Skip to content

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.

feat(voice-engine): start the local engine when its card is selected

rubenluetke10-beep6d905a97ef8f
diff --git a/jarvis/plugins/realtime/local_voice.py b/jarvis/plugins/realtime/local_voice.py
index ada4c20c21..023db64285 100644
--- a/jarvis/plugins/realtime/local_voice.py
+++ b/jarvis/plugins/realtime/local_voice.py
@@ -606,6 +606,16 @@ class LocalVoiceProvider:
"""The engine this app's calls use, for the card's status and self-test."""
return cls._shared(EngineSettings.from_config(cfg))
+ @classmethod
+ async def verify_activation(cls, cfg: Any) -> None:
+ """Selecting the card starts the engine, so the first call finds it loaded.
+
+ Never refuses: the card must stay selectable before setup, because
+ setup runs from that card. Without an installed engine nothing starts.
+ """
+ if cls.external_login_ready(cfg):
+ cls._shared(EngineSettings.from_config(cfg)).start_soon()
+
@classmethod
async def prespawn_transport(cls, cfg: Any) -> bool:
if not cls.external_login_ready(cfg):
diff --git a/tests/unit/voice_engine/test_local_voice_adapter.py b/tests/unit/voice_engine/test_local_voice_adapter.py
index b180c433ec..19ea7aa588 100644
--- a/tests/unit/voice_engine/test_local_voice_adapter.py
+++ b/tests/unit/voice_engine/test_local_voice_adapter.py
@@ -220,6 +220,31 @@ async def test_an_installed_engine_starts_in_the_background_and_answers_at_once(
LocalVoiceProvider._engine = None
+async def test_selecting_the_card_starts_an_installed_engine_and_never_refuses(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setenv("JARVIS_VOICE_ENGINE_HOME", str(tmp_path / "missing"))
+ try:
+ await LocalVoiceProvider.verify_activation(JarvisConfig())
+ assert LocalVoiceProvider._engine is None # nothing set up: nothing starts
+
+ _installed_home(tmp_path)
+ monkeypatch.setenv("JARVIS_VOICE_ENGINE_HOME", str(tmp_path))
+ engine = LocalVoiceProvider.shared_engine(JarvisConfig())
+ starts: list[int] = []
+
+ async def fake_start() -> None:
+ starts.append(1)
+
+ engine.ensure_started = fake_start
+ await LocalVoiceProvider.verify_activation(JarvisConfig())
+ await asyncio.sleep(0)
+ assert starts == [1]
+ finally:
+ LocalVoiceProvider._engine = None
+
+
@pytest.mark.asyncio
async def test_a_selftest_result_is_routed_to_its_caller() -> None:
engine, client = await _running_engine()