feat(cli): opt-in terminal bell when a turn finishes or approval is needed (#10182)

Co-authored-by: Lifei Zhou <lifei@squareup.com>
This commit is contained in:
jlmalone
2026-09-09 23:30:59 +00:00
committed by GitHub
parent fae91d0114
commit bded379069
5 changed files with 32 additions and 1 deletions
+2 -1
View File
@@ -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"
)
}
+7
View File
@@ -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<Permission> {
output::hide_thinking();
output::emit_attention_bell();
output::render_tool_confirmation(
&request.tool_name,
+21
View File
@@ -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::<bool>("GOOSE_CLI_BELL")
.unwrap_or(false)
}
pub fn get_theme() -> Theme {
CURRENT_THEME.with(|t| *t.borrow())
}
@@ -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 |
@@ -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 |