Status: Implementation IMPLEMENTED × Exposure INTERNAL (phase D1 of the driver fast path; phase D1b ships the driver in every guest image — Linux, Windows, the sandbox container, and the tart VMs). Source: domains/computer-use/driver/. Launched by surfaces/allternit-desktop/src/main/computer-use-driver-manager.ts on this device, and by a boot service / logon task in the guest images (domains/computer-use/driver/packaging/). Called by cmd/allternit-api/src/this_device_input.rs (this device) and cmd/allternit-api/src/guest_driver.rs (guests, through the guest exec channel). The structured members (read_ui, act, run_batch, verify) reach models in contract v2 (phase D2).

Overview

The Allternit Driver is the process that actually touches the screen on a computer running Allternit Desktop. It sits between the computer toolset executor in allternit-api and the operating system:
Neither engine is primary on macOS. Each op goes to the engine that does it best for that app, and the router keeps learning which one that is. On guests the native engine is the primary path; Cua only serves where it is actually installed.

Engines

Cua Driver runs in its standard permission mode, the least privilege that allows observation and input on any app. bounded needs a per-app manifest, which can’t cover “whatever app the user asked for”; unrestricted turns off Cua’s approval checks. The permission_denied that run_actions returned before was not a mode problem: Cua Driver 0.34 (the newest release on 2026-10-09) does not ship run_actions, and its policy denies any tool without a reviewed risk class. The Allternit Driver runs batches itself (below).

Operations

Every op is a JSON-RPC method on the sidecar’s socket. Value-only writes (focus: false). act with {op: "set_value", focus: false} (on macOS also type) writes the value through accessibility on that element and does nothing else: no focus step and no key-typing fallback. On macOS that is AXValue with no AXFocused write (a secure text field, which hides its value from accessibility, counts as written when the write is accepted); on Linux the AT-SPI text or value interface; on Windows UI Automation ValuePattern.SetValue. A field that refuses answers value_rejected and is left as it was; an engine with no direct setter answers unsupported_op, and a vision element (v…) is refused. The answer leaves out changes, which would hold the new value. allternit-api uses it for use_credential and the masked secret box on the person’s own computer. Why no focus: in the Safari spike (2026-11-26) focusing a field in a background Safari window made that window key, and the person’s typing then went into it. run_batch stops at the first failed step or check and then reads once. After it, the engine that didn’t run the steps confirms the last expect: on macOS that is arc’s freshness check (a fresh, uncached walk), elsewhere Cua’s verify_state. This catches a batch that “succeeded” without the app reacting.

Element ids and map versions

  • An element’s id is a hash of its role, its name and its tree path. A path segment is role:n, where n counts only earlier siblings with the same role and name, so a new row with another name doesn’t shift anyone’s id. Identical twins under one parent also mix in their bbox, measured from the window’s corner and rounded to 8 pt, so moving the window doesn’t change ids.
  • Ids are the same whichever engine read the window, and the same across reads while the element is there. A batch can therefore use ids from before its first step after earlier steps have changed the window.
  • crops: true adds crop to each element: an 8×8 average hash of its pixels, taken from one window capture (macOS). The vision fallback and replay use it to recognise an element whose tree data changed.
  • Each window keeps its last 8 map versions. A version changes only when something a model can see changed: ids, names, values, bounds, enabled or focus. since answers with added, changed and removed from that version, or the whole map with reset: true when it has aged out.
  • An action carries the version it was planned on. If the window has moved on, the action is refused with stale_version and the fresh map, the same freshness guard arc applies to its own snapshots.
  • Before an act or run_batch checks its version, the map is brought up to date with every notification so far, so a change the app announced a moment ago refuses an action planned before it. The refusal carries the current map (no extra walk).

Live element map

