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): the sparkle PAUSES Prompt Mode instead of switching it off

rubenluetke10-beep7cdb0decdf46
diff --git a/docs/BUGS.md b/docs/BUGS.md
index 6ed91481a1..c282505adb 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -14342,13 +14342,23 @@ came back as a document passed everything.
**Also in this change (feature, maintainer request the same message).** The
Prompt Mode switch is now a control on the native Jarvis bar: a sparkle in the
-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
+resting pill's left slot, drawn ONLY while the SETTING is on. Three follow-up
+corrections the same evening, all from screenshots: 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; the dim OFF-state sparkle is gone, because the bar reports a state and
+offers the way out of it rather than advertising a feature nobody switched on;
+and the click PAUSES instead of switching the setting off. That last one was a
+real dead end: the first version wrote `prompt_mode = false`, the sparkle went
+with it, and there was then no way back to the mode from the bar at all. The
+pause is runtime-only state in `prompt_mode._paused`, read by
+`prompt_mode_enabled` so it reaches the dictation path, the REST dictation
+route and the polish probe alike; `prompt_mode_configured` answers the separate
+question a surface asks before drawing the switch. It clears on restart and on
+any write of the setting, so a switch just turned on is never held down by an
+old click. Paused draws the same accent star with a red slash — the muted mic's
+language, chosen after a red star under a red slash measured as one unreadable
+blob at this size. It 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 — the mute flag's shape, for the reason mute has
diff --git a/docs/os-parity.md b/docs/os-parity.md
index 85554118e0..98a2a89daa 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, 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` |
+| 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 SETTING is on (visible without a hover — the pill opens as it does for mute). A click PAUSES the rewriting rather than changing the setting: the mark goes red with a slash through it, jarvis.toml is untouched, and the same click brings it back. The pause is runtime-only and clears on restart or on any write of the setting. With the setting off nothing is drawn there and the spot starts a session as before. 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` |
## Maintenance
diff --git a/jarvis/core/events.py b/jarvis/core/events.py
index b20b699048..a4619ce46c 100644
--- a/jarvis/core/events.py
+++ b/jarvis/core/events.py
@@ -1006,14 +1006,18 @@ class VoiceMuteToggleRequested(Event):
@dataclass(frozen=True, slots=True)
-class DictationPromptModeToggleRequested(Event):
- """A surface asked for ``[dictation].prompt_mode`` to be flipped.
+class DictationPromptModePauseToggleRequested(Event):
+ """A surface asked to PAUSE or RESUME Prompt Mode — not to change it.
Publishers: the Jarvis bar's sparkle control, forwarded by
- ``ui/orb/bus_bridge.py``. Like ``VoiceMuteToggleRequested`` the caller does
- not know the current value: the speech pipeline owns the flip in
- ``_on_prompt_mode_toggle_requested`` (it holds the live dictation config)
- and answers with ``DictationPromptModeChanged``.
+ ``ui/orb/bus_bridge.py``. The pause is a runtime hold with no home on
+ disk: ``[dictation].prompt_mode`` stays exactly as the user set it and the
+ settings card keeps showing it on, while dictations are delivered
+ unrewritten until the same control is clicked again (maintainer,
+ 2026-08-28). Like ``VoiceMuteToggleRequested`` the caller does not know
+ the current value: the speech pipeline owns the flip in
+ ``_on_prompt_mode_pause_toggle_requested`` (it holds the live dictation
+ config) and answers with ``DictationPromptModeChanged``.
"""
source: str = ""
@@ -1027,8 +1031,15 @@ class DictationPromptModeChanged(Event):
surface asked — the settings screen, the bar's sparkle. Every mirror of
the switch (the bar, the front-page pill, the settings card) redraws from
this event, so no two of them can disagree about a value the user just set.
+
+ ``enabled`` is the SETTING on disk; ``paused`` is the runtime hold a
+ surface can put on it. Both travel together so no mirror has to ask a
+ second question to know what to draw: nothing at all when ``enabled`` is
+ false, the plain mark when it is true, the struck-through mark when it is
+ true and ``paused``.
"""
enabled: bool = False
+ paused: bool = False
source: str = ""
diff --git a/jarvis/dictation/prompt_mode.py b/jarvis/dictation/prompt_mode.py
index ae2856a4e5..9fc92ae463 100644
--- a/jarvis/dictation/prompt_mode.py
+++ b/jarvis/dictation/prompt_mode.py
@@ -505,11 +505,58 @@ def echoes_example(raw: str, prompt: str) -> bool:
return len(shared - _shingles(raw)) >= _ECHO_MIN_SHINGLES
-def prompt_mode_enabled(cfg: Any) -> bool:
- """``[dictation].prompt_mode`` — off on any config that has not heard of it."""
+# --- The switch, and the pause on top of it ---------------------------------
+#
+# Two levels, because the maintainer asked for two (2026-08-28):
+#
+# * ``[dictation].prompt_mode`` is the SETTING. It lives in jarvis.toml, the
+# settings card and the front-page pill own it, and turning it off means
+# the feature is not in use at all — the bar then shows nothing.
+# * the PAUSE is a runtime flag with no home on disk. The bar's sparkle
+# toggles it: "not for the next few dictations", with the setting left
+# exactly as it was, so one click brings it back. It resets on restart and
+# whenever the setting itself is written, because a switch the user just
+# turned on must not come back paused from a click they made yesterday.
+#
+# Process-wide module state, like the polish pass's breaker: the dictation
+# path, the REST routes and the bar all live in the desktop process, and a bool
+# assignment is atomic under CPython, so no lock earns its keep here.
+_paused: bool = False
+
+
+def prompt_mode_configured(cfg: Any) -> bool:
+ """The SETTING alone — ``[dictation].prompt_mode``, ignoring the pause.
+
+ What a surface asks when it wants to know whether to show the switch at
+ all. Off on any config that has not heard of the key.
+ """
return bool(getattr(cfg, "prompt_mode", False))
+def prompt_mode_paused() -> bool:
+ """Whether the switch is paused from the bar. Never persisted."""
+ return _paused
+
+
+def set_prompt_mode_paused(paused: bool) -> bool:
+ """Set the runtime pause; returns the value now in force."""
+ global _paused
+ _paused = bool(paused)
+ return _paused
+
+
+def prompt_mode_enabled(cfg: Any) -> bool:
+ """Whether THIS dictation is to be rewritten: the setting, minus the pause.
+
+ Every call site that asks "does Prompt Mode apply right now" asks this
+ one, so pausing from the bar reaches the live dictation path, the REST
+ dictation route and the polish probe without any of them knowing a pause
+ exists. A surface that wants to draw the switch asks
+ :func:`prompt_mode_configured` instead.
+ """
+ return prompt_mode_configured(cfg) and not _paused
+
+
def build_prompt_mode_prompt(protected_terms: Sequence[str] = ()) -> str:
"""The system prompt for one Prompt Mode call.
@@ -900,7 +947,10 @@ __all__ = [
"lost_literals",
"normalize_prompt_text",
"prompt_guard_reason",
+ "prompt_mode_configured",
"prompt_mode_enabled",
+ "prompt_mode_paused",
+ "set_prompt_mode_paused",
"strip_closing_sign_off",
"timeout_budget_s",
"transcript_literals",
diff --git a/jarvis/dictation/prompt_mode_switch.py b/jarvis/dictation/prompt_mode_switch.py
index 98056eee4c..7a09d4a13e 100644
--- a/jarvis/dictation/prompt_mode_switch.py
+++ b/jarvis/dictation/prompt_mode_switch.py
@@ -26,18 +26,57 @@ from typing import Any
log = logging.getLogger(__name__)
-async def announce_prompt_mode(enabled: bool, *, bus: Any, source: str) -> None:
- """Broadcast the switch's current value to every mirror. Never raises."""
+async def announce_prompt_mode(
+ enabled: bool, *, bus: Any, source: str, paused: bool = False
+) -> None:
+ """Broadcast the switch's current value to every mirror. Never raises.
+
+ Both levels travel together — ``enabled`` is the setting on disk and
+ ``paused`` the runtime hold the bar can put on it — so no mirror has to
+ ask a second question to know what to draw.
+ """
if bus is None:
return
from jarvis.core.events import DictationPromptModeChanged
try:
- await bus.publish(DictationPromptModeChanged(enabled=bool(enabled), source=source))
+ await bus.publish(
+ DictationPromptModeChanged(
+ enabled=bool(enabled), paused=bool(paused), source=source
+ )
+ )
except Exception: # noqa: BLE001 — a mirror update must never break the flip
log.exception("DictationPromptModeChanged publish failed")
+async def toggle_prompt_mode_pause(*, cfg: Any, bus: Any, source: str) -> bool:
+ """Pause or resume Prompt Mode from a surface. Returns the pause now held.
+
+ The bar's sparkle. Deliberately NOT a settings change: the maintainer's
+ ask (2026-08-28) is "off for now, and one click brings it back", so the
+ value in ``jarvis.toml`` is left exactly as it is and the settings card
+ keeps showing the switch as on. Nothing happens at all when the setting
+ is off — there is nothing to pause, and a surface that offered it anyway
+ would be offering a hold on a feature that is not running.
+ """
+ from jarvis.dictation.prompt_mode import (
+ prompt_mode_configured,
+ prompt_mode_paused,
+ set_prompt_mode_paused,
+ )
+
+ if not prompt_mode_configured(cfg):
+ return prompt_mode_paused()
+ paused = set_prompt_mode_paused(not prompt_mode_paused())
+ log.info(
+ "dictation prompt mode %s (source=%s)",
+ "PAUSED — the setting stays on" if paused else "resumed",
+ source or "unknown",
+ )
+ await announce_prompt_mode(True, bus=bus, source=source, paused=paused)
+ return paused
+
+
async def apply_prompt_mode(
enabled: bool,
*,
@@ -70,9 +109,14 @@ async def apply_prompt_mode(
dictation_cfg.prompt_mode = value
except Exception as exc: # noqa: BLE001 — a frozen model is not an error
log.debug("in-memory dictation.prompt_mode update skipped: %s", exc)
+ # Writing the setting clears any runtime hold: a switch the user just
+ # turned on must not come back paused from a click they made an hour ago.
+ from jarvis.dictation.prompt_mode import set_prompt_mode_paused
+
+ set_prompt_mode_paused(False)
log.info("dictation prompt mode %s (source=%s)", "ON" if value else "off", source or "unknown")
- await announce_prompt_mode(value, bus=bus, source=source)
+ await announce_prompt_mode(value, bus=bus, source=source, paused=False)
return True
-__all__ = ["announce_prompt_mode", "apply_prompt_mode"]
+__all__ = ["announce_prompt_mode", "apply_prompt_mode", "toggle_prompt_mode_pause"]
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index 167a45abd9..47c8f17de7 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -60,7 +60,7 @@ from jarvis.core.events import (
AudioOutFirst,
BrainTTFT,
DictationCompleted,
- DictationPromptModeToggleRequested,
+ DictationPromptModePauseToggleRequested,
DictationRefused,
DictationStarted,
DictationTranscribing,
@@ -3043,7 +3043,8 @@ class SpeechPipeline:
# holds the live dictation config, so it owns the flip and answers
# with DictationPromptModeChanged for every mirror of the switch.
self._bus.subscribe(
- DictationPromptModeToggleRequested, self._on_prompt_mode_toggle_requested
+ DictationPromptModePauseToggleRequested,
+ self._on_prompt_mode_pause_toggle_requested,
)
# Wave 0 (omni-latency): perceived time-to-first-audio (ack OR
# brain, whichever speaks first) feeds the per-turn latency tracker.
@@ -4368,23 +4369,20 @@ class SpeechPipeline:
except Exception: # noqa: BLE001
log.exception("VoiceMuteChanged publish failed")
- async def _on_prompt_mode_toggle_requested(
- self, event: DictationPromptModeToggleRequested
+ async def _on_prompt_mode_pause_toggle_requested(
+ self, event: DictationPromptModePauseToggleRequested
) -> None:
- """Flip ``[dictation].prompt_mode`` and broadcast the new value.
+ """Pause or resume Prompt Mode and broadcast the new state.
Idempotent like the mute toggle: the caller does not know the current
- state. The write goes through the one switch writer
- (:mod:`jarvis.dictation.prompt_mode_switch`) — the path the settings
- screen takes too — so disk, the live config and every surface agree.
+ state. Deliberately NOT a settings write — the value in jarvis.toml is
+ left alone, so the settings card keeps showing the switch on and one
+ more click on the bar brings the rewriting back.
"""
- from jarvis.dictation.prompt_mode import prompt_mode_enabled
- from jarvis.dictation.prompt_mode_switch import apply_prompt_mode
+ from jarvis.dictation.prompt_mode_switch import toggle_prompt_mode_pause
- cfg = getattr(self, "_dictation_cfg", None)
- await apply_prompt_mode(
- not prompt_mode_enabled(cfg),
- dictation_cfg=cfg,
+ await toggle_prompt_mode_pause(
+ cfg=getattr(self, "_dictation_cfg", None),
bus=self._bus,
source=event.source or "unknown",
)
diff --git a/jarvis/ui/jarvisbar/host.py b/jarvis/ui/jarvisbar/host.py
index 95cf146565..5ac0fd5da7 100644
--- a/jarvis/ui/jarvisbar/host.py
+++ b/jarvis/ui/jarvisbar/host.py
@@ -105,7 +105,12 @@ def dispatch(surface: Any, msg: dict[str, Any]) -> bool:
elif op == "set_muted":
_call(surface, "set_muted", bool(msg.get("muted", False)))
elif op == "set_prompt_mode":
- _call(surface, "set_prompt_mode", bool(msg.get("enabled", False)))
+ _call(
+ surface,
+ "set_prompt_mode",
+ bool(msg.get("enabled", False)),
+ bool(msg.get("paused", False)),
+ )
elif op == "set_size_scale":
_call(surface, "set_size_scale", float(msg.get("scale", 1.0)))
elif op == "set_follow_cursor":
diff --git a/jarvis/ui/jarvisbar/null_overlay.py b/jarvis/ui/jarvisbar/null_overlay.py
index d5cb2579ac..8b438fb6f8 100644
--- a/jarvis/ui/jarvisbar/null_overlay.py
+++ b/jarvis/ui/jarvisbar/null_overlay.py
@@ -30,7 +30,7 @@ class NullOverlay:
def start_mouth_animation(self, duration_ms: int = 60000) -> None: ...
def stop_mouth_animation(self) -> None: ...
def set_muted(self, muted: bool) -> None: ...
- def set_prompt_mode(self, enabled: bool) -> None: ...
+ def set_prompt_mode(self, enabled: bool, paused: bool = False) -> None: ...
def set_on_mute_toggle(self, callback: Callable[[], None] | None) -> None: ...
def set_on_prompt_mode_toggle(self, callback: Callable[[], None] | None) -> None: ...
def set_feedback_publisher(self, callback: Callable[[str, dict], None] | None) -> None: ...
diff --git a/jarvis/ui/jarvisbar/overlay.py b/jarvis/ui/jarvisbar/overlay.py
index 294246cc29..ad92a49191 100644
--- a/jarvis/ui/jarvisbar/overlay.py
+++ b/jarvis/ui/jarvisbar/overlay.py
@@ -517,6 +517,9 @@ class JarvisBarOverlay:
# Mirror of ``[dictation].prompt_mode`` (the bridge keeps it current
# from DictationPromptModeChanged): lights the idle pill's sparkle.
self._prompt_mode = False
+ # ...and whether the bar is holding it (the sparkle's red slash).
+ # A runtime hold only: the setting on disk is untouched.
+ self._prompt_mode_paused = False
# True only on a macOS root whose "-transparent" attribute took; the
# frame loop then converts frames to RGBA (renderer.key_to_alpha).
self._mac_transparent = False
@@ -623,14 +626,17 @@ class JarvisBarOverlay:
atomic bool write — the frame loop reads it; no Tk marshal needed."""
self._muted = bool(muted)
- def set_prompt_mode(self, enabled: bool) -> None:
- """Mirror ``[dictation].prompt_mode`` onto the bar's sparkle.
+ def set_prompt_mode(self, enabled: bool, paused: bool = False) -> None:
+ """Mirror ``[dictation].prompt_mode`` and its pause onto the sparkle.
Called by OrbBusBridge on every DictationPromptModeChanged (from this
- bar, the settings screen or the front-page pill), so the lit sparkle
- and the switch behind it never disagree. Plain atomic bool write —
- the frame loop reads it; no Tk marshal needed."""
+ bar, the settings screen or the front-page pill), so the sparkle and
+ the switch behind it never disagree. ``enabled`` is the setting —
+ false draws nothing at all; ``paused`` is this bar's runtime hold and
+ strikes the mark through in red. Plain atomic bool writes; the frame
+ loop reads them, no Tk marshal needed."""
self._prompt_mode = bool(enabled)
+ self._prompt_mode_paused = bool(paused)
def set_size_scale(self, scale: float) -> None:
"""Live-resize the bar to a new user "Bar size" multiplier.
@@ -1363,6 +1369,7 @@ class JarvisBarOverlay:
drop_visual,
silent,
getattr(self, "_prompt_mode", False),
+ getattr(self, "_prompt_mode_paused", False),
)
if tick_key != self._static_tick_key:
self._static_tick_key = tick_key
@@ -1388,6 +1395,7 @@ class JarvisBarOverlay:
hovered=self._hovered,
muted=self._muted,
prompt_mode=getattr(self, "_prompt_mode", False),
+ prompt_mode_paused=getattr(self, "_prompt_mode_paused", False),
drop_state=drop_visual,
# Same getattr guard as the level stamp above, and for the
# same reason: a ``__new__``-built test/hot-reload instance
@@ -1950,16 +1958,19 @@ class JarvisBarOverlay:
cb()
self._muted = not self._muted
elif action == "prompt_mode_toggle":
- # The idle pill's sparkle: ask the parent to flip
- # [dictation].prompt_mode (the pipeline owns the switch and
- # answers with DictationPromptModeChanged → set_prompt_mode).
- # Optimistic local flip for the next frame, only when a
- # callback is wired — a boot-race click must not light a
- # sparkle with nothing behind it.
+ # The idle pill's sparkle: ask the parent to PAUSE or resume
+ # Prompt Mode (the pipeline owns the hold and answers with
+ # DictationPromptModeChanged → set_prompt_mode). The setting
+ # itself is never touched here. Optimistic local flip for the
+ # next frame, only when a callback is wired — a boot-race
+ # click must not strike the mark through with nothing behind
+ # it.
cb = self._on_prompt_mode_toggle
if cb is not None:
cb()
- self._prompt_mode = not getattr(self, "_prompt_mode", False)
+ self._prompt_mode_paused = not getattr(
+ self, "_prompt_mode_paused", False
+ )
elif action == "hangup":
callback = self._on_hangup
if callback is not None:
diff --git a/jarvis/ui/jarvisbar/qt_overlay.py b/jarvis/ui/jarvisbar/qt_overlay.py
index ca4f15cd74..1a58fe6a81 100644
--- a/jarvis/ui/jarvisbar/qt_overlay.py
+++ b/jarvis/ui/jarvisbar/qt_overlay.py
@@ -441,7 +441,8 @@ class QtJarvisBarOverlay:
self._hovered = False
# Mirror of ``[dictation].prompt_mode``: lights the idle pill's sparkle.
self._prompt_mode = False
- self._static_tick_key: tuple[str, bool, bool, str, bool] | None = None
+ self._prompt_mode_paused = False
+ self._static_tick_key: tuple[str, bool, bool, str, bool, bool] | None = None
self._static_tick_count = 0
self._hangup_click_block_until = 0.0
@@ -555,8 +556,9 @@ class QtJarvisBarOverlay:
self._muted = bool(muted)
self._invalidate_static_frame()
- def set_prompt_mode(self, enabled: bool) -> None:
+ def set_prompt_mode(self, enabled: bool, paused: bool = False) -> None:
self._prompt_mode = bool(enabled)
+ self._prompt_mode_paused = bool(paused)
self._invalidate_static_frame()
def set_size_scale(self, scale: float) -> None:
@@ -769,6 +771,7 @@ class QtJarvisBarOverlay:
self._muted,
drop_visual,
self._prompt_mode,
+ self._prompt_mode_paused,
)
if tick_key != self._static_tick_key:
self._static_tick_key = tick_key
@@ -793,6 +796,7 @@ class QtJarvisBarOverlay:
hovered=self._hovered,
muted=self._muted,
prompt_mode=self._prompt_mode,
+ prompt_mode_paused=self._prompt_mode_paused,
drop_state=drop_visual,
drop_elapsed=now - self._drop_visual_t0,
)
@@ -1484,8 +1488,8 @@ class QtJarvisBarOverlay:
elif action == "prompt_mode_toggle":
callback = self._on_prompt_mode_toggle
if callback is not None:
- self._invoke_callback(callback, "prompt-mode-toggle")
- self._prompt_mode = not self._prompt_mode
+ self._invoke_callback(callback, "prompt-mode-pause")
+ self._prompt_mode_paused = not self._prompt_mode_paused
self._invalidate_static_frame()
elif action in {"talk", "hangup", "dictation_stop"}:
callback = self._on_voice_action
diff --git a/jarvis/ui/jarvisbar/renderer.py b/jarvis/ui/jarvisbar/renderer.py
index 5fe9590041..756800aa08 100644
--- a/jarvis/ui/jarvisbar/renderer.py
+++ b/jarvis/ui/jarvisbar/renderer.py
@@ -456,6 +456,9 @@ _DOTS_SPAN_FRAC = 0.62 # dots span / pill width (matches the bars)
# already does, and the parity is pinned by a test.
SPARKLE_CENTRE_FRAC = 0.33
SPARKLE_R_FRAC = 0.30
+#: Half-length of the paused state's slash, as a fraction of the pill height.
+#: Slightly longer than the star's radius so its ends clear the mark.
+SPARKLE_SLASH_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).
@@ -789,6 +792,7 @@ class JarvisBarRenderer:
drop_state: str = DROP_STATE_NONE,
drop_elapsed: float = 0.0,
prompt_mode: bool = False,
+ prompt_mode_paused: bool = False,
) -> Image.Image:
active = mode in ("listen", "speak")
# "That did not happen" — see NOTICE_MODES. Held separately from the
@@ -910,12 +914,13 @@ class JarvisBarRenderer:
if active_sess:
self._draw_close_x(d, x_left, cy, ph)
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)
+ # The Prompt Mode switch, and ONLY while the SETTING is on:
+ # the maintainer asked for it to be shown in that mode and in
+ # no other (2026-08-28). Struck through while paused, which is
+ # the state the same click puts it in — so the mark is never
+ # an advert for a feature that is not switched on, and always
+ # the way back to one that is merely on hold.
+ self._draw_sparkle(img, x_sparkle, cy, ph, paused=prompt_mode_paused)
self._draw_mic(img, x_right, cy, ph, muted)
elif mode == "think":
self._draw_thinking(d, t, cx, cy, pw, ph)
@@ -931,7 +936,7 @@ class JarvisBarRenderer:
if muted:
self._draw_mic(img, x_right, cy, ph, muted=True)
if prompt_mode:
- self._draw_sparkle(img, x_sparkle, cy, ph)
+ self._draw_sparkle(img, x_sparkle, cy, ph, paused=prompt_mode_paused)
# 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."
@@ -959,20 +964,31 @@ 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) -> None:
+ def _draw_sparkle(
+ self, img: Image.Image, cx: float, cy: float, ph: float, paused: bool = False
+ ) -> 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 — the
sparkle mark the app uses for the same switch on its front page, so
- 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.
+ the two surfaces read as one control. Drawn only while the SETTING is
+ on, so it never advertises a feature nobody switched on.
+
+ ``paused`` gives it the muted mic's language: the same glyph in the
+ muted red with a diagonal slash through it. That is deliberate reuse —
+ the user already knows that mark means "this is off right now, click
+ to bring it back", which is exactly what a paused switch is.
+ Supersampled like the mic, because thin star tips alias at ~30 px.
"""
ss = 4
layer = Image.new("RGBA", (img.width * ss, img.height * ss), (0, 0, 0, 0))
ld = ImageDraw.Draw(layer)
+ # The STAR keeps the accent in both states — struck through means the
+ # mark unchanged with a line over it, and it is also what keeps the
+ # paused control recognisable as the same control. Colouring the star
+ # red too was measured and rejected: at this size a red star under a
+ # red slash is one blob, and a gap cut through the star to separate
+ # them left a red hash nobody would read as a sparkle (2026-08-28).
color = (*self._accent, 255)
x, y, p = cx * ss, cy * ss, ph * ss
@@ -993,6 +1009,18 @@ class JarvisBarRenderer:
r = p * SPARKLE_R_FRAC
star(x - r * 0.15, y + r * 0.15, r)
star(x + r * 0.80, y - r * 0.72, r * 0.36)
+ if paused:
+ # The slash, in the muted mic's red and at the mic's angle. It
+ # reaches slightly past the star so it reads as a line ACROSS the
+ # mark, and a fill-coloured line laid down first leaves a thin gap
+ # so the stroke sits on top of the star instead of melting into
+ # it. Sized from the pill height, and short enough that neither
+ # the stroke nor the LANCZOS ringing reaches the rim.
+ s = p * SPARKLE_SLASH_FRAC
+ stroke = max(1, round(_STROKE_W * 0.85 * ss))
+ ends = [(x - s, y + s), (x + s, y - s)]
+ ld.line(ends, fill=(*PILL_BG, 255), width=round(stroke * 1.4))
+ ld.line(ends, fill=(*MUTED_RED, 255), width=stroke)
small = layer.resize(img.size, Image.Resampling.LANCZOS)
img.paste(small, (0, 0), small)
diff --git a/jarvis/ui/jarvisbar/subprocess_overlay.py b/jarvis/ui/jarvisbar/subprocess_overlay.py
index f50b7db8ce..b2a9ae3cf0 100644
--- a/jarvis/ui/jarvisbar/subprocess_overlay.py
+++ b/jarvis/ui/jarvisbar/subprocess_overlay.py
@@ -112,6 +112,7 @@ class SubprocessBarOverlay:
self._mode = "idle"
self._muted = False
self._prompt_mode = False
+ self._prompt_mode_paused = False
# Mirror what the real host does at construction time. A persistent,
# ungated bar maps itself immediately; a startup-gated or
# non-persistent bar starts withdrawn. This mirror is load-bearing for
@@ -291,9 +292,16 @@ class SubprocessBarOverlay:
self._muted = bool(muted)
self._send({"op": "set_muted", "muted": self._muted})
- def set_prompt_mode(self, enabled: bool) -> None:
+ def set_prompt_mode(self, enabled: bool, paused: bool = False) -> None:
self._prompt_mode = bool(enabled)
- self._send({"op": "set_prompt_mode", "enabled": self._prompt_mode})
+ self._prompt_mode_paused = bool(paused)
+ self._send(
+ {
+ "op": "set_prompt_mode",
+ "enabled": self._prompt_mode,
+ "paused": self._prompt_mode_paused,
+ }
+ )
def set_size_scale(self, scale: float) -> None:
"""Forward a live "Bar size" change to the hosted surface.
@@ -491,7 +499,13 @@ class SubprocessBarOverlay:
if self._muted:
self._send({"op": "set_muted", "muted": True})
if self._prompt_mode:
- self._send({"op": "set_prompt_mode", "enabled": True})
+ self._send(
+ {
+ "op": "set_prompt_mode",
+ "enabled": True,
+ "paused": self._prompt_mode_paused,
+ }
+ )
if self._last_level is not None:
self._send({"op": "set_level", "level": self._last_level})
diff --git a/jarvis/ui/web/dictation_routes.py b/jarvis/ui/web/dictation_routes.py
index 54bfdfa059..7bc69e5a0e 100644
--- a/jarvis/ui/web/dictation_routes.py
+++ b/jarvis/ui/web/dictation_routes.py
@@ -1295,14 +1295,19 @@ async def put_settings(body: SettingsBody, request: Request) -> dict[str, Any]:
# Prompt Mode has mirrors outside this screen — the sparkle on the native
# Jarvis bar, the pill on the front page — and they learn of a flip from
- # one event, the same one the bar's own toggle raises.
+ # one event, the same one the bar's own control raises. Writing the
+ # setting also clears the bar's runtime pause, so a switch the user just
+ # turned on is never held down by a click they made an hour ago.
if "prompt_mode" in updates:
+ from jarvis.dictation.prompt_mode import set_prompt_mode_paused
from jarvis.dictation.prompt_mode_switch import announce_prompt_mode
+ set_prompt_mode_paused(False)
await announce_prompt_mode(
bool(validated.prompt_mode),
bus=getattr(request.app.state, "bus", None),
source="settings",
+ paused=False,
)
return {
diff --git a/tests/unit/dictation/test_prompt_mode.py b/tests/unit/dictation/test_prompt_mode.py
index 23d650db4d..f30cdd2bb1 100644
--- a/tests/unit/dictation/test_prompt_mode.py
+++ b/tests/unit/dictation/test_prompt_mode.py
@@ -118,6 +118,8 @@ class FakeChain:
@pytest.fixture(autouse=True)
def _fresh_breaker() -> None:
polish.reset_polish_state()
+ # The pause is process-wide module state; never leak it between tests.
+ prompt_mode.set_prompt_mode_paused(False)
def _cfg(**overrides: Any) -> DictationConfig:
@@ -665,6 +667,49 @@ async def test_off_returns_the_raw_text_without_a_call(
assert chain.calls == []
+# --------------------------------------------------------------------------- #
+# The setting and the pause on top of it
+# --------------------------------------------------------------------------- #
+
+
+def test_the_setting_and_the_pause_are_separate_questions() -> None:
+ """Two levels, because the maintainer asked for two: the setting is the
+ feature, the pause is "not for the next few dictations". A surface that
+ draws the switch asks the first; the dictation path asks the second."""
+ cfg = _cfg()
+ assert prompt_mode.prompt_mode_configured(cfg) is True
+ assert prompt_mode.prompt_mode_enabled(cfg) is True
+
+ prompt_mode.set_prompt_mode_paused(True)
+ assert prompt_mode.prompt_mode_configured(cfg) is True, "the SETTING is untouched"
+ assert prompt_mode.prompt_mode_enabled(cfg) is False, "this dictation is not rewritten"
+ assert prompt_mode.prompt_mode_paused() is True
+
+ prompt_mode.set_prompt_mode_paused(False)
+ assert prompt_mode.prompt_mode_enabled(cfg) is True
+
+
+def test_a_pause_on_a_switch_that_is_off_changes_nothing() -> None:
+ off = DictationConfig()
+ prompt_mode.set_prompt_mode_paused(True)
+ assert prompt_mode.prompt_mode_configured(off) is False
+ assert prompt_mode.prompt_mode_enabled(off) is False
+
+
+async def test_a_paused_switch_delivers_the_transcript_untouched(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """The pause has to reach the dictation path itself, not just the picture
+ on the bar — that is the whole point of routing it through
+ ``prompt_mode_enabled``."""
+ chain = _install(monkeypatch, FakeChain())
+ prompt_mode.set_prompt_mode_paused(True)
+ out = await compose_prompt(RAW, cfg=_cfg())
+ assert (out.status, out.text) == ("off", RAW)
+ assert chain.calls == []
+
+
async def test_empty_input_is_skipped(monkeypatch: pytest.MonkeyPatch) -> None:
_install(monkeypatch, FakeChain())
out = await compose_prompt(" ", cfg=_cfg())
diff --git a/tests/unit/dictation/test_prompt_mode_switch.py b/tests/unit/dictation/test_prompt_mode_switch.py
index a372ed890d..d8fc43fadf 100644
--- a/tests/unit/dictation/test_prompt_mode_switch.py
+++ b/tests/unit/dictation/test_prompt_mode_switch.py
@@ -19,7 +19,12 @@ import pytest
from jarvis.core import config_writer
from jarvis.core.events import DictationPromptModeChanged
-from jarvis.dictation.prompt_mode_switch import announce_prompt_mode, apply_prompt_mode
+from jarvis.dictation import prompt_mode
+from jarvis.dictation.prompt_mode_switch import (
+ announce_prompt_mode,
+ apply_prompt_mode,
+ toggle_prompt_mode_pause,
+)
class _Bus:
@@ -34,6 +39,14 @@ class _Cfg:
prompt_mode = False
[email protected](autouse=True)
+def _no_pause() -> Any:
+ """Process-wide module state; never leak it between tests."""
+ prompt_mode.set_prompt_mode_paused(False)
+ yield
+ prompt_mode.set_prompt_mode_paused(False)
+
+
@pytest.mark.asyncio
async def test_a_flip_lands_on_disk_live_and_on_the_bus(monkeypatch: pytest.MonkeyPatch) -> None:
written: list[tuple[str, Any]] = []
@@ -95,3 +108,53 @@ async def test_a_broken_bus_never_breaks_the_flip(monkeypatch: pytest.MonkeyPatc
cfg = _Cfg()
assert await apply_prompt_mode(False, dictation_cfg=cfg, bus=_DeadBus(), source="t")
assert cfg.prompt_mode is False
+
+
+# --------------------------------------------------------------------------- #
+# The pause: the bar's hold, which is NOT a settings change
+# --------------------------------------------------------------------------- #
+
+
+async def test_the_pause_never_touches_the_setting(monkeypatch: pytest.MonkeyPatch) -> None:
+ """The maintainer's report in one test: the bar must hold the feature, not
+ switch it off, or there is no way back to it from the bar."""
+
+ def _never(key: str, value: Any) -> None:
+ raise AssertionError("a pause must not write jarvis.toml")
+
+ monkeypatch.setattr(config_writer, "set_dictation_setting", _never)
+ bus, cfg = _Bus(), _Cfg()
+ cfg.prompt_mode = True
+
+ assert await toggle_prompt_mode_pause(cfg=cfg, bus=bus, source="jarvis_bar") is True
+ assert cfg.prompt_mode is True, "the setting survives the pause"
+ assert prompt_mode.prompt_mode_paused() is True
+ assert (bus.published[0].enabled, bus.published[0].paused) == (True, True)
+
+ assert await toggle_prompt_mode_pause(cfg=cfg, bus=bus, source="jarvis_bar") is False
+ assert prompt_mode.prompt_mode_paused() is False
+ assert (bus.published[1].enabled, bus.published[1].paused) == (True, False)
+
+
+async def test_there_is_nothing_to_pause_when_the_setting_is_off() -> None:
+ """No hold on a feature that is not running — and the bar draws no control
+ there either, so this is belt and braces."""
+ bus, cfg = _Bus(), _Cfg() # prompt_mode stays False
+ assert await toggle_prompt_mode_pause(cfg=cfg, bus=bus, source="jarvis_bar") is False
+ assert prompt_mode.prompt_mode_paused() is False
+ assert bus.published == []
+
+
+async def test_writing_the_setting_clears_the_pause(monkeypatch: pytest.MonkeyPatch) -> None:
+ """A switch the user just turned on must not come back held down by a
+ click they made an hour ago."""
+ monkeypatch.setattr(config_writer, "set_dictation_setting", lambda key, value: None)
+ prompt_mode.set_prompt_mode_paused(True)
+ bus, cfg = _Bus(), _Cfg()
+
+ assert await apply_prompt_mode(True, dictation_cfg=cfg, bus=bus, source="settings")
+ assert prompt_mode.prompt_mode_paused() is False
+ assert bus.published[0].paused is False
diff --git a/tests/unit/ui/jarvisbar/test_host_protocol.py b/tests/unit/ui/jarvisbar/test_host_protocol.py
index a9a8f68c21..22457b7045 100644
--- a/tests/unit/ui/jarvisbar/test_host_protocol.py
+++ b/tests/unit/ui/jarvisbar/test_host_protocol.py
@@ -45,8 +45,8 @@ class _RecordingBar:
def set_muted(self, muted: bool) -> None:
self.calls.append(("set_muted", muted))
- def set_prompt_mode(self, enabled: bool) -> None:
- self.calls.append(("set_prompt_mode", enabled))
+ def set_prompt_mode(self, enabled: bool, paused: bool = False) -> None:
+ self.calls.append(("set_prompt_mode", enabled, paused))
def set_size_scale(self, scale: float) -> None:
self.calls.append(("set_size_scale", scale))
@@ -114,7 +114,7 @@ def test_dispatch_maps_every_op_onto_the_surface() -> None:
{"op": "hide"},
{"op": "set_level", "level": 0.5},
{"op": "set_muted", "muted": True},
- {"op": "set_prompt_mode", "enabled": True},
+ {"op": "set_prompt_mode", "enabled": True, "paused": True},
{"op": "set_size_scale", "scale": 1.4},
{"op": "set_persistent", "enabled": False},
{"op": "release_startup_gate"},
@@ -133,7 +133,7 @@ def test_dispatch_maps_every_op_onto_the_surface() -> None:
assert ("show", "listen") in bar.calls
assert ("set_level", 0.5) in bar.calls
assert ("set_muted", True) in bar.calls
- assert ("set_prompt_mode", True) in bar.calls
+ assert ("set_prompt_mode", True, True) in bar.calls
assert ("set_size_scale", 1.4) in bar.calls
assert ("play_animation", "wave", {"x": 1}) in bar.calls
assert ("show_listening_transcript", "hi", 9) in bar.calls
diff --git a/tests/unit/ui/jarvisbar/test_prompt_mode_bridge.py b/tests/unit/ui/jarvisbar/test_prompt_mode_bridge.py
index a00383da47..55459f4a06 100644
--- a/tests/unit/ui/jarvisbar/test_prompt_mode_bridge.py
+++ b/tests/unit/ui/jarvisbar/test_prompt_mode_bridge.py
@@ -1,12 +1,12 @@
"""OrbBusBridge wires the bar's Prompt Mode sparkle to the bus, both ways.
-Down: ``DictationPromptModeChanged`` → ``surface.set_prompt_mode`` (a surface
-without the method, the mascot orb, is skipped). Up: the sparkle click →
-``DictationPromptModeToggleRequested(source="jarvis_bar")`` through the same
-Tk→asyncio marshal the mute toggle uses. Seed: on attach and again on the
-voice-ready signal the bridge reads where the user left the switch from the
-pipeline's live dictation config, so the sparkle is right from the first frame
-the pipeline exists — mute starts false, Prompt Mode starts wherever it was.
+Down: ``DictationPromptModeChanged`` → ``surface.set_prompt_mode(enabled,
+paused)`` (a surface without the method, the mascot orb, is skipped). Up: the
+sparkle click → ``DictationPromptModePauseToggleRequested(source="jarvis_bar")``
+through the same Tk→asyncio marshal the mute toggle uses. Seed: on attach and
+again on the voice-ready signal the bridge reads BOTH levels — the setting
+from the pipeline's live dictation config, the pause from the module that
+holds it — so the sparkle is right from the first frame the pipeline exists.
"""
from __future__ import annotations
@@ -16,17 +16,29 @@ from typing import Any
import pytest
-from jarvis.core.events import DictationPromptModeChanged, DictationPromptModeToggleRequested
+from jarvis.core.events import (
+ DictationPromptModeChanged,
+ DictationPromptModePauseToggleRequested,
+)
+from jarvis.dictation import prompt_mode
from ui.orb.bus_bridge import OrbBusBridge
[email protected](autouse=True)
+def _no_pause() -> Any:
+ """The pause is process-wide module state; never leak it between tests."""
+ prompt_mode.set_prompt_mode_paused(False)
+ yield
+ prompt_mode.set_prompt_mode_paused(False)
+
+
class _Surface:
def __init__(self) -> None:
- self.prompt_mode: list[bool] = []
+ self.calls: list[tuple[bool, bool]] = []
self.toggle_cb: Any = None
- def set_prompt_mode(self, enabled: bool) -> None:
- self.prompt_mode.append(enabled)
+ def set_prompt_mode(self, enabled: bool, paused: bool = False) -> None:
+ self.calls.append((enabled, paused))
def set_on_prompt_mode_toggle(self, cb: Any) -> None:
self.toggle_cb = cb
@@ -41,12 +53,14 @@ class _Bus:
@pytest.mark.asyncio
-async def test_changed_event_reaches_the_surface() -> None:
+async def test_both_levels_reach_the_surface() -> None:
surface = _Surface()
bridge = OrbBusBridge(bus=SimpleNamespace(), orb=surface)
- await bridge._on_prompt_mode_changed(DictationPromptModeChanged(enabled=True, source="x"))
- await bridge._on_prompt_mode_changed(DictationPromptModeChanged(enabled=False, source="x"))
- assert surface.prompt_mode == [True, False]
+ for enabled, paused in ((True, False), (True, True), (False, False)):
+ await bridge._on_prompt_mode_changed(
+ DictationPromptModeChanged(enabled=enabled, paused=paused, source="x")
+ )
+ assert surface.calls == [(True, False), (True, True), (False, False)]
@pytest.mark.asyncio
@@ -55,24 +69,29 @@ async def test_a_surface_without_the_method_is_skipped() -> None:
await bridge._on_prompt_mode_changed(DictationPromptModeChanged(enabled=True))
-def test_the_sparkle_click_asks_the_bus_to_flip() -> None:
+def test_the_sparkle_click_asks_for_a_pause_not_a_settings_change() -> None:
bus = _Bus()
bridge = OrbBusBridge(bus=bus, orb=_Surface())
# No backend loop captured: the marshal falls back to a one-shot run.
bridge._publish_prompt_mode_toggle()
assert len(bus.published) == 1
event = bus.published[0]
- assert isinstance(event, DictationPromptModeToggleRequested)
+ assert isinstance(event, DictationPromptModePauseToggleRequested)
assert event.source == "jarvis_bar"
-def test_seed_reads_the_switch_from_the_live_pipeline(monkeypatch: pytest.MonkeyPatch) -> None:
+def test_seed_reads_the_setting_and_the_pause(monkeypatch: pytest.MonkeyPatch) -> None:
surface = _Surface()
bridge = OrbBusBridge(bus=SimpleNamespace(), orb=surface)
pipeline = SimpleNamespace(_dictation_cfg=SimpleNamespace(prompt_mode=True))
monkeypatch.setattr("jarvis.core.runtime_refs.get_speech_pipeline", lambda: pipeline)
+
+ bridge._seed_prompt_mode()
+ assert surface.calls == [(True, False)]
+
+ prompt_mode.set_prompt_mode_paused(True)
bridge._seed_prompt_mode()
- assert surface.prompt_mode == [True]
+ assert surface.calls[-1] == (True, True)
def test_seed_without_a_pipeline_leaves_the_surface_alone(
@@ -82,4 +101,4 @@ def test_seed_without_a_pipeline_leaves_the_surface_alone(
bridge = OrbBusBridge(bus=SimpleNamespace(), orb=surface)
monkeypatch.setattr("jarvis.core.runtime_refs.get_speech_pipeline", lambda: None)
bridge._seed_prompt_mode()
- assert surface.prompt_mode == []
+ assert surface.calls == []
diff --git a/tests/unit/ui/jarvisbar/test_prompt_mode_button.py b/tests/unit/ui/jarvisbar/test_prompt_mode_button.py
index a931387bd2..16fb7de7b6 100644
--- a/tests/unit/ui/jarvisbar/test_prompt_mode_button.py
+++ b/tests/unit/ui/jarvisbar/test_prompt_mode_button.py
@@ -1,14 +1,18 @@
-"""The jarvis-bar's idle LEFT control is the Prompt Mode switch.
-
-Maintainer request 2026-08-28: "when Prompt Mode is on, the bar should offer
-a way to switch it off when I hover over it." The sparkle takes the close-X's
-slot on the resting pill — lit in the accent while every dictation becomes a
-prompt, visible at a glance without a hover (the pill opens like it does for
-mute), dim while off and only drawn while the controls are up. A click on it
-fires the wired ``_on_prompt_mode_toggle`` (the OrbBusBridge points it at
-``DictationPromptModeToggleRequested``) and optimistically flips the local
-mirror; the authoritative ``DictationPromptModeChanged`` is reconciled via
-``set_prompt_mode``, exactly like the mute button.
+"""The jarvis-bar's idle LEFT control: pause Prompt Mode, and bring it back.
+
+Two levels, because the maintainer asked for two (2026-08-28). The SETTING
+lives in jarvis.toml and belongs to the settings card and the front-page
+pill; with it off the bar draws nothing at all. The PAUSE is the bar's own,
+runtime-only: the sparkle is there while the setting is on, a click holds the
+rewriting only until the same button is pressed again, and the mark takes a
+red slash — the muted mic's language — so that second click is obvious. The
+setting is never written from here, which is the whole point: the first
+version turned it off for good, and then there was no way back.
+
+A click fires the wired ``_on_prompt_mode_toggle`` (the OrbBusBridge points
+it at ``DictationPromptModePauseToggleRequested``) and optimistically flips
+the local mirror; the authoritative ``DictationPromptModeChanged`` carries
+both levels and is reconciled via ``set_prompt_mode``, exactly like mute.
Every surface carries the same two methods (the Tk bar, the Qt bar, the IPC
proxy, the null surface) and the host protocol carries the op and the event —
@@ -17,6 +21,8 @@ pinned here so no renderer can silently lack the control.
from __future__ import annotations
+import pytest
+
from jarvis.ui.jarvisbar import host, interaction
from jarvis.ui.jarvisbar import renderer as R
from jarvis.ui.jarvisbar.null_overlay import NullOverlay
@@ -133,9 +139,12 @@ def test_a_live_bar_keeps_the_close_x_untouched() -> None:
# --------------------------------------------------------------------------- #
-def test_sparkle_click_fires_toggle_and_optimistically_clears(monkeypatch) -> None:
+def test_the_click_pauses_and_a_second_click_brings_it_back(monkeypatch) -> None:
+ """The headline. The first version switched the setting off, the sparkle
+ vanished with it, and the mode could not be brought back from the bar at
+ all — which is exactly what the maintainer reported."""
bar = JarvisBarOverlay()
- bar.set_prompt_mode(True) # the only state in which the sparkle exists
+ bar.set_prompt_mode(True) # the setting; the sparkle exists only then
fired: list[int] = []
bar.set_on_prompt_mode_toggle(lambda: fired.append(1))
fake = _FakePipeline()
@@ -143,31 +152,34 @@ def test_sparkle_click_fires_toggle_and_optimistically_clears(monkeypatch) -> No
bar._on_click(_sparkle_x(), hovered=True)
assert fired == [1]
- assert bar._prompt_mode is False # optimistic flip → the sparkle goes
- assert fake.session_calls == 0 # the switch is not a session start
+ assert bar._prompt_mode_paused is True # struck through on the next frame
+ assert bar._prompt_mode is True, "the SETTING must survive a pause"
+ assert fake.session_calls == 0 # the control 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]
- assert fake.session_calls == 1
+ assert fired == [1, 1]
+ assert bar._prompt_mode_paused is False # ...and back, in one click
+ assert bar._prompt_mode is True
-def test_no_callback_means_no_false_flip(monkeypatch) -> None:
- """A boot-race click before the bridge wired the toggle must not clear the
- sparkle with nothing behind it (mirrors the mute button's rule)."""
+def test_no_callback_means_no_false_pause(monkeypatch) -> None:
+ """A boot-race click before the bridge wired the toggle must not strike the
+ sparkle through 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 True
+ assert bar._prompt_mode_paused is False
-def test_set_prompt_mode_mirrors_the_authoritative_value() -> None:
+def test_set_prompt_mode_mirrors_both_levels() -> None:
bar = JarvisBarOverlay()
bar.set_prompt_mode(True)
- assert bar._prompt_mode is True
+ assert (bar._prompt_mode, bar._prompt_mode_paused) == (True, False)
+ bar.set_prompt_mode(True, True)
+ assert (bar._prompt_mode, bar._prompt_mode_paused) == (True, True)
bar.set_prompt_mode(0)
- assert bar._prompt_mode is False
+ assert (bar._prompt_mode, bar._prompt_mode_paused) == (False, False)
# --------------------------------------------------------------------------- #
@@ -253,14 +265,43 @@ 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:
+def test_the_paused_sparkle_is_red_and_struck_through() -> None:
+ """The maintainer asked for the muted mic's language, and for the reason
+ it works: he already knows that mark means "off right now, click to bring
+ it back". So the paused state is the same glyph in MUTED_RED with a slash
+ across it, not a second icon to learn."""
+ on = _settled(prompt_mode=True)
+ paused = _settled(prompt_mode=True, prompt_mode_paused=True)
+ changed = _differing(on, paused)
+ assert changed, "pausing must change what the bar draws"
+
+ # Warm gold → red: the red channel holds, the green drops away.
+ def greenness(pixels) -> float:
+ return sum(p[1] for p in pixels) / max(1, len(pixels))
+
+ assert greenness([q for _, q in changed]) < greenness([p for p, _ in changed])
+
+ # The slash adds ink rather than removing it.
+ def ink(img) -> int:
+ arr = R.key_to_alpha(img)
+ return sum(
+ 1
+ for r, g, b, a in arr.get_flattened_data()
+ if a and (r, g, b) not in (R.PILL_BG, R.PILL_BORDER)
+ )
+
+ assert ink(paused) > ink(on)
+
+
[email protected]("paused", [False, True])
+def test_no_part_of_the_sparkle_is_drawn_outside_the_pill(paused: bool) -> 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))
+ on = R.key_to_alpha(_settled(prompt_mode=True, prompt_mode_paused=paused))
ph = float(R.OPEN_H)
cy = R.pill_center_y(ph)
top, bottom = cy - ph / 2.0, cy + ph / 2.0
@@ -288,14 +329,15 @@ class _RecordingSurface:
def __init__(self) -> None:
self.calls: list[tuple] = []
- def set_prompt_mode(self, enabled: bool) -> None:
- self.calls.append(("set_prompt_mode", enabled))
+ def set_prompt_mode(self, enabled: bool, paused: bool = False) -> None:
+ self.calls.append(("set_prompt_mode", enabled, paused))
def test_host_dispatches_the_set_prompt_mode_op() -> None:
surface = _RecordingSurface()
- assert host.dispatch(surface, {"op": "set_prompt_mode", "enabled": True}) is True
- assert ("set_prompt_mode", True) in surface.calls
+ msg = {"op": "set_prompt_mode", "enabled": True, "paused": True}
+ assert host.dispatch(surface, msg) is True
+ assert ("set_prompt_mode", True, True) in surface.calls
def test_the_null_surface_accepts_both_methods() -> None:
diff --git a/ui/orb/bus_bridge.py b/ui/orb/bus_bridge.py
index bb9cb30359..f0cb077625 100644
--- a/ui/orb/bus_bridge.py
+++ b/ui/orb/bus_bridge.py
@@ -39,7 +39,7 @@ from jarvis.core.events import (
AudioOutFirst,
DictationCompleted,
DictationPromptModeChanged,
- DictationPromptModeToggleRequested,
+ DictationPromptModePauseToggleRequested,
DictationRefused,
DictationStarted,
DictationTranscribing,
@@ -496,14 +496,15 @@ class OrbBusBridge:
log.debug("surface set_muted failed", exc_info=True)
async def _on_prompt_mode_changed(self, event: DictationPromptModeChanged) -> None:
- """Forward the authoritative Prompt Mode value to the current surface
- so its sparkle mirrors reality. Defensive getattr: a surface without
+ """Forward the authoritative Prompt Mode state to the current surface
+ so its sparkle mirrors reality — both levels, the setting and the
+ runtime pause. Defensive getattr: a surface without
``set_prompt_mode`` (the mascot orb) is simply skipped."""
setter = getattr(self._orb, "set_prompt_mode", None)
if not callable(setter):
return
try:
- setter(bool(event.enabled))
+ setter(bool(event.enabled), bool(event.paused))
except Exception: # noqa: BLE001 — a mirror update must never break the bus
log.debug("surface set_prompt_mode failed", exc_info=True)
@@ -520,12 +521,16 @@ class OrbBusBridge:
return
try:
from jarvis.core.runtime_refs import get_speech_pipeline
- from jarvis.dictation.prompt_mode import prompt_mode_enabled
+ from jarvis.dictation.prompt_mode import (
+ prompt_mode_configured,
+ prompt_mode_paused,
+ )
pipeline = get_speech_pipeline()
if pipeline is None:
return
- setter(prompt_mode_enabled(getattr(pipeline, "_dictation_cfg", None)))
+ cfg = getattr(pipeline, "_dictation_cfg", None)
+ setter(prompt_mode_configured(cfg), prompt_mode_paused())
except Exception: # noqa: BLE001 — a seed must never break the bridge
log.debug("prompt mode seed onto the surface failed", exc_info=True)
@@ -533,8 +538,10 @@ class OrbBusBridge:
"""Called from the surface's UI thread when the sparkle is clicked.
Same marshal as ``_publish_mute_toggle``; the pipeline flips the value
and answers with ``DictationPromptModeChanged``."""
- coro = self._bus.publish(DictationPromptModeToggleRequested(source="jarvis_bar"))
- self._marshal_publish(coro, label="prompt-mode-toggle")
+ coro = self._bus.publish(
+ DictationPromptModePauseToggleRequested(source="jarvis_bar")
+ )
+ self._marshal_publish(coro, label="prompt-mode-pause")
def _publish_visible_feedback(self, mode: str, observed: dict) -> None:
"""Called from the orb's Tk thread after a deiconify. Builds and