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.

chore: auto-save WIP via Claude stop-hook safety net (2026-07-06 18:21)

Ruben Lütke3694b25f97dd
diff --git a/docs/superpowers/plans/2026-07-06-onboarding-install-redesign.md b/docs/superpowers/plans/2026-07-06-onboarding-install-redesign.md
index e669176158..855d4666ed 100644
--- a/docs/superpowers/plans/2026-07-06-onboarding-install-redesign.md
+++ b/docs/superpowers/plans/2026-07-06-onboarding-install-redesign.md
@@ -681,6 +681,13 @@ git commit -m "fix(onboarding): retry state fetch during backend warmup instead
### Task 4b: Global "Jarvis is starting…" banner while the backend warms (spec B3)
+> **RESOLVED WITHOUT CODE (2026-07-06):** spec B3 is already implemented by
+> `VoiceWarmingBanner` + `useVoiceReadiness` (`bootWarming = !connected &&
+> wsWarming`, store default `wsWarming: true` — `store/events.ts:296` with a
+> test pinning it). The banner covers both the fast-boot window and the voice
+> warmup from the first second. Building the hook below would duplicate that
+> single source of truth, so this task is intentionally skipped.
+
**Files:**
- Create: `jarvis/ui/web/frontend/src/hooks/useBackendWarming.ts`
- Modify: `jarvis/ui/web/frontend/src/App.tsx` (mount the banner)
diff --git a/jarvis/plugins/tool/click_element.py b/jarvis/plugins/tool/click_element.py
index 84cdc67fd2..478165fdcd 100644
--- a/jarvis/plugins/tool/click_element.py
+++ b/jarvis/plugins/tool/click_element.py
@@ -189,20 +189,18 @@ class ClickElementTool:
error=f"Click on '{matched.name}' at ({cx},{cy}) failed: {exc}",
)
else:
+ # Capability probe instead of a raw pyautogui import: Wayland /
+ # headless / missing-deps hosts get the actionable
+ # ActuationUnavailable message (§3 honest degradation).
+ from jarvis.cu.actuate.base import ActuationUnavailable, get_actuator
+
try:
- import pyautogui
- except ImportError as exc:
- return ToolResult(
- success=False,
- output=None,
- error=(
- f"Platform is not Windows ({os.name}) and pyautogui is "
- f"missing: {exc}. pip install pyautogui"
- ),
- )
+ actuator = get_actuator()
+ except ActuationUnavailable as exc:
+ return ToolResult(success=False, output=None, error=str(exc))
try:
- pyautogui.click(
- x=cx, y=cy, clicks=2 if double else 1, button=button
+ await asyncio.to_thread(
+ actuator.click, cx, cy, button=button, double=double
)
except Exception as exc: # noqa: BLE001
return ToolResult(success=False, output=None, error=str(exc))
diff --git a/jarvis/plugins/tool/drag.py b/jarvis/plugins/tool/drag.py
index ce42841276..7a10711a49 100644
--- a/jarvis/plugins/tool/drag.py
+++ b/jarvis/plugins/tool/drag.py
@@ -17,6 +17,7 @@ gracefully with a clear message rather than raising.
from __future__ import annotations
import asyncio
+import os
from typing import Any
from jarvis.core.protocols import ExecutionContext, ToolResult
@@ -28,11 +29,23 @@ _DEFAULT_DRAG_DURATION_MS = 400
def _perform_drag(x1: int, y1: int, x2: int, y2: int, duration_s: float) -> None:
"""Press left at ``(x1, y1)``, drag to ``(x2, y2)``, release. Blocking;
- callers run it via ``asyncio.to_thread``."""
- import pyautogui # noqa: PLC0415 — lazy: keeps non-desktop import clean
+ callers run it via ``asyncio.to_thread``.
- pyautogui.moveTo(x1, y1)
- pyautogui.dragTo(x2, y2, duration=max(0.0, duration_s), button="left")
+ Windows keeps the proven pyautogui path unchanged. Elsewhere the backend
+ is resolved via the capability probe so Wayland/headless/missing-deps
+ hosts raise ``ActuationUnavailable`` with the actionable message instead
+ of a raw pyautogui error.
+ """
+ if os.name == "nt":
+ import pyautogui # noqa: PLC0415 — lazy: keeps non-desktop import clean
+
+ pyautogui.moveTo(x1, y1)
+ pyautogui.dragTo(x2, y2, duration=max(0.0, duration_s), button="left")
+ return
+
+ from jarvis.cu.actuate.base import get_actuator # noqa: PLC0415
+
+ get_actuator().drag(x1, y1, x2, y2, duration_s=max(0.0, duration_s))
class DragTool:
@@ -79,8 +92,12 @@ class DragTool:
success=False, output=None,
error="drag 'duration_ms' must be a number of milliseconds",
)
+ from jarvis.cu.actuate.base import ActuationUnavailable # noqa: PLC0415
+
try:
await asyncio.to_thread(_perform_drag, x1, y1, x2, y2, duration_s)
+ except ActuationUnavailable as exc:
+ return ToolResult(success=False, output=None, error=str(exc))
except ImportError as exc:
return ToolResult(
success=False, output=None,
diff --git a/jarvis/plugins/tool/move_mouse.py b/jarvis/plugins/tool/move_mouse.py
index 198d9a03ea..a8c54a3db1 100644
--- a/jarvis/plugins/tool/move_mouse.py
+++ b/jarvis/plugins/tool/move_mouse.py
@@ -60,14 +60,18 @@ class MoveMouseTool:
except OSError as exc:
return ToolResult(success=False, output=None, error=str(exc))
+ # Non-Windows: resolve the input backend via the capability probe so
+ # Wayland/headless/missing-deps hosts fail with the actionable
+ # ActuationUnavailable message instead of a raw pyautogui error.
+ from jarvis.cu.actuate.base import ActuationUnavailable, get_actuator
+
try:
- import pyautogui
- pyautogui.moveTo(x, y)
- return ToolResult(success=True, output=f"Mouse (pyautogui) at ({x},{y})")
- except ImportError as exc:
+ actuator = get_actuator()
+ await asyncio.to_thread(actuator.move, x, y)
return ToolResult(
- success=False, output=None,
- error=f"Platform is not Windows and pyautogui is missing: {exc}",
+ success=True, output=f"Mouse ({actuator.name}) at ({x},{y})"
)
+ except ActuationUnavailable as exc:
+ return ToolResult(success=False, output=None, error=str(exc))
except Exception as exc: # noqa: BLE001
return ToolResult(success=False, output=None, error=str(exc))
diff --git a/jarvis/plugins/tool/screen_snapshot.py b/jarvis/plugins/tool/screen_snapshot.py
index d2c186ba6d..dcc96315ee 100644
--- a/jarvis/plugins/tool/screen_snapshot.py
+++ b/jarvis/plugins/tool/screen_snapshot.py
@@ -34,7 +34,10 @@ import io
from typing import Any
from jarvis.core.protocols import ExecutionContext, ToolResult
-from jarvis.vision.screenshot import select_capture_monitor
+from jarvis.vision.screenshot import (
+ select_capture_monitor,
+ warn_if_screen_recording_denied,
+)
_MAX_BYTES = 500_000
_DEFAULT_JPEG_QUALITY = 85
@@ -120,6 +123,21 @@ class ScreenSnapshotTool:
error=f"Missing dependency: {exc.name or exc}",
)
+ # On macOS without the Screen-Recording grant, mss "succeeds" but
+ # captures only the desktop wallpaper — a success=True wallpaper JPEG
+ # would silently blind the model. Refuse honestly instead (§3:
+ # degrade with an actionable message, recoverable in-app).
+ if warn_if_screen_recording_denied():
+ return ToolResult(
+ success=False,
+ output=None,
+ error=(
+ "Screen capture is blocked: macOS Screen Recording "
+ "permission is not granted. Grant it in System Settings "
+ "> Privacy & Security > Screen Recording, then retry."
+ ),
+ )
+
try:
with mss.mss() as sct:
monitors = sct.monitors
diff --git a/tests/unit/plugins/tool/test_click_element.py b/tests/unit/plugins/tool/test_click_element.py
index 234a7e702d..cf0610cbd9 100644
--- a/tests/unit/plugins/tool/test_click_element.py
+++ b/tests/unit/plugins/tool/test_click_element.py
@@ -133,3 +133,34 @@ async def test_no_match_lists_available_names(
assert result.error is not None
assert "Save" in result.error
assert "Cancel" in result.error
+
+
+async def test_posix_unavailable_backend_reports_actionable_message(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """Non-Windows without an input backend: the capability-probe message
+ (Wayland/headless/extras missing) must reach the model — not a raw
+ pyautogui ImportError (§3 honest degradation)."""
+ from jarvis.cu.actuate.base import ActuationUnavailable
+
+ monkeypatch.setattr("jarvis.plugins.tool.click_element.os.name", "posix")
+
+ def _unavailable() -> None:
+ raise ActuationUnavailable(
+ "Cannot control mouse/keyboard: no input backend is installed. "
+ "Install the desktop extras (pip install "
+ "'personal-jarvis[desktop]') to get pynput/pyautogui."
+ )
+
+ monkeypatch.setattr("jarvis.cu.actuate.base.get_actuator", _unavailable)
+
+ nodes = (
+ UIANode(role="Button", name="Save", bounds=(10, 20, 100, 40), enabled=True),
+ )
+ tool = ClickElementTool(vision_source=_FakeVisionSource(nodes))
+
+ result = await tool.execute({"name": "save"}, _ctx())
+
+ assert result.success is False
+ assert "desktop extras" in (result.error or "")
diff --git a/tests/unit/plugins/tool/test_drag.py b/tests/unit/plugins/tool/test_drag.py
index d9a338910c..e0d7862cf1 100644
--- a/tests/unit/plugins/tool/test_drag.py
+++ b/tests/unit/plugins/tool/test_drag.py
@@ -88,3 +88,37 @@ def test_drag_tool_identity():
assert t.name == "drag"
assert t.risk_tier == "monitor"
assert {"x1", "y1", "x2", "y2"} <= set(t.schema["required"])
+
+async def test_drag_reports_actuation_unavailable_verbatim(monkeypatch):
+ """Wayland/headless: the actionable capability-probe message must reach
+ the model verbatim (no generic 'failed' wrapper around it)."""
+ from jarvis.cu.actuate.base import ActuationUnavailable
+
+ def _unavailable(*_a, **_k):
+ raise ActuationUnavailable(
+ "Cannot control mouse/keyboard on a Wayland session: Wayland "
+ "blocks synthetic input for security."
+ )
+
+ monkeypatch.setattr(drag_mod, "_perform_drag", _unavailable)
+ res = await DragTool().execute(
+ {"x1": 0, "y1": 0, "x2": 10, "y2": 10}, SimpleNamespace()
+ )
+ assert res.success is False
+ assert (res.error or "").startswith("Cannot control mouse/keyboard")
+
+
+def test_perform_drag_posix_routes_through_capability_probe(monkeypatch):
+ """Non-Windows _perform_drag must use get_actuator(), not raw pyautogui."""
+ monkeypatch.setattr(drag_mod.os, "name", "posix")
+ drags: list[tuple] = []
+
+ class _FakeActuator:
+ def drag(self, x1, y1, x2, y2, *, duration_s=0.4):
+ drags.append((x1, y1, x2, y2, duration_s))
+
+ monkeypatch.setattr(
+ "jarvis.cu.actuate.base.get_actuator", lambda: _FakeActuator()
+ )
+ drag_mod._perform_drag(1, 2, 3, 4, 0.25)
+ assert drags == [(1, 2, 3, 4, 0.25)]
diff --git a/tests/unit/plugins/tool/test_move_mouse.py b/tests/unit/plugins/tool/test_move_mouse.py
new file mode 100644
index 0000000000..d3bb0734f6
--- /dev/null
+++ b/tests/unit/plugins/tool/test_move_mouse.py
@@ -0,0 +1,59 @@
+"""MoveMouseTool non-Windows degradation (§3 honest messages).
+
+The POSIX path must resolve the input backend via the capability probe
+(``get_actuator``) so Wayland/headless/missing-deps hosts fail with the
+actionable ``ActuationUnavailable`` message instead of a raw pyautogui error.
+"""
+from __future__ import annotations
+
+from types import SimpleNamespace
+
+import pytest
+
+from jarvis.cu.actuate.base import ActuationUnavailable
+from jarvis.plugins.tool import move_mouse as mm
+
+
+async def test_posix_headless_reports_actionable_message(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setattr(mm.os, "name", "posix")
+
+ def _unavailable() -> None:
+ raise ActuationUnavailable(
+ "Cannot control mouse/keyboard: no display is present on this "
+ "host (headless). Computer-Use needs a desktop session."
+ )
+
+ monkeypatch.setattr("jarvis.cu.actuate.base.get_actuator", _unavailable)
+
+ res = await mm.MoveMouseTool().execute({"x": 10, "y": 20}, SimpleNamespace())
+
+ assert res.success is False
+ assert "headless" in (res.error or "")
+ assert "desktop session" in (res.error or "")
+
+
+async def test_posix_success_moves_via_probed_backend(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setattr(mm.os, "name", "posix")
+ moves: list[tuple[int, int]] = []
+
+ class _FakeActuator:
+ name = "fake-posix"
+
+ def move(self, x: int, y: int) -> None:
+ moves.append((x, y))
+
+ monkeypatch.setattr(
+ "jarvis.cu.actuate.base.get_actuator", lambda: _FakeActuator()
+ )
+
+ res = await mm.MoveMouseTool().execute({"x": 5, "y": 7}, SimpleNamespace())
+
+ assert res.success is True
+ assert moves == [(5, 7)]
+ assert "fake-posix" in (res.output or "")
diff --git a/tests/unit/plugins/tool/test_screen_snapshot.py b/tests/unit/plugins/tool/test_screen_snapshot.py
new file mode 100644
index 0000000000..fe5a70a030
--- /dev/null
+++ b/tests/unit/plugins/tool/test_screen_snapshot.py
@@ -0,0 +1,74 @@
+"""ScreenSnapshotTool honesty on macOS without the Screen-Recording grant.
+
+Audit finding 2026-07-06: without the TCC grant, mss "succeeds" but captures
+only the desktop wallpaper — the tool then returned success=True with a
+useless image and the model analyzed a wallpaper as if it were the screen.
+The tool must refuse honestly with the actionable permission message instead.
+"""
+from __future__ import annotations
+
+from types import SimpleNamespace
+
+import pytest
+
+from jarvis.plugins.tool.screen_snapshot import ScreenSnapshotTool
+
+
+async def test_macos_screen_recording_denied_is_honest_failure(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setattr(
+ "jarvis.plugins.tool.screen_snapshot.warn_if_screen_recording_denied",
+ lambda: True,
+ )
+
+ res = await ScreenSnapshotTool().execute({}, SimpleNamespace())
+
+ assert res.success is False
+ assert "Screen Recording" in (res.error or "")
+ assert not getattr(res, "artifacts", ())
+
+
+async def test_grant_present_does_not_block(monkeypatch: pytest.MonkeyPatch) -> None:
+ """With the grant present (probe returns False) the capture path runs.
+ The mss grab itself is faked so the test works on headless CI."""
+ monkeypatch.setattr(
+ "jarvis.plugins.tool.screen_snapshot.warn_if_screen_recording_denied",
+ lambda: False,
+ )
+
+ class _FakeShot:
+ size = (4, 4)
+ rgb = b"\x10\x20\x30" * 16
+
+ class _FakeSct:
+ monitors = [
+ {"left": 0, "top": 0, "width": 8, "height": 8},
+ {"left": 0, "top": 0, "width": 4, "height": 4},
+ ]
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *exc):
+ return False
+
+ def grab(self, target):
+ return _FakeShot()
+
+ import sys
+ import types
+
+ fake_mss = types.SimpleNamespace(mss=lambda: _FakeSct())
+ monkeypatch.setitem(sys.modules, "mss", fake_mss)
+ monkeypatch.setattr(
+ "jarvis.plugins.tool.screen_snapshot.select_capture_monitor",
+ lambda monitors, strategy="foreground": monitors[1],
+ )
+
+ res = await ScreenSnapshotTool().execute({"reason": "test"}, SimpleNamespace())
+
+ assert res.success is True
+ assert res.artifacts and res.artifacts[0]["type"] == "image"