From 35de0a21db8f8fb2c95835cae6fb24f2faba6b5d Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Thu, 29 Jan 2026 12:57:21 -0500 Subject: [PATCH] Hook thinking status (#6815) Signed-off-by: Trae Robrock Co-authored-by: Trae Robrock Co-authored-by: Douwe Osinga Co-authored-by: Claude Sonnet 4.5 --- crates/goose-cli/src/session/mod.rs | 2 ++ crates/goose-cli/src/session/output.rs | 27 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/crates/goose-cli/src/session/mod.rs b/crates/goose-cli/src/session/mod.rs index 4e80a445..3bd1ad2d 100644 --- a/crates/goose-cli/src/session/mod.rs +++ b/crates/goose-cli/src/session/mod.rs @@ -461,6 +461,7 @@ impl CliSession { }) .collect(); + output::run_status_hook("waiting"); let input = input::get_input(&mut editor, Some(&conversation_strings))?; if matches!(input, InputResult::Exit) { break; @@ -595,6 +596,7 @@ impl CliSession { let _provider = self.agent.provider().await?; + output::run_status_hook("thinking"); output::show_thinking(); let start_time = Instant::now(); self.process_agent_response(true, CancellationToken::default()) diff --git a/crates/goose-cli/src/session/output.rs b/crates/goose-cli/src/session/output.rs index 0991335c..bdc8458e 100644 --- a/crates/goose-cli/src/session/output.rs +++ b/crates/goose-cli/src/session/output.rs @@ -162,6 +162,33 @@ pub fn hide_thinking() { } } +pub fn run_status_hook(status: &str) { + if let Ok(hook) = Config::global().get_param::("GOOSE_STATUS_HOOK") { + let status = status.to_string(); + std::thread::spawn(move || { + #[cfg(target_os = "windows")] + let result = std::process::Command::new("cmd") + .arg("/C") + .arg(format!("{} {}", hook, status)) + .stdin(std::process::Stdio::null()) + .stdout(std::process::Stdio::null()) + .stderr(std::process::Stdio::null()) + .status(); + + #[cfg(not(target_os = "windows"))] + let result = std::process::Command::new("sh") + .arg("-c") + .arg(format!("{} {}", hook, status)) + .stdin(std::process::Stdio::null()) + .stdout(std::process::Stdio::null()) + .stderr(std::process::Stdio::null()) + .status(); + + let _ = result; + }); + } +} + pub fn is_showing_thinking() -> bool { THINKING.with(|t| t.borrow().is_shown()) }