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
fix(jarvisbar): the Prompt Mode sparkle only exists while the mode is on
rubenluetke10-beepb30e2d84244d
diff --git a/docs/BUGS.md b/docs/BUGS.mdindex 886ab39b46..480cb2e968 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -14342,8 +14342,13 @@ came back as a document passed everything.**Also in this change (feature, maintainer request the same message).** ThePrompt Mode switch is now a control on the native Jarvis bar: a sparkle in the-resting pill's left slot, lit while the switch is on and visible without a-hover, clickable while the controls are up. It has ONE writer+resting pill's left slot, drawn ONLY while the mode is on and clicked to switch+it off. Two follow-up corrections the same evening, both from a screenshot: at+the close-X's inset the mark's tips crossed the rim and drew onto the colour+key (a magenta fleck and a star floating outside the pill), so it moved to the+mic's mirrored inset and shrank; and the dim OFF-state sparkle is gone — the+bar reports a state and offers the way out of it, it does not advertise a+feature that is not running. It has ONE writer(`jarvis/dictation/prompt_mode_switch.py`) and one broadcast(`DictationPromptModeChanged`) that the bar, the front-page pill and thesettings card all redraw from — the mute flag's shape, for the reason mute hasdiff --git a/docs/os-parity.md b/docs/os-parity.mdindex afb418bea6..85554118e0 100644--- a/docs/os-parity.md+++ b/docs/os-parity.md@@ -290,7 +290,7 @@ shortcuts it never created. Covered by|---|---|---|---|---|---|| P-38 | Medium | Native installer / desktop window | The Linux AppImage and `.deb` have **no native desktop window**. Windows (WebView2) and macOS (WKWebView) get one from the frozen bundle; Linux does not, because pywebview's GTK backend needs PyGObject and a frozen interpreter can never import the distribution's `python3-gi` (it is compiled against the system CPython), while bundling GTK 3 + WebKit2GTK portably means shipping its helper processes, GIO modules, pixbuf loaders, GSettings schemas and typelibs. The Qt route is also closed today: the `[desktop]` extra installs `pyside6-essentials`, which has no QtWebEngine, and `jarvis.spec` excludes PySide6 outright. Adding `pyside6-addons` and dropping that exclusion is the realistic fix, at roughly +400 MB | `packaging/linux/README.md` ("The window question"), `jarvis/ui/desktop_app.py::_degrade_to_browser_ui`, `jarvis.spec` `excludes`, `pyproject.toml` `[desktop]` | Linux: honest degradation, verified against a real build — the app catches pywebview's `WebViewException`, keeps the backend serving, and `AppRun` waits for `/api/health` and opens the interface with `xdg-open`. Everything except the window frame works, including the whole CLI. A source/pipx install on a Linux desktop with `python3-gi` + `gir1.2-webkit2-4.1` still gets the native window; only the frozen build does not. Sub-gap: the app's fallback message advises installing those system packages, which does not help a frozen build || P-39 | Medium | Dictation hold-key watchdog | A HOLD-started dictation is owed a release edge, and that edge can be lost between the OS hotkey listener and the pipeline (a checker restart mid-hold, a re-arm, a handler that raised). The recording then ran to its 30-minute cap with the bar's X dead and every key press refused (BUG-191). The repair asks the keyboard instead of trusting edges: `HotkeyBackend.chord_is_down(combo)` is a three-way capability — `True`/`False` when the backend can see the keyboard, `None` when it cannot — and the recording finishes itself once the chord has read "up" for one second. The three OS backends can see different amounts: Windows reads `GetAsyncKeyState` (ground truth, the poller's own source); macOS answers from the event tap's held-set, whose modifier half is re-synced from every event's flags word; Linux/X11 answers from pynput's held-set, which is edge-fed like the matcher itself | `jarvis/trigger/backends/__init__.py::HotkeyBackend.chord_is_down`, `backends/global_hotkeys.py::chord_is_down`, `backends/quartz.py::chord_is_down`, `backends/pynput.py::chord_is_down`, `backends/noop.py`, `jarvis/speech/pipeline.py::_watch_dictation_hold_key`, `tests/contract/test_hotkey_backend_protocol.py` | Windows: the watchdog sees the physical key and ends a lost-release recording within ~1 s. macOS / Linux-X11: the watchdog runs on the listener's own bookkeeping — it catches a release the pipeline missed, not one the listener itself missed. Wayland / no listener: the backend answers `None`, the watchdog stands down, and the other stop gestures carry alone — the key (a press during a running dictation is its stop), the bar's X, the Dictation view, `jarvis api dictation stop`. On no host does `None` ever read as "up": a phantom release is the one failure this must never produce |-| P-40 | Low | JarvisBar | The Prompt Mode switch (`[dictation].prompt_mode`, every dictation comes out as a written prompt) is a control on the native bar since 2026-08-28: a sparkle in the resting pill's left slot, lit while on and visible without a hover (the pill opens as it does for mute), dim and clickable while hovered, the hang-up X unchanged on a live bar. The switch has ONE writer (`jarvis/dictation/prompt_mode_switch.py`) and one broadcast (`DictationPromptModeChanged`) that the bar, the front-page pill and the settings card all redraw from | `jarvis/ui/jarvisbar/renderer.py::_draw_sparkle`, `interaction.py::resolve_click` (`prompt_mode_toggle`), `overlay.py` / `qt_overlay.py` / `subprocess_overlay.py` (`set_prompt_mode`, `set_on_prompt_mode_toggle`), `host.py` (op `set_prompt_mode`, event `prompt_mode_toggle`), `ui/orb/bus_bridge.py` | Windows/Linux (Tk bar, in-process) and macOS (Qt bar in the companion host, over the existing IPC protocol): the same sparkle, the same click, the same event. Headless / `orb_style = none`: the NullOverlay accepts both methods as no-ops; the pill on the front page and the settings card remain the switch. Guards: `tests/unit/ui/jarvisbar/test_prompt_mode_button.py`, `test_prompt_mode_bridge.py`, `test_surface_contract.py`, `test_host_protocol.py` |+| P-40 | Low | JarvisBar | The Prompt Mode switch (`[dictation].prompt_mode`, every dictation comes out as a written prompt) is a control on the native bar since 2026-08-28: a sparkle in the resting pill's left slot, drawn ONLY while the mode is on (visible without a hover — the pill opens as it does for mute) and clicked to switch it off; with the mode off nothing is drawn there and the spot starts a session as before, so the bar can only ever turn the mode OFF. The glyph mirrors the mic's inset rather than the close-X's, which is left untouched on a live bar. The switch has ONE writer (`jarvis/dictation/prompt_mode_switch.py`) and one broadcast (`DictationPromptModeChanged`) that the bar, the front-page pill and the settings card all redraw from | `jarvis/ui/jarvisbar/renderer.py::_draw_sparkle`, `interaction.py::resolve_click` (`prompt_mode_toggle`), `overlay.py` / `qt_overlay.py` / `subprocess_overlay.py` (`set_prompt_mode`, `set_on_prompt_mode_toggle`), `host.py` (op `set_prompt_mode`, event `prompt_mode_toggle`), `ui/orb/bus_bridge.py` | Windows/Linux (Tk bar, in-process) and macOS (Qt bar in the companion host, over the existing IPC protocol): the same sparkle, the same click, the same event. Headless / `orb_style = none`: the NullOverlay accepts both methods as no-ops; the pill on the front page and the settings card remain the switch. Guards: `tests/unit/ui/jarvisbar/test_prompt_mode_button.py`, `test_prompt_mode_bridge.py`, `test_surface_contract.py`, `test_host_protocol.py` |## Maintenancediff --git a/jarvis/ui/jarvisbar/interaction.py b/jarvis/ui/jarvisbar/interaction.pyindex 553a57d658..6d9c8aef0e 100644--- a/jarvis/ui/jarvisbar/interaction.py+++ b/jarvis/ui/jarvisbar/interaction.py@@ -44,6 +44,9 @@ def classify_release(*, moved: bool) -> str:_CLOSE_X_HIT_PX: float = 10.0_CLOSE_X_HIT_FRAC: float = 0.14_CLOSE_X_CENTRE_FRAC: float = 0.42 # X centre offset from pill centre (mirror of renderer)+# The Prompt Mode sparkle's centre, mirroring ``renderer.SPARKLE_CENTRE_FRAC``+# (this module must not import the renderer — see the module docstring).+_SPARKLE_CENTRE_FRAC: float = 0.33def resolve_click(@@ -53,6 +56,7 @@ def resolve_click(*,hovered: bool = False,pill_w: float | None = None,+ prompt_mode: bool = False,) -> str:"""Resolve a click on the bar into an action by its horizontal zone + state.@@ -86,13 +90,15 @@ def resolve_click(draws for these modes — resolved to nothing (BUG-191). The renderer andthis resolver now agree: a drawn X is a working X.- The IDLE pill's left control is the Prompt Mode sparkle — the switch that- turns every dictation into a written prompt. It sits where the close-X- sits on a live bar and is drawn only while the controls are up- (``hovered``), so a click on that spot flips the switch instead of- starting a session; a click anywhere else on the idle body still talks.- Non-destructive, reversible with a second click, and it takes no more of- the bar than the X does.+ The IDLE pill's left control is the Prompt Mode sparkle, and it exists+ ONLY while ``prompt_mode`` is on — the renderer draws it exactly then, so+ a click there switches the mode off, and with the mode off the same spot+ is ordinary body and starts a session. That asymmetry is deliberate+ (maintainer, 2026-08-28): the bar reports a state the user might have+ forgotten and offers the way out of it; it is not a place to switch the+ feature on, which is what the settings card and the front-page pill are+ for. The glyph mirrors the mic's inset rather than the close-X's, because+ at the X's offset its left tip drew outside the pill.``NOTICE_MODES`` is inert for the same reason and one more. A notice is atransient ANSWER, not a control: it appears unrequested, it opens the pill@@ -115,9 +121,14 @@ def resolve_click(if frac >= 0.60: # right zone → the mic mute toggle (non-destructive)return "mute"if not active:- # Idle: the sparkle on the left (only while the controls are up) flips- # Prompt Mode; the rest of the body starts a normal session.- if hovered and _on_prompt_sparkle(x, width, pill_w):+ # Idle: the sparkle on the left switches Prompt Mode OFF; the rest of+ # the body starts a normal session. Gated on ``prompt_mode`` and not+ # on ``hovered``, because the renderer draws the sparkle exactly when+ # the mode is on — hovered or at rest — and a drawn glyph is a working+ # glyph. With the mode off nothing is drawn there and the spot talks,+ # which is also why the bar can only ever turn the mode OFF: an unlit+ # switch would be an advert for a feature that is not running.+ if prompt_mode and _on_prompt_sparkle(x, width, pill_w):return "prompt_mode_toggle"return "talk"# Active session: the ONLY destructive bar action is the close-X hang-up,@@ -143,12 +154,16 @@ def _on_close_x(x: float, width: int, pill_w: float | None) -> bool:def _on_prompt_sparkle(x: float, width: int, pill_w: float | None) -> bool:"""Does a click at ``x`` land on the Prompt Mode sparkle?- The sparkle takes the close-X's slot on the idle pill (the renderer draws- it at ``cx - 0.42*pw`` too), so the hit-box is the X's. In production- ``pill_w`` is the OPEN pill width — the size the idle pill has while- hovered.+ The sparkle mirrors the MIC rather than sharing the close-X's slot: it is+ the bigger glyph, and at the X's ``0.42`` its left tip crossed the rim and+ drew outside the pill (2026-08-28). ``_SPARKLE_CENTRE_FRAC`` restates+ ``renderer.SPARKLE_CENTRE_FRAC`` — this module stays dependency-free, so+ it cannot import the renderer; a test pins the two together."""- return _on_close_x(x, width, pill_w)+ pw = float(pill_w) if pill_w is not None else float(width)+ x_glyph = width / 2.0 - _SPARKLE_CENTRE_FRAC * pw+ hit = max(_CLOSE_X_HIT_PX, _CLOSE_X_HIT_FRAC * pw)+ return abs(x - x_glyph) <= hitdef default_bottom_center(diff --git a/jarvis/ui/jarvisbar/overlay.py b/jarvis/ui/jarvisbar/overlay.pyindex c994720412..294246cc29 100644--- a/jarvis/ui/jarvisbar/overlay.py+++ b/jarvis/ui/jarvisbar/overlay.py@@ -1915,6 +1915,7 @@ class JarvisBarOverlay:self._mode,hovered=hovered,pill_w=pill_w,+ prompt_mode=getattr(self, "_prompt_mode", False),)if action == "dictation_stop":# The X while dictating ends the recording and deliversdiff --git a/jarvis/ui/jarvisbar/qt_overlay.py b/jarvis/ui/jarvisbar/qt_overlay.pyindex e8f2136315..ca4f15cd74 100644--- a/jarvis/ui/jarvisbar/qt_overlay.py+++ b/jarvis/ui/jarvisbar/qt_overlay.py@@ -1473,6 +1473,7 @@ class QtJarvisBarOverlay:# The idle pill is OPEN while its controls are up; the sparkle's# hit-box tracks that pill, not the window.pill_w=renderer.ACTIVE_W if active else renderer.OPEN_W,+ prompt_mode=self._prompt_mode,)if action == "mute":callback = self._on_mute_togglediff --git a/jarvis/ui/jarvisbar/renderer.py b/jarvis/ui/jarvisbar/renderer.pyindex 774edd4dd4..5fe9590041 100644--- a/jarvis/ui/jarvisbar/renderer.py+++ b/jarvis/ui/jarvisbar/renderer.py@@ -447,6 +447,16 @@ _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)+# The Prompt Mode sparkle: where its centre sits (offset from the pill centre,+# as a fraction of the pill WIDTH — the mirror of the mic's ``+0.33``) and how+# big it is (fraction of the pill HEIGHT). PUBLIC because+# ``interaction._on_prompt_sparkle`` must place its hit-box on the same spot,+# and that module is deliberately dependency-free (no PIL/numpy) so it cannot+# import this one — it restates the value the way ``_CLOSE_X_CENTRE_FRAC``+# already does, and the parity is pinned by a test.+SPARKLE_CENTRE_FRAC = 0.33+SPARKLE_R_FRAC = 0.30+# 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).@@ -853,6 +863,13 @@ class JarvisBarRenderer:# Hover splits the bar into controls: LEFT X (hang up, only while a# session is live) + RIGHT mic (toggle voice mute for Jarvis).x_right = cx + 0.33 * pw # pulled in so the mic glyph never clips the rim+ # The Prompt Mode sparkle mirrors the mic rather than sharing the+ # close-X's slot. Measured on the OPEN pill (68x19 at 1x): the X sits+ # 5.4 px from the rim and its own radius is 4.9, which just fits; the+ # sparkle is bigger and at 0.42 its left tip crossed the rim and drew+ # onto the colour key — a star floating OUTSIDE the pill, which is+ # what the maintainer saw and could not read (2026-08-28).+ x_sparkle = cx - SPARKLE_CENTRE_FRAC * pwif confirming:# The verdict owns the pill alone. Equalizer bars or the orbital# core behind a tick would be mush at this pill height — and the@@ -892,12 +909,13 @@ class JarvisBarRenderer:)if active_sess:self._draw_close_x(d, x_left, cy, ph)- else:- # Idle controls: the left slot is the Prompt Mode switch —- # lit while every dictation becomes a prompt, dim while it- # does not. Same spot as the close-X, so the hand that knows- # where the bar's left control lives finds this one too.- self._draw_sparkle(img, x_left, cy, ph, lit=prompt_mode)+ elif prompt_mode:+ # The Prompt Mode switch, and ONLY while the mode is on: the+ # maintainer asked for it to be shown in that mode and in no+ # other (2026-08-28). It is the way OUT of the mode, not an+ # advert for a feature that is not running — turning it on+ # stays with the settings card and the front-page pill.+ self._draw_sparkle(img, x_sparkle, cy, ph)self._draw_mic(img, x_right, cy, ph, muted)elif mode == "think":self._draw_thinking(d, t, cx, cy, pw, ph)@@ -907,13 +925,13 @@ class JarvisBarRenderer:# Standby with a state worth seeing (idle, not hovered). Muted:# always show the slashed mic so the user sees at a glance they're# muted AND where to click to unmute (they can't unmute by voice —- # Jarvis is deaf while muted). Prompt Mode on: the lit sparkle, so+ # Jarvis is deaf while muted). Prompt Mode on: the sparkle, so# "every dictation comes out rewritten" is never a surprise and- # the switch is one hover away.+ # the switch that ends it is right there.if muted:self._draw_mic(img, x_right, cy, ph, muted=True)if prompt_mode:- self._draw_sparkle(img, cx - 0.42 * pw, cy, ph, lit=True)+ self._draw_sparkle(img, x_sparkle, cy, ph)# idle / standby (not hovered, not muted, Prompt Mode off): a clean# EMPTY pill — no dots, no bars. "When nothing is happening, nothing is# in the bar."@@ -941,21 +959,21 @@ class JarvisBarRenderer:d.line([(cx - r, cy - r), (cx + r, cy + r)], fill=CLOSE_X, width=w)d.line([(cx - r, cy + r), (cx + r, cy - r)], fill=CLOSE_X, width=w)- def _draw_sparkle(- self, img: Image.Image, cx: float, cy: float, ph: float, lit: bool- ) -> None:+ def _draw_sparkle(self, img: Image.Image, cx: float, cy: float, ph: float) -> None:"""Left-hand control on the resting pill: the Prompt Mode switch.A four-point star with a smaller companion up and to the right — thesparkle mark the app uses for the same switch on its front page, so- the two surfaces read as one control. Accent-coloured while ON; the- standby dot grey while off (drawn only while the controls are up).- Supersampled like the mic, because thin star tips alias at ~30 px.+ the two surfaces read as one control. Always the accent colour,+ because it is only ever drawn while the mode is ON: an OFF switch that+ is invisible is the whole point of it (the bar advertises a state, it+ does not offer a feature). Supersampled like the mic, because thin+ star tips alias at ~30 px."""ss = 4layer = Image.new("RGBA", (img.width * ss, img.height * ss), (0, 0, 0, 0))ld = ImageDraw.Draw(layer)- color = (*(self._accent if lit else DOT_COLOR), 255)+ color = (*self._accent, 255)x, y, p = cx * ss, cy * ss, ph * ssdef star(sx: float, sy: float, r: float) -> None:@@ -966,9 +984,15 @@ class JarvisBarRenderer:pts.append((sx + rad * math.cos(ang), sy - rad * math.sin(ang)))ld.polygon(pts, fill=color)- r = p * 0.30+ # Sized and tucked so the whole mark stays INSIDE the pill. The star+ # has a tip pointing straight up, so the companion's reach above+ # centre is (offset + its own radius) — kept to 1.08*r, i.e. well+ # under the pill's half-height, because the 4x LANCZOS downscale rings+ # a pixel or two past the source and a tip that grazed the rim drew a+ # magenta fleck of colour key ABOVE the bar (measured 2026-08-28).+ r = p * SPARKLE_R_FRACstar(x - r * 0.15, y + r * 0.15, r)- star(x + r * 0.85, y - r * 0.85, r * 0.42)+ star(x + r * 0.80, y - r * 0.72, r * 0.36)small = layer.resize(img.size, Image.Resampling.LANCZOS)img.paste(small, (0, 0), small)diff --git a/tests/unit/ui/jarvisbar/test_click_no_session_guard.py b/tests/unit/ui/jarvisbar/test_click_no_session_guard.pyindex c5d2612510..96f46655a1 100644--- a/tests/unit/ui/jarvisbar/test_click_no_session_guard.py+++ b/tests/unit/ui/jarvisbar/test_click_no_session_guard.py@@ -90,18 +90,13 @@ def test_repeated_close_click_does_not_reopen_session(monkeypatch):assert fake.hangup_calls == 1assert fake.session_calls == 0- # The guard is bounded: after the backend has reached idle, the X's spot- # is the idle pill's left control — the Prompt Mode sparkle (drawn there- # while hovered) — so a deliberate click flips that switch rather than- # firing a hang-up; the idle BODY still starts a new call.- flips: list[int] = []- bar.set_on_prompt_mode_toggle(lambda: flips.append(1))+ # The guard is bounded: after the backend has reached idle, the same area+ # behaves like the normal idle body and can deliberately start a new call.+ # (The Prompt Mode sparkle sits further in, at the mic's mirrored inset,+ # and only exists while that mode is on — so it never shadows this spot.)fake._session_active = Falsenow[0] += 1.0bar._on_click(_x_glyph(), hovered=True)- assert flips == [1]- assert fake.hangup_calls == 1- bar._on_click(R.WIN_W / 2, hovered=True)assert fake.session_calls == 1diff --git a/tests/unit/ui/jarvisbar/test_prompt_mode_button.py b/tests/unit/ui/jarvisbar/test_prompt_mode_button.pyindex b860386328..a931387bd2 100644--- a/tests/unit/ui/jarvisbar/test_prompt_mode_button.py+++ b/tests/unit/ui/jarvisbar/test_prompt_mode_button.py@@ -38,9 +38,8 @@ class _FakePipeline:def _sparkle_x() -> float:- """The on-screen sparkle centre on the OPEN (hovered idle) pill — the- renderer's ``cx - 0.42 * pw``."""- return R.WIN_W / 2.0 - 0.42 * R.OPEN_W+ """The on-screen sparkle centre on the OPEN (idle) pill."""+ return R.WIN_W / 2.0 - R.SPARKLE_CENTRE_FRAC * R.OPEN_Wdef _patch_pipeline(monkeypatch, fake) -> None:@@ -52,40 +51,79 @@ def _patch_pipeline(monkeypatch, fake) -> None:# --------------------------------------------------------------------------- #-def test_idle_hovered_sparkle_click_flips_prompt_mode() -> None:- action = interaction.resolve_click(- _sparkle_x(), R.WIN_W, "idle", hovered=True, pill_w=R.OPEN_W- )- assert action == "prompt_mode_toggle"+def test_the_hit_box_sits_where_the_renderer_draws_the_sparkle() -> None:+ """The two live in different modules on purpose — ``interaction`` stays+ dependency-free and cannot import the renderer — so the shared number is+ pinned here. A drawn glyph must be a working glyph."""+ assert interaction._SPARKLE_CENTRE_FRAC == R.SPARKLE_CENTRE_FRAC-def test_the_sparkle_is_only_a_control_while_the_controls_are_up() -> None:- """Not hovered, nothing is drawn there, so nothing is clicked there: the- resting pill's body starts a session as it always did."""- action = interaction.resolve_click(- _sparkle_x(), R.WIN_W, "idle", hovered=False, pill_w=R.OPEN_W- )- assert action == "talk"+def test_the_sparkle_fits_inside_the_pill() -> None:+ """The defect this replaced: at the close-X's 0.42 the star's left tip+ reached past the rim and drew onto the colour key — a star floating+ OUTSIDE the pill, which is why the maintainer could not read it."""+ for pw, ph in ((R.OPEN_W, R.OPEN_H), (R.ACTIVE_W, R.ACTIVE_H)):+ left_rim = R.WIN_W / 2.0 - pw / 2.0+ centre = R.WIN_W / 2.0 - R.SPARKLE_CENTRE_FRAC * pw+ radius = R.SPARKLE_R_FRAC * ph+ # The main star sits at ``centre - 0.15*r`` and reaches ``r`` further left.+ assert centre - 1.15 * radius > left_rim+ # The companion reaches 1.27*r above centre; the pill is ph/2 tall.+ assert 1.27 * radius < ph / 2.0+++def test_a_click_on_the_sparkle_switches_prompt_mode_off() -> None:+ for hovered in (True, False):+ action = interaction.resolve_click(+ _sparkle_x(), R.WIN_W, "idle", hovered=hovered, pill_w=R.OPEN_W, prompt_mode=True+ )+ assert action == "prompt_mode_toggle", hovered+++def test_with_prompt_mode_off_that_spot_is_ordinary_bar() -> None:+ """Nothing is drawn there, so nothing is clicked there — and the bar can+ only ever switch the mode OFF. Turning it on stays with the settings card+ and the front-page pill (maintainer, 2026-08-28)."""+ for hovered in (True, False):+ action = interaction.resolve_click(+ _sparkle_x(), R.WIN_W, "idle", hovered=hovered, pill_w=R.OPEN_W, prompt_mode=False+ )+ assert action == "talk", hovereddef test_the_idle_body_still_talks_and_the_mic_still_mutes() -> None:- assert interaction.resolve_click(R.WIN_W / 2, R.WIN_W, "idle", hovered=True) == "talk"- assert interaction.resolve_click(R.WIN_W * 0.9, R.WIN_W, "idle", hovered=True) == "mute"+ for prompt_mode in (False, True):+ assert (+ interaction.resolve_click(+ R.WIN_W / 2, R.WIN_W, "idle", hovered=True, prompt_mode=prompt_mode+ )+ == "talk"+ )+ assert (+ interaction.resolve_click(+ R.WIN_W * 0.9, R.WIN_W, "idle", hovered=True, prompt_mode=prompt_mode+ )+ == "mute"+ )-def test_a_live_bar_keeps_the_close_x_in_that_slot() -> None:- """During a session the left control is the hang-up X, never the switch:- a user reaching for the X must not silently change how their next+def test_a_live_bar_keeps_the_close_x_untouched() -> None:+ """During a session the left control is the hang-up X, whatever the switch+ is doing: a user reaching for the X must not silently change how their nextdictation is written."""x = R.WIN_W / 2.0 - 0.42 * R.ACTIVE_Wfor mode in ("listen", "speak", "think"):assert (- interaction.resolve_click(x, R.WIN_W, mode, hovered=True, pill_w=R.ACTIVE_W)+ interaction.resolve_click(+ x, R.WIN_W, mode, hovered=True, pill_w=R.ACTIVE_W, prompt_mode=True+ )== "hangup")for mode in ("dictate", "dictate_transcribing"):assert (- interaction.resolve_click(x, R.WIN_W, mode, hovered=True, pill_w=R.ACTIVE_W)+ interaction.resolve_click(+ x, R.WIN_W, mode, hovered=True, pill_w=R.ACTIVE_W, prompt_mode=True+ )== "dictation_stop")@@ -95,31 +133,33 @@ def test_a_live_bar_keeps_the_close_x_in_that_slot() -> None:# --------------------------------------------------------------------------- #-def test_sparkle_click_fires_toggle_and_optimistically_flips(monkeypatch) -> None:+def test_sparkle_click_fires_toggle_and_optimistically_clears(monkeypatch) -> None:bar = JarvisBarOverlay()+ bar.set_prompt_mode(True) # the only state in which the sparkle existsfired: list[int] = []bar.set_on_prompt_mode_toggle(lambda: fired.append(1))fake = _FakePipeline()_patch_pipeline(monkeypatch, fake)- assert bar._prompt_mode is Falsebar._on_click(_sparkle_x(), hovered=True)assert fired == [1]- assert bar._prompt_mode is True # optimistic flip → lit sparkle next frame+ assert bar._prompt_mode is False # optimistic flip → the sparkle goesassert fake.session_calls == 0 # the switch is not a session start+ # ...and with the mode off the same spot is ordinary bar again.bar._on_click(_sparkle_x(), hovered=True)- assert fired == [1, 1]- assert bar._prompt_mode is False+ assert fired == [1]+ assert fake.session_calls == 1-def test_no_callback_means_no_false_sparkle(monkeypatch) -> None:- """A boot-race click before the bridge wired the toggle must not light a+def test_no_callback_means_no_false_flip(monkeypatch) -> None:+ """A boot-race click before the bridge wired the toggle must not clear thesparkle with nothing behind it (mirrors the mute button's rule)."""bar = JarvisBarOverlay()+ bar.set_prompt_mode(True)_patch_pipeline(monkeypatch, _FakePipeline())bar._on_click(_sparkle_x(), hovered=True)- assert bar._prompt_mode is False+ assert bar._prompt_mode is Truedef test_set_prompt_mode_mirrors_the_authoritative_value() -> None:@@ -178,16 +218,18 @@ def _warmth(pixels) -> float:return sum(p[0] - p[2] for p in pixels) / max(1, len(pixels))-def test_the_sparkle_says_on_in_the_accent_and_off_in_grey() -> None:- """The switch's whole job is to be readable at a glance: lit in the accent- while every dictation becomes a prompt, grey while it does not."""+def test_the_sparkle_is_drawn_in_the_accent_and_only_when_the_mode_is_on() -> None:+ """The switch reports a state and offers the way out of it. With the mode+ off it is not dimmed — it is not there at all (maintainer, 2026-08-28),+ which is also why the hovered bar with the mode off must look exactly like+ it did before this feature existed."""changed = _differing(_settled(hovered=True), _settled(hovered=True, prompt_mode=True))- assert changed, "flipping the switch must change what the bar draws"+ assert changed, "switching the mode on must change what the bar draws"off_warmth = _warmth([p for p, _ in changed])on_warmth = _warmth([q for _, q in changed])assert on_warmth > 2 * off_warmth, (- f"the lit sparkle must read as the accent, not the standby grey "+ f"the sparkle must read as the accent against the bare pill "f"(warmth off={off_warmth:.0f}, on={on_warmth:.0f})")@@ -211,6 +253,32 @@ def test_prompt_mode_is_visible_on_the_resting_bar() -> None:assert _warmth(ink) < _warmth([(231, 196, 110)])+def test_no_part_of_the_sparkle_is_drawn_outside_the_pill() -> None:+ """The defect the maintainer photographed: the mark's tips crossed the rim+ and drew onto the colour key, so the bar wore a magenta fleck and a star+ that looked like a stray artefact instead of a control. Every pixel the+ switch adds must land inside the pill — with room to spare, because the 4x+ LANCZOS downscale rings a pixel or two past the shape it drew."""+ off = R.key_to_alpha(_settled())+ on = R.key_to_alpha(_settled(prompt_mode=True))+ ph = float(R.OPEN_H)+ cy = R.pill_center_y(ph)+ top, bottom = cy - ph / 2.0, cy + ph / 2.0+ left = R.WIN_W / 2.0 - R.OPEN_W / 2.0++ width = off.size[0]+ escaped = []+ for i, (before, after) in enumerate(+ zip(off.get_flattened_data(), on.get_flattened_data(), strict=True)+ ):+ if before == after:+ continue+ y, x = divmod(i, width)+ if not (top <= y <= bottom and x >= left):+ escaped.append((x, y, after))+ assert escaped == [], f"the sparkle drew outside the pill: {escaped[:5]}"++# --------------------------------------------------------------------------- ## The host protocol and the other surfaces# --------------------------------------------------------------------------- #