Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(dictation): Prompt Mode knows when NOT to write, and the bar can switch it off
rubenluetke10-beep57d4fb164938
diff --git a/docs/BUGS.md b/docs/BUGS.mdindex de95e345c2..c133713e29 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -14300,3 +14300,54 @@ id reports `False` on Windows).died while the thread runs; this is the case where the thread itself waits).The `disable_windows_app_ghosting` note in `process_utils` describes the otherface of a non-pumping Tk thread (the black box around the pill).++## BUG-203: Prompt Mode wrote a full prompt for a one-word answer — "shall I finish this?" / "yes" came back as a role, sections and format rules nobody asked for (MEDIUM, FIXED 2026-08-28)++**Symptom.** Two complaints on the v6 output, the same afternoon it shipped.+First, size: Prompt Mode is on for every dictation, and a dictation is often+not a brief. The model asks "soll ich das jetzt wirklich fertig machen?", the <!-- i18n-allow -->+user says "ja" — and what lands in the field is a written-out prompt. The+maintainer's words: "bei so kurzen Antworten, wo eigentlich kein Prompt <!-- i18n-allow -->+formuliert werden müsste, wird trotzdem so ein riesen ausführlicher Block <!-- i18n-allow -->+geschrieben." <!-- i18n-allow -->+Second, invention: a real brief (the local-models check) came back correct in+substance but carrying a **Formatierungs- & Strukturvorgaben** section+demanding markdown output and a table with named columns, plus an+**Input-Variablen / Platzhalter** section of `{frontend_config}`-style+variables — none of it spoken. In his words, a JSON-ish form where he had+asked for work. <!-- i18n-allow -->++**Root cause.** v6 decided how to write and never whether to write. The+instruction sized the message to its brief, but every transcript reached the+writer, and the one long worked example carried format rules and a+placeholder section that a fast model reproduced as part of "what a prompt+looks like". Nothing in the guards measured growth: `dropped_context` catches+a message that is too SHORT for its transcript; a two-word transcript that+came back as a document passed everything.++**Fix (v7), in `jarvis/dictation/prompt_mode.py`.**++1. `is_short_reply` — a transcript of eight words or fewer never reaches the+ writer at all. "Ja.", "Nein, lass das.", "okay, go ahead", "fix the typo on+ the login page" are complete as spoken; the ordinary polish pass punctuates+ them. Deterministic, costs no model call, and it hands the fast chain's+ per-minute budget back to the dictations that need it.+2. The instruction names the case out loud (WHEN IT IS AN ANSWER: the message+ is the answer itself, tidied, never a role or a task list for a "yes") and+ forbids what the user did not say — no format rules, no placeholder+ variables, no report template.+3. `inflated` — a transcript under the measured length (30 words) whose+ message grew past four times its size, floor 60 words, is rejected and the+ dictation falls through to the ordinary passes.++**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, lit while the switch is on and visible without a+hover, clickable while the controls are up. 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+it: three surfaces that can each flip a value must never each own it. See+`docs/os-parity.md` P-40.++**Related.** BUG-201 (the v6 defect: the example became the job).diff --git a/docs/os-parity.md b/docs/os-parity.mdindex e6286faefc..4c4ba534f1 100644--- a/docs/os-parity.md+++ b/docs/os-parity.md@@ -290,6 +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` |## Maintenancediff --git a/jarvis/core/events.py b/jarvis/core/events.pyindex 6448e859dc..b20b699048 100644--- a/jarvis/core/events.py+++ b/jarvis/core/events.py@@ -1005,6 +1005,33 @@ class VoiceMuteToggleRequested(Event):source: str = ""+@dataclass(frozen=True, slots=True)+class DictationPromptModeToggleRequested(Event):+ """A surface asked for ``[dictation].prompt_mode`` to be flipped.++ 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``.+ """+ source: str = ""+++@dataclass(frozen=True, slots=True)+class DictationPromptModeChanged(Event):+ """Authoritative broadcast that ``[dictation].prompt_mode`` changed.++ Emitted AFTER the value is on disk and in the live config, by the one+ switch writer (``jarvis/dictation/prompt_mode_switch.py``) whichever+ 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: bool = False+ source: str = ""++# Show / raise the main desktop window (user-facing gesture, e.g. an overlay# right-click).diff --git a/jarvis/dictation/prompt_mode.py b/jarvis/dictation/prompt_mode.pyindex 58eec25775..ae2856a4e5 100644--- a/jarvis/dictation/prompt_mode.py+++ b/jarvis/dictation/prompt_mode.py@@ -122,7 +122,16 @@ log = logging.getLogger(__name__)#: "write a prompt"), that a message is as large as its brief, and shows#: three runs on subjects that have nothing to do with prompt writing. Two#: guards back it in code: ``meta_prompt`` and ``echoed_example``.-PROMPT_MODE_PROMPT_VERSION: Final[int] = 6+#:+#: v7 decides when NOT to write. Prompt Mode is on for every dictation, and+#: the maintainer's next complaint (2026-08-28, same afternoon) was a "yes"+#: to a question the model had asked coming back as a document, and a real+#: brief coming back with format rules and placeholder variables he never+#: spoke. So: a transcript of eight words or fewer never reaches the writer+#: (``is_short_reply``); the instruction names the answer case and forbids+#: invented format rules, placeholders and templates; and ``inflated``+#: rejects a short transcript that grew more than fourfold.+PROMPT_MODE_PROMPT_VERSION: Final[int] = 7#: The status a successful Prompt Mode delivery reports on the history row.#: Lives in ``POLISH_STATUSES`` (the shared vocabulary) — restated here as a@@ -200,8 +209,11 @@ they said goes in exactly as spoken, one they did not say does not exist, and \a gap they left is left open rather than guessed at or filled with a \placeholder. "Das", "es", "the thing from before": the user is in a \conversation the model can see, so the reference stays a reference and is \-never replaced by an invented noun. Drop the filler sounds, the false starts \-and the self-corrections; keep the corrected version.+never replaced by an invented noun. No format rules the user did not state \+(no "answer as markdown", no table with columns they never named), no \+placeholder variables, no report template: they asked for work, not for a \+form. Drop the filler sounds, the false starts and the self-corrections; keep \+the corrected version.HOW MUCH. The message is as large as its brief. A long dictation with several \tasks, constraints and a wanted outcome becomes a structured prompt - a role \@@ -212,6 +224,13 @@ becomes one or two clear sentences and nothing more: no role, no sections, no \criteria the user did not state. Be concrete rather than adjectival: "a \markdown table with the columns X, Y, Z", never "make it good".+WHEN IT IS AN ANSWER. The model often asks the user something ("shall I \+finish this now?", "which of the two?") and the user dictates the reply: \+"yes", "no, leave it", "okay, go ahead, but skip the tests". That is not a \+brief and gets no prompt: the message is the answer itself, tidied, in one \+or two sentences, with every condition the user attached and nothing added. \+Never a role, never a heading, never a task list for a "yes".+WRITE IT IN THE LANGUAGE THE USER SPOKE. These instructions are in English \and that says nothing about your answer: a German transcript gets a German \message, a Spanish one a Spanish message, and that includes the headings and \@@ -357,6 +376,51 @@ _MIN_MEASURED_WORDS: Final[int] = 30_WORD_RE: Final[re.Pattern[str]] = re.compile(r"[^\W\d_]+", re.UNICODE)+# --- Size guards -------------------------------------------------------------+#+# Prompt Mode is on for every dictation, and not every dictation is a brief.+# The model asks "shall I finish this now?" and the user says "yes"; a+# capable user says "okay, go ahead, but skip the tests". Neither needs a+# prompt, and the maintainer's complaint (2026-08-28) was exactly that they+# got one anyway: a role, sections, a task list, for a "yes". Two answers to+# that, one before the call and one after.++#: A transcript of this many words or fewer never reaches the writer at all.+#: "Ja.", "Nein, lass das.", "Okay, mach weiter.", "fix the typo on the login+#: page" — every one of these is complete as spoken, the ordinary polish pass+#: delivers it with its punctuation, and a prompt written for it could only+#: add what the user did not say. Deterministic, costs nothing, and it keeps+#: the fast chain's per-minute token budget for the dictations that need it.+_MAX_REPLY_WORDS: Final[int] = 8++#: Above that, the writer decides — and is measured. A transcript under+#: ``_MIN_MEASURED_WORDS`` (30) is a remark, a follow-up or an answer, and its+#: message may not grow past this multiple of the spoken word count, with a+#: floor so a ten-word brief may still become a decent paragraph. A message+#: over the line is the "yes" that came back as a document.+_INFLATION_FACTOR: Final[float] = 4.0+_INFLATION_FLOOR_WORDS: Final[int] = 60+++def is_short_reply(raw: str) -> bool:+ """True when *raw* is too short to want a prompt written for it."""+ return len(_WORD_RE.findall(str(raw or ""))) <= _MAX_REPLY_WORDS+++def looks_inflated(raw: str, prompt: str) -> bool:+ """True when a short transcript came back as a long document.++ Only over transcripts under the measured length: a real brief is allowed+ to grow into a structured prompt, and does, but a remark of twenty words+ has nothing in it that a message of a hundred could be faithful to.+ """+ spoken = len(_WORD_RE.findall(str(raw or "")))+ if spoken >= _MIN_MEASURED_WORDS:+ return False+ written = len(_WORD_RE.findall(str(prompt or "")))+ return written > max(_INFLATION_FLOOR_WORDS, int(spoken * _INFLATION_FACTOR))++# --- Level guards ------------------------------------------------------------## The failure v6 answers is not a lost literal but a wrong LEVEL: the writer@@ -605,6 +669,9 @@ def prompt_guard_reason(raw: str, prompt: str, *, protected: Sequence[str] = ())* ``dropped_context`` — under 40 % of the spoken word count. A writtenprompt is normally longer than the dictation; this short means thewriter summarised instead.+ * ``inflated`` — a transcript under the measured length came back more+ than four times its size (floor 60 words). A remark or an answer+ became a document."""body = (prompt or "").strip()if not body:@@ -629,6 +696,8 @@ def prompt_guard_reason(raw: str, prompt: str, *, protected: Sequence[str] = ())return "dropped_detail"if looks_thinned(raw, body):return "dropped_context"+ if looks_inflated(raw, body):+ return "inflated"return ""@@ -698,6 +767,10 @@ async def compose_prompt(return _result("off")if not source.strip():return _result("skipped_short", reason="empty_input")+ if is_short_reply(source):+ # "Ja.", "Nein, lass das.", "okay, go ahead": complete as spoken.+ # The ordinary passes punctuate it; a writer could only add.+ return _result("skipped_short", reason="reply")from jarvis.dictation import polish as polish_pass@@ -821,6 +894,8 @@ __all__ = ["echoes_example","ends_with_sign_off","extract_prompt_block",+ "is_short_reply",+ "looks_inflated","looks_thinned","lost_literals","normalize_prompt_text",diff --git a/jarvis/dictation/prompt_mode_switch.py b/jarvis/dictation/prompt_mode_switch.pynew file mode 100644index 0000000000..98056eee4c--- /dev/null+++ b/jarvis/dictation/prompt_mode_switch.py@@ -0,0 +1,78 @@+"""The one writer of the Prompt Mode switch, whichever surface flips it.++``[dictation].prompt_mode`` has three mirrors: the card under Voice, the pill+on the front page, and the sparkle on the native Jarvis bar. Each can flip+it. If each also wrote it, the value on disk, the value the running pipeline+reads and the value each surface shows would drift the moment two of them+disagreed — the multi-writer pattern the voice-mute flag was built to avoid+(one flip owner, one broadcast, every mirror listens).++So: every flip lands here. Disk first, the live config second, and then one+``DictationPromptModeChanged`` on the bus that every mirror redraws from. A+save that fails changes nothing live, for the reason the settings route+gives — a switch that looks on until the next restart is worse than one that+refused.++Pure orchestration; the imports that cost anything are inside the functions+so this module stays free on the boot path (AP-26).+"""++from __future__ import annotations++import asyncio+import logging+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."""+ if bus is None:+ return+ from jarvis.core.events import DictationPromptModeChanged++ try:+ await bus.publish(DictationPromptModeChanged(enabled=bool(enabled), source=source))+ except Exception: # noqa: BLE001 — a mirror update must never break the flip+ log.exception("DictationPromptModeChanged publish failed")+++async def apply_prompt_mode(+ enabled: bool,+ *,+ dictation_cfg: Any,+ bus: Any,+ source: str,+ persist: bool = True,+) -> bool:+ """Set ``[dictation].prompt_mode`` everywhere it lives, then say so.++ Returns ``True`` when the value is on disk and live. ``False`` means the+ save failed and NOTHING changed — the caller's surface should keep+ showing the old state rather than the one it hoped for.+ """+ value = bool(enabled)+ if persist:+ from jarvis.core import config_writer++ try:+ await asyncio.to_thread(config_writer.set_dictation_setting, "prompt_mode", value)+ except Exception: # noqa: BLE001 — reported, and the switch stays honest+ log.warning(+ "dictation prompt mode could not be saved (source=%s); the switch stays as it was.",+ source or "unknown",+ exc_info=True,+ )+ return False+ if dictation_cfg is not None:+ try:+ 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)+ 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)+ return True+++__all__ = ["announce_prompt_mode", "apply_prompt_mode"]diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.pyindex fe220ba3b3..167a45abd9 100644--- a/jarvis/speech/pipeline.py+++ b/jarvis/speech/pipeline.py@@ -60,6 +60,7 @@ from jarvis.core.events import (AudioOutFirst,BrainTTFT,DictationCompleted,+ DictationPromptModeToggleRequested,DictationRefused,DictationStarted,DictationTranscribing,@@ -3038,6 +3039,12 @@ class SpeechPipeline:self._bus.subscribe(VoiceMuteToggleRequested, self._on_mute_toggle_requested)+ # Prompt Mode toggle from the Jarvis bar's sparkle. The pipeline+ # 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+ )# Wave 0 (omni-latency): perceived time-to-first-audio (ack OR# brain, whichever speaks first) feeds the per-turn latency tracker.self._bus.subscribe(AudioOutFirst, self._on_audio_out_first)@@ -4361,6 +4368,27 @@ class SpeechPipeline:except Exception: # noqa: BLE001log.exception("VoiceMuteChanged publish failed")+ async def _on_prompt_mode_toggle_requested(+ self, event: DictationPromptModeToggleRequested+ ) -> None:+ """Flip ``[dictation].prompt_mode`` and broadcast the new value.++ 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.+ """+ from jarvis.dictation.prompt_mode import prompt_mode_enabled+ from jarvis.dictation.prompt_mode_switch import apply_prompt_mode++ cfg = getattr(self, "_dictation_cfg", None)+ await apply_prompt_mode(+ not prompt_mode_enabled(cfg),+ dictation_cfg=cfg,+ bus=self._bus,+ source=event.source or "unknown",+ )+async def _emit_wake(self, keyword: str, confidence: float = 0.0) -> None:self._last_wake_keyword = keywordif self._bus is not None:diff --git a/jarvis/ui/jarvisbar/host.py b/jarvis/ui/jarvisbar/host.pyindex 156821f361..95cf146565 100644--- a/jarvis/ui/jarvisbar/host.py+++ b/jarvis/ui/jarvisbar/host.py@@ -104,6 +104,8 @@ def dispatch(surface: Any, msg: dict[str, Any]) -> bool:_call(surface, "set_level", float(msg.get("level", 0.0)))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)))elif op == "set_size_scale":_call(surface, "set_size_scale", float(msg.get("scale", 1.0)))elif op == "set_follow_cursor":@@ -219,6 +221,7 @@ class _EchoBar:self._stop_evt.set()def set_on_mute_toggle(self, cb: Any) -> None: ...+ def set_on_prompt_mode_toggle(self, cb: Any) -> None: ...def set_on_voice_action(self, cb: Any) -> None: ...def set_on_talk(self, cb: Any) -> None: ...def set_on_hangup(self, cb: Any) -> None: ...@@ -384,6 +387,9 @@ def _wire_surface_events(surface: Any) -> None:# the pipeline lives (BUG-191 — this X used to resolve to nothing)._call(surface, "set_on_dictation_stop", lambda: emit("dictation_stop"))_call(surface, "set_on_mute_toggle", lambda: emit("mute_toggle"))+ # The idle pill's sparkle: the switch lives in the parent's dictation+ # config, so the click travels there like the mute toggle does.+ _call(surface, "set_on_prompt_mode_toggle", lambda: emit("prompt_mode_toggle"))# The orb's control row adds one action the bar never had: muting the# ASSISTANT's voice. Like talk/hang-up it needs the parent, because the# SpeechPipeline whose TTS volume it changes lives there.diff --git a/jarvis/ui/jarvisbar/interaction.py b/jarvis/ui/jarvisbar/interaction.pyindex c7107e6b31..553a57d658 100644--- a/jarvis/ui/jarvisbar/interaction.py+++ b/jarvis/ui/jarvisbar/interaction.py@@ -57,7 +57,7 @@ def resolve_click("""Resolve a click on the bar into an action by its horizontal zone + state.Returns one of ``"hangup"`` / ``"dictation_stop"`` / ``"mute"`` / ``"talk"``- / ``"none"``.+ / ``"prompt_mode_toggle"`` / ``"none"``.The RIGHT zone is the microphone mute toggle (mic muted FOR JARVIS only —non-destructive, so it keeps a generous zone). When IDLE, a click anywhere@@ -86,6 +86,14 @@ 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.+``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 pillunder wherever the pointer happens to be, and it clears itself a moment@@ -106,7 +114,11 @@ def resolve_click(active = mode in ("listen", "think", "speak")if frac >= 0.60: # right zone → the mic mute toggle (non-destructive)return "mute"- if not active: # idle middle/left → start a normal session+ 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):+ return "prompt_mode_toggle"return "talk"# Active session: the ONLY destructive bar action is the close-X hang-up,# which must be a deliberate click ON the visible X glyph.@@ -128,6 +140,17 @@ def _on_close_x(x: float, width: int, pill_w: float | None) -> bool:return abs(x - x_glyph) <= hit+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.+ """+ return _on_close_x(x, width, pill_w)++def default_bottom_center(*, screen_w: int, screen_h: int, bar_w: int, bar_h: int, margin: int) -> tuple[int, int]:diff --git a/jarvis/ui/jarvisbar/null_overlay.py b/jarvis/ui/jarvisbar/null_overlay.pyindex 1c813d4e05..d5cb2579ac 100644--- a/jarvis/ui/jarvisbar/null_overlay.py+++ b/jarvis/ui/jarvisbar/null_overlay.py@@ -29,7 +29,10 @@ class NullOverlay:def hide_comment(self) -> None: ...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_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: ...def set_on_show_window(self, callback: Callable[[], None] | None) -> None: ...def set_on_speaker_toggle(self, callback: Callable[[], None] | None) -> None: ...diff --git a/jarvis/ui/jarvisbar/overlay.py b/jarvis/ui/jarvisbar/overlay.pyindex 74069b63ee..c994720412 100644--- a/jarvis/ui/jarvisbar/overlay.py+++ b/jarvis/ui/jarvisbar/overlay.py@@ -501,6 +501,7 @@ class JarvisBarOverlay:self._cur_work: tuple[int, int, int, int] | None = Noneself._level_unsub: Callable[[], None] | None = Noneself._on_mute_toggle: Callable[[], None] | None = None+ self._on_prompt_mode_toggle: Callable[[], None] | None = None# Interaction callbacks let the macOS companion host forward actions# to the parent process, where the live SpeechPipeline is registered.# They stay optional so Windows/Linux keep their existing in-process@@ -513,6 +514,9 @@ class JarvisBarOverlay:self._feedback_publisher: Callable[[str, dict], None] | None = Noneself._on_show_window: Callable[[], None] | None = Noneself._hovered = False # mouse over the bar → reveal the close cross+ # Mirror of ``[dictation].prompt_mode`` (the bridge keeps it current+ # from DictationPromptModeChanged): lights the idle pill's sparkle.+ self._prompt_mode = 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@@ -619,6 +623,15 @@ 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.++ 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."""+ self._prompt_mode = bool(enabled)+def set_size_scale(self, scale: float) -> None:"""Live-resize the bar to a new user "Bar size" multiplier.@@ -644,6 +657,9 @@ class JarvisBarOverlay:def set_on_mute_toggle(self, callback: Callable[[], None] | None) -> None:self._on_mute_toggle = callback+ def set_on_prompt_mode_toggle(self, callback: Callable[[], None] | None) -> None:+ self._on_prompt_mode_toggle = callback+def set_on_talk(self, callback: Callable[[], None] | None) -> None:"""Register the idle-body click action for an external host."""self._on_talk = callback@@ -1340,7 +1356,14 @@ class JarvisBarOverlay:static_capable = effective_mode == "idle" or (effective_mode in ("listen", "speak") and silent)- tick_key = (effective_mode, self._hovered, self._muted, drop_visual, silent)+ tick_key = (+ effective_mode,+ self._hovered,+ self._muted,+ drop_visual,+ silent,+ getattr(self, "_prompt_mode", False),+ )if tick_key != self._static_tick_key:self._static_tick_key = tick_keyself._static_tick_count = 0@@ -1364,6 +1387,7 @@ class JarvisBarOverlay:level,hovered=self._hovered,muted=self._muted,+ prompt_mode=getattr(self, "_prompt_mode", 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@@ -1882,7 +1906,9 @@ class JarvisBarOverlay:active = self._mode in ("listen", "think", "speak") or (self._mode in DICTATION_MODES)- pill_w = renderer.ACTIVE_W if active else None+ # The idle pill is OPEN while its controls are up, and the+ # sparkle's hit-box has to track that pill, not the window.+ pill_w = renderer.ACTIVE_W if active else renderer.OPEN_Waction = interaction.resolve_click(click_x,renderer.WIN_W,@@ -1922,6 +1948,17 @@ class JarvisBarOverlay:if cb is not None: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.+ cb = self._on_prompt_mode_toggle+ if cb is not None:+ cb()+ self._prompt_mode = not getattr(self, "_prompt_mode", False)elif action == "hangup":callback = self._on_hangupif callback is not None:diff --git a/jarvis/ui/jarvisbar/qt_overlay.py b/jarvis/ui/jarvisbar/qt_overlay.pyindex 75d103f0bc..e8f2136315 100644--- a/jarvis/ui/jarvisbar/qt_overlay.py+++ b/jarvis/ui/jarvisbar/qt_overlay.py@@ -439,7 +439,9 @@ class QtJarvisBarOverlay:self._last_level_rx_t = 0.0self._muted = Falseself._hovered = False- self._static_tick_key: tuple[str, bool, bool, str] | None = None+ # 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 = Noneself._static_tick_count = 0self._hangup_click_block_until = 0.0@@ -498,6 +500,7 @@ class QtJarvisBarOverlay:# The companion has no SpeechPipeline of its own. The host should map# this callback to an IPC event and let the parent perform the action.self._on_voice_action: Callable[[str], None] | None = None+ self._on_prompt_mode_toggle: Callable[[], None] | None = None# ------------------------------------------------------------------# Surface API consumed by OrbBusBridge / the companion host@@ -552,6 +555,10 @@ class QtJarvisBarOverlay:self._muted = bool(muted)self._invalidate_static_frame()+ def set_prompt_mode(self, enabled: bool) -> None:+ self._prompt_mode = bool(enabled)+ self._invalidate_static_frame()+def set_size_scale(self, scale: float) -> None:"""Live-resize the bar to a new user "Bar size" multiplier (thread-safe).@@ -572,6 +579,9 @@ class QtJarvisBarOverlay:def set_on_mute_toggle(self, callback: Callable[[], None] | None) -> None:self._on_mute_toggle = callback+ def set_on_prompt_mode_toggle(self, callback: Callable[[], None] | None) -> None:+ self._on_prompt_mode_toggle = callback+def set_feedback_publisher(self, callback: Callable[[str, dict], None] | None) -> None:self._feedback_publisher = callback@@ -753,7 +763,13 @@ class QtJarvisBarOverlay:# Without the veto the confirmation is never seen: a settled idle# bar skips exactly the frames the tick would live in.drop_visual = self._current_drop_visual()- tick_key = (effective_mode, self._hovered, self._muted, drop_visual)+ tick_key = (+ effective_mode,+ self._hovered,+ self._muted,+ drop_visual,+ self._prompt_mode,+ )if tick_key != self._static_tick_key:self._static_tick_key = tick_keyself._static_tick_count = 0@@ -776,6 +792,7 @@ class QtJarvisBarOverlay:),hovered=self._hovered,muted=self._muted,+ prompt_mode=self._prompt_mode,drop_state=drop_visual,drop_elapsed=now - self._drop_visual_t0,)@@ -966,6 +983,7 @@ class QtJarvisBarOverlay:self._mode,hovered=True,muted=self._muted,+ prompt_mode=self._prompt_mode,)center_x = renderer.WIN_W / 2.0center_y = renderer.pill_center_y(float(pill_h))@@ -1452,7 +1470,9 @@ class QtJarvisBarOverlay:renderer.WIN_W,self._mode,hovered=is_hovered,- pill_w=renderer.ACTIVE_W if active else None,+ # 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,)if action == "mute":callback = self._on_mute_toggle@@ -1460,6 +1480,12 @@ class QtJarvisBarOverlay:self._invoke_callback(callback, "mute-toggle")self._muted = not self._mutedself._invalidate_static_frame()+ 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._invalidate_static_frame()elif action in {"talk", "hangup", "dictation_stop"}:callback = self._on_voice_actionif callback is None:diff --git a/jarvis/ui/jarvisbar/renderer.py b/jarvis/ui/jarvisbar/renderer.pyindex df480dd00a..774edd4dd4 100644--- a/jarvis/ui/jarvisbar/renderer.py+++ b/jarvis/ui/jarvisbar/renderer.py@@ -506,7 +506,11 @@ def evenly_spaced(cx: float, span: float, n: int) -> list[float]:def target_pill_size(- mode: str, hovered: bool, muted: bool = False, drop_open: bool = False+ mode: str,+ hovered: bool,+ muted: bool = False,+ drop_open: bool = False,+ prompt_mode: bool = False,) -> tuple[int, int]:"""Pick the pill's target (w, h): ACTIVE while a session is live, OPEN onhover (to show controls), COLLAPSED at rest. Only a live session is 2x —@@ -535,10 +539,15 @@ def target_pill_size(further: the resting pill is a ~37x6 px sliver with no room to draw alegible mark in, while the 2x ACTIVE size would make a passing message looklike a live session. OPEN is the size at which the answer is readable and- still unmistakably not a conversation."""+ still unmistakably not a conversation.++ ``prompt_mode`` opens the resting pill the way muted does, and for the+ same reason: the switch that rewrites every dictation is a state the user+ must be able to see at a glance, and the sparkle that shows it (and turns+ it off) needs the OPEN pill's room to be legible and clickable."""if mode in ("listen", "speak", "think") or mode in DICTATION_MODES:return ACTIVE_W, ACTIVE_H- if hovered or muted or drop_open or mode in NOTICE_MODES:+ if hovered or muted or drop_open or prompt_mode or mode in NOTICE_MODES:return OPEN_W, OPEN_Hreturn COLLAPSED_W, COLLAPSED_H@@ -769,6 +778,7 @@ class JarvisBarRenderer:muted: bool = False,drop_state: str = DROP_STATE_NONE,drop_elapsed: float = 0.0,+ prompt_mode: bool = False,) -> Image.Image:active = mode in ("listen", "speak")# "That did not happen" — see NOTICE_MODES. Held separately from the@@ -792,7 +802,7 @@ class JarvisBarRenderer:# live, OPEN on hover (controls), while muted (keep the mute cue +# unmute target visible) OR during a drop (landing zone + tick room),# COLLAPSED at rest.- tw, th = target_pill_size(mode, hovered, muted, drop_open)+ tw, th = target_pill_size(mode, hovered, muted, drop_open, prompt_mode)# Snappy grow/shrink: 0.5 reaches the target in ~4 frames (~70 ms) so the# bar pops to full size almost immediately on "Hey Jarvis" instead of# crawling there over a third of a second.@@ -882,18 +892,31 @@ 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)self._draw_mic(img, x_right, cy, ph, muted)elif mode == "think":self._draw_thinking(d, t, cx, cy, pw, ph)elif mode in ("listen", "speak"):self._draw_bars(d, t, cx, cy, pw, ph)- elif muted:- # Muted standby (idle, not hovered): 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).- self._draw_mic(img, x_right, cy, ph, muted=True)- # idle / standby (not hovered, not muted): a clean EMPTY pill — no dots,- # no bars. "When nothing is happening, nothing is in the bar."+ elif muted or prompt_mode:+ # 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+ # "every dictation comes out rewritten" is never a surprise and+ # the switch is one hover away.+ 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)+ # 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."return imgdef _draw_dots(@@ -918,6 +941,37 @@ 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:+ """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. 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.+ """+ ss = 4+ layer = 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)+ x, y, p = cx * ss, cy * ss, ph * ss++ def star(sx: float, sy: float, r: float) -> None:+ pts = []+ for k in range(8):+ ang = math.radians(90 * (k // 2) + 45 * (k % 2))+ rad = r if k % 2 == 0 else r * 0.36+ pts.append((sx + rad * math.cos(ang), sy - rad * math.sin(ang)))+ ld.polygon(pts, fill=color)++ r = p * 0.30+ star(x - r * 0.15, y + r * 0.15, r)+ star(x + r * 0.85, y - r * 0.85, r * 0.42)+ small = layer.resize(img.size, Image.Resampling.LANCZOS)+ img.paste(small, (0, 0), small)+def _draw_mic(self, img: Image.Image, cx: float, cy: float, ph: float, muted: bool) -> None:diff --git a/jarvis/ui/jarvisbar/subprocess_overlay.py b/jarvis/ui/jarvisbar/subprocess_overlay.pyindex 7665a1ec53..f50b7db8ce 100644--- a/jarvis/ui/jarvisbar/subprocess_overlay.py+++ b/jarvis/ui/jarvisbar/subprocess_overlay.py@@ -111,6 +111,7 @@ class SubprocessBarOverlay:self._follow_cursor_monitor = bool(follow_cursor_monitor)self._mode = "idle"self._muted = False+ self._prompt_mode = 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@@ -128,6 +129,7 @@ class SubprocessBarOverlay:self._respawn_succeeded = threading.Event()self._respawn_exhausted = threading.Event()self._on_mute_toggle: Callable[[], None] | None = None+ self._on_prompt_mode_toggle: Callable[[], None] | None = Noneself._on_talk: Callable[[], None] | None = Noneself._on_hangup: Callable[[], None] | None = Noneself._on_dictation_stop: Callable[[], None] | None = None@@ -289,6 +291,10 @@ class SubprocessBarOverlay:self._muted = bool(muted)self._send({"op": "set_muted", "muted": self._muted})+ def set_prompt_mode(self, enabled: bool) -> None:+ self._prompt_mode = bool(enabled)+ self._send({"op": "set_prompt_mode", "enabled": self._prompt_mode})+def set_size_scale(self, scale: float) -> None:"""Forward a live "Bar size" change to the hosted surface.@@ -317,6 +323,9 @@ class SubprocessBarOverlay:def set_on_mute_toggle(self, callback: Callable[[], None] | None) -> None:self._on_mute_toggle = callback+ def set_on_prompt_mode_toggle(self, callback: Callable[[], None] | None) -> None:+ self._on_prompt_mode_toggle = callback+def set_on_talk(self, callback: Callable[[], None] | None) -> None:self._on_talk = callback@@ -481,6 +490,8 @@ class SubprocessBarOverlay:self._send({"op": "hide"})if self._muted:self._send({"op": "set_muted", "muted": True})+ if self._prompt_mode:+ self._send({"op": "set_prompt_mode", "enabled": True})if self._last_level is not None:self._send({"op": "set_level", "level": self._last_level})@@ -519,6 +530,10 @@ class SubprocessBarOverlay:cb = self._on_mute_toggleif cb is not None:cb()+ elif event == "prompt_mode_toggle":+ cb_prompt = self._on_prompt_mode_toggle+ if cb_prompt is not None:+ cb_prompt()elif event == "feedback":pub = self._feedback_publisherif pub is not None:diff --git a/jarvis/ui/web/dictation_routes.py b/jarvis/ui/web/dictation_routes.pyindex 069b8b198a..54bfdfa059 100644--- a/jarvis/ui/web/dictation_routes.py+++ b/jarvis/ui/web/dictation_routes.py@@ -1293,6 +1293,18 @@ async def put_settings(body: SettingsBody, request: Request) -> dict[str, Any]:except Exception as exc: # noqa: BLE001 — never fail a save on live-applylog.warning("dictation settings live-apply failed: %s", exc)+ # 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.+ if "prompt_mode" in updates:+ from jarvis.dictation.prompt_mode_switch import announce_prompt_mode++ await announce_prompt_mode(+ bool(validated.prompt_mode),+ bus=getattr(request.app.state, "bus", None),+ source="settings",+ )+return {"ok": True,"settings": {diff --git a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts b/jarvis/ui/web/frontend/src/hooks/useWebSocket.tsindex 424c5c47f0..4ae5cffd14 100644--- a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts+++ b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts@@ -30,6 +30,7 @@ import { PANE_ACTIVITY_EVENT } from "@/store/workspacePanes";import { WSAudioLevel, WSEventEnvelope, WSWelcome } from "@/schema/ws";import { useI18nStore, hydrateUiLanguage, hydrateReplyLanguage, translate } from "@/i18n";import { hydrateUiTheme } from "@/hooks/useTheme";+import { announceDictationSettings } from "@/hooks/usePromptMode";let singleton: WSClient | null = null;@@ -463,6 +464,16 @@ export function useWebSocket(): void {window.dispatchEvent(new CustomEvent("jarvis:secret-configured", { detail: env.payload }));}+ if (env.event_name === "DictationPromptModeChanged") {+ // The switch flipped somewhere this window did not click — the+ // native Jarvis bar's sparkle, another window — and every pill and+ // card mirrors the one authoritative value.+ const p = env.payload as { enabled?: unknown };+ if (typeof p.enabled === "boolean") {+ announceDictationSettings({ prompt_mode: p.enabled });+ }+ }+if (env.event_name === "ContactChanged") {// Trigger only — ContactsView re-fetches its own list, so a contact// saved by voice (contact-upsert) appears without a manual refresh.diff --git a/tests/unit/dictation/test_prompt_mode.py b/tests/unit/dictation/test_prompt_mode.pyindex d2392e6b02..23d650db4d 100644--- a/tests/unit/dictation/test_prompt_mode.py+++ b/tests/unit/dictation/test_prompt_mode.py@@ -46,6 +46,8 @@ from jarvis.dictation.prompt_mode import (echoes_example,ends_with_sign_off,extract_prompt_block,+ is_short_reply,+ looks_inflated,looks_thinned,lost_literals,normalize_prompt_text,@@ -250,8 +252,92 @@ def test_every_example_answer_clears_the_fidelity_guards_for_its_transcript() ->assert not asks_for_a_prompt(transcript, answer)-def test_the_prompt_version_names_the_v6_revision() -> None:- assert prompt_mode.PROMPT_MODE_PROMPT_VERSION == 6+def test_the_prompt_version_names_the_v7_revision() -> None:+ assert prompt_mode.PROMPT_MODE_PROMPT_VERSION == 7+++def test_the_instruction_names_the_answer_case() -> None:+ """A "yes" to a question the model asked is not a brief. Measured+ 2026-08-28: it came back as a role, sections and a task list."""+ system = build_prompt_mode_prompt()+ assert "WHEN IT IS AN ANSWER" in system+ assert "the message is the answer itself, tidied" in system+ assert 'never a task list for a "yes"' in system+++def test_the_instruction_forbids_invented_format_rules_and_placeholders() -> None:+ """The live output carried "Formatierungs- & Strukturvorgaben" and an+ "Input-Variablen / Platzhalter" section with {frontend_config}-style+ variables the user never spoke - a form, where work was asked for."""+ system = build_prompt_mode_prompt()+ assert "No format rules the user did not state" in system+ assert "no placeholder variables, no report template" in system+++# --------------------------------------------------------------------------- #+# Size: when no prompt is wanted at all+# --------------------------------------------------------------------------- #+++ "spoken",+ [+ "Ja.",+ "Nein, lass das.",+ "Okay, mach weiter.",+ "yes go ahead",+ "fix the typo on the login page",+ "Ja, mach das fertig und push es dann.",+ ],+)+def test_a_reply_of_eight_words_or_fewer_wants_no_prompt(spoken: str) -> None:+ assert is_short_reply(spoken)+++def test_a_nine_word_remark_reaches_the_writer() -> None:+ assert not is_short_reply("bitte mach das fertig und lass die tests dabei weg")+++async def test_a_short_reply_never_calls_the_chain(monkeypatch: pytest.MonkeyPatch) -> None:+ """The one place the fast chain's per-minute budget is cheapest to+ save: a "yes" costs no call at all and lands as spoken."""+ chain = _install(monkeypatch, FakeChain())+ out = await compose_prompt("Ja, mach das.", cfg=_cfg(), language="de")+ assert out.status == "skipped_short"+ assert out.reason == "reply"+ assert out.text == "Ja, mach das."+ assert chain.calls == []+++def test_a_short_transcript_that_grew_fourfold_is_inflated() -> None:+ spoken = (+ "ja mach das bitte fertig aber lass die tests weg die brauchen wir "+ "nicht mehr und sag mir bescheid"+ )+ honest = (+ "Ja, mach das bitte fertig. Lass die Tests weg, die brauchen wir nicht "+ "mehr. Sag mir Bescheid."+ )+ assert not looks_inflated(spoken, honest)+ document = "## Rolle\nDu bist ein Entwickler.\n\n## Aufgabe\n" + " ".join(["Wort"] * 80) + "."+ assert looks_inflated(spoken, document)+ assert prompt_guard_reason(spoken, document) == "inflated"+++def test_a_ten_word_brief_may_still_become_a_paragraph() -> None:+ """The floor: sixty words for a brief of ten, so a real small task can+ be written up properly."""+ spoken = "fix the blank screen on a wrong password in AuthHandler please"+ written = "Fix the blank screen in AuthHandler on a wrong password. " + " ".join(["word"] * 50)+ assert not looks_inflated(spoken, written)+++def test_a_real_brief_is_never_measured_for_inflation() -> None:+ """Thirty words and up is a brief, and a brief may grow into a+ structured prompt - that is the feature."""+ spoken = " ".join(["wort"] * 30)+ assert not looks_inflated(spoken, " ".join(["wort"] * 400))def test_protected_terms_are_listed_in_the_shared_block() -> None:diff --git a/tests/unit/dictation/test_prompt_mode_switch.py b/tests/unit/dictation/test_prompt_mode_switch.pynew file mode 100644index 0000000000..a372ed890d--- /dev/null+++ b/tests/unit/dictation/test_prompt_mode_switch.py@@ -0,0 +1,97 @@+"""One writer for the Prompt Mode switch, whichever surface flips it.++Three surfaces can flip ``[dictation].prompt_mode`` (the settings card, the+front-page pill, the native bar's sparkle). If each wrote it, disk, the live+config and the surfaces would drift the moment two disagreed. So every flip+lands in ``prompt_mode_switch``: disk first, live config second, then ONE+``DictationPromptModeChanged`` that every mirror redraws from — and a save+that fails changes nothing live, because a switch that looks on until the+next restart is worse than one that refused.++No ``unittest.mock``: the writer and the bus are plain fakes.+"""++from __future__ import annotations++from typing import Any++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+++class _Bus:+ def __init__(self) -> None:+ self.published: list[Any] = []++ async def publish(self, event: Any) -> None:+ self.published.append(event)+++class _Cfg:+ prompt_mode = False+++async def test_a_flip_lands_on_disk_live_and_on_the_bus(monkeypatch: pytest.MonkeyPatch) -> None:+ written: list[tuple[str, Any]] = []+ monkeypatch.setattr(+ config_writer, "set_dictation_setting", lambda key, value: written.append((key, value))+ )+ bus, cfg = _Bus(), _Cfg()++ assert await apply_prompt_mode(True, dictation_cfg=cfg, bus=bus, source="jarvis_bar")++ assert written == [("prompt_mode", True)]+ assert cfg.prompt_mode is True+ assert len(bus.published) == 1+ event = bus.published[0]+ assert isinstance(event, DictationPromptModeChanged)+ assert event.enabled is True+ assert event.source == "jarvis_bar"+++async def test_a_failed_save_changes_nothing_live(monkeypatch: pytest.MonkeyPatch) -> None:+ def _boom(key: str, value: Any) -> None:+ raise OSError("disk says no")++ monkeypatch.setattr(config_writer, "set_dictation_setting", _boom)+ bus, cfg = _Bus(), _Cfg()++ assert not await apply_prompt_mode(True, dictation_cfg=cfg, bus=bus, source="settings")++ assert cfg.prompt_mode is False+ assert bus.published == []+++async def test_live_only_skips_the_disk(monkeypatch: pytest.MonkeyPatch) -> None:+ def _never(key: str, value: Any) -> None:+ raise AssertionError("persist=False must not write")++ monkeypatch.setattr(config_writer, "set_dictation_setting", _never)+ bus, cfg = _Bus(), _Cfg()+ assert await apply_prompt_mode(True, dictation_cfg=cfg, bus=bus, source="t", persist=False)+ assert cfg.prompt_mode is True+ assert bus.published[0].enabled is True+++async def test_announce_without_a_bus_is_a_quiet_no_op() -> None:+ await announce_prompt_mode(True, bus=None, source="settings")+++async def test_a_broken_bus_never_breaks_the_flip(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(config_writer, "set_dictation_setting", lambda key, value: None)++ class _DeadBus:+ async def publish(self, event: Any) -> None:+ raise RuntimeError("bus is gone")++ cfg = _Cfg()+ assert await apply_prompt_mode(False, dictation_cfg=cfg, bus=_DeadBus(), source="t")+ assert cfg.prompt_mode is Falsediff --git a/tests/unit/ui/jarvisbar/test_click_no_session_guard.py b/tests/unit/ui/jarvisbar/test_click_no_session_guard.pyindex 357f6196ab..c5d2612510 100644--- a/tests/unit/ui/jarvisbar/test_click_no_session_guard.py+++ b/tests/unit/ui/jarvisbar/test_click_no_session_guard.py@@ -90,11 +90,18 @@ 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 same area- # behaves like the normal idle body and can deliberately start a new call.+ # 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))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_host_protocol.py b/tests/unit/ui/jarvisbar/test_host_protocol.pyindex 5b409812cc..a9a8f68c21 100644--- a/tests/unit/ui/jarvisbar/test_host_protocol.py+++ b/tests/unit/ui/jarvisbar/test_host_protocol.py@@ -45,6 +45,9 @@ 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_size_scale(self, scale: float) -> None:self.calls.append(("set_size_scale", scale))@@ -88,6 +91,9 @@ class _RecordingBar:def set_on_dictation_stop(self, callback) -> None:self.on_dictation_stop = callback+ def set_on_prompt_mode_toggle(self, callback) -> None:+ self.calls.append(("set_on_prompt_mode_toggle",))+def set_on_mute_toggle(self, callback) -> None:self.on_mute_toggle = callback@@ -108,6 +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_size_scale", "scale": 1.4},{"op": "set_persistent", "enabled": False},{"op": "release_startup_gate"},@@ -126,6 +133,7 @@ def test_dispatch_maps_every_op_onto_the_surface() -> None:assert ("show", "listen") in bar.callsassert ("set_level", 0.5) in bar.callsassert ("set_muted", True) in bar.calls+ assert ("set_prompt_mode", True) in bar.callsassert ("set_size_scale", 1.4) in bar.callsassert ("play_animation", "wave", {"x": 1}) in bar.callsassert ("show_listening_transcript", "hi", 9) in bar.callsdiff --git a/tests/unit/ui/jarvisbar/test_prompt_mode_bridge.py b/tests/unit/ui/jarvisbar/test_prompt_mode_bridge.pynew file mode 100644index 0000000000..a00383da47--- /dev/null+++ b/tests/unit/ui/jarvisbar/test_prompt_mode_bridge.py@@ -0,0 +1,85 @@+"""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.+"""++from __future__ import annotations++from types import SimpleNamespace+from typing import Any++import pytest++from jarvis.core.events import DictationPromptModeChanged, DictationPromptModeToggleRequested+from ui.orb.bus_bridge import OrbBusBridge+++class _Surface:+ def __init__(self) -> None:+ self.prompt_mode: list[bool] = []+ self.toggle_cb: Any = None++ def set_prompt_mode(self, enabled: bool) -> None:+ self.prompt_mode.append(enabled)++ def set_on_prompt_mode_toggle(self, cb: Any) -> None:+ self.toggle_cb = cb+++class _Bus:+ def __init__(self) -> None:+ self.published: list[Any] = []++ async def publish(self, event: Any) -> None:+ self.published.append(event)+++async def test_changed_event_reaches_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]+++async def test_a_surface_without_the_method_is_skipped() -> None:+ bridge = OrbBusBridge(bus=SimpleNamespace(), orb=SimpleNamespace())+ await bridge._on_prompt_mode_changed(DictationPromptModeChanged(enabled=True))+++def test_the_sparkle_click_asks_the_bus_to_flip() -> 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 event.source == "jarvis_bar"+++def test_seed_reads_the_switch_from_the_live_pipeline(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.prompt_mode == [True]+++def test_seed_without_a_pipeline_leaves_the_surface_alone(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ surface = _Surface()+ 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 == []diff --git a/tests/unit/ui/jarvisbar/test_prompt_mode_button.py b/tests/unit/ui/jarvisbar/test_prompt_mode_button.pynew file mode 100644index 0000000000..b860386328--- /dev/null+++ b/tests/unit/ui/jarvisbar/test_prompt_mode_button.py@@ -0,0 +1,236 @@+"""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.++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 —+pinned here so no renderer can silently lack the control.+"""++from __future__ import annotations++from jarvis.ui.jarvisbar import host, interaction+from jarvis.ui.jarvisbar import renderer as R+from jarvis.ui.jarvisbar.null_overlay import NullOverlay+from jarvis.ui.jarvisbar.overlay import JarvisBarOverlay+++class _FakePipeline:+ def __init__(self) -> None:+ self.session_calls = 0++ def is_session_active(self) -> bool:+ return False++ def request_voice_session(self) -> None:+ self.session_calls += 1++ def request_hangup(self) -> None: # pragma: no cover - unused here+ ...+++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+++def _patch_pipeline(monkeypatch, fake) -> None:+ monkeypatch.setattr("jarvis.core.runtime_refs.get_speech_pipeline", lambda: fake)+++# --------------------------------------------------------------------------- #+# The click zone+# --------------------------------------------------------------------------- #+++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_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_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"+++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+ dictation is written."""+ x = R.WIN_W / 2.0 - 0.42 * R.ACTIVE_W+ for mode in ("listen", "speak", "think"):+ assert (+ interaction.resolve_click(x, R.WIN_W, mode, hovered=True, pill_w=R.ACTIVE_W)+ == "hangup"+ )+ for mode in ("dictate", "dictate_transcribing"):+ assert (+ interaction.resolve_click(x, R.WIN_W, mode, hovered=True, pill_w=R.ACTIVE_W)+ == "dictation_stop"+ )+++# --------------------------------------------------------------------------- #+# The Tk surface+# --------------------------------------------------------------------------- #+++def test_sparkle_click_fires_toggle_and_optimistically_flips(monkeypatch) -> None:+ bar = JarvisBarOverlay()+ fired: list[int] = []+ bar.set_on_prompt_mode_toggle(lambda: fired.append(1))+ fake = _FakePipeline()+ _patch_pipeline(monkeypatch, fake)++ assert bar._prompt_mode is False+ bar._on_click(_sparkle_x(), hovered=True)+ assert fired == [1]+ assert bar._prompt_mode is True # optimistic flip → lit sparkle next frame+ assert fake.session_calls == 0 # the switch is not a session start++ bar._on_click(_sparkle_x(), hovered=True)+ assert fired == [1, 1]+ assert bar._prompt_mode is False+++def test_no_callback_means_no_false_sparkle(monkeypatch) -> None:+ """A boot-race click before the bridge wired the toggle must not light a+ sparkle with nothing behind it (mirrors the mute button's rule)."""+ bar = JarvisBarOverlay()+ _patch_pipeline(monkeypatch, _FakePipeline())+ bar._on_click(_sparkle_x(), hovered=True)+ assert bar._prompt_mode is False+++def test_set_prompt_mode_mirrors_the_authoritative_value() -> None:+ bar = JarvisBarOverlay()+ bar.set_prompt_mode(True)+ assert bar._prompt_mode is True+ bar.set_prompt_mode(0)+ assert bar._prompt_mode is False+++# --------------------------------------------------------------------------- #+# The renderer+# --------------------------------------------------------------------------- #+++def test_prompt_mode_opens_the_resting_pill_like_mute_does() -> None:+ assert R.target_pill_size("idle", False) == (R.COLLAPSED_W, R.COLLAPSED_H)+ assert R.target_pill_size("idle", False, prompt_mode=True) == (R.OPEN_W, R.OPEN_H)+ # A live session is 2x regardless.+ assert R.target_pill_size("listen", False, prompt_mode=True) == (R.ACTIVE_W, R.ACTIVE_H)+++def _settled(**kw):+ """One idle frame, rendered until the eased pill size has converged."""+ rend = R.JarvisBarRenderer()+ img = None+ for i in range(40):+ img = rend.render(i * 0.016, "idle", 0.0, **kw)+ assert img is not None+ return img+++def _differing(one, other) -> list[tuple[tuple, tuple]]:+ """The pixels the two frames disagree about, paired ``(one, other)``.++ Between two frames that differ ONLY in the switch's state, these pixels+ ARE the sparkle — which is why the comparison is made this way rather+ than by hunting a region: the pill rim and the colour-keyed corners are+ identical in both frames and drop out on their own.+ """+ return [+ (p, q)+ for p, q in zip(one.get_flattened_data(), other.get_flattened_data(), strict=True)+ if p != q+ ]+++def _warmth(pixels) -> float:+ """Mean red-minus-blue over *pixels* — how much accent is in the ink.++ Brightness alone cannot tell the two states apart (an antialiased star+ blends into the near-neutral pill fill either way), but the hue can: the+ accent (231, 196, 110) is 121 apart on this axis, the standby grey+ (150, 140, 120) only 30, and the fill it blends into is 2.+ """+ 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."""+ changed = _differing(_settled(hovered=True), _settled(hovered=True, prompt_mode=True))+ assert changed, "flipping the switch 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"(warmth off={off_warmth:.0f}, on={on_warmth:.0f})"+ )+++def test_prompt_mode_is_visible_on_the_resting_bar() -> None:+ """No hover needed: "every dictation comes out rewritten" is a state the+ user must never be surprised by, so the resting pill opens and shows the+ lit sparkle — while a bar with nothing on stays the clean empty pill."""+ resting_off = _settled()+ resting_on = _settled(prompt_mode=True)+ assert _differing(resting_off, resting_on), "Prompt Mode on must be visible at rest"++ # The pill with nothing on draws no ink at all (the historical contract:+ # "when nothing is happening, nothing is in the bar").+ arr = R.key_to_alpha(resting_off)+ ink = [+ (r, g, b)+ 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 _warmth(ink) < _warmth([(231, 196, 110)])+++# --------------------------------------------------------------------------- #+# The host protocol and the other surfaces+# --------------------------------------------------------------------------- #+++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 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+++def test_the_null_surface_accepts_both_methods() -> None:+ null = NullOverlay()+ null.set_prompt_mode(True)+ null.set_on_prompt_mode_toggle(lambda: None)diff --git a/tests/unit/ui/jarvisbar/test_subprocess_overlay.py b/tests/unit/ui/jarvisbar/test_subprocess_overlay.pyindex c26afbae32..0e3716ae8a 100644--- a/tests/unit/ui/jarvisbar/test_subprocess_overlay.py+++ b/tests/unit/ui/jarvisbar/test_subprocess_overlay.py@@ -136,6 +136,7 @@ def test_surface_calls_become_wire_ops_and_mirror_locally(monkeypatch) -> None:surface.hide()surface.set_level(0.75)surface.set_muted(True)+ surface.set_prompt_mode(True)surface.reassert_z_order()surface._on_reset_double_click()ops = [m["op"] for m in proc.sent()[1:]]@@ -144,11 +145,18 @@ def test_surface_calls_become_wire_ops_and_mirror_locally(monkeypatch) -> None:"hide","set_level","set_muted",+ "set_prompt_mode","reassert_z_order","reset_position",]assert surface._mode == "speak"assert surface._muted is True+ assert surface._prompt_mode is True+ # The child's sparkle click comes back as an event and reaches the wired callback.+ flips: list[int] = []+ surface.set_on_prompt_mode_toggle(lambda: flips.append(1))+ surface._dispatch_event({"event": "prompt_mode_toggle"})+ assert flips == [1]def test_text_and_mouth_methods_are_local_noops(monkeypatch) -> None:diff --git a/tests/unit/ui/jarvisbar/test_surface_contract.py b/tests/unit/ui/jarvisbar/test_surface_contract.pyindex 82c6d43cf4..9e099aec3a 100644--- a/tests/unit/ui/jarvisbar/test_surface_contract.py+++ b/tests/unit/ui/jarvisbar/test_surface_contract.py@@ -12,6 +12,7 @@ REQUIRED = ["release_startup_gate","set_level","set_muted",+ "set_prompt_mode","set_size_scale","play_animation","stop_animation",@@ -20,6 +21,7 @@ REQUIRED = ["start_mouth_animation","stop_mouth_animation","set_on_mute_toggle",+ "set_on_prompt_mode_toggle","set_on_talk","set_on_hangup","set_feedback_publisher",@@ -69,6 +71,8 @@ def test_methods_safe_without_tk_window():bar.set_muted(True) # _root None → safe atomic writeassert bar._muted is Truebar.set_muted(False)+ bar.set_prompt_mode(True)+ bar.set_prompt_mode(False)assert bar._muted is Falsebar.hide() # _root None → safe no-op@@ -81,6 +85,7 @@ def test_methods_safe_without_tk_window():bar.stop_mouth_animation()bar.set_on_mute_toggle(lambda: None)+ bar.set_on_prompt_mode_toggle(lambda: None)bar.set_on_talk(lambda: None)bar.set_on_hangup(lambda: None)bar.set_feedback_publisher(lambda k, d: None)diff --git a/ui/orb/bus_bridge.py b/ui/orb/bus_bridge.pyindex 5b906f96f9..bb9cb30359 100644--- a/ui/orb/bus_bridge.py+++ b/ui/orb/bus_bridge.py@@ -38,6 +38,8 @@ from typing import TYPE_CHECKING, Anyfrom jarvis.core.events import (AudioOutFirst,DictationCompleted,+ DictationPromptModeChanged,+ DictationPromptModeToggleRequested,DictationRefused,DictationStarted,DictationTranscribing,@@ -393,6 +395,9 @@ class OrbBusBridge:# with the real state — defensive getattr keeps surfaces without the# method (the mascot orb) working unchanged.self._bus.subscribe(VoiceMuteChanged, self._on_voice_mute_changed)+ # Same shape for the Prompt Mode switch: one writer (the switch+ # module), one broadcast, and the bar's sparkle mirrors it.+ self._bus.subscribe(DictationPromptModeChanged, self._on_prompt_mode_changed)# ADR-0016 L2 — voice-driven recovery from "orb lost on screen".# The local_action_gate publishes OrbResetRequested when the# user says "Orb zurück" / "wo bist du" / "reset orb". # i18n-allow@@ -409,6 +414,12 @@ class OrbBusBridge:setter = getattr(self._orb, "set_on_mute_toggle", None)if setter is not None:setter(self._publish_mute_toggle)+ # The bar's sparkle asks for [dictation].prompt_mode to flip. Same+ # Tk→asyncio marshal as the mute toggle; the pipeline owns the flip.+ prompt_setter = getattr(self._orb, "set_on_prompt_mode_toggle", None)+ if prompt_setter is not None:+ prompt_setter(self._publish_prompt_mode_toggle)+ self._seed_prompt_mode()# ADR-0016 visible-feedback contract: inject the publisher so# the orb stays bus-agnostic. Defensive getattr keeps older# orb test doubles working.@@ -484,6 +495,47 @@ class OrbBusBridge:except Exception: # noqa: BLE001 — a mirror update must never break the buslog.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+ ``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))+ except Exception: # noqa: BLE001 — a mirror update must never break the bus+ log.debug("surface set_prompt_mode failed", exc_info=True)++ def _seed_prompt_mode(self) -> None:+ """Push the current ``[dictation].prompt_mode`` onto the surface.++ Mute starts false; Prompt Mode starts wherever the user left it, and+ the live value sits on the pipeline's dictation config. Before the+ pipeline is registered there is nothing to read and the surface keeps+ its default (off) until the voice-ready signal runs this again.+ """+ setter = getattr(self._orb, "set_prompt_mode", None)+ if not callable(setter):+ return+ try:+ from jarvis.core.runtime_refs import get_speech_pipeline+ from jarvis.dictation.prompt_mode import prompt_mode_enabled++ pipeline = get_speech_pipeline()+ if pipeline is None:+ return+ setter(prompt_mode_enabled(getattr(pipeline, "_dictation_cfg", None)))+ except Exception: # noqa: BLE001 — a seed must never break the bridge+ log.debug("prompt mode seed onto the surface failed", exc_info=True)++ def _publish_prompt_mode_toggle(self) -> None:+ """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")+def _publish_visible_feedback(self, mode: str, observed: dict) -> None:"""Called from the orb's Tk thread after a deiconify. Builds andpublishes ``UserVisibleFeedback`` onto the asyncio bus.@@ -713,6 +765,9 @@ class OrbBusBridge:if not event.voice_usable:returnself._voice_usable = True+ # The pipeline is registered by now, so the bar can learn where the+ # user left the Prompt Mode switch (attach() may have run too early).+ self._seed_prompt_mode()self._release_bar_startup_gate(event.detail or "voice-ready")def _release_bar_startup_gate(self, reason: str) -> None: