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 09:52)
Ruben Lütke76495c699517
diff --git a/jarvis/cu/actuate/base.py b/jarvis/cu/actuate/base.pyindex a88931d045..d941480292 100644--- a/jarvis/cu/actuate/base.py+++ b/jarvis/cu/actuate/base.py@@ -95,10 +95,18 @@ def verified_move(One retry: transient focus/animation can eat the first positioning. Whenthe cursor position is unreadable the move is trusted (``landed=None``) —refusing to act on an unreadable-but-working host would brick CU there.++ The tiny sleep between inject and read is load-bearing: injected input+ passes through the OS input queue, so an immediate ``cursor_pos`` read+ can still see the PRE-move position under desktop load (live rig run+ 2026-07-02) — a false "coordinate-space mismatch"."""+ import time # noqa: PLC0415+last: tuple[int, int] | None = Nonefor attempt in (1, 2):actuator.move(int(x), int(y))+ time.sleep(0.02)last = actuator.cursor_pos()if last is None:return ActResult(diff --git a/jarvis/speech/rolling_whisper_wake.py b/jarvis/speech/rolling_whisper_wake.pyindex 07e75497fc..cf1935204a 100644--- a/jarvis/speech/rolling_whisper_wake.py+++ b/jarvis/speech/rolling_whisper_wake.py@@ -389,6 +389,10 @@ class RollingWhisperWake:# last poll was not busy). A streak longer than# ``self._busy_hang_recover_s`` is a TRUE hang -> rebuild.busy_since: float | None = None+ # Cross-snapshot join state: final token of the previous RELIABLE+ # transcript + when it was seen (see the join at the match site).+ prev_tail = ""+ prev_tail_t = 0.0# Boot serialisation state — see the warm gate inside the poll loop.warm_wait_t0 = time.time()@@ -666,11 +670,30 @@ class RollingWhisperWake:continuelog.info("rolling-whisper: rms=%.4f text=%r", rms, text)- m = self._pattern.search(text)+ # Cross-snapshot prefix join: a short spoken phrase can still+ # straddle two windows (one snapshot ends with "Hey", the next+ # starts with the name). The strict full-phrase matcher+ # (2026-07-02, fire-only-on-the-phrase mandate) needs prefix ++ # core ADJACENT, so prepend the FINAL token of the previous+ # reliable transcript when it is fresh (within one window+ # span). A stale tail must never join — an old "hey" plus a+ # bare name minutes later is exactly the false fire the strict+ # matcher exists to prevent.+ joined = text+ if (+ prev_tail+ and now - prev_tail_t <= self._window_samples / self._sample_rate+ ):+ joined = f"{prev_tail} {text}"+ prev_tail = text.rsplit(None, 1)[-1] if text else ""+ prev_tail_t = now+ m = self._pattern.search(joined)if m:self._stat_matched += 1last_trigger_t = now- log.info("rolling-whisper: WAKE matched %r in %r", m.group(0), text)+ log.info(+ "rolling-whisper: WAKE matched %r in %r", m.group(0), joined+ )yield m.group(0)else:self._stat_rejected_no_match += 1diff --git a/scripts/cu_rig_results_raw.json b/scripts/cu_rig_results_raw.jsonindex dc1c67777d..5c48578cb8 100644--- a/scripts/cu_rig_results_raw.json+++ b/scripts/cu_rig_results_raw.json@@ -2,17 +2,17 @@{"scenario": "raw-pipeline","intended_clicks": 4,- "received_first_hits": 0,- "hit_rate": 0.0,- "mean_distance_px": null,- "max_distance_px": null,+ "received_first_hits": 2,+ "hit_rate": 0.5,+ "mean_distance_px": 0.0,+ "max_distance_px": 0.0,"duplicate_clicks": 0,- "step_latency_s_p50": 0.016,- "step_latency_s_max": 0.032,+ "step_latency_s_p50": 0.039,+ "step_latency_s_max": 0.063,"provoked_duplicates_executed": 0,"typed_expected": "example.com",- "typed_received": "example.com",- "typed_exactly_once": true,+ "typed_received": "",+ "typed_exactly_once": false,"typed_duplicated": false,"actuator": "windows-sendinput","monitor": "3840x2160@0,0"diff --git a/scripts/cu_test_rig.py b/scripts/cu_test_rig.pyindex b56a56c65d..e72b7b8e22 100644--- a/scripts/cu_test_rig.py+++ b/scripts/cu_test_rig.py@@ -203,10 +203,33 @@ def _distance(a: tuple[int, int], b: tuple[int, int]) -> float:return math.hypot(a[0] - b[0], a[1] - b[1])-def _capture_monitor():- from jarvis.cu.capture import select_monitor+def _capture_monitor(rig: RigWindow):+ """The monitor CONTAINING the rig window (by containment, not focus —+ the console that launched the rig may hold focus on another screen)."""+ from jarvis.cu.geometry import list_monitors- return select_monitor("foreground")+ ox, oy = rig.canvas_origin_on_screen()+ cx, cy = ox + WINDOW_W // 2, oy + WINDOW_H // 2+ monitors = list_monitors()+ for m in monitors:+ if m.contains(cx, cy):+ return m+ if monitors:+ return next((m for m in monitors if m.is_primary), monitors[0])+ raise RuntimeError("no display detected")+++def _activate_rig(rig: RigWindow) -> None:+ """Bring the rig window to the FOREGROUND with a real activation click+ on dead canvas space — the engines' capture follows the foreground+ window, and a merely-topmost window does not hold focus."""+ from jarvis.cu.actuate import get_actuator++ ox, oy = rig.canvas_origin_on_screen()+ get_actuator().click(ox + 410, oy + 480) # dead strip below the targets+ time.sleep(0.4)+ rig.log.clicks.clear()+ rig.log.keys.clear()def _norm_for(point: tuple[int, int], monitor) -> tuple[int, int]:@@ -272,7 +295,8 @@ def run_raw(rig: RigWindow) -> list[dict[str, Any]]:from jarvis.cu.geometry import CoordinateMapperactuator = get_actuator()- monitor = _capture_monitor()+ _activate_rig(rig)+ monitor = _capture_monitor(rig)# A mapper for a synthetic model image (downscaled 1366px longest side),# exactly like a v2 frame would carry.scale = 1366 / max(monitor.width, monitor.height)@@ -464,7 +488,8 @@ async def _run_engine_mission(def run_engine_mode(rig: RigWindow, engine: str) -> list[dict[str, Any]]:- monitor = _capture_monitor()+ _activate_rig(rig)+ monitor = _capture_monitor(rig)results: list[dict[str, Any]] = []# -- scenario 1: click all four targets (accuracy + latency) ----------diff --git a/tests/unit/speech/test_wake_matcher_integration.py b/tests/unit/speech/test_wake_matcher_integration.pyindex 65c1b1d9ba..ecb22699fc 100644--- a/tests/unit/speech/test_wake_matcher_integration.py+++ b/tests/unit/speech/test_wake_matcher_integration.py@@ -71,3 +71,96 @@ async def test_verify_with_stt_honours_custom_matcher() -> None:async def test_verify_with_stt_default_matcher_still_jarvis() -> None:matched, _ = await verify_wake_with_stt(_FakeSTT("Jarvis"), b"\x00\x00" * 100)assert matched is False+++# --------------------------------------------------------------------------+# Cross-snapshot prefix join: a phrase split over two poll windows still wakes+# under the strict full-phrase matcher; a bare core with no recent prefix+# stays silent (the 2026-07-02 fire-only-on-the-phrase mandate).+# --------------------------------------------------------------------------++import asyncio # noqa: E402++import numpy as np # noqa: E402++from jarvis.core.protocols import AudioChunk # noqa: E402+++class _ScriptedSTT:+ """Returns one scripted transcript per call, then empty ones."""++ is_warm = True++ def __init__(self, texts: list[str]) -> None:+ self._texts = list(texts)++ async def transcribe_pcm(+ self, pcm_bytes: bytes, sample_rate: int = 16_000, language: str | None = None+ ) -> SimpleNamespace:+ text = self._texts.pop(0) if self._texts else ""+ return SimpleNamespace(text=text, confidence=0.9, segments=())+++async def _first_yield(stt: _ScriptedSTT, phrase: str, wait_s: float) -> str | None:+ wake = RollingWhisperWake(+ stt,+ pattern=compile_wake_matcher(phrase),+ 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:+ arr = np.full(1600, 12000 + (i % 5) * 100, dtype=np.int16)+ await src.put(+ AudioChunk(pcm=arr.tobytes(), sample_rate=16000, timestamp_ns=0)+ )+ 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:+ deadline = asyncio.get_running_loop().time() + wait_s+ while not got and asyncio.get_running_loop().time() < deadline:+ 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_split_window_prefix_joins_across_snapshots() -> None:+ """Window 1 heard only "hey", window 2 only the name — the fresh previous+ tail joins, so the split genuine wake still fires first try."""+ stt = _ScriptedSTT(["hey", "nico ich bin da"])+ assert await _first_yield(stt, "Hey Nico", wait_s=5.0) is not None+++async def test_bare_core_with_no_recent_prefix_stays_silent() -> None:+ """The name inside ordinary speech, no prefix anywhere near — silent."""+ stt = _ScriptedSTT(["und dann", "nico ich bin da"])+ assert await _first_yield(stt, "Hey Nico", wait_s=1.5) is None