Computer use CLI for AI agents
Rust accessibilityaccessibility-apiai-agentsautomationclicomputer-usecomputer-use-agentcomputer-use-agentsdesktop-automationmacosmcprust
docs: simplify the README and repo docs (#481)
Lahfir17467da5142d
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex b52c847d3..7614910d7 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -1,99 +1,99 @@# Contributing to agent-desktop-agent-desktop is a native Rust CLI and FFI library that gives AI agents structured access to desktop applications through OS accessibility trees. Contributions that sharpen that core mission are welcome.+agent-desktop is a Rust CLI and C library. It reads native accessibility trees and returns structured JSON with ref-based element ids, so AI agents can observe and act on desktop apps.-## Kinds of contributions that fit this project+## Contributions that fit-- **Bug fixes** — wrong JSON output, incorrect ref resolution, `STALE_REF` on a stable target, etc.-- **New commands** — additions to the 60-command surface (56 operational, four held-input names fail closed); see the steps in [AGENTS.md](AGENTS.md#architecture)-- **Platform adapters** — fixes and features for the macOS, Windows and Linux adapters, each implementing `PlatformAdapter`-- **App-specific quirks** — documented edge cases for specific apps (Electron, game engines, etc.) under `skills/`-- **Docs and skill files** — keeping `skills/agent-desktop*/` accurate when behaviour changes+- Bug fixes, such as wrong JSON output, incorrect ref resolution, or `STALE_REF` on a stable target.+- New commands. Follow the steps in the Architecture section of [AGENTS.md](AGENTS.md#architecture).+- Platform adapter fixes and features for macOS, Windows and Linux. Each adapter implements `PlatformAdapter`.+- App-specific quirks, such as Electron or game engine edge cases, documented under `skills/`.+- Docs and skill files. Keep `skills/agent-desktop*/` accurate when behavior changes.-Out of scope: embedding LLMs, GUI/TUI interfaces, browser automation, macro recording.+Out of scope: embedding LLMs, GUI or TUI interfaces, browser automation (use agent-browser for that), and macro recording.-## Code of Conduct+## Code of conduct-This project follows the guidelines in [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). All contributors are expected to uphold them.+Follow the [Code of Conduct](CODE_OF_CONDUCT.md).## Prerequisites| Requirement | Notes ||---|---|-| **Rust toolchain** | Pinned to 1.89.0 via `rust-toolchain.toml` (`rust-version` 1.89 is the MSRV). `rustup` picks the correct channel automatically. |-| **macOS 13+** | Required to build and run the macOS adapter (`crates/macos/`), with the Xcode command-line tools. |-| **Windows** | The Windows adapter (`crates/windows/`) builds on Windows only, with the MSVC build tools. |-| **Linux** | The Linux adapter (`crates/linux/`) builds on Linux only. Its live tests need an AT-SPI session; see `tests/e2e-linux/README.md`. |-| **Python 3** | `scripts/check-rust-file-size.sh` runs a Python helper and fails when no Python 3 is on `PATH`. |-| **Accessibility permission** | Required on macOS for integration and E2E tests against real apps. Grant it in **System Settings > Privacy & Security > Accessibility** by adding the terminal you run tests from. |-| **Screen Recording permission** | Required on macOS only for `screenshot` tests. Same path in System Settings. |+| Rust toolchain | 1.89.0, pinned in `rust-toolchain.toml`. `rust-version` 1.89 is the MSRV. `rustup` installs the pinned channel. |+| macOS 13 or later | Needed to build and run the macOS adapter (`crates/macos/`). Requires the Xcode command-line tools. |+| Windows | Builds the Windows adapter (`crates/windows/`). Windows only. Requires the MSVC build tools. |+| Linux | Builds the Linux adapter (`crates/linux/`). Linux only. Live tests need an AT-SPI session. See `tests/e2e-linux/README.md`. |+| Python 3 | `scripts/check-rust-file-size.sh` runs a Python helper and fails when no Python 3 is on `PATH`. |+| Accessibility permission | macOS, for integration and E2E tests against real apps. Add the terminal you test from under **System Settings > Privacy & Security > Accessibility**. |+| Screen Recording permission | macOS, for `screenshot` tests. Add the terminal under **System Settings > Privacy & Security > Screen Recording**. |## Getting started+Clone the repository and turn on the pre-commit hook. Run the `git config` line once per clone.+```bashgit clone https://github.com/vercel-labs/agent-desktopcd agent-desktop--# Wire up the pre-commit hook (one time per clone)git config core.hooksPath .githooks+```-# Every platform adapter compiles on its own OS only, so unscoped workspace-# commands fail on every host. Scope cargo to the host package set.-# macOS:-HOST_PKGS=(-p agent-desktop-core -p agent-desktop-macos -p agent-desktop -p agent-desktop-ffi)-# Windows: swap agent-desktop-macos for agent-desktop-windows.-# Linux: swap agent-desktop-macos for agent-desktop-linux.--# Debug build-cargo build "${HOST_PKGS[@]}"+Every platform adapter compiles only on its own OS, and the workspace names all three. An unscoped `cargo build` or `cargo test --workspace` fails on every host, so scope cargo to the host's packages. The example uses macOS. On Windows, replace `agent-desktop-macos` with `agent-desktop-windows`. On Linux, use `agent-desktop-linux`.-# Release build (optimised, < 15 MB)-cargo build --release -p agent-desktop+```bash+HOST_PKGS=(-p agent-desktop-core -p agent-desktop-macos -p agent-desktop -p agent-desktop-ffi)-# Run the binary+cargo build "${HOST_PKGS[@]}" # debug build+cargo build --release -p agent-desktop # release CLI; CI fails it above 15 MB./target/release/agent-desktop snapshot --app Finder -i```-`HOST_PKGS` is an array so that it expands to separate arguments in both bash and zsh, the macOS default shell.+`HOST_PKGS` is an array, so each entry expands to a separate argument in bash and zsh. zsh is the macOS default shell.-## Dev workflow and quality gates+## Quality gates-All of these must pass before a PR is merged. Set `HOST_PKGS` as shown in Getting started.+Every gate below must pass before a PR merges. Set `HOST_PKGS` as shown above.```bash-# Format checkcargo fmt --all -- --check--# Lint — zero warnings requiredcargo clippy "${HOST_PKGS[@]}" --all-targets -- -D warnings+cargo test "${HOST_PKGS[@]}" --lib # adapter stubs and golden fixtures; skips the binary crate+cargo test -p agent-desktop # CLI contract, dispatch, batch and policy tests+cargo test -p agent-desktop-ffi --tests # C ABI, enum fuzzing and out-param zeroing+cargo tree -p agent-desktop-core # must name no platform crate+AGENT_DESKTOP_E2E_EXCLUSIVE=1 bash tests/e2e/run.sh # macOS only; needs an exclusive desktop and Accessibility permission+```-# Library unit tests (adapter stubs, golden fixtures); skips the agent-desktop binary crate-cargo test "${HOST_PKGS[@]}" --lib+CI runs its test steps through `scripts/cargo-test-isolated-home.sh`, which gives cargo a throwaway `HOME`, so tests never touch `~/.agent-desktop`. The pre-commit hook does the same for its `--lib` step. Run the script locally for the same isolation:-# Binary-level command tests (CLI contract, dispatch, batch, policy)-cargo test -p agent-desktop+```bash+scripts/cargo-test-isolated-home.sh test "${HOST_PKGS[@]}" --lib+```-# FFI integration tests (C-ABI, enum fuzzing, out-param zeroing)-cargo test -p agent-desktop-ffi --tests+`tests/e2e/run.sh` builds the release CLI, the macOS helper and the FFI library itself. It refuses to run without `AGENT_DESKTOP_E2E_EXCLUSIVE=1`, because headed cases move the real cursor. See `tests/e2e/README.md` for what it asserts and how to add a scenario.-# Core isolation — output must contain no platform crate names-cargo tree -p agent-desktop-core+CI also checks what a local run can miss:-# macOS only: E2E harness against the SwiftUI fixture app (needs an exclusive desktop and AX permission)-AGENT_DESKTOP_E2E_EXCLUSIVE=1 bash tests/e2e/run.sh-```+- The 15 MB limit on each shipped executable.+- The Rust 1.89 MSRV build.+- Drift between the committed header `crates/ffi/include/agent_desktop.h` and the Rust ABI. Regenerate it with `scripts/update-ffi-header.sh`, which needs cbindgen 0.29.4.+- The `cargo-deny` policy in `deny.toml`.+- Secret scanning, CodeQL and workflow linting.-CI and the pre-commit hook run `cargo test` through `scripts/cargo-test-isolated-home.sh test ...`, which gives cargo a throwaway `HOME` so tests never touch `~/.agent-desktop`. Use it the same way locally when you want that isolation.+## Pre-commit hook-`tests/e2e/run.sh` builds the release CLI, macOS helper and FFI library itself and refuses to run without `AGENT_DESKTOP_E2E_EXCLUSIVE=1`, because headed cases move the real cursor. `tests/e2e/README.md` covers what it asserts and how to add a scenario.+`.githooks/pre-commit` mirrors the CI gates. The script is the authoritative list. For a commit that stages `.rs` or `.toml` files, the hook runs these over the host's package set:-CI also enforces what a local run can miss: the 15 MB limit on each shipped executable, the Rust 1.89 MSRV check, drift of the committed C header `crates/ffi/include/agent_desktop.h` from the Rust ABI declarations (regenerate it with `scripts/update-ffi-header.sh`, which needs cbindgen 0.29.4), the `cargo-deny` dependency policy in `deny.toml`, secret scanning, CodeQL, and workflow linting.+- `scripts/check-rust-file-size.sh`, `scripts/check-architecture.sh`, `scripts/check-no-phase-references.sh` and `scripts/check-stale-ref-constructor-misuse.sh`+- `cargo fmt --all -- --check`+- Clippy with `-D warnings`+- The `--lib` tests-## Pre-commit hook+When the commit touches `crates/ffi/`, the hook also runs the stub-adapter passthrough test and the cbindgen header-drift check. The drift check is skipped when cbindgen 0.29.4 is not installed. CI still runs it.-`.githooks/pre-commit` is the local mirror of the CI gates, and the script is the authoritative list. On a commit that stages `.rs` or `.toml` files it runs, over the package set for the host OS, the source-rule scripts in `scripts/` (`check-rust-file-size.sh`, `check-no-phase-references.sh`, `check-stale-ref-constructor-misuse.sh`), `cargo fmt --all -- --check`, clippy with `-D warnings`, and the `--lib` tests. When the commit touches `crates/ffi/` it also runs the stub-adapter passthrough test and the cbindgen header-drift check (skipped when cbindgen 0.29.4 is not installed; CI still runs it). A commit that only touches `scripts/`, `.githooks/`, `.github/workflows/` or `tests/e2e-linux/` runs the Bash 3 compatibility and no-phase-reference checks.+A commit with no Rust or FFI changes that touches `scripts/`, `.githooks/`, `.github/workflows/` or `tests/e2e-linux/` runs the Bash 3 compatibility and no-phase-reference checks.-To bypass in a genuine emergency:+Bypass the hook only in an emergency:```bashgit commit --no-verify@@ -103,43 +103,40 @@ SKIP_PRECOMMIT=1 git commit -m "..."## Engineering rules-[AGENTS.md](AGENTS.md) holds the engineering rules, and they bind people and coding agents alike: Conventional-Commits, the 400-line cap per Rust file, no inline comments, no delivery-plan references in shipped source, one domain-type per file, error handling, core isolation, and the steps for adding a command. The pre-commit hook and CI enforce-most of them.+[AGENTS.md](AGENTS.md) holds the engineering rules for people and coding agents. They cover Conventional Commits, the 400-line cap per Rust file, no inline comments, no delivery-plan references in shipped source, one domain type per file, error handling, core isolation and the steps for adding a command. The hook and CI enforce most of them.-**Skills stay in sync.** Every new command or changed CLI flag must be reflected in the matching skill. Cross-platform behavior goes in the core skill, `skills/agent-desktop/` (its `references/` hold the per-command detail). Platform behavior goes in `skills/agent-desktop-macos/`, `skills/agent-desktop-windows/` or `skills/agent-desktop-linux/`, and C ABI changes in `skills/agent-desktop-ffi/`. The binary embeds these skills and AI agents read them, so they must match the implementation.+Skills stay in sync. A new command or a changed CLI flag must update the matching skill. Cross-platform behavior goes in `skills/agent-desktop/`. Platform behavior goes in `skills/agent-desktop-macos/`, `skills/agent-desktop-windows/` or `skills/agent-desktop-linux/`. C ABI changes go in `skills/agent-desktop-ffi/`. The binary embeds these skills and agents read them, so they must match the code.## Submitting a pull request-1. **Pick the right base branch.** Branch from `main` and open the PR into `main` for every platform, core and FFI work, Linux included.-2. **Keep PRs focused.** One logical change per PR; separate refactors from features.-3. **Make sure all quality gates pass** locally before pushing (see Dev workflow above).-4. **Use a Conventional Commit title** for the PR title. It becomes the squash-merge commit message.-5. **Link related issues** with `Fixes #N` or `Refs #N` in the PR description.-6. **Check that `cargo tree -p agent-desktop-core` is clean** if you touched any crate dependency.-7. CI runs automatically on every push. A red CI is a blocker.+1. Branch from `main` and open the PR into `main`. This applies to every platform, core, FFI and Linux work.+2. Keep each PR to one logical change. Separate refactors from features.+3. Pass every quality gate locally before pushing.+4. Use a Conventional Commit title. The squash merge uses it as the commit message.+5. Link related issues with `Fixes #N` or `Refs #N` in the description.+6. If you changed a crate dependency, check that `cargo tree -p agent-desktop-core` is still clean.+7. CI runs on every push. A red CI blocks the merge.## Publishing source and diagnostic evidence-Use a reviewed Git revision or the release workflow to assemble public source and packages. Do not upload the working directory or local internal-document archives: ignored files can contain agent settings, transcripts, screenshots and personal filesystem paths. Browser automation captures and local demo recordings also need review before they are added to Git. Ignore rules prevent accidental staging; they do not sanitize files or prevent force-adds.+Publish from a reviewed Git revision or through the release workflow. Never upload the working directory or local internal-document archives. Ignored files can hold agent settings, transcripts, screenshots and personal file paths. Review browser captures and demo recordings before adding them to Git. Ignore rules only stop accidental staging. They do not sanitize files or block force-adds.-Run the repository's secret/privacy scan and its scanner regression check before publishing. Credentials must remain detectable in lockfiles, fixtures and lines that also contain safe example values. Review media visually; a text scanner cannot establish that a video, screenshot or audio track is safe.+Run the secret and privacy scan before publishing. It is gitleaks with `.gitleaks.toml`. Its regression check is `node scripts/check-gitleaks-policy.mjs ./gitleaks`. Credentials must stay detectable in lockfiles, fixtures and lines that also contain safe example values. Review media by eye. A text scanner cannot show that a video, screenshot or audio track is safe.-The supply-chain scan records two exact historical findings for machine SIDs in an old Windows E2E plan. They are absent from the current tree and are not credentials. The exceptions acknowledge their presence in published history; they do not erase it or exempt new SIDs, other commits or credentials. Do not replace these fingerprints with broad path or rule exclusions.+`.gitleaksignore` holds two exact fingerprints for Windows machine SIDs in an old E2E plan. Those SIDs are not in the current tree and are not credentials. The entries record that the SIDs exist in published history. They do not erase that history, and they do not cover new SIDs, other commits or real credentials. Do not replace them with broad path or rule exclusions.-Git commits retain author and committer names and email addresses. Use your account's verified GitHub noreply address for future commits if you do not want a personal address published. Existing public attribution is not a credential leak; changing local Git configuration does not rewrite history. Do not rewrite shared history merely to remove an audit warning.+Commits keep the author and committer name and email. To keep a personal address out of future commits, set your Git email to your verified GitHub noreply address. Changing local Git config does not rewrite history, and existing attribution is not a credential leak. Do not rewrite shared history to clear an audit warning.## Reporting bugs and security issues-**Bugs and feature requests:** use the [issue templates](https://github.com/vercel-labs/agent-desktop/issues/new/choose); [SUPPORT.md](SUPPORT.md) says what to include.+Bugs and feature requests: use the [issue templates](https://github.com/vercel-labs/agent-desktop/issues/new/choose). [SUPPORT.md](SUPPORT.md) lists what to include.-**Security vulnerabilities:** do **not** open a public issue. Follow [SECURITY.md](SECURITY.md).+Security vulnerabilities: do not open a public issue. Follow [SECURITY.md](SECURITY.md).## Writing with AI coding agents-If an AI coding agent writes any of your contribution's prose, it must use the [`technical-writer` skill](.agents/skills/technical-writer/SKILL.md). That covers docs pages, READMEs, skills, changelog entries, commit messages, PR descriptions, and issues. The skill sets the voice and editorial standards for this repo and asks agents to check technical claims against the source. Agents that read this repo's `AGENTS.md` pick up the requirement automatically.+If an AI coding agent writes any prose in your contribution (docs, READMEs, skills, changelog entries, commit messages, PR descriptions or issues), it must use the [`technical-writer` skill](.agents/skills/technical-writer/SKILL.md). The skill sets the repo's voice and asks agents to check technical claims against the source. AGENTS.md tells agents to use it.## License-By contributing, you agree that your contributions are licensed under the [Apache-2.0 License](LICENSE) that covers this project.+Contributions are licensed under the [Apache-2.0 License](LICENSE) that covers this project.diff --git a/README.md b/README.mdindex 640963561..7bce943e5 100644--- a/README.md+++ b/README.md@@ -1,6 +1,6 @@# agent-desktop-Computer use for AI agents: read and operate desktop apps through the OS accessibility tree.+Computer use for AI agents: see and operate desktop apps on macOS, Windows, and Linux through the OS accessibility tree.<p><a href="https://vercel.com/labs#labs-products"><img alt="Vercel Labs Product" src="https://img.shields.io/badge/LABS-PRODUCT-0a0a0a.svg?style=for-the-badge&logo=Vercel&labelColor=000000" height="28"></a>@@ -9,45 +9,33 @@ Computer use for AI agents: read and operate desktop apps through the OS accessi<a href="https://www.npmjs.com/package/agent-desktop"><img alt="npm downloads per month: agent-desktop" src="https://img.shields.io/npm/dm/agent-desktop.svg?style=for-the-badge&labelColor=000000&label=npm%20downloads" height="28"></a></p>-A CLI and C library for macOS, Windows and Linux. A snapshot returns JSON with a ref for every element an agent can act on. The agent acts on a ref and snapshots again to check, with no pixel matching; the loop stays in your agent.+agent-desktop gives an AI agent computer use without screenshots or pixel matching. It reads the accessibility tree of a desktop app and returns it as JSON, with a ref for every element the agent can act on. The agent clicks or types on a ref, reads the UI again to check the result, and repeats. The loop lives in your agent; agent-desktop has no model inside. It ships as a CLI and a C library.-Every CLI call runs in its own process. Headless calls still prohibit foreground activation and synthesized input.+Snapshots, clipboard reads, screenshots, command output, and debug artifacts can contain private desktop content. Keep them out of public logs and uploads.-Snapshots, clipboard reads, screenshots, command output and debug artifacts can contain private desktop content. Keep them out of public logs and uploads. The optional [JEV helper](skills/jev-desktop/SKILL.md) sends screen descriptions to a configured model provider; it is separate from the native CLI. See [privacy and data handling](docs/faq.md#what-data-can-contain-private-information).--## Installation--Install on macOS, Windows or Linux with npm:+## Install```bashnpm install -g agent-desktop-agent-desktop version+agent-desktop status # platform, permissions, supported surfaces+agent-desktop permissions --guide # macOS: walks you through the Accessibility grant```-Bun, Yarn and pnpm can install the same package. It includes native binaries and platform helpers for x64 and ARM64.-For direct execution without a JavaScript launcher, download the matching native archive from-[GitHub Releases](https://github.com/vercel-labs/agent-desktop/releases) and keep its helper beside the executable.--Official Homebrew and Scoop packages are being submitted; they are not yet available in the default catalogs.-The repository no longer maintains a custom Homebrew tap or Scoop bucket.+- **Windows:** no grant for apps at your terminal's integrity level.+- **Linux:** run in the user's graphical session with `at-spi2-core`.-- **macOS** needs Accessibility permission: `agent-desktop permissions --guide`.-- **Windows** needs no grant for apps at your terminal's integrity level.-- **Linux** needs the user's graphical session with `at-spi2-core`.--See [installation and permissions](docs/install.md) for package-manager behavior, release archives, and building from source.+Release archives and building from source are covered in [Installation](https://agent-browser.dev/desktop/installation).## Quick start-Observe, act on a ref, observe again. Any app name from `agent-desktop list-apps` works; Finder is the macOS example.-Each command prints one JSON envelope; a trimmed snapshot follows the commands.-```bashagent-desktop snapshot --app Finder -i # interactive elements, each with a refagent-desktop click @s8f3k2p9:e8 # act on a ref from that snapshotagent-desktop snapshot --app Finder -i # observe again to verify```+Each command prints one JSON envelope. A trimmed snapshot:+```json{"version": "2.6",@@ -55,7 +43,6 @@ agent-desktop snapshot --app Finder -i # observe again to verify"command": "snapshot","data": {"app": "Finder",- "window": { "id": "w-204749", "title": "Downloads" },"snapshot_id": "s8f3k2p9","ref_count": 59,"complete": true,@@ -70,19 +57,25 @@ agent-desktop snapshot --app Finder -i # observe again to verify}```-- **Refs belong to their snapshot.** A bare `@e8` is rejected with `INVALID_ARGS`. When the UI changes, an action- returns `STALE_REF` or `AMBIGUOUS_TARGET`: take a new snapshot and use its refs.-- **Several windows** give `AMBIGUOUS_TARGET`; `snapshot` lists the candidate window ids in `error.details`. Pass one- with `--window-id`.-- **Dense apps:** map first with `snapshot --skeleton --app Slack -i --compact`, then drill into one region with- `snapshot --root @s8f3k2p9:e3 -i --compact`.-- **Headless by default.** Ref actions go through the accessibility API without moving the pointer or taking focus.- The global `--headed` flag allows physical input.-- **PowerShell.** Quote every ref (`'@s8f3k2p9:e8'`), because a bare `@token` is the splatting operator.+- Refs carry their snapshot id. A bare `@e8` fails with `INVALID_ARGS`.+- If the UI changed, an action returns `STALE_REF` or `AMBIGUOUS_TARGET`. Take a new snapshot and use its refs.+- Actions are headless by default: no pointer movement, no focus change. Pass `--headed` for physical input.+- In PowerShell, quote every ref (`'@s8f3k2p9:e8'`), because a bare `@token` is the splatting operator.++The full walkthrough is in the [quick start](https://agent-browser.dev/desktop/quick-start).++## How it works++<picture>+ <source media="(prefers-color-scheme: dark)" srcset="assets/architecture-dark.png">+ <img alt="The calling agent runs the agent-desktop CLI or the C library. Both go through agent-desktop-core and the PlatformAdapter trait to one platform crate, chosen at compile time, which reads the target app through the AX API on macOS, UI Automation on Windows, or AT-SPI on Linux." src="assets/architecture-light.png" width="720">+</picture>++Your agent calls the CLI, or the C library in process. Both run the same core, which reaches the OS only through `PlatformAdapter`. Each binary is built for one OS and talks to that OS's accessibility API.## For AI agents-The binary carries its own docs, matched to its version:+The binary carries guides that match its version:```bashagent-desktop skills get desktop # the loop, refs, verification and retry rules@@ -103,11 +96,11 @@ Use `agent-desktop` to see and operate desktop apps. Before the first use, run`agent-desktop skills get desktop` and `agent-desktop skills get platform`, and follow them.```-Every command prints one envelope with `ok` and either `data` or `error`. An error carries a `code`, a `disposition` and usually a `suggestion`; retry only when `error.disposition.retry` is `safe`. The contract, error codes and exit codes are in [docs/json-output.md](docs/json-output.md).+Retry a failed command only when `error.disposition.retry` is `safe`. See [JSON output](https://agent-browser.dev/desktop/json-output) for the envelope, error codes, and exit codes.## Commands-It ships 60 command names, 56 operational commands. The other four (`key-down`, `key-up`, `mouse-down`, `mouse-up`) refuse to run until a daemon can release a held key or button.+agent-desktop has 60 command names, 56 operational commands. The other four (`key-down`, `key-up`, `mouse-down`, `mouse-up`) refuse to run until a daemon can release a held key or button. [Commands](https://agent-browser.dev/desktop/commands) documents each one.| Group | Commands ||---|---|@@ -123,24 +116,17 @@ It ships 60 command names, 56 operational commands. The other four (`key-down`,## Platform support-| | macOS | Windows | Linux |-|---|:---:|:---:|:---:|-| Accessibility tree | Yes | Yes | Yes (AT-SPI) |-| Click / type / keyboard | Yes | Yes | AT-SPI; X11 / GNOME keys |-| Mouse input | Yes | Yes | X11, `--headed` |-| Screenshot | Yes | Yes | X11 windows; Wayland portal |-| Clipboard | Yes | Yes | Yes; Wayland needs `wl-clipboard` |-| App & window management | Yes | Yes | Launch/list; X11 window control |-| Notifications | Yes | Yes | GNOME Shell |-| Shell surfaces (`open-system-surface`) | Dock, menu bar extras | Yes | GNOME tray, Action Center |--The Windows surface and `launch` notes and the Linux X11 and Wayland notes are in [docs/install.md](docs/install.md#platform-notes).+| Platform | Requirement | Accessibility API |+|---|---|---|+| [macOS](https://agent-browser.dev/desktop/platforms/macos) | macOS 13 or later, Intel or Apple Silicon | AX API |+| [Windows](https://agent-browser.dev/desktop/platforms/windows) | Windows 10 1809 or later, x64 or ARM64 | UI Automation |+| [Linux](https://agent-browser.dev/desktop/platforms/linux) | Ubuntu 24.04 or later, x86_64 or aarch64, X11 or Wayland | AT-SPI |-`agent-desktop skills get platform` prints the full capability table for the OS you run on.+Each platform page lists what works headless, what needs `--headed`, and what refuses.-## Language bindings+## C library-Each release also ships `libagent_desktop_ffi` for macOS, Linux and Windows, so a program can call the tool in process instead of starting the CLI for each command. `agent-desktop skills get ffi` covers the entry points, memory ownership and threading rules.+Each release ships `libagent_desktop_ffi`, so a program can call agent-desktop in process. See the [C library docs](https://agent-browser.dev/desktop/ffi).```pythonimport ctypes@@ -162,25 +148,16 @@ cargo test "${HOST_PKGS[@]}"cargo clippy "${HOST_PKGS[@]}" --all-targets -- -D warnings```-On Windows, replace `agent-desktop-macos` in that list with `agent-desktop-windows`; on Linux, with `agent-desktop-linux`.-[CONTRIBUTING.md](CONTRIBUTING.md) lists every gate. Build from source: [docs/install.md](docs/install.md#from-source).+On Windows, use `agent-desktop-windows` instead of `agent-desktop-macos`; on Linux, `agent-desktop-linux`. [CONTRIBUTING.md](CONTRIBUTING.md) lists every gate.## Documentation-| I want to... | Read |-|---|---|-| Fix an install problem, grant permissions, verify a download or build from source | [docs/install.md](docs/install.md) |-| Parse the JSON envelope, error codes and exit codes | [docs/json-output.md](docs/json-output.md) |-| Drive the tool as an AI agent | `agent-desktop skills get desktop` ([skills/agent-desktop/](skills/agent-desktop/)) |-| Learn what differs on one OS | [macOS](skills/agent-desktop-macos/), [Windows](skills/agent-desktop-windows/), [Linux](skills/agent-desktop-linux/) |-| Call the C library | [skills/agent-desktop-ffi/](skills/agent-desktop-ffi/) |-| Look up the vocabulary: refs, snapshots, sessions | [CONCEPTS.md](CONCEPTS.md) |-| Contribute and pass the gates | [CONTRIBUTING.md](CONTRIBUTING.md) |-| Read the engineering rules | [AGENTS.md](AGENTS.md) |-| Learn from past bugs and lessons | [docs/solutions/](docs/solutions/) |-| Find answers to common questions | [docs/faq.md](docs/faq.md) |-| Report a vulnerability | [SECURITY.md](SECURITY.md) |-| Get help | [SUPPORT.md](SUPPORT.md) |+- [Introduction](https://agent-browser.dev/desktop): what it is and how it works+- [Snapshots and refs](https://agent-browser.dev/desktop/snapshots-and-refs)+- [Errors and recovery](https://agent-browser.dev/desktop/errors-and-recovery)+- [Skills](https://agent-browser.dev/desktop/skills)+- [CONCEPTS.md](CONCEPTS.md): vocabulary+- [CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md), [SUPPORT.md](SUPPORT.md)## Licensediff --git a/SUPPORT.md b/SUPPORT.mdindex 391e77dc2..855d32263 100644--- a/SUPPORT.md+++ b/SUPPORT.md@@ -2,14 +2,14 @@## Before asking-- Read the [README](README.md) and the skill docs in [`skills/`](skills/) — the per-command reference and platform-specific notes are there.+- Read the [README](README.md) and the skill docs in [`skills/`](skills/). The per-command reference and platform notes are there.- Search [existing issues](https://github.com/vercel-labs/agent-desktop/issues) to see if your question has already been answered.## Getting help-- **Bug or unexpected behavior** — open an issue via the [issue templates](https://github.com/vercel-labs/agent-desktop/issues/new/choose). Include the `agent-desktop --version` output, the OS and its version, how you installed it, the command you ran with its full JSON output, and reproduction steps.-- **Feature request** — use the feature-request template in the same link above.-- **AI-agent integration / skill usage** — refer to the README's [For AI agents](README.md#for-ai-agents) section and the `skills/agent-desktop/` reference docs. The same skills are bundled in the binary: `agent-desktop skills get desktop` prints the core guide and `agent-desktop skills get platform` the one for your OS.+- **Bug or unexpected behavior:** open an issue via the [issue templates](https://github.com/vercel-labs/agent-desktop/issues/new/choose). Include the `agent-desktop --version` output, the OS and its version, how you installed it, the command you ran with its full JSON output, and reproduction steps.+- **Feature request:** use the feature-request template in the same link above.+- **AI-agent integration and skill usage:** see the README's [For AI agents](README.md#for-ai-agents) section and the `skills/agent-desktop/` reference docs. The same skills are bundled in the binary: `agent-desktop skills get desktop` prints the core guide and `agent-desktop skills get platform` the one for your OS.## Security vulnerabilitiesdiff --git a/apps/docs/content/docs/installation.mdx b/apps/docs/content/docs/installation.mdxindex 3babf6a37..1cb0dbe36 100644--- a/apps/docs/content/docs/installation.mdx+++ b/apps/docs/content/docs/installation.mdx@@ -42,13 +42,14 @@ gh attestation verify <downloaded-archive> --repo vercel-labs/agent-desktop## Blocked install scripts-The package's `postinstall` script replaces the Node launcher with a link to the native binary. If your package manager blocks install scripts, the Node launcher runs instead. It works, but every call starts Node first, which adds more than 100 ms. The launcher prints a one-time notice to stderr with the fix. Approve the script and reinstall:+The package's `postinstall` script replaces the Node launcher with a link to the native binary. If your package manager blocks install scripts, the Node launcher runs instead. It works, but every call starts Node first, which adds more than 100 ms. The launcher prints a one-time notice to stderr with the fix. Allow the script and reinstall:```bash-npm install-scripts approve agent-desktop # npm 12-npm install -g agent-desktop --allow-scripts=agent-desktop # npm 11+npm install -g agent-desktop --allow-scripts=agent-desktop```+For a project install, run `npm install-scripts approve agent-desktop` inside the project, then `npm rebuild agent-desktop`. The approve command only edits the project's `package.json` and fails for a global install.+## Homebrew and ScoopThere is no Homebrew or Scoop package. The custom Homebrew tap and Scoop bucket were removed in 1.0.1 (see the [changelog](/desktop/changelog)). An older tap or bucket install stays pinned to its version and can shadow the npm command. Check which executable runs, and uninstall the old one with the package manager that installed it:diff --git a/assets/architecture-dark.png b/assets/architecture-dark.pngnew file mode 100644index 000000000..e10a7eea4Binary files /dev/null and b/assets/architecture-dark.png differdiff --git a/assets/architecture-light.png b/assets/architecture-light.pngnew file mode 100644index 000000000..ccf81d82cBinary files /dev/null and b/assets/architecture-light.png differdiff --git a/benchmarks/locator-resolution/README.md b/benchmarks/locator-resolution/README.mdindex 8ffdd1cae..7cb6eb5a8 100644--- a/benchmarks/locator-resolution/README.md+++ b/benchmarks/locator-resolution/README.md@@ -1,10 +1,6 @@# Locator resolution benchmark-This deterministic harness compares the legacy full-snapshot locator path with-the handle-free observed-tree evaluator over synthetic Chromium/Electron accessibility-trees. It exercises deep anonymous wrapper chains, duplicate role/name-candidates, moving bounds, simultaneous `AXIdentifier` and `AXDOMIdentifier`-values, containment predicates, and large trees.+A deterministic harness that compares the legacy full-snapshot locator path with the handle-free observed-tree evaluator. Both run over synthetic Chromium and Electron accessibility trees. The trees cover deep anonymous wrapper chains, duplicate role and name candidates, moving bounds, `AXIdentifier` and `AXDOMIdentifier` set at once, containment predicates and large trees.Run it without network access:@@ -13,34 +9,22 @@ cargo run -p agent-desktop-core --release --example locator_benchmark \> /tmp/agent-desktop-locator-synthetic.json```-The JSON report includes 31-run p50/p95 wall-clock latency, candidate nodes,-predicate work, requested synthetic attribute values, cardinality, and-correctness. `live_find_selected_refs` uses the same selected-match-only-materialization contract as the default CLI `find` path. `live_arena_direct` is-reported separately as a lower-overhead direct-target metric, and-`live_count_no_refmap` verifies that count-only requests perform no action or-settable evidence reads. The harness does not claim absolute native AX calls:-role-dependent action and settable probes make that model inaccurate. Native-Slack/Electron IPC measurements require Accessibility permission and belong in-the privileged macOS integration suite.--This synthetic benchmark JSON is consumed by the repo-wide performance report:-run `bash scripts/perf-baseline-compare.sh` (optionally with `--apps "Slack,Google-Chrome"`) to produce `report.html`, covering the HEAD-vs-main fixture A/B,-optional real-app read-only probes, and this synthetic benchmark.--For privileged Electron/Chromium runs, the macOS adapter first asks whether the-application root exposes `AXManualAccessibility` as settable, reads its current-value, and sets it at most once when supported. The adapter then waits within-the request's existing absolute deadline until the attribute reports ready,-recording attempted/succeeded/ready activation in locator stats. Unsupported-native applications are left unchanged. This follows-[Electron's official third-party accessibility guidance](https://github.com/electron/electron/blob/main/docs/tutorial/accessibility.md),-which documents setting `AXManualAccessibility` from native assistive software-to expose Chromium's accessibility tree before automatic assistive-technology-detection has enabled it. The-[current Electron macOS implementation](https://github.com/electron/electron/blob/main/shell/browser/mac/electron_application.mm)-advertises the attribute as settable, reports `true` only in complete mode, and-handles `AXEnhancedUserInterface` separately; that source behavior is why the-benchmark methodology requires a post-set readiness read instead of treating a-successful setter as immediate readiness.+The JSON report contains:++- p50 and p95 wall-clock latency over 31 measured runs+- Candidate nodes, predicate work and the synthetic attribute values requested+- Cardinality and correctness++The three live modes measure different things:++- `live_find_selected_refs` uses the same selected-match-only materialization as the default CLI `find` path.+- `live_arena_direct` is a lower-overhead direct-target metric, reported separately.+- `live_count_no_refmap` checks that count-only requests perform no action or settable-evidence reads.++The harness does not report absolute native AX call counts, because role-dependent action and settable probes make that count inaccurate. Native Slack and Electron measurements need Accessibility permission. Run them with the opt-in live harness, `tests/e2e/electron-live.sh`, not with this benchmark.++To produce the repo-wide report, run `bash scripts/perf-baseline-compare.sh`, optionally with `--apps "Slack,Google Chrome"`. It writes `report.html`. The report covers the HEAD vs merge-base fixture A/B, the optional read-only app probes and this benchmark.++## Electron and Chromium activation (macOS)++For Electron and Chromium apps, the macOS adapter turns on the accessibility tree before it reads the app. It sets `AXManualAccessibility` when the app supports it, and otherwise `AXEnhancedUserInterface`. It skips the set when the value is already `true`. It then waits, within the request deadline, until the attribute reports ready. Native apps that do not expose the attribute are left unchanged. This follows [Electron's accessibility guidance for third-party assistive software](https://github.com/electron/electron/blob/main/docs/tutorial/accessibility.md). The benchmark reads readiness after the set, because a successful set does not mean the tree is ready.diff --git a/crates/ffi/README.md b/crates/ffi/README.mdindex a2610d8d8..baaee1893 100644--- a/crates/ffi/README.md+++ b/crates/ffi/README.md@@ -1,8 +1,8 @@# agent-desktop-ffi-C-ABI cdylib over [`PlatformAdapter`](../../crates/core/src/adapter/mod.rs). Exposes-`libagent_desktop_ffi.{dylib,so,dll}` to Python (ctypes), Swift, Go (cgo),-Node (ffi-napi), and C++ consumers without spawning a CLI subprocess per call.+A C-ABI library over the [`PlatformAdapter`](../../crates/core/src/adapter/mod.rs) trait. It builds a shared library for C, C++, Python (ctypes), Swift, Go (cgo) and Node (ffi-napi). Calls run in process, so a program does not start the CLI for each command.++The full guide is at https://agent-browser.dev/desktop/ffi. It covers linking, the API, ownership and threading. The agent-facing version is the [`agent-desktop-ffi` skill](../../skills/agent-desktop-ffi/SKILL.md).## Build@@ -10,12 +10,13 @@ Node (ffi-napi), and C++ consumers without spawning a CLI subprocess per call.cargo build --profile release-ffi -p agent-desktop-ffi```-The `release-ffi` profile keeps `panic = "unwind"`, which is required for the-`catch_unwind` traps that prevent panics from crossing the `extern "C"` boundary.-Do **not** use `--release` — that profile sets `panic = "abort"`, which silently-defeats every trap.+The output is in `target/release-ffi/`: `libagent_desktop_ffi.dylib` on macOS, `libagent_desktop_ffi.so` on Linux, and `agent_desktop_ffi.dll` on Windows.++Use `--profile release-ffi`, not `--release`. The `release` profile sets `panic = "abort"`, which turns off the `catch_unwind` traps at the `extern "C"` boundary without any error. The `release-ffi` profile keeps `panic = "unwind"`.++A source build also needs the platform helper beside the library: `agent-desktop-macos-helper` on macOS, `agent-desktop-linux-clipboard-owner` on Linux.-For the CI / stub-adapter path (no AX permission required):+For CI and tests that need no accessibility permission, build the stub adapter. It returns `PLATFORM_NOT_SUPPORTED` for every adapter call.```bashcargo build --profile release-ffi -p agent-desktop-ffi --features stub-adapterdiff --git a/docs/faq.md b/docs/faq.mdindex cf5f1ec3a..d2704c3fc 100644--- a/docs/faq.md+++ b/docs/faq.md@@ -2,90 +2,66 @@## What is agent-desktop?-agent-desktop gives any agent computer use on the desktop. Agents see and operate desktop apps through OS accessibility trees, using structured JSON with stable refs instead of guessing from screenshots or pixel matching.+agent-desktop is a CLI and C library. It reads the accessibility tree of desktop apps on macOS, Windows, and Linux and returns it as JSON. Each element an agent can act on gets a ref. The calling agent runs the observe, act, and verify loop, because agent-desktop has no model inside. It does not automate web pages. Use [agent-browser](https://agent-browser.dev) for those. The [introduction](https://agent-browser.dev/desktop) covers the rest.## Does agent-desktop require screenshots or pixel matching?-No. The core workflow reads native accessibility trees and assigns refs to interactive elements. Screenshots are available as a separate command, but agents do not need screenshots or pixel matching to click buttons, type into fields, inspect menus, or navigate app windows.+No. Commands that take a ref find the element in the accessibility tree, not by matching pixels. `screenshot` is a separate command. An app that publishes no accessibility tree is not visible to agent-desktop.## How does agent-desktop work?-| Component | Function |-|-----------|----------|-| **Native Rust CLI** | Fast, single binary, no runtime dependencies |-| **C-ABI cdylib** | Load once from Python, Swift, Go, Ruby, Node, or C instead of forking |-| **60 Commands** | Observation, interaction, keyboard, mouse, notifications, clipboard, window management, session lifecycle, trace read/export, and bundled `skills` docs |-| **Snapshot & Refs** | Compact snapshot IDs and deterministic element refs like `@s8f3k2p9:e1`, `@s8f3k2p9:e2` |-| **Structured JSON** | Machine-readable responses with error codes and recovery hints |--## What makes agent-desktop useful for AI agents?--| Feature | Benefit |-|---------|---------|-| **Progressive Skeleton Traversal** | `snapshot --skeleton` returns a shallow overview and `--root @ref` drills into one region, so an agent reads only the part of a dense app it acts on |-| **Headless-by-Default Actions** | Ref actions use accessibility APIs and block unintended physical side effects |-| **Snapshot Refs** | Agents act on stable refs within a snapshot instead of guessing coordinates |-| **Recovery Hints** | Errors include machine-readable codes and suggestions for the next agent step |-| **Cross-Language FFI** | Python, Swift, Go, Ruby, Node, C, and C++ hosts can call the native library directly |+`snapshot` reads an app's accessibility tree and prints it as JSON, with a ref for each element an agent can act on. Actions take a ref from a snapshot, and each command prints one JSON envelope. The [introduction](https://agent-browser.dev/desktop) shows the components, from the CLI or C library down to the platform accessibility API.## Which platforms are supported?-macOS, Windows and Linux. The [platform table in the README](../README.md#platform-support) shows what each one-supports, and `agent-desktop skills get platform` prints the full capability table for the OS the binary runs on.+macOS, Windows, and Linux. The [platform table in the README](../README.md#platform-support) lists each requirement. `agent-desktop skills get platform` prints the platform guide for the OS the binary runs on.## How do I install agent-desktop?-Install the CLI from npm:-```bashnpm install -g agent-desktop-agent-desktop snapshot --app Safari```-Build the FFI library from source:+[Installation](https://agent-browser.dev/desktop/installation) covers the other package managers, release archives, and building from source. [docs/install.md](install.md) has the same details for GitHub readers.++## How do I build the C library from source?```bashcargo build --profile release-ffi -p agent-desktop-ffi-# Outputs under target/release-ffi/: libagent_desktop_ffi.dylib/.so or agent_desktop_ffi.dll```+The library is written to `target/release-ffi/`: `libagent_desktop_ffi.dylib` or `.so` on macOS and Linux, `agent_desktop_ffi.dll` on Windows. Only the `release-ffi` profile traps panics at the boundary and returns them as `AD_RESULT_ERR_INTERNAL`. A plain `--release` build does not. A source build also needs the platform helper beside the library. See [Build and link](https://agent-browser.dev/desktop/ffi/build-and-link).+## What is the ref system?-`snapshot` assigns qualified refs to interactive elements in depth-first order, such as `@s8f3k2p9:e1`. The embedded snapshot ID makes every ref self-describing. Snapshot lookup remains confined to the selected namespace, so refs created under a session still require that session's `--session` or `AGENT_DESKTOP_SESSION` scope. A bare `@e1` is rejected with `INVALID_ARGS`.+`snapshot` assigns refs in depth-first order. A ref carries the ID of the snapshot it came from, such as `@s8f3k2p9:e1`. Pass the full form to actions. A bare `@e1` fails with `INVALID_ARGS`.-Interactive roles that receive refs:+An element gets a ref when its role is one of these, or when it advertises a primary action:`button`, `textfield`, `checkbox`, `link`, `menuitem`, `tab`, `slider`, `combobox`, `treeitem`, `cell`, `radiobutton`, `incrementor`, `menubutton`, `switch`, `colorwell`, `dockitem`, `listbox`, `option`.-Stale ref recovery:--```text-snapshot -> act -> STALE_REF? -> snapshot again -> retry-```+Snapshot lookup stays inside the selected session. A ref from a session needs that session's `--session` flag or `AGENT_DESKTOP_SESSION` value. When an action returns `STALE_REF`, take a new snapshot and retry with a ref from it.## How does an agent learn the tool?-Run `agent-desktop skills get desktop` for the core skill, then `agent-desktop skills get platform` for the skill of the OS the binary runs on. Run `agent-desktop <command> --help` for flags.+Run `agent-desktop skills get desktop` for the core guide. Run `agent-desktop skills get platform` for the guide for the OS the binary runs on. Run `agent-desktop <command> --help` for a command's flags.## Is agent-desktop free and open source?-Yes. agent-desktop is Apache-2.0 licensed for personal and commercial use.+Yes. It is licensed under [Apache-2.0](../LICENSE).## What data can contain private information?-Snapshot trees, window titles, clipboard reads, notifications, screenshots and command results contain the desktop content you asked to inspect. Debug HTML embeds a screenshot and accessibility data. Session traces can retain evidence artifacts even when structured fields are redacted. Keep these files and caller transcripts private; redaction does not make a screenshot safe to publish.+Snapshots, window titles, clipboard reads, notifications, screenshots, and command results contain the desktop content you asked to read. `--debug --screenshot PATH.html` writes a local HTML page with a screenshot and the accessibility data. Session traces redact sensitive structured fields, but they can keep evidence artifacts. Keep these files and your agent's transcripts private. Redaction does not make a screenshot safe to publish.-The native CLI does not require a remote model service. The optional repository-only [JEV helper](../skills/jev-desktop/SKILL.md) sends goals and screen descriptions to the configured provider. Its value-suppression option does not remove private text from labels, titles, ancestor paths or the goal itself. Use it only with data approved for that provider. Its executable command output can also contain supplied text.+The native CLI does not require a remote model service. The optional [JEV helper](../skills/jev-desktop/SKILL.md) sends your goal and screen descriptions to the model provider you configure. Use it only with data that provider may see.-Public probe captures retain technical environment details such as OS versions and window geometry. Review captures and media before publishing them, even when identity fields have been redacted.+Probe captures under `probes/` record technical details such as OS versions and window geometry. Review them before publishing, even after you redact identity fields.## Where can I get help?-| Resource | Link |-|----------|------|-| **Repository** | [github.com/vercel-labs/agent-desktop](https://github.com/vercel-labs/agent-desktop) |-| **skills.sh Listing** | [skills.sh/vercel-labs/agent-desktop/agent-desktop](https://skills.sh/vercel-labs/agent-desktop/agent-desktop) |-| **npm Package** | [npmjs.com/package/agent-desktop](https://www.npmjs.com/package/agent-desktop) |-| **CI Status** | [GitHub Actions](https://github.com/vercel-labs/agent-desktop/actions/workflows/ci.yml?query=branch%3Amain) |-| **Releases** | [GitHub Releases](https://github.com/vercel-labs/agent-desktop/releases) |-| **Issues** | [GitHub Issues](https://github.com/vercel-labs/agent-desktop/issues) |+See [SUPPORT.md](../SUPPORT.md) for what to include in a bug report. Report security issues privately, as described in [SECURITY.md](../SECURITY.md).++- [Issues](https://github.com/vercel-labs/agent-desktop/issues)+- [Releases](https://github.com/vercel-labs/agent-desktop/releases)+- [npm package](https://www.npmjs.com/package/agent-desktop)diff --git a/docs/install.md b/docs/install.mdindex d1b45e7a4..007cb5ce8 100644--- a/docs/install.md+++ b/docs/install.md@@ -1,45 +1,33 @@# Installing agent-desktop-Install the `agent-desktop` npm package with npm, pnpm, Yarn or Bun. It bundles native executables and platform-helpers for macOS, Windows and Linux, on x64 and ARM64:+Install the `agent-desktop` npm package with npm, pnpm, Yarn, or Bun. It needs Node 18 or later and bundles native executables and platform helpers for macOS, Windows, and Linux, on x64 and ARM64:```bashnpm install -g agent-desktopagent-desktop version```-For a direct native executable without a JavaScript launcher, download the archive for your OS and architecture-from [GitHub Releases](https://github.com/vercel-labs/agent-desktop/releases). Extract the executable and its platform-helper together into a directory on PATH. Upgrade by replacing both with files from the same release.+Without `-g`, the command goes to `./node_modules/.bin` instead of your PATH. Run it with `npx agent-desktop`, or install globally.## Homebrew and Scoop-Official packages are being submitted to `Homebrew/homebrew-core` and `ScoopInstaller/Main`. They are not yet-available through the default catalogs. This repository no longer maintains a custom tap or bucket; existing-custom installations remain pinned to their installed version.--Once accepted, Homebrew builds from the tagged source and manages its own bottles. Scoop installs the Windows-release archive and checks GitHub releases for updates. Catalog updates and approvals are managed by those-projects, separately from our npm and GitHub release workflow.--If an older installation shadows the command, uninstall it through its original package manager. Check resolution-with `command -v agent-desktop` on macOS/Linux or `Get-Command agent-desktop` on Windows.+There is no Homebrew or Scoop package. The custom Homebrew tap and Scoop bucket were removed in 1.0.1. An install from them stays on its old version and can shadow the npm command. Uninstall it with the package manager that installed it. Check which executable runs with `command -v agent-desktop` on macOS and Linux, or `Get-Command agent-desktop` on Windows.## Blocked install scripts-The npm package includes the native binaries and helpers. Its `postinstall` script replaces the Node launcher with a-link to the native binary (about 21 ms per call). If the package manager blocks install scripts (npm 12 does by-default), the Node launcher runs instead and each call costs about 146 ms. Approve the script with-`npm install-scripts approve agent-desktop`, or install with `--allow-scripts`. Some package managers retain their-own launcher.+The npm package's `postinstall` script replaces the Node launcher with a link to the native binary. Some package managers block install scripts, and npm 12 does by default. Then every call runs through the Node launcher, which adds about 125 ms. The launcher prints a one-time notice to stderr. Allow the script and reinstall:++```bash+npm install -g agent-desktop --allow-scripts=agent-desktop+```-A plain `npm install agent-desktop` without `-g` puts the command in `./node_modules/.bin`, not on PATH; run it with-`npx agent-desktop` or install globally.+For a project install, run `npm install-scripts approve agent-desktop` inside the project, then `npm rebuild agent-desktop`. The approve command only edits the project's `package.json` and fails for a global install.## Release archives-Release archives are on the [releases page](https://github.com/vercel-labs/agent-desktop/releases). Their checksums come-from the same release, so they catch corruption but do not prove origin. Check origin with:+Download the archive for your OS and architecture from [GitHub Releases](https://github.com/vercel-labs/agent-desktop/releases). Extract the executable and its platform helper into one directory on your PATH. To upgrade, replace both files with the ones from the same release.++The release's `checksums.txt` catches corrupted downloads but does not prove where the archive came from. Verify its origin with the build attestation:```bashgh attestation verify <downloaded-archive> --repo vercel-labs/agent-desktop@@ -47,44 +35,36 @@ gh attestation verify <downloaded-archive> --repo vercel-labs/agent-desktop## From source-You need Rust 1.89 or later, plus the Xcode command-line tools on macOS 13+, the MSVC build tools on Windows, or a C-linker on Linux:+You need the Rust toolchain pinned in `rust-toolchain.toml` (1.89.0). `rustup` installs it on first use. You also need a C toolchain: the Xcode command-line tools on macOS 13 or later, the MSVC build tools on Windows, or `build-essential` on Linux.```bashgit clone https://github.com/vercel-labs/agent-desktop && cd agent-desktopcargo build --release -p agent-desktop```-On Linux, also run `cargo build --release -p agent-desktop-linux --bins` and keep-`agent-desktop-linux-clipboard-owner` beside the CLI. npm and the release archives include it.+Each platform crate builds only on its own OS. Build the helper for your platform. A source build puts it in `target/release/`, next to the CLI. Windows has no helper.++```bash+cargo build --release -p agent-desktop-macos --bin agent-desktop-macos-helper # macOS+cargo build --release -p agent-desktop-linux --bins # Linux+```++The CLI looks for the helper in its own directory, so move the two together.## Permissions-**macOS** needs Accessibility permission. Screenshots also need Screen Recording, and opening Notification Center-needs Automation permission for System Events. `agent-desktop permissions` reports the state without prompting,-`--request` asks for what is missing, and `--guide` opens System Settings at the missing permission with an on-screen-guide.+**macOS** needs Accessibility permission. Screenshots also need Screen Recording. Some commands need Automation permission for System Events, and report it when it is missing. `agent-desktop permissions` reports the state without prompting. `permissions --request` shows the system prompts. `permissions --guide` opens System Settings with an on-screen guide for Accessibility and Screen Recording.++**Windows** needs no grant for apps at your terminal's integrity level. An app running as administrator can be read, but only an elevated agent can send it input. The binary is unsigned. SmartScreen may warn on a browser download, and antivirus may quarantine it. On a clean Windows 11 install, Smart App Control blocks it, and no download method or launch mode avoids that. Turn Smart App Control off to run it. npm installs do not trigger SmartScreen. To restore a quarantined file, first check its SHA-256 checksum against the release.-**Windows** needs no grant for apps at your terminal's integrity level. An app that runs as administrator can be read,-but only an elevated agent can send it input. The binary is unsigned, so SmartScreen may warn on a browser download,-antivirus may quarantine it, and Smart App Control on a clean Windows 11 install blocks it. The npm install path does-not trigger SmartScreen.+**Linux** needs Ubuntu 24.04 or later on x86_64 or aarch64, with a glibc 2.35 floor. Ubuntu 22.04's AT-SPI bridge aborts on `Action.GetActions`. Run the CLI inside the user's graphical session, with `at-spi2-core` installed. A TTY, an SSH shell, or a container without that session's bus, display, and runtime environment sees no apps. `agent-desktop status` activates and checks the accessibility bus. An empty `supported_surfaces` list means the bus did not answer.-**Linux** supports Ubuntu 24.04+ with GNOME 46 as the primary target and a glibc 2.35 floor; Ubuntu 22.04's ATK bridge-aborts on `Action.GetActions`. Run inside the user's graphical session with `at-spi2-core` installed. A TTY or SSH-shell without that session's bus, display and runtime environment cannot see its apps. `agent-desktop status`-activates and checks the accessibility bus. X11 keys need XTEST,-Wayland keys need GNOME Mutter RemoteDesktop, and the Wayland clipboard needs `wl-clipboard`. The Linux skill covers-the rest: `agent-desktop skills get linux`.+Keys need XTEST on X11 and GNOME Mutter RemoteDesktop on Wayland. The Wayland clipboard needs `wl-clipboard`. For the rest, run `agent-desktop skills get platform` on the Linux machine.## Platform notes-**Windows.** `list-surfaces` lists each process's `window`, `focused`, `sheet` and `menu` surfaces. `snapshot---surface` also reads `taskbar`, `system-tray`, `system-tray-overflow`, `start-menu` and `action-center` without-`--app`. `quick-settings` returns `INVALID_ARGS` and names `action-center`, which carries those controls.+**Windows.** `list-surfaces` lists each process's `window`, `focused`, `sheet`, and `menu` surfaces. `snapshot --surface` also reads `taskbar`, `system-tray`, `system-tray-overflow`, `start-menu`, and `action-center` without `--app`. `quick-settings` returns `PLATFORM_NOT_SUPPORTED` and names `action-center` as the surface that carries those controls.-`launch` on Windows takes an absolute path, or a bare name under System32 or the Windows directory, with or-without `.exe`. It cannot resolve a display name such as "Google Chrome".+`launch` takes an absolute path, or a bare name under System32 or the Windows directory, with or without `.exe`. It does not resolve a display name such as "Google Chrome". Use `list-apps` to find a running app.-**Linux.** Semantic actions work on X11 and Wayland. On Wayland, app pointer input refuses and native window control-is unsupported.+**Linux.** Semantic actions work on X11 and Wayland. On Wayland, app pointer input returns `ACTION_NOT_SUPPORTED`, and window control is refused for native windows.diff --git a/npm/bin/agent-desktop b/npm/bin/agent-desktopindex b13f3b6ed..732d92f84 100755--- a/npm/bin/agent-desktop+++ b/npm/bin/agent-desktop@@ -17,7 +17,7 @@ function getBinaryName() {const LAUNCHER_NOTICE = ['agent-desktop: this command runs through the Node launcher because npm did not run the install script, which adds about 125 ms per call.',- 'Allow it and reinstall to link the native binary: npm install -g agent-desktop --allow-scripts=agent-desktop (npm 11), or npm install-scripts approve agent-desktop (npm 12).',+ 'Allow it and reinstall to link the native binary: npm install -g agent-desktop --allow-scripts=agent-desktop. In a project, run npm install-scripts approve agent-desktop, then npm rebuild agent-desktop.',].join('\n');// Reaching this launcher means postinstall never linked the native binary.diff --git a/scripts/ffi-archive-readme-linux.md b/scripts/ffi-archive-readme-linux.mdindex 8e310bf38..361160115 100644--- a/scripts/ffi-archive-readme-linux.md+++ b/scripts/ffi-archive-readme-linux.md@@ -1,16 +1,11 @@-Linux needs glibc 2.35 or newer (Ubuntu 22.04 and later). `dlopen` / Python-`ctypes` callers load `lib/libagent_desktop_ffi.so` by path. The library has no-SONAME, so a linking consumer records the file name and needs `-L` for the-`lib/` directory and `-rpath` pointing at it at run time.+Linux needs glibc 2.35 or newer.-- Calls on one adapter run one at a time. Many threads can share an adapter,- but they do not run in parallel.-- `ad_snapshot` takes an application name only. It has no window id or root.-- The clipboard calls carry text only. `ad_set_clipboard` starts the detached- `lib/agent-desktop-linux-clipboard-owner` process, which keeps serving the- text after the host exits until another client takes the selection or- `ad_clear_clipboard` ends it. The library finds that file beside its own- image, never through `PATH`, so keep the two files in the same directory.- Wayland needs `wl-clipboard` installed.-- Observation needs a session accessibility bus (`at-spi2-core`).+`dlopen` and Python `ctypes` callers load `lib/libagent_desktop_ffi.so` by path. The library has no SONAME, so a program that links it records the file name. Pass `-L` for the `lib/` directory at link time, and `-rpath` pointing at it at run time.++For the full API, see https://agent-browser.dev/desktop/ffi.++- Mutations run one at a time across threads and processes, under an interaction lock. Reads can overlap them, and many threads can share one adapter. Resolve, use and free a native handle on one thread, with the adapter that created it. See https://agent-browser.dev/desktop/ffi/ownership-and-threading.+- `ad_snapshot` takes an application name. It has no window id or root element argument.+- The clipboard calls carry text only. `ad_set_clipboard` starts the detached `lib/agent-desktop-linux-clipboard-owner` process. The process keeps serving the text after the host exits, until another client takes the selection or `ad_clear_clipboard` ends it. The library finds the helper beside its own image, never through `PATH`, so keep both files in the same directory. Wayland needs `wl-clipboard` installed.+- Observation needs a session accessibility bus (`at-spi2-core`). On Ubuntu 22.04 the at-spi2-core bridge aborts on `Action.GetActions`. Other distributions need the bridge fix dc0dc33.diff --git a/skills/agent-desktop-ffi/SKILL.md b/skills/agent-desktop-ffi/SKILL.mdindex 100d4e4d1..15407b94c 100644--- a/skills/agent-desktop-ffi/SKILL.md+++ b/skills/agent-desktop-ffi/SKILL.md@@ -15,7 +15,7 @@ description: ># agent-desktop-ffi-Direct C-ABI access to PlatformAdapter operations. Build the cdylib with the+Direct C-ABI access to the same operations as the CLI. Build the cdylib with the`release-ffi` profile:```shdiff --git a/skills/agent-desktop-linux/SKILL.md b/skills/agent-desktop-linux/SKILL.mdindex 014fae694..9ca85bef6 100644--- a/skills/agent-desktop-linux/SKILL.md+++ b/skills/agent-desktop-linux/SKILL.md@@ -17,8 +17,8 @@ description: ># agent-desktop-linux-The observe-act loop, refs, JSON envelope, sessions and tracing match every-platform. This file covers only what differs on Linux.+This file covers only what differs on Linux. The observe-act loop, refs, JSON+envelope, sessions and tracing are the same on every platform.Needs Ubuntu 24.04+ (x86_64 or aarch64), a graphical session of the signed-inuser and a running AT-SPI bus. Other distributions need the at-spi2-core bridgediff --git a/skills/agent-desktop-macos/SKILL.md b/skills/agent-desktop-macos/SKILL.mdindex 2d88b6c97..560523e40 100644--- a/skills/agent-desktop-macos/SKILL.md+++ b/skills/agent-desktop-macos/SKILL.md@@ -15,7 +15,7 @@ description: ># agent-desktop on macOS-Read the core skill first (`agent-desktop skills get desktop`) for the observe, act, verify loop. This skill covers only what is different on macOS. Symptoms and fixes are in [references/troubleshooting.md](references/troubleshooting.md).+Read the core skill first (`agent-desktop skills get desktop`) for the observe, act, verify loop. This skill covers only what is different on macOS. When a command fails, find the symptom in [references/troubleshooting.md](references/troubleshooting.md).## Requirements@@ -27,7 +27,7 @@ Read the core skill first (`agent-desktop skills get desktop`) for the observe,## First contact1. Run `agent-desktop permissions`.-2. If a permission is denied, run `agent-desktop permissions --guide`. It opens the correct System Settings page with a panel that shows the user which app to drag into the list. The user confirms with Touch ID or a password, and the panel moves to the next missing permission by itself. The command returns at once with `"guide": "started"`, `"already_running"` or `"not_needed"`. `agent-desktop permissions --request` shows the system prompts instead.+2. If a permission is denied, run `agent-desktop permissions --guide`. It opens the right System Settings page with a panel that shows the user which app to drag into the list. The user confirms with Touch ID or a password, and the panel moves to the next missing permission by itself. The command returns at once with `"guide": "started"`, `"already_running"` or `"not_needed"`. `agent-desktop permissions --request` shows the system prompts instead.3. If the guide cannot run, open System Settings > Privacy & Security > Accessibility (Device Control and Data Access on macOS 27 and later). Add the launching app and turn it on.4. Run `agent-desktop permissions` to confirm `granted`. The next agent-desktop call sees a new grant, so the launching app does not need a restart. Each command reads permissions in its own process, so a permission granted during a `batch` applies from the next CLI call, not to later items in that batch.5. Run `agent-desktop snapshot -i` to confirm. It reads the focused app. `snapshot --app Finder -i` returns `WINDOW_NOT_FOUND` when Finder has no open window.@@ -55,7 +55,3 @@ Read the core skill first (`agent-desktop skills get desktop`) for the observe,**Keys.** The primary modifier is `cmd`: `press cmd+c`, `press cmd+s`. Quit shortcuts such as `cmd+q`, `cmd+shift+q`, `cmd+alt+esc`, `ctrl+cmd+q` and `cmd+shift+delete` return `POLICY_DENIED` unless you pass `--force`. To quit an app, use `close-app`. Punctuation keys work in combos, as the symbol (`,` `.` `/` `;` `'` `[` `]` `\` `-` `=` `` ` ``) or by name (`comma`, `period`, `slash`, `semicolon`, `quote`, `leftbracket`, `rightbracket`, `backslash`, `minus`, `equal`, `grave`). Each one is sent with the key that types it in the active keyboard layout, so `press cmd+,` opens Settings on ANSI and JIS keyboards alike.**Cursor overlay.** `cursor-overlay enable` draws the agent cursor in a click-through window. It never moves the OS pointer or activates an app. The macOS motion and image limits are in the core `commands-system` reference.--## Next step--When a command fails, find the symptom in [references/troubleshooting.md](references/troubleshooting.md).diff --git a/skills/agent-desktop-windows/SKILL.md b/skills/agent-desktop-windows/SKILL.mdindex e93d2a730..c38f51275 100644--- a/skills/agent-desktop-windows/SKILL.md+++ b/skills/agent-desktop-windows/SKILL.md@@ -16,8 +16,8 @@ description: ># agent-desktop-windows-The observe-act loop, ref system, JSON envelope, sessions and tracing are the-same on every platform. This file covers only what differs on Windows.+This file covers only what differs on Windows. The observe-act loop, refs, JSON+envelope, sessions and tracing are the same on every platform.Requires Windows 10 1809+ / Windows Server 2019+ (x64 or ARM64). Run it in theinteractive desktop session of the signed-in user. Session 0 (services anddiff --git a/skills/agent-desktop/SKILL.md b/skills/agent-desktop/SKILL.mdindex 5e369dfe0..5184fe152 100644--- a/skills/agent-desktop/SKILL.md+++ b/skills/agent-desktop/SKILL.md@@ -17,7 +17,7 @@ description: ># agent-desktop-agent-desktop is a CLI that lets an AI agent observe and operate desktop apps through the OS accessibility tree. It is a tool, not an agent. Every command prints one JSON envelope (`ok`, `data` or `error`). The observe, act and verify loop runs in you.+agent-desktop is a CLI that reads and operates desktop apps through the OS accessibility tree. Every command prints one JSON envelope (`ok`, `data` or `error`). It is a tool, not an agent: the observe, act and verify loop runs in you.## Shell syntaxdiff --git a/tests/conformance/README.md b/tests/conformance/README.mdindex 0cfe30960..476ed4021 100644--- a/tests/conformance/README.md+++ b/tests/conformance/README.md@@ -1,17 +1,10 @@-# Adapter Reliability Conformance+# Adapter reliability conformance-Every platform adapter must satisfy the same ref/action contract. The tests are-written against `PlatformAdapter` semantics, so macOS AX, Windows UIA and Linux-AT-SPI share the same expectations.+Every platform adapter must meet the same ref and action contract. The tests are written against `PlatformAdapter` semantics, so macOS AX, Windows UIA and Linux AT-SPI share one set of expectations.-The reusable command-path helper lives in `tests/conformance/ref_action_contract.rs`.-`window_identity_contract.rs` holds the window-identity contract, and-`macos_notification_contract.rs` the macOS-only notification contract. The-executable smoke harness in `src/tests/conformance.rs` mounts all three and runs-the ref/action helper against a mock adapter. A fixture driving a real adapter-can call the same helper with adapter-provided refs.+The reusable command-path helper is `tests/conformance/ref_action_contract.rs`. `window_identity_contract.rs` covers window identity, and `macos_notification_contract.rs` covers notifications (macOS only). `src/tests/conformance.rs` mounts all three and runs the ref and action helper against a mock adapter. A fixture that drives a real adapter can call the same helper with adapter-provided refs.-## Required Gates+## Required gates| Area | Required behavior ||------|-------------------|@@ -25,7 +18,7 @@ can call the same helper with adapter-provided refs.| Session lifecycle | `session start/end/list/gc` manage manifests, the current-session pointer, and trace directories || FFI parity | FFI ref actions use strict resolve and actionability checks before adapter dispatch |-## Platform Matrix+## Platform matrix| Fixture | macOS AX | Windows UIA | Linux AT-SPI ||---------|:--------:|:-----------:|:------------:|@@ -37,17 +30,13 @@ can call the same helper with adapter-provided refs.| Batch item session overrides inherited session | Required | Required | Required || FFI `AdRefEntry` preserves full identity envelope | Required | Required | Required |-## Adding a Platform+## Adding a platform-Add adapter-specific integration fixtures, but keep expected errors and JSON-shapes identical. Prefer semantic platform actions first (`AXPress`, UIA-Invoke/Value/Selection patterns, AT-SPI actions). Coordinate input is a lower-confidence fallback and must remain explicit in policy or command choice.+Add adapter-specific integration fixtures, but keep expected errors and JSON shapes identical. Prefer semantic platform actions first (`AXPress`, UIA Invoke, Value and Selection patterns, AT-SPI actions). Coordinate input is a lower-confidence fallback, so it must stay explicit in policy or command choice.-## Windows Private-Storage Gate+## Windows private-storage gate-Windows private-file behavior is verified by native tests, never by-cross-compilation evidence alone. The Windows CI lanes run these suites natively:+Verify Windows private-file behavior with native tests. Cross-compilation alone is not evidence. The Windows CI lanes run these suites natively:| Behavior | Native test ||----------|-------------|@@ -59,9 +48,4 @@ cross-compilation evidence alone. The Windows CI lanes run these suites natively| Atomic replace succeeds over open readers and concurrent writers, and leaves no temporary residue | `replace_tests.rs` || The binary and the FFI adapter install the hardened seam, and `session start` through a junction state root is refused with nothing written under the target | `src/tests/windows_private_file_install.rs`, `crates/ffi/tests/c_abi_windows_private_file_install.rs` |-The module protects each private directory it creates with a protected DACL-(`dacl::protect_directory`) granting SYSTEM, Administrators, the token user and-the owner-eligible SIDs, and `dacl::require_private` checks that DACL before use.-Files created in such a directory inherit those grants, which-`a_profile_artifact_keeps_system_admins_and_user_and_never_users_across_create_and_replace`-in `owner_tests.rs` pins.+Each private directory the module creates gets a protected DACL (`dacl::protect_directory`) that grants SYSTEM, Administrators, the token user and the owner-eligible SIDs. `dacl::require_private` checks that DACL before use. Files created in such a directory inherit those grants. The test `a_profile_artifact_keeps_system_admins_and_user_and_never_users_across_create_and_replace` in `owner_tests.rs` pins this.diff --git a/tests/ffi-python/README.md b/tests/ffi-python/README.mdindex 1b7151ff9..8f883675d 100644--- a/tests/ffi-python/README.md+++ b/tests/ffi-python/README.md@@ -1,4 +1,4 @@-# FFI Python Smoke Harness+# FFI Python smoke harnessProves the C ABI works from a non-Rust host (Python ctypes) and gates it in CI.@@ -6,13 +6,13 @@ Proves the C ABI works from a non-Rust host (Python ctypes) and gates it in CI.| Leg | Check ||-----|-------|-| 1 | `ad_abi_version()` equals `AD_ABI_VERSION_MAJOR` from the header (catches header/dylib mismatch at import) |-| 2 | Every `ad_*_size()` getter equals the corresponding `AD_*_SIZE` macro (catches struct layout drift) |-| 3 | `ad_version()` returns `ok:true` JSON with `data.version` (basic command pipeline) |-| 4 | `ad_adapter_create` → `ad_snapshot` → `ad_free_string` → `ad_adapter_destroy` without crash or leak; stub adapter yields a clean `PLATFORM_NOT_SUPPORTED` envelope |-| 5 | Opt-in (`AD_EXPECT_REAL=1`, optional `AD_APP`, default `gnome-calculator`): the real adapter returns a complete snapshot with refs for the named app on the main thread and on a worker thread. Run by `tests/linux-dist/run-consumer.sh` |-| Linux helper | Opt-in (`AD_EXPECT_LINUX_HELPER=1` with `AD_HELPER_EMPTY_PATH`, run by `scripts/ci-ffi-helper-discovery-smoke.sh`): with an empty `PATH`, the library finds the clipboard owner beside it, a foreign GTK reader sees the text it sets, and clear empties the selection |-| 6 | Opt-in (`AD_EXPECT_MACOS_HELPER=1`, run by `scripts/ci-ffi-helper-discovery-smoke.sh`): macOS helper discovery |+| 1 | `ad_abi_version()` equals `AD_ABI_VERSION_MAJOR` from the header. Catches a header and dylib mismatch at import. |+| 2 | Every `ad_*_size()` getter equals its `AD_*_SIZE` macro. Catches struct layout drift. |+| 3 | `ad_version()` returns `ok:true` JSON with `data.version`. |+| 4 | `ad_adapter_create` → `ad_snapshot` → `ad_free_string` → `ad_adapter_destroy` runs without a crash or leak. A stub adapter returns a clean `PLATFORM_NOT_SUPPORTED` envelope. |+| 5 | Opt-in with `AD_EXPECT_REAL=1` (optional `AD_APP`, default `gnome-calculator`). The real adapter returns a complete snapshot with refs for the app, on the main thread and on a worker thread. Run by `tests/linux-dist/run-consumer.sh`. |+| Linux helper | Opt-in with `AD_EXPECT_LINUX_HELPER=1` and `AD_HELPER_EMPTY_PATH`. Run by `scripts/ci-ffi-helper-discovery-smoke.sh`. With an empty `PATH`, the library finds the clipboard owner beside it, a foreign GTK reader sees the text it sets, and clear empties the selection. |+| 6 | Opt-in with `AD_EXPECT_MACOS_HELPER=1`. Run by `scripts/ci-ffi-helper-discovery-smoke.sh`. Checks macOS helper discovery. |## Building the dylib@@ -21,27 +21,23 @@ Proves the C ABI works from a non-Rust host (Python ctypes) and gates it in CI.cargo build --locked --profile release-ffi -p agent-desktop-ffi --features stub-adapter```-The dylib lands at `target/release-ffi/libagent_desktop_ffi.dylib` (macOS) or-`target/release-ffi/libagent_desktop_ffi.so` (Linux).+The dylib lands at `target/release-ffi/libagent_desktop_ffi.dylib` on macOS, or `target/release-ffi/libagent_desktop_ffi.so` on Linux.-`--profile release-ffi` keeps `panic = "unwind"`, which is required for the-`catch_unwind` traps inside the FFI layer. Using the default `release` profile-(which has `panic = "abort"`) would silently defeat those traps.+Use `--profile release-ffi`. The default `release` profile sets `panic = "abort"`, which silently disables the FFI's `catch_unwind` traps.-`--features stub-adapter` replaces the real platform adapter with a no-op that-returns `PLATFORM_NOT_SUPPORTED` for every adapter call. This lets CI run the-harness without requiring macOS Accessibility permissions.+`--features stub-adapter` replaces the real adapter with one that returns `PLATFORM_NOT_SUPPORTED` for every call. CI uses this build, so the harness runs without Accessibility permission.## Running locally+The examples use macOS paths. On Linux, pass the `.so` instead.+```bash-# macOS (arm64 or x86_64):python3 tests/ffi-python/smoke.py \target/release-ffi/libagent_desktop_ffi.dylib \crates/ffi/include/agent_desktop.h```-Alternatively, use environment variables:+Or set environment variables:```bashexport AD_DYLIB_PATH=target/release-ffi/libagent_desktop_ffi.dylib@@ -51,27 +47,15 @@ python3 tests/ffi-python/smoke.py## Stub enforcement (`AD_EXPECT_STUB=1`)-Set `AD_EXPECT_STUB=1` when running the harness against a stub-adapter build.-With this variable set, the harness fails if `ad_snapshot()` returns `ok:true`,-which would indicate the dylib was **not** built with `--features stub-adapter`.-The stub Python smoke step on the macOS leg of the `ffi-panic-guard` CI job sets this variable so a real-adapter dylib cannot-accidentally pass the stub-only gate.+Set `AD_EXPECT_STUB=1` when you run the harness against a stub build. The harness then fails if `ad_snapshot()` returns `ok:true`, which would mean the dylib was not built with `--features stub-adapter`. The arm64 macOS leg of the `ffi-panic-guard` CI job sets this variable. A real-adapter dylib therefore cannot pass the stub gate.## Dependencies-`smoke.py` uses only the Python standard library (`ctypes`, `json`, `os`, `re`,-`pathlib`, `sys`, `threading`). No `pip install` is required, except for the-Linux helper leg: `linux_helper.py` reads the clipboard as a foreign GTK client-and needs PyGObject with the GTK 3 typelib (`python3-gi`, `gir1.2-gtk-3.0`).+`smoke.py` uses only the Python standard library, so no `pip install` is needed. The Linux helper leg is the exception. `linux_helper.py` reads the clipboard as a foreign GTK client, so it needs PyGObject with the GTK 3 typelib (`python3-gi` and `gir1.2-gtk-3.0`).## Real-adapter happy path-Legs 1 to 4 gate the permission-independent surface (ABI version, struct sizes,-`ad_version`) and the `PLATFORM_NOT_SUPPORTED` passthrough path. A successful-`ad_snapshot` with `ok:true` from the real adapter is covered elsewhere. On-macOS, the native E2E harness covers it (`tests/e2e/run.sh`, whose `ffi_live.py`-drives the release FFI library) and requires AX permission. On Linux, Leg 5-covers it.+Legs 1 to 4 cover the surface that needs no permission: the ABI version, struct sizes, `ad_version`, and the `PLATFORM_NOT_SUPPORTED` path. A successful `ad_snapshot` from the real adapter is tested elsewhere. On macOS, `tests/e2e/run.sh` covers it through `scenarios/acceptance.sh`, which runs `ffi_live.py` against the release FFI library. That run needs Accessibility permission. On Linux, leg 5 covers it.## Other files@@ -79,4 +63,4 @@ covers it.|------|---------|| `linux_helper.py` | The Linux helper leg, and `verify_cli` for the installed CLI (used by `tests/linux-dist/run-npm-install.sh`) || `test_linux_helper.py` | Unit tests for `linux_helper.py`: `python3 -I -m unittest discover -s tests/ffi-python -p 'test_linux_helper.py'` |-| `leak_probe.py` | Linux only, not run by CI: `python3 tests/ffi-python/leak_probe.py <library.so> [--calls N]` points the library at a silent X11 TCP server and checks that repeated timed-out `ad_list_displays` calls keep the host's thread and descriptor counts flat |+| `leak_probe.py` | Linux only, not run by CI: `python3 tests/ffi-python/leak_probe.py <library.so> [--calls N]`. It points the library at a silent X11 TCP server and checks that repeated timed-out `ad_list_displays` calls keep the host's thread and descriptor counts flat. |diff --git a/tests/npm/wrapper.test.js b/tests/npm/wrapper.test.jsindex a1e150a2a..55f1bd29f 100644--- a/tests/npm/wrapper.test.js+++ b/tests/npm/wrapper.test.js@@ -191,7 +191,8 @@ test('launcher notice prints once per version and leaves stdout and exit code alassert.equal(first.stdout, '["a","--b"]\n');assert.match(first.stderr, /runs through the Node launcher/);assert.match(first.stderr, /--allow-scripts=agent-desktop/);- assert.match(first.stderr, /npm install-scripts approve agent-desktop/);+ assert.match(first.stderr, /npm install-scripts approve agent-desktop, then npm rebuild agent-desktop/);+ assert.doesNotMatch(first.stderr, /\(npm 1\d\)/);assert.equal(statSync(join(binDir, '.launcher-notice-9.8.7')).isFile(), true);const second = await runLinux(script);assert.equal(second.code, 3);