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
chore: auto-save WIP via Claude stop-hook safety net (2026-07-02 12:38)
Ruben Lütkeab468cd3ab90
diff --git a/desktop-ttu-latest.json b/desktop-ttu-latest.jsonindex 331db337fc..080c485c3c 100644--- a/desktop-ttu-latest.json+++ b/desktop-ttu-latest.json@@ -3,35 +3,34 @@"runs": 3,"python": "C:\\Program Files\\Python311\\python.exe","vault_pages": 84,- "median_wall_ms": 1346.8,- "median_boot_ready_ms": 112.8,- "median_bind_wall_ms": 1032.2,- "median_voice_ready_wall_ms": 6381.8,+ "median_wall_ms": 1197.0,+ "median_boot_ready_ms": 107.0,+ "median_bind_wall_ms": 800.8,+ "median_voice_ready_wall_ms": 6196.0,"voice_ready_wall_ms_runs": [- 6381.8,- 6932.9,- 6050.2+ 8122.8,+ 5804.2,+ 6196.0],- "median_voice_usable_wall_ms": 12059.3,+ "median_voice_usable_wall_ms": 9491.5,"voice_usable_wall_ms_runs": [- 12059.3,- 12190.8,- 10777.6+ 12486.5,+ 9491.5,+ 8865.6],"wall_ms_runs": [- 1346.8,- 1427.5,- 1315.9+ 1778.5,+ 1197.0,+ 1173.1],"boot_ready_ms_runs": [- 122.8,- 112.8,- 106.7+ 192.8,+ 107.0,+ 103.4],"phase_medians_ms": {- "db_pre_webserver": 2884.6,- "db_webserver_ctor": 1654.7,- "uvicorn_serve": 0.0+ "db_pre_webserver": 2839.1,+ "db_webserver_ctor": 1901.5},"anchor": "spawn -> /api/health responds 200 (= DesktopApp._wait_for_backend success = window creation point)","secondary_anchor": "median_bind_wall_ms = spawn -> BOOT_READY print (bootstrap bind; may precede a responsive health endpoint)",diff --git a/jarvis/brain/model_catalog.py b/jarvis/brain/model_catalog.pyindex 880b836cda..8ff70f9b36 100644--- a/jarvis/brain/model_catalog.py+++ b/jarvis/brain/model_catalog.py@@ -155,6 +155,18 @@ def _ids(ids: list[str]) -> list[ModelInfo]:# single block (voice_de/voice_en/model), so the picker only renders on the# ACTIVE TTS card and sets the global value.TTS_CATALOG: dict[str, tuple[str, list[ModelInfo]]] = {+ # ElevenLabs picks a VOICE ID (opaque hashes), so the curated list carries+ # human names as labels while the value stays the id. The picker's+ # "use custom" row lets a user paste their OWN voice id (e.g. a cloned+ # voice) instead of a curated one — kept in sync with DEFAULT_VOICES in+ # jarvis/plugins/tts/elevenlabs_tts.py.+ "elevenlabs": ("voice", _curated([+ ("onwK4e9ZLuTAKqWW03F9", "Daniel — British, authoritative (default)"),+ ("JBFqnCBsd6RMkjVDRZzb", "George — British, deep narrator"),+ ("IKne3meq5aSn9XLyUdCD", "Charlie — British, mature butler"),+ ("nPczCjzI2devNBz1zQrb", "Brian — American, deep narrator"),+ ("pNInz6obpgDQGcFmaJgB", "Adam — American, classic AI voice"),+ ])),"gemini-flash-tts": ("voice", _ids(["Charon", "Kore", "Aoede", "Orus", "Iapetus","Rasalgethi", "Algenib", "Algieba", "Fenrir",diff --git a/jarvis/speech/rolling_whisper_wake.py b/jarvis/speech/rolling_whisper_wake.pyindex cf1935204a..7f10d6af1b 100644--- a/jarvis/speech/rolling_whisper_wake.py+++ b/jarvis/speech/rolling_whisper_wake.py@@ -45,6 +45,10 @@ from jarvis.plugins.stt.fwhisper import FasterWhisperProvider, TranscribeBusy# keep working. ``pattern=`` also accepts a ``WakeMatcher`` (duck-types# ``.search().group(0)``) so a custom wake phrase can drive this backstop.from jarvis.speech.wake_constants import JARVIS_WAKE_PATTERN as DEFAULT_PATTERN+from jarvis.speech.wake_constants import (+ STT_HALLUCINATION_RE,+ normalize_phrase_for_match,+)log = logging.getLogger("jarvis.wake.rolling")@@ -271,6 +275,7 @@ class RollingWhisperWake:self._stat_rejected_no_match = 0self._stat_matched = 0self._stat_suppressed_cooldown = 0+ self._stat_suppressed_echo = 0def stats(self) -> dict[str, int]:"""Snapshot of this listen session's wake-evaluation counters.@@ -293,8 +298,74 @@ class RollingWhisperWake:"rejected_no_match": self._stat_rejected_no_match,"matched": self._stat_matched,"suppressed_cooldown": self._stat_suppressed_cooldown,+ "suppressed_echo": self._stat_suppressed_echo,}+ async def _is_prompt_echo(+ self, match: Any, window_text: str, pcm_bytes: bytes+ ) -> bool:+ """True when a matched candidate is the bias prompt ECHOING, not speech.++ Ghost-activation forensic (live log 2026-07-02, five activations in+ ~30 min with media audio in the room): the wake Whisper is primed with+ ``initial_prompt="<phrase>"`` so the weak model resolves ambiguous+ noise/breath windows to EXACTLY the primed text — transcript+ ``'Hey Fable'`` at rms 0.0037, verbatim, no surrounding words. The+ strict matcher cannot help: the text IS the full phrase. Removing the+ bias is no fix either (recall collapses 100 % -> 62.5 %, measured).++ The tell-tale is the ECHO SIGNATURE (the transcript consists of the+ phrase and NOTHING else) — genuine speech usually carries context.+ Such candidates get ONE unbiased second pass over the SAME window: an+ unprimed ear hears *something* wherever real speech exists (even a+ mis-hearing), but hears nothing — or a known hallucination+ boilerplate — on the noise the primed model echoed over. Costs one+ extra local transcribe only on exact-phrase candidates. Fail-open on+ infrastructure errors: a broken confirm must never eat a real wake.+ """+ bias = getattr(self._stt, "bias_prompt", None)+ if not bias:+ return False # unprimed model -> echoes are impossible+ window_tokens = normalize_phrase_for_match(window_text)+ matched_tokens = normalize_phrase_for_match(match.group(0))+ if len(window_tokens) > len(matched_tokens):+ return False # real speech around the phrase -> not an echo+ try:+ timeout_s = self._transcribe_timeout_s+ if timeout_s > 0:+ async with asyncio.timeout(timeout_s):+ transcript = await self._stt.transcribe_pcm(+ pcm_bytes,+ language=self._language,+ ignore_initial_prompt=True,+ )+ else:+ transcript = await self._stt.transcribe_pcm(+ pcm_bytes,+ language=self._language,+ ignore_initial_prompt=True,+ )+ except TypeError:+ return False # provider has no unbiased pass -> legacy behaviour+ except Exception as exc: # noqa: BLE001 — fail-open, never eat a wake+ log.warning(+ "echo-confirm: unbiased pass failed (%s) — accepting the wake",+ exc,+ )+ return False+ unbiased = (transcript.text or "").strip()+ if unbiased and STT_HALLUCINATION_RE.search(unbiased) is None:+ log.info(+ "echo-confirm: unprimed ear heard %r — genuine wake", unbiased[:60]+ )+ return False+ log.info(+ "echo-confirm: SUPPRESSED prompt echo — biased transcript was "+ "exactly the phrase but the unprimed ear heard %r",+ unbiased[:60],+ )+ return True+async def detect(self, chunks: AsyncIterator[AudioChunk]) -> AsyncIterator[str]:@@ -689,6 +760,13 @@ class RollingWhisperWake:prev_tail_t = nowm = self._pattern.search(joined)if m:+ # Bias-echo gate: a candidate whose transcript is EXACTLY+ # the primed phrase may be the initial_prompt echoing on+ # noise (ghost activations, live 2026-07-02). One unbiased+ # second pass over the same window separates the two.+ if await self._is_prompt_echo(m, text, pcm_bytes):+ self._stat_suppressed_echo += 1+ continueself._stat_matched += 1last_trigger_t = nowlog.info(diff --git a/jarvis/ui/web/frontend/src/lib/keyFormat.test.ts b/jarvis/ui/web/frontend/src/lib/keyFormat.test.tsindex b3dfa565c5..d4a8fc013e 100644--- a/jarvis/ui/web/frontend/src/lib/keyFormat.test.ts+++ b/jarvis/ui/web/frontend/src/lib/keyFormat.test.ts@@ -23,9 +23,11 @@ describe("detectKeyFormat", () => {expect(detectKeyFormat("sk-proj-abc123")?.kind).toBe("openai");});- it("recognizes xAI, Cartesia and Groq keys", () => {+ it("recognizes xAI, Cartesia, ElevenLabs and Groq keys", () => {expect(detectKeyFormat("xai-abc123")?.kind).toBe("xai");expect(detectKeyFormat("sk_car_abc123")?.kind).toBe("cartesia");+ // Cartesia's more specific sk_car_ must win over the generic ElevenLabs sk_.+ expect(detectKeyFormat("sk_elevenlabsvoicekey123")?.kind).toBe("elevenlabs");expect(detectKeyFormat("gsk_abc123")?.kind).toBe("groq");});@@ -41,6 +43,8 @@ describe("expectedKindForSecret", () => {expect(expectedKindForSecret("openai_api_key")).toBe("openai");expect(expectedKindForSecret("codex_openai_api_key")).toBe("openai");expect(expectedKindForSecret("grok_api_key")).toBe("xai");+ expect(expectedKindForSecret("cartesia_api_key")).toBe("cartesia");+ expect(expectedKindForSecret("elevenlabs_api_key")).toBe("elevenlabs");});it("returns null for slots without a known key format", () => {diff --git a/jarvis/ui/web/frontend/src/lib/keyFormat.ts b/jarvis/ui/web/frontend/src/lib/keyFormat.tsindex 6a52f92d06..bac5c57cf0 100644--- a/jarvis/ui/web/frontend/src/lib/keyFormat.ts+++ b/jarvis/ui/web/frontend/src/lib/keyFormat.ts@@ -18,6 +18,7 @@ export type KeyFormatKind =| "openrouter"| "xai"| "cartesia"+ | "elevenlabs"| "groq"| "unknown";@@ -49,6 +50,10 @@ export function detectKeyFormat(value: string): KeyFormatHint | null {if (/^sk-ant-/.test(v)) return { kind: "anthropic", label: "Anthropic API key" };if (/^sk-or-/.test(v)) return { kind: "openrouter", label: "OpenRouter API key" };if (/^sk_car_/.test(v)) return { kind: "cartesia", label: "Cartesia API key" };+ // ElevenLabs keys start with `sk_` (tested AFTER the more specific `sk_car_`+ // so Cartesia wins its own prefix). Older 32-char hex keys fall through to+ // "unknown" — harmless, since the hint never blocks a save.+ if (/^sk_/.test(v)) return { kind: "elevenlabs", label: "ElevenLabs API key" };if (/^gsk_/.test(v)) return { kind: "groq", label: "Groq API key" };if (/^xai-/.test(v)) return { kind: "xai", label: "xAI (Grok) API key" };if (/^AIza/.test(v) || /^AQ\./.test(v)) {@@ -82,6 +87,8 @@ export function expectedKindForSecret(secretKey: string): KeyFormatKind | null {return "xai";case "cartesia_api_key":return "cartesia";+ case "elevenlabs_api_key":+ return "elevenlabs";case "groq_api_key":return "groq";default:diff --git a/jarvis/ui/web/provider_spec.py b/jarvis/ui/web/provider_spec.pyindex aa550f1999..c1e39903d4 100644--- a/jarvis/ui/web/provider_spec.py+++ b/jarvis/ui/web/provider_spec.py@@ -225,6 +225,20 @@ PROVIDERS: tuple[ProviderSpec, ...] = (# shares with the (now TTS-only) xAI key remains.# Ollama-Provider 2026-04-21 entfernt — reine API-Provider-Chain.# ── TTS ───────────────────────────────────────────────────────────────+ ProviderSpec(+ id="elevenlabs",+ label="ElevenLabs",+ tier="tts",+ auth_mode="api_key",+ secret_keys=("elevenlabs_api_key",),+ dashboard_url="https://elevenlabs.io/app/settings/api-keys",+ credential_help=(+ "ElevenLabs API key for premium multilingual voices (DE+EN via "+ "eleven_flash_v2_5). Pick one of the curated Jarvis voices in the "+ "voice picker, or paste your own ElevenLabs voice ID (e.g. a cloned "+ "voice) into it. Billed per character on your ElevenLabs account."+ ),+ ),ProviderSpec(id="gemini-flash-tts",label="Gemini Flash TTS",diff --git a/tests/unit/speech/test_rolling_whisper_wake_echo_confirm.py b/tests/unit/speech/test_rolling_whisper_wake_echo_confirm.pynew file mode 100644index 0000000000..673b32ced1--- /dev/null+++ b/tests/unit/speech/test_rolling_whisper_wake_echo_confirm.py@@ -0,0 +1,157 @@+"""Bias-prompt echo gate: ghost activations must die, genuine wakes must live.++Live forensic 2026-07-02 (~30 min, media audio in the room): five activations+whose transcript was EXACTLY the primed phrase ('Hey Fable'), some at noise+rms (0.0037) — the wake Whisper's ``initial_prompt`` echoing back on+ambiguous windows. The strict matcher cannot reject them (the text IS the+phrase), and dropping the bias costs far more recall than it saves (measured:+100 % -> 62.5 %). The gate: an exact-phrase candidate gets ONE unbiased pass+over the same window; hearing nothing (or hallucination boilerplate) there+means echo -> suppress, hearing anything real means genuine -> fire.+"""+from __future__ import annotations++import asyncio+from types import SimpleNamespace++import numpy as np++from jarvis.core.protocols import AudioChunk+from jarvis.speech.rolling_whisper_wake import RollingWhisperWake+from jarvis.speech.wake_phrase import compile_wake_matcher+++def _loud_chunk(marker: int, n: int = 1600) -> AudioChunk:+ arr = np.full(n, 12000 + (marker % 5) * 100, dtype=np.int16)+ return AudioChunk(pcm=arr.tobytes(), sample_rate=16000, timestamp_ns=0)+++class _BiasedSTT:+ """Fake with the bias surface: primed passes return ``biased_text``,+ unprimed passes return ``unbiased_text``."""++ is_warm = True++ def __init__(self, biased_text: str, unbiased_text: str) -> None:+ self._biased = biased_text+ self._unbiased = unbiased_text+ self.bias_prompt = "Hey Nico"+ self.unbiased_calls = 0++ async def transcribe_pcm(+ self,+ pcm_bytes: bytes,+ sample_rate: int = 16_000,+ language: str | None = None,+ ignore_initial_prompt: bool = False,+ ) -> SimpleNamespace:+ if ignore_initial_prompt:+ self.unbiased_calls += 1+ text = self._unbiased+ else:+ text = self._biased+ return SimpleNamespace(text=text, confidence=0.9, segments=())+++class _LegacySTT:+ """No bias surface, no ``ignore_initial_prompt`` kwarg — old providers and+ fakes must keep the pre-gate behaviour (fire on a match)."""++ is_warm = True++ def __init__(self, text: str) -> None:+ self._text = text++ async def transcribe_pcm(+ self, pcm_bytes: bytes, sample_rate: int = 16_000, language: str | None = None+ ) -> SimpleNamespace:+ return SimpleNamespace(text=self._text, confidence=0.9, segments=())+++async def _first_yield(stt, wait_s: float = 4.0) -> str | None:+ wake = RollingWhisperWake(+ stt,+ pattern=compile_wake_matcher("Hey Nico"),+ poll_interval_s=0.05,+ cooldown_s=0.0,+ min_rms=0.0,+ min_peak=0.0,+ transcribe_timeout_s=5.0,+ )+ src: asyncio.Queue = asyncio.Queue()+ got: list[str] = []++ async def _iter():+ while True:+ chunk = await src.get()+ if chunk is None:+ return+ yield chunk++ async def _feed() -> None:+ i = 0+ while True:+ await src.put(_loud_chunk(i))+ i += 1+ await asyncio.sleep(0.005)++ async def _drain() -> None:+ async for kw in wake.detect(_iter()):+ got.append(kw)+ return++ feeder = asyncio.create_task(_feed())+ driver = asyncio.create_task(_drain())+ try:+ for _ in range(int(wait_s / 0.05)):+ if got:+ break+ await asyncio.sleep(0.05)+ finally:+ driver.cancel()+ feeder.cancel()+ for t in (driver, feeder):+ try:+ await t+ except (asyncio.CancelledError, Exception): # noqa: BLE001, S110+ pass+ return got[0] if got else None+++async def test_prompt_echo_is_suppressed() -> None:+ """Biased pass says exactly the phrase, unprimed ear hears NOTHING — the+ ghost-activation signature. Must stay silent."""+ stt = _BiasedSTT(biased_text="Hey Nico", unbiased_text="")+ assert await _first_yield(stt, wait_s=1.5) is None+ assert stt.unbiased_calls >= 1, "echo confirm never ran"+++async def test_echo_boilerplate_is_suppressed() -> None:+ """Unprimed ear hears only known hallucination boilerplate — still echo."""+ stt = _BiasedSTT(biased_text="Hey Nico!", unbiased_text="Vielen Dank.")+ assert await _first_yield(stt, wait_s=1.5) is None+++async def test_genuine_exact_phrase_fires() -> None:+ """Unprimed ear hears real speech (even a mis-hearing) — genuine wake."""+ stt = _BiasedSTT(biased_text="Hey Nico", unbiased_text="Hey Niko.")+ assert await _first_yield(stt) is not None+++async def test_genuine_misheard_speech_fires() -> None:+ """The unprimed base model often garbles the name ('Space'/'Ego' forensic)+ — ANY real speech counts as confirmation, not just the phrase."""+ stt = _BiasedSTT(biased_text="Hey Nico", unbiased_text="Ist er nieko da")+ assert await _first_yield(stt) is not None+++async def test_phrase_with_context_skips_the_confirm() -> None:+ """Real surrounding speech is not an echo — no second pass, no latency."""+ stt = _BiasedSTT(biased_text="Hey Nico wie spät ist es", unbiased_text="")+ assert await _first_yield(stt) is not None+ assert stt.unbiased_calls == 0, "confirm ran although context ruled out echo"+++async def test_legacy_provider_without_bias_surface_fires() -> None:+ stt = _LegacySTT("Hey Nico")+ assert await _first_yield(stt) is not None