Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(screen-context): looking at the screen must never start Computer-Use
Ruben Lütke4e65d2fb180b
diff --git a/docs/screen-context.md b/docs/screen-context.mdindex 1492295719..5255780056 100644--- a/docs/screen-context.md+++ b/docs/screen-context.md@@ -224,6 +224,33 @@ window", "edge case") read as commands. Screen Context reuses that maskingapproach before matching, and adds its own: "see" in "I see" / "you see" /"let's see", "look" in "look into it" / "look for", "schauen wir mal", "a ver".+### 3.1a Looking is not operating — the Computer-Use boundary (BINDING)++Maintainer mandate 2026-08-02, after Computer-Use answered "what is on my+screen?" by taking over the desktop. **A question about the screen is answered+with one screenshot. Computer-Use runs only when an action is asked for.** The+two paths are enforced apart in three places, and all three are load-bearing:++1. **`intent.requests_screen_operation`** — a turn that asks for an on-screen+ action ("click the button on my screen") is *not* a look request, so Screen+ Context stands down and leaves the tools the user asked for in place.+2. **`jarvis/brain/cu_gate.py`** — the mirror image. Its vocabulary is split+ into ACTION verbs and SURFACE nouns, because a noun names *where*, not *what+ to do*. A turn this module reads as a look request cannot start a desktop+ mission even when it names a surface, and even inside the recent-run+ follow-up window. Before the split, the bare noun "Bildschirm" was itself+ sufficient authority — which is how a question moved the user's mouse.+3. **`BrainManager.generate`** — a successful capture strips every tool from+ the turn, so the two paths can never both run for one utterance.++Two consequences worth stating, because both were regressions waiting to+happen. A screenshot request ("mach mal einen Screenshot") is the *least*+ambiguous look request there is: it must classify as `SCREEN`, and the German+pattern that missed the most common spoken phrasing of it is exactly why the+turn used to reach Computer-Use. And naming the harness ("mit Computer-Use ...")+is the strongest desktop signal there is: it stands Screen Context down and+passes the gate unconditionally.+### 3.2 TargetingThe requirement is explicit and it differs from every existing capture path in@@ -419,15 +446,23 @@ exclusion has the same blank/unblank correctness backstop as the other OSes.**Done when:** every capture is preceded by a visible indicator on all threeOSes, or by a logged degradation naming why it could not be shown.-### Wave 4 — settings surface ✅ *implemented*--A Screen Context group in Settings exposes the master switch, structured-end-to-end readiness (capture, permission, indicator, vision, accessibility,-and OCR),-denylist and redaction-pattern editors, default-rule and OCR toggles, retention-promise, an immediate discard action, and a one-capture test that deletes its-own handle without returning pixels. The REST surface also exposes TTL and-text-budget settings. Multi-field changes use one atomic config replacement.+### Wave 4 — settings surface ✅ *implemented, simplified 2026-08-02*++**One switch, and nothing else** (maintainer mandate 2026-08-02). The Settings+card shows the master switch plus one honest readiness line — "Ready on N+monitor(s)", or the first real blocker while the feature is on. That is the+whole card.++Everything it used to expose — denylist editor, extra redaction patterns, the+default-rule and OCR toggles, the retention field, the readiness grid, and the+Save / Test / Discard buttons — is gone from the UI, not from the product. The+privacy rules still run at their shipped defaults on every capture (default+patterns on, monitor-wide denylist check, 120 s TTL, nothing on disk), and every+key remains readable and writable through the REST surface and therefore through+`jarvis api screen-context get-settings|put-settings`. A settings card that asks+a non-technical user to write regular expressions before a feature works is a+card they switch off instead of using; the CLI-first contract (CLAUDE.md §5) is+what makes hiding it safe rather than lossy.### Wave 5 — OCR supplement ✅ *implemented*diff --git a/jarvis/brain/cu_gate.py b/jarvis/brain/cu_gate.pyindex 02b3ccc81d..92817fd982 100644--- a/jarvis/brain/cu_gate.py+++ b/jarvis/brain/cu_gate.py@@ -25,6 +25,19 @@ LLM-initiated ``computer_use`` call executes ONLY when one of these holds:follow-ups alive ("try again", "do it in my Chrome browser" — the latteralso matches rule 1) without letting a cold research question start one.+**Looking is not operating (maintainer mandate 2026-08-02).** A surface NOUN is+not a command: "what is on my screen?" names the screen without asking for+anything to be done to it, and it used to pass rule 1 on the bare noun alone —+so a question that Screen Context answers with one screenshot instead started a+desktop mission that moved the user's mouse. The vocabulary is therefore split+into ACTION verbs and SURFACE nouns, and a turn that+``jarvis.screen_context.intent`` reads as a look request is refused even when it+names a surface and even inside a live desktop episode. Only an action verb, an+explicitly named Computer-Use, or a surface noun in a turn that is NOT a look+request may still drive the desktop. This gate is the enforcement half; the+other half is that a successful Screen Context capture strips every tool from+the turn (``BrainManager.generate``), so the two paths can never both run.+Everything else is blocked and fed back to the model as a tool error tellingit to answer inline (or via ``search_web`` for fresh facts). Over-ALLOWING issafe by construction — a match only means the MODEL MAY drive the desktop, it@@ -98,6 +111,11 @@ _PRODUCT_NAME_NOISE_RE: re.Pattern[str] = re.compile(# Explicit desktop-vehicle vocabulary (DE/EN/ES) — speech-input matching data.#+# Split into ACTION verbs and SURFACE nouns because the two carry different+# authority: a verb asks for something to be DONE, a noun only names where. A+# noun alone used to be enough, which is how "what is on my screen?" started a+# desktop mission (see the module docstring).+## Deliberate exclusions (each one is a live trap):# * bare "start": the incident utterance itself contains the German NOUN# "Start- und Landebahn" (runway) — # i18n-allow: names the German noun under exclusion@@ -109,7 +127,7 @@ _PRODUCT_NAME_NOISE_RE: re.Pattern[str] = re.compile(# * bare "open\w*": it swallowed every "Open…" product name as an open-verb# (see _PRODUCT_NAME_NOISE_RE). Pinned to the real English conjugations,# exactly like ``_OPEN_VERB_RE`` in jarvis/brain/local_action_gate.py.-_DESKTOP_VEHICLE_RE: re.Pattern[str] = re.compile(+_DESKTOP_ACTION_RE: re.Pattern[str] = re.compile(r"(?:"# --- action verbs (en) ---r"\bopen(?:s|ed|ing)?\b|\blaunch\w*\b|\bclick\w*\b|\bdouble-?click\w*\b|\btap\b"@@ -131,8 +149,24 @@ _DESKTOP_VEHICLE_RE: re.Pattern[str] = re.compile(r"|\babr(?:e|a|as|ir)\b|\bcli(?:c|ca|quea)\b|\bpincha\w*|\bpulsa\w*"r"|\btecle\w*|\bdesplaz\w*|\barrastr\w*|\bpega\b|\bcierr\w*|\bnaveg\w*"r"|\bactualiz\w*|\brecarg\w*"+ r")",+ re.IGNORECASE,+)++# Naming the harness itself is the strongest possible desktop signal — the+# maintainer mandate is "Computer-Use only when Computer-Use is asked for", and+# this is that ask, spelled out. Mirrors ``_EXPLICIT_COMPUTER_USE_RE`` in+# jarvis/screen_context/intent.py, which stands Screen Context down for the+# same phrases.+_EXPLICIT_HARNESS_RE: re.Pattern[str] = re.compile(+ r"\bcomputer[-\s]?use\b",+ re.IGNORECASE,+)++_DESKTOP_SURFACE_RE: re.Pattern[str] = re.compile(+ r"(?:"# --- screen/app/browser nouns (en/de/es share most brand tokens) ---- r"|\bscreen\w*|\bdesktop\b|\bbrowser\w*|\bchrome\b|\bsafari\b"+ r"\bscreen\w*|\bdesktop\b|\bbrowser\w*|\bchrome\b|\bsafari\b"r"|\bfirefox\b|\bedge\b|\btabs?\b|\bwindows?\b|\bmouse\b|\bcursor\w*"r"|\bkeyboard\b|\bterminal\w*|\bapps?\b|\bapplications?\b"r"|\bprogram(?:me?s?)?\b|\bwebsites?\b|\bwebpages?\b|\burls?\b"@@ -162,11 +196,50 @@ def _normalized(text: str) -> str:return _PRODUCT_NAME_NOISE_RE.sub(" ", folded)+def _is_look_request(user_text: str) -> bool:+ """Whether this turn asks Jarvis to LOOK at the screen rather than use it.++ Delegated to ``jarvis.screen_context.intent`` instead of re-derived here,+ for the same reason the turn planner delegates it: two vocabularies for one+ question drift apart, and the half that drifts decides whether the user's+ mouse starts moving. That module is pure regex over the utterance — no IO,+ no model call — so it keeps this gate's promise on the voice hot path.++ A classifier defect must not brick desktop automation, so a raised+ exception answers "not a look request" and leaves the old behaviour intact.+ """+ try:+ from jarvis.screen_context.intent import ( # noqa: PLC0415+ classify,+ requests_screen_operation,+ )+ from jarvis.screen_context.models import VisualIntent # noqa: PLC0415++ if requests_screen_operation(user_text):+ return False+ return classify(user_text).intent is not VisualIntent.NONE+ except Exception: # noqa: BLE001 — the gate must never crash a tool turn+ log.warning(+ "cu_gate: visual-intent probe failed — treating the turn as a "+ "non-look turn",+ exc_info=True,+ )+ return False++def llm_computer_use_allowed(user_text: str) -> bool:"""May an LLM-chosen ``computer_use`` call execute for this user turn?- True when the turn names the desktop vehicle, or when the conversation is- still inside a recent desktop episode (BUG-105 corrective follow-ups).+ True when the turn asks for an on-screen ACTION, names the Computer-Use+ harness itself, names a desktop surface without asking to look at it, or+ when the conversation is still inside a recent desktop episode (BUG-105+ corrective follow-ups).++ False for a look request ("what is on my screen?", "read this window to+ me") even when it names a surface and even inside a live desktop episode.+ Answering a question by driving the desktop is the defect this rule exists+ for; Screen Context answers those turns with one short-lived screenshot.+An EMPTY turn fails OPEN: this gate exists to stop question-shaped voiceturns from hijacking the screen, and non-conversational launch routes(scheduled missions, REST) may reach the loop without a user utterance —@@ -175,7 +248,19 @@ def llm_computer_use_allowed(user_text: str) -> bool:normalized = _normalized(user_text).strip()if not normalized:return True- if _DESKTOP_VEHICLE_RE.search(normalized):+ if _DESKTOP_ACTION_RE.search(normalized) or _EXPLICIT_HARNESS_RE.search(+ normalized+ ):+ return True+ # Checked before the surface nouns AND before the recent-run window: a+ # question about the screen stays a question, whatever else is going on.+ if _is_look_request(user_text):+ log.info(+ "cu_gate: blocked computer_use — this turn asks to LOOK at the "+ "screen, not to operate it"+ )+ return False+ if _DESKTOP_SURFACE_RE.search(normalized):return Truetry:from jarvis.harness.cu_run_registry import has_recent_run # noqa: PLC0415diff --git a/jarvis/screen_context/intent.py b/jarvis/screen_context/intent.pyindex 3ba7c7cb00..f427791336 100644--- a/jarvis/screen_context/intent.py+++ b/jarvis/screen_context/intent.py@@ -166,6 +166,19 @@ _WINDOW_SCOPE_RE: re.Pattern[str] = re.compile(# Level 2 — screen-scoped, unambiguous# --------------------------------------------------------------------------+# Spoken language puts articles, politeness and timing particles between a verb+# and its object ("mach MIR MAL EBEN EINEN Screenshot", "take A QUICK+# screenshot"). An enumerated filler list cannot keep up with that and the+# German pattern proved it: its single ``bitte`` slot missed the most common+# spoken phrasing of all ("mach mal einen Screenshot"), the turn classified as+# NONE, and Computer-Use picked it up and drove the desktop instead (BUG-124).+#+# A bounded any-token gap is the fix, not a longer word list. It is short+# enough that the verb and the noun still belong to one clause, and it stops at+# sentence punctuation so a verb in one sentence cannot bind a noun in the+# next. Same shape the German ``pruef``/``bildschirm`` rule below already uses.+_NEAR = r"[^.?!]{0,24}?"+_SCREEN_INTENT_RE: re.Pattern[str] = re.compile(r"(?:"# ---------------- English ----------------@@ -185,8 +198,15 @@ _SCREEN_INTENT_RE: re.Pattern[str] = re.compile(r"(?:screenshot|screen\s+capture)\b"r"|\b(?:inspect|review|analy[sz]e)\s+(?:this|that|the\s+current)\s+"r"(?:window|screen|monitor|dialog|tab)\b"- r"|\b(?:take|make|capture|grab)\s+(?:a\s+)?screen(?:shot|\s+capture)\b"+ # A screenshot request names the feature outright — the least ambiguous+ # sentence there is. Spoken language puts fillers between the verb and the+ # noun ("take a quick screenshot for me"), and the earlier tight pattern+ # missed every one of them; the turn then fell through to Computer-Use,+ # which drove the desktop instead of taking one picture (BUG-124).+ rf"|\b(?:take|make|capture|grab|get)\b{_NEAR}"+ r"\bscreen(?:shot|\s+capture)\b"r"|\bscreen(?:shot|\s+capture)\s+(?:this|that|my\s+screen|the\s+screen)\b"+ r"|\bscreen(?:shot|\s+capture)\s+(?:please|for\s+me)\b"r"|\b(?:this|that)\s+(?:error|error\s+message|message|button|menu|popup)\b"# read-out requestsr"|\bwhat\s+does\s+(?:it|this|that|the\s+\w+)\s+say\b"@@ -209,12 +229,21 @@ _SCREEN_INTENT_RE: re.Pattern[str] = re.compile(r"(?:anschauen|ansehen|pruefen)\b"r"|\bsiehst\s+du\s+(?:das|dies|meinen\s+bildschirm|den\s+fehler)\b" # i18n-allow: DE inputr"|\bwas\s+siehst\s+du\b"- # screen nouns- r"|\bauf\s+(?:dem|meinem)\s+bildschirm\b|\bam\s+bildschirm\b|\bmein\s+bildschirm\b"- r"|\bauf\s+(?:dem|meinem|diesem)\s+monitor\b|\bmein\s+monitor\b"+ # Screen nouns in every case German inflects them into. The earlier list+ # spelled out the dative only, so the natural spoken accusative ("schau mal+ # auf meinEN Bildschirm") classified as NONE and the turn fell through to+ # Computer-Use (BUG-124). Inflection is matching data, not prose.+ # i18n-allow: German speech-input matching data+ r"|\b(?:auf|an|in)\s+(?:dem|den|meinem|meinen|deinem|deinen|diesem|diesen)" # i18n-allow: DE input+ r"\s+(?:bildschirm|monitor)\b"+ r"|\bam\s+(?:bildschirm|monitor)\b"+ r"|\bmein(?:en|em)?\s+(?:bildschirm|monitor)\b"# i18n-allow: German speech-input matching data- r"|\b(?:mach|mache|erstelle|nimm)\s+(?:bitte\s+)?(?:einen\s+)?screenshot\b"- r"|\bbildschirmfoto\s+(?:machen|aufnehmen|erstellen)\b" # i18n-allow: DE input+ r"|\b(?:mach|mache|machst|erstell|erstelle|erstellst|nimm|schiess|schiesse)"+ rf"\b{_NEAR}"+ r"\b(?:screenshot|bildschirmfoto|bildschirmaufnahme)\b" # i18n-allow: DE input+ r"|\b(?:screenshot|bildschirmfoto|bildschirmaufnahme)\s+"+ r"(?:machen|aufnehmen|erstellen|bitte)\b" # i18n-allow: DE inputr"|\bauf\s+dem\s+schirm\b|\bhier\s+auf\s+dem\b" # i18n-allow: DE inputr"|\b(?:diese|die)\s+fehlermeldung\b" # i18n-allow: DE inputr"|\b(?:dieser|der)\s+fehler\s+(?:hier|da)\b" # i18n-allow: DE input@@ -237,7 +266,8 @@ _SCREEN_INTENT_RE: re.Pattern[str] = re.compile(r"|\bves\s+(?:esto|eso|mi\s+pantalla)\b|\bque\s+ves\b"r"|\bque\s+ves\s+en\s+mi\s+(?:pantalla|monitor)\b"r"|\ben\s+(?:mi|la)\s+pantalla\b|\bmi\s+pantalla\b"- r"|\b(?:haz|toma|captura)\s+(?:una\s+)?captura\s+de\s+pantalla\b"+ rf"|\b(?:haz|hazme|toma|tomame|captura|saca)\b{_NEAR}"+ r"\bcaptura\s+de\s+pantalla\b"r"|\banaliza\s+(?:esta\s+|esa\s+|la\s+)?captura\s+de\s+pantalla\b"r"|\bque\s+dice\s+(?:ahi|aqui|esto|eso)\b"r"|\blee\s+(?:esto|eso|el\s+\w+)\b"diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 2c7d75921d..895697f4fc 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -1379,31 +1379,10 @@},"screen_context": {"title": "Bildschirmkontext",- "description": "Erlaubt {name}, genau einen aktuellen Screenshot als Kontext zu verwenden, wenn du ausdrücklich darum bittest. Vorher erscheint ein sichtbarer Rand; das Bild wird in diesem Turn verbraucht und danach gelöscht.",+ "description": "Wenn du nach deinem Bildschirm fragst, macht {name} genau einen Screenshot, beantwortet damit diesen einen Turn und löscht ihn. Vorher erscheint ein sichtbarer Rand. Dein Gerät wird dabei nie gesteuert — das bleibt Computer-Use vorbehalten, das nur läuft, wenn du eine Aktion verlangst.","available": "Auf {0} Monitor(en) bereit.","unavailable": "Die Bildschirmaufnahme ist nicht verfügbar. Prüfe die Systemberechtigung und Desktop-Sitzung; Headless- und Wayland-Systeme werden sicher eingeschränkt.",- "denylist": "Diese Apps oder Fenstertitel nie aufnehmen (ein Eintrag pro Zeile)",- "denylist_placeholder": "Passwortmanager\nPrivates Banking",- "patterns": "Zusätzliche sensible Muster (Bezeichnung:regulärer Ausdruck)",- "patterns_placeholder": "kunden_id:KUNDE-[0-9]+",- "default_patterns": "Erkennbare Passwortfelder sowie passende Karten-, Token-, Schlüssel- und Geheimtexte schwärzen",- "ocr": "Optionale Texterkennung für Pixelschwärzung und fehlenden Bedienungshilfen-Text verwenden",- "capture_status": "Aufnahme-Backend",- "indicator_status": "Sichtbarer Rand",- "vision_status": "Vision-Modell",- "accessibility_status": "Bedienungshilfen-Text",- "ocr_status": "Optionale Texterkennung",- "placeholders_are_examples": "Der Text im leeren Feld ist nur ein Beispiel und keine aktive Datenschutzregel.",- "retention_label": "Aufbewahrung (Sekunden, 1–600)",- "save_privacy": "Datenschutzregeln speichern",- "discard": "Gespeicherte Aufnahmen jetzt verwerfen",- "test_capture": "Eine Aufnahme testen",- "test_success": "Aufnahmetest bestanden und sofort gelöscht: {0}",- "test_failed": "Der Aufnahmetest konnte nicht abgeschlossen werden.",- "held": "Derzeit gespeichert: {0}.",- "retention": "Aufnahmen aus Unterhaltungen werden sofort verbraucht. Eine ungenutzte API-Aufnahme wird nach {0} Sekunden gelöscht. Es wird nichts auf die Festplatte geschrieben.","saved": "Einstellungen für den Bildschirmkontext gespeichert.",- "discarded": "Alle gespeicherten Bildschirmaufnahmen wurden verworfen.","capturing": "Der Bildschirmkontext betrachtet die angeforderte Oberfläche.","completed": "Bildschirm aufgenommen: {0}×{1}, {2} Schwärzung(en)."},diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex a7530608fb..94026b7521 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -1380,31 +1380,10 @@},"screen_context": {"title": "Screen Context",- "description": "Lets {name} use one current screenshot as context only when you explicitly ask. A visible border appears first; the image is consumed by that turn and then deleted.",+ "description": "When you ask about your screen, {name} takes one screenshot, answers that turn with it, and deletes it. A visible border appears first. It never operates your desktop — that stays with Computer-Use, which only runs when you ask for an action.","available": "Ready on {0} monitor(s).","unavailable": "Screen capture is unavailable. Check the system permission and desktop session; headless and Wayland systems degrade safely.",- "denylist": "Never capture these apps or window titles (one per line)",- "denylist_placeholder": "Password Manager\nPrivate Banking",- "patterns": "Additional sensitive patterns (label:regular expression)",- "patterns_placeholder": "customer_id:CUST-[0-9]+",- "default_patterns": "Redact detectable password fields and matching card, token, key, and secret text",- "ocr": "Use optional OCR for pixel redaction and missing accessibility text",- "capture_status": "Capture backend",- "indicator_status": "Visible border",- "vision_status": "Vision model",- "accessibility_status": "Accessibility text",- "ocr_status": "Optional OCR",- "placeholders_are_examples": "The text shown in the empty field is only an example; it is not an active privacy rule.",- "retention_label": "Retention (seconds, 1–600)",- "save_privacy": "Save privacy rules",- "discard": "Discard held captures now",- "test_capture": "Test one capture",- "test_success": "Capture test passed and was deleted immediately: {0}",- "test_failed": "The capture test did not complete.",- "held": "Currently held: {0}.",- "retention": "Conversation captures are consumed immediately. An unused API capture is deleted after {0} seconds. Nothing is written to disk.","saved": "Screen Context settings saved.",- "discarded": "All held screen captures were discarded.","capturing": "Screen Context is looking at the requested surface.","completed": "Screen captured: {0}×{1}, {2} redaction(s)."},diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex b758885d9a..78ca0f7d5a 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -1379,31 +1379,10 @@},"screen_context": {"title": "Contexto de pantalla",- "description": "Permite que {name} use una captura actual como contexto solo cuando lo pides de forma explícita. Primero aparece un borde visible; la imagen se consume en ese turno y después se elimina.",+ "description": "Cuando preguntas por tu pantalla, {name} toma una captura, responde ese turno con ella y la elimina. Antes aparece un borde visible. Nunca maneja tu escritorio: eso es cosa de Computer-Use, que solo se ejecuta cuando pides una acción.","available": "Listo en {0} monitor(es).","unavailable": "La captura de pantalla no está disponible. Comprueba el permiso del sistema y la sesión de escritorio; los sistemas sin pantalla y Wayland se limitan de forma segura.",- "denylist": "No capturar nunca estas apps o títulos de ventana (uno por línea)",- "denylist_placeholder": "Gestor de contraseñas\nBanca privada",- "patterns": "Patrones sensibles adicionales (etiqueta:expresión regular)",- "patterns_placeholder": "id_cliente:CLIENTE-[0-9]+",- "default_patterns": "Ocultar campos de contraseña detectables y texto coincidente de tarjetas, tokens, claves y secretos",- "ocr": "Usar OCR opcional para ocultar píxeles y completar texto de accesibilidad",- "capture_status": "Sistema de captura",- "indicator_status": "Borde visible",- "vision_status": "Modelo de visión",- "accessibility_status": "Texto de accesibilidad",- "ocr_status": "OCR opcional",- "placeholders_are_examples": "El texto del campo vacío es solo un ejemplo y no una regla de privacidad activa.",- "retention_label": "Retención (segundos, 1–600)",- "save_privacy": "Guardar reglas de privacidad",- "discard": "Descartar capturas retenidas ahora",- "test_capture": "Probar una captura",- "test_success": "La prueba de captura terminó correctamente y se eliminó de inmediato: {0}",- "test_failed": "La prueba de captura no pudo completarse.",- "held": "Retenidas ahora: {0}.",- "retention": "Las capturas de conversación se consumen de inmediato. Una captura de API sin usar se elimina tras {0} segundos. No se escribe nada en disco.","saved": "Ajustes de contexto de pantalla guardados.",- "discarded": "Se descartaron todas las capturas retenidas.","capturing": "El contexto de pantalla está revisando la superficie solicitada.","completed": "Pantalla capturada: {0}×{1}, {2} ocultación(es)."},diff --git a/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.test.tsx b/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.test.tsxindex c9e97e3c43..25d018b5cd 100644--- a/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.test.tsx+++ b/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.test.tsx@@ -3,37 +3,24 @@ import { afterEach, describe, expect, it, vi } from "vitest";import { ScreenContextGroup } from "./ScreenContextGroup";-const SETTINGS = {- enabled: true,- denylist: [],- sensitive_patterns: [],- include_default_patterns: true,- max_text_chars: 4000,- ttl_s: 120,- ocr_enabled: false,-};+/**+ * Screen Context is a ONE-SWITCH card (maintainer mandate 2026-08-02). These+ * tests pin that contract from the outside: the only control is the switch, a+ * blocker is reported honestly while the feature is on, and nothing on the card+ * asks the user to write privacy rules by hand.+ */-function status(available: boolean) {+const SETTINGS = { enabled: true };++function status(available: boolean, enabled = true) {return {- enabled: true,+ enabled,available,blocked_reason: available ? null : "No vision-capable provider is configured.",blocked_reasons: available? []: ["No vision-capable provider is configured."],monitor_count: 2,- held_captures: 0,- ttl_s: 120,- components: {- capture: { ready: true, detail: "" },- indicator: { ready: true, detail: "" },- vision: {- ready: available,- detail: available ? "" : "No vision-capable provider is configured.",- },- accessibility: { ready: true, detail: "" },- ocr: { enabled: false, ready: false, detail: "Optional OCR is switched off." },- },};}@@ -44,7 +31,7 @@ function response(body: unknown) {afterEach(() => vi.restoreAllMocks());describe("ScreenContextGroup", () => {- it("shows the real blocker and labels empty-field text as examples", async () => {+ it("reports the real blocker while the feature is switched on", async () => {vi.stubGlobal("fetch",vi.fn(async (url: string) =>@@ -59,39 +46,55 @@ describe("ScreenContextGroup", () => {screen.getByText("No vision-capable provider is configured."),).toBeTruthy(),);- expect(screen.getAllByText(/only an example/i)).toHaveLength(2);- expect(screen.getByText("Test one capture").closest("button")?.disabled).toBe(- true,+ });++ it("offers exactly one control and no privacy-rule editors", async () => {+ vi.stubGlobal(+ "fetch",+ vi.fn(async (url: string) =>+ response(url.endsWith("/settings") ? SETTINGS : status(true)),+ ),);++ const { container } = render(<ScreenContextGroup />);++ await waitFor(() => expect(screen.getByText(/Ready on 2/)).toBeTruthy());+ expect(container.querySelectorAll("textarea")).toHaveLength(0);+ expect(container.querySelectorAll("input")).toHaveLength(0);+ // The old card shipped Save / Test / Discard buttons plus three more+ // switches next to this one.+ const buttons = Array.from(container.querySelectorAll("button"));+ expect(buttons).toHaveLength(1);+ expect(buttons[0].getAttribute("role")).toBe("switch");});- it("tests one capture and deletes only that handle", async () => {+ it("writes only the enabled flag when the switch is flipped", async () => {const fetchMock = vi.fn(async (url: string, init?: RequestInit) => {+ if (url.endsWith("/settings") && init?.method === "PUT") {+ return response({ ok: true, changed: ["enabled"] });+ }if (url.endsWith("/settings")) return response(SETTINGS);if (url.endsWith("/status")) return response(status(true));- if (url.endsWith("/capture") && init?.method === "POST") {- return response({- status: "captured",- id: "one-shot-handle",- receipt: "monitor primary",- });- }- if (url.endsWith("/one-shot-handle") && init?.method === "DELETE") {- return response({ ok: true, discarded: 1 });- }throw new Error(`Unexpected request: ${url}`);});vi.stubGlobal("fetch", fetchMock);- render(<ScreenContextGroup />);- const button = await waitFor(() => screen.getByText("Test one capture"));- fireEvent.click(button);+ const { container } = render(<ScreenContextGroup />);+ const toggle = await waitFor(() => {+ const found = container.querySelector("button[role=switch]");+ if (!found) throw new Error("switch not rendered yet");+ return found;+ });+ fireEvent.click(toggle);- await waitFor(() =>- expect(fetchMock).toHaveBeenCalledWith(- "/api/screen-context/one-shot-handle",- { method: "DELETE" },- ),- );+ await waitFor(() => {+ const put = fetchMock.mock.calls.find(+ ([, init]) => (init as RequestInit | undefined)?.method === "PUT",+ );+ expect(put).toBeTruthy();+ expect(JSON.parse(String((put?.[1] as RequestInit).body))).toEqual({+ enabled: false,+ });+ });});});diff --git a/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.tsxindex b5db6f44fd..9ad7e6be06 100644--- a/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.tsx+++ b/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.tsx@@ -1,40 +1,27 @@import { useEffect, useState } from "react";-import { Camera, Eye, Loader2, Shield, Trash2 } from "lucide-react";+import { Eye, Loader2 } from "lucide-react";-import { Button } from "@/components/ui/button";import { Switch } from "@/components/ui/switch";import { useT } from "@/i18n";import { useEventStore } from "@/store/events";+/**+ * Screen Context is deliberately a ONE-SWITCH feature (maintainer mandate+ * 2026-08-02). The privacy rules it used to expose here — denylist, extra+ * patterns, OCR, retention seconds — are still enforced at their shipped+ * defaults and remain editable through `jarvis api screen-context put-settings`+ * for anyone who wants them, but a settings card that asks a non-technical user+ * to write regular expressions is a card they switch off instead of using.+ */interface ScreenContextSettings {enabled: boolean;- denylist: string[];- sensitive_patterns: string[];- include_default_patterns: boolean;- max_text_chars: number;- ttl_s: number;- ocr_enabled: boolean;}interface ScreenContextStatus {enabled: boolean;available: boolean;blocked_reason: string | null;- blocked_reasons: string[];monitor_count: number;- held_captures: number;- ttl_s: number;- components: Record<- string,- { ready: boolean; detail: string; enabled?: boolean }- >;-}--interface CaptureTestResult {- status: string;- id?: string;- receipt?: string;- reason?: string;}async function jsonRequest<T>(url: string, init?: RequestInit): Promise<T> {@@ -58,31 +45,14 @@ async function jsonRequest<T>(url: string, init?: RequestInit): Promise<T> {return body as T;}-function lines(value: string): string[] {- return value- .split("\n")- .map((item) => item.trim())- .filter(Boolean);-}-export function ScreenContextGroup() {const t = useT();const pushToast = useEventStore((state) => state.pushToast);const [settings, setSettings] = useState<ScreenContextSettings | null>(null);const [status, setStatus] = useState<ScreenContextStatus | null>(null);- const [denylist, setDenylist] = useState("");- const [patterns, setPatterns] = useState("");- const [ttl, setTtl] = useState("120");const [loading, setLoading] = useState(true);const [saving, setSaving] = useState(false);- async function refreshStatus() {- const nextStatus = await jsonRequest<ScreenContextStatus>(- "/api/screen-context/status",- );- setStatus(nextStatus);- }-useEffect(() => {let active = true;void Promise.all([@@ -93,9 +63,6 @@ export function ScreenContextGroup() {if (!active) return;setSettings(nextSettings);setStatus(nextStatus);- setDenylist(nextSettings.denylist.join("\n"));- setPatterns(nextSettings.sensitive_patterns.join("\n"));- setTtl(String(nextSettings.ttl_s));}).catch((error: Error) => pushToast("error", error.message)).finally(() => {@@ -106,19 +73,18 @@ export function ScreenContextGroup() {};}, [pushToast]);- async function save(patch: Partial<ScreenContextSettings>) {- if (!settings) return;+ async function toggle(enabled: boolean) {setSaving(true);try {await jsonRequest("/api/screen-context/settings", {method: "PUT",headers: { "content-type": "application/json" },- body: JSON.stringify(patch),+ body: JSON.stringify({ enabled }),});- setSettings((current) =>- current === null ? current : { ...current, ...patch },+ setSettings((current) => (current === null ? current : { enabled }));+ setStatus(+ await jsonRequest<ScreenContextStatus>("/api/screen-context/status"),);- await refreshStatus();pushToast("success", t("settings_view.screen_context.saved"));} catch (error) {pushToast("error", (error as Error).message);@@ -127,64 +93,9 @@ export function ScreenContextGroup() {}}- async function discard() {- setSaving(true);- try {- await jsonRequest("/api/screen-context", { method: "DELETE" });- await refreshStatus();- pushToast("success", t("settings_view.screen_context.discarded"));- } catch (error) {- pushToast("error", (error as Error).message);- } finally {- setSaving(false);- }- }-- async function testCapture() {- setSaving(true);- let captureId = "";- try {- const result = await jsonRequest<CaptureTestResult>(- "/api/screen-context/capture",- {- method: "POST",- headers: { "content-type": "application/json" },- body: JSON.stringify({ force: true }),- },- );- captureId = result.id || "";- if (result.status !== "captured" || !captureId) {- throw new Error(- result.reason || t("settings_view.screen_context.test_failed"),- );- }- await jsonRequest(- `/api/screen-context/${encodeURIComponent(captureId)}`,- { method: "DELETE" },- );- captureId = "";- pushToast(- "success",- t("settings_view.screen_context.test_success").replace(- "{0}",- result.receipt || "",- ),- );- await refreshStatus();- } catch (error) {- if (captureId) {- await fetch(`/api/screen-context/${encodeURIComponent(captureId)}`, {- method: "DELETE",- }).catch(() => undefined);- }- pushToast("error", (error as Error).message);- } finally {- setSaving(false);- }- }-- const ttlValue = Number(ttl);- const ttlValid = Number.isFinite(ttlValue) && ttlValue >= 1 && ttlValue <= 600;+ // A blocker is only worth showing while the feature is meant to be running:+ // "switched off" is not a problem to report, it is what the switch says.+ const showBlocker = Boolean(settings?.enabled && status && !status.available);return (<section className="mt-2 max-w-5xl rounded-lg border border-border bg-card/60 p-4">@@ -192,172 +103,37 @@ export function ScreenContextGroup() {<Eye className="mt-0.5 h-4 w-4 shrink-0 text-primary" /><div className="min-w-0 flex-1"><div className="flex items-center justify-between gap-4">- <h4 className="font-medium">{t("settings_view.screen_context.title")}</h4>+ <h4 className="font-medium">+ {t("settings_view.screen_context.title")}+ </h4>{loading || !settings ? (<Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />) : (<Switchchecked={settings.enabled}disabled={saving}- onCheckedChange={(enabled) => void save({ enabled })}+ onCheckedChange={(enabled) => void toggle(enabled)}/>)}</div><p className="mt-1 text-xs text-muted-foreground">{t("settings_view.screen_context.description")}</p>- {status && (- <div className="mt-2" aria-live="polite">- <p- className={`text-[11px] ${- status.available ? "text-emerald-400" : "text-amber-400"- }`}- >- {status.available- ? t("settings_view.screen_context.available").replace(- "{0}",- String(status.monitor_count),- )- : status.blocked_reason ||- t("settings_view.screen_context.unavailable")}- </p>- <div className="mt-2 grid max-w-3xl grid-cols-2 gap-x-5 gap-y-1 text-[11px] sm:grid-cols-3">- {[- ["capture", "capture_status"],- ["indicator", "indicator_status"],- ["vision", "vision_status"],- ["accessibility", "accessibility_status"],- ["ocr", "ocr_status"],- ].map(([name, labelKey]) => {- const component = status.components[name];- const optionalDisabled =- name === "ocr" && component?.enabled === false;- const ready = component?.ready || optionalDisabled;- return (- <span- key={name}- className={ready ? "text-muted-foreground" : "text-amber-400"}- title={component?.detail || ""}- >- {ready ? "✓" : "!"}{" "}- {t(`settings_view.screen_context.${labelKey}`)}- </span>- );- })}- </div>- </div>- )}-- {settings && (- <div className="mt-4 space-y-3 border-t border-border/70 pt-4">- <label className="block text-xs font-medium">- {t("settings_view.screen_context.denylist")}- <textarea- value={denylist}- disabled={saving}- onChange={(event) => setDenylist(event.target.value)}- placeholder={t("settings_view.screen_context.denylist_placeholder")}- className="mt-1.5 min-h-20 w-full resize-y rounded-md border border-border bg-background px-3 py-2 font-mono text-xs"- />- {!denylist.trim() && (- <span className="mt-1 block text-[11px] font-normal text-muted-foreground">- {t("settings_view.screen_context.placeholders_are_examples")}- </span>- )}- </label>- <label className="block text-xs font-medium">- {t("settings_view.screen_context.patterns")}- <textarea- value={patterns}- disabled={saving}- onChange={(event) => setPatterns(event.target.value)}- placeholder={t("settings_view.screen_context.patterns_placeholder")}- className="mt-1.5 min-h-20 w-full resize-y rounded-md border border-border bg-background px-3 py-2 font-mono text-xs"- />- {!patterns.trim() && (- <span className="mt-1 block text-[11px] font-normal text-muted-foreground">- {t("settings_view.screen_context.placeholders_are_examples")}- </span>- )}- </label>- <div className="flex items-center justify-between gap-4 text-xs">- <span>{t("settings_view.screen_context.default_patterns")}</span>- <Switch- checked={settings.include_default_patterns}- disabled={saving}- onCheckedChange={(include_default_patterns) =>- void save({ include_default_patterns })- }- />- </div>- <div className="flex items-center justify-between gap-4 text-xs">- <span>{t("settings_view.screen_context.ocr")}</span>- <Switch- checked={settings.ocr_enabled}- disabled={saving}- onCheckedChange={(ocr_enabled) => void save({ ocr_enabled })}- />- </div>- <label className="flex items-center justify-between gap-4 text-xs">- <span>{t("settings_view.screen_context.retention_label")}</span>- <input- type="number"- min={1}- max={600}- step={1}- value={ttl}- disabled={saving}- onChange={(event) => setTtl(event.target.value)}- className="w-24 rounded-md border border-border bg-background px-3 py-1.5 text-right text-xs"- />- </label>- <div className="flex flex-wrap gap-2">- <Button- size="sm"- disabled={saving || !ttlValid}- onClick={() =>- void save({- denylist: lines(denylist),- sensitive_patterns: lines(patterns),- ttl_s: ttlValue,- })- }- >- <Shield className="mr-1.5 h-3.5 w-3.5" />- {t("settings_view.screen_context.save_privacy")}- </Button>- <Button- size="sm"- variant="outline"- disabled={saving || !status?.available}- onClick={() => void testCapture()}- >- <Camera className="mr-1.5 h-3.5 w-3.5" />- {t("settings_view.screen_context.test_capture")}- </Button>- <Button- size="sm"- variant="outline"- disabled={saving}- onClick={() => void discard()}- >- <Trash2 className="mr-1.5 h-3.5 w-3.5" />- {t("settings_view.screen_context.discard")}- </Button>- </div>- <p className="text-[11px] text-muted-foreground">- {t("settings_view.screen_context.retention").replace(- "{0}",- String(settings.ttl_s),- )}- {status && status.held_captures > 0- ? ` ${t("settings_view.screen_context.held").replace(- "{0}",- String(status.held_captures),- )}`- : ""}- </p>- </div>+ {settings?.enabled && status && (+ <p+ className={`mt-2 text-[11px] ${+ status.available ? "text-emerald-400" : "text-amber-400"+ }`}+ aria-live="polite"+ >+ {showBlocker+ ? status.blocked_reason ||+ t("settings_view.screen_context.unavailable")+ : t("settings_view.screen_context.available").replace(+ "{0}",+ String(status.monitor_count),+ )}+ </p>)}</div></div>diff --git a/tests/unit/brain/test_cu_gate.py b/tests/unit/brain/test_cu_gate.pyindex 75e1104b12..5487263e35 100644--- a/tests/unit/brain/test_cu_gate.py+++ b/tests/unit/brain/test_cu_gate.py@@ -138,6 +138,89 @@ def test_explicit_desktop_ask_allows_computer_use(utterance: str) -> None:assert llm_computer_use_allowed(utterance) is True+# ── looking is not operating (maintainer mandate 2026-08-02, BUG-124) ─────+#+# The user asked "what is on my screen?" and Computer-Use started every time:+# the bare surface noun ("Bildschirm") was enough to pass the gate, so a+# question that Screen Context answers with ONE screenshot instead moved the+# mouse. These pin the split — surface nouns no longer authorize a mission on+# their own when the turn reads as a look request.+++ "utterance",+ [+ # The reported utterance, and its nearest phrasings.+ "Hey, was ist da auf meinem Bildschirm?", # i18n-allow: live utterance+ "Was siehst du auf meinem Bildschirm?", # i18n-allow: DE turn fixture+ "Kannst du mal auf meinen Bildschirm schauen?", # i18n-allow: DE fixture+ "Schau dir das mal an.", # i18n-allow: DE turn fixture+ "Was steht da im Terminal?", # i18n-allow: DE turn fixture+ "Lies mir das Fenster vor.", # i18n-allow: DE turn fixture+ "What is on my screen right now?",+ "Can you see this error on my screen?",+ "Read this window to me.",+ "¿Qué ves en mi pantalla?",+ # A screenshot request names the feature outright — it is the least+ # ambiguous look request there is and must never reach the harness.+ "Mach mal einen Screenshot.", # i18n-allow: DE turn fixture+ "Mach mir mal eben einen Screenshot davon.", # i18n-allow: DE fixture+ "Take a quick screenshot for me.",+ "Hazme una captura de pantalla, por favor.",+ ],+)+def test_look_request_never_drives_the_desktop(utterance: str) -> None:+ assert llm_computer_use_allowed(utterance) is False+++def test_look_request_stays_blocked_inside_a_live_desktop_episode() -> None:+ """A question mid-episode is still a question, not a corrective follow-up.++ The recent-run window exists so "try again" keeps working after a mission.+ It must not re-open the desktop for "what is on my screen?", or every+ conversation that follows a Computer-Use run inherits the original defect.+ """+ look = "Was ist da auf meinem Bildschirm?" # i18n-allow: DE turn fixture+ cu_run_registry.register_run("m3", "open the browser", token=None)+ assert llm_computer_use_allowed(look) is False+ # The vehicle-free corrective follow-up is unaffected by the new rule.+ assert llm_computer_use_allowed("Versuch es nochmal.") is True # i18n-allow+++ "utterance",+ [+ # An action verb wins over the look vocabulary in the same sentence:+ # the user wants something DONE to what they are pointing at.+ "Klick auf den Button auf meinem Bildschirm.", # i18n-allow: DE trigger+ "Schau in Chrome nach und klick auf Anmelden.", # i18n-allow: DE trigger+ "Look at my screen and close that window.",+ # Naming the harness IS the explicit ask the mandate asks for.+ "Mach das per Computer-Use",+ "Use computer use to open Spotify",+ ],+)+def test_explicit_action_outranks_the_look_vocabulary(utterance: str) -> None:+ assert llm_computer_use_allowed(utterance) is True+++def test_visual_intent_probe_failure_keeps_desktop_automation_working() -> None:+ """A classifier defect must degrade to the old behaviour, never brick CU."""+ import jarvis.screen_context.intent as intent_module++ def _boom(*_args: object, **_kwargs: object) -> bool:+ raise RuntimeError("classifier exploded")++ original = intent_module.requests_screen_operation+ intent_module.requests_screen_operation = _boom # type: ignore[assignment]+ try:+ # The probe is what is under test; the turn is only its input.+ look = "Was ist auf meinem Bildschirm?" # i18n-allow: DE turn fixture+ assert llm_computer_use_allowed(look) is True+ finally:+ intent_module.requests_screen_operation = original # type: ignore[assignment]++# ── BUG-105 corrective follow-ups inside a desktop episode ────────────────