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
feat(realtime): show the handshake, and stop paying for it twice
rubenluetke10-beepff6ce016e5bc
diff --git a/jarvis/codex_app_server.py b/jarvis/codex_app_server.pyindex 42d038b415..7b824953e1 100644--- a/jarvis/codex_app_server.py+++ b/jarvis/codex_app_server.py@@ -50,6 +50,10 @@ from jarvis.core.process_utils import NO_WINDOW_CREATIONFLAGSlog = logging.getLogger(__name__)_DEFAULT_REQUEST_TIMEOUT_S: Final = 20.0+# How long a passed cold-start audit may be ridden by a SECOND thread_start on+# the same process (the STUN media-path retry). Short on purpose: warm starts+# minutes later must re-audit in full.+_STARTUP_AUDIT_TTL_S: Final = 10.0_SHUTDOWN_TIMEOUT_S: Final = 2.0_DEFAULT_SDP_TIMEOUT_S: Final = 15.0_DEFAULT_NOTIFICATION_QUEUE_SIZE: Final = 512@@ -2031,8 +2035,17 @@ class CodexAppServerClient:# The live process whose FULL startup audit (profile, live account,# config requirements, effective config) just passed. ``thread_start``# consumes this to skip repeating that identical audit microseconds- # later; every WARM thread start still re-audits.+ # later; every WARM thread start still re-audits. The (process, stamp)+ # pair below extends the one-shot token by a short TTL for exactly one+ # scenario: a failed host-candidate media path retries with STUN and+ # pays a SECOND thread_start seconds after the audit passed — that+ # retry rides the same audit instead of re-running three RPCs and a+ # profile walk. Warm starts minutes later still re-audit in full, so+ # "re-read immediately before EVERY subscription thread" keeps its+ # meaning.self._startup_audit_process: asyncio.subprocess.Process | None = None+ self._audited_process: asyncio.subprocess.Process | None = None+ self._startup_audit_at = 0.0def _assert_owner_loop(self) -> asyncio.AbstractEventLoop:loop = asyncio.get_running_loop()@@ -2290,6 +2303,8 @@ class CodexAppServerClient:# three RPC round trips and a profile walk on the SAME process# microseconds later.self._startup_audit_process = self._process+ self._audited_process = self._process+ self._startup_audit_at = time.monotonic()def _announce_ready() -> None:# Status callers waiting out the "voice is starting"@@ -3184,6 +3199,12 @@ class CodexAppServerClient:model: str | None = None,ephemeral: bool = True,extra: Mapping[str, Any] | None = None,+ # EXPLICIT opt-in for one scenario only: a failed host-candidate media+ # path retrying with STUN may ride an audit that passed within the TTL+ # instead of running a third identical copy. Every ordinary (warm)+ # thread start keeps the full re-audit — the account can switch under+ # a shared process between calls, and that doctrine stays intact.+ ride_recent_audit: bool = False,) -> dict[str, Any]:"""Start a verified ChatGPT-only transport thread outside the workspace."""# cwd/model/ephemeral stay caller-proof: the audit below pins them to@@ -3309,9 +3330,15 @@ class CodexAppServerClient:# thread/start frame, so exactly one thread start can ride it and# every WARM start still re-audits.live_process = self._process- audit_is_fresh = (- live_process is not None- and self._startup_audit_process is live_process+ audit_is_fresh = live_process is not None and (+ self._startup_audit_process is live_process+ or (+ ride_recent_audit+ and getattr(self, "_audited_process", None) is live_process+ and time.monotonic()+ - getattr(self, "_startup_audit_at", 0.0)+ <= _STARTUP_AUDIT_TTL_S+ ))self._startup_audit_process = Nonetry:@@ -3329,6 +3356,11 @@ class CodexAppServerClient:self._audit_effective_config(await self._read_effective_config())+ # This full audit is byte-identical to the cold-start one;+ # stamp it so a STUN media-path retry seconds from now can+ # ride it instead of running a THIRD copy.+ self._audited_process = live_process+ self._startup_audit_at = time.monotonic()except CodexSubscriptionUnavailable as exc:if isinstance(exc, CodexSubscriptionPlanUnsupported):# The WARM call path re-judges the live account before@@ -3576,6 +3608,8 @@ class CodexAppServerClient:if process is None:self._ready = Falseself._startup_audit_process = None+ self._audited_process = None+ self._startup_audit_at = 0.0self._close_lifeline()if self._profile_transport_epoch is not None:# Epoch first, release off-loop and shielded: a cancellation@@ -3591,6 +3625,8 @@ class CodexAppServerClient:self._process = Noneself._ready = Falseself._startup_audit_process = None+ self._audited_process = None+ self._startup_audit_at = 0.0tree = self._process_treeself._process_tree = Nonereader_task = self._reader_taskdiff --git a/jarvis/plugins/realtime/codex_subscription.py b/jarvis/plugins/realtime/codex_subscription.pyindex 58c72cea40..11a02fa690 100644--- a/jarvis/plugins/realtime/codex_subscription.py+++ b/jarvis/plugins/realtime/codex_subscription.py@@ -2846,10 +2846,19 @@ class CodexSubscriptionRealtimeProvider:transport_module = importlib.import_module("jarvis.realtime.webrtc_transport")attempts: tuple[Any, ...] = (None, transport_module.stun_ice_servers)last_error: BaseException | None = None+ # Built and primed ONCE for both attempts: the recognizer is pure+ # local state, and rebuilding + re-warming it on the STUN retry paid+ # seconds for nothing.+ input_transcriber = self._build_input_transcriber(cfg)for index, ice_factory in enumerate(attempts):try:session = await self._open_session_once(- cfg, None if ice_factory is None else ice_factory()+ cfg,+ None if ice_factory is None else ice_factory(),+ input_transcriber=input_transcriber,+ # The STUN retry may ride the audit that passed seconds+ # ago on this very open; a first attempt never does.+ ride_recent_audit=index > 0,)if index > 0:# Postmortem marker: this call paid the full re-open (a@@ -2911,7 +2920,12 @@ class CodexSubscriptionRealtimeProvider:return Noneasync def _open_session_once(- self, cfg: Any, ice_servers: Any+ self,+ cfg: Any,+ ice_servers: Any,+ *,+ input_transcriber: Any = None,+ ride_recent_audit: bool = False,) -> _CodexSubscriptionRealtimeSession:# Jarvis owns the media path in-process. The UI could only ever broker# a signalling-shaped offer (no microphone), which ChatGPT-Live cannot@@ -3007,7 +3021,11 @@ class CodexSubscriptionRealtimeProvider:thread_id=thread_id,answer_sdp=answer_sdp,audio_endpoint=audio_endpoint,- input_transcriber=self._build_input_transcriber(cfg),+ input_transcriber=(+ input_transcriber+ if input_transcriber is not None+ else self._build_input_transcriber(cfg)+ ),language=str(getattr(cfg, "language", "en") or "en"),voice=voice,)diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.pyindex 805d4ba0b3..a08e407c6b 100644--- a/jarvis/speech/pipeline.py+++ b/jarvis/speech/pipeline.py@@ -7711,9 +7711,6 @@ class SpeechPipeline:held_muted_reply: dict[str, Any] | None = Nonemuted_reply_flush_task: asyncio.Task[Any] | None = Noneturn_complete = asyncio.Event()- # One warning per session when the supervisor cannot represent the- # connecting phase — a loud-once note, never a per-message log spam.- connecting_state_reported = Falsespeaking = Falsepost_output_echo_guard_until = 0.0# End of the tail's physically-audible phase (device latency residue);@@ -7912,7 +7909,6 @@ class SpeechPipeline:async def _send_json(message: dict[str, Any]) -> None:nonlocal semantic_turn_committed, speakingnonlocal surface_playback_epoch, surface_playback_task- nonlocal connecting_state_reportedkind = str(message.get("type", ""))if kind == "audio_starting":# The provider handshake is ABOUT to run and can legitimately@@ -7931,22 +7927,11 @@ class SpeechPipeline:self._active_realtime_language or "unknown",message.get("handshake_budget_s", "unknown"),)+ # SupervisorState.CONNECTING exists since the 2026-08-06+ # campaign; the surfaces show a live "connecting" look for+ # the whole handshake instead of freezing on their previous+ # state (the WARN branch that used to sit here is retired).await self._transition(_REALTIME_CONNECTING_STATE)- supervisor = getattr(self, "_supervisor", None)- if (- supervisor is not None- and not connecting_state_reported- and getattr(supervisor, "state", "") != _REALTIME_CONNECTING_STATE- ):- # The supervisor ignores states it does not know, by design.- # Say so once instead of leaving the surface silently on its- # previous state — that silence IS the bug this branch fixes.- connecting_state_reported = True- log.warning(- "Supervisor does not know the %s state; the bar and orb "- "keep their previous state through the handshake",- _REALTIME_CONNECTING_STATE,- )elif kind == "language":# Mid-call language flip from the ONE resolver. Recorded so the# surface can label the call honestly; never re-derived here.diff --git a/jarvis/state/supervisor.py b/jarvis/state/supervisor.pyindex 72773c6cea..51fd09024c 100644--- a/jarvis/state/supervisor.py+++ b/jarvis/state/supervisor.py@@ -16,6 +16,12 @@ if TYPE_CHECKING:class SupervisorState(str, Enum):IDLE = "IDLE"+ # A voice session's transport handshake is in flight (a cold codex+ # subscription bring-up legitimately spends seconds here). Before this+ # state existed the pipeline transitioned to "CONNECTING", the supervisor+ # silently dropped the unknown value, and orb/bar froze on their previous+ # look for the whole handshake - dead air with no visible progress.+ CONNECTING = "CONNECTING"LISTENING = "LISTENING"THINKING = "THINKING"SPEAKING = "SPEAKING"diff --git a/jarvis/ui/web/frontend/src/components/VoiceIndicator.tsx b/jarvis/ui/web/frontend/src/components/VoiceIndicator.tsxindex 7abb867141..69d41968bb 100644--- a/jarvis/ui/web/frontend/src/components/VoiceIndicator.tsx+++ b/jarvis/ui/web/frontend/src/components/VoiceIndicator.tsx@@ -5,12 +5,13 @@ import { cn } from "@/lib/utils";// Exhaustive by construction: adding a member to VoiceState without a style// here fails the TypeScript build instead of rendering an undefined swatch.const STATE_STYLE: Record<VoiceState, { color: string; ring: string }> = {- idle: { color: "bg-blue-500", ring: "ring-blue-500/40" },- listening: { color: "bg-emerald-500", ring: "ring-emerald-500/50 animate-pulse" },- thinking: { color: "bg-yellow-500", ring: "ring-yellow-500/50 animate-pulse" },- speaking: { color: "bg-pink-500", ring: "ring-pink-500/50 animate-pulse" },- paused: { color: "bg-amber-500", ring: "ring-amber-500/40" },- error: { color: "bg-red-500", ring: "ring-red-500/50" },+ idle: { color: "bg-blue-500", ring: "ring-blue-500/40" },+ connecting: { color: "bg-sky-400", ring: "ring-sky-400/50 animate-pulse" },+ listening: { color: "bg-emerald-500", ring: "ring-emerald-500/50 animate-pulse" },+ thinking: { color: "bg-yellow-500", ring: "ring-yellow-500/50 animate-pulse" },+ speaking: { color: "bg-pink-500", ring: "ring-pink-500/50 animate-pulse" },+ paused: { color: "bg-amber-500", ring: "ring-amber-500/40" },+ error: { color: "bg-red-500", ring: "ring-red-500/50" },};export function VoiceIndicator() {diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsxindex bd5fd1bfba..a52a36e141 100644--- a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx@@ -158,6 +158,7 @@ function storePos(pos: BubblePos): void {/** Locale keys for the status line, per state. */const STATUS_KEY: Record<VoiceState, string> = {idle: "agentic_grid.voice_bubble.ready",+ connecting: "agentic_grid.voice_bubble.connecting",listening: "agentic_grid.voice_bubble.listening",thinking: "agentic_grid.voice_bubble.thinking",speaking: "agentic_grid.voice_bubble.speaking",diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsxindex 4cdb63f727..40c5362f45 100644--- a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx@@ -52,6 +52,18 @@ const MOTIONS: Record<VoiceState, Motion> = {voiceImpact: 0,colorChurn: 0.28,},+ connecting: {+ // The handshake: alive and clearly in motion, but calmer than thinking —+ // a steady expectant swirl while the transport comes up.+ flowX: 0.2,+ flowY: 0.05,+ breathAmp: 0.012,+ breathHz: 0.5,+ turbulence: 1.1,+ energy: 0.92,+ voiceImpact: 0,+ colorChurn: 0.6,+ },listening: {flowX: 0.11,flowY: 0.035,diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 182975b6ed..2ae080546e 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -3830,6 +3830,7 @@"button_open": "Sprach-Bubble öffnen — mit {0} sprechen","button_close": "Sprach-Bubble schließen","ready": "Bereit",+ "connecting": "Verbinde…","listening": "Hört zu…","thinking": "Denkt nach…","speaking": "Spricht",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 5ffa135b4e..7900e6bec3 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -3830,6 +3830,7 @@"button_open": "Open the voice bubble — talk to {0}","button_close": "Close the voice bubble","ready": "Ready",+ "connecting": "Connecting…","listening": "Listening…","thinking": "Thinking…","speaking": "Speaking",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 4a458cba93..a0dfdfc57a 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -3830,6 +3830,7 @@"button_open": "Abrir la burbuja de voz — habla con {0}","button_close": "Cerrar la burbuja de voz","ready": "Listo",+ "connecting": "Conectando…","listening": "Escuchando…","thinking": "Pensando…","speaking": "Hablando",diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.tsindex ce899df9ff..5ca1423be3 100644--- a/jarvis/ui/web/frontend/src/store/events.ts+++ b/jarvis/ui/web/frontend/src/store/events.ts@@ -19,6 +19,7 @@ import {*/export type VoiceState =| "idle"+ | "connecting"| "listening"| "thinking"| "speaking"@@ -28,6 +29,7 @@ export type VoiceState =/** The full lowercased supervisor vocabulary, in the order it is declared. */export const VOICE_STATES: readonly VoiceState[] = ["idle",+ "connecting","listening","thinking","speaking",