Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(cu): add opt-in zoom_before_click config+context flag (plumbing)

Ruben Lütke7b19ec2132d1
diff --git a/jarvis/brain/factory.py b/jarvis/brain/factory.py
index 2543f93110..8f2fc52d0d 100644
--- a/jarvis/brain/factory.py
+++ b/jarvis/brain/factory.py
@@ -1000,6 +1000,7 @@ def _phase2_full_brain(
fast_step_model=getattr(cu_cfg, "fast_step_model", ""),
plan_model_override=cu_cfg.plan_model,
verify_after_each_step=cu_cfg.verify_after_each_step,
+ zoom_before_click=getattr(cu_cfg, "zoom_before_click", False),
max_replans=cu_cfg.max_replans,
announce_progress=getattr(cu_cfg, "announce_progress", False),
native_cu=native_cu,
diff --git a/jarvis/core/config.py b/jarvis/core/config.py
index 6a1bd466fb..8955faf408 100644
--- a/jarvis/core/config.py
+++ b/jarvis/core/config.py
@@ -1379,6 +1379,15 @@ class ComputerUseConfig(BaseModel):
# screenshot_only_loop.py).
fast_step_model: str = Field(default="")
verify_after_each_step: bool = True
+ # Proactively zoom-refine each click target BEFORE clicking (default OFF).
+ # When on AND the click action carries a `target`, the loop grabs a live
+ # zoomed crop around the coarse point, re-locates the target inside it, and
+ # only then clicks — and REFUSES to click (re-plans) when the target is not
+ # in the crop, catching wrong-element clicks the pixel-diff verify accepts.
+ # Internal screenshot crop only: nothing is shown on screen. Costs one extra
+ # model call per targeted click, so it stays opt-in to protect the default
+ # latency profile.
+ zoom_before_click: bool = False
# Spoken per-step milestones ("Schritt N von M erledigt."). Default OFF
# (2026-06-10): the milestone counter tracks successful actions, not
# verified plan steps, so it announced "6 von 6 erledigt" on a mission
diff --git a/jarvis/harness/computer_use_context.py b/jarvis/harness/computer_use_context.py
index 797b094420..ed32517675 100644
--- a/jarvis/harness/computer_use_context.py
+++ b/jarvis/harness/computer_use_context.py
@@ -46,6 +46,10 @@ class ComputerUseContext:
fast_step_model: str = "" # L9: cheaper model id for trivial steps ("" = off)
plan_model_override: str | None = None
verify_after_each_step: bool = True
+ # Proactive zoom-before-click (opt-in, default OFF). See
+ # ComputerUseConfig.zoom_before_click. Internal screenshot crop only —
+ # nothing renders on screen.
+ zoom_before_click: bool = False
max_replans: int = 2 # from ADR-0008; configurable
# Spoken per-step milestones ("Schritt N von M erledigt."). OFF by default
# (2026-06-10): the counter counts successful ACTIONS, not verified plan
@@ -174,6 +178,7 @@ _RELOADABLE_FIELDS: tuple[str, ...] = (
"fast_step_model",
"max_replans",
"verify_after_each_step",
+ "zoom_before_click",
"announce_progress",
)
_subscribed_bus_id: int | None = None
diff --git a/tests/unit/harness/test_cu_zoom_before_click_config.py b/tests/unit/harness/test_cu_zoom_before_click_config.py
new file mode 100644
index 0000000000..f03ef342f5
--- /dev/null
+++ b/tests/unit/harness/test_cu_zoom_before_click_config.py
@@ -0,0 +1,29 @@
+"""Plumbing tests for the opt-in [computer_use].zoom_before_click flag."""
+from __future__ import annotations
+
+from jarvis.core.config import ComputerUseConfig
+from jarvis.harness.computer_use_context import (
+ ComputerUseContext,
+ _RELOADABLE_FIELDS,
+)
+
+
+def test_config_zoom_before_click_defaults_off() -> None:
+ assert ComputerUseConfig().zoom_before_click is False
+
+
+def test_config_zoom_before_click_parses_true() -> None:
+ assert ComputerUseConfig(zoom_before_click=True).zoom_before_click is True
+
+
+def test_context_zoom_before_click_defaults_off() -> None:
+ ctx = ComputerUseContext(
+ vision_engine=None, brain_manager=None, tool_executor=None,
+ )
+ assert ctx.zoom_before_click is False
+
+
+def test_zoom_before_click_is_hot_reloadable() -> None:
+ # Listed in _RELOADABLE_FIELDS so a voice / Self-Mod toggle applies to the
+ # next mission without an app restart (mirrors verify_after_each_step).
+ assert "zoom_before_click" in _RELOADABLE_FIELDS