The driver keeps a live map of every window it reads: it subscribes to the OS’s accessibility notifications and patches the map as they arrive, instead of walking the tree on each read_ui. Code: domains/computer-use/driver/allternit_driver/live/.
  • One subscriber per window. On macOS one AXObserver per app runs on one run-loop thread (live/macos.py, the AXHub). It feeds arc’s change journal and settle counter (drop-in adapters installed with arc’s app_factory hook), each window’s walk cache, and the live map. Upstream arc ran three observers per app, each with a thread polling every 20–50 ms; the hub sleeps until an app posts. Both engines, the decision runtime and every caller read the same map.
  • Notifications (registered on the app): value, title, created, destroyed, focused element, focused/main window, window created/moved/resized/minimized, layout, row count, rows expanded/collapsed, selected children/rows/text/cells, scroll position, menu opened/closed, sheet/drawer created, app hidden/shown. Web areas also get their own subscription, since a page posts on its web area.
  • Patching. A notification marks the window dirty and wakes the patch worker. A patch is arc’s incremental walk: only the elements the notifications named are read again, plus a child-list check of containers that catches rows added without a notification. The map is rebuilt from that walk without further accessibility calls, and its version goes up only when something visible changed. A read of a dirty window patches first, so a read never answers older than the last notification.
  • Full walks happen only on first sight, on a window-level change (a window, sheet or menu came or went, or focus moved to another window), when more than 40 structural notifications arrive in one burst, on fresh: true, or when the staleness probe fails. The probe runs every 2 s per watched window and costs two accessibility calls: the window’s child count and the app’s focused element.
  • Re-reads cost no accessibility call. A clean window is answered from the map (cached: true); the app’s current window is also remembered until a window-level notification, so read_ui with only an app makes no call either.
  • Fallback (live.state: degraded). When an app accepts no notifications, its observer fails, or the probe catches a change no notification announced twice, the window is read on a timer: the map is reused for at most 0.5 s, then read again (narrowed to 200 elements on the Cua engine), and every answer says degraded with the reason. On macOS every read is arc’s. Where the router picks Cua (Windows, Linux, or an app arc can’t read), Cua’s get_window_state runs only on first sight, after a notification, on a forced refresh (fresh: true), or on a degraded window’s timer.
  • Lifecycle. Windows are watched on demand, when first read or acted on (and the prewarmed frontmost app, which is patched only once a caller reads it). A window is unwatched after 5 minutes without use; at most 8 are watched at once (the least recently used goes); each keeps 8 versions. Background patching runs only for windows a caller read in the last minute, at most every 100 ms per window; others are patched when read.
  • Safety. The observer callback makes no accessibility call: it counts, queues and returns inside a try. Role lookups run on a separate dispatch thread with a 0.25 s messaging timeout, and watched apps get a 1 s timeout instead of the 6 s default, so a hung app can’t stall the others. Nothing on this path touches arc’s SkyLight input code (the D2 press crash). When an app quits, the probe or the next patch drops its watches and releases its arc state; a relaunch is a new pid, watched on its next read.
  • macOS run loop. The sidecar’s main thread now runs the Cocoa run loop (requests are served on a thread). Without it, NSWorkspace never refreshed its list of running apps, so an app launched after the sidecar started answered app_not_running.
  • Linux and Windows (D1b: the guest-image engines). The native engines run the structured members on guest images: engines/atspi.py walks the AT-SPI tree with pyatspi (roles mapped to the same AX-style vocabulary arc and Cua emit, so element ids and router decisions are comparable across OSes), acts through AT-SPI action/text/value interfaces, and posts keys and pixels through xdotool; engines/uia.py walks UI Automation with comtypes on one MTA thread, acts through invoke/value/selection/toggle patterns, and posts input through user32. Reads stay behind the same live-map contract: the observer (above) decides when a read is needed, the engine answers the tree. Both observers and engines were written to the macOS design and run for the first time on these images — validate-image.sh / validate-windows-image.ps1 prove hello and a populated read_ui before an image ships. Without pyatspi/comtypes or an accessibility bus, every window reports degraded and the API fails structured calls as driver_unavailable, never silently. Chromium and Electron apps (Chrome, the Allternit app) only publish an AT-SPI tree when accessibility is requested, so the Linux images set ACCESSIBILITY_ENABLED=1 (and GTK_MODULES=atk-bridge) for the desktop session, the headless app service and /etc/environment. Verified on the 1.1.6 cloud computer image (2026-10-10): read_ui on Chrome returns its tree through the AT-SPI engine.

