Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(wake): give the wake word its own language setting, decoupled from the app language
Ruben Lütke6a3732a7719c
diff --git a/docs/product/personalize-and-connect/audio-and-wake-word.md b/docs/product/personalize-and-connect/audio-and-wake-word.mdindex 6d58e15d6c..bb8162c668 100644--- a/docs/product/personalize-and-connect/audio-and-wake-word.md+++ b/docs/product/personalize-and-connect/audio-and-wake-word.md@@ -89,7 +89,9 @@ still saved; restart the app before testing it.Settings field accepts the complete phrase.3. Under **Which language do you speak?**, choose the language in which youpronounce the phrase. The choices are English, German, and Spanish. Choose- based on your speech, not the origin of the name or word.+ based on your speech, not the origin of the name or word. This choice is+ independent of the app's display language and the general voice recognition+ language — switching either of those never moves your wake-word language.4. Leave **Detection engine** on **Auto (recommended)**. Auto looks for a localoption that can serve your exact phrase and current language.5. Select **Save wake word**. A running desktop voice pipeline applies the newdiff --git a/docs/product/personalize-and-connect/settings-and-appearance.md b/docs/product/personalize-and-connect/settings-and-appearance.mdindex 1a8fc3a8dd..fa735de6e5 100644--- a/docs/product/personalize-and-connect/settings-and-appearance.md+++ b/docs/product/personalize-and-connect/settings-and-appearance.md@@ -61,10 +61,12 @@ Read [Languages and Voices](languages-and-voices) before changing severallanguage controls at once. Read [Audio Devices and Wake Word](audio-and-wake-word)for the complete microphone and wake setup.-The **Which language do you speak?** choice inside Wake Word changes the same-recognition setting shown as **Voice Recognition Language** under Languages.-The Wake Word panel asks for a specific spoken language because its local-detector needs one; changing either control updates the other.+The **Which language do you speak?** choice inside Wake Word is the wake+word's own, independent language setting. It only decides which local acoustic+model listens for your phrase. It does not change the interface language, the+**Voice Recognition Language** under Languages, or the reply language — and+none of those change it back. The app can stay in English while your wake word+is spoken in German.### Realtime Voice and Providersdiff --git a/jarvis/core/config.py b/jarvis/core/config.pyindex 018a46208e..358a5e4fb2 100644--- a/jarvis/core/config.py+++ b/jarvis/core/config.py@@ -270,6 +270,14 @@ class WakeWordConfig(BaseModel):engine: str = "auto"# Path to a user-supplied/trained .onnx wake model (engine="custom_onnx").custom_model_path: str = ""+ # The language the user SPEAKS their wake word in — an INDEPENDENT setting,+ # deliberately decoupled from the app display language ([ui].language) and+ # the general recognition language ([stt].language). "auto" keeps the+ # legacy cascade (stt -> ui -> default) so existing installs behave+ # unchanged; a concrete code ("de"/"en"/"es") pins the wake model's+ # language for good — switching the app language never moves it again.+ # Resolved by jarvis/speech/wake_model_fetch.py::resolve_wake_language.+ language: str = "auto"# READ-COMPAT ONLY, runtime-ignored since 2026-07-10: the user-facing# Sensitivity slider was removed (mandate: always run every wake path at# its calibrated-reliable maximum-speed value, identically on every OS —@@ -292,6 +300,15 @@ class WakeWordConfig(BaseModel):text = str(value or "").strip().lower()return text if text in WAKE_ENGINES else "auto"+ @field_validator("language", mode="before")+ @classmethod+ def _coerce_language(cls, value: object) -> str:+ # Normalize only — membership is checked by resolve_wake_language, so an+ # unknown value simply falls through the cascade instead of failing+ # validation (a stale/hand-edited config must never brick boot, AP-16).+ text = str(value or "").strip().lower()+ return text or "auto"+@field_validator("sensitivity", mode="before")@classmethoddef _floor_sensitivity(cls, value: object) -> float:diff --git a/jarvis/core/config_writer.py b/jarvis/core/config_writer.pyindex dd8d46647c..bda73d5824 100644--- a/jarvis/core/config_writer.py+++ b/jarvis/core/config_writer.py@@ -585,6 +585,21 @@ def set_wake_word(log.debug("persona-name strip skipped: %s", exc)+def set_wake_language(language: str, *, path: Path = DEFAULT_CONFIG_FILE) -> None:+ """Persist the wake-word language pin to ``[trigger.wake_word] language``.++ One of ``auto`` | ``de`` | ``en`` | ``es`` (validated by the caller). This is+ the user's INDEPENDENT wake-word language: a concrete code pins which+ acoustic model hears the wake word, decoupled from both the app display+ language (``[ui] language``) and the general recognition language+ (``[stt] language``); ``auto`` keeps the legacy cascade (stt -> ui ->+ default). TOML-only by design, same rationale as :func:`set_wake_word`:+ ``trigger.wake_word`` is deliberately NOT tracked in ``config-soll.json``, # i18n-allow+ so a plain atomic write is never reverted and no ENV layer applies.+ """+ _patch_wake_word_toml(path, {"language": language})++def set_wake_word_enabled(enabled: bool, *, path: Path = DEFAULT_CONFIG_FILE) -> None:"""Persist the wake-word activation toggle to ``[trigger] wake_word_enabled``.diff --git a/jarvis/speech/wake_model_fetch.py b/jarvis/speech/wake_model_fetch.pyindex 5f0e0aa0e1..8c000e4bec 100644--- a/jarvis/speech/wake_model_fetch.py+++ b/jarvis/speech/wake_model_fetch.py@@ -75,12 +75,25 @@ def _normalized_membership_key(language: Any) -> str:def resolve_wake_language(cfg: Any) -> str:"""Best speech language for the wake model.- Cascade: ``cfg.stt.language`` when it names a concrete supported code (the- user explicitly forced a recognition language) -> ``cfg.ui.language`` (the- language the user actually chose in onboarding) -> ``DEFAULT_LOCALE``. Both- reads are duck-typed (``getattr`` chains) and this never raises, so a- missing/odd ``stt``/``ui``/``cfg`` just falls through to the next step.+ Cascade: ``cfg.trigger.wake_word.language`` when it names a concrete+ supported code (the user pinned the wake-word language in Settings — an+ INDEPENDENT choice that must never follow the app display language) ->+ ``cfg.stt.language`` when concrete (the user forced a recognition+ language) -> ``cfg.ui.language`` (the language the user chose in+ onboarding, a sensible default while nothing is pinned) ->+ ``DEFAULT_LOCALE``. All reads are duck-typed (``getattr`` chains) and this+ never raises, so a missing/odd ``trigger``/``stt``/``ui``/``cfg`` just+ falls through to the next step."""+ try:+ wake_lang = getattr(+ getattr(getattr(cfg, "trigger", None), "wake_word", None), "language", None+ )+ except Exception: # noqa: BLE001 - duck-typed cfg read must never raise+ wake_lang = None+ if _normalized_membership_key(wake_lang) in VOSK_MODELS:+ return vosk_lang_for(wake_lang)+try:stt_lang = getattr(getattr(cfg, "stt", None), "language", None)except Exception: # noqa: BLE001 - duck-typed cfg read must never raisediff --git a/jarvis/ui/web/frontend/src/hooks/useWakeWord.ts b/jarvis/ui/web/frontend/src/hooks/useWakeWord.tsindex ccf0031906..d560903c35 100644--- a/jarvis/ui/web/frontend/src/hooks/useWakeWord.ts+++ b/jarvis/ui/web/frontend/src/hooks/useWakeWord.ts@@ -9,6 +9,10 @@ export interface WakeWordConfig {engine: string;custom_model_path: string;fuzzy_match_ratio: number;+ // The independent wake-word language pin ("auto" = derive a sensible+ // default; a concrete code pins the acoustic model's language and never+ // follows the app display language).+ language: string;engines: string[];instant_phrases: string[];local_whisper_available: boolean;@@ -119,6 +123,24 @@ export function useWakeWord() {[],);+ // Pin the wake-word language (PUT /api/settings/wake-language). Applies+ // immediately: the backend live-swaps the wake plan and provisions the+ // matching model in the background when it is not on disk yet. Deliberately+ // its OWN setting — never writes the app display language or the general+ // STT recognition language.+ const setWakeLanguage = useCallback(async (language: string): Promise<void> => {+ const res = await fetch("/api/settings/wake-language", {+ method: "PUT",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ language }),+ });+ const body = await res.json().catch(() => ({}));+ if (!res.ok) {+ throw new Error(body.detail ?? `HTTP ${res.status}`);+ }+ window.dispatchEvent(new CustomEvent("jarvis:wake-word-changed"));+ }, []);+// Turn the always-on wake word ON/OFF (the activation master switch). The// backend applies it to a running voice pipeline and only requests a restart// when no live desktop voice pipeline exists.@@ -139,7 +161,7 @@ export function useWakeWord() {[],);- return { config, loading, error, refetch, saveWakeWord, setWakeActivation };+ return { config, loading, error, refetch, saveWakeWord, setWakeLanguage, setWakeActivation };}/**diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 154ddf7bd0..2ad45a7149 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -1231,7 +1231,7 @@"phrase_placeholder": "z. B. Jonas","language_label": "Welche Sprache sprichst du?","language_callout_title": "Wähle die Sprache, die DU sprichst — nicht die Herkunft des Wortes.",- "language_hint": "Jarvis erkennt deine Aussprache, nicht das Wort selbst. Wenn du Deutsch sprichst, wähle Deutsch — auch bei einem Namen wie „Alex\" oder einem englischen Wort. Falsche Sprache = Jarvis hört dich lautlos nie.",+ "language_hint": "Jarvis erkennt deine Aussprache, nicht das Wort selbst. Wenn du Deutsch sprichst, wähle Deutsch — auch bei einem Namen wie „Alex\" oder einem englischen Wort. Falsche Sprache = Jarvis hört dich lautlos nie. Diese Wahl ist unabhängig von der Anzeigesprache der App — die App kann auf Englisch bleiben, während dein Wake-Word Deutsch ist.","language_placeholder": "Sprache wählen, die du sprichst …","self_test_button": "Wake-Word testen","self_test_running": "Prüfe …",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex be9f2090c8..33a3c6a7b0 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -1232,7 +1232,7 @@"phrase_placeholder": "e.g. Jonas","language_label": "Which language do you speak?","language_callout_title": "Choose the language you SPEAK — not where the word comes from.",- "language_hint": "Jarvis matches your pronunciation, not the word itself. If you speak German, choose German — even for a name like \"Alex\" or an English word. Pick the wrong language and Jarvis silently never hears you.",+ "language_hint": "Jarvis matches your pronunciation, not the word itself. If you speak German, choose German — even for a name like \"Alex\" or an English word. Pick the wrong language and Jarvis silently never hears you. This choice is independent of the app's display language — the app can stay in English while your wake word is German.","language_placeholder": "Select the language you speak…","self_test_button": "Test wake word","self_test_running": "Checking…",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex bf59ff9b44..7edc8d13f5 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -1231,7 +1231,7 @@"phrase_placeholder": "p. ej. Jonas","language_label": "¿Qué idioma hablas?","language_callout_title": "Elige el idioma que HABLAS, no el origen de la palabra.",- "language_hint": "Jarvis reconoce tu pronunciación, no la palabra en sí. Si hablas alemán, elige alemán — incluso para un nombre como \"Alex\" o una palabra en inglés. Un idioma equivocado y Jarvis nunca te oye, en silencio.",+ "language_hint": "Jarvis reconoce tu pronunciación, no la palabra en sí. Si hablas alemán, elige alemán — incluso para un nombre como \"Alex\" o una palabra en inglés. Un idioma equivocado y Jarvis nunca te oye, en silencio. Esta elección es independiente del idioma de la interfaz — la app puede quedarse en inglés mientras tu palabra de activación es en alemán.","language_placeholder": "Elige el idioma que hablas…","self_test_button": "Probar palabra de activación","self_test_running": "Comprobando …",diff --git a/jarvis/ui/web/frontend/src/views/SettingsView.tsx b/jarvis/ui/web/frontend/src/views/SettingsView.tsxindex 88e227c9c2..33f709767f 100644--- a/jarvis/ui/web/frontend/src/views/SettingsView.tsx+++ b/jarvis/ui/web/frontend/src/views/SettingsView.tsx@@ -43,20 +43,22 @@ import { detectKeyboardPlatform } from "@/views/settings/keyboardLayout";import { deriveAssistantName } from "@/lib/deriveAssistantName";import { WAKE_ENGINES, WAKE_ENGINE_I18N_KEY } from "@/constants/wakeEngines";import { useEventStore } from "@/store/events";-import {- useT,- useSttLanguage,- setSttLanguage,- hydrateSttLanguage,- type SttLanguage,-} from "@/i18n";+import { useT } from "@/i18n";++// The wake-word language pin — its OWN setting ([trigger.wake_word] language),+// deliberately independent of both the app display language and the general+// STT recognition language (maintainer mandate 2026-07-21: app in English ++// wake word spoken in German must be possible, with neither following the+// other). Mirrors jarvis/ui/web/settings_routes.py::_WAKE_LANGUAGES minus+// "auto".+type WakeLanguage = "en" | "de" | "es";// Concrete spoken languages only — "auto" is deliberately NOT offered here: the// wake word must be pinned to the language the user actually speaks (an-// ambiguous "auto" silently defaults to the interface language, the exact trap-// that left German speakers deaf). A user on "auto" sees a "choose your+// ambiguous "auto" silently derives a default from other settings, the exact+// trap that left German speakers deaf). A user on "auto" sees a "choose your// language" placeholder until they pick.-const WAKE_STT_LANGUAGES: SttLanguage[] = ["en", "de", "es"];+const WAKE_LANGUAGES: WakeLanguage[] = ["en", "de", "es"];interface WakeSelfTestResult {ok: boolean;@@ -167,10 +169,10 @@ function LanguageDropdown({disabled,}: {value: string;- options: SttLanguage[];+ options: WakeLanguage[];placeholder: string;- labelFor: (code: SttLanguage) => string;- onChange: (code: SttLanguage) => void;+ labelFor: (code: WakeLanguage) => string;+ onChange: (code: WakeLanguage) => void;disabled?: boolean;}) {const [open, setOpen] = useState(false);@@ -192,7 +194,7 @@ function LanguageDropdown({}, [open]);const selected = (options as string[]).includes(value)- ? labelFor(value as SttLanguage)+ ? labelFor(value as WakeLanguage): null;return (@@ -247,19 +249,21 @@ function LanguageDropdown({function WakeWordPanel() {const t = useT();- const { config, loading, error, saveWakeWord, refetch, setWakeActivation } = useWakeWord();+ const { config, loading, error, saveWakeWord, refetch, setWakeLanguage, setWakeActivation } =+ useWakeWord();const pushToast = useEventStore((s) => s.pushToast);// In-app installer for the local speech pack (faster-whisper) that unlocks any// wake phrase. Refetch the wake config on success so the hint clears.const { status: installStatus, install } = useLocalSpeechInstall(refetch);- // The voice-recognition language IS the wake language: a Vosk model is- // acoustically language-specific, so the model must match the language the- // user speaks their wake word in. Reuses the existing STT-language machinery- // (same backend field the runtime wake plan resolves against) — surfaced here- // so the user can fix the #1 cause of a dead wake word without leaving the- // panel.- const sttLang = useSttLanguage();+ // The wake-word language pin: a Vosk model is acoustically language-specific,+ // so the model must match the language the user speaks their wake word in.+ // Its OWN backend setting ([trigger.wake_word] language) — independent of the+ // app display language and the general STT recognition language, so switching+ // either never silently moves the wake model. Local state mirrors the config+ // for a snappy dropdown; the backend refetch (via jarvis:wake-word-changed)+ // keeps it truthful.+ const [wakeLang, setWakeLangLocal] = useState("auto");const [phrase, setPhrase] = useState("");const [engine, setEngine] = useState<string>("auto");const [customModelPath, setCustomModelPath] = useState("");@@ -288,14 +292,24 @@ function WakeWordPanel() {setPhrase(config.phrase);setEngine(config.engine || "auto");setCustomModelPath(config.custom_model_path ?? "");+ // ?? "auto" keeps the dropdown controlled even if an older backend omits it.+ setWakeLangLocal(config.language ?? "auto");// ?? false keeps the Switch controlled even if an older backend omits it.setEnabled(config.enabled ?? false);}, [config]);- // Reflect the backend's persisted STT/wake language on open.- useEffect(() => {- void hydrateSttLanguage();- }, []);+ // Pin the wake language: optimistic local update, then persist + live-apply+ // via the backend. On failure, revert and surface the honest error.+ async function onPickWakeLanguage(code: WakeLanguage) {+ const previous = wakeLang;+ setWakeLangLocal(code);+ try {+ await setWakeLanguage(code);+ } catch (e) {+ setWakeLangLocal(previous);+ pushToast("error", (e as Error).message);+ }+ }async function onToggleActivation(next: boolean) {setTogglingActivation(true);@@ -409,7 +423,7 @@ function WakeWordPanel() {ok: false,phrase,engine,- language: sttLang,+ language: wakeLang,wake_available: false,phrase_in_vocab: null,mic_ok: false,@@ -474,8 +488,10 @@ function WakeWordPanel() {and the trap is unintuitive: it is about the language the userSPEAKS (their accent/pronunciation), NOT the origin of the word("Ruben" is heard by the German model because the user speaks it- in German, not because the name is German). Bound to the shared- STT-language machinery so it agrees with the runtime wake plan. */}+ in German, not because the name is German). Bound to the wake+ word's OWN language pin ([trigger.wake_word] language) — the app+ display language and the STT recognition language stay untouched,+ and neither can move this choice. */}<div className="mt-4 rounded-md border border-primary/50 bg-primary/5 p-3"><div className="flex items-center gap-2"><Languages className="h-4 w-4 shrink-0 text-primary" />@@ -488,11 +504,11 @@ function WakeWordPanel() {</p><div className="mt-2"><LanguageDropdown- value={sttLang}- options={WAKE_STT_LANGUAGES}+ value={wakeLang}+ options={WAKE_LANGUAGES}placeholder={t("settings_view.wake_word.language_placeholder")}labelFor={(code) => t(`languages_view.options.${code}.label`)}- onChange={(code) => void setSttLanguage(code)}+ onChange={(code) => void onPickWakeLanguage(code)}disabled={loading}/></div>diff --git a/jarvis/ui/web/settings_routes.py b/jarvis/ui/web/settings_routes.pyindex d9a090cdfb..d646b350fb 100644--- a/jarvis/ui/web/settings_routes.py+++ b/jarvis/ui/web/settings_routes.py@@ -477,14 +477,32 @@ async def put_stt_language(body: SttLanguageBody, request: Request) -> dict[str,except Exception as exc: # noqa: BLE001 — frozen model is not an errorlog.debug("in-memory cfg.stt.language update skipped: %s", exc)- # Make "switch language -> it works" TRUE without a restart: re-resolve the- # wake word against the NEW language and live-apply it to the running voice- # pipeline (a Vosk model is acoustically language-specific, so the language is- # what decides whether the wake fires at all). If the matching-language model- # is not on disk yet, apply the best available plan now (multilingual- # stt_match) and provision the model in the background, then re-apply so it- # upgrades to the fast vosk_kws path. Best-effort throughout; a headless/down- # pipeline just applies on the next voice start.+ applied_live = _live_apply_wake_plan(request, log_tag="stt-language")++ return {+ "ok": True,+ "language": lang,+ "persisted": persisted,+ "applied_live": applied_live,+ # Only ask for a restart when we could NOT live-apply (no running pipeline).+ "restart_required": not applied_live,+ }+++def _live_apply_wake_plan(request: Request, *, log_tag: str) -> bool:+ """Re-resolve the wake plan against the CURRENT config and live-apply it.++ Makes "switch language -> it works" TRUE without a restart: re-resolve the+ wake word against the newly-effective language and live-apply it to the+ running voice pipeline (a Vosk model is acoustically language-specific, so+ the language is what decides whether the wake fires at all). If the+ matching-language model is not on disk yet, apply the best available plan+ now (multilingual stt_match) and provision the model in the background,+ then re-apply so it upgrades to the fast vosk_kws path. Best-effort+ throughout; a headless/down pipeline just applies on the next voice start.+ Shared by the stt-language and wake-language PUT routes (must be called+ from a running event loop). Returns True when a live pipeline took the plan.+ """applied_live = Falsetry:from jarvis.speech import wake_model_fetch as _wmf@@ -517,18 +535,87 @@ async def put_stt_language(body: SttLanguageBody, request: Request) -> dict[str,if landed is not None:_apply_plan(_resolve_plan())except Exception as exc: # noqa: BLE001 — background best-effort- log.debug("stt-language background provision skipped: %s", exc)+ log.debug("%s background provision skipped: %s", log_tag, exc)asyncio.create_task(_provision_then_reapply())except Exception as exc: # noqa: BLE001 — never fail the language save on a live hiccup- log.warning("stt-language wake live-apply skipped: %s", exc)+ log.warning("%s wake live-apply skipped: %s", log_tag, exc)+ return applied_live+++# ----------------------------------------------------------------------+# Wake-word language — the language the user SPEAKS their wake word in. An+# INDEPENDENT setting (maintainer mandate 2026-07-21): it must never follow the+# app display language ([ui].language) or force the general recognition+# language ([stt].language). "auto" keeps the legacy cascade (stt -> ui ->+# default) so untouched installs keep their sensible onboarding default; a+# concrete code pins the wake model's language for good. Persisted to+# [trigger.wake_word] language and resolved by resolve_wake_language.+# ----------------------------------------------------------------------++_WAKE_LANGUAGES: tuple[str, ...] = ("auto", "de", "en", "es")+++class WakeLanguageBody(BaseModel):+ language: str = Field(..., min_length=1)+ persist: bool = Field(default=True, description="Persist as boot default in jarvis.toml")++[email protected]("/wake-language")+async def get_wake_language(request: Request) -> dict[str, object]:+ from jarvis.speech.wake_model_fetch import resolve_wake_language++ cfg = _config(request)+ ww = getattr(getattr(cfg, "trigger", None), "wake_word", None)+ pinned = str(getattr(ww, "language", "auto") or "auto").strip().lower()+ if pinned not in _WAKE_LANGUAGES:+ pinned = "auto"+ return {+ "language": pinned,+ # What the runtime actually resolves right now (the cascade result) —+ # lets a client show the effective language while the pin is "auto".+ "effective_language": resolve_wake_language(cfg),+ "options": list(_WAKE_LANGUAGES),+ }++[email protected]("/wake-language")+async def put_wake_language(body: WakeLanguageBody, request: Request) -> dict[str, object]:+ lang = (body.language or "").strip().lower()+ if lang not in _WAKE_LANGUAGES:+ raise HTTPException(+ status_code=400,+ detail=f"Unknown wake language {body.language!r} (allowed: {list(_WAKE_LANGUAGES)})",+ )++ persisted = False+ if body.persist:+ try:+ from jarvis.core import config_writer+ from jarvis.core.config import resolve_config_path++ config_writer.set_wake_language(lang, path=resolve_config_path())+ persisted = True+ except Exception as exc: # noqa: BLE001 — persist is best-effort+ log.warning("wake-language persist failed: %s", exc)++ # Best-effort in-memory update so the live-apply below (and any later cfg+ # read) already sees the new pin pre-restart.+ cfg = _config(request)+ ww = getattr(getattr(cfg, "trigger", None), "wake_word", None)+ if ww is not None:+ try:+ ww.language = lang+ except Exception as exc: # noqa: BLE001 — frozen model is not an error+ log.debug("in-memory wake_word.language update skipped: %s", exc)++ applied_live = _live_apply_wake_plan(request, log_tag="wake-language")return {"ok": True,"language": lang,"persisted": persisted,"applied_live": applied_live,- # Only ask for a restart when we could NOT live-apply (no running pipeline)."restart_required": not applied_live,}@@ -782,6 +869,8 @@ async def get_wake_word(request: Request) -> dict[str, object]:"engine": ww.engine,"custom_model_path": ww.custom_model_path,"fuzzy_match_ratio": ww.fuzzy_match_ratio,+ # The independent wake-word language pin ("auto" = legacy cascade).+ "language": str(getattr(ww, "language", "auto") or "auto"),"engines": list(WAKE_ENGINES),"instant_phrases": list(INSTANT_WAKE_PHRASES),"local_whisper_available": _local_whisper_available(),@@ -817,9 +906,9 @@ async def put_wake_word(body: WakeWordBody, request: Request) -> dict[str, objec# Preview the resolved plan so the UI can tell the user immediately whether# the chosen phrase will work as-is or degrade (e.g. no local Whisper).# Use the SAME concrete language resolver the runtime wake plan and the model- # download use (stt.language → ui.language → default), never raw "auto" — a- # Vosk model is acoustically language-specific, so selection and provisioning- # must agree on the language.+ # download use (wake_word.language pin → stt.language → ui.language →+ # default), never raw "auto" — a Vosk model is acoustically+ # language-specific, so selection and provisioning must agree on the language.from jarvis.speech.wake_model_fetch import resolve_wake_language_cfg_for_lang = _config(request)diff --git a/tests/unit/core/test_config_writer_wake_word.py b/tests/unit/core/test_config_writer_wake_word.pyindex 2560ff31c4..a87b27f818 100644--- a/tests/unit/core/test_config_writer_wake_word.py+++ b/tests/unit/core/test_config_writer_wake_word.py@@ -111,6 +111,32 @@ def test_set_wake_word_creates_section_if_missing(tmp_path: Path) -> None:assert ww["engine"] == "stt_match"+def test_set_wake_language_writes_the_pin_and_preserves_siblings(tmp_path: Path) -> None:+ # The independent wake-word language pin (decoupling mandate 2026-07-21):+ # persisted under [trigger.wake_word] language, TOML-only like set_wake_word,+ # preserving the phrase, sibling keys, and comments.+ f = _write(tmp_path)+ config_writer.set_wake_language("de", path=f)+ data = _load(f)+ ww = data["trigger"]["wake_word"]+ assert ww["language"] == "de"+ assert ww["phrase"] == "Hey Jarvis" # sibling wake keys untouched+ assert data["trigger"]["single_turn_mode"] is False+ assert "keep this comment" in f.read_text(encoding="utf-8")+ # And back to the legacy-cascade default.+ config_writer.set_wake_language("auto", path=f)+ assert _load(f)["trigger"]["wake_word"]["language"] == "auto"+++def test_set_wake_language_is_bom_safe_and_creates_section(tmp_path: Path) -> None:+ f = tmp_path / "jarvis.toml"+ f.write_bytes(b"\xef\xbb\xbf" + b"[trigger]\nsingle_turn_mode = false\n")+ config_writer.set_wake_language("es", path=f)+ raw = f.read_bytes()+ assert raw.startswith(b"\xef\xbb\xbf"), "BOM must be preserved"+ assert _load(f)["trigger"]["wake_word"]["language"] == "es"++def test_set_wake_word_enabled_toggles_the_activation_switch(tmp_path: Path) -> None:# The activation master switch (product rule 2026-07-04): in-app on/off,# persisted to [trigger] wake_word_enabled, preserving sibling keys + comments.diff --git a/tests/unit/speech/test_wake_language_aware.py b/tests/unit/speech/test_wake_language_aware.pyindex 2ee5557d60..f361c052a6 100644--- a/tests/unit/speech/test_wake_language_aware.py+++ b/tests/unit/speech/test_wake_language_aware.py@@ -131,14 +131,24 @@ def test_mismatched_language_no_whisper_is_honest_wake_off(de_model):# ---------------------------------------------------------------------------# resolve_wake_language cascade (stt → ui → default) — one SoT everywhere+# resolve_wake_language cascade (wake pin → stt → ui → default) — one SoT+# everywhere# --------------------------------------------------------------------------def test_resolve_wake_language_cascade():from jarvis.speech.wake_model_fetch import resolve_wake_language- # stt.language concrete wins+ # the explicit wake-word pin wins over everything (the 2026-07-21+ # decoupling: the wake language must never follow the app language)+ assert resolve_wake_language(+ SimpleNamespace(+ trigger=SimpleNamespace(wake_word=SimpleNamespace(language="de")),+ stt=SimpleNamespace(language="en"),+ ui=SimpleNamespace(language="en"),+ )+ ) == "de"+ # stt.language concrete wins while the pin is "auto"assert resolve_wake_language(SimpleNamespace(stt=SimpleNamespace(language="de"), ui=SimpleNamespace(language="en"))) == "de"@@ -189,10 +199,10 @@ def test_wake_high_accuracy_defaults_to_cpu():def test_stt_language_list_parity_python_ts():- # The wake language selector reuses the STT-language machinery. If the Python- # accepted set (settings_routes._STT_LANGUAGES) and the TS SttLanguage union- # drift, the Settings dropdown offers a value the backend rejects (or vice- # versa). Set-equality (order-independent) so a re-ordering never false-fails.+ # If the Python accepted set (settings_routes._STT_LANGUAGES) and the TS+ # SttLanguage union drift, the Languages view offers a value the backend+ # rejects (or vice versa). Set-equality (order-independent) so a+ # re-ordering never false-fails.import refrom jarvis.ui.web.settings_routes import _STT_LANGUAGES@@ -209,3 +219,33 @@ def test_stt_language_list_parity_python_ts():f"TS {ts_langs} != Python {set(_STT_LANGUAGES)} — keep the STT language ""list in lockstep (settings_routes._STT_LANGUAGES ↔ i18n SttLanguage).")+++def test_wake_language_list_parity_python_ts():+ # The wake-word language is its OWN setting (decoupled from the app display+ # language and the STT recognition language, 2026-07-21). The Settings+ # dropdown (SettingsView WAKE_LANGUAGES) deliberately omits "auto" — every+ # concrete code it offers must be accepted by the backend route+ # (settings_routes._WAKE_LANGUAGES), and both must stay within the models+ # the fetcher can actually provision (VOSK_MODELS).+ import re++ from jarvis.speech.wake_model_fetch import VOSK_MODELS+ from jarvis.ui.web.settings_routes import _WAKE_LANGUAGES++ ts_path = (+ Path(__file__).resolve().parents[3]+ / "jarvis" / "ui" / "web" / "frontend" / "src" / "views" / "SettingsView.tsx"+ )+ text = ts_path.read_text(encoding="utf-8")+ m = re.search(r"const WAKE_LANGUAGES: WakeLanguage\[\]\s*=\s*\[([^\]]+)\]", text)+ assert m, "WAKE_LANGUAGES const not found in SettingsView.tsx"+ ts_langs = set(re.findall(r"[\"']([a-z]+)[\"']", m.group(1)))+ assert ts_langs == set(_WAKE_LANGUAGES) - {"auto"}, (+ f"TS {ts_langs} != Python {set(_WAKE_LANGUAGES) - {'auto'}} — keep the wake "+ "language list in lockstep (settings_routes._WAKE_LANGUAGES ↔ "+ "SettingsView WAKE_LANGUAGES)."+ )+ assert set(_WAKE_LANGUAGES) - {"auto"} == set(VOSK_MODELS), (+ "every pinnable wake language needs a provisionable Vosk model"+ )diff --git a/tests/unit/speech/test_wake_model_fetch.py b/tests/unit/speech/test_wake_model_fetch.pyindex 2c1d88eb75..107d897e90 100644--- a/tests/unit/speech/test_wake_model_fetch.py+++ b/tests/unit/speech/test_wake_model_fetch.py@@ -105,10 +105,59 @@ def test_offline_failure_is_nonfatal(tmp_path):# ----------------------------------------------------------------------------# resolve_wake_language: stt.language (if concrete) -> ui.language -> DEFAULT_LOCALE+# resolve_wake_language: trigger.wake_word.language pin (if concrete) ->+# stt.language (if concrete) -> ui.language -> DEFAULT_LOCALE# ---------------------------------------------------------------------------+def _pin(language: str) -> SimpleNamespace:+ return SimpleNamespace(wake_word=SimpleNamespace(language=language))+++def test_resolve_wake_language_pin_beats_stt_and_ui():+ """The explicit wake-word pin is the user's independent choice — it wins+ over BOTH the recognition language and the app display language (the+ decoupling mandate 2026-07-21: app in English, wake word in German)."""+ cfg = SimpleNamespace(+ trigger=_pin("de"),+ stt=SimpleNamespace(language="es"),+ ui=SimpleNamespace(language="en"),+ )+ assert wmf.resolve_wake_language(cfg) == "de"+++def test_resolve_wake_language_ui_change_never_moves_a_pinned_wake_language():+ """Switching the app display language must not move a pinned wake word."""+ for ui_lang in ("en", "de", "es"):+ cfg = SimpleNamespace(+ trigger=_pin("de"),+ stt=SimpleNamespace(language="auto"),+ ui=SimpleNamespace(language=ui_lang),+ )+ assert wmf.resolve_wake_language(cfg) == "de"+++def test_resolve_wake_language_auto_pin_keeps_legacy_cascade():+ """language='auto' (the default) -> the legacy stt -> ui cascade stands,+ so untouched installs behave exactly as before."""+ cfg = SimpleNamespace(+ trigger=_pin("auto"),+ stt=SimpleNamespace(language="auto"),+ ui=SimpleNamespace(language="es"),+ )+ assert wmf.resolve_wake_language(cfg) == "es"+++def test_resolve_wake_language_unsupported_pin_falls_through():+ """A hand-edited unsupported pin ('fr') must not brick — fall through."""+ cfg = SimpleNamespace(+ trigger=_pin("fr"),+ stt=SimpleNamespace(language="es"),+ ui=SimpleNamespace(language="de"),+ )+ assert wmf.resolve_wake_language(cfg) == "es"++def test_resolve_wake_language_uses_concrete_stt_language():"""An explicit, supported stt.language always wins -- the user forced it."""cfg = SimpleNamespace(diff --git a/tests/unit/ui/test_wake_word_route.py b/tests/unit/ui/test_wake_word_route.pyindex 468b46e5b2..3845c87a04 100644--- a/tests/unit/ui/test_wake_word_route.py+++ b/tests/unit/ui/test_wake_word_route.py@@ -42,6 +42,8 @@ def test_get_returns_current_and_options() -> None:body = _client().get("/api/settings/wake-word").json()assert body["phrase"] == ""assert body["engine"] == "auto"+ # The independent wake-word language pin defaults to the legacy cascade.+ assert body["language"] == "auto"assert "auto" in body["engines"] and "stt_match" in body["engines"]assert "Hey Jarvis" not in body["instant_phrases"] # instant quick-picks are emptyassert isinstance(body["local_whisper_available"], bool)@@ -90,6 +92,62 @@ def test_put_without_pipeline_reports_restart_required() -> None:assert body["restart_required"] is True+# ---------------------------------------------------------------------------+# GET/PUT /api/settings/wake-language — the INDEPENDENT wake-word language pin+# (decoupling mandate 2026-07-21: it must never follow the app display+# language, and pinning it must never touch [ui].language or [stt].language).+# ---------------------------------------------------------------------------+++def test_get_wake_language_reports_pin_effective_and_options() -> None:+ body = _client().get("/api/settings/wake-language").json()+ assert body["language"] == "auto"+ assert body["options"] == ["auto", "de", "en", "es"]+ # With no pin and no stt/ui signal the cascade lands on the default.+ assert body["effective_language"] == "en"+++def test_put_wake_language_pins_without_touching_ui_or_stt(monkeypatch) -> None:+ from jarvis.core import config_writer+ from jarvis.speech import wake_model_fetch++ persisted: list[str] = []+ monkeypatch.setattr(+ config_writer, "set_wake_language", lambda lang, path=None: persisted.append(lang)+ )+ # The matching model is "already on disk" — no background provisioning task.+ monkeypatch.setattr(wake_model_fetch, "vosk_model_present", lambda *_a, **_k: True)++ pipe = _FakePipeline()+ client = _client(wake_word=WakeWordConfig(phrase="Hey Nova"), pipeline=pipe)+ # An app in ENGLISH with default recognition — the exact coupling scenario.+ client.app.state.config.ui = SimpleNamespace(language="en")+ client.app.state.config.stt = SimpleNamespace(language="auto")++ resp = client.put("/api/settings/wake-language", json={"language": "de"})+ body = resp.json()+ assert resp.status_code == 200+ assert body["ok"] is True+ assert body["language"] == "de"+ assert body["persisted"] is True+ assert body["applied_live"] is True+ assert body["restart_required"] is False+ assert persisted == ["de"]+ # The pin landed in-memory and immediately decides the effective language …+ assert client.app.state.config.trigger.wake_word.language == "de"+ assert client.get("/api/settings/wake-language").json()["effective_language"] == "de"+ # … while the app display language and the recognition language are untouched.+ assert client.app.state.config.ui.language == "en"+ assert client.app.state.config.stt.language == "auto"+ # And the live pipeline got a re-resolved plan.+ assert pipe.applied is not None+++def test_put_wake_language_rejects_unknown_code() -> None:+ resp = _client().put("/api/settings/wake-language", json={"language": "klingon"})+ assert resp.status_code == 400++def test_activation_live_applies_without_restart(monkeypatch) -> None:from jarvis.core import config_writer