agent-desktop on macOS
Use the core skill's headless observe, act, verify workflow. A platform capability
never authorizes --headed; only the user's explicit request does.
Setup and permissions
The sandbox provider on macOS is macos: a macOS VM that needs an Apple Silicon Mac, macOS 13 or later on the host and in the guest, and Xcode Command Line Tools. The first setup needs a person in the guest window; clones need none. See agent-browser.dev/desktop/sandboxes/macos.
agent-desktop status reports permissions and supported_surfaces. Accessibility must be granted for observation and actions; Screen Recording must be granted for screenshots, including session screenshot artifacts. Grant access to the app that launches the CLI and to the binary if listed separately. Ask the user to change the relevant privacy permissions, then confirm with agent-desktop permissions. A new CLI call sees a new grant; a batch retains its process's cached report.
permissions does not prompt. Requests use a bounded isolated helper.
The permission guide opens a visible settings page and guide panel, so ask the
user before starting it. It offers the app that started agent-desktop's process
tree: under tmux, the app that started the tmux server, which can differ from
the terminal you attach from; under SSH, the agent-desktop binary. Automation
may report unknown when consent would require a prompt.
Platform behavior
- Native AX element tokens identify individual controls, including twins. A stale token never falls back to a look-alike search. Elements without a token follow the uniqueness rule of the core skill.
list-windowsalso lists a floating or panel window an app raises above the normal level, as accessory apps do with settings and panels, while it is on screen.menuandmenubarobservations are application-owned and can omitdata.window. An app without an ordinary window may still expose process-owned surfaces. Inspectsupported_surfacesrather than assuming every surface exists.clicknever runsAXOpenon a member of a selectable collection: an element that reportsAXSelected, or one below an element that reportsAXSelectedChildren,AXSelectedRowsorAXSelectedCells, such as a file icon. It selects the member. Usedouble-clickto open it.press --appheadless:returnandescaperun as accessibility actions on the focused element. Any other key needs a focused element in the app (ACTION_FAILED,details.check: process_focus,not_deliveredotherwise). A modifier shortcut never runs a menu item:clickthe item.agent-desktop press escape --app <app>closes an open menu or popover with its cancel action when no focused element takes Escape, and reads that it closed; with--window-id <id>it closes the surface that window or the app shows. A popover can appear a moment after the click that opens it: read it withsnapshot --app <app> --surface popover.list-surfaceslists the sheets, alerts and popovers of every window, not only the focused one. A modal dialog and a system service panel, such as AirDrop from a share, arealertsurfaces; there is nodialogkind.- Notifications read Notification Center.
list-notificationsrefuses withPOLICY_DENIEDwhile Notification Center is closed because opening it takes focus, and works headless once the panel is open.dismiss-notification,dismiss-all-notificationsandnotification-actionalways require--headed; use--headedonly when the user asks. - Headless menu-opening and dialog-opening actions can refuse before delivery.
A label ending in an ellipsis predicts a dialog; it does not prove one exists.
A click on a button inside a popover refuses with
kind: popover_command: a share item starts a service whose window takes the front. Stop on a headed-only refusal rather than changing mode. Headlessrestoreof a minimized window and headlessminimizeof the focused window refuse withPOLICY_DENIED; the system raises or moves focus. - A file-name text field is not a file-system rename interface. Value-write actions refuse it because a changed field could falsely imply a renamed file.
- A tab button (
AXRadioButton, subroleAXTabButton) is selected by press rather than writingAXValue(which crashes Chromium); if a web tab ignores that press, report it and useclick --headedonly when the user asked. - Chromium accessibility is enabled by the adapter when needed. A sparse or incomplete read still needs another observation, not an assumption of absence.
- A table cell carries its grid address in
native_id(kindgrid_cell, for exampleB7), or its own identifier when it has one; the address finds it either way. Get one cell withfind --role cell --native-id B7 --root '<table ref>'. A cell that spans several rows or columns has no address. set-valueandclearon a table cell that listsSetValuewrite its value directly when the cell takes one. Any other cell is written through its own editor and committed with Return, without activating the app. Text and Return go only to that editor. An application that moves a value into an editor of its own, as a spreadsheet does with a formula that starts with=, leaves it typed and open, and the write fails asdelivered_unverified: commit it withpress return --app <app>. The cell is read after the commit: a cell that still shows nothing fails asACTION_FAILEDwithdelivered_unverified, and one that shows another value staysdelivered_unverified. An application that gives its cell editor no keyboard input from a press always takes that failure; type there with--headedonly if the user explicitly asked for that. The write also commits an edit that is open in another cell.- AX success alone does not prove an application effect. Verify the result independently, especially after a menu action or value write.
Troubleshooting
Read the disposition before applying a fix. Match both the code and message.
| Code and message pattern | Cause and fix |
|---|---|
PERM_DENIED: Accessibility or Screen Recording permission |
The launching app lacks the relevant grant. Ask the user to grant it, then check permissions in a new CLI call. |
POLICY_DENIED: interaction policy, menu, dialog, or physical route |
The operation cannot run headless. Stop and tell the user which operation needs headed mode; do not add --headed. |
ACTION_NOT_SUPPORTED: The field shows a file's name |
A value write cannot prove a rename. Use the app's exposed rename operation or an authorized file-system operation, then verify the file itself. |
STALE_REF: Element not found (resolution_complete_absence) |
The adapter could not land the ref. Take a fresh snapshot in the same session; do not infer delivery from the missing target. |
APP_UNRESPONSIVE: accessibility action did not complete |
A modal action may already have landed. If retry is unsafe, inspect the relevant surface and live state without repeating it. |
WINDOW_NOT_FOUND: no window or requested surface |
A running process need not own a window. Read list-windows and list-surfaces; wait for the needed surface instead of activating the app. |
PERM_DENIED: private file parent is accessible by group or other users |
The state root is not private. Run chmod 700 "${AGENT_DESKTOP_HOME:-$HOME/.agent-desktop}", or use a new state root and let the tool create it. |
PERM_DENIED: private file parent is not owned by the effective user |
The directory belongs to another user. Point AGENT_DESKTOP_HOME at a new directory under your home and let the tool create it; do not take over someone else's state. |
needs_setup from sandbox status for a sandbox that worked before |
The guest agent, agent-desktop-guest, is not running in the guest, or Accessibility is off for it. Run sandbox stop <name>, then sandbox start <name> --window. In the guest, turn on automatic login, run sh "/Volumes/My Shared Files/guest-setup.sh" in Terminal, and switch on agent-desktop-guest in System Settings > Privacy & Security > Accessibility. Then check status on the host. A sandbox set up by agent-desktop 1.3.0 needs this once. |
ACTION_NOT_SUPPORTED: The packaged macOS clipboard helper is missing or invalid |
Every clipboard command runs the packaged agent-desktop-macos-helper beside the binary, and it is checked before launch: a regular file (not a symlink) owned by you, executable, one link, no group or world write, no ACL that lets someone else change it, under directories owned by you or root that are not group or world writable unless sticky. details.kind is clipboard_helper_invalid or clipboard_helper_not_found, and platform_detail names the failed rule. Repair the install; the clipboard is not empty. |