Agent browser on Windows

Windows cloud computers run an agent’s browser through allternit-agent-browser, installed beside the driver (C:\Program Files\Allternit\Driver\allternit-agent-browser.cmd; source allternit_driver/agent_browser.py). Run it in the desktop session, the same one the driver’s logon task uses.
  • allternit-agent-browser start <agent_id> opens Microsoft Edge (Chrome if Edge is missing), headed, with --user-data-dir=C:\ProgramData\Allternit\browser-profiles\<agent_id> and prints {agent_id, pid, profile_dir, cdp_port}, the same shape as the Linux launcher. Starting an id that already runs returns the running browser. Agent ids are letters, digits, ., _ and -, up to 64 characters.
  • allternit-agent-browser stop <agent_id> closes only that agent’s browser (a polite close, then a forced one after 10 s). The profile stays, so logins and cookies survive the next start.
  • The UI Automation engine addresses the browser by the printed pid: read_ui, act and screenshots refuse a window that belongs to another process (window_not_found), so they never land on another window.
  • One agent at a time. Windows has one interactive desktop and the driver’s input lease is its single owner, so two agents take turns; each keeps its own profile.
  • No extension on Windows yet. Force-installing an off-store extension only works on managed machines, and our VMs are not managed, so the agent browser has no Allternit extension here. The Linux and Mac browsers cover that path.
  • Check: the manual workflow windows-browser-smoke.yml installs the driver from the checkout, starts two agent ids in turn, reads each window and uploads a screenshot of each.

Router

  • Capability first. An engine only gets an op it can do. Cua Driver 0.34 has no run_actions, so macOS batches run on arc today and the decision says capability. zoom stays with Cua. Cua 0.34’s parse_visual_regions is not used: it needs Cua’s optional cua-perception extension, which is AGPL; the vision fallback proposes its own regions.
  • Actions follow the map. An element action goes to the engine that produced the map its id came from, because only that engine holds the element’s handle.
  • Learning. For every op and app the router keeps calls, failures, a latency EWMA and the last 10 outcomes. An engine that failed at least half of 3 or more recent calls hands the op to the other engine. When both have 5 or more timed calls and the other is at most half as slow, it takes over. Read-only ops (verify, screenshot, zoom) try the other engine on one call in 20 until it has enough samples to compare. Input never explores.
  • Per user. The table is saved in the Desktop app’s data folder (computer-use/driver/router.json). Every routed op is written to computer-use/driver/audit.jsonl with its engine, reason, time and outcome.
  • Degraded apps. An empty tree (or Cua’s degraded_reason) marks the app degraded, and reads say so (degraded: true, degraded_reason). The vision fallback takes over for those windows: the router decides per read whether elements come from the tree, from vision, or from both, and records it (source, source_reason, router.sources).

One reader and one input owner per window

  • Only one tree walk of a window runs at a time. A reader that waited for another one reuses that walk if it finished in the last 250 ms.
  • Input to a window has one owner at a time. Input to different windows runs side by side.
  • Screen-wide pixel input (pixel_*) lands wherever the pointer or focus is, so it excludes all window input while it runs.

Agent browsers on Linux: one display per agent

