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
feat(cua-driver)!: ship semantic cursor themes
Francesco Bonaccie06e9229ba65
diff --git a/.github/workflows/cd-rust-cua-driver.yml b/.github/workflows/cd-rust-cua-driver.ymlindex d85eb6fcd0..649b43d075 100644--- a/.github/workflows/cd-rust-cua-driver.yml+++ b/.github/workflows/cd-rust-cua-driver.yml@@ -125,7 +125,7 @@ jobs:rust-cua-driver-rs-linux-${{ matrix.arch }}-- name: Build (release)working-directory: libs/cua-driver/rust- run: cargo build --locked -p cua-driver -p cua-driver-sdk --release --features cua-driver/portal-input --target ${{ matrix.target }}+ run: cargo build --locked -p cua-driver -p cursor-theme-cli -p cua-driver-sdk --release --features cua-driver/portal-input --target ${{ matrix.target }}- name: Build Electron-compatible Node runtimeworking-directory: libs/cua-driverrun: |@@ -142,6 +142,7 @@ jobs:STAGE="cua-driver-rs-${VERSION}-${LABEL}"mkdir -p "release/${STAGE}"cp "target/${TARGET}/release/cua-driver" "release/${STAGE}/"+ cp "target/${TARGET}/release/cua-cursor-theme" "release/${STAGE}/"cp "target/${TARGET}/release/libcua_driver_sdk.so" "release/${STAGE}/"cp "target/${TARGET}/release/cua_driver_node_runtime.node" "release/${STAGE}/"cp include/cua_driver_abi.h "release/${STAGE}/"@@ -150,7 +151,7 @@ jobs:# Bare runtime tarball: CLI plus the UniFFI library consumed by the# Python and Node imported-SDK packages.tar -czf "release/${STAGE}-binary.tar.gz" -C "release/${STAGE}" \- cua-driver libcua_driver_sdk.so cua_driver_node_runtime.node cua_driver_abi.h+ cua-driver cua-cursor-theme libcua_driver_sdk.so cua_driver_node_runtime.node cua_driver_abi.hls -lh "release/${STAGE}.tar.gz" "release/${STAGE}-binary.tar.gz"- uses: actions/upload-artifact@v4with:@@ -221,7 +222,7 @@ jobs:# `cua-driver-uia.exe` is the Windows-only sibling daemon that runs# at UIAccess integrity so SendInput / UI Automation can cross UIPI# into UWP apps — see crates/cua-driver-uia/ and #1602.- run: cargo build --locked -p cua-driver -p cua-driver-uia -p cua-driver-sdk --release --target ${{ matrix.target }}+ run: cargo build --locked -p cua-driver -p cursor-theme-cli -p cua-driver-uia -p cua-driver-sdk --release --target ${{ matrix.target }}- name: Build Electron-compatible Node runtimeworking-directory: libs/cua-drivershell: bash@@ -240,6 +241,7 @@ jobs:$stage = "cua-driver-rs-${version}-${label}"New-Item -ItemType Directory -Force -Path "release/$stage" | Out-NullCopy-Item "target/$target/release/cua-driver.exe" "release/$stage/"+ Copy-Item "target/$target/release/cua-cursor-theme.exe" "release/$stage/"Copy-Item "target/$target/release/cua-driver-uia.exe" "release/$stage/"Copy-Item "target/$target/release/cua_driver_sdk.dll" "release/$stage/"Copy-Item "target/$target/release/cua_driver_node_runtime.node" "release/$stage/"@@ -258,7 +260,7 @@ jobs:# to UIAccess integrity on a default-policy machine. The main CLI/MCP# binary stays fully functional regardless; uia is opt-in dead-weight# until signed.- Compress-Archive -Path "release/$stage/cua-driver.exe","release/$stage/cua-driver-uia.exe","release/$stage/cua_driver_sdk.dll","release/$stage/cua_driver_node_runtime.node","release/$stage/cua_driver_abi.h" -DestinationPath "release/$stage-binary.zip" -Force+ Compress-Archive -Path "release/$stage/cua-driver.exe","release/$stage/cua-cursor-theme.exe","release/$stage/cua-driver-uia.exe","release/$stage/cua_driver_sdk.dll","release/$stage/cua_driver_node_runtime.node","release/$stage/cua_driver_abi.h" -DestinationPath "release/$stage-binary.zip" -ForceGet-ChildItem "release/$stage*.zip"- uses: actions/upload-artifact@v4with:@@ -357,12 +359,12 @@ jobs:working-directory: libs/cua-driver/rustenv:MACOSX_DEPLOYMENT_TARGET: "13.0"- run: cargo build --locked -p cua-driver -p cua-driver-sdk --release --target aarch64-apple-darwin+ run: cargo build --locked -p cua-driver -p cursor-theme-cli -p cua-driver-sdk --release --target aarch64-apple-darwin- name: Build x86_64working-directory: libs/cua-driver/rustenv:MACOSX_DEPLOYMENT_TARGET: "13.0"- run: cargo build --locked -p cua-driver -p cua-driver-sdk --release --target x86_64-apple-darwin+ run: cargo build --locked -p cua-driver -p cursor-theme-cli -p cua-driver-sdk --release --target x86_64-apple-darwin- name: Build Electron-compatible Node runtimesworking-directory: libs/cua-driverrun: |@@ -378,15 +380,19 @@ jobs:run: |ARM64="target/aarch64-apple-darwin/release/cua-driver"X86="target/x86_64-apple-darwin/release/cua-driver"+ THEME_ARM64="target/aarch64-apple-darwin/release/cua-cursor-theme"+ THEME_X86="target/x86_64-apple-darwin/release/cua-cursor-theme"SDK_ARM64="target/aarch64-apple-darwin/release/libcua_driver_sdk.dylib"SDK_X86="target/x86_64-apple-darwin/release/libcua_driver_sdk.dylib"NODE_ARM64="target/aarch64-apple-darwin/release/cua_driver_node_runtime.node"NODE_X86="target/x86_64-apple-darwin/release/cua_driver_node_runtime.node"mkdir -p release/universallipo -create "$ARM64" "$X86" -output release/universal/cua-driver+ lipo -create "$THEME_ARM64" "$THEME_X86" -output release/universal/cua-cursor-themelipo -create "$SDK_ARM64" "$SDK_X86" -output release/universal/libcua_driver_sdk.dyliblipo -create "$NODE_ARM64" "$NODE_X86" -output release/universal/cua_driver_node_runtime.nodelipo -info release/universal/cua-driver+ lipo -info release/universal/cua-cursor-themelipo -info release/universal/libcua_driver_sdk.dyliblipo -info release/universal/cua_driver_node_runtime.nodetest "$(otool -D release/universal/libcua_driver_sdk.dylib | tail -n 1)" = \@@ -408,9 +414,12 @@ jobs:codesign --force --timestamp --options runtime \--entitlements scripts/CuaDriver.entitlements \--sign "$IDENTITY" release/universal/cua-driver+ codesign --force --timestamp --options runtime \+ --sign "$IDENTITY" release/universal/cua-cursor-themecodesign --force --timestamp --options runtime \--sign "$IDENTITY" release/universal/libcua_driver_sdk.dylibcodesign --verify --strict --verbose=2 release/universal/cua-driver+ codesign --verify --strict --verbose=2 release/universal/cua-cursor-themecodesign --verify --strict --verbose=2 release/universal/libcua_driver_sdk.dylib- name: Assemble CuaDriver.app bundleworking-directory: libs/cua-driver/rust@@ -433,7 +442,10 @@ jobs:cp -R scripts/CuaDriverBundle/Contents release/CuaDriver.app/Contentscp release/universal/cua-driver \release/CuaDriver.app/Contents/MacOS/cua-driver+ cp release/universal/cua-cursor-theme \+ release/CuaDriver.app/Contents/MacOS/cua-cursor-themechmod +x release/CuaDriver.app/Contents/MacOS/cua-driver+ chmod +x release/CuaDriver.app/Contents/MacOS/cua-cursor-theme# Stamp the release version into Info.plist so the bundle# version tracks the tag instead of whatever was last# checked in. Without this the in-tree Info.plist's@@ -496,6 +508,7 @@ jobs:# that download by arch still get the universal slice# (matches the Swift `cd-swift-cua-driver.yml` convention).cp release/universal/cua-driver "release/${STAGE}/"+ cp release/universal/cua-cursor-theme "release/${STAGE}/"cp release/universal/libcua_driver_sdk.dylib "release/${STAGE}/"cp release/universal/cua_driver_node_runtime.node "release/${STAGE}/"cp include/cua_driver_abi.h "release/${STAGE}/"@@ -510,7 +523,7 @@ jobs:# Bare runtime tarball: universal CLI plus universal UniFFI library.# No app bundle: callers of this asset deliberately skip that flow.tar -czf "release/cua-driver-rs-${VERSION}-darwin-universal-binary.tar.gz" \- -C release/universal cua-driver libcua_driver_sdk.dylib cua_driver_node_runtime.node \+ -C release/universal cua-driver cua-cursor-theme libcua_driver_sdk.dylib cua_driver_node_runtime.node \-C ../../include cua_driver_abi.hls -lh release/*.tar.gz- uses: actions/upload-artifact@v4diff --git a/docs/content/docs/how-to-guides/driver/personalize-cursor.mdx b/docs/content/docs/how-to-guides/driver/personalize-cursor.mdxindex c033e9a959..b5ef19b353 100644--- a/docs/content/docs/how-to-guides/driver/personalize-cursor.mdx+++ b/docs/content/docs/how-to-guides/driver/personalize-cursor.mdx@@ -1,77 +1,93 @@----title: Personalize the Cua cursor-description: "Swap the agent cursor shape and palette: pick a built-in silhouette, override at runtime, or bring your own SVG/PNG/ICO."+title: Personalize the agent cursor+description: "Use Cua Driver's semantic default cursor or compile and install a safe custom dotLottie theme."---import { Callout } from 'fumadocs-ui/components/callout';-The Cua Driver agent cursor ships with two built-in silhouettes:+Cua Driver ships one built-in theme, `cua.default`, on macOS, Windows, and+Linux. It uses an off-white pointer with a navy outline and small animations+for actions such as observe, click, drag, scroll, type, and navigate.-- **`teardrop`** (the default)-- **`arrow`**+<Callout type="warn" title="Visual aid, not authorization">+The cursor helps a person follow an agent. It is not a security indicator,+consent prompt, or proof that an action succeeded.+</Callout>-`teardrop` is the default. Opt back into the arrow with `--cursor-shape arrow`. You can also replace the silhouette entirely with your own SVG / PNG / JPEG / ICO file via `--cursor-icon <path>`, swap the body palette at runtime, or scale the bloom halo independently.+## Select a theme for a session-## Pick a built-in silhouette+Create a session and select an already-installed theme by ID:```bash-cua-driver serve --cursor-shape teardrop # explicit; same as the default-cua-driver serve --cursor-shape arrow # opt into the procedural arrow+cua-driver start_session '{"session":"demo"}'+cua-driver set_agent_cursor_theme \+ '{"session":"demo","theme_id":"cua.default","reduced_motion":"auto"}'+cua-driver get_agent_cursor_state '{"session":"demo"}'```-`--cursor-shape` is a daemon startup option. Passing it to an MCP proxy or one-shot CLI adapter does not change the already-running daemon's overlay; set it on `cua-driver serve`.--`--cursor-icon <path>` always wins over `--cursor-shape`: if you pass both, the custom file is what renders.--## Change the cursor look at runtime+Use `set_agent_cursor_enabled` to hide or show the session cursor. Use+`set_agent_cursor_motion` for movement physics and visibility timing only.-Every per-instance cursor accepts a runtime style override via the `set_agent_cursor_style` MCP tool. An agent or harness can call it mid-session; the next paint frame picks up the new style.+The old `set_agent_cursor_style` operation and its `cursor_id`, shape, color,+label, size, opacity, image-path, gradient, and bloom styling fields have been+removed. (`cursor_id` may still appear on input-delivery tools where it names a+virtual pointer; it is no longer a cursor-theme selector.)-```json-{- "gradient_colors": ["#FF6B6B", "#FFD93D"],- "bloom_color": "#FF6B6B"-}-```+## Create a custom theme-- `gradient_colors`: array of CSS hex strings used as the cursor body's tip-to-tail gradient. An empty array reverts to the palette default (`#F0FBFF` → `#66D9FF` → `#35C6D8` on the teardrop; the palette's `cursor_start/mid/end` on the arrow).-- `bloom_color`: hex string for the radial halo behind the cursor. Empty string reverts.-- `image_path`: path to a PNG / JPEG / SVG / ICO file. When set, replaces the built-in silhouette with your asset. Empty string clears the override, reverting to the default silhouette.+A source theme is a dotLottie archive with:-Switch between the built-in `arrow` and `teardrop` silhouettes at runtime with `set_agent_cursor_motion`'s `cursor_icon` field. Pass the built-in name or a file path, using the same vocabulary the CLI `--cursor-shape` / `--cursor-icon` flags accept. Both the CLI and MCP resolve names through the same `BuiltinShape` table, so they can never drift.+- the standard `manifest.json`;+- 128×128, 30 fps animations under `a/`, with at most 120 frames per+ animation and 1,000 frames across the complete compiled theme;+- a `cua/theme.json` semantic manifest;+- all twelve actions: `idle`, `observe`, `click`, `drag`, `scroll`, `text`,+ `key`, `navigate`, `app`, `transfer`, `record`, and `system`;+- all six modifiers: `background`, `foreground`, `ax`, `pixel`, `browser`, and+ `desktop`;+- a representative `still_frame` for every animation;+- an author and license.-## Use your own cursor asset+The compiler enforces the complete theme contract, including the semantic+manifest, animation inventory, frame limits, author, and license.-Pass `--cursor-icon <path>` to `cua-driver serve` (or set `image_path` on `set_agent_cursor_style` at runtime). Supported formats: `.svg`, `.png`, `.jpeg`, `.ico`. The asset is rasterised once at startup into a 52×52 RGBA buffer and used in place of the built-in silhouette.+Validate, compile, inspect, and preview the source:```bash-cua-driver serve --cursor-icon ~/my-cursor.svg+cua-driver cursor-theme validate theme.lottie+cua-driver cursor-theme build theme.lottie --output theme.cua-theme+cua-driver cursor-theme inspect theme.cua-theme+cua-driver cursor-theme preview theme.cua-theme --output preview```-<Callout type="info" title="Tip orientation">-Custom cursor assets are rendered with no rotation compensation. The driver assumes your asset's tip points to the **right** at rest. If your SVG has a tip pointing up, up-left, or anywhere else, the cursor will appear rotated off-axis during motion. Two options:+Install it locally, then select its reverse-DNS ID:-1. **Re-author your SVG** so the tip points right at the unrotated default. The driver's rotation logic then aligns the tip with motion direction automatically.-2. **Stick with PNG / static art** if you do not care about motion-aligned rotation. The cursor will render at a fixed orientation regardless of motion direction. This is what most OS cursor packs do.-</Callout>+```bash+cua-driver cursor-theme install theme.cua-theme+cua-driver cursor-theme list-## Recolour at launch+cua-driver set_agent_cursor_theme \+ '{"session":"demo","theme_id":"com.example.cursor.studio"}'+```-`--cursor-palette <name>` picks a built-in colour palette for the cursor at launch. It is the launch-time counterpart to the runtime `set_agent_cursor_style` palette. Like the other cursor flags it is parsed on `serve` and `mcp` only.+Profile v1 does not compile dotLottie color/theme variants. Publish each+visually distinct design under a separate theme ID.-```bash-cua-driver serve --cursor-palette <name>-```+## Why installation is separate-Run `cua-driver serve --help` for the available palette names.+Theme authoring is a trusted local workflow. The short-lived compiler validates+the ZIP and Lottie source, rejects unsupported or unbounded content, and emits+bounded premultiplied RGBA frames.-## Things that aren't currently personalizable+The privileged overlay loads only the compiled `.cua-theme` artifact. It never+parses ZIP, JSON, Lottie, fonts, expressions, URLs, or an arbitrary source+path. MCP and SDK tools may select an installed ID, but they cannot install+source or submit inline animation data.-- **Multiple built-in palettes per agent.** Runtime overrides can recolour a cursor, but built-in named palettes are shared.-- **Shape render size.** `cursor_size` controls the dot-style cursor radius. The shape-based render path uses its own fixed size.-- **Motion-path curve shape.** Glide duration, post-click dwell, idle-hide delay, and spring damping are tunable via `set_agent_cursor_motion`, but the underlying path shape is fixed.+Remove a custom theme with:-## See also+```bash+cua-driver cursor-theme uninstall com.example.cursor.studio+```-- [Connect your agent](./connect-your-agent): register Cua Driver with Claude Code, Codex, Hermes, and others.-- [MCP tools](/reference/cua-driver/mcp-tools): full parameter list and return shape.+The built-in `cua.default` theme cannot be removed.diff --git a/docs/content/docs/reference/cua-driver/cli-reference.mdx b/docs/content/docs/reference/cua-driver/cli-reference.mdxindex d68297988e..6161ff2325 100644--- a/docs/content/docs/reference/cua-driver/cli-reference.mdx+++ b/docs/content/docs/reference/cua-driver/cli-reference.mdx@@ -72,6 +72,8 @@ On Windows and Linux, bare cua-driver mcp owns its runtime directly and shuts it| ---- | ---- | ------- | ----------- || `--socket` | String | — | Select an explicit daemon socket or named-pipe endpoint. || `--host-bundle-id` | String | — | Advisory host bundle id label echoed in check_permissions output (embedded mode). |+| `--cursor-theme` | String | cua.default | Select an installed cursor theme id. |+| `--cursor-reduced-motion` | String | auto | Follow the OS setting, force still frames, or allow animation: auto, on, or off. |**Flags:**@@ -106,6 +108,7 @@ The daemon owns per-process state such as element-index caches, recording state,| `--approve-session-policy` | Trusted-launcher confirmation that the exact bounded manifest was reviewed. || `--no-permissions-gate` | Skip the macOS first-launch permissions gate. || `--embedded` | Run embedded inside a host app: inherit the host's TCC grants, never prompt or relaunch. Also CUA_DRIVER_EMBEDDED=1. |+| `--no-overlay` | Disable the agent cursor overlay for this daemon. |### `cua-driver stop`@@ -436,6 +439,114 @@ Consumers can use this instead of hardcoding launch arguments such as the MCP in| ---- | ----------- || `-p`, `--pretty` | Pretty-print JSON. |+### `cua-driver cursor-theme`++Validate, compile, inspect, preview, install, or remove a local cursor theme.++This is a trusted local authoring workflow. Agent-facing tools may select an installed theme id, but cannot install source or compiled theme data.++#### `cua-driver cursor-theme validate`++Validate a bounded dotLottie source archive.++**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- |+| `<source>` | String | Yes | Path to the source .lottie archive. |++**Flags:**++| Name | Description |+| ---- | ----------- |+| `--development` | Allow the reserved com.example development namespace. |++#### `cua-driver cursor-theme build`++Compile a validated dotLottie archive into a bounded .cua-theme artifact.++**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- |+| `<source>` | String | Yes | Path to the source .lottie archive. |++**Options:**++| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- |+| `--output` | String | — | Output .cua-theme path. |++**Flags:**++| Name | Description |+| ---- | ----------- |+| `--development` | Allow the reserved com.example development namespace. |++#### `cua-driver cursor-theme inspect`++Inspect metadata in a compiled .cua-theme artifact.++**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- |+| `<theme>` | String | Yes | Path to the compiled .cua-theme artifact. |++**Flags:**++| Name | Description |+| ---- | ----------- |+| `--json` | Emit machine-readable JSON. |++#### `cua-driver cursor-theme preview`++Render a compiled theme's representative still frames to a directory.++**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- |+| `<theme>` | String | Yes | Path to the compiled .cua-theme artifact. |++**Options:**++| Name | Type | Default | Description |+| ---- | ---- | ------- | ----------- |+| `--output` | String | — | Preview output directory. |++#### `cua-driver cursor-theme install`++Install a compiled theme into the current user's theme store.++**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- |+| `<theme>` | String | Yes | Path to the compiled .cua-theme artifact. |++#### `cua-driver cursor-theme list`++List the built-in and installed cursor themes.++**Flags:**++| Name | Description |+| ---- | ----------- |+| `--json` | Emit machine-readable JSON. |++#### `cua-driver cursor-theme uninstall`++Remove a custom theme from the current user's theme store.++The built-in cua.default theme cannot be removed.++**Arguments:**++| Name | Type | Required | Description |+| ---- | ---- | -------- | ----------- |+| `<theme-id>` | String | Yes | Installed custom theme id. |+### `cua-driver dump-docs`Output machine-readable CLI and MCP documentation JSON.diff --git a/docs/content/docs/reference/cua-driver/mcp-tools.mdx b/docs/content/docs/reference/cua-driver/mcp-tools.mdxindex 7618e109d3..1c49d447e8 100644--- a/docs/content/docs/reference/cua-driver/mcp-tools.mdx+++ b/docs/content/docs/reference/cua-driver/mcp-tools.mdx@@ -134,11 +134,15 @@ Pure read-only.### `get_agent_cursor_state`-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.+Return the session cursor's theme, semantic playback, position, visibility, and motion.**Arguments:**-- `cursor_id` (string, optional): Cursor instance. Default: this session's cursor.+- `session` (string, required)++```json+{"session":"example"}+```## Action tools@@ -589,6 +593,8 @@ Declare a session — a named, color-coded identity for THIS agent run. Pass a s**Arguments:**- `capture_scope` (string, optional): Per-session perception/action modality. auto starts window-only and requires explicit escalation before desktop tools; window and desktop are strict. Immutable for the live session.+- `cursor_theme` (object,null, optional): Optional initial cursor theme. The host applies it before the cursor is+first made visible, avoiding a flash of the default theme.- `session` (string, required): Stable session id for this run (e.g. "research-run-1").```json@@ -609,72 +615,37 @@ End a session declared with `start_session`: removes its agent cursor, stops any### `set_agent_cursor_enabled`-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`.)+Show or hide the agent cursor owned by a session.**Arguments:**-- `cursor_id` (string, optional): Cursor instance. Default: 'default'.-- `enabled` (boolean, required): true = show, false = hide.+- `enabled` (boolean, required)+- `session` (string, required)```json-{"enabled":false}+{"enabled":false,"session":"example"}```### `set_agent_cursor_motion`-Configure the visual appearance and motion curve of an agent cursor instance.--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+Configure only movement physics and visibility timing for a session cursor.**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.--- 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:**+- `arc_flow` (number,null, optional)+- `arc_size` (number,null, optional)+- `dwell_after_click_ms` (number,null, optional)+- `end_handle` (number,null, optional)+- `glide_duration_ms` (number,null, optional)+- `idle_hide_ms` (number,null, optional)+- `session` (string, required)+- `spring` (number,null, optional)+- `start_handle` (number,null, optional)+- `turn_radius` (number,null, optional)-- `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.+```json+{"session":"example"}+```## Maintenance tools@@ -755,6 +726,20 @@ Install the ffmpeg binary used by start_recording's video capture (Linux/Windows## Other tools+### `set_agent_cursor_theme`++Select an already-installed cursor theme for a session.++**Arguments:**++- `reduced_motion` (string, optional)+- `session` (string, required)+- `theme_id` (string, required)++```json+{"session":"example","theme_id":"example"}+```+### `get_browser_state`Read-only browser inspection. Mode 1 (bind): pass pid + window_id of a native browser window to classify it, correlate it to a CDP target (exact-or-refuse), and mint a session-scoped target id plus tab ids. Mode 2 (snapshot): pass target_id + tab_id. The dom_refs_v1 compatibility format returns composed DOM refs. semantic_v2 joins accessibility, DOM, layout, and viewport state; ranks visible content before retained/offscreen state; and returns a semantic outline, typed action refs, content refs, scoped reads, and opaque continuation. Never performs setup — a missing endpoint is a structured browser_requires_setup refusal pointing at browser_prepare.diff --git a/docs/content/docs/reference/cua-driver/sdk-reference.mdx b/docs/content/docs/reference/cua-driver/sdk-reference.mdxindex e578da2c01..665b034cbb 100644--- a/docs/content/docs/reference/cua-driver/sdk-reference.mdx+++ b/docs/content/docs/reference/cua-driver/sdk-reference.mdx@@ -112,6 +112,22 @@ explicit escalation before desktop tools are enabled.| `press_key` | `pressKey` | `PressKeyInput` || `hotkey` | `hotkey` | `HotkeyInput` |+## Typed cursor methods++| Python | TypeScript | Input |+| -------------------------- | ----------------------- | ---------------------------- |+| `set_agent_cursor_enabled` | `setAgentCursorEnabled` | `SetAgentCursorEnabledInput` |+| `set_agent_cursor_motion` | `setAgentCursorMotion` | `SetAgentCursorMotionInput` |+| `set_agent_cursor_theme` | `setAgentCursorTheme` | `SetAgentCursorThemeInput` |+| `get_agent_cursor_state` | `getAgentCursorState` | `GetAgentCursorStateInput` |++Every cursor operation is bound to a declared session. `cua.default` is the+only built-in theme. A trusted local operator may validate, compile, and install+a custom theme with `cua-driver cursor-theme`; agent-facing tools may select an+installed theme ID but cannot install source or compiled theme data. See+[Agent cursor themes](/how-to-guides/driver/personalize-cursor) for the+semantic profile and authoring workflow.+Use `list_tools_json()` / `listToolsJson()` and `call_tool()` / `callTool()` forthe generic, platform-extensible tool surface. Its top-level`enforcement_adapters` array distinguishes active, metadata-only, anddiff --git a/libs/cua-driver/README.md b/libs/cua-driver/README.mdindex d477363c15..ee647afbbf 100644--- a/libs/cua-driver/README.md+++ b/libs/cua-driver/README.md@@ -63,6 +63,8 @@ generated Cua client.Contributor documentation:+- `docs/cursor-themes.md` documents the default semantic cursor and custom+ dotLottie authoring contract.- `docs/test-matrix.md` maps unit and canonical harness E2E suites.- `docs/action-support.md` is the empirical platform behavior ledger.- `docs/test-harnesses-guide.md` explains fixture and runner ownership.diff --git a/libs/cua-driver/contract/README.md b/libs/cua-driver/contract/README.mdindex 7d1c0d823b..04a35f60eb 100644--- a/libs/cua-driver/contract/README.md+++ b/libs/cua-driver/contract/README.md@@ -32,6 +32,18 @@ It also covers the portable whole-desktop loop:- `drag` and `scroll` in native desktop coordinates- `type_text`, `press_key`, and `hotkey` against the foreground application+The canonical session-owned cursor slice is shared exactly by MCP and both+generated SDKs:++- `set_agent_cursor_enabled`+- `set_agent_cursor_motion`+- `set_agent_cursor_theme`+- `get_agent_cursor_state`++Cursor artwork is selected by installed theme ID. Theme installation and+dotLottie compilation are intentionally local CLI operations, not SDK or MCP+tool calls.+Session contracts are marked `canonical_runtime`: the same typed Rust input,output, and metadata declaration builds the live MCP tool. Desktop contractsare marked `portable_subset`: their typed Rust inputs are a deliberatelydiff --git a/libs/cua-driver/contract/manifest.json b/libs/cua-driver/contract/manifest.jsonindex f5e6c998cf..cb0625ff78 100644--- a/libs/cua-driver/contract/manifest.json+++ b/libs/cua-driver/contract/manifest.json@@ -27,6 +27,9 @@"open_world": true},"schema_mode": "portable_subset",+ "cursor_semantics": {+ "action": "click"+ },"input_schema": {"additionalProperties": false,"properties": {@@ -101,6 +104,9 @@"open_world": true},"schema_mode": "portable_subset",+ "cursor_semantics": {+ "action": "drag"+ },"input_schema": {"additionalProperties": false,"properties": {@@ -191,6 +197,9 @@"open_world": false},"schema_mode": "canonical_runtime",+ "cursor_semantics": {+ "action": "system"+ },"input_schema": {"additionalProperties": true,"properties": {@@ -239,6 +248,9 @@"open_world": false},"schema_mode": "canonical_runtime",+ "cursor_semantics": {+ "action": "system"+ },"input_schema": {"additionalProperties": true,"properties": {@@ -330,6 +342,231 @@"type": "object"}},+ {+ "name": "get_agent_cursor_state",+ "description": "Return the session cursor's theme, semantic playback, position, visibility, and motion.",+ "platforms": [+ "macos",+ "windows",+ "linux"+ ],+ "capabilities": [+ "agent_cursor.state"+ ],+ "annotations": {+ "read_only": true,+ "destructive": false,+ "idempotent": true,+ "open_world": false+ },+ "schema_mode": "canonical_runtime",+ "input_schema": {+ "additionalProperties": false,+ "properties": {+ "session": {+ "type": "string"+ }+ },+ "required": [+ "session"+ ],+ "type": "object"+ },+ "success_output_schema": {+ "additionalProperties": true,+ "properties": {+ "enabled": {+ "type": "boolean"+ },+ "motion": {+ "properties": {+ "arc_flow": {+ "format": "double",+ "type": "number"+ },+ "arc_size": {+ "format": "double",+ "type": "number"+ },+ "dwell_after_click_ms": {+ "format": "double",+ "type": "number"+ },+ "end_handle": {+ "format": "double",+ "type": "number"+ },+ "glide_duration_ms": {+ "format": "double",+ "type": "number"+ },+ "idle_hide_ms": {+ "format": "double",+ "type": "number"+ },+ "spring": {+ "format": "double",+ "type": "number"+ },+ "start_handle": {+ "format": "double",+ "type": "number"+ },+ "turn_radius": {+ "format": "double",+ "type": "number"+ }+ },+ "required": [+ "start_handle",+ "end_handle",+ "arc_size",+ "arc_flow",+ "spring",+ "glide_duration_ms",+ "dwell_after_click_ms",+ "idle_hide_ms",+ "turn_radius"+ ],+ "type": "object"+ },+ "position": {+ "properties": {+ "x": {+ "format": "double",+ "type": "number"+ },+ "y": {+ "format": "double",+ "type": "number"+ }+ },+ "required": [+ "x",+ "y"+ ],+ "type": "object"+ },+ "session": {+ "type": "string"+ },+ "theme": {+ "properties": {+ "fallback": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ]+ },+ "id": {+ "type": "string"+ },+ "profile": {+ "type": "string"+ },+ "reduced_motion": {+ "enum": [+ "auto",+ "on",+ "off"+ ],+ "type": "string"+ },+ "version": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "version",+ "profile",+ "reduced_motion",+ "fallback"+ ],+ "type": "object"+ },+ "visual_state": {+ "properties": {+ "frame": {+ "format": "uint64",+ "minimum": 0,+ "type": "integer"+ },+ "modifiers": {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "phase": {+ "type": "string"+ },+ "preempted_count": {+ "format": "uint64",+ "minimum": 0,+ "type": "integer"+ },+ "requested_action": {+ "enum": [+ "idle",+ "observe",+ "click",+ "drag",+ "scroll",+ "text",+ "key",+ "navigate",+ "app",+ "transfer",+ "record",+ "system"+ ],+ "type": "string"+ },+ "resolved_action": {+ "enum": [+ "idle",+ "observe",+ "click",+ "drag",+ "scroll",+ "text",+ "key",+ "navigate",+ "app",+ "transfer",+ "record",+ "system"+ ],+ "type": "string"+ }+ },+ "required": [+ "requested_action",+ "resolved_action",+ "modifiers",+ "phase",+ "frame",+ "preempted_count"+ ],+ "type": "object"+ }+ },+ "required": [+ "session",+ "enabled",+ "position",+ "theme",+ "visual_state",+ "motion"+ ],+ "type": "object"+ }+ },{"name": "get_cursor_position","description": "Return the OS cursor position when the platform can observe it.",@@ -348,6 +585,9 @@"open_world": false},"schema_mode": "portable_subset",+ "cursor_semantics": {+ "action": "observe"+ },"input_schema": {"additionalProperties": false,"properties": {@@ -397,6 +637,9 @@"open_world": false},"schema_mode": "portable_subset",+ "cursor_semantics": {+ "action": "observe"+ },"input_schema": {"additionalProperties": false,"properties": {@@ -479,6 +722,9 @@"open_world": false},"schema_mode": "portable_subset",+ "cursor_semantics": {+ "action": "observe"+ },"input_schema": {"additionalProperties": false,"properties": {@@ -529,6 +775,9 @@"open_world": false},"schema_mode": "canonical_runtime",+ "cursor_semantics": {+ "action": "system"+ },"input_schema": {"additionalProperties": true,"properties": {@@ -622,6 +871,9 @@"open_world": true},"schema_mode": "portable_subset",+ "cursor_semantics": {+ "action": "key"+ },"input_schema": {"additionalProperties": false,"properties": {@@ -681,6 +933,9 @@"open_world": false},"schema_mode": "portable_subset",+ "cursor_semantics": {+ "action": "navigate"+ },"input_schema": {"additionalProperties": false,"properties": {@@ -740,6 +995,9 @@"open_world": true},"schema_mode": "portable_subset",+ "cursor_semantics": {+ "action": "key"+ },"input_schema": {"additionalProperties": false,"properties": {@@ -801,6 +1059,9 @@"open_world": true},"schema_mode": "portable_subset",+ "cursor_semantics": {+ "action": "scroll"+ },"input_schema": {"additionalProperties": false,"properties": {@@ -863,6 +1124,314 @@"type": "object"}},+ {+ "name": "set_agent_cursor_enabled",+ "description": "Show or hide the agent cursor owned by a session.",+ "platforms": [+ "macos",+ "windows",+ "linux"+ ],+ "capabilities": [+ "agent_cursor.set_enabled"+ ],+ "annotations": {+ "read_only": false,+ "destructive": false,+ "idempotent": true,+ "open_world": false+ },+ "schema_mode": "canonical_runtime",+ "input_schema": {+ "additionalProperties": false,+ "properties": {+ "enabled": {+ "type": "boolean"+ },+ "session": {+ "type": "string"+ }+ },+ "required": [+ "session",+ "enabled"+ ],+ "type": "object"+ },+ "success_output_schema": {+ "additionalProperties": true,+ "properties": {+ "enabled": {+ "type": "boolean"+ },+ "session": {+ "type": "string"+ }+ },+ "required": [+ "session",+ "enabled"+ ],+ "type": "object"+ }+ },+ {+ "name": "set_agent_cursor_motion",+ "description": "Configure only movement physics and visibility timing for a session cursor.",+ "platforms": [+ "macos",+ "windows",+ "linux"+ ],+ "capabilities": [+ "agent_cursor.set_motion"+ ],+ "annotations": {+ "read_only": false,+ "destructive": false,+ "idempotent": true,+ "open_world": false+ },+ "schema_mode": "canonical_runtime",+ "input_schema": {+ "additionalProperties": false,+ "properties": {+ "arc_flow": {+ "format": "double",+ "type": [+ "number",+ "null"+ ]+ },+ "arc_size": {+ "format": "double",+ "type": [+ "number",+ "null"+ ]+ },+ "dwell_after_click_ms": {+ "format": "double",+ "type": [+ "number",+ "null"+ ]+ },+ "end_handle": {+ "format": "double",+ "type": [+ "number",+ "null"+ ]+ },+ "glide_duration_ms": {+ "format": "double",+ "type": [+ "number",+ "null"+ ]+ },+ "idle_hide_ms": {+ "format": "double",+ "type": [+ "number",+ "null"+ ]+ },+ "session": {+ "type": "string"+ },+ "spring": {+ "format": "double",+ "type": [+ "number",+ "null"+ ]+ },+ "start_handle": {+ "format": "double",+ "type": [+ "number",+ "null"+ ]+ },+ "turn_radius": {+ "format": "double",+ "type": [+ "number",+ "null"+ ]+ }+ },+ "required": [+ "session"+ ],+ "type": "object"+ },+ "success_output_schema": {+ "additionalProperties": true,+ "properties": {+ "motion": {+ "properties": {+ "arc_flow": {+ "format": "double",+ "type": "number"+ },+ "arc_size": {+ "format": "double",+ "type": "number"+ },+ "dwell_after_click_ms": {+ "format": "double",+ "type": "number"+ },+ "end_handle": {+ "format": "double",+ "type": "number"+ },+ "glide_duration_ms": {+ "format": "double",+ "type": "number"+ },+ "idle_hide_ms": {+ "format": "double",+ "type": "number"+ },+ "spring": {+ "format": "double",+ "type": "number"+ },+ "start_handle": {+ "format": "double",+ "type": "number"+ },+ "turn_radius": {+ "format": "double",+ "type": "number"+ }+ },+ "required": [+ "start_handle",+ "end_handle",+ "arc_size",+ "arc_flow",+ "spring",+ "glide_duration_ms",+ "dwell_after_click_ms",+ "idle_hide_ms",+ "turn_radius"+ ],+ "type": "object"+ },+ "session": {+ "type": "string"+ }+ },+ "required": [+ "session",+ "motion"+ ],+ "type": "object"+ }+ },+ {+ "name": "set_agent_cursor_theme",+ "description": "Select an already-installed cursor theme for a session.",+ "platforms": [+ "macos",+ "windows",+ "linux"+ ],+ "capabilities": [+ "agent_cursor.set_theme"+ ],+ "annotations": {+ "read_only": false,+ "destructive": false,+ "idempotent": true,+ "open_world": false+ },+ "schema_mode": "canonical_runtime",+ "input_schema": {+ "additionalProperties": false,+ "properties": {+ "reduced_motion": {+ "default": "auto",+ "enum": [+ "auto",+ "on",+ "off"+ ],+ "type": "string"+ },+ "session": {+ "type": "string"+ },+ "theme_id": {+ "maxLength": 200,+ "minLength": 1,+ "type": "string"+ }+ },+ "required": [+ "session",+ "theme_id"+ ],+ "type": "object"+ },+ "success_output_schema": {+ "additionalProperties": true,+ "properties": {+ "session": {+ "type": "string"+ },+ "theme": {+ "properties": {+ "fallback": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ]+ },+ "id": {+ "type": "string"+ },+ "profile": {+ "type": "string"+ },+ "reduced_motion": {+ "enum": [+ "auto",+ "on",+ "off"+ ],+ "type": "string"+ },+ "version": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "version",+ "profile",+ "reduced_motion",+ "fallback"+ ],+ "type": "object"+ }+ },+ "required": [+ "session",+ "theme"+ ],+ "type": "object"+ }+ },{"name": "start_session","description": "Declare a session — a named, color-coded identity for THIS agent run. Pass a stable `session` id and choose capture_scope=auto|window|desktop; the agent cursor, capture policy, 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.",@@ -882,6 +1451,9 @@"open_world": false},"schema_mode": "canonical_runtime",+ "cursor_semantics": {+ "action": "system"+ },"input_schema": {"additionalProperties": true,"properties": {@@ -895,6 +1467,30 @@],"type": "string"},+ "cursor_theme": {+ "description": "Optional initial cursor theme. The host applies it before the cursor is\nfirst made visible, avoiding a flash of the default theme.",+ "properties": {+ "reduced_motion": {+ "default": "auto",+ "enum": [+ "auto",+ "on",+ "off"+ ],+ "type": "string"+ },+ "theme_id": {+ "type": "string"+ }+ },+ "required": [+ "theme_id"+ ],+ "type": [+ "object",+ "null"+ ]+ },"session": {"description": "Stable session id for this run (e.g. \"research-run-1\").","type": "string"@@ -996,6 +1592,9 @@"open_world": true},"schema_mode": "portable_subset",+ "cursor_semantics": {+ "action": "text"+ },"input_schema": {"additionalProperties": false,"properties": {diff --git a/libs/cua-driver/docs/action-icon-catalog.md b/libs/cua-driver/docs/action-icon-catalog.mdnew file mode 100644index 0000000000..d988c2cbaa--- /dev/null+++ b/libs/cua-driver/docs/action-icon-catalog.md@@ -0,0 +1,335 @@+# Cua Driver action and icon catalog++**Status:** Semantic source catalog for cursor theme profile v1++**Source:** Cua Driver public contract and platform tool registries++**Scope:** Public MCP/CLI-callable tools and their meaningful runtime action+variants. Internal implementation helpers are excluded.++## What is being cataloged++A public tool name is not always a complete action identity.++For example, `click` may resolve to:++- an accessibility action or a pixel action;+- background or foreground delivery;+- a window target or the full desktop;+- left, right, or middle button;+- one, two, or three clicks.++The icon system should therefore resolve a call into:++```text+surface.intent.target.delivery.qualifiers+```++Examples:++```text+native.click.px.background.left.single+native.click.px.foreground.left.single+native.click.ax.background.press+native.scroll.desktop.down.page+browser.click.trusted.ref+browser.pointer.drag.dom_event+```++Foreground and background are separate resolved actions, but they should not+need unrelated illustrations. A maintainable asset system uses:++1. a base intent glyph or animation (`click`, `type`, `scroll`, `drag`);+2. a targeting treatment (`ax`, `px`, `desktop`, `page`, `browser`);+3. a delivery treatment (`background`, `foreground`);+4. a small qualifier where it changes the visible gesture (`right`, `double`,+ `down`, `page`, and so on).++## Canonical variant vocabulary++### Targeting++| Token | Meaning | How it is selected |+| --- | --- | --- |+| `ax` | Accessibility-addressed element action | `element_token` or `element_index` |+| `px` | Window-local pixel action | Window target plus `x`/`y` coordinates |+| `focused` | Acts on the target's currently focused control | No element or point supplied |+| `desktop` | Screen-absolute action | `scope:"desktop"` without a window target |+| `page` | Legacy page/DOM action | A `page[action=…]` operation |+| `browser_trusted` | Typed browser action through trusted CDP Input events | `input_route:"trusted"` or omitted |+| `browser_dom` | Explicit synthetic DOM event | `input_route:"dom_event"` |++### Delivery++| Token | Meaning |+| --- | --- |+| `background` | Targeted delivery without raising or fronting the target |+| `foreground` | Briefly front target, act, then restore the previous foreground app |+| `persistent_foreground` | `bring_to_front`; target stays foreground |+| `fixed_background` | Browser or Linux low-level operation whose contract never fronts |+| `none` | Read-only or lifecycle operation with no input-delivery posture |++The desktop input family exposing `delivery_mode` is:++```text+click+double_click+right_click+drag+type_text+press_key+hotkey+scroll+```++`browser_dialog` also exposes background/foreground delivery for `accept` and+`dismiss`. Typed browser pointer/click operations never foreground the browser.++### Gesture qualifiers++| Dimension | Values |+| --- | --- |+| Button | `left`, `right`, `middle` |+| Click count | `single`, `double`, `triple` |+| AX click action | `press`, `show_menu`, `pick`, `confirm`, `cancel`, `open` |+| Scroll direction | `up`, `down`, `left`, `right` |+| Scroll unit | `line`, `page` |+| Browser input route | `trusted`, `dom_event` |+| Browser typing | `insert_text`, `keystrokes` |++Modifiers such as Command, Control, Alt/Option, and Shift belong in the+animation payload or label. They do not require separate base icons.++## Resolved native input actions++These are the action identities that should drive cursor animations.+Brace-delimited values are finite variants, not literal asset names.++| Public tool | Resolved action keys |+| --- | --- |+| `click` | `native.click.ax.{background\|foreground}.{press\|show_menu\|pick\|confirm\|cancel\|open}` |+| `click` | `native.click.px.{background\|foreground}.{left\|right\|middle}.{single\|double\|triple}` |+| `click` | `native.click.desktop.{left\|right\|middle}.{single\|double\|triple}` |+| `double_click` | `native.double_click.{ax\|px}.{background\|foreground}` |+| `right_click` | `native.right_click.{ax\|px}.{background\|foreground}` |+| `drag` | `native.drag.px.{background\|foreground}.{left\|right\|middle}` |+| `drag` | `native.drag.desktop.{left\|right\|middle}` |+| `type_text` | `native.type_text.{ax\|px\|focused}.{background\|foreground}` |+| `type_text` | `native.type_text.desktop` |+| `press_key` | `native.press_key.{ax\|px\|focused}.{background\|foreground}` |+| `press_key` | `native.press_key.desktop` |+| `hotkey` | `native.hotkey.{px\|focused}.{background\|foreground}` |+| `hotkey` | `native.hotkey.desktop` |+| `set_value` | `native.set_value.ax.background` |+| `scroll` | `native.scroll.{ax\|px}.{background\|foreground}.{up\|down\|left\|right}.{line\|page}` |+| `scroll` | `native.scroll.desktop.{up\|down\|left\|right}.{line\|page}` |+| `move_cursor` | `agent_cursor.move.window`, `native.pointer.move.desktop` |+| `zoom` | `native.zoom.window` |+| `bring_to_front` | `native.window.persistent_foreground` |++Do not generate every Cartesian product as a fully independent illustration.+For example, all `native.scroll.*` actions should share one scroll animation,+with direction, delivery, and targeting represented as composable treatments.++## Page compound actions++The public `page` tool contains seven operations:++| Resolved action key | Effect | Platform note |+| --- | --- | --- |+| `page.get_text` | Read visible page text | Cross-platform |+| `page.query_dom` | Query elements with a CSS selector | Cross-platform |+| `page.execute_javascript` | Execute JavaScript | Cross-platform where a supported page backend is available |+| `page.click_element` | Click a CSS-selected element | Cross-platform |+| `page.insert_text` | Insert text at current DOM focus | macOS implementation currently documented |+| `page.type_keystrokes` | Dispatch durable per-character key events | macOS implementation currently documented |+| `page.enable_javascript_apple_events` | Enable Safari JavaScript automation | macOS only |++## Typed browser actions++| Public tool | Resolved action keys |+| --- | --- |+| `get_browser_state` | `browser.bind`, `browser.snapshot.dom_refs_v1`, `browser.snapshot.semantic_v2` |+| `browser_prepare` | `browser.prepare.detect`, `browser.prepare.isolated_new`, `browser.prepare.isolated_named`, `browser.prepare.existing_profile` |+| `browser_navigate` | `browser.navigate` |+| `browser_click` | `browser.click.trusted.{ref\|viewport}`, `browser.click.dom_event.ref` |+| `browser_type` | `browser.type.insert_text`, `browser.type.keystrokes` |+| `browser_dialog` | `browser.dialog.inspect` |+| `browser_dialog` | `browser.dialog.accept.{background\|foreground}` |+| `browser_dialog` | `browser.dialog.dismiss.{background\|foreground}` |+| `browser_set_input_files` | `browser.files.set_input` |+| `browser_download` | `browser.download` |+| `browser_pointer` | `browser.pointer.{hover\|right_click\|double_click\|scroll\|drag}.{trusted\|dom_event}` |++Typed browser clicks and pointer operations have fixed background posture. The+`trusted` and `dom_event` routes are materially different and should remain+distinct resolved action IDs.++## Session, recording, cursor, and maintenance variants++| Public tool | Resolved action keys |+| --- | --- |+| `start_session` | `session.start.{auto\|window\|desktop}` |+| `escalate_session` | `session.escalate.desktop` |+| `get_session_state` | `session.inspect` |+| `end_session` | `session.end` |+| `start_recording` | `recording.start.trajectory`, `recording.start.video` |+| `stop_recording` | `recording.stop` |+| `get_recording_state` | `recording.inspect` |+| `replay_trajectory` | `recording.replay` |+| `set_agent_cursor_enabled` | `agent_cursor.show`, `agent_cursor.hide` |+| `set_agent_cursor_motion` | `agent_cursor.configure_motion` |+| `set_agent_cursor_theme` | `agent_cursor.set_theme` |+| `get_agent_cursor_state` | `agent_cursor.inspect` |+| `check_permissions` | `permissions.inspect`, `permissions.request` |+| `health_report` | `system.health.inspect` |+| `get_config` | `config.inspect` |+| `set_config` | `config.update` |+| `check_for_update` | `update.inspect` |+| `install_ffmpeg` | `dependency.ffmpeg.plan`, `dependency.ffmpeg.install` |++## Complete public tool-name union++The source-built macOS registry contains 49 tools. Windows adds+`debug_window_info`. Linux adds four low-level pointer tools. The union is 54+public tool names.++| # | Tool | Category | Platform | Primary icon intent |+| ---: | --- | --- | --- | --- |+| 1 | `list_apps` | Inspection | All | Apps/list |+| 2 | `list_windows` | Inspection | All | Windows/list |+| 3 | `get_window_state` | Inspection | All | Window inspect; optional capture treatment |+| 4 | `launch_app` | App lifecycle | All | Launch |+| 5 | `kill_app` | App lifecycle | All | Force stop |+| 6 | `bring_to_front` | Window lifecycle | All | Persistent foreground |+| 7 | `click` | Pointer input | All | Click plus target/delivery/button/count |+| 8 | `double_click` | Pointer input | All | Double click plus target/delivery |+| 9 | `right_click` | Pointer input | All | Context click plus target/delivery |+| 10 | `drag` | Pointer input | All | Drag plus delivery |+| 11 | `type_text` | Keyboard input | All | Type plus target/delivery |+| 12 | `press_key` | Keyboard input | All | Single key plus target/delivery |+| 13 | `hotkey` | Keyboard input | All | Key chord plus delivery |+| 14 | `set_value` | Accessibility input | All | Set semantic value |+| 15 | `scroll` | Pointer/accessibility input | All | Scroll plus target/delivery/direction |+| 16 | `get_screen_size` | Inspection | All | Screen dimensions |+| 17 | `get_desktop_state` | Inspection | All | Desktop capture |+| 18 | `get_cursor_position` | Inspection | All | Cursor location |+| 19 | `move_cursor` | Pointer/overlay input | All | Agent-cursor move in window scope; real-pointer move in desktop scope |+| 20 | `set_agent_cursor_enabled` | Agent cursor | All | Show/hide cursor |+| 21 | `set_agent_cursor_motion` | Agent cursor | All | Motion configuration |+| 22 | `set_agent_cursor_theme` | Agent cursor | All | Select an installed visual theme |+| 23 | `get_agent_cursor_state` | Agent cursor | All | Cursor inspect |+| 24 | `check_permissions` | Permissions | All; prompting is macOS-specific | Permission inspect/request |+| 25 | `health_report` | Maintenance | All | Health check |+| 26 | `get_config` | Configuration | All | Config inspect |+| 27 | `set_config` | Configuration | All | Config update |+| 28 | `get_accessibility_tree` | Inspection | All | Desktop accessibility inspect |+| 29 | `zoom` | Inspection | All | Zoom/crop |+| 30 | `page` | Page/DOM | All, with operation-specific limits | Use the seven page operation icons |+| 31 | `get_browser_state` | Typed browser | All | Bind or snapshot |+| 32 | `browser_prepare` | Typed browser | All | Browser preparation/profile |+| 33 | `browser_navigate` | Typed browser | All | Navigate |+| 34 | `browser_click` | Typed browser | All | Browser click plus route |+| 35 | `browser_type` | Typed browser | All | Browser type plus mode |+| 36 | `browser_dialog` | Typed browser | All | Inspect/accept/dismiss dialog |+| 37 | `browser_set_input_files` | Typed browser | All | Upload/attach files |+| 38 | `browser_download` | Typed browser | All | Download |+| 39 | `browser_pointer` | Typed browser | All | Use the ten browser-pointer operation icons |+| 40 | `start_recording` | Recording | All | Start trajectory/video recording |+| 41 | `stop_recording` | Recording | All | Stop recording |+| 42 | `get_recording_state` | Recording | All | Recording inspect |+| 43 | `replay_trajectory` | Recording | All | Replay |+| 44 | `install_ffmpeg` | Maintenance | Windows/Linux; no-op when unnecessary | Plan/install dependency |+| 45 | `start_session` | Session lifecycle | All | Start session plus capture scope |+| 46 | `escalate_session` | Session lifecycle | All | Escalate to desktop |+| 47 | `get_session_state` | Session lifecycle | All | Session inspect |+| 48 | `end_session` | Session lifecycle | All | End session |+| 49 | `check_for_update` | Maintenance | All | Update check |+| 50 | `debug_window_info` | Diagnostic | Windows only | Window diagnostic |+| 51 | `mouse_button_down` | Low-level pointer | Linux only | Hold button |+| 52 | `mouse_drag` | Low-level pointer | Linux only | Move held pointer |+| 53 | `mouse_button_up` | Low-level pointer | Linux only | Release button |+| 54 | `parallel_mouse_drag` | Multi-pointer | Linux only | Concurrent drags |++## Linux low-level pointer action keys++These tools are intentionally separate because a held button survives across+calls and multiple session cursors can drag concurrently:++```text+linux.mouse_button_down.{left|right|middle}.fixed_background+linux.mouse_drag.fixed_background+linux.mouse_button_up.fixed_background+linux.parallel_mouse_drag.fixed_background+```++## Aliases and removed surfaces++- `type_text_chars` is a deprecated invoke-time alias for `type_text`. It is+ deliberately hidden from `tools/list` and should reuse the `type_text` icon.+- The old `screenshot` tool is removed. Window capture is represented by+ `get_window_state`; full-display capture is `get_desktop_state`.+- Deprecated `get_window_state.capture_mode` values are accepted but ignored.+ They do not represent distinct actions and should not receive icons.+- Internal platform delivery paths such as `cgevent`, `x11_atspi`, `msaa`, and+ `key_events_fg` are result metadata, not public requested actions. They may+ be shown in diagnostics, but should not expand the primary icon catalog.++## Recommended first asset set++Generate these as reusable base glyphs/animations first:++```text+inspect+capture+launch+kill+foreground+click+double_click+right_click+drag+type_text+press_key+hotkey+set_value+scroll+move_cursor+zoom+navigate+dialog+upload+download+record+replay+session+permissions+settings+health+update+```++Then generate small composable treatments for:++```text+ax+px+desktop+page+browser_trusted+browser_dom+background+foreground+left+right+middle+double+triple+up+down+horizontal+vertical+```++This produces distinct foreground/background click states while keeping the+system small enough to remain coherent as new tools are added.diff --git a/libs/cua-driver/docs/cursor-themes.md b/libs/cua-driver/docs/cursor-themes.mdnew file mode 100644index 0000000000..f9335fd915--- /dev/null+++ b/libs/cua-driver/docs/cursor-themes.md@@ -0,0 +1,174 @@+# Agent cursor themes++Cua Driver ships one built-in cursor theme: `cua.default`. It is the default on+macOS, Windows, and Linux and cannot be removed. The theme uses the approved+off-white pointer with a navy outline and a small semantic animation that+describes what the active session is doing.++The cursor is a visual aid for people watching an agent. It is not a security+indicator, an authorization prompt, or evidence that a tool call succeeded.+Authorization is enforced separately.++## Use the default theme++Declare a session, then pass that session to cursor controls:++```bash+cua-driver start_session '{"session":"demo"}'+cua-driver set_agent_cursor_enabled \+ '{"session":"demo","enabled":true}'+cua-driver set_agent_cursor_theme \+ '{"session":"demo","theme_id":"cua.default","reduced_motion":"auto"}'+cua-driver get_agent_cursor_state '{"session":"demo"}'+```++`set_agent_cursor_motion` changes only movement physics and visibility timing.+It does not change artwork. The removed `set_agent_cursor_style` operation and+its `cursor_id`, shape, color, label, size, opacity, image-path, gradient, and+bloom styling fields are not accepted. Input-delivery tools may still use+`cursor_id` to name a virtual pointer; it does not select cursor artwork.++The same four typed operations are available on `CuaDriver` and+`CuaDriverSession` in the Python and TypeScript SDKs:++- `set_agent_cursor_enabled`+- `set_agent_cursor_motion`+- `set_agent_cursor_theme`+- `get_agent_cursor_state`++`StartSessionInput.cursor_theme` may select an installed theme when the session+is created. `reduced_motion` is `auto`, `on`, or `off`. `auto` follows the host+accessibility preference where the platform exposes one.++## Semantic profile++A full custom theme must provide all twelve action animations:++| Action | Playback |+| --- | --- |+| `idle` | resting loop |+| `observe` | loop |+| `click` | one shot |+| `drag` | held |+| `scroll` | loop |+| `text` | held |+| `key` | one shot |+| `navigate` | one shot |+| `app` | one shot |+| `transfer` | loop |+| `record` | loop |+| `system` | one shot |++It must also provide six transparent modifier animations. The renderer+composites at most one delivery modifier and one target modifier over the+action:++- delivery: `background`, `foreground`+- target: `ax`, `pixel`, `browser`, `desktop`++Unknown tools do not invent an animation. Visual events are best effort and+never affect tool dispatch or results.++## Author a custom theme++The source is a dotLottie archive with a Cua semantic manifest:++```text+theme.lottie+├── manifest.json+├── a/+│ ├── action_idle.json+│ └── ...+└── cua/+ └── theme.json+```++Every animation must be a transparent 128×128 Lottie animation at 30 fps and+contain no more than 120 frames. A compiled theme may contain at most 1,000+frames in total across its actions and modifiers. Profile v1 supports the+bounded subset accepted by the bundled compiler. Expressions, scripts,+external URLs, fonts, images, unbounded archives, and unsupported renderer+features are rejected.++`manifest.json` must contain every referenced animation ID. A minimal+`cua/theme.json` has this shape:++```json+{+ "schema": "cua.cursor-theme/1",+ "id": "com.example.cursor.studio",+ "name": "Studio Cursor",+ "version": "1.0.0",+ "author": "Example Studio",+ "license": "MIT",+ "compatibility": {+ "profile": "cua-driver-full-v1",+ "semantics": 1+ },+ "canvas": { "width": 128, "height": 128, "fps": 30 },+ "hotspot": { "x": 55, "y": 30 },+ "actions": {+ "idle": { "animation": "action_idle", "still_frame": 0 },+ "observe": { "animation": "action_observe", "still_frame": 18 },+ "click": { "animation": "action_click", "still_frame": 8 },+ "drag": { "animation": "action_drag", "still_frame": 20 },+ "scroll": { "animation": "action_scroll", "still_frame": 16 },+ "text": { "animation": "action_text", "still_frame": 8 },+ "key": { "animation": "action_key", "still_frame": 8 },+ "navigate": { "animation": "action_navigate", "still_frame": 12 },+ "app": { "animation": "action_app", "still_frame": 18 },+ "transfer": { "animation": "action_transfer", "still_frame": 16 },+ "record": { "animation": "action_record", "still_frame": 16 },+ "system": { "animation": "action_system", "still_frame": 18 }+ },+ "modifiers": {+ "background": { "animation": "modifier_background", "still_frame": 0 },+ "foreground": { "animation": "modifier_foreground", "still_frame": 0 },+ "ax": { "animation": "modifier_ax", "still_frame": 0 },+ "pixel": { "animation": "modifier_pixel", "still_frame": 0 },+ "browser": { "animation": "modifier_browser", "still_frame": 0 },+ "desktop": { "animation": "modifier_desktop", "still_frame": 0 }+ }+}+```++The `still_frame` is used when reduced motion is active. Use a reverse-DNS+theme ID. Profile v1 does not compile dotLottie color/theme variants; publish a+visually distinct variant under a separate theme ID.++## Validate, compile, and install++Run the authoring workflow locally, outside an agent tool call:++```bash+cua-driver cursor-theme validate theme.lottie+cua-driver cursor-theme build theme.lottie --output theme.cua-theme+cua-driver cursor-theme inspect theme.cua-theme+cua-driver cursor-theme preview theme.cua-theme --output preview+cua-driver cursor-theme install theme.cua-theme+cua-driver cursor-theme list+```++Then select it by ID:++```bash+cua-driver set_agent_cursor_theme \+ '{"session":"demo","theme_id":"com.example.cursor.studio"}'+```++Remove it with:++```bash+cua-driver cursor-theme uninstall com.example.cursor.studio+```++The authoring compiler is a short-lived, unprivileged sidecar. It converts+Lottie source into bounded, premultiplied RGBA frames. The privileged overlay+loads only the compiled `.cua-theme` format; it never parses ZIP, JSON, Lottie,+fonts, expressions, URLs, or arbitrary source paths. Agent-facing tools can+select an already-installed ID but cannot install a theme or pass inline theme+data.++The embedded default is rendered directly as native vector paths for smaller+artifacts and lower idle memory. It follows the same semantic and reduced-motion+contract as compiled Lottie themes.diff --git a/libs/cua-driver/python/README.md b/libs/cua-driver/python/README.mdindex cf79c75af5..8b76360506 100644--- a/libs/cua-driver/python/README.md+++ b/libs/cua-driver/python/README.md@@ -40,8 +40,10 @@ import asynciofrom cua_driver import (CaptureScope,CuaDriver,+ CursorReducedMotion,EndSessionInput,GetDesktopStateInput,+ SetAgentCursorThemeInput,StartSessionInput,)@@ -51,6 +53,13 @@ async def main() -> None:StartSessionInput(session="demo", capture_scope=CaptureScope.DESKTOP))try:+ await driver.set_agent_cursor_theme(+ SetAgentCursorThemeInput(+ session="demo",+ theme_id="cua.default",+ reduced_motion=CursorReducedMotion.AUTO,+ )+ )desktop = await driver.get_desktop_state(GetDesktopStateInput(session="demo", screenshot_out_file=None))@@ -68,6 +77,12 @@ text, images, verification/error metadata, and `structured_json` / `raw_json`for platform-extensible results. Session lifecycle calls return dedicatedgenerated records.+The agent cursor is session-owned. Its default theme and custom dotLottie+authoring workflow are documented in+[`docs/cursor-themes.md`](../docs/cursor-themes.md). Custom source is compiled+and installed with the local CLI; SDK and MCP tools select only an installed+theme ID.+`CuaDriver.connect(socket_path)` remains available while existing applicationsmigrate. It exposes the same methods over the installed daemon, but it does notprovide a second SDK contract.diff --git a/libs/cua-driver/python/src/cua_driver/__init__.py b/libs/cua-driver/python/src/cua_driver/__init__.pyindex 3995d8bae7..e7f0c5b600 100644--- a/libs/cua-driver/python/src/cua_driver/__init__.py+++ b/libs/cua-driver/python/src/cua_driver/__init__.py@@ -46,6 +46,9 @@ from ._native_contract import (CaptureScope,ClickButton,ClickInput,+ CursorAction,+ CursorReducedMotion,+ CursorThemeSelection,DesktopScope,DragInput,EndSessionInput,@@ -53,6 +56,7 @@ from ._native_contract import (EffectiveScope,EscalateSessionInput,EscalationReason,+ GetAgentCursorStateInput,GetCursorPositionInput,GetDesktopStateInput,GetScreenSizeInput,@@ -65,6 +69,9 @@ from ._native_contract import (ScrollDirection,ScrollInput,SessionStateOutput,+ SetAgentCursorEnabledInput,+ SetAgentCursorMotionInput,+ SetAgentCursorThemeInput,StartSessionInput,StartSessionOutput,TypeTextInput,@@ -121,6 +128,9 @@ __all__ = ["ConfiguredDriverOptions","CuaDriver","CuaDriverSession",+ "CursorAction",+ "CursorReducedMotion",+ "CursorThemeSelection","DesktopScope","DragInput","DriverError",@@ -142,6 +152,7 @@ __all__ = ["EscalateSessionInput","EscalationReason","GetCursorPositionInput",+ "GetAgentCursorStateInput","GetDesktopStateInput","GetScreenSizeInput","GetSessionStateInput",@@ -163,6 +174,9 @@ __all__ = ["ScrollInput","SessionStateOutput","SessionPermissionMode",+ "SetAgentCursorEnabledInput",+ "SetAgentCursorMotionInput",+ "SetAgentCursorThemeInput","StartSessionInput","StartSessionOutput","ToolResult",diff --git a/libs/cua-driver/python/src/cua_driver/_native.py b/libs/cua-driver/python/src/cua_driver/_native.pyindex d772cfd1a9..3d802af554 100644--- a/libs/cua-driver/python/src/cua_driver/_native.py+++ b/libs/cua-driver/python/src/cua_driver/_native.py@@ -520,6 +520,8 @@ def _uniffi_check_api_checksums(lib):raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriver_execution_mode() != 2639:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_driver_sdk_checksum_method_cuadriver_get_agent_cursor_state() != 45642:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriver_get_cursor_position() != 34285:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriver_get_desktop_state() != 65084:@@ -544,6 +546,12 @@ def _uniffi_check_api_checksums(lib):raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriver_scroll() != 52290:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_enabled() != 26268:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_motion() != 12578:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_theme() != 53908:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriver_shutdown() != 36331:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriver_socket_path() != 48126:@@ -564,6 +572,8 @@ def _uniffi_check_api_checksums(lib):raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_escalate_session() != 34392:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_agent_cursor_state() != 60344:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_cursor_position() != 54838:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_desktop_state() != 26695:@@ -580,6 +590,12 @@ def _uniffi_check_api_checksums(lib):raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_scroll() != 8013:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_enabled() != 37153:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_motion() != 26144:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_theme() != 29734:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_start_session() != 13118:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_type_text() != 63241:@@ -1055,6 +1071,11 @@ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_execution_mode.argtypes = (ctypes.POINTER(_UniffiRustCallStatus),)_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_execution_mode.restype = _UniffiRustBuffer+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_get_agent_cursor_state.argtypes = (+ ctypes.c_uint64,+ cua_driver._native_contract._UniffiRustBuffer,+)+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_get_agent_cursor_state.restype = ctypes.c_uint64_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_get_cursor_position.argtypes = (ctypes.c_uint64,cua_driver._native_contract._UniffiRustBuffer,@@ -1113,6 +1134,21 @@ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_scroll.argtypes = (cua_driver._native_contract._UniffiRustBuffer,)_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_scroll.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_enabled.argtypes = (+ ctypes.c_uint64,+ cua_driver._native_contract._UniffiRustBuffer,+)+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_enabled.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_motion.argtypes = (+ ctypes.c_uint64,+ cua_driver._native_contract._UniffiRustBuffer,+)+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_motion.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_theme.argtypes = (+ ctypes.c_uint64,+ cua_driver._native_contract._UniffiRustBuffer,+)+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_theme.restype = ctypes.c_uint64_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_shutdown.argtypes = (ctypes.c_uint64,)@@ -1163,6 +1199,11 @@ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_escalate_session.argcua_driver._native_contract._UniffiRustBuffer,)_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_escalate_session.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_agent_cursor_state.argtypes = (+ ctypes.c_uint64,+ cua_driver._native_contract._UniffiRustBuffer,+)+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_agent_cursor_state.restype = ctypes.c_uint64_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_cursor_position.argtypes = (ctypes.c_uint64,cua_driver._native_contract._UniffiRustBuffer,@@ -1203,6 +1244,21 @@ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_scroll.argtypes = (cua_driver._native_contract._UniffiRustBuffer,)_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_scroll.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_enabled.argtypes = (+ ctypes.c_uint64,+ cua_driver._native_contract._UniffiRustBuffer,+)+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_enabled.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_motion.argtypes = (+ ctypes.c_uint64,+ cua_driver._native_contract._UniffiRustBuffer,+)+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_motion.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_theme.argtypes = (+ ctypes.c_uint64,+ cua_driver._native_contract._UniffiRustBuffer,+)+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_theme.restype = ctypes.c_uint64_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_start_session.argtypes = (ctypes.c_uint64,cua_driver._native_contract._UniffiRustBuffer,@@ -1334,6 +1390,9 @@ _UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_escalate_session.rest_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_execution_mode.argtypes = ()_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_execution_mode.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_get_agent_cursor_state.argtypes = (+)+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_get_agent_cursor_state.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_get_cursor_position.argtypes = ()_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_get_cursor_position.restype = ctypes.c_uint16@@ -1370,6 +1429,15 @@ _UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_runtime_scope_prefix._UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_scroll.argtypes = ()_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_scroll.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_enabled.argtypes = (+)+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_enabled.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_motion.argtypes = (+)+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_motion.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_theme.argtypes = (+)+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_theme.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_shutdown.argtypes = ()_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_shutdown.restype = ctypes.c_uint16@@ -1400,6 +1468,9 @@ _UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_end_session.re_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_escalate_session.argtypes = ()_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_escalate_session.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_agent_cursor_state.argtypes = (+)+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_agent_cursor_state.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_cursor_position.argtypes = ()_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_cursor_position.restype = ctypes.c_uint16@@ -1424,6 +1495,15 @@ _UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_press_key.rest_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_scroll.argtypes = ()_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_scroll.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_enabled.argtypes = (+)+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_enabled.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_motion.argtypes = (+)+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_motion.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_theme.argtypes = (+)+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_theme.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_start_session.argtypes = ()_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_start_session.restype = ctypes.c_uint16@@ -3727,6 +3807,14 @@ class _UniffiFfiConverterTypeSdkClientKind(_UniffiConverterRustBuffer):++++++++@@ -3755,6 +3843,8 @@ class CuaDriverProtocol(typing.Protocol):raise NotImplementedErrordef execution_mode(self, ) -> DriverExecutionMode:raise NotImplementedError+ async def get_agent_cursor_state(self, input: cua_driver._native_contract.GetAgentCursorStateInput) -> ToolResult:+ raise NotImplementedErrorasync def get_cursor_position(self, input: cua_driver._native_contract.GetCursorPositionInput) -> ToolResult:raise NotImplementedErrorasync def get_desktop_state(self, input: cua_driver._native_contract.GetDesktopStateInput) -> ToolResult:@@ -3782,6 +3872,12 @@ class CuaDriverProtocol(typing.Protocol):raise NotImplementedErrorasync def scroll(self, input: cua_driver._native_contract.ScrollInput) -> ToolResult:raise NotImplementedError+ async def set_agent_cursor_enabled(self, input: cua_driver._native_contract.SetAgentCursorEnabledInput) -> ToolResult:+ raise NotImplementedError+ async def set_agent_cursor_motion(self, input: cua_driver._native_contract.SetAgentCursorMotionInput) -> ToolResult:+ raise NotImplementedError+ async def set_agent_cursor_theme(self, input: cua_driver._native_contract.SetAgentCursorThemeInput) -> ToolResult:+ raise NotImplementedErrorasync def shutdown(self, ) -> None:"""Stop accepting new embedded operations. Repeated calls are harmless;@@ -4145,6 +4241,23 @@ class CuaDriver(CuaDriverProtocol):*_uniffi_lowered_args,)return _uniffi_lift_return(_uniffi_ffi_result)+ async def get_agent_cursor_state(self, input: cua_driver._native_contract.GetAgentCursorStateInput) -> ToolResult:++ cua_driver._native_contract._UniffiFfiConverterTypeGetAgentCursorStateInput.check_lower(input)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ cua_driver._native_contract._UniffiFfiConverterTypeGetAgentCursorStateInput.lower(input),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_get_agent_cursor_state(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )async def get_cursor_position(self, input: cua_driver._native_contract.GetCursorPositionInput) -> ToolResult:cua_driver._native_contract._UniffiFfiConverterTypeGetCursorPositionInput.check_lower(input)@@ -4336,6 +4449,57 @@ class CuaDriver(CuaDriverProtocol):_uniffi_lift_return,_uniffi_error_converter,)+ async def set_agent_cursor_enabled(self, input: cua_driver._native_contract.SetAgentCursorEnabledInput) -> ToolResult:++ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorEnabledInput.check_lower(input)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorEnabledInput.lower(input),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_enabled(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )+ async def set_agent_cursor_motion(self, input: cua_driver._native_contract.SetAgentCursorMotionInput) -> ToolResult:++ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorMotionInput.check_lower(input)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorMotionInput.lower(input),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_motion(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )+ async def set_agent_cursor_theme(self, input: cua_driver._native_contract.SetAgentCursorThemeInput) -> ToolResult:++ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorThemeInput.check_lower(input)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorThemeInput.lower(input),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_theme(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )async def shutdown(self, ) -> None:"""Stop accepting new embedded operations. Repeated calls are harmless;@@ -4455,6 +4619,8 @@ class CuaDriverSessionProtocol(typing.Protocol):raise NotImplementedErrorasync def escalate_session(self, input: cua_driver._native_contract.EscalateSessionInput) -> cua_driver._native_contract.SessionStateOutput:raise NotImplementedError+ async def get_agent_cursor_state(self, input: cua_driver._native_contract.GetAgentCursorStateInput) -> ToolResult:+ raise NotImplementedErrorasync def get_cursor_position(self, input: cua_driver._native_contract.GetCursorPositionInput) -> ToolResult:raise NotImplementedErrorasync def get_desktop_state(self, input: cua_driver._native_contract.GetDesktopStateInput) -> ToolResult:@@ -4471,6 +4637,12 @@ class CuaDriverSessionProtocol(typing.Protocol):raise NotImplementedErrorasync def scroll(self, input: cua_driver._native_contract.ScrollInput) -> ToolResult:raise NotImplementedError+ async def set_agent_cursor_enabled(self, input: cua_driver._native_contract.SetAgentCursorEnabledInput) -> ToolResult:+ raise NotImplementedError+ async def set_agent_cursor_motion(self, input: cua_driver._native_contract.SetAgentCursorMotionInput) -> ToolResult:+ raise NotImplementedError+ async def set_agent_cursor_theme(self, input: cua_driver._native_contract.SetAgentCursorThemeInput) -> ToolResult:+ raise NotImplementedErrorasync def start_session(self, input: cua_driver._native_contract.StartSessionInput) -> cua_driver._native_contract.StartSessionOutput:raise NotImplementedErrorasync def type_text(self, input: cua_driver._native_contract.TypeTextInput) -> ToolResult:@@ -4606,6 +4778,23 @@ class CuaDriverSession(CuaDriverSessionProtocol):_uniffi_lift_return,_uniffi_error_converter,)+ async def get_agent_cursor_state(self, input: cua_driver._native_contract.GetAgentCursorStateInput) -> ToolResult:++ cua_driver._native_contract._UniffiFfiConverterTypeGetAgentCursorStateInput.check_lower(input)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ cua_driver._native_contract._UniffiFfiConverterTypeGetAgentCursorStateInput.lower(input),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_agent_cursor_state(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )async def get_cursor_position(self, input: cua_driver._native_contract.GetCursorPositionInput) -> ToolResult:cua_driver._native_contract._UniffiFfiConverterTypeGetCursorPositionInput.check_lower(input)@@ -4742,6 +4931,57 @@ class CuaDriverSession(CuaDriverSessionProtocol):_uniffi_lift_return,_uniffi_error_converter,)+ async def set_agent_cursor_enabled(self, input: cua_driver._native_contract.SetAgentCursorEnabledInput) -> ToolResult:++ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorEnabledInput.check_lower(input)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorEnabledInput.lower(input),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_enabled(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )+ async def set_agent_cursor_motion(self, input: cua_driver._native_contract.SetAgentCursorMotionInput) -> ToolResult:++ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorMotionInput.check_lower(input)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorMotionInput.lower(input),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_motion(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )+ async def set_agent_cursor_theme(self, input: cua_driver._native_contract.SetAgentCursorThemeInput) -> ToolResult:++ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorThemeInput.check_lower(input)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorThemeInput.lower(input),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_theme(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )async def start_session(self, input: cua_driver._native_contract.StartSessionInput) -> cua_driver._native_contract.StartSessionOutput:cua_driver._native_contract._UniffiFfiConverterTypeStartSessionInput.check_lower(input)diff --git a/libs/cua-driver/python/src/cua_driver/_native_contract.py b/libs/cua-driver/python/src/cua_driver/_native_contract.pyindex 21493ca62f..c80c37775b 100644--- a/libs/cua-driver/python/src/cua_driver/_native_contract.py+++ b/libs/cua-driver/python/src/cua_driver/_native_contract.py@@ -1023,6 +1023,401 @@ class _UniffiFfiConverterTypeClickInput(_UniffiConverterRustBuffer):_UniffiFfiConverterOptionalTypeClickButton.write(value.button, buf)_UniffiFfiConverterOptionalUInt32.write(value.count, buf)+@dataclass+class CursorMotionOutput:+ def __init__(self, *, start_handle:float, end_handle:float, arc_size:float, arc_flow:float, spring:float, glide_duration_ms:float, dwell_after_click_ms:float, idle_hide_ms:float, turn_radius:float):+ self.start_handle = start_handle+ self.end_handle = end_handle+ self.arc_size = arc_size+ self.arc_flow = arc_flow+ self.spring = spring+ self.glide_duration_ms = glide_duration_ms+ self.dwell_after_click_ms = dwell_after_click_ms+ self.idle_hide_ms = idle_hide_ms+ self.turn_radius = turn_radius+++++ def __str__(self):+ return "CursorMotionOutput(start_handle={}, end_handle={}, arc_size={}, arc_flow={}, spring={}, glide_duration_ms={}, dwell_after_click_ms={}, idle_hide_ms={}, turn_radius={})".format(self.start_handle, self.end_handle, self.arc_size, self.arc_flow, self.spring, self.glide_duration_ms, self.dwell_after_click_ms, self.idle_hide_ms, self.turn_radius)+ def __eq__(self, other):+ if self.start_handle != other.start_handle:+ return False+ if self.end_handle != other.end_handle:+ return False+ if self.arc_size != other.arc_size:+ return False+ if self.arc_flow != other.arc_flow:+ return False+ if self.spring != other.spring:+ return False+ if self.glide_duration_ms != other.glide_duration_ms:+ return False+ if self.dwell_after_click_ms != other.dwell_after_click_ms:+ return False+ if self.idle_hide_ms != other.idle_hide_ms:+ return False+ if self.turn_radius != other.turn_radius:+ return False+ return True++class _UniffiFfiConverterTypeCursorMotionOutput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return CursorMotionOutput(+ start_handle=_UniffiFfiConverterFloat64.read(buf),+ end_handle=_UniffiFfiConverterFloat64.read(buf),+ arc_size=_UniffiFfiConverterFloat64.read(buf),+ arc_flow=_UniffiFfiConverterFloat64.read(buf),+ spring=_UniffiFfiConverterFloat64.read(buf),+ glide_duration_ms=_UniffiFfiConverterFloat64.read(buf),+ dwell_after_click_ms=_UniffiFfiConverterFloat64.read(buf),+ idle_hide_ms=_UniffiFfiConverterFloat64.read(buf),+ turn_radius=_UniffiFfiConverterFloat64.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterFloat64.check_lower(value.start_handle)+ _UniffiFfiConverterFloat64.check_lower(value.end_handle)+ _UniffiFfiConverterFloat64.check_lower(value.arc_size)+ _UniffiFfiConverterFloat64.check_lower(value.arc_flow)+ _UniffiFfiConverterFloat64.check_lower(value.spring)+ _UniffiFfiConverterFloat64.check_lower(value.glide_duration_ms)+ _UniffiFfiConverterFloat64.check_lower(value.dwell_after_click_ms)+ _UniffiFfiConverterFloat64.check_lower(value.idle_hide_ms)+ _UniffiFfiConverterFloat64.check_lower(value.turn_radius)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterFloat64.write(value.start_handle, buf)+ _UniffiFfiConverterFloat64.write(value.end_handle, buf)+ _UniffiFfiConverterFloat64.write(value.arc_size, buf)+ _UniffiFfiConverterFloat64.write(value.arc_flow, buf)+ _UniffiFfiConverterFloat64.write(value.spring, buf)+ _UniffiFfiConverterFloat64.write(value.glide_duration_ms, buf)+ _UniffiFfiConverterFloat64.write(value.dwell_after_click_ms, buf)+ _UniffiFfiConverterFloat64.write(value.idle_hide_ms, buf)+ _UniffiFfiConverterFloat64.write(value.turn_radius, buf)++@dataclass+class CursorPointOutput:+ def __init__(self, *, x:float, y:float):+ self.x = x+ self.y = y+++++ def __str__(self):+ return "CursorPointOutput(x={}, y={})".format(self.x, self.y)+ def __eq__(self, other):+ if self.x != other.x:+ return False+ if self.y != other.y:+ return False+ return True++class _UniffiFfiConverterTypeCursorPointOutput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return CursorPointOutput(+ x=_UniffiFfiConverterFloat64.read(buf),+ y=_UniffiFfiConverterFloat64.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterFloat64.check_lower(value.x)+ _UniffiFfiConverterFloat64.check_lower(value.y)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterFloat64.write(value.x, buf)+ _UniffiFfiConverterFloat64.write(value.y, buf)+++++++class CursorReducedMotion(enum.Enum):++ AUTO = 0++ ON = 1++ OFF = 2++++class _UniffiFfiConverterTypeCursorReducedMotion(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ variant = buf.read_i32()+ if variant == 1:+ return CursorReducedMotion.AUTO+ if variant == 2:+ return CursorReducedMotion.ON+ if variant == 3:+ return CursorReducedMotion.OFF+ raise InternalError("Raw enum value doesn't match any cases")++ @staticmethod+ def check_lower(value):+ if value == CursorReducedMotion.AUTO:+ return+ if value == CursorReducedMotion.ON:+ return+ if value == CursorReducedMotion.OFF:+ return+ raise ValueError(value)++ @staticmethod+ def write(value, buf):+ if value == CursorReducedMotion.AUTO:+ buf.write_i32(1)+ if value == CursorReducedMotion.ON:+ buf.write_i32(2)+ if value == CursorReducedMotion.OFF:+ buf.write_i32(3)++++@dataclass+class CursorThemeOutput:+ def __init__(self, *, id:str, version:str, profile:str, reduced_motion:CursorReducedMotion, fallback:typing.Optional[str]):+ self.id = id+ self.version = version+ self.profile = profile+ self.reduced_motion = reduced_motion+ self.fallback = fallback+++++ def __str__(self):+ return "CursorThemeOutput(id={}, version={}, profile={}, reduced_motion={}, fallback={})".format(self.id, self.version, self.profile, self.reduced_motion, self.fallback)+ def __eq__(self, other):+ if self.id != other.id:+ return False+ if self.version != other.version:+ return False+ if self.profile != other.profile:+ return False+ if self.reduced_motion != other.reduced_motion:+ return False+ if self.fallback != other.fallback:+ return False+ return True++class _UniffiFfiConverterTypeCursorThemeOutput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return CursorThemeOutput(+ id=_UniffiFfiConverterString.read(buf),+ version=_UniffiFfiConverterString.read(buf),+ profile=_UniffiFfiConverterString.read(buf),+ reduced_motion=_UniffiFfiConverterTypeCursorReducedMotion.read(buf),+ fallback=_UniffiFfiConverterOptionalString.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.id)+ _UniffiFfiConverterString.check_lower(value.version)+ _UniffiFfiConverterString.check_lower(value.profile)+ _UniffiFfiConverterTypeCursorReducedMotion.check_lower(value.reduced_motion)+ _UniffiFfiConverterOptionalString.check_lower(value.fallback)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.id, buf)+ _UniffiFfiConverterString.write(value.version, buf)+ _UniffiFfiConverterString.write(value.profile, buf)+ _UniffiFfiConverterTypeCursorReducedMotion.write(value.reduced_motion, buf)+ _UniffiFfiConverterOptionalString.write(value.fallback, buf)++@dataclass+class CursorThemeSelection:+ def __init__(self, *, theme_id:str, reduced_motion:CursorReducedMotion):+ self.theme_id = theme_id+ self.reduced_motion = reduced_motion+++++ def __str__(self):+ return "CursorThemeSelection(theme_id={}, reduced_motion={})".format(self.theme_id, self.reduced_motion)+ def __eq__(self, other):+ if self.theme_id != other.theme_id:+ return False+ if self.reduced_motion != other.reduced_motion:+ return False+ return True++class _UniffiFfiConverterTypeCursorThemeSelection(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return CursorThemeSelection(+ theme_id=_UniffiFfiConverterString.read(buf),+ reduced_motion=_UniffiFfiConverterTypeCursorReducedMotion.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.theme_id)+ _UniffiFfiConverterTypeCursorReducedMotion.check_lower(value.reduced_motion)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.theme_id, buf)+ _UniffiFfiConverterTypeCursorReducedMotion.write(value.reduced_motion, buf)+++++++class CursorAction(enum.Enum):++ IDLE = 0++ OBSERVE = 1++ CLICK = 2++ DRAG = 3++ SCROLL = 4++ TEXT = 5++ KEY = 6++ NAVIGATE = 7++ APP = 8++ TRANSFER = 9++ RECORD = 10++ SYSTEM = 11++++class _UniffiFfiConverterTypeCursorAction(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ variant = buf.read_i32()+ if variant == 1:+ return CursorAction.IDLE+ if variant == 2:+ return CursorAction.OBSERVE+ if variant == 3:+ return CursorAction.CLICK+ if variant == 4:+ return CursorAction.DRAG+ if variant == 5:+ return CursorAction.SCROLL+ if variant == 6:+ return CursorAction.TEXT+ if variant == 7:+ return CursorAction.KEY+ if variant == 8:+ return CursorAction.NAVIGATE+ if variant == 9:+ return CursorAction.APP+ if variant == 10:+ return CursorAction.TRANSFER+ if variant == 11:+ return CursorAction.RECORD+ if variant == 12:+ return CursorAction.SYSTEM+ raise InternalError("Raw enum value doesn't match any cases")++ @staticmethod+ def check_lower(value):+ if value == CursorAction.IDLE:+ return+ if value == CursorAction.OBSERVE:+ return+ if value == CursorAction.CLICK:+ return+ if value == CursorAction.DRAG:+ return+ if value == CursorAction.SCROLL:+ return+ if value == CursorAction.TEXT:+ return+ if value == CursorAction.KEY:+ return+ if value == CursorAction.NAVIGATE:+ return+ if value == CursorAction.APP:+ return+ if value == CursorAction.TRANSFER:+ return+ if value == CursorAction.RECORD:+ return+ if value == CursorAction.SYSTEM:+ return+ raise ValueError(value)++ @staticmethod+ def write(value, buf):+ if value == CursorAction.IDLE:+ buf.write_i32(1)+ if value == CursorAction.OBSERVE:+ buf.write_i32(2)+ if value == CursorAction.CLICK:+ buf.write_i32(3)+ if value == CursorAction.DRAG:+ buf.write_i32(4)+ if value == CursorAction.SCROLL:+ buf.write_i32(5)+ if value == CursorAction.TEXT:+ buf.write_i32(6)+ if value == CursorAction.KEY:+ buf.write_i32(7)+ if value == CursorAction.NAVIGATE:+ buf.write_i32(8)+ if value == CursorAction.APP:+ buf.write_i32(9)+ if value == CursorAction.TRANSFER:+ buf.write_i32(10)+ if value == CursorAction.RECORD:+ buf.write_i32(11)+ if value == CursorAction.SYSTEM:+ buf.write_i32(12)++++class _UniffiFfiConverterSequenceString(_UniffiConverterRustBuffer):+ @classmethod+ def check_lower(cls, value):+ for item in value:+ _UniffiFfiConverterString.check_lower(item)++ @classmethod+ def write(cls, value, buf):+ items = len(value)+ buf.write_i32(items)+ for item in value:+ _UniffiFfiConverterString.write(item, buf)++ @classmethod+ def read(cls, buf):+ count = buf.read_i32()+ if count < 0:+ raise InternalError("Unexpected negative sequence length")++ return [+ _UniffiFfiConverterString.read(buf) for i in range(count)+ ]+class _UniffiFfiConverterUInt64(_UniffiConverterPrimitiveInt):CLASS_NAME = "u64"VALUE_MIN = 0@@ -1036,6 +1431,66 @@ class _UniffiFfiConverterUInt64(_UniffiConverterPrimitiveInt):def write(value, buf):buf.write_u64(value)+@dataclass+class CursorVisualOutput:+ def __init__(self, *, requested_action:CursorAction, resolved_action:CursorAction, modifiers:typing.List[str], phase:str, frame:int, preempted_count:int):+ self.requested_action = requested_action+ self.resolved_action = resolved_action+ self.modifiers = modifiers+ self.phase = phase+ self.frame = frame+ self.preempted_count = preempted_count+++++ def __str__(self):+ return "CursorVisualOutput(requested_action={}, resolved_action={}, modifiers={}, phase={}, frame={}, preempted_count={})".format(self.requested_action, self.resolved_action, self.modifiers, self.phase, self.frame, self.preempted_count)+ def __eq__(self, other):+ if self.requested_action != other.requested_action:+ return False+ if self.resolved_action != other.resolved_action:+ return False+ if self.modifiers != other.modifiers:+ return False+ if self.phase != other.phase:+ return False+ if self.frame != other.frame:+ return False+ if self.preempted_count != other.preempted_count:+ return False+ return True++class _UniffiFfiConverterTypeCursorVisualOutput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return CursorVisualOutput(+ requested_action=_UniffiFfiConverterTypeCursorAction.read(buf),+ resolved_action=_UniffiFfiConverterTypeCursorAction.read(buf),+ modifiers=_UniffiFfiConverterSequenceString.read(buf),+ phase=_UniffiFfiConverterString.read(buf),+ frame=_UniffiFfiConverterUInt64.read(buf),+ preempted_count=_UniffiFfiConverterUInt64.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterTypeCursorAction.check_lower(value.requested_action)+ _UniffiFfiConverterTypeCursorAction.check_lower(value.resolved_action)+ _UniffiFfiConverterSequenceString.check_lower(value.modifiers)+ _UniffiFfiConverterString.check_lower(value.phase)+ _UniffiFfiConverterUInt64.check_lower(value.frame)+ _UniffiFfiConverterUInt64.check_lower(value.preempted_count)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterTypeCursorAction.write(value.requested_action, buf)+ _UniffiFfiConverterTypeCursorAction.write(value.resolved_action, buf)+ _UniffiFfiConverterSequenceString.write(value.modifiers, buf)+ _UniffiFfiConverterString.write(value.phase, buf)+ _UniffiFfiConverterUInt64.write(value.frame, buf)+ _UniffiFfiConverterUInt64.write(value.preempted_count, buf)+class _UniffiFfiConverterOptionalUInt64(_UniffiConverterRustBuffer):@classmethoddef check_lower(cls, value):@@ -1061,29 +1516,6 @@ class _UniffiFfiConverterOptionalUInt64(_UniffiConverterRustBuffer):else:raise InternalError("Unexpected flag byte for optional type")-class _UniffiFfiConverterSequenceString(_UniffiConverterRustBuffer):- @classmethod- def check_lower(cls, value):- for item in value:- _UniffiFfiConverterString.check_lower(item)-- @classmethod- def write(cls, value, buf):- items = len(value)- buf.write_i32(items)- for item in value:- _UniffiFfiConverterString.write(item, buf)-- @classmethod- def read(cls, buf):- count = buf.read_i32()- if count < 0:- raise InternalError("Unexpected negative sequence length")-- return [- _UniffiFfiConverterString.read(buf) for i in range(count)- ]-class _UniffiFfiConverterOptionalSequenceString(_UniffiConverterRustBuffer):@classmethoddef check_lower(cls, value):@@ -1334,60 +1766,175 @@ class _UniffiFfiConverterTypeEscalationReason(_UniffiConverterRustBuffer):@staticmethoddef write(value, buf):- if value == EscalationReason.AX_TREE_PIXEL_MISMATCH:- buf.write_i32(1)- if value == EscalationReason.BACKGROUND_DELIVERY_FAILED:- buf.write_i32(2)- if value == EscalationReason.FOREGROUND_INEFFECTIVE:- buf.write_i32(3)- if value == EscalationReason.NO_WINDOW_TARGET:- buf.write_i32(4)- if value == EscalationReason.OTHER:- buf.write_i32(5)+ if value == EscalationReason.AX_TREE_PIXEL_MISMATCH:+ buf.write_i32(1)+ if value == EscalationReason.BACKGROUND_DELIVERY_FAILED:+ buf.write_i32(2)+ if value == EscalationReason.FOREGROUND_INEFFECTIVE:+ buf.write_i32(3)+ if value == EscalationReason.NO_WINDOW_TARGET:+ buf.write_i32(4)+ if value == EscalationReason.OTHER:+ buf.write_i32(5)++++@dataclass+class EscalateSessionInput:+ def __init__(self, *, session:str, reason:EscalationReason, detail:typing.Optional[str]):+ self.session = session+ self.reason = reason+ self.detail = detail+++++ def __str__(self):+ return "EscalateSessionInput(session={}, reason={}, detail={})".format(self.session, self.reason, self.detail)+ def __eq__(self, other):+ if self.session != other.session:+ return False+ if self.reason != other.reason:+ return False+ if self.detail != other.detail:+ return False+ return True++class _UniffiFfiConverterTypeEscalateSessionInput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return EscalateSessionInput(+ session=_UniffiFfiConverterString.read(buf),+ reason=_UniffiFfiConverterTypeEscalationReason.read(buf),+ detail=_UniffiFfiConverterOptionalString.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.session)+ _UniffiFfiConverterTypeEscalationReason.check_lower(value.reason)+ _UniffiFfiConverterOptionalString.check_lower(value.detail)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.session, buf)+ _UniffiFfiConverterTypeEscalationReason.write(value.reason, buf)+ _UniffiFfiConverterOptionalString.write(value.detail, buf)++@dataclass+class GetAgentCursorStateInput:+ def __init__(self, *, session:str):+ self.session = session+++++ def __str__(self):+ return "GetAgentCursorStateInput(session={})".format(self.session)+ def __eq__(self, other):+ if self.session != other.session:+ return False+ return True++class _UniffiFfiConverterTypeGetAgentCursorStateInput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return GetAgentCursorStateInput(+ session=_UniffiFfiConverterString.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.session)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.session, buf)++class _UniffiFfiConverterOptionalTypeCursorPointOutput(_UniffiConverterRustBuffer):+ @classmethod+ def check_lower(cls, value):+ if value is not None:+ _UniffiFfiConverterTypeCursorPointOutput.check_lower(value)++ @classmethod+ def write(cls, value, buf):+ if value is None:+ buf.write_u8(0)+ return+ buf.write_u8(1)+ _UniffiFfiConverterTypeCursorPointOutput.write(value, buf)+ @classmethod+ def read(cls, buf):+ flag = buf.read_u8()+ if flag == 0:+ return None+ elif flag == 1:+ return _UniffiFfiConverterTypeCursorPointOutput.read(buf)+ else:+ raise InternalError("Unexpected flag byte for optional type")@dataclass-class EscalateSessionInput:- def __init__(self, *, session:str, reason:EscalationReason, detail:typing.Optional[str]):+class GetAgentCursorStateOutput:+ def __init__(self, *, session:str, enabled:bool, position:typing.Optional[CursorPointOutput], theme:CursorThemeOutput, visual_state:CursorVisualOutput, motion:CursorMotionOutput):self.session = session- self.reason = reason- self.detail = detail+ self.enabled = enabled+ self.position = position+ self.theme = theme+ self.visual_state = visual_state+ self.motion = motiondef __str__(self):- return "EscalateSessionInput(session={}, reason={}, detail={})".format(self.session, self.reason, self.detail)+ return "GetAgentCursorStateOutput(session={}, enabled={}, position={}, theme={}, visual_state={}, motion={})".format(self.session, self.enabled, self.position, self.theme, self.visual_state, self.motion)def __eq__(self, other):if self.session != other.session:return False- if self.reason != other.reason:+ if self.enabled != other.enabled:return False- if self.detail != other.detail:+ if self.position != other.position:+ return False+ if self.theme != other.theme:+ return False+ if self.visual_state != other.visual_state:+ return False+ if self.motion != other.motion:return Falsereturn True-class _UniffiFfiConverterTypeEscalateSessionInput(_UniffiConverterRustBuffer):+class _UniffiFfiConverterTypeGetAgentCursorStateOutput(_UniffiConverterRustBuffer):@staticmethoddef read(buf):- return EscalateSessionInput(+ return GetAgentCursorStateOutput(session=_UniffiFfiConverterString.read(buf),- reason=_UniffiFfiConverterTypeEscalationReason.read(buf),- detail=_UniffiFfiConverterOptionalString.read(buf),+ enabled=_UniffiFfiConverterBoolean.read(buf),+ position=_UniffiFfiConverterOptionalTypeCursorPointOutput.read(buf),+ theme=_UniffiFfiConverterTypeCursorThemeOutput.read(buf),+ visual_state=_UniffiFfiConverterTypeCursorVisualOutput.read(buf),+ motion=_UniffiFfiConverterTypeCursorMotionOutput.read(buf),)@staticmethoddef check_lower(value):_UniffiFfiConverterString.check_lower(value.session)- _UniffiFfiConverterTypeEscalationReason.check_lower(value.reason)- _UniffiFfiConverterOptionalString.check_lower(value.detail)+ _UniffiFfiConverterBoolean.check_lower(value.enabled)+ _UniffiFfiConverterOptionalTypeCursorPointOutput.check_lower(value.position)+ _UniffiFfiConverterTypeCursorThemeOutput.check_lower(value.theme)+ _UniffiFfiConverterTypeCursorVisualOutput.check_lower(value.visual_state)+ _UniffiFfiConverterTypeCursorMotionOutput.check_lower(value.motion)@staticmethoddef write(value, buf):_UniffiFfiConverterString.write(value.session, buf)- _UniffiFfiConverterTypeEscalationReason.write(value.reason, buf)- _UniffiFfiConverterOptionalString.write(value.detail, buf)+ _UniffiFfiConverterBoolean.write(value.enabled, buf)+ _UniffiFfiConverterOptionalTypeCursorPointOutput.write(value.position, buf)+ _UniffiFfiConverterTypeCursorThemeOutput.write(value.theme, buf)+ _UniffiFfiConverterTypeCursorVisualOutput.write(value.visual_state, buf)+ _UniffiFfiConverterTypeCursorMotionOutput.write(value.motion, buf)@dataclassclass GetCursorPositionInput:@@ -2016,6 +2563,301 @@ class _UniffiFfiConverterTypeSessionStateOutput(_UniffiConverterRustBuffer):_UniffiFfiConverterOptionalTypeEscalationReason.write(value.escalation_reason, buf)_UniffiFfiConverterOptionalString.write(value.escalation_detail, buf)+@dataclass+class SetAgentCursorEnabledInput:+ def __init__(self, *, session:str, enabled:bool):+ self.session = session+ self.enabled = enabled+++++ def __str__(self):+ return "SetAgentCursorEnabledInput(session={}, enabled={})".format(self.session, self.enabled)+ def __eq__(self, other):+ if self.session != other.session:+ return False+ if self.enabled != other.enabled:+ return False+ return True++class _UniffiFfiConverterTypeSetAgentCursorEnabledInput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return SetAgentCursorEnabledInput(+ session=_UniffiFfiConverterString.read(buf),+ enabled=_UniffiFfiConverterBoolean.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.session)+ _UniffiFfiConverterBoolean.check_lower(value.enabled)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.session, buf)+ _UniffiFfiConverterBoolean.write(value.enabled, buf)++@dataclass+class SetAgentCursorEnabledOutput:+ def __init__(self, *, session:str, enabled:bool):+ self.session = session+ self.enabled = enabled+++++ def __str__(self):+ return "SetAgentCursorEnabledOutput(session={}, enabled={})".format(self.session, self.enabled)+ def __eq__(self, other):+ if self.session != other.session:+ return False+ if self.enabled != other.enabled:+ return False+ return True++class _UniffiFfiConverterTypeSetAgentCursorEnabledOutput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return SetAgentCursorEnabledOutput(+ session=_UniffiFfiConverterString.read(buf),+ enabled=_UniffiFfiConverterBoolean.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.session)+ _UniffiFfiConverterBoolean.check_lower(value.enabled)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.session, buf)+ _UniffiFfiConverterBoolean.write(value.enabled, buf)++class _UniffiFfiConverterOptionalFloat64(_UniffiConverterRustBuffer):+ @classmethod+ def check_lower(cls, value):+ if value is not None:+ _UniffiFfiConverterFloat64.check_lower(value)++ @classmethod+ def write(cls, value, buf):+ if value is None:+ buf.write_u8(0)+ return++ buf.write_u8(1)+ _UniffiFfiConverterFloat64.write(value, buf)++ @classmethod+ def read(cls, buf):+ flag = buf.read_u8()+ if flag == 0:+ return None+ elif flag == 1:+ return _UniffiFfiConverterFloat64.read(buf)+ else:+ raise InternalError("Unexpected flag byte for optional type")++@dataclass+class SetAgentCursorMotionInput:+ def __init__(self, *, session:str, start_handle:typing.Optional[float], end_handle:typing.Optional[float], arc_size:typing.Optional[float], arc_flow:typing.Optional[float], spring:typing.Optional[float], glide_duration_ms:typing.Optional[float], dwell_after_click_ms:typing.Optional[float], idle_hide_ms:typing.Optional[float], turn_radius:typing.Optional[float]):+ self.session = session+ self.start_handle = start_handle+ self.end_handle = end_handle+ self.arc_size = arc_size+ self.arc_flow = arc_flow+ self.spring = spring+ self.glide_duration_ms = glide_duration_ms+ self.dwell_after_click_ms = dwell_after_click_ms+ self.idle_hide_ms = idle_hide_ms+ self.turn_radius = turn_radius+++++ def __str__(self):+ return "SetAgentCursorMotionInput(session={}, start_handle={}, end_handle={}, arc_size={}, arc_flow={}, spring={}, glide_duration_ms={}, dwell_after_click_ms={}, idle_hide_ms={}, turn_radius={})".format(self.session, self.start_handle, self.end_handle, self.arc_size, self.arc_flow, self.spring, self.glide_duration_ms, self.dwell_after_click_ms, self.idle_hide_ms, self.turn_radius)+ def __eq__(self, other):+ if self.session != other.session:+ return False+ if self.start_handle != other.start_handle:+ return False+ if self.end_handle != other.end_handle:+ return False+ if self.arc_size != other.arc_size:+ return False+ if self.arc_flow != other.arc_flow:+ return False+ if self.spring != other.spring:+ return False+ if self.glide_duration_ms != other.glide_duration_ms:+ return False+ if self.dwell_after_click_ms != other.dwell_after_click_ms:+ return False+ if self.idle_hide_ms != other.idle_hide_ms:+ return False+ if self.turn_radius != other.turn_radius:+ return False+ return True++class _UniffiFfiConverterTypeSetAgentCursorMotionInput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return SetAgentCursorMotionInput(+ session=_UniffiFfiConverterString.read(buf),+ start_handle=_UniffiFfiConverterOptionalFloat64.read(buf),+ end_handle=_UniffiFfiConverterOptionalFloat64.read(buf),+ arc_size=_UniffiFfiConverterOptionalFloat64.read(buf),+ arc_flow=_UniffiFfiConverterOptionalFloat64.read(buf),+ spring=_UniffiFfiConverterOptionalFloat64.read(buf),+ glide_duration_ms=_UniffiFfiConverterOptionalFloat64.read(buf),+ dwell_after_click_ms=_UniffiFfiConverterOptionalFloat64.read(buf),+ idle_hide_ms=_UniffiFfiConverterOptionalFloat64.read(buf),+ turn_radius=_UniffiFfiConverterOptionalFloat64.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.session)+ _UniffiFfiConverterOptionalFloat64.check_lower(value.start_handle)+ _UniffiFfiConverterOptionalFloat64.check_lower(value.end_handle)+ _UniffiFfiConverterOptionalFloat64.check_lower(value.arc_size)+ _UniffiFfiConverterOptionalFloat64.check_lower(value.arc_flow)+ _UniffiFfiConverterOptionalFloat64.check_lower(value.spring)+ _UniffiFfiConverterOptionalFloat64.check_lower(value.glide_duration_ms)+ _UniffiFfiConverterOptionalFloat64.check_lower(value.dwell_after_click_ms)+ _UniffiFfiConverterOptionalFloat64.check_lower(value.idle_hide_ms)+ _UniffiFfiConverterOptionalFloat64.check_lower(value.turn_radius)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.session, buf)+ _UniffiFfiConverterOptionalFloat64.write(value.start_handle, buf)+ _UniffiFfiConverterOptionalFloat64.write(value.end_handle, buf)+ _UniffiFfiConverterOptionalFloat64.write(value.arc_size, buf)+ _UniffiFfiConverterOptionalFloat64.write(value.arc_flow, buf)+ _UniffiFfiConverterOptionalFloat64.write(value.spring, buf)+ _UniffiFfiConverterOptionalFloat64.write(value.glide_duration_ms, buf)+ _UniffiFfiConverterOptionalFloat64.write(value.dwell_after_click_ms, buf)+ _UniffiFfiConverterOptionalFloat64.write(value.idle_hide_ms, buf)+ _UniffiFfiConverterOptionalFloat64.write(value.turn_radius, buf)++@dataclass+class SetAgentCursorMotionOutput:+ def __init__(self, *, session:str, motion:CursorMotionOutput):+ self.session = session+ self.motion = motion+++++ def __str__(self):+ return "SetAgentCursorMotionOutput(session={}, motion={})".format(self.session, self.motion)+ def __eq__(self, other):+ if self.session != other.session:+ return False+ if self.motion != other.motion:+ return False+ return True++class _UniffiFfiConverterTypeSetAgentCursorMotionOutput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return SetAgentCursorMotionOutput(+ session=_UniffiFfiConverterString.read(buf),+ motion=_UniffiFfiConverterTypeCursorMotionOutput.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.session)+ _UniffiFfiConverterTypeCursorMotionOutput.check_lower(value.motion)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.session, buf)+ _UniffiFfiConverterTypeCursorMotionOutput.write(value.motion, buf)++@dataclass+class SetAgentCursorThemeInput:+ def __init__(self, *, session:str, theme_id:str, reduced_motion:CursorReducedMotion):+ self.session = session+ self.theme_id = theme_id+ self.reduced_motion = reduced_motion+++++ def __str__(self):+ return "SetAgentCursorThemeInput(session={}, theme_id={}, reduced_motion={})".format(self.session, self.theme_id, self.reduced_motion)+ def __eq__(self, other):+ if self.session != other.session:+ return False+ if self.theme_id != other.theme_id:+ return False+ if self.reduced_motion != other.reduced_motion:+ return False+ return True++class _UniffiFfiConverterTypeSetAgentCursorThemeInput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return SetAgentCursorThemeInput(+ session=_UniffiFfiConverterString.read(buf),+ theme_id=_UniffiFfiConverterString.read(buf),+ reduced_motion=_UniffiFfiConverterTypeCursorReducedMotion.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.session)+ _UniffiFfiConverterString.check_lower(value.theme_id)+ _UniffiFfiConverterTypeCursorReducedMotion.check_lower(value.reduced_motion)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.session, buf)+ _UniffiFfiConverterString.write(value.theme_id, buf)+ _UniffiFfiConverterTypeCursorReducedMotion.write(value.reduced_motion, buf)++@dataclass+class SetAgentCursorThemeOutput:+ def __init__(self, *, session:str, theme:CursorThemeOutput):+ self.session = session+ self.theme = theme+++++ def __str__(self):+ return "SetAgentCursorThemeOutput(session={}, theme={})".format(self.session, self.theme)+ def __eq__(self, other):+ if self.session != other.session:+ return False+ if self.theme != other.theme:+ return False+ return True++class _UniffiFfiConverterTypeSetAgentCursorThemeOutput(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return SetAgentCursorThemeOutput(+ session=_UniffiFfiConverterString.read(buf),+ theme=_UniffiFfiConverterTypeCursorThemeOutput.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.session)+ _UniffiFfiConverterTypeCursorThemeOutput.check_lower(value.theme)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.session, buf)+ _UniffiFfiConverterTypeCursorThemeOutput.write(value.theme, buf)+class _UniffiFfiConverterOptionalTypeCaptureScope(_UniffiConverterRustBuffer):@classmethoddef check_lower(cls, value):@@ -2041,22 +2883,50 @@ class _UniffiFfiConverterOptionalTypeCaptureScope(_UniffiConverterRustBuffer):else:raise InternalError("Unexpected flag byte for optional type")+class _UniffiFfiConverterOptionalTypeCursorThemeSelection(_UniffiConverterRustBuffer):+ @classmethod+ def check_lower(cls, value):+ if value is not None:+ _UniffiFfiConverterTypeCursorThemeSelection.check_lower(value)++ @classmethod+ def write(cls, value, buf):+ if value is None:+ buf.write_u8(0)+ return++ buf.write_u8(1)+ _UniffiFfiConverterTypeCursorThemeSelection.write(value, buf)++ @classmethod+ def read(cls, buf):+ flag = buf.read_u8()+ if flag == 0:+ return None+ elif flag == 1:+ return _UniffiFfiConverterTypeCursorThemeSelection.read(buf)+ else:+ raise InternalError("Unexpected flag byte for optional type")+@dataclassclass StartSessionInput:- def __init__(self, *, session:str, capture_scope:typing.Optional[CaptureScope]):+ def __init__(self, *, session:str, capture_scope:typing.Optional[CaptureScope], cursor_theme:typing.Optional[CursorThemeSelection]):self.session = sessionself.capture_scope = capture_scope+ self.cursor_theme = cursor_themedef __str__(self):- return "StartSessionInput(session={}, capture_scope={})".format(self.session, self.capture_scope)+ return "StartSessionInput(session={}, capture_scope={}, cursor_theme={})".format(self.session, self.capture_scope, self.cursor_theme)def __eq__(self, other):if self.session != other.session:return Falseif self.capture_scope != other.capture_scope:return False+ if self.cursor_theme != other.cursor_theme:+ return Falsereturn Trueclass _UniffiFfiConverterTypeStartSessionInput(_UniffiConverterRustBuffer):@@ -2065,17 +2935,20 @@ class _UniffiFfiConverterTypeStartSessionInput(_UniffiConverterRustBuffer):return StartSessionInput(session=_UniffiFfiConverterString.read(buf),capture_scope=_UniffiFfiConverterOptionalTypeCaptureScope.read(buf),+ cursor_theme=_UniffiFfiConverterOptionalTypeCursorThemeSelection.read(buf),)@staticmethoddef check_lower(value):_UniffiFfiConverterString.check_lower(value.session)_UniffiFfiConverterOptionalTypeCaptureScope.check_lower(value.capture_scope)+ _UniffiFfiConverterOptionalTypeCursorThemeSelection.check_lower(value.cursor_theme)@staticmethoddef write(value, buf):_UniffiFfiConverterString.write(value.session, buf)_UniffiFfiConverterOptionalTypeCaptureScope.write(value.capture_scope, buf)+ _UniffiFfiConverterOptionalTypeCursorThemeSelection.write(value.cursor_theme, buf)@dataclassclass StartSessionOutput:@@ -2229,6 +3102,8 @@ __all__ = ["InternalError","DesktopScope","ClickButton",+ "CursorReducedMotion",+ "CursorAction","EscalationReason","ScrollDirection","ScrollBy",@@ -2236,10 +3111,17 @@ __all__ = ["EffectiveScope","Platform","ClickInput",+ "CursorMotionOutput",+ "CursorPointOutput",+ "CursorThemeOutput",+ "CursorThemeSelection",+ "CursorVisualOutput","DragInput","EndSessionInput","EndSessionOutput","EscalateSessionInput",+ "GetAgentCursorStateInput",+ "GetAgentCursorStateOutput","GetCursorPositionInput","GetDesktopStateInput","GetScreenSizeInput",@@ -2249,6 +3131,12 @@ __all__ = ["PressKeyInput","ScrollInput","SessionStateOutput",+ "SetAgentCursorEnabledInput",+ "SetAgentCursorEnabledOutput",+ "SetAgentCursorMotionInput",+ "SetAgentCursorMotionOutput",+ "SetAgentCursorThemeInput",+ "SetAgentCursorThemeOutput","StartSessionInput","StartSessionOutput","TypeTextInput",diff --git a/libs/cua-driver/rust/Cargo.lock b/libs/cua-driver/rust/Cargo.lockindex 590563f100..07119eadeb 100644--- a/libs/cua-driver/rust/Cargo.lock+++ b/libs/cua-driver/rust/Cargo.lock@@ -343,6 +343,15 @@ dependencies = ["syn",]+[[package]]+name = "atomic-polyfill"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4"+dependencies = [+ "critical-section",+]+[[package]]name = "atomic-waker"version = "1.1.2"@@ -635,6 +644,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98"dependencies = ["find-msvc-tools",+ "jobserver",+ "libc","shlex",]@@ -859,15 +870,6 @@ dependencies = ["libc",]-[[package]]-name = "core_maths"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30"-dependencies = [- "libm",-]-[[package]]name = "cpufeatures"version = "0.2.17"@@ -895,6 +897,12 @@ dependencies = ["cfg-if",]+[[package]]+name = "critical-section"+version = "1.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"+[[package]]name = "crossbeam-channel"version = "0.5.15"@@ -1065,13 +1073,30 @@ name = "cursor-overlay"version = "0.12.6"dependencies = ["anyhow",+ "cua-driver-contract","image",- "resvg",+ "postcard","serde","serde_json",- "tiny-skia",+ "sha2",+ "tiny-skia 0.11.4","tracing",- "usvg",+ "zstd",+]++[[package]]+name = "cursor-theme-cli"+version = "0.12.6"+dependencies = [+ "anyhow",+ "cursor-overlay",+ "image",+ "rasterlottie",+ "serde",+ "serde_json",+ "sha2",+ "tempfile",+ "zip",][[package]]@@ -1080,12 +1105,6 @@ version = "2.11.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8"-[[package]]-name = "data-url"-version = "0.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376"-[[package]]name = "deranged"version = "0.5.8"@@ -1258,15 +1277,6 @@ dependencies = ["windows-sys 0.61.2",]-[[package]]-name = "euclid"-version = "0.22.14"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06"-dependencies = [- "num-traits",-]-[[package]]name = "evdev"version = "0.12.2"@@ -1351,14 +1361,9 @@ checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"dependencies = ["crc32fast","miniz_oxide",+ "zlib-rs",]-[[package]]-name = "float-cmp"-version = "0.9.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"-[[package]]name = "fluent-uri"version = "0.4.1"@@ -1388,18 +1393,6 @@ version = "0.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"-[[package]]-name = "fontdb"-version = "0.22.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a3a6f9af55fb97ad673fb7a69533eb2f967648a06fa21f8c9bb2cd6d33975716"-dependencies = [- "log",- "slotmap",- "tinyvec",- "ttf-parser",-]-[[package]]name = "foreign-types"version = "0.3.2"@@ -1665,6 +1658,15 @@ dependencies = ["scroll",]+[[package]]+name = "hash32"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"+dependencies = [+ "byteorder",+]+[[package]]name = "hashbrown"version = "0.15.5"@@ -1691,6 +1693,20 @@ version = "0.17.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"+[[package]]+name = "heapless"+version = "0.7.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f"+dependencies = [+ "atomic-polyfill",+ "hash32",+ "rustc_version",+ "serde",+ "spin 0.9.9",+ "stable_deref_trait",+]+[[package]]name = "heck"version = "0.5.0"@@ -1868,17 +1884,11 @@ dependencies = ["byteorder-lite","moxcms","num-traits",- "png 0.18.1",+ "png","zune-core","zune-jpeg",]-[[package]]-name = "imagesize"-version = "0.13.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "edcd27d72f2f071c64249075f42e205ff93c9a4c5f6c6da53e79ed9f9832c285"-[[package]]name = "indexmap"version = "2.14.0"@@ -1918,6 +1928,16 @@ version = "1.0.18"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"+[[package]]+name = "jobserver"+version = "0.1.35"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"+dependencies = [+ "getrandom 0.4.2",+ "libc",+]+[[package]]name = "js-sys"version = "0.3.98"@@ -1966,17 +1986,6 @@ dependencies = ["regex-syntax",]-[[package]]-name = "kurbo"-version = "0.11.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c62026ae44756f8a599ba21140f350303d4f08dcdcc71b5ad9c9bb8128c13c62"-dependencies = [- "arrayvec",- "euclid",- "smallvec",-]-[[package]]name = "lazy_static"version = "1.5.0"@@ -2011,12 +2020,6 @@ dependencies = ["windows-link 0.2.1",]-[[package]]-name = "libm"-version = "0.2.16"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"-[[package]]name = "libredox"version = "0.1.17"@@ -2576,12 +2579,6 @@ dependencies = ["siphasher",]-[[package]]-name = "pico-args"-version = "0.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"-[[package]]name = "pin-project-lite"version = "0.2.17"@@ -2675,7 +2672,7 @@ dependencies = ["serde","serde_json","thiserror 1.0.69",- "tiny-skia",+ "tiny-skia 0.11.4","tokio","tracing","tracing-subscriber",@@ -2718,7 +2715,7 @@ dependencies = ["serde","serde_json","thiserror 1.0.69",- "tiny-skia",+ "tiny-skia 0.11.4","tokio","tokio-tungstenite","tracing",@@ -2741,25 +2738,12 @@ dependencies = ["serde","serde_json","thiserror 1.0.69",- "tiny-skia",+ "tiny-skia 0.11.4","tokio","tracing","windows 0.58.0",]-[[package]]-name = "png"-version = "0.17.16"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"-dependencies = [- "bitflags 1.3.2",- "crc32fast",- "fdeflate",- "flate2",- "miniz_oxide",-]-[[package]]name = "png"version = "0.18.1"@@ -2796,6 +2780,7 @@ dependencies = ["cobs","embedded-io 0.4.0","embedded-io 0.6.1",+ "heapless","serde",]@@ -2941,6 +2926,20 @@ version = "0.10.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"+[[package]]+name = "rasterlottie"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "384686130a2b365f82258f5e444c512e57989addcf2b45e9913c4ef6f0e95a24"+dependencies = [+ "rustc-hash 2.1.3",+ "serde",+ "serde_json",+ "thiserror 2.0.18",+ "tiny-skia 0.12.0",+ "zip",+]+[[package]]name = "redox_syscall"version = "0.5.18"@@ -3054,7 +3053,7 @@ dependencies = ["serde","serde_json","serde_yaml",- "spin",+ "spin 0.10.1","thiserror 2.0.18","url","uuid",@@ -3073,29 +3072,6 @@ dependencies = ["tokio",]-[[package]]-name = "resvg"-version = "0.44.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4a325d5e8d1cebddd070b13f44cec8071594ab67d1012797c121f27a669b7958"-dependencies = [- "log",- "pico-args",- "rgb",- "svgtypes",- "tiny-skia",- "usvg",-]--[[package]]-name = "rgb"-version = "0.8.53"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4"-dependencies = [- "bytemuck",-]-[[package]]name = "ring"version = "0.17.14"@@ -3110,12 +3086,6 @@ dependencies = ["windows-sys 0.52.0",]-[[package]]-name = "roxmltree"-version = "0.20.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"-[[package]]name = "rustc-hash"version = "1.1.0"@@ -3191,24 +3161,6 @@ version = "1.0.22"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"-[[package]]-name = "rustybuzz"-version = "0.18.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c85d1ccd519e61834798eb52c4e886e8c2d7d698dd3d6ce0b1b47eb8557f1181"-dependencies = [- "bitflags 2.11.1",- "bytemuck",- "core_maths",- "log",- "smallvec",- "ttf-parser",- "unicode-bidi-mirroring",- "unicode-ccc",- "unicode-properties",- "unicode-script",-]-[[package]]name = "ryu"version = "1.0.23"@@ -3480,15 +3432,6 @@ version = "0.3.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"-[[package]]-name = "simplecss"-version = "0.2.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c"-dependencies = [- "log",-]-[[package]]name = "siphasher"version = "1.0.2"@@ -3501,15 +3444,6 @@ version = "0.4.12"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"-[[package]]-name = "slotmap"-version = "1.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038"-dependencies = [- "version_check",-]-[[package]]name = "smallvec"version = "1.15.1"@@ -3532,6 +3466,15 @@ dependencies = ["windows-sys 0.61.2",]+[[package]]+name = "spin"+version = "0.9.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e"+dependencies = [+ "lock_api",+]+[[package]]name = "spin"version = "0.10.1"@@ -3555,9 +3498,6 @@ name = "strict-num"version = "0.1.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"-dependencies = [- "float-cmp",-][[package]]name = "strsim"@@ -3571,16 +3511,6 @@ version = "2.6.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"-[[package]]-name = "svgtypes"-version = "0.15.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "68c7541fff44b35860c1a7a47a7cadf3e4a304c457b58f9870d9706ece028afc"-dependencies = [- "kurbo",- "siphasher",-]-[[package]]name = "syn"version = "2.0.117"@@ -3751,8 +3681,22 @@ dependencies = ["bytemuck","cfg-if","log",- "png 0.17.16",- "tiny-skia-path",+ "tiny-skia-path 0.11.4",+]++[[package]]+name = "tiny-skia"+version = "0.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47ffee5eaaf5527f630fb0e356b90ebdec84d5d18d937c5e440350f88c5a91ea"+dependencies = [+ "arrayref",+ "arrayvec",+ "bytemuck",+ "cfg-if",+ "log",+ "png",+ "tiny-skia-path 0.12.0",][[package]]@@ -3767,30 +3711,26 @@ dependencies = [][[package]]-name = "tinystr"-version = "0.8.3"+name = "tiny-skia-path"+version = "0.12.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"+checksum = "edca365c3faccca67d06593c5980fa6c57687de727a03131735bb85f01fdeeb9"dependencies = [- "displaydoc",- "zerovec",+ "arrayref",+ "bytemuck",+ "strict-num",][[package]]-name = "tinyvec"-version = "1.11.0"+name = "tinystr"+version = "0.8.3"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3"+checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"dependencies = [- "tinyvec_macros",+ "displaydoc",+ "zerovec",]-[[package]]-name = "tinyvec_macros"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"-[[package]]name = "tokio"version = "1.52.1"@@ -4007,15 +3947,6 @@ dependencies = ["tracing-log",]-[[package]]-name = "ttf-parser"-version = "0.24.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a"-dependencies = [- "core_maths",-]-[[package]]name = "tungstenite"version = "0.24.0"@@ -4035,6 +3966,12 @@ dependencies = ["utf-8",]+[[package]]+name = "typed-path"+version = "0.12.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e"+[[package]]name = "typenum"version = "1.20.0"@@ -4052,24 +3989,6 @@ dependencies = ["windows-sys 0.61.2",]-[[package]]-name = "unicode-bidi"-version = "0.3.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"--[[package]]-name = "unicode-bidi-mirroring"-version = "0.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "64af057ad7466495ca113126be61838d8af947f41d93a949980b2389a118082f"--[[package]]-name = "unicode-ccc"-version = "0.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "260bc6647b3893a9a90668360803a15f96b85a5257b1c3a0c3daf6ae2496de42"-[[package]]name = "unicode-general-category"version = "1.1.0"@@ -4082,30 +4001,12 @@ version = "1.0.24"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"-[[package]]-name = "unicode-properties"-version = "0.1.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d"--[[package]]-name = "unicode-script"-version = "0.5.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee"-[[package]]name = "unicode-segmentation"version = "1.13.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"-[[package]]-name = "unicode-vo"-version = "0.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94"-[[package]]name = "unicode-width"version = "0.1.14"@@ -4153,7 +4054,7 @@ dependencies = ["serde","tempfile","textwrap",- "toml 0.8.23",+ "toml 0.9.12+spec-1.1.0","uniffi_internal_macros","uniffi_meta","uniffi_pipeline",@@ -4199,7 +4100,7 @@ dependencies = ["quote","serde","syn",- "toml 0.8.23",+ "toml 0.9.12+spec-1.1.0","uniffi_meta",]@@ -4296,33 +4197,6 @@ dependencies = ["serde",]-[[package]]-name = "usvg"-version = "0.44.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7447e703d7223b067607655e625e0dbca80822880248937da65966194c4864e6"-dependencies = [- "base64",- "data-url",- "flate2",- "fontdb",- "imagesize",- "kurbo",- "log",- "pico-args",- "roxmltree",- "rustybuzz",- "simplecss",- "siphasher",- "strict-num",- "svgtypes",- "tiny-skia-path",- "unicode-bidi",- "unicode-script",- "unicode-vo",- "xmlwriter",-]-[[package]]name = "utf-8"version = "0.7.6"@@ -5143,12 +5017,6 @@ version = "0.2.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56"-[[package]]-name = "xmlwriter"-version = "0.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"-[[package]]name = "yansi-term"version = "0.1.2"@@ -5359,12 +5227,72 @@ dependencies = ["syn",]+[[package]]+name = "zip"+version = "8.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b"+dependencies = [+ "crc32fast",+ "flate2",+ "indexmap",+ "memchr",+ "typed-path",+ "zopfli",+]++[[package]]+name = "zlib-rs"+version = "0.6.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b142a20ec14a91d5bc708c1dc21b080c550113d8aa77afa29635673a65dd02c5"+[[package]]name = "zmij"version = "1.0.21"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"+[[package]]+name = "zopfli"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249"+dependencies = [+ "bumpalo",+ "crc32fast",+ "log",+ "simd-adler32",+]++[[package]]+name = "zstd"+version = "0.13.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a"+dependencies = [+ "zstd-safe",+]++[[package]]+name = "zstd-safe"+version = "7.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d"+dependencies = [+ "zstd-sys",+]++[[package]]+name = "zstd-sys"+version = "2.0.16+zstd.1.5.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748"+dependencies = [+ "cc",+ "pkg-config",+]+[[package]]name = "zune-core"version = "0.5.1"diff --git a/libs/cua-driver/rust/Cargo.toml b/libs/cua-driver/rust/Cargo.tomlindex 7daee6c6e3..6cdd7deb9c 100644--- a/libs/cua-driver/rust/Cargo.toml+++ b/libs/cua-driver/rust/Cargo.toml@@ -12,6 +12,7 @@ members = ["crates/platform-windows","crates/platform-linux","crates/cursor-overlay",+ "crates/cursor-theme-cli","crates/pip-preview",]@@ -34,3 +35,6 @@ base64 = "0.22"uuid = { version = "1", features = ["v4"] }image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }uniffi = "=0.31.0"+postcard = { version = "1", features = ["alloc"] }+sha2 = "0.10"+zstd = "0.13"diff --git a/libs/cua-driver/rust/README.md b/libs/cua-driver/rust/README.mdindex fe0d7cc703..47070041b5 100644--- a/libs/cua-driver/rust/README.md+++ b/libs/cua-driver/rust/README.md@@ -14,7 +14,8 @@ implementations, testkit, and helper crates.| `platform-linux` | Linux AT-SPI, X11/Wayland, capture, and input support || `cua-driver-testkit` | Test-only helpers for spawning the daemon and parsing responses || `cua-driver-uia` | Windows UIAccess worker |-| `cursor-overlay` | Cursor overlay support |+| `cursor-overlay` | Cross-platform semantic cursor renderer and bounded compiled-theme loader |+| `cursor-theme-cli` | Short-lived dotLottie validation, compilation, preview, and installation sidecar || `pip-preview` | Packaging preview helper |Platform crates are selected with `cfg(target_os)` from the main driver crate.diff --git a/libs/cua-driver/rust/Skills/cua-driver/SKILL.md b/libs/cua-driver/rust/Skills/cua-driver/SKILL.mdindex b848bbe9b2..69302b8740 100644--- a/libs/cua-driver/rust/Skills/cua-driver/SKILL.md+++ b/libs/cua-driver/rust/Skills/cua-driver/SKILL.md@@ -165,9 +165,10 @@ must be replaced by a fresh snapshot.Visual cursor overlay for demos and screen recordings. It is enabled bydefault for declared sessions; anonymous actions remain cursor-less. Toggle with-`cua-driver set_agent_cursor_enabled '{"enabled":true|false}'` only to-hide or re-show it. A triangle pointer Bezier-glides to each click-target, ring-ripples on landing, idle-hides after ~1.5s. Motion knobs:+`set_agent_cursor_enabled` to hide or re-show it. The embedded+`cua.default` theme uses an off-white/navy pointer and semantic animations for+idle, observe, click, drag, scroll, text, key, navigation, app, transfer,+recording, and system activity. Motion knobs:`set_agent_cursor_motion` takes any subset of `start_handle`,`end_handle`, `arc_size`, `arc_flow`, `spring` — tuneable at runtime,persisted to config.@@ -175,10 +176,14 @@ persisted to config.**Per-session cursors.** Each MCP session automatically owns its owncursor, keyed by the session's id (the proxy mints one session id perMCP connection and the daemon scopes the cursor, config overrides, and-recording to it). You normally pass nothing — the session key is wired-through for you. Pass an explicit `cursor_id` only to _deliberately-share_ one cursor across sessions. When a session ends (the MCP client-disconnects) its cursor is removed automatically.+recording to it). The CLI and SDK contracts take the declared `session`+explicitly. Cursor-theme controls no longer accept `cursor_id` or the legacy+shape/color/image fields. Input-delivery tools may still use `cursor_id` to+name a virtual pointer; it never selects artwork. Select only preinstalled+themes with `set_agent_cursor_theme`; theme source paths and inline animation+data are never accepted through an agent tool. Use the trusted local+`cua-driver cursor-theme` workflow to validate, compile, preview, install,+list, or remove custom themes.**Visibility caveat (AX runs).** On a pure accessibility-action run(clicking by `element_index`), the first action **seeds the cursordiff --git a/libs/cua-driver/rust/crates/cua-driver-contract/src/cursor.rs b/libs/cua-driver/rust/crates/cua-driver-contract/src/cursor.rsnew file mode 100644index 0000000000..872524823b--- /dev/null+++ b/libs/cua-driver/rust/crates/cua-driver-contract/src/cursor.rs@@ -0,0 +1,343 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 Cua AI, Inc.++//! Transport-neutral semantic contract for the agent cursor.+//!+//! Tool implementations emit these semantics as best-effort visual telemetry.+//! They never affect authorization, dispatch, input delivery, or tool results.++use serde::{Deserialize, Serialize};+use serde_json::Value;++#[derive(+ Debug,+ Clone,+ Copy,+ Default,+ Serialize,+ Deserialize,+ schemars::JsonSchema,+ PartialEq,+ Eq,+ Hash,+ PartialOrd,+ Ord,+ uniffi::Enum,+)]+#[serde(rename_all = "snake_case")]+pub enum CursorAction {+ #[default]+ Idle,+ Observe,+ Click,+ Drag,+ Scroll,+ Text,+ Key,+ Navigate,+ App,+ Transfer,+ Record,+ System,+}++impl CursorAction {+ pub const ALL: [Self; 12] = [+ Self::Idle,+ Self::Observe,+ Self::Click,+ Self::Drag,+ Self::Scroll,+ Self::Text,+ Self::Key,+ Self::Navigate,+ Self::App,+ Self::Transfer,+ Self::Record,+ Self::System,+ ];++ pub const fn as_str(self) -> &'static str {+ match self {+ Self::Idle => "idle",+ Self::Observe => "observe",+ Self::Click => "click",+ Self::Drag => "drag",+ Self::Scroll => "scroll",+ Self::Text => "text",+ Self::Key => "key",+ Self::Navigate => "navigate",+ Self::App => "app",+ Self::Transfer => "transfer",+ Self::Record => "record",+ Self::System => "system",+ }+ }++ pub const fn playback(self) -> CursorPlayback {+ match self {+ Self::Idle => CursorPlayback::Resting,+ Self::Observe | Self::Scroll | Self::Transfer | Self::Record => CursorPlayback::Loop,+ Self::Drag | Self::Text => CursorPlayback::Held,+ Self::Click | Self::Key | Self::Navigate | Self::App | Self::System => {+ CursorPlayback::OneShot+ }+ }+ }++ pub const fn duration_secs(self) -> f64 {+ match self {+ Self::Idle => 4.0,+ Self::Click => 0.67,+ Self::Observe+ | Self::Drag+ | Self::Scroll+ | Self::Text+ | Self::Key+ | Self::Navigate+ | Self::App+ | Self::Transfer+ | Self::Record+ | Self::System => 1.6,+ }+ }+}++#[derive(Debug, Clone, Copy, Serialize, Deserialize, schemars::JsonSchema, PartialEq, Eq, Hash)]+#[serde(rename_all = "snake_case")]+pub enum CursorPlayback {+ Resting,+ OneShot,+ Held,+ Loop,+}++#[derive(Debug, Clone, Copy, Serialize, Deserialize, schemars::JsonSchema, PartialEq, Eq, Hash)]+#[serde(rename_all = "snake_case")]+pub enum CursorDelivery {+ Background,+ Foreground,+}++impl CursorDelivery {+ pub const fn as_str(self) -> &'static str {+ match self {+ Self::Background => "background",+ Self::Foreground => "foreground",+ }+ }+}++#[derive(Debug, Clone, Copy, Serialize, Deserialize, schemars::JsonSchema, PartialEq, Eq, Hash)]+#[serde(rename_all = "snake_case")]+pub enum CursorTarget {+ Ax,+ Pixel,+ Browser,+ Desktop,+}++#[derive(+ Debug,+ Clone,+ Copy,+ Default,+ Serialize,+ Deserialize,+ schemars::JsonSchema,+ PartialEq,+ Eq,+ uniffi::Enum,+)]+#[serde(rename_all = "snake_case")]+pub enum CursorReducedMotion {+ #[default]+ Auto,+ On,+ Off,+}++#[derive(+ Debug, Clone, Serialize, Deserialize, schemars::JsonSchema, PartialEq, Eq, uniffi::Record,+)]+pub struct CursorThemeSelection {+ pub theme_id: String,+ #[serde(default)]+ pub reduced_motion: CursorReducedMotion,+}++impl CursorTarget {+ pub const fn as_str(self) -> &'static str {+ match self {+ Self::Ax => "ax",+ Self::Pixel => "pixel",+ Self::Browser => "browser",+ Self::Desktop => "desktop",+ }+ }+}++#[derive(Debug, Clone, Copy, Serialize, Deserialize, schemars::JsonSchema, PartialEq, Eq, Hash)]+pub struct CursorSemantics {+ pub action: CursorAction,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub delivery: Option<CursorDelivery>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub target: Option<CursorTarget>,+}++impl CursorSemantics {+ pub const fn new(action: CursorAction) -> Self {+ Self {+ action,+ delivery: None,+ target: None,+ }+ }+}++/// Resolve a public tool call into the small visual vocabulary.+///+/// The mapping deliberately uses the resolved route in `args` where the+/// runtime exposes it. Unknown and cursor-management tools return `None`+/// rather than inventing a misleading cue.+pub fn classify_cursor_semantics(name: &str, args: &Value) -> Option<CursorSemantics> {+ let action = match name {+ "get_desktop_state"+ | "get_window_state"+ | "get_accessibility_tree"+ | "get_ax_tree"+ | "get_screen_size"+ | "get_cursor_position"+ | "screenshot"+ | "zoom"+ | "browser_get_state"+ | "browser_snapshot"+ | "browser_screenshot"+ | "browser_tabs"+ | "browser_get_tabs" => CursorAction::Observe,++ "click"+ | "double_click"+ | "right_click"+ | "browser_click"+ | "browser_double_click"+ | "browser_right_click" => CursorAction::Click,++ "drag" | "browser_drag" => CursorAction::Drag,+ "scroll" | "browser_scroll" => CursorAction::Scroll,+ "type_text" | "set_value" | "browser_type" | "browser_fill" => CursorAction::Text,+ "press_key" | "hotkey" | "browser_press_key" | "browser_hotkey" => CursorAction::Key,++ "move_cursor" | "browser_navigate" | "browser_go_back" | "browser_go_forward"+ | "browser_reload" | "browser_new_tab" | "browser_close_tab" | "browser_select_tab" => {+ CursorAction::Navigate+ }++ "launch_app" | "activate_app" | "bring_to_front" | "list_apps" | "list_windows"+ | "kill_app" => CursorAction::App,++ "upload_file" | "download_file" | "copy_file" | "move_file" => CursorAction::Transfer,++ "start_recording" | "stop_recording" | "get_recording_state" | "replay_trajectory" => {+ CursorAction::Record+ }++ "start_session" | "escalate_session" | "get_session_state" | "end_session"+ | "check_permissions" | "get_config" | "set_config" | "health_report"+ | "browser_prepare" | "browser_close" | "browser_release" | "browser_activate"+ | "install_ffmpeg" | "check_update" | "update" => CursorAction::System,++ "set_agent_cursor_enabled"+ | "set_agent_cursor_motion"+ | "set_agent_cursor_theme"+ | "get_agent_cursor_state" => return None,+ _ => return None,+ };++ let target = if name.starts_with("browser_") {+ Some(CursorTarget::Browser)+ } else if args+ .get("element_index")+ .is_some_and(|value| !value.is_null())+ {+ Some(CursorTarget::Ax)+ } else if args.get("x").is_some() || args.get("y").is_some() {+ Some(CursorTarget::Pixel)+ } else {+ Some(CursorTarget::Desktop)+ };++ let delivery = args+ .get("delivery_mode")+ .or_else(|| args.get("delivery"))+ .and_then(Value::as_str)+ .and_then(|value| match value {+ "background" | "background_ax" | "background_pixel" => Some(CursorDelivery::Background),+ "foreground" => Some(CursorDelivery::Foreground),+ _ => None,+ })+ .or_else(|| {+ args.get("background")+ .and_then(Value::as_bool)+ .map(|background| {+ if background {+ CursorDelivery::Background+ } else {+ CursorDelivery::Foreground+ }+ })+ });++ Some(CursorSemantics {+ action,+ delivery,+ target,+ })+}++#[cfg(test)]+mod tests {+ use super::*;+ use serde_json::json;++ #[test]+ fn canonical_vocabulary_is_complete_and_unique() {+ let mut names = std::collections::BTreeSet::new();+ for action in CursorAction::ALL {+ assert!(names.insert(action.as_str()));+ }+ assert_eq!(names.len(), 12);+ }++ #[test]+ fn classifier_uses_resolved_target_and_delivery() {+ assert_eq!(+ classify_cursor_semantics(+ "click",+ &json!({"element_index":"ax:1","delivery_mode":"background"})+ ),+ Some(CursorSemantics {+ action: CursorAction::Click,+ delivery: Some(CursorDelivery::Background),+ target: Some(CursorTarget::Ax),+ })+ );+ assert_eq!(+ classify_cursor_semantics("browser_click", &json!({"x":12,"y":14})),+ Some(CursorSemantics {+ action: CursorAction::Click,+ delivery: None,+ target: Some(CursorTarget::Browser),+ })+ );+ }++ #[test]+ fn cursor_configuration_does_not_animate_itself() {+ assert_eq!(+ classify_cursor_semantics("set_agent_cursor_theme", &json!({})),+ None+ );+ }+}diff --git a/libs/cua-driver/rust/crates/cua-driver-contract/src/cursor_tools.rs b/libs/cua-driver/rust/crates/cua-driver-contract/src/cursor_tools.rsnew file mode 100644index 0000000000..89ae2e1a95--- /dev/null+++ b/libs/cua-driver/rust/crates/cua-driver-contract/src/cursor_tools.rs@@ -0,0 +1,67 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 Cua AI, Inc.++use crate::{+ GetAgentCursorStateInput, GetAgentCursorStateOutput, Platform, SchemaMode,+ SetAgentCursorEnabledInput, SetAgentCursorEnabledOutput, SetAgentCursorMotionInput,+ SetAgentCursorMotionOutput, SetAgentCursorThemeInput, SetAgentCursorThemeOutput,+ ToolAnnotations, ToolContract, ToolInput, ToolOutput,+};++const ALL_PLATFORMS: [Platform; 3] = [Platform::Macos, Platform::Windows, Platform::Linux];++pub fn contracts() -> Vec<ToolContract> {+ vec![+ contract::<SetAgentCursorEnabledInput, SetAgentCursorEnabledOutput>(+ "set_agent_cursor_enabled",+ "Show or hide the agent cursor owned by a session.",+ &["agent_cursor.set_enabled"],+ false,+ ),+ contract::<SetAgentCursorMotionInput, SetAgentCursorMotionOutput>(+ "set_agent_cursor_motion",+ "Configure only movement physics and visibility timing for a session cursor.",+ &["agent_cursor.set_motion"],+ false,+ ),+ contract::<SetAgentCursorThemeInput, SetAgentCursorThemeOutput>(+ "set_agent_cursor_theme",+ "Select an already-installed cursor theme for a session.",+ &["agent_cursor.set_theme"],+ false,+ ),+ contract::<GetAgentCursorStateInput, GetAgentCursorStateOutput>(+ "get_agent_cursor_state",+ "Return the session cursor's theme, semantic playback, position, visibility, and motion.",+ &["agent_cursor.state"],+ true,+ ),+ ]+}++fn contract<I: ToolInput, O: ToolOutput>(+ name: &str,+ description: &str,+ capabilities: &[&str],+ read_only: bool,+) -> ToolContract {+ assert_eq!(name, I::TOOL_NAME, "typed input is bound to the wrong tool");+ ToolContract {+ name: name.into(),+ description: description.into(),+ platforms: ALL_PLATFORMS.to_vec(),+ aliases: Vec::new(),+ capabilities: capabilities.iter().map(|value| (*value).into()).collect(),+ annotations: ToolAnnotations {+ read_only,+ destructive: false,+ idempotent: true,+ open_world: false,+ },+ schema_mode: SchemaMode::CanonicalRuntime,+ cursor_semantics: None,+ input_schema: I::input_schema(),+ success_output_schema: Some(O::output_schema()),+ output_validator: crate::validate_typed_output::<O>,+ }+}diff --git a/libs/cua-driver/rust/crates/cua-driver-contract/src/desktop.rs b/libs/cua-driver/rust/crates/cua-driver-contract/src/desktop.rsindex 6c281decfb..03c7c8a2ed 100644--- a/libs/cua-driver/rust/crates/cua-driver-contract/src/desktop.rs+++ b/libs/cua-driver/rust/crates/cua-driver-contract/src/desktop.rs@@ -8,10 +8,11 @@//! do not replace the richer platform-owned runtime schemas.use crate::{- ClickInput, ClickOutput, CursorPositionOutput, DesktopActionOutput, DesktopStateOutput,- DragInput, GetCursorPositionInput, GetDesktopStateInput, GetScreenSizeInput, HotkeyInput,- MoveCursorInput, MoveCursorOutput, Platform, PressKeyInput, SchemaMode, ScreenSizeOutput,- ScrollInput, ToolAnnotations, ToolContract, ToolInput, ToolOutput, TypeTextInput,+ ClickInput, ClickOutput, CursorAction, CursorPositionOutput, CursorSemantics,+ DesktopActionOutput, DesktopStateOutput, DragInput, GetCursorPositionInput,+ GetDesktopStateInput, GetScreenSizeInput, HotkeyInput, MoveCursorInput, MoveCursorOutput,+ Platform, PressKeyInput, SchemaMode, ScreenSizeOutput, ScrollInput, ToolAnnotations,+ ToolContract, ToolInput, ToolOutput, TypeTextInput,};const ALL_PLATFORMS: [Platform; 3] = [Platform::Macos, Platform::Windows, Platform::Linux];@@ -36,6 +37,7 @@ fn contract<I: ToolInput, O: ToolOutput>(description: &str,capabilities: &[&str],annotations: ToolAnnotations,+ cursor_action: CursorAction,) -> ToolContract {assert_eq!(name, I::TOOL_NAME, "typed input is bound to the wrong tool");ToolContract {@@ -46,6 +48,7 @@ fn contract<I: ToolInput, O: ToolOutput>(capabilities: capabilities.iter().map(|value| (*value).into()).collect(),annotations,schema_mode: SchemaMode::PortableSubset,+ cursor_semantics: Some(CursorSemantics::new(cursor_action)),input_schema: I::input_schema(),success_output_schema: Some(O::output_schema()),output_validator: crate::validate_typed_output::<O>,@@ -63,6 +66,7 @@ fn get_desktop_state() -> ToolContract {idempotent: false,open_world: false,},+ CursorAction::Observe,)}@@ -77,6 +81,7 @@ fn get_screen_size() -> ToolContract {idempotent: true,open_world: false,},+ CursorAction::Observe,)}@@ -91,6 +96,7 @@ fn get_cursor_position() -> ToolContract {idempotent: true,open_world: false,},+ CursorAction::Observe,)}@@ -105,6 +111,7 @@ fn move_cursor() -> ToolContract {idempotent: true,open_world: false,},+ CursorAction::Navigate,)}@@ -123,6 +130,7 @@ fn click() -> ToolContract {idempotent: false,open_world: true,},+ CursorAction::Click,)}@@ -137,6 +145,7 @@ fn drag() -> ToolContract {idempotent: false,open_world: true,},+ CursorAction::Drag,)}@@ -151,6 +160,7 @@ fn scroll() -> ToolContract {idempotent: false,open_world: true,},+ CursorAction::Scroll,)}@@ -169,6 +179,7 @@ fn type_text() -> ToolContract {idempotent: false,open_world: true,},+ CursorAction::Text,)}@@ -183,6 +194,7 @@ fn press_key() -> ToolContract {idempotent: false,open_world: true,},+ CursorAction::Key,)}@@ -197,5 +209,6 @@ fn hotkey() -> ToolContract {idempotent: false,open_world: true,},+ CursorAction::Key,)}diff --git a/libs/cua-driver/rust/crates/cua-driver-contract/src/inputs.rs b/libs/cua-driver/rust/crates/cua-driver-contract/src/inputs.rsindex 8bd5c2bca6..49986da6c9 100644--- a/libs/cua-driver/rust/crates/cua-driver-contract/src/inputs.rs+++ b/libs/cua-driver/rust/crates/cua-driver-contract/src/inputs.rs@@ -6,6 +6,7 @@//! These types are transport-free. The contract generator derives JSON Schema//! from them, and live Rust handlers deserialize the same types before acting.+use crate::CursorThemeSelection;use schemars::{json_schema, JsonSchema, Schema, SchemaGenerator};use serde::{de::DeserializeOwned, Deserialize, Serialize};use serde_json::Value;@@ -89,6 +90,10 @@ fn scroll_amount_schema(_: &mut SchemaGenerator) -> Schema {json_schema!({ "type": "integer", "minimum": 1, "maximum": 50 })}+fn cursor_theme_id_schema(_: &mut SchemaGenerator) -> Schema {+ json_schema!({ "type": "string", "minLength": 1, "maxLength": 200 })+}+fn escalation_detail_schema(_: &mut SchemaGenerator) -> Schema {json_schema!({ "type": "string", "maxLength": 200 })}@@ -248,6 +253,10 @@ pub struct StartSessionInput {#[serde(default, skip_serializing_if = "Option::is_none")]#[schemars(schema_with = "capture_scope_schema")]pub capture_scope: Option<CaptureScope>,+ /// Optional initial cursor theme. The host applies it before the cursor is+ /// first made visible, avoiding a flash of the default theme.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub cursor_theme: Option<CursorThemeSelection>,}impl ToolInput for StartSessionInput {@@ -283,6 +292,60 @@ pub struct EndSessionInput {pub session: String,}+#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, uniffi::Record)]+#[serde(deny_unknown_fields)]+pub struct SetAgentCursorEnabledInput {+ pub session: String,+ pub enabled: bool,+}++impl ToolInput for SetAgentCursorEnabledInput {+ const TOOL_NAME: &'static str = "set_agent_cursor_enabled";+}++#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, uniffi::Record)]+#[serde(deny_unknown_fields)]+pub struct SetAgentCursorMotionInput {+ pub session: String,+ pub start_handle: Option<f64>,+ pub end_handle: Option<f64>,+ pub arc_size: Option<f64>,+ pub arc_flow: Option<f64>,+ pub spring: Option<f64>,+ pub glide_duration_ms: Option<f64>,+ pub dwell_after_click_ms: Option<f64>,+ pub idle_hide_ms: Option<f64>,+ pub turn_radius: Option<f64>,+}++impl ToolInput for SetAgentCursorMotionInput {+ const TOOL_NAME: &'static str = "set_agent_cursor_motion";+}++#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, uniffi::Record)]+#[serde(deny_unknown_fields)]+pub struct SetAgentCursorThemeInput {+ pub session: String,+ #[schemars(schema_with = "cursor_theme_id_schema")]+ pub theme_id: String,+ #[serde(default)]+ pub reduced_motion: crate::CursorReducedMotion,+}++impl ToolInput for SetAgentCursorThemeInput {+ const TOOL_NAME: &'static str = "set_agent_cursor_theme";+}++#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, uniffi::Record)]+#[serde(deny_unknown_fields)]+pub struct GetAgentCursorStateInput {+ pub session: String,+}++impl ToolInput for GetAgentCursorStateInput {+ const TOOL_NAME: &'static str = "get_agent_cursor_state";+}+impl ToolInput for EndSessionInput {const TOOL_NAME: &'static str = "end_session";}diff --git a/libs/cua-driver/rust/crates/cua-driver-contract/src/lib.rs b/libs/cua-driver/rust/crates/cua-driver-contract/src/lib.rsindex 7ca8b5e221..1e0d41ad37 100644--- a/libs/cua-driver/rust/crates/cua-driver-contract/src/lib.rs+++ b/libs/cua-driver/rust/crates/cua-driver-contract/src/lib.rs@@ -14,21 +14,31 @@ use std::collections::{BTreeMap, BTreeSet};use std::sync::OnceLock;pub mod compatibility;+pub mod cursor;+mod cursor_tools;mod desktop;mod inputs;mod outputs;mod session;+pub use cursor::{+ classify_cursor_semantics, CursorAction, CursorDelivery, CursorPlayback, CursorReducedMotion,+ CursorSemantics, CursorTarget, CursorThemeSelection,+};pub use inputs::{CaptureScope, ClickButton, ClickInput, DesktopScope, DragInput, EndSessionInput,- EscalateSessionInput, EscalationReason, GetCursorPositionInput, GetDesktopStateInput,- GetScreenSizeInput, GetSessionStateInput, HotkeyInput, MoveCursorInput, PressKeyInput,- ScrollBy, ScrollDirection, ScrollInput, StartSessionInput, ToolInput, TypeTextInput,+ EscalateSessionInput, EscalationReason, GetAgentCursorStateInput, GetCursorPositionInput,+ GetDesktopStateInput, GetScreenSizeInput, GetSessionStateInput, HotkeyInput, MoveCursorInput,+ PressKeyInput, ScrollBy, ScrollDirection, ScrollInput, SetAgentCursorEnabledInput,+ SetAgentCursorMotionInput, SetAgentCursorThemeInput, StartSessionInput, ToolInput,+ TypeTextInput,};pub use outputs::{- ClickOutput, CursorPositionOutput, DesktopActionOutput, DesktopStateOutput, EffectiveScope,- EndSessionOutput, MoveCursorOutput, ScreenSizeOutput, SessionStateOutput, StartSessionOutput,- ToolOutput,+ ClickOutput, CursorMotionOutput, CursorPointOutput, CursorPositionOutput, CursorThemeOutput,+ CursorVisualOutput, DesktopActionOutput, DesktopStateOutput, EffectiveScope, EndSessionOutput,+ GetAgentCursorStateOutput, MoveCursorOutput, ScreenSizeOutput, SessionStateOutput,+ SetAgentCursorEnabledOutput, SetAgentCursorMotionOutput, SetAgentCursorThemeOutput,+ StartSessionOutput, ToolOutput,};/// Shape version for the MCP `tools/list` result emitted by cua-driver.@@ -103,6 +113,10 @@ pub struct ToolContract {pub capabilities: Vec<String>,pub annotations: ToolAnnotations,pub schema_mode: SchemaMode,+ /// Best-effort agent-cursor cue. The live classifier may refine target+ /// and delivery from resolved invocation arguments.+ #[serde(skip_serializing_if = "Option::is_none")]+ pub cursor_semantics: Option<CursorSemantics>,pub input_schema: Value,/// Schema for successful `structuredContent` only. It is experimental and/// is not advertised as MCP `outputSchema` until transport parity is proven.@@ -129,6 +143,7 @@ pub struct ContractManifest {pub fn manifest() -> ContractManifest {let mut tools = session::contracts();tools.extend(desktop::contracts());+ tools.extend(cursor_tools::contracts());tools.sort_by(|left, right| left.name.cmp(&right.name));ContractManifest {generated_notice: "Generated by cua-contract-gen; do not edit by hand.".into(),diff --git a/libs/cua-driver/rust/crates/cua-driver-contract/src/outputs.rs b/libs/cua-driver/rust/crates/cua-driver-contract/src/outputs.rsindex ab50f173bc..2cfba1bdb9 100644--- a/libs/cua-driver/rust/crates/cua-driver-contract/src/outputs.rs+++ b/libs/cua-driver/rust/crates/cua-driver-contract/src/outputs.rs@@ -105,6 +105,82 @@ impl ToolOutput for EndSessionOutput {}}+#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, uniffi::Record)]+pub struct CursorMotionOutput {+ pub start_handle: f64,+ pub end_handle: f64,+ pub arc_size: f64,+ pub arc_flow: f64,+ pub spring: f64,+ pub glide_duration_ms: f64,+ pub dwell_after_click_ms: f64,+ pub idle_hide_ms: f64,+ pub turn_radius: f64,+}++#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, uniffi::Record)]+pub struct CursorThemeOutput {+ pub id: String,+ pub version: String,+ pub profile: String,+ pub reduced_motion: crate::CursorReducedMotion,+ #[schemars(required, schema_with = "nullable_string_schema")]+ pub fallback: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, uniffi::Record)]+pub struct CursorVisualOutput {+ pub requested_action: crate::CursorAction,+ pub resolved_action: crate::CursorAction,+ pub modifiers: Vec<String>,+ pub phase: String,+ pub frame: u64,+ pub preempted_count: u64,+}++#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, uniffi::Record)]+pub struct CursorPointOutput {+ pub x: f64,+ pub y: f64,+}++#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, uniffi::Record)]+pub struct SetAgentCursorEnabledOutput {+ pub session: String,+ pub enabled: bool,+}++impl ToolOutput for SetAgentCursorEnabledOutput {}++#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, uniffi::Record)]+pub struct SetAgentCursorMotionOutput {+ pub session: String,+ pub motion: CursorMotionOutput,+}++impl ToolOutput for SetAgentCursorMotionOutput {}++#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, uniffi::Record)]+pub struct SetAgentCursorThemeOutput {+ pub session: String,+ pub theme: CursorThemeOutput,+}++impl ToolOutput for SetAgentCursorThemeOutput {}++#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, uniffi::Record)]+pub struct GetAgentCursorStateOutput {+ pub session: String,+ pub enabled: bool,+ #[schemars(required)]+ pub position: Option<CursorPointOutput>,+ pub theme: CursorThemeOutput,+ pub visual_state: CursorVisualOutput,+ pub motion: CursorMotionOutput,+}++impl ToolOutput for GetAgentCursorStateOutput {}+fn inactive_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema {schemars::json_schema!({ "const": false })}diff --git a/libs/cua-driver/rust/crates/cua-driver-contract/src/session.rs b/libs/cua-driver/rust/crates/cua-driver-contract/src/session.rsindex 3e6fef5d65..74a9ae3210 100644--- a/libs/cua-driver/rust/crates/cua-driver-contract/src/session.rs+++ b/libs/cua-driver/rust/crates/cua-driver-contract/src/session.rs@@ -2,9 +2,9 @@// Copyright (c) 2026 Cua AI, Inc.use crate::{- EndSessionInput, EndSessionOutput, EscalateSessionInput, GetSessionStateInput, Platform,- SchemaMode, SessionStateOutput, StartSessionInput, StartSessionOutput, ToolAnnotations,- ToolContract, ToolInput, ToolOutput,+ CursorAction, CursorSemantics, EndSessionInput, EndSessionOutput, EscalateSessionInput,+ GetSessionStateInput, Platform, SchemaMode, SessionStateOutput, StartSessionInput,+ StartSessionOutput, ToolAnnotations, ToolContract, ToolInput, ToolOutput,};const ALL_PLATFORMS: [Platform; 3] = [Platform::Macos, Platform::Windows, Platform::Linux];@@ -28,6 +28,7 @@ fn contract<I: ToolInput, O: ToolOutput>(capabilities: capabilities.iter().map(|value| (*value).into()).collect(),annotations,schema_mode: SchemaMode::CanonicalRuntime,+ cursor_semantics: Some(CursorSemantics::new(CursorAction::System)),input_schema: I::input_schema(),success_output_schema: Some(O::output_schema()),output_validator: crate::validate_typed_output::<O>,diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/authorization.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/authorization.rsindex 8fbdbce142..d78fb3d31b 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/authorization.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/authorization.rs@@ -691,7 +691,7 @@ pub fn advertised_risk_for(tool: &str) -> RiskAssessment {| "end_session"| "set_agent_cursor_enabled"| "set_agent_cursor_motion"- | "set_agent_cursor_style" => RiskClass::R1,+ | "set_agent_cursor_theme" => RiskClass::R1,// Surfaces that can reveal or control sensitive local/authenticated// state. Active adapters still decide their exact resource scope atdiff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/cursor_events.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/cursor_events.rsnew file mode 100644index 0000000000..70e419b0ea--- /dev/null+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/cursor_events.rs@@ -0,0 +1,160 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 Cua AI, Inc.++//! Best-effort semantic cursor-event fanout.+//!+//! The dispatch boundary emits these events after authorization and scope+//! validation. Platform overlays may subscribe, but failures and missing+//! subscribers are intentionally invisible to the tool result.++use cua_driver_contract::{+ classify_cursor_semantics, CursorAction, CursorSemantics, CursorThemeSelection,+};+use serde_json::Value;+use std::sync::{Arc, OnceLock, RwLock};++#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub enum CursorEventPhase {+ Begin,+ End,+}++#[derive(Debug, Clone, PartialEq, Eq)]+pub enum CursorEvent {+ Action {+ session: String,+ phase: CursorEventPhase,+ semantics: CursorSemantics,+ },+ SelectTheme {+ session: String,+ selection: CursorThemeSelection,+ },+}++pub trait CursorEventSink: Send + Sync + 'static {+ fn emit(&self, event: CursorEvent);+}++impl<F> CursorEventSink for F+where+ F: Fn(CursorEvent) + Send + Sync + 'static,+{+ fn emit(&self, event: CursorEvent) {+ self(event);+ }+}++fn sink_slot() -> &'static RwLock<Option<Arc<dyn CursorEventSink>>> {+ static SLOT: OnceLock<RwLock<Option<Arc<dyn CursorEventSink>>>> = OnceLock::new();+ SLOT.get_or_init(|| RwLock::new(None))+}++/// Install the process-owned overlay sink. Reinstalling replaces a stale sink+/// from an embedded runtime that has already shut down.+pub fn install_cursor_event_sink(sink: Arc<dyn CursorEventSink>) {+ *sink_slot()+ .write()+ .unwrap_or_else(|poisoned| poisoned.into_inner()) = Some(sink);+}++pub fn clear_cursor_event_sink() {+ *sink_slot()+ .write()+ .unwrap_or_else(|poisoned| poisoned.into_inner()) = None;+}++fn explicit_session(args: &Value) -> Option<String> {+ args.get("session")+ .or_else(|| args.get("_session_id"))+ .and_then(Value::as_str)+ .map(str::trim)+ .filter(|session| !session.is_empty())+ .map(ToOwned::to_owned)+}++pub fn begin_tool(name: &str, args: &Value) -> Option<(String, CursorAction)> {+ let session = explicit_session(args)?;+ if name == "start_session" {+ if let Some(selection) = args+ .get("cursor_theme")+ .cloned()+ .and_then(|value| serde_json::from_value::<CursorThemeSelection>(value).ok())+ {+ emit(CursorEvent::SelectTheme {+ session: session.clone(),+ selection,+ });+ }+ }+ let semantics = classify_cursor_semantics(name, args)?;+ emit(CursorEvent::Action {+ session: session.clone(),+ phase: CursorEventPhase::Begin,+ semantics,+ });+ Some((session, semantics.action))+}++pub fn end_tool(active: Option<(String, CursorAction)>) {+ let Some((session, action)) = active else {+ return;+ };+ emit(CursorEvent::Action {+ session,+ phase: CursorEventPhase::End,+ semantics: CursorSemantics::new(action),+ });+}++fn emit(event: CursorEvent) {+ let sink = sink_slot()+ .read()+ .unwrap_or_else(|poisoned| poisoned.into_inner())+ .clone();+ if let Some(sink) = sink {+ sink.emit(event);+ }+}++#[cfg(test)]+mod tests {+ use super::*;+ use serde_json::json;+ use std::sync::Mutex;++ #[test]+ fn emits_only_for_explicit_session_and_known_tool() {+ let events = Arc::new(Mutex::new(Vec::new()));+ let captured = Arc::clone(&events);+ install_cursor_event_sink(Arc::new(move |event| {+ captured.lock().unwrap().push(event);+ }));++ assert!(begin_tool("click", &json!({"x":1,"y":2})).is_none());+ assert!(begin_tool("unknown", &json!({"session":"run"})).is_none());+ let active = begin_tool(+ "click",+ &json!({"session":"run","x":1,"y":2,"delivery_mode":"background"}),+ );+ end_tool(active);++ let events = events.lock().unwrap();+ assert_eq!(events.len(), 2);+ assert!(matches!(+ events[0],+ CursorEvent::Action {+ phase: CursorEventPhase::Begin,+ ..+ }+ ));+ assert!(matches!(+ events[1],+ CursorEvent::Action {+ phase: CursorEventPhase::End,+ ..+ }+ ));+ clear_cursor_event_sink();+ }+}diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/lib.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/lib.rsindex 0a8d4cea56..62e517a4be 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/lib.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/lib.rs@@ -51,6 +51,7 @@ pub mod capture_mode;pub mod capture_scope;pub mod cdp;pub mod consent;+pub mod cursor_events;pub mod cursor_sampler;pub mod daemon;pub mod element_cache;diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/session.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/session.rsindex 35aa4443f0..0cc079f0f5 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/session.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/session.rs@@ -79,17 +79,8 @@ pub struct SessionObservationState {}#[derive(Debug, Clone, Copy, PartialEq, Eq)]-pub enum CursorStyleCategory {+pub enum CursorThemeCategory {Default,- BuiltinArrow,- BuiltinTeardrop,- CustomIcon,- Unknown,-}--#[derive(Debug, Clone, Copy, PartialEq, Eq)]-pub enum CursorColorSource {- AutomaticPalette,Custom,Unknown,}@@ -100,50 +91,32 @@ pub enum CursorColorSource {pub struct CursorOutcomeObservation {pub observed: bool,pub enabled: bool,- pub style: CursorStyleCategory,- pub color_source: CursorColorSource,- pub label_set: bool,+ pub theme: CursorThemeCategory,pub motion_customized: bool,pub active_cursor_count: usize,}/// Convert platform cursor fields to fixed categories without retaining any-/// raw icon, color, label, identifier, or motion value.+/// raw theme identifier or motion value.pub fn bounded_cursor_outcome(observed: bool,enabled: bool,- icon: Option<&str>,- color: Option<&str>,- label: Option<&str>,+ theme_id: Option<&str>,motion_customized: bool,active_cursor_count: usize,) -> CursorOutcomeObservation {- let style = if !observed {- CursorStyleCategory::Unknown- } else {- match icon.map(str::trim).filter(|value| !value.is_empty()) {- None => CursorStyleCategory::Default,- Some(value) if value.eq_ignore_ascii_case("arrow") => CursorStyleCategory::BuiltinArrow,- Some(value) if value.eq_ignore_ascii_case("teardrop") => {- CursorStyleCategory::BuiltinTeardrop- }- Some(_) => CursorStyleCategory::CustomIcon,- }- };- let color_source = if !observed {- CursorColorSource::Unknown+ let theme = if !observed {+ CursorThemeCategory::Unknown} else {- match color.map(str::trim).filter(|value| !value.is_empty()) {- None | Some("#00FFFF") | Some("#00ffff") => CursorColorSource::AutomaticPalette,- Some(_) => CursorColorSource::Custom,+ match theme_id.map(str::trim).filter(|value| !value.is_empty()) {+ None | Some("cua.default") => CursorThemeCategory::Default,+ Some(_) => CursorThemeCategory::Custom,}};CursorOutcomeObservation {observed,enabled: observed && enabled,- style,- color_source,- label_set: observed && label.is_some_and(|value| !value.trim().is_empty()),+ theme,motion_customized: observed && motion_customized,active_cursor_count,}@@ -775,41 +748,21 @@ mod tests {#[test]fn cursor_outcomes_are_fixed_categories_without_raw_values() {- let custom = bounded_cursor_outcome(- true,- true,- Some("/private/customer/cursor.svg"),- Some("private-brand-color"),- Some("private agent label"),- true,- 7,- );- assert_eq!(custom.style, CursorStyleCategory::CustomIcon);- assert_eq!(custom.color_source, CursorColorSource::Custom);- assert!(custom.label_set);+ let custom = bounded_cursor_outcome(true, true, Some("private.customer.theme"), true, 7);+ assert_eq!(custom.theme, CursorThemeCategory::Custom);assert!(custom.motion_customized);assert_eq!(custom.active_cursor_count, 7);let debug = format!("{custom:?}");- for forbidden in ["/private/customer", "private-brand", "private agent"] {+ for forbidden in ["private.customer.theme"] {assert!(!debug.contains(forbidden),"cursor outcome leaked {forbidden}: {debug}");}- let unknown = bounded_cursor_outcome(- false,- true,- Some("arrow"),- Some("#00FFFF"),- Some("label"),- true,- 0,- );- assert_eq!(unknown.style, CursorStyleCategory::Unknown);- assert_eq!(unknown.color_source, CursorColorSource::Unknown);+ let unknown = bounded_cursor_outcome(false, true, Some("cua.default"), true, 0);+ assert_eq!(unknown.theme, CursorThemeCategory::Unknown);assert!(!unknown.enabled);- assert!(!unknown.label_set);assert!(!unknown.motion_customized);}@@ -959,7 +912,7 @@ mod tests {fn observer_distinguishes_explicit_idle_revival_and_control_cleanup() {let probe = probe_observer();let _ = set_cursor_outcome_reader(Arc::new(|_| {- bounded_cursor_outcome(true, true, Some("arrow"), None, None, false, 2)+ bounded_cursor_outcome(true, true, Some("cua.default"), false, 2)}));let explicit = "test-observer-explicit-IJ90";begin_tool_call(@@ -1048,8 +1001,7 @@ mod tests {id == explicit&& *reason == SessionEndReason::Explicit&& cursor.is_some_and(|value| {- value.style == CursorStyleCategory::BuiltinArrow- && value.active_cursor_count == 2+ value.theme == CursorThemeCategory::Default && value.active_cursor_count == 2})}));assert!(endsdiff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rsindex efd7e9781c..d397282368 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs@@ -171,7 +171,7 @@ impl ToolDef {/// `session.capture_scope`, `session.capture_scope.read`,/// `session.capture_scope.escalate`/// - `agent_cursor.move`, `agent_cursor.set_enabled`,-/// `agent_cursor.set_motion`, `agent_cursor.set_style`,+/// `agent_cursor.set_motion`, `agent_cursor.set_theme`,/// `agent_cursor.state`/// - `recording.start`, `recording.stop`, `recording.state`,/// `recording.replay`, `recording.install_dependency`@@ -288,7 +288,7 @@ pub fn default_capabilities_for(tool_name: &str) -> Vec<String> {// ── agent cursor ─────────────────────────────────────────────"set_agent_cursor_enabled" => &["agent_cursor.set_enabled"],"set_agent_cursor_motion" => &["agent_cursor.set_motion"],- "set_agent_cursor_style" => &["agent_cursor.set_style"],+ "set_agent_cursor_theme" => &["agent_cursor.set_theme"],"get_agent_cursor_state" => &["agent_cursor.state"],// ── recording / replay ───────────────────────────────────────@@ -1094,6 +1094,7 @@ impl ToolRegistry {// Capture start time for recording timestamps only after validation.let start_ms = now_ms();+ let cursor_event = crate::cursor_events::begin_tool(resolved_name, &args);// Reserve and capture the turn before dispatch so recorded evidence// shows the application immediately before the action changed it.@@ -1130,6 +1131,7 @@ impl ToolRegistry {.flatten();let mut result = tool.invoke(args.clone()).await;+ crate::cursor_events::end_tool(cursor_event);// Coordinate the physical action itself, not post-action evidence// capture or result shaping. Keeping the global desktop lock through// recording/PiP screenshots would unnecessarily block an unrelated@@ -3415,7 +3417,7 @@ mod capability_tests {// agent cursor"set_agent_cursor_enabled","set_agent_cursor_motion",- "set_agent_cursor_style",+ "set_agent_cursor_theme","get_agent_cursor_state",// recording / replay"start_recording",@@ -3497,7 +3499,7 @@ mod capability_tests {"agent_cursor.move","agent_cursor.set_enabled","agent_cursor.set_motion",- "agent_cursor.set_style",+ "agent_cursor.set_theme","agent_cursor.state",// recording"recording.start",diff --git a/libs/cua-driver/rust/crates/cua-driver-core/tests/contract_parity.rs b/libs/cua-driver/rust/crates/cua-driver-core/tests/contract_parity.rsindex ac8c9f9b3c..3d5c38ace5 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/tests/contract_parity.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/tests/contract_parity.rs@@ -17,6 +17,12 @@ fn canonical_session_contract_matches_live_registry() {.tools.into_iter().filter(|contract| contract.schema_mode == SchemaMode::CanonicalRuntime)+ .filter(|contract| {+ contract+ .capabilities+ .iter()+ .any(|capability| capability.starts_with("session."))+ }){let entry = live["tools"].as_array()diff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/src/lib.rs b/libs/cua-driver/rust/crates/cua-driver-sdk/src/lib.rsindex ae03212a2b..e3607f8a72 100644--- a/libs/cua-driver/rust/crates/cua-driver-sdk/src/lib.rs+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/src/lib.rs@@ -7,9 +7,10 @@use cua_driver_contract::{ClickInput, DragInput, EndSessionInput, EndSessionOutput, EscalateSessionInput,- GetCursorPositionInput, GetDesktopStateInput, GetScreenSizeInput, GetSessionStateInput,- HotkeyInput, MoveCursorInput, PressKeyInput, ScrollInput, SessionStateOutput,- StartSessionInput, StartSessionOutput, ToolInput, TypeTextInput,+ GetAgentCursorStateInput, GetCursorPositionInput, GetDesktopStateInput, GetScreenSizeInput,+ GetSessionStateInput, HotkeyInput, MoveCursorInput, PressKeyInput, ScrollInput,+ SessionStateOutput, SetAgentCursorEnabledInput, SetAgentCursorMotionInput,+ SetAgentCursorThemeInput, StartSessionInput, StartSessionOutput, ToolInput, TypeTextInput,};use cua_driver_core::daemon::{is_daemon_listening, request_daemon_metadata, send_request, socket_path_for_namespace,@@ -550,6 +551,10 @@ macro_rules! desktop_tool_methods {type_text: TypeTextInput,press_key: PressKeyInput,hotkey: HotkeyInput,+ set_agent_cursor_enabled: SetAgentCursorEnabledInput,+ set_agent_cursor_motion: SetAgentCursorMotionInput,+ set_agent_cursor_theme: SetAgentCursorThemeInput,+ get_agent_cursor_state: GetAgentCursorStateInput,}};}@@ -2254,6 +2259,7 @@ mod tests {.start_session(StartSessionInput {session: "run-2".into(),capture_scope: Some(cua_driver_contract::CaptureScope::Auto),+ cursor_theme: None,}).await.unwrap();diff --git a/libs/cua-driver/rust/crates/cua-driver/src/cli.rs b/libs/cua-driver/rust/crates/cua-driver/src/cli.rsindex bd78411f72..1bcfe2404b 100644--- a/libs/cua-driver/rust/crates/cua-driver/src/cli.rs+++ b/libs/cua-driver/rust/crates/cua-driver/src/cli.rs@@ -9,7 +9,7 @@//! cua-driver call <tool> [json-args] → invoke tool, print result//! cua-driver <tool> [json-args] → shorthand for call (snake_case names)//!-//! Cursor-overlay flags (--cursor-id, --no-overlay, etc.) are consumed by+//! Cursor-overlay flags (--cursor-theme, --no-overlay, etc.) are consumed by//! `CursorConfig::from_args()` and are ignored here.use std::process;@@ -165,6 +165,12 @@ pub enum Command {subcommand: String,flags: Vec<String>,},+ /// Trusted local cursor-theme authoring and installation workflow. The+ /// actual parser/compiler is a separate short-lived executable so Lottie,+ /// ZIP, and JSON are not linked into the privileged daemon.+ CursorTheme {+ args: Vec<String>,+ },/// Mint a short-lived, single-use approval token for a direct/raw/// `browser_prepare` call. This command requires an interactive terminal.BrowserApprove {@@ -189,10 +195,8 @@ pub enum TelemetryCommand {/// Flags whose next token is a value (not a subcommand)./// We skip both the flag and its value when scanning for the subcommand.const VALUE_FLAGS: &[&str] = &[- "--cursor-icon",- "--cursor-id",- "--cursor-palette",- "--cursor-shape",+ "--cursor-theme",+ "--cursor-reduced-motion","--glide-ms","--dwell-ms","--idle-hide-ms",@@ -268,6 +272,7 @@ fn finite_command_name_from_args(args: &[String]) -> Option<&'static str> {Some("permissions") => Some("permissions"),Some("autostart") => Some("autostart"),Some("skills") => Some("skills"),+ Some("cursor-theme") => Some("cursor_theme"),Some("browser-approve") => Some("browser_approve"),Some("config") => Some("config"),Some(_) => Some("call"),@@ -420,7 +425,7 @@ pub fn parse_command() -> Command {env!("CARGO_PKG_VERSION"));println!("Usage: cua-driver [SUBCOMMAND] [OPTIONS]");- println!("Subcommands: mcp, list-tools, describe, call, serve, stop, revoke, status, config, telemetry, recording, update, check-update, doctor, diagnose, permissions, autostart, skills, browser-approve, manifest");+ println!("Subcommands: mcp, list-tools, describe, call, serve, stop, revoke, status, config, telemetry, recording, update, check-update, doctor, diagnose, permissions, autostart, skills, browser-approve, manifest, cursor-theme");println!();println!("permissions options (macOS):");println!(" cua-driver permissions status Report Accessibility + Screen Recording status. Read-only (no prompt).");@@ -535,22 +540,22 @@ pub fn parse_command() -> Command {println!(" glide, so it can be easy to miss — do a pixel click or move_cursor first");println!(" for a visibly gliding demo. These flags tune the overlay on `serve`/`mcp`:");println!(" --no-overlay Disable the cursor overlay entirely for this daemon.");- println!(- " --cursor-id <id> Name the default cursor instance (default: 'default')."- );- println!(" --cursor-icon <path> Use a custom PNG / JPEG / SVG / ICO cursor asset.");- println!(- " --cursor-shape <name> Built-in silhouette: {} ('teardrop' is the default —",- cursor_overlay::BuiltinShape::names_help()- );- println!(- " embedded cursor-up SVG; 'arrow' is the procedural gradient"- );- println!(" diamond). Same vocabulary as MCP `cursor_icon`.");- println!(" --cursor-palette <name> Pick a built-in colour palette for the cursor.");+ println!(" --cursor-theme <id> Select an installed theme (default: cua.default).");+ println!(" --cursor-reduced-motion <auto|on|off>");+ println!(" Follow the OS setting, force stills, or allow motion.");println!(" Set these on `cua-driver serve`; MCP and one-shot CLI processes are clients");println!(" and do not own the daemon's overlay configuration or UI runloop.");println!();+ println!("cursor-theme options (trusted local workflow):");+ println!(" cua-driver cursor-theme validate <source.lottie>");+ println!(" cua-driver cursor-theme build <source.lottie> --output <theme.cua-theme>");+ println!(" cua-driver cursor-theme inspect <theme.cua-theme> [--json]");+ println!(" cua-driver cursor-theme preview <theme.cua-theme> --output <directory>");+ println!(" cua-driver cursor-theme install <theme.cua-theme>");+ println!(" cua-driver cursor-theme list [--json]");+ println!(" cua-driver cursor-theme uninstall <theme-id>");+ println!(" Theme installation is local-only and is never an agent tool.");+ println!();println!("manifest options:");println!(" cua-driver manifest Emit a stable JSON description of this CLI's surface");println!(" (subcommands, args, MCP invocation, version). Read-only.");@@ -840,6 +845,15 @@ pub fn parse_command() -> Command {}Command::Skills { subcommand, flags }}+ Some("cursor-theme") => {+ let index = args+ .iter()+ .position(|value| value == "cursor-theme")+ .expect("cursor-theme positional is present");+ Command::CursorTheme {+ args: args[index + 1..].to_vec(),+ }+ }Some("browser-approve") => {let pid = approval_pid.as_deref()@@ -2920,7 +2934,9 @@ fn cli_docs_json() -> serde_json::Value {"arguments": no_args,"options": [{"name":"socket","short_name":null,"help":"Select an explicit daemon socket or named-pipe endpoint.","type":"String","default_value":null,"is_optional":true},- {"name":"host-bundle-id","short_name":null,"help":"Advisory host bundle id label echoed in check_permissions output (embedded mode).","type":"String","default_value":null,"is_optional":true}+ {"name":"host-bundle-id","short_name":null,"help":"Advisory host bundle id label echoed in check_permissions output (embedded mode).","type":"String","default_value":null,"is_optional":true},+ {"name":"cursor-theme","short_name":null,"help":"Select an installed cursor theme id.","type":"String","default_value":"cua.default","is_optional":true},+ {"name":"cursor-reduced-motion","short_name":null,"help":"Follow the OS setting, force still frames, or allow animation: auto, on, or off.","type":"String","default_value":"auto","is_optional":true}],"flags": [{"name":"direct","short_name":null,"help":"Own the runtime in this MCP process; mutually exclusive with --socket.","default_value":false},@@ -2979,7 +2995,8 @@ fn cli_docs_json() -> serde_json::Value {{"name":"allow-legacy-existing-profile-approval","short_name":null,"help":"Temporary migration flag for the unprotected file-backed existing-profile artifact.","default_value":false},{"name":"approve-session-policy","short_name":null,"help":"Trusted-launcher confirmation that the exact bounded manifest was reviewed.","default_value":false},{"name":"no-permissions-gate","short_name":null,"help":"Skip the macOS first-launch permissions gate.","default_value":false},- {"name":"embedded","short_name":null,"help":"Run embedded inside a host app: inherit the host's TCC grants, never prompt or relaunch. Also CUA_DRIVER_EMBEDDED=1.","default_value":false}+ {"name":"embedded","short_name":null,"help":"Run embedded inside a host app: inherit the host's TCC grants, never prompt or relaunch. Also CUA_DRIVER_EMBEDDED=1.","default_value":false},+ {"name":"no-overlay","short_name":null,"help":"Disable the agent cursor overlay for this daemon.","default_value":false}],"subcommands": no_subcommands},@@ -3185,6 +3202,23 @@ fn cli_docs_json() -> serde_json::Value {"flags": [{"name":"pretty","short_name":"p","help":"Pretty-print JSON.","default_value":false}],"subcommands": no_subcommands},+ {+ "name": "cursor-theme",+ "abstract": "Validate, compile, inspect, preview, install, or remove a local cursor theme.",+ "discussion": "This is a trusted local authoring workflow. Agent-facing tools may select an installed theme id, but cannot install source or compiled theme data.",+ "arguments": no_args,+ "options": no_options,+ "flags": no_flags,+ "subcommands": [+ {"name":"validate","abstract":"Validate a bounded dotLottie source archive.","discussion":"","arguments":[{"name":"source","help":"Path to the source .lottie archive.","type":"String","is_optional":false}],"options":[],"flags":[{"name":"development","short_name":null,"help":"Allow the reserved com.example development namespace.","default_value":false}],"subcommands":[]},+ {"name":"build","abstract":"Compile a validated dotLottie archive into a bounded .cua-theme artifact.","discussion":"","arguments":[{"name":"source","help":"Path to the source .lottie archive.","type":"String","is_optional":false}],"options":[{"name":"output","short_name":null,"help":"Output .cua-theme path.","type":"String","default_value":null,"is_optional":false}],"flags":[{"name":"development","short_name":null,"help":"Allow the reserved com.example development namespace.","default_value":false}],"subcommands":[]},+ {"name":"inspect","abstract":"Inspect metadata in a compiled .cua-theme artifact.","discussion":"","arguments":[{"name":"theme","help":"Path to the compiled .cua-theme artifact.","type":"String","is_optional":false}],"options":[],"flags":[{"name":"json","short_name":null,"help":"Emit machine-readable JSON.","default_value":false}],"subcommands":[]},+ {"name":"preview","abstract":"Render a compiled theme's representative still frames to a directory.","discussion":"","arguments":[{"name":"theme","help":"Path to the compiled .cua-theme artifact.","type":"String","is_optional":false}],"options":[{"name":"output","short_name":null,"help":"Preview output directory.","type":"String","default_value":null,"is_optional":false}],"flags":[],"subcommands":[]},+ {"name":"install","abstract":"Install a compiled theme into the current user's theme store.","discussion":"","arguments":[{"name":"theme","help":"Path to the compiled .cua-theme artifact.","type":"String","is_optional":false}],"options":[],"flags":[],"subcommands":[]},+ {"name":"list","abstract":"List the built-in and installed cursor themes.","discussion":"","arguments":[],"options":[],"flags":[{"name":"json","short_name":null,"help":"Emit machine-readable JSON.","default_value":false}],"subcommands":[]},+ {"name":"uninstall","abstract":"Remove a custom theme from the current user's theme store.","discussion":"The built-in cua.default theme cannot be removed.","arguments":[{"name":"theme-id","help":"Installed custom theme id.","type":"String","is_optional":false}],"options":[],"flags":[],"subcommands":[]}+ ]+ },{"name": "dump-docs","abstract": "Output machine-readable CLI and MCP documentation JSON.",diff --git a/libs/cua-driver/rust/crates/cua-driver/src/main.rs b/libs/cua-driver/rust/crates/cua-driver/src/main.rsindex 9dd58d2e29..bcc2045dd8 100644--- a/libs/cua-driver/rust/crates/cua-driver/src/main.rs+++ b/libs/cua-driver/rust/crates/cua-driver/src/main.rs@@ -6,9 +6,8 @@//! backend lives in the `serve` daemon selected at compile time.//!//! Extra CLI flags (consumed here, not by MCP):-//! --cursor-icon <path.svg|.ico|.png> custom cursor shape-//! --cursor-id <id> multi-cursor instance id-//! --cursor-palette <name> named colour palette+//! --cursor-theme <installed-theme-id> installed cursor theme+//! --cursor-reduced-motion <auto|on|off> accessibility motion preference//! --no-overlay start with overlay disabled//! --glide-ms <f64> glide duration override//! --dwell-ms <f64> post-click dwell override@@ -183,6 +182,37 @@ fn run_telemetry_command(command: cli::TelemetryCommand) {}}+fn run_cursor_theme_command(args: &[String]) -> ! {+ let executable = match std::env::current_exe() {+ Ok(path) => path,+ Err(error) => {+ eprintln!("cua-driver: cannot locate cursor-theme compiler: {error}");+ std::process::exit(1);+ }+ };+ let binary_name = if cfg!(target_os = "windows") {+ "cua-cursor-theme.exe"+ } else {+ "cua-cursor-theme"+ };+ let sidecar = executable+ .parent()+ .unwrap_or_else(|| std::path::Path::new("."))+ .join(binary_name);+ let status = match std::process::Command::new(&sidecar).args(args).status() {+ Ok(status) => status,+ Err(error) => {+ eprintln!(+ "cua-driver: cursor-theme compiler is unavailable at {}: {error}",+ sidecar.display()+ );+ eprintln!("Reinstall Cua Driver so the matching authoring sidecar is present.");+ std::process::exit(1);+ }+ };+ std::process::exit(status.code().unwrap_or(1));+}+/// Wire up the experimental picture-in-picture preview window.////// Called from every long-running entry point (Serve and Mcp on all@@ -700,6 +730,9 @@ fn main() {cli::Command::Skills { subcommand, flags } => {skills::run(&subcommand, &flags);}+ cli::Command::CursorTheme { args } => {+ run_cursor_theme_command(&args);+ }cli::Command::BrowserApprove {pid,strategy,@@ -947,6 +980,9 @@ fn main() -> anyhow::Result<()> {skills::run(&subcommand, &flags);return Ok(());}+ cli::Command::CursorTheme { args } => {+ run_cursor_theme_command(&args);+ }cli::Command::BrowserApprove {pid,strategy,diff --git a/libs/cua-driver/rust/crates/cua-driver/src/telemetry.rs b/libs/cua-driver/rust/crates/cua-driver/src/telemetry.rsindex a8031b7462..2d63685d20 100644--- a/libs/cua-driver/rust/crates/cua-driver/src/telemetry.rs+++ b/libs/cua-driver/rust/crates/cua-driver/src/telemetry.rs@@ -386,12 +386,7 @@ pub fn inspect_event(event_name: &str) -> Result<Value, String> {("used_config_write", Value::Bool(false)),("cursor_outcome_observed", Value::Bool(true)),("cursor_overlay_enabled_at_end", Value::Bool(true)),- ("cursor_style", Value::String("default".into())),- (- "cursor_color_source",- Value::String("automatic_palette".into()),- ),- ("cursor_label_set", Value::Bool(false)),+ ("cursor_theme", Value::String("default".into())),("cursor_motion_customized", Value::Bool(false)),("multi_cursor_bucket", Value::String("1".into())),("observed_multiple_transports", Value::Bool(false)),@@ -588,7 +583,7 @@ impl AgentSessionState {tool_name,"set_agent_cursor_enabled"| "set_agent_cursor_motion"- | "set_agent_cursor_style"+ | "set_agent_cursor_theme"| "get_agent_cursor_state");self.used_recording |= matches!(@@ -603,7 +598,7 @@ impl AgentSessionState {reason: cua_driver_core::session::SessionEndReason,cursor: Option<cua_driver_core::session::CursorOutcomeObservation>,) -> Map<String, Value> {- use cua_driver_core::session::{CursorColorSource, CursorStyleCategory, SessionEndReason};+ use cua_driver_core::session::{CursorThemeCategory, SessionEndReason};let end_reason = match reason {SessionEndReason::Explicit => "explicit",SessionEndReason::IdleTimeout => "idle_timeout",@@ -613,23 +608,14 @@ impl AgentSessionState {let cursor = cursor.unwrap_or(cua_driver_core::session::CursorOutcomeObservation {observed: false,enabled: false,- style: CursorStyleCategory::Unknown,- color_source: CursorColorSource::Unknown,- label_set: false,+ theme: CursorThemeCategory::Unknown,motion_customized: false,active_cursor_count: 0,});- let cursor_style = match cursor.style {- CursorStyleCategory::Default => "default",- CursorStyleCategory::BuiltinArrow => "builtin_arrow",- CursorStyleCategory::BuiltinTeardrop => "builtin_teardrop",- CursorStyleCategory::CustomIcon => "custom_icon",- CursorStyleCategory::Unknown => "unknown",- };- let cursor_color_source = match cursor.color_source {- CursorColorSource::AutomaticPalette => "automatic_palette",- CursorColorSource::Custom => "custom",- CursorColorSource::Unknown => "unknown",+ let cursor_theme = match cursor.theme {+ CursorThemeCategory::Default => "default",+ CursorThemeCategory::Custom => "custom",+ CursorThemeCategory::Unknown => "unknown",};bounded_properties(&[("end_reason", Value::String(end_reason.into())),@@ -665,12 +651,7 @@ impl AgentSessionState {("used_config_write", Value::Bool(self.used_config_write)),("cursor_outcome_observed", Value::Bool(cursor.observed)),("cursor_overlay_enabled_at_end", Value::Bool(cursor.enabled)),- ("cursor_style", Value::String(cursor_style.into())),- (- "cursor_color_source",- Value::String(cursor_color_source.into()),- ),- ("cursor_label_set", Value::Bool(cursor.label_set)),+ ("cursor_theme", Value::String(cursor_theme.into())),("cursor_motion_customized",Value::Bool(cursor.motion_customized),@@ -3351,9 +3332,7 @@ mod tests {Some(cua_driver_core::session::CursorOutcomeObservation {observed: true,enabled: true,- style: cua_driver_core::session::CursorStyleCategory::CustomIcon,- color_source: cua_driver_core::session::CursorColorSource::Custom,- label_set: true,+ theme: cua_driver_core::session::CursorThemeCategory::Custom,motion_customized: true,active_cursor_count: 3,}),@@ -3367,9 +3346,7 @@ mod tests {assert_eq!(properties["used_page"], true);assert_eq!(properties["used_browser"], false);assert_eq!(properties["browser_refusal_count_bucket"], "0");- assert_eq!(properties["cursor_style"], "custom_icon");- assert_eq!(properties["cursor_color_source"], "custom");- assert_eq!(properties["cursor_label_set"], true);+ assert_eq!(properties["cursor_theme"], "custom");assert_eq!(properties["cursor_motion_customized"], true);assert_eq!(properties["multi_cursor_bucket"], "3_5");assert_eq!(properties["observed_multiple_transports"], true);diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/embedded_host_sdk_mcp_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/embedded_host_sdk_mcp_test.rsindex 750bf19cec..ebf6213d63 100644--- a/libs/cua-driver/rust/crates/cua-driver/tests/embedded_host_sdk_mcp_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver/tests/embedded_host_sdk_mcp_test.rs@@ -142,6 +142,7 @@ async fn embedded_host_serves_sdk_and_mcp_with_one_contract() {.start_session(StartSessionInput {session: "embedded-sdk-window".into(),capture_scope: Some(CaptureScope::Window),+ cursor_theme: None,}).await.expect("start SDK-owned session");diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/protocol_schema_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/protocol_schema_test.rsindex 297d9d6937..3d850724c6 100644--- a/libs/cua-driver/rust/crates/cua-driver/tests/protocol_schema_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver/tests/protocol_schema_test.rs@@ -331,7 +331,11 @@ fn linux_cursor_motion_knobs_are_applied() {"Linux cursor motion update failed: {response:?}");let structured = &response["result"]["structuredContent"];- assert_eq!(structured["arc_size"].as_f64(), Some(0.4));- assert_eq!(structured["glide_duration_ms"].as_f64(), Some(500.0));- assert_eq!(structured["idle_hide_ms"].as_f64(), Some(5000.0));+ assert_eq!(structured["session"].as_str(), Some("schema-linux"));+ assert_eq!(structured["motion"]["arc_size"].as_f64(), Some(0.4));+ assert_eq!(+ structured["motion"]["glide_duration_ms"].as_f64(),+ Some(500.0)+ );+ assert_eq!(structured["motion"]["idle_hide_ms"].as_f64(), Some(5000.0));}diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/protocol_session_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/protocol_session_test.rsindex ac5c06d558..57fc1d8c61 100644--- a/libs/cua-driver/rust/crates/cua-driver/tests/protocol_session_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver/tests/protocol_session_test.rs@@ -106,9 +106,8 @@ fn concurrent_clients_with_cursor_moves() {#[test]#[cfg(any(target_os = "macos", target_os = "windows"))]fn concurrent_multi_driver_isolation() {- //! Two cua-driver processes running simultaneously with different cursor IDs.- //! Verifies that concurrent sessions don't interfere — each tracks its own- //! cursor state and the overlay stays alive under concurrent load.+ //! Two cua-driver processes running simultaneously with different declared+ //! sessions. Each process must retain its own session-owned cursor state.let Some(mut child_a) = spawn_unrestricted_with_overlay() else {return;};@@ -122,14 +121,28 @@ fn concurrent_multi_driver_isolation() {child_a.recv();child_b.recv();- // Driver A: set_agent_cursor_enabled for cursor "alpha", Driver B for cursor "beta".child_a.send(&serde_json::json!({"jsonrpc":"2.0","id":2,"method":"tools/call",- "params":{"name":"set_agent_cursor_enabled","arguments":{"cursor_id":"alpha","enabled":true}}+ "params":{"name":"start_session","arguments":{"session":"alpha"}}}));child_b.send(&serde_json::json!({"jsonrpc":"2.0","id":2,"method":"tools/call",- "params":{"name":"set_agent_cursor_enabled","arguments":{"cursor_id":"beta","enabled":false}}+ "params":{"name":"start_session","arguments":{"session":"beta"}}+ }));+ assert!(!child_a.recv()["result"]["isError"]+ .as_bool()+ .unwrap_or(false));+ assert!(!child_b.recv()["result"]["isError"]+ .as_bool()+ .unwrap_or(false));++ child_a.send(&serde_json::json!({+ "jsonrpc":"2.0","id":3,"method":"tools/call",+ "params":{"name":"set_agent_cursor_enabled","arguments":{"session":"alpha","enabled":true}}+ }));+ child_b.send(&serde_json::json!({+ "jsonrpc":"2.0","id":3,"method":"tools/call",+ "params":{"name":"set_agent_cursor_enabled","arguments":{"session":"beta","enabled":false}}}));let resp_a = child_a.recv();let resp_b = child_b.recv();@@ -142,16 +155,14 @@ fn concurrent_multi_driver_isolation() {"Driver B set_agent_cursor_enabled failed: {resp_b:?}");- // Each driver queries its own cursor state — should reflect what it set.- // get_agent_cursor_state is session-scoped, so pass the cursor_id each- // driver owns; the response carries { "cursors": [<that one>], "enabled" }.+ // Each driver queries its own session-owned cursor state.child_a.send(&serde_json::json!({- "jsonrpc":"2.0","id":3,"method":"tools/call",- "params":{"name":"get_agent_cursor_state","arguments":{"cursor_id":"alpha"}}+ "jsonrpc":"2.0","id":4,"method":"tools/call",+ "params":{"name":"get_agent_cursor_state","arguments":{"session":"alpha"}}}));child_b.send(&serde_json::json!({- "jsonrpc":"2.0","id":3,"method":"tools/call",- "params":{"name":"get_agent_cursor_state","arguments":{"cursor_id":"beta"}}+ "jsonrpc":"2.0","id":4,"method":"tools/call",+ "params":{"name":"get_agent_cursor_state","arguments":{"session":"beta"}}}));let state_a = child_a.recv();let state_b = child_b.recv();@@ -164,46 +175,27 @@ fn concurrent_multi_driver_isolation() {"Driver B get_agent_cursor_state failed: {state_b:?}");- // cursors is an array of { config: { cursor_id, enabled, ... }, x, y }.- // Cursor alpha should be enabled (we set true), beta disabled (we set false).- // The state lives per process — processes don't share CursorRegistry.- let cursors_a = state_a["result"]["structuredContent"]["cursors"].as_array();- let cursors_b = state_b["result"]["structuredContent"]["cursors"].as_array();-- let alpha_enabled = cursors_a- .and_then(|arr| {- arr.iter()- .find(|c| c["config"]["cursor_id"].as_str() == Some("alpha"))- })- .and_then(|c| c["config"]["enabled"].as_bool());- let beta_enabled = cursors_b- .and_then(|arr| {- arr.iter()- .find(|c| c["config"]["cursor_id"].as_str() == Some("beta"))- })- .and_then(|c| c["config"]["enabled"].as_bool());-assert_eq!(- alpha_enabled,+ state_a["result"]["structuredContent"]["enabled"].as_bool(),Some(true),- "Cursor alpha should be enabled in driver A"+ "Session alpha should be enabled in driver A");assert_eq!(- beta_enabled,+ state_b["result"]["structuredContent"]["enabled"].as_bool(),Some(false),- "Cursor beta should be disabled in driver B"+ "Session beta should be disabled in driver B");// macOS additionally exercises move_cursor on both drivers to confirm// neither crashes the other (the Windows variant stops after the state check).if !cfg!(target_os = "windows") {child_a.send(&serde_json::json!({- "jsonrpc":"2.0","id":4,"method":"tools/call",- "params":{"name":"move_cursor","arguments":{"cursor_id":"alpha","x":100,"y":100}}+ "jsonrpc":"2.0","id":5,"method":"tools/call",+ "params":{"name":"move_cursor","arguments":{"session":"alpha","x":100,"y":100}}}));child_b.send(&serde_json::json!({- "jsonrpc":"2.0","id":4,"method":"tools/call",- "params":{"name":"move_cursor","arguments":{"cursor_id":"beta","x":200,"y":200}}+ "jsonrpc":"2.0","id":5,"method":"tools/call",+ "params":{"name":"move_cursor","arguments":{"session":"beta","x":200,"y":200}}}));let mv_a = child_a.recv();let mv_b = child_b.recv();@@ -220,135 +212,61 @@ fn concurrent_multi_driver_isolation() {#[test]#[cfg(any(target_os = "macos", target_os = "windows"))]-fn multi_cursor_instance_state() {- //! Two cursor instances can be created with different IDs; each has independent state.- let Some(mut d) = spawn_unrestricted_with_overlay() else {+fn session_owned_cursor_state_is_independent() {+ let Some(mut driver) = spawn_unrestricted_with_overlay() else {return;};- d.send(&serde_json::json!({"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}));- d.recv();-- // Move cursor "agent1" to (100, 200).- d.send(&serde_json::json!({- "jsonrpc":"2.0","id":2,"method":"tools/call",- "params":{"name":"move_cursor","arguments":{"x":100.0,"y":200.0,"cursor_id":"agent1"}}+ driver.send(&serde_json::json!({+ "jsonrpc":"2.0","id":1,"method":"initialize","params":{}}));- let r2 = d.recv();- assert!(!r2["result"]["isError"].as_bool().unwrap_or(false));+ driver.recv();- // Move cursor "agent2" to (300, 400).- d.send(&serde_json::json!({- "jsonrpc":"2.0","id":3,"method":"tools/call",- "params":{"name":"move_cursor","arguments":{"x":300.0,"y":400.0,"cursor_id":"agent2"}}- }));- let r3 = d.recv();- assert!(!r3["result"]["isError"].as_bool().unwrap_or(false));+ for (id, session) in [(2, "agent1"), (3, "agent2")] {+ driver.send(&serde_json::json!({+ "jsonrpc":"2.0","id":id,"method":"tools/call",+ "params":{"name":"start_session","arguments":{"session":session}}+ }));+ let response = driver.recv();+ assert!(+ !response["result"]["isError"].as_bool().unwrap_or(false),+ "start_session failed: {response:?}"+ );+ }- // Configure cursor "agent1" with a custom color.- d.send(&serde_json::json!({+ driver.send(&serde_json::json!({"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"set_agent_cursor_motion","arguments":{- "cursor_id":"agent1","cursor_color":"#FF0000","cursor_label":"AI-1"+ "session":"agent1","spring":0.7}}}));- let r4 = d.recv();- assert!(!r4["result"]["isError"].as_bool().unwrap_or(false));+ let motion = driver.recv();+ assert!(!motion["result"]["isError"].as_bool().unwrap_or(false));- // Hide cursor "agent2".- d.send(&serde_json::json!({+ driver.send(&serde_json::json!({"jsonrpc":"2.0","id":5,"method":"tools/call",- "params":{"name":"set_agent_cursor_enabled","arguments":{"enabled":false,"cursor_id":"agent2"}}- }));- let r5 = d.recv();- assert!(!r5["result"]["isError"].as_bool().unwrap_or(false));-- // get_agent_cursor_state reports independent per-cursor state. macOS scopes- // the response to the resolved cursor_id (returns ONLY that cursor); Windows- // returns ALL cursors in one list. Either way, agent1 must read back enabled- // and agent2 disabled.- d.send(&serde_json::json!({- "jsonrpc":"2.0","id":6,"method":"tools/call",- "params":{"name":"get_agent_cursor_state","arguments":{"cursor_id":"agent1"}}+ "params":{"name":"set_agent_cursor_enabled","arguments":{+ "session":"agent2","enabled":false+ }}}));- let resp1 = d.recv();- assert!(!resp1["result"]["isError"].as_bool().unwrap_or(false));- let cursors1 = resp1["result"]["structuredContent"]["cursors"]- .as_array()- .cloned()- .unwrap_or_default();- if cfg!(target_os = "windows") {- // Windows returns the full cursor list; find agent1 within it.- let a1 = cursors1- .iter()- .find(|c| c["config"]["cursor_id"].as_str() == Some("agent1"))- .expect("agent1 in returned cursor list");- assert_eq!(- a1["config"]["enabled"].as_bool(),- Some(true),- "agent1 was never disabled"- );- } else {- assert_eq!(- cursors1.len(),- 1,- "agent1 query must return exactly its own cursor, got: {cursors1:?}"- );- assert_eq!(cursors1[0]["config"]["cursor_id"].as_str(), Some("agent1"));- assert_eq!(- resp1["result"]["structuredContent"]["enabled"].as_bool(),- Some(true),- "agent1 was never disabled"- );- }+ let hidden = driver.recv();+ assert!(!hidden["result"]["isError"].as_bool().unwrap_or(false));- d.send(&serde_json::json!({- "jsonrpc":"2.0","id":7,"method":"tools/call",- "params":{"name":"get_agent_cursor_state","arguments":{"cursor_id":"agent2"}}- }));- let resp2 = d.recv();- assert!(!resp2["result"]["isError"].as_bool().unwrap_or(false));- let cursors2 = resp2["result"]["structuredContent"]["cursors"]- .as_array()- .cloned()- .unwrap_or_default();- if cfg!(target_os = "windows") {- // Windows returns the full cursor list; find agent2 within it.- let a2 = cursors2- .iter()- .find(|c| c["config"]["cursor_id"].as_str() == Some("agent2"))- .expect("agent2 in returned cursor list");- assert_eq!(- a2["config"]["enabled"].as_bool(),- Some(false),- "agent2 was hidden"- );- } else {- assert_eq!(- cursors2.len(),- 1,- "agent2 query must return exactly its own cursor, got: {cursors2:?}"- );- assert_eq!(cursors2[0]["config"]["cursor_id"].as_str(), Some("agent2"));- assert_eq!(- resp2["result"]["structuredContent"]["enabled"].as_bool(),- Some(false),- "agent2 was hidden"+ for (id, session, expected_enabled) in [(6, "agent1", true), (7, "agent2", false)] {+ driver.send(&serde_json::json!({+ "jsonrpc":"2.0","id":id,"method":"tools/call",+ "params":{"name":"get_agent_cursor_state","arguments":{"session":session}}+ }));+ let response = driver.recv();+ assert!(+ !response["result"]["isError"].as_bool().unwrap_or(false),+ "get_agent_cursor_state failed: {response:?}");+ let state = &response["result"]["structuredContent"];+ assert_eq!(state["session"].as_str(), Some(session));+ assert_eq!(state["enabled"].as_bool(), Some(expected_enabled));+ assert_eq!(state["theme"]["id"].as_str(), Some("cua.default"));}-- std::thread::sleep(std::time::Duration::from_millis(50));- // Process must still be alive: probe with one more request (a crashed- // process would EOF and panic in recv()).- d.send(&serde_json::json!({- "jsonrpc":"2.0","id":99,"method":"tools/call",- "params":{"name":"get_agent_cursor_state","arguments":{"cursor_id":"agent1"}}- }));- let resp = d.recv();- assert_eq!(- resp["id"], 99,- "cua-driver crashed during multi-cursor test"- );}#[test]diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/schema_consistency_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/schema_consistency_test.rsindex a7874dea40..35fc8612ff 100644--- a/libs/cua-driver/rust/crates/cua-driver/tests/schema_consistency_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver/tests/schema_consistency_test.rs@@ -199,6 +199,67 @@ fn portable_desktop_contracts_are_accepted_by_active_backend() {);}+#[test]+fn canonical_cursor_contracts_match_active_backend() {+ let Some(mut driver) = RawDriver::spawn() else {+ return;+ };++ driver.send(&json!({+ "jsonrpc": "2.0", "id": 1, "method": "initialize",+ "params": {+ "protocolVersion": "2024-11-05",+ "capabilities": {},+ "clientInfo": { "name": "cursor-contract-gate", "version": "1" }+ }+ }));+ let _ = driver.recv();+ driver.send(&json!({ "jsonrpc": "2.0", "id": 2, "method": "tools/list" }));+ let response = driver.recv();+ let live_tools = response["result"]["tools"]+ .as_array()+ .expect("tools/list must return result.tools");++ for contract in manifest().tools.into_iter().filter(|contract| {+ contract.schema_mode == SchemaMode::CanonicalRuntime+ && contract+ .capabilities+ .iter()+ .any(|capability| capability.starts_with("agent_cursor."))+ }) {+ let live = live_tools+ .iter()+ .find(|entry| entry["name"].as_str() == Some(&contract.name))+ .unwrap_or_else(|| panic!("{} missing from live registry", contract.name));+ assert_eq!(+ live["description"], contract.description,+ "{} description",+ contract.name+ );+ assert_eq!(+ live["inputSchema"], contract.input_schema,+ "{} input schema",+ contract.name+ );+ assert_eq!(+ live["capabilities"],+ json!(contract.capabilities),+ "{} capabilities",+ contract.name+ );+ assert_eq!(+ live["annotations"]["readOnlyHint"], contract.annotations.read_only,+ "{} readOnlyHint",+ contract.name+ );+ assert_eq!(+ live["annotations"]["idempotentHint"], contract.annotations.idempotent,+ "{} idempotentHint",+ contract.name+ );+ }+}+#[test]fn health_report_is_callable_through_authorized_mcp_surface() {let Some(mut driver) = RawDriver::spawn() else {diff --git a/libs/cua-driver/rust/crates/cursor-overlay/Cargo.toml b/libs/cua-driver/rust/crates/cursor-overlay/Cargo.tomlindex 4f561f4180..fcf94e7ba2 100644--- a/libs/cua-driver/rust/crates/cursor-overlay/Cargo.toml+++ b/libs/cua-driver/rust/crates/cursor-overlay/Cargo.toml@@ -3,16 +3,19 @@ name = "cursor-overlay"version.workspace = trueedition.workspace = true+[features]+default = []+theme-authoring = []+[dependencies]+cua-driver-contract = { path = "../cua-driver-contract" }serde = { workspace = true }serde_json = { workspace = true }anyhow = { workspace = true }tracing = { workspace = true }+postcard.workspace = true+sha2.workspace = true+zstd.workspace = true-# SVG rasterization for --cursor-icon <path.svg>-resvg = { version = "0.44", default-features = false }tiny-skia = { version = "0.11", default-features = false, features = ["std"] }-usvg = { version = "0.44", default-features = false, features = ["text"] }--# ICO / PNG parsing for --cursor-icon <path.ico|png>-image = { version = "0.25", default-features = false, features = ["png", "jpeg", "ico"] }+image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }diff --git a/libs/cua-driver/rust/crates/cursor-overlay/src/lib.rs b/libs/cua-driver/rust/crates/cursor-overlay/src/lib.rsindex 2997e96e26..79b276d4f9 100644--- a/libs/cua-driver/rust/crates/cursor-overlay/src/lib.rs+++ b/libs/cua-driver/rust/crates/cursor-overlay/src/lib.rs@@ -1,51 +1,50 @@//! cursor-overlay — shared types and math for the cua-driver cursor overlay.//!//! Platform renderers (macOS, Windows, Linux) depend on this crate for:-//! - `CursorConfig` — parsed from CLI args (`--cursor-icon`, `--cursor-id`, etc.)-//! - `Palette` — 9 named colour palettes matching the reference implementations+//! - `CursorConfig` — theme, accessibility, visibility, and motion settings//! - `MotionConfig` — glide duration, spring, dwell, idle-hide timings//! - `CubicBezier` + `PathPlanner` — Bezier path math (ported 1:1 from C#)-//! - `CursorShape` — loaded and rasterised custom SVG / ICO / PNG asset//! - `OverlayCommand` — messages sent from MCP tools to the overlay threadpub mod bezier;pub mod capture_utils;pub mod motion;-pub mod palette;pub mod path_planner;pub mod render_state;-pub mod shape;+pub mod theme;+pub mod theme_artifact;pub mod util;pub mod z_order;pub use bezier::CubicBezier;pub use motion::{MotionConfig, Spring};-pub use palette::Palette;pub use path_planner::{PathPlanner, PathState, PlannedPath};-pub use render_state::{- draw_default_arrow, paint_cursor, render_frame, FocusRect, RenderStateCore,+pub use render_state::{paint_cursor, render_frame, FocusRect, RenderStateCore};+pub use theme::{+ CursorAction, CursorVisualState, DeliveryModifier, PlaybackKind, ReducedMotion, TargetModifier,+ DEFAULT_THEME_ID, DEFAULT_THEME_VERSION, THEME_PROFILE,};-pub use shape::{resolve_cursor_icon, BuiltinShape, CursorIconResolution, CursorShape};+pub use theme_artifact::{+ decode_theme, inspect_artifact, list_installed_themes, load_installed_theme,+ paint_compiled_theme, resolve_theme_selection, theme_store_root, validate_compiled_theme,+ CompiledAnimation, CompiledFrame, CompiledTheme,+};+#[cfg(feature = "theme-authoring")]+pub use theme_artifact::{encode_theme, install_artifact, uninstall_theme};pub use z_order::ZOrderEnforcer;/// Configuration assembled from CLI arguments and passed to every/// platform backend when it initialises the overlay window.#[derive(Debug, Clone)]pub struct CursorConfig {- /// Multi-cursor instance identifier; affects palette selection.- /// Defaults to `"default"`.+ /// Multi-cursor instance identifier. Defaults to `"default"`.pub cursor_id: String,- /// Custom cursor shape loaded from `--cursor-icon <path>`. Takes- /// precedence over `builtin_shape` when set. `None` means use the- /// built-in selected by `builtin_shape`.- pub shape: Option<CursorShape>,+ /// Installed theme selected at launch.+ pub theme_id: String,- /// Which built-in silhouette to render when no custom `shape` is set.- /// Defaults to [`BuiltinShape::Arrow`] (the procedural gradient- /// diamond) until the embedded teardrop's retina rasterisation is- /// fully sorted; opt into the teardrop via `--cursor-shape teardrop`.- pub builtin_shape: BuiltinShape,+ /// Accessibility motion preference.+ pub reduced_motion: ReducedMotion,/// Initial motion config (can be updated at runtime via MCP tool).pub motion: MotionConfig,@@ -59,8 +58,8 @@ impl Default for CursorConfig {fn default() -> Self {Self {cursor_id: "default".into(),- shape: None,- builtin_shape: BuiltinShape::default(),+ theme_id: DEFAULT_THEME_ID.into(),+ reduced_motion: ReducedMotion::Auto,motion: MotionConfig::default(),enabled: true,}@@ -72,11 +71,8 @@ impl CursorConfig {////// Recognised flags:/// ```text- /// --cursor-icon <path.svg|path.ico|path.png>- /// --cursor-id <id>- /// --cursor-shape <arrow|teardrop> (selects a built-in silhouette;- /// default: arrow)- /// --cursor-palette <name> (selects a named Palette)+ /// --cursor-theme <installed-theme-id>+ /// --cursor-reduced-motion <auto|on|off>/// --no-overlay (start with overlay disabled)/// --glide-ms <f64> (glideDurationMs override)/// --dwell-ms <f64> (dwellAfterClickMs override)@@ -92,37 +88,25 @@ impl CursorConfig {let mut i = 0usize;while i < args.len() {match args[i].as_str() {- "--cursor-icon" => {- if let Some(path) = args.get(i + 1) {- match CursorShape::load(path) {- Ok(s) => cfg.shape = Some(s),- Err(e) => tracing::warn!("--cursor-icon {path}: {e}"),- }- i += 1;- }- }- "--cursor-id" => {- if let Some(id) = args.get(i + 1) {- cfg.cursor_id = id.clone();- i += 1;- }- }- "--cursor-palette" => {- if let Some(name) = args.get(i + 1) {- // Palette is resolved inside the platform backend using the id;- // store the name as the id so ForInstance logic picks it up.- cfg.cursor_id = name.clone();+ "--cursor-theme" => {+ if let Some(theme_id) = args.get(i + 1) {+ cfg.theme_id = theme_id.clone();i += 1;}}- "--cursor-shape" => {- if let Some(name) = args.get(i + 1) {- match BuiltinShape::parse(name) {- Some(s) => cfg.builtin_shape = s,- None => tracing::warn!(- "--cursor-shape {name}: unknown shape (expected arrow|teardrop); falling back to default"- ),- }+ "--cursor-reduced-motion" => {+ if let Some(value) = args.get(i + 1) {+ cfg.reduced_motion = match value.as_str() {+ "auto" => ReducedMotion::Auto,+ "on" => ReducedMotion::On,+ "off" => ReducedMotion::Off,+ _ => {+ tracing::warn!(+ "--cursor-reduced-motion {value}: expected auto|on|off; using auto"+ );+ ReducedMotion::Auto+ }+ };i += 1;}}@@ -151,11 +135,6 @@ impl CursorConfig {}cfg}-- /// Return the `Palette` for this config (by cursor_id).- pub fn palette(&self) -> Palette {- Palette::for_instance(&self.cursor_id)- }}// ── Shared cursor instance registry ──────────────────────────────────────────@@ -164,15 +143,12 @@ use serde::{Deserialize, Serialize};use std::collections::HashMap;use std::sync::Mutex;-/// Per-instance cursor configuration (icon, color, label, size, opacity).+/// Per-instance cursor configuration.#[derive(Debug, Clone, Serialize, Deserialize)]pub struct CursorInstanceConfig {pub cursor_id: String,- pub cursor_icon: Option<String>,- pub cursor_color: Option<String>,- pub cursor_label: Option<String>,- pub cursor_size: Option<f64>,- pub cursor_opacity: Option<f64>,+ pub theme_id: String,+ pub reduced_motion: ReducedMotion,pub enabled: bool,}@@ -180,11 +156,8 @@ impl Default for CursorInstanceConfig {fn default() -> Self {Self {cursor_id: "default".into(),- cursor_icon: None,- cursor_color: Some("#00FFFF".into()),- cursor_label: None,- cursor_size: Some(16.0),- cursor_opacity: Some(0.85),+ theme_id: DEFAULT_THEME_ID.into(),+ reduced_motion: ReducedMotion::Auto,enabled: true,}}@@ -359,40 +332,23 @@ pub enum OverlayCommand {SetEnabled(bool),/// Update the motion/timing config live.SetMotion(MotionConfig),- /// Update the palette live.- SetPalette(Palette),/// Pin the overlay above a specific window (by platform window id).PinAbove(u64),- /// Replace the cursor shape at runtime with a custom image (or clear it).- /// `None` clears the custom override so the configured `builtin_shape`- /// shows again. Built-in silhouettes go through `SetBuiltinShape` instead.- SetShape(Option<CursorShape>),- /// Select the built-in silhouette at runtime (`arrow` / `teardrop`).- /// Sets `builtin_shape` and clears any custom `SetShape` override, so- /// either built-in is reachable regardless of which one is the default.- SetBuiltinShape(BuiltinShape),- /// Update the gradient/bloom colours used by the default arrow renderer.- /// `gradient_colors`: ordered list of `#RRGGBB` hex strings.- /// `bloom_color`: `#RRGGBB` hex string for the radial halo.- SetGradient {- gradient_colors: Vec<[u8; 4]>,- bloom_color: Option<[u8; 4]>,+ /// Begin a best-effort semantic cursor cue.+ BeginAction {+ action: CursorAction,+ delivery: Option<DeliveryModifier>,+ target: Option<TargetModifier>,+ },+ /// End a held or looping cue if it still owns the visual state.+ EndAction(CursorAction),+ /// Select an already-installed cursor theme for this cursor instance.+ SetTheme {+ theme_id: String,+ reduced_motion: ReducedMotion,},/// Show a focus-highlight rectangle around an AX-targeted element./// `[x, y, width, height]` in screen coordinates (top-left origin)./// `None` clears the highlight.ShowFocusRect(Option<[f64; 4]>),}--impl OverlayCommand {- /// The overlay command that applies a resolved `cursor_icon` value: a- /// built-in name selects the silhouette (`SetBuiltinShape`), a custom image- /// becomes a one-off override (`SetShape`). Shared by every platform's MCP- /// handler so they stay in lockstep.- pub fn from_cursor_icon(resolution: CursorIconResolution) -> Self {- match resolution {- CursorIconResolution::Builtin(b) => OverlayCommand::SetBuiltinShape(b),- CursorIconResolution::Image(s) => OverlayCommand::SetShape(Some(s)),- }- }-}diff --git a/libs/cua-driver/rust/crates/cursor-overlay/src/palette.rs b/libs/cua-driver/rust/crates/cursor-overlay/src/palette.rsdeleted file mode 100644index abd239b045..0000000000--- a/libs/cua-driver/rust/crates/cursor-overlay/src/palette.rs+++ /dev/null@@ -1,187 +0,0 @@-//! Nine named colour palettes — 1:1 port of `AgentCursorPalette.cs`.-//!-//! Colours stored as `[u8; 4]` = [R, G, B, 255].--use serde::{Deserialize, Serialize};--#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]-pub struct Palette {- pub name: String,- /// Tip colour (lightest, gradient position 0.0).- pub cursor_start: [u8; 4],- /// Mid-gradient colour (position 0.53).- pub cursor_mid: [u8; 4],- /// Tail colour (position 1.0).- pub cursor_end: [u8; 4],- /// Outer bloom layer.- pub bloom_outer: [u8; 4],- /// Inner bloom layer (brighter core).- pub bloom_inner: [u8; 4],-}--// Raw palette data as (&name, start, mid, end, bloom_outer, bloom_inner).-type PaletteData = (&'static str, [u8; 4], [u8; 4], [u8; 4], [u8; 4], [u8; 4]);--const fn rgba(r: u8, g: u8, b: u8) -> [u8; 4] {- [r, g, b, 255]-}--const PALETTE_DATA: &[PaletteData] = &[- (- "default_blue",- rgba(219, 238, 255),- rgba(94, 192, 232),- rgba(84, 205, 160),- rgba(188, 232, 252),- rgba(238, 248, 255),- ),- (- "soft_purple",- rgba(238, 226, 255),- rgba(178, 132, 255),- rgba(118, 194, 255),- rgba(214, 188, 255),- rgba(246, 238, 255),- ),- (- "rose_gold",- rgba(255, 231, 238),- rgba(247, 132, 170),- rgba(255, 181, 108),- rgba(255, 190, 211),- rgba(255, 243, 232),- ),- (- "mint_lime",- rgba(226, 255, 240),- rgba(96, 218, 174),- rgba(178, 229, 72),- rgba(178, 245, 217),- rgba(241, 255, 231),- ),- (- "amber",- rgba(255, 244, 214),- rgba(244, 178, 66),- rgba(255, 126, 92),- rgba(255, 219, 140),- rgba(255, 248, 225),- ),- (- "aqua",- rgba(221, 252, 255),- rgba(76, 204, 224),- rgba(63, 222, 166),- rgba(172, 241, 249),- rgba(236, 255, 251),- ),- (- "orchid",- rgba(252, 228, 255),- rgba(221, 113, 236),- rgba(255, 139, 196),- rgba(237, 181, 246),- rgba(255, 239, 252),- ),- (- "crimson",- rgba(255, 226, 226),- rgba(232, 82, 98),- rgba(150, 94, 255),- rgba(255, 168, 178),- rgba(255, 240, 241),- ),- (- "chartreuse",- rgba(247, 255, 218),- rgba(184, 220, 54),- rgba(72, 190, 119),- rgba(224, 247, 128),- rgba(249, 255, 232),- ),- (- "cobalt",- rgba(226, 235, 255),- rgba(80, 126, 236),- rgba(91, 219, 222),- rgba(170, 195, 255),- rgba(239, 246, 255),- ),-];--fn from_data(d: &PaletteData) -> Palette {- Palette {- name: d.0.to_owned(),- cursor_start: d.1,- cursor_mid: d.2,- cursor_end: d.3,- bloom_outer: d.4,- bloom_inner: d.5,- }-}--impl Palette {- pub fn default_blue() -> Self {- from_data(&PALETTE_DATA[0])- }-- /// Select a palette for an instance id using the same stable-hash- /// logic as the C# `AgentCursorPalette.ForInstance`.- pub fn for_instance(instance_id: &str) -> Self {- if instance_id.is_empty() || instance_id == "default" {- return Self::default_blue();- }- // Exact name match.- if let Some(d) = PALETTE_DATA.iter().find(|d| d.0 == instance_id) {- return from_data(d);- }- // Stable hash into alternates (all except default_blue at index 0).- let alternates = &PALETTE_DATA[1..];- let idx = stable_index(instance_id, alternates.len());- from_data(&alternates[idx])- }-- pub fn all_names() -> Vec<&'static str> {- PALETTE_DATA.iter().map(|d| d.0).collect()- }-- /// Lerp along cursor_start → cursor_mid → cursor_end at `t ∈ [0,1]`.- pub fn gradient_at(&self, t: f64) -> [u8; 4] {- let t = t.clamp(0.0, 1.0);- if t <= 0.53 {- lerp_rgba(self.cursor_start, self.cursor_mid, t / 0.53)- } else {- lerp_rgba(self.cursor_mid, self.cursor_end, (t - 0.53) / 0.47)- }- }-}--fn lerp_rgba(a: [u8; 4], b: [u8; 4], t: f64) -> [u8; 4] {- let l = |x: u8, y: u8| (x as f64 + (y as f64 - x as f64) * t).round() as u8;- [l(a[0], b[0]), l(a[1], b[1]), l(a[2], b[2]), 255]-}--fn stable_index(id: &str, count: usize) -> usize {- let suffix = id- .rfind(['-', '_', '.'])- .map(|i| &id[i + 1..])- .unwrap_or(id);- if let Ok(n) = suffix.parse::<usize>() {- if n > 0 {- return (n - 1) % count;- }- }- if suffix.len() == 1 {- if let Some(c) = suffix.chars().next() {- if c.is_ascii_alphabetic() {- return (c.to_ascii_lowercase() as usize - b'a' as usize) % count;- }- }- }- let mut hash: u32 = 2_166_136_261;- for c in id.chars() {- hash ^= c as u32;- hash = hash.wrapping_mul(16_777_619);- }- (hash as usize) % count-}diff --git a/libs/cua-driver/rust/crates/cursor-overlay/src/render_state.rs b/libs/cua-driver/rust/crates/cursor-overlay/src/render_state.rsindex 7bf74fd16c..1a0ac8fdcf 100644--- a/libs/cua-driver/rust/crates/cursor-overlay/src/render_state.rs+++ b/libs/cua-driver/rust/crates/cursor-overlay/src/render_state.rs@@ -7,10 +7,7 @@//!//! ## What lives here//!-//! - [`RenderStateCore`] — the platform-agnostic animation fields-//! (`cfg`, `palette`, `motion`, `pos`, `heading`, `path`, `dist`, `spring`,-//! `spring_tgt`, `click_t`, `pressed`, `shape`, `visible`, `idle_secs`, `idle_alpha`,-//! `pinned_wid`, `gradient_colors`, `bloom_override`).+//! - [`RenderStateCore`] — the platform-agnostic animation and semantic state.//! - [`RenderStateCore::tick_motion`] — speed-profile + spring physics +//! click-pulse + idle-fade using runtime [`MotionConfig`] (Windows + Linux).//! - [`RenderStateCore::tick_swift_constants`] — same physics but with the@@ -18,13 +15,12 @@//! path just ended (so the caller can fire arrival signals).//! - [`RenderStateCore::apply_command_base`] — the OverlayCommand match arms//! that all three platforms implement identically (MoveTo / ClickPulse /-//! SetEnabled / SetMotion / SetPalette / PinAbove / SetShape / SetGradient).+//! SetEnabled / SetMotion / SetTheme / semantic action events / PinAbove).//! Returns `false` for variants the core doesn't handle so platforms can//! layer their own behaviour on top (e.g. macOS ShowFocusRect).-//! - [`render_frame`] — the tiny-skia paint of bloom + click-pulse + arrow.+//! - [`render_frame`] — the tiny-skia paint of the selected cursor theme.//! Parametrised by pixmap dimensions and an origin offset so Windows can//! pass `(virt_x, virt_y)` while macOS / Linux pass `(0, 0)`.-//! - [`draw_default_arrow`] — gradient-arrow rasteriser.//!//! ## What stays per-platform//!@@ -39,9 +35,10 @@//! supplies one via the optional argument).use crate::{- BuiltinShape, CursorConfig, CursorShape, MotionConfig, OverlayCommand, Palette, PathPlanner,- PathState, PlannedPath, Spring,+ CompiledTheme, CursorAction, CursorConfig, CursorVisualState, MotionConfig, OverlayCommand,+ PathPlanner, PathState, PlannedPath, Spring,};+use std::sync::Arc;/// Platform-agnostic render state shared by macOS / Windows / Linux overlays.///@@ -50,8 +47,6 @@ use crate::{pub struct RenderStateCore {/// Frozen copy of the launch-time CursorConfig.pub cfg: CursorConfig,- /// Current colour palette (mutable via [`OverlayCommand::SetPalette`]).- pub palette: Palette,/// Current motion / timing config (mutable via [`OverlayCommand::SetMotion`]).pub motion: MotionConfig,/// Current rendered position in screen / overlay-window coordinates.@@ -70,8 +65,12 @@ pub struct RenderStateCore {pub click_t: Option<f64>,/// Whether a button is currently being held for this cursor.pub pressed: bool,- /// Custom cursor shape; `None` = built-in gradient arrow.- pub shape: Option<CursorShape>,+ /// Semantic action and animation playback state.+ pub visual: CursorVisualState,+ /// Decoded installed theme. `None` selects the embedded `cua.default`.+ pub theme: Option<Arc<CompiledTheme>>,+ /// Non-fatal launch-time fallback reason, if an installed theme failed.+ pub theme_fallback: Option<String>,/// User-controlled visibility.pub visible: bool,/// Idle-hide: elapsed seconds since last activity.@@ -80,11 +79,6 @@ pub struct RenderStateCore {pub idle_alpha: f64,/// Window id the overlay should be pinned above (for z-ordering).pub pinned_wid: Option<u64>,- /// Runtime-overridden gradient colours (from `set_agent_cursor_style`).- /// Empty = use palette defaults.- pub gradient_colors: Vec<[u8; 4]>,- /// Runtime-overridden bloom colour. `None` = palette default.- pub bloom_override: Option<[u8; 4]>,}impl RenderStateCore {@@ -93,16 +87,26 @@ impl RenderStateCore {/// "never placed on screen yet" — the click path uses this to detect/// first-placement and snap rather than animate.pub fn new(cfg: CursorConfig) -> Self {- let palette = cfg.palette();let motion = cfg.motion.clone();- let shape = cfg.shape.clone();+ let mut visual = CursorVisualState::default();+ visual.reduced_motion = cfg.reduced_motion;+ let (theme, theme_fallback) = match crate::load_installed_theme(&cfg.theme_id) {+ Ok(theme) => (theme, None),+ Err(error) => (+ None,+ Some(format!(+ "theme `{}` could not be loaded; using {}: {error}",+ cfg.theme_id,+ crate::DEFAULT_THEME_ID+ )),+ ),+ };Self {cfg,- palette,motion,- shape,- gradient_colors: vec![],- bloom_override: None,+ visual,+ theme,+ theme_fallback,pos: (-200.0, -200.0),heading: std::f64::consts::FRAC_PI_4,path: None,@@ -118,6 +122,25 @@ impl RenderStateCore {}}+ /// Return the theme that is actually being painted, including any+ /// non-fatal fallback from an unavailable launch-time selection.+ pub fn active_theme_metadata(&self) -> (String, String, String, Option<String>) {+ match self.theme.as_deref() {+ Some(theme) => (+ theme.id.clone(),+ theme.version.clone(),+ theme.profile.clone(),+ self.theme_fallback.clone(),+ ),+ None => (+ crate::DEFAULT_THEME_ID.into(),+ crate::DEFAULT_THEME_VERSION.into(),+ crate::THEME_PROFILE.into(),+ self.theme_fallback.clone(),+ ),+ }+ }+/// Advance the animation by `dt` seconds using runtime [`MotionConfig`]/// for peak / floor / spring constants. Used by Windows + Linux.///@@ -338,6 +361,7 @@ impl RenderStateCore {/// moving, then fade `idle_alpha` from 1→0 over 180ms once/// `motion.idle_hide_ms` has elapsed. Identical across all platforms.fn tick_idle(&mut self, dt: f64) {+ self.visual.tick(dt);let idle_hide_ms = self.motion.idle_hide_ms;if idle_hide_ms > 0.0 {let moving = self.path.is_some() || self.spring.is_some() || self.click_t.is_some();@@ -410,6 +434,7 @@ impl RenderStateCore {self.dist = 0.0;self.spring = None;self.spring_tgt = None;+ self.visual.begin(CursorAction::Navigate, None, None);self.idle_secs = 0.0;self.idle_alpha = 1.0;true@@ -427,6 +452,7 @@ impl RenderStateCore {self.dist = 0.0;self.spring = None;self.spring_tgt = None;+ self.visual.begin(CursorAction::Navigate, None, None);self.idle_secs = 0.0;self.idle_alpha = 1.0;true@@ -448,12 +474,18 @@ impl RenderStateCore {self.pos = (x, y);}self.click_t = Some(0.0);+ self.visual.begin(CursorAction::Click, None, None);self.idle_secs = 0.0;self.idle_alpha = 1.0;true}OverlayCommand::SetPressed(v) => {self.pressed = v;+ if v {+ self.visual.begin(CursorAction::Drag, None, None);+ } else {+ self.visual.end(CursorAction::Drag);+ }self.idle_secs = 0.0;self.idle_alpha = 1.0;true@@ -466,31 +498,42 @@ impl RenderStateCore {self.motion = m;true}- OverlayCommand::SetPalette(p) => {- self.palette = p;- true- }OverlayCommand::PinAbove(wid) => {self.pinned_wid = Some(wid);true}- OverlayCommand::SetShape(shape) => {- self.shape = shape;+ OverlayCommand::BeginAction {+ action,+ delivery,+ target,+ } => {+ self.visual.begin(action, delivery, target);true}- OverlayCommand::SetBuiltinShape(builtin) => {- // Built-in selection drives the default silhouette and clears- // any custom image override so the built-in actually shows.- self.cfg.builtin_shape = builtin;- self.shape = None;+ OverlayCommand::EndAction(action) => {+ self.visual.end(action);true}- OverlayCommand::SetGradient {- gradient_colors,- bloom_color,+ OverlayCommand::SetTheme {+ theme_id,+ reduced_motion,} => {- self.gradient_colors = gradient_colors;- self.bloom_override = bloom_color;+ match crate::resolve_theme_selection(&theme_id) {+ Ok(theme) => {+ self.theme = theme;+ self.theme_fallback = None;+ self.cfg.theme_id = theme_id;+ self.cfg.reduced_motion = reduced_motion;+ self.visual.reduced_motion = reduced_motion;+ }+ Err(error) => {+ tracing::warn!(+ theme_id,+ error = %error,+ "keeping the active cursor theme after selection failed"+ );+ }+ }true}OverlayCommand::ShowFocusRect(_) => false, // caller-specific@@ -583,94 +626,6 @@ pub fn paint_cursor(let heading = core.heading;let alpha_scale = core.idle_alpha as f32;- // --- Bloom (radial gradient behind the arrow) ---- let bloom_r: f32 = if core.pressed { 34.0 * sf } else { 22.0 * sf };- // Use runtime bloom_override if set, otherwise fall back to palette.- let (br, bg, bb) = if let Some([r, g, b, _]) = core.bloom_override {- (r, g, b)- } else {- let [r, g, b, _] = core.palette.bloom_inner;- (r, g, b)- };- let bloom_inner = tiny_skia::Color::from_rgba8(br, bg, bb, (115.0 * alpha_scale) as u8);- let (or_, og, ob) = if let Some([r, g, b, _]) = core.bloom_override {- (r, g, b)- } else {- let [r, g, b, _] = core.palette.bloom_outer;- (r, g, b)- };- let bloom_outer = tiny_skia::Color::from_rgba8(or_, og, ob, (26.0 * alpha_scale) as u8);- let bloom_zero = tiny_skia::Color::from_rgba8(or_, og, ob, 0);-- let bloom_paint = tiny_skia::Paint {- shader: tiny_skia::RadialGradient::new(- tiny_skia::Point::from_xy(px as f32, py as f32),- tiny_skia::Point::from_xy(px as f32, py as f32), // focal = center- bloom_r,- vec![- tiny_skia::GradientStop::new(0.0, bloom_inner),- tiny_skia::GradientStop::new(0.5, bloom_outer),- tiny_skia::GradientStop::new(1.0, bloom_zero),- ],- tiny_skia::SpreadMode::Pad,- tiny_skia::Transform::identity(),- )- .unwrap_or(tiny_skia::Shader::SolidColor(bloom_inner)),- anti_alias: true,- ..Default::default()- };-- if let Some(r) = tiny_skia::Rect::from_xywh(- (px - bloom_r as f64) as f32,- (py - bloom_r as f64) as f32,- bloom_r * 2.0,- bloom_r * 2.0,- ) {- pm.fill_rect(r, &bloom_paint, tiny_skia::Transform::identity(), None);- }-- if core.pressed {- let [pr, pg, pb, _] = core.palette.cursor_mid;- let ring_color = tiny_skia::Color::from_rgba8(pr, pg, pb, (210.0 * alpha_scale) as u8);- let ring_paint = tiny_skia::Paint {- shader: tiny_skia::Shader::SolidColor(ring_color),- anti_alias: true,- ..Default::default()- };- let stroke = tiny_skia::Stroke {- width: 3.0 * sf,- ..Default::default()- };- let core_fill = tiny_skia::Color::from_rgba8(pr, pg, pb, (110.0 * alpha_scale) as u8);- let fill_paint = tiny_skia::Paint {- shader: tiny_skia::Shader::SolidColor(core_fill),- anti_alias: true,- ..Default::default()- };- let mut pb = tiny_skia::PathBuilder::new();- pb.push_circle(px as f32, py as f32, 6.5 * sf);- if let Some(path) = pb.finish() {- pm.fill_path(- &path,- &fill_paint,- tiny_skia::FillRule::Winding,- tiny_skia::Transform::identity(),- None,- );- }- let mut pb = tiny_skia::PathBuilder::new();- pb.push_circle(px as f32, py as f32, 13.0 * sf);- if let Some(path) = pb.finish() {- pm.stroke_path(- &path,- &ring_paint,- &stroke,- tiny_skia::Transform::identity(),- None,- );- }- }-// --- Focus rect highlight (macOS only — others pass None) ---// Cyan glow border + faint fill, matching Swift AgentCursor.showFocusRect.if let Some(fr) = focus_rect {@@ -723,219 +678,28 @@ pub fn paint_cursor(}}- // --- Click pulse ring ---- if let Some(t) = core.click_t {- // bloom_r already includes backing_scale; the +20pt expansion is- // logical so scale it explicitly here.- let ring_r = (bloom_r + 20.0 * sf * t as f32) * (1.0 - t as f32 * 0.5);- let alpha = ((1.0 - t) * 180.0 * alpha_scale as f64) as u8;- let [cr, cg, cb, _] = core.palette.cursor_mid;- let ring_color = tiny_skia::Color::from_rgba8(cr, cg, cb, alpha);- let ring_paint = tiny_skia::Paint {- shader: tiny_skia::Shader::SolidColor(ring_color),- anti_alias: true,- ..Default::default()- };- let stroke = tiny_skia::Stroke {- width: 2.0 * sf,- ..Default::default()- };- let mut pb = tiny_skia::PathBuilder::new();- pb.push_circle(px as f32, py as f32, ring_r);- if let Some(path) = pb.finish() {- pm.stroke_path(- &path,- &ring_paint,- &stroke,- tiny_skia::Transform::identity(),- None,- );- }- }-- // --- Arrow / silhouette ---- //- // Three-way precedence:- // 1. Per-instance custom asset loaded from `--cursor-icon <path>`- // (or runtime `set_agent_cursor_style.image_path`) wins.- // 2. Else the built-in selected by `--cursor-shape`:- // - `arrow` (default): call `draw_default_arrow` — procedural- // gradient diamond, sharp at any backing scale because nothing- // rasterises.- // - `teardrop`: blit the cached `CursorShape::teardrop()` pixmap- // — rasterised once at 2× the display target.- // 3. (No other built-ins today.)- //- // Teardrop is the default silhouette; `--cursor-shape arrow` (or- // `cursor_icon: "arrow"`) selects the procedural arrow instead.- let shape: Option<&CursorShape> = match (core.shape.as_ref(), core.cfg.builtin_shape) {- (Some(custom), _) => Some(custom),- (None, BuiltinShape::Teardrop) => Some(CursorShape::teardrop()),- (None, BuiltinShape::Arrow) => {- let grad_override = if core.gradient_colors.is_empty() {- None- } else {- Some(&core.gradient_colors)- };- draw_default_arrow(- pm,- &core.palette,- grad_override,- px as f32,- py as f32,- heading as f32,- alpha_scale,- );- None- }- };- let shape = match shape {- Some(s) => s,- None => return,- };- // Display size in pixels. 26 logical points is a touch larger than a- // default OS arrow — large enough to spot during agent action without- // overwhelming the workspace. The source raster is shape.width ×- // shape.height (64×64 for built-ins), so the transform scales down by- // display_size/shape.width. We multiply by `backing_scale` so the arrow- // rasterises at the destination pixmap's native resolution (e.g. 52 px- // on a 2× retina display) — Core Animation then maps 1:1 to the screen- // instead of upsampling a logical-pixel pixmap.- let display_size = 26.0_f32 * sf;- let scale = display_size / shape.width as f32;- if let Some(pix) = tiny_skia::PixmapRef::from_bytes(&shape.pixels, shape.width, shape.height) {- // T = Translate(px, py) * Rotate(angle) * Scale(s) * Translate(-w/2, -h/2)- // Centres the source on its own origin, scales to display_size, rotates- // around the scaled centre, lands the centre at (px, py).- //- // +90° offset compensates for the SVG's intrinsic orientation: the- // cursor-up silhouette points UP at rest (CSS y-down angle -π/2),- // whereas the procedural arrow's rotation convention assumes the- // shape points RIGHT at rest (angle 0). Without the +90°, motion-- // right rotation would leave the tip still pointing up.- let rotation_deg = heading.to_degrees() as f32 + 180.0 + 90.0;- let transform = tiny_skia::Transform::from_translate(- -(shape.width as f32) / 2.0,- -(shape.height as f32) / 2.0,- )- .post_scale(scale, scale)- .post_rotate(rotation_deg)- .post_translate(px as f32, py as f32);- let paint = tiny_skia::PixmapPaint {- opacity: alpha_scale,- ..Default::default()- };- pm.draw_pixmap(0, 0, pix, &paint, transform, None);- }-}--/// Rasterise the built-in gradient arrow at `(px, py)` rotated by-/// `heading` radians. `alpha_scale` is the idle-fade multiplier-/// (1.0 = fully opaque, 0.0 = fully faded out).-///-/// `gradient_override` lets `set_agent_cursor_style` substitute custom-/// gradient stops at runtime. When `None` the palette's-/// `cursor_start/cursor_mid/cursor_end` are used.-pub fn draw_default_arrow(- pm: &mut tiny_skia::Pixmap,- palette: &Palette,- gradient_override: Option<&Vec<[u8; 4]>>,- px: f32,- py: f32,- heading: f32,- alpha_scale: f32,-) {- // Arrow vertices (tip at +x).- let verts: [(f32, f32); 4] = [(14.0, 0.0), (-8.0, -9.0), (-3.0, 0.0), (-8.0, 9.0)];-- // Rotate by (heading + π) so tip points in the motion direction.- let angle = heading + std::f64::consts::PI as f32;- let (sa, ca) = (angle.sin(), angle.cos());- let transform_pt =- |(vx, vy): (f32, f32)| -> (f32, f32) { (px + ca * vx - sa * vy, py + sa * vx + ca * vy) };-- let pts: Vec<(f32, f32)> = verts.iter().map(|&v| transform_pt(v)).collect();-- let mut pb = tiny_skia::PathBuilder::new();- pb.move_to(pts[0].0, pts[0].1);- for p in &pts[1..] {- pb.line_to(p.0, p.1);- }- pb.close();- let arrow_path = match pb.finish() {- Some(p) => p,- None => return,- };-- // Gradient fill: start color at tip, end color at tail.- // Use runtime overrides when available, otherwise fall back to palette.- let tip = pts[0];- let tail = ((pts[1].0 + pts[3].0) / 2.0, (pts[1].1 + pts[3].1) / 2.0);- let (r0, g0, b0) = if let Some(g) = gradient_override.and_then(|g| g.first()) {- (g[0], g[1], g[2])- } else {- let [r, g, b, _] = palette.cursor_start;- (r, g, b)- };- let (r1, g1, b1) =- if let Some(g) = gradient_override.and_then(|g| g.get(1).or_else(|| g.first())) {- (g[0], g[1], g[2])- } else {- let [r, g, b, _] = palette.cursor_mid;- (r, g, b)- };- let (r2, g2, b2) = if let Some(g) = gradient_override.and_then(|g| g.last()) {- (g[0], g[1], g[2])+ if let Some(theme) = core.theme.as_deref() {+ crate::paint_compiled_theme(+ pm,+ theme,+ &core.visual,+ px as f32,+ py as f32,+ heading as f32,+ backing_scale.max(1.0),+ alpha_scale,+ );} else {- let [r, g, b, _] = palette.cursor_end;- (r, g, b)- };-- let a = (255.0 * alpha_scale) as u8;- let fill_paint = tiny_skia::Paint {- shader: tiny_skia::LinearGradient::new(- tiny_skia::Point::from_xy(tip.0, tip.1),- tiny_skia::Point::from_xy(tail.0, tail.1),- vec![- tiny_skia::GradientStop::new(0.00, tiny_skia::Color::from_rgba8(r0, g0, b0, a)),- tiny_skia::GradientStop::new(0.53, tiny_skia::Color::from_rgba8(r1, g1, b1, a)),- tiny_skia::GradientStop::new(1.00, tiny_skia::Color::from_rgba8(r2, g2, b2, a)),- ],- tiny_skia::SpreadMode::Pad,- tiny_skia::Transform::identity(),- )- .unwrap_or(tiny_skia::Shader::SolidColor(tiny_skia::Color::from_rgba8(- r1, g1, b1, a,- ))),- anti_alias: true,- ..Default::default()- };-- pm.fill_path(- &arrow_path,- &fill_paint,- tiny_skia::FillRule::Winding,- tiny_skia::Transform::identity(),- None,- );-- // White outline (faded with alpha_scale).- let stroke_paint = tiny_skia::Paint {- shader: tiny_skia::Shader::SolidColor(tiny_skia::Color::from_rgba8(255, 255, 255, a)),- anti_alias: true,- ..Default::default()- };- let stroke = tiny_skia::Stroke {- width: 1.5,- ..Default::default()- };- pm.stroke_path(- &arrow_path,- &stroke_paint,- &stroke,- tiny_skia::Transform::identity(),- None,- );+ crate::theme::paint_default_theme(+ pm,+ &core.visual,+ px as f32,+ py as f32,+ heading as f32,+ backing_scale.max(1.0),+ alpha_scale,+ );+ }}#[cfg(test)]diff --git a/libs/cua-driver/rust/crates/cursor-overlay/src/shape.rs b/libs/cua-driver/rust/crates/cursor-overlay/src/shape.rsdeleted file mode 100644index 3c0ec681f2..0000000000--- a/libs/cua-driver/rust/crates/cursor-overlay/src/shape.rs+++ /dev/null@@ -1,294 +0,0 @@-//! Custom cursor shape — rasterised from SVG / ICO / PNG.-//!-//! Used when `--cursor-icon <path>` is passed to the MCP binary, plus the-//! `teardrop()` built-in (`cursor-up` from svgrepo) selectable via-//! `--cursor-shape teardrop`. Always produces a 64×64 RGBA pixel buffer.--use anyhow::{bail, Result};--/// Built-in cursor silhouette selectable via `--cursor-shape <name>` or the-/// MCP `cursor_icon` field. Used when no `--cursor-icon` custom file overrides-/// the choice.-///-/// `Teardrop` is the default; opt back into the procedural arrow with-/// `--cursor-shape arrow` (CLI) or `cursor_icon: "arrow"` (MCP).-#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]-pub enum BuiltinShape {- /// Procedural gradient diamond drawn from vector primitives — the- /// original cua cursor. Sharp at any backing scale because nothing is- /// rasterised; `draw_default_arrow` rebuilds the path each frame.- Arrow,- /// Embedded `cursor-up` SVG (teardrop with notched bottom). Rasterised- /// once into a 52 px RGBA buffer and blitted with a runtime transform.- #[default]- Teardrop,-}--impl BuiltinShape {- /// Canonical `(name → variant)` table. The single source of truth behind- /// [`parse`](Self::parse), [`names`](Self::names),- /// [`names_help`](Self::names_help), the CLI `--cursor-shape` help text, and- /// every platform's MCP `cursor_icon` tool description. Add a built-in here- /// and all of them pick it up — nothing else hardcodes the name list.- const TABLE: &'static [(&'static str, Self)] =- &[("arrow", Self::Arrow), ("teardrop", Self::Teardrop)];-- /// Parse the value of `--cursor-shape` / MCP `cursor_icon`. Case-insensitive.- /// Returns `None` for unknown names so the caller can warn and fall back to- /// the default.- pub fn parse(name: &str) -> Option<Self> {- let lower = name.to_ascii_lowercase();- Self::TABLE- .iter()- .find(|(n, _)| *n == lower)- .map(|(_, v)| *v)- }-- /// The accepted built-in names in declaration order, e.g.- /// `["arrow", "teardrop"]`.- pub fn names() -> impl Iterator<Item = &'static str> {- Self::TABLE.iter().map(|(name, _)| *name)- }-- /// Human-facing list of built-in names for help / tool-description text,- /// e.g. `'arrow' | 'teardrop'`. The single string the CLI `--help` and every- /// MCP `cursor_icon` description render from, so the advertised vocabulary- /// can never drift from what [`parse`](Self::parse) actually accepts.- pub fn names_help() -> String {- Self::names()- .map(|n| format!("'{n}'"))- .collect::<Vec<_>>()- .join(" | ")- }-}--/// What an MCP `cursor_icon` value resolves to. Built-in names drive the-/// overlay's `builtin_shape` (so either built-in is reachable regardless of-/// which is the default); a file path becomes a one-off shape override.-#[derive(Debug, Clone)]-pub enum CursorIconResolution {- /// A built-in silhouette — apply via `OverlayCommand::SetBuiltinShape`,- /// which sets `builtin_shape` and clears any custom override.- Builtin(BuiltinShape),- /// A custom image loaded from disk — apply via- /// `OverlayCommand::SetShape(Some(_))`.- Image(CursorShape),-}--/// Resolve an MCP `cursor_icon` (or CLI) value into a [`CursorIconResolution`].-///-/// - empty string → the configured default built-in ([`BuiltinShape::default`])-/// - a built-in name (`arrow` / `teardrop`, case-insensitive) → that built-in-/// - anything else → treated as a file path and loaded (`.svg` / `.png` / `.ico`)-///-/// This is the single resolver shared by the CLI flags and every platform's MCP-/// `set_agent_cursor_motion` handler, so the accepted vocabulary — and which-/// rendering path each value takes — stays identical across all of them.-pub fn resolve_cursor_icon(value: &str) -> Result<CursorIconResolution> {- if value.is_empty() {- return Ok(CursorIconResolution::Builtin(BuiltinShape::default()));- }- if let Some(builtin) = BuiltinShape::parse(value) {- return Ok(CursorIconResolution::Builtin(builtin));- }- CursorShape::load(value).map(CursorIconResolution::Image)-}--/// Rasterised cursor shape at 64×64 RGBA.-#[derive(Debug, Clone)]-pub struct CursorShape {- /// Raw RGBA pixels, row-major top-to-bottom, 4 bytes per pixel.- pub pixels: Vec<u8>,- pub width: u32,- pub height: u32,-}--/// Source rasterisation size. Sized as 2× the runtime display target-/// (26 px in `paint_cursor`) so the downscale ratio stays a clean 2:1 —-/// bilinear handles that without smearing, and on 2× retina displays the-/// pixmap maps 1:1 to physical pixels for perfect crispness. Non-integer-/// ratios (e.g. 64→26 = 0.41×) produce visible downscale blur.-pub const CURSOR_SIZE: u32 = 52;--/// User-supplied "cursor-up" silhouette from svgrepo.com — an upward-pointing-/// teardrop with a notched bottom. Original fill was solid black; we substitute-/// the fleet linear gradient (light blue → teal, top-right to bottom-left) so-/// the runtime `gradient_colors` MCP override has a surface to tint, and add a-/// white stroke for visibility on dark backdrops. Embedded verbatim so the-/// daemon ships the built-in teardrop without an external asset.-const TEARDROP_CURSOR_SVG: &[u8] = br##"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">-<defs>-<linearGradient id="cursorGrad" x1="1" x2="0" y1="0" y2="1">-<stop offset="0" stop-color="#F0FBFF"/>-<stop offset="0.55" stop-color="#66D9FF"/>-<stop offset="1" stop-color="#35C6D8"/>-</linearGradient>-</defs>-<path d="M19.87,19.21l-6-15.92a2,2,0,0,0-3.74,0l-6,15.92a2,2,0,0,0,.65,2.3A2.21,2.21,0,0,0,6.17,22a2.24,2.24,0,0,0,1.23-.37L12,18.57l4.6,3.06a2.22,2.22,0,0,0,2.62-.12A2,2,0,0,0,19.87,19.21Z" fill="url(#cursorGrad)" stroke="#FFFFFF" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>-</svg>"##;--impl CursorShape {- /// Load from `path`. Supported: `.svg`, `.ico`, `.png`.- pub fn load(path: &str) -> Result<Self> {- let lower = path.to_ascii_lowercase();- if lower.ends_with(".svg") {- Self::load_svg(path)- } else if lower.ends_with(".ico") || lower.ends_with(".png") {- Self::load_raster(path)- } else {- bail!("Unsupported cursor-icon format (expected .svg, .ico, or .png): {path}")- }- }-- /// The built-in teardrop cursor — embedded `cursor-up` silhouette- /// rasterised once via `OnceLock` so callers can ask for it cheaply.- /// Selected by `BuiltinShape::Teardrop`, which is the default silhouette.- pub fn teardrop() -> &'static Self {- static CACHE: std::sync::OnceLock<CursorShape> = std::sync::OnceLock::new();- CACHE.get_or_init(|| {- Self::load_svg_bytes(TEARDROP_CURSOR_SVG).expect("embedded teardrop SVG should parse")- })- }-- fn load_svg(path: &str) -> Result<Self> {- let data = std::fs::read(path)?;- Self::load_svg_bytes(&data)- }-- fn load_svg_bytes(data: &[u8]) -> Result<Self> {- let opts = usvg::Options::default();- let tree = usvg::Tree::from_data(data, &opts)?;-- let mut pixmap = tiny_skia::Pixmap::new(CURSOR_SIZE, CURSOR_SIZE).ok_or_else(|| {- anyhow::anyhow!("Failed to create {CURSOR_SIZE}×{CURSOR_SIZE} pixmap")- })?;-- let sx = CURSOR_SIZE as f32 / tree.size().width();- let sy = CURSOR_SIZE as f32 / tree.size().height();- resvg::render(- &tree,- tiny_skia::Transform::from_scale(sx, sy),- &mut pixmap.as_mut(),- );-- let raw = pixmap.take();- let pixels = unpremultiply(raw);- Ok(Self {- pixels,- width: CURSOR_SIZE,- height: CURSOR_SIZE,- })- }-- fn load_raster(path: &str) -> Result<Self> {- let img = image::open(path)?.into_rgba8();- let resized = image::imageops::resize(- &img,- CURSOR_SIZE,- CURSOR_SIZE,- image::imageops::FilterType::Lanczos3,- );- Ok(Self {- pixels: resized.into_raw(),- width: CURSOR_SIZE,- height: CURSOR_SIZE,- })- }-}--/// Convert pre-multiplied RGBA → straight RGBA.-fn unpremultiply(mut data: Vec<u8>) -> Vec<u8> {- for px in data.chunks_exact_mut(4) {- let a = px[3];- if a > 0 && a < 255 {- let scale = 255.0 / a as f32;- px[0] = (px[0] as f32 * scale).min(255.0) as u8;- px[1] = (px[1] as f32 * scale).min(255.0) as u8;- px[2] = (px[2] as f32 * scale).min(255.0) as u8;- }- }- data-}--#[cfg(test)]-mod tests {- use super::*;-- #[test]- fn builtin_shape_parses_known_names_case_insensitive() {- assert_eq!(BuiltinShape::parse("arrow"), Some(BuiltinShape::Arrow));- assert_eq!(BuiltinShape::parse("ARROW"), Some(BuiltinShape::Arrow));- assert_eq!(BuiltinShape::parse("Arrow"), Some(BuiltinShape::Arrow));- assert_eq!(- BuiltinShape::parse("teardrop"),- Some(BuiltinShape::Teardrop)- );- assert_eq!(- BuiltinShape::parse("TEARDROP"),- Some(BuiltinShape::Teardrop)- );- assert_eq!(- BuiltinShape::parse("Teardrop"),- Some(BuiltinShape::Teardrop)- );- }-- #[test]- fn builtin_shape_rejects_unknown_names() {- assert_eq!(BuiltinShape::parse(""), None);- assert_eq!(BuiltinShape::parse("diamond"), None);- assert_eq!(BuiltinShape::parse("arrow "), None); // whitespace-significant- assert_eq!(BuiltinShape::parse("cua_brand"), None); // legacy name no longer recognised- // The invented MCP names that never existed in the renderer must NOT parse —- // they were doc-only fiction and are gone now.- assert_eq!(BuiltinShape::parse("crosshair"), None);- assert_eq!(BuiltinShape::parse("hand"), None);- assert_eq!(BuiltinShape::parse("dot"), None);- }-- #[test]- fn names_help_lists_every_table_entry() {- // Single source of truth: help text is derived from TABLE, so it always- // matches what `parse` accepts.- let help = BuiltinShape::names_help();- for name in BuiltinShape::names() {- assert!(help.contains(name), "names_help() missing {name}: {help}");- assert!(- BuiltinShape::parse(name).is_some(),- "{name} listed but unparseable"- );- }- assert_eq!(help, "'arrow' | 'teardrop'");- }-- #[test]- fn resolve_cursor_icon_matches_builtins_and_revert() {- use CursorIconResolution::*;- // Empty reverts to the configured default built-in (now teardrop).- assert!(matches!(- resolve_cursor_icon("").unwrap(),- Builtin(BuiltinShape::Teardrop)- ));- // Built-in names resolve to that built-in, case-insensitively —- // crucially `arrow` stays reachable even though teardrop is the default.- assert!(matches!(- resolve_cursor_icon("arrow").unwrap(),- Builtin(BuiltinShape::Arrow)- ));- assert!(matches!(- resolve_cursor_icon("TEARDROP").unwrap(),- Builtin(BuiltinShape::Teardrop)- ));- // A non-name, non-existent path is treated as a file and fails to load.- assert!(resolve_cursor_icon("/no/such/cursor.png").is_err());- }-- /// `Teardrop` is the default silhouette. If this assertion changes, the- /// `personalize-cursor.mdx` doc and the CLI `--cursor-shape` help must- /// change to match — both tell users which built-in they get when no flag- /// is set.- #[test]- fn default_builtin_shape_is_teardrop() {- assert_eq!(BuiltinShape::default(), BuiltinShape::Teardrop);- }-}diff --git a/libs/cua-driver/rust/crates/cursor-overlay/src/theme.rs b/libs/cua-driver/rust/crates/cursor-overlay/src/theme.rsnew file mode 100644index 0000000000..86b023249a--- /dev/null+++ b/libs/cua-driver/rust/crates/cursor-overlay/src/theme.rs@@ -0,0 +1,726 @@+//! Canonical cursor-theme semantics and the embedded `cua.default` renderer.+//!+//! The default artwork was authored as Lottie on a 128×128 canvas. Production+//! rendering uses this bounded vector representation so the privileged overlay+//! never parses Lottie, ZIP, fonts, scripts, images, or network references.++use serde::{Deserialize, Serialize};+use tiny_skia::{Color, FillRule, Paint, Path, PathBuilder, Stroke, Transform};++pub use cua_driver_contract::{+ CursorAction, CursorDelivery as DeliveryModifier, CursorPlayback as PlaybackKind,+ CursorReducedMotion as ReducedMotion, CursorTarget as TargetModifier,+};++pub const DEFAULT_THEME_ID: &str = "cua.default";+pub const DEFAULT_THEME_VERSION: &str = "1.0.0";+pub const THEME_PROFILE: &str = "cua-driver-full-v1";+pub const CANVAS_SIZE: f32 = 128.0;+pub const DISPLAY_SIZE: f32 = 58.0;++fn ink() -> Color {+ Color::from_rgba8(16, 21, 47, 255)+}++fn paper() -> Color {+ Color::from_rgba8(251, 251, 249, 255)+}++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]+pub struct CursorVisualState {+ pub requested_action: CursorAction,+ pub resolved_action: CursorAction,+ pub delivery: Option<DeliveryModifier>,+ pub target: Option<TargetModifier>,+ pub elapsed_secs: f64,+ /// Grace period remaining after a short tool call ends, so observe/key+ /// cues remain visible for at least one rendered frame.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub ending_secs: Option<f64>,+ pub reduced_motion: ReducedMotion,+ pub preempted_count: u64,+}++impl Default for CursorVisualState {+ fn default() -> Self {+ Self {+ requested_action: CursorAction::Idle,+ resolved_action: CursorAction::Idle,+ delivery: None,+ target: None,+ elapsed_secs: 0.0,+ ending_secs: None,+ reduced_motion: ReducedMotion::Auto,+ preempted_count: 0,+ }+ }+}++impl CursorVisualState {+ pub fn begin(+ &mut self,+ action: CursorAction,+ delivery: Option<DeliveryModifier>,+ target: Option<TargetModifier>,+ ) {+ if self.resolved_action != CursorAction::Idle && self.resolved_action != action {+ self.preempted_count = self.preempted_count.saturating_add(1);+ }+ self.requested_action = action;+ self.resolved_action = action;+ self.delivery = delivery;+ self.target = target;+ self.elapsed_secs = 0.0;+ self.ending_secs = None;+ }++ pub fn end(&mut self, action: CursorAction) {+ if self.resolved_action == action+ && matches!(action.playback(), PlaybackKind::Held | PlaybackKind::Loop)+ {+ self.ending_secs = Some(0.4);+ }+ }++ pub fn to_idle(&mut self) {+ self.requested_action = CursorAction::Idle;+ self.resolved_action = CursorAction::Idle;+ self.delivery = None;+ self.target = None;+ self.elapsed_secs = 0.0;+ self.ending_secs = None;+ }++ pub fn tick(&mut self, dt: f64) {+ let dt = dt.max(0.0);+ self.elapsed_secs = (self.elapsed_secs + dt).min(86_400.0);+ if let Some(remaining) = self.ending_secs {+ if remaining <= dt {+ self.to_idle();+ return;+ }+ self.ending_secs = Some(remaining - dt);+ }+ let action = self.resolved_action;+ if action.playback() == PlaybackKind::OneShot && self.elapsed_secs >= action.duration_secs()+ {+ self.to_idle();+ }+ }++ pub fn phase(&self) -> &'static str {+ match self.resolved_action.playback() {+ PlaybackKind::Resting | PlaybackKind::Loop => "loop",+ PlaybackKind::Held => "sustain",+ PlaybackKind::OneShot => "one_shot",+ }+ }++ pub fn frame(&self) -> u32 {+ let duration = self.resolved_action.duration_secs().max(1.0 / 30.0);+ let elapsed = match self.resolved_action.playback() {+ PlaybackKind::Resting | PlaybackKind::Loop | PlaybackKind::Held => {+ self.elapsed_secs.rem_euclid(duration)+ }+ PlaybackKind::OneShot => self.elapsed_secs.min(duration),+ };+ (elapsed * 30.0).floor() as u32+ }+}++fn solid_paint(color: Color, alpha: f32) -> Paint<'static> {+ Paint {+ shader: tiny_skia::Shader::SolidColor(+ Color::from_rgba(+ color.red(),+ color.green(),+ color.blue(),+ (color.alpha() * alpha).clamp(0.0, 1.0),+ )+ .unwrap_or(Color::TRANSPARENT),+ ),+ anti_alias: true,+ ..Default::default()+ }+}++fn cue_stroke(alpha: f32, width: f32) -> (Paint<'static>, Stroke) {+ (+ solid_paint(ink(), alpha),+ Stroke {+ width,+ line_cap: tiny_skia::LineCap::Round,+ line_join: tiny_skia::LineJoin::Round,+ ..Default::default()+ },+ )+}++fn draw_path(+ pm: &mut tiny_skia::Pixmap,+ path: &Path,+ transform: Transform,+ alpha: f32,+ width: f32,+) {+ let (paint, stroke) = cue_stroke(alpha, width);+ pm.stroke_path(path, &paint, &stroke, transform, None);+}++fn line_path(points: &[(f32, f32)]) -> Option<Path> {+ let (&(x, y), rest) = points.split_first()?;+ let mut builder = PathBuilder::new();+ builder.move_to(x, y);+ for &(x, y) in rest {+ builder.line_to(x, y);+ }+ builder.finish()+}++fn rounded_rect_path(x: f32, y: f32, width: f32, height: f32, radius: f32) -> Option<Path> {+ let r = radius.min(width * 0.5).min(height * 0.5).max(0.0);+ let k = 0.552_284_8;+ let mut builder = PathBuilder::new();+ builder.move_to(x + r, y);+ builder.line_to(x + width - r, y);+ builder.cubic_to(+ x + width - r + r * k,+ y,+ x + width,+ y + r - r * k,+ x + width,+ y + r,+ );+ builder.line_to(x + width, y + height - r);+ builder.cubic_to(+ x + width,+ y + height - r + r * k,+ x + width - r + r * k,+ y + height,+ x + width - r,+ y + height,+ );+ builder.line_to(x + r, y + height);+ builder.cubic_to(+ x + r - r * k,+ y + height,+ x,+ y + height - r + r * k,+ x,+ y + height - r,+ );+ builder.line_to(x, y + r);+ builder.cubic_to(x, y + r - r * k, x + r - r * k, y, x + r, y);+ builder.close();+ builder.finish()+}++fn ease_in_out(t: f32) -> f32 {+ let t = t.clamp(0.0, 1.0);+ t * t * (3.0 - 2.0 * t)+}++fn triangle_wave(t: f32) -> f32 {+ let t = t.rem_euclid(1.0);+ if t < 0.5 {+ t * 2.0+ } else {+ (1.0 - t) * 2.0+ }+}++/// Paint one frame of the embedded Full-v1 theme.+///+/// `anchor_x/y` is the existing overlay's cursor centre. The Lottie canvas is+/// centred there so the established click offset and path physics remain+/// unchanged. `heading` rotates the artwork around the canvas centre.+pub fn paint_default_theme(+ pm: &mut tiny_skia::Pixmap,+ visual: &CursorVisualState,+ anchor_x: f32,+ anchor_y: f32,+ heading: f32,+ backing_scale: f32,+ alpha: f32,+) {+ let scale = DISPLAY_SIZE * backing_scale / CANVAS_SIZE;+ let base_rotation = heading - std::f32::consts::FRAC_PI_4;+ let mut body_dx = 0.0;+ let mut body_dy = 0.0;+ let mut body_rotation = 0.0;+ let mut body_scale = 1.0;++ let duration = visual.resolved_action.duration_secs() as f32;+ let local = (visual.elapsed_secs as f32).rem_euclid(duration.max(1.0 / 30.0));+ let progress = (local / duration.max(1.0 / 30.0)).clamp(0.0, 1.0);+ let reduced = visual.reduced_motion == ReducedMotion::On;++ if !reduced {+ match visual.resolved_action {+ CursorAction::Idle => {+ let angle = progress * std::f32::consts::TAU;+ body_dx = angle.sin() * 5.0;+ body_dy = 6.0 * angle.cos() - 5.0;+ body_rotation = 2.5_f32.to_radians() * angle.cos();+ }+ CursorAction::Click => {+ body_scale = if progress < 0.35 {+ 1.0 - ease_in_out(progress / 0.35) * 0.07+ } else if progress < 0.6 {+ 0.93 + ease_in_out((progress - 0.35) / 0.25) * 0.10+ } else {+ 1.03 - ease_in_out((progress - 0.6) / 0.4) * 0.03+ };+ }+ CursorAction::Drag => {+ let held = ease_in_out(triangle_wave(progress));+ body_dx = held * 7.0;+ body_dy = held * 3.0;+ }+ _ => {}+ }+ }++ let canvas_transform = Transform::from_translate(-64.0, -64.0)+ .post_scale(scale, scale)+ .post_rotate(base_rotation.to_degrees())+ .post_translate(anchor_x, anchor_y);+ let body_transform = Transform::from_translate(-64.0, -64.0)+ .post_scale(scale * body_scale, scale * body_scale)+ .post_rotate((base_rotation + body_rotation).to_degrees())+ .post_translate(anchor_x + body_dx * scale, anchor_y + body_dy * scale);++ draw_action_cue(+ pm,+ visual.resolved_action,+ progress,+ canvas_transform,+ alpha,+ reduced,+ );+ draw_cursor_body(pm, body_transform, alpha);+ draw_modifiers(pm, visual, canvas_transform, alpha);+}++fn draw_cursor_body(pm: &mut tiny_skia::Pixmap, transform: Transform, alpha: f32) {+ let mut builder = PathBuilder::new();+ builder.move_to(55.0, 30.0);+ builder.cubic_to(48.0, 28.0, 42.0, 33.0, 43.0, 41.0);+ builder.line_to(64.0, 98.0);+ builder.cubic_to(67.0, 106.0, 73.0, 106.0, 77.0, 99.0);+ builder.line_to(86.0, 79.0);+ builder.cubic_to(88.0, 75.0, 91.0, 72.0, 95.0, 70.0);+ builder.line_to(108.0, 63.0);+ builder.cubic_to(115.0, 59.0, 114.0, 53.0, 107.0, 50.0);+ builder.close();+ let Some(path) = builder.finish() else {+ return;+ };+ pm.fill_path(+ &path,+ &solid_paint(paper(), alpha),+ FillRule::Winding,+ transform,+ None,+ );+ let (paint, mut stroke) = cue_stroke(alpha, 5.0);+ stroke.line_join = tiny_skia::LineJoin::Round;+ pm.stroke_path(&path, &paint, &stroke, transform, None);+}++fn draw_action_cue(+ pm: &mut tiny_skia::Pixmap,+ action: CursorAction,+ progress: f32,+ transform: Transform,+ alpha: f32,+ reduced: bool,+) {+ let wave = if reduced {+ 0.5+ } else {+ triangle_wave(progress)+ };+ match action {+ CursorAction::Idle => {}+ CursorAction::Observe => {+ let opacity = alpha+ * if reduced {+ 1.0+ } else {+ (progress * 7.0).min(1.0)+ };+ let scale = if reduced { 1.0 } else { 0.88 + progress * 0.20 };+ let t = Transform::from_translate(-64.0, -64.0)+ .post_scale(scale, scale)+ .post_translate(64.0 + 8.0, 64.0 - 10.0)+ .post_concat(transform);+ let mut a = PathBuilder::new();+ a.move_to(38.0, 28.0);+ a.cubic_to(27.0, 29.0, 20.0, 38.0, 20.0, 49.0);+ if let Some(path) = a.finish() {+ draw_path(pm, &path, t, opacity, 4.0);+ }+ let mut b = PathBuilder::new();+ b.move_to(42.0, 19.0);+ b.cubic_to(23.0, 19.0, 11.0, 33.0, 11.0, 51.0);+ if let Some(path) = b.finish() {+ draw_path(pm, &path, t, opacity, 4.0);+ }+ }+ CursorAction::Click => {+ let cue_progress = (progress / 0.65).clamp(0.0, 1.0);+ let opacity = alpha * (1.0 - cue_progress).min(cue_progress * 4.0).clamp(0.0, 1.0);+ let cue_scale = 0.25 + ease_in_out(cue_progress) * 1.0;+ let t = Transform::from_translate(-25.0, -25.0)+ .post_scale(cue_scale, cue_scale)+ .post_translate(25.0 + 10.0, 25.0 + 3.0)+ .post_concat(transform);+ for points in [+ &[(35.0, 20.0), (34.0, 11.0)][..],+ &[(27.0, 25.0), (19.0, 19.0)][..],+ &[(25.0, 34.0), (15.0, 34.0)][..],+ ] {+ if let Some(path) = line_path(points) {+ draw_path(pm, &path, t, opacity, 4.0);+ }+ }+ }+ CursorAction::Drag => {+ let offset = if reduced {+ 0.0+ } else {+ ease_in_out(wave) * 7.0+ };+ let t = Transform::from_translate(offset, offset * 0.43).post_concat(transform);+ for points in [+ &[(28.0, 38.0), (16.0, 35.0)][..],+ &[(26.0, 48.0), (12.0, 45.0)][..],+ ] {+ if let Some(path) = line_path(points) {+ draw_path(pm, &path, t, alpha * (0.2 + wave * 0.8), 4.0);+ }+ }+ }+ CursorAction::Scroll => {+ let y = if reduced { 0.0 } else { 4.0 - wave * 8.0 };+ let t = Transform::from_translate(-5.0, y).post_concat(transform);+ for points in [+ &[(23.0, 31.0), (31.0, 22.0), (39.0, 31.0)][..],+ &[(23.0, 49.0), (31.0, 58.0), (39.0, 49.0)][..],+ ] {+ if let Some(path) = line_path(points) {+ draw_path(pm, &path, t, alpha * (0.42 + wave * 0.58), 4.0);+ }+ }+ }+ CursorAction::Text => {+ let opacity = if reduced || progress < 0.34 || progress > 0.64 {+ alpha+ } else {+ alpha * 0.18+ };+ let t = Transform::from_translate(-4.0, 0.0).post_concat(transform);+ for points in [+ &[(31.0, 22.0), (31.0, 58.0)][..],+ &[(24.0, 22.0), (38.0, 22.0)][..],+ &[(24.0, 58.0), (38.0, 58.0)][..],+ ] {+ if let Some(path) = line_path(points) {+ draw_path(pm, &path, t, opacity, 4.0);+ }+ }+ }+ CursorAction::Key => {+ let bounce = if reduced {+ 0.0+ } else {+ (progress * std::f32::consts::TAU).sin() * (1.0 - progress) * 3.0+ };+ let t = Transform::from_translate(-9.0, bounce).post_concat(transform);+ if let Some(rect) = tiny_skia::Rect::from_xywh(14.0, 25.0, 28.0, 28.0) {+ if let Some(path) =+ rounded_rect_path(rect.x(), rect.y(), rect.width(), rect.height(), 6.0)+ {+ draw_path(pm, &path, t, alpha, 3.5);+ }+ }+ if let Some(path) = line_path(&[+ (23.0, 32.0),+ (23.0, 46.0),+ (23.0, 39.0),+ (33.0, 32.0),+ (24.0, 39.0),+ (34.0, 46.0),+ ]) {+ draw_path(pm, &path, t, alpha, 3.5);+ }+ }+ CursorAction::Navigate => {+ let x = if reduced {+ 0.0+ } else {+ -5.0 + ease_in_out(progress) * 9.0+ };+ let t = Transform::from_translate(x - 5.0, 0.0).post_concat(transform);+ for points in [+ &[(15.0, 29.0), (25.0, 40.0), (15.0, 51.0)][..],+ &[(29.0, 29.0), (39.0, 40.0), (29.0, 51.0)][..],+ ] {+ if let Some(path) = line_path(points) {+ draw_path(pm, &path, t, alpha * (0.2 + wave * 0.8), 4.0);+ }+ }+ }+ CursorAction::App => {+ let s = if reduced {+ 1.0+ } else {+ 0.2 + ease_in_out((progress * 2.0).min(1.0)) * 0.8+ };+ let t = Transform::from_translate(-26.0, -39.0)+ .post_scale(s, s)+ .post_translate(26.0 - 5.0, 39.0)+ .post_concat(transform);+ for (x, y) in [(13.0, 26.0), (29.0, 26.0), (13.0, 42.0), (29.0, 42.0)] {+ if let Some(rect) = tiny_skia::Rect::from_xywh(x, y, 10.0, 10.0) {+ if let Some(path) =+ rounded_rect_path(rect.x(), rect.y(), rect.width(), rect.height(), 2.0)+ {+ draw_path(pm, &path, t, alpha, 3.5);+ }+ }+ }+ }+ CursorAction::Transfer => {+ let y = if reduced { 0.0 } else { 6.0 - wave * 12.0 };+ let t = Transform::from_translate(-9.0, y).post_concat(transform);+ for points in [+ &[+ (22.0, 50.0),+ (22.0, 20.0),+ (14.0, 28.0),+ (22.0, 20.0),+ (30.0, 28.0),+ ][..],+ &[+ (37.0, 28.0),+ (37.0, 58.0),+ (29.0, 50.0),+ (37.0, 58.0),+ (45.0, 50.0),+ ][..],+ ] {+ if let Some(path) = line_path(points) {+ draw_path(pm, &path, t, alpha * (0.38 + wave * 0.62), 4.0);+ }+ }+ }+ CursorAction::Record => {+ let t = Transform::from_translate(-12.0, 0.0).post_concat(transform);+ let (paint, stroke) = cue_stroke(alpha, 4.0);+ let mut ring = PathBuilder::new();+ ring.push_circle(29.0, 39.0, 17.0);+ if let Some(path) = ring.finish() {+ pm.stroke_path(&path, &paint, &stroke, t, None);+ }+ let radius = if reduced { 5.0 } else { 3.6 + wave * 2.1 };+ let mut dot = PathBuilder::new();+ dot.push_circle(29.0, 39.0, radius);+ if let Some(path) = dot.finish() {+ pm.fill_path(+ &path,+ &solid_paint(ink(), alpha * (0.42 + wave * 0.58)),+ FillRule::Winding,+ t,+ None,+ );+ }+ }+ CursorAction::System => {+ let rotation = if reduced {+ 0.0+ } else {+ ease_in_out(progress) * 68.0 - 18.0+ };+ let t = Transform::from_translate(-29.0, -39.0)+ .post_rotate(rotation)+ .post_translate(29.0 - 14.0, 39.0)+ .post_concat(transform);+ let (paint, stroke) = cue_stroke(alpha, 3.5);+ for radius in [12.0, 4.0] {+ let mut circle = PathBuilder::new();+ circle.push_circle(29.0, 39.0, radius);+ if let Some(path) = circle.finish() {+ pm.stroke_path(&path, &paint, &stroke, t, None);+ }+ }+ for points in [+ &[(29.0, 20.0), (29.0, 25.0)][..],+ &[(29.0, 53.0), (29.0, 58.0)][..],+ &[(10.0, 39.0), (15.0, 39.0)][..],+ &[(43.0, 39.0), (48.0, 39.0)][..],+ &[(16.0, 26.0), (20.0, 30.0)][..],+ &[(38.0, 48.0), (42.0, 52.0)][..],+ &[(16.0, 52.0), (20.0, 48.0)][..],+ &[(38.0, 30.0), (42.0, 26.0)][..],+ ] {+ if let Some(path) = line_path(points) {+ draw_path(pm, &path, t, alpha, 3.5);+ }+ }+ }+ }+}++fn draw_modifiers(+ pm: &mut tiny_skia::Pixmap,+ visual: &CursorVisualState,+ transform: Transform,+ alpha: f32,+) {+ if visual.delivery == Some(DeliveryModifier::Background) {+ let mut builder = PathBuilder::new();+ builder.move_to(34.0, 23.0);+ builder.cubic_to(20.0, 31.0, 17.0, 48.0, 21.0, 63.0);+ builder.cubic_to(25.0, 80.0, 38.0, 95.0, 53.0, 106.0);+ if let Some(path) = builder.finish() {+ let (paint, mut stroke) = cue_stroke(alpha * 0.75, 2.5);+ stroke.dash = Some(tiny_skia::StrokeDash::new(vec![1.0, 5.0], 0.0).unwrap());+ pm.stroke_path(&path, &paint, &stroke, transform, None);+ }+ }++ if visual.delivery == Some(DeliveryModifier::Foreground) {+ let (paint, stroke) = cue_stroke(alpha, 3.0);+ let mut ring = PathBuilder::new();+ ring.push_circle(104.0, 96.0, 9.0);+ if let Some(path) = ring.finish() {+ pm.stroke_path(&path, &paint, &stroke, transform, None);+ }+ }++ match visual.target {+ Some(TargetModifier::Ax) => {+ let (paint, stroke) = cue_stroke(alpha, 2.5);+ for (x, y) in [(104.0, 89.0), (94.0, 104.0), (114.0, 104.0)] {+ let mut circle = PathBuilder::new();+ circle.push_circle(x, y, 3.0);+ if let Some(path) = circle.finish() {+ pm.stroke_path(&path, &paint, &stroke, transform, None);+ }+ }+ if let Some(path) = line_path(&[+ (104.0, 92.0),+ (104.0, 97.0),+ (94.0, 101.0),+ (104.0, 97.0),+ (114.0, 101.0),+ ]) {+ draw_path(pm, &path, transform, alpha, 2.5);+ }+ }+ Some(TargetModifier::Pixel) => {+ if let Some(rect) = tiny_skia::Rect::from_xywh(94.0, 91.0, 19.0, 19.0) {+ let path = PathBuilder::from_rect(rect);+ let (paint, mut stroke) = cue_stroke(alpha, 2.5);+ stroke.dash = Some(tiny_skia::StrokeDash::new(vec![2.0, 3.0], 0.0).unwrap());+ pm.stroke_path(&path, &paint, &stroke, transform, None);+ }+ }+ Some(TargetModifier::Browser) => {+ let (paint, stroke) = cue_stroke(alpha, 2.5);+ let mut circle = PathBuilder::new();+ circle.push_circle(104.0, 100.0, 10.0);+ if let Some(path) = circle.finish() {+ pm.stroke_path(&path, &paint, &stroke, transform, None);+ }+ for points in [+ &[(94.0, 100.0), (114.0, 100.0)][..],+ &[(104.0, 90.0), (100.0, 100.0), (104.0, 110.0)][..],+ &[(104.0, 90.0), (108.0, 100.0), (104.0, 110.0)][..],+ ] {+ if let Some(path) = line_path(points) {+ draw_path(pm, &path, transform, alpha, 2.5);+ }+ }+ }+ Some(TargetModifier::Desktop) => {+ if let Some(rect) = tiny_skia::Rect::from_xywh(93.0, 90.0, 21.0, 15.0) {+ if let Some(path) =+ rounded_rect_path(rect.x(), rect.y(), rect.width(), rect.height(), 2.0)+ {+ draw_path(pm, &path, transform, alpha, 2.5);+ }+ }+ if let Some(path) = line_path(&[+ (103.5, 105.0),+ (103.5, 110.0),+ (97.0, 110.0),+ (110.0, 110.0),+ ]) {+ draw_path(pm, &path, transform, alpha, 2.5);+ }+ }+ None => {}+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn full_profile_has_twelve_unique_actions() {+ let mut names = std::collections::BTreeSet::new();+ for action in CursorAction::ALL {+ assert!(names.insert(action.as_str()));+ }+ assert_eq!(names.len(), 12);+ }++ #[test]+ fn one_shot_returns_to_idle() {+ let mut state = CursorVisualState::default();+ state.begin(CursorAction::Click, None, Some(TargetModifier::Pixel));+ state.tick(CursorAction::Click.duration_secs() + 0.01);+ assert_eq!(state.resolved_action, CursorAction::Idle);+ assert_eq!(state.target, None);+ }++ #[test]+ fn held_action_waits_for_matching_end() {+ let mut state = CursorVisualState::default();+ state.begin(CursorAction::Text, Some(DeliveryModifier::Foreground), None);+ state.tick(30.0);+ assert_eq!(state.resolved_action, CursorAction::Text);+ state.end(CursorAction::Click);+ assert_eq!(state.resolved_action, CursorAction::Text);+ state.end(CursorAction::Text);+ assert_eq!(state.resolved_action, CursorAction::Text);+ state.tick(0.41);+ assert_eq!(state.resolved_action, CursorAction::Idle);+ }++ #[test]+ fn every_action_renders_pixels_at_one_and_two_x() {+ for action in CursorAction::ALL {+ for scale in [1.0, 2.0] {+ let mut pm = tiny_skia::Pixmap::new(256, 256).unwrap();+ let mut visual = CursorVisualState::default();+ visual.begin(+ action,+ Some(DeliveryModifier::Background),+ Some(TargetModifier::Ax),+ );+ visual.elapsed_secs = action.duration_secs() * 0.4;+ paint_default_theme(&mut pm, &visual, 128.0, 128.0, 0.0, scale, 1.0);+ assert!(+ pm.data().chunks_exact(4).any(|pixel| pixel[3] != 0),+ "{} did not render at {scale}x",+ action.as_str()+ );+ }+ }+ }+}diff --git a/libs/cua-driver/rust/crates/cursor-overlay/src/theme_artifact.rs b/libs/cua-driver/rust/crates/cursor-overlay/src/theme_artifact.rsnew file mode 100644index 0000000000..1bfc9e1793--- /dev/null+++ b/libs/cua-driver/rust/crates/cursor-overlay/src/theme_artifact.rs@@ -0,0 +1,524 @@+//! Bounded compiled cursor-theme artifacts and the local installed-theme store.+//!+//! `.cua-theme` files contain zstd-compressed postcard data behind a fixed+//! header. The privileged overlay never parses Lottie, ZIP, JSON, fonts,+//! expressions, URLs, or arbitrary source paths.++use crate::{CursorAction, CursorVisualState, DeliveryModifier, TargetModifier};+use anyhow::{anyhow, bail, Context, Result};+use serde::{Deserialize, Serialize};+use sha2::{Digest, Sha256};+use std::{+ collections::BTreeMap,+ fs,+ io::{Cursor, Read},+ path::{Path, PathBuf},+ sync::{Arc, Mutex, OnceLock},+};+use tiny_skia::{PixmapPaint, PixmapRef, Transform};++const MAGIC: &[u8; 8] = b"CUATHEM1";+const HEADER_LEN: usize = 8 + 2 + 4 + 32;+const ARTIFACT_VERSION: u16 = 1;+const MAX_COMPRESSED_BYTES: usize = 24 * 1024 * 1024;+const MAX_DECOMPRESSED_BYTES: usize = 96 * 1024 * 1024;+const MAX_TOTAL_FRAMES: usize = 1_000;+const MAX_FRAMES_PER_ANIMATION: usize = 120;+const MAX_TEXT_BYTES: usize = 200;+const CANVAS: u32 = 128;+const FPS: u16 = 30;++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]+pub struct CompiledFrame {+ /// Premultiplied RGBA8 pixels, exactly 128×128.+ pub pixels: Vec<u8>,+}++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]+pub struct CompiledAnimation {+ pub still_frame: u16,+ pub frames: Vec<CompiledFrame>,+}++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]+pub struct CompiledTheme {+ pub id: String,+ pub name: String,+ pub version: String,+ pub author: String,+ pub license: String,+ pub profile: String,+ pub source_hash: [u8; 32],+ pub hotspot: [u16; 2],+ pub actions: BTreeMap<String, CompiledAnimation>,+ pub modifiers: BTreeMap<String, CompiledAnimation>,+}++impl CompiledTheme {+ pub fn content_hash(&self) -> String {+ let mut hasher = Sha256::new();+ if let Ok(bytes) = postcard::to_allocvec(self) {+ hasher.update(bytes);+ }+ hex_digest(hasher.finalize().as_slice())+ }++ pub fn animation_for_action(&self, action: CursorAction) -> Option<&CompiledAnimation> {+ self.actions.get(action.as_str())+ }++ fn modifier(&self, name: &str) -> Option<&CompiledAnimation> {+ self.modifiers.get(name)+ }+}++fn valid_theme_id(value: &str) -> bool {+ value.len() <= MAX_TEXT_BYTES+ && value.contains('.')+ && value.split('.').all(|part| {+ !part.is_empty()+ && part.len() <= 63+ && part+ .bytes()+ .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_'))+ })+}++fn validate_animation(name: &str, animation: &CompiledAnimation) -> Result<usize> {+ if animation.frames.is_empty() || animation.frames.len() > MAX_FRAMES_PER_ANIMATION {+ bail!("animation `{name}` must contain 1..={MAX_FRAMES_PER_ANIMATION} frames");+ }+ if usize::from(animation.still_frame) >= animation.frames.len() {+ bail!("animation `{name}` has an out-of-range still_frame");+ }+ let expected = (CANVAS * CANVAS * 4) as usize;+ for (index, frame) in animation.frames.iter().enumerate() {+ if frame.pixels.len() != expected {+ bail!(+ "animation `{name}` frame {index} is {} bytes; expected {expected}",+ frame.pixels.len()+ );+ }+ }+ Ok(animation.frames.len())+}++pub fn validate_compiled_theme(theme: &CompiledTheme, full: bool) -> Result<()> {+ if !valid_theme_id(&theme.id) {+ bail!("theme id must be a bounded reverse-DNS identifier");+ }+ for (label, value) in [+ ("name", theme.name.as_str()),+ ("version", theme.version.as_str()),+ ("author", theme.author.as_str()),+ ("license", theme.license.as_str()),+ ("profile", theme.profile.as_str()),+ ] {+ if value.is_empty() || value.len() > MAX_TEXT_BYTES {+ bail!("{label} must contain 1..={MAX_TEXT_BYTES} bytes");+ }+ }+ if theme.hotspot[0] >= CANVAS as u16 || theme.hotspot[1] >= CANVAS as u16 {+ bail!("hotspot must be within the {CANVAS}×{CANVAS} canvas");+ }++ if full {+ for action in CursorAction::ALL {+ if !theme.actions.contains_key(action.as_str()) {+ bail!("full profile is missing action `{}`", action.as_str());+ }+ }+ for modifier in [+ "background",+ "foreground",+ "ax",+ "pixel",+ "browser",+ "desktop",+ ] {+ if !theme.modifiers.contains_key(modifier) {+ bail!("full profile is missing modifier `{modifier}`");+ }+ }+ } else if !theme.actions.contains_key("idle") || !theme.actions.contains_key("click") {+ bail!("development profile requires at least `idle` and `click`");+ }++ let mut total_frames = 0usize;+ for (name, animation) in theme.actions.iter().chain(theme.modifiers.iter()) {+ total_frames += validate_animation(name, animation)?;+ if total_frames > MAX_TOTAL_FRAMES {+ bail!("theme exceeds the {MAX_TOTAL_FRAMES}-frame limit");+ }+ }+ Ok(())+}++#[cfg(feature = "theme-authoring")]+pub fn encode_theme(theme: &CompiledTheme) -> Result<Vec<u8>> {+ validate_compiled_theme(theme, theme.profile == crate::THEME_PROFILE)?;+ let payload = postcard::to_allocvec(theme).context("serialize compiled theme")?;+ if payload.len() > MAX_DECOMPRESSED_BYTES {+ bail!("compiled theme exceeds the decoded size limit");+ }+ let compressed =+ zstd::stream::encode_all(Cursor::new(&payload), 12).context("compress compiled theme")?;+ if compressed.len() > MAX_COMPRESSED_BYTES {+ bail!("compiled theme exceeds the compressed size limit");+ }+ let mut output = Vec::with_capacity(HEADER_LEN + compressed.len());+ output.extend_from_slice(MAGIC);+ output.extend_from_slice(&ARTIFACT_VERSION.to_le_bytes());+ output.extend_from_slice(&(payload.len() as u32).to_le_bytes());+ output.extend_from_slice(&theme.source_hash);+ output.extend_from_slice(&compressed);+ Ok(output)+}++pub fn decode_theme(bytes: &[u8]) -> Result<CompiledTheme> {+ if bytes.len() < HEADER_LEN || &bytes[..8] != MAGIC {+ bail!("not a Cua cursor-theme artifact");+ }+ if bytes.len() - HEADER_LEN > MAX_COMPRESSED_BYTES {+ bail!("cursor-theme artifact exceeds the compressed size limit");+ }+ let version = u16::from_le_bytes([bytes[8], bytes[9]]);+ if version != ARTIFACT_VERSION {+ bail!("unsupported cursor-theme artifact version {version}");+ }+ let decoded_len = u32::from_le_bytes([bytes[10], bytes[11], bytes[12], bytes[13]]) as usize;+ if decoded_len > MAX_DECOMPRESSED_BYTES {+ bail!("cursor-theme artifact exceeds the decoded size limit");+ }+ let decoder = zstd::stream::read::Decoder::new(Cursor::new(&bytes[HEADER_LEN..]))+ .context("open cursor-theme payload")?;+ let mut decoded = Vec::with_capacity(decoded_len.min(1024 * 1024));+ decoder+ .take((MAX_DECOMPRESSED_BYTES + 1) as u64)+ .read_to_end(&mut decoded)+ .context("decode cursor-theme payload")?;+ if decoded.len() != decoded_len {+ bail!("cursor-theme decoded length does not match its header");+ }+ let theme: CompiledTheme =+ postcard::from_bytes(&decoded).context("parse cursor-theme payload")?;+ if theme.source_hash != bytes[14..46] {+ bail!("cursor-theme source hash does not match its header");+ }+ validate_compiled_theme(&theme, theme.profile == crate::THEME_PROFILE)?;+ Ok(theme)+}++pub fn theme_store_root() -> Result<PathBuf> {+ if let Some(override_path) = std::env::var_os("CUA_DRIVER_CURSOR_THEME_DIR") {+ let path = PathBuf::from(override_path);+ if !path.is_absolute() {+ bail!("CUA_DRIVER_CURSOR_THEME_DIR must be absolute");+ }+ return Ok(path);+ }+ #[cfg(target_os = "windows")]+ {+ let root = std::env::var_os("LOCALAPPDATA")+ .map(PathBuf::from)+ .ok_or_else(|| anyhow!("LOCALAPPDATA is unavailable"))?;+ return Ok(root.join("Cua Driver").join("cursor-themes"));+ }+ #[cfg(target_os = "macos")]+ {+ let home = std::env::var_os("HOME")+ .map(PathBuf::from)+ .ok_or_else(|| anyhow!("HOME is unavailable"))?;+ return Ok(home+ .join("Library")+ .join("Application Support")+ .join("Cua Driver")+ .join("cursor-themes"));+ }+ #[cfg(all(unix, not(target_os = "macos")))]+ {+ if let Some(root) = std::env::var_os("XDG_DATA_HOME") {+ return Ok(PathBuf::from(root).join("cua-driver").join("cursor-themes"));+ }+ let home = std::env::var_os("HOME")+ .map(PathBuf::from)+ .ok_or_else(|| anyhow!("HOME is unavailable"))?;+ Ok(home+ .join(".local")+ .join("share")+ .join("cua-driver")+ .join("cursor-themes"))+ }+}++fn installed_path(id: &str) -> Result<PathBuf> {+ if !valid_theme_id(id) {+ bail!("invalid cursor theme id");+ }+ Ok(theme_store_root()?.join(format!("{id}.cua-theme")))+}++#[cfg(feature = "theme-authoring")]+pub fn install_artifact(bytes: &[u8]) -> Result<PathBuf> {+ let theme = decode_theme(bytes)?;+ let root = theme_store_root()?;+ fs::create_dir_all(&root).context("create cursor-theme store")?;+ let target = installed_path(&theme.id)?;+ let temporary = root.join(format!(".{}.{}.tmp", theme.id, std::process::id()));+ fs::write(&temporary, bytes).context("write staged cursor theme")?;+ fs::rename(&temporary, &target).context("atomically install cursor theme")?;+ Ok(target)+}++#[cfg(feature = "theme-authoring")]+pub fn uninstall_theme(id: &str) -> Result<bool> {+ if id == crate::DEFAULT_THEME_ID {+ bail!("the embedded default theme cannot be uninstalled");+ }+ let path = installed_path(id)?;+ match fs::remove_file(&path) {+ Ok(()) => Ok(true),+ Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(false),+ Err(error) => Err(error).context("remove installed cursor theme"),+ }+}++pub fn list_installed_themes() -> Result<Vec<String>> {+ let mut ids = vec![crate::DEFAULT_THEME_ID.to_owned()];+ let root = theme_store_root()?;+ let entries = match fs::read_dir(root) {+ Ok(entries) => entries,+ Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(ids),+ Err(error) => return Err(error).context("read cursor-theme store"),+ };+ for entry in entries {+ let entry = entry?;+ if !entry.file_type()?.is_file() {+ continue;+ }+ let name = entry.file_name();+ let name = name.to_string_lossy();+ if let Some(id) = name.strip_suffix(".cua-theme") {+ if valid_theme_id(id) {+ ids.push(id.to_owned());+ }+ }+ }+ ids.sort();+ ids.dedup();+ Ok(ids)+}++fn theme_cache() -> &'static Mutex<BTreeMap<String, Arc<CompiledTheme>>> {+ static CACHE: OnceLock<Mutex<BTreeMap<String, Arc<CompiledTheme>>>> = OnceLock::new();+ CACHE.get_or_init(|| Mutex::new(BTreeMap::new()))+}++pub fn load_installed_theme(id: &str) -> Result<Option<Arc<CompiledTheme>>> {+ if id == crate::DEFAULT_THEME_ID {+ return Ok(None);+ }+ if let Some(theme) = theme_cache()+ .lock()+ .unwrap_or_else(|poisoned| poisoned.into_inner())+ .get(id)+ .cloned()+ {+ return Ok(Some(theme));+ }+ let path = installed_path(id)?;+ let metadata = fs::symlink_metadata(&path).context("locate installed cursor theme")?;+ if !metadata.file_type().is_file() || metadata.file_type().is_symlink() {+ bail!("installed cursor theme is not a regular file");+ }+ if metadata.len() as usize > HEADER_LEN + MAX_COMPRESSED_BYTES {+ bail!("installed cursor theme exceeds the size limit");+ }+ let bytes = fs::read(&path).context("read installed cursor theme")?;+ let theme = decode_theme(&bytes)?;+ if theme.id != id {+ bail!("installed cursor theme id does not match its filename");+ }+ let theme = Arc::new(theme);+ theme_cache()+ .lock()+ .unwrap_or_else(|poisoned| poisoned.into_inner())+ .insert(id.to_owned(), Arc::clone(&theme));+ Ok(Some(theme))+}++pub fn resolve_theme_selection(id: &str) -> Result<Option<Arc<CompiledTheme>>> {+ load_installed_theme(id)+}++fn animation_frame<'a>(+ animation: &'a CompiledAnimation,+ elapsed_secs: f64,+ reduced_motion: bool,+) -> Option<&'a CompiledFrame> {+ let index = if reduced_motion {+ usize::from(animation.still_frame)+ } else {+ ((elapsed_secs.max(0.0) * f64::from(FPS)).floor() as usize) % animation.frames.len()+ };+ animation.frames.get(index)+}++fn draw_layer(+ target: &mut tiny_skia::Pixmap,+ animation: &CompiledAnimation,+ elapsed_secs: f64,+ reduced_motion: bool,+ transform: Transform,+ alpha: f32,+) {+ let Some(frame) = animation_frame(animation, elapsed_secs, reduced_motion) else {+ return;+ };+ let Some(source) = PixmapRef::from_bytes(&frame.pixels, CANVAS, CANVAS) else {+ return;+ };+ target.draw_pixmap(+ 0,+ 0,+ source,+ &PixmapPaint {+ opacity: alpha.clamp(0.0, 1.0),+ ..Default::default()+ },+ transform,+ None,+ );+}++pub fn paint_compiled_theme(+ target: &mut tiny_skia::Pixmap,+ theme: &CompiledTheme,+ visual: &CursorVisualState,+ anchor_x: f32,+ anchor_y: f32,+ heading: f32,+ backing_scale: f32,+ alpha: f32,+) {+ let scale = crate::theme::DISPLAY_SIZE * backing_scale / crate::theme::CANVAS_SIZE;+ let transform = Transform::from_translate(-64.0, -64.0)+ .post_scale(scale, scale)+ .post_rotate((heading - std::f32::consts::FRAC_PI_4).to_degrees())+ .post_translate(anchor_x, anchor_y);+ let reduced = visual.reduced_motion == crate::ReducedMotion::On;+ if let Some(animation) = theme.animation_for_action(visual.resolved_action) {+ draw_layer(+ target,+ animation,+ visual.elapsed_secs,+ reduced,+ transform,+ alpha,+ );+ }+ if let Some(delivery) = visual.delivery {+ let name = match delivery {+ DeliveryModifier::Background => "background",+ DeliveryModifier::Foreground => "foreground",+ };+ if let Some(animation) = theme.modifier(name) {+ draw_layer(+ target,+ animation,+ visual.elapsed_secs,+ reduced,+ transform,+ alpha,+ );+ }+ }+ if let Some(target_modifier) = visual.target {+ let name = match target_modifier {+ TargetModifier::Ax => "ax",+ TargetModifier::Pixel => "pixel",+ TargetModifier::Browser => "browser",+ TargetModifier::Desktop => "desktop",+ };+ if let Some(animation) = theme.modifier(name) {+ draw_layer(+ target,+ animation,+ visual.elapsed_secs,+ reduced,+ transform,+ alpha,+ );+ }+ }+}++fn hex_digest(bytes: &[u8]) -> String {+ const HEX: &[u8; 16] = b"0123456789abcdef";+ let mut output = String::with_capacity(bytes.len() * 2);+ for byte in bytes {+ output.push(HEX[(byte >> 4) as usize] as char);+ output.push(HEX[(byte & 0x0f) as usize] as char);+ }+ output+}++pub fn inspect_artifact(path: &Path) -> Result<CompiledTheme> {+ let bytes = fs::read(path).with_context(|| format!("read {}", path.display()))?;+ decode_theme(&bytes)+}++#[cfg(test)]+mod tests {+ use super::*;++ fn frame() -> CompiledFrame {+ CompiledFrame {+ pixels: vec![0; (CANVAS * CANVAS * 4) as usize],+ }+ }++ fn minimal_theme() -> CompiledTheme {+ let animation = CompiledAnimation {+ still_frame: 0,+ frames: vec![frame()],+ };+ CompiledTheme {+ id: "com.example.test".into(),+ name: "Test".into(),+ version: "1.0.0".into(),+ author: "Example Author".into(),+ license: "MIT".into(),+ profile: "cua-driver-development-v1".into(),+ source_hash: [7; 32],+ hotspot: [55, 30],+ actions: BTreeMap::from([+ ("idle".into(), animation.clone()),+ ("click".into(), animation),+ ]),+ modifiers: BTreeMap::new(),+ }+ }++ #[test]+ fn artifact_round_trip_and_bounds() {+ let theme = minimal_theme();+ let bytes = encode_theme(&theme).unwrap();+ assert_eq!(decode_theme(&bytes).unwrap(), theme);+ assert!(decode_theme(&bytes[..20]).is_err());+ }++ #[test]+ fn full_profile_requires_every_action_and_modifier() {+ let mut theme = minimal_theme();+ theme.profile = crate::THEME_PROFILE.into();+ assert!(validate_compiled_theme(&theme, true).is_err());+ }++ #[test]+ fn rejects_paths_disguised_as_ids() {+ let mut theme = minimal_theme();+ theme.id = "../bad".into();+ assert!(validate_compiled_theme(&theme, false).is_err());+ }+}diff --git a/libs/cua-driver/rust/crates/cursor-theme-cli/Cargo.toml b/libs/cua-driver/rust/crates/cursor-theme-cli/Cargo.tomlnew file mode 100644index 0000000000..0fcea2226c--- /dev/null+++ b/libs/cua-driver/rust/crates/cursor-theme-cli/Cargo.toml@@ -0,0 +1,24 @@+[package]+name = "cursor-theme-cli"+version.workspace = true+edition.workspace = true+license.workspace = true+repository.workspace = true+publish = false++[[bin]]+name = "cua-cursor-theme"+path = "src/main.rs"++[dependencies]+anyhow.workspace = true+cursor-overlay = { path = "../cursor-overlay", features = ["theme-authoring"] }+image.workspace = true+rasterlottie = { version = "0.2.1", default-features = false, features = ["dotlottie"] }+serde.workspace = true+serde_json.workspace = true+sha2.workspace = true+zip = { version = "8.6", default-features = false, features = ["deflate"] }++[dev-dependencies]+tempfile = "3"diff --git a/libs/cua-driver/rust/crates/cursor-theme-cli/src/main.rs b/libs/cua-driver/rust/crates/cursor-theme-cli/src/main.rsnew file mode 100644index 0000000000..cb338c54c9--- /dev/null+++ b/libs/cua-driver/rust/crates/cursor-theme-cli/src/main.rs@@ -0,0 +1,640 @@+//! Short-lived, unprivileged cursor-theme authoring tool.++use anyhow::{anyhow, bail, Context, Result};+use cursor_overlay::{+ encode_theme, inspect_artifact, install_artifact, list_installed_themes, uninstall_theme,+ validate_compiled_theme, CompiledAnimation, CompiledFrame, CompiledTheme, CursorAction,+ THEME_PROFILE,+};+use rasterlottie::{analyze_animation, Animation, RenderConfig, Renderer};+use serde::Deserialize;+use sha2::{Digest, Sha256};+use std::{+ collections::{BTreeMap, BTreeSet},+ env, fs,+ io::{Cursor, Read},+ path::{Component, Path, PathBuf},+};+use zip::ZipArchive;++const MAX_ARCHIVE_BYTES: usize = 24 * 1024 * 1024;+const MAX_ENTRY_BYTES: usize = 4 * 1024 * 1024;+const MAX_TOTAL_BYTES: usize = 32 * 1024 * 1024;+const MAX_ENTRIES: usize = 80;+const CANVAS: u32 = 128;+const FPS: f32 = 30.0;+const MAX_FRAMES: usize = 120;++#[derive(Debug, Deserialize)]+struct ThemeManifest {+ schema: String,+ id: String,+ name: String,+ version: String,+ author: String,+ license: String,+ compatibility: Compatibility,+ canvas: Canvas,+ hotspot: Hotspot,+ actions: BTreeMap<String, AnimationRef>,+ modifiers: BTreeMap<String, AnimationRef>,+ #[serde(default)]+ variants: BTreeMap<String, String>,+}++#[derive(Debug, Deserialize)]+struct Compatibility {+ profile: String,+ semantics: u32,+}++#[derive(Debug, Deserialize)]+struct Canvas {+ width: u32,+ height: u32,+ fps: f32,+}++#[derive(Debug, Deserialize)]+struct Hotspot {+ x: u16,+ y: u16,+}++#[derive(Debug, Deserialize)]+struct AnimationRef {+ animation: String,+ #[serde(default)]+ still_frame: u16,+}++#[derive(Debug, Deserialize)]+struct DotLottieManifest {+ animations: Vec<DotLottieAnimation>,+}++#[derive(Debug, Deserialize)]+struct DotLottieAnimation {+ id: String,+}++fn usage() -> &'static str {+ "Usage:+ cua-driver cursor-theme validate <source.lottie> [--development]+ cua-driver cursor-theme build <source.lottie> --output <theme.cua-theme> [--development]+ cua-driver cursor-theme inspect <theme.cua-theme> [--json]+ cua-driver cursor-theme preview <theme.cua-theme> --output <directory>+ cua-driver cursor-theme install <theme.cua-theme>+ cua-driver cursor-theme list [--json]+ cua-driver cursor-theme uninstall <theme-id>"+}++fn main() {+ if let Err(error) = run() {+ eprintln!("cua-driver cursor-theme: {error:#}");+ std::process::exit(1);+ }+}++fn run() -> Result<()> {+ let args: Vec<String> = env::args().skip(1).collect();+ let Some(command) = args.first().map(String::as_str) else {+ bail!(usage());+ };+ match command {+ "validate" => {+ let source = required_path(&args, 1, "source .lottie")?;+ let full = !args.iter().any(|value| value == "--development");+ let theme = compile_source(&source, full)?;+ println!(+ "valid: {} {} ({} actions, {} modifiers, profile {})",+ theme.id,+ theme.version,+ theme.actions.len(),+ theme.modifiers.len(),+ theme.profile+ );+ }+ "build" => {+ let source = required_path(&args, 1, "source .lottie")?;+ let output = flag_path(&args, "--output")?;+ let full = !args.iter().any(|value| value == "--development");+ let theme = compile_source(&source, full)?;+ let bytes = encode_theme(&theme)?;+ fs::write(&output, bytes).with_context(|| format!("write {}", output.display()))?;+ println!(+ "built {} {} → {}",+ theme.id,+ theme.version,+ output.display()+ );+ }+ "inspect" => {+ let artifact = required_path(&args, 1, "compiled theme")?;+ let theme = inspect_artifact(&artifact)?;+ if args.iter().any(|value| value == "--json") {+ println!("{}", serde_json::to_string_pretty(&theme)?);+ } else {+ println!("id: {}", theme.id);+ println!("name: {}", theme.name);+ println!("version: {}", theme.version);+ println!("author: {}", theme.author);+ println!("license: {}", theme.license);+ println!("profile: {}", theme.profile);+ println!("content hash: {}", theme.content_hash());+ println!("actions: {}", theme.actions.len());+ println!("modifiers: {}", theme.modifiers.len());+ }+ }+ "preview" => {+ let artifact = required_path(&args, 1, "compiled theme")?;+ let output = flag_path(&args, "--output")?;+ preview(&inspect_artifact(&artifact)?, &output)?;+ println!("preview written to {}", output.display());+ }+ "install" => {+ let artifact = required_path(&args, 1, "compiled theme")?;+ let bytes =+ fs::read(&artifact).with_context(|| format!("read {}", artifact.display()))?;+ let target = install_artifact(&bytes)?;+ println!("installed {}", target.display());+ }+ "list" => {+ let themes = list_installed_themes()?;+ if args.iter().any(|value| value == "--json") {+ println!("{}", serde_json::to_string_pretty(&themes)?);+ } else {+ for theme in themes {+ println!("{theme}");+ }+ }+ }+ "uninstall" => {+ let id = args.get(1).ok_or_else(|| anyhow!("missing theme id"))?;+ if uninstall_theme(id)? {+ println!("uninstalled {id}");+ } else {+ println!("theme {id} was not installed");+ }+ }+ "--help" | "-h" | "help" => println!("{}", usage()),+ other => bail!("unknown cursor-theme command `{other}`\n\n{}", usage()),+ }+ Ok(())+}++fn required_path(args: &[String], index: usize, label: &str) -> Result<PathBuf> {+ args.get(index)+ .filter(|value| !value.starts_with('-'))+ .map(PathBuf::from)+ .ok_or_else(|| anyhow!("missing {label}"))+}++fn flag_path(args: &[String], flag: &str) -> Result<PathBuf> {+ let index = args+ .iter()+ .position(|value| value == flag)+ .ok_or_else(|| anyhow!("missing required {flag}"))?;+ args.get(index + 1)+ .filter(|value| !value.starts_with('-'))+ .map(PathBuf::from)+ .ok_or_else(|| anyhow!("missing value for {flag}"))+}++fn read_source_archive(path: &Path) -> Result<(Vec<u8>, BTreeMap<String, Vec<u8>>)> {+ let bytes = fs::read(path).with_context(|| format!("read {}", path.display()))?;+ if bytes.len() > MAX_ARCHIVE_BYTES {+ bail!("source archive exceeds the {MAX_ARCHIVE_BYTES}-byte limit");+ }+ let mut archive = ZipArchive::new(Cursor::new(&bytes)).context("open dotLottie archive")?;+ if archive.len() > MAX_ENTRIES {+ bail!("source archive exceeds the {MAX_ENTRIES}-entry limit");+ }+ let mut entries = BTreeMap::new();+ let mut total = 0usize;+ for index in 0..archive.len() {+ let mut entry = archive.by_index(index).context("read archive entry")?;+ if entry.is_dir() {+ continue;+ }+ let Some(path) = entry.enclosed_name() else {+ bail!("archive entry contains an absolute or parent path");+ };+ if path+ .components()+ .any(|component| !matches!(component, Component::Normal(_)))+ {+ bail!("archive entry contains a non-normal path segment");+ }+ if let Some(mode) = entry.unix_mode() {+ let file_type = mode & 0o170000;+ if file_type != 0 && file_type != 0o100000 {+ bail!("archive contains a symlink or non-regular entry");+ }+ }+ let name = path.to_string_lossy().replace('\\', "/");+ let allowed = name == "manifest.json"+ || name == "cua/theme.json"+ || (name.starts_with("a/") && name.ends_with(".json"));+ if !allowed {+ bail!("unsupported archive entry `{name}`");+ }+ if entries.contains_key(&name) {+ bail!("duplicate archive entry `{name}`");+ }+ let declared = usize::try_from(entry.size()).unwrap_or(usize::MAX);+ if declared > MAX_ENTRY_BYTES {+ bail!("archive entry `{name}` exceeds the per-entry limit");+ }+ let mut data = Vec::with_capacity(declared.min(64 * 1024));+ entry+ .by_ref()+ .take((MAX_ENTRY_BYTES + 1) as u64)+ .read_to_end(&mut data)+ .with_context(|| format!("read archive entry `{name}`"))?;+ if data.len() > MAX_ENTRY_BYTES {+ bail!("archive entry `{name}` exceeds the per-entry limit");+ }+ total = total.saturating_add(data.len());+ if total > MAX_TOTAL_BYTES {+ bail!("archive exceeds the decompressed-size limit");+ }+ entries.insert(name, data);+ }+ Ok((bytes, entries))+}++fn parse_json<T: for<'de> Deserialize<'de>>(bytes: &[u8], name: &str) -> Result<T> {+ let text = std::str::from_utf8(bytes).with_context(|| format!("{name} is not UTF-8"))?;+ serde_json::from_str(text).with_context(|| format!("parse {name}"))+}++fn compile_source(path: &Path, full: bool) -> Result<CompiledTheme> {+ let (source, entries) = read_source_archive(path)?;+ let manifest_bytes = entries+ .get("cua/theme.json")+ .ok_or_else(|| anyhow!("archive is missing cua/theme.json"))?;+ let manifest: ThemeManifest = parse_json(manifest_bytes, "cua/theme.json")?;+ if manifest.schema != "cua.cursor-theme/1" {+ bail!("unsupported source schema `{}`", manifest.schema);+ }+ if manifest.compatibility.semantics != 1 {+ bail!(+ "unsupported cursor semantic version {}",+ manifest.compatibility.semantics+ );+ }+ if manifest.canvas.width != CANVAS+ || manifest.canvas.height != CANVAS+ || (manifest.canvas.fps - FPS).abs() > f32::EPSILON+ {+ bail!("Cua cursor profile v1 requires a 128×128 canvas at 30 fps");+ }+ if full && manifest.compatibility.profile != THEME_PROFILE {+ bail!("full validation requires profile `{THEME_PROFILE}`");+ }+ if !manifest.variants.is_empty() {+ bail!(+ "cursor-theme variants are not supported by profile v1; publish each visual variant as a separate theme id"+ );+ }++ // Parse the standard manifest too: it must exist and be valid JSON. The+ // Cua manifest remains authoritative for semantic mapping.+ let standard = entries+ .get("manifest.json")+ .ok_or_else(|| anyhow!("archive is missing manifest.json"))?;+ let standard: DotLottieManifest = parse_json(standard, "manifest.json")?;++ let referenced: BTreeSet<&str> = manifest+ .actions+ .values()+ .chain(manifest.modifiers.values())+ .map(|item| item.animation.as_str())+ .collect();+ let standard_ids: BTreeSet<&str> = standard+ .animations+ .iter()+ .map(|animation| animation.id.as_str())+ .collect();+ if standard_ids.len() != standard.animations.len() {+ bail!("manifest.json contains duplicate animation ids");+ }+ for id in &referenced {+ if !standard_ids.contains(id) {+ bail!("Cua semantic manifest references `{id}`, which is absent from manifest.json");+ }+ }+ let mut compiled = BTreeMap::new();+ for id in referenced {+ let name = format!("a/{id}.json");+ let source = entries+ .get(&name)+ .ok_or_else(|| anyhow!("semantic manifest references missing animation `{id}`"))?;+ compiled.insert(id.to_owned(), compile_animation(source, id)?);+ }++ let mut actions = BTreeMap::new();+ for (name, reference) in manifest.actions {+ if !CursorAction::ALL+ .iter()+ .any(|action| action.as_str() == name)+ {+ bail!("unknown action `{name}`");+ }+ actions.insert(+ name,+ with_still_frame(+ compiled+ .get(&reference.animation)+ .cloned()+ .ok_or_else(|| anyhow!("missing compiled action"))?,+ reference.still_frame,+ )?,+ );+ }+ let allowed_modifiers = [+ "background",+ "foreground",+ "ax",+ "pixel",+ "browser",+ "desktop",+ ];+ let mut modifiers = BTreeMap::new();+ for (name, reference) in manifest.modifiers {+ if !allowed_modifiers.contains(&name.as_str()) {+ bail!("unknown modifier `{name}`");+ }+ modifiers.insert(+ name,+ with_still_frame(+ compiled+ .get(&reference.animation)+ .cloned()+ .ok_or_else(|| anyhow!("missing compiled modifier"))?,+ reference.still_frame,+ )?,+ );+ }+ let mut hasher = Sha256::new();+ hasher.update(&source);+ let source_hash: [u8; 32] = hasher.finalize().into();+ let theme = CompiledTheme {+ id: manifest.id,+ name: manifest.name,+ version: manifest.version,+ author: manifest.author,+ license: manifest.license,+ profile: manifest.compatibility.profile,+ source_hash,+ hotspot: [manifest.hotspot.x, manifest.hotspot.y],+ actions,+ modifiers,+ };+ validate_compiled_theme(&theme, full)?;+ Ok(theme)+}++fn with_still_frame(+ mut animation: CompiledAnimation,+ still_frame: u16,+) -> Result<CompiledAnimation> {+ if usize::from(still_frame) >= animation.frames.len() {+ bail!("still_frame {still_frame} is outside the animation");+ }+ animation.still_frame = still_frame;+ Ok(animation)+}++fn compile_animation(bytes: &[u8], id: &str) -> Result<CompiledAnimation> {+ let text =+ std::str::from_utf8(bytes).with_context(|| format!("animation `{id}` is not UTF-8"))?;+ let animation =+ Animation::from_json_str(text).with_context(|| format!("parse animation `{id}`"))?;+ if animation.width != CANVAS+ || animation.height != CANVAS+ || (animation.frame_rate - FPS).abs() > f32::EPSILON+ {+ bail!("animation `{id}` must be 128×128 at 30 fps");+ }+ let report = analyze_animation(&animation);+ if !report.is_supported() {+ bail!("animation `{id}` uses unsupported Lottie features: {report}");+ }+ let count = animation.duration_frames().ceil() as usize;+ if count == 0 || count > MAX_FRAMES {+ bail!("animation `{id}` must contain 1..={MAX_FRAMES} frames");+ }+ let renderer = Renderer::default();+ let mut frames = Vec::with_capacity(count);+ for index in 0..count {+ let frame = renderer+ .render_frame(+ &animation,+ animation.in_point + index as f32,+ RenderConfig::default(),+ )+ .with_context(|| format!("render animation `{id}` frame {index}"))?;+ if frame.width != CANVAS || frame.height != CANVAS {+ bail!("renderer returned an unexpected canvas for `{id}`");+ }+ frames.push(CompiledFrame {+ pixels: premultiply_rgba(frame.pixels),+ });+ }+ Ok(CompiledAnimation {+ still_frame: 0,+ frames,+ })+}++fn premultiply_rgba(mut pixels: Vec<u8>) -> Vec<u8> {+ for pixel in pixels.chunks_exact_mut(4) {+ let alpha = u16::from(pixel[3]);+ pixel[0] = ((u16::from(pixel[0]) * alpha + 127) / 255) as u8;+ pixel[1] = ((u16::from(pixel[1]) * alpha + 127) / 255) as u8;+ pixel[2] = ((u16::from(pixel[2]) * alpha + 127) / 255) as u8;+ }+ pixels+}++fn preview(theme: &CompiledTheme, output: &Path) -> Result<()> {+ fs::create_dir_all(output).with_context(|| format!("create {}", output.display()))?;+ for (name, animation) in theme.actions.iter().chain(theme.modifiers.iter()) {+ let frame = animation+ .frames+ .get(usize::from(animation.still_frame))+ .ok_or_else(|| anyhow!("missing still frame for `{name}`"))?;+ // The compiled pixels are premultiplied; PNG expects straight RGBA.+ let pixels = unpremultiply_rgba(frame.pixels.clone());+ let path = output.join(format!("{name}.png"));+ image::save_buffer_with_format(+ &path,+ &pixels,+ CANVAS,+ CANVAS,+ image::ColorType::Rgba8,+ image::ImageFormat::Png,+ )+ .with_context(|| format!("write {}", path.display()))?;+ }+ Ok(())+}++fn unpremultiply_rgba(mut pixels: Vec<u8>) -> Vec<u8> {+ for pixel in pixels.chunks_exact_mut(4) {+ let alpha = u16::from(pixel[3]);+ if alpha == 0 {+ pixel[0] = 0;+ pixel[1] = 0;+ pixel[2] = 0;+ continue;+ }+ pixel[0] = ((u16::from(pixel[0]) * 255 + alpha / 2) / alpha).min(255) as u8;+ pixel[1] = ((u16::from(pixel[1]) * 255 + alpha / 2) / alpha).min(255) as u8;+ pixel[2] = ((u16::from(pixel[2]) * 255 + alpha / 2) / alpha).min(255) as u8;+ }+ pixels+}++#[cfg(test)]+mod tests {+ use super::*;+ use std::io::Write;+ use zip::{write::SimpleFileOptions, ZipWriter};++ #[test]+ fn premultiplication_round_trip_is_bounded() {+ let original = vec![200, 100, 50, 128, 0, 0, 0, 0];+ let round_trip = unpremultiply_rgba(premultiply_rgba(original.clone()));+ assert!(round_trip[0].abs_diff(original[0]) <= 1);+ assert!(round_trip[1].abs_diff(original[1]) <= 1);+ assert!(round_trip[2].abs_diff(original[2]) <= 1);+ assert_eq!(&round_trip[4..], &[0, 0, 0, 0]);+ }++ #[test]+ fn usage_lists_every_management_command() {+ for command in [+ "validate",+ "build",+ "inspect",+ "preview",+ "install",+ "list",+ "uninstall",+ ] {+ assert!(usage().contains(command));+ }+ }++ fn source_archive(standard_id: &str, variants: &str) -> tempfile::NamedTempFile {+ let file = tempfile::Builder::new()+ .suffix(".lottie")+ .tempfile()+ .unwrap();+ let mut archive = ZipWriter::new(file.reopen().unwrap());+ let options = SimpleFileOptions::default();+ let standard = format!(r#"{{"version":"2","animations":[{{"id":"{standard_id}"}}]}}"#);+ let semantic = format!(+ r#"{{+ "schema":"cua.cursor-theme/1",+ "id":"com.example.test",+ "name":"Test",+ "version":"1.0.0",+ "author":"Example Author",+ "license":"MIT",+ "compatibility":{{"profile":"cua-driver-development-v1","semantics":1}},+ "canvas":{{"width":128,"height":128,"fps":30}},+ "hotspot":{{"x":55,"y":30}},+ "actions":{{+ "idle":{{"animation":"base","still_frame":0}},+ "click":{{"animation":"base","still_frame":0}}+ }},+ "modifiers":{{}},+ "variants":{variants}+ }}"#+ );+ let animation = r#"{"v":"5.12.2","fr":30,"ip":0,"op":1,"w":128,"h":128,"nm":"base","ddd":0,"assets":[],"layers":[]}"#;+ for (name, contents) in [+ ("manifest.json", standard.as_str()),+ ("cua/theme.json", semantic.as_str()),+ ("a/base.json", animation),+ ] {+ archive.start_file(name, options).unwrap();+ archive.write_all(contents.as_bytes()).unwrap();+ }+ archive.finish().unwrap();+ file+ }++ fn archive_with_entries(entries: &[(&str, &[u8])]) -> tempfile::NamedTempFile {+ let file = tempfile::Builder::new()+ .suffix(".lottie")+ .tempfile()+ .unwrap();+ let mut archive = ZipWriter::new(file.reopen().unwrap());+ let options = SimpleFileOptions::default();+ for (name, contents) in entries {+ archive.start_file(*name, options).unwrap();+ archive.write_all(contents).unwrap();+ }+ archive.finish().unwrap();+ file+ }++ #[test]+ fn compiles_a_bounded_development_theme() {+ let source = source_archive("base", "{}");+ let theme = compile_source(source.path(), false).unwrap();+ assert_eq!(theme.id, "com.example.test");+ assert_eq!(theme.author, "Example Author");+ assert_eq!(theme.license, "MIT");+ assert_eq!(theme.actions.len(), 2);+ assert!(encode_theme(&theme).is_ok());+ }++ #[test]+ fn rejects_semantic_references_missing_from_standard_manifest() {+ let source = source_archive("different", "{}");+ assert!(compile_source(source.path(), false)+ .unwrap_err()+ .to_string()+ .contains("absent from manifest.json"));+ }++ #[test]+ fn rejects_noop_variants_in_profile_v1() {+ let source = source_archive("base", r#"{"dark":"dark"}"#);+ assert!(compile_source(source.path(), false)+ .unwrap_err()+ .to_string()+ .contains("variants are not supported"));+ }++ #[test]+ fn rejects_parent_paths() {+ let traversal = archive_with_entries(&[("../theme.json", b"{}")]);+ assert!(read_source_archive(traversal.path())+ .unwrap_err()+ .to_string()+ .contains("absolute or parent path"));+ }++ #[test]+ fn rejects_unsupported_and_oversized_entries() {+ let unsupported = archive_with_entries(&[("images/pointer.png", b"not-an-image")]);+ assert!(read_source_archive(unsupported.path())+ .unwrap_err()+ .to_string()+ .contains("unsupported archive entry"));++ let oversized = vec![0_u8; MAX_ENTRY_BYTES + 1];+ let oversized = archive_with_entries(&[("a/huge.json", oversized.as_slice())]);+ assert!(read_source_archive(oversized.path())+ .unwrap_err()+ .to_string()+ .contains("per-entry limit"));+ }+}diff --git a/libs/cua-driver/rust/crates/platform-linux/src/overlay.rs b/libs/cua-driver/rust/crates/platform-linux/src/overlay.rsindex 563a784121..da8d96e1dd 100644--- a/libs/cua-driver/rust/crates/platform-linux/src/overlay.rs+++ b/libs/cua-driver/rust/crates/platform-linux/src/overlay.rs@@ -27,8 +27,7 @@ use std::time::{Duration, Instant};#[cfg(target_os = "linux")]use cursor_overlay::ZOrderEnforcer;use cursor_overlay::{- CursorConfig, CursorKey, KeyedOverlayCommand, OverlayCommand, OverlayMsg, Palette,- RenderStateCore,+ CursorConfig, CursorKey, KeyedOverlayCommand, OverlayCommand, OverlayMsg, RenderStateCore,};// ── Global channel ────────────────────────────────────────────────────────@@ -67,9 +66,8 @@ struct RenderMap {}fn render_state_for_key(template: &CursorConfig, key: &str) -> RenderState {- let mut rs = RenderState::new(template.clone());- rs.core.palette = Palette::for_instance(key);- rs+ let _ = key;+ RenderState::new(template.clone())}fn apply_msg(map: &mut RenderMap, msg: OverlayMsg) -> Option<CursorKey> {@@ -125,6 +123,38 @@ pub fn init(cfg: CursorConfig) {last_active: None,});});+ cua_driver_core::cursor_events::install_cursor_event_sink(std::sync::Arc::new(+ |event: cua_driver_core::cursor_events::CursorEvent| {+ use cua_driver_core::cursor_events::{CursorEvent, CursorEventPhase};+ let (session, cmd) = match event {+ CursorEvent::Action {+ session,+ phase: CursorEventPhase::Begin,+ semantics,+ } => (+ session,+ OverlayCommand::BeginAction {+ action: semantics.action,+ delivery: semantics.delivery,+ target: semantics.target,+ },+ ),+ CursorEvent::Action {+ session,+ phase: CursorEventPhase::End,+ semantics,+ } => (session, OverlayCommand::EndAction(semantics.action)),+ CursorEvent::SelectTheme { session, selection } => (+ session,+ OverlayCommand::SetTheme {+ theme_id: selection.theme_id,+ reduced_motion: selection.reduced_motion,+ },+ ),+ };+ send_command_for(session, cmd);+ },+ ));}pub fn send_command(cmd: OverlayCommand) {@@ -218,6 +248,25 @@ pub fn current_motion_for(key: &str) -> cursor_overlay::MotionConfig {.unwrap_or_default()}+pub fn current_theme_state_for(+ key: &str,+) -> Option<(+ String,+ String,+ String,+ Option<String>,+ cursor_overlay::CursorVisualState,+)> {+ let guard = RENDER.lock().ok()?;+ let map = guard.as_ref()?;+ let state = map+ .cursors+ .get(key)+ .or_else(|| map.cursors.get("default"))?;+ let (id, version, profile, fallback) = state.core.active_theme_metadata();+ Some((id, version, profile, fallback, state.core.visual.clone()))+}+fn seed_start_if_sentinel(key: &CursorKey, target_x: f64, target_y: f64) -> bool {const SEED_OFFSET: f64 = 140.0;let mut guard = RENDER.lock().unwrap();@@ -1329,7 +1378,10 @@ mod tests {&mut map,Some(OverlayMsg::Cmd(KeyedOverlayCommand {key: "other".to_owned(),- cmd: OverlayCommand::SetPalette(Palette::for_instance("other")),+ cmd: OverlayCommand::SetTheme {+ theme_id: cursor_overlay::DEFAULT_THEME_ID.to_owned(),+ reduced_motion: cursor_overlay::ReducedMotion::Auto,+ },})),&rx,0.1,diff --git a/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs b/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rsindex b859c7e643..08526ab3f4 100644--- a/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs+++ b/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs@@ -5872,404 +5872,230 @@ impl Tool for MoveCursorTool {// ── set_agent_cursor_enabled ──────────────────────────────────────────────────-pub struct SetAgentCursorEnabledTool {+pub struct SetAgentCursorEnabledV2Tool {state: Arc<ToolState>,}-static SCE_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();+static CURSOR_ENABLED_V2_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();#[async_trait]-impl Tool for SetAgentCursorEnabledTool {+impl Tool for SetAgentCursorEnabledV2Tool {fn def(&self) -> &ToolDef {- SCE_DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_enabled".into(),- description: "Show or hide the agent cursor overlay.".into(),- input_schema: json!({"type":"object","required":["enabled"],"properties":{- "enabled":{"type":"boolean"},"session":{"type":"string"},"cursor_id":{"type":"string"}- },"additionalProperties":false}),- read_only: false, destructive: false, idempotent: true, open_world: false,- })+ CURSOR_ENABLED_V2_DEF.get_or_init(|| canonical_cursor_def("set_agent_cursor_enabled"))}+async fn invoke(&self, args: Value) -> ToolResult {- use cua_driver_core::tool_args::ArgsExt;- let enabled = match args.require_bool("enabled") {- Ok(v) => v,- Err(e) => return e,+ let enabled = match args.get("enabled").and_then(Value::as_bool) {+ Some(value) => value,+ None => return ToolResult::error("Missing required boolean field `enabled`."),};- let cursor_id = resolve_cursor_key(&args);- self.state.cursor_registry.set_enabled(&cursor_id, enabled);+ let session = resolve_cursor_key(&args);+ self.state.cursor_registry.set_enabled(&session, enabled);crate::overlay::send_command_for(- cursor_id.clone(),+ session.clone(),cursor_overlay::OverlayCommand::SetEnabled(enabled),);ToolResult::text(format!(- "Agent cursor '{cursor_id}' {}.",+ "Agent cursor for session '{session}' {}.",if enabled { "enabled" } else { "disabled" }))+ .with_structured(json!({"session":session,"enabled":enabled}))}}-// ── set_agent_cursor_motion ───────────────────────────────────────────────────+pub struct SetAgentCursorMotionV2Tool;-pub struct SetAgentCursorMotionTool {- state: Arc<ToolState>,-}+static CURSOR_MOTION_V2_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();-static CURSOR_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();+fn cursor_number(value: Option<&Value>) -> Option<f64> {+ value.and_then(|value| {+ value+ .as_f64()+ .or_else(|| value.as_i64().map(|integer| integer as f64))+ })+}#[async_trait]-impl Tool for SetAgentCursorMotionTool {+impl Tool for SetAgentCursorMotionV2Tool {fn def(&self) -> &ToolDef {- CURSOR_DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_motion".into(),- description: format!("Configure the visual appearance and motion curve of an agent cursor instance.\n\n\- - cursor_id: instance name (default='default')\n\- - cursor_icon: built-in ({}) or a path to a PNG/JPEG/SVG/ICO file; '' reverts to the default cursor\n\- - cursor_color: hex color e.g. '#00FFFF' or CSS name\n\- - cursor_label: short text shown near the cursor\n\- - cursor_size: dot radius in points (default=16)\n\- - cursor_opacity: 0.0–1.0 (default=0.85)\n\n\- Motion curve (Bezier):\n\- - arc_size: perpendicular deflection as fraction of path length [0,1]. Default 0.25\n\- - spring: settle damping [0.3,1.0]; 1.0=no overshoot. Default 0.72\n\- - glide_duration_ms: fixed flight duration per move [50,5000]; omit for speed-based\n\- - dwell_after_click_ms: pause after click ripple [0,5000]. Default 80\n\- - idle_hide_ms: auto-hide delay [0,60000]; 0=never. Default 20000",- cursor_overlay::BuiltinShape::names_help()),- input_schema: json!({- "type":"object","properties":{- "session":{"type":"string"},- "cursor_id":{"type":"string"},- "cursor_icon":{"type":"string"},- "cursor_color":{"type":"string"},- "cursor_label":{"type":"string"},- "cursor_size":{"type":"number"},- "cursor_opacity":{"type":"number"},- "start_handle":{"type":"number","description":"Start-handle fraction [0,1]. Default 0.3."},- "end_handle":{"type":"number","description":"End-handle fraction [0,1]. Default 0.3."},- "arc_size":{"type":"number","description":"Arc deflection as fraction of path length [0,1]. Default 0.25."},- "arc_flow":{"type":"number","description":"Asymmetry bias [-1,1]. Default 0.0."},- "spring":{"type":"number","description":"Settle damping [0.3,1.0]. Default 0.72."},- "glide_duration_ms":{"type":"number","minimum":50,"maximum":5000},- "dwell_after_click_ms":{"type":"number","minimum":0,"maximum":5000},- "idle_hide_ms":{"type":"number","minimum":0,"maximum":60000},- "turn_radius":{"type":"number","minimum":1,"maximum":1000}- },"additionalProperties":false- }),- read_only: false, destructive: false, idempotent: true, open_world: false,- })+ CURSOR_MOTION_V2_DEF.get_or_init(|| canonical_cursor_def("set_agent_cursor_motion"))}- async fn invoke(&self, args: Value) -> ToolResult {- fn num(value: Option<&Value>) -> Option<f64> {- value.and_then(|value| {- value- .as_f64()- .or_else(|| value.as_i64().map(|integer| integer as f64))- })- }- let cursor_id = resolve_cursor_key(&args);- // Resolve `cursor_icon` (built-in name or image path — same vocabulary as- // the CLI flags) to a shape override and dispatch it, so the overlay- // actually changes instead of just recording the string.- let mut shape_cmd: Option<cursor_overlay::OverlayCommand> = None;- if let Some(icon) = args.opt_str("cursor_icon") {- let icon_owned = icon.clone();- match tokio::task::spawn_blocking(move || {- cursor_overlay::resolve_cursor_icon(&icon_owned)- })- .await- {- Ok(Ok(resolution)) => {- shape_cmd = Some(cursor_overlay::OverlayCommand::from_cursor_icon(resolution))- }- Ok(Err(e)) => return ToolResult::error(format!("Invalid cursor_icon: {e}")),- Err(e) => return ToolResult::error(format!("Task error: {e}")),- }- }- self.state.cursor_registry.update_config(&cursor_id, |cfg| {- if let Some(v) = args.opt_str("cursor_icon") {- cfg.cursor_icon = Some(v);- }- if let Some(v) = args.opt_str("cursor_color") {- cfg.cursor_color = Some(v);- }- if let Some(v) = args.opt_str("cursor_label") {- cfg.cursor_label = Some(v);- }- if let Some(v) = args.opt_f64("cursor_size") {- cfg.cursor_size = Some(v);- }- if let Some(v) = args.opt_f64("cursor_opacity") {- cfg.cursor_opacity = Some(v.clamp(0.0, 1.0));- }- });- if let Some(cmd) = shape_cmd {- crate::overlay::send_command_for(cursor_id.clone(), cmd);- }-- let motion = crate::overlay::current_motion_for(&cursor_id).with_overrides(- num(args.get("start_handle")),- num(args.get("end_handle")),- num(args.get("arc_size")),- num(args.get("arc_flow")),- num(args.get("spring")),- num(args.get("glide_duration_ms")),- num(args.get("dwell_after_click_ms")),- num(args.get("idle_hide_ms")),+ async fn invoke(&self, args: Value) -> ToolResult {+ let session = resolve_cursor_key(&args);+ let current = crate::overlay::current_motion_for(&session);+ let motion = current.with_overrides(+ cursor_number(args.get("start_handle")),+ cursor_number(args.get("end_handle")),+ cursor_number(args.get("arc_size")),+ cursor_number(args.get("arc_flow")),+ cursor_number(args.get("spring")),+ cursor_number(args.get("glide_duration_ms")),+ cursor_number(args.get("dwell_after_click_ms")),+ cursor_number(args.get("idle_hide_ms")),None,- num(args.get("turn_radius")),+ cursor_number(args.get("turn_radius")),);crate::overlay::send_command_for(- cursor_id.clone(),+ session.clone(),cursor_overlay::OverlayCommand::SetMotion(motion.clone()),);-ToolResult::text(format!(- "Cursor '{cursor_id}' config updated. Motion: arc={:.2} spring={:.2} glide={}ms dwell={}ms idle={}ms",- motion.arc_size,- motion.spring,- motion.glide_duration_ms as u32,- motion.dwell_after_click_ms as u32,- motion.idle_hide_ms as u32,+ "Agent cursor motion updated for session '{session}'."))- .with_structured(json!({- "cursor_id": cursor_id,- "start_handle": motion.start_handle,- "end_handle": motion.end_handle,- "arc_size": motion.arc_size,- "arc_flow": motion.arc_flow,- "spring": motion.spring,- "glide_duration_ms": motion.glide_duration_ms,- "dwell_after_click_ms": motion.dwell_after_click_ms,- "idle_hide_ms": motion.idle_hide_ms,- "turn_radius": motion.turn_radius,- }))+ .with_structured(json!({"session":session,"motion":{+ "start_handle":motion.start_handle,+ "end_handle":motion.end_handle,+ "arc_size":motion.arc_size,+ "arc_flow":motion.arc_flow,+ "spring":motion.spring,+ "glide_duration_ms":motion.glide_duration_ms,+ "dwell_after_click_ms":motion.dwell_after_click_ms,+ "idle_hide_ms":motion.idle_hide_ms,+ "turn_radius":motion.turn_radius+ }}))}}-// ── get_agent_cursor_state ────────────────────────────────────────────────────--pub struct GetAgentCursorStateTool {+pub struct SetAgentCursorThemeTool {state: Arc<ToolState>,}-static GCSTATE_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();+static CURSOR_THEME_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();++fn cursor_reduced_motion(value: Option<&str>) -> cursor_overlay::ReducedMotion {+ match value {+ Some("on") => cursor_overlay::ReducedMotion::On,+ Some("off") => cursor_overlay::ReducedMotion::Off,+ _ => cursor_overlay::ReducedMotion::Auto,+ }+}#[async_trait]-impl Tool for GetAgentCursorStateTool {+impl Tool for SetAgentCursorThemeTool {fn def(&self) -> &ToolDef {- GCSTATE_DEF.get_or_init(|| ToolDef {- name: "get_agent_cursor_state".into(),- description: "Return the current state of all agent cursor instances.".into(),- input_schema: json!({"type":"object","properties":{"session":{"type":"string"},"cursor_id":{"type":"string"}},"additionalProperties":false}),- read_only: true, destructive: false, idempotent: true, open_world: false,- })+ CURSOR_THEME_DEF.get_or_init(|| canonical_cursor_def("set_agent_cursor_theme"))}+async fn invoke(&self, args: Value) -> ToolResult {- let cursor_id = resolve_cursor_key(&args);- let states = if args.get("session").is_some() || args.get("cursor_id").is_some() {- vec![self.state.cursor_registry.get_or_create(&cursor_id)]- } else {- self.state.cursor_registry.all_states()+ let Some(theme_id) = args.get("theme_id").and_then(Value::as_str) else {+ return ToolResult::error("Missing required string field `theme_id`.");+ };+ let session = resolve_cursor_key(&args);+ let resolved_theme = match cursor_overlay::resolve_theme_selection(theme_id) {+ Ok(theme) => theme,+ Err(error) => {+ return ToolResult::error(format!(+ "Cursor theme '{theme_id}' cannot be selected: {error}"+ ));+ }};- let json = serde_json::to_value(&states).unwrap_or_default();- ToolResult::text(format!("{} cursor instance(s).", states.len()))- .with_structured(json!({ "cursors": json }))+ let (version, profile) = resolved_theme+ .as_deref()+ .map(|theme| (theme.version.as_str(), theme.profile.as_str()))+ .unwrap_or((+ cursor_overlay::DEFAULT_THEME_VERSION,+ cursor_overlay::THEME_PROFILE,+ ));+ let reduced_motion =+ cursor_reduced_motion(args.get("reduced_motion").and_then(Value::as_str));+ self.state+ .cursor_registry+ .update_config(&session, |config| {+ config.theme_id = theme_id.to_owned();+ config.reduced_motion = reduced_motion;+ });+ crate::overlay::send_command_for(+ session.clone(),+ cursor_overlay::OverlayCommand::SetTheme {+ theme_id: theme_id.to_owned(),+ reduced_motion,+ },+ );+ ToolResult::text(format!(+ "Agent cursor theme for session '{session}' set to '{theme_id}'."+ ))+ .with_structured(json!({"session":session,"theme":{+ "id":theme_id,+ "version":version,+ "profile":profile,+ "reduced_motion":reduced_motion,+ "fallback":null+ }}))}}-// ── set_agent_cursor_style ────────────────────────────────────────────────────+pub struct GetAgentCursorStateV2Tool;-pub struct SetAgentCursorStyleTool {- state: Arc<ToolState>,-}--static STYLE_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();+static CURSOR_STATE_V2_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();#[async_trait]-impl Tool for SetAgentCursorStyleTool {+impl Tool for GetAgentCursorStateV2Tool {fn def(&self) -> &ToolDef {- STYLE_DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_style".into(),- description:- "Update the visual style of the agent cursor overlay.\n\n\- - 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.\n\- - bloom_color: hex string for the radial halo/bloom behind the cursor \- (e.g. \"#00FFFF\"). Empty string reverts to the default.\n\- - 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.\n\- All parameters are optional; omit any you do not want to change."- .into(),- input_schema: json!({- "type": "object",- "properties": {- "session": {- "type": "string",- "description": "Optional multi-cursor session id; takes precedence over cursor_id."- },- "cursor_id": {- "type": "string",- "description": "Cursor instance. Default: 'default'."- },- "gradient_colors": {- "type": "array",- "items": { "type": "string" },- "description": "CSS hex gradient stops tip→tail. [] = revert to default."- },- "bloom_color": {- "type": "string",- "description": "Hex bloom/halo colour (e.g. '#00FFFF'). '' = revert to default."- },- "image_path": {- "type": "string",- "description": "Path to PNG/JPEG/SVG/ICO cursor image. '' = revert to the default cursor."- }- },- "additionalProperties": false- }),- read_only: false, destructive: false, idempotent: true, open_world: false,- })+ CURSOR_STATE_V2_DEF.get_or_init(|| canonical_cursor_def("get_agent_cursor_state"))}async fn invoke(&self, args: Value) -> ToolResult {- let cursor_id = resolve_cursor_key(&args);-- // image_path- let image_path = args.get("image_path").and_then(|v| v.as_str());- let shape_cmd: Option<cursor_overlay::OverlayCommand> = if let Some(path) = image_path {- if path.is_empty() {- Some(cursor_overlay::OverlayCommand::SetShape(None))- } else {- let path_owned = path.to_owned();- match tokio::task::spawn_blocking(move || {- cursor_overlay::CursorShape::load(&path_owned)- })- .await- {- Ok(Ok(shape)) => {- let path_for_cfg = path.to_owned();- self.state.cursor_registry.update_config(&cursor_id, |cfg| {- cfg.cursor_icon = Some(path_for_cfg);- });- Some(cursor_overlay::OverlayCommand::SetShape(Some(shape)))- }- Ok(Err(e)) => {- return ToolResult::error(format!("Failed to load image_path: {e}"))- }- Err(e) => return ToolResult::error(format!("Task error: {e}")),- }- }- } else {- None- };-- // gradient_colors- let gradient_colors: Vec<[u8; 4]> =- if let Some(arr) = args.get("gradient_colors").and_then(|v| v.as_array()) {- let mut out = vec![];- for v in arr {- if let Some(hex) = v.as_str() {- match parse_hex_color(hex) {- Some(c) => out.push(c),- None => return ToolResult::error(format!("Invalid hex color: {hex}")),- }- }- }- out- } else {- vec![]- };-- // bloom_color- let bloom_color: Option<Option<[u8; 4]>> =- if let Some(hex) = args.get("bloom_color").and_then(|v| v.as_str()) {- if hex.is_empty() {- Some(None)- } else {- match parse_hex_color(hex) {- Some(c) => Some(Some(c)),- None => return ToolResult::error(format!("Invalid bloom_color: {hex}")),- }- }- } else {- None- };-- // Dispatch to overlay- if let Some(cmd) = shape_cmd {- crate::overlay::send_command_for(cursor_id.clone(), cmd);- }- let gradient_provided = args.get("gradient_colors").is_some();- let bloom_provided = args.get("bloom_color").is_some();- if gradient_provided || bloom_provided {- crate::overlay::send_command_for(- cursor_id.clone(),- cursor_overlay::OverlayCommand::SetGradient {- gradient_colors,- bloom_color: bloom_color.flatten(),+ let session = resolve_cursor_key(&args);+ let enabled = crate::overlay::is_enabled_for(&session);+ let motion = crate::overlay::current_motion_for(&session);+ let (theme_id, version, profile, fallback, visual) =+ crate::overlay::current_theme_state_for(&session).unwrap_or_else(|| {+ (+ cursor_overlay::DEFAULT_THEME_ID.into(),+ cursor_overlay::DEFAULT_THEME_VERSION.into(),+ cursor_overlay::THEME_PROFILE.into(),+ None,+ cursor_overlay::CursorVisualState::default(),+ )+ });+ let modifiers: Vec<&str> = [+ visual.delivery.map(|value| value.as_str()),+ visual.target.map(|value| value.as_str()),+ ]+ .into_iter()+ .flatten()+ .collect();+ ToolResult::text(format!("Agent cursor state for session '{session}'.")).with_structured(+ json!({+ "session":session,+ "enabled":enabled,+ "position":null,+ "theme":{+ "id":theme_id,+ "version":version,+ "profile":profile,+ "reduced_motion":visual.reduced_motion,+ "fallback":fallback},- );- }-- let grad_str = args- .get("gradient_colors")- .and_then(|v| v.as_array())- .map(|arr| {- let strs: Vec<String> = arr- .iter()- .filter_map(|v| v.as_str().map(str::to_owned))- .collect();- format!("[{}]", strs.join(", "))- })- .unwrap_or_else(|| "(unchanged)".into());- let bloom_str = args- .get("bloom_color")- .and_then(|v| v.as_str())- .map(|s| {- if s.is_empty() {- "(reverted)".to_owned()- } else {- s.to_owned()- }- })- .unwrap_or_else(|| "(unchanged)".into());- let img_str = image_path- .map(|s| {- if s.is_empty() {- "(reverted to default)".to_owned()- } else {- s.to_owned()+ "visual_state":{+ "requested_action":visual.requested_action,+ "resolved_action":visual.resolved_action,+ "modifiers":modifiers,+ "phase":visual.phase(),+ "frame":visual.frame(),+ "preempted_count":visual.preempted_count+ },+ "motion":{+ "start_handle":motion.start_handle,+ "end_handle":motion.end_handle,+ "arc_size":motion.arc_size,+ "arc_flow":motion.arc_flow,+ "spring":motion.spring,+ "glide_duration_ms":motion.glide_duration_ms,+ "dwell_after_click_ms":motion.dwell_after_click_ms,+ "idle_hide_ms":motion.idle_hide_ms,+ "turn_radius":motion.turn_radius}- })- .unwrap_or_else(|| "(unchanged)".into());-- ToolResult::text(format!(- "cursor style: gradient_colors={grad_str} bloom_color={bloom_str} image_path={img_str}"- ))+ }),+ )}}-fn parse_hex_color(hex: &str) -> Option<[u8; 4]> {- let s = hex.trim_start_matches('#');- match s.len() {- 6 => {- let r = u8::from_str_radix(&s[0..2], 16).ok()?;- let g = u8::from_str_radix(&s[2..4], 16).ok()?;- let b = u8::from_str_radix(&s[4..6], 16).ok()?;- Some([r, g, b, 255])- }- 3 => {- let r = u8::from_str_radix(&s[0..1].repeat(2), 16).ok()?;- let g = u8::from_str_radix(&s[1..2].repeat(2), 16).ok()?;- let b = u8::from_str_radix(&s[2..3].repeat(2), 16).ok()?;- Some([r, g, b, 255])- }- _ => None,- }+fn canonical_cursor_def(name: &str) -> ToolDef {+ let contract = cua_driver_contract::tool_contract(name)+ .unwrap_or_else(|| panic!("missing canonical cursor contract for {name}"));+ ToolDef::from_contract(&contract)}// ── check_permissions ─────────────────────────────────────────────────────────@@ -7033,9 +6859,7 @@ pub fn build_registry_with_provider(Some(state) => cua_driver_core::session::bounded_cursor_outcome(true,state.config.enabled,- state.config.cursor_icon.as_deref(),- state.config.cursor_color.as_deref(),- state.config.cursor_label.as_deref(),+ Some(state.config.theme_id.as_str()),motion_customized,active_cursor_count,),@@ -7043,8 +6867,6 @@ pub fn build_registry_with_provider(false,false,None,- None,- None,false,active_cursor_count,),@@ -7136,16 +6958,12 @@ pub fn build_registry_with_provider(r.register(Box::new(MoveCursorTool {state: state.clone(),}));- r.register(Box::new(SetAgentCursorEnabledTool {- state: state.clone(),- }));- r.register(Box::new(SetAgentCursorMotionTool {- state: state.clone(),- }));- r.register(Box::new(GetAgentCursorStateTool {+ r.register(Box::new(SetAgentCursorEnabledV2Tool {state: state.clone(),}));- r.register(Box::new(SetAgentCursorStyleTool {+ r.register(Box::new(SetAgentCursorMotionV2Tool));+ r.register(Box::new(GetAgentCursorStateV2Tool));+ r.register(Box::new(SetAgentCursorThemeTool {state: state.clone(),}));r.register(Box::new(CheckPermissionsTool));diff --git a/libs/cua-driver/rust/crates/platform-linux/src/tools/stubs.rs b/libs/cua-driver/rust/crates/platform-linux/src/tools/stubs.rsindex ade7b0b9c0..8cb57d6173 100644--- a/libs/cua-driver/rust/crates/platform-linux/src/tools/stubs.rs+++ b/libs/cua-driver/rust/crates/platform-linux/src/tools/stubs.rs@@ -47,6 +47,35 @@ macro_rules! stub_tool {};}+macro_rules! contract_stub_tool {+ ($mod_name:ident, $struct_name:ident, $tool_name:literal) => {+ mod $mod_name {+ use super::*;+ pub struct $struct_name;+ static DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();+ impl $struct_name {+ pub fn def_static() -> &'static ToolDef {+ DEF.get_or_init(|| {+ let contract = cua_driver_contract::tool_contract($tool_name)+ .expect("canonical cursor contract exists");+ ToolDef::from_contract(&contract)+ })+ }+ }+ #[async_trait]+ impl Tool for $struct_name {+ fn def(&self) -> &ToolDef {+ Self::def_static()+ }+ async fn invoke(&self, _args: Value) -> ToolResult {+ not_impl($tool_name)+ }+ }+ }+ pub use $mod_name::$struct_name;+ };+}+stub_tool!(list_apps_m,ListAppsTool,@@ -174,24 +203,25 @@ stub_tool!(serde_json::json!({"type":"object","properties":{},"additionalProperties":false}));-stub_tool!(cursor_motion_m, SetAgentCursorMotionTool, "set_agent_cursor_motion",- format!("Configure the visual appearance of an agent cursor instance.\n\nExtended cursor customization for multi-cursor use cases:\n- cursor_id: instance name (default='default')\n- cursor_icon: built-in ({}) or a path to a PNG/JPEG/SVG/ICO file; '' reverts to the default cursor\n- cursor_color: hex color e.g. '#00FFFF' or CSS name\n- cursor_label: short text shown near the cursor\n- cursor_size: dot radius in points (default=16)\n- cursor_opacity: 0.0–1.0 (default=0.85)", cursor_overlay::BuiltinShape::names_help()),- serde_json::json!({"type":"object","properties":{"cursor_id":{"type":"string"},"cursor_icon":{"type":"string"},"cursor_color":{"type":"string"},"cursor_label":{"type":"string"},"cursor_size":{"type":"number"},"cursor_opacity":{"type":"number"}},"additionalProperties":false}));--stub_tool!(- get_cursor_state_m,- GetAgentCursorStateTool,- "get_agent_cursor_state",- "Return the current state of all agent cursor instances.",- serde_json::json!({"type":"object","properties":{},"additionalProperties":false})+contract_stub_tool!(+ cursor_enabled_v2_m,+ SetAgentCursorEnabledV2Tool,+ "set_agent_cursor_enabled");--stub_tool!(- set_cursor_style_m,- SetAgentCursorStyleTool,- "set_agent_cursor_style",- "Update the visual style of the agent cursor overlay.",- serde_json::json!({"type":"object","properties":{"cursor_id":{"type":"string"},"gradient_colors":{"type":"array","items":{"type":"string"}},"bloom_color":{"type":"string"},"image_path":{"type":"string"}},"additionalProperties":false})+contract_stub_tool!(+ cursor_motion_v2_m,+ SetAgentCursorMotionV2Tool,+ "set_agent_cursor_motion"+);+contract_stub_tool!(+ get_cursor_state_v2_m,+ GetAgentCursorStateV2Tool,+ "get_agent_cursor_state"+);+contract_stub_tool!(+ cursor_theme_m,+ SetAgentCursorThemeTool,+ "set_agent_cursor_theme");stub_tool!(@@ -272,45 +302,6 @@ mod move_cursor_m {}pub use move_cursor_m::MoveCursorTool;-mod set_enabled_m {- use super::*;- pub struct SetAgentCursorEnabledTool;- static DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();- impl SetAgentCursorEnabledTool {- pub fn def_static() -> &'static ToolDef {- DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_enabled".into(),- description: "Show or hide the agent cursor overlay.".into(),- input_schema: serde_json::json!({"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"},"cursor_id":{"type":"string"}},"additionalProperties":false}),- read_only: false, destructive: false, idempotent: true, open_world: false,- })- }- }- #[async_trait]- impl Tool for SetAgentCursorEnabledTool {- fn def(&self) -> &ToolDef {- Self::def_static()- }- async fn invoke(&self, args: Value) -> ToolResult {- let enabled = args- .get("enabled")- .and_then(|v| v.as_bool())- .unwrap_or(true);- let cursor_id = args- .get("cursor_id")- .and_then(|v| v.as_str())- .unwrap_or("default");- crate::overlay::send_command(cursor_overlay::OverlayCommand::SetEnabled(enabled));- ToolResult::text(format!(- "Agent cursor '{}' {}.",- cursor_id,- if enabled { "enabled" } else { "disabled" }- ))- }- }-}-pub use set_enabled_m::SetAgentCursorEnabledTool;-pub fn build_registry() -> cua_driver_core::tool::ToolRegistry {let mut r = cua_driver_core::tool::ToolRegistry::new();r.register(Box::new(ListAppsTool));@@ -330,10 +321,10 @@ pub fn build_registry() -> cua_driver_core::tool::ToolRegistry {r.register(Box::new(GetScreenSizeTool));r.register(Box::new(GetCursorPositionTool));r.register(Box::new(MoveCursorTool));- r.register(Box::new(SetAgentCursorEnabledTool));- r.register(Box::new(SetAgentCursorMotionTool));- r.register(Box::new(GetAgentCursorStateTool));- r.register(Box::new(SetAgentCursorStyleTool));+ r.register(Box::new(SetAgentCursorEnabledV2Tool));+ r.register(Box::new(SetAgentCursorMotionV2Tool));+ r.register(Box::new(GetAgentCursorStateV2Tool));+ r.register(Box::new(SetAgentCursorThemeTool));r.register(Box::new(CheckPermissionsTool));// health_report is cross-platform — the Linux provider here lets// non-Linux hosts running the stubbed registry still advertisediff --git a/libs/cua-driver/rust/crates/platform-macos/src/cursor/overlay.rs b/libs/cua-driver/rust/crates/platform-macos/src/cursor/overlay.rsindex 59e8710f7b..8190102920 100644--- a/libs/cua-driver/rust/crates/platform-macos/src/cursor/overlay.rs+++ b/libs/cua-driver/rust/crates/platform-macos/src/cursor/overlay.rs@@ -36,7 +36,7 @@ use std::time::{Duration, Instant};use cursor_overlay::{CursorConfig, CursorKey, FocusRect, KeyedOverlayCommand, MotionConfig, OverlayCommand,- OverlayMsg, Palette, RenderStateCore, ZOrderEnforcer,+ OverlayMsg, RenderStateCore, ZOrderEnforcer,};use indexmap::IndexMap;@@ -89,8 +89,7 @@ struct RenderMap {/// rendered cursor is crisp at native resolution instead of being/// bilinear-upsampled by Core Animation from a logical-pixel buffer.backing_scale: f64,- /// Frozen launch-time config used as the template for lazily-created- /// cursors (its palette is overridden per-key via `Palette::for_instance`).+ /// Frozen launch-time config used as the template for lazily-created cursors.template: CursorConfig,/// Render-side tombstone of permanently-ended session cursor keys. A `Cmd`/// for a key in here is dropped WITHOUT get-or-create, so an in-flight@@ -102,13 +101,11 @@ struct RenderMap {ended: std::collections::HashSet<CursorKey>,}-/// Build the `RenderState` for a lazily-created cursor key: derive from the-/// launch template but give each non-default key its own palette so distinct-/// sessions get distinct colours automatically.+/// Build the `RenderState` for a lazily-created session cursor from the+/// process launch template.fn render_state_for_key(template: &CursorConfig, key: &str) -> RenderState {- let mut rs = RenderState::new(template.clone());- rs.core.palette = Palette::for_instance(key);- rs+ let _ = key;+ RenderState::new(template.clone())}/// Apply one inbound [`OverlayMsg`] to the render map (drain step). Factored@@ -176,6 +173,38 @@ pub fn init(cfg: CursorConfig) {ended: std::collections::HashSet::new(),});});+ cua_driver_core::cursor_events::install_cursor_event_sink(std::sync::Arc::new(+ |event: cua_driver_core::cursor_events::CursorEvent| {+ use cua_driver_core::cursor_events::{CursorEvent, CursorEventPhase};+ let (session, cmd) = match event {+ CursorEvent::Action {+ session,+ phase: CursorEventPhase::Begin,+ semantics,+ } => (+ session,+ OverlayCommand::BeginAction {+ action: semantics.action,+ delivery: semantics.delivery,+ target: semantics.target,+ },+ ),+ CursorEvent::Action {+ session,+ phase: CursorEventPhase::End,+ semantics,+ } => (session, OverlayCommand::EndAction(semantics.action)),+ CursorEvent::SelectTheme { session, selection } => (+ session,+ OverlayCommand::SetTheme {+ theme_id: selection.theme_id,+ reduced_motion: selection.reduced_motion,+ },+ ),+ };+ send_command(session, cmd);+ },+ ));}/// Send a keyed command from any thread (MCP tool, etc.). Non-blocking; drops@@ -227,6 +256,26 @@ pub fn current_motion(key: &str) -> MotionConfig {.unwrap_or_default()}+/// Return the render-owned theme and semantic playback state for one cursor.+pub fn current_theme_state(+ key: &str,+) -> Option<(+ String,+ String,+ String,+ Option<String>,+ cursor_overlay::CursorVisualState,+)> {+ let guard = RENDER.lock().unwrap();+ let map = guard.as_ref()?;+ let state = map+ .cursors+ .get(key)+ .or_else(|| map.cursors.get("default"))?;+ let (id, version, profile, fallback) = state.core.active_theme_metadata();+ Some((id, version, profile, fallback, state.core.visual.clone()))+}+/// Seed a brand-new (sentinel-positioned) cursor at an on-screen start point/// offset up-left of `(target_x, target_y)` so the immediately-following/// `MoveTo` glides INTO the target instead of silently snapping. Without this,@@ -1159,16 +1208,18 @@ mod tests {}#[test]- fn lazily_created_cursors_get_distinct_palettes() {+ fn lazily_created_cursors_inherit_the_selected_theme() {let mut map = empty_map();apply_msg(&mut map, move_msg("sessA", 10.0, 10.0));apply_msg(&mut map, move_msg("sessB", 20.0, 20.0));- let a = &map.cursors["sessA"].core.palette;- let b = &map.cursors["sessB"].core.palette;- let def = &map.cursors["default"].core.palette;- // default uses the blue palette; the two sessions derive their own.- assert_ne!(a.name, def.name);- assert_ne!(b.name, def.name);+ assert_eq!(+ map.cursors["sessA"].core.cfg.theme_id,+ map.cursors["default"].core.cfg.theme_id+ );+ assert_eq!(+ map.cursors["sessB"].core.cfg.theme_id,+ map.cursors["default"].core.cfg.theme_id+ );}#[test]diff --git a/libs/cua-driver/rust/crates/platform-macos/src/cursor/state.rs b/libs/cua-driver/rust/crates/platform-macos/src/cursor/state.rsindex d13db9799d..89b3319d65 100644--- a/libs/cua-driver/rust/crates/platform-macos/src/cursor/state.rs+++ b/libs/cua-driver/rust/crates/platform-macos/src/cursor/state.rs@@ -7,18 +7,12 @@ use std::sync::Mutex;/// Per-instance cursor configuration.#[derive(Debug, Clone, Serialize, Deserialize)]pub struct CursorConfig {- /// Instance identifier for multi-cursor use cases. Default: "default".+ /// Session-owned cursor identifier.pub cursor_id: String,- /// Built-in icon name ("arrow", "crosshair", "hand") or path to PNG/SVG.- pub cursor_icon: Option<String>,- /// Hex color (e.g. "#00FFFF") or CSS name for the glow/indicator.- pub cursor_color: Option<String>,- /// Short label rendered near the cursor dot.- pub cursor_label: Option<String>,- /// Dot radius in points. Default: 16.- pub cursor_size: Option<f64>,- /// Opacity 0.0–1.0. Default: 0.85.- pub cursor_opacity: Option<f64>,+ /// Installed cursor theme id.+ pub theme_id: String,+ /// Accessibility motion preference.+ pub reduced_motion: cursor_overlay::ReducedMotion,/// Whether the overlay is currently visible.pub enabled: bool,}@@ -27,11 +21,8 @@ impl Default for CursorConfig {fn default() -> Self {Self {cursor_id: "default".into(),- cursor_icon: None,- cursor_color: Some("#00FFFF".into()),- cursor_label: None,- cursor_size: Some(16.0),- cursor_opacity: Some(0.85),+ theme_id: cursor_overlay::DEFAULT_THEME_ID.into(),+ reduced_motion: cursor_overlay::ReducedMotion::Auto,enabled: true,}}diff --git a/libs/cua-driver/rust/crates/platform-macos/src/tools/cursor_tools.rs b/libs/cua-driver/rust/crates/platform-macos/src/tools/cursor_tools.rsindex 7768b29233..1ae5d4799c 100644--- a/libs/cua-driver/rust/crates/platform-macos/src/tools/cursor_tools.rs+++ b/libs/cua-driver/rust/crates/platform-macos/src/tools/cursor_tools.rs@@ -1,8 +1,4 @@-//! Agent cursor control tools: set_agent_cursor_enabled, set_agent_cursor_motion,-//! get_agent_cursor_state.-//!-//! Extended with multi-cursor customization fields matching the customer use case-//! where codex wrapper wants control over the cursor icon.+//! Session-owned agent cursor controls.use async_trait::async_trait;use cua_driver_core::{@@ -14,43 +10,26 @@ use std::sync::Arc;use super::ToolState;-/// Resolve the cursor key for a tool invocation. Always returns a non-empty-/// key, so the agent cursor is shown by default.-///-/// Precedence: an explicit `session` arg, then its legacy alias `cursor_id`,-/// then the connection-injected `_session_id` the daemon mirrors onto every-/// call, then a stable per-daemon fallback ([`default_cursor_session`]). So a-/// caller that never declares a session still gets a consistent cursor for the-/// run (e.g. raw CLI `call`s). The same id works identically over MCP, the CLI-/// (`--session`), or the raw socket, and follows the run across any number of-/// apps/windows. Opt out per session with `set_agent_cursor_enabled`.+/// Resolve the cursor identity from the current session. The removed+/// `cursor_id` alias is intentionally not accepted by the new contract.pub(crate) fn resolve_cursor_key(args: &Value) -> String {use cua_driver_core::tool_args::ArgsExt;- // Explicit cursor identity first (`session`, or its legacy `cursor_id` alias),- // then the per-run `_session_id` the daemon mirrors onto every call, then a- // stable per-daemon fallback. So the agent cursor is shown by DEFAULT with an- // id that stays consistent across a run, even when the caller never declared a- // session (e.g. raw CLI `call`s). Opt out per session with set_agent_cursor_enabled.- for key in ["session", "cursor_id", "_session_id"] {- if let Some(v) = args.opt_str(key) {- if !v.is_empty() {- return v;+ for key in ["session", "_session_id"] {+ if let Some(value) = args.opt_str(key) {+ if !value.is_empty() {+ return value;}}}default_cursor_session()}-/// Stable per-daemon cursor session, minted once per `serve` process. Used when a-/// call carries no session identity at all, so every such call shares one cursor.fn default_cursor_session() -> String {static ID: std::sync::OnceLock<String> = std::sync::OnceLock::new();ID.get_or_init(|| format!("auto-{:x}", std::process::id())).clone()}-// ── SetAgentCursorEnabled ─────────────────────────────────────────────────────-pub struct SetAgentCursorEnabledTool {state: Arc<ToolState>,}@@ -64,28 +43,7 @@ impl SetAgentCursorEnabledTool {static ENABLED_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();fn enabled_def() -> &'static ToolDef {- ENABLED_DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_enabled".into(),- description: "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`.)".into(),- input_schema: serde_json::json!({- "type": "object",- "required": ["enabled"],- "properties": {- "enabled": { "type": "boolean", "description": "true = show, false = hide." },- "cursor_id": { "type": "string", "description": "Cursor instance. Default: 'default'." }- },- "additionalProperties": false- }),- read_only: false,- destructive: false,- idempotent: true,- open_world: false,- })+ ENABLED_DEF.get_or_init(|| canonical_cursor_def("set_agent_cursor_enabled"))}#[async_trait]@@ -100,26 +58,26 @@ impl Tool for SetAgentCursorEnabledTool {}use cua_driver_core::tool_args::ArgsExt;let enabled = match args.require_bool("enabled") {- Ok(v) => v,- Err(e) => return e,+ Ok(value) => value,+ Err(error) => return error,};- let key = resolve_cursor_key(&args);- self.state.cursor_registry.set_enabled(&key, enabled);- // Drive the visual overlay for THIS session's cursor.+ let session = resolve_cursor_key(&args);+ self.state.cursor_registry.set_enabled(&session, enabled);crate::cursor::overlay::send_command(- key.clone(),+ session.clone(),cursor_overlay::OverlayCommand::SetEnabled(enabled),);ToolResult::text(format!(- "Agent cursor '{}' {}.",- key,+ "Agent cursor for session '{session}' {}.",if enabled { "enabled" } else { "disabled" }))+ .with_structured(serde_json::json!({+ "session": session,+ "enabled": enabled+ }))}}-// ── SetAgentCursorMotion (config) ─────────────────────────────────────────────-pub struct SetAgentCursorMotionTool {state: Arc<ToolState>,}@@ -133,86 +91,14 @@ impl SetAgentCursorMotionTool {static MOTION_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();fn motion_def() -> &'static ToolDef {- MOTION_DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_motion".into(),- description: format!("Configure the visual appearance and motion curve of an agent cursor instance.\n\n\- Appearance (multi-cursor customization):\n\- - cursor_id: instance name (default='default')\n\- - cursor_icon: built-in ({}) or a path to a PNG/JPEG/SVG/ICO file; '' reverts to the default cursor\n\- - cursor_color: hex color e.g. '#00FFFF' or CSS name\n\- - cursor_label: short text shown near the cursor\n\- - cursor_size: dot radius in points (default=16)\n\- - cursor_opacity: 0.0–1.0 (default=0.85)\n\n\- Motion curve (Bezier path shape):\n\- - start_handle: departure control-point fraction [0,1]. Default 0.3\n\- - end_handle: arrival control-point fraction [0,1]. Default 0.3\n\- - arc_size: perpendicular deflection as fraction of path length [0,1]. Default 0.25\n\- - arc_flow: asymmetry [-1,1]; positive bulges toward destination. Default 0.0\n\- - spring: settle damping [0.3,1.0]; 1.0=no overshoot. Default 0.72\n\- - glide_duration_ms: fixed flight duration per move [50,5000]; omit for speed-based (the default)\n\- - dwell_after_click_ms: pause after click ripple [0,5000]. Default 80\n\- - idle_hide_ms: auto-hide delay [0,60000]; 0=never. Default 20000",- cursor_overlay::BuiltinShape::names_help()),- input_schema: serde_json::json!({- "type": "object",- "properties": {- "cursor_id": { "type": "string", "description": "Cursor instance name. Default: 'default'." },- "cursor_icon": { "type": "string", "description": format!("Built-in shape ({}) or a path to a PNG/JPEG/SVG/ICO file. '' reverts to the default cursor.", cursor_overlay::BuiltinShape::names_help()) },- "cursor_color": { "type": "string", "description": "Hex color (e.g. '#00FFFF') or CSS color name." },- "cursor_label": { "type": "string", "description": "Short label near the cursor dot." },- "cursor_size": { "type": "number", "description": "Dot radius in points. Default: 16." },- "cursor_opacity": { "type": "number", "description": "Opacity 0.0–1.0. Default: 0.85." },- "start_handle": {- "type": "number",- "description": "Start-handle fraction in [0, 1]. Default 0.3."- },- "end_handle": {- "type": "number",- "description": "End-handle fraction in [0, 1]. Default 0.3."- },- "arc_size": {- "type": "number",- "description": "Arc deflection as fraction of path length [0, 1]. Default 0.25."- },- "arc_flow": {- "type": "number",- "description": "Asymmetry bias in [-1, 1]. Default 0.0."- },- "spring": {- "type": "number",- "description": "Settle damping in [0.3, 1.0]. Default 0.72."- },- "glide_duration_ms": {- "type": "number",- "minimum": 50,- "maximum": 5000,- "description": "Fixed flight duration per move in ms; omit for speed-based timing (the default)."- },- "dwell_after_click_ms": {- "type": "number",- "minimum": 0,- "maximum": 5000,- "description": "Pause after click ripple in ms. Default 80."- },- "idle_hide_ms": {- "type": "number",- "minimum": 0,- "maximum": 60000,- "description": "Auto-hide delay in ms. 0 = never hide. Default 20000."- },- "turn_radius": {- "type": "number",- "minimum": 1,- "maximum": 1000,- "description": "Minimum turning radius of the glide path in points; smaller = tighter curves. Default 80."- }- },- "additionalProperties": false- }),- read_only: false,- destructive: false,- idempotent: true,- open_world: false,+ MOTION_DEF.get_or_init(|| canonical_cursor_def("set_agent_cursor_motion"))+}++fn number(value: Option<&Value>) -> Option<f64> {+ value.and_then(|value| {+ value+ .as_f64()+ .or_else(|| value.as_i64().map(|integer| integer as f64))})}@@ -226,325 +112,128 @@ impl Tool for SetAgentCursorMotionTool {if !self.state.cursor_overlay_available {return super::cursor_overlay_unavailable();}- use cua_driver_core::tool_args::ArgsExt;- let cursor_id = resolve_cursor_key(&args);-- // Start from the current state or defaults.- let mut current = self.state.cursor_registry.get_or_create(&cursor_id);- let config = &mut current.config;-- // ── Appearance fields ────────────────────────────────────────────────- // `cursor_icon` accepts the same vocabulary as the CLI `--cursor-shape` /- // `--cursor-icon` flags: a built-in name (resolved via the shared- // `BuiltinShape` table) or a path to an image file. Resolve it to a shape- // override and dispatch below so the overlay actually changes — this field- // used to be stored and never rendered.- let mut shape_cmd: Option<cursor_overlay::OverlayCommand> = None;- if let Some(icon) = args.opt_str("cursor_icon") {- let icon_owned = icon.clone();- match tokio::task::spawn_blocking(move || {- cursor_overlay::resolve_cursor_icon(&icon_owned)- })- .await- {- Ok(Ok(resolution)) => {- config.cursor_icon = Some(icon);- shape_cmd = Some(cursor_overlay::OverlayCommand::from_cursor_icon(resolution));- }- Ok(Err(e)) => return ToolResult::error(format!("Invalid cursor_icon: {e}")),- Err(e) => return ToolResult::error(format!("Task error: {e}")),+ let session = resolve_cursor_key(&args);+ let current = crate::cursor::overlay::current_motion(&session);+ let motion = current.with_overrides(+ number(args.get("start_handle")),+ number(args.get("end_handle")),+ number(args.get("arc_size")),+ number(args.get("arc_flow")),+ number(args.get("spring")),+ number(args.get("glide_duration_ms")),+ number(args.get("dwell_after_click_ms")),+ number(args.get("idle_hide_ms")),+ None,+ number(args.get("turn_radius")),+ );+ crate::cursor::overlay::send_command(+ session.clone(),+ cursor_overlay::OverlayCommand::SetMotion(motion.clone()),+ );+ ToolResult::text(format!(+ "Agent cursor motion updated for session '{session}'."+ ))+ .with_structured(serde_json::json!({+ "session": session,+ "motion": {+ "start_handle": motion.start_handle,+ "end_handle": motion.end_handle,+ "arc_size": motion.arc_size,+ "arc_flow": motion.arc_flow,+ "spring": motion.spring,+ "glide_duration_ms": motion.glide_duration_ms,+ "dwell_after_click_ms": motion.dwell_after_click_ms,+ "idle_hide_ms": motion.idle_hide_ms,+ "turn_radius": motion.turn_radius}- }- if let Some(color) = args.opt_str("cursor_color") {- config.cursor_color = Some(color);- }- if let Some(label) = args.opt_str("cursor_label") {- config.cursor_label = Some(label);- }- if let Some(size) = args.opt_f64("cursor_size") {- config.cursor_size = Some(size);- }- if let Some(opacity) = args.opt_f64("cursor_opacity") {- config.cursor_opacity = Some(opacity.clamp(0.0, 1.0));- }-- self.state.cursor_registry.update_config(config.clone());-- // Dispatch the resolved shape to this session's overlay instance.- if let Some(cmd) = shape_cmd {- crate::cursor::overlay::send_command(cursor_id.clone(), cmd);- }-- // ── Motion curve fields (apply to shared overlay MotionConfig) ───────- // JSON integers from MCP decode as i64; coerce to f64 here.- fn num(v: Option<&Value>) -> Option<f64> {- v.and_then(|v| v.as_f64().or_else(|| v.as_i64().map(|i| i as f64)))- }- let motion_changed = args.get("start_handle").is_some()- || args.get("end_handle").is_some()- || args.get("arc_size").is_some()- || args.get("arc_flow").is_some()- || args.get("spring").is_some()- || args.get("glide_duration_ms").is_some()- || args.get("dwell_after_click_ms").is_some()- || args.get("idle_hide_ms").is_some()- || args.get("turn_radius").is_some();-- if motion_changed {- // Read this cursor's current motion from the overlay, apply- // overrides, push back.- let current_motion = crate::cursor::overlay::current_motion(&cursor_id);- let new_motion = current_motion.with_overrides(- num(args.get("start_handle")),- num(args.get("end_handle")),- num(args.get("arc_size")),- num(args.get("arc_flow")),- num(args.get("spring")),- num(args.get("glide_duration_ms")),- num(args.get("dwell_after_click_ms")),- num(args.get("idle_hide_ms")),- None, // press_duration_ms not exposed- num(args.get("turn_radius")),- );- crate::cursor::overlay::send_command(- cursor_id.clone(),- cursor_overlay::OverlayCommand::SetMotion(new_motion.clone()),- );- ToolResult::text(format!(- "Cursor '{}' updated. Motion: start={:.2} end={:.2} arc={:.2} flow={:.2} \- spring={:.2} glide={}ms dwell={}ms idle={}ms",- cursor_id,- new_motion.start_handle,- new_motion.end_handle,- new_motion.arc_size,- new_motion.arc_flow,- new_motion.spring,- new_motion.glide_duration_ms as u32,- new_motion.dwell_after_click_ms as u32,- new_motion.idle_hide_ms as u32,- ))- .with_structured(serde_json::to_value(¤t.config).unwrap_or_default())- } else {- ToolResult::text(format!("Cursor '{}' config updated.", cursor_id))- .with_structured(serde_json::to_value(¤t.config).unwrap_or_default())- }+ }))}}-// ── SetAgentCursorStyle ───────────────────────────────────────────────────────--pub struct SetAgentCursorStyleTool {+pub struct SetAgentCursorThemeTool {state: Arc<ToolState>,}-impl SetAgentCursorStyleTool {+impl SetAgentCursorThemeTool {pub fn new(state: Arc<ToolState>) -> Self {Self { state }}}-static STYLE_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();--fn style_def() -> &'static ToolDef {- STYLE_DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_style".into(),- description:- "Update the visual style of the agent cursor overlay.\n\n\- - 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.\n\- - bloom_color: hex string for the radial halo/bloom behind the cursor \- (e.g. \"#00FFFF\"). Empty string reverts to the default.\n\- - 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.\n\- All parameters are optional; omit any you do not want to change."- .into(),- input_schema: serde_json::json!({- "type": "object",- "properties": {- "cursor_id": {- "type": "string",- "description": "Cursor instance. Default: 'default'."- },- "gradient_colors": {- "type": "array",- "items": { "type": "string" },- "description": "CSS hex gradient stops tip→tail. [] = revert to default."- },- "bloom_color": {- "type": "string",- "description": "Hex bloom/halo colour (e.g. '#00FFFF'). '' = revert to default."- },- "image_path": {- "type": "string",- "description": "Path to PNG/JPEG/SVG/ICO cursor image. '' = revert to the default cursor."- }- },- "additionalProperties": false- }),- read_only: false,- destructive: false,- idempotent: true,- open_world: false,- })+static THEME_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();++fn theme_def() -> &'static ToolDef {+ THEME_DEF.get_or_init(|| canonical_cursor_def("set_agent_cursor_theme"))+}++fn parse_reduced_motion(value: Option<&str>) -> cursor_overlay::ReducedMotion {+ match value {+ Some("on") => cursor_overlay::ReducedMotion::On,+ Some("off") => cursor_overlay::ReducedMotion::Off,+ _ => cursor_overlay::ReducedMotion::Auto,+ }}#[async_trait]-impl Tool for SetAgentCursorStyleTool {+impl Tool for SetAgentCursorThemeTool {fn def(&self) -> &ToolDef {- style_def()+ theme_def()}async fn invoke(&self, args: Value) -> ToolResult {if !self.state.cursor_overlay_available {return super::cursor_overlay_unavailable();}- let cursor_id = resolve_cursor_key(&args);-- // ── image_path ────────────────────────────────────────────────────────- let image_path = args.get("image_path").and_then(|v| v.as_str());- let shape_cmd: Option<cursor_overlay::OverlayCommand> = if let Some(path) = image_path {- if path.is_empty() {- // Revert to the configured default silhouette.- Some(cursor_overlay::OverlayCommand::SetShape(None))- } else {- let path_owned = path.to_owned();- match tokio::task::spawn_blocking(move || {- cursor_overlay::CursorShape::load(&path_owned)- })- .await- {- Ok(Ok(shape)) => {- // Also persist to registry so it's available for state queries.- let mut current = self.state.cursor_registry.get_or_create(&cursor_id);- current.config.cursor_icon = Some(path.to_owned());- self.state.cursor_registry.update_config(current.config);- Some(cursor_overlay::OverlayCommand::SetShape(Some(shape)))- }- Ok(Err(e)) => {- return ToolResult::error(format!("Failed to load image_path: {e}"))- }- Err(e) => return ToolResult::error(format!("Task error: {e}")),- }+ use cua_driver_core::tool_args::ArgsExt;+ let theme_id = match args.require_str("theme_id") {+ Ok(value) => value,+ Err(error) => return error,+ };+ let session = resolve_cursor_key(&args);+ let resolved_theme = match cursor_overlay::resolve_theme_selection(&theme_id) {+ Ok(theme) => theme,+ Err(error) => {+ return ToolResult::error(format!(+ "Cursor theme '{theme_id}' cannot be selected: {error}"+ ));}- } else {- None};-- // ── gradient_colors ───────────────────────────────────────────────────- let gradient_colors: Vec<[u8; 4]> =- if let Some(arr) = args.get("gradient_colors").and_then(|v| v.as_array()) {- let mut out = vec![];- for v in arr {- if let Some(hex) = v.as_str() {- match parse_hex_color(hex) {- Some(c) => out.push(c),- None => return ToolResult::error(format!("Invalid hex color: {hex}")),- }- }- }- out- } else {- // Not provided — don't change.- vec![]- };-- // ── bloom_color ───────────────────────────────────────────────────────- let bloom_color: Option<Option<[u8; 4]>> =- if let Some(hex) = args.get("bloom_color").and_then(|v| v.as_str()) {- if hex.is_empty() {- Some(None) // revert- } else {- match parse_hex_color(hex) {- Some(c) => Some(Some(c)),- None => return ToolResult::error(format!("Invalid bloom_color: {hex}")),- }- }- } else {- None- };-- // ── Dispatch to overlay (keyed to this session's cursor) ──────────────- if let Some(cmd) = shape_cmd {- crate::cursor::overlay::send_command(cursor_id.clone(), cmd);- }-- let gradient_provided = args.get("gradient_colors").is_some();- let bloom_provided = args.get("bloom_color").is_some();- if gradient_provided || bloom_provided {- crate::cursor::overlay::send_command(- cursor_id.clone(),- cursor_overlay::OverlayCommand::SetGradient {- gradient_colors,- bloom_color: bloom_color.flatten(),- },- );- }-- // Build response summary.- let grad_str = args- .get("gradient_colors")- .and_then(|v| v.as_array())- .map(|arr| {- let strs: Vec<String> = arr- .iter()- .filter_map(|v| v.as_str().map(str::to_owned))- .collect();- format!("[{}]", strs.join(", "))- })- .unwrap_or_else(|| "(unchanged)".into());-- let bloom_str = args- .get("bloom_color")- .and_then(|v| v.as_str())- .map(|s| {- if s.is_empty() {- "(reverted)".to_owned()- } else {- s.to_owned()- }- })- .unwrap_or_else(|| "(unchanged)".into());-- let img_str = image_path- .map(|s| {- if s.is_empty() {- "(reverted to default)".to_owned()- } else {- s.to_owned()- }- })- .unwrap_or_else(|| "(unchanged)".into());-+ let (version, profile) = resolved_theme+ .as_deref()+ .map(|theme| (theme.version.as_str(), theme.profile.as_str()))+ .unwrap_or((+ cursor_overlay::DEFAULT_THEME_VERSION,+ cursor_overlay::THEME_PROFILE,+ ));+ let reduced_motion =+ parse_reduced_motion(args.get("reduced_motion").and_then(Value::as_str));+ let mut state = self.state.cursor_registry.get_or_create(&session);+ state.config.theme_id = theme_id.clone();+ state.config.reduced_motion = reduced_motion;+ self.state.cursor_registry.update_config(state.config);+ crate::cursor::overlay::send_command(+ session.clone(),+ cursor_overlay::OverlayCommand::SetTheme {+ theme_id: theme_id.clone(),+ reduced_motion,+ },+ );ToolResult::text(format!(- "✅ cursor style: gradient_colors={grad_str} bloom_color={bloom_str} image_path={img_str}"+ "Agent cursor theme for session '{session}' set to '{theme_id}'."))+ .with_structured(serde_json::json!({+ "session": session,+ "theme": {+ "id": theme_id,+ "version": version,+ "profile": profile,+ "reduced_motion": reduced_motion,+ "fallback": null+ }+ }))}}-/// Parse `#RRGGBB` or `#RGB` hex string to `[R, G, B, A=255]`.-fn parse_hex_color(hex: &str) -> Option<[u8; 4]> {- let s = hex.trim_start_matches('#');- match s.len() {- 6 => {- let r = u8::from_str_radix(&s[0..2], 16).ok()?;- let g = u8::from_str_radix(&s[2..4], 16).ok()?;- let b = u8::from_str_radix(&s[4..6], 16).ok()?;- Some([r, g, b, 255])- }- 3 => {- let r = u8::from_str_radix(&s[0..1].repeat(2), 16).ok()?;- let g = u8::from_str_radix(&s[1..2].repeat(2), 16).ok()?;- let b = u8::from_str_radix(&s[2..3].repeat(2), 16).ok()?;- Some([r, g, b, 255])- }- _ => None,- }-}--// ── GetAgentCursorState ───────────────────────────────────────────────────────-pub struct GetAgentCursorStateTool {state: Arc<ToolState>,}@@ -558,23 +247,13 @@ impl GetAgentCursorStateTool {static STATE_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();fn state_def() -> &'static ToolDef {- STATE_DEF.get_or_init(|| ToolDef {- name: "get_agent_cursor_state".into(),- description: "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.".into(),- input_schema: serde_json::json!({- "type": "object",- "properties": {- "cursor_id": { "type": "string", "description": "Cursor instance. Default: this session's cursor." }- },- "additionalProperties": false- }),- read_only: true,- destructive: false,- idempotent: true,- open_world: false,- })+ STATE_DEF.get_or_init(|| canonical_cursor_def("get_agent_cursor_state"))+}++fn canonical_cursor_def(name: &str) -> ToolDef {+ let contract = cua_driver_contract::tool_contract(name)+ .unwrap_or_else(|| panic!("missing canonical cursor contract for {name}"));+ ToolDef::from_contract(&contract)}#[async_trait]@@ -587,152 +266,99 @@ impl Tool for GetAgentCursorStateTool {if !self.state.cursor_overlay_available {return super::cursor_overlay_unavailable();}- // Scope to the CALLER's cursor (explicit cursor_id > injected- // _session_id > "default"). Returning every session's cursors here was a- // cross-session leak, and deriving the top-level `enabled` via- // `.first()` over a HashMap-backed Vec was nondeterministic with N- // cursors. A non-creating `get` keeps a never-touched session from- // materialising a phantom entry.- let key = resolve_cursor_key(&args);- let state = self.state.cursor_registry.get(&key);- // `enabled` defaults to true when the session has no cursor yet — the- // anonymous / one-shot path resolves to "default", which is always- // present, so this default only applies to a brand-new session that has- // not enabled/moved its cursor, where "visible by default" is correct.- let enabled = state.as_ref().map(|s| s.config.enabled).unwrap_or(true);- let cursors: Vec<&crate::cursor::CursorState> = state.iter().collect();- let json = serde_json::to_value(&cursors).unwrap_or_default();- ToolResult::text(format!(- "{} cursor instance(s) for '{}'.",- cursors.len(),- key- ))- .with_structured(serde_json::json!({ "cursors": json, "enabled": enabled }))+ let session = resolve_cursor_key(&args);+ let registry_state = self.state.cursor_registry.get(&session);+ let enabled = registry_state+ .as_ref()+ .map(|state| state.config.enabled)+ .unwrap_or(true);+ let position = registry_state+ .as_ref()+ .and_then(|state| state.position.as_ref())+ .map(|position| serde_json::json!({ "x": position.x, "y": position.y }));+ let motion = crate::cursor::overlay::current_motion(&session);+ let (theme_id, version, profile, fallback, visual) =+ crate::cursor::overlay::current_theme_state(&session).unwrap_or_else(|| {+ (+ cursor_overlay::DEFAULT_THEME_ID.into(),+ cursor_overlay::DEFAULT_THEME_VERSION.into(),+ cursor_overlay::THEME_PROFILE.into(),+ None,+ cursor_overlay::CursorVisualState::default(),+ )+ });+ let modifiers: Vec<&str> = [+ visual.delivery.map(|value| value.as_str()),+ visual.target.map(|value| value.as_str()),+ ]+ .into_iter()+ .flatten()+ .collect();+ ToolResult::text(format!("Agent cursor state for session '{session}'.")).with_structured(+ serde_json::json!({+ "session": session,+ "enabled": enabled,+ "position": position,+ "theme": {+ "id": theme_id,+ "version": version,+ "profile": profile,+ "reduced_motion": visual.reduced_motion,+ "fallback": fallback+ },+ "visual_state": {+ "requested_action": visual.requested_action,+ "resolved_action": visual.resolved_action,+ "modifiers": modifiers,+ "phase": visual.phase(),+ "frame": visual.frame(),+ "preempted_count": visual.preempted_count+ },+ "motion": {+ "start_handle": motion.start_handle,+ "end_handle": motion.end_handle,+ "arc_size": motion.arc_size,+ "arc_flow": motion.arc_flow,+ "spring": motion.spring,+ "glide_duration_ms": motion.glide_duration_ms,+ "dwell_after_click_ms": motion.dwell_after_click_ms,+ "idle_hide_ms": motion.idle_hide_ms,+ "turn_radius": motion.turn_radius+ }+ }),+ )}}-// ── Headless unit tests for cursor-key resolution ─────────────────────────-#[cfg(test)]mod tests {use super::resolve_cursor_key;use serde_json::json;#[test]- fn anonymous_defaults_to_a_stable_cursor_session() {- // No session/cursor_id declared → a stable per-daemon "auto-…" cursor- // session (never the empty key), so the agent cursor shows by default.- // The id is consistent across calls within the process.- let a = resolve_cursor_key(&json!({}));- let b = resolve_cursor_key(&json!({ "x": 1 }));- assert!(a.starts_with("auto-"), "got {a}");- assert_ne!(a, "");- assert_eq!(- a, b,- "the anonymous default must stay the same across calls"- );- // The minted per-run `_session_id` now DOES drive the cursor (consistent run id).- assert_eq!(- resolve_cursor_key(&json!({ "_session_id": "mcp-1-2" })),- "mcp-1-2"- );- }-- #[test]- fn explicit_session_owns_a_cursor() {- assert_eq!(- resolve_cursor_key(&json!({ "session": "research-run" })),- "research-run"- );- }-- #[test]- fn cursor_id_is_a_legacy_alias() {- // `cursor_id` still works (codex-wrapper use case); `session` wins if both.- assert_eq!(- resolve_cursor_key(&json!({ "cursor_id": "user-handle" })),- "user-handle"- );- assert_eq!(- resolve_cursor_key(&json!({ "session": "s1", "cursor_id": "c1" })),- "s1"- );+ fn anonymous_calls_share_a_stable_auto_session() {+ let first = resolve_cursor_key(&json!({}));+ let second = resolve_cursor_key(&json!({ "x": 1 }));+ assert!(first.starts_with("auto-"));+ assert_eq!(first, second);}#[test]- fn get_agent_cursor_state_is_session_scoped() {- // A fabricated registry with two sessions' cursors; the scoped read for- // one session must return ONLY that session's cursor (no cross-session- // leak) and a deterministic `enabled` for that key.- use crate::cursor::CursorRegistry;- let reg = CursorRegistry::new();- reg.set_enabled("sessA", true);- reg.set_enabled("sessB", false);-- let a = reg.get("sessA").expect("sessA present");- assert!(a.config.enabled);- let b = reg.get("sessB").expect("sessB present");- assert!(!b.config.enabled);- // Scoping to sessB must not see sessA's enabled flag.- assert_ne!(a.config.enabled, b.config.enabled);- // A never-touched session has no entry — no phantom materialised.- assert!(reg.get("sessC-never-touched").is_none());- }-- #[test]- fn enable_and_ax_click_resolve_the_same_session_cursor() {- // In one run, set_agent_cursor_enabled and a click(element_index) carry- // the SAME explicit `session`, so both resolve the same cursor key —- // enabling the cursor lights the very cursor the AX click drives.- let session = "research-run";- let enable_args = json!({ "enabled": true, "session": session });- let ax_click_args =- json!({ "pid": 844, "window_id": 10725, "element_index": 14, "session": session });- let enable_key = resolve_cursor_key(&enable_args);- let click_key = resolve_cursor_key(&ax_click_args);- assert_eq!(enable_key, session);+ fn explicit_session_wins_over_injected_session() {assert_eq!(- enable_key, click_key,- "set_agent_cursor_enabled and the AX click must drive the same session cursor"+ resolve_cursor_key(&json!({+ "session": "explicit",+ "_session_id": "injected"+ })),+ "explicit");}#[test]- fn get_config_reports_calling_session_cursor_deterministically() {- // BUG 3 regression: get_config's cursor_enabled must reflect the CALLING- // session's own cursor (resolved by key), not a nondeterministic- // HashMap.first(). Two sessions with opposite enabled flags must each- // read back their OWN value.- use crate::cursor::CursorRegistry;- let reg = CursorRegistry::new();- reg.set_enabled("sessA", true);- reg.set_enabled("sessB", false);-- // Replicate get_config's resolution: key = resolve_cursor_key(args),- // then get(key) or get("default").- let read_for = |args: &serde_json::Value| -> bool {- let key = resolve_cursor_key(args);- reg.get(&key)- .or_else(|| reg.get("default"))- .map(|s| s.config.enabled)- .unwrap_or(true)- };- assert!(read_for(&json!({ "session": "sessA" })));- assert!(!read_for(&json!({ "session": "sessB" })));- // Anonymous caller (no session) falls back to the seeded default (on).- assert!(read_for(&json!({})));- }-- #[test]- fn empty_strings_fall_through_to_the_default_cursor() {- // An empty `session` falls through to `cursor_id`; both empty → the stable- // per-daemon default (never the empty key, so a cursor is still shown).- assert_eq!(- resolve_cursor_key(&json!({ "session": "", "cursor_id": "c1" })),- "c1"+ fn removed_cursor_id_alias_is_not_an_identity_source() {+ assert_ne!(+ resolve_cursor_key(&json!({ "cursor_id": "legacy" })),+ "legacy");- let both_empty = resolve_cursor_key(&json!({ "session": "", "cursor_id": "" }));- assert!(both_empty.starts_with("auto-"), "got {both_empty}");- assert_ne!(both_empty, "");}}diff --git a/libs/cua-driver/rust/crates/platform-macos/src/tools/mod.rs b/libs/cua-driver/rust/crates/platform-macos/src/tools/mod.rsindex 57124ecc45..4c9c1ed1b3 100644--- a/libs/cua-driver/rust/crates/platform-macos/src/tools/mod.rs+++ b/libs/cua-driver/rust/crates/platform-macos/src/tools/mod.rs@@ -552,9 +552,7 @@ pub fn register_all(Some(state) => cua_driver_core::session::bounded_cursor_outcome(true,state.config.enabled,- state.config.cursor_icon.as_deref(),- state.config.cursor_color.as_deref(),- state.config.cursor_label.as_deref(),+ Some(state.config.theme_id.as_str()),motion_customized,active_cursor_count,),@@ -562,8 +560,6 @@ pub fn register_all(false,false,None,- None,- None,false,active_cursor_count,),@@ -647,7 +643,7 @@ pub fn register_all(registry.register(Box::new(cursor_tools::SetAgentCursorMotionTool::new(state.clone(),)));- registry.register(Box::new(cursor_tools::SetAgentCursorStyleTool::new(+ registry.register(Box::new(cursor_tools::SetAgentCursorThemeTool::new(state.clone(),)));registry.register(Box::new(cursor_tools::GetAgentCursorStateTool::new(diff --git a/libs/cua-driver/rust/crates/platform-windows/examples/cursor_visibility.rs b/libs/cua-driver/rust/crates/platform-windows/examples/cursor_visibility.rsdeleted file mode 100644index e392ce8202..0000000000--- a/libs/cua-driver/rust/crates/platform-windows/examples/cursor_visibility.rs+++ /dev/null@@ -1,168 +0,0 @@-//! TDD harness for the agent cursor overlay — drives the LIVE DAEMON.-//!-//! Strategy: set the cursor to pure-magenta gradient (a colour that does not-//! naturally appear on screen), move it to a target, screenshot, and search-//! the screenshot for magenta pixels. Cleaner than diffing two screenshots-//! because we don't compete with screen activity.-//!-//! Hard 2-second timeout on every pipe round-trip.--use std::io::{Read, Write};-use std::time::{Duration, Instant};--#[cfg(target_os = "windows")]-fn main() {- use image::GenericImageView;-- let target_x = 700i32;- let target_y = 500i32;-- let mut pipe = std::fs::OpenOptions::new()- .read(true)- .write(true)- .open(r"\\.\pipe\cua-driver")- .expect("open pipe — start daemon first");- println!("[1] connected");-- fn req(p: &mut std::fs::File, json: &str) -> String {- p.write_all(format!("{json}\n").as_bytes()).unwrap();- p.flush().ok();- let mut out = Vec::new();- let mut buf = [0u8; 8192];- let deadline = Instant::now() + Duration::from_secs(2);- loop {- if Instant::now() > deadline {- break;- }- let n = p.read(&mut buf).unwrap_or(0);- if n == 0 {- break;- }- out.extend_from_slice(&buf[..n]);- if out.contains(&b'\n') {- break;- }- }- String::from_utf8_lossy(&out).into_owned()- }-- let r2 = req(- &mut pipe,- r#"{"method":"call","name":"set_agent_cursor_enabled","args":{"enabled":true}}"#,- );- println!(" enabled resp: {}", r2.trim());- // Set bright pure-magenta gradient — easy to find, won't match any normal screen content.- let r3 = req(- &mut pipe,- r##"{"method":"call","name":"set_agent_cursor_style","args":{"gradient_colors":["#FF00FF","#FF00FF","#FF00FF"],"bloom_color":"#FF00FF"}}"##,- );- println!(" style resp: {}", r3.trim());-- let cmd = format!(- r#"{{"method":"call","name":"move_cursor","args":{{"x":{},"y":{}}}}}"#,- target_x, target_y- );- let r4 = req(&mut pipe, &cmd);- println!(" move resp: {}", r4.trim());-- // Poll until cursor centroid stops moving, with a 4s ceiling. Swift- // signals arrival via a one-shot channel; the Rust Windows overlay doesn't- // expose one yet, so we poll instead.- let deadline = Instant::now() + Duration::from_secs(4);- let mut last_centroid = (-1i64, -1i64);- let mut stable_ticks = 0;- let mut png;- loop {- std::thread::sleep(Duration::from_millis(150));- png = platform_windows::capture::screenshot_display_bytes().expect("screenshot");- let img = image::load_from_memory(&png).expect("decode");- let rgba = img.to_rgba8();- let (iw, ih) = img.dimensions();- let mut count = 0u64;- let mut sx = 0i64;- let mut sy = 0i64;- for py in 0..ih {- for px in 0..iw {- let p = rgba.get_pixel(px, py).0;- if p[0] > 180 && p[1] < 100 && p[2] > 180 {- count += 1;- sx += px as i64;- sy += py as i64;- }- }- }- if count > 50 {- let c = (sx / count as i64, sy / count as i64);- let dist = ((c.0 - last_centroid.0).pow(2) + (c.1 - last_centroid.1).pow(2)) as f64;- if dist.sqrt() < 3.0 {- stable_ticks += 1;- } else {- stable_ticks = 0;- }- println!(- " polling: centroid=({},{}) count={} stable={}",- c.0, c.1, count, stable_ticks- );- last_centroid = c;- if stable_ticks >= 3 {- break;- }- }- if Instant::now() > deadline {- println!(" polling: deadline reached");- break;- }- }- let _ = std::fs::write("O:/tmp_cursor_screen.png", &png);- let img = image::load_from_memory(&png).expect("decode");- let (w, h) = img.dimensions();- let rgba = img.to_rgba8();-- // Search whole screen for magenta-ish pixels (R high, G low, B high).- let mut magenta_count = 0u64;- let mut sx = 0i64;- let mut sy = 0i64;- let mut min_x = w as i32;- let mut max_x = 0i32;- let mut min_y = h as i32;- let mut max_y = 0i32;- for py in 0..h {- for px in 0..w {- let p = rgba.get_pixel(px, py).0;- // Tolerate antialiasing: R > 180, G < 100, B > 180- if p[0] > 180 && p[1] < 100 && p[2] > 180 {- magenta_count += 1;- sx += px as i64;- sy += py as i64;- min_x = min_x.min(px as i32);- max_x = max_x.max(px as i32);- min_y = min_y.min(py as i32);- max_y = max_y.max(py as i32);- }- }- }- println!("[4] screen {w}x{h}, magenta pixels: {magenta_count}");-- if magenta_count == 0 {- eprintln!("\n❌ FAIL: NO magenta cursor pixels found anywhere on screen.");- eprintln!(" The overlay window exists but isn't rendering, OR style cmd didn't apply.");- std::process::exit(1);- }-- let cx = sx / magenta_count as i64;- let cy = sy / magenta_count as i64;- let dx = (cx - target_x as i64).abs();- let dy = (cy - target_y as i64).abs();- println!("[5] centroid: ({cx},{cy}); bbox ({min_x},{min_y})-({max_x},{max_y})");- println!(" target was ({target_x},{target_y}); offset = ({dx},{dy})");-- if dx > 100 || dy > 100 {- eprintln!("\n❌ FAIL: cursor is rendering but at wrong location.");- eprintln!(" Expected near ({target_x},{target_y}), found centroid ({cx},{cy}).");- std::process::exit(2);- }- println!("\n✅ PASS: magenta cursor at ({cx},{cy}) close to target ({target_x},{target_y})");-}--#[cfg(not(target_os = "windows"))]-fn main() {}diff --git a/libs/cua-driver/rust/crates/platform-windows/examples/set_agent_cursor_style_parity.rs b/libs/cua-driver/rust/crates/platform-windows/examples/set_agent_cursor_style_parity.rsdeleted file mode 100644index 698289ab57..0000000000--- a/libs/cua-driver/rust/crates/platform-windows/examples/set_agent_cursor_style_parity.rs+++ /dev/null@@ -1,75 +0,0 @@-//! Parity check for `set_agent_cursor_style`.--use std::io::{Read, Write};-use std::time::{Duration, Instant};--#[cfg(target_os = "windows")]-fn main() {- let mut pipe = std::fs::OpenOptions::new()- .read(true)- .write(true)- .open(r"\\.\pipe\cua-driver")- .expect("open pipe");-- fn req(p: &mut std::fs::File, json: &str) -> String {- p.write_all(format!("{json}\n").as_bytes()).unwrap();- p.flush().ok();- let mut out = Vec::new();- let mut buf: Vec<u8> = vec![0u8; 64 * 1024];- let deadline = Instant::now() + Duration::from_secs(4);- loop {- if Instant::now() > deadline {- panic!("timeout");- }- let n = p.read(&mut buf).unwrap_or(0);- if n == 0 {- break;- }- out.extend_from_slice(&buf[..n]);- if out.contains(&b'\n') {- break;- }- }- String::from_utf8_lossy(&out).into_owned()- }- fn extract_text(v: &serde_json::Value) -> String {- v.pointer("/result/content/0/text")- .and_then(|t| t.as_str())- .or_else(|| v.pointer("/error").and_then(|e| e.as_str()))- .map(|s| s.to_owned())- .unwrap_or_default()- }-- // 1. Set gradient + bloom — text should reflect both.- let r1 = req(- &mut pipe,- r##"{"method":"call","name":"set_agent_cursor_style","args":{"gradient_colors":["#FF6B6B","#FF8E53"],"bloom_color":"#A855F7"}}"##,- );- let t1 = extract_text(&serde_json::from_str(r1.trim()).unwrap());- println!("Style resp: {t1:?}");- assert!(- t1.contains("✅ cursor style:")- && t1.contains("gradient_colors=[#FF6B6B,#FF8E53]")- && t1.contains("bloom_color=#A855F7"),- "Set-style text doesn't match Swift format: {t1:?}"- );- println!("Set OK");-- // 2. Revert all — should produce "✅ cursor style: reverted to default".- let r2 = req(- &mut pipe,- r#"{"method":"call","name":"set_agent_cursor_style","args":{"gradient_colors":[],"bloom_color":"","image_path":""}}"#,- );- let t2 = extract_text(&serde_json::from_str(r2.trim()).unwrap());- println!("Revert resp: {t2:?}");- assert_eq!(- t2, "✅ cursor style: reverted to default",- "Revert text wrong: {t2:?}"- );- println!("Revert OK");-- println!("\n✅ PASS: set_agent_cursor_style text format matches Swift");-}--#[cfg(not(target_os = "windows"))]-fn main() {}diff --git a/libs/cua-driver/rust/crates/platform-windows/src/overlay.rs b/libs/cua-driver/rust/crates/platform-windows/src/overlay.rsindex b5ce2f9dda..ecc98fd187 100644--- a/libs/cua-driver/rust/crates/platform-windows/src/overlay.rs+++ b/libs/cua-driver/rust/crates/platform-windows/src/overlay.rs@@ -15,7 +15,7 @@//! so concurrent MCP sessions clobbered each other last-writer-wins → one//! shared cursor. It now keeps a keyed [`RenderMap`] (`IndexMap<CursorKey,//! RenderState>`): each declared `session` owns its own cursor with its own-//! palette, and the ~125 Hz tick composites them all into the single layered+//! visual state, and the ~125 Hz tick composites them all into the single layered//! window. `IndexMap` gives deterministic insertion-ordered iteration = stable//! per-session z-order frame to frame. The lifecycle (lazy create, per-key//! arrival isolation, `session_end` removal, resurrection tombstone) mirrors@@ -38,7 +38,7 @@ use std::time::Instant;use cursor_overlay::{CursorConfig, CursorKey, KeyedOverlayCommand, MotionConfig, OverlayCommand, OverlayMsg,- Palette, RenderStateCore, ZOrderEnforcer,+ RenderStateCore, ZOrderEnforcer,};use indexmap::IndexMap;@@ -96,8 +96,7 @@ struct RenderMap {/// timer resolution defaults to 15ms so a hardcoded 8ms would run the/// animation at half speed).last_tick: Instant,- /// Frozen launch-time config used as the template for lazily-created- /// cursors (its palette is overridden per-key via `Palette::for_instance`).+ /// Frozen launch-time config used as the template for lazily-created cursors.template: CursorConfig,/// Render-side tombstone of permanently-ended session cursor keys. A `Cmd`/// for a key in here is dropped WITHOUT get-or-create, so an in-flight@@ -111,13 +110,11 @@ struct RenderMap {last_active: Option<CursorKey>,}-/// Build the `RenderState` for a lazily-created cursor key: derive from the-/// launch template but give each non-default key its own palette so distinct-/// sessions get distinct colours automatically.+/// Build the `RenderState` for a lazily-created session cursor from the+/// process launch template.fn render_state_for_key(template: &CursorConfig, key: &str) -> RenderState {- let mut rs = RenderState::new(template.clone());- rs.core.palette = Palette::for_instance(key);- rs+ let _ = key;+ RenderState::new(template.clone())}/// Apply one inbound [`OverlayMsg`] to the render map (drain step). Factored@@ -189,6 +186,38 @@ pub fn init(cfg: CursorConfig) {last_active: None,});});+ cua_driver_core::cursor_events::install_cursor_event_sink(std::sync::Arc::new(+ |event: cua_driver_core::cursor_events::CursorEvent| {+ use cua_driver_core::cursor_events::{CursorEvent, CursorEventPhase};+ let (session, cmd) = match event {+ CursorEvent::Action {+ session,+ phase: CursorEventPhase::Begin,+ semantics,+ } => (+ session,+ OverlayCommand::BeginAction {+ action: semantics.action,+ delivery: semantics.delivery,+ target: semantics.target,+ },+ ),+ CursorEvent::Action {+ session,+ phase: CursorEventPhase::End,+ semantics,+ } => (session, OverlayCommand::EndAction(semantics.action)),+ CursorEvent::SelectTheme { session, selection } => (+ session,+ OverlayCommand::SetTheme {+ theme_id: selection.theme_id,+ reduced_motion: selection.reduced_motion,+ },+ ),+ };+ send_command(session, cmd);+ },+ ));}/// Send a keyed command from any thread (MCP tool, etc.). Non-blocking; drops@@ -291,6 +320,25 @@ pub fn current_motion(key: &str) -> MotionConfig {.unwrap_or_default()}+pub fn current_theme_state(+ key: &str,+) -> Option<(+ String,+ String,+ String,+ Option<String>,+ cursor_overlay::CursorVisualState,+)> {+ let guard = RENDER.lock().ok()?;+ let map = guard.as_ref()?;+ let state = map+ .cursors+ .get(key)+ .or_else(|| map.cursors.get("default"))?;+ let (id, version, profile, fallback) = state.core.active_theme_metadata();+ Some((id, version, profile, fallback, state.core.visual.clone()))+}+/// Current screen position of the cursor for `key` (the off-screen sentinel/// `(-200, -200)` if it has never been placed). A session with no own cursor/// yet reports the sentinel so the click path treats it as first-placement.@@ -1173,15 +1221,18 @@ mod tests {}#[test]- fn lazily_created_cursors_get_distinct_palettes() {+ fn lazily_created_cursors_inherit_the_selected_theme() {let mut map = empty_map();apply_msg(&mut map, move_msg("sessA", 10.0, 10.0));apply_msg(&mut map, move_msg("sessB", 20.0, 20.0));- let a = &map.cursors["sessA"].core.palette;- let b = &map.cursors["sessB"].core.palette;- let def = &map.cursors["default"].core.palette;- assert_ne!(a.name, def.name);- assert_ne!(b.name, def.name);+ assert_eq!(+ map.cursors["sessA"].core.cfg.theme_id,+ map.cursors["default"].core.cfg.theme_id+ );+ assert_eq!(+ map.cursors["sessB"].core.cfg.theme_id,+ map.cursors["default"].core.cfg.theme_id+ );}#[test]diff --git a/libs/cua-driver/rust/crates/platform-windows/src/tools/impl_.rs b/libs/cua-driver/rust/crates/platform-windows/src/tools/impl_.rsindex ae70e1c017..ab81f25f48 100644--- a/libs/cua-driver/rust/crates/platform-windows/src/tools/impl_.rs+++ b/libs/cua-driver/rust/crates/platform-windows/src/tools/impl_.rs@@ -6835,449 +6835,242 @@ impl Tool for MoveCursorTool {// ── set_agent_cursor_enabled ──────────────────────────────────────────────────-pub struct SetAgentCursorEnabledTool {+pub struct SetAgentCursorEnabledV2Tool {state: Arc<ToolState>,}-static SCE_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();+static CURSOR_ENABLED_V2_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();#[async_trait]-impl Tool for SetAgentCursorEnabledTool {+impl Tool for SetAgentCursorEnabledV2Tool {fn def(&self) -> &ToolDef {- SCE_DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_enabled".into(),- // Description ported from Swift `SetAgentCursorEnabledTool.swift`.- description: "Toggle the visual agent-cursor overlay. When enabled, future \- pointer actions animate a floating arrow to the target's on-screen position \- before firing the click — purely visual, the click dispatch itself is \- unchanged. Disabling removes the overlay immediately.\n\n\- Default: enabled. Stays on for the life of the MCP session / daemon; \- disable with `{\"enabled\": false}` for headless / CI runs where the \- visual isn't wanted.\n\n\- Rust-only: `cursor_id` selects an instance from the multi-cursor registry; \- default is `'default'` (Swift has a single AgentCursor.shared).".into(),- input_schema: json!({"type":"object","required":["enabled"],"properties":{- "enabled":{"type":"boolean","description":"True to show the overlay cursor; false to hide."},- "cursor_id":{"type":"string","description":"Rust-only: multi-cursor instance id. Default 'default'."}- },"additionalProperties":false}),- read_only: false, destructive: false, idempotent: true, open_world: false,- })+ CURSOR_ENABLED_V2_DEF.get_or_init(|| canonical_cursor_def("set_agent_cursor_enabled"))}+async fn invoke(&self, args: Value) -> ToolResult {- // Swift error wording 1:1.- let enabled = match args.get("enabled").and_then(|v| v.as_bool()) {- Some(v) => v,+ let enabled = match args.get("enabled").and_then(Value::as_bool) {+ Some(value) => value,None => return ToolResult::error("Missing required boolean field `enabled`."),};- let cursor_key = resolve_cursor_key(&args);- if !cursor_key.is_empty() {- self.state.cursor_registry.set_enabled(&cursor_key, enabled);+ let session = resolve_cursor_key(&args);+ if session.is_empty() {+ return ToolResult::error("`session` is required for agent cursor controls.");}+ self.state.cursor_registry.set_enabled(&session, enabled);crate::overlay::send_command(- cursor_key.clone(),+ session.clone(),cursor_overlay::OverlayCommand::SetEnabled(enabled),);- // Match Swift text format 1:1: `"✅ Agent cursor enabled."`- // (or `"✅ Agent cursor disabled."`).- ToolResult::text(if enabled {- "✅ Agent cursor enabled.".to_owned()- } else {- "✅ Agent cursor disabled.".to_owned()- })+ ToolResult::text(format!(+ "Agent cursor for session '{session}' {}.",+ if enabled { "enabled" } else { "disabled" }+ ))+ .with_structured(json!({"session":session,"enabled":enabled}))}}-// ── set_agent_cursor_motion ───────────────────────────────────────────────────+pub struct SetAgentCursorMotionV2Tool;-pub struct SetAgentCursorMotionTool {- state: Arc<ToolState>,-}+static CURSOR_MOTION_V2_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();-static CURSOR_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();+fn cursor_number(value: Option<&Value>) -> Option<f64> {+ value.and_then(|value| {+ value+ .as_f64()+ .or_else(|| value.as_i64().map(|integer| integer as f64))+ })+}#[async_trait]-impl Tool for SetAgentCursorMotionTool {+impl Tool for SetAgentCursorMotionV2Tool {fn def(&self) -> &ToolDef {- CURSOR_DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_motion".into(),- description: format!("Configure the visual appearance and motion curve of an agent cursor instance.\n\n\- Appearance:\n\- - cursor_id: instance name (default='default')\n\- - cursor_icon: built-in ({}) or a path to a PNG/JPEG/SVG/ICO file; '' reverts to the default cursor\n\- - cursor_color: hex color e.g. '#00FFFF' or CSS name\n\- - cursor_label: short text shown near the cursor\n\- - cursor_size: dot radius in points (default=16)\n\- - cursor_opacity: 0.0–1.0 (default=0.85)\n\n\- Motion curve (Bezier):\n\- - arc_size: perpendicular deflection as fraction of path length [0,1]. Default 0.25\n\- - spring: settle damping [0.3,1.0]; 1.0=no overshoot. Default 0.72\n\- - glide_duration_ms: fixed flight duration per move [50,5000]; omit for speed-based (the default)\n\- - dwell_after_click_ms: pause after click ripple [0,5000]. Default 80\n\- - idle_hide_ms: auto-hide delay [0,60000]; 0=never. Default 20000",- cursor_overlay::BuiltinShape::names_help()),- input_schema: json!({- "type":"object","properties":{- "cursor_id":{"type":"string"},- "cursor_icon":{"type":"string"},- "cursor_color":{"type":"string"},- "cursor_label":{"type":"string"},- "cursor_size":{"type":"number"},- "cursor_opacity":{"type":"number"},- "start_handle":{"type":"number","description":"Start-handle fraction [0,1]. Default 0.3."},- "end_handle":{"type":"number","description":"End-handle fraction [0,1]. Default 0.3."},- "arc_size":{"type":"number","description":"Arc deflection as fraction of path length [0,1]. Default 0.25."},- "arc_flow":{"type":"number","description":"Asymmetry bias [-1,1]. Default 0.0."},- "spring":{"type":"number","description":"Settle damping [0.3,1.0]. Default 0.72."},- "glide_duration_ms":{"type":"number","minimum":50,"maximum":5000,"description":"Fixed flight duration per move in ms; omit for speed-based timing (the default)."},- "dwell_after_click_ms":{"type":"number","minimum":0,"maximum":5000,"description":"Pause after click ripple in ms. Default 80."},- "idle_hide_ms":{"type":"number","minimum":0,"maximum":60000,"description":"Auto-hide delay in ms. 0=never. Default 20000."},- "turn_radius":{"type":"number","minimum":1,"maximum":1000,"description":"Minimum turning radius of the glide path in points; smaller = tighter curves. Default 80."}- },"additionalProperties":false- }),- read_only: false, destructive: false, idempotent: true, open_world: false,- })+ CURSOR_MOTION_V2_DEF.get_or_init(|| canonical_cursor_def("set_agent_cursor_motion"))}+async fn invoke(&self, args: Value) -> ToolResult {- // JSON numbers without decimals parse as ints; coerce to f64 so- // callers can write `{"glide_duration_ms": 1500}` without it being- // silently ignored (matches Swift's `number()` helper).- fn num(v: Option<&Value>) -> Option<f64> {- v.and_then(|x| x.as_f64().or_else(|| x.as_i64().map(|i| i as f64)))- }- // Cursor key: caller-declared `session` > legacy `cursor_id` > NO_CURSOR.- let cursor_id = resolve_cursor_key(&args);- // 0. Resolve `cursor_icon` (built-in name or image path — same vocabulary- // as the CLI flags) to a shape override and dispatch it below, so the- // overlay actually changes instead of only recording the string.- let mut shape_cmd: Option<cursor_overlay::OverlayCommand> = None;- if let Some(icon) = args.get("cursor_icon").and_then(|v| v.as_str()) {- let icon_owned = icon.to_owned();- match tokio::task::spawn_blocking(move || {- cursor_overlay::resolve_cursor_icon(&icon_owned)- })- .await- {- Ok(Ok(resolution)) => {- shape_cmd = Some(cursor_overlay::OverlayCommand::from_cursor_icon(resolution))- }- Ok(Err(e)) => return ToolResult::error(format!("Invalid cursor_icon: {e}")),- Err(e) => return ToolResult::error(format!("Task error: {e}")),- }- }- // 1. Per-instance appearance fields (Rust-only).- self.state.cursor_registry.update_config(&cursor_id, |cfg| {- if let Some(v) = args.get("cursor_icon").and_then(|v| v.as_str()) {- cfg.cursor_icon = Some(v.to_owned());- }- if let Some(v) = args.get("cursor_color").and_then(|v| v.as_str()) {- cfg.cursor_color = Some(v.to_owned());- }- if let Some(v) = args.get("cursor_label").and_then(|v| v.as_str()) {- cfg.cursor_label = Some(v.to_owned());- }- if let Some(v) = num(args.get("cursor_size")) {- cfg.cursor_size = Some(v);- }- if let Some(v) = num(args.get("cursor_opacity")) {- cfg.cursor_opacity = Some(v.clamp(0.0, 1.0));- }- });- if let Some(cmd) = shape_cmd {- crate::overlay::send_command(cursor_id.clone(), cmd);- }- // 2. Apply motion knobs to the live render state — was silently- // dropped before; this is the Swift parity behavior.- let current = crate::overlay::current_motion(&cursor_id);- let updated = current.with_overrides(- num(args.get("start_handle")),- num(args.get("end_handle")),- num(args.get("arc_size")),- num(args.get("arc_flow")),- num(args.get("spring")),- num(args.get("glide_duration_ms")),- num(args.get("dwell_after_click_ms")),- num(args.get("idle_hide_ms")),- None, // press_duration_ms — not in Swift tool surface- num(args.get("turn_radius")),+ let session = resolve_cursor_key(&args);+ if session.is_empty() {+ return ToolResult::error("`session` is required for agent cursor controls.");+ }+ let current = crate::overlay::current_motion(&session);+ let motion = current.with_overrides(+ cursor_number(args.get("start_handle")),+ cursor_number(args.get("end_handle")),+ cursor_number(args.get("arc_size")),+ cursor_number(args.get("arc_flow")),+ cursor_number(args.get("spring")),+ cursor_number(args.get("glide_duration_ms")),+ cursor_number(args.get("dwell_after_click_ms")),+ cursor_number(args.get("idle_hide_ms")),+ None,+ cursor_number(args.get("turn_radius")),);crate::overlay::send_command(- cursor_id.clone(),- cursor_overlay::OverlayCommand::SetMotion(updated.clone()),+ session.clone(),+ cursor_overlay::OverlayCommand::SetMotion(motion.clone()),);- // Match Swift text format 1:1.- let summary = format!(- "cursor motion: startHandle={sh} endHandle={eh} arcSize={asz} arcFlow={af} \- spring={sp} glideDurationMs={gd} dwellAfterClickMs={dw} idleHideMs={ih} turnRadius={tr}",- sh = updated.start_handle, eh = updated.end_handle,- asz = updated.arc_size, af = updated.arc_flow,- sp = updated.spring,- gd = updated.glide_duration_ms as i64,- dw = updated.dwell_after_click_ms as i64,- ih = updated.idle_hide_ms as i64,- tr = updated.turn_radius as i64,- );- ToolResult::text(format!("✅ {summary}")).with_structured(json!({- "cursor_id": cursor_id,- "start_handle": updated.start_handle,- "end_handle": updated.end_handle,- "arc_size": updated.arc_size,- "arc_flow": updated.arc_flow,- "spring": updated.spring,- "glide_duration_ms": updated.glide_duration_ms,- "dwell_after_click_ms": updated.dwell_after_click_ms,- "idle_hide_ms": updated.idle_hide_ms,- "turn_radius": updated.turn_radius,- }))+ ToolResult::text(format!(+ "Agent cursor motion updated for session '{session}'."+ ))+ .with_structured(json!({"session":session,"motion":{+ "start_handle":motion.start_handle,+ "end_handle":motion.end_handle,+ "arc_size":motion.arc_size,+ "arc_flow":motion.arc_flow,+ "spring":motion.spring,+ "glide_duration_ms":motion.glide_duration_ms,+ "dwell_after_click_ms":motion.dwell_after_click_ms,+ "idle_hide_ms":motion.idle_hide_ms,+ "turn_radius":motion.turn_radius+ }}))}}-// ── get_agent_cursor_state ────────────────────────────────────────────────────--pub struct GetAgentCursorStateTool {+pub struct SetAgentCursorThemeTool {state: Arc<ToolState>,}-static GCSTATE_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();+static CURSOR_THEME_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();++fn cursor_reduced_motion(value: Option<&str>) -> cursor_overlay::ReducedMotion {+ match value {+ Some("on") => cursor_overlay::ReducedMotion::On,+ Some("off") => cursor_overlay::ReducedMotion::Off,+ _ => cursor_overlay::ReducedMotion::Auto,+ }+}#[async_trait]-impl Tool for GetAgentCursorStateTool {+impl Tool for SetAgentCursorThemeTool {fn def(&self) -> &ToolDef {- GCSTATE_DEF.get_or_init(|| ToolDef {- name: "get_agent_cursor_state".into(),- // Description ported from Swift `GetAgentCursorStateTool.swift`.- description: "Report the current agent-cursor configuration: enabled flag, \- motion knobs (startHandle, endHandle, arcSize, arcFlow, spring), glide \- duration, post-click dwell, and idle-hide delay. Durations come back in \- milliseconds to match the setter's units. Pure read-only — no side effects."- .into(),- input_schema: json!({"type":"object","properties":{},"additionalProperties":false}),- read_only: true,- destructive: false,- idempotent: true,- open_world: false,- })+ CURSOR_THEME_DEF.get_or_init(|| canonical_cursor_def("set_agent_cursor_theme"))}+async fn invoke(&self, args: Value) -> ToolResult {- // Report THIS session's cursor (caller-declared `session` > `cursor_id`- // > "default"), mirroring macOS get_agent_cursor_state scoping.- let cursor_key = resolve_cursor_key(&args);- let enabled = crate::overlay::is_enabled(&cursor_key);- let motion = crate::overlay::current_motion(&cursor_key);- // Swift text format 1:1: single-line camelCase key=value pairs.- let summary = format!(- "cursor: enabled={enabled} startHandle={sh} endHandle={eh} arcSize={asz} \- arcFlow={af} spring={sp} glideDurationMs={gd} dwellAfterClickMs={dw} idleHideMs={ih} turnRadius={tr}",- sh = motion.start_handle, eh = motion.end_handle,- asz = motion.arc_size, af = motion.arc_flow,- sp = motion.spring,- gd = motion.glide_duration_ms as i64,- dw = motion.dwell_after_click_ms as i64,- ih = motion.idle_hide_ms as i64,- tr = motion.turn_radius as i64,+ let Some(theme_id) = args.get("theme_id").and_then(Value::as_str) else {+ return ToolResult::error("Missing required string field `theme_id`.");+ };+ let session = resolve_cursor_key(&args);+ if session.is_empty() {+ return ToolResult::error("`session` is required for agent cursor controls.");+ }+ let resolved_theme = match cursor_overlay::resolve_theme_selection(theme_id) {+ Ok(theme) => theme,+ Err(error) => {+ return ToolResult::error(format!(+ "Cursor theme '{theme_id}' cannot be selected: {error}"+ ));+ }+ };+ let (version, profile) = resolved_theme+ .as_deref()+ .map(|theme| (theme.version.as_str(), theme.profile.as_str()))+ .unwrap_or((+ cursor_overlay::DEFAULT_THEME_VERSION,+ cursor_overlay::THEME_PROFILE,+ ));+ let reduced_motion =+ cursor_reduced_motion(args.get("reduced_motion").and_then(Value::as_str));+ self.state+ .cursor_registry+ .update_config(&session, |config| {+ config.theme_id = theme_id.to_owned();+ config.reduced_motion = reduced_motion;+ });+ crate::overlay::send_command(+ session.clone(),+ cursor_overlay::OverlayCommand::SetTheme {+ theme_id: theme_id.to_owned(),+ reduced_motion,+ },);- // Rust-only structured payload: the same fields + the multi-cursor- // instance map. Cursor instances are a Rust-only extension.- let cursors =- serde_json::to_value(self.state.cursor_registry.all_states()).unwrap_or_default();- ToolResult::text(format!("✅ {summary}")).with_structured(json!({- "enabled": enabled,- "start_handle": motion.start_handle,- "end_handle": motion.end_handle,- "arc_size": motion.arc_size,- "arc_flow": motion.arc_flow,- "spring": motion.spring,- "glide_duration_ms": motion.glide_duration_ms,- "dwell_after_click_ms": motion.dwell_after_click_ms,- "idle_hide_ms": motion.idle_hide_ms,- "turn_radius": motion.turn_radius,- "cursors": cursors,- }))+ ToolResult::text(format!(+ "Agent cursor theme for session '{session}' set to '{theme_id}'."+ ))+ .with_structured(json!({"session":session,"theme":{+ "id":theme_id,+ "version":version,+ "profile":profile,+ "reduced_motion":reduced_motion,+ "fallback":null+ }}))}}-// ── set_agent_cursor_style ────────────────────────────────────────────────────+pub struct GetAgentCursorStateV2Tool;-pub struct SetAgentCursorStyleTool {- state: Arc<ToolState>,-}--static STYLE_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();+static CURSOR_STATE_V2_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();#[async_trait]-impl Tool for SetAgentCursorStyleTool {+impl Tool for GetAgentCursorStateV2Tool {fn def(&self) -> &ToolDef {- STYLE_DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_style".into(),- description:- "Update the visual style of the agent cursor overlay.\n\n\- - 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.\n\- - bloom_color: hex string for the radial halo/bloom behind the cursor \- (e.g. \"#00FFFF\"). Empty string reverts to the default.\n\- - 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.\n\- All parameters are optional; omit any you do not want to change."- .into(),- input_schema: json!({- "type": "object",- "properties": {- "cursor_id": {- "type": "string",- "description": "Cursor instance. Default: 'default'."- },- "gradient_colors": {- "type": "array",- "items": { "type": "string" },- "description": "CSS hex gradient stops tip→tail. [] = revert to default."- },- "bloom_color": {- "type": "string",- "description": "Hex bloom/halo colour (e.g. '#00FFFF'). '' = revert to default."- },- "image_path": {- "type": "string",- "description": "Path to PNG/JPEG/SVG/ICO cursor image. '' = revert to the default cursor."- }- },- "additionalProperties": false- }),- read_only: false, destructive: false, idempotent: true, open_world: false,- })+ CURSOR_STATE_V2_DEF.get_or_init(|| canonical_cursor_def("get_agent_cursor_state"))}async fn invoke(&self, args: Value) -> ToolResult {- // Cursor key: caller-declared `session` > legacy `cursor_id` > NO_CURSOR.- let cursor_id = resolve_cursor_key(&args);-- // image_path- let image_path = args.get("image_path").and_then(|v| v.as_str());- let shape_cmd: Option<cursor_overlay::OverlayCommand> = if let Some(path) = image_path {- if path.is_empty() {- Some(cursor_overlay::OverlayCommand::SetShape(None))- } else {- let path_owned = path.to_owned();- match tokio::task::spawn_blocking(move || {- cursor_overlay::CursorShape::load(&path_owned)- })- .await- {- Ok(Ok(shape)) => {- let path_owned2 = path.to_owned();- self.state.cursor_registry.update_config(&cursor_id, |c| {- c.cursor_icon = Some(path_owned2);- });- Some(cursor_overlay::OverlayCommand::SetShape(Some(shape)))- }- Ok(Err(e)) => {- return ToolResult::error(format!("Failed to load image_path: {e}"))- }- Err(e) => return ToolResult::error(format!("Task error: {e}")),- }- }- } else {- None- };-- // gradient_colors- let gradient_colors: Vec<[u8; 4]> =- if let Some(arr) = args.get("gradient_colors").and_then(|v| v.as_array()) {- let mut out = vec![];- for v in arr {- if let Some(hex) = v.as_str() {- match parse_hex_color(hex) {- Some(c) => out.push(c),- None => return ToolResult::error(format!("Invalid hex color: {hex}")),- }- }- }- out- } else {- vec![]- };-- // bloom_color- let bloom_color: Option<Option<[u8; 4]>> =- if let Some(hex) = args.get("bloom_color").and_then(|v| v.as_str()) {- if hex.is_empty() {- Some(None)- } else {- match parse_hex_color(hex) {- Some(c) => Some(Some(c)),- None => return ToolResult::error(format!("Invalid bloom_color: {hex}")),- }- }- } else {- None- };-- // Dispatch to overlay- if let Some(cmd) = shape_cmd {- crate::overlay::send_command(cursor_id.clone(), cmd);- }- let gradient_provided = args.get("gradient_colors").is_some();- let bloom_provided = args.get("bloom_color").is_some();- if gradient_provided || bloom_provided {- crate::overlay::send_command(- cursor_id.clone(),- cursor_overlay::OverlayCommand::SetGradient {- gradient_colors,- bloom_color: bloom_color.flatten(),+ let session = resolve_cursor_key(&args);+ if session.is_empty() {+ return ToolResult::error("`session` is required for agent cursor controls.");+ }+ let enabled = crate::overlay::is_enabled(&session);+ let motion = crate::overlay::current_motion(&session);+ let (theme_id, version, profile, fallback, visual) =+ crate::overlay::current_theme_state(&session).unwrap_or_else(|| {+ (+ cursor_overlay::DEFAULT_THEME_ID.into(),+ cursor_overlay::DEFAULT_THEME_VERSION.into(),+ cursor_overlay::THEME_PROFILE.into(),+ None,+ cursor_overlay::CursorVisualState::default(),+ )+ });+ let modifiers: Vec<&str> = [+ visual.delivery.map(|value| value.as_str()),+ visual.target.map(|value| value.as_str()),+ ]+ .into_iter()+ .flatten()+ .collect();+ ToolResult::text(format!("Agent cursor state for session '{session}'.")).with_structured(+ json!({+ "session":session,+ "enabled":enabled,+ "position":null,+ "theme":{+ "id":theme_id,+ "version":version,+ "profile":profile,+ "reduced_motion":visual.reduced_motion,+ "fallback":fallback},- );- }-- // Swift `SetAgentCursorStyleTool` text format: only include fields- // whose post-write value is `Some` (i.e. not reverted to default).- // Falls back to "✅ cursor style: reverted to default" when every- // field is empty.- let mut parts: Vec<String> = Vec::new();- if let Some(arr) = args.get("gradient_colors").and_then(|v| v.as_array()) {- let hexes: Vec<String> = arr- .iter()- .filter_map(|v| v.as_str().map(str::to_owned))- .collect();- if !hexes.is_empty() {- parts.push(format!("gradient_colors=[{}]", hexes.join(",")));- }- }- if let Some(s) = args.get("bloom_color").and_then(|v| v.as_str()) {- if !s.is_empty() {- parts.push(format!("bloom_color={s}"));- }- }- if let Some(s) = image_path {- if !s.is_empty() {- parts.push(format!("image_path={s}"));- }- }- let summary = if parts.is_empty() {- "reverted to default".to_owned()- } else {- parts.join(" ")- };- ToolResult::text(format!("✅ cursor style: {summary}"))+ "visual_state":{+ "requested_action":visual.requested_action,+ "resolved_action":visual.resolved_action,+ "modifiers":modifiers,+ "phase":visual.phase(),+ "frame":visual.frame(),+ "preempted_count":visual.preempted_count+ },+ "motion":{+ "start_handle":motion.start_handle,+ "end_handle":motion.end_handle,+ "arc_size":motion.arc_size,+ "arc_flow":motion.arc_flow,+ "spring":motion.spring,+ "glide_duration_ms":motion.glide_duration_ms,+ "dwell_after_click_ms":motion.dwell_after_click_ms,+ "idle_hide_ms":motion.idle_hide_ms,+ "turn_radius":motion.turn_radius+ }+ }),+ )}}-fn parse_hex_color(hex: &str) -> Option<[u8; 4]> {- let s = hex.trim_start_matches('#');- match s.len() {- 6 => {- let r = u8::from_str_radix(&s[0..2], 16).ok()?;- let g = u8::from_str_radix(&s[2..4], 16).ok()?;- let b = u8::from_str_radix(&s[4..6], 16).ok()?;- Some([r, g, b, 255])- }- 3 => {- let r = u8::from_str_radix(&s[0..1].repeat(2), 16).ok()?;- let g = u8::from_str_radix(&s[1..2].repeat(2), 16).ok()?;- let b = u8::from_str_radix(&s[2..3].repeat(2), 16).ok()?;- Some([r, g, b, 255])- }- _ => None,- }+fn canonical_cursor_def(name: &str) -> ToolDef {+ let contract = cua_driver_contract::tool_contract(name)+ .unwrap_or_else(|| panic!("missing canonical cursor contract for {name}"));+ ToolDef::from_contract(&contract)}// ── check_permissions ─────────────────────────────────────────────────────────@@ -8612,9 +8405,7 @@ pub fn build_registry_with_provider(Some(state) => cua_driver_core::session::bounded_cursor_outcome(true,state.config.enabled,- state.config.cursor_icon.as_deref(),- state.config.cursor_color.as_deref(),- state.config.cursor_label.as_deref(),+ Some(state.config.theme_id.as_str()),motion_customized,active_cursor_count,),@@ -8622,8 +8413,6 @@ pub fn build_registry_with_provider(false,false,None,- None,- None,false,active_cursor_count,),@@ -8727,16 +8516,12 @@ pub fn build_registry_with_provider(r.register(Box::new(MoveCursorTool {state: state.clone(),}));- r.register(Box::new(SetAgentCursorEnabledTool {- state: state.clone(),- }));- r.register(Box::new(SetAgentCursorMotionTool {- state: state.clone(),- }));- r.register(Box::new(GetAgentCursorStateTool {+ r.register(Box::new(SetAgentCursorEnabledV2Tool {state: state.clone(),}));- r.register(Box::new(SetAgentCursorStyleTool {+ r.register(Box::new(SetAgentCursorMotionV2Tool));+ r.register(Box::new(GetAgentCursorStateV2Tool));+ r.register(Box::new(SetAgentCursorThemeTool {state: state.clone(),}));r.register(Box::new(CheckPermissionsTool));diff --git a/libs/cua-driver/rust/crates/platform-windows/src/tools/stubs.rs b/libs/cua-driver/rust/crates/platform-windows/src/tools/stubs.rsindex 03065c3a3e..a540c10854 100644--- a/libs/cua-driver/rust/crates/platform-windows/src/tools/stubs.rs+++ b/libs/cua-driver/rust/crates/platform-windows/src/tools/stubs.rs@@ -47,6 +47,35 @@ macro_rules! stub_tool {};}+macro_rules! contract_stub_tool {+ ($mod_name:ident, $struct_name:ident, $tool_name:literal) => {+ mod $mod_name {+ use super::*;+ pub struct $struct_name;+ static DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();+ impl $struct_name {+ pub fn def_static() -> &'static ToolDef {+ DEF.get_or_init(|| {+ let contract = cua_driver_contract::tool_contract($tool_name)+ .expect("canonical cursor contract exists");+ ToolDef::from_contract(&contract)+ })+ }+ }+ #[async_trait]+ impl Tool for $struct_name {+ fn def(&self) -> &ToolDef {+ Self::def_static()+ }+ async fn invoke(&self, _args: Value) -> ToolResult {+ not_impl($tool_name)+ }+ }+ }+ pub use $mod_name::$struct_name;+ };+}+stub_tool!(list_apps_m,ListAppsTool,@@ -163,24 +192,25 @@ stub_tool!(serde_json::json!({"type":"object","properties":{},"additionalProperties":false}));-stub_tool!(cursor_motion_m, SetAgentCursorMotionTool, "set_agent_cursor_motion",- format!("Configure the visual appearance of an agent cursor instance.\n\nExtended cursor customization for multi-cursor use cases:\n- cursor_id: instance name (default='default')\n- cursor_icon: built-in ({}) or a path to a PNG/JPEG/SVG/ICO file; '' reverts to the default cursor\n- cursor_color: hex color e.g. '#00FFFF' or CSS name\n- cursor_label: short text shown near the cursor\n- cursor_size: dot radius in points (default=16)\n- cursor_opacity: 0.0–1.0 (default=0.85)", cursor_overlay::BuiltinShape::names_help()),- serde_json::json!({"type":"object","properties":{"cursor_id":{"type":"string"},"cursor_icon":{"type":"string"},"cursor_color":{"type":"string"},"cursor_label":{"type":"string"},"cursor_size":{"type":"number"},"cursor_opacity":{"type":"number"}},"additionalProperties":false}));--stub_tool!(- get_cursor_state_m,- GetAgentCursorStateTool,- "get_agent_cursor_state",- "Return the current state of all agent cursor instances.",- serde_json::json!({"type":"object","properties":{},"additionalProperties":false})+contract_stub_tool!(+ cursor_enabled_v2_m,+ SetAgentCursorEnabledV2Tool,+ "set_agent_cursor_enabled");--stub_tool!(- set_cursor_style_m,- SetAgentCursorStyleTool,- "set_agent_cursor_style",- "Update the visual style of the agent cursor overlay.",- serde_json::json!({"type":"object","properties":{"cursor_id":{"type":"string"},"gradient_colors":{"type":"array","items":{"type":"string"}},"bloom_color":{"type":"string"},"image_path":{"type":"string"}},"additionalProperties":false})+contract_stub_tool!(+ cursor_motion_v2_m,+ SetAgentCursorMotionV2Tool,+ "set_agent_cursor_motion"+);+contract_stub_tool!(+ get_cursor_state_v2_m,+ GetAgentCursorStateV2Tool,+ "get_agent_cursor_state"+);+contract_stub_tool!(+ cursor_theme_m,+ SetAgentCursorThemeTool,+ "set_agent_cursor_theme");stub_tool!(@@ -264,48 +294,6 @@ mod move_cursor_m {}pub use move_cursor_m::MoveCursorTool;-mod set_enabled_m {- use super::*;- pub struct SetAgentCursorEnabledTool;- static DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();- impl SetAgentCursorEnabledTool {- pub fn def_static() -> &'static ToolDef {- DEF.get_or_init(|| ToolDef {- name: "set_agent_cursor_enabled".into(),- description: "Show or hide the agent cursor overlay.".into(),- input_schema: serde_json::json!({"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"},"cursor_id":{"type":"string"}},"additionalProperties":false}),- read_only: false, destructive: false, idempotent: true, open_world: false,- })- }- }- #[async_trait]- impl Tool for SetAgentCursorEnabledTool {- fn def(&self) -> &ToolDef {- Self::def_static()- }- async fn invoke(&self, args: Value) -> ToolResult {- let enabled = args- .get("enabled")- .and_then(|v| v.as_bool())- .unwrap_or(true);- let cursor_id = args- .get("cursor_id")- .and_then(|v| v.as_str())- .unwrap_or("default");- crate::overlay::send_command(- cursor_id.to_owned(),- cursor_overlay::OverlayCommand::SetEnabled(enabled),- );- ToolResult::text(format!(- "Agent cursor '{}' {}.",- cursor_id,- if enabled { "enabled" } else { "disabled" }- ))- }- }-}-pub use set_enabled_m::SetAgentCursorEnabledTool;-pub fn build_registry() -> cua_driver_core::tool::ToolRegistry {let mut r = cua_driver_core::tool::ToolRegistry::new();r.register(Box::new(ListAppsTool));@@ -325,10 +313,10 @@ pub fn build_registry() -> cua_driver_core::tool::ToolRegistry {r.register(Box::new(GetScreenSizeTool));r.register(Box::new(GetCursorPositionTool));r.register(Box::new(MoveCursorTool));- r.register(Box::new(SetAgentCursorEnabledTool));- r.register(Box::new(SetAgentCursorMotionTool));- r.register(Box::new(GetAgentCursorStateTool));- r.register(Box::new(SetAgentCursorStyleTool));+ r.register(Box::new(SetAgentCursorEnabledV2Tool));+ r.register(Box::new(SetAgentCursorMotionV2Tool));+ r.register(Box::new(GetAgentCursorStateV2Tool));+ r.register(Box::new(SetAgentCursorThemeTool));r.register(Box::new(CheckPermissionsTool));// health_report is cross-platform — the Windows provider here lets// non-Windows hosts running the stubbed registry still advertisediff --git a/libs/cua-driver/scripts/_install-local-rust.sh b/libs/cua-driver/scripts/_install-local-rust.shindex 5fb926bc45..99b75a76f7 100755--- a/libs/cua-driver/scripts/_install-local-rust.sh+++ b/libs/cua-driver/scripts/_install-local-rust.sh@@ -200,16 +200,21 @@ export CARGO_TARGET_DIR="$BUILD_TARGET_DIR"echo "${BOLD}Building cua-driver ($BUILD_CONFIG)...${NORMAL}"cd "$REPO_ROOT"if [ "$BUILD_CONFIG" = "release" ]; then- cargo build --release -p cua-driver+ cargo build --release -p cua-driver -p cursor-theme-clielse- cargo build -p cua-driver+ cargo build -p cua-driver -p cursor-theme-clifiBUILT_BINARY="$BUILD_TARGET_DIR/$BUILD_CONFIG/cua-driver"+BUILT_THEME_BINARY="$BUILD_TARGET_DIR/$BUILD_CONFIG/cua-cursor-theme"if [ ! -x "$BUILT_BINARY" ]; thenecho "${RED}Error: build produced no binary at $BUILT_BINARY${NORMAL}"exit 1fi+if [ ! -x "$BUILT_THEME_BINARY" ]; then+ echo "${RED}Error: build produced no cursor-theme compiler at $BUILT_THEME_BINARY${NORMAL}"+ exit 1+fiecho ""# --- Stage into versioned release dir + repoint `current` --------------@@ -217,7 +222,9 @@ echo ""echo "${BOLD}Staging into $VERSIONED_DIR${NORMAL}"mkdir -p "$VERSIONED_DIR"cp "$BUILT_BINARY" "$VERSIONED_DIR/cua-driver-local"+cp "$BUILT_THEME_BINARY" "$VERSIONED_DIR/cua-cursor-theme"chmod +x "$VERSIONED_DIR/cua-driver-local"+chmod +x "$VERSIONED_DIR/cua-cursor-theme"# Re-sign with a fresh ad-hoc signature.#@@ -234,6 +241,8 @@ if [ "$OS" = "Darwin" ]; thenif command -v codesign >/dev/null 2>&1; thencodesign --force --sign - "$VERSIONED_DIR/cua-driver-local" 2>/dev/null \|| echo "${YELLOW}warning: codesign --force --sign - failed; first run may fail with SIGKILL on macOS 26+${NORMAL}" >&2+ codesign --force --sign - "$VERSIONED_DIR/cua-cursor-theme" 2>/dev/null \+ || echo "${YELLOW}warning: cursor-theme sidecar signing failed${NORMAL}" >&2fifi@@ -301,7 +310,9 @@ if [ "$OS" = "Darwin" ]; thenmkdir -p "$APP_STAGE/Contents/MacOS"cp -R "$SKELETON/Contents/." "$APP_STAGE/Contents/"cp "$VERSIONED_DIR/cua-driver-local" "$APP_STAGE/Contents/MacOS/cua-driver-local"+ cp "$VERSIONED_DIR/cua-cursor-theme" "$APP_STAGE/Contents/MacOS/cua-cursor-theme"chmod +x "$APP_STAGE/Contents/MacOS/cua-driver-local"+ chmod +x "$APP_STAGE/Contents/MacOS/cua-cursor-theme"rm -f "$APP_STAGE/Contents/MacOS/.gitkeep"# Stamp the local build version so the bundle reports something sane.if command -v plutil >/dev/null 2>&1; thendiff --git a/libs/cua-driver/scripts/_install-rust.sh b/libs/cua-driver/scripts/_install-rust.shindex d23f4221c8..8e0a91e5c5 100644--- a/libs/cua-driver/scripts/_install-rust.sh+++ b/libs/cua-driver/scripts/_install-rust.sh@@ -585,10 +585,12 @@ case "$LABEL" indarwin-*)STAGE="cua-driver-rs-${VERSION}-darwin-universal"SRC="$TMP_DIR/$STAGE/$BINARY_NAME"+ SRC_THEME="$TMP_DIR/$STAGE/cua-cursor-theme"SRC_APP="$TMP_DIR/$STAGE/$APP_NAME";;*)SRC="$TMP_DIR/$BINARY_NAME"+ SRC_THEME="$TMP_DIR/cua-cursor-theme"SRC_APP="";;esac@@ -597,6 +599,11 @@ if [[ ! -f "$SRC" ]]; thenls -la "$TMP_DIR"exit 1fi+if [[ ! -f "$SRC_THEME" ]]; then+ err "expected cua-cursor-theme in tarball but didn't find it"+ ls -la "$TMP_DIR"+ exit 1+fi# --- Install ------------------------------------------------------------@@ -752,6 +759,7 @@ elsemkdir -p "$VERSIONED_DIR"install -m 0755 "$SRC" "$VERSIONED_DIR/$BINARY_NAME"+ install -m 0755 "$SRC_THEME" "$VERSIONED_DIR/cua-cursor-theme"log "installed $VERSIONED_DIR/$BINARY_NAME (version $VERSION, target $TARGET)"# `ln -sfn` would replace an existing dir-symlink in place but isdiff --git a/libs/cua-driver/scripts/install-local.ps1 b/libs/cua-driver/scripts/install-local.ps1index 497e5cb314..16e87477cc 100644--- a/libs/cua-driver/scripts/install-local.ps1+++ b/libs/cua-driver/scripts/install-local.ps1@@ -64,6 +64,7 @@ $RepoRoot = (Resolve-Path "$ScriptDir\..\rust").Path$BinaryName = "cua-driver-local.exe"$BuiltBinaryName = "cua-driver.exe"$UiaBinaryName = "cua-driver-uia-local.exe"+$ThemeBinaryName = "cua-cursor-theme.exe"# Always release-config — matches the binary install.ps1 hands end users.$Config = "release"@@ -172,10 +173,10 @@ if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) {# ---------- Build -----------------------------------------------------------Write-Step "cargo build --release -p cua-driver -p cua-driver-uia"+Write-Step "cargo build --release -p cua-driver -p cua-driver-uia -p cursor-theme-cli"Push-Location $RepoRoottry {- & cargo build --release -p cua-driver -p cua-driver-uia+ & cargo build --release -p cua-driver -p cua-driver-uia -p cursor-theme-cliif ($LASTEXITCODE -ne 0) {Write-Host "Error: cargo build failed." -ForegroundColor Redexit $LASTEXITCODE@@ -186,10 +187,15 @@ finally {}$BuiltBinary = Join-Path $RepoRoot "target\$Config\$BuiltBinaryName"$BuiltUiaBinary = Join-Path $RepoRoot "target\$Config\cua-driver-uia.exe"+$BuiltThemeBinary = Join-Path $RepoRoot "target\$Config\$ThemeBinaryName"if (-not (Test-Path -LiteralPath $BuiltBinary)) {Write-Host "Error: build produced no binary at $BuiltBinary" -ForegroundColor Redexit 1}+if (-not (Test-Path -LiteralPath $BuiltThemeBinary)) {+ Write-Host "Error: build produced no cursor-theme compiler at $BuiltThemeBinary" -ForegroundColor Red+ exit 1+}# ---------- Stage into versioned release dir -------------------------------@@ -232,6 +238,7 @@ if (Test-Path -LiteralPath $DestBinary) {Write-Step "staging into $VersionedDir"New-Item -ItemType Directory -Path $VersionedDir -Force | Out-NullCopy-Item -LiteralPath $BuiltBinary -Destination $DestBinary -Force+Copy-Item -LiteralPath $BuiltThemeBinary -Destination (Join-Path $VersionedDir $ThemeBinaryName) -Force$DestUiaBinary = Join-Path $VersionedDir $UiaBinaryNameif (Test-Path -LiteralPath $BuiltUiaBinary) {Copy-Item -LiteralPath $BuiltUiaBinary -Destination $DestUiaBinary -Forcediff --git a/libs/cua-driver/scripts/install.ps1 b/libs/cua-driver/scripts/install.ps1index 70d732bd16..820ebf6d13 100644--- a/libs/cua-driver/scripts/install.ps1+++ b/libs/cua-driver/scripts/install.ps1@@ -100,6 +100,7 @@ $ProgressPreference = "SilentlyContinue"$Repo = "trycua/cua"$TagPrefix = "cua-driver-rs-v"$BinaryName = "cua-driver.exe"+$ThemeBinaryName = "cua-cursor-theme.exe"# Baked-version constant — kept in lock-step with the latest published# cua-driver-rs-v* release tag by the Release Please release pull request@@ -1097,6 +1098,11 @@ if (-not $skipDownload) {$stageDir = Get-ReleaseAsset $version $archLabel $tmpRootNew-Item -ItemType Directory -Force -Path $versionedDir | Out-NullCopy-Item -LiteralPath (Join-Path $stageDir $BinaryName) -Destination (Join-Path $versionedDir $BinaryName) -Force+ $themeStage = Join-Path $stageDir $ThemeBinaryName+ if (-not (Test-Path -LiteralPath $themeStage)) {+ throw "release archive is missing required $ThemeBinaryName"+ }+ Copy-Item -LiteralPath $themeStage -Destination (Join-Path $versionedDir $ThemeBinaryName) -ForceWrite-Step "installed $versionedDir\$BinaryName (version $version, target $target)"# Optional sibling: the reserved uiAccess worker# (cua-driver-uia.exe). It started shipping withdiff --git a/libs/cua-driver/scripts/tests/test_install_local.py b/libs/cua-driver/scripts/tests/test_install_local.pyindex 8324df0baf..e954785c66 100644--- a/libs/cua-driver/scripts/tests/test_install_local.py+++ b/libs/cua-driver/scripts/tests/test_install_local.py@@ -46,7 +46,9 @@ test "${1:-}" = buildtest "$CARGO_TARGET_DIR" = "$EXPECTED_CARGO_TARGET_DIR"mkdir -p "$CARGO_TARGET_DIR/release"printf 'fresh custom target\n' > "$CARGO_TARGET_DIR/release/cua-driver"+printf 'fresh cursor theme compiler\n' > "$CARGO_TARGET_DIR/release/cua-cursor-theme"chmod +x "$CARGO_TARGET_DIR/release/cua-driver"+chmod +x "$CARGO_TARGET_DIR/release/cua-cursor-theme"""",)_write_executable(@@ -88,4 +90,10 @@ esacassert result.returncode == 0, result.stdout + result.stderrassert (custom_target / "release/cua-driver").read_text() == "fresh custom target\n"+ assert (+ custom_target / "release/cua-cursor-theme"+ ).read_text() == "fresh cursor theme compiler\n"assert (install_bin / "cua-driver-local").read_text() == "fresh custom target\n"+ assert (+ local_home / "packages/current/cua-cursor-theme"+ ).read_text() == "fresh cursor theme compiler\n"diff --git a/libs/cua-driver/tests/fixtures/smoke/macos.sh b/libs/cua-driver/tests/fixtures/smoke/macos.shindex 17bebb7986..28403af3c4 100755--- a/libs/cua-driver/tests/fixtures/smoke/macos.sh+++ b/libs/cua-driver/tests/fixtures/smoke/macos.sh@@ -101,22 +101,25 @@ for w in data.get('windows', []):if w.get('pid')==$HARNESS_PID and 'AppKit' in (w.get('title') or ''):print(w.get('window_id'));break" 2>/dev/null || echo "")echo " Window id=$WIN_ID"+SMOKE_SESSION="macos-smoke"+run_tool start_session "{\"session\":\"$SMOKE_SESSION\"}"# ── group 1: no-arg tools (informational, always-safe) ──────────────────────echo ""echo "=== group 1: no-arg / config tools ==="for t in check_permissions get_screen_size get_cursor_position get_config \- get_agent_cursor_state get_recording_state list_apps list_windows; do+ get_recording_state list_apps list_windows; dorun_tool "$t"done+run_tool get_agent_cursor_state "{\"session\":\"$SMOKE_SESSION\"}"# ── group 2: setters ─────────────────────────────────────────────────────────echo ""echo "=== group 2: setters ==="run_tool set_config '{"max_image_dimension":1024}'-run_tool set_agent_cursor_enabled '{"enabled":true}'-run_tool set_agent_cursor_style '{"style":"default"}'-run_tool set_agent_cursor_motion '{}'+run_tool set_agent_cursor_enabled "{\"session\":\"$SMOKE_SESSION\",\"enabled\":true}"+run_tool set_agent_cursor_theme "{\"session\":\"$SMOKE_SESSION\",\"theme_id\":\"cua.default\"}"+run_tool set_agent_cursor_motion "{\"session\":\"$SMOKE_SESSION\"}"run_tool stop_recording '{}'# ── group 3: app lifecycle ──────────────────────────────────────────────────diff --git a/libs/cua-driver/typescript/README.md b/libs/cua-driver/typescript/README.mdindex 5a2864ffc7..e07de2e840 100644--- a/libs/cua-driver/typescript/README.md+++ b/libs/cua-driver/typescript/README.md@@ -32,8 +32,10 @@ agent SDK.import {CaptureScope,CuaDriver,+ CursorReducedMotion,EndSessionInput,GetDesktopStateInput,+ SetAgentCursorThemeInput,StartSessionInput,} from "@trycua/cua-driver"@@ -46,6 +48,13 @@ await driver.startSession()try {+ await driver.setAgentCursorTheme(+ SetAgentCursorThemeInput.new({+ session: "demo",+ themeId: "cua.default",+ reducedMotion: CursorReducedMotion.Auto,+ }),+ )const desktop = await driver.getDesktopState(GetDesktopStateInput.new({ session: "demo" }),)@@ -64,6 +73,12 @@ images, verification/error metadata, and `structuredJson` / `rawJson` forplatform-extensible results. Session lifecycle calls return dedicated generatedrecords.+The agent cursor is session-owned. Its default theme and custom dotLottie+authoring workflow are documented in+[`docs/cursor-themes.md`](../docs/cursor-themes.md). Custom source is compiled+and installed with the local CLI; SDK and MCP tools select only an installed+theme ID.+`CuaDriver.connect(socketPath)` remains available while existing applicationsmigrate. It exposes the same methods over the installed daemon, but it does notprovide a second SDK contract.diff --git a/libs/cua-driver/typescript/src/native/cua_driver_contract.ts b/libs/cua-driver/typescript/src/native/cua_driver_contract.tsindex c8750c93b0..a7406a931c 100644--- a/libs/cua-driver/typescript/src/native/cua_driver_contract.ts+++ b/libs/cua-driver/typescript/src/native/cua_driver_contract.ts@@ -160,6 +160,368 @@ const FfiConverterTypeClickInput = (() => {return new FFIConverter();})();+export type CursorMotionOutput = {+ startHandle: number,+ endHandle: number,+ arcSize: number,+ arcFlow: number,+ spring: number,+ glideDurationMs: number,+ dwellAfterClickMs: number,+ idleHideMs: number,+ turnRadius: number+}++/**+ * Generated factory for {@link CursorMotionOutput} record objects.+ */+export const CursorMotionOutput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<CursorMotionOutput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<CursorMotionOutput>,+ });+})();++const FfiConverterTypeCursorMotionOutput = (() => {+ type TypeName = CursorMotionOutput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ startHandle: FfiConverterFloat64.read(from),+ endHandle: FfiConverterFloat64.read(from),+ arcSize: FfiConverterFloat64.read(from),+ arcFlow: FfiConverterFloat64.read(from),+ spring: FfiConverterFloat64.read(from),+ glideDurationMs: FfiConverterFloat64.read(from),+ dwellAfterClickMs: FfiConverterFloat64.read(from),+ idleHideMs: FfiConverterFloat64.read(from),+ turnRadius: FfiConverterFloat64.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterFloat64.write(value.startHandle, into);+ FfiConverterFloat64.write(value.endHandle, into);+ FfiConverterFloat64.write(value.arcSize, into);+ FfiConverterFloat64.write(value.arcFlow, into);+ FfiConverterFloat64.write(value.spring, into);+ FfiConverterFloat64.write(value.glideDurationMs, into);+ FfiConverterFloat64.write(value.dwellAfterClickMs, into);+ FfiConverterFloat64.write(value.idleHideMs, into);+ FfiConverterFloat64.write(value.turnRadius, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterFloat64.allocationSize(value.startHandle) ++ FfiConverterFloat64.allocationSize(value.endHandle) ++ FfiConverterFloat64.allocationSize(value.arcSize) ++ FfiConverterFloat64.allocationSize(value.arcFlow) ++ FfiConverterFloat64.allocationSize(value.spring) ++ FfiConverterFloat64.allocationSize(value.glideDurationMs) ++ FfiConverterFloat64.allocationSize(value.dwellAfterClickMs) ++ FfiConverterFloat64.allocationSize(value.idleHideMs) ++ FfiConverterFloat64.allocationSize(value.turnRadius);++ }+ };+ return new FFIConverter();+})();++export type CursorPointOutput = {+ x: number,+ y: number+}++/**+ * Generated factory for {@link CursorPointOutput} record objects.+ */+export const CursorPointOutput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<CursorPointOutput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<CursorPointOutput>,+ });+})();++const FfiConverterTypeCursorPointOutput = (() => {+ type TypeName = CursorPointOutput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ x: FfiConverterFloat64.read(from),+ y: FfiConverterFloat64.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterFloat64.write(value.x, into);+ FfiConverterFloat64.write(value.y, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterFloat64.allocationSize(value.x) ++ FfiConverterFloat64.allocationSize(value.y);++ }+ };+ return new FFIConverter();+})();++export enum CursorReducedMotion {+ Auto,+ On,+ Off+}++const FfiConverterTypeCursorReducedMotion = (() => {+ const ordinalConverter = FfiConverterInt32;+ type TypeName = CursorReducedMotion;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ switch (ordinalConverter.read(from)) {+ case 1: return CursorReducedMotion.Auto;+ case 2: return CursorReducedMotion.On;+ case 3: return CursorReducedMotion.Off;+ default: throw new UniffiInternalError.UnexpectedEnumCase();+ }+ }+ write(value: TypeName, into: RustBuffer): void {+ switch (value) {+ case CursorReducedMotion.Auto: return ordinalConverter.write(1, into);+ case CursorReducedMotion.On: return ordinalConverter.write(2, into);+ case CursorReducedMotion.Off: return ordinalConverter.write(3, into);+ }+ }+ allocationSize(value: TypeName): number {+ return ordinalConverter.allocationSize(0);+ }+ }+ return new FFIConverter();+})();++export type CursorThemeOutput = {+ id: string,+ version: string,+ profile: string,+ reducedMotion: CursorReducedMotion,+ fallback?: string+}++/**+ * Generated factory for {@link CursorThemeOutput} record objects.+ */+export const CursorThemeOutput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<CursorThemeOutput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<CursorThemeOutput>,+ });+})();++const FfiConverterTypeCursorThemeOutput = (() => {+ type TypeName = CursorThemeOutput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ id: FfiConverterString.read(from),+ version: FfiConverterString.read(from),+ profile: FfiConverterString.read(from),+ reducedMotion: FfiConverterTypeCursorReducedMotion.read(from),+ fallback: FfiConverterOptionalString.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.id, into);+ FfiConverterString.write(value.version, into);+ FfiConverterString.write(value.profile, into);+ FfiConverterTypeCursorReducedMotion.write(value.reducedMotion, into);+ FfiConverterOptionalString.write(value.fallback, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.id) ++ FfiConverterString.allocationSize(value.version) ++ FfiConverterString.allocationSize(value.profile) ++ FfiConverterTypeCursorReducedMotion.allocationSize(value.reducedMotion) ++ FfiConverterOptionalString.allocationSize(value.fallback);++ }+ };+ return new FFIConverter();+})();++export type CursorThemeSelection = {+ themeId: string,+ reducedMotion: CursorReducedMotion+}++/**+ * Generated factory for {@link CursorThemeSelection} record objects.+ */+export const CursorThemeSelection = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<CursorThemeSelection, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<CursorThemeSelection>,+ });+})();++const FfiConverterTypeCursorThemeSelection = (() => {+ type TypeName = CursorThemeSelection;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ themeId: FfiConverterString.read(from),+ reducedMotion: FfiConverterTypeCursorReducedMotion.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.themeId, into);+ FfiConverterTypeCursorReducedMotion.write(value.reducedMotion, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.themeId) ++ FfiConverterTypeCursorReducedMotion.allocationSize(value.reducedMotion);++ }+ };+ return new FFIConverter();+})();++export enum CursorAction {+ Idle,+ Observe,+ Click,+ Drag,+ Scroll,+ Text,+ Key,+ Navigate,+ App,+ Transfer,+ Record,+ System+}++const FfiConverterTypeCursorAction = (() => {+ const ordinalConverter = FfiConverterInt32;+ type TypeName = CursorAction;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ switch (ordinalConverter.read(from)) {+ case 1: return CursorAction.Idle;+ case 2: return CursorAction.Observe;+ case 3: return CursorAction.Click;+ case 4: return CursorAction.Drag;+ case 5: return CursorAction.Scroll;+ case 6: return CursorAction.Text;+ case 7: return CursorAction.Key;+ case 8: return CursorAction.Navigate;+ case 9: return CursorAction.App;+ case 10: return CursorAction.Transfer;+ case 11: return CursorAction.Record;+ case 12: return CursorAction.System;+ default: throw new UniffiInternalError.UnexpectedEnumCase();+ }+ }+ write(value: TypeName, into: RustBuffer): void {+ switch (value) {+ case CursorAction.Idle: return ordinalConverter.write(1, into);+ case CursorAction.Observe: return ordinalConverter.write(2, into);+ case CursorAction.Click: return ordinalConverter.write(3, into);+ case CursorAction.Drag: return ordinalConverter.write(4, into);+ case CursorAction.Scroll: return ordinalConverter.write(5, into);+ case CursorAction.Text: return ordinalConverter.write(6, into);+ case CursorAction.Key: return ordinalConverter.write(7, into);+ case CursorAction.Navigate: return ordinalConverter.write(8, into);+ case CursorAction.App: return ordinalConverter.write(9, into);+ case CursorAction.Transfer: return ordinalConverter.write(10, into);+ case CursorAction.Record: return ordinalConverter.write(11, into);+ case CursorAction.System: return ordinalConverter.write(12, into);+ }+ }+ allocationSize(value: TypeName): number {+ return ordinalConverter.allocationSize(0);+ }+ }+ return new FFIConverter();+})();++export type CursorVisualOutput = {+ requestedAction: CursorAction,+ resolvedAction: CursorAction,+ modifiers: Array<string>,+ phase: string,+ frame: bigint,+ preemptedCount: bigint+}++/**+ * Generated factory for {@link CursorVisualOutput} record objects.+ */+export const CursorVisualOutput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<CursorVisualOutput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<CursorVisualOutput>,+ });+})();++const FfiConverterTypeCursorVisualOutput = (() => {+ type TypeName = CursorVisualOutput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ requestedAction: FfiConverterTypeCursorAction.read(from),+ resolvedAction: FfiConverterTypeCursorAction.read(from),+ modifiers: FfiConverterSequenceString.read(from),+ phase: FfiConverterString.read(from),+ frame: FfiConverterUInt64.read(from),+ preemptedCount: FfiConverterUInt64.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterTypeCursorAction.write(value.requestedAction, into);+ FfiConverterTypeCursorAction.write(value.resolvedAction, into);+ FfiConverterSequenceString.write(value.modifiers, into);+ FfiConverterString.write(value.phase, into);+ FfiConverterUInt64.write(value.frame, into);+ FfiConverterUInt64.write(value.preemptedCount, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterTypeCursorAction.allocationSize(value.requestedAction) ++ FfiConverterTypeCursorAction.allocationSize(value.resolvedAction) ++ FfiConverterSequenceString.allocationSize(value.modifiers) ++ FfiConverterString.allocationSize(value.phase) ++ FfiConverterUInt64.allocationSize(value.frame) ++ FfiConverterUInt64.allocationSize(value.preemptedCount);++ }+ };+ return new FFIConverter();+})();+export type DragInput = {fromX: number,fromY: number,@@ -414,6 +776,104 @@ const FfiConverterTypeEscalateSessionInput = (() => {return new FFIConverter();})();+export type GetAgentCursorStateInput = {+ session: string+}++/**+ * Generated factory for {@link GetAgentCursorStateInput} record objects.+ */+export const GetAgentCursorStateInput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<GetAgentCursorStateInput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<GetAgentCursorStateInput>,+ });+})();++const FfiConverterTypeGetAgentCursorStateInput = (() => {+ type TypeName = GetAgentCursorStateInput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ session: FfiConverterString.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.session, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.session);++ }+ };+ return new FFIConverter();+})();++export type GetAgentCursorStateOutput = {+ session: string,+ enabled: boolean,+ position?: CursorPointOutput,+ theme: CursorThemeOutput,+ visualState: CursorVisualOutput,+ motion: CursorMotionOutput+}++/**+ * Generated factory for {@link GetAgentCursorStateOutput} record objects.+ */+export const GetAgentCursorStateOutput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<GetAgentCursorStateOutput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<GetAgentCursorStateOutput>,+ });+})();++const FfiConverterTypeGetAgentCursorStateOutput = (() => {+ type TypeName = GetAgentCursorStateOutput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ session: FfiConverterString.read(from),+ enabled: FfiConverterBool.read(from),+ position: FfiConverterOptionalTypeCursorPointOutput.read(from),+ theme: FfiConverterTypeCursorThemeOutput.read(from),+ visualState: FfiConverterTypeCursorVisualOutput.read(from),+ motion: FfiConverterTypeCursorMotionOutput.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.session, into);+ FfiConverterBool.write(value.enabled, into);+ FfiConverterOptionalTypeCursorPointOutput.write(value.position, into);+ FfiConverterTypeCursorThemeOutput.write(value.theme, into);+ FfiConverterTypeCursorVisualOutput.write(value.visualState, into);+ FfiConverterTypeCursorMotionOutput.write(value.motion, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.session) ++ FfiConverterBool.allocationSize(value.enabled) ++ FfiConverterOptionalTypeCursorPointOutput.allocationSize(value.position) ++ FfiConverterTypeCursorThemeOutput.allocationSize(value.theme) ++ FfiConverterTypeCursorVisualOutput.allocationSize(value.visualState) ++ FfiConverterTypeCursorMotionOutput.allocationSize(value.motion);++ }+ };+ return new FFIConverter();+})();+export type GetCursorPositionInput = {/*** Optional session id.@@ -997,6 +1457,300 @@ const FfiConverterTypeSessionStateOutput = (() => {return new FFIConverter();})();+export type SetAgentCursorEnabledInput = {+ session: string,+ enabled: boolean+}++/**+ * Generated factory for {@link SetAgentCursorEnabledInput} record objects.+ */+export const SetAgentCursorEnabledInput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<SetAgentCursorEnabledInput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<SetAgentCursorEnabledInput>,+ });+})();++const FfiConverterTypeSetAgentCursorEnabledInput = (() => {+ type TypeName = SetAgentCursorEnabledInput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ session: FfiConverterString.read(from),+ enabled: FfiConverterBool.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.session, into);+ FfiConverterBool.write(value.enabled, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.session) ++ FfiConverterBool.allocationSize(value.enabled);++ }+ };+ return new FFIConverter();+})();++export type SetAgentCursorEnabledOutput = {+ session: string,+ enabled: boolean+}++/**+ * Generated factory for {@link SetAgentCursorEnabledOutput} record objects.+ */+export const SetAgentCursorEnabledOutput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<SetAgentCursorEnabledOutput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<SetAgentCursorEnabledOutput>,+ });+})();++const FfiConverterTypeSetAgentCursorEnabledOutput = (() => {+ type TypeName = SetAgentCursorEnabledOutput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ session: FfiConverterString.read(from),+ enabled: FfiConverterBool.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.session, into);+ FfiConverterBool.write(value.enabled, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.session) ++ FfiConverterBool.allocationSize(value.enabled);++ }+ };+ return new FFIConverter();+})();++export type SetAgentCursorMotionInput = {+ session: string,+ startHandle?: number,+ endHandle?: number,+ arcSize?: number,+ arcFlow?: number,+ spring?: number,+ glideDurationMs?: number,+ dwellAfterClickMs?: number,+ idleHideMs?: number,+ turnRadius?: number+}++/**+ * Generated factory for {@link SetAgentCursorMotionInput} record objects.+ */+export const SetAgentCursorMotionInput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<SetAgentCursorMotionInput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<SetAgentCursorMotionInput>,+ });+})();++const FfiConverterTypeSetAgentCursorMotionInput = (() => {+ type TypeName = SetAgentCursorMotionInput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ session: FfiConverterString.read(from),+ startHandle: FfiConverterOptionalFloat64.read(from),+ endHandle: FfiConverterOptionalFloat64.read(from),+ arcSize: FfiConverterOptionalFloat64.read(from),+ arcFlow: FfiConverterOptionalFloat64.read(from),+ spring: FfiConverterOptionalFloat64.read(from),+ glideDurationMs: FfiConverterOptionalFloat64.read(from),+ dwellAfterClickMs: FfiConverterOptionalFloat64.read(from),+ idleHideMs: FfiConverterOptionalFloat64.read(from),+ turnRadius: FfiConverterOptionalFloat64.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.session, into);+ FfiConverterOptionalFloat64.write(value.startHandle, into);+ FfiConverterOptionalFloat64.write(value.endHandle, into);+ FfiConverterOptionalFloat64.write(value.arcSize, into);+ FfiConverterOptionalFloat64.write(value.arcFlow, into);+ FfiConverterOptionalFloat64.write(value.spring, into);+ FfiConverterOptionalFloat64.write(value.glideDurationMs, into);+ FfiConverterOptionalFloat64.write(value.dwellAfterClickMs, into);+ FfiConverterOptionalFloat64.write(value.idleHideMs, into);+ FfiConverterOptionalFloat64.write(value.turnRadius, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.session) ++ FfiConverterOptionalFloat64.allocationSize(value.startHandle) ++ FfiConverterOptionalFloat64.allocationSize(value.endHandle) ++ FfiConverterOptionalFloat64.allocationSize(value.arcSize) ++ FfiConverterOptionalFloat64.allocationSize(value.arcFlow) ++ FfiConverterOptionalFloat64.allocationSize(value.spring) ++ FfiConverterOptionalFloat64.allocationSize(value.glideDurationMs) ++ FfiConverterOptionalFloat64.allocationSize(value.dwellAfterClickMs) ++ FfiConverterOptionalFloat64.allocationSize(value.idleHideMs) ++ FfiConverterOptionalFloat64.allocationSize(value.turnRadius);++ }+ };+ return new FFIConverter();+})();++export type SetAgentCursorMotionOutput = {+ session: string,+ motion: CursorMotionOutput+}++/**+ * Generated factory for {@link SetAgentCursorMotionOutput} record objects.+ */+export const SetAgentCursorMotionOutput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<SetAgentCursorMotionOutput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<SetAgentCursorMotionOutput>,+ });+})();++const FfiConverterTypeSetAgentCursorMotionOutput = (() => {+ type TypeName = SetAgentCursorMotionOutput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ session: FfiConverterString.read(from),+ motion: FfiConverterTypeCursorMotionOutput.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.session, into);+ FfiConverterTypeCursorMotionOutput.write(value.motion, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.session) ++ FfiConverterTypeCursorMotionOutput.allocationSize(value.motion);++ }+ };+ return new FFIConverter();+})();++export type SetAgentCursorThemeInput = {+ session: string,+ themeId: string,+ reducedMotion: CursorReducedMotion+}++/**+ * Generated factory for {@link SetAgentCursorThemeInput} record objects.+ */+export const SetAgentCursorThemeInput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<SetAgentCursorThemeInput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<SetAgentCursorThemeInput>,+ });+})();++const FfiConverterTypeSetAgentCursorThemeInput = (() => {+ type TypeName = SetAgentCursorThemeInput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ session: FfiConverterString.read(from),+ themeId: FfiConverterString.read(from),+ reducedMotion: FfiConverterTypeCursorReducedMotion.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.session, into);+ FfiConverterString.write(value.themeId, into);+ FfiConverterTypeCursorReducedMotion.write(value.reducedMotion, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.session) ++ FfiConverterString.allocationSize(value.themeId) ++ FfiConverterTypeCursorReducedMotion.allocationSize(value.reducedMotion);++ }+ };+ return new FFIConverter();+})();++export type SetAgentCursorThemeOutput = {+ session: string,+ theme: CursorThemeOutput+}++/**+ * Generated factory for {@link SetAgentCursorThemeOutput} record objects.+ */+export const SetAgentCursorThemeOutput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<SetAgentCursorThemeOutput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<SetAgentCursorThemeOutput>,+ });+})();++const FfiConverterTypeSetAgentCursorThemeOutput = (() => {+ type TypeName = SetAgentCursorThemeOutput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ session: FfiConverterString.read(from),+ theme: FfiConverterTypeCursorThemeOutput.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.session, into);+ FfiConverterTypeCursorThemeOutput.write(value.theme, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.session) ++ FfiConverterTypeCursorThemeOutput.allocationSize(value.theme);++ }+ };+ return new FFIConverter();+})();+export type StartSessionInput = {/*** Stable session id for this run (e.g. "research-run-1").@@ -1005,7 +1759,12 @@ export type StartSessionInput = {/*** Per-session perception/action modality. auto starts window-only and requires explicit escalation before desktop tools; window and desktop are strict. Immutable for the live session.*/- captureScope?: CaptureScope+ captureScope?: CaptureScope,+ /**+ * Optional initial cursor theme. The host applies it before the cursor is+ * first made visible, avoiding a flash of the default theme.+ */+ cursorTheme?: CursorThemeSelection}/**@@ -1030,16 +1789,19 @@ const FfiConverterTypeStartSessionInput = (() => {read(from: RustBuffer): TypeName {return {session: FfiConverterString.read(from),- captureScope: FfiConverterOptionalTypeCaptureScope.read(from)+ captureScope: FfiConverterOptionalTypeCaptureScope.read(from),+ cursorTheme: FfiConverterOptionalTypeCursorThemeSelection.read(from)};}write(value: TypeName, into: RustBuffer): void {FfiConverterString.write(value.session, into);FfiConverterOptionalTypeCaptureScope.write(value.captureScope, into);+ FfiConverterOptionalTypeCursorThemeSelection.write(value.cursorTheme, into);}allocationSize(value: TypeName): number {return FfiConverterString.allocationSize(value.session) +- FfiConverterOptionalTypeCaptureScope.allocationSize(value.captureScope);+ FfiConverterOptionalTypeCaptureScope.allocationSize(value.captureScope) ++ FfiConverterOptionalTypeCursorThemeSelection.allocationSize(value.cursorTheme);}};@@ -1187,24 +1949,33 @@ const FfiConverterOptionalTypeClickButton = new FfiConverterOptional(FfiConverte// FfiConverter for number | undefinedconst FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32);-// FfiConverter for bigint | undefined-const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);-// FfiConverter for Array<string>const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);+// FfiConverter for bigint | undefined+const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);+// FfiConverter for Array<string> | undefinedconst FfiConverterOptionalSequenceString = new FfiConverterOptional(FfiConverterSequenceString);+// FfiConverter for CursorPointOutput | undefined+const FfiConverterOptionalTypeCursorPointOutput = new FfiConverterOptional(FfiConverterTypeCursorPointOutput);+// FfiConverter for ScrollBy | undefinedconst FfiConverterOptionalTypeScrollBy = new FfiConverterOptional(FfiConverterTypeScrollBy);// FfiConverter for EscalationReason | undefinedconst FfiConverterOptionalTypeEscalationReason = new FfiConverterOptional(FfiConverterTypeEscalationReason);+// FfiConverter for number | undefined+const FfiConverterOptionalFloat64 = new FfiConverterOptional(FfiConverterFloat64);+// FfiConverter for CaptureScope | undefinedconst FfiConverterOptionalTypeCaptureScope = new FfiConverterOptional(FfiConverterTypeCaptureScope);+// FfiConverter for CursorThemeSelection | undefined+const FfiConverterOptionalTypeCursorThemeSelection = new FfiConverterOptional(FfiConverterTypeCursorThemeSelection);+/*** This should be called before anything else.@@ -1233,6 +2004,13 @@ export default Object.freeze({FfiConverterTypeCaptureScope,FfiConverterTypeClickButton,FfiConverterTypeClickInput,+ FfiConverterTypeCursorAction,+ FfiConverterTypeCursorMotionOutput,+ FfiConverterTypeCursorPointOutput,+ FfiConverterTypeCursorReducedMotion,+ FfiConverterTypeCursorThemeOutput,+ FfiConverterTypeCursorThemeSelection,+ FfiConverterTypeCursorVisualOutput,FfiConverterTypeDesktopScope,FfiConverterTypeDragInput,FfiConverterTypeEffectiveScope,@@ -1240,6 +2018,8 @@ export default Object.freeze({FfiConverterTypeEndSessionOutput,FfiConverterTypeEscalateSessionInput,FfiConverterTypeEscalationReason,+ FfiConverterTypeGetAgentCursorStateInput,+ FfiConverterTypeGetAgentCursorStateOutput,FfiConverterTypeGetCursorPositionInput,FfiConverterTypeGetDesktopStateInput,FfiConverterTypeGetScreenSizeInput,@@ -1252,6 +2032,12 @@ export default Object.freeze({FfiConverterTypeScrollDirection,FfiConverterTypeScrollInput,FfiConverterTypeSessionStateOutput,+ FfiConverterTypeSetAgentCursorEnabledInput,+ FfiConverterTypeSetAgentCursorEnabledOutput,+ FfiConverterTypeSetAgentCursorMotionInput,+ FfiConverterTypeSetAgentCursorMotionOutput,+ FfiConverterTypeSetAgentCursorThemeInput,+ FfiConverterTypeSetAgentCursorThemeOutput,FfiConverterTypeStartSessionInput,FfiConverterTypeStartSessionOutput,FfiConverterTypeTypeTextInput,diff --git a/libs/cua-driver/typescript/src/native/cua_driver_sdk-ffi.ts b/libs/cua-driver/typescript/src/native/cua_driver_sdk-ffi.tsindex 1db823602f..182107e52a 100644--- a/libs/cua-driver/typescript/src/native/cua_driver_sdk-ffi.ts+++ b/libs/cua-driver/typescript/src/native/cua_driver_sdk-ffi.ts@@ -408,6 +408,11 @@ const DEFINITIONS = {ret: FfiType.RustBuffer,hasRustCallStatus: true,},+ "uniffi_cua_driver_sdk_fn_method_cuadriver_get_agent_cursor_state": {+ args: [FfiType.Handle, FfiType.RustBuffer],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_driver_sdk_fn_method_cuadriver_get_cursor_position": {args: [FfiType.Handle, FfiType.RustBuffer],ret: FfiType.Handle,@@ -468,6 +473,21 @@ const DEFINITIONS = {ret: FfiType.Handle,hasRustCallStatus: false,},+ "uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_enabled": {+ args: [FfiType.Handle, FfiType.RustBuffer],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },+ "uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_motion": {+ args: [FfiType.Handle, FfiType.RustBuffer],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },+ "uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_theme": {+ args: [FfiType.Handle, FfiType.RustBuffer],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_driver_sdk_fn_method_cuadriver_shutdown": {args: [FfiType.Handle],ret: FfiType.Handle,@@ -518,6 +538,11 @@ const DEFINITIONS = {ret: FfiType.Handle,hasRustCallStatus: false,},+ "uniffi_cua_driver_sdk_fn_method_cuadriversession_get_agent_cursor_state": {+ args: [FfiType.Handle, FfiType.RustBuffer],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_driver_sdk_fn_method_cuadriversession_get_cursor_position": {args: [FfiType.Handle, FfiType.RustBuffer],ret: FfiType.Handle,@@ -558,6 +583,21 @@ const DEFINITIONS = {ret: FfiType.Handle,hasRustCallStatus: false,},+ "uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_enabled": {+ args: [FfiType.Handle, FfiType.RustBuffer],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },+ "uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_motion": {+ args: [FfiType.Handle, FfiType.RustBuffer],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },+ "uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_theme": {+ args: [FfiType.Handle, FfiType.RustBuffer],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_driver_sdk_fn_method_cuadriversession_start_session": {args: [FfiType.Handle, FfiType.RustBuffer],ret: FfiType.Handle,@@ -733,6 +773,11 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_driver_sdk_checksum_method_cuadriver_get_agent_cursor_state": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_driver_sdk_checksum_method_cuadriver_get_cursor_position": {args: [],ret: FfiType.UInt16,@@ -793,6 +838,21 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_enabled": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },+ "uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_motion": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },+ "uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_theme": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_driver_sdk_checksum_method_cuadriver_shutdown": {args: [],ret: FfiType.UInt16,@@ -843,6 +903,11 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_agent_cursor_state": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_cursor_position": {args: [],ret: FfiType.UInt16,@@ -883,6 +948,21 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_enabled": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },+ "uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_motion": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },+ "uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_theme": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_driver_sdk_checksum_method_cuadriversession_start_session": {args: [],ret: FfiType.UInt16,@@ -1111,6 +1191,7 @@ interface NativeModuleInterface {uniffi_cua_driver_sdk_fn_method_cuadriver_end_session(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriver_escalate_session(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriver_execution_mode(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;+ uniffi_cua_driver_sdk_fn_method_cuadriver_get_agent_cursor_state(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriver_get_cursor_position(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriver_get_desktop_state(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriver_get_screen_size(uniffiSelf: bigint, input: Uint8Array): bigint;@@ -1123,6 +1204,9 @@ interface NativeModuleInterface {uniffi_cua_driver_sdk_fn_method_cuadriver_press_key(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriver_runtime_scope_prefix(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_driver_sdk_fn_method_cuadriver_scroll(uniffiSelf: bigint, input: Uint8Array): bigint;+ uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_enabled(uniffiSelf: bigint, input: Uint8Array): bigint;+ uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_motion(uniffiSelf: bigint, input: Uint8Array): bigint;+ uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_theme(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriver_shutdown(uniffiSelf: bigint): bigint;uniffi_cua_driver_sdk_fn_method_cuadriver_socket_path(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_driver_sdk_fn_method_cuadriver_start_session(uniffiSelf: bigint, input: Uint8Array): bigint;@@ -1133,6 +1217,7 @@ interface NativeModuleInterface {uniffi_cua_driver_sdk_fn_method_cuadriversession_drag(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriversession_end_session(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriversession_escalate_session(uniffiSelf: bigint, input: Uint8Array): bigint;+ uniffi_cua_driver_sdk_fn_method_cuadriversession_get_agent_cursor_state(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriversession_get_cursor_position(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriversession_get_desktop_state(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriversession_get_screen_size(uniffiSelf: bigint, input: Uint8Array): bigint;@@ -1141,6 +1226,9 @@ interface NativeModuleInterface {uniffi_cua_driver_sdk_fn_method_cuadriversession_move_cursor(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriversession_press_key(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriversession_scroll(uniffiSelf: bigint, input: Uint8Array): bigint;+ uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_enabled(uniffiSelf: bigint, input: Uint8Array): bigint;+ uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_motion(uniffiSelf: bigint, input: Uint8Array): bigint;+ uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_theme(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriversession_start_session(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_method_cuadriversession_type_text(uniffiSelf: bigint, input: Uint8Array): bigint;uniffi_cua_driver_sdk_fn_constructor_embeddedcuadriverhost_new(binaryPath: Uint8Array, hostBundleId: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;@@ -1176,6 +1264,7 @@ interface NativeModuleInterface {uniffi_cua_driver_sdk_checksum_method_cuadriver_end_session(): number;uniffi_cua_driver_sdk_checksum_method_cuadriver_escalate_session(): number;uniffi_cua_driver_sdk_checksum_method_cuadriver_execution_mode(): number;+ uniffi_cua_driver_sdk_checksum_method_cuadriver_get_agent_cursor_state(): number;uniffi_cua_driver_sdk_checksum_method_cuadriver_get_cursor_position(): number;uniffi_cua_driver_sdk_checksum_method_cuadriver_get_desktop_state(): number;uniffi_cua_driver_sdk_checksum_method_cuadriver_get_screen_size(): number;@@ -1188,6 +1277,9 @@ interface NativeModuleInterface {uniffi_cua_driver_sdk_checksum_method_cuadriver_press_key(): number;uniffi_cua_driver_sdk_checksum_method_cuadriver_runtime_scope_prefix(): number;uniffi_cua_driver_sdk_checksum_method_cuadriver_scroll(): number;+ uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_enabled(): number;+ uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_motion(): number;+ uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_theme(): number;uniffi_cua_driver_sdk_checksum_method_cuadriver_shutdown(): number;uniffi_cua_driver_sdk_checksum_method_cuadriver_socket_path(): number;uniffi_cua_driver_sdk_checksum_method_cuadriver_start_session(): number;@@ -1198,6 +1290,7 @@ interface NativeModuleInterface {uniffi_cua_driver_sdk_checksum_method_cuadriversession_drag(): number;uniffi_cua_driver_sdk_checksum_method_cuadriversession_end_session(): number;uniffi_cua_driver_sdk_checksum_method_cuadriversession_escalate_session(): number;+ uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_agent_cursor_state(): number;uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_cursor_position(): number;uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_desktop_state(): number;uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_screen_size(): number;@@ -1206,6 +1299,9 @@ interface NativeModuleInterface {uniffi_cua_driver_sdk_checksum_method_cuadriversession_move_cursor(): number;uniffi_cua_driver_sdk_checksum_method_cuadriversession_press_key(): number;uniffi_cua_driver_sdk_checksum_method_cuadriversession_scroll(): number;+ uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_enabled(): number;+ uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_motion(): number;+ uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_theme(): number;uniffi_cua_driver_sdk_checksum_method_cuadriversession_start_session(): number;uniffi_cua_driver_sdk_checksum_method_cuadriversession_type_text(): number;uniffi_cua_driver_sdk_checksum_constructor_embeddedcuadriverhost_new(): number;diff --git a/libs/cua-driver/typescript/src/native/cua_driver_sdk.ts b/libs/cua-driver/typescript/src/native/cua_driver_sdk.tsindex ab6f9fe54b..a2f303865c 100644--- a/libs/cua-driver/typescript/src/native/cua_driver_sdk.ts+++ b/libs/cua-driver/typescript/src/native/cua_driver_sdk.ts@@ -6,12 +6,12 @@import nativeModule from "./cua_driver_sdk-ffi.js";import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiForeignFutureResultRustBuffer, type UniffiForeignFutureCompleterustBuffer, type UniffiForeignFutureResultVoid, type UniffiForeignFutureCompletevoid, type UniffiVTableCallbackInterfaceCuaDriverSdkProtectedConsentHost,} from "./cua_driver_sdk-ffi.js";-import { type ClickInput, type DragInput, type EndSessionInput, type EndSessionOutput, type EscalateSessionInput, type GetCursorPositionInput, type GetDesktopStateInput, type GetScreenSizeInput, type GetSessionStateInput, type HotkeyInput, type MoveCursorInput, type PressKeyInput, type ScrollInput, type SessionStateOutput, type StartSessionInput, type StartSessionOutput, type TypeTextInput,+import { type ClickInput, type DragInput, type EndSessionInput, type EndSessionOutput, type EscalateSessionInput, type GetAgentCursorStateInput, type GetCursorPositionInput, type GetDesktopStateInput, type GetScreenSizeInput, type GetSessionStateInput, type HotkeyInput, type MoveCursorInput, type PressKeyInput, type ScrollInput, type SessionStateOutput, type SetAgentCursorEnabledInput, type SetAgentCursorMotionInput, type SetAgentCursorThemeInput, type StartSessionInput, type StartSessionOutput, type TypeTextInput,} from "./cua_driver_contract.js";import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustCallStatus, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterBool, FfiConverterInt32, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCallAsyncWithError, uniffiTypeNameSymbol, variantOrdinalSymbol,} from "@ubjs/core";import uniffiCuaDriverContractModule from "./cua_driver_contract.js";-const { FfiConverterTypeClickInput, FfiConverterTypeDragInput, FfiConverterTypeEndSessionInput, FfiConverterTypeEndSessionOutput, FfiConverterTypeEscalateSessionInput, FfiConverterTypeGetCursorPositionInput, FfiConverterTypeGetDesktopStateInput, FfiConverterTypeGetScreenSizeInput, FfiConverterTypeGetSessionStateInput, FfiConverterTypeHotkeyInput, FfiConverterTypeMoveCursorInput, FfiConverterTypePressKeyInput, FfiConverterTypeScrollInput, FfiConverterTypeSessionStateOutput, FfiConverterTypeStartSessionInput, FfiConverterTypeStartSessionOutput, FfiConverterTypeTypeTextInput } = uniffiCuaDriverContractModule.converters;+const { FfiConverterTypeClickInput, FfiConverterTypeDragInput, FfiConverterTypeEndSessionInput, FfiConverterTypeEndSessionOutput, FfiConverterTypeEscalateSessionInput, FfiConverterTypeGetAgentCursorStateInput, FfiConverterTypeGetCursorPositionInput, FfiConverterTypeGetDesktopStateInput, FfiConverterTypeGetScreenSizeInput, FfiConverterTypeGetSessionStateInput, FfiConverterTypeHotkeyInput, FfiConverterTypeMoveCursorInput, FfiConverterTypePressKeyInput, FfiConverterTypeScrollInput, FfiConverterTypeSessionStateOutput, FfiConverterTypeSetAgentCursorEnabledInput, FfiConverterTypeSetAgentCursorMotionInput, FfiConverterTypeSetAgentCursorThemeInput, FfiConverterTypeStartSessionInput, FfiConverterTypeStartSessionOutput, FfiConverterTypeTypeTextInput } = uniffiCuaDriverContractModule.converters;const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));const uniffiIsDebug =@@ -2425,6 +2425,7 @@ export interface CuaDriverLike {endSession(input: EndSessionInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<EndSessionOutput>;escalateSession(input: EscalateSessionInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<SessionStateOutput>;executionMode(): DriverExecutionMode;+ getAgentCursorState(input: GetAgentCursorStateInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;getCursorPosition(input: GetCursorPositionInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;getDesktopState(input: GetDesktopStateInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;getScreenSize(input: GetScreenSizeInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;@@ -2440,6 +2441,9 @@ export interface CuaDriverLike {pressKey(input: PressKeyInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;runtimeScopePrefix(): string | undefined;scroll(input: ScrollInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;+ setAgentCursorEnabled(input: SetAgentCursorEnabledInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;+ setAgentCursorMotion(input: SetAgentCursorMotionInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;+ setAgentCursorTheme(input: SetAgentCursorThemeInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;/*** Stop accepting new embedded operations. Repeated calls are harmless;* daemon compatibility clients do not own the daemon and therefore no-op.@@ -2829,6 +2833,38 @@ private constructor(pointer: UniffiHandle) {));}+ async getAgentCursorState(input: GetAgentCursorStateInput, asyncOpts_?: { signal: AbortSignal }): Promise<ToolResult> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_get_agent_cursor_state(+ uniffiTypeCuaDriverObjectFactory.clonePointer(this),FfiConverterTypeGetAgentCursorStateInput.lower(input, nativeModule().rustbuffer_alloc)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeToolResult.lift.bind(FfiConverterTypeToolResult),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+async getCursorPosition(input: GetCursorPositionInput, asyncOpts_?: { signal: AbortSignal }): Promise<ToolResult> /*throws*/ {const __stack = uniffiIsDebug ? new Error().stack : undefined;try {@@ -3180,6 +3216,102 @@ private constructor(pointer: UniffiHandle) {}}+ async setAgentCursorEnabled(input: SetAgentCursorEnabledInput, asyncOpts_?: { signal: AbortSignal }): Promise<ToolResult> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_enabled(+ uniffiTypeCuaDriverObjectFactory.clonePointer(this),FfiConverterTypeSetAgentCursorEnabledInput.lower(input, nativeModule().rustbuffer_alloc)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeToolResult.lift.bind(FfiConverterTypeToolResult),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }++ async setAgentCursorMotion(input: SetAgentCursorMotionInput, asyncOpts_?: { signal: AbortSignal }): Promise<ToolResult> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_motion(+ uniffiTypeCuaDriverObjectFactory.clonePointer(this),FfiConverterTypeSetAgentCursorMotionInput.lower(input, nativeModule().rustbuffer_alloc)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeToolResult.lift.bind(FfiConverterTypeToolResult),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }++ async setAgentCursorTheme(input: SetAgentCursorThemeInput, asyncOpts_?: { signal: AbortSignal }): Promise<ToolResult> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_theme(+ uniffiTypeCuaDriverObjectFactory.clonePointer(this),FfiConverterTypeSetAgentCursorThemeInput.lower(input, nativeModule().rustbuffer_alloc)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeToolResult.lift.bind(FfiConverterTypeToolResult),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+/*** Stop accepting new embedded operations. Repeated calls are harmless;* daemon compatibility clients do not own the daemon and therefore no-op.@@ -3390,6 +3522,7 @@ export interface CuaDriverSessionLike {drag(input: DragInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;endSession(input: EndSessionInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<EndSessionOutput>;escalateSession(input: EscalateSessionInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<SessionStateOutput>;+ getAgentCursorState(input: GetAgentCursorStateInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;getCursorPosition(input: GetCursorPositionInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;getDesktopState(input: GetDesktopStateInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;getScreenSize(input: GetScreenSizeInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;@@ -3398,6 +3531,9 @@ export interface CuaDriverSessionLike {moveCursor(input: MoveCursorInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;pressKey(input: PressKeyInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;scroll(input: ScrollInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;+ setAgentCursorEnabled(input: SetAgentCursorEnabledInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;+ setAgentCursorMotion(input: SetAgentCursorMotionInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;+ setAgentCursorTheme(input: SetAgentCursorThemeInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;startSession(input: StartSessionInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<StartSessionOutput>;typeText(input: TypeTextInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;}@@ -3597,6 +3733,38 @@ private constructor(pointer: UniffiHandle) {}}+ async getAgentCursorState(input: GetAgentCursorStateInput, asyncOpts_?: { signal: AbortSignal }): Promise<ToolResult> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriversession_get_agent_cursor_state(+ uniffiTypeCuaDriverSessionObjectFactory.clonePointer(this),FfiConverterTypeGetAgentCursorStateInput.lower(input, nativeModule().rustbuffer_alloc)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeToolResult.lift.bind(FfiConverterTypeToolResult),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+async getCursorPosition(input: GetCursorPositionInput, asyncOpts_?: { signal: AbortSignal }): Promise<ToolResult> /*throws*/ {const __stack = uniffiIsDebug ? new Error().stack : undefined;try {@@ -3853,6 +4021,102 @@ private constructor(pointer: UniffiHandle) {}}+ async setAgentCursorEnabled(input: SetAgentCursorEnabledInput, asyncOpts_?: { signal: AbortSignal }): Promise<ToolResult> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_enabled(+ uniffiTypeCuaDriverSessionObjectFactory.clonePointer(this),FfiConverterTypeSetAgentCursorEnabledInput.lower(input, nativeModule().rustbuffer_alloc)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeToolResult.lift.bind(FfiConverterTypeToolResult),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }++ async setAgentCursorMotion(input: SetAgentCursorMotionInput, asyncOpts_?: { signal: AbortSignal }): Promise<ToolResult> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_motion(+ uniffiTypeCuaDriverSessionObjectFactory.clonePointer(this),FfiConverterTypeSetAgentCursorMotionInput.lower(input, nativeModule().rustbuffer_alloc)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeToolResult.lift.bind(FfiConverterTypeToolResult),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }++ async setAgentCursorTheme(input: SetAgentCursorThemeInput, asyncOpts_?: { signal: AbortSignal }): Promise<ToolResult> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_theme(+ uniffiTypeCuaDriverSessionObjectFactory.clonePointer(this),FfiConverterTypeSetAgentCursorThemeInput.lower(input, nativeModule().rustbuffer_alloc)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeToolResult.lift.bind(FfiConverterTypeToolResult),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+async startSession(input: StartSessionInput, asyncOpts_?: { signal: AbortSignal }): Promise<StartSessionOutput> /*throws*/ {const __stack = uniffiIsDebug ? new Error().stack : undefined;try {@@ -4831,6 +5095,9 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_execution_mode() !== 2639) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_execution_mode");}+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_get_agent_cursor_state() !== 45642) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_get_agent_cursor_state");+ }if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_get_cursor_position() !== 34285) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_get_cursor_position");}@@ -4867,6 +5134,15 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_scroll() !== 52290) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_scroll");}+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_enabled() !== 26268) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_enabled");+ }+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_motion() !== 12578) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_motion");+ }+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_theme() !== 53908) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_theme");+ }if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_shutdown() !== 36331) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_shutdown");}@@ -4897,6 +5173,9 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriversession_escalate_session() !== 34392) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriversession_escalate_session");}+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_agent_cursor_state() !== 60344) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_agent_cursor_state");+ }if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_cursor_position() !== 54838) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriversession_get_cursor_position");}@@ -4921,6 +5200,15 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriversession_scroll() !== 8013) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriversession_scroll");}+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_enabled() !== 37153) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_enabled");+ }+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_motion() !== 26144) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_motion");+ }+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_theme() !== 29734) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_cursor_theme");+ }if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriversession_start_session() !== 13118) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriversession_start_session");}