Hook thinking status (#6815)

Signed-off-by: Trae Robrock <trobrock@gmail.com>
Co-authored-by: Trae Robrock <trobrock@gmail.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Douwe Osinga
2026-01-29 12:57:21 -05:00
committed by GitHub
parent a8f1980747
commit 35de0a21db
2 changed files with 29 additions and 0 deletions
+2
View File
@@ -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())
+27
View File
@@ -162,6 +162,33 @@ pub fn hide_thinking() {
}
}
pub fn run_status_hook(status: &str) {
if let Ok(hook) = Config::global().get_param::<String>("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())
}