On Linux cloud computers (the desktop image and the headless developer image) each agent gets its own X display and its own kept Chrome profile, so two agents can work at the same time without typing into each other’s windows, and neither touches the person’s screen (:0).
  • Headed, never headless. The agent browser is Google Chrome running headed on a bare Xvfb (no desktop environment, no window manager). Xvfb is a real X server, so sites see a normal headed Chrome. Headless Chrome flags are not used for agent runs.
  • The launcher. allternit-agent-display start <agent_id> (allternit_driver/agent_display.py, installed as /usr/local/bin/allternit-agent-display by install-driver.sh and cloud-init.yaml) starts Xvfb on the next free display from :10, then Chrome on it with --user-data-dir=/var/lib/allternit/browser-profiles/<agent_id>. It prints one JSON object: display, pid (the Chrome browser process, the pid read_ui and act take), xvfb_pid, profile_dir, cdp_port (9300 + N, loopback), vnc_port (5900 + N on the desktop image, null on headless) and the screen size. Starting an agent that already runs returns the same display with "reused": true.
  • Stopping. allternit-agent-display stop <agent_id> ends Chrome, x11vnc and Xvfb. The profile directory stays, so the agent’s sign-ins and cookies are there on its next run. allternit-agent-display list shows what runs; records whose Xvfb died are cleaned up on every call.
  • Memory cap. Each display costs about 400 MB (ALLTERNIT_AGENT_DISPLAY_MB) after a 1536 MB reserve for the app, allternit-api and the sidecars (ALLTERNIT_AGENT_DISPLAY_RESERVE_MB), and never more than the memory free right now. A 4 GB computer runs up to 6. Past the cap start exits 3 with {"error": "display_limit", "cap", "running", ...} and a plain message; nothing is started. ALLTERNIT_AGENT_DISPLAY_MAX lowers the cap; the image can set these in /etc/allternit/agent-display.env.
  • Driver calls target a display. Windows from read_ui/windows carry display, read from the Chrome process’s own environment (/proc/<pid>/environ), and every xdotool and scrot call for that window runs on that display. Calls with no window take display (":10"): screenshot with only display is that agent’s screen, and pixel_* with display sends input there. read_ui with display only matches windows on that display, so a call never falls through to another agent’s window. Values other than :N are refused. hello reports "displays": true on Linux guests.
  • AT-SPI on many displays. Accessibility is keyed to the D-Bus session, not to the X display. Every agent Chrome joins the guest’s one shared session bus (/run/allternit/session-bus.env, written by the desktop’s run.sh or allternit-session-bus.service) with GTK_MODULES=atk-bridge, ACCESSIBILITY_ENABLED=1 and --force-renderer-accessibility. A new :N has no AT_SPI_BUS root-window property, so Chrome’s bridge asks the session bus for org.a11y.Bus.GetAddress and joins the same accessibility bus as everything else (the launcher calls GetAddress first, so the bus launcher is running). The one AT-SPI registry the driver already reads then lists every agent’s Chrome, told apart by pid, and the live observer’s events arrive the same way. A bus per display would need one pyatspi registry per bus, and pyatspi keeps one registry per process, so the driver does not do that. Element coordinates are in each display’s own space, which is the space xdotool uses on that display.
  • Wired in allternit-api. A toolset call with a run_id on a Linux cloud computer starts the run’s display on its first call and names it on every driver call after that; the run’s end stops it. See Agent displays on Linux cloud computers.
  • Live view. On the desktop image each agent display has its own x11vnc on 5900 + N (loopback, the same port rule as the extra bot screens in computer_screens.rs). On the headless image there is no VNC; a run’s live view is the driver’s screenshot with that run’s display.
  • The Allternit extension. install-browser-policy.sh writes /etc/opt/chrome/policies/managed/allternit.json (ExtensionSettings, force_installed) for id hkillgnnhkokmjcjjpolpnecmdnilhod only when the image build passes ALLTERNIT_EXTENSION_UPDATE_URL, an https update manifest that serves a CRX3 of the extension. The extension is not on the Chrome Web Store, and no CRX or update manifest is hosted yet, so today the policy file is not written and the build log says what is missing. Google Chrome 137 and later ignore --load-extension, so a command-line install is not a fallback.
  • Input is serialized. Screen-wide pixel_* input still takes the one desktop input lock, so two agents’ pixel steps take turns (each step is short). Element actions on different windows run side by side.

Safari on this Mac

