agent-desktop on Linux
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
Use an at-spi2-core bridge with fix dc0dc33 before observing applications.
Ubuntu 22.04's older bridge can abort the target on Action.GetActions; a reachable bus does not prove it is safe.
Run agent-desktop status as the target's user in the same desktop session.
It probes the AT-SPI registry through the session's accessibility bus:
permissions.accessibility is granted when the registry answers, even if
list-apps is empty. denied with no supported_surfaces means the bus is
unavailable, not an empty desktop. Follow the reported setup suggestion.
automation is not_required. screen_recording is not_required when the
X11 capture probe answers and unknown on Wayland or an unproven display.
There is no accessibility permission dialog. The target must share the bus, including through a sandbox. Restart an app that predates the bus only after preserving its work. Never restart another user's or a shared host's live bus; use a private session and runtime directory for isolated work.
Platform behavior
- Semantic AT-SPI observation and actions work on X11 and Wayland. A reachable accessibility bus does not establish pointer, window-control, capture, shell, notification, or tray capability.
- GTK refs can retain native element addresses and ancestry. Chromium, Qt, and unknown-toolkit refs must be unique in the window or inside their nearest unique ancestor. Take fresh refs after list changes; a narrower drill does not disambiguate identical twins.
- A table reports
row_countandcolumn_count, and a large sheet is read by its cells in view. While a window shows a sheet read this way, a ref that carries no native element address is refused: a twin could sit among the cells that were not read. A cell's text is itsvalue. Where a spreadsheet names a cell by its address, get it withfind --role cell --name B7 --root '<table ref>'.set-valueon an editable cell takes a number; text has no background route and is refused.clickandselecton a table cell select it where the table supports that; a GTK3 tree view does not. - GTK4 list-backed dropdowns stay in the window tree. Use
wait --textandsnapshot --rootto read their contents, not a menu-surface wait. Menu-role popups use the menu surface instead. - Popup and dialog openers can take the foreground and refuse headless.
Qt combo selection may need pointer input to commit rather than highlight a row.
Stop on a headed-only refusal instead of changing mode. Headless
restoreof a minimized window and headlessminimizeof the focused window refuse withPOLICY_DENIED; the system raises or moves focus. - Headless
focus-windowalways returnsPOLICY_DENIEDand sends nothing. A headlessfocuson a ref that takes key focus also returnsPOLICY_DENIED. Use--headed focus-windowonly when the user asks for a visible focus change. - A headless graceful
close-appof a native Wayland client returnsACTION_NOT_SUPPORTED(details.cause: wayland_session).--forcediscards unsaved work. When it cannot read the focused window it fails withPOLICY_DENIED(details.kind: focus_unreadable) before any close request is sent. press --appworks headless only when the target's window is active. Otherwise it sends nothing and returnsACTION_FAILED(details.check: window_active), orSTALE_REFwhen the window has no process identity.- A Qt toggle button that offers only the
Toggleaction (noPress) flips its checked state on a headlesscheckortoggle, but the app may not react as it does to a click (for example, a panel does not open). Verify the app's own result; when only a click opens it, the user must ask for--headed. permissionsand the other read-only probes connect to the accessibility bus without announcing a listener, so they never look like an assistive client to Chromium or Electron. A command that reads a tree announces one.- On X11 a command that sent keys ends up to 200 ms after its last key, before the accessibility connection closes. The last client leaving mid-key can crash GTK 3, Chromium and Electron apps.
- A node whose
GetActionsdoes not answer within 300 ms is read by index fromNActionsandGetName, so WebKitGTK and Chromium content stays in the tree. When that also fails, the node keeps its place and its actions field is failed. - On X11 a toolkit that draws at a device scale (GTK with
GDK_SCALE, a scaled GNOME session) reports window coordinates in logical pixels while the window sits at physical pixels. Bounds, headed clicks and the cursor overlay use physical pixels: the factor is the whole number from 2 to 4 that the window's X client size shows over the size the frame reports, and any other ratio leaves coordinates as read. Fractional scales and popups are not scaled. - A GTK4 list or grid view has no row nodes, so
selectandclickcannot pick a row. - A headless
selecton a GTK4 list box is refused withselection_index_unproven: the toolkit gives no promise that its selection indices name the rows it presents, so only--headedon X11 clicks the row. - A window can precede its content. Wait for the application's observable result; an accepted AT-SPI call or a changed selected value does not prove that handlers ran. Wait for each effect before another click.
- With
WAYLAND_DISPLAYunset andDISPLAYnaming an Xwayland, the window listing classifies frames as on a Wayland session: the display answers theXWAYLANDextension, so native Wayland windows are listed and the compositor frames are not read as X11 windows. An Xwayland that does not answer is read as plain X11. - Wayland refuses headed pointer input; window operations can use a mapped Xwayland client, but native Wayland windows lack that route.
- Authorized physical
typesends a newline asReturnon X11 too and refuses a tab and other control characters. On Wayland it sends a newline asReturnand a tab asTab, which can submit a form or move focus instead of inserting literal text. - Wayland per-window screenshots are unsupported; display capture uses a portal that can ask for consent.
Ask the user before a visible consent flow, and do not retry a pending request in a loop.
GNOME draws monitors of different scales at the largest scale, so a
--screencapture of a lower-scale monitor reports that larger scale inscale_factor. An image whose size fits no layout isPLATFORM_NOT_SUPPORTEDwithdetails.reason: "display_mapping". A monitor turned by 90° or 270° reports the turned size, and a transform beyond the eight Wayland defines isPLATFORM_NOT_SUPPORTEDwithdetails.reason: "monitor_transform". - X11 capture depends on compositing: a covered noncomposited window may have no readable pixels, and a composited desktop may not support whole-screen capture. Neither failure authorizes focusing the target.
- Shell notifications need the supported GNOME service; tray reads need a StatusNotifierWatcher. A missing service is an error.
- Password-role values are withheld, but a field that only masks its text can be readable. Treat observation output as sensitive.
launchaccepts a program on PATH, an absolute path, an installed desktop id, or an unambiguous desktop entry name. A script launch attaches only to the interpreter process that runs that script, never to another script of the same interpreter.--no-attachrefuses any running process of the same program (the same executable, or the interpreter running the same script) whatever its arguments. Use process and window identity from observations rather than guessing from a window title. Without--activate, a launch on X11 gives the focus and window order back and reportsfocus_returned: true, orfalsewith a suggestion; a headless click that opens a dialog is guarded the same way.press escape --app <app> --window-id <id>on a background window with a showing native popup closes it only via a dismissal action (or GTK3 combo boxPress) and reportsdelivered_verifiedonce gone. Web content and buttons without a dismissal action keep the focus refusal; it never collapses a tree row.- Sandboxes are not available on Linux yet. To run agent-desktop in a container you manage yourself, see
agent-browser.dev/desktop/guides/docker-container.
Troubleshooting
Read the disposition before applying a fix. Match both the code and message.
| Code and message pattern | Cause and fix |
|---|---|
PLATFORM_NOT_SUPPORTED: session bus or accessibility bus unavailable |
Run in the target's desktop session. Install at-spi2-core if missing and share the accessibility bus with sandboxed targets; do not restart a shared live bus. |
APP_NOT_FOUND: running but not on the accessibility bus |
The process has not registered or its toolkit is inaccessible. Preserve work before restarting; Chromium may need --force-renderer-accessibility, and Qt needs QT_ACCESSIBILITY=1 at launch. |
STALE_REF: Stored ref does not match any live element (resolve_no_candidate) |
The adapter could not land the ref. Take a fresh snapshot in the same session; do not infer delivery from the missing target. |
POLICY_DENIED: foreground, popup, dialog, or pointer required |
The operation cannot run headless. Stop and tell the user which operation needs headed mode; do not add --headed. |
ACTION_NOT_SUPPORTED: Wayland pointer input, window operation, or native popup requires input |
The display server or toolkit cannot provide the route. Use an exposed semantic operation when available, or report the capability limit. |
PERM_DENIED or TIMEOUT: screenshot portal consent |
The portal denied capture or is waiting for the user. Ask the user to handle consent; do not loop or attempt to automate the inaccessible prompt. |
PLATFORM_NOT_SUPPORTED: missing clipboard owner helper or wl-clipboard |
X11 needs the shipped owner helper beside the binary; Wayland needs wl-copy and wl-paste. Repair the installation instead of treating the clipboard as empty. |
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. |
