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(computer-use): agent pointer and a calm blue control border
rubenluetke10-beep3c310de6b46b
diff --git a/docs/adr/0028-cu-screen-indicator-sidecar.md b/docs/adr/0028-cu-screen-indicator-sidecar.mdindex e29d2216a6..4ceb9e1c4e 100644--- a/docs/adr/0028-cu-screen-indicator-sidecar.md+++ b/docs/adr/0028-cu-screen-indicator-sidecar.md@@ -3,6 +3,11 @@Date: 2026-07-15Status: Accepted+**Amendment (2026-10-03):** the gold glow became a thin blue border with a+narrow inner glow, and the sidecar now also draws the agent pointer while a+mission or live session holds the mouse (Windows hides the system pointer+meanwhile). See [computer-use.md](../computer-use.md).+## ContextUsers need an unmistakable, always-visible signal that Jarvis isdiff --git a/docs/adr/0038-live-reasoning-model-owns-computer-control.md b/docs/adr/0038-live-reasoning-model-owns-computer-control.mdindex b2c323921f..1e6baae146 100644--- a/docs/adr/0038-live-reasoning-model-owns-computer-control.md+++ b/docs/adr/0038-live-reasoning-model-owns-computer-control.md@@ -57,7 +57,7 @@ computer; no second model is called for it.A blocker returns `blocked: <code>` and a plain sentence; the instructionstell the model to explain it and not retry in a loop.4. **Control signals stay.** The first input step publishes `CUControlStarted`- (yellow border, Escape armed) and registers a cancel token, so Escape, the+ (control border and agent pointer, Escape armed) and registers a cancel token, so Escape, thevoice hang-up and the emergency stop stop it. `CUControlEnded` follows 12 safter the last input. Input is serialized with the mission harness desktoplock; while a mission runs the tool answers `blocked: busy`.diff --git a/docs/computer-use.md b/docs/computer-use.mdindex e0e295da72..b5ff22cfd4 100644--- a/docs/computer-use.md+++ b/docs/computer-use.md@@ -29,9 +29,27 @@ frame or a changed front window presses nothing. Before any capture or input| Linux | Wayland session; no display | `wayland` / `headless` || All | `[computer_use].enabled`; a running mission holds the desktop | `disabled` / `busy` |-The yellow border and Escape work as for missions. Text chat, scheduled tasks+The control border and Escape work as for missions. Text chat, scheduled tasksand the CLI still use the mission engine described below.+## What the user sees while Jarvis has the mouse (2026-10-03)++While Jarvis operates the screen, a thin blue line with a narrow glow runs+along every monitor edge, and an "Esc to cancel" pill sits top-center. The+pointer turns into the agent pointer: a slim blue arrowhead with a white rim+and a soft halo (`jarvis/cu/indicator/agent_pointer.py`). It glides to each+target on a gently bowed path, leans into its motion, and dips with a ring+on every click; a click waits about a quarter second so the user sees the+pointer arrive. The motion model is `jarvis/cu/indicator/pointer_motion.py`.++On Windows the system pointer is hidden during control (`SetSystemCursor`)+and the user's own cursor scheme is reloaded when control ends+(`SPI_SETCURSORS`). A marker file records the swap, so the main app restores+the pointer at boot and after reaping a sidecar that died mid-control. macOS+and Linux cannot hide another app's pointer; there the agent pointer is drawn+on top of the system pointer. Screen looks without control show the border+only, never the agent pointer.+## Engine v2 (default since 2026-07-02)The POAV Computer-Use engine was rebuilt from scratch as the modular packagediff --git a/jarvis/cu/direct.py b/jarvis/cu/direct.pyindex 0ca77c1ae6..c70c0b4a94 100644--- a/jarvis/cu/direct.py+++ b/jarvis/cu/direct.py@@ -61,6 +61,9 @@ STEP_GAP_S = 0.08#: The border and the Escape binding stay up this long after the last input#: step, so a multi-call task reads as one continuous control period.IDLE_RELEASE_S = 12.0+#: While the agent pointer is on screen, a click first moves the pointer and+#: waits this long, so the user sees it arrive before the button goes down.+POINTER_ARRIVAL_S = 0.26_POINTER = frozenset({"click", "double_click", "right_click", "middle_click", "move", "drag"})_KEYBOARD = frozenset({"type", "key"})@@ -846,6 +849,30 @@ def _input_failure(exc: Exception) -> str:return text[:300]+def _visible_pointer() -> Any:+ """The indicator controller while the agent pointer is on screen, else ``None``."""+ try:+ from jarvis.cu.indicator.controller import get_indicator_controller # noqa: PLC0415+ except Exception: # noqa: BLE001 — no indicator on this host+ return None+ controller = get_indicator_controller()+ return controller if getattr(controller, "pointer_visible", False) else None+++def _announce_press(actuator: Any, sx: int, sy: int) -> None:+ """Let the agent pointer glide to the target and dip before the click."""+ import time # noqa: PLC0415++ from jarvis.cu.actuate import verified_move # noqa: PLC0415++ controller = _visible_pointer()+ if controller is None:+ return+ if verified_move(actuator, sx, sy).ok:+ time.sleep(POINTER_ARRIVAL_S)+ controller.pointer_press()++def _act(actuator: Any, step: Step, frame: Any, foreground: Callable[[], Foreground]) -> str:"""Run one input step synchronously; return an error detail or ``""``."""from jarvis.cu.actuate import verified_click, verified_drag, verified_move # noqa: PLC0415@@ -861,6 +888,7 @@ def _act(actuator: Any, step: Step, frame: Any, foreground: Callable[[], Foregroif step.action in {"click", "double_click", "right_click", "middle_click"}:button = {"right_click": "right", "middle_click": "middle"}.get(step.action, "left")+ _announce_press(actuator, sx, sy)landing = verified_click(actuator,sx,diff --git a/jarvis/cu/indicator/agent_pointer.py b/jarvis/cu/indicator/agent_pointer.pynew file mode 100644index 0000000000..45b39f3f54--- /dev/null+++ b/jarvis/cu/indicator/agent_pointer.py@@ -0,0 +1,288 @@+"""The look of Jarvis operating the screen: agent pointer, border and hint pill.++Sidecar-only (imports PySide6 at module level, like ``renderer.py``).++Visual contract (2026-10-03):++- **Border.** A thin blue line along every monitor edge with softly rounded+ inner corners, over a narrow inner glow. It breathes gently through the+ renderer's window opacity; nothing is repainted per frame.+- **Agent pointer.** While Jarvis has the mouse and keyboard, the pointer+ becomes a rounded arrow with a blue gradient body, a white rim, a soft+ shadow and a blue halo. It glides between targets on a bowed path, leans+ into its motion, dips and rings on every click+ (:mod:`jarvis.cu.indicator.pointer_motion`). On Windows the system pointer+ is hidden meanwhile and comes back the moment control ends; macOS and+ Linux keep the system pointer under it.+- **Hint pill.** A dark glass pill with a blue dot: "Esc to cancel".++Both windows are click-through, never activate, and are excluded from screen+capture where the OS allows it (the model never sees its own pointer).+"""++from __future__ import annotations++import sys+import time++from PySide6.QtCore import QPointF, QRectF, Qt, QTimer+from PySide6.QtGui import (+ QColor,+ QCursor,+ QFont,+ QFontMetricsF,+ QLinearGradient,+ QPainter,+ QPainterPath,+ QPen,+ QRadialGradient,+)+from PySide6.QtWidgets import QWidget++from jarvis.cu.indicator.pointer_motion import PointerMotion, PointerPose+from jarvis.cu.indicator.win32 import exclude_from_capture, harden_window++#: The product accent (``--accent`` dark, ``#3D8BFF``) and its light sibling.+ACCENT = (61, 139, 255)+ACCENT_LIGHT = (126, 182, 255)+ACCENT_DEEP = (36, 99, 235)++_BORDER_LINE_PX = 2.0+_BORDER_CORNER_PX = 14.0+_BORDER_GLOW_MIN_PX = 16+_BORDER_GLOW_MAX_PX = 34++#: Pointer window: the arrow tip sits at ``_HOTSPOT`` inside a square canvas+#: large enough for the halo and a full click ring around the tip.+_CANVAS_PX = 128+_HOTSPOT = QPointF(46.0, 46.0)+_FRAME_MS = 16+_RING_MAX_PX = 30.0+_HALO_PX = 34.0++# A slim arrowhead, tip at the origin, its axis 60 degrees below the+# horizontal (up-left like a pointer), with a notched base. Logical px; the+# round-joined rim softens every corner.+_ARROW = (+ (0.0, 0.0),+ (4.3, 26.6),+ (9.0, 15.6),+ (20.9, 17.0),+)+#: Where the halo sits: the arrowhead's visual center.+_BODY_CENTER = QPointF(9.1, 14.9)+++def _arrow_path() -> QPainterPath:+ path = QPainterPath()+ path.moveTo(*_ARROW[0])+ for point in _ARROW[1:]:+ path.lineTo(*point)+ path.closeSubpath()+ return path+++def _ui_font(point_size: float, weight: QFont.Weight) -> QFont:+ font = QFont("Inter")+ font.setStyleHint(QFont.StyleHint.SansSerif)+ font.setPointSizeF(point_size)+ font.setWeight(weight)+ return font+++def paint_border(painter: QPainter, width: int, height: int) -> None:+ """The control border on one monitor: inner glow plus a crisp rounded line."""+ glow = max(_BORDER_GLOW_MIN_PX, min(_BORDER_GLOW_MAX_PX, int(min(width, height) * 0.022)))+ painter.setRenderHint(QPainter.RenderHint.Antialiasing)+ painter.setPen(Qt.PenStyle.NoPen)+ inner = QColor(*ACCENT, 92)+ mid = QColor(*ACCENT, 26)+ clear = QColor(*ACCENT, 0)++ def edge(x1: float, y1: float, x2: float, y2: float) -> QLinearGradient:+ gradient = QLinearGradient(x1, y1, x2, y2)+ gradient.setColorAt(0.0, inner)+ gradient.setColorAt(0.4, mid)+ gradient.setColorAt(1.0, clear)+ return gradient++ painter.fillRect(QRectF(0, 0, width, glow), edge(0, 0, 0, glow))+ painter.fillRect(QRectF(0, height - glow, width, glow), edge(0, height, 0, height - glow))+ painter.fillRect(QRectF(0, 0, glow, height), edge(0, 0, glow, 0))+ painter.fillRect(QRectF(width - glow, 0, glow, height), edge(width, 0, width - glow, 0))++ inset = _BORDER_LINE_PX / 2+ rect = QRectF(inset, inset, width - _BORDER_LINE_PX, height - _BORDER_LINE_PX)+ # A faint wide stroke under the crisp one reads as light, not as a frame.+ for pen_width, alpha in ((_BORDER_LINE_PX + 5.0, 48), (_BORDER_LINE_PX, 235)):+ pen = QPen(QColor(*ACCENT_LIGHT if alpha > 100 else ACCENT, alpha), pen_width)+ pen.setJoinStyle(Qt.PenJoinStyle.RoundJoin)+ painter.setPen(pen)+ painter.setBrush(Qt.BrushStyle.NoBrush)+ painter.drawRoundedRect(rect, _BORDER_CORNER_PX, _BORDER_CORNER_PX)+++def paint_hint_pill(painter: QPainter, width: int, hint: str) -> None:+ """The "Esc to cancel" pill, top-center."""+ font = _ui_font(10.0, QFont.Weight.Medium)+ painter.setFont(font)+ metrics = QFontMetricsF(font)+ dot = 7.0+ pad_x, pad_y, gap = 14.0, 7.0, 8.0+ text_w = metrics.horizontalAdvance(hint)+ pill_w = pad_x + dot + gap + text_w + pad_x+ pill_h = metrics.height() + 2 * pad_y+ pill = QRectF((width - pill_w) / 2.0, 16.0, pill_w, pill_h)+ painter.setRenderHint(QPainter.RenderHint.Antialiasing)+ painter.setPen(QPen(QColor(*ACCENT, 110), 1.0))+ painter.setBrush(QColor(10, 10, 12, 214))+ painter.drawRoundedRect(pill, pill_h / 2.0, pill_h / 2.0)+ center_y = pill.center().y()+ painter.setPen(Qt.PenStyle.NoPen)+ painter.setBrush(QColor(*ACCENT, 70))+ painter.drawEllipse(QPointF(pill.left() + pad_x + dot / 2, center_y), dot, dot)+ painter.setBrush(QColor(*ACCENT_LIGHT, 255))+ painter.drawEllipse(QPointF(pill.left() + pad_x + dot / 2, center_y), dot / 2, dot / 2)+ painter.setPen(QColor(250, 250, 250, 235))+ painter.drawText(+ QRectF(pill.left() + pad_x + dot + gap, pill.top(), text_w + 1, pill_h),+ Qt.AlignmentFlag.AlignVCenter | Qt.AlignmentFlag.AlignLeft,+ hint,+ )+++def paint_pointer(painter: QPainter, origin: QPointF, pose: PointerPose) -> None:+ """Rings, halo, shadow and the arrow, tip at ``origin``."""+ painter.setRenderHint(QPainter.RenderHint.Antialiasing)+ for progress in pose.rings:+ radius = 6.0 + (_RING_MAX_PX - 6.0) * (1 - (1 - progress) ** 3)+ alpha = int(200 * (1 - progress))+ painter.setPen(QPen(QColor(*ACCENT_LIGHT, alpha), 2.0))+ painter.setBrush(QColor(*ACCENT, int(alpha * 0.18)))+ painter.drawEllipse(origin, radius, radius)++ painter.save()+ painter.translate(origin)+ painter.rotate(pose.angle)+ painter.scale(pose.scale, pose.scale)++ halo = QRadialGradient(_BODY_CENTER, _HALO_PX)+ halo.setColorAt(0.0, QColor(*ACCENT, 92))+ halo.setColorAt(0.45, QColor(*ACCENT, 34))+ halo.setColorAt(1.0, QColor(*ACCENT, 0))+ painter.setPen(Qt.PenStyle.NoPen)+ painter.setBrush(halo)+ painter.drawEllipse(_BODY_CENTER, _HALO_PX, _HALO_PX)++ arrow = _arrow_path()+ # Soft shadow: widening strokes of falling opacity read as a blur.+ shadow = arrow.translated(0.8, 1.8)+ for width, alpha in ((8.0, 8), (5.5, 12), (3.0, 18)):+ pen = QPen(QColor(0, 6, 24, alpha), width)+ pen.setJoinStyle(Qt.PenJoinStyle.RoundJoin)+ painter.setPen(pen)+ painter.setBrush(QColor(0, 6, 24, alpha))+ painter.drawPath(shadow)++ body = QLinearGradient(0.0, 0.0, 14.0, 24.0)+ body.setColorAt(0.0, QColor(*ACCENT_LIGHT))+ body.setColorAt(0.55, QColor(*ACCENT))+ body.setColorAt(1.0, QColor(*ACCENT_DEEP))+ rim = QPen(QColor(255, 255, 255, 250), 2.2)+ rim.setJoinStyle(Qt.PenJoinStyle.RoundJoin)+ painter.setPen(rim)+ painter.setBrush(body)+ painter.drawPath(arrow)+ # A thin highlight along the left flank gives the body some depth.+ painter.setPen(QPen(QColor(255, 255, 255, 96), 1.0))+ painter.drawLine(QPointF(1.8, 4.8), QPointF(4.3, 19.9))+ painter.restore()+++class AgentPointerWindow(QWidget):+ """A small click-through canvas that follows the real cursor."""++ def __init__(self) -> None:+ super().__init__(None)+ self.setWindowFlags(+ Qt.WindowType.FramelessWindowHint+ | Qt.WindowType.WindowStaysOnTopHint+ | Qt.WindowType.WindowTransparentForInput+ | Qt.WindowType.WindowDoesNotAcceptFocus+ | Qt.WindowType.Tool+ | Qt.WindowType.NoDropShadowWindowHint+ )+ self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)+ self.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents)+ self.setAttribute(Qt.WidgetAttribute.WA_ShowWithoutActivating)+ if sys.platform == "darwin":+ mac_always_show = getattr(Qt.WidgetAttribute, "WA_MacAlwaysShowToolWindow", None)+ if mac_always_show is not None:+ self.setAttribute(mac_always_show)+ self.resize(_CANVAS_PX, _CANVAS_PX)+ self._motion = PointerMotion()+ self._pose: PointerPose | None = None+ self._running = False+ self._blanked = False+ self._timer = QTimer(self)+ self._timer.setInterval(_FRAME_MS)+ self._timer.timeout.connect(self._tick)++ # -- lifecycle -------------------------------------------------------+ def start(self) -> None:+ if self._running:+ return+ self._running = True+ self._motion.reset()+ self._tick()+ self._timer.start()+ if not self._blanked:+ self.show()++ def stop(self) -> None:+ self._running = False+ self._timer.stop()+ self.hide()++ def press(self) -> None:+ if self._running:+ self._motion.press(time.monotonic())++ def set_blanked(self, blanked: bool) -> None:+ """Hide for a frame grab on hosts without capture exclusion."""+ self._blanked = blanked+ if blanked:+ self.hide()+ elif self._running:+ self.show()++ # -- frame loop ------------------------------------------------------+ def _tick(self) -> None:+ cursor = QCursor.pos()+ pose = self._motion.step((float(cursor.x()), float(cursor.y())), time.monotonic())+ self._pose = pose+ self.move(round(pose.x - _HOTSPOT.x()), round(pose.y - _HOTSPOT.y()))+ self.update()++ def showEvent(self, event) -> None: # noqa: N802 (Qt override)+ super().showEvent(event)+ hwnd = int(self.winId())+ harden_window(hwnd)+ exclude_from_capture(hwnd)++ def paintEvent(self, event) -> None: # noqa: N802 (Qt override)+ del event+ if self._pose is None:+ return+ painter = QPainter(self)+ paint_pointer(painter, _HOTSPOT, self._pose)+ painter.end()+++__all__ = [+ "ACCENT",+ "AgentPointerWindow",+ "paint_border",+ "paint_hint_pill",+ "paint_pointer",+]diff --git a/jarvis/cu/indicator/controller.py b/jarvis/cu/indicator/controller.pyindex 8a6e480247..1673f0f3a2 100644--- a/jarvis/cu/indicator/controller.py+++ b/jarvis/cu/indicator/controller.py@@ -37,6 +37,7 @@ from typing import Anyfrom uuid import UUIDfrom jarvis.cu.indicator import capture_guard, protocol, self_input+from jarvis.cu.indicator.win32 import restore_system_cursorlog = logging.getLogger(__name__)@@ -174,7 +175,9 @@ class CUIndicatorController:if self._active and self._esc_task is not Noneelse "")- visible = await self._show_border(hint=hint, required=True)+ visible = await self._show_border(+ hint=hint, required=True, pointer=bool(self._active)+ )except Exception: # noqa: BLE001 - acknowledge failure honestlylog.warning("[screen-context-indicator] failed to show capture border",@@ -198,9 +201,9 @@ class CUIndicatorController:if esc_armedelse "")- await self._show_border(hint=hint, required=False)+ await self._show_border(hint=hint, required=False, pointer=True)- async def _show_border(self, *, hint: str, required: bool) -> bool:+ async def _show_border(self, *, hint: str, required: bool, pointer: bool = False) -> bool:"""Ensure the shared sidecar is visibly showing and return its ACK."""if not required and not _screen_indicator_enabled():log.debug("[cu-indicator] disabled via [computer_use].screen_indicator")@@ -222,6 +225,9 @@ class CUIndicatorController:protocol.CMD_SHOW,_SHOW_ACK_TIMEOUT_S,hint=hint,+ # The agent pointer belongs to control of the mouse, never to a+ # one-shot screen look.+ pointer=pointer,)async def _deactivate(self) -> None:@@ -617,6 +623,19 @@ class CUIndicatorController:except queue.Empty: # timeout is the caller-visible false resultreturn False+ @property+ def pointer_visible(self) -> bool:+ """True while the agent pointer is on screen (control is held)."""+ return bool(self._active) and self._proc is not None++ def pointer_press(self) -> None:+ """Jarvis is about to click: the agent pointer dips and rings.++ Fire-and-forget from any thread; nothing happens without control.+ """+ if self._active and self._proc is not None:+ self._send(protocol.CMD_POINTER_PRESS)+def _reap(self, proc: subprocess.Popen[str]) -> None:try:proc.wait(timeout=_QUIT_GRACE_S)@@ -626,6 +645,8 @@ class CUIndicatorController:proc.wait(timeout=1.0)except Exception: # noqa: BLE001log.debug("[cu-indicator] sidecar reap failed", exc_info=True)+ # A killed sidecar cannot give the user's pointer back itself.+ restore_system_cursor(only_if_marked=True)# Deterministic handle accounting on long-running installs — do not# leave the pipe FDs to GC timing.for pipe in (proc.stdin, proc.stdout):@@ -747,6 +768,12 @@ def wire_cu_indicator(bus: Any) -> CUIndicatorController | None:global _controllerif bus is None:return None+ # The last run may have ended while the sidecar held the pointer (one+ # file check; the cursor is only touched when a swap is on record).+ try:+ restore_system_cursor(only_if_marked=True)+ except Exception: # noqa: BLE001 — the indicator must never break boot+ log.warning("[cu-indicator] pointer restore at boot failed", exc_info=True)if _controller is not None and _controller._bus is bus:return _controllertry:diff --git a/jarvis/cu/indicator/pointer_motion.py b/jarvis/cu/indicator/pointer_motion.pynew file mode 100644index 0000000000..47a2a9de08--- /dev/null+++ b/jarvis/cu/indicator/pointer_motion.py@@ -0,0 +1,197 @@+"""Motion model of the agent pointer: where it is drawn, tilted and scaled.++Pure Python (no Qt) so it is testable on a headless host; the sidecar's+``AgentPointerWindow`` feeds it the real cursor position every frame and+paints the returned :class:`PointerPose`.++Behaviour:++* **Glide.** Computer control moves the real cursor in one jump. When the+ target jumps further than :data:`JUMP_PX`, the pointer travels there on a+ gently bowed path (quadratic Bezier, ease-in-out) instead of teleporting.+ Its duration grows with the distance within ``GLIDE_MIN_S..GLIDE_MAX_S``.+* **Follow.** Small moves (the user's own hand on the mouse) are followed+ directly, so the pointer never lags behind a person.+* **Lean.** The pointer tilts a few degrees into its horizontal velocity and+ settles back on a critically damped spring.+* **Press.** A click shrinks the pointer briefly and sends out a ring.+* **Appear.** The pointer grows in when control starts.+"""++from __future__ import annotations++import math+from dataclasses import dataclass, field++JUMP_PX = 24.0+GLIDE_MIN_S = 0.20+GLIDE_MAX_S = 0.55+#: Seconds of glide per logical pixel of distance, on top of the minimum.+GLIDE_PER_PX_S = 1.0 / 3200.0+#: The path bows sideways by this share of its length (capped).+ARC_SHARE = 0.16+ARC_MAX_PX = 90.0+MAX_LEAN_DEG = 14.0+LEAN_PER_PX_S = 0.012+LEAN_RATE = 14.0+PRESS_IN_S = 0.07+PRESS_OUT_S = 0.26+PRESS_SCALE = 0.84+RING_S = 0.45+APPEAR_S = 0.18+APPEAR_FROM = 0.6+++def ease_in_out_cubic(t: float) -> float:+ t = min(1.0, max(0.0, t))+ return 4 * t * t * t if t < 0.5 else 1 - (-2 * t + 2) ** 3 / 2+++def ease_out_cubic(t: float) -> float:+ t = min(1.0, max(0.0, t))+ return 1 - (1 - t) ** 3+++@dataclass(frozen=True)+class PointerPose:+ x: float+ y: float+ angle: float+ scale: float+ #: Progress 0..1 of every live click ring, oldest first.+ rings: tuple[float, ...] = ()+ gliding: bool = False+++@dataclass+class _Glide:+ start: tuple[float, float]+ control: tuple[float, float]+ end: tuple[float, float]+ began: float+ duration: float++ def at(self, now: float) -> tuple[tuple[float, float], bool]:+ t = (now - self.began) / self.duration if self.duration > 0 else 1.0+ if t >= 1.0:+ return self.end, False+ e = ease_in_out_cubic(t)+ (x0, y0), (cx, cy), (x1, y1) = self.start, self.control, self.end+ u = 1 - e+ return (+ u * u * x0 + 2 * u * e * cx + e * e * x1,+ u * u * y0 + 2 * u * e * cy + e * e * y1,+ ), True+++def glide_duration(distance: float) -> float:+ return min(GLIDE_MAX_S, max(GLIDE_MIN_S, GLIDE_MIN_S + distance * GLIDE_PER_PX_S))+++def arc_control(start: tuple[float, float], end: tuple[float, float]) -> tuple[float, float]:+ """The control point bowing the path: always to the left of travel."""+ dx, dy = end[0] - start[0], end[1] - start[1]+ length = math.hypot(dx, dy)+ mid = ((start[0] + end[0]) / 2, (start[1] + end[1]) / 2)+ if length < 1e-6:+ return mid+ bow = min(ARC_MAX_PX, length * ARC_SHARE)+ # Left normal of the travel direction (screen y grows downward).+ return (mid[0] + dy / length * bow, mid[1] - dx / length * bow)+++@dataclass+class PointerMotion:+ """Advance with :meth:`step` once per frame; call :meth:`press` on a click."""++ pos: tuple[float, float] | None = None+ angle: float = 0.0+ _target: tuple[float, float] | None = None+ _glide: _Glide | None = None+ _last_now: float | None = None+ _appeared: float | None = None+ _presses: list[float] = field(default_factory=list)++ def reset(self) -> None:+ self.pos = None+ self.angle = 0.0+ self._target = None+ self._glide = None+ self._last_now = None+ self._appeared = None+ self._presses.clear()++ def press(self, now: float) -> None:+ self._presses.append(now)+ del self._presses[:-4]++ def step(self, target: tuple[float, float], now: float) -> PointerPose:+ if self.pos is None:+ self.pos = target+ self._target = target+ self._last_now = now+ self._appeared = now+ dt = max(1e-3, now - (self._last_now if self._last_now is not None else now))+ previous = self.pos+ jump_from = self._glide.end if self._glide is not None else self._target+ if jump_from is not None and math.dist(target, jump_from) > JUMP_PX:+ start = self.pos+ self._glide = _Glide(+ start=start,+ control=arc_control(start, target),+ end=target,+ began=now,+ duration=glide_duration(math.dist(start, target)),+ )+ elif self._glide is not None:+ # A small correction while gliding just moves the destination.+ self._glide.end = target+ self._target = target+ gliding = False+ if self._glide is not None:+ self.pos, gliding = self._glide.at(now)+ if not gliding:+ self._glide = None+ else:+ self.pos = target+ velocity_x = (self.pos[0] - previous[0]) / dt+ lean = max(-MAX_LEAN_DEG, min(MAX_LEAN_DEG, velocity_x * LEAN_PER_PX_S))+ self.angle += (lean - self.angle) * min(1.0, dt * LEAN_RATE)+ if abs(self.angle) < 0.01:+ self.angle = 0.0+ self._last_now = now+ self._presses = [t for t in self._presses if now - t < max(RING_S, PRESS_OUT_S)]+ return PointerPose(+ x=self.pos[0],+ y=self.pos[1],+ angle=self.angle,+ scale=self._scale(now),+ rings=tuple(+ (now - t) / RING_S for t in self._presses if 0 <= now - t < RING_S+ ),+ gliding=gliding,+ )++ def _scale(self, now: float) -> float:+ scale = 1.0+ if self._appeared is not None and now - self._appeared < APPEAR_S:+ grow = ease_out_cubic((now - self._appeared) / APPEAR_S)+ scale *= APPEAR_FROM + (1 - APPEAR_FROM) * grow+ if self._presses:+ age = now - self._presses[-1]+ if 0 <= age < PRESS_IN_S:+ scale *= 1 - (1 - PRESS_SCALE) * ease_out_cubic(age / PRESS_IN_S)+ elif PRESS_IN_S <= age < PRESS_OUT_S:+ back = ease_out_cubic((age - PRESS_IN_S) / (PRESS_OUT_S - PRESS_IN_S))+ scale *= PRESS_SCALE + (1 - PRESS_SCALE) * back+ return scale+++__all__ = [+ "JUMP_PX",+ "PointerMotion",+ "PointerPose",+ "arc_control",+ "ease_in_out_cubic",+ "glide_duration",+]diff --git a/jarvis/cu/indicator/protocol.py b/jarvis/cu/indicator/protocol.pyindex 18ea0b61ec..234271bce1 100644--- a/jarvis/cu/indicator/protocol.py+++ b/jarvis/cu/indicator/protocol.py@@ -3,7 +3,9 @@ process) and the renderer sidecar.One JSON object per line on the sidecar's stdin::- {"cmd": "show", "hint": "Esc to cancel"} # fade the border in+ {"cmd": "show", "hint": "Esc to cancel", # fade the border in; with+ "pointer": true} # pointer, Jarvis has the mouse+ {"cmd": "pointer_press"} # the agent pointer clicks{"cmd": "hide"} # fade the border out{"cmd": "blank"} # hide INSTANTLY (capture guard){"cmd": "unblank"} # restore after a frame grab@@ -56,6 +58,8 @@ CMD_SNAP_IMAGE = "snap_image"CMD_CARD = "card"#: A short status line on the card ("Copied", "Saved to Downloads").CMD_CARD_STATUS = "card_status"+#: Jarvis is about to press a mouse button: the agent pointer dips and rings.+CMD_POINTER_PRESS = "pointer_press"ALL_COMMANDS = frozenset({@@ -68,6 +72,7 @@ ALL_COMMANDS = frozenset(CMD_SNAP_IMAGE,CMD_CARD,CMD_CARD_STATUS,+ CMD_POINTER_PRESS,})@@ -146,6 +151,7 @@ __all__ = ["CMD_CARD","CMD_CARD_STATUS","CMD_HIDE",+ "CMD_POINTER_PRESS","CMD_QUIT","CMD_SHOW","CMD_SNAP",diff --git a/jarvis/cu/indicator/renderer.py b/jarvis/cu/indicator/renderer.pyindex 75f7ddfac1..cc9797e5ee 100644--- a/jarvis/cu/indicator/renderer.py+++ b/jarvis/cu/indicator/renderer.py@@ -6,12 +6,14 @@ never import it (boot-path discipline, AP-26); the ``__main__`` entryguards the import and exits with ``protocol.EXIT_NO_GUI`` when the GUIstack is unavailable.-Visual contract (maintainer-approved 2026-07-15):+Visual contract (2026-10-03, drawn by ``agent_pointer.py``):-- A soft gold glow along every edge of EVERY monitor, breathing on a- ~2.4 s sine loop, 300 ms fade in/out.+- A thin blue line with a narrow inner glow along every edge of EVERY+ monitor, breathing on a ~3.2 s sine loop, 300 ms fade in/out.- An "Esc to cancel" pill top-center on the primary monitor (text arrivespre-localized from the controller; omitted when Escape isn't armable).+- While a show carries ``pointer``: the agent pointer follows the cursor,+ and on Windows the system pointer is hidden until the hide.- Frameless, always-on-top, fully click-through, never activates, and onWindows excluded from screen capture (see ``win32.py``)."""@@ -49,7 +51,6 @@ from PySide6.QtGui import (QFontMetricsF,QGuiApplication,QImage,- QLinearGradient,QPainter,QPainterPath,QPen,@@ -59,23 +60,21 @@ from PySide6.QtGui import (from PySide6.QtWidgets import QApplication, QWidgetfrom jarvis.cu.indicator import protocol+from jarvis.cu.indicator.agent_pointer import (+ AgentPointerWindow,+ paint_border,+ paint_hint_pill,+)from jarvis.cu.indicator.win32 import (exclude_from_capture,harden_clickable_window,harden_window,+ hide_system_cursor,+ restore_system_cursor,)-# Jarvis gold — matches ui/orb BUBBLE_BORDER_HEX (#FFE500) at the crisp-# edge, falling off through the softer [ui].bar_accent gold (#e7c46e).-_EDGE_RGB = (255, 229, 0)-_SOFT_RGB = (231, 196, 110)--_GLOW_MIN_PX = 32-_GLOW_MAX_PX = 110-_EDGE_LINE_PX = 3--_PULSE_PERIOD_MS = 2400-_PULSE_FLOOR = 0.62 # breathing dims to 62 %, never fully out+_PULSE_PERIOD_MS = 3200+_PULSE_FLOOR = 0.78 # breathing dims to 78 %, calm and never out_FADE_MS = 300@@ -135,67 +134,12 @@ class _GlowWindow(QWidget):h = self.height()if w <= 0 or h <= 0:return- glow = max(_GLOW_MIN_PX, min(_GLOW_MAX_PX, int(min(w, h) * 0.06)))-painter = QPainter(self)- painter.setRenderHint(QPainter.RenderHint.Antialiasing)- painter.setPen(Qt.PenStyle.NoPen)-- edge = QColor(*_EDGE_RGB, 205)- soft = QColor(*_SOFT_RGB, 135)- clear = QColor(*_SOFT_RGB, 0)-- def _edge_gradient(x1: float, y1: float, x2: float, y2: float):- grad = QLinearGradient(x1, y1, x2, y2)- grad.setColorAt(0.0, edge)- grad.setColorAt(0.35, soft)- grad.setColorAt(1.0, clear)- return grad-- painter.fillRect(0, 0, w, glow, _edge_gradient(0, 0, 0, glow))- painter.fillRect(0, h - glow, w, glow, _edge_gradient(0, h, 0, h - glow))- painter.fillRect(0, 0, glow, h, _edge_gradient(0, 0, glow, 0))- painter.fillRect(w - glow, 0, glow, h, _edge_gradient(w, 0, w - glow, 0))-- # Crisp definition line at the very edge.- pen = QPen(QColor(*_EDGE_RGB, 235))- pen.setWidth(_EDGE_LINE_PX)- painter.setPen(pen)- painter.setBrush(Qt.BrushStyle.NoBrush)- inset = _EDGE_LINE_PX // 2- painter.drawRect(inset, inset, w - _EDGE_LINE_PX, h - _EDGE_LINE_PX)-+ paint_border(painter, w, h)if self._with_pill and self._hint:- self._paint_pill(painter, w)+ paint_hint_pill(painter, w, self._hint)painter.end()- def _paint_pill(self, painter: QPainter, w: int) -> None:- font = QFont()- font.setPointSizeF(10.5)- font.setWeight(QFont.Weight.Medium)- painter.setFont(font)- metrics = QFontMetricsF(font)- pad_x, pad_y = 16.0, 7.0- text_w = metrics.horizontalAdvance(self._hint)- pill_w = text_w + 2 * pad_x- pill_h = metrics.height() + 2 * pad_y- x = (w - pill_w) / 2.0- y = 18.0- radius = pill_h / 2.0-- painter.setPen(QPen(QColor(*_SOFT_RGB, 200), 1.0))- painter.setBrush(QColor(18, 18, 18, 175))- painter.drawRoundedRect(int(x), int(y), int(pill_w), int(pill_h), radius, radius)- painter.setPen(QColor(255, 240, 200, 235))- painter.drawText(- int(x),- int(y),- int(pill_w),- int(pill_h),- Qt.AlignmentFlag.AlignCenter,- self._hint,- )-# ---------------------------------------------------------------------------# Appshot shutter effect — the phone-screenshot moment.@@ -1195,6 +1139,9 @@ class Renderer(QObject):self._card_labels: dict[str, str] = {}self._hint = ""self._active = False # "show" was requested and not yet "hide"+ #: The agent pointer (created on first use) and the system pointer swap.+ self._pointer: AgentPointerWindow | None = None+ self._cursor_hidden = Falseself._blanked = False # capture guard currently hiding the borderself._commands: deque[dict] = deque()self._processing_commands = False@@ -1244,6 +1191,10 @@ class Renderer(QObject):cmd = payload["cmd"]if cmd == protocol.CMD_SHOW:self._show(str(payload.get("hint", "")))+ self._set_pointer(bool(payload.get("pointer")))+ elif cmd == protocol.CMD_POINTER_PRESS:+ if self._pointer is not None:+ self._pointer.press()elif cmd == protocol.CMD_HIDE:self._hide()elif cmd == protocol.CMD_BLANK:@@ -1290,8 +1241,28 @@ class Renderer(QObject):def _hide(self) -> None:self._active = False+ self._set_pointer(False)self._fade_to(0.0)+ def _set_pointer(self, wanted: bool) -> None:+ """Become (or stop being) the pointer while Jarvis operates the screen."""+ if wanted:+ if self._pointer is None:+ self._pointer = AgentPointerWindow()+ self._pointer.start()+ if not self._cursor_hidden:+ self._cursor_hidden = hide_system_cursor()+ return+ if self._pointer is not None:+ self._pointer.stop()+ if self._cursor_hidden:+ restore_system_cursor()+ self._cursor_hidden = False++ def shutdown(self) -> None:+ """The user's pointer always comes back, whatever ended the sidecar."""+ self._set_pointer(False)+def _snap(self, payload: dict) -> None:thumb = QImage()raw = payload.get("thumb")@@ -1529,6 +1500,8 @@ class Renderer(QObject):self._blanked = Truefor win in self._windows:win.hide()+ if self._pointer is not None:+ self._pointer.set_blanked(True)def _unblank(self) -> None:for card in self._cards:@@ -1539,6 +1512,8 @@ class Renderer(QObject):self._blanked = Falsefor win in self._windows:win.show()+ if self._pointer is not None:+ self._pointer.set_blanked(False)# -- screens -----------------------------------------------------------def _ensure_windows(self) -> None:@@ -1634,6 +1609,8 @@ def run() -> int:# All windows are frequently hidden (blank/hide) — that must never# terminate the sidecar; only stdin EOF or "quit" does.app.setQuitOnLastWindowClosed(False)+ # A sidecar that died while it held the pointer left the swap on record.+ restore_system_cursor(only_if_marked=True)renderer = Renderer(app)QGuiApplication.instance().screenAdded.connect(renderer.on_screens_changed)@@ -1653,7 +1630,10 @@ def run() -> int:))- return app.exec()+ try:+ return app.exec()+ finally:+ renderer.shutdown()__all__ = ["Renderer", "run"]diff --git a/jarvis/cu/indicator/win32.py b/jarvis/cu/indicator/win32.pyindex 0972badde5..3f33a406c5 100644--- a/jarvis/cu/indicator/win32.py+++ b/jarvis/cu/indicator/win32.py@@ -1,6 +1,6 @@"""Win32 window hardening for the indicator sidecar (ctypes, lazy).-Two jobs, both quiet no-ops on every non-Windows platform:+Three jobs, all quiet no-ops on every non-Windows platform:- ``harden_window(hwnd)`` — belt-and-suspenders click-through: Qt alreadysets ``WindowTransparentForInput``, but Windows silently drops layered@@ -11,6 +11,9 @@ Two jobs, both quiet no-ops on every non-Windows platform:including Computer-Use's OWN perception frames (Windows 10 2004+).Set ``JARVIS_CU_INDICATOR_CAPTURABLE=1`` to skip this — used by thelive-verification flow, which needs to SEE the border in a screenshot.+- ``hide_system_cursor()`` / ``restore_system_cursor()`` — while Jarvis+ operates the screen the agent pointer replaces the system pointer; the+ user's own cursor scheme always comes back (see the section below)."""from __future__ import annotations@@ -120,6 +123,113 @@ def exclude_from_capture(hwnd: int) -> bool:return exclude_hwnd_from_capture(hwnd)+# ---------------------------------------------------------------------------+# System pointer swap: while Jarvis operates the screen, the agent pointer+# drawn by the sidecar IS the pointer. Windows lets one process replace the+# system-wide cursor images (SetSystemCursor) and reload the user's own+# scheme from the registry (SPI_SETCURSORS) — the restore works from ANY+# process, so the main app can heal a sidecar that died mid-control.+# ---------------------------------------------------------------------------++#: Every standard cursor slot an application can show (OCR_* in winuser.h).+_CURSOR_SLOTS = (+ 32512, 32513, 32514, 32515, 32516, 32642, 32643, 32644,+ 32645, 32646, 32648, 32649, 32650, 32651,+) # fmt: skip+_SPI_SETCURSORS = 0x0057+_CURSOR_MARKER = "cu-pointer-hidden"+++def _cursor_marker():+ from jarvis.core.paths import user_data_dir # noqa: PLC0415++ return user_data_dir() / _CURSOR_MARKER+++def _blank_cursor(user32, ctypes):+ """A fully transparent 32x32 cursor (AND mask all set, XOR mask clear)."""+ size = 32 * 32 // 8+ and_mask = (ctypes.c_ubyte * size)(*([0xFF] * size))+ xor_mask = (ctypes.c_ubyte * size)()+ return user32.CreateCursor(None, 0, 0, 32, 32, and_mask, xor_mask)+++def hide_system_cursor() -> bool:+ """Swap every system cursor for a transparent one. ``False`` elsewhere.++ A marker file records the swap first, so :func:`restore_system_cursor`+ in any later process (the main app at boot, or after reaping a crashed+ sidecar) knows the user's pointer still needs to come back.+ """+ if os.name != "nt":+ return False+ import ctypes # noqa: PLC0415+ from ctypes import wintypes # noqa: PLC0415++ try:+ marker = _cursor_marker()+ marker.parent.mkdir(parents=True, exist_ok=True)+ marker.write_text(str(os.getpid()), encoding="utf-8")+ except OSError:+ # Without the marker a crash could leave the pointer invisible for+ # good. Keep the user's pointer instead of risking that.+ log.warning("cursor marker unwritable; keeping the system pointer", exc_info=True)+ return False+ user32 = ctypes.WinDLL("user32", use_last_error=True)+ user32.CreateCursor.restype = wintypes.HANDLE+ user32.CreateCursor.argtypes = [+ wintypes.HINSTANCE, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,+ ctypes.c_void_p, ctypes.c_void_p,+ ] # fmt: skip+ user32.SetSystemCursor.argtypes = [wintypes.HANDLE, wintypes.DWORD]+ user32.SetSystemCursor.restype = wintypes.BOOL+ swapped = 0+ for slot in _CURSOR_SLOTS:+ # SetSystemCursor takes ownership of (and destroys) the handle, so+ # every slot gets its own blank cursor.+ handle = _blank_cursor(user32, ctypes)+ if handle and user32.SetSystemCursor(handle, slot):+ swapped += 1+ if not swapped:+ restore_system_cursor()+ return False+ return True+++def restore_system_cursor(*, only_if_marked: bool = False) -> bool:+ """Reload the user's own cursor scheme. Safe to call any number of times.++ ``only_if_marked`` restores only when a swap is on record — the cheap+ boot/reap check that never touches the cursor in the common case.+ """+ if os.name != "nt":+ return False+ try:+ marker = _cursor_marker()+ marked = marker.exists()+ except OSError:+ marked = False+ if only_if_marked and not marked:+ return False+ import ctypes # noqa: PLC0415+ from ctypes import wintypes # noqa: PLC0415++ user32 = ctypes.WinDLL("user32", use_last_error=True)+ user32.SystemParametersInfoW.argtypes = [+ wintypes.UINT, wintypes.UINT, ctypes.c_void_p, wintypes.UINT,+ ] # fmt: skip+ user32.SystemParametersInfoW.restype = wintypes.BOOL+ ok = bool(user32.SystemParametersInfoW(_SPI_SETCURSORS, 0, None, 0))+ if ok and marked:+ try:+ marker.unlink(missing_ok=True)+ except OSError:+ log.debug("cursor marker not removable", exc_info=True)+ if not ok:+ log.warning("restoring the system cursor scheme failed")+ return ok++def capture_exclusion_available() -> bool:"""True where the OS can hide the border from screenshots (Windows).@@ -135,4 +245,6 @@ __all__ = ["exclude_from_capture","harden_clickable_window","harden_window",+ "hide_system_cursor",+ "restore_system_cursor",]diff --git a/tests/unit/cu/indicator/test_agent_pointer.py b/tests/unit/cu/indicator/test_agent_pointer.pynew file mode 100644index 0000000000..4c5ad005ed--- /dev/null+++ b/tests/unit/cu/indicator/test_agent_pointer.py@@ -0,0 +1,152 @@+"""The agent pointer: motion model, wire protocol, controller flag, pointer restore."""++from __future__ import annotations++import asyncio+import math++import pytest++from jarvis.cu.indicator import protocol, win32+from jarvis.cu.indicator.pointer_motion import (+ GLIDE_MAX_S,+ GLIDE_MIN_S,+ JUMP_PX,+ MAX_LEAN_DEG,+ PRESS_SCALE,+ PointerMotion,+ arc_control,+ glide_duration,+)++# -- motion ------------------------------------------------------------------+++def _run(motion: PointerMotion, target, start: float, seconds: float, fps: int = 60):+ poses = []+ frames = int(seconds * fps)+ for index in range(frames + 1):+ poses.append(motion.step(target, start + index / fps))+ return poses+++def test_a_jump_glides_on_a_bowed_path_and_lands_exactly():+ motion = PointerMotion()+ motion.step((100.0, 100.0), 0.0)+ poses = _run(motion, (700.0, 100.0), 0.5, GLIDE_MAX_S + 0.1)+ assert poses[0].gliding is True+ assert (poses[-1].x, poses[-1].y) == (700.0, 100.0)+ assert poses[-1].gliding is False+ # Not a straight teleport: midway the pointer is between the ends and+ # off the straight line (the arc bows to the left of travel, upward here).+ middle = poses[len(poses) // 3]+ assert 100 < middle.x < 700+ assert middle.y < 100 - 5+++def test_the_users_own_small_moves_are_followed_without_lag():+ motion = PointerMotion()+ motion.step((100.0, 100.0), 0.0)+ pose = motion.step((100.0 + JUMP_PX - 1, 104.0), 0.016)+ assert (pose.x, pose.y) == (100.0 + JUMP_PX - 1, 104.0)+ assert pose.gliding is False+++def test_glide_duration_grows_with_distance_within_bounds():+ assert glide_duration(0) == GLIDE_MIN_S+ assert glide_duration(300) < glide_duration(1200)+ assert glide_duration(100_000) == GLIDE_MAX_S+++def test_arc_control_bows_left_of_travel_and_is_capped():+ cx, cy = arc_control((0.0, 0.0), (100.0, 0.0))+ assert cx == 50.0 and cy < 0 # rightward travel bows up (screen y down)+ far = arc_control((0.0, 0.0), (10_000.0, 0.0))+ assert math.isclose(far[1], -90.0)+++def test_the_pointer_leans_into_motion_and_settles():+ motion = PointerMotion()+ motion.step((0.0, 300.0), 0.0)+ poses = _run(motion, (900.0, 300.0), 0.1, 0.15)+ assert 0 < max(p.angle for p in poses) <= MAX_LEAN_DEG+ settled = _run(motion, (900.0, 300.0), 0.4, 1.0)+ assert abs(settled[-1].angle) < 0.5+++def test_a_press_dips_the_pointer_and_sends_one_ring():+ motion = PointerMotion()+ motion.step((50.0, 50.0), 0.0)+ motion.step((50.0, 50.0), 1.0)+ motion.press(1.0)+ dip = motion.step((50.0, 50.0), 1.07)+ assert math.isclose(dip.scale, PRESS_SCALE, abs_tol=0.01)+ assert len(dip.rings) == 1 and 0 < dip.rings[0] < 1+ after = motion.step((50.0, 50.0), 2.0)+ assert after.scale == 1.0 and after.rings == ()+++def test_the_pointer_grows_in_when_control_starts():+ motion = PointerMotion()+ first = motion.step((10.0, 10.0), 5.0)+ later = motion.step((10.0, 10.0), 5.5)+ assert first.scale < 1.0+ assert later.scale == 1.0+++# -- wire protocol -----------------------------------------------------------+++def test_pointer_press_and_the_show_flag_cross_the_wire():+ press = protocol.decode_command(protocol.encode_command(protocol.CMD_POINTER_PRESS))+ assert press == {"cmd": "pointer_press"}+ show = protocol.decode_command(+ protocol.encode_command(protocol.CMD_SHOW, hint="Esc to cancel", pointer=True)+ )+ assert show["pointer"] is True+++# -- controller ----------------------------------------------------------------+++async def test_control_shows_the_pointer_and_clicks_reach_it(monkeypatch):+ from jarvis.core.bus import EventBus+ from jarvis.cu.indicator.controller import CUIndicatorController++ ctl = CUIndicatorController(EventBus())+ sent: list[tuple[str, dict]] = []+ monkeypatch.setattr(ctl, "_arm_escape", lambda: True)+ monkeypatch.setattr(ctl, "_border_capability", lambda: (True, ""))+ monkeypatch.setattr(ctl, "_spawn_sidecar", lambda: setattr(ctl, "_proc", object()))+ monkeypatch.setattr(+ ctl, "_send_and_wait", lambda cmd, _timeout, **fields: sent.append((cmd, fields)) or True+ )+ monkeypatch.setattr(ctl, "_send", lambda cmd, **fields: sent.append((cmd, fields)) or True)+ monkeypatch.setattr("jarvis.cu.indicator.controller._screen_indicator_enabled", lambda: True)+ monkeypatch.setattr(+ "jarvis.cu.indicator.controller.capture_guard.register_hook", lambda _hook: None+ )++ ctl.pointer_press() # no control yet: nothing is sent+ assert sent == []+ await ctl._on_started(object())+ assert sent[-1][0] == protocol.CMD_SHOW and sent[-1][1]["pointer"] is True+ assert ctl.pointer_visible is True+ ctl.pointer_press()+ assert sent[-1] == (protocol.CMD_POINTER_PRESS, {})+ await asyncio.sleep(0)+++# -- system pointer restore ------------------------------------------------------+++def test_restore_without_a_recorded_swap_never_touches_the_pointer(monkeypatch, tmp_path):+ monkeypatch.setattr(win32, "_cursor_marker", lambda: tmp_path / "cu-pointer-hidden")+ assert win32.restore_system_cursor(only_if_marked=True) is False+++def test_pointer_swap_is_windows_only(monkeypatch):+ monkeypatch.setattr(win32.os, "name", "posix")+ assert win32.hide_system_cursor() is False+ assert win32.restore_system_cursor() is Falsediff --git a/tests/unit/cu/indicator/test_controller.py b/tests/unit/cu/indicator/test_controller.pyindex 7165d5a40f..095974ba12 100644--- a/tests/unit/cu/indicator/test_controller.py+++ b/tests/unit/cu/indicator/test_controller.py@@ -215,8 +215,9 @@ async def test_screen_capture_waits_for_real_show_ack_and_hides_afterward(ctl = CUIndicatorController(bus)calls: list[str] = []- async def fake_show(*, hint: str, required: bool) -> bool:+ async def fake_show(*, hint: str, required: bool, pointer: bool = False) -> bool:assert required is True+ assert pointer is False # a screen look never takes over the pointercalls.append(f"show:{hint}")return Truediff --git a/tests/unit/cu/test_direct.py b/tests/unit/cu/test_direct.pyindex 802821c581..9ad585dab9 100644--- a/tests/unit/cu/test_direct.py+++ b/tests/unit/cu/test_direct.py@@ -433,3 +433,27 @@ def test_control_rules_forbid_a_second_agent_and_name_the_safety_stops():assert "no separate computer-use agent" in rulesfor stop in ("payments", "passwords", "untrusted", "Escape"):assert stop in rules+++async def test_a_click_lets_the_visible_agent_pointer_arrive_and_dip_first(monkeypatch):+ order: list[str] = []++ class Indicator:+ pointer_visible = True++ def pointer_press(self):+ order.append("press")++ class Recording(FakeActuator):+ def click_at_cursor(self, **kwargs):+ order.append("click")+ super().click_at_cursor(**kwargs)++ monkeypatch.setattr(direct, "POINTER_ARRIVAL_S", 0.0)+ monkeypatch.setattr(direct, "_visible_pointer", lambda: Indicator())+ computer, actuator, _, _ = _computer(actuator=Recording())+ shot = await _shoot(computer)+ result = await _click(computer, shot)+ assert result["success"] is True+ assert order == ["press", "click"]