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(jarvisbar): make the bar a real dictation indicator

Ruben Lütkec0c55a6899cf
diff --git a/jarvis/ui/jarvisbar/host.py b/jarvis/ui/jarvisbar/host.py
index 926316e42a..6eefae5ff2 100644
--- a/jarvis/ui/jarvisbar/host.py
+++ b/jarvis/ui/jarvisbar/host.py
@@ -92,6 +92,10 @@ def dispatch(surface: Any, msg: dict[str, Any]) -> bool:
if op == "stop":
return False
if op == "show":
+ # The mode string is forwarded VERBATIM — this protocol carries no mode
+ # list of its own, so a new coarse mode reaches the hosted surface with
+ # no change here. The surface re-validates against the one canonical
+ # tuple (``jarvis.ui.jarvisbar.modes.MODES``).
_call(surface, "show", str(msg.get("mode", "listen")))
elif op == "hide":
_call(surface, "hide")
diff --git a/jarvis/ui/jarvisbar/interaction.py b/jarvis/ui/jarvisbar/interaction.py
index eea032c35b..a1550b793f 100644
--- a/jarvis/ui/jarvisbar/interaction.py
+++ b/jarvis/ui/jarvisbar/interaction.py
@@ -15,6 +15,10 @@ from __future__ import annotations
from pathlib import Path
+# Dependency-free import (no numpy/PIL): this module stays cheap enough for the
+# IPC proxy and the pure unit tests.
+from jarvis.ui.jarvisbar.modes import DICTATION_MODES
+
# --------------------------------------------------------------------------- #
# Pure geometry helpers (no I/O) #
@@ -68,15 +72,16 @@ def resolve_click(
trap (live bug 2026-06-19): the old code hung up on ANY click in the left
40% of the bar, decoupled from the visible affordance.
- ``dictate`` (a dictation is recording) is inert on purpose: without this
- branch it would fall through to "not active" and a stray click would START
- A VOICE SESSION in the middle of dictating. There is always another way to
+ EVERY dictation mode (``dictate`` while recording, ``dictate_transcribing``
+ while the text is being produced) is inert on purpose: without this branch
+ they would fall through to "not active" and a stray click would START A
+ VOICE SESSION in the middle of dictating. There is always another way to
stop — release the key, press it again in toggle mode, the Dictation view,
or ``jarvis api dictation stop`` — so an inert bar costs nothing and cannot
misfire.
"""
frac = x / max(1, width)
- if mode == "dictate":
+ if mode in DICTATION_MODES:
return "none"
active = mode in ("listen", "think", "speak")
if frac >= 0.60: # right zone → the mic mute toggle (non-destructive)
diff --git a/jarvis/ui/jarvisbar/modes.py b/jarvis/ui/jarvisbar/modes.py
new file mode 100644
index 0000000000..794d65aa15
--- /dev/null
+++ b/jarvis/ui/jarvisbar/modes.py
@@ -0,0 +1,38 @@
+"""The bar's coarse-mode vocabulary — ONE definition, imported everywhere.
+
+A coarse mode is what the bridge asks the bar to *be* (``show(mode=...)``); the
+rendered look is derived from it plus live audio by ``renderer.visual_mode``.
+
+Why this module exists at all: the tuple used to live in ``renderer`` and was
+hand-copied into ``subprocess_overlay`` because that module is a pure IPC proxy
+and must not drag numpy/PIL into the parent process. A hand-copied enum is the
+five-layer drift pattern this repo has been bitten by four times (AP-4 /
+BUG-008) — and it duly drifted: ``"dictate"`` was handled by ``visual_mode`` and
+``resolve_click`` for weeks while every surface silently dropped it, because it
+was never added to the tuple. So the vocabulary now lives in a module with NO
+imports at all: every layer (renderer, the Tk surface, the Qt surface, the IPC
+proxy, the click resolver) imports these names instead of restating them, and
+``tests/unit/ui/jarvisbar/test_mode_parity.py`` fails the build if any file in
+the package re-hardcodes them.
+
+Adding a mode = add it here, teach ``renderer.visual_mode`` what it looks like,
+and decide in ``interaction.resolve_click`` what a click on it does. Nothing
+else needs touching.
+"""
+from __future__ import annotations
+
+#: Voice-session modes, driven by the supervisor state machine.
+VOICE_MODES: tuple[str, ...] = ("idle", "listen", "speak", "think")
+
+#: Dictation modes. Dictation runs OUTSIDE the voice state machine (it raises no
+#: ``SystemStateChanged``), so it gets its own modes rather than borrowing a
+#: voice one — reusing ``listen``/``think`` would re-arm the close-X hang-up and
+#: the mute zone on a bar with no session behind it, which is exactly the
+#: silent-hangup trap ``resolve_click`` exists to prevent.
+#:
+#: - ``dictate`` — recording: the user is speaking, level is live.
+#: - ``dictate_transcribing`` — recording stopped, the transcription is running.
+DICTATION_MODES: tuple[str, ...] = ("dictate", "dictate_transcribing")
+
+#: Every mode a surface accepts. Anything else is dropped by ``show()``.
+MODES: tuple[str, ...] = VOICE_MODES + DICTATION_MODES
diff --git a/jarvis/ui/jarvisbar/null_overlay.py b/jarvis/ui/jarvisbar/null_overlay.py
index 0faf0dc3c6..9809f7a837 100644
--- a/jarvis/ui/jarvisbar/null_overlay.py
+++ b/jarvis/ui/jarvisbar/null_overlay.py
@@ -5,6 +5,11 @@ drive "no overlay on screen" without sprinkling None-checks through its event
handlers. Has no Tk window and imports nothing heavy, so it stays importable on
a headless host. Deliberately does NOT define ``_root`` so the bridge's
``getattr(orb, "_root", None)`` reset path early-returns.
+
+``show`` is deliberately mode-AGNOSTIC: it accepts every entry of
+``jarvis.ui.jarvisbar.modes.MODES`` — and anything else — without validating,
+so a new coarse mode can never make this surface raise. Pinned by
+``tests/unit/ui/jarvisbar/test_mode_parity.py``.
"""
from __future__ import annotations
diff --git a/jarvis/ui/jarvisbar/renderer.py b/jarvis/ui/jarvisbar/renderer.py
index 3e78e80317..9ad754ae25 100644
--- a/jarvis/ui/jarvisbar/renderer.py
+++ b/jarvis/ui/jarvisbar/renderer.py
@@ -12,6 +12,9 @@ State → look:
sparks counter-orbiting on tilted ellipses (synthetic,
ignores level). Replaced the old travelling sine wave,
which read as a generic-AI visual.
+- ``dictate`` → the equalizer, driven by the dictation mic level.
+- ``dictate_transcribing`` → the orbital core: recording has stopped and the
+ transcription is running, so there IS something to represent.
Gold only appears during activity; idle dots stay muted.
"""
@@ -23,6 +26,15 @@ from dataclasses import dataclass, field
import numpy as np
from PIL import Image, ImageDraw
+# The coarse-mode vocabulary lives in ONE dependency-free module so the
+# numpy/PIL-free IPC proxy can import the same tuple instead of hand-copying it
+# (AP-4). ``MODES`` is re-exported here because every surface already validates
+# against ``renderer.MODES``.
+from jarvis.ui.jarvisbar.modes import ( # noqa: F401 — re-exported as renderer.MODES
+ DICTATION_MODES,
+ MODES,
+)
+
COLOR_KEY_RGB = (255, 0, 255)
@@ -404,7 +416,8 @@ _N_DOTS = 7 # dots in the standby row
_DOT_R_FRAC = 0.16 # dot radius / pill height (small round dots, not chunky)
_DOTS_SPAN_FRAC = 0.62 # dots span / pill width (matches the bars)
-MODES = ("idle", "listen", "speak", "think")
+# MODES / DICTATION_MODES are imported at the top of this module — see the note
+# there. Nothing in this package may restate them (test_mode_parity.py).
# A level sample is trusted only this long. The feeders (mic ~30-100 ms
# cadence, TTS ~60 ms blocks) stream continuously while sound exists; when a
@@ -479,8 +492,14 @@ def target_pill_size(
size"), which is both a punishing target to release a file on and far too
small to render a legible tick in. Opening on the first drag-enter turns
the sliver into a real landing zone and gives the confirmation room to
- show."""
- if mode in ("listen", "speak", "think"):
+ show.
+
+ The dictation modes are ACTIVE too. Callers pass either the EFFECTIVE mode
+ (``render``, where a dictation mode has already resolved to ``speak`` /
+ ``think``) or the COARSE mode (the Qt surface's hover-footprint probe) — so
+ listing them keeps the hit-box the user can hover in step with the pill the
+ renderer actually draws during a dictation."""
+ if mode in ("listen", "speak", "think") or mode in DICTATION_MODES:
return ACTIVE_W, ACTIVE_H
if hovered or muted or drop_open:
return OPEN_W, OPEN_H
@@ -543,17 +562,25 @@ def visual_mode(
``hold_s`` bridges the short gaps between words/sentences so the bars don't
flap back on every micro-pause.
- ``dictate`` is the fifth coarse mode (dictation runs outside the voice
- state machine entirely). It always renders as the equalizer: dictation is
- the user talking, the mic level is being fed, and there is nothing for a
- thinking indicator to represent. Handled BEFORE the audio-activity branches
- so a silent pause mid-dictation shows still bars rather than falling
- through to the thinking core.
+ Dictation runs outside the voice state machine entirely and has two modes
+ of its own, both resolved BEFORE the audio-activity branches so neither can
+ be overruled by a stale level sample:
+
+ - ``dictate`` (the user is speaking into the dictation mic) always renders
+ as the equalizer. A SPEAKING dictation must never show the thinking core:
+ the mic level is being fed, so a silent pause mid-sentence shows still
+ bars rather than falling through and pretending to think.
+ - ``dictate_transcribing`` (the key was released, the transcription is
+ running) renders as the orbital core. Here there genuinely IS work in
+ flight to represent, and the mic feed has stopped — showing the equalizer
+ would claim the bar is still listening when it is not.
"""
if coarse_mode == "idle":
return "idle"
if coarse_mode == "dictate":
return "speak"
+ if coarse_mode == "dictate_transcribing":
+ return "think"
if playback_active or seconds_since_audible < hold_s:
return "speak"
if coarse_mode == "think":
diff --git a/jarvis/ui/jarvisbar/subprocess_overlay.py b/jarvis/ui/jarvisbar/subprocess_overlay.py
index 123c3e1a49..2969600bb4 100644
--- a/jarvis/ui/jarvisbar/subprocess_overlay.py
+++ b/jarvis/ui/jarvisbar/subprocess_overlay.py
@@ -38,6 +38,13 @@ import weakref
from collections.abc import Callable
from typing import IO, Any
+# The SAME coarse-mode tuple every other layer validates against — imported,
+# never copied. ``jarvis.ui.jarvisbar.modes`` has no imports at all, so this
+# stays a pure IPC proxy with no numpy/PIL in the parent process. The
+# hand-copied predecessor is precisely why ``show("dictate")`` was a silent
+# no-op on the macOS surface for weeks (AP-4 / BUG-008).
+from jarvis.ui.jarvisbar.modes import MODES as _MODES
+
log = logging.getLogger("jarvis.ui.jarvisbar")
@@ -65,10 +72,6 @@ def _respawn_after_backoff_weakly(
return
surface._respawn_after_backoff(attempt)
-# Kept in sync with renderer.MODES without importing numpy/PIL into the
-# parent for a pure IPC proxy; the host-side bar re-validates every mode.
-_MODES = ("idle", "listen", "speak", "think")
-
_HOST_MODULE = "jarvis.ui.jarvisbar.host"
diff --git a/tests/unit/dictation/test_delivery_and_bar.py b/tests/unit/dictation/test_delivery_and_bar.py
index eabad13059..1fb89edecc 100644
--- a/tests/unit/dictation/test_delivery_and_bar.py
+++ b/tests/unit/dictation/test_delivery_and_bar.py
@@ -629,9 +629,37 @@ async def test_a_crash_inside_delivery_does_not_double_publish(
def test_dictate_renders_as_the_equalizer() -> None:
- """Dictation is the user talking — never the thinking indicator."""
+ """A SPEAKING dictation is the user talking — never the thinking indicator,
+ not even during a silent pause mid-sentence."""
assert renderer.visual_mode("dictate", 99.0, hold_s=0.4) == "speak"
assert renderer.visual_mode("dictate", 0.0, hold_s=0.4) == "speak"
+ # Not even a TTS playback flag may steal the recording look.
+ assert renderer.visual_mode("dictate", 0.0, hold_s=0.4, playback_active=True) == "speak"
+
+
+def test_the_transcribing_phase_renders_as_the_thinking_core() -> None:
+ """Recording has stopped and the mic feed is gone — the equalizer would
+ claim the bar is still listening. Decided by the mode alone, so a level
+ sample still fresh from the last word cannot overrule it."""
+ assert renderer.visual_mode("dictate_transcribing", 99.0, hold_s=0.4) == "think"
+ assert renderer.visual_mode("dictate_transcribing", 0.0, hold_s=0.4) == "think"
+
+
+def test_both_dictation_modes_open_the_pill_to_its_active_size() -> None:
+ """The hover hit-box is computed from the COARSE mode while the pill is
+ drawn from the effective one; if they disagree the user hovers a pill that
+ is not where they see it."""
+ active = renderer.target_pill_size("listen", hovered=False)
+ for mode in renderer.DICTATION_MODES:
+ assert renderer.target_pill_size(mode, hovered=False) == active
+
+
+def test_the_dictation_modes_are_accepted_by_the_surfaces() -> None:
+ """The gap that made the whole lane dead on arrival: the modes were handled
+ by the pure helpers but missing from the tuple every surface validates
+ against, so every ``show("dictate")`` was silently dropped."""
+ for mode in renderer.DICTATION_MODES:
+ assert mode in renderer.MODES
@pytest.mark.parametrize(
@@ -658,10 +686,13 @@ def test_existing_visual_modes_are_unchanged(
@pytest.mark.parametrize("x", [10, 100, 400, 700])
-def test_clicking_the_bar_during_dictation_does_nothing(x: int) -> None:
- """Without this, a stray click would start a voice session mid-dictation."""
- assert interaction.resolve_click(x, 800, "dictate", hovered=True, pill_w=400) == "none"
- assert interaction.resolve_click(x, 800, "dictate", hovered=False) == "none"
[email protected]("mode", renderer.DICTATION_MODES)
+def test_clicking_the_bar_during_dictation_does_nothing(x: int, mode: str) -> None:
+ """Without this, a stray click would start a voice session mid-dictation —
+ and on the mute zone it would deafen Jarvis while the user is dictating.
+ Both dictation phases are inert, not just the recording one."""
+ assert interaction.resolve_click(x, 800, mode, hovered=True, pill_w=400) == "none"
+ assert interaction.resolve_click(x, 800, mode, hovered=False) == "none"
def test_existing_click_zones_are_unchanged() -> None:
diff --git a/tests/unit/ui/jarvisbar/test_mode_parity.py b/tests/unit/ui/jarvisbar/test_mode_parity.py
new file mode 100644
index 0000000000..6f2a347310
--- /dev/null
+++ b/tests/unit/ui/jarvisbar/test_mode_parity.py
@@ -0,0 +1,152 @@
+"""Every bar layer must agree on the SAME coarse-mode vocabulary.
+
+This is the AP-4 / BUG-008 enum-drift guard for the bar. The vocabulary used to
+be a tuple in ``renderer`` that ``subprocess_overlay`` hand-copied, and it duly
+drifted: ``"dictate"`` was handled by ``visual_mode`` and ``resolve_click`` for
+weeks while every surface silently dropped it, so the dictation bar never
+appeared on any OS. There is now ONE definition
+(``jarvis.ui.jarvisbar.modes``) and these tests fail the build if any layer
+restates it, stops accepting a mode, or leaves one without a defined look and a
+defined click behaviour.
+
+Deliberately derived: the expectations iterate ``modes.MODES`` rather than
+listing modes, so ADDING a mode automatically extends the coverage instead of
+silently escaping it.
+"""
+
+from __future__ import annotations
+
+import re
+from pathlib import Path
+
+import pytest
+
+from jarvis.ui.jarvisbar import interaction, modes, renderer
+from jarvis.ui.jarvisbar import subprocess_overlay as subprocess_mod
+from jarvis.ui.jarvisbar.null_overlay import NullOverlay
+from jarvis.ui.jarvisbar.overlay import JarvisBarOverlay
+
+_PACKAGE_DIR = Path(renderer.__file__).resolve().parent
+
+
+# --------------------------------------------------------------------------
+# One definition, imported everywhere
+# --------------------------------------------------------------------------
+def test_the_vocabulary_has_exactly_one_definition() -> None:
+ """Nothing may restate the tuple — every layer imports the same object."""
+ assert renderer.MODES is modes.MODES
+ assert renderer.DICTATION_MODES is modes.DICTATION_MODES
+ assert subprocess_mod._MODES is modes.MODES
+ assert interaction.DICTATION_MODES is modes.DICTATION_MODES
+
+
+def test_no_module_hardcodes_a_mode_tuple() -> None:
+ """A future hand-copied mirror is a build failure, not a bug report.
+
+ Scans the package for a literal tuple/list of mode strings outside the one
+ module that is allowed to define them. This is what makes the guard survive
+ a new surface written by someone who never read this file.
+ """
+ literal = re.compile(r"""\(\s*["']idle["']\s*,\s*["']listen["']""")
+ offenders: list[str] = []
+ for path in sorted(_PACKAGE_DIR.glob("*.py")):
+ if path.name == "modes.py":
+ continue
+ if literal.search(path.read_text(encoding="utf-8")):
+ offenders.append(path.name)
+ assert not offenders, (
+ "these modules restate the coarse-mode vocabulary instead of importing "
+ f"jarvis.ui.jarvisbar.modes: {offenders}"
+ )
+
+
+def test_dictation_modes_are_part_of_the_vocabulary() -> None:
+ for mode in modes.DICTATION_MODES:
+ assert mode in modes.MODES
+ # The four voice modes are untouched — no existing behaviour may shift.
+ assert modes.VOICE_MODES == ("idle", "listen", "speak", "think")
+ assert modes.DICTATION_MODES == ("dictate", "dictate_transcribing")
+
+
+# --------------------------------------------------------------------------
+# Every surface accepts every mode
+# --------------------------------------------------------------------------
[email protected]("mode", modes.MODES)
+def test_the_tk_surface_accepts_every_mode(mode: str) -> None:
+ bar = JarvisBarOverlay(persistent=False, accent="#abcdef")
+ bar.show(mode)
+ assert bar._mode == mode
+
+
+def test_the_tk_surface_still_rejects_an_unknown_mode() -> None:
+ bar = JarvisBarOverlay(persistent=False, accent="#abcdef")
+ bar.show("listen")
+ bar.show("bogus")
+ assert bar._mode == "listen"
+
+
[email protected]("mode", modes.MODES)
+def test_the_ipc_proxy_accepts_and_forwards_every_mode(mode: str) -> None:
+ """The macOS proxy must put every mode on the wire, or the feature is
+ Windows/Linux-only — a silent OS-parity hole (CLAUDE.md §3)."""
+ proxy = subprocess_mod.SubprocessBarOverlay.__new__(
+ subprocess_mod.SubprocessBarOverlay
+ )
+ sent: list[dict] = []
+ proxy._send = sent.append # type: ignore[method-assign]
+ proxy._persistent_flag = False
+ proxy._visible = False
+ proxy._mode = "idle"
+
+ proxy.show(mode)
+
+ assert proxy._mode == mode
+ assert sent == [{"op": "show", "mode": mode}]
+ assert proxy._visible is (mode != "idle")
+
+
[email protected]("mode", modes.MODES)
+def test_the_host_protocol_forwards_every_mode_verbatim(mode: str) -> None:
+ """The companion-process protocol carries no mode list of its own."""
+ from jarvis.ui.jarvisbar import host
+
+ class _Surface:
+ def __init__(self) -> None:
+ self.shown: list[str] = []
+
+ def show(self, mode: str = "listen") -> None:
+ self.shown.append(mode)
+
+ surface = _Surface()
+ assert host.dispatch(surface, {"op": "show", "mode": mode}) is True
+ assert surface.shown == [mode]
+
+
[email protected]("mode", modes.MODES)
+def test_the_null_surface_swallows_every_mode(mode: str) -> None:
+ NullOverlay().show(mode) # must never raise on any mode
+
+
+# --------------------------------------------------------------------------
+# Every mode has a defined look and a defined click behaviour
+# --------------------------------------------------------------------------
[email protected]("mode", modes.MODES)
+def test_every_mode_resolves_to_a_renderable_look(mode: str) -> None:
+ for seconds_since_audible in (0.0, 99.0):
+ for playback in (False, True):
+ look = renderer.visual_mode(
+ mode, seconds_since_audible, hold_s=0.4, playback_active=playback
+ )
+ assert look in ("idle", "speak", "think")
+
+
[email protected]("mode", modes.MODES)
+def test_every_mode_has_a_pill_size(mode: str) -> None:
+ w, h = renderer.target_pill_size(mode, hovered=False)
+ assert w > 0 and h > 0
+
+
[email protected]("mode", modes.MODES)
+def test_every_mode_resolves_a_click(mode: str) -> None:
+ action = interaction.resolve_click(400, 800, mode, hovered=True, pill_w=400)
+ assert action in ("hangup", "mute", "talk", "none")
diff --git a/tests/unit/ui/test_orb_bus_bridge_dictation.py b/tests/unit/ui/test_orb_bus_bridge_dictation.py
new file mode 100644
index 0000000000..e3d379f449
--- /dev/null
+++ b/tests/unit/ui/test_orb_bus_bridge_dictation.py
@@ -0,0 +1,348 @@
+"""The dictation lane on the bar: rise on key-down, animate, work, close.
+
+The maintainer's promise for the dictation shortcut is that it behaves like the
+wake word except it is a dictation turn — the bar rises and shows it is
+listening, the level indicator moves while you speak, on release it shows it is
+transcribing, and then it closes.
+
+Before this lane was wired, the bar could only appear on the FIRST non-final
+``DictationTranscript`` — a partial interval plus an STT round-trip after speech
+started, and never at all for a short press — and the level indicator stood
+still because ``_on_mic_level`` only forwarded samples during a voice state.
+These tests pin the fix at the four points it can regress: the reveal, the
+level gate, the transcribing look, and the stand-down.
+"""
+
+from __future__ import annotations
+
+import asyncio
+import sys
+from pathlib import Path
+
+import pytest
+
+_REPO_ROOT = Path(__file__).resolve().parents[3]
+if str(_REPO_ROOT) in sys.path:
+ sys.path.remove(str(_REPO_ROOT))
+sys.path.insert(0, str(_REPO_ROOT))
+sys.modules.pop("ui", None)
+
+try: # noqa: SIM105 — deliberate try-import (top-level `ui` discovery quirk)
+ from ui.orb import bus_bridge as bridge_mod # type: ignore[import-not-found]
+ from ui.orb.bus_bridge import OrbBusBridge # type: ignore[import-not-found]
+except ModuleNotFoundError: # pragma: no cover
+ pytest.skip(
+ "ui.orb not importable in this pytest pythonpath — run from repo root.",
+ allow_module_level=True,
+ )
+
+from jarvis.core.events import ( # noqa: E402
+ DictationCompleted,
+ DictationStarted,
+ DictationTranscribing,
+ DictationTranscript,
+ VoiceSessionStarted,
+ WakeCandidateDetected,
+)
+
+
+class _FakeBus:
+ def subscribe(self, *_a, **_k) -> None:
+ pass
+
+
+class _FakeOrb:
+ """Records every surface call, and accepts every mode the bar accepts."""
+
+ def __init__(self) -> None:
+ self.calls: list[tuple[str, object]] = []
+
+ def show(self, mode: str = "listen") -> None:
+ self.calls.append(("show", mode))
+
+ def hide(self) -> None:
+ self.calls.append(("hide", None))
+
+ def set_level(self, level: float) -> None:
+ self.calls.append(("set_level", level))
+
+ def play_animation(self, name: str) -> None:
+ self.calls.append(("play_animation", name))
+
+ def show_listening_transcript(self, text: str = "", duration_ms: int = 0) -> None:
+ self.calls.append(("transcript", text))
+
+ @property
+ def modes(self) -> list[str]:
+ return [arg for name, arg in self.calls if name == "show"]
+
+
+class _VoiceOnlyOrb(_FakeOrb):
+ """A surface that predates the dictation modes (the mascot orb): it raises
+ on anything outside the four voice modes."""
+
+ def show(self, mode: str = "listen") -> None:
+ if mode not in ("idle", "listen", "speak", "think"):
+ raise ValueError(f"Unknown mode: {mode}")
+ super().show(mode)
+
+
+def _bridge(orb: _FakeOrb, *, hide_on_idle: bool = True) -> OrbBusBridge:
+ return OrbBusBridge( # type: ignore[arg-type]
+ bus=_FakeBus(),
+ orb=orb,
+ hide_on_idle=hide_on_idle,
+ idle_animations_enabled=False,
+ )
+
+
+async def _quiesce(bridge: OrbBusBridge) -> None:
+ """Let any task the bridge scheduled run to completion."""
+ for task_attr in ("_dictation_standdown_task", "_dictation_failsafe_task"):
+ task = getattr(bridge, task_attr, None)
+ if task is not None and not task.done():
+ task.cancel()
+ await asyncio.sleep(0)
+
+
+# --------------------------------------------------------------------------
+# The reveal
+# --------------------------------------------------------------------------
+async def test_the_bar_rises_on_started_not_on_the_first_transcript() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+
+ assert orb.modes == ["dictate"]
+ assert bridge._dictation_active is True
+ await _quiesce(bridge)
+
+
+async def test_the_reveal_survives_a_stale_voice_state_label() -> None:
+ """Dictation never touches the voice state machine, so ``_last_state`` can
+ legitimately be stale. Gating the reveal on it would strand the feature with
+ no visible cause — the failure shape this repo calls BUG-037."""
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ bridge._last_state = "LISTENING" # a missed IDLE edge left this behind
+
+ await bridge._on_dictation_started(DictationStarted(target="auto"))
+
+ assert orb.modes == ["dictate"]
+ await _quiesce(bridge)
+
+
+async def test_a_live_voice_session_outranks_a_dictation_reveal() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ bridge._voice_session_active = True
+
+ await bridge._on_dictation_started(DictationStarted(target="chat"))
+
+ assert orb.modes == []
+ assert bridge._dictation_active is False
+ await _quiesce(bridge)
+
+
+async def test_a_voice_only_surface_degrades_to_its_listening_look() -> None:
+ """The mascot orb validates against the four voice modes and raises on
+ anything else. It has no close-X, so its listening look carries no
+ destructive affordance — an honest fallback, not a silent nothing."""
+ orb = _VoiceOnlyOrb()
+ bridge = _bridge(orb)
+
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+
+ assert orb.modes == ["listen"]
+ await _quiesce(bridge)
+
+
+# --------------------------------------------------------------------------
+# The level indicator
+# --------------------------------------------------------------------------
+async def test_the_level_indicator_moves_while_dictating() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ orb.calls.clear()
+
+ bridge._on_mic_level(0.62)
+
+ assert ("set_level", 0.62) in orb.calls
+ await _quiesce(bridge)
+
+
+def test_the_level_gate_is_unchanged_outside_a_dictation() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ bridge._last_state = "IDLE"
+
+ bridge._on_mic_level(0.62)
+
+ assert ("set_level", 0.62) not in orb.calls
+
+
+# --------------------------------------------------------------------------
+# The transcribing look
+# --------------------------------------------------------------------------
+async def test_release_switches_to_the_transcribing_look() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ orb.calls.clear()
+
+ await bridge._on_dictation_transcribing(DictationTranscribing())
+
+ assert orb.modes == ["dictate_transcribing"]
+ assert bridge._dictation_transcribing is True
+ await _quiesce(bridge)
+
+
+async def test_a_late_partial_cannot_drag_the_bar_back_to_the_mic_look() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ await bridge._on_dictation_transcribing(DictationTranscribing())
+ orb.calls.clear()
+
+ await bridge._on_dictation_transcript(DictationTranscript(text="hello", is_final=False))
+
+ assert orb.modes == [] # the working look stays put
+ assert ("transcript", "hello") in orb.calls
+ await _quiesce(bridge)
+
+
+async def test_transcribing_without_a_dictation_is_ignored() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+
+ await bridge._on_dictation_transcribing(DictationTranscribing())
+
+ assert orb.modes == []
+ await _quiesce(bridge)
+
+
+# --------------------------------------------------------------------------
+# The stand-down
+# --------------------------------------------------------------------------
+async def test_completion_stands_the_bar_down_and_closes_it() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb, hide_on_idle=True)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ await bridge._on_dictation_transcribing(DictationTranscribing())
+ orb.calls.clear()
+
+ await bridge._on_dictation_completed(
+ DictationCompleted(text="hello there", outcome="inserted")
+ )
+ assert bridge._dictation_active is False
+ assert bridge._dictation_transcribing is False
+
+ # Run the stand-down without waiting out its real dwell.
+ task = bridge._dictation_standdown_task
+ assert task is not None
+ bridge._schedule_dictation_standdown(0.0)
+ await asyncio.sleep(0)
+ await asyncio.sleep(0)
+ assert ("hide", None) in orb.calls
+ await _quiesce(bridge)
+
+
+async def test_a_persistent_bar_repaints_idle_instead_of_being_withdrawn() -> None:
+ """A persistent (always-on) bar must NEVER be withdrawn — the historical
+ 'the bar vanishes after I talk to it' bug."""
+ orb = _FakeOrb()
+ bridge = _bridge(orb, hide_on_idle=False)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ await bridge._on_dictation_completed(DictationCompleted(text="hi", outcome="inserted"))
+ orb.calls.clear()
+
+ bridge._schedule_dictation_standdown(0.0)
+ await asyncio.sleep(0)
+ await asyncio.sleep(0)
+
+ assert ("hide", None) not in orb.calls
+ assert orb.modes == ["idle"]
+ await _quiesce(bridge)
+
+
+async def test_a_new_dictation_cancels_the_previous_stand_down() -> None:
+ """Press → release → press again inside the dwell must not be closed by the
+ first turn's timer."""
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ await bridge._on_dictation_completed(DictationCompleted(text="hi", outcome="inserted"))
+ first = bridge._dictation_standdown_task
+ assert first is not None
+
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ await asyncio.sleep(0)
+
+ assert first.cancelled() or first.done()
+ assert bridge._dictation_standdown_task is None
+ assert bridge._dictation_active is True
+ await _quiesce(bridge)
+
+
+async def test_the_lane_cannot_stick_the_bar_on_forever() -> None:
+ """If ``DictationCompleted`` never arrives, an expiring fail-safe still
+ brings the bar down. A deadline expires; a latch you forget to clear does
+ not — and a permanently-lit bar with no visible cause is the worst failure
+ shape this product has."""
+ orb = _FakeOrb()
+ bridge = _bridge(orb, hide_on_idle=True)
+ monkey_delay = 0.0
+ original = bridge_mod.DICTATION_MAX_VISIBLE_S
+ bridge_mod.DICTATION_MAX_VISIBLE_S = monkey_delay
+ try:
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ orb.calls.clear()
+ task = bridge._dictation_failsafe_task
+ assert task is not None
+ await task
+ finally:
+ bridge_mod.DICTATION_MAX_VISIBLE_S = original
+
+ assert bridge._dictation_active is False
+ assert ("hide", None) in orb.calls
+
+
+# --------------------------------------------------------------------------
+# Interaction with the voice lane (zero regression budget)
+# --------------------------------------------------------------------------
+async def test_a_wake_preview_does_not_flicker_over_a_running_dictation() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ orb.calls.clear()
+
+ await bridge._on_wake_candidate(WakeCandidateDetected(active=True))
+
+ assert orb.modes == []
+ await _quiesce(bridge)
+
+
+async def test_the_wake_preview_is_untouched_when_no_dictation_runs() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+
+ await bridge._on_wake_candidate(WakeCandidateDetected(active=True))
+
+ assert orb.modes == ["listen"]
+ assert bridge._wake_candidate_active is True
+
+
+async def test_a_real_session_takes_the_bar_from_the_dictation_lane() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ orb.calls.clear()
+
+ await bridge._on_session_started(VoiceSessionStarted(session_id="s1"))
+
+ assert bridge._dictation_active is False
+ assert bridge._dictation_failsafe_task is None
+ assert "listen" in orb.modes
+ await _quiesce(bridge)
diff --git a/ui/orb/bus_bridge.py b/ui/orb/bus_bridge.py
index 0a34a8e7e7..bc62c2fbe2 100644
--- a/ui/orb/bus_bridge.py
+++ b/ui/orb/bus_bridge.py
@@ -38,6 +38,8 @@ from typing import TYPE_CHECKING, Any
from jarvis.core.events import (
AudioOutFirst,
DictationCompleted,
+ DictationStarted,
+ DictationTranscribing,
DictationTranscript,
JarvisAgentBackgroundCompleted,
ListeningStarted,
@@ -77,6 +79,17 @@ SALUTE_DURATION_S = 1.1
# the user should still see the mascot briefly instead of it vanishing instantly.
GRACE_HIDE_DURATION_S = 1.5
+# Hard ceiling on how long a dictation may keep the bar lit without a
+# ``DictationCompleted``. The pipeline caps a recording at ``dictation.
+# max_seconds`` (300 s default, and a configured 0 falls back to that same
+# default, so the cap can never be switched off); this is that ceiling plus a
+# generous transcription margin. It exists ONLY as a fail-safe: if the
+# completion event is lost — a crashed session, a dropped subscriber, a
+# surface swap mid-dictation — the bar must still come down on its own rather
+# than stay lit with no visible cause and no way back. A deadline expires; a
+# latch you forget to clear does not.
+DICTATION_MAX_VISIBLE_S = 360.0
+
# Long enough to cover an entire THINKING/SPEAKING phase. The transcript
# bubble is explicitly hidden when the state leaves voice mode (→ IDLE/ERROR).
#
@@ -192,9 +205,18 @@ class OrbBusBridge:
self._hangup_task: asyncio.Task | None = None
self._completion_task: asyncio.Task | None = None
# Dictation lane (separate from every voice state — see
- # _on_dictation_transcript): True while a dictation is painting the bar.
+ # _on_dictation_started): True while a dictation is painting the bar.
self._dictation_active = False
+ # True once recording stopped and the transcription is running, so a
+ # late partial transcript cannot drag the bar back to the mic look.
+ self._dictation_transcribing = False
self._dictation_standdown_task: asyncio.Task | None = None
+ # Expiring fail-safe, armed on DictationStarted and cancelled on
+ # DictationCompleted. If the completion event never arrives (a crashed
+ # session, a dropped subscriber) the bar would otherwise stay lit
+ # forever with no way back — the "it never goes away and I can't tell
+ # why" failure class. A deadline cannot stick the way a latch can.
+ self._dictation_failsafe_task: asyncio.Task | None = None
self._rng = random.Random()
self._listening_transcript_text = ""
# True while the pipeline is mid-completion-buffer (paused on an
@@ -300,10 +322,19 @@ class OrbBusBridge:
self._bus.subscribe(AudioOutFirst, self._on_audio_out_first)
# Dictation is a SEPARATE lane from the voice states: it raises no
# SystemStateChanged, so the four voice modes stay exactly as they
- # are and dictation gets its own coarse mode instead of borrowing
- # one. Without these two the bar showed nothing at all while
- # dictating.
+ # are and dictation gets its own coarse modes instead of borrowing
+ # one. The full lifecycle, in order:
+ # DictationStarted → the bar RISES, listening look, live level
+ # DictationTranscript → the live text in the bubble
+ # DictationTranscribing → recording stopped, working look
+ # DictationCompleted → outcome, then stand down and close
+ # The reveal hangs off ``DictationStarted`` and nothing else: the
+ # first transcript costs a partial interval plus an STT round-trip
+ # and never arrives at all for a short press, so a transcript-driven
+ # reveal meant the bar came up late or not at all.
+ self._bus.subscribe(DictationStarted, self._on_dictation_started)
self._bus.subscribe(DictationTranscript, self._on_dictation_transcript)
+ self._bus.subscribe(DictationTranscribing, self._on_dictation_transcribing)
self._bus.subscribe(DictationCompleted, self._on_dictation_completed)
# Boot visibility gate: a genuine voice-ready signal releases the
# hidden Jarvis Bar. Degraded UI-only ready signals do not.
@@ -467,6 +498,17 @@ class OrbBusBridge:
preview without forging an authoritative session state.
"""
if event.active:
+ if self._dictation_active:
+ # A candidate is an UNVERIFIED, retractable preview; a running
+ # dictation is a real thing the user started. Letting the
+ # preview repaint over it makes the dictation bar flicker into
+ # the wake look and back. The authoritative signals
+ # (WakeWordDetected / VoiceSessionStarted) are deliberately NOT
+ # gated, so a genuine session still takes the bar — and the
+ # dictation lane cannot deafen the preview for good because it
+ # carries its own expiring fail-safe.
+ log.debug("OrbBridge wake preview skipped: a dictation owns the bar")
+ return
# Incoming speech candidate — cancel any pending idle hide and pop
# the bar. _last_state untouched (see docstring).
if not self._wake_candidate_active:
@@ -545,6 +587,14 @@ class OrbBusBridge:
"""
log.info("OrbBridge._on_session_started: session=%s", event.session_id)
self._voice_session_active = True
+ # A real session outranks the dictation lane. Releasing it here means a
+ # dictation flag that somehow survived its own completion cannot follow
+ # the user into the next voice turn (stray mic-level routing, a
+ # suppressed wake preview) — the session is the authoritative owner.
+ self._dictation_active = False
+ self._dictation_transcribing = False
+ self._cancel_dictation_failsafe()
+ self._cancel_dictation_standdown()
prev_state = self._last_state
self._suppress_show_until_session = False
was_preview = self._wake_candidate_active
@@ -894,32 +944,120 @@ class OrbBusBridge:
elif state in ("THINKING", "SPEAKING"):
self._show_listening_transcript(self._last_response_text or THINKING_BUBBLE_TEXT)
+ def _show_dictation_mode(self, mode: str) -> None:
+ """Drive the current surface into a dictation coarse mode.
+
+ Every JarvisBar surface accepts the dictation modes. The mascot orb is
+ an older surface that validates against the four voice modes and raises
+ on anything else; for it the honest equivalent of "recording" is its
+ listening look, which carries no destructive affordance (the mascot has
+ no close-X — only drag and the four-click mute gesture), so falling back
+ cannot arm one. A surface that rejects both is left alone: a missing
+ visual is cosmetic, and it must never break the bus.
+ """
+ try:
+ self._orb.show(mode=mode)
+ return
+ except Exception as exc: # noqa: BLE001 — a surface hiccup is cosmetic
+ log.debug("OrbBridge dictation mode %r not supported: %s", mode, exc)
+ try:
+ self._orb.show(mode="listen")
+ except Exception as exc: # noqa: BLE001
+ log.debug("OrbBridge dictation fallback show suppressed: %s", exc)
+
+ async def _on_dictation_started(self, event: DictationStarted) -> None:
+ """The dictation key went down — raise the bar NOW.
+
+ This is the whole point of the event: the bar must rise at key-down
+ speed, exactly like it does on a wake word, instead of waiting for the
+ first partial transcript (a partial interval plus an STT round-trip —
+ and for a short press no partial ever arrives, so the bar never came up
+ at all).
+
+ Mirrors ``_on_session_started`` minus every voice-state mutation:
+ ``_last_state`` stays whatever it is, because dictation is not a voice
+ turn and must not forge one. Deliberately NOT gated on
+ ``_last_state == "IDLE"`` either — dictation never drives that label, so
+ a stale value left by a missed IDLE edge would block every dictation bar
+ with no visible cause (the BUG-037 failure shape). The authoritative
+ ``_voice_session_active`` flag (set and cleared by the session lifecycle
+ events) is the only thing that outranks a dictation, and the whole lane
+ uses that same guard so its four handlers cannot disagree.
+
+ The boot startup gate still applies: a surface that has not been
+ 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", ""))
+ self._cancel_dictation_standdown()
+ self._dictation_active = True
+ self._dictation_transcribing = False
+ # A fresh input affordance supersedes stale output recency from a
+ # preceding turn, and the mic envelope must start from silence so the
+ # bars only ever show what is said AFTER the bar is visible.
+ self._last_tts_level_t = 0.0
+ self._clear_input_level()
+ self._cancel_idle_scheduler()
+ self._show_dictation_mode("dictate")
+ self._show_listening_transcript("")
+ self._arm_dictation_failsafe()
+
async def _on_dictation_transcript(self, event: DictationTranscript) -> None:
"""Show the live dictation text on the bar.
Dictation runs in its own lane — it never raises SystemStateChanged, so
none of the voice-state handling above sees it and none of the four
- voice modes change meaning. It gets its own coarse mode, ``dictate``,
- which the renderer paints as the equalizer (the mic level is being fed,
- so the bars actually move) with no thinking indicator.
+ voice modes change meaning. It gets its own coarse modes, which the
+ renderer paints as the equalizer while recording (the mic level is being
+ fed, so the bars actually move) and as the orbital core while the text
+ is being produced.
A live voice session ALWAYS wins: dictation cannot start while one is
running, but a race at the boundary must not repaint a real turn.
+
+ The reveal itself belongs to ``_on_dictation_started``; this handler
+ only re-asserts the recording look for a dictation that is genuinely
+ still recording. Once ``DictationTranscribing`` has arrived it must NOT
+ drag the bar back to the mic look — a final partial can land after the
+ key is released.
+
+ Same guard as the rest of the lane (``_voice_session_active`` only, not
+ ``_last_state``) so the four dictation handlers can never disagree about
+ who owns the bar.
"""
- if self._voice_session_active or self._last_state != "IDLE":
+ if self._voice_session_active:
return
if getattr(event, "is_final", False):
# The completion handler owns the end of a dictation — it knows the
# outcome and whether anything needs saying.
return
text = (event.text or "").strip()
- try:
- self._orb.show(mode="dictate")
- except Exception as exc: # noqa: BLE001 — a surface hiccup is cosmetic
- log.debug("OrbBridge dictation show suppressed: %s", exc)
- self._dictation_active = True
+ if not self._dictation_transcribing:
+ self._show_dictation_mode("dictate")
+ if not self._dictation_active:
+ # A transcript with no preceding DictationStarted (an older
+ # pipeline, a lost event): this reveal has to arm the fail-safe
+ # itself, or a lane opened here would have nothing bounding it.
+ self._dictation_active = True
+ self._arm_dictation_failsafe()
self._show_listening_transcript(text)
+ async def _on_dictation_transcribing(self, _event: DictationTranscribing) -> None:
+ """Recording stopped, the transcription is running — show the work.
+
+ The mic feed has ended here, so leaving the equalizer up would claim the
+ bar is still listening when it is not. The dedicated
+ ``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:
+ return
+ self._dictation_transcribing = True
+ self._show_dictation_mode("dictate_transcribing")
+
async def _on_dictation_completed(self, event: DictationCompleted) -> None:
"""Dictation finished — show the outcome briefly, then stand down.
@@ -931,9 +1069,16 @@ class OrbBusBridge:
if not getattr(self, "_dictation_active", False):
return
self._dictation_active = False
+ self._dictation_transcribing = False
+ self._cancel_dictation_failsafe()
message = (event.detail or "").strip() or (event.text or "").strip()
self._show_listening_transcript(message)
- if self._voice_session_active or self._last_state != "IDLE":
+ # 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:
return
# Give the user a moment to read it, then return the bar to standby.
# A longer dwell for a message that needs acting on than for the plain
@@ -944,21 +1089,83 @@ class OrbBusBridge:
except Exception as exc: # noqa: BLE001
log.debug("OrbBridge dictation stand-down suppressed: %s", exc)
- def _schedule_dictation_standdown(self, delay_s: float) -> None:
- """Return the bar to its resting look after a dictation."""
+ def _cancel_dictation_standdown(self) -> None:
+ """Drop a pending stand-down so a new dictation is not closed by the
+ previous one's timer (press → release → press again inside the dwell)."""
task = getattr(self, "_dictation_standdown_task", None)
if task is not None and not task.done():
task.cancel()
+ self._dictation_standdown_task = None
+
+ def _cancel_dictation_failsafe(self) -> None:
+ task = getattr(self, "_dictation_failsafe_task", None)
+ if task is not None and not task.done():
+ task.cancel()
+ self._dictation_failsafe_task = None
+
+ def _arm_dictation_failsafe(self) -> None:
+ """Guarantee the dictation bar comes down even if nothing tells it to.
+
+ ``DictationCompleted`` normally ends the lane. This is the backstop for
+ when it does not arrive at all — the session crashed before publishing,
+ a subscriber was dropped, the surface was swapped mid-dictation. Without
+ it the bar would sit there lit forever with no visible cause and no way
+ back, which is the single worst failure shape this codebase has (the bar
+ is the only proof the app is alive). The deadline is far longer than any
+ real dictation, so it can never cut a genuine one short.
+ """
+ self._cancel_dictation_failsafe()
+
+ async def _expire() -> None:
+ try:
+ await asyncio.sleep(DICTATION_MAX_VISIBLE_S)
+ except asyncio.CancelledError:
+ return
+ if not self._dictation_active:
+ return
+ log.warning(
+ "OrbBridge dictation fail-safe fired after %.0fs — no completion "
+ "event arrived; standing the bar down.",
+ DICTATION_MAX_VISIBLE_S,
+ )
+ 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.
+ return
+ # Stand down directly rather than through _schedule_dictation_
+ # standdown: that path also refuses when ``_last_state`` is not
+ # IDLE, and a stale state left by a missed edge is exactly the
+ # situation this fail-safe exists for.
+ self._show_listening_transcript("")
+ try:
+ if self._hide_on_idle:
+ self._orb.hide()
+ else:
+ self._orb.show(mode="idle")
+ except Exception as exc: # noqa: BLE001
+ log.debug("OrbBridge dictation fail-safe repaint suppressed: %s", exc)
+
+ self._dictation_failsafe_task = asyncio.create_task(
+ _expire(), name="orb-dictation-failsafe"
+ )
+
+ def _schedule_dictation_standdown(self, delay_s: float) -> None:
+ """Return the bar to its resting look after a dictation."""
+ self._cancel_dictation_standdown()
async def _standdown() -> None:
try:
await asyncio.sleep(delay_s)
except asyncio.CancelledError:
return
+ # A NEW dictation or a real voice session has taken the bar in the
+ # meantime — it owns the look now. Deliberately NOT gated on
+ # ``_last_state``: dictation never touches the voice state machine,
+ # so a stale label there would strand the bar in the dictation look
+ # with nothing left to clear it (see _on_dictation_completed).
if self._dictation_active or self._voice_session_active:
return
- if self._last_state != "IDLE":
- return
self._show_listening_transcript("")
try:
if self._hide_on_idle:
@@ -1136,7 +1343,13 @@ class OrbBusBridge:
only when (a) NO TTS output is currently playing — Jarvis's voice owns
the bars while it speaks, and the state label is unreliable because
continue-listening flips to LISTENING mid-playback — and (b) the coarse
- state is LISTENING. Works for whichever surface is current."""
+ state is LISTENING, a wake candidate is previewing, or a dictation is
+ recording. Works for whichever surface is current.
+
+ The dictation clause is what makes the level indicator move while you
+ dictate: the dictation session feeds the very same ``mic_level`` channel,
+ but it never enters a voice state, so without it every sample was
+ dropped and the equalizer stood still on a visible bar."""
if time.monotonic() - self._last_tts_level_t < self._TTS_OWNS_BARS_S:
return # TTS is making sound → it drives the bars, not the silent mic
candidate_listening = self._wake_candidate_active and self._last_state in {
@@ -1144,7 +1357,11 @@ class OrbBusBridge:
"ERROR",
"PAUSED",
}
- if self._last_state != "LISTENING" and not candidate_listening:
+ if (
+ self._last_state != "LISTENING"
+ and not candidate_listening
+ and not self._dictation_active
+ ):
return
try:
self._orb.set_level(level)