Agent runs on this Mac browse in Safari, because sites turn Chrome automation away. Safari is one process for all of its windows, so the driver treats it specially (arc_cua/backends/macos_safari.py). Why. Inside one Safari process, key events go to Safari’s key window, whatever window they are addressed to. The 2026-11-26 spike (agent-browser plan, step 1) showed an agent’s keys landing in the person’s window, and two agents’ keys interleaving in a third window. Background key focus is borrowed per process, so it cannot keep two windows of the same app apart. Accessibility value writes (AXValue) do stay in their window: they passed with two agents typing at once and with the person typing in another window. They reach the page as a trusted input event, but with no keydown. Text entry. act with set_value or type on a Safari field:
  1. Writes the text as an accessibility value and reads it back. A Safari value is read again after 150 ms, so a page that resets it counts as a rejection.
  2. Focuses the field first only when the agent’s window is already Safari’s key window, or is Safari’s only window. Focusing a web field in another window makes that window key, and the person’s typing follows it.
  3. Falls back to real keystrokes only when the page rejects the value. Those keys wait in a queue per Safari process (below).
act takes an optional focus. With focus: false, the field is never focused and nothing is typed: if the page rejects the value, the call fails with value_rejected. use_credential should pass it, so a secret only ever goes to the field the agent picked. Leave focus out for the automatic rule above. focus: true keeps the old behaviour (always focus first). Key queue. One sender at a time per Safari process. A batch of up to 16 characters is sent only when both of these hold:
  • The person is not using Safari: Safari is not their front app, or they have been idle for more than 3 s. The driver’s own posted events also reset the idle clock, so they don’t count as the person.
  • The agent’s window is Safari’s key window. The queue makes it key (AXMain), checks it, and sends. Keys are never sent while another Safari window is key.
After the last batch, the previous key window is handed back. If the person comes back to Safari mid-run, their window is handed back at once and the rest waits. Keys that get no safe turn within 30 s fail with keys_held, and nothing more is typed. Background key input for every app now also refuses (key_window_busy) when the person’s front app is the target app and the target window is not its key window. Before this change, those keys landed in the person’s window. A window per run. safari_window with op: "open" opens a new window from File > New Window > New “Allternit Agent” Window and returns its pid and window_id. Safari starts in the background if it isn’t running. op: "close" with that window closes it. The driver closes only windows it opened in this session, and it never touches the person’s own windows or profiles. allternit-api calls it at the start of every browser run on this Mac and closes it when the run ends (Safari windows on this Mac). When more than one new window shows up at once, the window that shows the profile name to accessibility is taken; otherwise the open fails rather than guess. The “Allternit Agent” profile. When the profile is missing, open tries Safari > Create Profile…, fills in the name, and closes only the windows that step opened. It does not try while the person is using Safari. When it cannot create the profile, it fails with profile_missing, and data carries reason (not_found, person_using_safari, no_create_command, create_failed), the profile name and the manual steps. Desktop shows these as a one-time setup card:
  1. In Safari, choose Safari > Create Profile… (or Safari > Settings > Profiles > New Profile).
  2. Name it Allternit Agent and click Create Profile.
  3. Done. Agent runs open their windows with File > New Window > New “Allternit Agent” Window.
Not yet checked on a real Mac: creating the profile by script, and whether a profile window shows the profile name to accessibility. The suite tasks safari-two-agents, safari-user-typing and safari-password-set-value (domains/computer-use/suite/tasks/mac/) are the live check. Each one passes only when the agent’s text is exact and the person’s window text is unchanged.

