The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(cli,tui): add display.bell_on_clarify — terminal bell on clarify prompts
Turgut Kuralef6d3367a641
diff --git a/cli-config.yaml.example b/cli-config.yaml.exampleindex c3d83a28e78..ce459c12f16 100644--- a/cli-config.yaml.example+++ b/cli-config.yaml.example@@ -1768,6 +1768,12 @@ display:# false: Silent (default)bell_on_complete: false+ # Play terminal bell when the agent asks a clarification question.+ # Same mechanism as bell_on_complete (\\a) — works over SSH.+ # true: Ring on every clarify prompt+ # false: Silent (default)+ bell_on_clarify: false+# Show model reasoning/thinking before each response.# When enabled, a dim box shows the model's thought process above the response.# Toggle at runtime with /reasoning show or /reasoning hide.diff --git a/cli.py b/cli.pyindex e7dfd7fddc8..cb58316749a 100644--- a/cli.py+++ b/cli.py@@ -5259,6 +5259,8 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):self.resume_display = CLI_CONFIG["display"].get("resume_display", "full")# bell_on_complete: play terminal bell (\a) when agent finishes a responseself.bell_on_complete = CLI_CONFIG["display"].get("bell_on_complete", False)+ # bell_on_clarify: play terminal bell (\a) when agent asks a clarify question — same mechanism as bell_on_complete+ self.bell_on_clarify = CLI_CONFIG["display"].get("bell_on_clarify", False)# show_reasoning: display model thinking/reasoning before the responseself.show_reasoning = CLI_CONFIG["display"].get("show_reasoning", True)# reasoning_full: when reasoning display is on, print the post-response@@ -16211,6 +16213,14 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):self._clarify_freetext = is_open_endedself._clarify_multi_base = None+ # Bell on clarify (same mechanism as bell_on_complete — \\a over SSH)+ if getattr(self, "bell_on_clarify", False):+ try:+ sys.stdout.write("\a")+ sys.stdout.flush()+ except Exception:+ pass+# Trigger an immediate prompt_toolkit repaint from this (non-main)# thread. Modal prompts must paint at once and must not be gated by the# _invalidate throttle / resize guard — see _paint_now / _invalidate (#41098).@@ -16402,6 +16412,12 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):self._clarify_state = stateself._clarify_batch_set_active(state, 0)self._clarify_deadline = None if timeout <= 0 else _time.monotonic() + timeout+ if getattr(self, "bell_on_clarify", False):+ try:+ sys.stdout.write("\a")+ sys.stdout.flush()+ except Exception:+ passself._paint_now()_last_countdown_refresh = _time.monotonic()diff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.pyindex 7bce1e561aa..26f7782746a 100644--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@ -1475,6 +1475,7 @@ DEFAULT_CONFIG = {# dashboard. Set false to suppress the hint."tui_agents_nudge": True,"bell_on_complete": False,+ "bell_on_clarify": False,# Stream the model's reasoning/thinking live before the response.# Default ON: on thinking models the reasoning phase can run tens of# seconds, and with this off the user stares at a spinner the wholediff --git a/ui-tui/src/app/createGatewayEventHandler.ts b/ui-tui/src/app/createGatewayEventHandler.tsindex 33f8096bd05..48c165f643b 100644--- a/ui-tui/src/app/createGatewayEventHandler.ts+++ b/ui-tui/src/app/createGatewayEventHandler.ts@@ -420,7 +420,7 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:const { rpc } = ctx.gatewayconst { STARTUP_RESUME_ID, newSession, recoverSidRef, resumeById, setCatalog } = ctx.session- const { bellOnComplete, stdout, sys } = ctx.system+ const { bellOnClarify, bellOnComplete, stdout, sys } = ctx.systemconst { appendMessage, panel, setHistoryItems } = ctx.transcriptconst { setInput } = ctx.composerconst { submitLiteralRef, submitRef } = ctx.submission@@ -1250,6 +1250,10 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:}})setStatus('waiting for input…')+ // Same BEL mechanism as bell_on_complete — works over SSH, triggers tmux bell-action+ if (bellOnClarify && stdout?.isTTY) {+ stdout.write('\x07')+ }return}diff --git a/ui-tui/src/app/interfaces.ts b/ui-tui/src/app/interfaces.tsindex 0f4b9cb6ac8..c19b35e5b70 100644--- a/ui-tui/src/app/interfaces.ts+++ b/ui-tui/src/app/interfaces.ts@@ -498,6 +498,7 @@ export interface GatewayEventHandlerContext {}system: {bellOnComplete: boolean+ bellOnClarify?: booleanstdout?: NodeJS.WriteStreamsys: (text: string) => void}diff --git a/ui-tui/src/app/useConfigSync.ts b/ui-tui/src/app/useConfigSync.tsindex 32e5b4f4626..2139cd72c1c 100644--- a/ui-tui/src/app/useConfigSync.ts+++ b/ui-tui/src/app/useConfigSync.ts@@ -253,10 +253,11 @@ const _pasteCollapseCharsFromConfig = (cfg: ConfigFullResponse | null): number =export async function hydrateFullConfig(gw: GatewayClient,setBell: (v: boolean) => void,- setVoiceRecordKey?: (v: ParsedVoiceRecordKey) => void+ setVoiceRecordKey?: (v: ParsedVoiceRecordKey) => void,+ setBellOnClarify?: (v: boolean) => void): Promise<ConfigFullResponse | null> {const cfg = await quietRpc<ConfigFullResponse>(gw, 'config.get', { key: 'full' })- applyDisplay(cfg, setBell, setVoiceRecordKey)+ applyDisplay(cfg, setBell, setVoiceRecordKey, setBellOnClarify)return cfg}@@ -264,12 +265,14 @@ export async function hydrateFullConfig(export const applyDisplay = (cfg: ConfigFullResponse | null,setBell: (v: boolean) => void,- setVoiceRecordKey?: (v: ParsedVoiceRecordKey) => void+ setVoiceRecordKey?: (v: ParsedVoiceRecordKey) => void,+ setBellOnClarify?: (v: boolean) => void) => {const d = cfg?.config?.display ?? {}const approvals = cfg?.config?.approvalssetBell(!!d.bell_on_complete)+ if (setBellOnClarify) setBellOnClarify(!!d.bell_on_clarify)applyConfiguredTuiTheme(d.tui_theme)@@ -314,6 +317,7 @@ export const applyDisplay = (export function useConfigSync({gw,setBellOnComplete,+ setBellOnClarify,setVoiceEnabled,setVoiceRecordKey,sid@@ -339,8 +343,8 @@ export function useConfigSync({// mcp_rev) look like an MCP change and fire a needless reload.mcp.mcpRevRef.current.accepted = String(r?.mcp_rev ?? '')})- void hydrateFullConfig(gw, setBellOnComplete, setVoiceRecordKey)- }, [gw, setBellOnComplete, setVoiceEnabled, setVoiceRecordKey, sid])+ void hydrateFullConfig(gw, setBellOnComplete, setVoiceRecordKey, setBellOnClarify)+ }, [gw, setBellOnComplete, setBellOnClarify, setVoiceEnabled, setVoiceRecordKey, sid])useEffect(() => {if (!sid) {@@ -387,17 +391,18 @@ export function useConfigSync({)}- void hydrateFullConfig(gw, setBellOnComplete, setVoiceRecordKey)+ void hydrateFullConfig(gw, setBellOnComplete, setVoiceRecordKey, setBellOnClarify)})}, MTIME_POLL_MS)return () => clearInterval(id)- }, [gw, setBellOnComplete, setVoiceRecordKey, sid])+ }, [gw, setBellOnComplete, setBellOnClarify, setVoiceRecordKey, sid])}export interface UseConfigSyncOptions {gw: GatewayClientsetBellOnComplete: (v: boolean) => void+ setBellOnClarify?: (v: boolean) => voidsetVoiceEnabled: (v: boolean) => voidsetVoiceRecordKey?: (v: ParsedVoiceRecordKey) => voidsid: null | stringdiff --git a/ui-tui/src/app/useMainApp.ts b/ui-tui/src/app/useMainApp.tsindex 4a794fc29ba..bbd158f4f22 100644--- a/ui-tui/src/app/useMainApp.ts+++ b/ui-tui/src/app/useMainApp.ts@@ -207,6 +207,7 @@ export function useMainApp(gw: GatewayClient) {// Bumped by the gateway `reaction` event (core-detected affection).const goodVibesTick = useStore($goodVibesTick)const [bellOnComplete, setBellOnComplete] = useState(false)+ const [bellOnClarify, setBellOnClarify] = useState(false)const ui = useStore($uiState)const overlay = useStore($overlayState)@@ -578,7 +579,7 @@ export function useMainApp(gw: GatewayClient) {}}, [ui.busy, turnStartedAt])- useConfigSync({ gw, setBellOnComplete, setVoiceEnabled, setVoiceRecordKey, sid: ui.sid })+ useConfigSync({ gw, setBellOnComplete, setBellOnClarify, setVoiceEnabled, setVoiceRecordKey, sid: ui.sid })useBatteryPoll(gw)useEffect(() => {@@ -857,7 +858,7 @@ export function useMainApp(gw: GatewayClient) {setCatalog},submission: { submitLiteralRef, submitRef },- system: { bellOnComplete, stdout, sys },+ system: { bellOnComplete, bellOnClarify, stdout, sys },transcript: { appendMessage, panel, setHistoryItems },voice: {setProcessing: setVoiceProcessing,@@ -868,6 +869,7 @@ export function useMainApp(gw: GatewayClient) {}),[appendMessage,+ bellOnClarify,bellOnComplete,composerActions.setInput,gateway,diff --git a/ui-tui/src/gatewayTypes.ts b/ui-tui/src/gatewayTypes.tsindex 5b81b2f7d6c..087271c9479 100644--- a/ui-tui/src/gatewayTypes.ts+++ b/ui-tui/src/gatewayTypes.ts@@ -79,6 +79,7 @@ export type CommandDispatchResponse =export interface ConfigDisplayConfig {battery?: booleanbell_on_complete?: boolean+ bell_on_clarify?: booleanbusy_input_mode?: stringdetails_mode?: string/** Focus view (/focus) — display-only reduced-output mode. */diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.mdindex 2e2778760d6..581418ab845 100644--- a/website/docs/user-guide/configuration.md+++ b/website/docs/user-guide/configuration.md@@ -1909,6 +1909,7 @@ display:cli_multiline_shortcuts: true # CLI: Ctrl+J, \ + Enter, and supported Shift+Enter insert newlines (false = legacy c-j submit fallback)resume_display: full # full (show previous messages on resume) | minimal (one-liner only)bell_on_complete: false # Play terminal bell when agent finishes (great for long tasks)+ bell_on_clarify: false # Play terminal bell when the agent asks a clarification question (same BEL mechanism, works over SSH)show_reasoning: true # Show model reasoning/thinking above each response (default: true; toggle with /reasoning show|hide)streaming: false # Stream tokens to terminal as they arrive (real-time output)show_cost: false # Show estimated $ cost in the CLI status bar