The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): keep English stop defaults, Unicode-safe matching, configurable barge-in (#117801)
brooklyn!cb7b1b32dd6d
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation.ts b/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation.tsindex 4ddc69189c7..3ce46e438a1 100644--- a/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation.ts+++ b/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation.ts@@ -13,6 +13,7 @@ import {import { isVoiceStopCommand } from '@/lib/voice-stop-word'import { notify, notifyError } from '@/store/notifications'import { $voicePlayback } from '@/store/voice-playback'+import { $bargeInThresholdMultiplier } from '@/store/voice-prefs'import { useComposerScope } from '../scope'@@ -393,6 +394,7 @@ export function useVoiceConversation({stopBargeMonitorRef.current = monitorSpeechDuringPlayback({isPlaying: () => $voicePlayback.get().status === 'speaking',+ thresholdMultiplier: $bargeInThresholdMultiplier.get(),onSpeech: () => {bargeCapturePendingRef.current = truebargedRef.current = truediff --git a/apps/desktop/src/app/session/hooks/use-hermes-config.ts b/apps/desktop/src/app/session/hooks/use-hermes-config.tsindex 0b9b3ef9589..63bbe7cefd5 100644--- a/apps/desktop/src/app/session/hooks/use-hermes-config.ts+++ b/apps/desktop/src/app/session/hooks/use-hermes-config.ts@@ -20,6 +20,7 @@ import {import { refreshVoiceLiveStatus } from '@/store/voice-live'import {applyAutoSpeakFromConfig,+ applyBargeInThresholdFromConfig,applyThinkingSoundFromConfig,applyVoiceStopPhraseFromConfig} from '@/store/voice-prefs'@@ -150,7 +151,8 @@ export function useHermesConfig({ activeSessionIdRef }: HermesConfigOptions) {}applyAutoSpeakFromConfig(config)- applyVoiceStopPhraseFromConfig(config)+ applyVoiceStopPhraseFromConfig(config, defaults)+ applyBargeInThresholdFromConfig(config)applyThinkingSoundFromConfig(config)// Resolved server-side (mode + whether a key resolves); non-critical.void refreshVoiceLiveStatus().catch(() => undefined)diff --git a/apps/desktop/src/lib/voice-barge-in.test.ts b/apps/desktop/src/lib/voice-barge-in.test.tsnew file mode 100644index 00000000000..2853cbf53f1--- /dev/null+++ b/apps/desktop/src/lib/voice-barge-in.test.ts@@ -0,0 +1,107 @@+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'++import { bargeInTriggerLevels, DEFAULT_BARGE_IN_THRESHOLD_MULTIPLIER, monitorSpeechDuringPlayback } from './voice-barge-in'++// Drive the real monitor with a fake mic: `micLevel` is the byte-domain RMS+// level the analyser reports, `playing` is the TTS-flowing flag, and each+// `advance(ms)` runs one animation frame per 16ms of simulated time.+let now = 0+let micLevel = 0+let frames: FrameRequestCallback[] = []++beforeEach(() => {+ now = 1_000_000+ micLevel = 0+ frames = []+ vi.spyOn(Date, 'now').mockImplementation(() => now)+ vi.stubGlobal('requestAnimationFrame', (cb: FrameRequestCallback) => frames.push(cb))+ vi.stubGlobal('cancelAnimationFrame', () => undefined)+ vi.stubGlobal(+ 'AudioContext',+ class {+ createAnalyser() {+ return {+ fftSize: 256,+ getByteTimeDomainData: (data: Uint8Array) => data.fill(128 + Math.round(micLevel * 42))+ }+ }++ createMediaStreamSource() {+ return { connect: () => undefined }+ }++ close() {+ return Promise.resolve()+ }+ }+ )+ Object.defineProperty(navigator, 'mediaDevices', {+ configurable: true,+ value: { getUserMedia: async () => ({ getTracks: () => [{ stop: () => undefined }] }) }+ })+})++afterEach(() => {+ vi.restoreAllMocks()+ vi.unstubAllGlobals()+})++async function flushMicrotasks() {+ for (let i = 0; i < 5; i += 1) {+ await Promise.resolve()+ }+}++function advance(ms: number) {+ for (let elapsed = 0; elapsed < ms; elapsed += 16) {+ now += 16+ const pending = frames+ frames = []+ pending.forEach(cb => cb(now))+ }+}++/** Quiet room, then TTS starts and the user talks over it at `speechLevel`. */+async function talkOverPlayback(speechLevel: number, thresholdMultiplier?: number | null) {+ let playing = false+ const onSpeech = vi.fn()+ const stop = monitorSpeechDuringPlayback({ isPlaying: () => playing, onSpeech, thresholdMultiplier })++ await flushMicrotasks()+ advance(600) // calibrate the quiet floor+ playing = true+ advance(700) // past the playback-onset grace window+ micLevel = speechLevel+ advance(800)+ stop()++ return onSpeech.mock.calls.length > 0+}++describe('monitorSpeechDuringPlayback — voice.barge_in_threshold_multiplier (#117801)', () => {+ // ~0.095: a Bluetooth HFP headset's speech level during playback, below the+ // stock playback clamp.+ const HFP_SPEECH_LEVEL = 0.095++ it('a quiet headset cannot interrupt playback at the stock sensitivity', async () => {+ expect(await talkOverPlayback(HFP_SPEECH_LEVEL)).toBe(false)+ expect(await talkOverPlayback(HFP_SPEECH_LEVEL, DEFAULT_BARGE_IN_THRESHOLD_MULTIPLIER)).toBe(false)+ })++ it('a lower configured multiplier lets the same headset interrupt playback', async () => {+ expect(await talkOverPlayback(HFP_SPEECH_LEVEL, 1.5)).toBe(true)+ })++ it('a higher configured multiplier makes playback harder to interrupt', async () => {+ const loud = bargeInTriggerLevels().playbackMinTrigger + 0.03++ expect(await talkOverPlayback(loud)).toBe(true)+ expect(await talkOverPlayback(loud, DEFAULT_BARGE_IN_THRESHOLD_MULTIPLIER * 2)).toBe(false)+ })++ it('invalid multipliers keep the stock trigger levels', () => {+ for (const value of [null, undefined, 0, -1, Number.NaN, Number.POSITIVE_INFINITY]) {+ expect(bargeInTriggerLevels(value)).toEqual(bargeInTriggerLevels(DEFAULT_BARGE_IN_THRESHOLD_MULTIPLIER))+ }+ })+})diff --git a/apps/desktop/src/lib/voice-barge-in.ts b/apps/desktop/src/lib/voice-barge-in.tsindex 4d521f33d1b..1c3685f7881 100644--- a/apps/desktop/src/lib/voice-barge-in.ts+++ b/apps/desktop/src/lib/voice-barge-in.ts@@ -16,6 +16,10 @@// - During playback the trigger is additionally clamped up to a minimum so// bleed alone can't trip it, and capped so speech always remains reachable.// - A short grace window after playback onset suppresses the start transient.+// - `voice.barge_in_threshold_multiplier` (the backend's sensitivity knob)+// scales the quiet-floor multiplier AND the playback clamp relative to the+// backend default, so a Bluetooth HFP headset whose mic sits below the stock+// playback clamp can still interrupt (#117801). Unset keeps the stock levels.// - Detection is a windowed majority (>=80% of the last SUSTAINED_MS above// trigger) so intra-word energy dips don't reset progress.@@ -28,6 +32,9 @@ const FLOOR_MULTIPLIER = 3.5// ≈ byte-domain level 0.14 / 0.37 with the /42 normalization below).const PLAYBACK_MIN_TRIGGER_LEVEL = 0.14const TRIGGER_CEILING_LEVEL = 0.37+// Backend default for voice.barge_in_threshold_multiplier+// (tools/voice_mode.DEFAULT_BARGE_MULTIPLIER); the levels above are tuned for it.+export const DEFAULT_BARGE_IN_THRESHOLD_MULTIPLIER = 3const PLAYBACK_GRACE_MS = 500const PLAYBACK_GAP_FOR_GRACE_MS = 1_000const FLOOR_SAMPLE_CAP = 200 // ~3s of quiet-phase levels at rAF cadence@@ -50,9 +57,33 @@ export interface BargeMonitorCallbacks {* the old behavior of a monitor opened at playback start.*/isPlaying?: () => boolean+ /**+ * `voice.barge_in_threshold_multiplier`. Lower = more sensitive. Omitted,+ * null, or non-positive keeps the stock trigger levels.+ */+ thresholdMultiplier?: number | null+}++export interface BargeTriggerLevels {+ /** Trigger = quiet floor x this (never below MIN_TRIGGER_LEVEL). */+ floorMultiplier: number+ /** Minimum trigger while TTS plays, so speaker bleed alone can't trip. */+ playbackMinTrigger: number+}++/** Trigger levels for a configured `voice.barge_in_threshold_multiplier`,+ * scaled from the stock levels by its ratio to the backend default. */+export function bargeInTriggerLevels(thresholdMultiplier?: number | null): BargeTriggerLevels {+ const scale =+ typeof thresholdMultiplier === 'number' && Number.isFinite(thresholdMultiplier) && thresholdMultiplier > 0+ ? thresholdMultiplier / DEFAULT_BARGE_IN_THRESHOLD_MULTIPLIER+ : 1++ return { floorMultiplier: FLOOR_MULTIPLIER * scale, playbackMinTrigger: PLAYBACK_MIN_TRIGGER_LEVEL * scale }}export function monitorSpeechDuringPlayback(callbacks: BargeMonitorCallbacks): () => void {+ const { floorMultiplier, playbackMinTrigger } = bargeInTriggerLevels(callbacks.thresholdMultiplier)let disposed = falselet stream: MediaStream | null = nulllet context: AudioContext | null = null@@ -250,10 +281,10 @@ export function monitorSpeechDuringPlayback(callbacks: BargeMonitorCallbacks): (// Phase-aware trigger: quiet baseline x multiplier; playback clamps// it up (bleed alone can't trip) but a ceiling keeps speech// reachable even over loud playback.- let trigger = Math.max(MIN_TRIGGER_LEVEL, quietFloor * FLOOR_MULTIPLIER)+ let trigger = Math.max(MIN_TRIGGER_LEVEL, quietFloor * floorMultiplier)if (playing) {- trigger = Math.min(Math.max(trigger, PLAYBACK_MIN_TRIGGER_LEVEL), TRIGGER_CEILING_LEVEL)+ trigger = Math.min(Math.max(trigger, playbackMinTrigger), TRIGGER_CEILING_LEVEL)}// Track ambient drift while quiet and below trigger.diff --git a/apps/desktop/src/lib/voice-stop-word.test.ts b/apps/desktop/src/lib/voice-stop-word.test.tsindex 517df48455c..23c88a379b8 100644--- a/apps/desktop/src/lib/voice-stop-word.test.ts+++ b/apps/desktop/src/lib/voice-stop-word.test.ts@@ -71,6 +71,20 @@ describe('isVoiceStopCommand', () => {expect(isVoiceStopCommand('goodbye', config)).toBe(false)})+ it('matches configured phrases regardless of Unicode form and script punctuation (#117801)', () => {+ const config = { mode: 'custom' as const, phrases: ['отбой', 'стоп', '停止'] }++ // Whisper can emit decomposed (NFD) Cyrillic: "й" as "и" + combining breve.+ expect(isVoiceStopCommand('Отбой.'.normalize('NFD'), config)).toBe(true)+ expect(isVoiceStopCommand('«Стоп»', config)).toBe(true)+ expect(isVoiceStopCommand('停止。', config)).toBe(true)+ expect(isVoiceStopCommand('стоп машина', config)).toBe(false)+ })++ it('matches the built-in list with typographic apostrophes', () => {+ expect(isVoiceStopCommand('That’s all.', { mode: 'default' })).toBe(true)+ })+it('disables spoken stop when voice.stop_phrases is an empty list', () => {expect(isVoiceStopCommand('stop', { mode: 'disabled' })).toBe(false)expect(isVoiceStopCommand('отбой', { mode: 'disabled' })).toBe(false)diff --git a/apps/desktop/src/lib/voice-stop-word.ts b/apps/desktop/src/lib/voice-stop-word.tsindex ae272046b88..1742545183d 100644--- a/apps/desktop/src/lib/voice-stop-word.ts+++ b/apps/desktop/src/lib/voice-stop-word.ts@@ -12,14 +12,15 @@// the word "stop" — e.g. "stop the docker container" or "how do I stop a// running process" — is never swallowed.//-// Config: when `voice.stop_phrases` is set, those phrases are matched (any-// language). When the key is absent, the built-in English list below is used.-// An explicit empty list disables spoken stop entirely — mirroring+// Config: a customised `voice.stop_phrases` replaces the built-in English list+// (any language). Absent or left at the backend default, the English list below+// is used. An explicit empty list disables spoken stop entirely — mirroring// `tools.voice_mode.is_voice_stop_phrase` (#117801).import { $voiceStopPhraseConfig, type VoiceStopPhraseConfig } from '@/store/voice-prefs'-// Canonical English stop commands used when `voice.stop_phrases` is unset.+// Canonical English stop commands used while `voice.stop_phrases` is unset or+// still the backend default (see `applyVoiceStopPhraseFromConfig`).const STOP_PHRASES: readonly string[] = ['stop','stop listening',@@ -43,13 +44,16 @@ const STOP_PHRASES: readonly string[] = [// still count. Stripped before matching the core phrase.const ADDRESS_PREFIXES: readonly string[] = ['hey hermes', 'hey hermes,', 'hermes', 'hermes,', 'ok', 'okay', 'hey']-// Normalise: lowercase, strip surrounding punctuation/whitespace, collapse-// internal runs of spaces. Trailing punctuation (".", "!", "…") is common in-// STT output and must not defeat the match.+// Normalise: Unicode-compose (so an NFD "отбой" from STT equals the NFC phrase+// in config.yaml), lowercase, turn punctuation from ANY script into spaces+// ("стоп!", "«отбой»", "停止。"), collapse whitespace. Transcripts and+// configured phrases go through the same function, so the match stays exact —+// like the backend's `is_voice_stop_phrase` — just punctuation-insensitive.function normalize(text: string): string {return text+ .normalize('NFKC').toLowerCase()- .replace(/[.,!?;:…]+/g, ' ')+ .replace(/\p{P}+/gu, ' ').replace(/\s+/g, ' ').trim()}@@ -69,6 +73,8 @@ function stripAddress(text: string): string {return text}+const DEFAULT_PHRASES = STOP_PHRASES.map(normalize)+function phrasesForConfig(config: VoiceStopPhraseConfig): readonly string[] | null {if (config.mode === 'disabled') {return null@@ -78,7 +84,7 @@ function phrasesForConfig(config: VoiceStopPhraseConfig): readonly string[] | nureturn config.phrases.map(normalize).filter(phrase => phrase.length > 0)}- return STOP_PHRASES+ return DEFAULT_PHRASES}/**diff --git a/apps/desktop/src/store/voice-prefs.test.ts b/apps/desktop/src/store/voice-prefs.test.tsindex 21db2320b91..3cf9c7e94f6 100644--- a/apps/desktop/src/store/voice-prefs.test.ts+++ b/apps/desktop/src/store/voice-prefs.test.ts@@ -6,8 +6,15 @@ vi.mock('@/hermes', () => ({}))import { saveHermesConfig } from '@/hermes'+import { isVoiceStopCommand } from '@/lib/voice-stop-word'-import { $voiceStopPhrase, $voiceStopPhraseConfig, applyVoiceStopPhraseFromConfig } from './voice-prefs'+import {+ $bargeInThresholdMultiplier,+ $voiceStopPhrase,+ $voiceStopPhraseConfig,+ applyBargeInThresholdFromConfig,+ applyVoiceStopPhraseFromConfig+} from './voice-prefs'it('keeps the desktop toggle local across config refreshes', async () => {for (const fails of [false, true]) {@@ -104,3 +111,63 @@ describe('applyVoiceStopPhraseFromConfig', () => {expect($voiceStopPhraseConfig.get()).toEqual({ mode: 'disabled' })})})++// The live matcher reads the atoms these seed, so drive it through them the way+// `useHermesConfig` does: `/api/config` (defaults merged in) + `/api/config/defaults`.+describe('spoken stop follows the loaded voice.stop_phrases (#117801)', () => {+ const defaults = { voice: { stop_phrases: ['stop'] } }++ it('a configured Russian list ends the chat and replaces the English list', () => {+ applyVoiceStopPhraseFromConfig({ voice: { stop_phrases: ['отбой', 'стоп', 'stop'] } }, defaults)++ expect(isVoiceStopCommand('Отбой.')).toBe(true)+ expect(isVoiceStopCommand('стоп')).toBe(true)+ expect(isVoiceStopCommand('goodbye')).toBe(false)+ })++ it('an untouched install (merged backend default) keeps the built-in English list', () => {+ applyVoiceStopPhraseFromConfig({ voice: { stop_phrases: ['stop'] } }, defaults)++ expect($voiceStopPhrase.get()).toBe('stop')+ expect(isVoiceStopCommand('goodbye')).toBe(true)+ expect(isVoiceStopCommand('never mind')).toBe(true)++ // Defaults endpoint unavailable: still recognised as the backend default.+ applyVoiceStopPhraseFromConfig({ voice: { stop_phrases: ['stop'] } }, {})+ expect(isVoiceStopCommand('goodbye')).toBe(true)+ })++ it('a malformed value falls back to the default like the backend', () => {+ applyVoiceStopPhraseFromConfig({ voice: { stop_phrases: { ru: 'отбой' } } }, defaults)++ expect($voiceStopPhrase.get()).toBe('stop')+ expect(isVoiceStopCommand('stop')).toBe(true)+ })++ it('an empty list disables spoken stop', () => {+ applyVoiceStopPhraseFromConfig({ voice: { stop_phrases: [] } }, defaults)++ expect(isVoiceStopCommand('stop')).toBe(false)+ })+})++describe('applyBargeInThresholdFromConfig', () => {+ it('adopts a positive voice.barge_in_threshold_multiplier', () => {+ applyBargeInThresholdFromConfig({ voice: { barge_in_threshold_multiplier: 1.5 } })+ expect($bargeInThresholdMultiplier.get()).toBe(1.5)++ applyBargeInThresholdFromConfig({ voice: { barge_in_threshold_multiplier: '2' } })+ expect($bargeInThresholdMultiplier.get()).toBe(2)+ })++ it('unset, zero, or malformed values leave the stock sensitivity', () => {+ for (const voice of [{}, { barge_in_threshold_multiplier: 0 }, { barge_in_threshold_multiplier: 'loud' }]) {+ applyBargeInThresholdFromConfig({ voice: { barge_in_threshold_multiplier: 1.5 } })+ applyBargeInThresholdFromConfig({ voice })+ expect($bargeInThresholdMultiplier.get()).toBeNull()+ }++ applyBargeInThresholdFromConfig(null)+ expect($bargeInThresholdMultiplier.get()).toBeNull()+ })+})diff --git a/apps/desktop/src/store/voice-prefs.ts b/apps/desktop/src/store/voice-prefs.tsindex 960ab310f22..c5e9051f22b 100644--- a/apps/desktop/src/store/voice-prefs.ts+++ b/apps/desktop/src/store/voice-prefs.ts@@ -15,11 +15,15 @@ export function applyAutoSpeakFromConfig(config: { voice?: { auto_tts?: unknown}}+// Backend default for `voice.stop_phrases` (DEFAULT_VOICE_STOP_PHRASES in+// tools/voice_mode_transcript.py), used until `/api/config/defaults` answers.+const BACKEND_DEFAULT_STOP_PHRASES: readonly string[] = ['stop']+// First configured `voice.stop_phrases` entry — drives the "Say "stop" to end// the voice chat" notice shown when a voice conversation starts. `null` means// the user disabled stop phrases (`stop_phrases: []`), so no notice is shown.// Defaults to "stop" (the backend default) before config loads.-export const $voiceStopPhrase = atom<string | null>('stop')+export const $voiceStopPhrase = atom<string | null>(BACKEND_DEFAULT_STOP_PHRASES[0])/** How the desktop matcher should treat `voice.stop_phrases` (#117801). */export type VoiceStopPhraseConfig =@@ -31,25 +35,73 @@ export type VoiceStopPhraseConfig =// stop recognizer honours the same list the notice advertises.export const $voiceStopPhraseConfig = atom<VoiceStopPhraseConfig>({ mode: 'default' })-/** Seed the stop-phrase atoms from a loaded config payload (mount / refresh). */-export function applyVoiceStopPhraseFromConfig(- config: { voice?: { stop_phrases?: unknown } | null } | null | undefined-) {- const raw = config?.voice?.stop_phrases+type ConfigPayload = Record<string, unknown> | { voice?: object | null } | null | undefined++function voiceValue(config: ConfigPayload, key: string): unknown {+ const voice = (config as { voice?: unknown } | null | undefined)?.voice++ return voice && typeof voice === 'object' ? (voice as Record<string, unknown>)[key] : undefined+}++/** Parse `voice.stop_phrases` like `_load_voice_stop_phrases`: a bare string+ * counts as one phrase, non-text entries are skipped, and anything that is not+ * a list or string (absent, null, a mapping) means "backend default" (`null`). */+function stopPhraseList(raw: unknown): string[] | null {+ const list = typeof raw === 'string' ? [raw] : Array.isArray(raw) ? raw : null++ return (+ list+ ?.filter(entry => typeof entry === 'string' || typeof entry === 'number')+ .map(entry => String(entry).trim())+ .filter(entry => entry.length > 0) ?? null+ )+}- if (raw === undefined) {- // Key absent — backend default + built-in English matcher list.- $voiceStopPhrase.set('stop')+function samePhrases(a: readonly string[], b: readonly string[]): boolean {+ return a.length === b.length && a.every((phrase, i) => phrase.toLowerCase() === b[i].toLowerCase())+}++/**+ * Seed the stop-phrase atoms from a loaded config payload (mount / refresh).+ *+ * `/api/config` merges DEFAULT_CONFIG, so an untouched install reports the+ * backend default (`["stop"]`) rather than omitting the key. Pass the+ * `/api/config/defaults` payload so that case keeps the built-in English+ * matcher list; only a list the user actually changed replaces it.+ */+export function applyVoiceStopPhraseFromConfig(config: ConfigPayload, defaults?: ConfigPayload) {+ const phrases = stopPhraseList(voiceValue(config, 'stop_phrases'))++ if (phrases === null) {+ // Key absent or malformed — backend default + built-in English matcher list.+ $voiceStopPhrase.set(BACKEND_DEFAULT_STOP_PHRASES[0])$voiceStopPhraseConfig.set({ mode: 'default' })return}- const list = Array.isArray(raw) ? raw : typeof raw === 'string' ? [raw] : []- const phrases = list.map(entry => String(entry).trim()).filter(entry => entry.length > 0)+ const defaultPhrases = stopPhraseList(voiceValue(defaults, 'stop_phrases')) ?? BACKEND_DEFAULT_STOP_PHRASES$voiceStopPhrase.set(phrases[0] ?? null)- $voiceStopPhraseConfig.set(phrases.length > 0 ? { mode: 'custom', phrases } : { mode: 'disabled' })+ $voiceStopPhraseConfig.set(+ phrases.length === 0+ ? { mode: 'disabled' }+ : samePhrases(phrases, defaultPhrases)+ ? { mode: 'default' }+ : { mode: 'custom', phrases }+ )+}++// `voice.barge_in_threshold_multiplier` — barge-in sensitivity shared with the+// CLI/TUI full-duplex listener. `null` = unset/invalid, so the monitor keeps its+// built-in trigger levels (same as the backend's `float(v or 0)` → default).+export const $bargeInThresholdMultiplier = atom<number | null>(null)++/** Seed the barge-in sensitivity from a loaded config payload. */+export function applyBargeInThresholdFromConfig(config: ConfigPayload) {+ const value = Number(voiceValue(config, 'barge_in_threshold_multiplier'))++ $bargeInThresholdMultiplier.set(Number.isFinite(value) && value > 0 ? value : null)}// `voice.thinking_sound` — ambient bubble blips while the agent works during adiff --git a/apps/desktop/src/types/hermes.ts b/apps/desktop/src/types/hermes.tsindex f1844f3a709..50ccd9d3572 100644--- a/apps/desktop/src/types/hermes.ts+++ b/apps/desktop/src/types/hermes.ts@@ -469,6 +469,7 @@ export interface HermesConfig {auto_tts?: booleanstop_phrases?: unknownthinking_sound?: unknown+ barge_in_threshold_multiplier?: unknown}}diff --git a/website/docs/user-guide/features/voice-mode.md b/website/docs/user-guide/features/voice-mode.mdindex a33f6dde884..6aab39939e5 100644--- a/website/docs/user-guide/features/voice-mode.md+++ b/website/docs/user-guide/features/voice-mode.md@@ -170,7 +170,7 @@ Both `silence_threshold` and `silence_duration` are configurable in `config.yaml### Ending a voice chat by voice-Say **"stop"** — and nothing else — to end the voice conversation hands-free. The match is deliberately strict: the whole utterance (case-insensitive, surrounding punctuation ignored) must equal a configured phrase, so "stop doing that and try X instead" still reaches the agent normally. Customize the phrase list with `voice.stop_phrases` in `config.yaml` (e.g. `["stop", "goodbye hermes"]`), or set it to `[]` to disable. A voice chat also ends on its own after three consecutive silent cycles (no speech detected).+Say **"stop"** — and nothing else — to end the voice conversation hands-free. The match is deliberately strict: the whole utterance (case-insensitive, surrounding punctuation ignored) must equal a configured phrase, so "stop doing that and try X instead" still reaches the agent normally. Customize the phrase list with `voice.stop_phrases` in `config.yaml` (e.g. `["stop", "goodbye hermes"]`), or set it to `[]` to disable. Phrases can be in any language (e.g. `["отбой", "стоп"]` with `stt.language: ru`). The desktop app honours the same list; while `voice.stop_phrases` is left at its default it also accepts a few English extras ("goodbye", "never mind", "cancel", …), and a customised list replaces them. A voice chat also ends on its own after three consecutive silent cycles (no speech detected).**Typing** a bare stop phrase while a voice chat is active works the same way on every surface (CLI, TUI, desktop): the message ends the voice chat instead of being sent to the agent. Outside a voice chat, typed "stop" is an ordinary message.@@ -229,7 +229,7 @@ You can interrupt the agent at ANY point in its turn — the microphone stays li- **Type or press the record key** — sending a new message or hitting the push-to-talk key stops playback instantly on every surface.- **Say "stop"** — the stop phrase works in both phases: mid-generation it interrupts the turn AND ends the voice chat; mid-playback it cuts the speech and ends the chat.-Tuning (config.yaml): `voice.barge_in: false` disables it; `voice.barge_in_threshold_multiplier` (default `3.0`) scales the speech trigger over the quiet-room floor; `voice.barge_in_grace_seconds` (default `0.5`) suppresses trips right after playback starts. Set `HERMES_VOICE_DEBUG=1` to stream per-block VAD diagnostics (calibrated floor, RMS, trip decisions) to stderr for live tuning.+Tuning (config.yaml): `voice.barge_in: false` disables it; `voice.barge_in_threshold_multiplier` (default `3.0`) scales the speech trigger over the quiet-room floor — lower is more sensitive; the desktop app also scales its playback-phase trigger by it, so a quiet Bluetooth headset that can't interrupt a reply can use e.g. `1.5`; `voice.barge_in_grace_seconds` (default `0.5`) suppresses trips right after playback starts. Set `HERMES_VOICE_DEBUG=1` to stream per-block VAD diagnostics (calibrated floor, RMS, trip decisions) to stderr for live tuning.The agent **knows** it was interrupted: the next message carries a short note telling the model its spoken reply was cut off, so it can react naturally ("rude!") or pick up where it left off instead of being oblivious.