Computer use CLI for AI agents
Rust accessibilityaccessibility-apiai-agentsautomationclicomputer-usecomputer-use-agentcomputer-use-agentsdesktop-automationmacosmcprust
docs: remove the staleness and contradictions left after the Windows promotion (#278)
Lahfir5a2c9ad43e26
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex 3cc131744..587bc15d6 100644--- a/.github/ISSUE_TEMPLATE/bug_report.yml+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -15,7 +15,7 @@ body:attributes:label: agent-desktop versiondescription: Paste the output of `agent-desktop --version`- placeholder: "agent-desktop 0.1.8"+ placeholder: "agent-desktop 0.10.1"validations:required: true@@ -57,7 +57,7 @@ body:render: shellplaceholder: |$ agent-desktop snapshot --app Finder- {"version":"2.2","ok":false,"command":"snapshot","error":{"code":"APP_NOT_FOUND",...}}+ {"version":"2.4","ok":false,"command":"snapshot","error":{"code":"APP_NOT_FOUND",...}}validations:required: truediff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex d44ac4b08..c348e7956 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -748,7 +748,7 @@ jobs:# Gate 3 — Stub-adapter passthrough tests: the Family-B command-backed# entrypoints (ad_snapshot, ad_status, ad_wait, ad_execute_by_ref,- # ad_version) plus adapter lifecycle (ad_init / ad_destroy) and+ # ad_version) plus adapter lifecycle (ad_init / ad_adapter_destroy) and# ad_check_permissions are exercised against the stub adapter. Each must# return a structured PLATFORM_NOT_SUPPORTED envelope — or, for# ad_check_permissions, the documented ErrPermDenied result. These tests are@@ -763,7 +763,7 @@ jobs:# assert PLATFORM_NOT_SUPPORTED for every covered entrypoint, proving the# non-macOS parity U10 targets.# - Release: release.yml build-ffi matrix covers macOS×2 + Linux×2 +- # Windows×1 for the real cdylib. PR builds do not duplicate that+ # Windows×2 for the real cdylib. PR builds do not duplicate that# cross-compile matrix to avoid bloating CI on every push.ffi-passthrough:name: FFI Stub-Adapter Passthroughdiff --git a/CLAUDE.md b/CLAUDE.mdindex fa346843a..616f25e21 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -87,12 +87,11 @@ When something is deferred — at planning time or at implementation time — th## Git & Commits-### Branching during a platform phase (Phase 2 = Windows, in progress)+### Branching-- **`feat/windows-adapter` is the base branch for all Windows work**, not `main`. Every sub-phase (2.0 → 2.16) is cut from it and merges back into it.-- Sub-phase branches: `feat/windows-<n.n>-<slug>` (e.g. `feat/windows-2.0-probes`), PR'd into `feat/windows-adapter`.-- **Never branch Windows work off `main`, never PR a sub-phase into `main`, never rebase a sub-phase onto `main`.**-- `main` is the macOS-GA line for the whole phase. It gains Windows exactly once, at the end, when the adapter is production-solid as a whole — one release-noted `feat!` promotion after full-branch review, live e2e, and a perf baseline. Phase 3 repeats this with `feat/linux-adapter`.+- **`main` carries macOS and Windows.** Windows reached `main` in v0.10.0 as one `feat!` promotion of `feat/windows-adapter`, which is merged. Fixes and features for either platform branch off `main` and PR into `main`.+- **A platform phase works on its own integration branch.** Phase 3 (Linux) uses `feat/linux-adapter`: every sub-phase is cut from it as `feat/linux-<n.n>-<slug>` and merges back into it, never into `main`, and never rebases onto `main`.+- The integration branch reaches `main` exactly once, at the end, when the adapter is production-solid as a whole — one release-noted `feat!` promotion after full-branch review, live e2e, and a perf baseline.- Plan docs: historical plans and brainstorms are tracked on `main`. Every sub-phase's plan doc lands onits own sub-phase branch, so each sub-phase PR reviews as one self-contained unit.- See `docs/phases.md` §Platform Delivery Model for the full rule.@@ -151,8 +150,7 @@ agent-desktop/├── docs/│ └── solutions/ # documented solutions to past problems (bugs, best practices, workflow patterns), organized by category with YAML frontmatter (module, tags, problem_type); relevant when implementing or debugging in documented areas└── tests/- ├── fixtures/ # golden JSON snapshots- └── integration/ # macOS CI integration tests+ └── fixtures/ # golden JSON snapshots```### Dependency Inversion (Non-Negotiable)@@ -222,7 +220,7 @@ Batch is not a second dispatcher. `src/batch/mod.rs` deserializes JSON entries iNumbering follows `docs/phases.md` (the source of truth for phase scope):- **Phase 1 / 1.5 / 1.6 (completed):** Foundation + macOS MVP, FFI cdylib distribution, and the Playwright-grade foundation contract (capability supertraits, auto-wait, occlusion gate, live locator, ProcessState, envelope 2.1)-- **Phase 2:** Windows adapter — delivered as sub-phases 2.0–2.17, beginning with a raw-script platform exploration phase, each a <=2,000-LOC PR into the `feat/windows-adapter` integration branch+- **Phase 2 (completed, v0.10.0):** Windows adapter — delivered as sub-phases 2.0–2.17, beginning with a raw-script platform exploration phase, each a <=2,000-LOC PR into the `feat/windows-adapter` integration branch- **Phase 3:** Linux adapter — same sub-phase template onto `feat/linux-adapter`- **Phase 4:** MCP server mode via `--mcp` flag — wraps existing commands- **Phase 5:** Daemon, sessions, enterprise quality gates@@ -285,7 +283,7 @@ All platform crates (`macos`, `windows`, `linux`) share the same top-level subfo```crates/{macos,windows,linux}/src/├── lib.rs # mod declarations + re-exports only-├── adapter.rs # PlatformAdapter trait impl (~175 LOC)+├── adapter.rs # PlatformAdapter trait impl├── tree/ # Reading & understanding the UI│ ├── mod.rs # re-exports│ ├── element.rs # AXElement struct + attribute readers@@ -307,7 +305,7 @@ crates/{macos,windows,linux}/src/│ ├── scroll_ladder.rs # ancestor ScrollPattern ladder│ ├── scroll_into_view.rs│ ├── focus.rs # headed SetFocus + verification-│ └── post_state.rs # post-action state for ActionResult+│ └── post_state.rs # post-action state for ActionResult (macOS only)├── input/ # Low-level OS input synthesis│ ├── mod.rs # re-exports│ ├── keyboard.rs # Key synthesis, text typing (+ keyboard_event/map/send/text on Windows)@@ -416,7 +414,7 @@ The `error` object may also carry optional `details` and `recovery` objects. Ver- All persisted state lives under one state root, default `~/.agent-desktop`. `AGENT_DESKTOP_HOME` relocates it (the env value is the root itself, no suffix appended); resolution lives in `crates/core/src/state_root.rs` with precedence test override > env > default, and `status` reports the resolved root as `state_root`- Snapshot refs are stored by snapshot ID under `<state root>/snapshots/{snapshot_id}/refmap.json`, with a `latest_snapshot_id` pointer that `status` reports- Retention keeps the newest 128 snapshots per namespace and evicts down to 96, so the sort-and-stat pass is amortised instead of running on every save. Refs are invalidated by the next UI change, so retention only has to cover one interaction's drill-downs. Per R7/KTD5 of the session-first trace plan, a `snapshot_id` referenced by an *older* trace event may therefore no longer resolve to a full tree; `ArtifactsMode::Full` is the recorded mitigation because it copies each refmap into `<session>/trace/refmaps/`-- `~/.agent-desktop/last_refmap.json` is written only as a latest-snapshot inspection artifact; command code must use `RefStore`+- `~/.agent-desktop/last_refmap.json` is a legacy file that is no longer written; `RefStore` reads it only to migrate an existing one into the default namespace; command code must use `RefStore`- Action commands use strict re-identification from platform-neutral `RefEntry` evidence: pid, role, path/source surface, role-conditional stable text identity, and bounds hash. Mutable control values are volatile and must not be treated as stable text identity. Return `STALE_REF` on mismatch and `AMBIGUOUS_TARGET` when multiple plausible live candidates remain.- Progressive traversal: `--skeleton` clamps depth to 3, annotates truncated containers with `children_count`. Named/described containers at boundary receive refs as drill-down targets- Drill-down: `--root @ref` starts from a previously-discovered ref with scoped invalidation (only that ref's subtree refs are replaced on re-drill)@@ -478,7 +476,7 @@ contact with Windows and was deleted. See60 commands spanning App/Window, Observation, Interaction, Scroll, Keyboard,Mouse, Notifications, Clipboard, Wait, System (including `session`), andBatch. The core skill (`skills/agent-desktop/`) covers the loop on every OS; the platform skills (`skills/agent-desktop-macos/`, `skills/agent-desktop-windows/`) cover what differs. `agent-desktop skills get platform` serves the one for the running OS.-All 60 are implemented on macOS (Phase 1). Windows ships the same surface,+56 of the 60 command names are operational on macOS; the four held-input names (key-down, key-up, mouse-down, mouse-up) fail closed. Windows ships the same surface,including event waits, shell surfaces and Action Center notifications, with theper-platform limits stated in `skills/agent-desktop-windows/`. Linux (Phase 3)targets the same surface. Adding a command: see the Extensibility Pattern above.@@ -488,7 +486,7 @@ targets the same surface. Adding a command: see the Extensibility Pattern above.- Does NOT embed or invoke LLMs- Does NOT provide a GUI, TUI, or interactive prompt — machine-facing only- Does NOT automate web browsers (use agent-browser for that)-- Does NOT record or replay macros (stateless per invocation until Phase 4 daemon)+- Does NOT record or replay macros (stateless per invocation until Phase 5 daemon)- Does NOT work with custom-rendered or game-engine UIs lacking accessibility exposure## Reference Documentsdiff --git a/CONCEPTS.md b/CONCEPTS.mdindex 5dcb5870e..0254aab1a 100644--- a/CONCEPTS.md+++ b/CONCEPTS.md@@ -140,7 +140,7 @@ Retiring both through one arm is how a hung or faulting target becomes a truncat## Coordination### State Root-The single on-disk directory that owns everything the CLI persists: sessions, snapshot refmaps and their locks, trace segments, and the latest-snapshot inspection artifact. Default is `~/.agent-desktop`.+The single on-disk directory that owns everything the CLI persists: sessions, snapshot refmaps and their locks, trace segments, and the `latest_snapshot_id` pointer. Default is `~/.agent-desktop`.`AGENT_DESKTOP_HOME` relocates the state root; the env value is the root itself, with no `.agent-desktop` suffix appended. Resolution lives in core and is identical across platforms. Explicit user-given output paths (`screenshot --out`, `--trace <path>`) are not re-rooted.@@ -225,7 +225,7 @@ Core owns the precondition each action declares — a focused window for keyboar### Agent Cursor Overlay-An optional presentation-only cursor driven by verified action destinations. Its whole configuration — label, colours, size, and click effects — is set once per session with `session start --cursor` or `cursor-overlay enable`; action and batch commands inherit it and take no cursor flags. Motion models a human hand and the cursor never rotates or resizes. The renderer acknowledges arrival before the action dispatches, under a bounded timeout, so the picture and the real effect stay in step. A click plays a ripple and flashes an outline around the element. Headed mode retains the overlay. It never moves or replaces the OS pointer and never changes Interaction Policy, action delivery, or response semantics. Configuration, motion, and effect timing live in `agent-desktop-core`; macOS supplies the native renderer while other platforms inherit the adapter's default no-op.+An optional presentation-only cursor driven by verified action destinations. Its whole configuration — label, colours, size, and click effects — is set once per session with `session start --cursor` or `cursor-overlay enable`; action and batch commands inherit it and take no cursor flags. Motion models a human hand and the cursor never rotates or resizes. The renderer acknowledges arrival before the action dispatches, under a bounded timeout, so the picture and the real effect stay in step. A click plays a ripple and flashes an outline around the element. On macOS, headed mode retains the overlay; on Windows a `--headed` command sends real pointer input and suppresses the overlay for that command. It never moves or replaces the OS pointer and never changes Interaction Policy, action delivery, or response semantics. Configuration, motion, and effect timing live in `agent-desktop-core`; macOS supplies the native renderer while other platforms inherit the adapter's default no-op.For macOS harness subagents, `session start --cursor --multi-agent` enables a cursor per `(session-id, agent-id)`. The harness assigns each subagent a stable global `--agent-id` or `AGENT_DESKTOP_AGENT_ID`. The CLI requires this identity for desktop UI actions in that mode. Headless and headed actions share the same cursor presentation, including raw physical pointer commands. The interaction lease still serializes physical input on the shared OS pointer. Each cursor reuses the same rendering and fade behavior; snapshots remain shared by session. Optional agent profiles override presentation only, and session disable/end removes every cursor.diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex fc5731cd5..d11e23fad 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -6,7 +6,7 @@ agent-desktop is a native Rust CLI and FFI library that gives AI agents structur- **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) (follow the Extensibility Pattern below)-- **Platform adapters** — the Windows adapter (in progress) and the Linux adapter (planned), both implementing `PlatformAdapter`+- **Platform adapters** — the Windows adapter (shipped in v0.10.0, open to fixes and features) and the Linux adapter (planned), both 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@@ -20,7 +20,7 @@ This project follows the guidelines in [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).| Requirement | Notes ||---|---|-| **Rust toolchain** | Pinned to `stable` via `rust-toolchain.toml` (`rust-version` 1.89). `rustup` picks the correct channel automatically. |+| **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.0+** | Required to build and run the macOS adapter (`crates/macos/`). The Windows adapter (`crates/windows/`) builds on Windows only. The Linux crate is still a stub and compiles anywhere. || **Accessibility permission** | Required 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 only for `screenshot` tests. Same path in System Settings. |@@ -80,7 +80,7 @@ bash tests/e2e/run.shThe E2E harness drives the release binary against a real SwiftUI/AppKit fixture and asserts every effect by independent observation — never by trusting `ok: true`. See `tests/e2e/README.md` for what it covers and how to add a scenario.-CI additionally checks that the release binary stays under 15 MB and that `crates/ffi/src/commands/generated.rs` is not out of sync with `build.rs`.+CI additionally checks that the release binary stays under 15 MB and that the committed C header `crates/ffi/include/agent_desktop.h` has not drifted from the Rust ABI declarations (the `ffi-header-drift` job).## Pre-commit hook@@ -167,7 +167,7 @@ No existing files are modified beyond these six registration points.## Submitting a pull request-1. **Pick the right base branch.** Branch from `main` for macOS and core work. Windows adapter work branches from `feat/windows-adapter` (as `feat/windows-<n.n>-<slug>`) and opens its PR into `feat/windows-adapter`, never into `main`.+1. **Pick the right base branch.** Branch from `main` for macOS, Windows and core work and open the PR into `main`. A platform phase still in progress (Linux) works on its own integration branch, `feat/linux-adapter`, with sub-phase branches `feat/linux-<n.n>-<slug>` that merge back into it, never into `main`.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.diff --git a/README.md b/README.mdindex 8497a78c6..221160b00 100644--- a/README.md+++ b/README.md@@ -1,8 +1,4 @@-<h1 align="center">AGENT DESKTOP</h1>--<p align="center">- <strong>OBSERVE. DECIDE. ACT.</strong>-</p>+<h1 align="center">agent-desktop</h1><p align="center"><a href="https://github.com/lahfir/agent-desktop/actions/workflows/ci.yml?query=branch%3Amain"><img src="https://img.shields.io/github/actions/workflow/status/lahfir/agent-desktop/ci.yml?branch=main&style=for-the-badge" alt="CI status"></a>@@ -17,520 +13,98 @@<video src="https://github.com/user-attachments/assets/9b2c9f8c-a49d-4b69-b6cf-11d9e0d40ceb" controls width="800"></video></p>-**agent-desktop** gives any agent reliable computer use on the desktop. Built with Rust, it sees any app's real UI structure through OS accessibility trees and operates it — refs stay stable and actions stay safe to retry, instead of guessing from pixels.--## Architecture--<p align="center">- <img src="docs/architecture.png" alt="agent-desktop architecture diagram" width="900" />-</p>--<p align="center">- <img src="docs/slack-example.png" alt="Slack accessibility snapshots: 30,743 tokens for a regular snapshot versus 383 for a skeleton overview, with focused drilling for controls" width="900" />-</p>+agent-desktop is a command-line tool and C library that lets an AI agent read and operate desktop apps on macOS and Windows through the operating system's accessibility tree. It prints JSON. Each element the agent can act on gets a ref such as `@s8f3k2p9:e3`, which names the snapshot it came from. Linux is planned.-<a href="https://star-history.com/#lahfir/agent-desktop&Date">- <picture>- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=lahfir/agent-desktop&type=Date&theme=dark">- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=lahfir/agent-desktop&type=Date">- <img alt="Star history for lahfir/agent-desktop" src="https://api.star-history.com/svg?repos=lahfir/agent-desktop&type=Date">- </picture>-</a>--## Key Features--- **Native Rust CLI**: Fast, single binary, no runtime dependencies-- **C-ABI cdylib** (`libagent_desktop_ffi`): Load once from Python / Swift / Go / Ruby / Node / C instead of forking the CLI per call-- **60 command names, 56 operational commands**: Observation, interaction, keyboard, mouse, notifications, shell surfaces, clipboard, window management, session lifecycle, trace read/export, plus a bundled `skills` doc loader. The four held-input names are reserved for a stateful daemon and fail closed in the stateless CLI.-- **Progressive skeleton traversal**: 78–96% token reduction on dense apps via shallow overview + targeted drill-down-- **Snapshot & refs**: AI-optimized workflow using compact snapshot IDs and qualified element references (`@s8f3k2p9:e1`, `@s8f3k2p9:e2`)-- **Headless-by-default interactions**: Ref actions use accessibility APIs and block silent focus, cursor, keyboard, or pasteboard side effects-- **Structured JSON output**: Machine-readable responses with error codes and recovery hints-- **Works with any app**: Finder, Safari, System Settings, Xcode, Slack — anything with an accessibility tree-- **Chromium-app interop via CDP**: `launch --cdp` opens a verified DevTools port so any framework that speaks CDP — Playwright, Puppeteer, `chrome-remote-interface`, agent-browser — can drive the web contents, while native menus, dialogs, and windows stay on the accessibility path+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.## Installation-### npm (recommended)--```bash-npm install -g agent-desktop # downloads prebuilt binary automatically-```--The same command installs on macOS (ARM64, x64) and Windows (x64, ARM64). The installer downloads a `.tar.gz` release asset, verifies its SHA-256 against the release's `checksums.txt`, and places the native binary beside the `agent-desktop` launcher.--Recent npm versions block install scripts by default, which prevents the wrapper from fetching its binary and produces a loud binary-not-found failure on first run. To permit this package's install script, add the `allowScripts` configuration to your `package.json` (or npm config):--```json-{- "allowScripts": {- "agent-desktop": true- }-}-```--Or via npm config:-```bash-npm config set allowScripts.agent-desktop true+npm install -g agent-desktop```-Or without installing:+This works on macOS (ARM64, x64) and Windows (x64, ARM64). The package's `postinstall` script downloads the binary from the GitHub release and checks its SHA-256 against the release's `checksums.txt`. npm 11 runs that script but warns that it is not covered by `allowScripts`. An npm that blocks install scripts leaves no binary, and the first run fails with binary-not-found. To allow the script:```bash-npx agent-desktop snapshot --app Finder -i+npm install -g --allow-scripts=agent-desktop agent-desktop+npm config set allow-scripts=agent-desktop --location=user```-### Direct download--Windows binaries are also published as GitHub Release assets:--- `agent-desktop-v<version>-x86_64-pc-windows-msvc.tar.gz`-- `agent-desktop-v<version>-aarch64-pc-windows-msvc.tar.gz`--Each archive contains one entry, `agent-desktop.exe`. Verify a manual download before running it:+Release archives are also on the [releases page](https://github.com/lahfir/agent-desktop/releases). The checksums come from the same release as the archives, so they catch corruption but do not prove origin. Check origin with:```bash-curl -fsSL https://github.com/lahfir/agent-desktop/releases/download/v<version>/checksums.txt-sha256sum <downloaded-archive> # compare with the matching checksums.txt linegh attestation verify <downloaded-archive> --repo lahfir/agent-desktop```-The checksums published beside a release come from the same release as the artifact they describe, so they detect corruption rather than proving provenance. A reader who downloads an artifact manually can verify provenance with `gh attestation verify <file> --repo lahfir/agent-desktop`.--### From source+To build from source you need Rust 1.89 or later, plus the Xcode command-line tools on macOS 13+ or the MSVC build tools on Windows:```bash-git clone https://github.com/lahfir/agent-desktop-cd agent-desktop-cargo build --release-cp target/release/agent-desktop /usr/local/bin/+git clone https://github.com/lahfir/agent-desktop && cd agent-desktop+cargo build --release -p agent-desktop```-Requires Rust 1.89+. On macOS this means macOS 13.0+ with the Xcode command-line tools; on Windows it requires the MSVC toolchain (Visual Studio Build Tools with the "Desktop development with C++" workload).--On macOS, application names use AppKit's localized display name. If it is unavailable, the inventory uses the executable name, then the bundle identifier, while retaining the application's process identity.-### Permissions-macOS requires Accessibility permission. Screenshots also require Screen Recording permission, and the Notification Center opener requires Automation permission for System Events. Plain permission checks never prompt. Request missing permissions in a bounded isolated helper with:--```bash-agent-desktop permissions --request # request missing permissions in an isolated helper-```--Windows needs no permission grant for reading or acting on applications at the same integrity level as your terminal: UI Automation requires no TCC-style consent. An elevated target (an app running as administrator) can only be driven by an elevated agent, because UIPI blocks synthesized input across that boundary while reads still succeed. Because the shipped binary is unsigned, three Windows execution controls may still intervene: a browser-downloaded copy shows the SmartScreen warning on first GUI launch (the npm install path attaches no Mark-of-the-Web, so no prompt fires there), antivirus software may quarantine a freshly downloaded unsigned executable, and Smart App Control on a clean Windows 11 install blocks unknown unsigned executables at process creation regardless of launch mode.--Permission fields are explicit objects, for example:--```json-{- "accessibility": { "state": "granted" },- "screen_recording": { "state": "denied", "suggestion": "Grant Screen Recording permission" },- "automation": { "state": "unknown" }-}-```+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; `agent-desktop permissions --request` asks for what is missing.-Automation reports `granted`, `denied`, or `unknown`; `unknown` means macOS would need to prompt or System Events could not be probed without prompting.+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, 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.-## Language bindings (FFI)+## Language bindings-Every GitHub Release ships a prebuilt C-ABI cdylib (`libagent_desktop_ffi`) for macOS, Linux, and Windows alongside the CLI tarballs. `dlopen` it and call the functions declared in `agent_desktop.h` for in-process calls instead of fork-exec per command.+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.```pythonimport ctypeslib = ctypes.CDLL("./lib/libagent_desktop_ffi.dylib")-lib.ad_init(4) # verify ABI major (AD_ABI_VERSION_MAJOR) before any call+lib.ad_init(5) # checks the header's AD_ABI_VERSION_MAJOR against the libraryadapter = lib.ad_adapter_create()-# observe -> act: ad_snapshot -> parse a qualified ref -> ad_execute_by_ref ...lib.ad_adapter_destroy(adapter)```-Full consumer guide — entrypoints, ownership, threading, error-handling, build/link, release archives, and verification: **[`skills/agent-desktop-ffi/`](skills/agent-desktop-ffi/)**.+See [`skills/agent-desktop-ffi/`](skills/agent-desktop-ffi/) for the entry points, memory ownership and threading rules.-## Core Workflow for AI+## Usage-> **Shell syntax.** The examples below are POSIX shell (zsh, bash). In Windows-> PowerShell, quote every ref (`'@s8f3k2p9:e1'`) — a bare `@token` is the-> splatting operator and the argument disappears — use `$env:NAME = 'value'`-> instead of `export`, and `$r = agent-desktop ... | ConvertFrom-Json` instead-> of `$(...)` and `jq`.--For dense apps (Slack, VS Code, Notion), use **progressive skeleton traversal** to minimize token usage:+Take a snapshot, act on a ref from it, then snapshot again to check the result:```bash-# 1. Shallow overview — depth-3 map, truncated containers show children_count-agent-desktop snapshot --skeleton --app Slack -i --compact-# Refs are qualified with their snapshot ID, for example @s8f3k2p9:e3--# 2. Drill into a region of interest (each truncated branch exposes a safe drill ref)-agent-desktop snapshot --root @s8f3k2p9:e3 -i --compact--# 3. Act on an element found in the drill-down-agent-desktop click @s8f3k2p9:e12--# 4. Re-drill the same region to verify the state change-agent-desktop snapshot --root @s8f3k2p9:e3 -i --compact-```--For simple apps, a full snapshot is fine:--```bash-agent-desktop snapshot --app Finder -i # get interactive elements with qualified refs-agent-desktop click @s8f3k2p9:e3 # click a button by ref-agent-desktop type @s8f3k2p9:e5 "quarterly report" # insert text into a field-agent-desktop press cmd+s # keyboard shortcut-agent-desktop snapshot -i # re-observe after UI changes-```--```-Agent loop: snapshot → decide → act → snapshot → decide → act → ...-```--### Trace viewer (read back a session)--```bash-session_id=$(agent-desktop session start --screenshots | jq -r '.data.session_id')-export AGENT_DESKTOP_SESSION="$session_id"-agent-desktop snapshot --app Finder -i # work inside the explicit session scope-agent-desktop click @s8f3k2p9:e5-agent-desktop trace show --limit 500 # bounded JSON timeline for agents-agent-desktop trace export --out run.html # single-file HTML viewer (works from file://)-```--`trace show` merges all segment files deterministically and requires no permissions. `trace export` embeds the timeline plus screenshots as base64 in one static HTML file. Without `--out`, the HTML is written to the session directory (`~/.agent-desktop/sessions/<id>/trace-<id>.html`), not the current directory; `--out` overrides the path. Treat exported HTML like a screenshot when `artifacts: full` was enabled.--### Shared sessions for multi-agent workflows--Run `session start` once per agent run to create a trace-enabled session (manifest `trace: on` by default), then pass the returned ID with global `--session <id>` or `AGENT_DESKTOP_SESSION=<id>`. Commands in that explicit scope get automatic JSONL segments under `~/.agent-desktop/sessions/<id>/trace/` and share the session's latest-snapshot namespace — no `--trace` on every call.--For concurrent **independent** agents, set `AGENT_DESKTOP_SESSION=<id>` per process. When multiple agents share one session ID, each agent should act on the qualified refs from its own `snapshot` call rather than assuming the namespace's latest snapshot is unchanged.--Bare `--session <id>` without a manifest (no `session start`) still scopes the snapshot namespace only and writes no trace files. Snapshot IDs resolve only inside the selected session namespace; they never trigger a cross-session search.--```bash-agent-desktop session start --name release-fix # note data.session_id-export AGENT_DESKTOP_SESSION=<session_id>-agent-desktop snapshot --app Xcode -i --compact # uses selected session + tracing-agent-desktop wait --element @s8f3k2p9:e9 --predicate actionable --timeout 5000-agent-desktop click @s8f3k2p9:e9-agent-desktop session end "$AGENT_DESKTOP_SESSION"-agent-desktop session gc-```--### Agent cursor overlay--A presentation-only cursor that shows what the agent is about to do. Off by-default. Renders on macOS and Windows; other platforms record the setting-without drawing.--On macOS agent cursors work in both headless and headed mode, including-physical pointer commands. Drags follow the cursor's curved motion and draw an-accent-colored trail while held, then fade after release. Each agent retains-its own cursor; the existing interaction lease coordinates the shared OS-pointer.--On Windows the overlay draws only for headless semantic actions — a `--headed`-command sends real pointer input and the overlay is suppressed for that-command only — and it does not collapse under the OS's reduce-motion-accessibility preference the way macOS does, a deliberate difference documented-with its cost in `skills/agent-desktop-windows/SKILL.md`.--```bash-session_id=$(agent-desktop session start --cursor | jq -r '.data.session_id')-export AGENT_DESKTOP_SESSION="$session_id"+agent-desktop snapshot --app Finder -i # interactive elements with refs+agent-desktop click @s8f3k2p9:e3+agent-desktop type @s8f3k2p9:e5 "quarterly report"+agent-desktop press cmd+sagent-desktop snapshot --app Finder -i-agent-desktop click <qualified-ref-from-snapshot>-agent-desktop cursor-overlay disable-```--`session start --cursor` turns it on with the default look. `cursor-overlay enable` does the same for a session that already exists.--**Style defaults belong to the session.** Set them once; later commands inherit them. Named agents can save their own style using global `--agent-id`.--```bash-agent-desktop --session "$session_id" cursor-overlay enable --label "Opening the menu"-export AGENT_DESKTOP_SESSION="$session_id"```-For harness subagents on macOS, start one shared session and give each worker a stable ID:+For a dense app, start with a shallow map and expand only the part you need. On Slack this cut one snapshot from 30,743 tokens to 383:```bash-session_id=$(agent-desktop session start --cursor --multi-agent | jq -r '.data.session_id')-export AGENT_DESKTOP_SESSION="$session_id"-# Set a different ID in each subagent's environment:-export AGENT_DESKTOP_AGENT_ID=researcher-agent-desktop cursor-overlay enable --label "Checking details" --accent "#FF3B7B"-agent-desktop snapshot --app Finder -i-agent-desktop click <qualified-ref-from-snapshot>-```--The style command is optional and saves settings for the next presentation without creating a cursor. Each distinct agent ID gets its own cursor on first presentation; three IDs produce three cursors, with no extra coordinator cursor. IDs use 1–64 letters, digits, `-` or `_`. Global `--agent-id` overrides the environment. In multi-agent mode, desktop UI actions require an ID; observations, clipboard operations, and session administration do not. Snapshots remain shared by session, so pin qualified refs and coordinate actions on shared UI. `cursor-overlay disable` or `session end` stops every cursor, even when an agent ID is set. To enable this mode on an existing session, run `cursor-overlay enable --multi-agent` without an agent ID.--| Flag | Meaning | Default |-|---|---|---|-| `--label TEXT` | Intent text beside the cursor | none |-| `--max-words N` | Label word limit, 1–12 | 6 |-| `--fill HEX` | Cursor body | `#FFFFFF` |-| `--rim HEX` | Cursor outline | `#111318` |-| `--accent HEX` | Ripple and element outline | `#4299FF` |-| `--size N` | Size multiplier, 0.5–4.0 | 1.0 |-| `--no-ripple` | No ripple on click | ripple on |-| `--no-highlight` | No element outline on click | outline on |-| `--image PATH` | PNG drawn instead of the arrow, scaled by `--size` | arrow |-| `--hotspot X,Y` | Click point in the image, points from its top-left | `0,0` |-| `--pointer-image PATH` | Image shown on arrival over buttons, links and other pressable controls | arrow |-| `--pointer-hotspot X,Y` | Click point in the pointer image | `0,0` |--`cursor-overlay enable` also accepts `--travel-ms`, `--bow`, `--overshoot`, `--tremor`, `--dwell-ms` and `--motion-seed` for session or per-agent motion profiles; see the [system command reference](skills/agent-desktop/references/commands-system.md#cursor-overlay).--**Behaviour**--- The cursor travels a human path in 90–320 ms. It never rotates or resizes.-- `--image` swaps the arrow for your PNG (≤ 2 MiB). Fill and rim do not apply; accent still drives the ripple, outline and trail. Oversized images are scaled down to fit the cursor stage, and a missing file falls back to the arrow. `--pointer-image` adds a second image, such as a pointing hand, shown when a ref action lands on a button, link or other pressable control, and on coordinate clicks.-- The action waits up to 900 ms for cursor arrival confirmation. If the renderer does not confirm in time, a warning is reported and the action proceeds.-- A click plays a ripple, then flashes an accent outline around the element for 0.9 s. Both draw below the cursor.-- Idle for 6 s, it fades out. The next command brings it back.-- `cursor-overlay disable` removes it now and stops the renderer. You do not- have to end the session. If a session ends without a `disable` — a crash,- `session gc` — the renderer reclaims itself within a few seconds regardless.-- Headed actions retain it on macOS and hide it on Windows. It never moves or- intercepts the OS pointer on either.-- Overhead is about 150–300 ms per action, all of it the visible travel. On- Windows the control-pipe roundtrip itself measures a fraction of a- millisecond; the travel animation is the cost.--macOS and Windows render it natively — on Windows it also draws above the-shell's own topmost chrome, including the taskbar. Linux inherits the-adapter's no-op and needs its own renderer against the same core contract.--## Driving Chromium apps (CDP)--For a Chromium-based app (Slack, VS Code, Discord, Obsidian, Notion), `launch --cdp` opens a verified Chrome DevTools Protocol endpoint on the web contents. Any framework that speaks CDP can connect — Playwright, Puppeteer, `chrome-remote-interface`, agent-browser — with agent-browser preferred for its ref-based agent workflow and bundled `electron` skill. Native surfaces (menus, dialogs, windows, screenshots) stay on the accessibility path either way.--```bash-agent-desktop launch "Obsidian" --cdp-```--```json-{ "app": "Obsidian", "pid": 4821, "cdp": {- "port": 9229,- "http_endpoint": "http://127.0.0.1:9229",- "websocket_url": "ws://127.0.0.1:9229/devtools/browser/<id>",- "product": "Chrome/142.0.7444.265"-},- "suggestion": "Next: run `agent-browser connect 9229` (preferred) or connect any CDP client such as Playwright or Puppeteer. ..." }-```--`--cdp` needs a fresh launch — an already-running target returns `ACTION_FAILED`. Run `close-app` first, confirm the process exited, then `launch --cdp` again.--The endpoint is pinned to `127.0.0.1`. Any local process running as your user can still reach it while it stays open; `close-app` ends the exposure along with the app.--## Commands--### Observation--```bash-agent-desktop snapshot --app Safari -i # accessibility tree with refs-agent-desktop snapshot --surface menu # capture open menu-agent-desktop screenshot --app Finder # PNG screenshot-agent-desktop find --role button --app TextEdit # search by role, name, value, text-agent-desktop get @s8f3k2p9:e3 --property value # read element property-agent-desktop is @s8f3k2p9:e7 --property checked # check boolean state-agent-desktop list-surfaces --app Notes # list menus, sheets, popovers, alerts-```--`get` and `is` resolve the ref once, prefer live platform reads when available, and fall back only when that live read is unsupported by the adapter.--### Interaction--```bash-agent-desktop click @s8f3k2p9:e3 # strict headless AX click-agent-desktop --headed click @s8f3k2p9:e3 # physical click, focus/cursor allowed-agent-desktop --headed double-click @s8f3k2p9:e3 # physical double-click-agent-desktop --headed triple-click @s8f3k2p9:e3 # physical triple-click-agent-desktop right-click @s8f3k2p9:e3 # open context menu; inspect effect before retrying-agent-desktop type @s8f3k2p9:e5 "hello world" # insert text into element-agent-desktop set-value @s8f3k2p9:e5 "new value" # set value directly via AX-agent-desktop clear @s8f3k2p9:e5 # clear element value-agent-desktop focus @s8f3k2p9:e5 # set keyboard focus-agent-desktop select @s8f3k2p9:e9 "Option B" # select verified dropdown/list option-agent-desktop toggle @s8f3k2p9:e12 # flip checkbox or switch-agent-desktop check @s8f3k2p9:e12 # idempotent check-agent-desktop uncheck @s8f3k2p9:e12 # idempotent uncheck-agent-desktop expand @s8f3k2p9:e15 # expand disclosure/tree item-agent-desktop collapse @s8f3k2p9:e15 # collapse disclosure/tree item-agent-desktop scroll @s8f3k2p9:e1 --direction down --amount 3 # strict headless AX scroll-agent-desktop scroll-to @s8f3k2p9:e20 # scroll element into view-```--> **(macOS, Phase 1)** Default ref actions are strict headless semantic operations. In headed mode, core focuses the exact ref window before dispatch; pointer commands additionally require a verified target point, while the adapter owns physical delivery. `click`, `right-click`, `type`, `clear`, and `scroll` are physical-first; double/triple-click, hover, and drag are physical-only; expand/collapse and other semantic commands remain semantic. Raw coordinates never imply a target window and therefore never steal focus. See `skills/agent-desktop/references/commands-interaction.md`.--### Keyboard--```bash-agent-desktop press cmd+s # key combo-agent-desktop press cmd+shift+z # multi-modifier-agent-desktop press escape # single key-```--`key-down` and `key-up` are reserved command names and return `ACTION_NOT_SUPPORTED` until a stateful daemon can own the held-key lifetime.--### Mouse--```bash-agent-desktop --headed hover @s8f3k2p9:e3 # move cursor to element-agent-desktop --headed hover --xy 500,300 # move cursor to coordinates-agent-desktop --headed drag --from @s8f3k2p9:e3 --to @s8f3k2p9:e8 # drag between elements-agent-desktop --headed drag --from-xy 100,200 --to-xy 400,200 # drag between coordinates-agent-desktop --headed mouse-click --xy 500,300 # click at coordinates-```--`mouse-down` and `mouse-up` are likewise reserved; use the atomic `mouse-click` or `drag` commands.--### App & Window Management--```bash-agent-desktop launch Safari # launch app by name-agent-desktop launch com.apple.Safari # launch by bundle ID-agent-desktop launch "Obsidian" --cdp # fresh launch + verified CDP port for web contents-agent-desktop close-app Safari # quit app-agent-desktop close-app Safari --force # force quit (SIGTERM, then SIGKILL if needed)-agent-desktop list-apps # list running GUI apps-agent-desktop list-windows # list visible windows-agent-desktop list-windows --app Finder # windows for specific app-agent-desktop focus-window --window-id w-4521 # bring exact window to front-agent-desktop resize-window --window-id w-4521 --width 800 --height 600-agent-desktop move-window --window-id w-4521 --x 100 --y 100-agent-desktop minimize --window-id w-4521-agent-desktop maximize --window-id w-4521-agent-desktop restore --window-id w-4521-agent-desktop --headed open-system-surface --surface action-center # raise a shell surface (Windows), returns the window it presents-```--### Notifications *(macOS, Windows)*--```bash-agent-desktop --headed list-notifications # open Notification Center if needed, then list-agent-desktop --headed list-notifications --app "Slack" # filter by app-agent-desktop --headed list-notifications --text "deploy" --limit 5 # filter by text-agent-desktop --headed dismiss-notification 1 --expected-app "Slack" --expected-title "Deploy complete"-agent-desktop --headed dismiss-all-notifications # dismiss all-agent-desktop --headed dismiss-all-notifications --app "Slack" # dismiss all from app-agent-desktop --headed notification-action 1 "Reply" --expected-app "Slack" --expected-title "Deploy complete"-```--Single-notification mutations require an app or title fingerprint from the-same listing. Every mutation requires `--headed` because it opens and focuses-the system notification surface. Headless listing can only observe an-already-open center; headed listing may open it and restore the prior-frontmost app afterward. On Windows these commands drive the Action Center-over UI Automation under the same foreground floor.--### Clipboard--```bash-agent-desktop clipboard-get # read clipboard text-agent-desktop clipboard-set "copied" # write to clipboard-agent-desktop clipboard-clear # clear clipboard-```--### Wait--```bash-agent-desktop wait 500 # sleep 500ms-agent-desktop wait --element @s8f3k2p9:e3 --timeout 5000 # wait for element-agent-desktop wait --element @s8f3k2p9:e3 --predicate actionable # wait until safe to act-agent-desktop wait --element @s8f3k2p9:e5 --predicate value --value ready-agent-desktop wait --window "Save" --timeout 10000 # wait for window-agent-desktop wait --text "Loading complete" --app Safari # wait for text-agent-desktop wait --text "Done" --count 1 --app Xcode # wait for exact match count-agent-desktop wait --notification --text "Build Succeeded" # wait for new matching notification-agent-desktop wait --menu --timeout 3000 # wait for menu-```--### Batch--```bash-agent-desktop batch '[- {"command": "click", "args": {"ref_id": "@<snapshot_id>:e2"}},- {"command": "type", "args": {"ref_id": "@<snapshot_id>:e5", "text": "hello"}},- {"command": "press", "args": {"combo": "return"}}-]' --stop-on-error--agent-desktop --session run-a batch '[- {"command": "snapshot", "args": {"app": "Finder", "interactive_only": true}},- {"command": "status", "session": "run-b", "args": {}}-]'-```--### System--```bash-agent-desktop session start [--name LABEL] [--no-trace] [--cursor [--multi-agent]] # create session; pass returned ID explicitly-agent-desktop session end [id]-agent-desktop session list-agent-desktop session gc [--older-than SECS] [--ended]-agent-desktop --session <id> [--agent-id ID] cursor-overlay enable [--multi-agent] [--label TEXT] [--max-words N] [--fill HEX] [--rim HEX] [--accent HEX] [--size N] [--no-ripple] [--no-highlight] [--image PATH [--hotspot X,Y]] [--pointer-image PATH [--pointer-hotspot X,Y]]-export AGENT_DESKTOP_SESSION=<id>-agent-desktop cursor-overlay disable-agent-desktop status # platform, permissions, session_id, tracing, latest snapshot-agent-desktop permissions # check accessibility/screen-recording/automation-agent-desktop permissions --request # request in the bounded isolated helper-agent-desktop version # version string-agent-desktop skills get desktop # core skill: the observe, act, verify loop-agent-desktop skills get platform # skill for the OS this binary runs on-```--## Snapshot Options--```bash-agent-desktop snapshot [OPTIONS]+agent-desktop snapshot --skeleton --app Slack -i --compact+agent-desktop snapshot --root @s8f3k2p9:e3 -i --compact```-| Flag | Default | Description |-|------|---------|-------------|-| `--app <NAME>` | focused app | Filter to a specific application |-| `--window-id <ID>` | - | Filter to a specific window |-| `-i` / `--interactive-only` | off | Only include interactive elements |-| `--compact` | off | Omit empty structural nodes |-| `--include-bounds` | off | Include pixel bounds (x, y, width, height) |-| `--max-depth <N>` | 10 | Maximum tree depth |-| `--skeleton` | off | Shallow 3-level overview; truncated containers show `children_count` and get refs as drill targets |-| `--root <REF>` | - | Start traversal from this ref; merges into existing refmap with scoped invalidation |-| `--surface <TYPE>` | window | `window`, `focused`, `menu`, `menubar`, `sheet`, `popover`, `alert`; Windows also serves the shell kinds `taskbar`, `system-tray`, `system-tray-overflow`, `start-menu`, `action-center` |--## JSON Output--See the [versioned JSON envelope, error-code, and exit-code contract](docs/json-output.md).+A ref belongs to the snapshot that printed it. A bare `@e3` is rejected with `INVALID_ARGS`. If the UI changes, an action returns `STALE_REF` or `AMBIGUOUS_TARGET`; take a new snapshot and use its refs.-## Ref System+Ref actions run headless by default, through the accessibility API, without moving the pointer or taking focus. `--headed` allows physical input. In PowerShell, quote every ref (`'@s8f3k2p9:e1'`), because a bare `@token` is the splatting operator and the argument disappears.-`snapshot` assigns local positions in depth-first order and emits qualified refs such as `@s8f3k2p9:e1`, `@s8f3k2p9:e2`, and `@s8f3k2p9:e3`. A qualified ref embeds the exact snapshot ID. Bare refs such as `@e3` are rejected with `INVALID_ARGS`. Snapshot lookup stays inside the selected session namespace.+### Commands-Interactive roles that receive refs: `button`, `textfield`, `checkbox`, `link`, `menuitem`, `tab`, `slider`, `combobox`, `treeitem`, `cell`, `radiobutton`, `incrementor`, `menubutton`, `switch`, `colorwell`, `dockitem`.+| Group | Commands |+|---|---|+| Observe | `snapshot`, `find`, `get`, `is`, `screenshot`, `list-surfaces` |+| Act on a ref | `click`, `double-click`, `triple-click`, `right-click`, `type`, `set-value`, `clear`, `focus`, `select`, `toggle`, `check`, `uncheck`, `expand`, `collapse`, `scroll`, `scroll-to` |+| Keyboard and mouse | `press`, `hover`, `drag`, `mouse-move`, `mouse-click`, `mouse-wheel`, `key-down`, `key-up`, `mouse-down`, `mouse-up` |+| Apps and windows | `launch`, `close-app`, `list-apps`, `list-windows`, `list-displays`, `focus-window`, `resize-window`, `move-window`, `minimize`, `maximize`, `restore`, `open-system-surface` |+| Notifications | `list-notifications`, `dismiss-notification`, `dismiss-all-notifications`, `notification-action` |+| Clipboard | `clipboard-get`, `clipboard-set`, `clipboard-clear` |+| Wait | `wait` |+| Sessions | `session`, `trace`, `cursor-overlay` |+| System | `status`, `permissions`, `version`, `batch`, `skills` |-Static elements (labels, groups, containers) appear in the tree for context but have no ref.+`agent-desktop <command> --help` lists a command's flags. The JSON envelope, error codes and exit codes are in [docs/json-output.md](docs/json-output.md).-Reliability contract:+The skills are bundled in the binary and match its version. `agent-desktop skills get desktop` prints the core guide, and `agent-desktop skills get platform` prints the guide for the OS you run on. They cover sessions and traces, the agent cursor overlay, multi-agent sessions and Chromium apps through `launch --cdp`.-- `session start` creates and returns a manifest-gated session with automatic trace segments. It does not activate later processes. Activation resolves explicit `--session` first, then `AGENT_DESKTOP_SESSION`; otherwise the command uses the global, non-session namespace.-- Bare `--session <id>` without a manifest scopes snapshots only — no surprise trace files for existing callers.-- Snapshot lookup is confined to the selected namespace. A session-owned snapshot requires the same explicit `--session` or `AGENT_DESKTOP_SESSION` scope.-- Ref actions re-identify targets at action time: a moved unique target can proceed, while missing or changed stable identity returns `STALE_REF`.-- Mutable value text is not treated as stable identity, so text fields and timers can keep resolving when the saved window, path, role, and bounds evidence still identify the same element.-- Multiple plausible targets return `AMBIGUOUS_TARGET` instead of choosing arbitrarily.-- Actions run an actionability preflight before dispatch: visibility, stability, enabled state, supported action, policy, and editability.-- `wait --element @s8f3k2p9:e3 --predicate actionable` polls until the target can be acted on.-- With an active trace-enabled session, JSONL segments land under `sessions/<id>/trace/<pid>-*.jsonl` automatically. `--trace <path>` overrides to one file; `--trace-strict` fails on setup and pre-action writes (post-action traces are best-effort).--Stale ref recovery:--```-snapshot → act → STALE_REF or AMBIGUOUS_TARGET? → wait/snapshot again → retry with the new ref-```--## Platform Support+## Platform support| | macOS | Windows | Linux ||---|:---:|:---:|:---:|@@ -543,27 +117,20 @@ snapshot → act → STALE_REF or AMBIGUOUS_TARGET? → wait/snapshot again →| Notifications | **Yes** | **Yes** | Planned || Shell surfaces (`open-system-surface`) | Planned | **Yes** | Planned |-\* On Windows, `list-surfaces` inventories each process's `window` / `focused` / `sheet` / `menu` surfaces, and `snapshot --surface` additionally resolves the shell kinds (`taskbar`, `system-tray`, `system-tray-overflow`, `start-menu`, `action-center`) with no `--app`; `quick-settings` refuses on pre-Windows-11 builds with the surface that carries the capability named instead.-\*\* `launch` on Windows resolves an absolute path or a bare name found under System32 or the Windows directory — it cannot resolve display names such as "Google Chrome".+\* On Windows, `list-surfaces` lists each process's `window`, `focused`, `sheet` and `menu` surfaces. `snapshot --surface` also reads the shell surfaces `taskbar`, `system-tray`, `system-tray-overflow`, `start-menu` and `action-center` without `--app`. `quick-settings` returns `PLATFORM_NOT_SUPPORTED` on every Windows build and names `action-center`, which 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".## Development-Every platform adapter compiles on its own OS only, so unscoped workspace commands fail on every host. Scope cargo to the host package set (this is the macOS set):+Each platform adapter builds only on its own OS, so scope cargo to the host's packages. On macOS:```bashHOST_PKGS="-p agent-desktop-core -p agent-desktop-macos -p agent-desktop-linux -p agent-desktop -p agent-desktop-ffi"--cargo build $HOST_PKGS # debug build-cargo build --release -p agent-desktop # optimized (<15MB)-cargo test $HOST_PKGS --lib # library tests-cargo clippy $HOST_PKGS --all-targets -- -D warnings # lint (must pass with zero warnings)+cargo test $HOST_PKGS+cargo clippy $HOST_PKGS --all-targets -- -D warnings```-On Windows the set is `-p agent-desktop-core -p agent-desktop-windows -p agent-desktop -p agent-desktop-ffi`. See [CONTRIBUTING.md](CONTRIBUTING.md) for the full gates.--## FAQ--See the [complete FAQ](docs/faq.md) for architecture, platform support, installation, refs, licensing, and support links.+On Windows the set is `-p agent-desktop-core -p agent-desktop-windows -p agent-desktop -p agent-desktop-ffi`. [CONTRIBUTING.md](CONTRIBUTING.md) lists every gate, and [docs/faq.md](docs/faq.md) answers common questions.## Licensediff --git a/crates/core/src/actionability/live.rs b/crates/core/src/actionability/live.rsindex f80cf9280..10890d201 100644--- a/crates/core/src/actionability/live.rs+++ b/crates/core/src/actionability/live.rs@@ -162,7 +162,7 @@ fn validate_live_identity(entry: &RefEntry, live: &LiveElement) -> Result<(), Adfn stale_live_element(message: &'static str) -> AdapterError {AdapterError::new(ErrorCode::StaleRef, message).with_suggestion(- "Re-run a snapshot to obtain fresh refs, then retry with the new ref (CLI: snapshot; FFI: ad_snapshot then ad_execute_by_ref with the returned snapshot_id)",+ "Re-run a snapshot to obtain fresh refs, then retry with the new ref (CLI: snapshot; FFI: ad_snapshot then ad_execute_by_ref with the returned qualified @<snapshot_id>:eN ref)",).with_details(serde_json::json!({ "retryable": true })).with_disposition(DeliverySemantics::not_delivered())diff --git a/crates/core/src/adapter_error.rs b/crates/core/src/adapter_error.rsindex 1536a10f2..b8e67b76b 100644--- a/crates/core/src/adapter_error.rs+++ b/crates/core/src/adapter_error.rs@@ -77,7 +77,7 @@ impl AdapterError {).with_suggestion("Re-run a snapshot to obtain fresh refs, then retry with the new ref \- (CLI: snapshot [--skeleton]; FFI: ad_snapshot then ad_execute_by_ref with the returned snapshot_id)",+ (CLI: snapshot [--skeleton]; FFI: ad_snapshot then pass the printed qualified ref to ad_execute_by_ref)",).with_disposition(DeliverySemantics::not_delivered())}diff --git a/crates/core/src/commands/launch_cdp_switch_tests.rs b/crates/core/src/commands/launch_cdp_switch_tests.rsindex 67b510b32..ecdb5ffed 100644--- a/crates/core/src/commands/launch_cdp_switch_tests.rs+++ b/crates/core/src/commands/launch_cdp_switch_tests.rs@@ -95,8 +95,8 @@ fn cdp_launch_rejects_a_conflicting_remote_allow_origins_switch() {}/// The running-app precheck must also catch a match by bundle id, not only-/// by display name — a later agent narrows this precheck to workspace-/// -registered apps, so `presentation` is set here rather than left absent.+/// by display name. Only workspace-registered apps (those with a+/// `presentation`) count as running instances, so `presentation` is set here.#[test]fn cdp_launch_rejects_an_already_running_instance_matched_by_bundle_id() {let adapter = CdpAdapter {diff --git a/crates/core/src/commands/point_resolve_tests.rs b/crates/core/src/commands/point_resolve_tests.rsindex 117bd7f38..1a6b45e88 100644--- a/crates/core/src/commands/point_resolve_tests.rs+++ b/crates/core/src/commands/point_resolve_tests.rs@@ -228,7 +228,7 @@ fn raw_xy_input_never_calls_hit_test() {PointResolveArgs {ref_id: None,xy: Some((5.0, 6.0)),- missing_input_message: "Provide a ref (@e1) or --xy x,y",+ missing_input_message: "Provide a ref (@<snapshot_id>:e1) or --xy x,y",headed_requirement: crate::HeadedRequirement::None,},&adapter,diff --git a/crates/core/src/commands/wait_event.rs b/crates/core/src/commands/wait_event.rsindex 947731447..4697c947d 100644--- a/crates/core/src/commands/wait_event.rs+++ b/crates/core/src/commands/wait_event.rs@@ -9,9 +9,8 @@ use std::time::{Duration, Instant};/// Baseline-diff event wait: captures a `SignalBaseline` at wait start, polls/// for a fresh one, and matches the first `diff_signals` event whose kind/// matches the requested `--event` token. `window_id`/`window_title` are-/// optional narrowing filters, never requirements — the whole point of R16-/// is that a caller who does not yet know a new window's id or title can-/// still wait for it to appear.+/// optional narrowing filters, never requirements, so a caller who does not+/// yet know a new window's id or title can still wait for it to appear.pub(crate) fn wait_for_event(input: EventWaitInput,adapter: &dyn PlatformAdapter,diff --git a/crates/core/src/cursor_overlay/config.rs b/crates/core/src/cursor_overlay/config.rsindex 1019fb57b..e53068662 100644--- a/crates/core/src/cursor_overlay/config.rs+++ b/crates/core/src/cursor_overlay/config.rs@@ -75,7 +75,7 @@ impl CursorOverlayConfig {if !self.enabled && self.label.is_some() {return Err(AdapterError::new(ErrorCode::InvalidArgs,- "Agent cursor label requires agent cursor mode 'on'",+ "Agent cursor label requires the agent cursor overlay to be enabled",));}if self.label.as_deref().is_some_and(|label| {diff --git a/crates/core/src/cursor_overlay/phase.rs b/crates/core/src/cursor_overlay/phase.rsindex 1cf713ed3..e7903be79 100644--- a/crates/core/src/cursor_overlay/phase.rs+++ b/crates/core/src/cursor_overlay/phase.rs@@ -4,7 +4,8 @@ use serde::{Deserialize, Serialize};////// `Travel` is sent before an action and acknowledged once the cursor lands./// `Drag` arms pointer tracking and is acknowledged once the renderer is ready.-/// `Effect` is sent after dispatch and is fire-and-forget.+/// `Effect` is sent after dispatch; the renderer acknowledges it, and the+/// action result does not depend on that acknowledgement.#[derive(Debug, Clone, Copy, Default, Deserialize, Eq, PartialEq, Serialize)]#[serde(rename_all = "snake_case")]pub enum CursorPhase {diff --git a/crates/core/src/cursor_overlay/timing.rs b/crates/core/src/cursor_overlay/timing.rsindex 6c0590be5..35021f39f 100644--- a/crates/core/src/cursor_overlay/timing.rs+++ b/crates/core/src/cursor_overlay/timing.rs@@ -23,7 +23,7 @@ pub const CURSOR_REST_FADE_MS: u64 = 156;/// How long the label card takes to appear once its text changes.///-/// macOS reveals it with an ease-out opacity ramp over 0.18s, so a card that+/// macOS reveals it with a 0.18s opacity fade and an ease-out scale pop, so a card that/// arrives does not simply blink into place. The same caveat applies: the/// bridge holds its own copy for now.pub const CURSOR_LABEL_REVEAL_MS: u64 = 180;diff --git a/crates/core/src/private_file.rs b/crates/core/src/private_file.rsindex 0222e9c9e..b0583a3f4 100644--- a/crates/core/src/private_file.rs+++ b/crates/core/src/private_file.rs@@ -77,8 +77,9 @@ pub(crate) fn write_atomic_portable(path: &Path, bytes: &[u8]) -> std::io::Resul/// Writes user-requested output, deliberately bypassing the `PrivateFileOps`/// seam that `write_atomic` routes through.///-/// Its two callers — `commands::screenshot` and `commands::clipboard_get`, via-/// `crate::refs::write_user_file` — write to a destination the user named, so+/// Its callers — `commands::screenshot`, `commands::clipboard_get` and the+/// trace HTML export in `trace_read::html`, via `crate::refs::write_user_file` —+/// write to a destination the user named, so/// it must tolerate network shares, reparse-traversing paths such as OneDrive/// or mapped folders, and directories owned by another principal. A platform/// implementation of the seam refuses all three, which is right for privatediff --git a/crates/core/src/process_state.rs b/crates/core/src/process_state.rsindex 6fff3531a..d6e566275 100644--- a/crates/core/src/process_state.rs+++ b/crates/core/src/process_state.rs@@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};////// macOS can only emit `Running`, `Exited { code: None }`, and/// `Unresponsive` — it has no way to read the exit code of a detached-/// process (apps launched via `open -g -a` are not children of this+/// process (apps launched through NSWorkspace are not children of this/// process). `Crashed` stays in the contract for adapters with real crash/// evidence (e.g. Windows `GetExitCodeProcess`).#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]diff --git a/crates/core/src/ref_action_wait_success_tests.rs b/crates/core/src/ref_action_wait_success_tests.rsindex 3453aedfe..919abe832 100644--- a/crates/core/src/ref_action_wait_success_tests.rs+++ b/crates/core/src/ref_action_wait_success_tests.rs@@ -7,10 +7,7 @@ use crate::{};use std::sync::atomic::{AtomicU32, Ordering};-/// Covers the branch where a successful action must never be rewritten into a-/// failure by process-state enrichment, split out of-/// `ref_action_wait_process_state_tests.rs` to keep both files under the-/// repo's 400 LOC hard limit.+/// Fixture ref entry for a button with known bounds.fn entry() -> RefEntry {let bounds = crate::Rect {x: 1.0,diff --git a/crates/core/src/signals.rs b/crates/core/src/signals.rsindex 7f3c4e9ac..9dd46e375 100644--- a/crates/core/src/signals.rs+++ b/crates/core/src/signals.rs@@ -190,14 +190,9 @@ fn diff_surfaces(baseline: &SignalBaseline, current: &SignalBaseline, events: &m}/// Grows `seen` with any entry from `current` not already present, keyed by-/// the same identity `diff_signals` uses. Nothing already in `seen` is ever-/// removed: this is the running union a disappearance-class wait diffs-/// against, so an entity that both appeared and disappeared within one wait-/// is still detected even though it never appears in the wait's original-/// fixed baseline.-/// Grows `seen` with any entry from `current` not already present, keyed by-/// `identity`. The shared body behind [`merge_signal_baseline`]'s three-/// fields, which differ only in their entity type and identity function.+/// `identity`. Nothing already in `seen` is ever removed. The shared body+/// behind [`merge_signal_baseline`]'s three fields, which differ only in their+/// entity type and identity function.fn grow_with_new<'a, T: Clone, K: Eq + Hash>(seen: &'a [T],current: &'a [T],diff --git a/crates/ffi/cbindgen.toml b/crates/ffi/cbindgen.tomlindex d7dfe30b8..68314a1d3 100644--- a/crates/ffi/cbindgen.toml+++ b/crates/ffi/cbindgen.toml@@ -23,8 +23,9 @@ after_includes = """* 3. Observe via ad_snapshot(). The returned JSON envelope contains the* accessibility tree with snapshot-qualified ref IDs (for example,* "@s8f3k2p9:e5") that address- * individual interactive elements. A refmap is written under- * ~/.agent-desktop/ and is keyed to the session. The envelope carries+ * individual interactive elements. A refmap is written under the state+ * root (default ~/.agent-desktop, or AGENT_DESKTOP_HOME) and is keyed to+ * the snapshot ID. The envelope carries* data.snapshot_id. Qualified refs already pin the exact snapshot.** 4. Act via ad_execute_by_ref(a, "@s8f3k2p9:e5", &action, policy, &out).diff --git a/crates/ffi/include/agent_desktop.h b/crates/ffi/include/agent_desktop.hindex a9726718c..8ab0356c8 100644--- a/crates/ffi/include/agent_desktop.h+++ b/crates/ffi/include/agent_desktop.h@@ -18,8 +18,9 @@* 3. Observe via ad_snapshot(). The returned JSON envelope contains the* accessibility tree with snapshot-qualified ref IDs (for example,* "@s8f3k2p9:e5") that address- * individual interactive elements. A refmap is written under- * ~/.agent-desktop/ and is keyed to the session. The envelope carries+ * individual interactive elements. A refmap is written under the state+ * root (default ~/.agent-desktop, or AGENT_DESKTOP_HOME) and is keyed to+ * the snapshot ID. The envelope carries* data.snapshot_id. Qualified refs already pin the exact snapshot.** 4. Act via ad_execute_by_ref(a, "@s8f3k2p9:e5", &action, policy, &out).@@ -1203,9 +1204,9 @@ AdResult ad_check_permissions(const struct AdAdapter *adapter);* Closes the application identified by `id` (bundle id on macOS,* executable path on other platforms). `force = true` skips the* graceful-shutdown path, terminates matching app processes, and escalates- * survivors when the platform supports it. Session-critical- * processes (loginwindow, WindowServer, Dock, Finder, launchd) are- * refused with `AD_RESULT_ERR_INVALID_ARGS` — the protected-process+ * survivors when the platform supports it. Session-critical processes+ * (for example loginwindow and Dock on macOS, csrss.exe and winlogon.exe+ * on Windows) are refused with `AD_RESULT_ERR_INVALID_ARGS` — the protected-process* guard is enforced inside the adapter, so FFI and CLI behave* identically.*@@ -1348,8 +1349,8 @@ AdResult ad_execute_by_ref_timeout(const struct AdAdapter *adapter,/*** Takes a full CLI-format snapshot of the target application window,- * allocates `@e` refs for all interactive elements, persists the refmap- * to disk, and writes the JSON envelope into `*out`.+ * allocates snapshot-qualified refs (`@<snapshot_id>:eN`) for all+ * interactive elements, persists the refmap to disk, and writes the JSON envelope into `*out`.** The JSON shape matches `agent-desktop snapshot`:* `{"version":"2.4","ok":true,"command":"snapshot","data":{"app":"...","window":{...},"ref_count":N,"snapshot_id":"...","complete":true,"tree":{...}}}`.diff --git a/crates/ffi/src/actions/execute.rs b/crates/ffi/src/actions/execute.rsindex 4503f8fe0..55803ed6b 100644--- a/crates/ffi/src/actions/execute.rs+++ b/crates/ffi/src/actions/execute.rs@@ -216,7 +216,7 @@ fn action_request(policy: AdPolicyKind, action: Action) -> ActionRequest {AdPolicyKind::FocusFallback => ActionRequest::focus_fallback(action),AdPolicyKind::Headed => ActionRequest::headed(action),}- .with_timeout_ms(Some(5000))+ .with_timeout_ms(Some(crate::operation::DEFAULT_FFI_TIMEOUT_MS))}#[cfg(test)]diff --git a/crates/ffi/src/apps/close.rs b/crates/ffi/src/apps/close.rsindex f6ecd7238..32c7f56f1 100644--- a/crates/ffi/src/apps/close.rs+++ b/crates/ffi/src/apps/close.rs@@ -6,9 +6,9 @@ use std::os::raw::c_char;/// Closes the application identified by `id` (bundle id on macOS,/// executable path on other platforms). `force = true` skips the/// graceful-shutdown path, terminates matching app processes, and escalates-/// survivors when the platform supports it. Session-critical-/// processes (loginwindow, WindowServer, Dock, Finder, launchd) are-/// refused with `AD_RESULT_ERR_INVALID_ARGS` — the protected-process+/// survivors when the platform supports it. Session-critical processes+/// (for example loginwindow and Dock on macOS, csrss.exe and winlogon.exe+/// on Windows) are refused with `AD_RESULT_ERR_INVALID_ARGS` — the protected-process/// guard is enforced inside the adapter, so FFI and CLI behave/// identically.///diff --git a/crates/ffi/src/apps/launch.rs b/crates/ffi/src/apps/launch.rsindex 12fb4c8a1..b8abf4a9d 100644--- a/crates/ffi/src/apps/launch.rs+++ b/crates/ffi/src/apps/launch.rs@@ -14,7 +14,7 @@ fn launched_window(launched: LaunchResult) -> Result<WindowInfo, AdapterError> {ErrorCode::WindowNotFound,"Application is running, but it has presented no window",)- .with_suggestion("Launch with activation, or wait for the window before reading it.")+ .with_suggestion("Wait for the window before reading it.")})}diff --git a/crates/ffi/src/commands/snapshot.rs b/crates/ffi/src/commands/snapshot.rsindex 63d49a613..c5af0f06f 100644--- a/crates/ffi/src/commands/snapshot.rs+++ b/crates/ffi/src/commands/snapshot.rs@@ -11,8 +11,8 @@ use std::ffi::c_char;use std::ptr;/// Takes a full CLI-format snapshot of the target application window,-/// allocates `@e` refs for all interactive elements, persists the refmap-/// to disk, and writes the JSON envelope into `*out`.+/// allocates snapshot-qualified refs (`@<snapshot_id>:eN`) for all+/// interactive elements, persists the refmap to disk, and writes the JSON envelope into `*out`.////// The JSON shape matches `agent-desktop snapshot`:/// `{"version":"2.4","ok":true,"command":"snapshot","data":{"app":"...","window":{...},"ref_count":N,"snapshot_id":"...","complete":true,"tree":{...}}}`.diff --git a/crates/ffi/src/commands/timeout.rs b/crates/ffi/src/commands/timeout.rsindex 1903d25d4..d9084d6f1 100644--- a/crates/ffi/src/commands/timeout.rs+++ b/crates/ffi/src/commands/timeout.rs@@ -2,7 +2,7 @@ use agent_desktop_core::{AdapterError, ErrorCode};pub(crate) fn decode_ref_action_timeout(timeout_ms: i64) -> Result<u64, AdapterError> {match timeout_ms {- -1 => Ok(5_000),+ -1 => Ok(crate::operation::DEFAULT_FFI_TIMEOUT_MS),0.. => Ok(timeout_ms as u64),_ => Err(AdapterError::new(ErrorCode::InvalidArgs,diff --git a/crates/ffi/tests/c_abi_log_callback.rs b/crates/ffi/tests/c_abi_log_callback.rsindex 390ed8da5..33ad7b0bc 100644--- a/crates/ffi/tests/c_abi_log_callback.rs+++ b/crates/ffi/tests/c_abi_log_callback.rs@@ -60,7 +60,7 @@ fn log_callback_register_delivers_event() {let deliveries = drain_recorder();assert!(!deliveries.is_empty(),- "at least one delivery expected after tracing::error!"+ "at least one delivery expected after the snapshot tree debug event");let d = deliveries.iter()diff --git a/crates/ffi/tests/c_abi_passthrough.rs b/crates/ffi/tests/c_abi_passthrough.rsindex 034deaf30..63f74a4d7 100644--- a/crates/ffi/tests/c_abi_passthrough.rs+++ b/crates/ffi/tests/c_abi_passthrough.rs@@ -23,12 +23,11 @@////// # Exception — `ad_check_permissions`///-/// The stub's `permission_report()` returns `PermissionState::Denied` (the-/// trait default), not `Unknown`. The FFI maps `Denied` to `ErrPermDenied-/// (-1)`, not `ErrPlatformNotSupported (-8)`. This is the documented signal-/// that permissions are unavailable on the platform; callers should treat-/// both `ErrPermDenied` and `ErrPlatformNotSupported` as "adapter not-/// operational here".+/// The stub's `permission_report()` returns `PermissionState::Unknown` (the+/// trait default), not `Denied`. The FFI maps `Unknown` to+/// `ErrPlatformNotSupported (-8)`, not `ErrPermDenied (-1)`, because an+/// adapter that never probed permissions has not been denied anything;+/// `ErrPermDenied` is reserved for an explicit `Denied` state.////// Commands gated by `#[cfg(feature = "stub-adapter")]` so they compile only/// when the feature is active. The normal test build (`cargo test -pdiff --git a/crates/ffi/tests/c_abi_roundtrip.rs b/crates/ffi/tests/c_abi_roundtrip.rsindex d9e933399..dd8c02a7a 100644--- a/crates/ffi/tests/c_abi_roundtrip.rs+++ b/crates/ffi/tests/c_abi_roundtrip.rs@@ -133,7 +133,7 @@ fn stale_ref_returns_ok_false_error_envelope() {/// available on generic headless CI.////// **Deferred CI proof**: the full-loop proof — real `ad_snapshot` producing-/// `@e` refs consumed by `ad_execute_by_ref` against a live app at the C+/// `@<snapshot_id>:e<N>` refs consumed by `ad_execute_by_ref` against a live app at the C/// boundary — is deferred to an external-consumer smoke harness (Python/// ctypes) that runs in the macOS E2E environment.///@@ -169,7 +169,7 @@ fn snapshot_execute_by_ref_live_roundtrip() {);let ref_id = find_first_ref_in_tree(&snap_val)- .expect("snapshot must contain at least one @e ref in the tree");+ .expect("snapshot must contain at least one @<snapshot_id>:e<N> ref in the tree");ad_free_string(snap_out);@@ -210,7 +210,7 @@ fn find_first_ref_in_tree(snap: &serde_json::Value) -> Option<String> {let mut searched = 0usize;common::find_ref_in_tree(snap, &mut searched, &|value| {let s = value.get("ref")?.as_str()?;- (s.starts_with("@e") || (s.starts_with("@s") && s.contains(":e"))).then(|| s.to_owned())+ (s.starts_with("@s") && s.contains(":e")).then(|| s.to_owned())})}diff --git a/crates/macos/examples/ax_probe.rs b/crates/macos/examples/ax_probe.rsindex d87d518fb..2c76a8c6b 100644--- a/crates/macos/examples/ax_probe.rs+++ b/crates/macos/examples/ax_probe.rs@@ -1,6 +1,6 @@//! Direct probe of macOS AX APIs with raw API output and click validation.//!-//! cargo run -p agent-desktop-macos --example ax_probe -- <AppName>+//! cargo run -p agent-desktop-macos --features dev-tools --example ax_probe -- <AppName>#[cfg(target_os = "macos")]fn main() {@@ -73,7 +73,7 @@ fn probe_app(pid: i32) {let ax_err = ax_press(*child);println!(- " kAXPressAction → err={} (0=ok, -25200=fail, -25205=not_supported)",+ " kAXPressAction → err={} (0=ok, -25200=fail, -25206=action_unsupported)",ax_err);diff --git a/crates/macos/src/actions/ax_helpers.rs b/crates/macos/src/actions/ax_helpers.rsindex 037bd7f0d..714d50a61 100644--- a/crates/macos/src/actions/ax_helpers.rs+++ b/crates/macos/src/actions/ax_helpers.rs@@ -265,7 +265,7 @@ mod imp {value.chars().count()),)- .with_suggestion("Pass a numeric value, e.g. set-value @e1 50"))+ .with_suggestion("Pass a numeric value, e.g. set-value @s8f3k2p9:e1 50"))}pub(crate) fn element_role(diff --git a/crates/macos/src/actions/chain_verify.rs b/crates/macos/src/actions/chain_verify.rsindex 46ed458c8..6c6a68c0e 100644--- a/crates/macos/src/actions/chain_verify.rs+++ b/crates/macos/src/actions/chain_verify.rs@@ -4,7 +4,7 @@ pub(crate) fn increment_deadline_error(start: f64, current: f64, target: f64) ->partial_mutation_disposition(AdapterError::timeout("Chain deadline expired while stepping the value toward the target").with_suggestion(- "Re-read the element value before retrying; increase the timeout or AGENT_DESKTOP_CHAIN_TIMEOUT_MS for slow controls.",+ "Re-read the element value before retrying; increase --timeout-ms for slow controls.",).with_details(serde_json::json!({"kind": "chain_deadline",diff --git a/crates/macos/src/actions/dispatch.rs b/crates/macos/src/actions/dispatch.rsindex 69c47ec96..3f86d18ea 100644--- a/crates/macos/src/actions/dispatch.rs+++ b/crates/macos/src/actions/dispatch.rs@@ -194,7 +194,7 @@ mod imp {label),)- .with_suggestion("Use the top-level command (e.g. 'hover', 'drag', 'key-down') instead of targeting an element."));+ .with_suggestion("Use the top-level command (e.g. 'hover', 'drag', 'press') instead of targeting an element."));}}diff --git a/crates/macos/src/system/process_state.rs b/crates/macos/src/system/process_state.rsindex 15f88f37c..87096e82c 100644--- a/crates/macos/src/system/process_state.rs+++ b/crates/macos/src/system/process_state.rs@@ -61,8 +61,7 @@ fn prepare_probe(}/// `kill(pid, 0)`-style liveness check: signal 0 sends no actual signal, the-/// kernel only validates the target exists and is reachable. Mirrors the-/// convention already used by `system::force_close::signal_result`.+/// kernel only validates the target exists and is reachable.#[cfg(all(test, target_os = "macos"))]fn pid_is_alive(pid: i32) -> bool {const POSIX_ESRCH: i32 = 3;diff --git a/crates/macos/src/tree/resolve.rs b/crates/macos/src/tree/resolve.rsindex f627d4e9e..6aca4474f 100644--- a/crates/macos/src/tree/resolve.rs+++ b/crates/macos/src/tree/resolve.rs@@ -252,7 +252,7 @@ fn sleep_before_retry(deadline: Instant) {}/// Core owns the payload (`agent_desktop_core::resolve_errors::mark_deadline_elapsed`)-/// because it is line-for-line identical to Windows's copy.+/// so both adapters share one definition.#[cfg(target_os = "macos")]use agent_desktop_core::resolve_errors::mark_deadline_elapsed;diff --git a/crates/macos/src/tree/resolve_errors.rs b/crates/macos/src/tree/resolve_errors.rsindex 44f2d9fff..751906092 100644--- a/crates/macos/src/tree/resolve_errors.rs+++ b/crates/macos/src/tree/resolve_errors.rs@@ -16,7 +16,7 @@ pub(super) fn native_identifier_role_reuse(entry: &RefEntry) -> AdapterError {}/// Core owns the payload (`agent_desktop_core::resolve_errors::identity_unknown_error`)-/// because it is byte-identical to Windows's copy: an unreadable candidate+/// so both adapters share one definition: an unreadable candidate/// means the same thing whichever adapter's search produced it.pub(super) use agent_desktop_core::resolve_errors::identity_unknown_error as identity_unknown;diff --git a/crates/windows/examples/uia_tree_dump/render.rs b/crates/windows/examples/uia_tree_dump/render.rsindex 158735098..be17b4ed6 100644--- a/crates/windows/examples/uia_tree_dump/render.rs+++ b/crates/windows/examples/uia_tree_dump/render.rs@@ -194,8 +194,8 @@ pub fn dump(serde_json::to_string_pretty(&document).map_err(|error| error.to_string())}-/// The RawView-versus-ControlView delta is left unreconciled: the code opens-/// the raw view walker while the document mandates the control view.+/// The RawView-versus-ControlView delta is reported rather than reconciled:+/// the raw-view and control-view counts are emitted side by side.////// A15-10 measured them identical on a Win32 fixture and five nodes apart on/// WPF, so the delta is provider-dependent. Reporting it per real target isdiff --git a/crates/windows/examples/uia_tree_dump/render_node.rs b/crates/windows/examples/uia_tree_dump/render_node.rsindex cc95bfe8f..b2cf310bf 100644--- a/crates/windows/examples/uia_tree_dump/render_node.rs+++ b/crates/windows/examples/uia_tree_dump/render_node.rs@@ -39,9 +39,12 @@ pub(crate) struct NodeFields {/// Renders one node's JSON from already-resolved evidence.////// COM-free by construction, which is what makes the marker test possible:-/// every value-bearing property must go through a withholding renderer here,-/// and `render_node_tests.rs` fails if any one of them is switched back to a-/// verbatim `slot()`.+/// every free-text property (name, description, automation id, help text, full+/// description, legacy default action, subrole, role description, placeholder)+/// goes through a withholding renderer here, and `render_node_tests.rs` fails+/// if any one of them is switched back to a verbatim `slot()`. `class_name` and+/// `provider_description` are emitted verbatim because they identify the+/// control class and UIA provider rather than carry user content.pub(crate) fn render_node(fields: &NodeFields) -> Value {json!({"parent_index": fields.position.parent,diff --git a/crates/windows/examples/uia_tree_dump/render_slots.rs b/crates/windows/examples/uia_tree_dump/render_slots.rsindex 9baef21d4..f2f0951cb 100644--- a/crates/windows/examples/uia_tree_dump/render_slots.rs+++ b/crates/windows/examples/uia_tree_dump/render_slots.rs@@ -99,11 +99,12 @@ pub fn slot(outcome: &PropertyOutcome) -> Value {/// Records a text slot as presence and length only, never its content.///-/// **Every value-bearing property gets this treatment, not only `Name`.** The-/// rule previously named `Name` alone, and `slot()` renders any other-/// `Known(Text(..))` verbatim - so `HelpText`, `FullDescription` and any-/// `LegacyIAccessible` string would have landed in a committed capture as-/// literal text read out of somebody's real application.+/// **Every free-text property is rendered through this, not only `Name`.**+/// `slot()` renders any `Known(Text(..))` verbatim, so `HelpText`,+/// `FullDescription` and any `LegacyIAccessible` string would land in a+/// committed capture as literal text read out of somebody's real application.+/// Only `ClassName` and the provider description are deliberately rendered+/// verbatim through `slot()`.pub fn text_presence(outcome: &PropertyOutcome) -> Value {match text_of(outcome) {Some(value) => json!({ "present": true, "chars": value.chars().count() }),diff --git a/crates/windows/src/actions/chain.rs b/crates/windows/src/actions/chain.rsindex 4eab39591..35c8472a8 100644--- a/crates/windows/src/actions/chain.rs+++ b/crates/windows/src/actions/chain.rs@@ -9,9 +9,10 @@//! `delivered_unverified` before it leaves this function — the code,//! message, suggestion and platform detail are left untouched. Only a clean//! not-delivered outcome advances to the next rung. Policy-disallowed rungs-//! are skipped with no step recorded (the hook later physical rungs will-//! use). Mechanism is always `semantic_api` for every rung this adapter-//! ships.+//! are skipped with no step recorded. Physical legs are built outside this+//! engine in `physical_click` and `physical_keyboard`, which record+//! `PhysicalSynthetic` steps. Every rung this engine runs uses the+//! `semantic_api` mechanism.use agent_desktop_core::{ActionStep, ActionStepOutcome, AdapterError, Deadline, DeliverySemantics, ErrorCode,diff --git a/crates/windows/src/actions/dispatch.rs b/crates/windows/src/actions/dispatch.rsindex 7655db4b9..af5337854 100644--- a/crates/windows/src/actions/dispatch.rs+++ b/crates/windows/src/actions/dispatch.rs@@ -175,7 +175,7 @@ mod imp {format!("{label} requires adapter-level handling, not element action"),).with_suggestion(- "Use the top-level command (e.g. 'hover', 'drag', 'key-down') instead of targeting an element.",+ "Use the top-level command (e.g. 'hover', 'drag', 'press') instead of targeting an element.",))}diff --git a/crates/windows/src/actions/scroll.rs b/crates/windows/src/actions/scroll.rsindex a70918855..9c3f7891d 100644--- a/crates/windows/src/actions/scroll.rs+++ b/crates/windows/src/actions/scroll.rs@@ -199,7 +199,7 @@ mod imp {if amount == 0 || amount > MAX_SCROLL_AMOUNT {return Err(AdapterError::new(ErrorCode::InvalidArgs,- "Scroll amount must be between 1 and 1000",+ format!("Scroll amount must be between 1 and {MAX_SCROLL_AMOUNT}"),));}Ok(())diff --git a/crates/windows/src/actions/scroll_ladder.rs b/crates/windows/src/actions/scroll_ladder.rsindex a976f6b2e..91897bca6 100644--- a/crates/windows/src/actions/scroll_ladder.rs+++ b/crates/windows/src/actions/scroll_ladder.rs@@ -26,7 +26,7 @@ pub(crate) const LADDER_SCROLL_LABEL: &str = SCROLL_LABEL;/// real distance to cover exhausted every rung and still reported/// `ACTION_FAILED` on a target that was never occluded, only never reached./// `LargeIncrement`/`LargeDecrement` map to a page-sized native scroll step,-/// so the same 10-rung budget covers a page's multiple.+/// so the same MAX_ANCESTOR_SCROLLS budget covers a page's multiple.#[cfg(target_os = "windows")]pub(crate) fn ladder_scroll_amounts(direction: &Direction,diff --git a/crates/windows/src/input/blocked_combo.rs b/crates/windows/src/input/blocked_combo.rsindex 739b33b13..b4429c369 100644--- a/crates/windows/src/input/blocked_combo.rs+++ b/crates/windows/src/input/blocked_combo.rs@@ -1,9 +1,9 @@//! Windows-dangerous key combos.//!//! `is_blocked_combo`'s core default blocks nothing-//! (`crates/core/src/adapter/system.rs`); until this module is wired in,-//! Windows advertises a dangerous-shortcut guard in the skill docs that it-//! never enforced. The list is reasoned from Windows semantics, not+//! (`crates/core/src/adapter/system.rs`); the Windows adapter's+//! `is_blocked_combo` override calls this module to supply the list. The list+//! is reasoned from Windows semantics, not//! translated from macOS's `cmd+q`-shaped set, which has no Windows meaning.//! One question decides membership: does the shortcut take the foreground//! away from the run, or change the session out from under it? `alt+f4`diff --git a/crates/windows/src/input/clipboard_image.rs b/crates/windows/src/input/clipboard_image.rsindex 66b798486..5cf683007 100644--- a/crates/windows/src/input/clipboard_image.rs+++ b/crates/windows/src/input/clipboard_image.rs@@ -275,9 +275,15 @@ fn validate_png_payload(png: &[u8], argument: bool) -> Result<(u32, u32), Adapte}if png.len() > MAX_PNG_INPUT_BYTES {return Err(if argument {- argument_error("Image exceeds the 64 MiB encoded-data budget")+ argument_error(&format!(+ "Image exceeds the {} MiB encoded-data budget",+ MAX_PNG_INPUT_BYTES / (1024 * 1024)+ ))} else {- payload_error("Clipboard image exceeds the 64 MiB encoded-data budget")+ payload_error(&format!(+ "Clipboard image exceeds the {} MiB encoded-data budget",+ MAX_PNG_INPUT_BYTES / (1024 * 1024)+ ))});}let dimensions = parse_png_dimensions(png).ok_or_else(|| {diff --git a/crates/windows/src/input/clipboard_worker_state.rs b/crates/windows/src/input/clipboard_worker_state.rsindex 9cd0e71ac..64af8e07d 100644--- a/crates/windows/src/input/clipboard_worker_state.rs+++ b/crates/windows/src/input/clipboard_worker_state.rs@@ -9,8 +9,7 @@//! stop it: it is to refuse the next clipboard operation instead of letting it//! contend with a worker nothing can reclaim, and to say so.//!-//! The reach of that refusal is exactly one process, and the shipped docs say-//! so. An abandoned worker dies with the process that spawned it and Windows+//! The reach of that refusal is exactly one process. An abandoned worker dies with the process that spawned it and Windows//! releases the clipboard on exit, so a retry from a fresh invocation neither//! needs this guard nor is affected by it. What it governs is a second//! clipboard operation inside one invocation — a batch entry, or a commanddiff --git a/crates/windows/src/input/drag.rs b/crates/windows/src/input/drag.rsindex 1cfe2aa05..6cffb33e8 100644--- a/crates/windows/src/input/drag.rs+++ b/crates/windows/src/input/drag.rs@@ -140,7 +140,7 @@ fn validate_drag(params: &DragParams) -> Result<(), AdapterError> {if params.duration_ms.is_some_and(|value| value > MAX_DRAG_MS) {return Err(AdapterError::new(ErrorCode::InvalidArgs,- "Drag duration must not exceed 60000ms",+ format!("Drag duration must not exceed {MAX_DRAG_MS}ms"),));}if params@@ -149,7 +149,7 @@ fn validate_drag(params: &DragParams) -> Result<(), AdapterError> {{return Err(AdapterError::new(ErrorCode::InvalidArgs,- "Drag drop delay must not exceed 30000ms",+ format!("Drag drop delay must not exceed {MAX_DROP_DELAY_MS}ms"),));}Ok(())diff --git a/crates/windows/src/system/adapter.rs b/crates/windows/src/system/adapter.rsindex 064898cee..f7969c293 100644--- a/crates/windows/src/system/adapter.rs+++ b/crates/windows/src/system/adapter.rs@@ -141,7 +141,7 @@ impl SystemOps for WindowsAdapter {/// The focused window is the focused-only filter's first result, composed/// from `list_windows` rather than a second native path (mirroring- /// `crates/macos/src/system/adapter.rs:142-149`). Whatever HWND-shape a+ /// `focused_window` in `crates/macos/src/system/adapter.rs`). Whatever HWND-shape a/// host presents, it maps to the same identity `list_windows` reports.fn focused_window(&self, deadline: Deadline) -> Result<Option<WindowInfo>, AdapterError> {let filter = WindowFilter {diff --git a/crates/windows/src/system/cursor_overlay/geometry.rs b/crates/windows/src/system/cursor_overlay/geometry.rsindex 223e65cf3..0f8784a28 100644--- a/crates/windows/src/system/cursor_overlay/geometry.rs+++ b/crates/windows/src/system/cursor_overlay/geometry.rs@@ -1,6 +1,6 @@//! The overlay's shape, in the numbers the macOS renderer already uses.//!-//! Pure. R16 claims Windows draws the same visual vocabulary as macOS, and a+//! Pure. The overlay claims Windows draws the same visual vocabulary as macOS, and a//! claim like that needs numbers to fail against — core shares the motion,//! the style and the label placement, but none of these dimensions. They are//! carried across rather than invented, and scaled by the session's stylediff --git a/crates/windows/src/system/cursor_overlay/geometry_tests.rs b/crates/windows/src/system/cursor_overlay/geometry_tests.rsindex 7c7d779f4..d29846858 100644--- a/crates/windows/src/system/cursor_overlay/geometry_tests.rs+++ b/crates/windows/src/system/cursor_overlay/geometry_tests.rs@@ -127,7 +127,7 @@ fn the_follower_surface_stays_far_smaller_than_a_screen() {/// Kept here rather than imported so the two spaces stay visibly distinct.const MACOS_DART: [(f64, f64); 4] = [(1.0, 35.0), (29.6, 17.5), (12.7, 16.3), (4.2, 1.6)];-/// R16 claims Windows draws the same visual vocabulary as macOS, so the dart+/// The overlay claims Windows draws the same visual vocabulary as macOS, so the dart/// is that path and not a redrawing of it — but expressed in this surface's/// space. Copying the coordinates across unchanged is the mistake this pins:/// it satisfies "same numbers" while drawing the pointer upside down.diff --git a/crates/windows/src/system/cursor_overlay/peer.rs b/crates/windows/src/system/cursor_overlay/peer.rsindex cf2a8d564..5a731acec 100644--- a/crates/windows/src/system/cursor_overlay/peer.rs+++ b/crates/windows/src/system/cursor_overlay/peer.rs@@ -1,8 +1,8 @@//! Who is on the other end of the control pipe.//!//! The pipe carries no security descriptor. This crate deliberately does not-//! author one — the module that would know how records descriptor authoring-//! and DACL validation as absent, after an earlier attempt sank on `AceSize`+//! author one — `private_file` records descriptor authoring+//! and DACL validation as deliberately absent, after an earlier attempt sank on `AceSize`//! handling, and a test pins the ACL/ACE symbol family out of it. So the peer//! is authenticated instead, with the token APIs the crate already calls.//!diff --git a/crates/windows/src/system/cursor_overlay/pipe_name.rs b/crates/windows/src/system/cursor_overlay/pipe_name.rsindex 646d082c7..5751f2970 100644--- a/crates/windows/src/system/cursor_overlay/pipe_name.rs+++ b/crates/windows/src/system/cursor_overlay/pipe_name.rs@@ -7,7 +7,7 @@//! The generation is not decoration. A renderer left running by an earlier//! build keeps serving a rebuilt binary's controls if the name it answers on//! does not change when the protocol does — which happens on any rebuild-//! during a live session, this branch's own end-to-end runs included. macOS+//! during a live session, every end-to-end run of the overlay included. macOS//! hashes its protocol version into the socket path for the same reason.use std::path::Path;@@ -21,7 +21,7 @@ use std::path::Path;/// the generation without also handing the previous one to the retirement/// sweep, so a renderer still drawing under it cannot be forgotten.///-/// One element today, so the retired set is empty and the sweep is a no-op.+/// With only the live generation in the ledger, the retired set is empty and the sweep is a no-op./// That is the correct state for a protocol that has never changed, and it is/// said out loud rather than left to be discovered: the sweep costs nothing/// until the first append and does its work from the moment there is one.@@ -100,7 +100,7 @@ pub(crate) fn session_prefix(root: &Path, session_id: &str) -> String {////// Takes the ledger rather than reading the shipped one, so the promotion rule/// — appending retires the entry it displaces — is provable against a ledger-/// with more than one generation in it, which the shipped one does not yet+/// with more than one generation in it, which the shipped one need not/// have.pub(crate) fn retired_generations<'a>(ledger: &'a [&'static str]) -> &'a [&'static str] {ledger.split_last().map_or(&[], |(_, earlier)| earlier)diff --git a/crates/windows/src/system/cursor_overlay/pipe_name_tests.rs b/crates/windows/src/system/cursor_overlay/pipe_name_tests.rsindex 952a2004d..be1325f05 100644--- a/crates/windows/src/system/cursor_overlay/pipe_name_tests.rs+++ b/crates/windows/src/system/cursor_overlay/pipe_name_tests.rs@@ -91,7 +91,7 @@ fn a_command_line_that_is_not_ours_parses_to_nothing() {);}-/// The shipped ledger has never been appended to, so nothing is retired and+/// A ledger holding only the live generation retires nothing, so/// the sweep has nothing to do. Asserted rather than assumed, because a sweep/// that quietly targeted the live generation would disable the renderer it/// just started.diff --git a/crates/windows/src/system/cursor_overlay/raster.rs b/crates/windows/src/system/cursor_overlay/raster.rsindex b9b55c0d4..c66d62c95 100644--- a/crates/windows/src/system/cursor_overlay/raster.rs+++ b/crates/windows/src/system/cursor_overlay/raster.rs@@ -96,7 +96,7 @@ const SAMPLES: i32 = 3;/// A pixel that its own corners and centre all agree about is not on an/// edge, so its coverage is already known and the sampling grid would spend-/// sixteen polygon walks confirming it.+/// SAMPLES x SAMPLES polygon walks confirming it.////// This matters because the interior of a shape dwarfs its outline: the/// probe of the busiest frame spent most of a display frame supersamplingdiff --git a/crates/windows/src/system/cursor_overlay/retire_tests.rs b/crates/windows/src/system/cursor_overlay/retire_tests.rsindex 28e8adf38..11a81bdde 100644--- a/crates/windows/src/system/cursor_overlay/retire_tests.rs+++ b/crates/windows/src/system/cursor_overlay/retire_tests.rs@@ -13,7 +13,7 @@ fn root() -> &'static Path {const SESSION: &str = "s0000001";-/// The protocol has never been bumped, so there is no earlier renderer to+/// While the ledger holds only the live generation, there is no earlier renderer to/// clear and the sweep costs an enable nothing.#[test]fn the_shipped_ledger_gives_the_sweep_nothing_to_do() {diff --git a/crates/windows/src/system/cursor_overlay/session_state_tests.rs b/crates/windows/src/system/cursor_overlay/session_state_tests.rsindex ef77bb50a..e5714144e 100644--- a/crates/windows/src/system/cursor_overlay/session_state_tests.rs+++ b/crates/windows/src/system/cursor_overlay/session_state_tests.rs@@ -57,7 +57,7 @@ fn a_session_whose_overlay_is_switched_off_reads_finished() {/// serialized, so switching it off **removes** the key — the manifest never/// contains `"enabled": false` at all. The hand-written fixture above is a/// shape the product does not produce, which is why it passed for a condition-/// that could not fire. `manifest_omits_a_disabled_cursor_overlay` in core+/// that could not fire. `the_manifest_omits_a_disabled_cursor_overlay_rather_than_writing_it_false` in core/// pins the serialization this relies on.#[test]fn a_manifest_with_the_overlay_key_removed_reads_finished() {diff --git a/crates/windows/src/system/interaction_lease/directory.rs b/crates/windows/src/system/interaction_lease/directory.rsindex 5c57f792f..791648cdc 100644--- a/crates/windows/src/system/interaction_lease/directory.rs+++ b/crates/windows/src/system/interaction_lease/directory.rs@@ -4,7 +4,7 @@//!//! Three independent checks port all three things//! `ensure_unix_runtime_directory` / `validate_unix_runtime_directory` do-//! (`crates/core/src/interaction_lease.rs:159-199`) to a platform where+//! (`crates/core/src/interaction_lease.rs:163-203`) to a platform where//! `mkdir` does not yield euid ownership: an owner check that accepts//! either `TokenOwner` or `TokenUser` - the two shapes an elevated//! administrator's own created directories actually carry on this platform -diff --git a/crates/windows/src/system/shell_surface_command_live_tests.rs b/crates/windows/src/system/shell_surface_command_live_tests.rsindex 1d8714ebf..b67121136 100644--- a/crates/windows/src/system/shell_surface_command_live_tests.rs+++ b/crates/windows/src/system/shell_surface_command_live_tests.rs@@ -1,6 +1,6 @@//! Windows-only: drives `agent_desktop_core::commands::open_system_surface`//! end to end - through the real adapter, the real kind table, the real-//! interaction lease - and proves the R1 round trip with the crate's own+//! interaction lease - and proves the open-to-observation round trip with the crate's own//! command functions: the window identity the open returns is the identity//! the observation stack consumes, with no second lookup in between.//!diff --git a/crates/windows/src/system/signal_filter_apply_tests.rs b/crates/windows/src/system/signal_filter_apply_tests.rsindex 26819d61c..8307752db 100644--- a/crates/windows/src/system/signal_filter_apply_tests.rs+++ b/crates/windows/src/system/signal_filter_apply_tests.rs@@ -37,7 +37,7 @@ fn inventory(windows: Vec<WindowInfo>, apps: Vec<AppInfo>) -> SignalWindowInvent}}-/// Reproduces `crates/core/src/commands/wait_event.rs:158-196`'s own+/// Reproduces `validate_signal_scope` in `crates/core/src/commands/wait_event.rs`, its own/// predicate rather than paraphrasing it: for a filtered wait, every/// observed pid and process instance must equal the expected one exactly.fn satisfies_validate_signal_scope(diff --git a/crates/windows/src/system/signals_tests.rs b/crates/windows/src/system/signals_tests.rsindex 2316c2194..c11aa410d 100644--- a/crates/windows/src/system/signals_tests.rs+++ b/crates/windows/src/system/signals_tests.rs@@ -163,7 +163,7 @@ mod windows_only {}}- /// Reproduces `crates/core/src/commands/wait_event.rs:158-196`'s own+ /// Reproduces `crates/core/src/commands/wait_event.rs:257-296`'s own/// predicate rather than paraphrasing it: for a process-filtered wait,/// every observed pid and process instance across windows, apps, and/// surfaces must equal the expected one exactly.diff --git a/crates/windows/src/system/wait.rs b/crates/windows/src/system/wait.rsindex 1265388e8..c86115151 100644--- a/crates/windows/src/system/wait.rs+++ b/crates/windows/src/system/wait.rs@@ -29,7 +29,7 @@ const POLL_INTERVAL: Duration = Duration::from_millis(50);/// when it is handed one.////// Core makes exactly one call here and owns no retry of its own-/// (`crates/core/src/commands/wait.rs:123-129`), so every condition this+/// (`crates/core/src/commands/wait.rs:118-123`), so every condition this/// loop can absorb - the 50ms poll interval, the identity re-checks, and a/// predicate read that itself times out mid-poll - is absorbed here rather/// than propagated raw: a `Timeout` from the predicate falls through to thisdiff --git a/crates/windows/src/system/wait_event_live_tests.rs b/crates/windows/src/system/wait_event_live_tests.rsindex a1180a850..3ada60887 100644--- a/crates/windows/src/system/wait_event_live_tests.rs+++ b/crates/windows/src/system/wait_event_live_tests.rs@@ -17,14 +17,14 @@//! `capture_signal_baseline` already scoped to this fixture's own//! `(pid, process_instance)` (`context::with_event_baseline`); core's//! `signal_filter` resolves `--app` from that seed via `process_from_baseline`-//! rather than calling `resolve_app` (`wait_event.rs:120-131`), and a+//! rather than calling `resolve_app` (`wait_event.rs:224`), and a//! process-filtered capture can only ever contain this fixture, so the//! ambiguity class does not arise regardless of what else is running.//! `window-closed` and `focus-changed` narrow by the fixture's own//! `--window-id` instead and never resolve `--app` at all. `app-launched`//! has no seed to resolve against - the process does not exist yet - so its//! filter always scans by name across the whole population-//! (`wait_event.rs:113-118`); it cannot itself raise `AMBIGUOUS_TARGET` (that+//! (`wait_event.rs:210-212`); it cannot itself raise `AMBIGUOUS_TARGET` (that//! branch never calls `resolve_app`), but an unrelated same-named fixture//! launching or exiting during its poll window could produce a same-shaped//! match, so it still holds `test_support::FIXTURE_APP_NAME_LOCK` to bounddiff --git a/crates/windows/src/system/window_ops.rs b/crates/windows/src/system/window_ops.rsindex 6e617ff97..d24df6a3e 100644--- a/crates/windows/src/system/window_ops.rs+++ b/crates/windows/src/system/window_ops.rs@@ -131,7 +131,7 @@ fn is_window_identity_race(error: &AdapterError) -> bool {/// One single-shot walk of the live top-level window inventory.////// Verification re-runs on both sides of the read (the two-sided rule macOS's-/// `window_inventory.rs:91-155` carries): the owning process is re-checked+/// `windows_from_records_with_focus` in `window_inventory.rs` carries): the owning process is re-checked/// after assembly, and a window whose process changed mid-listing fails the/// whole walk rather than emitting a half-identified entry - the race/// `list_windows_live` retries this whole function for.diff --git a/crates/windows/src/system/window_ops_tests.rs b/crates/windows/src/system/window_ops_tests.rsindex e46a6f115..51664a27c 100644--- a/crates/windows/src/system/window_ops_tests.rs+++ b/crates/windows/src/system/window_ops_tests.rs@@ -55,7 +55,7 @@ mod windows_only {/// How many times a live listing is re-attempted before its/// mid-walk identity refusal is accepted as the desktop's answer.- const LISTING_RACE_ATTEMPTS: u32 = 5;+ use crate::system::listing_retry::LISTING_RACE_ATTEMPTS;/// The live half of the census: a hosted fixture window appears in/// `list_windows` with a parseable id, the fixture's pid, and adiff --git a/crates/windows/src/tree/cache_tests.rs b/crates/windows/src/tree/cache_tests.rsindex c1f8967a9..f678d5622 100644--- a/crates/windows/src/tree/cache_tests.rs+++ b/crates/windows/src/tree/cache_tests.rs@@ -32,7 +32,7 @@ fn an_in_process_client_side_provider_skips_the_cache() {/// module is the client-side proxy library, but whose `Main` layer is/// `Nested` into the target application's own process id - measured live/// against `tests/fixture-app-windows`, a 176-node broad-search walk cost-/// ~840ms read live (exceeding the 750ms per-attempt resolve budget in+/// ~840ms read live (against the 4s per-attempt resolve budget in/// `crates/core/src/ref_resolve_deadline.rs`) against ~310ms forced-batched./// The module-name check alone reads this as client-side and picks `Skip`;/// the target-pid check must override it to `Batch`.diff --git a/crates/windows/src/tree/live_read.rs b/crates/windows/src/tree/live_read.rsindex 4f72df000..1527e2c69 100644--- a/crates/windows/src/tree/live_read.rs+++ b/crates/windows/src/tree/live_read.rs@@ -60,7 +60,7 @@ mod imp {/// answers with a partial bundle claiming completeness.////// Wires `properties::read_live_bounded` rather than the unbounded- /// `read_live`: the property set is 42 properties wide, one cross-process+ /// `read_live`: the property set is 43 properties wide, one cross-process/// call apiece, and nothing checked the operation deadline between them -/// a poll-style caller (`resolve.rs`'s retry loop, core's ref-action poll)/// could overshoot its own user-visible timeout on every single iteration.diff --git a/crates/windows/src/tree/resolve.rs b/crates/windows/src/tree/resolve.rsindex 0acc1ed87..2c6a0fdf6 100644--- a/crates/windows/src/tree/resolve.rs+++ b/crates/windows/src/tree/resolve.rs@@ -267,7 +267,7 @@ pub(crate) fn retry_incomplete_until(/// `Timeout` and is one of those - it is a per-call transport timeout inside/// the operation's budget, not the budget running out. Deadline exhaustion/// carries no retryable stamp, so it still falls through to the caller. Mirrors macOS-/// (`resolve.rs:275-277`); the granularity split between adapter-loop-settled+/// (`is_retryable_resolution_error` in `crates/macos/src/tree/resolve.rs`); the granularity split between adapter-loop-settled/// and incomplete lives in the `complete`/`retryable` details every resolver/// error carries.#[cfg(target_os = "windows")]@@ -280,7 +280,7 @@ pub(crate) fn is_retryable_resolution_error(error: &AdapterError) -> bool {/// caller sees why the retries ran out, preserving the incomplete's own/// details rather than discarding them for a bare `TIMEOUT`. Core owns the/// payload (`agent_desktop_core::resolve_errors::mark_deadline_elapsed`)-/// because it is line-for-line identical to macOS's copy.+/// so every platform stamps the same shape.#[cfg(target_os = "windows")]pub(crate) use agent_desktop_core::resolve_errors::mark_deadline_elapsed;diff --git a/crates/windows/src/tree/resolve_anchor_selector_wait_tests.rs b/crates/windows/src/tree/resolve_anchor_selector_wait_tests.rsindex 0ba2b102f..635e38c6c 100644--- a/crates/windows/src/tree/resolve_anchor_selector_wait_tests.rs+++ b/crates/windows/src/tree/resolve_anchor_selector_wait_tests.rs@@ -64,7 +64,7 @@ fn selector_matches(resolution.meta.selection_complete && resolution.meta.total_matches > 0}-/// `wait --selector` has no Windows-side evidence anywhere in this branch.+/// `wait --selector` depends on Windows observing a late-appearing control./// Its poll condition is `resolve_query` in this exact shape - if that call/// cannot observe a control that starts unmatched and becomes matched by a/// real mutation made after the first poll, `wait --selector` can neverdiff --git a/crates/windows/src/tree/resolve_search.rs b/crates/windows/src/tree/resolve_search.rsindex cfb7eb6f0..af5f5e4d0 100644--- a/crates/windows/src/tree/resolve_search.rs+++ b/crates/windows/src/tree/resolve_search.rs@@ -28,7 +28,7 @@ pub(crate) mod descent;/// The resolve-scoped depth cap.////// Independently bounded from the walk's own ceiling, mirroring macOS's-/// `MAX_RESOLVE_DEPTH` (`crates/macos/src/tree/resolve.rs:15`). Electron+/// `MAX_RESOLVE_DEPTH` (`crates/macos/src/tree/resolve.rs:17`). Electron/// elements commonly sit at depth 25+, so the cap is the search bound rather/// than the walk bound.pub(crate) const MAX_RESOLVE_DEPTH: u8 = 50;@@ -228,7 +228,7 @@ pub(crate) fn entry_is_unverifiable(entry: &RefEntry) -> bool {/// turn it into anything other than `AMBIGUOUS_TARGET`, so an incomplete/// region elsewhere in the tree must not withhold that verdict. Mirrors/// macOS's `should_stop_collecting`-/// (`crates/macos/src/tree/resolve_search.rs:378-380`), which does stop its+/// (`crates/macos/src/tree/resolve_search.rs:374-376`), which does stop its/// walk early on this signal - Windows only reuses its name and its/// classification rule, not its early exit.pub(crate) fn should_stop_collecting(match_count: usize, entry: &RefEntry) -> bool {diff --git a/crates/windows/src/tree/roles_fixture_coverage_tests.rs b/crates/windows/src/tree/roles_fixture_coverage_tests.rsindex e85829f38..423802fac 100644--- a/crates/windows/src/tree/roles_fixture_coverage_tests.rs+++ b/crates/windows/src/tree/roles_fixture_coverage_tests.rs@@ -157,7 +157,7 @@ fn fixture_covered_and_uncovered_roles_union_to_the_map_producible_set() {/// [`producible_cases`] cannot be derived mechanically from `roles.rs`/// without parsing Rust source, so this is the honest fallback the fixture-/// coverage plan calls for instead: a textual count of every+/// instead: a textual count of every/// `properties.is_true(TreeProperty::` and `properties.gated_flag(TreeProperty::`/// call in `roles.rs`'s own source, pinned against the number of flags/// [`producible_cases`] threads through [`role_of`] above.diff --git a/crates/windows/src/tree/walker_fake.rs b/crates/windows/src/tree/walker_fake.rsindex 61df51869..b42e1773d 100644--- a/crates/windows/src/tree/walker_fake.rs+++ b/crates/windows/src/tree/walker_fake.rs@@ -262,9 +262,9 @@ struct ScanLimits<'a> {/// Every resolver test that needs to locate one fixture node by predicate/// re-implemented this recursion by hand; only the predicate and the value/// built on a match differ between them, so both live here once. A child-/// enumeration failure anywhere aborts the whole search, matching the-/// fail-fast contract `resolve_search::enumerate_children` documents for the-/// production search this mirrors.+/// enumeration failure anywhere aborts the whole search, as it does in the+/// production search this mirrors (`resolve_search::enumerate_children`+/// propagates the error with `?`).#[cfg(target_os = "windows")]pub(crate) fn scan_subtree<T>(source: &UiaTreeSource,diff --git a/docs/architecture.excalidraw b/docs/architecture.excalidrawindex 522e0adf6..a624cfd1f 100644--- a/docs/architecture.excalidraw+++ b/docs/architecture.excalidraw@@ -275,13 +275,13 @@"updated": 1771942817499,"link": null,"locked": false,- "text": "50 Commands",+ "text": "60 Commands","fontSize": 18,"fontFamily": 1,"textAlign": "center","verticalAlign": "middle","containerId": "r-cmds",- "originalText": "50 Commands",+ "originalText": "60 Commands","lineHeight": 1.25,"index": "a7","autoResize": true@@ -563,13 +563,13 @@"updated": 1771942805457,"link": null,"locked": false,- "text": "Windows Adapter\nPlanned",+ "text": "Windows Adapter\nActive","fontSize": 18,"fontFamily": 1,"textAlign": "center","verticalAlign": "middle","containerId": "r-win",- "originalText": "Windows Adapter\nPlanned",+ "originalText": "Windows Adapter\nActive","lineHeight": 1.25,"index": "aF","autoResize": true@@ -779,13 +779,13 @@"updated": 1771942805457,"link": null,"locked": false,- "text": "UIAutomation\nPlanned",+ "text": "UIAutomation\nActive","fontSize": 14,"fontFamily": 1,"textAlign": "center","verticalAlign": "middle","containerId": "r-win-api",- "originalText": "UIAutomation\nPlanned",+ "originalText": "UIAutomation\nActive","lineHeight": 1.25,"index": "aL","autoResize": truediff --git a/docs/architecture.html b/docs/architecture.htmlindex 227cb207a..1e9e3806e 100644--- a/docs/architecture.html+++ b/docs/architecture.html@@ -101,5 +101,5 @@ svg {display:block;width:100%;height:auto;color:var(--ink);} text {font-family:u</g><text x="72" y="927" font-size="23">Headless by default: semantic actions without moving the cursor or stealing focus.</text><text x="72" y="974" font-size="22">Refs can go stale when the UI changes. Refresh the affected region before continuing.</text>-<text x="1528" y="974" text-anchor="end" font-size="22">macOS active · Windows + Linux planned</text>+<text x="1528" y="974" text-anchor="end" font-size="22">macOS + Windows active · Linux planned</text></svg></main></body></html>\ No newline at end of filediff --git a/docs/faq.md b/docs/faq.mdindex 842765987..0b8f85c54 100644--- a/docs/faq.md+++ b/docs/faq.md@@ -30,18 +30,19 @@ No. The core workflow reads native accessibility trees and assigns refs to inter## Which platforms are supported?-| Feature | macOS | Windows | Linux |-|---------|:-----:|:-------:|:-----:|-| Accessibility tree | **Yes** | Yes* | Planned |-| Click/type/keyboard | **Yes** | **Yes** | Planned |+| | macOS | Windows | Linux |+|---|:---:|:---:|:---:|+| Accessibility tree | **Yes** | Yes\* | Planned |+| Click / type / keyboard | **Yes** | **Yes** | Planned || Mouse input | **Yes** | **Yes** | Planned || Screenshot | **Yes** | **Yes** | Planned || Clipboard | **Yes** | **Yes** | Planned |-| App/window management | **Yes** | Yes** | Planned |-| Notifications | **Yes** | **Yes** (Action Center) | Planned |+| App & window management | **Yes** | Yes\*\* | Planned |+| Notifications | **Yes** | **Yes** | Planned |+| Shell surfaces (`open-system-surface`) | Planned | **Yes** | Planned |-\* On Windows, `list-surfaces` inventories each process's `window`, `focused`, `sheet` and `menu` surfaces.-\*\* `launch` on Windows resolves an absolute path or a bare name found under System32 or the Windows directory, not display names.+\* On Windows, `list-surfaces` lists each process's `window`, `focused`, `sheet` and `menu` surfaces. `snapshot --surface` also reads the shell surfaces `taskbar`, `system-tray`, `system-tray-overflow`, `start-menu` and `action-center` without `--app`. `quick-settings` returns `PLATFORM_NOT_SUPPORTED` on every Windows build and names `action-center`, which 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".## How do I install agent-desktop?@@ -65,7 +66,7 @@ cargo build --profile release-ffi -p agent-desktop-ffiInteractive roles that receive refs:-`button`, `textfield`, `checkbox`, `link`, `menuitem`, `tab`, `slider`, `combobox`, `treeitem`, `cell`, `radiobutton`, `incrementor`, `menubutton`, `switch`, `colorwell`, `dockitem`.+`button`, `textfield`, `checkbox`, `link`, `menuitem`, `tab`, `slider`, `combobox`, `treeitem`, `cell`, `radiobutton`, `incrementor`, `menubutton`, `switch`, `colorwell`, `dockitem`, `listbox`, `option`.Stale ref recovery:diff --git a/docs/json-output.md b/docs/json-output.mdindex 86c54d256..a364ef9c0 100644--- a/docs/json-output.md+++ b/docs/json-output.md@@ -95,6 +95,9 @@ to `role` or `value`.| `PLATFORM_NOT_SUPPORTED` | Adapter method not implemented on this platform || `TIMEOUT` | Wait condition expired || `INVALID_ARGS` | Invalid argument values |+| `WINDOW_NOT_FOUND` | The requested window does not exist |+| `NOTIFICATION_NOT_FOUND` | The notification ID was not found |+| `INTERNAL` | Unexpected error or caught panic |## Exit codesdiff --git a/docs/phases.md b/docs/phases.mdindex 04957691a..962600ae6 100644--- a/docs/phases.md+++ b/docs/phases.md@@ -6,40 +6,14 @@## Release Tracker-Most recent shipments against this roadmap:--| Version | Date | What shipped |-|---------|------|---------------|-| v0.6.0 | 2026-07-25 | **Breaking:** removed the speculative Win32 private-file layer from core (six `private_file_windows*` files, `windows-sys` dropped from core and the workspace — Windows now uses the same portable `std::fs` path as every other non-unix target) and added real `test-windows` / `test-linux` CI lanes that execute core's platform-conditional code on every PR instead of only type-checking it. Windows private-file hardening becomes from-scratch Phase 2.1 work behind the adapter boundary. See [2.1](#21--toolchain-ci--com-bootstrap) and `docs/solutions/best-practices/never-ship-platform-code-that-ci-cannot-execute.md` |-| v0.5.0 | 2026-07-24 | Foundation reliability contract (Playwright-grade, U0–U19) — capability-supertrait `PlatformAdapter` split, canonical role/state vocabulary, live `is --property visible`, `list-displays` + honest `--screen` + scale factor, truthful Automation permission, `native_id` identity spine, window-id-first resolution, `LocatorQuery` + live `find`, default-on auto-wait, three-way occlusion gate, `scroll_into_view`, core accname computation, `supported_surfaces` introspection, typed `ActionStep` delivery tier, `ProcessState` + `APP_UNRESPONSIVE`, `LaunchOptions`, `SignalBaseline` + `wait --event`, typed clipboard, mouse modifiers/wheel, FFI ABI major 3, envelope 2.1. See [Phase 1.6](#phase-16--playwright-grade-foundation-contract-completed). |-| v0.4.7 | 2026-07-02 | Trace viewer and replay artifacts |-| v0.4.6 | 2026-07-02 | Sessions promoted to the first-class trace container: `session start/end/list/gc`, manifest-gated automatic JSONL segments under `sessions/<id>/trace/` |-| v0.4.5 | 2026-06-30 | `--wait-for` selector polling flags |-| v0.4.4 | 2026-06-29 | macOS + core adapter hardening with caller-controllable guardrails |-| v0.4.3 | 2026-06-28 | macOS `retained_handle` null-guard hardening against release-only `CFRetain(null)` |-| v0.4.2 | 2026-06-27 | FFI Phase B and C: Python smoke harness, parity gates, command-wrapper groundwork |-| v0.4.1 | 2026-06-26 | FFI C-ABI surface complete (Phase A): load-time ABI handshake, session-scoped adapter, JSON-envelope command entrypoints (version, status, snapshot, wait, execute-by-ref), tracing log callback |-| v0.4.0 | 2026-06-24 | **Breaking:** `version` command always emits the JSON envelope (drops `--json`); over-engineering cleanup |-| v0.3.1 | 2026-06-21 | macOS stale-ref resolution hardening |-| v0.3.0 | 2026-06-20 | Playwright-grade reliability hardening on the Phase 1 contracts: session-scoped latest snapshot pointers, qualified snapshot refs within explicit namespaces, actionability checks, headed/headless policy, JSONL `--trace`, stale-ref diagnostics, and refstore symlink hardening |-| v0.2.3 | 2026-06-06 | macOS AX window fallback hardening and fullscreen AX tree retrieval fixes |-| v0.2.2 | 2026-06-02 | macOS CFArray type-safety fix for Mail.app snapshot stability |-| v0.2.1 | 2026-05-23 | Empty accessibility-identity ref stability fix |-| v0.2.0 | 2026-05-20 | Unified command execution contracts; chain deadlines now return structured `TIMEOUT` instead of `ACTION_FAILED` |-| v0.1.14 | 2026-05 | Phase 1 unified core: typed batch/CLI path, `CommandPolicy`, `PermissionReport`, snapshot-scoped `RefStore`, headless `ActionRequest`, macOS screenshot backend boundary |-| v0.1.13 | 2026-04-17 | FFI cdylib on 5 platforms (aarch64/x86_64 macOS + Linux, x86_64 Windows MSVC), Sigstore build-provenance attestations, FFI review fixes (#26 — 66 commits) |-| v0.1.12 | 2026-03–04 | Progressive skeleton traversal + ref-rooted drill-down (#20) |-| v0.1.11 | 2026-02–03 | Skill-install prompt fix on all success paths |-| v0.1.9 | 2026-01–02 | Scalable skill architecture + ClawHub auto-publish (#14) |-| v0.1.8 | 2026-01 | `--compact` flag to collapse single-child unnamed nodes |-| v0.1.7 | 2025-12 | Electron / web app accessibility-tree compatibility |+Every release, with its date and changes, is listed in [`CHANGELOG.md`](../CHANGELOG.md). Phase milestones:- Phase 1 completion: incremental across v0.1.0 – v0.1.14 (macOS MVP, 58 shipped command names — 54 operational, 4 fail-closed pending daemon-owned held input — unified core engine).- v0.2.0 – v0.3.1 unify command execution contracts and harden Playwright-grade ref reliability on top of the Phase 1 contracts.- v0.4.0 – v0.4.7 complete the FFI C-ABI surface (load-time handshake, session-scoped adapter, JSON-envelope entrypoints), then land session-first tracing and a trace viewer.-- Foundation reliability contract (Playwright-grade, U0–U19) completed on `feat/foundation-playwright-grade-contract` — see [Phase 1.6](#phase-16--playwright-grade-foundation-contract-completed).+- Foundation reliability contract (Playwright-grade, U0–U19) completed in v0.5.0 (PR #93) — see [Phase 1.6](#phase-16--playwright-grade-foundation-contract-completed).- Phase 1.5 completion: v0.1.13 (FFI cdylib on 5 platforms); the FFI C-ABI surface itself (`ad_snapshot` / `ad_execute_by_ref` / `ad_wait` / `ad_version` / `ad_status` / `ad_init` / `ad_abi_version`) completed in v0.4.1.-- Phase 2: in progress. The entire Windows implementation lands here as dependency-ordered sub-phases 2.0–2.17 into the `feat/windows-adapter` integration branch — nothing Windows defers to a later phase (see the no-convenience-deferral rule in the [Platform Delivery Model](#platform-delivery-model--sub-phases-and-integration-branches)). v0.6.0 already put a real Windows test lane in place; 2.0 (probe corpus) is the first sub-phase PR.+- Phase 2 completion: v0.10.0 (2026-10-18). The Windows adapter was delivered as dependency-ordered sub-phases 2.0–2.17 on the `feat/windows-adapter` integration branch and promoted to `main` as one `feat!` merge (see the [Platform Delivery Model](#platform-delivery-model--sub-phases-and-integration-branches)).- Phase 3+: planned. See each phase section below for the additive platform work and trait defaults that later phases backfill.---@@ -51,7 +25,7 @@ Most recent shipments against this roadmap:| 1 | Foundation + macOS MVP | **Completed** (v0.1.0 – v0.1.14) | macOS || 1.5 | FFI Distribution (C-ABI cdylib) | **Completed** (v0.1.13; C-ABI surface completed v0.4.1) | macOS, Windows, Linux || 1.6 | Playwright-grade Foundation Contract | **Completed** (PR #93) | macOS (contract in core) |-| 2 | Windows Adapter | **In progress** — sub-phases 2.0–2.17; all Windows scope lands here | macOS, Windows |+| 2 | Windows Adapter | **Completed** — v0.10.0, sub-phases 2.0–2.17 | macOS, Windows || 3 | Linux Adapter | Planned — sub-phases 3.0–3.15 | macOS, Windows, Linux || 4 | MCP Server Mode | Planned | All || 5 | Production Readiness | Planned | All |@@ -117,7 +91,7 @@ Phase 1 is the load-bearing phase. It establishes the shared command path, trait| P1-O2 | Platform adapter trait | Trait compiles with mock adapter; macOS adapter satisfies all trait methods || P1-O3 | Ref-based interaction | `click @s8f3k2p9:e3` successfully invokes AXPress on the resolved element || P1-O4 | Context efficiency | Typical Finder snapshot < 500 tokens (measured via tiktoken) |-| P1-O5 | Typed JSON contract | Output envelope carries `version: "2.2"`. **Partial**: dedicated standalone JSON-Schema files were never delivered — deferred to later quality gates. |+| P1-O5 | Typed JSON contract | Output envelope carries `version: "2.4"`. **Partial**: dedicated standalone JSON-Schema files were never delivered — deferred to later quality gates. || P1-O6 | Permission detection | Permission report covers Accessibility, Screen Recording, and Automation with recovery suggestions || P1-O7 | Command extensibility | Adding a new command follows the current shared path: `commands/{name}.rs` + `commands/mod.rs` + `src/cli_args/` + `src/cli/mod.rs` + `src/dispatch/mod.rs` + `src/command_policy/mod.rs` || P1-O8 | 58 shipped command names (54 operational) | All commands pass integration tests; `key-down` / `key-up` / `mouse-down` / `mouse-up` fail closed pending daemon-owned held input |@@ -166,15 +140,15 @@ agent-desktop/│ │ ├── snapshot_surface.rs # SnapshotSurface (predeclared cross-platform surface vocabulary)│ │ ├── snapshot.rs # SnapshotEngine (filter, allocate, serialize)│ │ ├── session/ # session start/end/list/gc, manifest, liveness-│ │ ├── private_file*.rs # 0600-equivalent private artifact writing (portable std::fs on every target; Windows ACL hardening not yet built, see Phase 2.1)+│ │ ├── private_file*.rs # 0600-equivalent private artifact writing (portable std::fs in core; the Windows implementation lives in crates/windows/src/system/private_file/)│ │ ├── trace.rs / trace_read/ # JSONL reliability trace, segment merge, HTML viewer│ │ ├── error_code.rs # ErrorCode enum│ │ ├── adapter_error.rs / app_error.rs # AdapterError, AppError-│ │ ├── output.rs # ENVELOPE_VERSION ("2.2") + envelope builders+│ │ ├── output.rs # ENVELOPE_VERSION ("2.4") + envelope builders│ │ ├── notification.rs # NotificationInfo, NotificationFilter, NotificationIdentity│ │ └── commands/ # one file per command (direct match, no Command trait)│ ├── macos/ # agent-desktop-macos (Phase 1, shipped)-│ ├── windows/ # agent-desktop-windows (stub → Phase 2)+│ ├── windows/ # agent-desktop-windows (Phase 2)│ ├── linux/ # agent-desktop-linux (stub → Phase 3)│ └── ffi/ # agent-desktop-ffi (cdylib, shipped v0.1.13; C-ABI surface completed v0.4.1; see Phase 1.5)├── src/ # agent-desktop binary (entry point)@@ -193,7 +167,7 @@ agent-desktop/└── integration/```-This tree is representative, not exhaustive — `crates/core/src/` alone holds roughly 200 files (one struct/enum/fn-group per file) plus the subdirectories named above.+This tree is representative, not exhaustive — `crates/core/src/` holds hundreds of files (one struct/enum/fn-group per file) plus the subdirectories named above.### PlatformAdapter Trait@@ -298,7 +272,7 @@ fn notification_action(&self, request: NotificationActionRequest<'_>, lease: &In### macOS Adapter Implementation-Located in `crates/macos/src/` following the platform crate folder structure (49 files under `tree/`, 31 under `actions/`, 30 under `input/`, 47 under `system/`, 12 under `notifications/` — the listing below is a representative subset):+Located in `crates/macos/src/` following the platform crate folder structure (`tree/`, `actions/`, `input/`, `system/`, `notifications/` — the listing below is a representative subset):```crates/macos/src/@@ -393,7 +367,7 @@ Platform-agnostic, lives in `agent-desktop-core`:4. Serialize: Omit null fields. Omit empty arrays. Omit bounds in compact mode5. Estimate tokens: Optionally warn if exceeding threshold-Snapshot refs persist through `RefStore`. The default namespace stores snapshots under `~/.agent-desktop/snapshots/{snapshot_id}/refmap.json`; `--session <id>` stores the same shape under `~/.agent-desktop/sessions/{id}/snapshots/{snapshot_id}/refmap.json`. Each namespace owns one `latest_snapshot_id` pointer, which `status` reports and pruning protects; no ref action resolves through it. A ref is accepted only in its qualified form `@<snapshot_id>:eN`, which identifies the snapshot within the selected namespace; session-owned snapshots still require the matching `--session` or `AGENT_DESKTOP_SESSION` scope, and lookup never searches another namespace. `~/.agent-desktop/last_refmap.json` remains only as a latest-snapshot inspection artifact. Action commands resolve through `RefStore` using strict re-identification from platform-neutral `RefEntry` evidence — pid, role, path/source surface, role-conditional stable text identity, and bounds hash; mutable control values are volatile and are never treated as stable text identity. Return `STALE_REF` on 0 live candidates and `AMBIGUOUS_TARGET` on 2+ plausible live candidates.+Snapshot refs persist through `RefStore`. The default namespace stores snapshots under `~/.agent-desktop/snapshots/{snapshot_id}/refmap.json`; `--session <id>` stores the same shape under `~/.agent-desktop/sessions/{id}/snapshots/{snapshot_id}/refmap.json`. Each namespace owns one `latest_snapshot_id` pointer, which `status` reports and pruning protects; no ref action resolves through it. A ref is accepted only in its qualified form `@<snapshot_id>:eN`, which identifies the snapshot within the selected namespace; session-owned snapshots still require the matching `--session` or `AGENT_DESKTOP_SESSION` scope, and lookup never searches another namespace. `~/.agent-desktop/last_refmap.json` is a legacy file that is no longer written; the default namespace reads it once, only to migrate it into a snapshot when no `latest_snapshot_id` exists. Action commands resolve through `RefStore` using strict re-identification from platform-neutral `RefEntry` evidence — pid, role, path/source surface, role-conditional stable text identity, and bounds hash; mutable control values are volatile and are never treated as stable text identity. Return `STALE_REF` on 0 live candidates and `AMBIGUOUS_TARGET` on 2+ plausible live candidates.**Progressive Skeleton Traversal:**- `--skeleton` flag clamps depth to `min(max_depth, 3)`, annotates truncated containers with `children_count` for agent discovery@@ -436,7 +410,7 @@ The `wait` command has been extended with notification, menu, event-diff, and se- `wait --event <kind> [--app ...] [--window-id ...]` — Wait for a `SignalBaseline` diff event (window-opened/closed, app-launched/terminated, focus-changed, surface-appeared); see [Phase 1.6](#phase-16--playwright-grade-foundation-contract-completed)- `--wait-for <selector>` — Poll a `LocatorQuery`-shaped selector until it matches (v0.4.5)-### Commands Shipped (58 names — 54 operational, 4 fail closed)+### Commands Shipped in Phase 1 (58 names — 54 operational, 4 fail closed)| Category | Commands | Count ||----------|----------|-------|@@ -460,12 +434,12 @@ The `wait` command has been extended with notification, menu, event-diff, and se### JSON Output Contract-All commands produce a response envelope with `version: "2.2"`. Standalone schema files are still deferred; the current contract is enforced by Rust serde types, CLI conformance tests, and documented examples.+All commands produce a response envelope with `version: "2.4"`. Standalone schema files are still deferred; the current contract is enforced by Rust serde types, CLI conformance tests, and documented examples.Success:```json{- "version": "2.2",+ "version": "2.4","ok": true,"command": "snapshot","data": {@@ -484,7 +458,7 @@ Success:Error:```json{- "version": "2.2",+ "version": "2.4","ok": false,"command": "click","error": {@@ -522,7 +496,7 @@ The `ErrorCode` enum in `crates/core/src/error_code.rs` (`AdapterError` lives in| `STALE_REF` | Ref | Element could not be re-identified from the requested snapshot | Run 'snapshot' (or `snapshot --skeleton`) to refresh || `AMBIGUOUS_TARGET` | Ref | Ref identity maps to more than one live candidate | Run 'snapshot' to refresh, then retry with a more specific ref || `WINDOW_NOT_FOUND` | Window | --window w-999 does not exist | Run 'list-windows' to see available windows |-| `PLATFORM_NOT_SUPPORTED` | Platform | Windows/Linux adapter not yet shipped | This platform ships in Phase 2/3 |+| `PLATFORM_NOT_SUPPORTED` | Platform | Desktop command on the Linux stub adapter, or an adapter method the platform does not implement | Use macOS or Windows; the Linux adapter ships in Phase 3 || `TIMEOUT` | Wait / Traversal / Auto-wait | wait --element exceeded timeout; auto-wait exceeded 5000ms without the target becoming actionable | Increase --timeout or --timeout-ms, or check app state || `INVALID_ARGS` | Input | Bad CLI argument, unknown ref format, or protected-process close refusal | Fix the argument per CLI help; target a regular application when closing || `NOTIFICATION_NOT_FOUND` | Notification | Notification ID not found / NC reordered | Run 'list-notifications' to see current notifications |@@ -582,13 +556,13 @@ Current `.github/workflows/ci.yml` runs on push to main/master, pull_request, an| `fmt` | ubuntu-latest | `cargo fmt --all -- --check`; shellcheck + bash3-compat on e2e scripts; `py_compile` + unittest on `tests/e2e/*.py`; actionlint on workflow files || `msrv` | ubuntu-latest | `cargo +1.89.0 check` (pinned MSRV) on core, linux, and the binary crate || `platform-check` | matrix: Linux / Windows / macOS | `cargo check --all-targets` per platform crate + binary — proves every crate compiles on its target |-| `test-windows` | windows-latest | `cargo test -p agent-desktop-core -p agent-desktop-windows --lib` — added in v0.6.0; the first lane that ever executed core's `#[cfg(windows)]` code. Phase 2.1 extends it to clippy, binary-crate tests, the core-isolation check, and the size check |+| `test-windows` | windows-latest | Dependency and Win32-leak isolation checks, clippy, core and Windows unit tests, Windows example tests, binary command tests, FFI integration tests, the Windows e2e contract gate, the release binary size check — added in v0.6.0 as the first lane that ever executed core's `#[cfg(windows)]` code; `test-windows-arm` runs the core and Windows unit tests, a release build and the packed npm package through its shim on windows-11-arm || `test-linux` | ubuntu-latest | `cargo test -p agent-desktop-core -p agent-desktop-linux --lib` — added in v0.6.0; Phase 3.1 extends it the same way || `test` | macos-latest | Dependency isolation check (`cargo tree -p agent-desktop-core` has zero platform crate names), release-consistency check, file-size rule check, `cargo clippy --all-targets -- -D warnings`, core+macos unit tests, `locator_benchmark` example, `permission-contract.sh`, binary command tests, FFI integration tests, release binary build + version-flag check + 15MB size check, FFI cdylib build (`release-ffi` profile), FFI helper-discovery smoke, npm package tests + wrapper smoke || `ffi-python-smoke` | macos-latest | Builds the FFI dylib with the `stub-adapter` feature, runs `tests/ffi-python/smoke.py` against it || `ffi-header-drift` | macos-latest | `cbindgen 0.29.4 --verify` against the committed `crates/ffi/include/agent_desktop.h` || `ffi-panic-guard` | macos-latest | Asserts `profile.release-ffi` keeps `panic = "unwind"`; runs `crates/ffi/tests/run_cdylib_panic_probe.sh` |-| `ffi-passthrough` | ubuntu-latest | `cargo test -p agent-desktop-ffi --features stub-adapter --test c_abi_passthrough` — Family-B entrypoints (`ad_snapshot` / `ad_status` / `ad_wait` / `ad_execute_by_ref` / `ad_version` + `ad_init` / `ad_destroy` / `ad_check_permissions`) against the stub adapter |+| `ffi-passthrough` | ubuntu-latest | `cargo test -p agent-desktop-ffi --features stub-adapter --test c_abi_passthrough` — Family-B entrypoints (`ad_snapshot` / `ad_status` / `ad_wait` / `ad_execute_by_ref` / `ad_version` + `ad_init` / `ad_adapter_destroy` / `ad_check_permissions`) against the stub adapter |Three more workflows run outside `ci.yml`: `native-e2e.yml` (workflow_dispatch only, self-hosted `[self-hosted, macOS, agent-desktop-e2e]` — builds and runs the exclusive native E2E suite via `scripts/run-native-e2e-ci.sh`), `codeql.yml` (pull_request + push to main/master + weekly cron + workflow_dispatch — CodeQL analysis for GitHub Actions/JS-TS and Rust), and `supply-chain.yml` (pull_request + push to main/master + weekly cron + workflow_dispatch — release-metadata consistency, npm package/publish policy, `cargo-deny`, `zizmor` workflow security audit). `release.yml` (push to main + workflow_dispatch) runs `release-please`, the per-target `build` and `build-ffi` matrices, `ffi-release-gates`, and the `publish-github` / `publish-npm` / `publish-skills` jobs.@@ -632,7 +606,7 @@ Phase 1.5 ships `crates/ffi/` as a first-class distribution target. The CLI stay| P1.5-O1 | Stable C-ABI surface | `crates/ffi/include/agent_desktop.h` compiled in CI as the committed ABI contract || P1.5-O2 | 5-platform release | Tarballs for aarch64/x86_64 apple-darwin, aarch64/x86_64 unknown-linux-gnu, and x86_64 pc-windows-msvc on every tagged release || P1.5-O3 | Panic safety | Dedicated `release-ffi` profile overrides `panic = "abort"` → `"unwind"`; `catch_unwind` wraps every `extern "C"` boundary via `trap_panic` / `trap_panic_ptr` / `trap_panic_const_ptr` / `trap_panic_void` |-| P1.5-O4 | Main-thread safety (macOS) | `require_main_thread()` guard in every build profile; worker-thread call returns `AD_RESULT_ERR_INTERNAL` with a static `'static CStr` message |+| P1.5-O4 | Main-thread safety (macOS) | No main-thread guard at the FFI boundary: AppKit-backed implementations stay callable from worker threads and the macOS adapter supplies its own autorelease pools || P1.5-O5 | Enum UB immunity | Public ABI struct fields store raw `i32`; every entry validates discriminants at the boundary via `try_from_c_enum!` || P1.5-O6 | Out-param zeroing before any guard | Every fallible entry zeroes `*out` before pointer / UTF-8 / main-thread checks, so a worker-thread early return never leaves a stale caller buffer || P1.5-O7 | Sigstore build-provenance | `actions/[email protected]` signs every release artifact; consumers verify with `gh attestation verify <file> --repo <owner>/agent-desktop` |@@ -650,7 +624,7 @@ crates/ffi/├── include/│ └── agent_desktop.h # committed, drift-checked against the OUT_DIR output; AD_ABI_VERSION_MAJOR = 5├── src/ # ad_* extern "C" entrypoints, organized by domain-│ ├── types/ # 34 one-type-per-file modules (AdAction, AdRect, AdExactWindowList, ...)+│ ├── types/ # one-type-per-file modules (AdAction, AdRect, AdExactWindowList, ...)│ ├── convert/ # string / rect / window / app / surface / notification helpers│ ├── tree/ # BFS flat-tree layout (flatten.rs, get.rs, free.rs)│ ├── actions/ # conversion, resolve, execute, result, native_handle@@ -658,15 +632,13 @@ crates/ffi/│ ├── apps/ windows/ input/ screenshot/ surfaces/ notifications/ observation/│ ├── error.rs # AdResult, errno-style TLS last-error (message/suggestion/platform_detail)│ ├── ffi_try.rs # panic boundary helpers (trap_panic_*)-│ ├── enum_validation.rs # try_from_c_enum! macro, fuzz tests-│ └── main_thread.rs # require_main_thread() guard+│ └── enum_validation.rs # try_from_c_enum! macro, fuzz tests├── tests/-│ ├── c_abi_harness.rs # raw extern "C" decls, enum fuzzing, out-param zeroing, null tolerance+│ ├── c_abi_layout.rs # struct layout and ABI constants│ ├── c_header_compile.rs # shells out to `cc` to verify every AD_* constant is usable from C│ ├── c_abi_passthrough.rs # Family-B command entrypoints vs stub adapter (ffi-passthrough CI job)+│ ├── cdylib_panic_probe.rs # panic boundary on the release-ffi profile│ └── error_lifetime.rs # last-error pointer stability across successful follow-up calls-└── examples/- └── panic_spike.rs # demonstrates panic boundary on the release-ffi profile```**Command-backed entrypoints** (`crates/ffi/src/commands/`, all 8 hand-written today):@@ -682,7 +654,7 @@ crates/ffi/| `version.rs` | `ad_version` || `wait.rs` | `ad_wait` |-`envelope_out.rs` and `timeout.rs` in the same directory are shared helpers, not entrypoints; `mod.rs` is module glue. The `ffi-passthrough` CI job exercises the original five Family-B entrypoints (`ad_snapshot`, `ad_status`, `ad_wait`, `ad_execute_by_ref`, `ad_version`) plus `ad_init` / `ad_destroy` / `ad_check_permissions` against the stub adapter; `ad_execute_by_ref_timeout`, `ad_trace_export`, and `ad_trace_show` joined the entrypoint set afterward.+`envelope_out.rs` and `timeout.rs` in the same directory are shared helpers, not entrypoints; `mod.rs` is module glue. The `ffi-passthrough` CI job exercises the original five Family-B entrypoints (`ad_snapshot`, `ad_status`, `ad_wait`, `ad_execute_by_ref`, `ad_version`) plus `ad_init` / `ad_adapter_destroy` / `ad_check_permissions` against the stub adapter; `ad_execute_by_ref_timeout`, `ad_trace_export`, and `ad_trace_show` joined the entrypoint set afterward.`wait`'s core event-wait mode (`--event` / `--window-id`) is intentionally **not** exposed over FFI in this release — `wait_args_from_ffi` (`crates/ffi/src/types/wait_args.rs`) always forwards `event: None` and `window_id: None` to core, documented inline.@@ -714,10 +686,10 @@ Regular `release` profile keeps `panic = "abort"` for the CLI binary, so a panicCurrent gates in `.github/workflows/ci.yml`:-- `cargo build --profile release-ffi -p agent-desktop-ffi` + FFI integration suites (`c_abi_harness`, `c_header_compile`, `error_lifetime`) inside the main `test` job (macos-latest)+- `cargo build --profile release-ffi -p agent-desktop-ffi` + FFI integration suites (`c_abi_layout`, `c_header_compile`, `error_lifetime`) inside the main `test` job (macos-latest)- `ffi-python-smoke` (macos-latest) — Python ctypes smoke harness (`tests/ffi-python/smoke.py`) against a dylib built with the `stub-adapter` feature- `ffi-header-drift` (macos-latest) — `cbindgen --verify` (pinned 0.29.4) against the committed header; exits non-zero on any diff-- `ffi-panic-guard` (macos-latest) — asserts `panic = "unwind"` in `Cargo.toml` and runs the `panic_spike` example to prove `catch_unwind` survives the `release-ffi` profile+- `ffi-panic-guard` (macos-latest) — asserts `panic = "unwind"` in `Cargo.toml` and runs `crates/ffi/tests/run_cdylib_panic_probe.sh` to prove `catch_unwind` survives the `release-ffi` profile- `ffi-passthrough` (ubuntu-latest) — `--test c_abi_passthrough --features stub-adapter` confirms the command entrypoints round-trip against the stub adapterThere is no `ffi-codegen-drift` job. An earlier draft of this document described one; it does not exist because there is no codegen step to drift-check yet — see Gap Status below.@@ -754,7 +726,7 @@ There is no `ffi-codegen-drift` job. An earlier draft of this document described## Phase 1.6 — Playwright-grade Foundation Contract (Completed)-**Status: Completed** — unreleased on `feat/foundation-playwright-grade-contract` (PR #93, `feat!`); will cut the next minor per the pre-1.0 versioning policy in `CLAUDE.md`.+**Status: Completed** — shipped in v0.5.0 (PR #93, `feat!`).Phase 1.6 is a breaking hardening pass over the Phase 1 contracts, modeled on Playwright's actionability/auto-wait discipline. It does not add a platform or a command surface — every change lands in `crates/core/` (plus the macOS backfill in the same PR) and tightens what the existing 58 command names guarantee. Twenty units (U0–U19) shipped; Windows and Linux (Phase 2/3) inherit this contract rather than re-deriving it.@@ -799,16 +771,16 @@ Every command that emits or accepts a ref now uses the snapshot-qualified form `Phase 2 (Windows) and Phase 3 (Linux) do not ship as one monolithic implementation PR. Each platform ships as a sequence of dependency-ordered sub-phases against its own integration branch.-- One integration branch per platform: `feat/windows-adapter`, later `feat/linux-adapter`. **The integration branch is the base for everything that platform does.** Every sub-phase branch is cut from it and merges back into it — never from or into `main`. `main` stays the macOS-GA line for the entire duration of the platform's phase; it receives the platform only once, at the end, as the single promotion described below. Rebasing a sub-phase onto `main` mid-phase, or opening a sub-phase PR against `main`, is a process error.+- One integration branch per platform: `feat/windows-adapter`, promoted to `main` in v0.10.0, then `feat/linux-adapter`. **The integration branch is the base for everything that platform does.** Every sub-phase branch is cut from it and merges back into it — never from or into `main`. `main` stays the released line for the entire duration of the platform's phase; it receives the platform only once, at the end, as the single promotion described below. Rebasing a sub-phase onto `main` mid-phase, or opening a sub-phase PR against `main`, is a process error.- Each sub-phase is one PR into the integration branch, sized at or under 2,000 changed lines of hand-written product code (excluding `Cargo.lock`, the generated FFI header, vendored fixtures, and committed evidence artifacts — probe corpora and their captures, tree-dump censuses, and dogfood reports), reviewed on its own. The evidence exclusion states what practice already applies: 2.0 landed 21,048 insertions, 2.1 landed 4,921 against a ~1.3k estimate, and 2.2 landed 8,244, each overwhelmingly evidence rather than product code. A sub-phase whose *product code* exceeds the cap says so in its plan with the reason, rather than the cap being quietly ignored. Sub-phase branches are named `feat/windows-<sub-phase>-<slug>` after the sub-phase's own number (e.g. `feat/windows-2.0-probes`, `feat/windows-2.12.1-window-identity`) so the base relationship is legible from the branch name alone. A sub-phase inserted between two existing numbers takes a third component rather than renumbering its successors, which would silently change what an already-referenced number means — the same move Phase 1.5 and Phase 1.6 made at phase level.- **Lifecycle per sub-phase:** plan (via `ce-plan`, written to `docs/plans/`) → implement → per-sub-phase review → merge to the integration branch. There is explicitly **no brainstorming stage** — this document is the finalized product contract; sub-phase planning documents implementation, not product scope.- **The workspace stays green at every merge.** Unimplemented capabilities return `not_supported()`; the CLI ships honest `PLATFORM_NOT_SUPPORTED` envelopes on the target OS until the capability lands. No sub-phase merge may regress `main`'s CI.- **Evidence-first rule:** adapter decisions are anchored in committed probe outputs — raw UIA / AT-SPI dumps checked in alongside the sub-phase plan — never docs-only assumptions about how a platform API behaves. The exploration sub-phases (2.0, 3.0) build the initial corpus; later sub-phases extend it.- **Source-of-truth feedback rule:** this document was authored from documentation research in a single pass; the exploration sub-phases (2.0, 3.0) exist because platform reality outranks documentation. When a committed probe proves a documented approach behaves differently on the real platform — an API that answers differently, a pattern that is unavailable, an event that never fires — the finding ledger entry and the amendment to this document land **in the same PR**. The source of truth tracks proven platform behavior; it is never defended against evidence.- **No convenience deferral.** The whole platform implementation lands inside its own phase's sub-phases — Windows under Phase 2, Linux under Phase 3. Scope may move *between* sub-phases of that phase; it may not move out of the phase because it is hard, large, or late. The only sanctioned deferral is **proven impossibility**: the platform genuinely cannot do it, evidenced by a probe row in that platform's findings ledger, and the command then ships an honest structured `PLATFORM_NOT_SUPPORTED` (or the applicable code) with `platform_detail` rather than a silent gap. Core features — observation, interaction, input, lifecycle, capture, clipboard, waits, and the shell surfaces the OS does expose — are a must, never a stretch.-- **Integration branch → main:** only after every sub-phase for that platform has merged **and the platform is production-solid as a whole** — not sub-phase-by-sub-phase, and not early because the branch has grown long-lived. Promotion to `main` runs a full multi-agent review of the whole branch, live e2e (both headless and headed) on the platform runner, a performance-baseline comparison against `main`, and the standard verification contract. It lands as one release-noted `feat!` merge — the same conventional-commit discipline as PR #93. Until that merge, `main` ships macOS only and makes no Windows claim.-- **The promotion's release note must carry one behavioural change core already made.** `AppError::code` now answers `PERM_DENIED` for an io error whose kind is `PermissionDenied`; on `main` today every io error still answers `INTERNAL`. The new code is the honest one — `INTERNAL` says the tool broke and carries no action — but a consumer branching on `INTERNAL` to catch a permission failure stops matching the moment Windows lands. `main` has never shipped the new mapping, so there is nothing to deprecate and no alias to add; what is required is that the `feat!` promotion says so in its release note rather than letting a caller discover it. Introduced by `07ccbddc`.-- **Windows first.** Phase 2 (2.x) completes before Phase 3 (3.x) starts; Linux reuses the same sub-phase template with AT-SPI2/D-Bus substituted for UIA.+- **Integration branch → main:** only after every sub-phase for that platform has merged **and the platform is production-solid as a whole** — not sub-phase-by-sub-phase, and not early because the branch has grown long-lived. Promotion to `main` runs a full multi-agent review of the whole branch, live e2e (both headless and headed) on the platform runner, a performance-baseline comparison against `main`, and the standard verification contract. It lands as one release-noted `feat!` merge — the same conventional-commit discipline as PR #93. Until that merge, `main` makes no claim for that platform.+- **The Windows promotion's release note carried one behavioural change core had already made.** `AppError::code` answers `PERM_DENIED` for an io error whose kind is `PermissionDenied`, where every io error used to answer `INTERNAL`; the FFI return code and `ad_last_error` answer the same. v0.10.0 lists it under `BREAKING CHANGE`, because a consumer branching on `INTERNAL` to catch a permission failure stops matching. Introduced by `07ccbddc`.+- **Windows first.** Phase 2 (2.x) is complete; Phase 3 (3.x) starts after it, and Linux reuses the same sub-phase template with AT-SPI2/D-Bus substituted for UIA.Every sub-phase below follows the same rendering shape: **Goal** (one or two sentences), **Scope** (what lands), **Key APIs** (platform surface touched), **Depends on** (prior sub-phase), **Exit criteria** (what proves it's done), **Est. PR size**.@@ -816,7 +788,7 @@ Every sub-phase below follows the same rendering shape: **Goal** (one or two sen## Phase 2 — Windows Adapter-**Status: In progress** — the entire Windows implementation is delivered as sub-phases 2.0–2.17 into the `feat/windows-adapter` integration branch per the [Platform Delivery Model](#platform-delivery-model--sub-phases-and-integration-branches), under its no-convenience-deferral rule: scope moves between these sub-phases, never out of Phase 2. v0.6.0 landed the prerequisite Windows test lane and removed core's unexecutable Win32 layer. This section is the public objective catalogue, the sub-phase implementation contract, and the preserved research (API mappings, capability maps, notification/tray approaches, Electron guidance) that grounds it.+**Status: Completed** — v0.10.0 (2026-10-18). The entire Windows implementation was delivered as sub-phases 2.0–2.17 into the `feat/windows-adapter` integration branch per the [Platform Delivery Model](#platform-delivery-model--sub-phases-and-integration-branches), under its no-convenience-deferral rule, and promoted to `main` as one `feat!` merge. v0.6.0 landed the prerequisite Windows test lane and removed core's unexecutable Win32 layer. This section is the public objective catalogue, the sub-phase implementation contract, and the preserved research (API mappings, capability maps, notification/tray approaches, Electron guidance) that grounds it.### Core invariants (research-driven — from the Phase 2 plan's Headless-First Invariant)@@ -1502,10 +1474,10 @@ System tray interaction is built from scratch here.**Promotion checklist — the ordered steps that merge `feat/windows-adapter` into `main`.**-This is not run by this sub-phase. It is run once, later, by whoever carries the-promotion, and it is written to be executable without reading any sub-phase plan.-The promotion is **one release-noted `feat!` merge of the whole integration-branch**, not a series of sub-phase merges, and it is what closes Phase 2.+This is not run by this sub-phase. It ran once, for the v0.10.0 promotion+(`483a31d0`), and it is written to be executable without reading any sub-phase+plan. The promotion is **one release-noted `feat!` merge of the whole integration+branch**, not a series of sub-phase merges, and it closed Phase 2.1. **Confirm the branch is complete.** Every sub-phase 2.0 through 2.17 has mergedinto `feat/windows-adapter`, and the branch is even with or ahead of `main` with@@ -1580,7 +1552,7 @@ branch**, not a series of sub-phase merges, and it is what closes Phase 2.before writing the message. There are three:- `get --property text` became role-conditional, returning the element's valuefor `textfield`, `combobox`, `listbox`, `datefield` and `timefield` and its- accessible name for every other role, where it previously returned the value+ accessible name for every other role, each falling back to the other when empty, where it previously returned the valuefor all of them. It is a core change with no platform branch, so it lands onmacOS too.- The FFI ABI major is 5. The legacy entrypoints that each have an `*_exact`@@ -1748,6 +1720,7 @@ windows-sys = { version = "0.61", features = ["Win32_Security_Authorization","Win32_System_ApplicationInstallationAndServicing","Win32_System_LibraryLoader",+ "Win32_System_SystemInformation","Win32_System_Threading","Win32_System_Diagnostics_ToolHelp","Win32_System_DataExchange",@@ -1784,7 +1757,7 @@ screencapturekit = "1.5"- Automation permission: `permissions` reports `granted`, `denied`, or `unknown` without prompting; explicit requests run in the bounded isolated helper, while native `close-app` needs no Apple Event authorization**FFI parity tests (P2-O16):**-- `ad_abi_version()` returns a packed `u32` matching the Cargo version; a consumer built against an older ABI major refuses to load a newer one+- `ad_abi_version()` returns `AD_ABI_VERSION_MAJOR` (the ABI major, currently 5), which is independent of the Cargo version; `ad_init(expected_major)` returns `ErrInvalidArgs` when the consumer's expected major differs from the dylib's, older or newer- `ad_snapshot` writes a refmap and the same qualified ref resolves via `ad_execute_by_ref` without a prior CLI snapshot on disk- `ad_execute_by_ref(adapter, "@s8f3k2p9:e5", &action, policy, &out)` with a click action produces identical `AdActionResult` to `ad_resolve_element_exact` + `ad_execute_action`- `ad_set_log_callback` receives at least one `tracing::debug!` event during an `ad_get_tree_exact` call@@ -1803,7 +1776,7 @@ Integration-level tests (Explorer/Notepad/Settings snapshots, click/type/clipboa- [ ] GitHub Release notes document Windows support and installation**Skill Update:**-- [x] Create `skills/agent-desktop-windows/`: SKILL.md plus permissions-and-elevation, chromium-and-electron, and troubleshooting references; capability claims are enforced against the adapter by a binary-crate test, and a core-crate coverage test fails when any `.md` under `skills/` is not served from the embedded skills table+- [x] Create `skills/agent-desktop-windows/`: SKILL.md plus permissions-and-elevation, chromium-and-electron, shell-and-overlay, and troubleshooting references; capability claims are enforced against the adapter by a binary-crate test, and a core-crate coverage test fails when any `.md` under `skills/` is not served from the embedded skills table- [x] Core `SKILL.md` routes to the platform skill for the running OS through `agent-desktop skills get platform`; `skills list` marks each platform skill with `platform` and `current`- [x] Update `workflows.md`: First-Time Setup covers both platforms; one Windows-specific workflow example added@@ -1818,7 +1791,7 @@ Integration-level tests (Explorer/Notepad/Settings snapshots, click/type/clipboa**Goal:** Bring the Windows adapter to the multi-agent cursor contract macOS now ships, and close the one session hazard that contract exposes.-**Status:** the identity model and the macOS implementation shipped on `main` in the 0.8.5 line; the Windows port ships on this branch. The session hazard in the last bullet is closed in core, for both adapters, by mandatory qualified refs.+**Status:** the identity model and the macOS implementation shipped on `main` in the 0.8.5 line; the Windows port shipped in v0.10.0. The session hazard in the last bullet is closed in core, for both adapters, by mandatory qualified refs.**The identity axis is settled and it is `(session, agent)`.** Agents share a session — its snapshot namespace, its trace, its manifest — and each carries a stable id supplied by the harness through the global `--agent-id` flag or `AGENT_DESKTOP_AGENT_ID`. `session start --cursor --multi-agent` turns the mode on. A per-agent `cursor-overlay enable` saves a presentation profile for that agent and starts nothing; an agent with no profile inherits the session's. Desktop UI actions require the id in this mode; observation, clipboard and administration do not.@@ -1837,7 +1810,7 @@ Integration-level tests (Explorer/Notepad/Settings snapshots, click/type/clipboa## Phase 3 — Linux Adapter-**Status: Planned** — delivered as sub-phases 3.0–3.15 into the `feat/linux-adapter` integration branch, mirroring the Windows sub-phase template ([Platform Delivery Model](#platform-delivery-model--sub-phases-and-integration-branches)) numbered slot for numbered slot, with AT-SPI2/D-Bus specifics substituted for UIA. Windows's §2.12.1 has no Linux counterpart in the mirror: it answers a Win32 handle-table hazard, and Linux gains an equivalent only if the same recycled-identifier hazard is measured on X11 or Wayland. Phase 3 begins only after Phase 2 (2.0–2.15) has merged to `main`.+**Status: Planned** — delivered as sub-phases 3.0–3.15 into the `feat/linux-adapter` integration branch, mirroring the Windows sub-phase template ([Platform Delivery Model](#platform-delivery-model--sub-phases-and-integration-branches)) numbered slot for numbered slot, with AT-SPI2/D-Bus specifics substituted for UIA. Windows's §2.12.1 has no Linux counterpart in the mirror: it answers a Win32 handle-table hazard, and Linux gains an equivalent only if the same recycled-identifier hazard is measured on X11 or Wayland. Phase 3 begins only after Phase 2 (2.0–2.17) has merged to `main`; that precondition is met (v0.10.0).Phase 3 completes the three-platform story. The Linux adapter implements the original adapter surface **plus** every cross-platform extension landed in Phase 2 (event subscriptions via `watch`, text ranges, modern screenshot, stable-selector fields, the predeclared toolbar and shell-surface vocabulary, new Action variants, new ErrorCode variants). Each has a canonical AT-SPI2 / D-Bus / Wayland-portal implementation. Core engine, trait contract, command-registry, CLI dispatch, FFI wrappers, and MCP transport are all untouched — per the [Command Surface Architecture](#command-surface-architecture-dry-invariant) invariant, Phase 3 is **pure `PlatformAdapter` trait implementation code**, nothing else. No new command files, no CLI dispatch changes, no FFI wrappers, no MCP tool registrations. "Foundation contract" below means Phase 1 + Phase 1.6 + whatever Phase 2 landed on the trait — Phase 3 implements against that settled contract, it does not renegotiate it.@@ -2144,7 +2117,7 @@ Same rendering shape, same [Cross-cutting sub-phase DoD](#cross-cutting-sub-phas**Scope:**- FFI real-adapter path validated on Linux (non-stub tests) for both x86_64 and aarch64-- npm `postinstall.js` gains `linux-x64`/`linux-arm64` branches+- npm `PLATFORMS` entries `linux-x64`/`linux-arm64` in `npm/lib/platform.js` flip from `released: false` to `released: true` (postinstall and the wrapper already consume the table; the Linux entries and target triples already exist)- Release matrix: CLI binary added for `x86_64-unknown-linux-gnu` and `aarch64-unknown-linux-gnu`, reusing the runners Phase 1.5 already builds the FFI cdylib on- `skills/agent-desktop-linux/SKILL.md` — see Skill Update below- README platform table: Linux column → **Yes**; minimum glibc (2.35, Ubuntu 22.04 baseline) documented@@ -2282,7 +2255,7 @@ Integration-level tests (Files/Terminal/Settings snapshots, click/type/clipboard**Release:**- [ ] Prebuilt Linux CLI binary added to `.github/workflows/release.yml` matrix for `x86_64-unknown-linux-gnu` and `aarch64-unknown-linux-gnu` (Phase 1.5 already builds the FFI cdylib for both triples on the same runners — Phase 3 reuses those runners)-- [ ] npm `postinstall.js` gains `linux-x64` / `linux-arm64` branches+- [ ] npm `PLATFORMS` entries `linux-x64` / `linux-arm64` in `npm/lib/platform.js` flip to `released: true`, with `scripts/check-npm-package.js` agreeing with the release build matrix- [ ] Every new `ad_*` Linux implementation from P3-O9 / O10 / O11 is covered by the existing FFI drift check + Sigstore attestation pipeline- [ ] GitHub Release notes document Linux support, minimum glibc (2.35, Ubuntu 22.04 baseline), display-server requirements, and Flatpak/Snap compatibility@@ -2313,7 +2286,7 @@ By Phase 4 the CLI already covers the shared command surface on three platforms,| ID | Objective | Metric ||----|-----------|--------|| P4-O1 | MCP server mode via `--mcp` | Responds to MCP `initialize` handshake, reports capabilities, per-host hello-world passes |-| P4-O2 | All commands as MCP tools | `tools/list` returns all 58 shipped command names as tools (54 operational + 4 fail-closed, matching the CLI surface 1:1) with JSON Schemas generated from the CLI arg structs via `schemars`; tool names prefixed `desktop_` |+| P4-O2 | All commands as MCP tools | `tools/list` returns every shipped command name as a tool (operational and fail-closed alike, matching the CLI surface 1:1) with JSON Schemas generated from the CLI arg structs via `schemars`; tool names prefixed `desktop_` || P4-O3 | Claude Desktop + Cursor + VS Code + Gemini CLI + MS Agent Framework validated | Each host invokes tools to control a desktop app end-to-end on all three platforms; repo ships `mcp.json` / `claude_desktop_config.json` / `.cursor/mcp.json` examples per host || P4-O4 | Tool annotations | `readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint` on every tool; Claude Desktop surfaces destructive tools with a confirmation prompt || P4-O5 | Ref-based MCP tool shape (Playwright-MCP idiom) | Tools take `{ref: "@s8f3k2p9:e5"}` (the qualified snapshot-ref form) not raw `element_handle`, matching Playwright MCP's ref idiom so agents can swap between the two without relearning selectors. Tree snapshots return as MCP resources with refs inline |@@ -2755,7 +2728,7 @@ Phase 5 spans are OpenTelemetry-compliant so `agent-desktop trace export <uuid>| Compatibility | Tested against target app matrix: Finder, TextEdit, Xcode, VS Code, Chrome, Slack (macOS); Explorer, Notepad, Settings, VS Code, Edge (Windows); Nautilus, Terminal, Firefox, VS Code (Linux). || Distribution | Single binary per platform. No runtime dependencies for the CLI. FFI cdylib tarballs signed via Sigstore (already shipping as of Phase 1.5). Formula / manifest verify Sigstore attestation before installing (P5-O10). || Documentation | README, CLI reference, MCP reference, per-platform setup guides, troubleshooting, audit-log format reference, policy-file reference, OpenTelemetry trace schema. |-| FFI stability | Header drift check green on every PR. ABI version exported via `ad_abi_version()` (major currently 4, append-only since Phase 1.6). Pre-1.0: minor version bump for any public struct field add; major version bump for any removed or changed signature. |+| FFI stability | Header drift check green on every PR. ABI version exported via `ad_abi_version()` (major currently 5, append-only between majors). Pre-1.0: minor version bump for any public struct field add; major version bump for any removed or changed signature. |### Performance Optimizations@@ -2929,7 +2902,7 @@ A rule this document presents as core-owned is canonical only if a production pa| Phase 1 | `macos-latest` (tests + CLI build) + `ubuntu-latest` (`fmt` job) || Phase 1.5 | Same as Phase 1 on PRs; release workflow fans out to `macos-latest` × 2 darwin arches + `ubuntu-22.04` + `ubuntu-22.04-arm` + `windows-latest` for the FFI matrix || Phase 1.6 | `ci.yml`: `fmt` (ubuntu-latest), `msrv` (ubuntu-latest, Rust 1.89.0), `platform-check` (matrix Linux/Windows/macOS, `cargo check` only), `test` (macos-latest, full suite), `ffi-python-smoke`, `ffi-header-drift`, `ffi-panic-guard`, `ffi-passthrough` (ubuntu-latest). Outside `ci.yml`: `native-e2e.yml` (self-hosted macOS, workflow_dispatch), `codeql.yml`, `supply-chain.yml` |-| v0.6.0 (current) | Real `test-windows` (`windows-latest`) and `test-linux` (`ubuntu-latest`) lanes execute `cargo test -p agent-desktop-core -p agent-desktop-{windows,linux} --lib` on every PR, alongside the macOS `test` job — core's platform-conditional code is now executed, not merely type-checked, on all three OSes. Hot-path performance baseline remains a per-PR Definition-of-Done review step (macOS: `scripts/perf-baseline-compare.sh`; Windows: probe corpus cost methodology, A15-13 / A18-7), not a blocking job |+| v0.6.0 (landed) | Real `test-windows` (`windows-latest`) and `test-linux` (`ubuntu-latest`) lanes execute `cargo test -p agent-desktop-core -p agent-desktop-{windows,linux} --lib` on every PR, alongside the macOS `test` job — core's platform-conditional code is now executed, not merely type-checked, on all three OSes. Hot-path performance baseline remains a per-PR Definition-of-Done review step (macOS: `scripts/perf-baseline-compare.sh`; Windows: probe corpus cost methodology, A15-13 / A18-7), not a blocking job || Phase 2 | The Windows test lane already exists as of v0.6.0; sub-phase 2.1 extends it to the adapter surface (clippy over `agent-desktop-windows`, binary-crate tests, size check); the self-hosted interactive Windows runner is registered at 2.15, the branch-final gate — the owner declined registration at 2.12 on a public-repository security ground (§2.12 Key Decisions), so 2.12's own live gate runs locally under its new `DesktopLease` instead || Phase 3 | The Linux test lane already exists as of v0.6.0; sub-phase 3.1 extends it to the adapter surface; an interactive Ubuntu GNOME runner is added for AT-SPI2/shell integration tests at 3.12 || Phase 4 | macOS + Windows + Ubuntu (+ MCP protocol tests) |diff --git a/docs/runbooks/windows-self-hosted-runner.md b/docs/runbooks/windows-self-hosted-runner.mdindex 57f782c03..804f4bacc 100644--- a/docs/runbooks/windows-self-hosted-runner.md+++ b/docs/runbooks/windows-self-hosted-runner.md@@ -47,8 +47,8 @@ that gets RDP'd into and left locked.## Trigger policy - `workflow_dispatch` and branch-scoped `push` only, never `pull_request`-`windows-e2e.yml` triggers on `workflow_dispatch` and on `push` to-`feat/windows-adapter`. It never triggers on `pull_request`:+A `windows-e2e.yml` workflow, if one is ever restored, must trigger only on `workflow_dispatch` and on `push` to+`feat/windows-adapter`, and never on `pull_request`:- **`pull_request` on a public repository is exactly the exposure GitHub'sown self-hosted-runner guidance warns against.** A fork's PR would run@@ -134,8 +134,8 @@ leaking into the next run's observations.## Labels-`[self-hosted, Windows, agent-desktop-e2e]` - already named by the-committed `windows-e2e.yml`. §2.15's registration allocates exactly these+`[self-hosted, Windows, agent-desktop-e2e]` - the labels the retired+`windows-e2e.yml` named. §2.15's registration allocates exactly theselabels to the interactive box; no other label is required or expected.## Capture upload is gated before it runsdiff --git a/docs/solutions/best-practices/a-test-that-cannot-fail-is-not-coverage.md b/docs/solutions/best-practices/a-test-that-cannot-fail-is-not-coverage.mdindex da120197e..38041942f 100644--- a/docs/solutions/best-practices/a-test-that-cannot-fail-is-not-coverage.md+++ b/docs/solutions/best-practices/a-test-that-cannot-fail-is-not-coverage.md@@ -122,7 +122,7 @@ None of the fixes were "delete the test":should say that, distinct from the genuinely falsifiable precedence testsbeside it.2. **Cover the reachable shape, and keep the unreachable one as a named- regression test.** `pressed_is_unproduced_for_a_button_role_at_any_toggle_state`+ regression test.** `button_role_with_toggle_state_but_no_pressed_bit_emits_no_pressed`stays, with a doc comment stating its input is unreachable and pointing at`toggle_state_on_a_switch_role_emits_checked_and_indeterminate`, which opensby asserting `is_toggleable_role("switch")` so the reachable case is pinneddiff --git a/docs/solutions/best-practices/a-verification-gate-is-code-and-needs-its-own-test.md b/docs/solutions/best-practices/a-verification-gate-is-code-and-needs-its-own-test.mdindex 10ee4af7c..7353d8493 100644--- a/docs/solutions/best-practices/a-verification-gate-is-code-and-needs-its-own-test.md+++ b/docs/solutions/best-practices/a-verification-gate-is-code-and-needs-its-own-test.md@@ -113,7 +113,7 @@ regression in the shipped rule is a regression the fixture can see.These gates look like they run everywhere, and they do not. Both`check-no-phase-references.sh` and `check-rust-file-size.sh` are steps of the-macOS-only `Test` job in `.github/workflows/ci.yml` (lines 190-194); the Linux+macOS-only `Test` job in `.github/workflows/ci.yml` (lines 131-134); the Linuxand Windows CI lanes (`test-linux`, `test-windows`) never invoke them.`.githooks/pre-commit` used to be the reason neither script ran on theWindows dev box at all, back when its documented invocation there was@@ -126,7 +126,7 @@ matching `MINGW*|MSYS*|CYGWIN*|Windows_NT` for the Windows dev box (lines84-100) — but that scope only ever changes which cargo packages the later`clippy` and `test` steps build against; `check-rust-file-size.sh` and`check-no-phase-references.sh` both run ahead of it, unconditionally, on-every host (lines 127-128). The two scripts are therefore no longer+every host (lines 116-117). The two scripts are therefore no longer"authored under GNU, executed only under BSD": the Windows dev box's own GitBash now runs them on every Rust commit, in the same GNU userland they areauthored and edited in, and the macOS CI job is the one place they still@@ -204,7 +204,7 @@ instead of discoverable only when a real commit happens to exercise the gap.docs, so the body skipped on every run and reported green forever —indistinguishable, again, from a test that ran and found nothing wrong. Thefix set the variable on the CI lane that owns staging the fixture- (`.github/workflows/ci.yml:415-417`) and added+ (`.github/workflows/ci.yml:357` and `:504`) and added`the_windows_lane_stages_the_live_wpf_host`(`crates/windows/src/tree/envelope_live_tests.rs:109-131`), which reads`ci.yml` itself and asserts the assignment sits on the step that runs thediff --git a/docs/solutions/best-practices/deduplicate-ref-allocator-via-config-struct-2026-04-14.md b/docs/solutions/best-practices/deduplicate-ref-allocator-via-config-struct-2026-04-14.mdindex 5c7bd1933..e00ab8b3b 100644--- a/docs/solutions/best-practices/deduplicate-ref-allocator-via-config-struct-2026-04-14.md+++ b/docs/solutions/best-practices/deduplicate-ref-allocator-via-config-struct-2026-04-14.md@@ -48,7 +48,7 @@ path prefix, then updates only that root's descendants in the stored map.one case the Prevention rule below admits: its output contract genuinelydiffers, and its rustdoc says so. It applies bounds omission, compact collapse,and interactive-only pruning to a raw adapter tree and never allocates a ref,-because the FFI `ad_get_tree` path (`crates/ffi/src/tree/get.rs`) exposes raw+because the FFI `ad_get_tree_exact` path (`crates/ffi/src/tree/get.rs`) exposes rawtrees with no ref pipeline — there is no `ref_id` for it to consult and no mapfor it to write. Its pruning decision is therefore role-based where theallocator's is ref-based.diff --git a/docs/solutions/best-practices/envelope-version-bump-contract-2026-05-13.md b/docs/solutions/best-practices/envelope-version-bump-contract-2026-05-13.mdindex b299cff97..5c8a00139 100644--- a/docs/solutions/best-practices/envelope-version-bump-contract-2026-05-13.md+++ b/docs/solutions/best-practices/envelope-version-bump-contract-2026-05-13.md@@ -71,13 +71,14 @@ is checked and, where it is wrong, corrected in the same change:- `CLAUDE.md` — success and error envelope examples and the error-object prose- `docs/phases.md` — the typed-contract objective row, the `output.rs` line inthe source-tree map, the envelope examples, and the error-object prose-- `skills/agent-desktop/SKILL.md` — the success and error envelope one-liners-- `skills/agent-desktop/references/commands-observation.md` and- `commands-system.md` — the snapshot and status envelope examples- `crates/ffi/src/commands/snapshot.rs` — the rustdoc envelope example, and`crates/ffi/include/agent_desktop.h`, which carries the same example and isregenerated rather than hand-edited+`src/cli/doc_literal_drift_tests.rs` fails when a literal in `CLAUDE.md`,+`docs/json-output.md`, `docs/phases.md` or the bug template disagrees with+`ENVELOPE_VERSION`; the prose around each literal still needs a person.+A surface that is bumped to the new number while still explaining only the oldone is the failure this checklist exists to catch: the literal and the prosedrift apart, and only the literal is easy to grep for.diff --git a/docs/solutions/developer-experience/visual-debug-snapshot-and-click-artifacts.md b/docs/solutions/developer-experience/visual-debug-snapshot-and-click-artifacts.mdindex a6dd5790d..c33e85bbc 100644--- a/docs/solutions/developer-experience/visual-debug-snapshot-and-click-artifacts.md+++ b/docs/solutions/developer-experience/visual-debug-snapshot-and-click-artifacts.md@@ -37,7 +37,7 @@ Use this when changing `src/visual_debug/` or the window-frame screenshot adapte## Examples-See [Visual debug usage](../../../skills/agent-desktop/references/commands-observation.md#visual-debug) for capture commands and viewer controls.+See the Guidance section above for capture commands and viewer controls.```bashcargo test -p agent-desktop --bin agent-desktop visual_debugdiff --git a/npm/bin/agent-desktop.js b/npm/bin/agent-desktop.jsindex 97b892cd5..bd4031f1f 100755--- a/npm/bin/agent-desktop.js+++ b/npm/bin/agent-desktop.js@@ -31,7 +31,8 @@ function main() {console.error(`Error: Native binary not found for ${platform()}-${arch()}`);console.error(`Expected: ${binaryPath}`);console.error('');- console.error('This usually means the install ran with --ignore-scripts');+ console.error('This usually means the install ran with --ignore-scripts,');+ console.error('the package manager blocked the postinstall script (npm: allow-scripts=agent-desktop),');console.error('or its postinstall download step failed.');console.error('Try reinstalling:');console.error(' npm install -g agent-desktop');diff --git a/npm/package.json b/npm/package.jsonindex 043f0c028..614c0c328 100644--- a/npm/package.json+++ b/npm/package.json@@ -30,6 +30,7 @@"cli","agent","macos",+ "windows","a11y"]}diff --git a/probes/windows/FINDINGS.md b/probes/windows/FINDINGS.mdindex 2ab1300e1..4fb20feb5 100644--- a/probes/windows/FINDINGS.md+++ b/probes/windows/FINDINGS.md@@ -16,7 +16,7 @@ safety envelope) and `docs/phases.md` Phase 2 (the contract these rows are grade| `stack` | `managed` (.NET `System.Windows.Automation`), `uia3-com` (hand-declared `CUIAutomation8` shim), or `n/a` (toolchain and session-evidence rows) || `scope` | `api-contract` = product-wide under KTD2's forward-compatibility rule. `app/provider` = specific to this environment and these app versions. Downstream sub-phases read this column to know what generalizes || `verdict` | `CONFIRMS`, `CONTRADICTS`, `NEW-EDGE`, `DEFERRED`. There are no `UNKNOWN` rows (R5) |-| `action` | what the finding obliges. `DEFERRED` rows carry `closure: 2.<n>` - the Phase 2 sub-phase that closes them |+| `action` | what the finding obliges. `DEFERRED` rows carry `closure: 2.<n>` - the Phase 2 sub-phase that closes them - or `closure: post-phase-2` for work measured out of Phase 2's reach |KTD1 governs stack authority: where a `managed` row and a `uia3-com` row disagree, the COMrow is the product-relevant one, because the Rust adapter wraps a UIA3 COM client. Managed@@ -734,7 +734,7 @@ The five `CONTRADICTS` rows are A1-5, A6-1, A8-3, A11-1 and A11-3; each appears`13-ledger-check.ps1` parses this file and fails loud with a nonzero exit unless: everyevidence area that carries a `## Area` heading carries at least one row; no verdict is`UNKNOWN` or otherwise outside the four-value vocabulary; every `DEFERRED` row names a-Phase 2 closure sub-phase as `closure: 2.<n>`; every row carries a non-empty `stack` and+Phase 2 closure sub-phase as `closure: 2.<n>` or `closure: post-phase-2`; every row carries a non-empty `stack` and`scope` drawn from the allowed sets; every row id is unique; and every hunk this file'sindex names still exists in the live `git diff -U0 main -- docs/phases.md`. The reversedirection - every live hunk being named here - is measured and reported, not enforced. It runs as part of `run-all.ps1`diff --git a/release-please-config.json b/release-please-config.jsonindex 08781807c..23ea0093c 100644--- a/release-please-config.json+++ b/release-please-config.json@@ -17,6 +17,22 @@"type": "json","path": "npm/package.json","jsonpath": "$.version"+ },+ {+ "type": "generic",+ "path": "skills/agent-desktop/SKILL.md"+ },+ {+ "type": "generic",+ "path": "skills/agent-desktop-ffi/SKILL.md"+ },+ {+ "type": "generic",+ "path": "skills/agent-desktop-macos/SKILL.md"+ },+ {+ "type": "generic",+ "path": "skills/agent-desktop-windows/SKILL.md"}]}diff --git a/scripts/lib/capture-redaction-cli.psm1 b/scripts/lib/capture-redaction-cli.psm1index e3d8e9f03..7cdf8deba 100644--- a/scripts/lib/capture-redaction-cli.psm1+++ b/scripts/lib/capture-redaction-cli.psm1@@ -8,9 +8,9 @@domain SIDs). It has no idea that agent-desktop's own JSON envelopecarries real target content in a small, fixed set of fields regardlessof which machine produced it: `name`, `value`, `description`, `title`,- `app_name`, `body`, `attribution` (the serialized NotificationInfo+ `app_name`, `body`, `attribution` (the element fields plus the serialized NotificationInfofield names the shell/notification surfaces publish), every element of- a `path` array (crates/core/src/commands/find.rs:194+ a `path` array (crates/core/src/commands/find.rs:222and live_locator/select.rs's node_label both populate it as"role:label"), every element of an `actions` array (notificationverb-button labels), `error.details.checks[].occluder.name`, and any literaldiff --git a/scripts/lib/e2e-windows-contract-rules-misc.psm1 b/scripts/lib/e2e-windows-contract-rules-misc.psm1index ff1e2e164..76c301c0b 100644--- a/scripts/lib/e2e-windows-contract-rules-misc.psm1+++ b/scripts/lib/e2e-windows-contract-rules-misc.psm1@@ -2,11 +2,12 @@<#e2e-windows-contract-rules-misc.psm1 - contract-gate rules 6, 7, 8, 11,- 12 and 14: Write-Verdict reachability, environment-identity protection,- scenario leg/skip declarations, the ConvertFrom-Json ban, the- --property text|name / stub-reachability pair, and the automatic-- variable-assignment ban. Rule 13 (the 400-line cap) needs no AST and is- a file-length check the orchestrator applies directly. Split from the+ 12, 14 and 15: Write-Verdict reachability, environment-identity+ protection, scenario leg/skip declarations, the ConvertFrom-Json ban, the+ --property text|name / stub-reachability pair, the automatic-+ variable-assignment ban, and the measured-and-discarded leg ban. Rule 13+ (the 400-line cap) needs no AST and is a file-length check the+ orchestrator applies directly. Split from theother rule groups purely to keep every gate module under the 400-linecap.#>diff --git a/scripts/run-windows-e2e-ci.ps1 b/scripts/run-windows-e2e-ci.ps1index 0fd9066da..76310976e 100644--- a/scripts/run-windows-e2e-ci.ps1+++ b/scripts/run-windows-e2e-ci.ps1@@ -1,8 +1,9 @@#Requires -Version 5.1<#.SYNOPSIS- The Windows analog of scripts/run-native-e2e-ci.sh: the one CI entry- point that builds and runs the exclusive tests/e2e-windows suite.+ The Windows analog of scripts/run-native-e2e-ci.sh: the operator-run+ entry point that builds and runs the exclusive tests/e2e-windows suite+ on a box holding the interactive session. No CI workflow invokes it..DESCRIPTIONMirrors run-native-e2e-ci.sh line for line in intent, including thediff --git a/skills/agent-desktop-ffi/SKILL.md b/skills/agent-desktop-ffi/SKILL.mdindex dbb78b6e0..8a25d9358 100644--- a/skills/agent-desktop-ffi/SKILL.md+++ b/skills/agent-desktop-ffi/SKILL.md@@ -1,6 +1,6 @@---name: agent-desktop-ffi-version: 0.4.1+version: 0.10.1 # x-release-please-versiontags: ffi, c-bindings, cdylib, python, swift, node, go, rust-ffirequirements:- agent-desktop-ffi@@ -167,17 +167,17 @@ to drive the pipelineredacted fields. Requires `session start` (or equivalent manifest on disk)before creating the adapter; plain session-id adapters write nothing to disk.- 2. **`ad_set_log_callback(cb)`** — installs a `tracing` subscriber layer that- delivers events as JSON to your callback. `cb` receives an int32_t level- (1=ERROR … 5=TRACE) and a `const char *msg` valid only for the duration of- the call. Pass `NULL` to unregister. The layer is installed on the first- non-null call; if a foreign global subscriber already owns the process at- that point, the install fails with `AD_RESULT_ERR_INTERNAL` and no events are- ever delivered. Sensitive field values (password, token, text, …) are- replaced with `{"redacted":true}` before formatting. A panicking callback is- caught and silently discarded. The callback may fire from threads other than- the registering thread, and may still fire briefly after a `NULL` unregister- — keep the callback and any data it captures valid for the process lifetime.+ 2. **`ad_set_log_callback(cb)`** — registers one process-wide callback that+ receives, as JSON, the `tracing` events emitted inside later `ad_*` calls;+ the FFI never installs or replaces the host process's global tracing+ subscriber. `cb` receives an int32_t level (1=ERROR … 5=TRACE) and a+ `const char *msg` valid only for the duration of the call. Pass `NULL` to+ unregister. Sensitive field values (password, token, text, …) are replaced+ with `{"redacted":true}` before formatting. The callback must not unwind+ across the C ABI: catch C++ exceptions and Rust panics inside it, because a+ violation may abort the host. The callback may fire from several host+ threads at once, and may still fire briefly after a `NULL` unregister —+ keep the callback and any data it captures valid for the process lifetime.- **Wait.** `ad_wait(adapter, args, &out)` runs the full CLI `wait` command(element-appear, window-appear, text-appear, menu-open/close, notification,diff --git a/skills/agent-desktop-ffi/references/build-and-link.md b/skills/agent-desktop-ffi/references/build-and-link.mdindex 873659c5a..ca4a4b0cf 100644--- a/skills/agent-desktop-ffi/references/build-and-link.md+++ b/skills/agent-desktop-ffi/references/build-and-link.md@@ -28,12 +28,12 @@ Every GitHub release ships prebuilt archives for:- macOS arm64 and x86_64- Linux x64 and arm64 (glibc)-- Windows x64 MSVC+- Windows x64 and ARM64 MSVC-Each archive contains the dylib/so/dll, `include/agent_desktop.h`, and+Each archive contains the dylib/so/dll (plus `lib/agent-desktop-macos-helper` on macOS and the `lib/agent_desktop_ffi.dll.lib` import library on Windows), `include/agent_desktop.h`, and`LICENSE`. Integrity: compare against `checksums.txt` in the releaseassets. Supply-chain verification: each release is signed via Sigstore-attestation — verify with `cosign verify-blob` before deploying.+attestation — verify with `gh attestation verify <file> --repo lahfir/agent-desktop` before deploying.## ABI handshake (do this first)diff --git a/skills/agent-desktop-ffi/references/error-handling.md b/skills/agent-desktop-ffi/references/error-handling.mdindex e233874a6..dfbc2d911 100644--- a/skills/agent-desktop-ffi/references/error-handling.md+++ b/skills/agent-desktop-ffi/references/error-handling.md@@ -24,7 +24,7 @@ ad_release_exact_window_fields(&win);## Last-error accessors-Four accessors share the same per-thread lifetime contract:+Five accessors share the same per-thread lifetime contract:| Accessor | Returns ||---------------------------------|----------------------------------------------------------------|@@ -92,7 +92,7 @@ releases may add codes.| `AD_RESULT_ERR_TIMEOUT` | -9 | Wait exceeded deadline || `AD_RESULT_ERR_INVALID_ARGS` | -10 | Null pointer, bad enum, invalid UTF-8 || `AD_RESULT_ERR_NOTIFICATION_NOT_FOUND`| -11 | Notification index out of range or reordered |-| `AD_RESULT_ERR_INTERNAL` | -12 | Internal failure or foreign-subscriber conflict |+| `AD_RESULT_ERR_INTERNAL` | -12 | Internal failure or caught Rust panic || `AD_RESULT_ERR_SNAPSHOT_NOT_FOUND` | -13 | Requested snapshot ref store is missing || `AD_RESULT_ERR_POLICY_DENIED` | -14 | Current action policy blocks this fallback || `AD_RESULT_ERR_AMBIGUOUS_TARGET` | -15 | Strict re-identification found multiple candidates; re-snapshot |diff --git a/skills/agent-desktop-macos/SKILL.md b/skills/agent-desktop-macos/SKILL.mdindex 913342189..59b258789 100644--- a/skills/agent-desktop-macos/SKILL.md+++ b/skills/agent-desktop-macos/SKILL.md@@ -1,6 +1,6 @@---name: agent-desktop-macos-version: 0.8.4+version: 0.10.1 # x-release-please-versiontags: macos-automation, accessibility, ax, tcc, ai-agent, gui-automation, clirequirements:- agent-desktopdiff --git a/skills/agent-desktop-windows/SKILL.md b/skills/agent-desktop-windows/SKILL.mdindex 9dc03a549..b3ad51ac1 100644--- a/skills/agent-desktop-windows/SKILL.md+++ b/skills/agent-desktop-windows/SKILL.md@@ -1,6 +1,6 @@---name: agent-desktop-windows-version: 0.8.4+version: 0.10.1 # x-release-please-versiontags: windows-automation, accessibility, uia, ai-agent, gui-automation, clirequirements:- agent-desktop@@ -42,7 +42,7 @@ observation, actions and capture there fail or return nothing.| Clipboard | `clipboard-get`, `clipboard-set`, `clipboard-clear` | Works; typed text and image content || Wait | `wait` | Works for ms, `--element`, `--window`, `--text`, `--menu`, `--menu-closed`, `--event`, and `--notification` predicates || Notifications | `list-notifications`, `dismiss-notification`, `dismiss-all-notifications`, `notification-action` | Works over the Action Center; the commands that raise shell chrome take the foreground, so pass `--headed` when the center is closed |-| Cursor overlay | `cursor-overlay` | Works; `enable` renders a click-through overlay and `data.rendered` is the renderer's own pipe acknowledgement, not merely a spawned process. `disable` carries no `rendered` field. See Cursor Overlay below |+| Cursor overlay | `cursor-overlay` | Works; `enable` renders a click-through overlay and `data.rendered` is the renderer's own pipe acknowledgement, not merely a spawned process. `disable` carries no `rendered` field. See `references/shell-and-overlay.md` || System | `status`, `permissions`, `version`, `batch`, `skills`, `session`, `trace` | Works |## First Contact@@ -61,11 +61,13 @@ observation, actions and capture there fail or return nothing.`--timeout-ms` to `snapshot` instead of concluding the tree is empty.- **Headless by default.** Ref actions stay semantic. Only `--headed` commandsverify exact-window focus and synthesize physical input. `alt+f4`, `win+l`,- `win+d`, `alt+tab` and modifier supersets are refused without `--force`.+ `win+d`, `alt+tab`, `win+r`, `win+x`, `win+e`, `ctrl+shift+esc` and modifier+ supersets are refused without `--force`.- **`type` needs focus permission.** It is physical keystroke synthesis, so a- strict-headless `type` returns `POLICY_DENIED`. It always ends- `delivered_unverified` (`verification_scope: "unavailable"`): confirm with a- fresh `get`.+ strict-headless `type` returns `POLICY_DENIED`. It ends+ `delivered_unverified` (`verification_scope: "unavailable"`) when the field+ exposes no readable Text selection, and can verify when one is readable:+ confirm with a fresh `get`.- **`press --app` writes to the foreground queue** with no per-processtargeting. A headless press to a non-frontmost app fails closed. Anon-interactive caller (service, scheduled task, CI job) gets@@ -88,7 +90,7 @@ observation, actions and capture there fail or return nothing.## What differs on Windows-- Ref actions are semantic UI Automation calls, in headless and `--headed` mode.+- Ref actions are semantic UI Automation calls, in headless and `--headed` mode, except `right-click`, `double-click`, `triple-click`, `type` and `focus`, which are physical or focus-stealing and need `--headed`.- Notifications work over the Action Center and need `--headed`.- `launch` takes an absolute path or a bare name under System32 or the Windowsdirectory, with or without `.exe`, not a display name.diff --git a/skills/agent-desktop-windows/references/permissions-and-elevation.md b/skills/agent-desktop-windows/references/permissions-and-elevation.mdindex aa59012e7..cd1b5cd6f 100644--- a/skills/agent-desktop-windows/references/permissions-and-elevation.md+++ b/skills/agent-desktop-windows/references/permissions-and-elevation.md@@ -68,6 +68,10 @@ key alias (`meta`/`cmd`/`super` → `win`), and modifier superset is caught:| `win+l` | locks the session || `win+d` | shows the desktop || `alt+tab` | steals the foreground mid-run |+| `win+r` | opens Run over the target |+| `win+x` | opens the Quick Link menu over the target |+| `win+e` | opens File Explorer over the target |+| `ctrl+shift+esc` | opens Task Manager over the target |Supersets like `alt+shift+tab` are blocked too. `--force` overrides the guard;the calling agent keeps control.diff --git a/skills/agent-desktop-windows/references/troubleshooting.md b/skills/agent-desktop-windows/references/troubleshooting.mdindex 528a46b48..94b5c2621 100644--- a/skills/agent-desktop-windows/references/troubleshooting.md+++ b/skills/agent-desktop-windows/references/troubleshooting.md@@ -71,10 +71,11 @@ differently:- **SmartScreen (browser downloads):** a browser attaches Mark-of-the-Web, sodouble-clicking a downloaded binary can show the "Windows protected yourPC" warning — choose More info → Run anyway. The npm install path is- different by measurement: System32 curl writes with plain file I/O and- attaches **no** mark (a real HTTP fetch landed with- `zone_identifier_present: false`, A25-5), so no mark-gated prompt can fire- during npm installation.+ different by measurement: curl writes with plain file I/O and attaches+ **no** mark (a real HTTP fetch by System32 curl landed with+ `zone_identifier_present: false`, A25-5; the installer runs whichever `curl`+ PATH resolves first), so no mark-gated prompt can fire during npm+ installation.- **Antivirus quarantine:** Defender or third-party scanners may quarantine afreshly downloaded unsigned executable regardless of how it was obtained.Restore/allow-list it or verify the published SHA-256 checksum and rebuild@@ -135,7 +136,9 @@ returns. When the app is live, the documented shape is a deliberate split:```json"code": "INTERNAL","message": "private file parent is owned by a foreign principal, not this-process's token owner"+process's token user, token owner, or an owner-eligible token group; if a+different principal owns this path intentionally, relocate the state root with+AGENT_DESKTOP_HOME instead of reusing it"```Cause: the data directory under your home (`~/.agent-desktop`) was created by@@ -175,11 +178,12 @@ Three outcomes, and they are not interchangeable:This is not a failure and not proof the change did not happen — it means theUIA property the verifier needs was not readable on that element. A controlwhose TogglePattern or ExpandCollapsePattern is absent, or whose property- read failed, reports this rather than a false verdict. **`type` always lands- here on Windows today**: deriving what a field should contain after an- insertion needs the selection range, and the adapter does not yet read one.- A `type` is therefore correct and unverified, never falsely failed — confirm- it with a fresh `get` if the value matters.+ read failed, reports this rather than a false verdict. **`type` is verified+ only when the focused field exposes a readable Text pattern selection**: the+ adapter reads that selection to predict the post-insertion value. Without a+ readable selection (no Text pattern, no selection, or a failed read) `type`+ lands here as correct and unverified, never falsely failed — confirm it with+ a fresh `get` if the value matters.**A `set-value` that the application reshapes is reported as failed.** If theapp trims whitespace, reformats a date, or normalizes a number, the readback nodiff --git a/skills/agent-desktop/SKILL.md b/skills/agent-desktop/SKILL.mdindex 09beca385..00611a522 100644--- a/skills/agent-desktop/SKILL.md+++ b/skills/agent-desktop/SKILL.md@@ -1,6 +1,6 @@---name: agent-desktop-version: 0.4.0+version: 0.10.1 # x-release-please-versiontags: computer-use, desktop-automation, accessibility, ai-agent, gui-automation, clirequirements:- agent-desktopdiff --git a/skills/agent-desktop/references/commands-interaction.md b/skills/agent-desktop/references/commands-interaction.mdindex 2b054298a..0604c9688 100644--- a/skills/agent-desktop/references/commands-interaction.md+++ b/skills/agent-desktop/references/commands-interaction.md@@ -99,7 +99,7 @@ agent-desktop clear @s8f3k2p9:e2agent-desktop focus @s8f3k2p9:e2```-- `type` inserts text. When value and selection are readable it checks the result. A mismatch or unreadable result returns `ACTION_FAILED`. Inspect the current value before you write again. Headed typing can change the selection when it focuses an inactive field. In that case the result stays unverified.+- `type` inserts text. When value and selection are readable it checks the result. A readable mismatch returns `ACTION_FAILED`; an unreadable result succeeds as `delivered_unverified`. Inspect the current value before you write again. Headed typing can change the selection when it focuses an inactive field. In that case the result stays unverified.- `set-value` writes the value directly through the semantic value path. It is faster than `type`, but it may not fire every UI callback. Use it for text fields, text areas and sliders.- A cell that exposes no value write is not directly editable. Activate it, take a fresh snapshot, and target the editor that appears. Some apps expose no editor and accept only keyboard input.- `clear` empties the element. `focus` sets keyboard focus without clicking.diff --git a/skills/agent-desktop/references/commands-system.md b/skills/agent-desktop/references/commands-system.mdindex 4e7cbf59a..77b9f85b2 100644--- a/skills/agent-desktop/references/commands-system.md+++ b/skills/agent-desktop/references/commands-system.md@@ -11,7 +11,7 @@ agent-desktop launch "MyTool" --arg /tmp/notes.txt --env KEY=VALUE --no-attachagent-desktop launch "Obsidian" --cdp```-`launch` returns once the process runs. The identifier differs by OS: the examples below use macOS display names, and Windows needs an absolute path or a System32 name (platform skill). By default it attaches to a running instance. `--no-attach` returns `ACTION_FAILED` if a matching app is running. It starts a new instance only when none is running. For an `--arg` value that starts with `-`, use `--arg=<value>`.+`launch` returns once the process runs. The identifier differs by OS: the examples below use macOS display names, and Windows needs an absolute path or a System32 name (platform skill). By default it attaches to a running instance. `--no-attach` starts a fresh instance instead of attaching: on Windows it returns `ACTION_FAILED` if a matching app is already running; on macOS it launches a second instance alongside the running one. For an `--arg` value that starts with `-`, use `--arg=<value>`.The process running and the app showing a window are separate facts:diff --git a/src/cli/contract_command_surface_tests.rs b/src/cli/contract_command_surface_tests.rsindex c8e9385a1..1a3e89cd6 100644--- a/src/cli/contract_command_surface_tests.rs+++ b/src/cli/contract_command_surface_tests.rs@@ -231,6 +231,9 @@ mod windows_capability_claims;#[path = "install_doc_claims_tests.rs"]mod install_doc_claims;+#[path = "doc_literal_drift_tests.rs"]+mod doc_literal_drift;+#[test]fn listing_timeout_is_accepted_in_cli_and_batch() {use clap::Parser;diff --git a/src/cli/doc_literal_drift_tests.rs b/src/cli/doc_literal_drift_tests.rsnew file mode 100644index 000000000..b253fcb90--- /dev/null+++ b/src/cli/doc_literal_drift_tests.rs@@ -0,0 +1,117 @@+use super::*;++const ENVELOPE_DOCS: &[(&str, &str)] = &[+ ("CLAUDE.md", include_str!("../../CLAUDE.md")),+ (+ "docs/json-output.md",+ include_str!("../../docs/json-output.md"),+ ),+ ("docs/phases.md", include_str!("../../docs/phases.md")),+ (+ ".github/ISSUE_TEMPLATE/bug_report.yml",+ include_str!("../../.github/ISSUE_TEMPLATE/bug_report.yml"),+ ),+];++const ABI_DOCS: &[(&str, &str)] = &[+ ("README.md", include_str!("../../README.md")),+ ("docs/phases.md", include_str!("../../docs/phases.md")),+ (+ "skills/agent-desktop-ffi/references/build-and-link.md",+ include_str!("../../skills/agent-desktop-ffi/references/build-and-link.md"),+ ),+];++const FFI_HEADER: &str = include_str!("../../crates/ffi/include/agent_desktop.h");+const README: &str = include_str!("../../README.md");+const CLAUDE_MD: &str = include_str!("../../CLAUDE.md");+const HELD_INPUT_COMMANDS: &[&str] = &["key-down", "key-up", "mouse-down", "mouse-up"];++fn quoted_values_after<'a>(text: &'a str, marker: &str) -> Vec<&'a str> {+ text.match_indices(marker)+ .filter_map(|(at, _)| {+ let rest = text[at + marker.len()..].trim_start();+ let rest = rest.strip_prefix('"')?;+ rest.split('"').next()+ })+ .collect()+}++fn integers_after(text: &str, marker: &str) -> Vec<u32> {+ text.match_indices(marker)+ .filter_map(|(at, _)| {+ let digits: String = text[at + marker.len()..]+ .trim_start_matches([' ', '`', '=', '('])+ .chars()+ .take_while(char::is_ascii_digit)+ .collect();+ digits.parse().ok()+ })+ .collect()+}++#[test]+fn documented_envelope_versions_match_the_code_constant() {+ for (path, text) in ENVELOPE_DOCS {+ let found = [+ quoted_values_after(text, "\"version\":"),+ quoted_values_after(text, "version: "),+ ]+ .concat();+ assert!(+ !found.is_empty(),+ "{path} no longer shows an envelope version"+ );+ for version in found {+ assert_eq!(+ version,+ agent_desktop_core::output::ENVELOPE_VERSION,+ "{path} documents envelope version {version}"+ );+ }+ }+}++#[test]+fn documented_abi_major_matches_the_header() {+ let header_major = integers_after(FFI_HEADER, "#define AD_ABI_VERSION_MAJOR")[0];+ for (path, text) in ABI_DOCS {+ let found = [+ integers_after(text, "ad_init("),+ integers_after(text, "AD_ABI_VERSION_MAJOR"),+ integers_after(text, "AD_ABI_VERSION_MAJOR` is currently"),+ integers_after(text, "the ABI major, currently"),+ integers_after(text, "ABI major is"),+ ]+ .concat();+ assert!(!found.is_empty(), "{path} no longer states the ABI major");+ for major in found {+ assert_eq!(major, header_major, "{path} documents ABI major {major}");+ }+ }+}++#[test]+fn documented_command_counts_match_the_cli() {+ let total = cli_command_names()+ .iter()+ .filter(|name| name.as_str() != "help")+ .count();+ let operational = total - HELD_INPUT_COMMANDS.len();+ assert!(+ README.contains(&format!(+ "{total} command names, {operational} operational commands"+ )),+ "README.md must state {total} command names and {operational} operational commands"+ );+ assert!(+ CLAUDE_MD.contains(&format!("{total} commands spanning")),+ "CLAUDE.md must state {total} commands"+ );+ assert!(+ CLAUDE_MD.contains(&format!(+ "{operational} of the {total} command names are operational"+ )),+ "CLAUDE.md must state {operational} of the {total} command names are operational"+ );+}diff --git a/src/cli/install_doc_claims_tests.rs b/src/cli/install_doc_claims_tests.rsindex 83142c6c4..f351ef4d7 100644--- a/src/cli/install_doc_claims_tests.rs+++ b/src/cli/install_doc_claims_tests.rs@@ -3,9 +3,8 @@ const README: &str = include_str!("../../README.md");const INSTALL_HEADING: &str = "## Installation";const NEXT_TOP_HEADING: &str = "## Language bindings";-/// The README is committed with CRLF endings, so the section is bounded by-/// heading text alone rather than by a line terminator the working tree may-/// rewrite.+/// The section is bounded by heading text alone, so the test does not depend+/// on the README's line terminators.fn install_section() -> &'static str {let start = README.find(INSTALL_HEADING)@@ -19,10 +18,10 @@ fn install_section() -> &'static str {/// The install path's two residual risks are closed as documentation rather/// than as code, which only holds while the documentation says the two things/// that close them. Same-origin checksums detect corruption but do not prove-/// provenance, so the reader needs the attestation command; and a modern npm-/// blocks the postinstall that fetches the binary, so the reader needs the-/// allowlist entry before the wrapper's binary-not-found failure is their-/// first experience of the tool.+/// provenance, so the reader needs the attestation command; and an npm that+/// blocks install scripts skips the postinstall that fetches the binary, so the+/// reader needs the allowlist entry before the wrapper's binary-not-found+/// failure is their first experience of the tool.#[test]fn the_install_section_closes_both_documented_npm_risks() {let section = install_section();@@ -35,9 +34,9 @@ fn the_install_section_closes_both_documented_npm_risks() {);assert!(section.contains("allowScripts"),- "the install section must publish the allowScripts configuration: npm \- blocks the postinstall that fetches the native binary, and without \- the allowlist entry a Windows reader meets a binary-not-found failure \- instead of a working install"+ "the install section must publish the allowScripts configuration: an \+ npm that blocks install scripts skips the postinstall that fetches \+ the native binary, and without the allowlist entry the reader meets \+ a binary-not-found failure instead of a working install");}diff --git a/src/cli/mod.rs b/src/cli/mod.rsindex a4b6a95d0..eb61abe0d 100644--- a/src/cli/mod.rs+++ b/src/cli/mod.rs@@ -92,9 +92,13 @@ pub(crate) enum Commands {MouseMove(MouseMoveArgs),#[command(about = "Click at absolute screen coordinates (requires --headed)")]MouseClick(MouseClickArgs),- #[command(about = "Press mouse button at coordinates (requires --headed)")]+ #[command(+ about = "Press mouse button at coordinates (fails closed in stateless mode; use mouse-click or drag)"+ )]MouseDown(MousePointArgs),- #[command(about = "Release mouse button at coordinates (requires --headed)")]+ #[command(+ about = "Release mouse button at coordinates (fails closed in stateless mode; use mouse-click or drag)"+ )]MouseUp(MousePointArgs),#[command(about = "Scroll the mouse wheel at absolute coordinates (requires --headed)")]MouseWheel(MouseWheelArgs),diff --git a/src/cli_args/actions.rs b/src/cli_args/actions.rsindex aa54553f3..ec1d6e2a6 100644--- a/src/cli_args/actions.rs+++ b/src/cli_args/actions.rs@@ -142,7 +142,7 @@ pub(crate) struct PressArgs {pub(crate) struct KeyComboArgs {#[arg(value_name = "COMBO",- help = "Key or modifier to hold/release: shift, meta, ctrl ... (cmd is accepted)"+ help = "Key or modifier to hold/release: shift, meta, ctrl ... (cmd is accepted); the command is rejected in stateless mode, use press instead")]pub combo: String,#[arg(diff --git a/src/cli_args/snapshot_tree.rs b/src/cli_args/snapshot_tree.rsindex eed82073c..b065aa82c 100644--- a/src/cli_args/snapshot_tree.rs+++ b/src/cli_args/snapshot_tree.rs@@ -8,7 +8,7 @@ fn default_max_depth() -> u8 {#[derive(Args, Debug, Deserialize)]#[serde(deny_unknown_fields)]pub(crate) struct SnapshotTreeArgs {- #[arg(long, default_value = "10", help = "Maximum tree depth (1-50)")]+ #[arg(long, default_value = "10", help = "Maximum tree depth (default 10)")]#[serde(default = "default_max_depth")]pub max_depth: u8,#[arg(long, help = "Include element bounds (x, y, width, height)")]diff --git a/src/cli_args/system.rs b/src/cli_args/system.rsindex 4894be958..a42959bb8 100644--- a/src/cli_args/system.rs+++ b/src/cli_args/system.rs@@ -42,7 +42,7 @@ pub(crate) struct LaunchArgs {pub cwd: Option<std::path::PathBuf>,#[arg(long = "no-attach",- help = "Require a fresh instance; fail if the app is already running"+ help = "Start a fresh instance instead of attaching to a running one (Windows fails if the app is already running)")]#[serde(default)]pub no_attach: bool,diff --git a/src/command_policy/mod.rs b/src/command_policy/mod.rsindex 536ee32ae..03d8a995a 100644--- a/src/command_policy/mod.rs+++ b/src/command_policy/mod.rs@@ -111,16 +111,18 @@ pub(crate) fn preflight(cmd: &Commands, report: &PermissionReport) -> Result<(),Ok(())}+fn agent_id_missing(cmd: &Commands, multi_agent: bool, agent_id: Option<&str>) -> bool {+ multi_agent+ && agent_id.is_none()+ && cmd.is_mutating()+ && policy_for(cmd) == PermissionNeed::Accessibility+}+pub(crate) fn preflight_context(cmd: &Commands,context: &agent_desktop_core::context::CommandContext,) -> Result<(), AppError> {- if cfg!(target_os = "macos")- && context.multi_agent()- && context.agent_id().is_none()- && cmd.is_mutating()- && policy_for(cmd) == PermissionNeed::Accessibility- {+ if agent_id_missing(cmd, context.multi_agent(), context.agent_id()) {return Err(AppError::invalid_input_with_suggestion("Multi-agent sessions require --agent-id for desktop actions","Set --agent-id or AGENT_DESKTOP_AGENT_ID before running the command.",diff --git a/src/command_policy/tests.rs b/src/command_policy/tests.rsindex b9aa18ad7..79c053618 100644--- a/src/command_policy/tests.rs+++ b/src/command_policy/tests.rs@@ -205,3 +205,16 @@ fn trace_show_passes_preflight_with_permissions_denied() {});assert!(preflight(&command, &report).is_ok());}++#[test]+fn a_multi_agent_desktop_action_needs_an_agent_id_on_every_platform() {+ let click = Commands::Click(RefArgs {+ ref_id: VALID_REF_ID.into(),+ timeout_ms: 5000,+ });++ assert!(agent_id_missing(&click, true, None));+ assert!(!agent_id_missing(&click, true, Some("agent-a")));+ assert!(!agent_id_missing(&click, false, None));+ assert!(!agent_id_missing(&Commands::Status, true, None));+}diff --git a/tests/conformance/README.md b/tests/conformance/README.mdindex 2fc814193..49a5ea93f 100644--- a/tests/conformance/README.md+++ b/tests/conformance/README.md@@ -36,7 +36,7 @@ adapter-provided refs.| Batch item session overrides inherited session | Required | Required | Required || FFI `AdRefEntry` preserves full identity envelope | Required | Required | Required |-## Adding Windows or Linux+## Adding a PlatformAdd adapter-specific integration fixtures, but keep expected errors and JSONshapes identical. Prefer semantic platform actions first (`AXPress`, UIAdiff --git a/tests/e2e-windows/Harness.psm1 b/tests/e2e-windows/Harness.psm1index 38a7d7410..cbfba11dc 100644--- a/tests/e2e-windows/Harness.psm1+++ b/tests/e2e-windows/Harness.psm1@@ -240,8 +240,9 @@ function ConvertFrom-AgentJson {The one JSON parser this harness ever calls, built onSystem.Web.Script.Serialization.JavaScriptSerializer withRecursionLimit and MaxJsonLength raised past its 100/2,097,152- defaults. ConvertFrom-Json is never called anywhere else in this- suite (enforced by U8's structural gate) because it measures a+ defaults. ConvertFrom-Json is never called anywhere else in the+ non-selftest harness (enforced by rule 11 of+ scripts/check-e2e-windows-contract.ps1) because it measures aRecursionLimit of 101 nesting levels on this host - a 102-deepdocument throws - and a snapshot contributes two nesting levels perUI level on top of the envelope, which a content-staged web treediff --git a/tests/e2e-windows/Lib.psm1 b/tests/e2e-windows/Lib.psm1index 0d3701c34..cd729e431 100644--- a/tests/e2e-windows/Lib.psm1+++ b/tests/e2e-windows/Lib.psm1@@ -5,7 +5,8 @@always carry their snapshot, independent-observation assertions, and athin snapshot/find/list-windows wrapper keeping tree/envelope readsinside this file or sibling LibEnvelope.psm1 - no other harness file- touches .ok/.error/.disposition/.data, and this file never calls `exit`;+ uses dotted .ok/.error/.disposition/.data access (rule 5 does not gate+ bracket indexing), and this file never calls `exit`;only Run-E2E.ps1 does. Lock ordering/leg ledger/Require-Target live inLibVerdict.psm1; batch/occluder assertions live in LibEnvelope.psm1 -both re-exported below, both split out for the 400-line cap. #>diff --git a/tests/e2e-windows/NativeDesktop.psm1 b/tests/e2e-windows/NativeDesktop.psm1index d42fca2da..25b87ca12 100644--- a/tests/e2e-windows/NativeDesktop.psm1+++ b/tests/e2e-windows/NativeDesktop.psm1@@ -81,9 +81,9 @@ function Get-NativeTopLevelWindows {function Get-NativeGuiThreadInfo {<#.SYNOPSIS- GUITHREADINFO for the foreground thread (idThread 0), read only for- its own live-invocation proof today; a later focus-contest scenario- is the production consumer.+ GUITHREADINFO for the given thread id (0 means the foreground+ thread). The focus oracle in scenarios/Interaction.ps1 calls it with+ the fixture window's owning thread id.#>[CmdletBinding()]param([uint32]$ThreadId = 0)diff --git a/tests/e2e-windows/README.md b/tests/e2e-windows/README.mdindex 0ce02578a..fd5988151 100644--- a/tests/e2e-windows/README.md+++ b/tests/e2e-windows/README.md@@ -16,6 +16,15 @@ own `ok:true`.| `Harness.psm1` | Isolated environment (`HOME`/`TEMP`/`CARGO_TARGET_DIR` redirection), recoverable delete, immutable binary staging + hash re-verification, fixture process identity, and `ConvertFrom-AgentJson`. || `DesktopLease.psm1` | The desktop-exclusivity lease and its CI adoption protocol, and the two guarded spawn entry points (`Invoke-Guarded`, `Invoke-GuardedAgent`). || `Lib.psm1` | Target objects that always carry their snapshot (`Find-Target`, `Get-Target`, `Test-Target`, `Wait-Target`, `Invoke-Target`), the independent-observation assertions (`Assert-Effect`, `Assert-NoEffect`, `Assert-Envelope`), lock ordering (`Enter-Stage`), and the verdict/skip ledger (`Register-Legs`, `Add-Pass`/`Add-Fail`/`Add-Skip`, `Write-Verdict`). |+| `NativeToken.psm1` | Process-token and integrity-level reads. |+| `StagedProcess.psm1` | Staged-process spawn and own-handle reporting helpers. |+| `StagedProcessHandleStability.psm1` | Handle-count stability checks for staged processes. |+| `LibEnvelope.psm1` | Envelope, batch and occluder assertions re-exported by `Lib.psm1`. |+| `LibVerdict.psm1` | Lock ordering, the leg ledger and `Require-Target`, re-exported by `Lib.psm1`. |+| `LibShell.psm1` | Shell-surface helpers used by the shell scenarios. |+| `ChromiumNative.psm1` | Native reads for the Chromium scenario. |+| `ChromiumStage.psm1` | Chromium content staging. |+| `CursorOverlaySupport.psm1` | Support helpers for the cursor-overlay scenario. || `Run-E2E.ps1` | The one process-terminating call in the whole tree. Scenario files (`scenarios/*.ps1`) return; only this script exits. |`Harness.psm1`/`Native.psm1` and their self-tests were split (and `DesktopLease.psm1`/`NativeTypes.psm1`/`NativeDesktop.psm1` introduced) purely to keep every file under the 400-line structural cap `scripts/check-e2e-windows-contract.ps1` enforces (rule 13); no exported function moved, only which file owns it. Every `selftest/*.ps1` entry point is likewise paired with a `*Cases*.ps1` file it dot-sources for the same reason.@@ -26,8 +35,10 @@ own `ok:true`.`Add-Skip`, with a reason. An undeclared token fails the run (a skip mustnever read as a pass).- `latency-baseline.psd1` - the committed per-leg p99 store `Assert-NoEffect`'s- window is derived from. Starts with only a conservative bootstrap value;- the cost run appends one entry per positive `Assert-Effect` leg.+ window is derived from. Starts with four whole-CLI cost entries taken from+ `probes/windows/24-fixture-e2e/captures/cost-baseline-devbox.json` and a+ conservative `BootstrapP99Ms` fallback; the per-leg cost run replaces them+ with one entry per positive `Assert-Effect` leg.## Running@@ -52,9 +63,9 @@ powershell -NoProfile -File tests\e2e-windows\Run-E2E.ps1- Every ref is a target object from `Find-Target`/`Find-TargetById`, carryingboth `RefId` and `SnapshotId`. No helper accepts or returns a bare `@eN`.- Effect assertions go through `Assert-Effect`/`Assert-NoEffect`; envelope- assertions go through `Assert-Envelope`. Touching `.ok`/`.error`/- `.disposition`/`.data` on a command result directly is a `Lib.psm1`-only- privilege.+ assertions go through `Assert-Envelope`. Dotted access to `.ok`/`.error`/+ `.disposition`/`.data` on a command result is a `Lib.psm1`/`LibEnvelope.psm1`-only+ privilege (rule 5 gates dotted member access only; bracket indexing is not gated).- Every desktop-touching leg is lexically wrapped in `Enter-Stage`, declaringlocks in the fixed order `DesktopLease` -> `ForegroundStage` -> `MenuStage`.- Every scenario calls `Register-Legs` with its leg names up front; everydiff --git a/tests/e2e-windows/Run-E2E.ps1 b/tests/e2e-windows/Run-E2E.ps1index 548cd7c84..9ba15467a 100644--- a/tests/e2e-windows/Run-E2E.ps1+++ b/tests/e2e-windows/Run-E2E.ps1@@ -1,7 +1,7 @@#Requires -Version 5.1<#- Run-E2E.ps1 - the single process-terminating call in the whole harness+ Run-E2E.ps1 - the single process-terminating call in the scenario runtree. Scenario files return; only this script exits, and Write-Verdictnever performs cleanup and never decides the exit code by itself - thisscript reads its boolean result and is the one place that turns it into@@ -10,10 +10,12 @@Sequencing: isolated environment -> hashed read-only staged binary(R11) -> desktop lease (adopted or acquired, R15b) -> fixture launcheddetached and waited for by observation, never by a fixed sleep ->- Preconditions -> Observation -> NonInterference -> Interaction, with the+ Preconditions -> Observation -> NonInterference -> Interaction ->+ Acceptance -> Reliability -> Surfaces -> ShellSurfaces ->+ TracePerformance -> Chromium -> SplitIntegrity -> CursorOverlay, with thefixture's process identity re-checked between each -> teardown ->- Write-Verdict. Later units append further scenarios to the sequence- array below; nothing about the sequencing loop itself is unit-specific.+ Write-Verdict. The sequence array in Invoke-ScenarioSequence is the+ single source for the order.#>[CmdletBinding()]param(diff --git a/tests/e2e-windows/StagedProcess.psm1 b/tests/e2e-windows/StagedProcess.psm1index 28d8ed169..11e1147b4 100644--- a/tests/e2e-windows/StagedProcess.psm1+++ b/tests/e2e-windows/StagedProcess.psm1@@ -317,14 +317,10 @@ function Start-StagedIntegrityProcess {$childReportedHandles = $nullif ($ReportOwnHandles) {- <# ConvertFrom-Json returns its whole result as ONE pipeline- object; wrapping that call in @(...) then collects it as a- single-element array whose one element is the real array -- measured live, this silently defeated every leak comparison- downstream (a real leaked handle would never be found- "-contains" a 1-element array of arrays). The parsed value is- used as-is; a scalar JSON result (an empty array or one bare- number) is still normalized to an array with ,@(). #>+ <# ConvertFrom-AgentJson returns an array as-is and a bare scalar+ as a scalar. The parsed value is used unwrapped so a real+ leaked handle is found by -contains; a null result becomes an+ empty array and a scalar is normalized to a one-element array. #>try {$parsed = ConvertFrom-AgentJson -Json $stdoutTextif ($null -eq $parsed) { $childReportedHandles = @() }diff --git a/tests/e2e-windows/scenarios/Acceptance.ps1 b/tests/e2e-windows/scenarios/Acceptance.ps1index 5a660aae2..3d086e016 100644--- a/tests/e2e-windows/scenarios/Acceptance.ps1+++ b/tests/e2e-windows/scenarios/Acceptance.ps1@@ -45,7 +45,7 @@all three read back the control's true 1x1 geometry - so whatships is a real 1x1 button, not a 0x0 one.`crates/core/src/actionability/gates.rs::bounds_are_visible` only- fails on `width == 0 || height == 0`; a 1x1 rectangle passes.+ fails on absent, invalid, or zero-width/height bounds; a 1x1 rectangle passes.Measured live: `is --property visible` on `zero-bounds-button`answers `applicable: true, result: true`, not `false`. The legbelow asserts the measured, falsifiable-both-ways truth instead:diff --git a/tests/e2e-windows/scenarios/Chromium.ps1 b/tests/e2e-windows/scenarios/Chromium.ps1index a0d7b1b11..339fa6311 100644--- a/tests/e2e-windows/scenarios/Chromium.ps1+++ b/tests/e2e-windows/scenarios/Chromium.ps1@@ -236,7 +236,7 @@ function Invoke-ChromiumSemanticLeg {<# `A24-11`: this box's staged content has no accessible-namecheckbox, so strict resolution fails closed before anycandidate search runs - a real, reproducible, documented- adapter identity gap (deferred to §2.14, docs/phases.md),+ adapter identity gap (closed, docs/phases.md),not an unbounded failure. TIMEOUT wrapping a STALE_REF`last_report` and a bare STALE_REF are both the honestnegative this leg's own disposition already accounts for. #>diff --git a/tests/e2e-windows/scenarios/Observation.ps1 b/tests/e2e-windows/scenarios/Observation.ps1index b80bc7695..29041f93a 100644--- a/tests/e2e-windows/scenarios/Observation.ps1+++ b/tests/e2e-windows/scenarios/Observation.ps1@@ -98,7 +98,7 @@ function Invoke-ObservationScenario {}<# outline-tree itself is a bare Panel wearing only a ControlType- override (crates/fixture-app-windows/FixtureCardsCollections.cs):+ override (tests/fixture-app-windows/FixtureCardsCollections.cs):it advertises no action beyond SetFocus, so is_ref_able(crates/core/src/ref_alloc.rs) never gives it a ref, by design -outline-parent is the outline's own actionable evidence, not itsdiff --git a/tests/e2e-windows/scenarios/TracePerformance.ps1 b/tests/e2e-windows/scenarios/TracePerformance.ps1index 3a3a8489c..493c9bb01 100644--- a/tests/e2e-windows/scenarios/TracePerformance.ps1+++ b/tests/e2e-windows/scenarios/TracePerformance.ps1@@ -13,7 +13,7 @@`--session <id>` is set through `$env:AGENT_DESKTOP_SESSION` for theduration of each leg's Enter-Stage body rather than threaded through a- new Lib.psm1 parameter: Lib.psm1 sits exactly at the 400-line cap+ new Lib.psm1 parameter: Lib.psm1 sits just under the 400-line cap(LibEnvelope.psm1 already grew for this same reason), and`AGENT_DESKTOP_SESSION` is not one of rule07's five protected identityvariables - CONCEPTS.md's own activation order isdiff --git a/tests/e2e-windows/skip-allowlist.psd1 b/tests/e2e-windows/skip-allowlist.psd1index 13bd1b5df..a4d07d22e 100644--- a/tests/e2e-windows/skip-allowlist.psd1+++ b/tests/e2e-windows/skip-allowlist.psd1@@ -1,5 +1,5 @@@{'chromium-target-absent' = 'No Electron/Chromium target is guaranteed on an arbitrary runner; Edge is absent under this grounding (G5). Declared for the Chromium/renderer scenario so a target-less host reports a visible skip rather than a silent pass.'- 'foreground-grant-declined' = 'A raw SetForegroundWindow (AttachThreadInput + AllowSetForegroundWindow) staged from the long-lived harness process itself can be declined by this desktop even after every documented workaround, the same escape hatch crate/windows/src/system/wait_event_live_tests.rs already takes for focus_changed ("this desktop declines foreground even to a raw SetForegroundWindow"). Declared for the contended focus-steal control (R17b(c)) so an unstageable host reports a visible skip rather than a silent pass; the N-trial rate leg is never reached when the control cannot be established.'+ 'foreground-grant-declined' = 'A raw SetForegroundWindow (AttachThreadInput + AllowSetForegroundWindow) staged from the long-lived harness process itself can be declined by this desktop even after every documented workaround, the same escape hatch crates/windows/src/system/wait_event_live_tests.rs already takes for focus_changed ("this desktop declines foreground even to a raw SetForegroundWindow"). Declared for the contended focus-steal control (R17b(c)) so an unstageable host reports a visible skip rather than a silent pass; the N-trial rate leg is never reached when the control cannot be established.''shell-surface-absent' = 'A runner whose shell does not expose the surface a leg drives: open-system-surface answers PLATFORM_NOT_SUPPORTED (the informative build refusal) instead of an identity. Declared for the Action Center legs of the shell-surfaces scenario so a surface-less host reports a visible skip rather than a silent pass or a fake failure; the tray/taskbar legs have no skip path because their Win32-class kinds exist on every build the adapter resolves.'}diff --git a/tests/ffi-python/README.md b/tests/ffi-python/README.mdindex 0566a813c..0e4402075 100644--- a/tests/ffi-python/README.md+++ b/tests/ffi-python/README.md@@ -10,6 +10,7 @@ Proves the C ABI works from a non-Rust host (Python ctypes) and gates it in CI.| 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_MACOS_HELPER=1`, run by `scripts/ci-ffi-helper-discovery-smoke.sh`): macOS helper discovery |## Building the dylib@@ -56,7 +57,7 @@ stub-only gate.## Dependencies-`smoke.py` uses only the Python standard library (`ctypes`, `json`, `re`,+`smoke.py` uses only the Python standard library (`ctypes`, `json`, `os`, `re`,`pathlib`, `sys`). No `pip install` required.## Real-adapter happy pathdiff --git a/tests/fixture-app-windows/AgentDeskFixture.cs b/tests/fixture-app-windows/AgentDeskFixture.csindex ad5362875..37dfc8ecc 100644--- a/tests/fixture-app-windows/AgentDeskFixture.cs+++ b/tests/fixture-app-windows/AgentDeskFixture.cs@@ -34,17 +34,12 @@ namespace AgentDeskFixtureApp/// <summary>/// Same contract as <see cref="Assign(Control,string)"/> for a- /// <see cref="ToolStripItem"/> - <c>menu-fire-item</c> and the- /// candidate <c>ToolStripSplitButton</c> shape for- /// <c>menu-disclosure</c> are items on a <see cref="MenuStrip"/> /- /// <see cref="ToolStrip"/>, not <see cref="Control"/>s in their own- /// right, so they cannot go through the <c>Control</c> overload.- /// Whether <c>ToolStripItem.Name</c> surfaces as UIA- /// <c>AutomationId</c> the same way <c>Control.Name</c> does is- /// unmeasured (A24-2 covered real <c>Control</c>s only) - that is- /// exactly what the read-back-while-building loop this fixture is- /// built under has to confirm for each item that goes through this- /// overload.+ /// <see cref="ToolStripItem"/>. Neither <c>menu-fire-item</c> nor+ /// <c>menu-disclosure</c> uses it: both shipped as real Buttons+ /// wearing override hosts, because <c>ToolStripItem.Name</c> does not+ /// surface as <c>AutomationId</c> the way <c>Control.Name</c> does (see+ /// README.md). Nothing in this fixture relies on this overload for+ /// resolvability./// </summary>public static void Assign(ToolStripItem item, string automationId){diff --git a/tests/fixture-app-windows/FixtureCardsClicks.cs b/tests/fixture-app-windows/FixtureCardsClicks.csindex 90437d8d8..2345223d0 100644--- a/tests/fixture-app-windows/FixtureCardsClicks.cs+++ b/tests/fixture-app-windows/FixtureCardsClicks.cs@@ -45,7 +45,7 @@ namespace AgentDeskFixtureApp/// target to a ListBox; see probes/windows/FINDINGS.md). Counting/// <see cref="Control.Click"/> events instead works for any control/// that raises Click, a Button included, and resets the counter once- /// the system double-click interval has elapsed since the run's+ /// twice the system double-click interval has elapsed since the run's/// first click - a click arriving after that window starts a fresh/// count of one rather than accumulating forever./// </summary>diff --git a/tests/fixture-app-windows/FixtureToggleHost.cs b/tests/fixture-app-windows/FixtureToggleHost.csindex 93e504ed9..d1b722209 100644--- a/tests/fixture-app-windows/FixtureToggleHost.cs+++ b/tests/fixture-app-windows/FixtureToggleHost.cs@@ -9,8 +9,8 @@ namespace AgentDeskFixtureApp/// Backs <c>switch-button</c>: a plain WinForms <see cref="Button"/> has/// no toggling shape at all, so <c>roles.rs</c>'s <c>button_role</c> never/// takes the <c>ToggleAvailable</c> arm against one. This host answers- /// <c>IsTogglePatternAvailableProperty</c> and <see cref="ITogglePattern"/>- /// - err, <see cref="IToggleProvider"/> - itself and leaves every other+ /// <c>IsTogglePatternAvailableProperty</c> and <see cref="IToggleProvider"/>+ /// itself and leaves every other/// property (bounds, enabled, offscreen, name) to the host provider via/// <see cref="IRawElementProviderSimple.HostRawElementProvider"/>, so the/// control stays a fully functional, boundable, clickable Button thatdiff --git a/tests/fixture-app-windows/README.md b/tests/fixture-app-windows/README.mdindex 0c2d7c077..d4b75af36 100644--- a/tests/fixture-app-windows/README.md+++ b/tests/fixture-app-windows/README.md@@ -116,7 +116,8 @@ override provider (`UiaProviderHost` and its subclasses in`FixtureProviderHost.cs`, `FixtureToggleHost.cs`,`FixtureExpandCollapseHost.cs` and `FixtureControlTypeOverrideHost.cs`) -`menu-disclosure`, `menu-fire-item`, `outline-tree`,-`outline-parent`, `outline-child-a`, `outline-child-b`. `outline-tree` is+`outline-parent`, `outline-child-a`, `outline-child-b`, `cell-griditem`,+`cell-custom`, `row-plain`. `outline-tree` istherefore not a real `System.Windows.Forms.TreeView`: it is a `Panel`holding three `Label`s arranged with indentation, each independentlyoverriding its own `ControlType`.diff --git a/tests/fixture-app-windows/build.ps1 b/tests/fixture-app-windows/build.ps1index 78ce7765f..6d3f085e5 100644--- a/tests/fixture-app-windows/build.ps1+++ b/tests/fixture-app-windows/build.ps1@@ -49,7 +49,7 @@ if (-not (Test-Path -LiteralPath $csc)) {<#UIAutomationProvider.dll and UIAutomationTypes.dll (needed by the- zero-bounds and cell-role WM_GETOBJECT providers, A24-9) ship only in+ cell-role and the other UiaProviderHost-based WM_GETOBJECT providers, A24-9) ship only inthe GAC on this toolchain, not alongside csc.exe itself - a plain/reference:UIAutomationProvider.dll fails with CS0006 because thelegacy pre-Roslyn compiler does not search the GAC for a bare filename.@@ -75,10 +75,8 @@ $uiaProvider = Resolve-GacAssembly -AssemblyName 'UIAutomationProvider'$uiaTypes = Resolve-GacAssembly -AssemblyName 'UIAutomationTypes'<#- WindowsBase.dll supplies System.Windows.Rect, the boxed type the- zero-bounds WM_GETOBJECT provider (FixtureCards.cs) returns from- IRawElementProviderFragment.BoundingRectangle - the UIA property is typed- System.Windows.Rect, not a WinForms Rectangle, and that type lives outside+ WindowsBase.dll supplies System.Windows.Rect and the other System.Windows+ types the UIAutomation assemblies depend on; it lives outsideSystem.Windows.Forms.dll. Resolved through the same GAC lookup as the twoUIAutomation assemblies above rather than hardcoded, for the same reason.#>diff --git a/tests/npm/postinstall.test.js b/tests/npm/postinstall.test.jsindex c2ac81419..04175ae2b 100644--- a/tests/npm/postinstall.test.js+++ b/tests/npm/postinstall.test.js@@ -245,7 +245,7 @@ test('recoverable cleanup retains artifacts and warns when trash is unavailable}});-// Cleanup can't fail on Windows (unconditional rm); covered by planted-survivor test.+// Windows staging cleanup uses a direct rmSync that logs and retains on failure; this test exercises the trash path only.test('cleanup failure does not mask a successful archive install', { skip: POSIX_CLEANUP_ONLY }, () => {const payload = archive({'agent-desktop': 'cli-build-v2',diff --git a/tools/inspector/README.md b/tools/inspector/README.mdindex 7564f72f4..de9381ed0 100644--- a/tools/inspector/README.md+++ b/tools/inspector/README.md@@ -14,4 +14,4 @@ No npm dependencies or global tools are needed. The bridge opens a localhost URLThis is a tool for human developers working on agent-desktop. It is not part ofthe agent-facing command surface, and an AI agent driving the CLI has no use forit. The agent-invocable equivalent is `snapshot --debug --screenshot PATH.html`,-documented in `skills/agent-desktop/references/commands-observation.md`.+documented in `docs/solutions/developer-experience/visual-debug-snapshot-and-click-artifacts.md`.