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 08:56)
Ruben Lütke409d7f21099e
diff --git a/jarvis/cu/__init__.py b/jarvis/cu/__init__.pynew file mode 100644index 0000000000..dc9713c5a3--- /dev/null+++ b/jarvis/cu/__init__.py@@ -0,0 +1,21 @@+"""Computer-Use v2 — modular perceive->act->verify engine.++This package is the rebuilt Computer-Use engine ("v2"). It keeps the product+mechanism unchanged — a screenshot is the perception, mouse + keyboard are the+actuation — but fixes the structural defects of the legacy monolith+(`jarvis/harness/screenshot_only_loop.py`):++* one `CoordinateMapper` per captured frame, so every click resolves against+ the exact image the model saw (`geometry.py`),+* provider coordinate conventions as a capability, not a hardcoded 0-1000+ grid (`conventions.py`),+* platform-native actuation with landed-position read-back (`actuate/`),+* a closed perceive->act->verify state machine with an idempotency ledger+ that deterministically refuses duplicate actions (`loop.py`, `ledger.py`,+ `verify.py`).++Everything here is lazily imported by the harness engine resolver+(`jarvis/plugins/harness/computer_use.py::_resolve_run_cu_loop`) so boot time+is unaffected. The public entry point is `jarvis.cu.engine.run_cu_loop`, which+implements the exact same contract as the legacy engines.+"""diff --git a/tests/unit/speech/test_rolling_whisper_wake_boot_warm.py b/tests/unit/speech/test_rolling_whisper_wake_boot_warm.pyindex db0d0a3af0..d099aba8b7 100644--- a/tests/unit/speech/test_rolling_whisper_wake_boot_warm.py+++ b/tests/unit/speech/test_rolling_whisper_wake_boot_warm.py@@ -133,9 +133,14 @@ async def test_poll_does_not_touch_a_cold_model_then_starts_when_warm() -> None:async def test_poll_owns_the_warmup_after_the_fallback_window() -> None:"""If nobody warms the model (unusual wiring), the poll loop must warm it- itself after the fallback window instead of waiting forever."""+ itself after the fallback window instead of waiting forever.++ fallback_s=0.0 (already elapsed on the first poll) keeps this test+ deterministic: the suite's sleep accelerator fast-forwards small sleeps,+ so a wall-clock threshold like 0.1 s would never be reached via sleeps.+ """stt = _WarmableSTT(warm=False)- wake = _wake(stt, fallback_s=0.1)+ wake = _wake(stt, fallback_s=0.0)shutdown = await _drive_with_audio(wake)try:for _ in range(300):diff --git a/tests/unit/speech/test_zz_diag_minimal_scratch.py b/tests/unit/speech/test_zz_diag_minimal_scratch.pyindex a73e44bd58..57602d513f 100644--- a/tests/unit/speech/test_zz_diag_minimal_scratch.py+++ b/tests/unit/speech/test_zz_diag_minimal_scratch.py@@ -1,41 +1,107 @@-"""Minimal repro: does an async generator waiting on a flag resume under pytest?"""+"""Minimal repro #2: fallback warm-up path — which await hangs?"""from __future__ import annotationsimport asyncio+import re+import numpy as np-class _Flag:- warm = False+from jarvis.core.protocols import AudioChunk+from jarvis.speech.rolling_whisper_wake import RollingWhisperWake-async def _gen(flag: _Flag):- while not flag.warm:- await asyncio.sleep(0.05)- while True:- await asyncio.sleep(0.01)- yield "tick"+class _STT:+ def __init__(self) -> None:+ self.is_warm = False+ self.calls = 0+ self.warm_up_calls = 0++ async def transcribe_pcm(self, pcm, sample_rate=16000, language=None): # noqa: ANN001+ self.calls += 1++ class _T:+ text = ""+ confidence = 1.0+ segments = ()++ return _T()++ def warm_up(self) -> None:+ self.warm_up_calls += 1+ self.is_warm = True+++async def test_diag_fallback(capsys) -> None:+ stt = _STT()+ wake = RollingWhisperWake(+ stt,+ pattern=re.compile("nico"),+ poll_interval_s=0.01,+ cooldown_s=0.0,+ min_rms=0.0,+ min_peak=0.0,+ transcribe_timeout_s=1.0,+ warm_wait_fallback_s=0.1,+ )+ src: asyncio.Queue = asyncio.Queue()+ stop = asyncio.Event()+ async def _iter():+ while True:+ c = await src.get()+ if c is None:+ return+ yield c-async def test_minimal_generator_resumes_after_flag_flip(capsys) -> None:- flag = _Flag()- ticks = []+ async def _feed() -> None:+ i = 0+ while not stop.is_set():+ arr = np.full(1600, 12000 + (i % 80) * 100, dtype=np.int16)+ await src.put(AudioChunk(pcm=arr.tobytes(), sample_rate=16000, timestamp_ns=0))+ i += 1+ await asyncio.sleep(0.002)async def _drain() -> None:- async for t in _gen(flag):- ticks.append(t)+ async for _kw in wake.detect(_iter()):+ pass+ import time as _time++ import jarvis.speech.rolling_whisper_wake as rww++ polls = {"n": 0}+ _orig_sleep = asyncio.sleep++ async def _counting_sleep(delay, *a, **k): # noqa: ANN001, ANN002, ANN003+ if abs(delay - 0.01) < 1e-12:+ polls["n"] += 1+ return await _orig_sleep(delay, *a, **k)++ rww.asyncio.sleep = _counting_sleep+ f = asyncio.create_task(_feed())d = asyncio.create_task(_drain())- await asyncio.sleep(0.3)- cold = len(ticks)- flag.warm = True- await asyncio.sleep(0.5)- warm = len(ticks)- d.cancel()- try:- await d- except asyncio.CancelledError:- pass+ _t0 = _time.perf_counter()+ for _ in range(300):+ if stt.calls > 0:+ break+ await asyncio.sleep(0.01)+ _elapsed = _time.perf_counter() - _t0+ rww.asyncio.sleep = _orig_sleepwith capsys.disabled():- print(f"\nMINIMAL cold_ticks={cold} warm_ticks={warm}")- assert cold == 0- assert warm > 0, "generator never resumed after the flag flip"+ import sys+ print(+ f"\nDIAG2 warm_up_calls={stt.warm_up_calls} calls={stt.calls} "+ f"is_warm={stt.is_warm} driver_done={d.done()} "+ f"poll_iters={polls['n']} elapsed={_elapsed:.2f}s"+ )+ print("--- driver stack ---")+ d.print_stack(file=sys.stdout)+ stop.set()+ await src.put(None)+ d.cancel()+ f.cancel()+ for t in (d, f):+ try:+ await t+ except (asyncio.CancelledError, Exception): # noqa: BLE001, S110+ pass