Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
docs(cua-driver): wire reference auto-generation to the real docs dir + release (#2088)
Francesco Bonacci0696256c8324
diff --git a/.github/workflows/cd-cua-driver-docs.yml b/.github/workflows/cd-cua-driver-docs.ymlnew file mode 100644index 0000000000..a32037721f--- /dev/null+++ b/.github/workflows/cd-cua-driver-docs.yml@@ -0,0 +1,92 @@+name: "CD: Cua Driver Reference Docs"++# On a cua-driver release tag, regenerate the auto-generated reference MDX+# (cli-reference.mdx + mcp-tools.mdx) from the released binary's `dump-docs`+# output and open a PR with the refresh. This keeps the shipped reference in+# lockstep with the released binary's CLI/MCP surface without a human having+# to remember to run `pnpm docs:generate:cua-driver` after every cut.+#+# A PR (rather than a direct push to main) keeps a human in the loop for the+# generated-content diff. The App token mirrors the identity the version-bake+# step in cd-rust-cua-driver.yml already uses for release-time repo writes.++on:+ push:+ tags:+ - "cua-driver-rs-v*"+ workflow_dispatch:++permissions:+ contents: write+ pull-requests: write++jobs:+ regenerate-reference-docs:+ name: Regenerate cua-driver reference+ runs-on: macos-latest+ steps:+ - name: Checkout repository+ uses: actions/checkout@v4+ with:+ fetch-depth: 0 # full history for git-tag version discovery+ persist-credentials: false # re-auth with the App token before pushing++ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: "20"++ - name: Install pnpm+ uses: pnpm/action-setup@v4++ - name: Install docs dependencies+ run: pnpm install+ working-directory: docs++ - name: Setup Rust toolchain+ uses: dtolnay/rust-toolchain@stable++ - name: Build cua-driver (release)+ run: cargo build -p cua-driver --release+ working-directory: libs/cua-driver/rust++ - name: Regenerate reference docs+ run: npx tsx scripts/docs-generators/runner.ts --library cua-driver++ - name: Generate GitHub App token+ id: app-token+ uses: actions/create-github-app-token@v1+ with:+ app-id: ${{ secrets.RELEASE_APP_ID }}+ private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}+ owner: ${{ github.repository_owner }}+ repositories: ${{ github.event.repository.name }}++ - name: Open PR with refreshed reference docs+ env:+ GH_TOKEN: ${{ steps.app-token.outputs.token }}+ run: |+ if git diff --quiet -- docs/content/docs/reference/cua-driver; then+ echo "Reference docs already up to date; nothing to open."+ exit 0+ fi++ BRANCH="docs/cua-driver-reference-${GITHUB_REF_NAME}"++ # Re-authenticate origin with the App token so the push uses the+ # bypass-enabled identity, not the default github-actions[bot]+ # credentials baked in by actions/checkout.+ git config --unset-all "http.https://github.com/.extraheader" || true+ git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"++ git config user.name "trycua-release[bot]"+ git config user.email "trycua-release[bot]@users.noreply.github.com"+ git checkout -B "$BRANCH"+ git add docs/content/docs/reference/cua-driver+ git commit -m "docs(cua-driver): regenerate reference for ${GITHUB_REF_NAME}"+ git push -u origin "$BRANCH" --force-with-lease++ gh pr create --base main --head "$BRANCH" \+ --title "docs(cua-driver): regenerate reference for ${GITHUB_REF_NAME}" \+ --body "Auto-generated from \`cua-driver dump-docs\` at \`${GITHUB_REF_NAME}\` by the cua-driver reference-docs workflow. Only the auto-generated \`cli-reference.mdx\` and \`mcp-tools.mdx\` change; the hand-maintained sibling files are untouched." \+ || echo "PR already exists for ${BRANCH}; the push updated it."diff --git a/.github/workflows/ci-check-docs.yml b/.github/workflows/ci-check-docs.ymlindex 15c1301164..a2e08d2691 100644--- a/.github/workflows/ci-check-docs.yml+++ b/.github/workflows/ci-check-docs.yml@@ -22,7 +22,7 @@ on:# Cua-Bot- "libs/cuabot/src/**"# Documentation files themselves- - "docs/content/docs/cua-driver/reference/**"+ - "docs/content/docs/reference/cua-driver/**"- "docs/content/docs/cua/reference/**"- "docs/content/docs/cuabot/reference/**"# Generator scripts@@ -71,7 +71,7 @@ jobs:GENERATORS=""# Source changes- if echo "$CHANGED_FILES" | grep -q "^libs/cua-driver/rust/crates/\|^libs/cua-driver/rust/Cargo.toml\|^libs/cua-driver/rust/Cargo.lock\|^docs/content/docs/cua-driver/reference/"; then+ if echo "$CHANGED_FILES" | grep -q "^libs/cua-driver/rust/crates/\|^libs/cua-driver/rust/Cargo.toml\|^libs/cua-driver/rust/Cargo.lock\|^docs/content/docs/reference/cua-driver/"; thenGENERATORS="$GENERATORS cua-driver"fiif echo "$CHANGED_FILES" | grep -q "^libs/lume/src/"; thendiff --git a/docs/content/docs/reference/cua-driver/cli-reference.mdx b/docs/content/docs/reference/cua-driver/cli-reference.mdxindex 4d7a59c030..a797ff3bd9 100644--- a/docs/content/docs/reference/cua-driver/cli-reference.mdx+++ b/docs/content/docs/reference/cua-driver/cli-reference.mdx@@ -3,13 +3,22 @@ title: CLI Referencedescription: Command-line interface specification for Cua Driver---+{/*+ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY+ Generated by: npx tsx scripts/docs-generators/cua-driver.ts+ Source: cua-driver dump-docs+ Version: 0.7.0+*/}+Cross-platform computer-use automation driver. Install via the official script:```shcurl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh | bash```-Documented against Cua Driver **0.5.7**. Run `cua-driver --version` for your installed version.+Documented against Cua Driver **0.7.0**. Run `cua-driver --version` for your installed version.++The macOS-only `cua-driver permissions` command is documented separately in [macOS permissions](/reference/cua-driver/macos-permissions).---@@ -19,135 +28,131 @@ Documented against Cua Driver **0.5.7**. Run `cua-driver --version` for your insList every registered MCP tool with a one-line description.-**Arguments:** none.------### `cua-driver describe`Print a tool's full description and JSON input schema.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `<tool-name>` | String | Yes | Name of the MCP tool to describe. |+**Arguments:**----+| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- |+| `<tool-name>` | String | Yes | Name of the MCP tool to describe. |### `cua-driver call`-Invoke an MCP tool directly from the shell. Runs the same handler the MCP server uses. JSON arguments may be passed as a positional JSON object or through stdin.+Invoke an MCP tool directly from the shell.++Runs the same handler the MCP server uses. JSON arguments may be passed as a positional JSON object or through stdin.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |+**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- || `<tool-name>` | String | Yes | Name of the MCP tool to invoke. || `<json-args>` | String | No | JSON object for the tool input schema. If omitted, stdin is read when piped. |**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- || `--screenshot-out-file` | String | — | Write the first image content block from the response to this path. || `--socket` | String | — | Override the daemon socket or named-pipe path. |-----## Daemon management### `cua-driver mcp`-Run the stdio MCP server. On macOS, shell-spawned MCP processes can auto-launch and proxy through a CuaDriver.app daemon so TCC grants attach to the bundle. On Windows and Linux, MCP proxies through an already-running daemon when one is listening.+Run the stdio MCP server.++On macOS, shell-spawned MCP processes can auto-launch and proxy through a CuaDriver.app daemon so TCC grants attach to the bundle. On Windows and Linux, MCP proxies through an already-running daemon when one is listening.**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- || `--socket` | String | — | Override the daemon socket or named-pipe path used by the proxy fallback. |**Flags:**-| Flag | Description |+| Name | Description || ---- | ----------- || `--no-daemon-relaunch` | Stay in-process instead of proxying through a daemon. || `--claude-code-computer-use-compat` | Expose the Claude Code computer-use compatibility screenshot surface. |-----### `cua-driver serve`-Run Cua Driver as a long-running daemon. The daemon owns per-process state such as element-index caches, recording state, and cursor overlay state.+Run Cua Driver as a long-running daemon.++The daemon owns per-process state such as element-index caches, recording state, and cursor overlay state.**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- || `--socket` | String | — | Override the daemon socket or named-pipe path. || `--pid-file` | String | — | Override the pid-file path on Unix targets. |**Flags:**-| Flag | Description |+| Name | Description || ---- | ----------- || `--no-permissions-gate` | Skip the macOS first-launch permissions gate. |-----### `cua-driver stop`Ask the running daemon to exit gracefully.**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- || `--socket` | String | — | Override the daemon socket or named-pipe path. |-----### `cua-driver status`Report whether a Cua Driver daemon is running.**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- || `--socket` | String | — | Override the daemon socket or named-pipe path. || `--pid-file` | String | — | Override the pid-file path on Unix targets. |-----### `cua-driver mcp-config`Print MCP server config or a client-specific install command.-Supported clients: `claude`, `codex`, `cursor`, `antigravity`, `openclaw`, `opencode`, `hermes`, `pi`.+Supported clients include claude, codex, cursor, antigravity, openclaw, opencode, hermes, pi, qwen, droid, and zcode.**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- || `--client` | String | — | Client name to print configuration for. |-----## Trajectory recording### `cua-driver recording`-Control trajectory recording on a running daemon. Recording state lives in-process; use a daemon for multi-call sessions.+Control trajectory recording on a running daemon.++Recording state lives in-process, so use a daemon for multi-call sessions.**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- || `--socket` | String | — | Override the daemon socket or named-pipe path. |#### `cua-driver recording start`Start trajectory recording to a directory.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |+**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- || `<output-dir>` | String | Yes | Directory to write turn folders into. |#### `cua-driver recording stop`@@ -160,37 +165,41 @@ Print the current recording state.#### `cua-driver recording render`-Render a recorded trajectory directory to an MP4. This pure file-to-file path does not require a running daemon.+Render a recorded trajectory directory to an MP4.++This pure file-to-file path does not require a running daemon.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |+**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- || `<input-dir>` | String | Yes | Trajectory directory containing recorded turn folders. || `<out-mp4>` | String | Yes | Output MP4 path. |**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |-| `--scale` | Number | `2.0` | Scale factor for rendered frames. |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- |+| `--scale` | Number | — | Scale factor for rendered frames. |**Flags:**-| Flag | Description |+| Name | Description || ---- | ----------- || `--no-zoom` | Disable cursor/action zoom effects in the rendered video. |-----## Configuration### `cua-driver config`-Read or mutate persistent driver configuration. Without a subcommand, prints the full config.+Read or mutate persistent driver configuration.++Without a subcommand, prints the full config.**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- || `--socket` | String | — | Override the daemon socket or named-pipe path. |#### `cua-driver config show`@@ -201,16 +210,20 @@ Print the full config.Print one config key.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |+**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- || `<key>` | String | Yes | Config key to read. |#### `cua-driver config set`Set one config key.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |+**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- || `<key>` | String | Yes | Config key to write. || `<value>` | String | Yes | Value to store. |@@ -218,59 +231,57 @@ Set one config key.Reset config to defaults.-----## Diagnostics### `cua-driver check-update`-Check whether a newer Cua Driver release is available. Read-only. Uses the same update-state payload as the `check_for_update` MCP tool.+Check whether a newer cua-driver release is available.++Read-only. Uses the same update-state payload as the check_for_update MCP tool.**Flags:**-| Flag | Description |+| Name | Description || ---- | ----------- || `--json` | Emit a machine-readable JSON payload. || `--no-cache` | Skip the 20-hour on-disk cache and force a GitHub request. |-----### `cua-driver update`-Check for an update and optionally apply it. The apply path delegates to the canonical platform installer scripts.+Check for an update and optionally apply it.++The apply path delegates to the canonical platform installer scripts.**Flags:**-| Flag | Description |+| Name | Description || ---- | ----------- || `--apply` | Download and install the latest release when one is available. || `--json` | Emit the structured update-state payload. |-----### `cua-driver doctor`-Run platform-aware diagnostic probes. Exit code is non-zero when any probe is an error.+Run platform-aware diagnostic probes.++Exit code is non-zero when any probe is an error.**Flags:**-| Flag | Description |+| Name | Description || ---- | ----------- || `--json` | Emit the probe report as JSON. |-----### `cua-driver diagnose`Print a pasteable install-layout and permission-attribution report.-----## Other commands### `cua-driver autostart`-Manage platform-native daemon autostart. Windows registers a logon Scheduled Task. macOS and Linux currently print manual-recipe guidance.+Manage platform-native daemon autostart.++Windows registers a logon Scheduled Task. macOS and Linux currently print manual-recipe guidance.#### `cua-driver autostart enable`@@ -288,11 +299,11 @@ Print whether autostart is registered and running.Start the autostart entry now without re-logging.-----### `cua-driver skills`-Install, update, inspect, or remove the optional agent skill pack. The install script never touches agent skill directories automatically.+Install, update, inspect, or remove the optional agent skill pack.++The install script never touches agent skill directories automatically.#### `cua-driver skills install`@@ -300,14 +311,14 @@ Fetch the versioned skill pack and link detected agents.**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- || `--agent` | String | — | Restrict linking to one agent. |-| `--from` | String | — | Fetch from a source such as `main` instead of the tagged release. |+| `--from` | String | — | Fetch from a source such as main instead of the tagged release. |**Flags:**-| Flag | Description |+| Name | Description || ---- | ----------- || `--all-platforms` | Keep platform-specific skill files for every platform. |@@ -321,7 +332,7 @@ Remove agent skill links.**Flags:**-| Flag | Description |+| Name | Description || ---- | ----------- || `--all` | Also delete the local skill-pack copy. |@@ -333,48 +344,27 @@ Report local skill-pack and per-agent link state.Print the local skill-pack path.-----### `cua-driver dump-docs`-Output machine-readable CLI and MCP documentation JSON. Used by the docs generator to keep reference pages in sync with the live binary.+Output machine-readable CLI and MCP documentation JSON.++Used by the docs generator to keep reference pages in sync with the live binary.**Options:**-| Option | Type | Default | Description |-| ------ | ---- | ------- | ----------- |-| `--type` | String | `all` | Which docs to emit: `all`, `cli`, or `mcp`. |+| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- |+| `--type` | String | all | Which docs to emit: all, cli, or mcp. |**Flags:**-| Flag | Description |+| Name | Description || ---- | ----------- || `-p`, `--pretty` | Pretty-print JSON. |------### `cua-driver permissions` (macOS)--Inspect or request the macOS TCC grants the driver needs (Accessibility and Screen Recording).--```bash-cua-driver permissions status # report grant status; read-only, no prompt-cua-driver permissions grant # launch CuaDriver via LaunchServices so the prompt attributes to the app-```--**Flags:**--| Flag | Description |-| ---- | ----------- |-| `--json` | Machine-readable status output. |------## Global optionsAvailable on all commands:-| Option | Description |-| ------ | ----------- |-| `--help` | Show help information. |-| `--version` | Show version number. |+- `--help` — Show help information.+- `--version` — Show version number.diff --git a/docs/content/docs/reference/cua-driver/macos-permissions.mdx b/docs/content/docs/reference/cua-driver/macos-permissions.mdxnew file mode 100644index 0000000000..844510ca61--- /dev/null+++ b/docs/content/docs/reference/cua-driver/macos-permissions.mdx@@ -0,0 +1,21 @@+---+title: macOS Permissions+description: The macOS-only `cua-driver permissions` command for inspecting and requesting Accessibility and Screen Recording TCC grants.+---++`cua-driver permissions` is a macOS-only command. It is not part of the auto-generated [CLI reference](/reference/cua-driver/cli-reference) because it has no Windows or Linux counterpart, so it is documented here.++## `cua-driver permissions` (macOS)++Inspect or request the macOS TCC grants the driver needs (Accessibility and Screen Recording).++```bash+cua-driver permissions status # report grant status; read-only, no prompt+cua-driver permissions grant # launch CuaDriver via LaunchServices so the prompt attributes to the app+```++**Flags:**++| Flag | Description |+| ---- | ----------- |+| `--json` | Machine-readable status output. |diff --git a/docs/content/docs/reference/cua-driver/mcp-tool-notes.mdx b/docs/content/docs/reference/cua-driver/mcp-tool-notes.mdxnew file mode 100644index 0000000000..68b277b15a--- /dev/null+++ b/docs/content/docs/reference/cua-driver/mcp-tool-notes.mdx@@ -0,0 +1,55 @@+---+title: MCP Tool Notes+description: Cross-cutting contracts behind the MCP tools — shared parameters, required-parameter rules, platform-specific parameters, and the action response shape.+---++These notes are hand-maintained companions to the auto-generated [MCP Tools](/reference/cua-driver/mcp-tools) reference. They document the cross-cutting parameter contract and response shape that span multiple tools and are not derivable from any single tool's schema.++## Common parameters++Several parameters are a **shared cross-platform contract**: the same JSON shape on Windows, macOS, and Linux, composed from canonical schema fragments and enforced by a CI consistency gate so the three platforms cannot drift. Tools accept them uniformly.++| Parameter | Where | Notes |+| --------- | ----- | ----- |+| `session` | every action and cursor tool | Optional run identity for the agent cursor and per-session state; the same id works over MCP, the CLI, or the raw socket and follows the run across apps and windows. Accepted on all three platforms — earlier Windows and Linux builds rejected it via `additionalProperties:false`. |+| `delivery_mode` | the input family (`click`, `double_click`, `right_click`, `drag`, `scroll`, `type_text`, `press_key`, `hotkey`) | `"background"` (default) injects without fronting or raising the target — the [no-foreground contract](/explanation/the-no-foreground-contract). `"foreground"` briefly fronts the target, acts, then restores the prior frontmost — the explicit last resort when a background attempt did not land. Legacy `"auto"` is removed. |+| `capture_mode` | `get_window_state` | **Deprecated and ignored.** Still accepted for back-compat so old callers don't error, but it has no effect — `get_window_state` always returns both the accessibility tree and a screenshot by default. There is no `ax`/`vision`/`som` capture choice; the modality (`ax` vs `px`) is chosen at action time by how you address the target. |+| `include_screenshot` | `get_window_state` | Boolean, default `true` (returns the tree **and** a screenshot). Set `false` to skip the screenshot grab and return the tree only — a **perf** opt-out for the cheap re-index-before-an-element-`ax`-action path, not a modality choice. |+| `modifier`, `button`, `element_index`, `element_token` | pointer and element tools | Held modifier keys, mouse button, and the two element-addressing handles. |++### Required parameters++The `required` set is uniform across platforms: `click` requires nothing, `scroll` requires `direction`, and `zoom` requires `window_id` plus `x1`/`y1`/`x2`/`y2`. `pid` is **conditionally** required — needed for every per-window action, omitted for a windowless desktop-scope call — so it is validated in code with a clear error rather than pinned in the schema. A client that omits `pid` for a desktop-scope action is therefore not schema-rejected.++### Platform-specific parameters++A few parameters are platform-specific by design and are intentionally NOT part of the shared contract:++| Parameter or tool | Platform | Why |+| ----------------- | -------- | --- |+| `launch_app` identifiers | macOS: `bundle_id`, `urls`. Windows: `aumid`, `launch_path`, `path`, `start_minimized`. | App launch is OS-native. `name` is the portable fallback that works on both. |+| `debug_window_info` | Windows only | A window-handle / class / rect / z-order debug tool with no macOS or Linux counterpart. |+| `check_permissions.prompt` | macOS only | Raises the TCC permission dialogs; there is no Windows or Linux equivalent of TCC. |+| Windowless screen-absolute (desktop-scope) clicks/scrolls | all three platforms, **exposed differently** | The capability exists everywhere, but the knob differs: macOS takes a **per-call `scope:"desktop"`** parameter on the pointer tools, while Windows and Linux gate it on the persisted **`capture_scope:"desktop"`** config (`set_config`). So a per-call `scope` param appears only on macOS; on Windows/Linux you opt in once via config. Unifying this knob is a tracked follow-up. |+| `modifier` on a *background* click | honored on macOS and Linux; dropped on a Windows background click | A Windows background click goes through UIA Invoke / PostMessage, which carry no live keyboard state, so `modifier` takes effect only on the `delivery_mode:"foreground"` (SendInput) rung there. |++## Action response shape++Action tools (`click`, `double_click`, `right_click`, `drag`, `scroll`, `type_text`, `press_key`, `hotkey`, `set_value`) return these structured fields:++| Field | Type | Meaning | Value set / presence |+| ----- | ---- | ------- | -------------------- |+| `path` | string | Delivery rung that ran. | `"ax"`, `"cgevent"`, `"cgevent_fg"`, `"key_events"`, `"key_events_fg"`, `"pixel"`, `"x11_atspi"`, `"x11_pixel"`, `"x11_pixel_fg"`, `"msaa"`. |+| `verified` | boolean or absent | AX read-back verification result. `true` means the driver read the effect back through AX; `false` means the action dispatched but is unconfirmed; absent means the tool does not carry this field. | `true`, `false`, or absent. |+| `effect` | string | Action confidence signal. | `"confirmed"`, `"unverifiable"`, `"suspected_noop"`. |+| `escalation` | object or absent | Machine-readable next-rung recommendation. Present only when the driver recommends climbing the ladder. | `{ recommended: "px" \| "foreground" \| "page", reason: string }`, or absent. |++## Per-tool notes++### `get_window_state` degraded results++On Linux (and macOS/Windows), the structured result may include `degraded: true` alongside a `degraded_reason` string when the accessibility walk completed but found no actionable elements. This distinguishes "a11y bridge not up, daemon not on the session D-Bus, or non-AX surface" from a window that genuinely has no controls — do not treat `elements: []` as authoritative when `degraded: true` is set. When `degraded: true`, act by `px` off the screenshot returned in the same response.++### `page` platform support++`get_text`, `query_dom`, `click_element`, and `execute_javascript` work cross-platform (macOS, Windows, Linux). `insert_text` and `type_keystrokes` are implemented on macOS only for now; Windows and Linux return a clear "not implemented" error rather than a silent no-op. Tracked in [trycua/cua#2084](https://github.com/trycua/cua/issues/2084).diff --git a/docs/content/docs/reference/cua-driver/mcp-tools.mdx b/docs/content/docs/reference/cua-driver/mcp-tools.mdxindex 60bcc8cb41..2817733de0 100644--- a/docs/content/docs/reference/cua-driver/mcp-tools.mdx+++ b/docs/content/docs/reference/cua-driver/mcp-tools.mdx@@ -1,728 +1,741 @@---title: MCP Tools-description: Specification for every MCP tool exposed by Cua Driver+description: Reference for every MCP tool Cua Driver exposes---+{/*+ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY+ Generated by: npx tsx scripts/docs-generators/cua-driver.ts+ Source: cua-driver dump-docs+ Version: 0.7.0+*/}+import { Callout } from 'fumadocs-ui/components/callout';-Cua Driver exposes 36 MCP tools through a single stdio server (`cua-driver mcp`). Every tool is also callable from the shell as `cua-driver call <tool-name> '<JSON-args>'`.+`cua-driver` exposes 38 MCP tools through a single stdio server (`cua-driver mcp`). Every tool is also callable from the shell as `cua-driver <name> '<JSON-args>'`.++Tool names are `snake_case`. Responses are MCP `CallTool.Result` envelopes: a text content block prefixed with a `✅` summary (or the error reason on failure), plus optional image or structured-content blocks on tools that produce them. See the [CLI reference](/reference/cua-driver/cli-reference) for CLI-specific options like `--socket` and `--screenshot-out-file`.-Tool names are `snake_case`. Responses are MCP `CallTool.Result` envelopes: a text content block prefixed with a `✅` summary (or the error reason on failure), plus optional image or structured-content blocks on tools that produce them.+For the cross-cutting parameter contract (shared parameters, required-parameter rules, platform-specific parameters) and the action response shape, see [MCP tool notes](/reference/cua-driver/mcp-tool-notes).<Callout type="info">- Tool names match the CLI dispatch form exactly. `cua-driver call list_apps '{}'` and the MCP `list_apps` tool run the same code path.+ Tool names here match the CLI form exactly. `cua-driver list_apps` and the MCP `list_apps` tool run the same code path.</Callout><Callout type="info">- **TCC auto-delegation.** When an MCP client spawns `cua-driver mcp` from an IDE terminal (Claude Code, Cursor, VS Code, Warp), macOS attributes the subprocess to the parent terminal, not `CuaDriver.app`, so AX probes fail against the wrong bundle id. `mcp` detects this, auto-launches a `cua-driver serve` daemon via `open -n -g -a CuaDriver --args serve`, and proxies every tool call through the daemon's Unix socket. Tool semantics are identical to the in-process path. Pass `--no-daemon-relaunch` (or set `CUA_DRIVER_MCP_NO_RELAUNCH=1`) to force in-process execution.+ **TCC auto-delegation.** When an MCP client spawns `cua-driver mcp` from an IDE terminal (Claude Code, Cursor, VS Code, Warp), macOS attributes the subprocess to the parent terminal — not `CuaDriver.app` — so AX probes fail against the wrong bundle id. `mcp` detects this and auto-launches a `cua-driver serve` daemon via `open -n -g -a CuaDriver --args serve`, then proxies every tool call through the daemon's Unix socket. Tool semantics are identical to the in-process path; no Python bridge is needed. Pass `--no-daemon-relaunch` (or set `CUA_DRIVER_MCP_NO_RELAUNCH=1`) to force in-process execution. See the [process model](/explanation/process-model) for the full lifecycle, failure modes, and wrapper-author guidance.</Callout>------## Common parameters--Several parameters are a **shared cross-platform contract**: the same JSON shape on Windows, macOS, and Linux, composed from canonical schema fragments and enforced by a CI consistency gate so the three platforms cannot drift. Tools accept them uniformly.--| Parameter | Where | Notes |-| --------- | ----- | ----- |-| `session` | every action and cursor tool | Optional run identity for the agent cursor and per-session state; the same id works over MCP, the CLI, or the raw socket and follows the run across apps and windows. Accepted on all three platforms — earlier Windows and Linux builds rejected it via `additionalProperties:false`. |-| `delivery_mode` | the input family (`click`, `double_click`, `right_click`, `drag`, `scroll`, `type_text`, `press_key`, `hotkey`) | `"background"` (default) injects without fronting or raising the target — the [no-foreground contract](/explanation/the-no-foreground-contract). `"foreground"` briefly fronts the target, acts, then restores the prior frontmost — the explicit last resort when a background attempt did not land. Legacy `"auto"` is removed. |-| `capture_mode` | `get_window_state` | **Deprecated and ignored.** Still accepted for back-compat so old callers don't error, but it has no effect — `get_window_state` always returns both the accessibility tree and a screenshot by default. There is no `ax`/`vision`/`som` capture choice; the modality (`ax` vs `px`) is chosen at action time by how you address the target. |-| `include_screenshot` | `get_window_state` | Boolean, default `true` (returns the tree **and** a screenshot). Set `false` to skip the screenshot grab and return the tree only — a **perf** opt-out for the cheap re-index-before-an-element-`ax`-action path, not a modality choice. |-| `modifier`, `button`, `element_index`, `element_token` | pointer and element tools | Held modifier keys, mouse button, and the two element-addressing handles. |--### Required parameters--The `required` set is uniform across platforms: `click` requires nothing, `scroll` requires `direction`, and `zoom` requires `window_id` plus `x1`/`y1`/`x2`/`y2`. `pid` is **conditionally** required — needed for every per-window action, omitted for a windowless desktop-scope call — so it is validated in code with a clear error rather than pinned in the schema. A client that omits `pid` for a desktop-scope action is therefore not schema-rejected.--### Platform-specific parameters--A few parameters are platform-specific by design and are intentionally NOT part of the shared contract:--| Parameter or tool | Platform | Why |-| ----------------- | -------- | --- |-| `launch_app` identifiers | macOS: `bundle_id`, `urls`. Windows: `aumid`, `launch_path`, `path`, `start_minimized`. | App launch is OS-native. `name` is the portable fallback that works on both. |-| `debug_window_info` | Windows only | A window-handle / class / rect / z-order debug tool with no macOS or Linux counterpart. |-| `check_permissions.prompt` | macOS only | Raises the TCC permission dialogs; there is no Windows or Linux equivalent of TCC. |-| Windowless screen-absolute (desktop-scope) clicks/scrolls | all three platforms, **exposed differently** | The capability exists everywhere, but the knob differs: macOS takes a **per-call `scope:"desktop"`** parameter on the pointer tools, while Windows and Linux gate it on the persisted **`capture_scope:"desktop"`** config (`set_config`). So a per-call `scope` param appears only on macOS; on Windows/Linux you opt in once via config. Unifying this knob is a tracked follow-up. |-| `modifier` on a *background* click | honored on macOS and Linux; dropped on a Windows background click | A Windows background click goes through UIA Invoke / PostMessage, which carry no live keyboard state, so `modifier` takes effect only on the `delivery_mode:"foreground"` (SendInput) rung there. |------## Inspection tools### `list_apps`-List macOS apps, both currently running and installed-but-not-running, with per-app state flags.+List macOS apps — both currently running and installed-but-not-running — with per-app state flags:-Per-record fields:+- running: is a process for this app live? (pid is 0 when false)+- active: is it the system-frontmost app? (implies running)+- launch_path: filesystem path to the `.app` bundle, when known. Pass this to `launch_app` to start the app cold.+- kind: `"desktop"` for `.app` bundles on macOS.+- last_used: RFC3339 timestamp from the bundle's filesystem mtime, when readable; otherwise null.-| Field | Description |-| ----- | ----------- |-| `running` | Whether a process for this app is live. `pid` is 0 when false. |-| `active` | Whether it is the system-frontmost app (implies `running`). |-| `launch_path` | Filesystem path to the `.app` bundle, when known. |-| `kind` | `"desktop"` for `.app` bundles on macOS. |-| `last_used` | RFC 3339 timestamp from the bundle's filesystem mtime, or null. |+Only apps with NSApplicationActivationPolicyRegular are included — background helpers and system UI agents are filtered out. Installed apps come from scanning /Applications, /Applications/Utilities, ~/Applications, /System/Applications, and /System/Applications/Utilities.-Only apps with `NSApplicationActivationPolicyRegular` are included. Installed apps are scanned from `/Applications`, `/Applications/Utilities`, `~/Applications`, `/System/Applications`, and `/System/Applications/Utilities`.+Use this for "is X installed?" as well as "is X running?". For per-window state — on-screen, on-current-Space, minimized, window titles — call list_windows instead. For just opening an app — running or not — call launch_app({bundle_id: ...}) directly; list_apps is not a prerequisite.**Arguments:** none.-----### `list_windows`-List all layer-0 top-level windows currently known to WindowServer, including off-screen windows (minimized, on another Space, hidden-launched).+List all layer-0 top-level windows currently known to WindowServer. Includes off-screen windows (minimized, on another Space, hidden-launched). Use this to find a window_id before calling get_window_state.-Per-record fields: `window_id`, `pid`, `app_name`, `title`, `bounds` (x/y/width/height, top-left origin), `z_index` (higher = frontmost), `is_on_screen`, `on_current_space`.+Per-record fields: window_id, pid, app_name, title, bounds (x/y/width/height, top-left origin), z_index (higher = frontmost), is_on_screen, on_current_space.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `on_screen_only` | boolean | No | When true, drop windows not on the current Space. Default false. |-| `pid` | integer | No | Optional pid filter. When set, only this pid's windows are returned. |+**Arguments:**----+- `on_screen_only` (boolean, optional): When true, drop windows not on the current Space. Default false.+- `pid` (integer, optional): Optional pid filter. When set, only this pid's windows are returned.### `get_window_state`-Walk a running app's AX tree and return a Markdown rendering of its UI, tagging every actionable element with `[element_index N]`. Returns **both** the accessibility/UIA tree and a PNG screenshot of the specified window by default — perception is mode-agnostic. You ground on the tree and the screenshot together and cross-check one against the other; you choose the modality (`ax` vs `px`) at action time, not here.+Walk a running app's AX tree and return BOTH a structured `elements` array (preferred) AND a Markdown rendering of the same tree (back-compat). Every actionable element is tagged with [element_index N] in the markdown and as `element_index` in the structured array — pass those indices to click, type_text, press_key, etc.-**Invariant:** call `get_window_state` once per turn per `(pid, window_id)` before any element-indexed action. The index map is replaced by the next snapshot.+INVARIANT: call get_window_state once per turn per (pid, window_id) before any element-indexed action. The index map is replaced by the next snapshot.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `window_id` | integer | Yes | Target window ID from `list_windows`. |-| `capture_mode` | string | No | **Deprecated and ignored.** Accepted for back-compat so old callers don't error, but it has no effect — the tree and the screenshot are both returned regardless of what you pass (`ax`, `vision`, `som`, anything). |-| `include_screenshot` | boolean | No | Default `true` — return the tree and the screenshot. Set `false` to skip the screenshot grab and return the tree only — a perf opt-out for re-indexing before an element `ax` action, not a modality choice. |-| `query` | string | No | Case-insensitive filter for `tree_markdown`. Element indices are unchanged. |-| `screenshot_out_file` | string | No | When set, write the PNG to this file path (`~` expanded) instead of embedding base64 in the response. |+PREFERRED CONSUMERS read `structuredContent.elements` (one entry per indexed row with `element_index`, `role`, `label`, `value` (the element's text/AXValue when present — use it to verify what a field holds), `frame: {x,y,w,h}`, `parent_index`, `depth`). The markdown `tree_markdown` stays available and unchanged in shape for existing text-parsing callers — but new fields will only be added to the structured side.-```json-{"pid": 844, "window_id": 10725}-```+Always returns BOTH the element tree AND a screenshot — ground on both and cross-check (the tree lies on some surfaces: Electron echo-confirms, Catalyst null values, virtualized off-viewport rows with `h:1` frames). You choose the modality at ACTION time, not here: an element ax action (pass `element_index`/`element_token` → the accessibility rung) or an element px action (pass `x`,`y` → the pixel rung, read straight off this screenshot). `capture_mode` is deprecated and ignored. Pass `include_screenshot:false` to skip the grab and get the tree only — the cheap path when you're just re-indexing before an element ax action.-On Linux (and macOS/Windows), the structured result may include `degraded: true` alongside a `degraded_reason` string when the accessibility walk completed but found no actionable elements. This distinguishes "a11y bridge not up, daemon not on the session D-Bus, or non-AX surface" from a window that genuinely has no controls — do not treat `elements: []` as authoritative when `degraded: true` is set. When `degraded: true`, act by `px` off the screenshot returned in the same response.+Optional `query` filters the tree_markdown to matching lines plus their ancestor chain (case-insensitive substring). The element_index values are unchanged — filtering only trims the rendered Markdown.----+Optional `max_elements` / `max_depth` bound the AX walk to mitigate context-window blow-up on Electron / Obsidian / large web apps that produce 10k+ element trees (#22865). When applied, BOTH the markdown and the structured elements are truncated identically. Omit both for current default behaviour (≤2 000 elements, depth ≤25).++**Arguments:**++- `capture_mode` (string, optional): DEPRECATED and ignored. get_window_state always returns BOTH the element tree and a screenshot — ground on both. The modality is chosen at action time by how you address the target: an element ax action (element_index/element_token) or an element px action (x,y). Any value (including the old "som"/"screenshot" aliases) is accepted but has no effect.+- `include_screenshot` (boolean, optional): Default true — returns a grounding screenshot alongside the tree. Set false to skip the grab and return the tree only (the cheap path when you're just re-indexing before an element ax action; saves the image tokens + screen-grab latency). screenshot_out_file still forces a capture to disk.+- `max_depth` (integer, optional): Cap on the AX-tree walk depth. Nodes whose rendered indent would exceed this are omitted. Omit for the default (25). Lower this for deep menu/Electron trees (#22865).+- `max_elements` (integer, optional): Cap on the total number of AX nodes walked. Truncates depth-first; markdown and structured elements truncate together. Omit for the default (2 000). Lower this for Electron / Obsidian / large web apps that produce 10k+ element trees and blow context windows (#22865).+- `pid` (integer, required): Target process ID.+- `query` (string, optional): Case-insensitive filter for tree_markdown.+- `screenshot_out_file` (string, optional): When set, write the PNG to this file path (~ expanded) instead of embedding base64 in the response. The structured output will contain screenshot_file_path instead.+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `window_id` (integer, required): Target window ID from list_windows.++```json+{"pid":844,"window_id":10725}+```### `get_accessibility_tree`-Return a lightweight snapshot of the desktop: running regular apps and on-screen visible windows with their bounds, z-order, and owner pid. No TCC grants required.+Return a lightweight snapshot of the desktop: running regular apps and on-screen visible windows with their bounds, z-order, and owner pid.++For the full AX subtree of a single window (with interactive element indices you can click by), use `get_window_state` instead — that's the heavy per-window tool. This one is a fast discovery read that needs no TCC grants.**Arguments:** none.----+### `get_desktop_state`++Capture a full-display vision screenshot in true screen pixels (no downscale), for scope="desktop" GUI loops where the agent then drives click(x,y, scope="desktop") with no pid/window_id. Returns the PNG at native display resolution plus the true screen size and backing scale factor so screen-absolute pixel picks land exactly. Vision-only: no AX tree walk.++**Arguments:**++- `screenshot_out_file` (string, optional): Write PNG here instead of base64.+- `session` (string, optional): Optional session id.### `get_screen_size`-Return the logical size of the main display in points plus its backing scale factor. Agents click in points; Retina displays have `scale_factor` 2.0. Requires no TCC permissions.+Return the logical size of the main display in points plus its backing scale factor. Agents click in points; Retina displays have scale_factor 2.0. Requires no TCC permissions.**Arguments:** none.-----### `get_cursor_position`Return the current mouse cursor position in screen points (origin top-left).**Arguments:** none.-----### `get_config`Return the current cua-driver-rs configuration.**Arguments:** none.-----### `get_recording_state`-Report the current trajectory recorder state: whether recording is enabled, the output directory (when enabled), and the 1-based counter for the next turn folder. Counter increments on every recorded action tool call and resets to 1 each time recording is (re-)enabled. Pure read-only.+Report the current trajectory recorder state: whether recording is enabled, the output directory (when enabled), and the 1-based counter for the next turn folder that will be written. Counter increments on every recorded action tool call and resets to 1 each time recording is (re-)enabled.-**Arguments:** none.+Pure read-only.----+**Arguments:** none.### `get_agent_cursor_state`-Return the current state of this session's agent cursor: position, config (color, icon, label, size, opacity), enabled flag. Scoped to the cursor the call resolves to (precedence: explicit `cursor_id` > session identity > `"default"`).+Return the current state of THIS session's agent cursor: position, config (color, icon, label, size, opacity), enabled flag. Pass cursor_id to inspect a specific instance.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `cursor_id` | string | No | Cursor instance to inspect. Omit to target the calling session's own cursor (macOS); the anonymous path targets `"default"`. |+**Arguments:**----+- `cursor_id` (string, optional): Cursor instance. Default: this session's cursor.## Action tools### `launch_app`-Launch a macOS app in the background. The target does NOT come to the foreground.+Launch a macOS app in the background — the target does NOT come to the foreground.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `bundle_id` | string | No | App bundle identifier, e.g. `com.apple.calculator`. Preferred over `name`. |-| `name` | string | No | App display name. Used only when `bundle_id` is absent. |-| `urls` | array of string | No | File paths or URLs to open with the app. |-| `electron_debugging_port` | integer | No | Open a Chrome DevTools Protocol server on this port (appends `--remote-debugging-port=N`). |-| `webkit_inspector_port` | integer | No | Open a WebKit inspector server on this port (sets `WEBKIT_INSPECTOR_SERVER` env var). |-| `creates_new_application_instance` | boolean | No | When true, force a new app instance even if already running (`open -n`). Use for concurrent multi-agent/multi-session work. |-| `additional_arguments` | array of string | No | Extra arguments appended after `--args` when launching. |+Provide either `bundle_id` (preferred — unambiguous, e.g. `com.apple.calculator`) or `name` (e.g. "Calculator"). If both are given, bundle_id wins.-Returns the launched app's `pid`, `bundle_id`, `name`, and a `windows` array (same shape as `list_windows`). When the focus-steal demotion check ran, the response also includes `self_activation_suppressed: bool`.+Optional `urls` are handed to the app as open targets — for Finder, pass a folder path to open a backgrounded Finder window there.----+Optional `cdp_debugging_port`: opens a Chrome DevTools Protocol (CDP) server on the specified port (appends --remote-debugging-port=N to the app's argv). Use this to automate Electron/VS Code/Cursor, or Chrome/Brave/Edge, via CDP.++Optional `webkit_inspector_port`: opens a WebKit inspector server on the specified port (sets WEBKIT_INSPECTOR_SERVER=127.0.0.1:N + TAURI_WEBVIEW_AUTOMATION=1). Use this for Tauri/WebKit-based apps.++Optional `creates_new_application_instance`: when true, forces a new app instance even if one is already running (passes -n to open). Reach for this when another agent or session may drive the SAME app concurrently — it returns a fresh pid + window so each session acts on its own isolated window instead of clobbering one shared instance. Without it, single-instance apps (Calculator, many utilities) hand every caller the same window, so two sessions fight over it.++Optional `additional_arguments`: extra argv strings appended after --args.++Returns the launched app's pid, bundle_id, name, and a `windows` array (same shape as `list_windows`) so callers can skip an extra round-trip before `get_window_state(pid, window_id)`. When the focus-steal belt-and-braces demotion check ran (target pid ≠ prior frontmost), the response also includes `self_activation_suppressed: bool` — true if focus stayed with the prior frontmost, false if the launched app held focus despite the re-demote attempt.++**Arguments:**++- `additional_arguments` (array of string, optional): Extra arguments appended after --args when launching.+- `bundle_id` (string, optional): App bundle identifier, e.g. com.apple.calculator. Preferred over name.+- `cdp_debugging_port` (integer, optional): Open a Chrome DevTools Protocol server on this port (appends --remote-debugging-port=N).+- `creates_new_application_instance` (boolean, optional): When true, force a new app instance even if already running (open -n). Use for concurrent multi-agent/multi-session work so each session gets an isolated instance + window instead of sharing one — on single-instance apps (e.g. Calculator) every caller otherwise gets the same window and the sessions clobber each other.+- `name` (string, optional): App display name. Used only when bundle_id is absent.+- `urls` (array of string, optional): Optional file paths or URLs to open with the app (e.g. a folder path for Finder).+- `webkit_inspector_port` (integer, optional): Open a WebKit inspector server on this port (sets WEBKIT_INSPECTOR_SERVER env var).### `kill_app`-Force-terminate a process by pid (kill -9 equivalent on macOS / Linux; `taskkill /F` equivalent on Windows). Unsaved state is lost.+Force-terminate a process by pid (kill -9 equivalent on macOS / Linux; taskkill /F equivalent on Windows). Use as escalation when the cooperative close path (hotkey cmd+q on macOS, click-the-X on Windows) failed to make the process exit. Unsaved state is lost — prefer the cooperative path first.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | PID of the process to terminate. |+**Arguments:**++- `pid` (integer, required): PID of the process to terminate.```json-{"pid": 844}+{"pid":844}```-----### `bring_to_front`-Persistently activate an app so it genuinely holds the foreground, then leave it there. Most input does **not** need this: on Windows it removes the per-call `SetForegroundWindow` flash before a `dispatch:"foreground"` run, and on macOS every dispatch already reaches backgrounded windows. Reach for it only for a focus-proxy surface that re-arms its own input channel on activation and must stay frontmost across the interaction — chiefly a remote-desktop client (Microsoft Windows App / RDP), where the brief foreground flash drops keystrokes. On macOS it activates the owning app by pid via `NSRunningApplication.activate` (`window_id` accepted for parity, activation is app-level). On Linux this tool stubs out (use `wmctrl -a` / `xdotool windowactivate`).+Persistently activate an app so it genuinely holds macOS foreground, then leave it there. Most input does NOT need this — every macOS dispatch reaches backgrounded windows, and `dispatch:"foreground"` does its own brief front→act→restore. Reach for `bring_to_front` only for a focus-proxy surface that re-arms its own input channel on activation and must stay frontmost across the interaction — chiefly a remote-desktop client (Microsoft Windows App / RDP), where the brief flash drops keystrokes. Activates the owning app by pid (`NSRunningApplication.activate`); `window_id` is accepted for parity but activation is app-level. This DOES steal foreground — explicit opt-in, never used by the input ladder.++**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `window_id` | integer | No | Optional target window ID. |+- `pid` (integer, required)+- `window_id` (integer, optional)```json-{"pid": 844}+{"pid":844}```-----### `click`-Left-click against a target pid.+Click against a target pid. **Prefer `element_index` over pixel coordinates** — element_index works on backgrounded / minimized / hidden / off-Space windows, surfaces a stable handle that survives rebuilds, and tells you what you're clicking via the cached element's role + label. Reach for `x, y` only when the target is a canvas / video / WebGL / custom-drawn surface that doesn't appear in the AX tree.Two addressing modes:-- **Element index** (`element_index` + `window_id`): AX action path. Works on backgrounded/hidden windows. No cursor move, no focus steal. Cache is scoped per `(pid, window_id)` and is replaced by the next snapshot.-- **Pixel** (`x`, `y`): CGEvent path. Synthesizes mouse events posted to pid. Needs a visible on-screen window.-- **Screen-absolute** (`x`, `y` with no window owner, under `capture_scope: desktop`): clicks true screen coordinates even when no window owns the point (desktop background, menu-extra gaps). The button is preserved — a windowless `right_click`/middle no longer downgrades to left.--| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `element_index` | integer | No | Element index from last `get_window_state`. Requires `pid` and `window_id` alongside it — `element_index` with no `pid` fails fast with `Missing required integer field: pid` (it is not a silent no-op). |-| `window_id` | integer | No | Target window ID. Required for `element_index`. |-| `x` | number | No | Window-local screenshot X coordinate. |-| `y` | number | No | Window-local screenshot Y coordinate. |-| `action` | string | No | AX action: `press` (default), `show_menu`, `pick`, `confirm`, `cancel`, `open`. |-| `count` | integer | No | Click count (pixel path only). Default 1. |-| `modifier` | array of string | No | Modifier keys: `cmd`, `shift`, `option`/`alt`, `ctrl`. |-| `from_zoom` | boolean | No | When true, `x` and `y` are in the last zoom image for this pid; driver translates back to full-window coordinates. |-| `debug_image_out` | string | No | File path for a diagnostic screenshot with a red crosshair at (x, y). |+- element_index + window_id (from last get_window_state): AX action path. Works on backgrounded/hidden windows. No cursor move, no focus steal. element_index cache is scoped per (pid, window_id) and is replaced by the next snapshot of the same window — re-snapshot every turn before clicking.-```json-{"pid": 844}-```+- x, y (window-local screenshot pixels, top-left origin of the PNG returned by get_window_state): CGEvent path. Synthesizes mouse events and posts to pid. Use modifier for cmd/shift/option/ctrl. Needs a visible on-screen window to anchor the conversion.----+button: "left" (default), "right", or "middle". Defaults to left so the field is fully back-compat — omit it and you get the legacy left-click behaviour. Pixel path: routes through the CGEvent left/right/middle mouse-button primitives. AX path: "right" maps to AXShowMenu (same surface as the dedicated `right_click` tool); "middle" has no AX equivalent and falls back to a pixel middle-click at the element's center.+action: press (default), show_menu, pick, confirm, cancel, open.+from_zoom: set true after a zoom call to auto-translate zoom-image pixel coordinates to full-window space.++**Arguments:**++- `action` (string, optional): AX action: press, show_menu, pick, confirm, cancel, open.+- `button` (string, optional): Mouse button. Default: "left" — omit for legacy left-click behaviour. Pixel path uses the matching CGEvent primitive; AX path maps "right" to AXShowMenu and falls back to a pixel middle-click at the element's center for "middle".+- `count` (integer, optional): Click count (pixel path only). Default 1.+- `debug_image_out` (string, optional): Optional file path. When set on a pixel-addressed click, captures a fresh screenshot, draws a red crosshair at (x, y), and writes the PNG. Use to verify coordinate spaces. Requires window_id; incompatible with from_zoom.+- `delivery_mode` (string, optional): Best-effort-background ladder rung for a PIXEL click (default "background"). "background": post the CGEvent to the pid without fronting. "foreground": briefly front the window, click, restore the prior frontmost — the explicit last resort for surfaces that drop background synthetic clicks. Requires window_id. A click is never driver-verifiable (no read-back), so both report verified:false — confirm the effect via screenshot. Use the agent loop: background AX (element_index) → screenshot → background pixel (x/y) → screenshot → delivery_mode:"foreground".+- `element_index` (integer, optional): Element index from last get_window_state. REQUIRES `pid` and `window_id` to be passed alongside it — element_index alone (no pid) fails fast with "Missing required integer field: pid"; it is not a silent no-op.+- `element_token` (string, optional): Opaque per-snapshot element handle from `structuredContent.elements[].element_token` of the last get_window_state. Takes precedence over element_index when both supplied. Returns an explicit "stale" error if the snapshot has been superseded — re-snapshot in that case.+- `from_zoom` (boolean, optional): When true, x and y are in the last zoom image for this pid; driver translates back to full-window coordinates.+- `modifier` (array of string, optional): Modifier keys: cmd, shift, option/alt, ctrl.+- `pid` (integer, optional): Target process ID.+- `scope` (string, optional): Coordinate frame for a windowless screen-absolute click (default "window"). Pass "desktop" when sending x,y with NO pid/window_id — the coordinates are then true screen pixels (read from get_desktop_state with scope="desktop"). Per-call; not a setting.+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `window_id` (integer, optional): Target window ID. Required for element_index. Optional when element_token is supplied (the token carries it).+- `x` (number, optional): X in screenshot pixels, read straight off the image you were handed — no scaling math needed. With pid+window_id (capture_scope=window): window-local pixels from the get_window_state PNG (top-left origin). Windowless (no pid/window_id, capture_scope=desktop): pixels from the get_desktop_state PNG (the native full-display image). Either way, the pixel you read IS the pixel that gets clicked; the driver undoes the Retina backing scale + any downscale internally.+- `y` (number, optional): Y in screenshot pixels (see x). Window-local from get_window_state, or full-display from get_desktop_state under capture_scope=desktop.### `double_click`-Double-click at `(x, y)` or on an AX element identified by `element_index` + `window_id`.+Double-click at (x, y) or on an AX element identified by element_index + window_id.-AX path: performs `AXOpen` when the element advertises it; otherwise resolves the element's on-screen center and falls back to a pixel double-click.+AX path (element_index provided): performs `AXOpen` when the element advertises it (Finder items, openable list rows/cells); otherwise resolves the element's on-screen center and falls back to a pixel double-click there.-Pixel path: two down/up pairs ~80 ms apart.+Pixel path (x, y provided): two down/up pairs ~80 ms apart at the given coordinates.++**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `element_index` | integer | No | Element index from last `get_window_state`. Uses AX path. Requires `pid` and `window_id` alongside it — `element_index` with no `pid` fails fast with `Missing required integer field: pid` (it is not a silent no-op). |-| `window_id` | integer | No | CGWindowID. Required when `element_index` is used. |-| `x` | number | No | Screen X coordinate (pixel path). |-| `y` | number | No | Screen Y coordinate (pixel path). |+- `delivery_mode` (string, optional): Best-effort-background ladder rung (default "background"). "background": inject without fronting or raising the target — no focus steal. "foreground": briefly front the target, act, then restore the prior frontmost — the explicit last resort when a background attempt didn't land. Re-call with "foreground" only for the action that needs it.+- `element_index` (integer, optional): Element index from last get_window_state. Uses AX path. REQUIRES `pid` and `window_id` to be passed alongside it — element_index alone (no pid) fails fast with "Missing required integer field: pid"; it is not a silent no-op.+- `element_token` (string, optional): Opaque per-snapshot element handle from `structuredContent.elements[].element_token`. Takes precedence over element_index when both supplied. Returns an explicit "stale" error if the snapshot has been superseded.+- `pid` (integer, required)+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `window_id` (integer, optional): CGWindowID. Required when element_index is used. Optional when element_token is supplied (the token carries it).+- `x` (number, optional): Screen X coordinate (pixel path).+- `y` (number, optional): Screen Y coordinate (pixel path).```json-{"pid": 844}+{"pid":844}```-----### `right_click`-Right-click against a target pid.+Right-click against a target pid. Two addressing modes:-Two addressing modes:+- `element_index` + `window_id` (from the last `get_window_state` snapshot) — performs `AXShowMenu` on the cached element. Pure AX RPC, works on backgrounded / hidden windows, no cursor move or focus steal. Requires a prior `get_window_state(pid, window_id)` in this turn.-- **Element index** (`element_index` + `window_id`): performs `AXShowMenu`. Pure AX RPC, works on backgrounded/hidden windows.-- **Pixel** (`x`, `y`): synthesizes `rightMouseDown`/`rightMouseUp` CGEvent pair posted to the pid.+- `x`, `y` — synthesizes `rightMouseDown` / `rightMouseUp` CGEvent pair posted to the pid. Driver converts image-pixel → screen-point internally. `modifier` forces the CGEvent path (AX actions don't propagate modifier keys).-Exactly one of `element_index` or (`x` AND `y`) must be provided. `pid` always required.+Exactly one of `element_index` or (`x` AND `y`) must be provided. `pid` always required. `window_id` required when `element_index` is used.++**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `element_index` | integer | No | Element index from last `get_window_state`. Routes through `AXShowMenu`. Requires `pid` and `window_id` alongside it — `element_index` with no `pid` fails fast with `Missing required integer field: pid` (it is not a silent no-op). |-| `window_id` | integer | No | CGWindowID. Required when `element_index` is used. |-| `x` | number | No | X in window-local screenshot pixels. |-| `y` | number | No | Y in window-local screenshot pixels. |-| `modifier` | array of string | No | Modifier keys held during right-click: `cmd`/`shift`/`option`/`ctrl`. Pixel path only. |+- `delivery_mode` (string, optional): Best-effort-background ladder rung (default "background"). "background": inject without fronting or raising the target — no focus steal. "foreground": briefly front the target, act, then restore the prior frontmost — the explicit last resort when a background attempt didn't land. Re-call with "foreground" only for the action that needs it.+- `element_index` (integer, optional): Element index from last get_window_state. Routes through AXShowMenu. REQUIRES `pid` and `window_id` to be passed alongside it — element_index alone (no pid) fails fast with "Missing required integer field: pid"; it is not a silent no-op.+- `element_token` (string, optional): Opaque per-snapshot element handle from `structuredContent.elements[].element_token`. Takes precedence over element_index when both supplied. Returns an explicit "stale" error if the snapshot has been superseded.+- `modifier` (array of string, optional): Modifier keys held during the right-click: cmd/shift/option/ctrl. Pixel path only.+- `pid` (integer, required): Target process ID.+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `window_id` (integer, optional): CGWindowID. Required when element_index is used. Optional when element_token is supplied (the token carries it).+- `x` (number, optional): X in window-local screenshot pixels. Must be provided together with y.+- `y` (number, optional): Y in window-local screenshot pixels. Must be provided together with x.```json-{"pid": 844}+{"pid":844}```-----### `drag`-Press-drag-release gesture from `(from_x, from_y)` to `(to_x, to_y)` in window-local screenshot pixels.--| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `from_x` | number | Yes | Drag-start X in window-local screenshot pixels. |-| `from_y` | number | Yes | Drag-start Y in window-local screenshot pixels. |-| `to_x` | number | Yes | Drag-end X in window-local screenshot pixels. |-| `to_y` | number | Yes | Drag-end Y in window-local screenshot pixels. |-| `window_id` | integer | No | CGWindowID for the window the pixel coordinates were measured against. |-| `duration_ms` | integer | No | Wall-clock duration of the drag path between mouseDown and mouseUp. Default 500. |-| `steps` | integer | No | Number of intermediate mouseDragged events. Default 20. |-| `modifier` | array of string | No | Modifier keys held across the entire gesture: `cmd`/`shift`/`option`/`ctrl`. |-| `button` | string | No | Mouse button used for the drag. Default: `left`. |-| `from_zoom` | boolean | No | When true, coordinates are in the last zoom image for this pid. |+Press-drag-release gesture from (from_x, from_y) to (to_x, to_y) in window-local screenshot pixels — the same space get_window_state returns. Top-left origin of the target's window.++Use for: marquee/lasso selection, drag-and-drop, resizing via a handle, scrubbing a slider, repositioning a panel.++`duration_ms` (default 500) is the wall-clock budget for the path between mouse-down and mouse-up; `steps` (default 20) is the number of intermediate mouseDragged events linearly interpolated along the path. Increase both for slower, more human drags; decrease for snap gestures.++`modifier` keys (cmd/shift/option/ctrl) are held across the entire gesture.++When `from_zoom` is true, coordinates are in the last zoom image for this pid; the driver maps them back to window coordinates before dispatching.++**Arguments:**++- `button` (string, optional): Mouse button used for the drag. Default: left.+- `delivery_mode` (string, optional): Best-effort-background ladder rung (default "background"). "background": inject without fronting or raising the target — no focus steal. "foreground": briefly front the target, act, then restore the prior frontmost — the explicit last resort when a background attempt didn't land. Re-call with "foreground" only for the action that needs it.+- `duration_ms` (integer, optional): Wall-clock duration of the drag path between mouseDown and mouseUp. Default: 500.+- `from_x` (number, required): Drag-start X in window-local screenshot pixels. Top-left origin.+- `from_y` (number, required): Drag-start Y in window-local screenshot pixels. Top-left origin.+- `from_zoom` (boolean, optional): When true, coordinates are in the last zoom image for this pid; driver maps back to window coordinates.+- `modifier` (array of string, optional): Modifier keys held across the entire gesture: cmd/shift/option/ctrl.+- `pid` (integer, required): Target process ID.+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `steps` (integer, optional): Number of intermediate mouseDragged events linearly interpolated along the path. Default: 20.+- `to_x` (number, required): Drag-end X in window-local screenshot pixels.+- `to_y` (number, required): Drag-end Y in window-local screenshot pixels.+- `window_id` (integer, optional): CGWindowID for the window the pixel coordinates were measured against. Optional — when omitted the driver picks the frontmost window of pid.```json-{"from_x": 100, "from_y": 200, "pid": 844, "to_x": 300, "to_y": 400}+{"from_x":100,"from_y":200,"pid":844,"to_x":100,"to_y":200}```-----### `type_text`-Insert text into the target pid via `AXSetAttribute(kAXSelectedText)`. Works for standard Cocoa text fields and text views. No keystrokes are synthesized. For Chromium/Electron inputs that don't implement `kAXSelectedText`, the tool falls back to CGEvent character synthesis automatically.--Two addressing forms — mutually exclusive:+Insert text into the target pid via `AXSetAttribute(kAXSelectedText)`. Works for standard Cocoa text fields and text views. No keystrokes are synthesized — special keys (Return / Escape / arrows) go through `press_key` / `hotkey`. For Chromium / Electron inputs that don't implement `kAXSelectedText`, the tool falls back to CGEvent character synthesis automatically.-- **Element index** (`element_index` + `window_id`): the **element ax action**. Directs the write to a specific field, no pre-click.-- **Pixel** (`x`, `y`, no `element_index`): the **element px action**. The tool pixel-clicks at `(x, y)` to establish real renderer focus, then types into the now-focused element (reusing `click`'s coordinate translation and `delivery_mode`). This is the one-call fix for Chromium/Electron inputs the AX path can't reach — read `x, y` off the `get_window_state` screenshot, same convention as `click`.+Optional `element_index` + `window_id` (from the last `get_window_state` snapshot) directs the write to a specific field. Without `element_index`, the write goes to the pid's currently focused element.-Keyboard px form: `x, y` are accepted and are mutually exclusive with `element_index`.+WEB CONTENT (Chromium/WebKit/Electron — browser tabs, Slack, VS Code, X's compose box): the AX layer accepts a write and echoes it back through AXValue while the renderer/DOM never observes it. The driver detects this at the element level (an AXWebArea ancestor) and refuses to trust that echo — an AX-path insert into web content returns effect:"unverifiable" + escalation, never a false "confirmed" (a browser's own native address bar/toolbar stays trusted). For a browser TAB the reliable path is the `page` tool (drives the DOM via CDP); for an embedded web view use this tool's px form: pass x,y (no element_index) to pixel-click the field then type, in one call. NOTE: a px focus-click won't reliably open+focus a CLOSED control; AX-press to open/activate it first (works in the background), then px-type. Always confirm via the screenshot; if px-background still drops, escalate to delivery_mode:"foreground".-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `text` | string | Yes | Text to insert at the target's cursor. |-| `element_index` | integer | No | Element index from last `get_window_state`. Directs the write to a specific field. Requires `pid` and `window_id` alongside it — `element_index` with no `pid` fails fast with `Missing required integer field: pid` (it is not a silent no-op). Mutually exclusive with `x`/`y`. |-| `window_id` | integer | No | CGWindowID. Required when `element_index` is used. |-| `x` | number | No | Window-local screenshot X of the field to type into — the px form. Pass with `y` and no `element_index`; the tool pixel-clicks there to focus, then types. |-| `y` | number | No | Window-local screenshot Y of the field. See `x`. |-| `delay_ms` | integer | No | Milliseconds between characters in the CGEvent fallback path. Default 30. Ignored when the AX path succeeds. |+**Arguments:**-```json-{"pid": 844, "text": "hello"}-```+- `delay_ms` (integer, optional): Milliseconds between characters in the CGEvent fallback path. Default 30. Ignored when the AX path succeeds.+- `delivery_mode` (string, optional): Best-effort-background ladder rung (default "background"). "background": AX insert, then CGEvent keystrokes if needed — no focus steal; the driver verifies via an AXValue read-back and reports `verified`. "foreground": briefly front the window, type, restore the prior frontmost — the explicit last resort for focus-sensitive surfaces (e.g. WhatsApp/Catalyst) where background keystrokes don't land. Re-call with "foreground" when a background attempt returns `verified:false` and a screenshot shows the text didn't appear.+- `element_index` (integer, optional): Element index from last get_window_state. Directs the write to a specific field. REQUIRES `pid` and `window_id` to be passed alongside it — element_index alone (no pid) fails fast with "Missing required integer field: pid"; it is not a silent no-op.+- `element_token` (string, optional): Opaque per-snapshot element handle from `structuredContent.elements[].element_token`. Takes precedence over element_index when both supplied. Returns an explicit "stale" error if the snapshot has been superseded.+- `pid` (integer, required): Target process ID.+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `text` (string, required): Text to insert at the target's cursor.+- `window_id` (integer, optional): CGWindowID. Required when element_index is used. Optional when element_token is supplied (the token carries it).+- `x` (number, optional): Screenshot-pixel X of the field to type into — the element px action form. Pass x,y (no element_index) and the tool pixel-clicks there to establish real renderer focus, then types. Use for Chromium/Electron inputs the AX path can't reach. Read straight off the get_window_state PNG, same convention as click.+- `y` (number, optional): Screenshot-pixel Y of the field (see x).```json-{"pid": 844, "window_id": 10725, "x": 320, "y": 210, "text": "hello"}+{"pid":844,"text":"hello"}```-----### `press_key`-Press and release a single key, delivered to the target pid via `CGEventPostToPid`. No focus steal.--Delivery paths:-- `window_id` + `element_index` (ax): focuses the AX element first, then posts via the auth-message path (Chromium-safe).-- `x`, `y`, no `element_index` (px): pixel-clicks at `(x, y)` to establish real renderer focus, then sends the key to the now-focused element. Use when the key must reach a Chromium/Electron surface the AX path can't focus. Mutually exclusive with `element_index`.-- `window_id` only (no `element_index`): NSMenu path. Briefly activates the window, posts without the auth envelope so `IOHIDPostEvent` fires and `NSApplication.sendEvent:` dispatches NSMenu key equivalents. Restores prior frontmost immediately.-- No `window_id`: standard auth-message path.+Press and release a single key, delivered to the target pid via CGEventPostToPid. Follows the same `delivery_mode` ladder as click/type_text — it does NOT raise the window by default:+• `background` (default): post to the pid WITHOUT fronting/raising — the auth-message path (Chromium-safe). With element_index it focuses that AX element first. `window_id` only targets; it does not raise.+• `foreground`: briefly front the window (NSMenu path, < 1 ms) so native menu key-equivalents dispatch, then restore prior frontmost — the explicit escalation for menu shortcuts an app drops in the background. Requires window_id (and no element_index).-Keyboard px form: `x, y` are accepted and are mutually exclusive with `element_index`.+A key press is never driver-verifiable → effect:"unverifiable"; confirm via screenshot. Key names: return, tab, escape, up/down/left/right, space, delete, home, end, pageup, pagedown, f1-f12, plus any letter or digit. Modifiers array: cmd, shift, option/alt, ctrl, fn.-Key names: `return`, `tab`, `escape`, `up`/`down`/`left`/`right`, `space`, `delete`, `home`, `end`, `pageup`, `pagedown`, `f1`–`f12`, plus any letter or digit.+**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `key` | string | Yes | Key name: `return`, `tab`, `escape`, `up`, `down`, etc. |-| `modifiers` | array of string | No | Modifier keys: `cmd`, `shift`, `option`/`alt`, `ctrl`, `fn`. |-| `element_index` | integer | No | Element index (ax). Mutually exclusive with `x`/`y`. |-| `window_id` | integer | No | Target window ID. |-| `x` | number | No | Window-local screenshot X — the px form: pixel-click there to focus, then send the key. Pass with `y`, no `element_index`. |-| `y` | number | No | Window-local screenshot Y. See `x`. |+- `delivery_mode` (string, optional): Best-effort-background ladder rung (default "background"). "background": inject without fronting or raising the target — no focus steal. "foreground": briefly front the target, act, then restore the prior frontmost — the explicit last resort when a background attempt didn't land. Re-call with "foreground" only for the action that needs it.+- `element_index` (integer, optional)+- `element_token` (string, optional): Opaque per-snapshot element handle from `structuredContent.elements[].element_token`. Takes precedence over element_index when both supplied. Returns an explicit "stale" error if the snapshot has been superseded.+- `key` (string, required): Key name: return, tab, escape, up, down, etc.+- `modifiers` (array of string, optional): Modifier keys: cmd, shift, option/alt, ctrl, fn.+- `pid` (integer, required)+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `window_id` (integer, optional): Target window. Required for delivery_mode:"foreground". Does NOT itself raise the window — raising is gated on delivery_mode.+- `x` (number, optional): Screenshot-pixel X — the element px action form: pixel-click there to focus, then send the key. Use when the key must go to a Chromium/Electron surface the AX path can't focus. Pass with y, no element_index.+- `y` (number, optional): Screenshot-pixel Y (see x).```json-{"key": "return", "pid": 844}+{"key":"return","pid":844}```-----### `hotkey`-Press a combination of keys simultaneously. The combo is posted directly to the target pid's event queue; the target does NOT need to be frontmost.+Press a key combination — e.g. `["cmd", "c"]` for Copy, `["cmd", "shift", "4"]` for screenshot selection. Follows the same `delivery_mode` ladder as click/type_text — it does NOT raise the window by default:+• `background` (default): post the combo to the target pid WITHOUT fronting or raising it — uses the macOS 14+ auth-message envelope so Chromium/Electron accept it as trusted live input. No focus steal. `window_id` here only targets the combo; it does not raise.+• `foreground`: briefly front the window (NSMenu path, < 1 ms via SLPSSetFrontProcessWithOptions) so native menu key-equivalents (Cmd+Z, Cmd+W) dispatch, then restore the prior frontmost — the explicit escalation for menu-bar shortcuts on non-Chromium apps that ignore a background combo. Requires window_id.-Delivery paths:-- `window_id` + `element_index` (ax): focuses the AX element first, then posts the combo.-- Default (no `window_id`): auth-message envelope. Chromium/Electron apps accept the keystrokes as trusted live input on macOS 14+.-- `x`, `y`, no `element_index` (px): pixel-clicks at `(x, y)` to establish real renderer focus first, then sends the combo to the now-focused field — e.g. `["cmd", "v"]` to paste into a specific Chromium/Electron input the background combo can't reach. A keyboard combo on its own does not focus a field.-- With `window_id`: NSMenu path. Briefly activates the target WindowServer-frontmost, posts without the auth envelope so `IOHIDPostEvent` fires and NSMenu key equivalents dispatch (e.g. Cmd+Z undo, Cmd+W close). Restores prior frontmost immediately.+A combo is never driver-verifiable (no read-back) → effect:"unverifiable"; confirm via screenshot. NOTE: a keyboard combo does NOT focus a text field — to type into a backgrounded Electron input, establish real renderer focus with a PIXEL click first, then `type_text` (do not reach for a clipboard + Cmd+V dance).-Keyboard px form: `x, y` are accepted and are mutually exclusive with `element_index`.+Recognized modifiers: cmd/command, shift, option/alt, ctrl/control, fn. Non-modifier keys use the same vocabulary as `press_key`. Order: modifiers first, one non-modifier last.-Recognized modifiers: `cmd`/`command`, `shift`, `option`/`alt`, `ctrl`/`control`, `fn`. Order: modifiers first, one non-modifier last.+**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `keys` | array of string | Yes | Modifier(s) and one non-modifier key, e.g. `["cmd", "c"]`. |-| `element_index` | integer | No | Element index (ax). Mutually exclusive with `x`/`y`. |-| `window_id` | integer | No | Target window ID. Required when `element_index` or `x, y` is used; without an element or pixel target, setting `window_id` uses the NSMenu path. |-| `x` | number | No | Window-local screenshot X — the px form: pixel-click there to focus, then send the combo. Pass with `y`. |-| `y` | number | No | Window-local screenshot Y. See `x`. |+- `delivery_mode` (string, optional): Best-effort-background ladder rung (default "background"). "background": inject without fronting or raising the target — no focus steal. "foreground": briefly front the target, act, then restore the prior frontmost — the explicit last resort when a background attempt didn't land. Re-call with "foreground" only for the action that needs it.+- `keys` (array of string, required): Modifier(s) and one non-modifier key, e.g. ["cmd", "c"].+- `pid` (integer, required): Target process ID.+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `window_id` (integer, optional): Target window. Required for delivery_mode:"foreground" (the NSMenu activation needs a window). Does NOT itself raise the window — raising is gated on delivery_mode.+- `x` (number, optional): Screenshot-pixel X — the element px action form: pixel-click there to focus, then send the combo (so e.g. Cmd+V pastes into that field). Pass with y. Use for Chromium/Electron surfaces the background combo can't reach.+- `y` (number, optional): Screenshot-pixel Y (see x).```json-{"keys": ["cmd", "c"], "pid": 844}+{"keys":["cmd","c"],"pid":844}```-----### `set_value`-Set a value on a UI element.+Set a value on a UI element. Two modes depending on element role:++- **AXPopUpButton / select dropdown**: finds the child option whose title or value matches `value` (case-insensitive) and AXPresses it directly — the native macOS popup menu is never opened, so focus is never stolen. Use this for HTML <select> elements in Safari or any native NSPopUpButton.++- **All other elements**: writes AXValue directly (sliders, steppers, date pickers, native text fields that expose settable AXValue).-Two modes:+For free-form text entry into web inputs, prefer `type_text_chars` which synthesises key events — AXValue writes are ignored by WebKit.-- **`AXPopUpButton` / select dropdown**: finds the child option whose title or value matches `value` (case-insensitive) and `AXPress`es it directly. No native popup menu is opened.-- **All other elements**: writes `AXValue` directly (sliders, steppers, date pickers, native text fields that expose a settable `AXValue`).+**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `element_index` | integer | Yes | Element index from last `get_window_state`. Requires `pid` and `window_id` alongside it — `element_index` with no `pid` fails fast with `Missing required integer field: pid` (it is not a silent no-op). |-| `window_id` | integer | Yes | CGWindowID for the window whose `get_window_state` produced the element index. |-| `value` | string | Yes | New value. AX will coerce to the element's native type. |+- `element_index` (integer, optional): Element index from last get_window_state. Must be supplied unless element_token is provided. REQUIRES `pid` and `window_id` to be passed alongside it — element_index alone (no pid) fails fast with "Missing required integer field: pid"; it is not a silent no-op.+- `element_token` (string, optional): Opaque per-snapshot element handle from `structuredContent.elements[].element_token`. Takes precedence over element_index when both supplied. Returns an explicit "stale" error if the snapshot has been superseded.+- `pid` (integer, required)+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `value` (string, required): New value. AX will coerce to the element's native type.+- `window_id` (integer, optional): CGWindowID for the window whose get_window_state produced the element_index. Required when element_index is used; optional when element_token is supplied (the token carries it).```json-{"element_index": 14, "pid": 844, "value": "42", "window_id": 10725}+{"pid":844,"value":"42"}```-----### `scroll`-Scroll the target pid. Two addressing paths:+Scroll the target pid. Two paths, picked by how you address the scroll:-- **Keystroke** (default — no coordinate/element target): scrolls the focused / page scroller via synthesized keys. `by='page'` → PageDown/PageUp × amount; `by='line'` → Down/Up arrow × amount. Horizontal uses Left/Right.-- **Pixel-wheel** (`element_index` / `element_token`, or window-local `x, y`) — *macOS*: synthesizes a mouse wheel at the target point so the scroll routes to the element under it. Use it to drive a **nested overflow region or an unfocused scroller** the keystroke path can't reach (e.g. a web `overflow` div). Background-safe — no cursor warp, no focus steal.+• **Pixel-wheel path (targeted)** — when you pass a target, either `element_index`/`element_token` (preferred) or window-local `x, y` pixels: the driver synthesizes a real mouse-wheel event (CGEventCreateScrollWheelEvent, pixel units) AT that screen point. The renderer hit-tests the wheel at the cursor, so the scroll lands on whatever element is under the point — exactly like physically rolling the wheel over it. This is the ONLY way to scroll a nested `overflow:auto` region (e.g. a scrollable <div> with no tabindex): such regions never take keyboard focus, so the keystroke path below no-ops on them. Use this for inner/nested scrollers in web views.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `pid` | integer | Yes | Target process ID. |-| `direction` | string | Yes | Scroll direction: `up`, `down`, `left`, `right`. |-| `by` | string | No | Scroll granularity: `line` (default) or `page`. |-| `amount` | integer | No | Pixel-wheel: number of wheel notches. Keystroke: number of key repetitions. Default 3. |-| `element_index` | integer | No | Element from last `get_window_state`. macOS: pixel-wheel at its center (e.g. a nested overflow region located in the AX tree); other platforms: pre-focuses it before the keystroke scroll. |-| `element_token` | string | No | Per-snapshot element handle (`structuredContent.elements[].element_token`); precedence over `element_index`. macOS: pixel-wheel at its center. |-| `x` | number | No | Window-local screenshot X (top-left origin). With `y`, macOS pixel-wheel at this point — for a scrollable surface not in the AX tree. Requires `window_id`. |-| `y` | number | No | Window-local screenshot Y. See `x`. |-| `window_id` | integer | No | Required when `element_index` / `x, y` is set. |+• **Keystroke path (focused region)** — when you pass NO target (just pid + direction): synthesizes PageDown/PageUp (by='page') or Down/Up arrows (by='line'); horizontal uses Left/Right arrows. Drives the focused / page scroller only.++Mapping: by='page' → larger step; by='line' → smaller step; amount = number of wheel notches (pixel path) or keystroke repetitions (keystroke path).++**Arguments:**++- `amount` (integer, optional): Pixel-wheel path: number of wheel notches. Keystroke path: number of keystroke repetitions. Default: 3.+- `by` (string, optional): Scroll granularity. Default: line.+- `delivery_mode` (string, optional): Best-effort-background ladder rung (default "background"). "background": inject without fronting or raising the target — no focus steal. "foreground": briefly front the target, act, then restore the prior frontmost — the explicit last resort when a background attempt didn't land. Re-call with "foreground" only for the action that needs it.+- `direction` (string, required): Scroll direction.+- `element_index` (integer, optional): Element from last get_window_state. Routes through the pixel-wheel path AT this element's center — use it to scroll a nested overflow region you located in the AX tree.+- `element_token` (string, optional): Opaque per-snapshot element handle from `structuredContent.elements[].element_token`. Takes precedence over element_index when both supplied. Returns an explicit "stale" error if the snapshot has been superseded. Routes through the pixel-wheel path at the element's center.+- `pid` (integer, optional)+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `window_id` (integer, optional)+- `x` (number, optional): Window-local screenshot X (top-left origin of the PNG from get_window_state). With `y`, routes through the pixel-wheel path at this point — use for a scrollable surface that isn't in the AX tree. Requires window_id to anchor the window→screen conversion.+- `y` (number, optional): Window-local screenshot Y. See `x`.```json-{"direction": "down", "pid": 844}+{"direction":"down"}```-----### `move_cursor`-Move the agent cursor overlay to `(x, y)`. Does NOT move the real mouse cursor.+Move the agent cursor overlay to (x, y). Does NOT move the real mouse cursor — the user's cursor stays where it is. Useful for showing the agent's attention without interrupting the user.++**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `x` | number | Yes | Target X coordinate in screen points. |-| `y` | number | Yes | Target Y coordinate in screen points. |-| `cursor_id` | string | No | Explicit cursor-instance override. Omit to target the calling session's own cursor. |+- `cursor_id` (string, optional): Cursor instance to move. Default: 'default'.+- `session` (string, optional): Optional session id: declares/uses the agent cursor and per-session state for this run. The same id works over MCP, the CLI, or the raw socket, and follows the run across apps/windows. Omit to run cursor-less.+- `x` (number, required)+- `y` (number, required)```json-{"x": 100, "y": 200}+{"x":100,"y":200}```-----### `zoom`-Capture a cropped JPEG of a window region `(x1, y1)`–`(x2, y2)` in screenshot pixel coordinates, with 20% padding added on each side. The output image is at most 500 px wide.+Capture a cropped JPEG of a window region (x1,y1)–(x2,y2) in screenshot pixel coordinates, with 20% padding added on each side. The output image is at most 500 px wide.-After a zoom, pass `from_zoom=true` to `click`/`type_text` to auto-translate coordinates back to full-window space.+After a zoom, pass `from_zoom=true` to click/type_text to auto-translate coordinates back to full-window space.++**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `window_id` | integer | Yes | CGWindowID from `list_windows`. |-| `x1` | number | Yes | Left edge of region in screenshot pixels. |-| `y1` | number | Yes | Top edge of region in screenshot pixels. |-| `x2` | number | Yes | Right edge of region in screenshot pixels. |-| `y2` | number | Yes | Bottom edge of region in screenshot pixels. |-| `pid` | integer | No | Target pid, required for `from_zoom` click/type translation. |+- `pid` (integer, optional): Target pid — required for from_zoom click/type translation.+- `window_id` (integer, required): CGWindowID from list_windows.+- `x1` (number, required): Left edge of region in screenshot pixels.+- `x2` (number, required): Right edge of region in screenshot pixels.+- `y1` (number, required): Top edge of region in screenshot pixels.+- `y2` (number, required): Bottom edge of region in screenshot pixels.```json-{"window_id": 10725, "x1": 100, "y1": 200, "x2": 400, "y2": 500}+{"window_id":10725,"x1":100,"x2":100,"y1":200,"y2":200}```------## Action response shape--Action tools (`click`, `double_click`, `right_click`, `drag`, `scroll`, `type_text`, `press_key`, `hotkey`, `set_value`) return these structured fields:+## Browser tools-| Field | Type | Meaning | Value set / presence |-| ----- | ---- | ------- | -------------------- |-| `path` | string | Delivery rung that ran. | `"ax"`, `"cgevent"`, `"cgevent_fg"`, `"key_events"`, `"key_events_fg"`, `"pixel"`, `"x11_atspi"`, `"x11_pixel"`, `"x11_pixel_fg"`, `"msaa"`. |-| `verified` | boolean or absent | AX read-back verification result. `true` means the driver read the effect back through AX; `false` means the action dispatched but is unconfirmed; absent means the tool does not carry this field. | `true`, `false`, or absent. |-| `effect` | string | Action confidence signal. | `"confirmed"`, `"unverifiable"`, `"suspected_noop"`. |-| `escalation` | object or absent | Machine-readable next-rung recommendation. Present only when the driver recommends climbing the ladder. | `{ recommended: "px" \| "foreground" \| "page", reason: string }`, or absent. |+### `page`----+Interact with the browser page loaded in a running app. Supports Chrome, Brave, Edge, Safari (via AppleScript on macOS), Electron apps (via CDP), Chromium/Firefox on Windows (via UIA for read; CDP for execute_javascript when --remote-debugging-port is set), and WKWebView/Tauri/AT-SPI fallbacks.-## Browser tools+Actions:+- execute_javascript: Run JS and return the result.+- get_text: Extract visible text from the page.+- query_dom: Find elements matching a CSS selector.+- click_element: Click a CSS-selected element AND animate the agent cursor to its on-screen center first (so the user sees what the agent is doing). Prefer over `execute_javascript('el.click()')` whenever you want visible cursor feedback.+- insert_text: Insert `text` at whatever currently holds DOM focus in one native operation (CDP Input.insertText) — no synthesized key events, but more durable than a one-shot execute_javascript write since rich-text editors already have to treat it like an IME commit. Try this before type_keystrokes on a contenteditable that discarded an execute_javascript write. Click/focus the target field first.+- type_keystrokes: Type `text` via real per-character keystroke events into whatever currently holds DOM focus. Slower than insert_text but the most durable rung — use it when insert_text also gets discarded, or the editor's own keydown/keyup handlers need to see real keys. Click/focus the target field first.+- enable_javascript_apple_events: macOS-only — patch the browser's Preferences to allow JS from Apple Events (Chrome/Brave/Edge, requires user confirmation and a browser restart).-### `page`+**Arguments:**-Interact with the browser page loaded in a running app. Supports Chrome, Brave, Edge, Safari (via AppleScript on macOS), Electron apps (via CDP), Chromium/Firefox on Windows (via UIA for read; CDP for `execute_javascript` when `--remote-debugging-port` is set), and WKWebView/Tauri/AT-SPI fallbacks.--**Actions:**--| Action | Description |-| ------ | ----------- |-| `execute_javascript` | Run JS and return the result. |-| `get_text` | Extract visible text from the page. |-| `query_dom` | Find elements matching a CSS selector. |-| `click_element` | Click a CSS-selected element and animate the agent cursor to its on-screen center. |-| `enable_javascript_apple_events` | macOS-only: patch the browser's Preferences to allow JS from Apple Events. Requires `user_has_confirmed_enabling: true` and a browser restart. |-| `insert_text` | Set text into the focused field via CDP (fast DOM insert). **macOS-only** — see note below. |-| `type_keystrokes` | Type text as per-character key events via CDP (fires JS key handlers). **macOS-only** — see note below. |--`get_text`, `query_dom`, `click_element`, and `execute_javascript` work cross-platform (macOS, Windows, Linux). `insert_text` and `type_keystrokes` are implemented on macOS only for now; Windows and Linux return a clear "not implemented" error rather than a silent no-op. Tracked in [trycua/cua#2084](https://github.com/trycua/cua/issues/2084).--| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `action` | string | Yes | Action to perform (see table above). |-| `pid` | integer | No | Target process ID. |-| `window_id` | integer | No | Target window ID from `list_windows`. |-| `javascript` | string | No | JavaScript to execute. Required for `execute_javascript`. |-| `css_selector` | string | No | CSS selector for `query_dom`. |-| `attributes` | array of string | No | Element attributes to include in `query_dom` results. |-| `selector` | string | No | CSS selector for `click_element`. |-| `bundle_id` | string | No | Bundle ID of the browser. Required for `enable_javascript_apple_events` (macOS only). |-| `user_has_confirmed_enabling` | boolean | No | Must be true to proceed with `enable_javascript_apple_events`. |-| `text` | string | No | Text for `insert_text` / `type_keystrokes`. |-| `cdp_port` | integer | No | Chromium remote-debugging port for the CDP path. |-| `target_url_contains` | string | No | Substring to pick the target tab by URL (CDP). |+- `action` (string, required): Action to perform.+- `attributes` (array of string, optional): Element attributes to include in query_dom results.+- `bundle_id` (string, optional): Bundle ID of the browser. Required for enable_javascript_apple_events (macOS only).+- `cdp_port` (integer, optional): Optional, for insert_text/type_keystrokes only: use this exact CDP port instead of auto-discovering one from pid. Needed when the port was opened via the browser's own remote-debugging toggle rather than a launch-time flag, since that path may not answer the auto-discovery probe.+- `css_selector` (string, optional): CSS selector for query_dom (e.g. 'a', 'button', 'input', 'h1'-'h6', 'p', 'img', 'select', '*').+- `javascript` (string, optional): JavaScript to execute. Required for execute_javascript.+- `pid` (integer, optional): Target process ID.+- `selector` (string, optional): CSS selector for click_element (e.g. 'button.submit', '#login a').+- `target_url_contains` (string, optional): Optional, for insert_text/type_keystrokes only: pick the browser tab whose URL contains this substring instead of whichever tab is found first. Use this on a multi-tab browser — there's no built-in link between window_id and which tab a CDP call reaches.+- `text` (string, optional): Text to insert or type. Required for insert_text and type_keystrokes. The target field must already have DOM focus (click/focus it first).+- `user_has_confirmed_enabling` (boolean, optional): Must be true to proceed with enable_javascript_apple_events. This will quit and relaunch the browser.+- `window_id` (integer, optional): Target window ID from list_windows.```json-{"action": "get_text"}+{"action":"get_text"}```-----## Recording tools### `start_recording`-Start trajectory recording. Every subsequent action-tool invocation writes a turn folder under `output_dir`.+Start trajectory recording. Every subsequent action-tool invocation (click, right_click, scroll, type_text, press_key, hotkey, set_value) writes a turn folder under `output_dir`:++- `app_state.json` — post-action AX/UIA snapshot for the target pid.+- `screenshot.png` — post-action per-window screenshot of the target's frontmost on-screen window.+- `action.json` — tool name, full input arguments, result summary, pid, click point (when applicable), ISO-8601 timestamp.+- `click.png` — for click-family actions only, `screenshot.png` with a red dot drawn at the click point.++Turn folders are named `turn-00001/`, `turn-00002/`, etc. Turn numbering restarts at 1 each time recording is (re-)started.-Turn folder contents:+**Video is off by default.** Pass `record_video: true` to also capture the main display to `<output_dir>/recording.mp4` (H.264 / 30 fps) for the lifetime of the session. The recording is torn down automatically when the MCP client disconnects.-| File | Description |-| ---- | ----------- |-| `app_state.json` | Post-action AX/UIA snapshot for the target pid. |-| `screenshot.png` | Post-action per-window screenshot of the target's frontmost on-screen window. |-| `action.json` | Tool name, full input arguments, result summary, pid, click point (when applicable), ISO-8601 timestamp. |-| `click.png` | For click-family actions only: `screenshot.png` with a red dot drawn at the click point. |+**macOS uses native ScreenCaptureKit** (in-process SCStream + SCRecordingOutput) so video inherits Cua Driver's own Screen Recording grant — no extra TCC prompt, no ffmpeg subprocess. Requires macOS 15.0+.-Turn folders are named `turn-00001/`, `turn-00002/`, etc. Numbering restarts at 1 each time recording is (re-)started.+**Windows + Linux use an ffmpeg subprocess** (`gdigrab` / `x11grab` + libx264). Requires ffmpeg on PATH (winget install Gyan.FFmpeg / apt install ffmpeg); when ffmpeg is missing or fails on startup the per-turn capture (screenshots + action.json) still runs and the session's `last_error` field carries the diagnostic.-**Video recording:**+State persists for the life of the daemon / MCP session; a restart resets to disabled with no on-disk state. Call `stop_recording` to disable + finalize the mp4.-- Default: off. Pass `record_video: true` to also capture the main display to `<output_dir>/recording.mp4` (H.264, 30 fps).-- On macOS: uses native ScreenCaptureKit (requires macOS 15.0+, no extra TCC prompt).-- On Windows + Linux: uses an ffmpeg subprocess (`gdigrab` / `x11grab` + libx264). Requires ffmpeg on PATH.-- Recording stops automatically when the session ends on the daemon-proxy path.+**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `output_dir` | string | Yes | Absolute or `~`-rooted directory where turn folders and the video file are written. |-| `record_video` | boolean | No | Capture the main display to `<output_dir>/recording.mp4`. Default false. |+- `output_dir` (string, required): Absolute or ~-rooted directory where turn folders and (when enabled) the video file are written.+- `record_video` (boolean, optional): Capture the main display to <output_dir>/recording.mp4. Default: false. Set to true to also capture the main display to recording.mp4 (otherwise only the per-turn screenshots + JSON are recorded). On macOS this uses native ScreenCaptureKit (no extra TCC prompt, macOS 15.0+); on Windows + Linux it requires ffmpeg on PATH.```json-{"output_dir": "~/cua-trajectories/demo1"}+{"output_dir":"~/cua-trajectories/demo1"}```-----### `stop_recording`-Stop trajectory recording. When video was enabled, gracefully terminates the ffmpeg subprocess so the mp4's `moov` atom is finalized (file is playable). Calling stop on an already-stopped session is a no-op. The response carries `last_video_path` pointing at the finalized mp4 when video was on.+Stop trajectory recording. Disables further per-turn capture and, when video was enabled, gracefully terminates the ffmpeg subprocess so the mp4's moov atom is finalized (the file is playable). Calling stop on an already-stopped session is a no-op. The response carries `last_video_path` pointing at the finalized mp4 (when video was on).-A manual `stop_recording` is unconditional. It stops whatever recording is active regardless of which session started it.+A manual `stop_recording` is **unconditional** — it stops whatever recording is active regardless of which session started it. Ownership-scoped teardown (so one MCP client disconnecting can't stop a recording a later client started) is handled by the daemon's `session_end` lifecycle signal, not by this tool.**Arguments:** none.-----### `replay_trajectory`-Replay a recorded trajectory by re-invoking every turn's tool call in lexical order. `dir` must point at a directory previously written by `start_recording`.+Replay a recorded trajectory by re-invoking every turn's tool call in lexical order. `dir` must point at a directory previously written by `start_recording`. Each `turn-NNNNN/` is parsed for `action.json`, and the recorded tool is called with its recorded `arguments` via the same dispatch path an MCP / CLI call uses.Caveats:-- Element-indexed actions fail because element indices are per-snapshot. Pixel clicks and keyboard tools replay cleanly.-- `get_window_state` and other read-only tools are not recorded, so replays do not re-populate the element cache.-- When recording is enabled while replay runs, the replay itself is recorded into the currently configured output directory.+- Element-indexed actions (`click({pid, element_index})` etc.) will fail because element indices are per-snapshot and don't survive across sessions. Pixel clicks (`click({pid, x, y})`) and all keyboard tools replay cleanly. Failures are reported but don't stop replay unless `stop_on_error` is true.+- `get_window_state` and other read-only tools are NOT currently recorded, so replays do not re-populate the per-(pid, window_id) element cache.+- If recording is ENABLED while replay runs, the replay itself is recorded into the currently configured output directory. That's deliberate: recording a replay against a new build and diffing the two trajectories is the regression-test workflow.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `dir` | string | Yes | Trajectory directory previously written by `start_recording`. Absolute or `~`-rooted. |-| `delay_ms` | integer | No | Milliseconds to sleep between turns. Default 500. |-| `stop_on_error` | boolean | No | Stop replay on the first tool-call error. Default true. |+**Arguments:**++- `delay_ms` (integer, optional): Milliseconds to sleep between turns, for human-observable pacing. Default 500.+- `dir` (string, required): Trajectory directory previously written by `start_recording`. Absolute or ~-rooted.+- `stop_on_error` (boolean, optional): Stop replay on the first tool-call error. Default true — set false to best-effort through the full trajectory.```json-{"dir": "~/cua-trajectories/demo1"}+{"dir":"~/cua-trajectories/demo1"}```-----## Configuration tools### `set_config`-Update cua-driver-rs configuration. Changes to `max_image_dimension` take effect immediately. `capture_mode` is now deprecated and ignored — setting it has no effect (`get_window_state` returns both the tree and a screenshot regardless). The `experimental_pip` keys are persisted to `~/.cua-driver/config.json` and take effect on the next daemon restart.+Update cua-driver-rs configuration. Changes to max_image_dimension and capture_scope take effect immediately. The experimental_pip keys are persisted to ~/.cua-driver/config.json and take effect on the next daemon restart (the PiP backend is initialised once at startup).-Two equivalent argument shapes are accepted on every platform: a **direct field** (`{"capture_scope": "desktop"}`) or a **`{key, value}` pair** (`{"key": "capture_scope", "value": "desktop"}`, the same shape the CLI `config set` uses). A direct field wins if both are supplied.+Note: capture_mode is a per-call param (on get_window_state / click), not a stored setting. capture_scope IS a global setting: it gates get_desktop_state (full-display capture requires capture_scope=desktop).-**Per-session isolation (daemon-proxy path).** On the daemon-proxy path, `set_config` writes an in-memory, session-scoped override that does not touch the global `DriverConfig` or persist to disk. `get_config` and capture tools resolve effective values as: call-arg > session override > global default. The override is dropped automatically when the client disconnects. Only the anonymous path (`cua-driver config set` CLI, one-shot `cua-driver call`) writes the persisted global default.+**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `capture_mode` | string | No | **Deprecated and ignored** — accepted for back-compat but has no effect; `get_window_state` returns both the tree and a screenshot regardless. |-| `max_image_dimension` | integer | No | Max dimension for screenshot resizing. 0 = no limit. |-| `experimental_pip` | boolean | No | Enable the experimental picture-in-picture preview window. Applies on next daemon restart. |-| `experimental_pip_geometry` | string | No | PiP window size + optional position in `WxH` or `WxH+X+Y` form (e.g. `320x200+24+24`). Applies on next daemon restart. |-----+- `capture_scope` (string, optional): Capture scope: "window" (default) or "desktop". Desktop scope enables get_desktop_state (full-display capture) and window-less screen-absolute click/scroll. Global setting; takes effect immediately.+- `experimental_pip` (boolean, optional): Enable the experimental picture-in-picture preview window. Applies on next daemon restart.+- `experimental_pip_geometry` (string, optional): PiP window size + optional position in `WxH` or `WxH+X+Y` form (e.g. `320x200+24+24`). Applies on next daemon restart.+- `key` (string, optional): Name of a single config field to write ({key, value} shape, matching the CLI `config set` and the Windows/Linux tools). Pair with `value`. Equivalent to passing the field directly.+- `max_image_dimension` (integer, optional): Max dimension for screenshot resizing (0 = no limit).+- `value` (undefined, optional): New value for `key`. JSON type depends on the key.### `start_session`-Declare a session: a named, color-coded identity for the current agent run. The agent cursor, per-session config, and recording all key on the session id, and it follows the run across apps/windows. Idempotent (re-calling refreshes the idle-TTL). End it with `end_session` or let the idle-TTL reclaim it.+Declare a session — a named, color-coded identity for THIS agent run. Pass a stable `session` id; the agent cursor, per-session config, and recording all key on it, and it follows the run across any apps/windows. The cursor's color is derived from the id, so distinct runs are visually distinct. A cursor is shown only for a declared session — call this (or pass `session` on your first action) to opt in. Idempotent: re-calling with the same id just refreshes its idle-TTL. End it with `end_session` (or let the idle-TTL reclaim it). Concurrent runs/subagents each pass their own `session` to get their own cursor.++**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `session` | string | Yes | Stable session id for this run (e.g. `"research-run-1"`). |+- `session` (string, required): Stable session id for this run (e.g. "research-run-1").----+```json+{"session":"example"}+```### `end_session`-End a session declared with `start_session`: removes its agent cursor, stops any recording it owns, and clears its per-session config. Idempotent.+End a session declared with `start_session`: removes its agent cursor, stops any recording it owns, and clears its per-session config. Call this when a run finishes so its cursor doesn't linger (otherwise the idle-TTL reclaims it after a period of inactivity). Idempotent.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `session` | string | Yes | The session id to end. |+**Arguments:**----+- `session` (string, required): The session id to end.++```json+{"session":"example"}+```### `set_agent_cursor_enabled`-Show or hide the agent cursor overlay for a cursor instance. The overlay is on by default for each MCP session.+Show or hide the agent cursor for a session. A cursor exists only for a DECLARED session: pass `session` (the same id you start_session / drive actions with) and the cursor appears on that session's first action — its color is derived from the id. Without a `session`, actions run cursor-less. Use enabled=false to hide a session's cursor, enabled=true to re-show it. (`cursor_id` is a legacy alias for `session`.)++**Arguments:**-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `enabled` | boolean | Yes | `true` = show, `false` = hide. |-| `cursor_id` | string | No | Cursor instance. Default: `"default"`. |+- `cursor_id` (string, optional): Cursor instance. Default: 'default'.+- `enabled` (boolean, required): true = show, false = hide.```json-{"enabled": false}+{"enabled":false}```-----### `set_agent_cursor_motion`Configure the visual appearance and motion curve of an agent cursor instance.-**Appearance parameters:**--| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `cursor_id` | string | No | Instance name. Default: `"default"`. |-| `cursor_icon` | string | No | Built-in silhouette (`arrow`, `teardrop`) or a path to a PNG/JPEG/SVG/ICO file. `""` reverts to the default (`teardrop`). Same vocabulary as the CLI `--cursor-shape` / `--cursor-icon` flags. |-| `cursor_color` | string | No | Hex color (e.g. `"#00FFFF"`) or CSS name. |-| `cursor_label` | string | No | Short text shown near the cursor. |-| `cursor_size` | number | No | Dot radius in points. Default 16. |-| `cursor_opacity` | number | No | Opacity 0.0–1.0. Default 0.85. |--**Motion curve parameters:**--| Argument | Type | Range | Default | Description |-| -------- | ---- | ----- | ------- | ----------- |-| `start_handle` | number | [0, 1] | 0.3 | Departure control-point fraction. |-| `end_handle` | number | [0, 1] | 0.3 | Arrival control-point fraction. |-| `arc_size` | number | [0, 1] | 0.25 | Perpendicular deflection as fraction of path length. |-| `arc_flow` | number | [-1, 1] | 0.0 | Asymmetry bias; positive bulges toward destination. |-| `spring` | number | [0.3, 1.0] | 0.72 | Settle damping; 1.0 = no overshoot. |-| `turn_radius` | number | [1, 1000] | 80 | Corner rounding radius at direction changes. |-| `glide_duration_ms` | number | [50, 5000] | — | Flight duration per move in ms. Omit for speed-based timing. |-| `dwell_after_click_ms` | number | [0, 5000] | 80 | Pause after click ripple in ms. |-| `idle_hide_ms` | number | [0, 60000] | 20000 | Auto-hide delay in ms. 0 = never hide. |+Appearance (multi-cursor customization):+- cursor_id: instance name (default='default')+- cursor_icon: built-in ('arrow' | 'teardrop') or a path to a PNG/JPEG/SVG/ICO file; '' reverts to the default cursor+- cursor_color: hex color e.g. '#00FFFF' or CSS name+- cursor_label: short text shown near the cursor+- cursor_size: dot radius in points (default=16)+- cursor_opacity: 0.0–1.0 (default=0.85)++Motion curve (Bezier path shape):+- start_handle: departure control-point fraction [0,1]. Default 0.3+- end_handle: arrival control-point fraction [0,1]. Default 0.3+- arc_size: perpendicular deflection as fraction of path length [0,1]. Default 0.25+- arc_flow: asymmetry [-1,1]; positive bulges toward destination. Default 0.0+- spring: settle damping [0.3,1.0]; 1.0=no overshoot. Default 0.72+- glide_duration_ms: fixed flight duration per move [50,5000]; omit for speed-based (the default)+- dwell_after_click_ms: pause after click ripple [0,5000]. Default 80+- idle_hide_ms: auto-hide delay [0,60000]; 0=never. Default 20000----+**Arguments:**++- `arc_flow` (number, optional): Asymmetry bias in [-1, 1]. Default 0.0.+- `arc_size` (number, optional): Arc deflection as fraction of path length [0, 1]. Default 0.25.+- `cursor_color` (string, optional): Hex color (e.g. '#00FFFF') or CSS color name.+- `cursor_icon` (string, optional): Built-in shape ('arrow' | 'teardrop') or a path to a PNG/JPEG/SVG/ICO file. '' reverts to the default cursor.+- `cursor_id` (string, optional): Cursor instance name. Default: 'default'.+- `cursor_label` (string, optional): Short label near the cursor dot.+- `cursor_opacity` (number, optional): Opacity 0.0–1.0. Default: 0.85.+- `cursor_size` (number, optional): Dot radius in points. Default: 16.+- `dwell_after_click_ms` (number, optional): Pause after click ripple in ms. Default 80.+- `end_handle` (number, optional): End-handle fraction in [0, 1]. Default 0.3.+- `glide_duration_ms` (number, optional): Fixed flight duration per move in ms; omit for speed-based timing (the default).+- `idle_hide_ms` (number, optional): Auto-hide delay in ms. 0 = never hide. Default 20000.+- `spring` (number, optional): Settle damping in [0.3, 1.0]. Default 0.72.+- `start_handle` (number, optional): Start-handle fraction in [0, 1]. Default 0.3.+- `turn_radius` (number, optional): Minimum turning radius of the glide path in points; smaller = tighter curves. Default 80.### `set_agent_cursor_style`Update the visual style of the agent cursor overlay.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `cursor_id` | string | No | Cursor instance. Default: `"default"`. |-| `gradient_colors` | array of string | No | CSS hex gradient stops tip→tail. Empty array reverts to default palette colours. |-| `bloom_color` | string | No | Hex bloom/halo colour (e.g. `"#00FFFF"`). Empty string reverts to default. |-| `image_path` | string | No | Path to PNG/JPEG/SVG/ICO cursor image. Empty string clears the override, reverting to the default silhouette (`teardrop`). |+- gradient_colors: array of CSS hex strings (e.g. ["#FF0000","#0000FF"]) used as the arrow fill gradient from tip to tail. Empty array reverts to the default palette colours.+- bloom_color: hex string for the radial halo/bloom behind the cursor (e.g. "#00FFFF"). Empty string reverts to the default.+- image_path: path to a PNG, JPEG, SVG, or ICO file to use as the cursor icon instead of the default silhouette. Empty string reverts to the default cursor.+All parameters are optional; omit any you do not want to change.----+**Arguments:**++- `bloom_color` (string, optional): Hex bloom/halo colour (e.g. '#00FFFF'). '' = revert to default.+- `cursor_id` (string, optional): Cursor instance. Default: 'default'.+- `gradient_colors` (array of string, optional): CSS hex gradient stops tip→tail. [] = revert to default.+- `image_path` (string, optional): Path to PNG/JPEG/SVG/ICO cursor image. '' = revert to the default cursor.## Maintenance tools### `check_permissions`-Report TCC permission status for Accessibility and Screen Recording. By default also raises the system permission dialogs for any missing grants (Apple's request APIs are no-ops when the grant is already active). Pass `{"prompt": false}` for a read-only status check.+Report TCC permission status for Accessibility and Screen Recording. By default also raises the system permission dialogs for any missing grants — Apple's request APIs are no-ops when the grant is already active, so this is safe to call repeatedly. Pass {"prompt": false} for a purely read-only status check.-| Argument | Type | Required | Description |-| -------- | ---- | -------- | ----------- |-| `prompt` | boolean | No | Raise the system permission prompts for missing grants. Default true. |+Returns: `accessibility` + `screen_recording` (booleans from the TCC preflight APIs), `screen_recording_capturable` (a live ScreenCaptureKit probe — if it disagrees with `screen_recording`, the preflight grant belongs to a different process), and `source` (which TCC identity the booleans reflect: the CuaDriver daemon vs the launching terminal/IDE). macOS attributes grants to the responsible process, so a standalone call from a terminal reports the terminal's grants, not the driver's.----+**Arguments:**++- `prompt` (boolean, optional): Raise the system permission prompts for missing grants. Default true.++### `health_report`++Single-call end-to-end driver diagnostics. Designed to let downstream consumers (Hermes Agent and similar) ship one stable call instead of stitching together check_permissions, doctor, version, bundle attribution, and a screenshot probe. cua-driver owns the health model; consumers stay thin.++Input — all optional:+ {+ "include": ["<check_name>", ...], // run only these+ "skip": ["<check_name>", ...] // skip these+ }+If both are given, `include` wins.++Canonical check names:+ macOS : binary_version, platform_supported, session_active,+ bundle_identity, tcc_accessibility, tcc_screen_recording,+ ax_capability, screen_capture_capability+ Windows: binary_version, platform_supported, session_active,+ ax_capability (via UIA), screen_capture_capability (via DXGI)+ Linux : binary_version, platform_supported, session_active,+ ax_capability (via AT-SPI), screen_capture_capability (via X11)++Output — stable contract, schema_version="1":+ {+ "schema_version": "1",+ "platform": "darwin" | "win32" | "linux",+ "driver_version": "<semver>",+ "overall": "ok" | "degraded" | "failed",+ "checks": [+ {+ "name": "<one of the canonical names above>",+ "status": "pass" | "fail" | "skip",+ "message": "<one-line summary, always present>",+ "hint": "<remediation step, present when status=fail>",+ "data": { /* check-specific structured fields */ }+ },+ ...+ ]+ }++`overall` rules:+ - `ok` — every non-skipped check passes+ - `degraded` — at least one non-core check fails (binary is still usable)+ - `failed` — any core check fails (binary_version, platform_supported, session_active)++Stability: schema_version="1" is the contract. Future breaking changes will be `"2"`. Adding new check names under the same schema_version is non-breaking; consumers must tolerate unknown check names. Downstream consumer: NousResearch/hermes-agent#47065.++**Arguments:**++- `include` (array of string, optional): Only run these checks (canonical names). Wins over `skip`.+- `skip` (array of string, optional): Skip these checks (canonical names). Ignored when `include` is set.### `check_for_update`-Check whether a newer cua-driver-rs release is available on GitHub. Returns the current and latest versions, an `update_available` boolean, the install one-liner, and the release notes URL. Read-only. Mirror of `cua-driver check-update --json`.+Check whether a newer cua-driver-rs release is available on GitHub. Returns the current and latest versions, an `update_available` boolean, the install one-liner, and the release notes URL. Read-only — never installs. Mirror of `cua-driver check-update --json`.**Arguments:** none.### `install_ffmpeg`-Install ffmpeg, which the recording video backend shells out to. Two-step and confirmed: called without `confirm` it only reports the command it would run (a read-only preview); pass `confirm: true` to actually run it. No-op if ffmpeg is already on `PATH`.+Install the ffmpeg binary used by start_recording's video capture (Linux/Windows; macOS records natively and needs no ffmpeg). Two-step and confirmed: called without `confirm` it only REPORTS the exact install command for this platform's package manager; pass `confirm: true` to actually run it. No-op if ffmpeg is already on PATH. ffmpeg is run as a separate process, never linked into the driver.**Arguments:**-| Argument | Type | Description |-| -------- | ---- | ----------- |-| `confirm` | boolean (optional) | When `true`, runs the install. Omit or set `false` for a read-only preview of the command. |+- `confirm` (boolean, optional): Run the install command. Without it, only the planned command is reported.diff --git a/docs/content/docs/reference/cua-driver/meta.json b/docs/content/docs/reference/cua-driver/meta.jsonindex 69cabab4bd..d567181229 100644--- a/docs/content/docs/reference/cua-driver/meta.json+++ b/docs/content/docs/reference/cua-driver/meta.json@@ -1 +1 @@-{ "title": "Cua Driver", "pages": ["cli-reference", "mcp-tools", "contracts", "limits", "modality-test-suite"] }+{ "title": "Cua Driver", "pages": ["cli-reference", "macos-permissions", "mcp-tools", "mcp-tool-notes", "contracts", "limits", "modality-test-suite"] }diff --git a/docs/content/docs/tutorials/drive-your-first-app.mdx b/docs/content/docs/tutorials/drive-your-first-app.mdxindex 22a0b2ad46..a90a447d98 100644--- a/docs/content/docs/tutorials/drive-your-first-app.mdx+++ b/docs/content/docs/tutorials/drive-your-first-app.mdx@@ -22,13 +22,7 @@ Use the same one-line installer on every platform; it picks the right path for t/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh)"```- Start the daemon through the app bundle so macOS attributes permission prompts to CuaDriver.app:-- ```bash- open -n -g -a CuaDriver --args serve- ```-- Then grant Accessibility and Screen Recording:+ Grant Accessibility and Screen Recording (this launches CuaDriver so the prompts are attributed to it):```bashcua-driver permissions grant@@ -41,11 +35,6 @@ Use the same one-line installer on every platform; it picks the right path for tirm https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.ps1 | iex```- Start the daemon from an interactive desktop session, not an SSH session. **The daemon must run in Session 1 or later**; a daemon started over SSH usually lands in Session 0 and cannot drive the GUI.-- ```powershell- cua-driver serve- ```</Tab><Tab value="Linux">Requires an x86_64 Linux desktop session with X11 or XWayland, plus AT-SPI 2.@@ -54,11 +43,6 @@ Use the same one-line installer on every platform; it picks the right path for t/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh)"```- Start the daemon from inside your graphical desktop session:-- ```bash- cua-driver serve- ```</Tab></Tabs>diff --git a/docs/package.json b/docs/package.jsonindex 6633ec2cf6..1ea9233186 100644--- a/docs/package.json+++ b/docs/package.json@@ -11,6 +11,7 @@"docs:check": "tsx ../scripts/docs-generators/runner.ts --check","docs:list": "tsx ../scripts/docs-generators/runner.ts --list","docs:generate:lume": "tsx ../scripts/docs-generators/lume.ts",+ "docs:generate:cua-driver": "tsx ../scripts/docs-generators/cua-driver.ts","docs:generate:python": "tsx ../scripts/docs-generators/python-sdk.ts","docs:generate:changelog": "tsx ../scripts/docs-generators/generate-changelog.ts","docs:generate:versions": "tsx ../scripts/docs-generators/generate-versioned-docs.ts",diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/recording_tools.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/recording_tools.rsindex c0f87d3a1b..0860954f7c 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/recording_tools.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/recording_tools.rs@@ -297,7 +297,7 @@ impl Tool for ReplayTrajectoryTool {"type": "object","required": ["dir"],"properties": {- "dir": { "type": "string", "description": "Trajectory directory previously written by `set_recording`. Absolute or ~-rooted." },+ "dir": { "type": "string", "description": "Trajectory directory previously written by `start_recording`. Absolute or ~-rooted." },"delay_ms": { "type": "integer", "minimum": 0, "maximum": 10000, "description": "Milliseconds to sleep between turns, for human-observable pacing. Default 500." },"stop_on_error": { "type": "boolean", "description": "Stop replay on the first tool-call error. Default true — set false to best-effort through the full trajectory." }},diff --git a/scripts/docs-generators/config.json b/scripts/docs-generators/config.jsonindex 069564f415..2a009ccd31 100644--- a/scripts/docs-generators/config.json+++ b/scripts/docs-generators/config.json@@ -6,7 +6,7 @@"name": "Cua Driver","language": "rust","sourcePath": "libs/cua-driver/rust/crates",- "docsOutputPath": "docs/content/docs/cua-driver/reference",+ "docsOutputPath": "docs/content/docs/reference/cua-driver","generatorScript": "scripts/docs-generators/cua-driver.ts","watchPaths": ["libs/cua-driver/rust/crates/**/*.rs",@@ -28,8 +28,8 @@"extractCommand": "target/release/cua-driver dump-docs --type cli"}],- "enabled": false,- "notes": "Targets the Swift driver; the shipping cross-platform Rust port (cua-driver-rs) ships a stubbed `dump-docs --type cli`. Reference docs are hand-maintained from `cua-driver list-tools` / `describe` until the generator is repointed at the Rust binary."+ "enabled": true,+ "notes": "Generates cli-reference.mdx + mcp-tools.mdx from the Rust binary's `dump-docs`. MCP tool docs come straight from the live tool registry; CLI docs come from a hand-maintained `cli_docs_json()` literal in crates/cua-driver/src/cli.rs (the CLI is hand-parsed, not clap, so there is nothing to introspect yet — introspecting it is a tracked follow-up). Curated cross-cutting content lives in the sibling non-generated files mcp-tool-notes.mdx and macos-permissions.mdx."},"lume": {"name": "Lume VM Manager",diff --git a/scripts/docs-generators/cua-driver.ts b/scripts/docs-generators/cua-driver.tsindex 37f949f576..55ce861447 100644--- a/scripts/docs-generators/cua-driver.ts+++ b/scripts/docs-generators/cua-driver.ts@@ -100,7 +100,7 @@ const CUA_DRIVER_BIN = path.join('release',process.platform === 'win32' ? 'cua-driver.exe' : 'cua-driver');-const DOCS_OUTPUT_DIR = path.join(ROOT_DIR, 'docs', 'content', 'docs', 'cua-driver', 'reference');+const DOCS_OUTPUT_DIR = path.join(ROOT_DIR, 'docs', 'content', 'docs', 'reference', 'cua-driver');const TAG_PREFIX = 'cua-driver-rs-v';// ============================================================================@@ -131,12 +131,6 @@ function resolveCargoCommand(): string {throw new Error('cargo not found on PATH; install Rust or set CARGO=/path/to/cargo');}-interface VersionInfo {- version: string;- href: string;- isCurrent: boolean;-}-/*** Get the latest released version from git tags.*/@@ -155,51 +149,6 @@ export function getLatestReleasedVersion(): string {return '0.0.0';}-/**- * Discover available versioned doc folders and build version list.- */-export function discoverVersions(currentVersion: string): VersionInfo[] {- const versions: VersionInfo[] = [];- const currentMajorMinor = currentVersion.split('.').slice(0, 2).join('.');-- // Add current version (latest)- versions.push({- version: currentMajorMinor,- href: '/cua-driver/reference/cli-reference',- isCurrent: true,- });-- // Discover versioned folders (v0.2, v0.1, etc.)- if (fs.existsSync(DOCS_OUTPUT_DIR)) {- const entries = fs.readdirSync(DOCS_OUTPUT_DIR, { withFileTypes: true });- for (const entry of entries) {- if (entry.isDirectory() && entry.name.startsWith('v')) {- const version = entry.name.substring(1);- if (version === currentMajorMinor) continue;- versions.push({- version,- href: `/cua-driver/reference/${entry.name}/cli-reference`,- isCurrent: false,- });- }- }- }-- // Sort descending- versions.sort((a, b) => {- const partsA = a.version.split('.').map((x) => parseInt(x, 10) || 0);- const partsB = b.version.split('.').map((x) => parseInt(x, 10) || 0);- for (let i = 0; i < Math.max(partsA.length, partsB.length); i++) {- const partA = partsA[i] || 0;- const partB = partsB[i] || 0;- if (partA !== partB) return partB - partA;- }- return 0;- });-- return versions;-}-// ============================================================================// Main// ============================================================================@@ -312,13 +261,10 @@ async function main() {export function generateCLIReferenceMDX(docs: CLIDocumentation, releasedVersion: string): string {const lines: string[] = [];- const currentMajorMinor = releasedVersion.split('.').slice(0, 2).join('.');- const versions = discoverVersions(releasedVersion);-// Frontmatter — must be at the very beginning of the filelines.push('---');lines.push('title: CLI Reference');- lines.push('description: Command Line Interface reference for Cua Driver');+ lines.push('description: Command-line interface specification for Cua Driver');lines.push('---');lines.push('');lines.push(`{/*@@ -328,24 +274,25 @@ export function generateCLIReferenceMDX(docs: CLIDocumentation, releasedVersion:Version: ${releasedVersion}*/}`);lines.push('');- lines.push("import { Callout } from 'fumadocs-ui/components/callout';");- lines.push("import { VersionHeader } from '@/components/version-selector';");- lines.push('');- // Version header component- lines.push('<VersionHeader');- lines.push(` versions={${JSON.stringify(versions)}}`);- lines.push(` currentVersion="${currentMajorMinor}"`);- lines.push(` fullVersion="${releasedVersion}"`);- lines.push(` packageName="cua-driver"`);+ // Introduction+ lines.push(escapeMdxText(docs.abstract) + ' Install via the official script:');+ lines.push('');+ lines.push('```sh');lines.push(- ` installCommand="curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh | bash"`+ 'curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh | bash');- lines.push('/>');+ lines.push('```');lines.push('');-- // Introduction- lines.push(escapeMdxText(docs.abstract));+ lines.push(+ `Documented against Cua Driver **${releasedVersion}**. Run \`cua-driver --version\` for your installed version.`+ );+ lines.push('');+ lines.push(+ 'The macOS-only `cua-driver permissions` command is documented separately in [macOS permissions](/reference/cua-driver/macos-permissions).'+ );+ lines.push('');+ lines.push('---');lines.push('');// Group commands by category@@ -393,7 +340,11 @@ export function generateCLIReferenceMDX(docs: CLIDocumentation, releasedVersion:...configuration,...diagnostics,];- const uncategorised = docs.commands.filter((c) => !allCategorised.includes(c.name));+ // Documented on their own pages, so keep them out of this reference.+ const excludedFromReference = ['permissions']; // -> reference/cua-driver/macos-permissions+ const uncategorised = docs.commands.filter(+ (c) => !allCategorised.includes(c.name) && !excludedFromReference.includes(c.name)+ );if (uncategorised.length > 0) {lines.push('## Other commands');lines.push('');@@ -417,7 +368,7 @@ export function generateCLIReferenceMDX(docs: CLIDocumentation, releasedVersion:export function generateCommandDoc(cmd: CommandDoc): string[] {const lines: string[] = [];- lines.push(`### cua-driver ${cmd.name}`);+ lines.push(`### \`cua-driver ${cmd.name}\``);lines.push('');lines.push(escapeMdxText(cmd.abstract));lines.push('');@@ -478,7 +429,7 @@ export function generateCommandDoc(cmd: CommandDoc): string[] {// Subcommandsif (cmd.subcommands.length > 0) {for (const sub of cmd.subcommands) {- lines.push(`#### cua-driver ${cmd.name} ${sub.name}`);+ lines.push(`#### \`cua-driver ${cmd.name} ${sub.name}\``);lines.push('');lines.push(escapeMdxText(sub.abstract));lines.push('');@@ -536,7 +487,7 @@ export function generateCommandDoc(cmd: CommandDoc): string[] {// Nested subcommandsif (sub.subcommands.length > 0) {for (const nested of sub.subcommands) {- lines.push(`##### cua-driver ${cmd.name} ${sub.name} ${nested.name}`);+ lines.push(`##### \`cua-driver ${cmd.name} ${sub.name} ${nested.name}\``);lines.push('');lines.push(escapeMdxText(nested.abstract));lines.push('');@@ -627,7 +578,11 @@ export function generateMCPToolsMDX(docs: MCPDocumentation, releasedVersion: str);lines.push('');lines.push(- 'Tool names are `snake_case`. Responses are MCP `CallTool.Result` envelopes: a text content block prefixed with a `✅` summary (or the error reason on failure), plus optional image or structured-content blocks on tools that produce them. See the [CLI reference](/cua-driver/reference/cli-reference) for CLI-specific options like `--socket` and `--screenshot-out-file`.'+ 'Tool names are `snake_case`. Responses are MCP `CallTool.Result` envelopes: a text content block prefixed with a `✅` summary (or the error reason on failure), plus optional image or structured-content blocks on tools that produce them. See the [CLI reference](/reference/cua-driver/cli-reference) for CLI-specific options like `--socket` and `--screenshot-out-file`.'+ );+ lines.push('');+ lines.push(+ 'For the cross-cutting parameter contract (shared parameters, required-parameter rules, platform-specific parameters) and the action response shape, see [MCP tool notes](/reference/cua-driver/mcp-tool-notes).');lines.push('');lines.push('<Callout type="info">');@@ -638,7 +593,7 @@ export function generateMCPToolsMDX(docs: MCPDocumentation, releasedVersion: strlines.push('');lines.push('<Callout type="info">');lines.push(- " **TCC auto-delegation.** When an MCP client spawns `cua-driver mcp` from an IDE terminal (Claude Code, Cursor, VS Code, Warp), macOS attributes the subprocess to the parent terminal — not `CuaDriver.app` — so AX probes fail against the wrong bundle id. `mcp` detects this and auto-launches a `cua-driver serve` daemon via `open -n -g -a CuaDriver --args serve`, then proxies every tool call through the daemon's Unix socket. Tool semantics are identical to the in-process path; no Python bridge is needed. Pass `--no-daemon-relaunch` (or set `CUA_DRIVER_MCP_NO_RELAUNCH=1`) to force in-process execution. See the [process model guide](/cua-driver/guide/getting-started/process-model) for the full lifecycle, failure modes, and wrapper-author guidance."+ " **TCC auto-delegation.** When an MCP client spawns `cua-driver mcp` from an IDE terminal (Claude Code, Cursor, VS Code, Warp), macOS attributes the subprocess to the parent terminal — not `CuaDriver.app` — so AX probes fail against the wrong bundle id. `mcp` detects this and auto-launches a `cua-driver serve` daemon via `open -n -g -a CuaDriver --args serve`, then proxies every tool call through the daemon's Unix socket. Tool semantics are identical to the in-process path; no Python bridge is needed. Pass `--no-daemon-relaunch` (or set `CUA_DRIVER_MCP_NO_RELAUNCH=1`) to force in-process execution. See the [process model](/explanation/process-model) for the full lifecycle, failure modes, and wrapper-author guidance.");lines.push('</Callout>');lines.push('');@@ -651,6 +606,7 @@ export function generateMCPToolsMDX(docs: MCPDocumentation, releasedVersion: str'list_windows','get_window_state','get_accessibility_tree',+ 'get_desktop_state','get_screen_size','get_cursor_position','get_config',@@ -689,6 +645,8 @@ export function generateMCPToolsMDX(docs: MCPDocumentation, releasedVersion: strtitle: 'Configuration tools',tools: ['set_config',+ 'start_session',+ 'end_session','set_agent_cursor_enabled','set_agent_cursor_motion','set_agent_cursor_style',@@ -696,7 +654,12 @@ export function generateMCPToolsMDX(docs: MCPDocumentation, releasedVersion: str},{title: 'Maintenance tools',- tools: ['check_permissions', 'check_for_update'],+ tools: [+ 'check_permissions',+ 'health_report',+ 'check_for_update',+ 'install_ffmpeg',+ ],},];@@ -732,7 +695,7 @@ export function generateMCPToolsMDX(docs: MCPDocumentation, releasedVersion: strexport function generateMCPToolDoc(tool: MCPToolDoc): string[] {const lines: string[] = [];- lines.push(`### ${tool.name}`);+ lines.push(`### \`${tool.name}\``);lines.push('');lines.push(escapeMdxText(tool.description));lines.push('');