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.

fix(dictation): show the dictation on the Jarvis Bar during a live call

rubenluetke10-beepfe66b35c1cbb
diff --git a/jarvis/live/session.py b/jarvis/live/session.py
index a896aa0da6..4a02ce0e29 100644
--- a/jarvis/live/session.py
+++ b/jarvis/live/session.py
@@ -337,10 +337,14 @@ class LiveVoiceSession:
callable(getattr(mic_level, name, None))
for name in ("claim_external", "release_external", "publish")
)
- if microphone_ready:
+ # While a dictation holds the input, its own capture drives the meter:
+ # the page's track is silenced, and claiming the meter here would
+ # flatten the dictation's bars with the page's zeros.
+ meter_owned = microphone_ready and not self._input_held
+ if meter_owned:
mic_level.claim_external(self.session_id)
self._mic_feedback_owned = True
- elif not self._mic_feedback_warning:
+ elif not microphone_ready and not self._mic_feedback_warning:
self._mic_feedback_warning = True
log.warning("Browser microphone meter needs an app restart; voice remains connected")
self._media_received = True
@@ -356,7 +360,7 @@ class LiveVoiceSession:
level_tap.note_playing(0.3)
elif previous_playback:
level_tap.reset_playing()
- if microphone_ready:
+ if meter_owned:
mic_level.publish(levels.input_level, owner=self.session_id)
if self._media_timeout is not None:
self._media_timeout.cancel()
@@ -672,8 +676,21 @@ class LiveVoiceSession:
"held" if self._input_held else "released",
getattr(event, "reason", "") or "unknown",
)
+ if self._input_held:
+ self._release_mic_meter()
await self._apply_input_mute()
+ def _release_mic_meter(self) -> None:
+ """Hand the microphone meter back so a dictation's own levels show."""
+ if not self._mic_feedback_owned:
+ return
+ from jarvis.audio import mic_level
+
+ release = getattr(mic_level, "release_external", None)
+ if callable(release):
+ release(self.session_id)
+ self._mic_feedback_owned = False
+
async def _apply_input_mute(self) -> None:
"""Drop the user's audio from now on and let the page silence its track.
diff --git a/tests/contract/test_live_input_mute.py b/tests/contract/test_live_input_mute.py
index 1bbe293999..fdfd04f3b2 100644
--- a/tests/contract/test_live_input_mute.py
+++ b/tests/contract/test_live_input_mute.py
@@ -132,3 +132,22 @@ async def test_a_call_that_starts_during_a_dictation_adopts_the_hold(call):
assert call.session._input_muted is True
await call.session.handle_audio_frame(PCM)
assert call.connection.sent == []
+
+
+async def test_a_held_call_leaves_the_microphone_meter_to_the_dictation(call):
+ from jarvis.audio import mic_level
+
+ mic_level.reset_for_tests()
+ seen: list[float] = []
+ mic_level.subscribe(seen.append)
+ call.session._watch_input_mute()
+ call.session._mic_feedback_owned = True
+ mic_level.claim_external(call.session.session_id)
+
+ await call.bus.publish(VoiceInputHeld(held=True, reason="dictation"))
+ # The dictation's own capture feeds the meter without an owner.
+ mic_level.publish(0.4)
+ assert seen == [0.4]
+ assert call.session._mic_feedback_owned is False
+ mic_level.reset_for_tests()
diff --git a/tests/unit/ui/test_orb_bus_bridge_dictation.py b/tests/unit/ui/test_orb_bus_bridge_dictation.py
index b3d1a54ce8..6ca62127cc 100644
--- a/tests/unit/ui/test_orb_bus_bridge_dictation.py
+++ b/tests/unit/ui/test_orb_bus_bridge_dictation.py
@@ -41,6 +41,7 @@ from jarvis.core.events import ( # noqa: E402
DictationStarted,
DictationTranscribing,
DictationTranscript,
+ SystemStateChanged,
VoiceSessionStarted,
WakeCandidateDetected,
)
@@ -69,6 +70,9 @@ class _FakeOrb:
def play_animation(self, name: str) -> None:
self.calls.append(("play_animation", name))
+ def stop_animation(self, name: str) -> None:
+ self.calls.append(("stop_animation", name))
+
def show_listening_transcript(self, text: str = "", duration_ms: int = 0) -> None:
self.calls.append(("transcript", text))
@@ -133,15 +137,38 @@ async def test_the_reveal_survives_a_stale_voice_state_label() -> None:
await _quiesce(bridge)
-async def test_a_live_voice_session_outranks_a_dictation_reveal() -> None:
+async def test_a_dictation_beside_a_live_call_takes_the_bar_and_hands_it_back() -> None:
+ """Live 2026-10-02: in a call the dictation key left the bar standing still.
+
+ The pipeline holds the call's input while dictating, so the bar shows the
+ dictation, ignores the call's state edges meanwhile, and gives the call its
+ own look back once the text is delivered.
+ """
orb = _FakeOrb()
bridge = _bridge(orb)
bridge._voice_session_active = True
+ bridge._last_state = "LISTENING"
- await bridge._on_dictation_started(DictationStarted(target="chat"))
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ assert orb.modes == ["dictate"]
+ assert bridge._dictation_active is True
- assert orb.modes == []
+ # The call keeps publishing its phase; the dictation still owns the bar.
+ await bridge._on_state(
+ SystemStateChanged(new_state="THINKING", previous="LISTENING")
+ )
+ assert orb.modes == ["dictate"]
+ orb.calls.clear()
+ bridge._on_mic_level(0.5)
+ assert ("set_level", 0.5) in orb.calls
+
+ await bridge._on_dictation_transcribing(DictationTranscribing())
+ await bridge._on_dictation_completed(
+ DictationCompleted(text="hello", outcome="inserted")
+ )
+ assert orb.modes[-1] == "think", "the call's current look comes back"
assert bridge._dictation_active is False
+ assert "idle" not in orb.modes
await _quiesce(bridge)
diff --git a/ui/orb/bus_bridge.py b/ui/orb/bus_bridge.py
index ba44fa61a3..916081ce04 100644
--- a/ui/orb/bus_bridge.py
+++ b/ui/orb/bus_bridge.py
@@ -1387,7 +1387,7 @@ class OrbBusBridge:
# suppression latch (that only blocks ACTIVE-state repaints), so the
# genuine IDLE transition, if it still arrives, is a harmless same-mode
# repaint. The idle-animation scheduler stays owned by that transition.
- if not self._hides_when_idle():
+ if not self._hides_when_idle() and not self._dictation_active:
try:
self._orb.show(mode="idle")
except Exception as exc: # noqa: BLE001
@@ -1519,6 +1519,13 @@ class OrbBusBridge:
except Exception as exc: # noqa: BLE001
log.debug("stop_mouth_animation failed: %s", exc)
+ if self._dictation_active:
+ # A dictation (also one beside a live call) owns the surface until
+ # it completes; ``_last_state`` is current, and the completion
+ # hands the surface back through ``_restore_voice_surface`` or
+ # stands it down when the call ended in the meantime.
+ return
+
if state == "LISTENING":
self._orb.show(mode="listen")
if prev_state in ("IDLE", "ERROR", "PAUSED"):
@@ -1665,6 +1672,9 @@ class OrbBusBridge:
)
if not late_final_ok:
return
+ if self._dictation_active:
+ # The dictation's live text owns the bubble meanwhile.
+ return
if _is_transcript_boilerplate(event.text):
log.info(
"OrbBridge suppressed STT boilerplate transcript: %r",
@@ -1690,7 +1700,7 @@ class OrbBusBridge:
is already hidden, so we leave it alone.
"""
self._last_response_text = (event.text or "").strip()
- if self._last_state in ("THINKING", "SPEAKING"):
+ if self._last_state in ("THINKING", "SPEAKING") and not self._dictation_active:
self._refresh_voice_bubble()
def _refresh_voice_bubble(self) -> None:
@@ -1769,10 +1779,14 @@ class OrbBusBridge:
released by ``VoiceBootStatus`` stores the mode and stays withdrawn,
exactly as it does for a wake word (AP-26).
"""
- if self._voice_session_active:
- log.debug("OrbBridge dictation reveal skipped: a voice session owns the bar")
- return
- log.info("OrbBridge._on_dictation_started: target=%s", getattr(event, "target", ""))
+ # A dictation beside a live call takes the surface over too: the
+ # pipeline holds the call's input meanwhile, so the bar shows what is
+ # actually listening, and the completion hands the call's look back.
+ log.info(
+ "OrbBridge._on_dictation_started: target=%s%s",
+ getattr(event, "target", ""),
+ " (over a live voice session)" if self._voice_session_active else "",
+ )
self._cancel_dictation_standdown()
self._dictation_active = True
self._dictation_transcribing = False
@@ -1809,7 +1823,7 @@ class OrbBusBridge:
``_last_state``) so the four dictation handlers can never disagree about
who owns the bar.
"""
- if self._voice_session_active:
+ if self._voice_session_active and not self._dictation_active:
return
if getattr(event, "is_final", False):
# The completion handler owns the end of a dictation — it knows the
@@ -1834,7 +1848,7 @@ class OrbBusBridge:
``dictate_transcribing`` mode renders the orbital core instead, and
keeps the click surface inert exactly like the recording mode does.
"""
- if not self._dictation_active or self._voice_session_active:
+ if not self._dictation_active:
return
self._dictation_transcribing = True
self._show_dictation_mode("dictate_transcribing")
@@ -1880,12 +1894,23 @@ class OrbBusBridge:
# raised for one frame before the stand-down clears it is a flicker,
# not a receipt.
self._show_listening_transcript("" if quiet else (detail or (event.text or "").strip()))
- # Whatever raised the bar must be able to lower it. This guard is
- # deliberately the SAME one ``_on_dictation_started`` uses — an
- # asymmetric pair (raise on any state, lower only from IDLE) would leave
- # the bar lit whenever ``_last_state`` was stale, which is a real
- # possibility because dictation never touches the voice state machine.
if self._voice_session_active:
+ # The dictation ran beside a live call: hand the surface back to
+ # the call's own look instead of standing it down to idle. The
+ # notice stand-down restores ``_current_voice_mode`` after its
+ # dwell, which also clears a sentence shown here.
+ if arrived:
+ self._restore_voice_surface()
+ delay = 0.0 if quiet else DICTATION_OUTCOME_DWELL_S
+ else:
+ self._show_notice_mode()
+ delay = (
+ DICTATION_OUTCOME_DWELL_S if detail else DICTATION_NOTHING_BACK_DWELL_S
+ )
+ try:
+ self._schedule_notice_standdown(delay)
+ except Exception as exc: # noqa: BLE001
+ log.debug("OrbBridge dictation hand-back suppressed: %s", exc)
return
if arrived:
# Nothing is in flight and nothing failed, so the bar rests NOW
@@ -1975,6 +2000,18 @@ class OrbBusBridge:
except Exception as exc: # noqa: BLE001 — a missed repaint is cosmetic
log.debug("OrbBridge dictation rest repaint suppressed: %s", exc)
+ def _restore_voice_surface(self) -> None:
+ """Give the surface back to the live voice session a dictation borrowed.
+
+ Repaints the look the voice lane would be showing now. The state edges
+ that arrived during the dictation updated ``_last_state`` but were not
+ painted (see ``_on_state``), so this is where they catch up.
+ """
+ try:
+ self._orb.show(mode=self._current_voice_mode())
+ except Exception as exc: # noqa: BLE001 — a missed repaint is cosmetic
+ log.debug("OrbBridge voice-look restore suppressed: %s", exc)
+
def _show_notice_mode(self) -> None:
"""Drive the current surface into its brief "that did not happen" look.
@@ -2091,7 +2128,10 @@ class OrbBusBridge:
self._dictation_active = False
self._dictation_transcribing = False
if self._voice_session_active:
- # A session took over and owns the bar — nothing to clean up.
+ # The session owns the bar again; show its look, not the
+ # dictation's.
+ self._show_listening_transcript("")
+ self._restore_voice_surface()
return
# Stand down directly rather than through _schedule_dictation_
# standdown: that path also refuses when ``_last_state`` is not
@@ -2164,7 +2204,7 @@ class OrbBusBridge:
left as-is (already showing Jarvis's reply); no personality quip is
popped over it.
"""
- if self._last_state != "SPEAKING":
+ if self._last_state != "SPEAKING" or self._dictation_active:
return
log.info("OrbBridge._on_audio_out_first → speaking overlay + mouth")
# Jarvis answers out loud: the thinking is over (an agent task that