Skip to content

The agent that grows with you

fix(desktop): keep the wake-word ear mounted everywhere — paused only during voice chat

Teknium46faa4f63929
diff --git a/apps/desktop/src/app/chat/composer/controls.test.tsx b/apps/desktop/src/app/chat/composer/controls.test.tsx
index 90d38d27495..b35c280c732 100644
--- a/apps/desktop/src/app/chat/composer/controls.test.tsx
+++ b/apps/desktop/src/app/chat/composer/controls.test.tsx
@@ -3,6 +3,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
import type { ChatBarState } from '@/app/chat/composer/types'
import { I18nProvider } from '@/i18n'
+import { applyWakeStartResult, applyWakeStatus, resetWakeWordState } from '@/store/wake-word'
import { ComposerControls } from './controls'
@@ -77,3 +78,51 @@ describe('ComposerControls shortcut tooltips', () => {
await expectShortcutTooltip('Queue message', 'Ctrl+↵')
})
})
+
+describe('wake-word ear visibility', () => {
+ afterEach(() => {
+ resetWakeWordState()
+ })
+
+ it('stays mounted during a busy agent turn', () => {
+ applyWakeStatus({ available: true, enabled: true, listening: true, phrase: 'hey hermes' })
+ renderControls({ busy: true, busyAction: 'stop' })
+
+ expect(screen.getByLabelText('Wake word: "hey hermes" — listening')).toBeTruthy()
+ })
+
+ it('stays mounted (enabled in config) even when a start was refused', () => {
+ applyWakeStatus({ available: true, enabled: true, listening: false, phrase: 'hey hermes' })
+ // Transient refusal marks available false but enabled keeps it mounted.
+ applyWakeStartResult({ hint: 'mic busy', reason: 'unavailable', started: false })
+ renderControls()
+
+ expect(screen.getByLabelText('Wake word: "hey hermes" — off')).toBeTruthy()
+ })
+
+ it('hides only when unavailable AND not enabled in config', () => {
+ applyWakeStatus({ available: false, enabled: false, listening: false, phrase: 'hey hermes' })
+ renderControls()
+
+ expect(screen.queryByLabelText(/Wake word/)).toBeNull()
+ })
+
+ it('shows a disabled paused ear inside the voice-conversation pill', () => {
+ applyWakeStatus({ available: true, enabled: true, listening: true, phrase: 'hey hermes' })
+ renderControls({
+ conversation: {
+ active: true,
+ level: 0,
+ muted: false,
+ onEnd: vi.fn(),
+ onStart: vi.fn(),
+ onStopTurn: vi.fn(),
+ onToggleMute: vi.fn(),
+ status: 'listening'
+ }
+ })
+
+ const ear = screen.getByLabelText('Wake word: "hey hermes" — paused during voice chat')
+ expect((ear as HTMLButtonElement).disabled).toBe(true)
+ })
+})
diff --git a/apps/desktop/src/app/chat/composer/controls.tsx b/apps/desktop/src/app/chat/composer/controls.tsx
index 647a7647ba5..6e2ec91f49c 100644
--- a/apps/desktop/src/app/chat/composer/controls.tsx
+++ b/apps/desktop/src/app/chat/composer/controls.tsx
@@ -185,6 +185,9 @@ function ConversationPill({
return (
<div className="ml-auto flex shrink-0 items-center gap-(--composer-control-gap)">
+ {/* Keep the ear visible during voice chat — shown paused, since the
+ conversation holds the mic (the one time wake must not listen). */}
+ <WakeWordButton disabled={disabled} pausedForVoice />
<Tip label={muted ? c.unmuteMic : c.muteMic}>
<Button
aria-label={muted ? c.unmuteMic : c.muteMic}
@@ -298,35 +301,42 @@ function AutoSpeakButton({ active, disabled, onToggle }: { active: boolean; disa
)
}
-// "Hey Hermes" wake-word toggle. Three states: listening (accent-highlighted,
-// like the auto-speak toggle above), off (muted ear-off), and unavailable —
-// when the backend reports the wake word can't run, the button hides entirely
-// so the row stays clean. Backend refusals ({started:false, reason}) keep the
-// toggle off and surface the reason/hint in the tooltip.
-function WakeWordButton({ disabled }: { disabled: boolean }) {
+// "Hey Hermes" wake-word toggle. States: listening (accent-highlighted, like
+// the auto-speak toggle above), off (muted ear-off), paused-for-voice (shown
+// disabled while a voice conversation holds the mic — the one legitimate
+// pause), and hidden — only when the feature can't run AND isn't enabled in
+// config. `enabled` keeps the ear mounted through transient refusals and busy
+// agent turns, so a persistent setting never silently vanishes mid-session.
+// Backend refusals ({started:false, reason}) keep the toggle off and surface
+// the reason/hint in the tooltip.
+function WakeWordButton({ disabled, pausedForVoice = false }: { disabled: boolean; pausedForVoice?: boolean }) {
const { t } = useI18n()
const c = t.composer
const wake = useStore($wakeWord)
- if (!wake.available) {
+ if (!wake.available && !wake.enabled) {
return null
}
const phrase = wake.phrase || 'hey hermes'
- const label = wake.listening ? c.wakeWordListening(phrase) : c.wakeWordOff(phrase)
- const tooltip = wake.notice ? `${label} — ${wake.notice}` : label
+ const label = pausedForVoice
+ ? c.wakeWordPausedVoice(phrase)
+ : wake.listening
+ ? c.wakeWordListening(phrase)
+ : c.wakeWordOff(phrase)
+ const tooltip = !pausedForVoice && wake.notice ? `${label} — ${wake.notice}` : label
return (
<Tip label={tooltip}>
<Button
aria-label={label}
- aria-pressed={wake.listening}
+ aria-pressed={wake.listening && !pausedForVoice}
className={cn(
GHOST_ICON_BTN,
'p-0',
- wake.listening && 'bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary'
+ wake.listening && !pausedForVoice && 'bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary'
)}
- disabled={disabled || wake.pending}
+ disabled={disabled || pausedForVoice || wake.pending}
onClick={() => {
triggerHaptic(wake.listening ? 'close' : 'open')
void toggleWakeWord()
@@ -335,7 +345,7 @@ function WakeWordButton({ disabled }: { disabled: boolean }) {
type="button"
variant="ghost"
>
- {wake.listening ? <Ear className={iconSize.sm} /> : <EarOff className={iconSize.sm} />}
+ {wake.listening && !pausedForVoice ? <Ear className={iconSize.sm} /> : <EarOff className={iconSize.sm} />}
</Button>
</Tip>
)
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index cb20d06c7bc..076bad01acb 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -1960,6 +1960,7 @@ export const en: Translations = {
stopSpeakingReplies: 'Stop reading replies aloud',
wakeWordListening: phrase => `Wake word: "${phrase}" — listening`,
wakeWordOff: phrase => `Wake word: "${phrase}" — off`,
+ wakeWordPausedVoice: phrase => `Wake word: "${phrase}" — paused during voice chat`,
lookupLoading: 'Looking up…',
lookupNoMatches: 'No matches.',
lookupTry: 'Try',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 4f70f97e691..632435d21a8 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -1819,6 +1819,7 @@ export const ja = defineLocale({
stopSpeakingReplies: '返信の読み上げを停止',
wakeWordListening: phrase => `ウェイクワード:「${phrase}」— 待機中`,
wakeWordOff: phrase => `ウェイクワード:「${phrase}」— オフ`,
+ wakeWordPausedVoice: phrase => `ウェイクワード:「${phrase}」— 音声チャット中は一時停止`,
lookupLoading: '検索中…',
lookupNoMatches: '一致なし。',
lookupTry: '試す',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index a1042ce7d88..35124612f78 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -1646,6 +1646,7 @@ export interface Translations {
stopSpeakingReplies: string
wakeWordListening: (phrase: string) => string
wakeWordOff: (phrase: string) => string
+ wakeWordPausedVoice: (phrase: string) => string
lookupLoading: string
lookupNoMatches: string
lookupTry: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index c45f1cbeceb..4259890e898 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -1762,6 +1762,7 @@ export const zhHant = defineLocale({
stopSpeakingReplies: '停止朗讀回覆',
wakeWordListening: phrase => `喚醒詞:「${phrase}」— 正在聆聽`,
wakeWordOff: phrase => `喚醒詞:「${phrase}」— 已關閉`,
+ wakeWordPausedVoice: phrase => `喚醒詞:「${phrase}」— 語音對話期間暫停`,
lookupLoading: '查詢中…',
lookupNoMatches: '沒有相符項目。',
lookupTry: '試試',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index a5b48ed368a..a2ff10eeba5 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -2153,6 +2153,7 @@ export const zh: Translations = {
stopSpeakingReplies: '停止朗读回复',
wakeWordListening: phrase => `唤醒词:"${phrase}" — 正在监听`,
wakeWordOff: phrase => `唤醒词:"${phrase}" — 已关闭`,
+ wakeWordPausedVoice: phrase => `唤醒词:"${phrase}" — 语音对话期间暂停`,
lookupLoading: '查找中…',
lookupNoMatches: '没有匹配项。',
lookupTry: '试试',
diff --git a/apps/desktop/src/store/wake-word.ts b/apps/desktop/src/store/wake-word.ts
index 3e64285a703..fd120c3cb6a 100644
--- a/apps/desktop/src/store/wake-word.ts
+++ b/apps/desktop/src/store/wake-word.ts
@@ -8,8 +8,10 @@ import { $gateway } from '@/store/gateway'
// cache of that truth, refreshed from every wake.* RPC response we see.
export interface WakeWordState {
- /** Wake word can run at all (deps + mic + key). False hides the toggle. */
+ /** Wake word can run at all (deps + mic + key). With `enabled` false too, hides the toggle. */
available: boolean
+ /** Config truth (wake_word.enabled) — keeps the ear mounted through transient refusals. */
+ enabled: boolean
/** The listener is armed and owned by this surface. */
listening: boolean
/** Last failure reason/hint (start refused, unavailable, …) for the tooltip. */
@@ -22,6 +24,7 @@ export interface WakeWordState {
const INITIAL_WAKE_WORD_STATE: WakeWordState = {
available: false,
+ enabled: false,
listening: false,
notice: '',
pending: false,
@@ -115,6 +118,7 @@ export function applyWakeStatus(status: WakeStatusResponse | null | undefined):
$wakeWord.set({
...current,
available: Boolean(status?.available),
+ enabled: Boolean(status?.enabled),
listening,
notice: listening && !silent ? '' : noticeFrom(status),
phrase: status?.phrase?.trim() || current.phrase
@@ -130,6 +134,7 @@ export function applyWakeStartResult(result: WakeStartResponse | null | undefine
$wakeWord.set({
...current,
available: true,
+ enabled: true,
listening: true,
notice: '',
pending: false,
@@ -142,7 +147,9 @@ export function applyWakeStartResult(result: WakeStartResponse | null | undefine
$wakeWord.set({
...current,
// The backend probes requirements on start; an explicit "unavailable"
- // refusal means the feature can't run here, so hide the toggle.
+ // refusal means the feature can't run here right now. Keep `enabled`
+ // (config truth) as-is so the button stays mounted through transient
+ // refusals instead of vanishing mid-session.
available: result?.reason === 'unavailable' ? false : current.available,
listening: false,
notice: noticeFrom(result),
@@ -157,6 +164,7 @@ export function applyWakeStopResult(result: WakeStopResponse | null | undefined)
$wakeWord.set({
...current,
+ enabled: result?.disabled_persisted ? false : current.enabled,
listening: false,
notice: result?.stopped ? '' : noticeFrom(result),
pending: false