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
"""The settings router must import + serve even when the realtime module is absent.
The realtime voice engine is an optional, still-internal module that is stripped
from public distribution snapshots (distribution-denylist). Two shipped sites
reference it — this guards the boot-critical one: ``settings_routes`` imported
``dodaios.realtime.factory`` at MODULE level, so a realtime-stripped public build
would fail to import the whole settings router and the server would not boot. The
reference must be lazy + guarded, degrading to "realtime not available".
"""
from __future__ import annotations
import sys
from dodaios.ui.web import settings_routes
def test_realtime_available_helper_degrades_when_module_stripped(monkeypatch) -> None:
# Simulate the realtime engine being stripped from a public snapshot: the
# import raises, and the helper must report "no realtime", not blow up.
monkeypatch.setitem(sys.modules, "dodaios.realtime.factory", None)
monkeypatch.setitem(sys.modules, "dodaios.realtime", None)
assert settings_routes._realtime_available_provider(object()) is None
def test_realtime_available_helper_resolves_when_module_present(monkeypatch) -> None:
# When the module IS present, the helper delegates to it (here: a stub that
# reports a reachable provider), so the local/full build is unchanged.
import types
stub = types.ModuleType("dodaios.realtime.factory")
stub.realtime_available_provider = lambda cfg: "openai-realtime" # type: ignore[attr-defined]
stub.realtime_requires_webrtc_offer = lambda cfg: True # type: ignore[attr-defined]
monkeypatch.setitem(sys.modules, "dodaios.realtime.factory", stub)
assert settings_routes._realtime_available_provider(object()) == "openai-realtime"
assert settings_routes._realtime_requires_webrtc_offer(object()) is True
def test_realtime_webrtc_helper_degrades_when_module_stripped(monkeypatch) -> None:
monkeypatch.setitem(sys.modules, "dodaios.realtime.factory", None)
monkeypatch.setitem(sys.modules, "dodaios.realtime", None)
assert settings_routes._realtime_requires_webrtc_offer(object()) is False