diff --git a/crates/goose-cli/src/session/input.rs b/crates/goose-cli/src/session/input.rs index 7a2a1b693..c77863a21 100644 --- a/crates/goose-cli/src/session/input.rs +++ b/crates/goose-cli/src/session/input.rs @@ -471,7 +471,8 @@ Navigation: Enter - Send message Ctrl+{newline_key} - Add a newline (configurable via GOOSE_CLI_NEWLINE_KEY) Ctrl+C - Clear current line if text is entered, otherwise exit the session -Up/Down arrows - Navigate through command history" +Up/Down arrows - Navigate through command history +GOOSE_CLI_BELL=true - Ring the terminal bell when goose finishes a turn or needs approval" ) } diff --git a/crates/goose-cli/src/session/mod.rs b/crates/goose-cli/src/session/mod.rs index a6e22fcb7..49a665e61 100644 --- a/crates/goose-cli/src/session/mod.rs +++ b/crates/goose-cli/src/session/mod.rs @@ -1428,6 +1428,8 @@ impl CliSession { ) .await?; + output::emit_attention_bell(); + match planner_response_type { PlannerResponseType::Plan => { println!(); @@ -1810,6 +1812,10 @@ impl CliSession { } } + if interactive { + output::emit_attention_bell(); + } + Ok(()) } @@ -2334,6 +2340,7 @@ fn emit_stream_event(event: &StreamEvent) { /// Prompt user for tool call confirmation, returns the Permission selected fn prompt_tool_confirmation(request: &ToolConfirmationRequest) -> Result { output::hide_thinking(); + output::emit_attention_bell(); output::render_tool_confirmation( &request.tool_name, diff --git a/crates/goose-cli/src/session/output.rs b/crates/goose-cli/src/session/output.rs index a851049a9..f3db28a30 100644 --- a/crates/goose-cli/src/session/output.rs +++ b/crates/goose-cli/src/session/output.rs @@ -120,6 +120,27 @@ pub fn set_theme(theme: Theme) { } } +/// Ring the terminal bell so an unfocused terminal can badge or chime. +/// Opt-in via `GOOSE_CLI_BELL=true` (environment or config); terminals +/// decide how to surface it, typically only when the window lacks focus. +pub fn emit_attention_bell() { + if !bell_enabled() { + return; + } + let mut stdout = std::io::stdout(); + if !stdout.is_terminal() { + return; + } + let _ = stdout.write_all(b"\x07"); + let _ = stdout.flush(); +} + +fn bell_enabled() -> bool { + Config::global() + .get_param::("GOOSE_CLI_BELL") + .unwrap_or(false) +} + pub fn get_theme() -> Theme { CURRENT_THEME.with(|t| *t.borrow()) } diff --git a/documentation/docs/guides/config-files.md b/documentation/docs/guides/config-files.md index f555669a7..f7ed962d5 100644 --- a/documentation/docs/guides/config-files.md +++ b/documentation/docs/guides/config-files.md @@ -61,6 +61,7 @@ The following settings can be configured at the root level of your config.yaml f | `GOOSE_CLI_LIGHT_THEME` | Custom syntax highlighting theme for light mode | [bat theme name](https://github.com/sharkdp/bat#adding-new-themes) | "GitHub" | No | | `GOOSE_CLI_DARK_THEME` | Custom syntax highlighting theme for dark mode | [bat theme name](https://github.com/sharkdp/bat#adding-new-themes) | "zenburn" | No | | `GOOSE_CLI_SHOW_COST` | Show estimated cost for token use in the CLI | true/false | false | No | +| `GOOSE_CLI_BELL` | Ring the terminal bell when an interactive turn finishes or tool approval is required | true/false | false | No | | `GOOSE_ALLOWLIST` | URL for allowed extensions | Valid URL | None | No | | `GOOSE_DOCS_ROOT` | Documentation root used by `goose-doc-guide` (e.g. for offline/air-gapped docs) | Local path or HTTP(S) URL containing `goose-docs-map.md` and `docs/` | `https://goose-docs.ai` | No | | `GOOSE_RECIPE_GITHUB_REPO` | GitHub repository for recipes | Format: "org/repo" | None | No | diff --git a/documentation/docs/guides/environment-variables.md b/documentation/docs/guides/environment-variables.md index 3ef0f8e5e..a74f77c32 100644 --- a/documentation/docs/guides/environment-variables.md +++ b/documentation/docs/guides/environment-variables.md @@ -162,6 +162,7 @@ These variables control how goose manages conversation sessions and context. | `GOOSE_CLI_LIGHT_THEME` | Custom [bat theme](https://github.com/sharkdp/bat#adding-new-themes) for syntax highlighting when using light mode | bat theme name (e.g., "Solarized (light)", "OneHalfLight") | "GitHub" | | `GOOSE_CLI_DARK_THEME` | Custom [bat theme](https://github.com/sharkdp/bat#adding-new-themes) for syntax highlighting when using dark mode | bat theme name (e.g., "Dracula", "Nord") | "zenburn" | | `GOOSE_CLI_NEWLINE_KEY` | Customize the keyboard shortcut for [inserting newlines in CLI input](/docs/guides/goose-cli-commands#keyboard-shortcuts) | Single character (e.g., "n", "m") | "j" (Ctrl+J) | +| `GOOSE_CLI_BELL` | Ring the terminal bell when an interactive turn finishes or tool approval is required | "true", "false" | false | | `GOOSE_CLI_SHOW_THINKING` | Shows model reasoning/thinking output in CLI responses. Some models (e.g., DeepSeek-R1, Kimi, Gemini) expose their internal reasoning process — this variable makes it visible in the CLI. | Set to any value to enable | Disabled | | `GOOSE_RANDOM_THINKING_MESSAGES` | Controls whether to show amusing random messages during processing | "true", "false" | "true" | | `GOOSE_CLI_SHOW_COST` | Toggles display of model cost estimates in CLI output | "1", "true" (case-insensitive) to enable | false |