The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): app sounds mute toggle, None chime, silent OS notifications (#143117)
Austin Pickett484de065a821
diff --git a/apps/desktop/src/app/settings/notifications-settings.test.tsx b/apps/desktop/src/app/settings/notifications-settings.test.tsxnew file mode 100644index 00000000000..5a9968f29bd--- /dev/null+++ b/apps/desktop/src/app/settings/notifications-settings.test.tsx@@ -0,0 +1,105 @@+// Check that the visible sound control silences real cue callers without audio output.+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'+import { MemoryRouter } from 'react-router'+import { afterEach, beforeEach, expect, it, vi } from 'vitest'++import { getAudioContext } from '@/lib/audio-context'+import { playCompletionSound, previewCompletionSound } from '@/lib/completion-sound'+import { startThinkingSound, stopThinkingSound } from '@/lib/thinking-sound'+import { playWakeSound } from '@/lib/wake-sound'+import { $hapticsMuted, setHapticsMuted } from '@/store/haptics'++import { NotificationsSettings } from './notifications-settings'++vi.mock('@/lib/audio-context', () => ({ getAudioContext: vi.fn(() => null) }))+vi.mock('@/store/notifications', () => ({ notify: vi.fn() }))+// Keep native alerts disabled while exercising the separate real sound owner.+vi.mock('@/store/native-notifications', async () => {+ const { atom } = await import('nanostores')++ return {+ $nativeNotifyPrefs: atom({ enabled: false, kinds: {} }),+ NATIVE_NOTIFICATION_KINDS: [],+ sendTestNativeNotification: vi.fn(),+ setNativeNotifyEnabled: vi.fn(),+ setNativeNotifyKind: vi.fn()+ }+})++beforeEach(() => {+ vi.useFakeTimers()+ setHapticsMuted(false)+ vi.clearAllMocks()+})++afterEach(() => {+ cleanup()+ stopThinkingSound()+ setHapticsMuted(false)+ vi.useRealTimers()+})++it('offers a persisted mute that silences automatic completion, wake and thinking cues with native alerts off', () => {+ render(+ <MemoryRouter>+ <NotificationsSettings subpage="sounds" />+ </MemoryRouter>+ )+ const toggle = screen.getByRole('switch', { name: 'Mute interface sounds' })++ // Native alert preferences alone do not own the foreground completion cue.+ playCompletionSound()+ expect(getAudioContext).toHaveBeenCalledTimes(1)+ vi.mocked(getAudioContext).mockClear()+ fireEvent.click(toggle)+ expect($hapticsMuted.get()).toBe(true)+ expect(localStorage.getItem('hermes.desktop.hapticsMuted')).toBe('true')++ playCompletionSound()+ playWakeSound()+ startThinkingSound()+ act(() => vi.advanceTimersByTime(2_000))+ expect(getAudioContext).not.toHaveBeenCalled()++ // An explicit audition remains available without enabling automatic cues.+ previewCompletionSound()+ expect(getAudioContext).toHaveBeenCalledTimes(1)+ vi.mocked(getAudioContext).mockClear()++ cleanup()+ render(+ <MemoryRouter>+ <NotificationsSettings subpage="sounds" />+ </MemoryRouter>+ )+ const restoredToggle = screen.getByRole('switch', { name: 'Mute interface sounds' })+ expect(restoredToggle.getAttribute('aria-checked')).toBe('true')+ fireEvent.click(restoredToggle)+ expect(localStorage.getItem('hermes.desktop.hapticsMuted')).toBe('false')+ previewCompletionSound()+ expect(getAudioContext).toHaveBeenCalledTimes(1)+})++it('silences cues in this window when a peer window saves mute', () => {+ localStorage.setItem('hermes.desktop.hapticsMuted', 'true')+ window.dispatchEvent(new StorageEvent('storage', { key: 'hermes.desktop.hapticsMuted' }))+ playCompletionSound()+ playWakeSound()+ startThinkingSound()+ act(() => vi.advanceTimersByTime(2_000))+ expect($hapticsMuted.get()).toBe(true)+ expect(getAudioContext).not.toHaveBeenCalled()++ window.dispatchEvent(new StorageEvent('storage', { key: 'unrelated' }))+ expect($hapticsMuted.get()).toBe(true)+ localStorage.setItem('hermes.desktop.hapticsMuted', 'false')+ window.dispatchEvent(new StorageEvent('storage', { key: 'hermes.desktop.hapticsMuted' }))+ expect($hapticsMuted.get()).toBe(false)+ playCompletionSound()+ expect(getAudioContext).toHaveBeenCalledTimes(1)++ setHapticsMuted(true)+ localStorage.removeItem('hermes.desktop.hapticsMuted')+ window.dispatchEvent(new StorageEvent('storage', { key: 'hermes.desktop.hapticsMuted' }))+ expect($hapticsMuted.get()).toBe(false)+})diff --git a/apps/desktop/src/app/settings/notifications-settings.tsx b/apps/desktop/src/app/settings/notifications-settings.tsxindex c210cca8f03..7e6299c41fe 100644--- a/apps/desktop/src/app/settings/notifications-settings.tsx+++ b/apps/desktop/src/app/settings/notifications-settings.tsx@@ -9,6 +9,7 @@ import { triggerHaptic } from '@/lib/haptics'import { Bell, Play } from '@/lib/icons'import { cn } from '@/lib/utils'import { $completionSoundVariantId, setCompletionSoundVariantId } from '@/store/completion-sound'+import { $hapticsMuted, setHapticsMuted } from '@/store/haptics'import {$nativeNotifyPrefs,NATIVE_NOTIFICATION_KINDS,@@ -36,6 +37,7 @@ interface NotificationsSettingsProps {export function NotificationsSettings({ subpage }: NotificationsSettingsProps = {}) {const { t } = useI18n()const prefs = useStore($nativeNotifyPrefs)+ const muted = useStore($hapticsMuted)const completionSoundVariantId = useStore($completionSoundVariantId)const copy = t.settings.notificationsconst showAlerts = subpage === undefined || subpage === 'alerts'@@ -79,51 +81,60 @@ export function NotificationsSettings({ subpage }: NotificationsSettingsProps =)}{showSounds && (- <ListRow- action={- <>- <Select- onValueChange={value => {- const variantId = Number.parseInt(value, 10)-- setCompletionSoundVariantId(variantId)- previewCompletionSound(variantId)- triggerHaptic('selection')- }}- value={String(completionSoundVariantId)}- >- <SelectTrigger className={cn('min-w-56', CONTROL_TEXT)}>- <SelectValue />- </SelectTrigger>-- <SelectContent>- {COMPLETION_SOUND_VARIANTS.map(variant => (- <SelectItem key={variant.id} value={String(variant.id)}>- {variant.name}- </SelectItem>- ))}- </SelectContent>- </Select>-- <Button- className="gap-1.5"- onClick={() => {- previewCompletionSound()- triggerHaptic('crisp')- }}- size="sm"- type="button"- variant="outline"- >- <Play className="size-3.5" />- {copy.completionSoundPreview}- </Button>- </>- }- description={copy.completionSoundDesc}- id={settingElementId(SETTING_IDS.notifications.completionSound)}- title={copy.completionSoundTitle}- />+ <>+ <ToggleRow+ checked={muted}+ description={copy.muteSoundsDesc}+ id={settingElementId(SETTING_IDS.notifications.muteSounds)}+ label={copy.muteSoundsTitle}+ onChange={setHapticsMuted}+ />+ <ListRow+ action={+ <>+ <Select+ onValueChange={value => {+ const variantId = Number.parseInt(value, 10)++ setCompletionSoundVariantId(variantId)+ previewCompletionSound(variantId)+ triggerHaptic('selection')+ }}+ value={String(completionSoundVariantId)}+ >+ <SelectTrigger className={cn('min-w-56', CONTROL_TEXT)}>+ <SelectValue />+ </SelectTrigger>++ <SelectContent>+ {COMPLETION_SOUND_VARIANTS.map(variant => (+ <SelectItem key={variant.id} value={String(variant.id)}>+ {variant.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>++ <Button+ className="gap-1.5"+ onClick={() => {+ previewCompletionSound()+ triggerHaptic('crisp')+ }}+ size="sm"+ type="button"+ variant="outline"+ >+ <Play className="size-3.5" />+ {copy.completionSoundPreview}+ </Button>+ </>+ }+ description={copy.completionSoundDesc}+ id={settingElementId(SETTING_IDS.notifications.completionSound)}+ title={copy.completionSoundTitle}+ />+ </>)}{showAlerts && (diff --git a/apps/desktop/src/app/settings/settings-manifest.ts b/apps/desktop/src/app/settings/settings-manifest.tsindex 708c50a31c7..9a0ad4909fa 100644--- a/apps/desktop/src/app/settings/settings-manifest.ts+++ b/apps/desktop/src/app/settings/settings-manifest.ts@@ -208,9 +208,17 @@ export const SETTINGS_MANIFEST = {} satisfies SettingDefinition])),+ muteSounds: {+ subpage: 'sounds',+ keywords: ['mute', 'silence', 'quiet', 'sound', 'chime', 'wake', 'haptics'],+ copy: t => ({+ label: t.settings.notifications.muteSoundsTitle,+ description: t.settings.notifications.muteSoundsDesc+ })+ },completionSound: {subpage: 'sounds',- keywords: ['sound', 'chime', 'ding', 'audio', 'done', 'complete', 'mute'],+ keywords: ['sound', 'chime', 'ding', 'audio', 'done', 'complete', 'mute', 'off', 'none', 'silence'],copy: t => ({label: t.settings.notifications.completionSoundTitle,description: t.settings.notifications.completionSoundDescdiff --git a/apps/desktop/src/i18n/ar_settings.ts b/apps/desktop/src/i18n/ar_settings.tsindex 925ded86bc6..db6fd0b957b 100644--- a/apps/desktop/src/i18n/ar_settings.ts+++ b/apps/desktop/src/i18n/ar_settings.ts@@ -229,6 +229,9 @@ export const arSettings = {testBody: 'الإشعارات تعمل.',testSent: 'تم إرسال التجربة. إذا لم يظهر شيء، تحقق من أذونات الإشعارات في نظام التشغيل ووضع التركيز/عدم الإزعاج.',testUnsupported: 'هذا النظام لا يدعم الإشعارات الأصلية.',+ muteSoundsTitle: 'كتم أصوات الواجهة',+ muteSoundsDesc:+ 'يكتم تنبيهات الاكتمال وكلمة التنبيه والتفكير التلقائية والاستجابة اللمسية وأصوات إشعارات النظام. تظل معاينات الصوت والردود المنطوقة مسموعة.',completionSoundTitle: 'صوت الاكتمال',completionSoundDesc: 'يُشغّل عند انتهاء دور الوكيل. اختر إعدادا مسبقا وعاينه هنا.',completionSoundPreview: 'معاينة'diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex 5292f2001c4..84b557e4b8f 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -10,6 +10,7 @@ import { deLocalModels } from './de_local_models'import { deModelMenu } from './de_model_menu'import { deModelSettings } from './de_model_settings'import { deNotices } from './de_notices'+import { deNotifications } from './de_notifications'import { deOnboarding } from './de_onboarding'import { dePluginUpdate } from './de_plugin_update'import { deProjects } from './de_projects'@@ -922,53 +923,7 @@ export const deOverrides = {masterPasswordPlaceholder: 'Master-Passwort'}},- notifications: {- title: 'Benachrichtigungen',- intro: 'OS-Benachrichtigungen (keine In-App-Toasts). Pro Gerät.',- enableAll: 'Benachrichtigungen aktivieren',- enableAllDesc: 'Aus schaltet jede Benachrichtigung unten stumm.',- focusedHint: 'Abschluss-Alerts feuern nur, während Hermes im Hintergrund ist.',- kinds: {- approval: {- label: 'Genehmigung nötig',- description: 'Ein Befehl wartet darauf, dass Sie ihn genehmigen oder ablehnen.'- },- input: {- label: 'Eingabe nötig',- description: 'Hermes hat eine Frage gestellt oder braucht ein Passwort oder Geheimnis.'- },- turnDone: {- label: 'Antwort bereit',- description: 'Ein Turn wurde beendet, während Hermes im Hintergrund war.'- },- turnError: {- label: 'Turn fehlgeschlagen',- description: 'Fehler bei Background-Turns.'- },- backgroundDone: {- label: 'Hintergrund-Task fertig',- description: 'Ein Terminal-Befehl im Hintergrund wurde abgeschlossen.'- },- credits: {- label: 'Credit-Alerts',- description: 'Der Credit-Zugriff wird pausiert oder wiederhergestellt.'- },- plugin: {- label: 'Plugin-Benachrichtigungen',- description: 'Ein Desktop-Plugin hat eine Benachrichtigung gesendet, während Hermes im Hintergrund war.'- }- },- test: 'Testbenachrichtigung senden',- testTitle: 'Hermes',- testBody: 'Benachrichtigungen funktionieren.',- testSent:- 'Test gesendet. Wenn nichts erscheint, überprüfen Sie die Benachrichtigungsberechtigungen Ihres Betriebssystems und Fokus/Nicht stören.',- testUnsupported: 'Dieses System unterstützt keine nativen Benachrichtigungen.',- completionSoundTitle: 'Abschluss-Sound',- completionSoundDesc:- 'Wird abgespielt, wenn ein Agent-Turn endet. Wählen Sie eine Vorlage aus und hören Sie sie hier an.',- completionSoundPreview: 'Vorschau'- },+ notifications: deNotifications,sections: {model: 'Modell',chat: 'Chat',diff --git a/apps/desktop/src/i18n/de_notifications.ts b/apps/desktop/src/i18n/de_notifications.tsnew file mode 100644index 00000000000..eb81fa21e64--- /dev/null+++ b/apps/desktop/src/i18n/de_notifications.ts@@ -0,0 +1,51 @@+// Notification settings copy used when the desktop locale loads.+export const deNotifications = {+ title: 'Benachrichtigungen',+ intro: 'OS-Benachrichtigungen (keine In-App-Toasts). Pro Gerät.',+ enableAll: 'Benachrichtigungen aktivieren',+ enableAllDesc: 'Aus schaltet jede Benachrichtigung unten stumm.',+ focusedHint: 'Abschluss-Alerts feuern nur, während Hermes im Hintergrund ist.',+ kinds: {+ approval: {+ label: 'Genehmigung nötig',+ description: 'Ein Befehl wartet darauf, dass Sie ihn genehmigen oder ablehnen.'+ },+ input: {+ label: 'Eingabe nötig',+ description: 'Hermes hat eine Frage gestellt oder braucht ein Passwort oder Geheimnis.'+ },+ turnDone: {+ label: 'Antwort bereit',+ description: 'Ein Turn wurde beendet, während Hermes im Hintergrund war.'+ },+ turnError: {+ label: 'Turn fehlgeschlagen',+ description: 'Fehler bei Background-Turns.'+ },+ backgroundDone: {+ label: 'Hintergrund-Task fertig',+ description: 'Ein Terminal-Befehl im Hintergrund wurde abgeschlossen.'+ },+ credits: {+ label: 'Credit-Alerts',+ description: 'Der Credit-Zugriff wird pausiert oder wiederhergestellt.'+ },+ plugin: {+ label: 'Plugin-Benachrichtigungen',+ description: 'Ein Desktop-Plugin hat eine Benachrichtigung gesendet, während Hermes im Hintergrund war.'+ }+ },+ test: 'Testbenachrichtigung senden',+ testTitle: 'Hermes',+ testBody: 'Benachrichtigungen funktionieren.',+ testSent:+ 'Test gesendet. Wenn nichts erscheint, überprüfen Sie die Benachrichtigungsberechtigungen Ihres Betriebssystems und Fokus/Nicht stören.',+ testUnsupported: 'Dieses System unterstützt keine nativen Benachrichtigungen.',+ muteSoundsTitle: 'Oberflächentöne stummschalten',+ muteSoundsDesc:+ 'Schaltet automatische Abschluss-, Aktivierungs- und Denktöne, haptisches Feedback und die Töne von Systembenachrichtigungen aus. Klangvorschauen und gesprochene Antworten werden weiterhin abgespielt.',+ completionSoundTitle: 'Abschluss-Sound',+ completionSoundDesc:+ 'Wird abgespielt, wenn ein Agent-Turn endet. Wählen Sie eine Vorlage aus und hören Sie sie hier an.',+ completionSoundPreview: 'Vorschau'+}diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex dbd69480776..df3eda922e8 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -17,6 +17,7 @@ import { enLocalModels } from './en_local_models'import { enModelMenu } from './en_model_menu'import { enModelSettings } from './en_model_settings'import { enNotices } from './en_notices'+import { enNotifications } from './en_notifications'import { enOnboarding } from './en_onboarding'import { enPluginUpdate } from './en_plugin_update'import { enProjects } from './en_projects'@@ -908,51 +909,7 @@ export const en: Translations = {masterPasswordPlaceholder: 'Master password'}},- notifications: {- title: 'Notifications',- intro: 'OS notifications (not in-app toasts). Per device.',- enableAll: 'Enable notifications',- enableAllDesc: 'Off silences every notification below.',- focusedHint: 'Completion alerts only fire while Hermes is in the background.',- kinds: {- approval: {- label: 'Approval needed',- description: 'A command is waiting for you to approve or reject it.'- },- input: {- label: 'Input needed',- description: 'Hermes asked a question or needs a password or secret.'- },- turnDone: {- label: 'Response ready',- description: 'A turn finished while Hermes was in the background.'- },- turnError: {- label: 'Turn failed',- description: 'Background turn errors.'- },- backgroundDone: {- label: 'Background task finished',- description: 'A backgrounded terminal command completed.'- },- credits: {- label: 'Credit alerts',- description: 'Credit access is paused or restored.'- },- plugin: {- label: 'Plugin notifications',- description: 'A desktop plugin sent a notification while Hermes was in the background.'- }- },- test: 'Send test notification',- testTitle: 'Hermes',- testBody: 'Notifications are working.',- testSent: 'Test sent. If nothing appears, check your OS notification permissions and Focus/Do Not Disturb.',- testUnsupported: 'This system does not support native notifications.',- completionSoundTitle: 'Completion Sound',- completionSoundDesc: 'Plays when an agent turn finishes. Pick a preset and preview it here.',- completionSoundPreview: 'Preview'- },+ notifications: enNotifications,sections: {model: 'Model',chat: 'Chat',diff --git a/apps/desktop/src/i18n/en_notifications.ts b/apps/desktop/src/i18n/en_notifications.tsnew file mode 100644index 00000000000..238fd912e6a--- /dev/null+++ b/apps/desktop/src/i18n/en_notifications.ts@@ -0,0 +1,49 @@+// Notification settings copy used when the desktop locale loads.+export const enNotifications = {+ title: 'Notifications',+ intro: 'OS notifications (not in-app toasts). Per device.',+ enableAll: 'Enable notifications',+ enableAllDesc: 'Off silences every notification below.',+ focusedHint: 'Completion alerts only fire while Hermes is in the background.',+ kinds: {+ approval: {+ label: 'Approval needed',+ description: 'A command is waiting for you to approve or reject it.'+ },+ input: {+ label: 'Input needed',+ description: 'Hermes asked a question or needs a password or secret.'+ },+ turnDone: {+ label: 'Response ready',+ description: 'A turn finished while Hermes was in the background.'+ },+ turnError: {+ label: 'Turn failed',+ description: 'Background turn errors.'+ },+ backgroundDone: {+ label: 'Background task finished',+ description: 'A backgrounded terminal command completed.'+ },+ credits: {+ label: 'Credit alerts',+ description: 'Credit access is paused or restored.'+ },+ plugin: {+ label: 'Plugin notifications',+ description: 'A desktop plugin sent a notification while Hermes was in the background.'+ }+ },+ test: 'Send test notification',+ testTitle: 'Hermes',+ testBody: 'Notifications are working.',+ testSent: 'Test sent. If nothing appears, check your OS notification permissions and Focus/Do Not Disturb.',+ testUnsupported: 'This system does not support native notifications.',+ muteSoundsTitle: 'Mute interface sounds',+ muteSoundsDesc:+ 'Silences automatic completion, wake-word and thinking cues, haptic feedback, and OS notification sounds. Sound previews and spoken replies still play.',+ completionSoundTitle: 'Completion Sound',+ completionSoundDesc: 'Plays when an agent turn finishes. Pick a preset and preview it here.',+ completionSoundPreview: 'Preview'+}diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex ad95e62b194..64aeb2e9173 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -11,6 +11,7 @@ import { esLocalModels } from './es_local_models'import { esModelMenu } from './es_model_menu'import { esModelSettings } from './es_model_settings'import { esNotices } from './es_notices'+import { esNotifications } from './es_notifications'import { esOnboarding } from './es_onboarding'import { esPluginUpdate } from './es_plugin_update'import { esProjects } from './es_projects'@@ -925,53 +926,7 @@ export const esOverrides = {masterPasswordPlaceholder: 'Contraseña maestra'}},- notifications: {- title: 'Notificaciones',- intro: 'Notificaciones del sistema operativo (no avisos dentro de la app). Por dispositivo.',- enableAll: 'Activar notificaciones',- enableAllDesc: 'Desactivado silencia todas las notificaciones siguientes.',- focusedHint: 'Los avisos de finalización solo se activan cuando Hermes está en segundo plano.',- kinds: {- approval: {- label: 'Se necesita aprobación',- description: 'Un comando espera que lo apruebes o rechaces.'- },- input: {- label: 'Se necesita información',- description: 'Hermes hizo una pregunta o necesita una contraseña o un secreto.'- },- turnDone: {- label: 'Respuesta lista',- description: 'Terminó un turno mientras Hermes estaba en segundo plano.'- },- turnError: {- label: 'El turno falló',- description: 'Errores de turnos en segundo plano.'- },- backgroundDone: {- label: 'Tarea en segundo plano finalizada',- description: 'Se completó un comando de terminal en segundo plano.'- },- credits: {- label: 'Avisos de crédito',- description: 'El acceso a los créditos se pausa o se restablece.'- },- plugin: {- label: 'Notificaciones de complementos',- description: 'Un complemento de escritorio envió una notificación mientras Hermes estaba en segundo plano.'- }- },- test: 'Enviar notificación de prueba',- testTitle: 'Hermes',- testBody: 'Las notificaciones funcionan.',- testSent:- 'Prueba enviada. Si no aparece nada, revisa los permisos de notificaciones del sistema operativo y el modo Concentración o No molestar.',- testUnsupported: 'Este sistema no admite notificaciones nativas.',- completionSoundTitle: 'Sonido de finalización',- completionSoundDesc:- 'Reproduce un sonido cuando termina el turno de un agente. Elige un ajuste predefinido y pruébalo aquí.',- completionSoundPreview: 'Vista previa'- },+ notifications: esNotifications,sections: {model: 'Modelo',chat: 'Chat',diff --git a/apps/desktop/src/i18n/es_notifications.ts b/apps/desktop/src/i18n/es_notifications.tsnew file mode 100644index 00000000000..ed2a3f5338b--- /dev/null+++ b/apps/desktop/src/i18n/es_notifications.ts@@ -0,0 +1,51 @@+// Notification settings copy used when the desktop locale loads.+export const esNotifications = {+ title: 'Notificaciones',+ intro: 'Notificaciones del sistema operativo (no avisos dentro de la app). Por dispositivo.',+ enableAll: 'Activar notificaciones',+ enableAllDesc: 'Desactivado silencia todas las notificaciones siguientes.',+ focusedHint: 'Los avisos de finalización solo se activan cuando Hermes está en segundo plano.',+ kinds: {+ approval: {+ label: 'Se necesita aprobación',+ description: 'Un comando espera que lo apruebes o rechaces.'+ },+ input: {+ label: 'Se necesita información',+ description: 'Hermes hizo una pregunta o necesita una contraseña o un secreto.'+ },+ turnDone: {+ label: 'Respuesta lista',+ description: 'Terminó un turno mientras Hermes estaba en segundo plano.'+ },+ turnError: {+ label: 'El turno falló',+ description: 'Errores de turnos en segundo plano.'+ },+ backgroundDone: {+ label: 'Tarea en segundo plano finalizada',+ description: 'Se completó un comando de terminal en segundo plano.'+ },+ credits: {+ label: 'Avisos de crédito',+ description: 'El acceso a los créditos se pausa o se restablece.'+ },+ plugin: {+ label: 'Notificaciones de complementos',+ description: 'Un complemento de escritorio envió una notificación mientras Hermes estaba en segundo plano.'+ }+ },+ test: 'Enviar notificación de prueba',+ testTitle: 'Hermes',+ testBody: 'Las notificaciones funcionan.',+ testSent:+ 'Prueba enviada. Si no aparece nada, revisa los permisos de notificaciones del sistema operativo y el modo Concentración o No molestar.',+ testUnsupported: 'Este sistema no admite notificaciones nativas.',+ muteSoundsTitle: 'Silenciar sonidos de la interfaz',+ muteSoundsDesc:+ 'Silencia los avisos automáticos de finalización, activación y reflexión, la respuesta háptica y los sonidos de las notificaciones del sistema. Las vistas previas de sonido y las respuestas habladas siguen reproduciéndose.',+ completionSoundTitle: 'Sonido de finalización',+ completionSoundDesc:+ 'Reproduce un sonido cuando termina el turno de un agente. Elige un ajuste predefinido y pruébalo aquí.',+ completionSoundPreview: 'Vista previa'+}diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex dd97615ea5a..89911abb3dc 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -11,6 +11,7 @@ import { frLocalModels } from './fr_local_models'import { frModelMenu } from './fr_model_menu'import { frModelSettings } from './fr_model_settings'import { frNotices } from './fr_notices'+import { frNotifications } from './fr_notifications'import { frOnboarding } from './fr_onboarding'import { frPluginUpdate } from './fr_plugin_update'import { frProjects } from './fr_projects'@@ -924,52 +925,7 @@ export const frOverrides = {masterPasswordPlaceholder: 'Mot de passe principal'}},- notifications: {- title: 'Notifications',- intro: "Notifications système (pas les toasts de l'application). Par appareil.",- enableAll: 'Activer les notifications',- enableAllDesc: 'Désactivé coupe toutes les notifications ci-dessous.',- focusedHint: 'Les alertes de fin ne se déclenchent que quand Hermes est en arrière-plan.',- kinds: {- approval: {- label: 'Approbation requise',- description: "Une commande attend que vous l'approuviez ou la rejetiez."- },- input: {- label: 'Saisie requise',- description: "Hermes a posé une question ou a besoin d'un mot de passe ou d'un secret."- },- turnDone: {- label: 'Réponse prête',- description: "Un tour s'est terminé pendant que Hermes était en arrière-plan."- },- turnError: {- label: 'Échec du tour',- description: 'Erreurs de tour en arrière-plan.'- },- backgroundDone: {- label: 'Tâche en arrière-plan terminée',- description: "Une commande terminal en arrière-plan s'est terminée."- },- credits: {- label: 'Alertes de crédits',- description: "L'accès aux crédits est suspendu ou rétabli."- },- plugin: {- label: 'Notifications des plugins',- description: 'Un plugin desktop a envoyé une notification pendant que Hermes était en arrière-plan.'- }- },- test: 'Envoyer une notification de test',- testTitle: 'Hermes',- testBody: 'Les notifications fonctionnent.',- testSent:- "Test envoyé. Si rien n'apparaît, vérifiez les autorisations de notification de votre système et le mode Ne pas déranger.",- testUnsupported: 'Ce système ne prend pas en charge les notifications natives.',- completionSoundTitle: 'Son de fin',- completionSoundDesc: "Se joue à la fin d'un tour d'agent. Choisissez un préréglage et prévisualisez-le ici.",- completionSoundPreview: 'Aperçu'- },+ notifications: frNotifications,sections: {model: 'Modèle',chat: 'Conversation',diff --git a/apps/desktop/src/i18n/fr_notifications.ts b/apps/desktop/src/i18n/fr_notifications.tsnew file mode 100644index 00000000000..ff0358c1307--- /dev/null+++ b/apps/desktop/src/i18n/fr_notifications.ts@@ -0,0 +1,50 @@+// Notification settings copy used when the desktop locale loads.+export const frNotifications = {+ title: 'Notifications',+ intro: "Notifications système (pas les toasts de l'application). Par appareil.",+ enableAll: 'Activer les notifications',+ enableAllDesc: 'Désactivé coupe toutes les notifications ci-dessous.',+ focusedHint: 'Les alertes de fin ne se déclenchent que quand Hermes est en arrière-plan.',+ kinds: {+ approval: {+ label: 'Approbation requise',+ description: "Une commande attend que vous l'approuviez ou la rejetiez."+ },+ input: {+ label: 'Saisie requise',+ description: "Hermes a posé une question ou a besoin d'un mot de passe ou d'un secret."+ },+ turnDone: {+ label: 'Réponse prête',+ description: "Un tour s'est terminé pendant que Hermes était en arrière-plan."+ },+ turnError: {+ label: 'Échec du tour',+ description: 'Erreurs de tour en arrière-plan.'+ },+ backgroundDone: {+ label: 'Tâche en arrière-plan terminée',+ description: "Une commande terminal en arrière-plan s'est terminée."+ },+ credits: {+ label: 'Alertes de crédits',+ description: "L'accès aux crédits est suspendu ou rétabli."+ },+ plugin: {+ label: 'Notifications des plugins',+ description: 'Un plugin desktop a envoyé une notification pendant que Hermes était en arrière-plan.'+ }+ },+ test: 'Envoyer une notification de test',+ testTitle: 'Hermes',+ testBody: 'Les notifications fonctionnent.',+ testSent:+ "Test envoyé. Si rien n'apparaît, vérifiez les autorisations de notification de votre système et le mode Ne pas déranger.",+ testUnsupported: 'Ce système ne prend pas en charge les notifications natives.',+ muteSoundsTitle: 'Couper les sons de l’interface',+ muteSoundsDesc:+ 'Coupe les signaux automatiques de fin, d’activation et de réflexion, le retour haptique et les sons des notifications système. Les aperçus sonores et les réponses vocales restent audibles.',+ completionSoundTitle: 'Son de fin',+ completionSoundDesc: "Se joue à la fin d'un tour d'agent. Choisissez un préréglage et prévisualisez-le ici.",+ completionSoundPreview: 'Aperçu'+}diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 1542c4e401f..87c6a460031 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -12,6 +12,7 @@ import { jaLocalModels } from './ja_local_models'import { jaModelMenu } from './ja_model_menu'import { jaModelSettings } from './ja_model_settings'import { jaNotices } from './ja_notices'+import { jaNotifications } from './ja_notifications'import { jaOnboarding } from './ja_onboarding'import { jaPluginSettings } from './ja_plugins'import { jaProjects } from './ja_projects'@@ -424,52 +425,7 @@ export const jaOverrides = {masterPasswordPlaceholder: 'マスターパスワード'}},- notifications: {- title: '通知',- intro: 'アプリ内トーストとは別の、ネイティブのデスクトップ通知です。設定は端末ごとに保存されます。',- enableAll: '通知を有効にする',- enableAllDesc: 'オフで以下の通知をすべて無効にします。',- focusedHint: '完了通知は Hermes がバックグラウンドにあるときのみ表示されます。',- kinds: {- approval: {- label: '承認が必要',- description: 'コマンドが承認または拒否を待っています。'- },- input: {- label: '入力が必要',- description: 'Hermes が質問したか、パスワードやシークレットを必要としています。'- },- turnDone: {- label: '応答完了',- description: 'Hermes がバックグラウンドのときにターンが完了しました。'- },- turnError: {- label: 'ターン失敗',- description: 'バックグラウンドのターンエラー。'- },- backgroundDone: {- label: 'バックグラウンドタスク完了',- description: 'バックグラウンドのターミナルコマンドが完了しました。'- },- credits: {- label: 'クレジット通知',- description: 'クレジットの利用が停止または復旧しました。'- },- plugin: {- label: 'プラグイン通知',- description: 'Hermes がバックグラウンドの間に、デスクトッププラグインが通知を送信しました。'- }- },- test: 'テスト通知を送信',- testTitle: 'Hermes',- testBody: '通知は正常に動作しています。',- testSent:- 'テストを送信しました。表示されない場合は、OS の通知許可と集中モード/おやすみモードを確認してください。',- testUnsupported: 'このシステムはネイティブ通知に対応していません。',- completionSoundTitle: '完了サウンド',- completionSoundDesc: 'エージェントのターン終了時に再生されます。プリセットを選んでここで試聴できます。',- completionSoundPreview: '試聴'- },+ notifications: jaNotifications,sections: {model: 'モデル',chat: 'チャット',diff --git a/apps/desktop/src/i18n/ja_notifications.ts b/apps/desktop/src/i18n/ja_notifications.tsnew file mode 100644index 00000000000..42fec004949--- /dev/null+++ b/apps/desktop/src/i18n/ja_notifications.ts@@ -0,0 +1,49 @@+// Notification settings copy used when the desktop locale loads.+export const jaNotifications = {+ title: '通知',+ intro: 'アプリ内トーストとは別の、ネイティブのデスクトップ通知です。設定は端末ごとに保存されます。',+ enableAll: '通知を有効にする',+ enableAllDesc: 'オフで以下の通知をすべて無効にします。',+ focusedHint: '完了通知は Hermes がバックグラウンドにあるときのみ表示されます。',+ kinds: {+ approval: {+ label: '承認が必要',+ description: 'コマンドが承認または拒否を待っています。'+ },+ input: {+ label: '入力が必要',+ description: 'Hermes が質問したか、パスワードやシークレットを必要としています。'+ },+ turnDone: {+ label: '応答完了',+ description: 'Hermes がバックグラウンドのときにターンが完了しました。'+ },+ turnError: {+ label: 'ターン失敗',+ description: 'バックグラウンドのターンエラー。'+ },+ backgroundDone: {+ label: 'バックグラウンドタスク完了',+ description: 'バックグラウンドのターミナルコマンドが完了しました。'+ },+ credits: {+ label: 'クレジット通知',+ description: 'クレジットの利用が停止または復旧しました。'+ },+ plugin: {+ label: 'プラグイン通知',+ description: 'Hermes がバックグラウンドの間に、デスクトッププラグインが通知を送信しました。'+ }+ },+ test: 'テスト通知を送信',+ testTitle: 'Hermes',+ testBody: '通知は正常に動作しています。',+ testSent: 'テストを送信しました。表示されない場合は、OS の通知許可と集中モード/おやすみモードを確認してください。',+ testUnsupported: 'このシステムはネイティブ通知に対応していません。',+ muteSoundsTitle: 'インターフェース音をミュート',+ muteSoundsDesc:+ '完了・ウェイクワード・思考中の自動通知音、触覚フィードバック、OS 通知の音を無効にします。サウンドのプレビューと音声による応答は引き続き再生されます。',+ completionSoundTitle: '完了サウンド',+ completionSoundDesc: 'エージェントのターン終了時に再生されます。プリセットを選んでここで試聴できます。',+ completionSoundPreview: '試聴'+}diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex eab07212123..31ec289df60 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -10,6 +10,7 @@ import { ruFirstRun } from './ru_first_run'import { ruModelMenu } from './ru_model_menu'import { ruModelSettings } from './ru_model_settings'import { ruNotices } from './ru_notices'+import { ruNotifications } from './ru_notifications'import { ruOnboarding } from './ru_onboarding'import { ruPluginSettings } from './ru_plugins'import { ruProjects } from './ru_projects'@@ -423,52 +424,7 @@ export const ruOverrides = {plugins: 'Плагины'},plugins: ruPluginSettings.plugins,- notifications: {- title: 'Уведомления',- intro: 'Системные уведомления (не всплывающие внутри приложения). Настраивается для каждого устройства.',- enableAll: 'Включить уведомления',- enableAllDesc: 'Если выключено — все уведомления ниже будут заглушены.',- focusedHint: 'Оповещения о завершении срабатывают только пока Hermes в фоне.',- kinds: {- approval: {- label: 'Нужно одобрение',- description: 'Команда ожидает вашего одобрения или отклонения.'- },- input: {- label: 'Нужен ввод',- description: 'Hermes задал вопрос или требует пароль/секрет.'- },- turnDone: {- label: 'Ответ готов',- description: 'Ход завершился, пока Hermes был в фоне.'- },- turnError: {- label: 'Ход не удался',- description: 'Ошибки фоновых ходов.'- },- backgroundDone: {- label: 'Фоновая задача завершена',- description: 'Фоновая команда терминала выполнена.'- },- credits: {- label: 'Оповещения о кредитах',- description: 'Доступ к кредитам приостановлен или восстановлен.'- },- plugin: {- label: 'Уведомления плагинов',- description: 'Плагин приложения отправил уведомление, пока Hermes был в фоне.'- }- },- test: 'Отправить тестовое уведомление',- testTitle: 'Hermes',- testBody: 'Уведомления работают.',- testSent:- 'Тест отправлен. Если ничего не появилось, проверьте разрешения на уведомления в системе и режим «Не беспокоить».',- testUnsupported: 'Эта система не поддерживает системные уведомления.',- completionSoundTitle: 'Звук завершения',- completionSoundDesc: 'Воспроизводится, когда ход агента завершён. Выберите пресет и прослушайте здесь.',- completionSoundPreview: 'Прослушать'- },+ notifications: ruNotifications,sections: {model: 'Модель',chat: 'Чат',diff --git a/apps/desktop/src/i18n/ru_notifications.ts b/apps/desktop/src/i18n/ru_notifications.tsnew file mode 100644index 00000000000..054cfdd0698--- /dev/null+++ b/apps/desktop/src/i18n/ru_notifications.ts@@ -0,0 +1,50 @@+// Notification settings copy used when the desktop locale loads.+export const ruNotifications = {+ title: 'Уведомления',+ intro: 'Системные уведомления (не всплывающие внутри приложения). Настраивается для каждого устройства.',+ enableAll: 'Включить уведомления',+ enableAllDesc: 'Если выключено — все уведомления ниже будут заглушены.',+ focusedHint: 'Оповещения о завершении срабатывают только пока Hermes в фоне.',+ kinds: {+ approval: {+ label: 'Нужно одобрение',+ description: 'Команда ожидает вашего одобрения или отклонения.'+ },+ input: {+ label: 'Нужен ввод',+ description: 'Hermes задал вопрос или требует пароль/секрет.'+ },+ turnDone: {+ label: 'Ответ готов',+ description: 'Ход завершился, пока Hermes был в фоне.'+ },+ turnError: {+ label: 'Ход не удался',+ description: 'Ошибки фоновых ходов.'+ },+ backgroundDone: {+ label: 'Фоновая задача завершена',+ description: 'Фоновая команда терминала выполнена.'+ },+ credits: {+ label: 'Оповещения о кредитах',+ description: 'Доступ к кредитам приостановлен или восстановлен.'+ },+ plugin: {+ label: 'Уведомления плагинов',+ description: 'Плагин приложения отправил уведомление, пока Hermes был в фоне.'+ }+ },+ test: 'Отправить тестовое уведомление',+ testTitle: 'Hermes',+ testBody: 'Уведомления работают.',+ testSent:+ 'Тест отправлен. Если ничего не появилось, проверьте разрешения на уведомления в системе и режим «Не беспокоить».',+ testUnsupported: 'Эта система не поддерживает системные уведомления.',+ muteSoundsTitle: 'Отключить звуки интерфейса',+ muteSoundsDesc:+ 'Отключает автоматические звуки завершения, активации и размышления, виброотклик и звуки системных уведомлений. Прослушивание звуков и голосовые ответы остаются включены.',+ completionSoundTitle: 'Звук завершения',+ completionSoundDesc: 'Воспроизводится, когда ход агента завершён. Выберите пресет и прослушайте здесь.',+ completionSoundPreview: 'Прослушать'+}diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 8759f17cfb7..b3b8bc0dcc5 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -21,6 +21,7 @@ import type { FirstRunCopy } from './types_first_run'import type { ModelMenuTranslations } from './types_model_menu'import type { ModelSettingsTranslations } from './types_model_settings'import type { NoticeTranslations } from './types_notices'+import type { NotificationSettingsTranslations } from './types_notifications'import type { OnboardingTranslations } from './types_onboarding'import type { PluginUpdateTranslations } from './types_plugin_update'import type { SidebarProjectsTranslations } from './types_projects'@@ -756,25 +757,7 @@ catalog: CatalogTranslationsmasterPasswordPlaceholder: string}}- notifications: {- title: string- intro: string- enableAll: string- enableAllDesc: string- focusedHint: string- kinds: Record<- 'approval' | 'backgroundDone' | 'credits' | 'input' | 'plugin' | 'turnDone' | 'turnError',- { label: string; description: string }- >- test: string- testTitle: string- testBody: string- testSent: string- testUnsupported: string- completionSoundTitle: string- completionSoundDesc: string- completionSoundPreview: string- }+ notifications: NotificationSettingsTranslationssections: Record<string, string>searchPlaceholder: Record<'about' | 'config' | 'gateway' | 'keys' | 'mcp' | 'sessions', string>modeOptions: Record<'light' | 'dark' | 'system', ModeOptionCopy>diff --git a/apps/desktop/src/i18n/types_notifications.ts b/apps/desktop/src/i18n/types_notifications.tsnew file mode 100644index 00000000000..5b268d4d776--- /dev/null+++ b/apps/desktop/src/i18n/types_notifications.ts@@ -0,0 +1,22 @@+// Notification settings types used by every desktop locale.+export interface NotificationSettingsTranslations {+ title: string+ intro: string+ enableAll: string+ enableAllDesc: string+ focusedHint: string+ kinds: Record<+ 'approval' | 'backgroundDone' | 'credits' | 'input' | 'plugin' | 'turnDone' | 'turnError',+ { label: string; description: string }+ >+ test: string+ testTitle: string+ testBody: string+ testSent: string+ testUnsupported: string+ muteSoundsTitle: string+ muteSoundsDesc: string+ completionSoundTitle: string+ completionSoundDesc: string+ completionSoundPreview: string+}diff --git a/apps/desktop/src/i18n/zh-hant_settings.ts b/apps/desktop/src/i18n/zh-hant_settings.tsindex 1b185d96b0a..d13b9bc64e5 100644--- a/apps/desktop/src/i18n/zh-hant_settings.ts+++ b/apps/desktop/src/i18n/zh-hant_settings.ts@@ -238,6 +238,8 @@ export const zhHantSettings = {testBody: '通知運作正常。',testSent: '測試已傳送。若沒有出現,請檢查系統通知權限與專注模式/勿擾模式。',testUnsupported: '此系統不支援原生通知。',+ muteSoundsTitle: '靜音介面提示音',+ muteSoundsDesc: '關閉自動完成、喚醒詞和思考提示音、觸感回饋以及系統通知聲音。聲音預覽和語音回覆仍會播放。',completionSoundTitle: '完成提示音',completionSoundDesc: '代理回合結束時播放。可在此選擇預設並預覽。',completionSoundPreview: '預覽'diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 7d07e1f6cbb..92da8c91c5e 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -11,6 +11,7 @@ import { zhLocalModels } from './zh_local_models'import { zhModelMenu } from './zh_model_menu'import { zhModelSettings } from './zh_model_settings'import { zhNotices } from './zh_notices'+import { zhNotifications } from './zh_notifications'import { zhOnboarding } from './zh_onboarding'import { zhProjects } from './zh_projects'import { zhSharedMetrics } from './zh_shared_metrics'@@ -668,51 +669,7 @@ export const zhOverrides = {nothingToInstall: '此包在这里没有可安装的内容。'}},- notifications: {- title: '通知',- intro: '原生桌面通知,区别于应用内提示。设置按设备保存,每台电脑各自独立。',- enableAll: '启用通知',- enableAllDesc: '关闭后静音下方所有通知。',- focusedHint: '完成提醒仅在 Hermes 处于后台时触发。',- kinds: {- approval: {- label: '需要批准',- description: '有命令正在等待你批准或拒绝。'- },- input: {- label: '需要输入',- description: 'Hermes 提出了问题,或需要密码或密钥。'- },- turnDone: {- label: '回复就绪',- description: 'Hermes 在后台时完成了一轮对话。'- },- turnError: {- label: '本轮失败',- description: '后台回合错误。'- },- backgroundDone: {- label: '后台任务完成',- description: '后台终端命令已完成。'- },- credits: {- label: '额度提醒',- description: '额度访问被暂停或恢复。'- },- plugin: {- label: '插件通知',- description: 'Hermes 在后台时,桌面插件发送了通知。'- }- },- test: '发送测试通知',- testTitle: 'Hermes',- testBody: '通知工作正常。',- testSent: '测试已发送。如果没有出现,请检查系统通知权限和专注模式/勿扰模式。',- testUnsupported: '此系统不支持原生通知。',- completionSoundTitle: '完成提示音',- completionSoundDesc: '智能体回合结束时播放。可在此选择预设并预览。',- completionSoundPreview: '预览'- },+ notifications: zhNotifications,sections: {model: '模型',chat: '对话',diff --git a/apps/desktop/src/i18n/zh_notifications.ts b/apps/desktop/src/i18n/zh_notifications.tsnew file mode 100644index 00000000000..314383a9766--- /dev/null+++ b/apps/desktop/src/i18n/zh_notifications.ts@@ -0,0 +1,48 @@+// Notification settings copy used when the desktop locale loads.+export const zhNotifications = {+ title: '通知',+ intro: '原生桌面通知,区别于应用内提示。设置按设备保存,每台电脑各自独立。',+ enableAll: '启用通知',+ enableAllDesc: '关闭后静音下方所有通知。',+ focusedHint: '完成提醒仅在 Hermes 处于后台时触发。',+ kinds: {+ approval: {+ label: '需要批准',+ description: '有命令正在等待你批准或拒绝。'+ },+ input: {+ label: '需要输入',+ description: 'Hermes 提出了问题,或需要密码或密钥。'+ },+ turnDone: {+ label: '回复就绪',+ description: 'Hermes 在后台时完成了一轮对话。'+ },+ turnError: {+ label: '本轮失败',+ description: '后台回合错误。'+ },+ backgroundDone: {+ label: '后台任务完成',+ description: '后台终端命令已完成。'+ },+ credits: {+ label: '额度提醒',+ description: '额度访问被暂停或恢复。'+ },+ plugin: {+ label: '插件通知',+ description: 'Hermes 在后台时,桌面插件发送了通知。'+ }+ },+ test: '发送测试通知',+ testTitle: 'Hermes',+ testBody: '通知工作正常。',+ testSent: '测试已发送。如果没有出现,请检查系统通知权限和专注模式/勿扰模式。',+ testUnsupported: '此系统不支持原生通知。',+ muteSoundsTitle: '静音界面提示音',+ muteSoundsDesc: '关闭自动完成、唤醒词和思考提示音、触感反馈以及系统通知声音。声音预览和语音回复仍会播放。',+ completionSoundTitle: '完成提示音',+ completionSoundDesc: '智能体回合结束时播放。可在此选择预设并预览。',+ completionSoundPreview: '预览'+}diff --git a/apps/desktop/src/lib/completion-sound.test.ts b/apps/desktop/src/lib/completion-sound.test.tsnew file mode 100644index 00000000000..0805439473c--- /dev/null+++ b/apps/desktop/src/lib/completion-sound.test.ts@@ -0,0 +1,75 @@+// Check completion cue ownership races without opening a real audio device.+import { afterEach, expect, it, vi } from 'vitest'++import { getAudioContext } from '@/lib/audio-context'+import {+ $completionSoundVariantId,+ DEFAULT_COMPLETION_SOUND_VARIANT_ID,+ NO_COMPLETION_SOUND_VARIANT_ID+} from '@/store/completion-sound'+import { $hapticsMuted, setHapticsMuted } from '@/store/haptics'++import { playCompletionSound, previewCompletionSound } from './completion-sound'++vi.mock('@/lib/audio-context', () => ({ getAudioContext: vi.fn(() => null) }))++const original = window.hermesDesktop++afterEach(() => {+ window.hermesDesktop = original+ setHapticsMuted(false)+ $completionSoundVariantId.set(DEFAULT_COMPLETION_SOUND_VARIANT_ID)+ vi.clearAllMocks()+})++it('rechecks mute after ownership resolves, including a failed claim and a later retry', async () => {+ for (const fail of [false, true]) {+ let resolve!: (owns: boolean) => void+ let reject!: (error: Error) => void++ const pending = new Promise<boolean>((yes, no) => {+ resolve = yes+ reject = no+ })++ const claim = vi.fn(() => pending)+ window.hermesDesktop = { ...original, claimAmbientCue: claim }+ setHapticsMuted(false)+ playCompletionSound('session')+ expect(claim).toHaveBeenCalledWith('sound:session')+ setHapticsMuted(true)++ if (fail) {+ reject(new Error('Ownership bridge unavailable'))+ } else {+ resolve(true)+ }++ // Drain the real ownership helper and its completion callback.+ await pending.catch(() => undefined)+ await Promise.resolve()+ expect(getAudioContext).not.toHaveBeenCalled()+ playCompletionSound('session')+ expect(claim).toHaveBeenCalledTimes(1)+ }++ setHapticsMuted(false)+ window.hermesDesktop = { ...original, claimAmbientCue: vi.fn(async () => true) }+ playCompletionSound('session')+ await Promise.resolve()+ await Promise.resolve()+ expect(getAudioContext).toHaveBeenCalledTimes(1)+ expect($hapticsMuted.get()).toBe(false)+})++it('stays silent on None and never claims the cue from an audible peer', () => {+ const claim = vi.fn(async () => true)+ window.hermesDesktop = { ...original, claimAmbientCue: claim }+ $completionSoundVariantId.set(NO_COMPLETION_SOUND_VARIANT_ID)++ playCompletionSound('session')+ previewCompletionSound()++ expect(claim).not.toHaveBeenCalled()+ expect(getAudioContext).not.toHaveBeenCalled()+})diff --git a/apps/desktop/src/lib/completion-sound.ts b/apps/desktop/src/lib/completion-sound.tsindex 6245c10723e..f74f2594a41 100644--- a/apps/desktop/src/lib/completion-sound.ts+++ b/apps/desktop/src/lib/completion-sound.ts@@ -1,9 +1,14 @@// Completion sound bank for agent turn-end cues.-// Fourteen curated presets for A/B in Settings → Appearance. Default is variant 1.+// Fourteen curated presets for A/B in Settings → Appearance, plus variant 0+// ("None") to turn the cue off. Default is variant 1.import { getAudioContext } from '@/lib/audio-context'import { ownsAmbientCue } from '@/store/ambient'-import { $completionSoundVariantId, resolveCompletionSoundVariantId } from '@/store/completion-sound'+import {+ $completionSoundVariantId,+ NO_COMPLETION_SOUND_VARIANT_ID,+ resolveCompletionSoundVariantId+} from '@/store/completion-sound'import { $hapticsMuted } from '@/store/haptics'type OscType = OscillatorType@@ -219,6 +224,13 @@ const C5 = 523.25const C6 = 1046.5export const COMPLETION_SOUND_VARIANTS: readonly CompletionSoundVariant[] = [+ // Variant 0 = "None": playVariant returns before touching the AudioContext,+ // so this play hook is never invoked.+ {+ id: 0,+ name: 'None',+ play: () => undefined+ },{id: 1,name: 'Two-note comfort',@@ -381,6 +393,11 @@ export const COMPLETION_SOUND_VARIANTS: readonly CompletionSoundVariant[] = [] as constfunction playVariant(variantId: number) {+ // "None": bail before any WebAudio scheduling so silence costs nothing.+ if (variantId === NO_COMPLETION_SOUND_VARIANT_ID) {+ return+ }+const variant = COMPLETION_SOUND_VARIANTS.find(v => v.id === variantId)if (!variant) {@@ -418,27 +435,35 @@ function playVariant(variantId: number) {}// Audition the selected variant from settings. Bypasses the haptics mute toggle so-// sound design can be compared even when turn-end cues are silenced.+// sound design can be compared even when turn-end cues are silenced. "None" stays+// silent — playVariant never schedules it.export function previewCompletionSound(variantId?: number) {playVariant(resolveCompletionSoundVariantId(variantId ?? $completionSoundVariantId.get()))}// Plays the selected completion cue on any `message.complete`. Pass a dedupeKey-// (the session id) so only one window beeps when several are open — the mute-// check runs first, so a muted window never claims the cue out from under an-// audible peer.+// (the session id) so only one window beeps when several are open — the mute and+// "None" checks run first, so a silent window never claims the cue out from under+// an audible peer.export function playCompletionSound(dedupeKey?: string) {if ($hapticsMuted.get()) {return}+ // "None" bails here — before the ownsAmbientCue claim — for the same reason+ // as the mute check above: a silent window must not steal the cue.+ if ($completionSoundVariantId.get() === NO_COMPLETION_SOUND_VARIANT_ID) {+ return+ }+const play = () => playVariant($completionSoundVariantId.get())if (!dedupeKey) {return play()}- void ownsAmbientCue(`sound:${dedupeKey}`).then(owns => owns && play())+ // A user can mute this window while the ownership request is in flight.+ void ownsAmbientCue(`sound:${dedupeKey}`).then(owns => owns && !$hapticsMuted.get() && play())}interface AirPuffSpec {diff --git a/apps/desktop/src/store/completion-sound.ts b/apps/desktop/src/store/completion-sound.tsindex 2db17feb589..f73c2aaddb4 100644--- a/apps/desktop/src/store/completion-sound.ts+++ b/apps/desktop/src/store/completion-sound.ts@@ -6,13 +6,17 @@ const STORAGE_KEY = 'hermes.desktop.completionSoundVariantId'export const DEFAULT_COMPLETION_SOUND_VARIANT_ID = 1-// Range mirrors COMPLETION_SOUND_VARIANTS in lib/completion-sound.ts. Validating-// by range (not membership) keeps this store free of a dependency on the lib,-// which imports the atom back — a membership check would close that cycle.+// "None": variant 0 disables the turn-end cue but stays a selectable settings value.+export const NO_COMPLETION_SOUND_VARIANT_ID = 0++// Range mirrors COMPLETION_SOUND_VARIANTS in lib/completion-sound.ts (0 = no+// sound). Validating by range (not membership) keeps this store free of a+// dependency on the lib, which imports the atom back — a membership check would+// close that cycle.const VARIANT_COUNT = 14export function resolveCompletionSoundVariantId(variantId: number): number {- return Number.isInteger(variantId) && variantId >= 1 && variantId <= VARIANT_COUNT+ return Number.isInteger(variantId) && variantId >= 0 && variantId <= VARIANT_COUNT? variantId: DEFAULT_COMPLETION_SOUND_VARIANT_ID}diff --git a/apps/desktop/src/store/haptics.ts b/apps/desktop/src/store/haptics.tsindex 8fc787351ad..ef600887dab 100644--- a/apps/desktop/src/store/haptics.ts+++ b/apps/desktop/src/store/haptics.ts@@ -8,6 +8,15 @@ export const $hapticsMuted = atom(storedBoolean(HAPTICS_MUTED_STORAGE_KEY, false$hapticsMuted.subscribe(muted => persistBoolean(HAPTICS_MUTED_STORAGE_KEY, muted))+// Keep automatic cues quiet in every open window, not just the settings window.+if (typeof window !== 'undefined') {+ window.addEventListener('storage', event => {+ if (event.key === HAPTICS_MUTED_STORAGE_KEY) {+ $hapticsMuted.set(storedBoolean(HAPTICS_MUTED_STORAGE_KEY, false))+ }+ })+}+export function setHapticsMuted(muted: boolean) {$hapticsMuted.set(muted)}diff --git a/apps/desktop/src/store/native-notifications.test.ts b/apps/desktop/src/store/native-notifications.test.tsindex 550ab44fb76..bfb3f3e7976 100644--- a/apps/desktop/src/store/native-notifications.test.ts+++ b/apps/desktop/src/store/native-notifications.test.ts@@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import { createClientSessionState } from '@/lib/chat-runtime'import { $gateway } from './gateway'+import { setHapticsMuted } from './haptics'import {clearPluginNotifyHandlers,dispatchNativeNotification,@@ -144,7 +145,9 @@ describe('dispatchNativeNotification preferences', () => {it('suppresses everything when the master switch is off', () => {setNativeNotifyEnabled(false)dispatchNativeNotification({ kind: 'approval', sessionId: freshSession(), title: 'approve' })- dispatchNativeNotification({ kind: 'turnDone', sessionId: freshSession(), title: 'done' })+ const sessionId = freshSession()+ setActiveSessionId(sessionId)+ dispatchNativeNotification({ kind: 'turnDone', sessionId, title: 'done' })expect(notify).not.toHaveBeenCalled()})@@ -381,3 +384,25 @@ describe('respondToApprovalAction', () => {expect(request).not.toHaveBeenCalled()})})++describe('app sounds mute', () => {+ afterEach(() => setHapticsMuted(false))++ const fire = () => {+ const sessionId = freshSession()+ setActiveSessionId(sessionId)+ dispatchNativeNotification({ kind: 'turnDone', sessionId, title: 'done' })+ dispatchPluginNativeNotification(freshSession(), { title: 'Opportunity' })++ return notify.mock.calls.map(([payload]) => payload.silent)+ }++ it('sends OS notifications silently while app sounds are muted', () => {+ setHapticsMuted(true)+ expect(fire()).toEqual([true, true])+ })++ it('leaves OS notification sound alone when not muted', () => {+ expect(fire()).toEqual([undefined, undefined])+ })+})diff --git a/apps/desktop/src/store/native-notifications.ts b/apps/desktop/src/store/native-notifications.tsindex cd0e0c2af6d..39b0892fb1a 100644--- a/apps/desktop/src/store/native-notifications.ts+++ b/apps/desktop/src/store/native-notifications.ts@@ -6,6 +6,7 @@ import { persistString, storedString } from '@/lib/storage'import { recordFeatureToggle } from './desktop-metrics'import { $gateway } from './gateway'+import { $hapticsMuted } from './haptics'import { withinNativeNotifyBaseline } from './notify-baseline'import {answerApproval,@@ -253,7 +254,8 @@ export function dispatchNativeNotification(input: NativeNotificationInput): boolkind: input.kind,notifyId: input.notifyId,sessionId: input.sessionId ?? undefined,- silent: input.silent,+ // The app-sounds mute also silences OS notification sounds.+ silent: $hapticsMuted.get() || input.silent,tag: input.tag,title})@@ -361,7 +363,8 @@ export function dispatchPluginNativeNotification(pluginId: string, input: Pluginicon: input.icon,kind: 'plugin',notifyId,- silent: input.silent,+ // The app-sounds mute also silences OS notification sounds.+ silent: $hapticsMuted.get() || input.silent,tag: pluginId,title: input.title})diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.jsonindex 2e8913e52b4..51bf60fa360 100644--- a/locales/_keys.desktop.json+++ b/locales/_keys.desktop.json@@ -3779,6 +3779,8 @@"settings.notifications.kinds.turnDone.label","settings.notifications.kinds.turnError.description","settings.notifications.kinds.turnError.label",+ "settings.notifications.muteSoundsDesc",+ "settings.notifications.muteSoundsTitle","settings.notifications.test","settings.notifications.testBody","settings.notifications.testSent",