Packaging

  • This device (Desktop). npm run prepare:allternit-driver (surfaces/allternit-desktop/scripts/prepare-allternit-driver.cjs) copies domains/computer-use/driver into the app’s resources and stages a relocatable CPython 3.12 per target from python-build-standalone, pinned by sha256. macOS targets also get the pinned PyObjC frameworks arc needs. A venv would point at the build machine’s Python, which users don’t have.
  • The Desktop app starts the sidecar after Cua Driver, through spawnSidecar, so it and its cua-driver mcp child stop with the app. Python runs with -B -s -E: no bytecode written into the signed bundle, no user site-packages or PYTHON* variables.
  • The this-device socket is computer-use/allternit-driver.sock in the app’s data folder, mode 0600 in a 0700 folder. Windows listens on 127.0.0.1 on a random port and every request carries a per-launch token; allternit-api connects there over loopback TCP (env ALLTERNIT_DRIVER_ENDPOINT + ALLTERNIT_DRIVER_TOKEN), so this-device read_ui/act/pixel input all go through the one driver on Windows too — the Cua CLI fallback remains only for Desktops too old to ship the sidecar. allternit-api gets the socket in ALLTERNIT_DRIVER_SOCKET and sends this Mac’s pointer and keyboard input through pixel_*. hold_key still posts CoreGraphics events itself. If an older Desktop app runs without the sidecar, input falls back to Cua Driver’s CLI.
  • Guests (D1b). domains/computer-use/driver/packaging/ installs the driver into every image that ships to users: the Incus desktop/cloud/headless builds (cmd/allternit-computer-cloud/guest/build-*.sh and cloud-init.yaml), the sandbox container (core/sandbox/container/Dockerfile.driver), the tart VMs (infrastructure/tart-host/build-image.sh, as a session autostart entry), and Firecracker rootfses (ALLTERNIT_DRIVER_DIR in drivers/firecracker/src/rootfs.rs). Linux guests run it as allternit-driver.service on /run/allternit/driver.sock; Windows guests run it as a logon scheduled task on loopback TCP with a launch token; both expose the allternit-driver-rpc forwarder that allternit-api drives through the guest exec channel. xdotool/scrot and the PowerShell input helpers remain installed as the explicit fallback when the driver is down. validate-image.sh and validate-windows-image.ps1 check the service, the hello capability report and a real read_ui before an image ships.
  • The socket is computer-use/allternit-driver.sock in the app’s data folder, mode 0600 in a 0700 folder. Windows listens on 127.0.0.1 on a random port and every request carries a per-launch token; allternit-api connects there over loopback TCP (env ALLTERNIT_DRIVER_ENDPOINT + ALLTERNIT_DRIVER_TOKEN), so this-device read_ui/act/pixel input all go through the one driver on Windows too — the Cua CLI fallback remains only for Desktops too old to ship the sidecar.
  • allternit-api gets the socket in ALLTERNIT_DRIVER_SOCKET and sends this Mac’s pointer and keyboard input through pixel_*. hold_key still posts CoreGraphics events itself. If an older Desktop app runs without the sidecar, input falls back to Cua Driver’s CLI.

Measurements

Measured on 2026-10-09 on a Mac running macOS 14.6, through the sidecar’s socket, so each figure includes the JSON-RPC round trip. Other work kept the machine’s load average at about 14 during the run. The baseline is Cua Driver 0.34 alone on the same Mac.
  • First read. It includes the one-time setup for an app: the notification watch, the window lookup and the walk. TextEdit misses 150 ms because its accessibility answers are slow (about 3 ms per element on this Mac; upstream arc measures the same). While computer use is active, and once at launch, the driver prepares whichever app comes to the front, so the read that follows a switch is a 4–5 ms cached answer. The live map (below) replaced these D1 figures for re-reads.
  • Batch. The middle step is slower because Calculator posts no notification for +, so arc waits out its 0.6 s no-reaction window before it calls the step settled.
  • Under heavy load (load average 30–200 from other work on the same Mac) walks were 3–10 times slower, and so was upstream arc. Re-reads stayed under 25 ms.

Live map (E4)

Measured on 2026-10-09 on the same Mac (macOS 14.6, load average 5–6), through the socket, one new connection per request.
  • A change made outside the driver (a pixel_click on Calculator’s “8”, typing into TextEdit with pixel_type_text): the first read_ui with since after the input already had the new version and the right diff (display 78; the text area’s new value), 0.7 ms and 9 ms after the input call returned.
  • Stale version: act with the version from before a click came back stale_version with the current map in 5 ms.
  • Idle: 0.2–0.4 % CPU over 30 s while watching 4–6 windows (one of them a terminal posting over a thousand notifications), measured in three runs.
  • App quit and relaunch: after Calculator quit, read_ui answered app_not_running and its watch was gone within one probe; after the relaunch the first read took 28 ms and the re-read 0.45 ms. The sidecar kept running.

Baseline

Cua Driver 0.34 on this Mac before the driver (spec §0): full reads without a screenshot of 745 / 647 / 933 ms (Calculator / TextEdit / Finder), 106–130 ms when capped at 60 elements, and about 1.3 s for a verified click.