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:
@@ -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())
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user