Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(cua-driver): add verified semantic window framing (#2772)

Francesco Bonaccifb3914475b9c
diff --git a/docs/content/docs/reference/cua-driver/mcp-tools.mdx b/docs/content/docs/reference/cua-driver/mcp-tools.mdx
index 3dc53af8f4..87a6aa5150 100644
--- a/docs/content/docs/reference/cua-driver/mcp-tools.mdx
+++ b/docs/content/docs/reference/cua-driver/mcp-tools.mdx
@@ -12,7 +12,7 @@ description: Reference for every MCP tool Cua Driver exposes
import { Callout } from 'fumadocs-ui/components/callout';
-`cua-driver` exposes 52 MCP tools through a single stdio server (`cua-driver mcp`). Every tool is also callable from the shell as `cua-driver <name> '<JSON-args>'`.
+`cua-driver` exposes 53 MCP tools through a single stdio server (`cua-driver mcp`). Every tool is also callable from the shell as `cua-driver <name> '<JSON-args>'`.
Tool names are `snake_case`. Responses are MCP `CallTool.Result` envelopes: a text content block prefixed with a `✅` summary (or the error reason on failure), plus optional image or structured-content blocks on tools that produce them. See the [CLI reference](/reference/cua-driver/cli-reference) for CLI-specific options like `--socket` and `--screenshot-out-file`.
@@ -200,6 +200,24 @@ Persistently activate an app so it genuinely holds macOS foreground, then leave
{"pid":844}
```
+### `set_window_frame`
+
+Set one exact top-level window's frame in the desktop-coordinate space reported by list_windows and verify the resulting geometry through an independent readback.
+
+**Arguments:**
+
+- `height` (number, required): range: 1–unbounded
+- `pid` (integer, required): range: 1–unbounded
+- `session` (string, optional): Optional session id.
+- `width` (number, required): range: 1–unbounded
+- `window_id` (integer, required): range: 1–unbounded
+- `x` (number, required)
+- `y` (number, required)
+
+```json
+{"height":1,"pid":844,"width":1,"window_id":10725,"x":100,"y":200}
+```
+
### `click`
Click against a target pid. **Prefer `element_index` over pixel coordinates** — element_index works on backgrounded / minimized / hidden / off-Space windows, surfaces a stable handle that survives rebuilds, and tells you what you're clicking via the cached element's role + label. Reach for `x, y` only when the target is a canvas / video / WebGL / custom-drawn surface that doesn't appear in the AX tree.
diff --git a/libs/cua-driver/contract/README.md b/libs/cua-driver/contract/README.md
index 695fd6ffb3..ac72f33057 100644
--- a/libs/cua-driver/contract/README.md
+++ b/libs/cua-driver/contract/README.md
@@ -28,6 +28,7 @@ It also covers the portable whole-desktop loop:
- `get_screen_size`
- `get_cursor_position`
- `move_cursor` with the required `scope="desktop"`
+- `set_window_frame` for exact, read-back-verified top-level window geometry
- `click` with the required `scope="desktop"`
- `drag` and `scroll` in native desktop coordinates
- `type_text`, `press_key`, and `hotkey` against the foreground application
diff --git a/libs/cua-driver/contract/manifest.json b/libs/cua-driver/contract/manifest.json
index 72e8022462..ccf7747dd5 100644
--- a/libs/cua-driver/contract/manifest.json
+++ b/libs/cua-driver/contract/manifest.json
@@ -168,6 +168,7 @@
"accessibility",
"synthetic_events",
"global_input",
+ "system_api",
"dom",
"trusted_input"
],
@@ -516,6 +517,7 @@
"accessibility",
"synthetic_events",
"global_input",
+ "system_api",
"dom",
"trusted_input"
],
@@ -1349,6 +1351,7 @@
"accessibility",
"synthetic_events",
"global_input",
+ "system_api",
"dom",
"trusted_input"
],
@@ -1509,6 +1512,7 @@
"accessibility",
"synthetic_events",
"global_input",
+ "system_api",
"dom",
"trusted_input"
],
@@ -1671,6 +1675,7 @@
"accessibility",
"synthetic_events",
"global_input",
+ "system_api",
"dom",
"trusted_input"
],
@@ -1853,6 +1858,7 @@
"accessibility",
"synthetic_events",
"global_input",
+ "system_api",
"dom",
"trusted_input"
],
@@ -2174,6 +2180,182 @@
"type": "object"
}
},
+ {
+ "name": "set_window_frame",
+ "description": "Set one exact top-level window's frame in the desktop-coordinate space reported by list_windows and verify the resulting geometry through an independent readback.",
+ "platforms": [
+ "macos",
+ "windows",
+ "linux"
+ ],
+ "capabilities": [
+ "window.frame.set"
+ ],
+ "annotations": {
+ "read_only": false,
+ "destructive": false,
+ "idempotent": true,
+ "open_world": false
+ },
+ "schema_mode": "portable_subset",
+ "cursor_semantics": {
+ "action": "app"
+ },
+ "input_schema": {
+ "additionalProperties": false,
+ "properties": {
+ "height": {
+ "minimum": 1,
+ "type": "number"
+ },
+ "pid": {
+ "minimum": 1,
+ "type": "integer"
+ },
+ "session": {
+ "description": "Optional session id.",
+ "type": "string"
+ },
+ "width": {
+ "minimum": 1,
+ "type": "number"
+ },
+ "window_id": {
+ "minimum": 1,
+ "type": "integer"
+ },
+ "x": {
+ "type": "number"
+ },
+ "y": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "pid",
+ "window_id",
+ "x",
+ "y",
+ "width",
+ "height"
+ ],
+ "type": "object"
+ },
+ "success_output_schema": {
+ "additionalProperties": false,
+ "properties": {
+ "delivery": {
+ "additionalProperties": false,
+ "properties": {
+ "delivered_count": {
+ "format": "uint32",
+ "minimum": 0,
+ "type": [
+ "integer",
+ "null"
+ ]
+ },
+ "mode": {
+ "enum": [
+ "background",
+ "foreground",
+ "not_applicable",
+ "unknown"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "mode"
+ ],
+ "type": [
+ "object",
+ "null"
+ ]
+ },
+ "effect": {
+ "enum": [
+ "confirmed",
+ "partial",
+ "unverifiable",
+ "suspected_noop",
+ "refused"
+ ],
+ "type": "string"
+ },
+ "escalation": {
+ "additionalProperties": false,
+ "properties": {
+ "reason": {
+ "enum": [
+ "route_unavailable",
+ "delivery_failed",
+ "effect_unconfirmed",
+ "suspected_noop",
+ "permission_required"
+ ],
+ "type": "string"
+ },
+ "target": {
+ "enum": [
+ "pixel",
+ "foreground",
+ "page",
+ "session"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "target",
+ "reason"
+ ],
+ "type": [
+ "object",
+ "null"
+ ]
+ },
+ "evidence": {
+ "items": {
+ "additionalProperties": false,
+ "properties": {
+ "kind": {
+ "enum": [
+ "value_readback",
+ "window_change"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "kind"
+ ],
+ "type": "object"
+ },
+ "type": [
+ "array",
+ "null"
+ ]
+ },
+ "route": {
+ "enum": [
+ "accessibility",
+ "synthetic_events",
+ "global_input",
+ "system_api",
+ "dom",
+ "trusted_input"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "effect",
+ "route"
+ ],
+ "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.",
@@ -2458,6 +2640,7 @@
"accessibility",
"synthetic_events",
"global_input",
+ "system_api",
"dom",
"trusted_input"
],
diff --git a/libs/cua-driver/python/src/cua_driver/__init__.py b/libs/cua-driver/python/src/cua_driver/__init__.py
index 1dcecba6c4..48815ca79a 100644
--- a/libs/cua-driver/python/src/cua_driver/__init__.py
+++ b/libs/cua-driver/python/src/cua_driver/__init__.py
@@ -91,6 +91,7 @@ from ._native_contract import (
SetAgentCursorEnabledInput,
SetAgentCursorMotionInput,
SetAgentCursorThemeInput,
+ SetWindowFrameInput,
StartSessionInput,
StartSessionOutput,
StatePredicate,
@@ -242,6 +243,7 @@ __all__ = [
"SetAgentCursorEnabledInput",
"SetAgentCursorMotionInput",
"SetAgentCursorThemeInput",
+ "SetWindowFrameInput",
"StartSessionInput",
"StartSessionOutput",
"StatePredicate",
diff --git a/libs/cua-driver/python/src/cua_driver/_native.py b/libs/cua-driver/python/src/cua_driver/_native.py
index 3026d68021..c30444c3c8 100644
--- a/libs/cua-driver/python/src/cua_driver/_native.py
+++ b/libs/cua-driver/python/src/cua_driver/_native.py
@@ -564,6 +564,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_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_set_window_frame() != 6509:
+ 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:
@@ -614,6 +616,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_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_set_window_frame() != 65413:
+ 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:
@@ -1215,6 +1219,11 @@ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_agent_cursor_theme.argt
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_set_window_frame.argtypes = (
+ ctypes.c_uint64,
+ cua_driver._native_contract._UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_set_window_frame.restype = ctypes.c_uint64
_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriver_shutdown.argtypes = (
ctypes.c_uint64,
)
@@ -1340,6 +1349,11 @@ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_the
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_set_window_frame.argtypes = (
+ ctypes.c_uint64,
+ cua_driver._native_contract._UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_window_frame.restype = ctypes.c_uint64
_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_start_session.argtypes = (
ctypes.c_uint64,
cua_driver._native_contract._UniffiRustBuffer,
@@ -1533,6 +1547,9 @@ _UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_agent_cursor_moti
_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_set_window_frame.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriver_set_window_frame.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
@@ -1608,6 +1625,9 @@ _UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_agent_curs
_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_set_window_frame.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_window_frame.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
@@ -4114,6 +4134,8 @@ class _UniffiFfiConverterTypeSdkClientKind(_UniffiConverterRustBuffer):
+
+
@@ -4175,6 +4197,8 @@ class CuaDriverProtocol(typing.Protocol):
raise NotImplementedError
async def set_agent_cursor_theme(self, input: cua_driver._native_contract.SetAgentCursorThemeInput) -> ToolResult:
raise NotImplementedError
+ async def set_window_frame(self, input: cua_driver._native_contract.SetWindowFrameInput) -> ToolResult:
+ raise NotImplementedError
async def shutdown(self, ) -> None:
"""
Stop accepting new embedded operations. Repeated calls are harmless;
@@ -4931,6 +4955,23 @@ class CuaDriver(CuaDriverProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def set_window_frame(self, input: cua_driver._native_contract.SetWindowFrameInput) -> ToolResult:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeSetWindowFrameInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeSetWindowFrameInput.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_window_frame(*_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;
@@ -5095,6 +5136,8 @@ class CuaDriverSessionProtocol(typing.Protocol):
raise NotImplementedError
async def set_agent_cursor_theme(self, input: cua_driver._native_contract.SetAgentCursorThemeInput) -> ToolResult:
raise NotImplementedError
+ async def set_window_frame(self, input: cua_driver._native_contract.SetWindowFrameInput) -> ToolResult:
+ raise NotImplementedError
async def start_session(self, input: cua_driver._native_contract.StartSessionInput) -> cua_driver._native_contract.StartSessionOutput:
raise NotImplementedError
async def type_text(self, input: cua_driver._native_contract.TypeTextInput) -> ToolResult:
@@ -5470,6 +5513,23 @@ class CuaDriverSession(CuaDriverSessionProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def set_window_frame(self, input: cua_driver._native_contract.SetWindowFrameInput) -> ToolResult:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeSetWindowFrameInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeSetWindowFrameInput.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_window_frame(*_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.py
index 1f702a2f0f..d9b92836fa 100644
--- a/libs/cua-driver/python/src/cua_driver/_native_contract.py
+++ b/libs/cua-driver/python/src/cua_driver/_native_contract.py
@@ -1187,9 +1187,11 @@ class ActionRoute(enum.Enum):
GLOBAL_INPUT = 2
- DOM = 3
+ SYSTEM_API = 3
- TRUSTED_INPUT = 4
+ DOM = 4
+
+ TRUSTED_INPUT = 5
@@ -1204,8 +1206,10 @@ class _UniffiFfiConverterTypeActionRoute(_UniffiConverterRustBuffer):
if variant == 3:
return ActionRoute.GLOBAL_INPUT
if variant == 4:
- return ActionRoute.DOM
+ return ActionRoute.SYSTEM_API
if variant == 5:
+ return ActionRoute.DOM
+ if variant == 6:
return ActionRoute.TRUSTED_INPUT
raise InternalError("Raw enum value doesn't match any cases")
@@ -1217,6 +1221,8 @@ class _UniffiFfiConverterTypeActionRoute(_UniffiConverterRustBuffer):
return
if value == ActionRoute.GLOBAL_INPUT:
return
+ if value == ActionRoute.SYSTEM_API:
+ return
if value == ActionRoute.DOM:
return
if value == ActionRoute.TRUSTED_INPUT:
@@ -1231,10 +1237,12 @@ class _UniffiFfiConverterTypeActionRoute(_UniffiConverterRustBuffer):
buf.write_i32(2)
if value == ActionRoute.GLOBAL_INPUT:
buf.write_i32(3)
- if value == ActionRoute.DOM:
+ if value == ActionRoute.SYSTEM_API:
buf.write_i32(4)
- if value == ActionRoute.TRUSTED_INPUT:
+ if value == ActionRoute.DOM:
buf.write_i32(5)
+ if value == ActionRoute.TRUSTED_INPUT:
+ buf.write_i32(6)
@@ -4018,6 +4026,72 @@ class _UniffiFfiConverterTypeSetAgentCursorThemeOutput(_UniffiConverterRustBuffe
_UniffiFfiConverterString.write(value.session, buf)
_UniffiFfiConverterTypeCursorThemeOutput.write(value.theme, buf)
+@dataclass
+class SetWindowFrameInput:
+ def __init__(self, *, pid:int, window_id:int, x:float, y:float, width:float, height:float, session:typing.Optional[str]):
+ self.pid = pid
+ self.window_id = window_id
+ self.x = x
+ self.y = y
+ self.width = width
+ self.height = height
+ self.session = session
+
+
+
+
+ def __str__(self):
+ return "SetWindowFrameInput(pid={}, window_id={}, x={}, y={}, width={}, height={}, session={})".format(self.pid, self.window_id, self.x, self.y, self.width, self.height, self.session)
+ def __eq__(self, other):
+ if self.pid != other.pid:
+ return False
+ if self.window_id != other.window_id:
+ return False
+ if self.x != other.x:
+ return False
+ if self.y != other.y:
+ return False
+ if self.width != other.width:
+ return False
+ if self.height != other.height:
+ return False
+ if self.session != other.session:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeSetWindowFrameInput(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return SetWindowFrameInput(
+ pid=_UniffiFfiConverterUInt32.read(buf),
+ window_id=_UniffiFfiConverterUInt64.read(buf),
+ x=_UniffiFfiConverterFloat64.read(buf),
+ y=_UniffiFfiConverterFloat64.read(buf),
+ width=_UniffiFfiConverterFloat64.read(buf),
+ height=_UniffiFfiConverterFloat64.read(buf),
+ session=_UniffiFfiConverterOptionalString.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterUInt32.check_lower(value.pid)
+ _UniffiFfiConverterUInt64.check_lower(value.window_id)
+ _UniffiFfiConverterFloat64.check_lower(value.x)
+ _UniffiFfiConverterFloat64.check_lower(value.y)
+ _UniffiFfiConverterFloat64.check_lower(value.width)
+ _UniffiFfiConverterFloat64.check_lower(value.height)
+ _UniffiFfiConverterOptionalString.check_lower(value.session)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterUInt32.write(value.pid, buf)
+ _UniffiFfiConverterUInt64.write(value.window_id, buf)
+ _UniffiFfiConverterFloat64.write(value.x, buf)
+ _UniffiFfiConverterFloat64.write(value.y, buf)
+ _UniffiFfiConverterFloat64.write(value.width, buf)
+ _UniffiFfiConverterFloat64.write(value.height, buf)
+ _UniffiFfiConverterOptionalString.write(value.session, buf)
+
class _UniffiFfiConverterOptionalTypeCaptureScope(_UniffiConverterRustBuffer):
@classmethod
def check_lower(cls, value):
@@ -4643,6 +4717,7 @@ __all__ = [
"SetAgentCursorMotionOutput",
"SetAgentCursorThemeInput",
"SetAgentCursorThemeOutput",
+ "SetWindowFrameInput",
"StartSessionInput",
"StartSessionOutput",
"WindowPredicate",
diff --git a/libs/cua-driver/rust/Skills/cua-driver/LINUX.md b/libs/cua-driver/rust/Skills/cua-driver/LINUX.md
index 4034d41007..92d6a5594f 100644
--- a/libs/cua-driver/rust/Skills/cua-driver/LINUX.md
+++ b/libs/cua-driver/rust/Skills/cua-driver/LINUX.md
@@ -8,6 +8,12 @@ supported: `click`, `type_text`, scroll, `press_key`, `screenshot`,
`launch_app`, `list_apps`, `list_windows`, `get_window_state`, and
session recording.
+On X11, `set_window_frame({pid, window_id, x, y, width, height})` sends an
+EWMH window-manager request and confirms it against `list_windows` geometry.
+Wayland has no portable protocol for setting another application's top-level
+geometry, so this tool refuses there unless a future compositor-owned adapter
+can provide exact targeting and readback.
+
AT-SPI is talked to natively over D-Bus (the `atspi`/zbus crate) — no
`pyatspi` or GObject-introspection typelibs are required at runtime.
diff --git a/libs/cua-driver/rust/Skills/cua-driver/MACOS.md b/libs/cua-driver/rust/Skills/cua-driver/MACOS.md
index da67519cb4..f9fb9cc1bb 100644
--- a/libs/cua-driver/rust/Skills/cua-driver/MACOS.md
+++ b/libs/cua-driver/rust/Skills/cua-driver/MACOS.md
@@ -110,6 +110,7 @@ is safe even for apps that normally foreground on media-load
| Open / launch an app | `launch_app({bundle_id})` or `launch_app({bundle_id, urls:[...]})` | `open -a`, `osascript 'tell app … to launch/activate/open'` |
| Find a pid | `list_apps` or `launch_app`'s return | `pgrep`, `ps`, `osascript frontmost` |
| Enumerate an app's windows | `list_windows({pid})` — or read the `windows` array `launch_app` already returns | `osascript 'every window of app …'` |
+| Move or resize one exact window | `set_window_frame({pid, window_id, x, y, width, height})` | `osascript` position/size writes or title-bar dragging |
| Click / type / scroll / keys | `click`, `type_text`, `scroll`, `press_key`, `hotkey` | `osascript`, `cliclick`, raw `CGEvent`, `open <url>` |
| Drag / drag-and-drop / marquee select | `drag({pid, from_x, from_y, to_x, to_y})` (pixel-only — macOS AX has no semantic drag) | `cliclick dd:`, `osascript drag` |
| Screenshot | `screenshot` or the PNG in `get_window_state` | `screencapture` |
diff --git a/libs/cua-driver/rust/Skills/cua-driver/SKILL.md b/libs/cua-driver/rust/Skills/cua-driver/SKILL.md
index 41ad44ba32..5b2407c459 100644
--- a/libs/cua-driver/rust/Skills/cua-driver/SKILL.md
+++ b/libs/cua-driver/rust/Skills/cua-driver/SKILL.md
@@ -65,6 +65,21 @@ Use whichever combination matches the host. When in doubt, run
`cua-driver doctor` — it reports the platform and the right entry
point.
+## Choose a semantic system operation before a GUI path
+
+Before opening or operating an application, classify the requested outcome. If
+the caller already has a purpose-built API, CLI, or filesystem operation that
+can complete a non-GUI outcome directly, use it before Cua Driver. File moves,
+renames, copies, directory creation, archive extraction, data conversion, and
+process inspection should not be performed by opening Finder, Explorer, or a
+Linux file manager and imitating a user.
+
+Use Cua Driver when the outcome lives in an application's UI or window state,
+or when the user explicitly asks to operate that GUI. Once the task crosses
+that boundary, do not replace Cua's targeted and verified actions with shell
+scripts that mutate the app UI. A shell is a capability of the calling agent,
+not of the Cua Driver MCP server; an MCP-only client must not assume one exists.
+
## The no-foreground principle (window phase)
In a strict `window` session, and during the initial window phase of an
@@ -88,7 +103,7 @@ that phase only after the complete window ladder below has been attempted and
verified, followed by `escalate_session`. Never infer desktop permission from a
failed action or a proxy/transport session id.
-## Defaults — always prefer cua-driver over shell shims
+## GUI transport defaults — prefer cua-driver over GUI shell shims
**Default transport is the `cua-driver` CLI** — `Bash` shelling out
to `cua-driver <tool-name> '<JSON-args>'`. MCP tools (prefix
@@ -678,6 +693,7 @@ against a specific window.
| Intent | Tool | Notes |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| List an app's windows | `list_windows({pid})` | returns `window_id`, `title`, `bounds`, `z_index`, `is_on_screen`, `on_current_space`. Already included in `launch_app`'s response — only call this for long-lived pids |
+| Set an exact window frame | `set_window_frame({pid, window_id, x, y, width, height})` | uses the platform window manager and returns `confirmed` only after geometry readback; inspect `list_windows` again before continuing when the result is not confirmed |
| Snapshot a window | `get_window_state({pid, window_id})` | returns `tree_markdown` + `screenshot_*`; populates the `(pid, window_id)` element_index cache |
| Verify a postcondition | `verify_state({pid, window_id, expect, include_screenshot?})` | polls bounded structured predicates; returns `satisfied`, `unsatisfied`, or `unknown`. Optional final image is interpreted by the agent harness, never by the driver |
| Left click | `click({pid, window_id, element_index})` | default `action: "press"`. Pixel form: `click({pid, x, y})` (window_id optional) — `modifier: ["cmd"\|"ctrl"]` |
diff --git a/libs/cua-driver/rust/Skills/cua-driver/WINDOWS.md b/libs/cua-driver/rust/Skills/cua-driver/WINDOWS.md
index a9a00050bc..3c9e80b1d6 100644
--- a/libs/cua-driver/rust/Skills/cua-driver/WINDOWS.md
+++ b/libs/cua-driver/rust/Skills/cua-driver/WINDOWS.md
@@ -366,6 +366,7 @@ gone wrong — re-read "The no-foreground contract" above.
| Open a URL in the default browser | `launch_app({urls: ["https://example.com"]})` | `Start-Process "https://…"`, `explorer.exe ms-edge:…`, `cmd /c start "" "https://…"` |
| Find a pid | `list_apps` or `launch_app`'s return | `Get-Process`, `tasklist`, Win+S typing |
| Enumerate an app's windows | `list_windows({pid})` — or read the `windows` array `launch_app` already returns | `Get-Process \| Where-Object { $_.MainWindowHandle }` |
+| Move or resize one exact window | `set_window_frame({pid, window_id, x, y, width, height})` | PowerShell Add-Type wrappers, Win+Arrow, or title-bar dragging |
| Click / type / scroll / keys | `click`, `type_text`, `scroll`, `press_key`, `hotkey` | `SendInput`, `cliclick`-style C# add-types, AutoHotkey scripts |
| Drag / drag-and-drop | `drag({pid, from_x, from_y, to_x, to_y})` | `SendInput` with `MOUSEEVENTF_MOVE`, mouse_event |
| Screenshot | `screenshot` or the PNG in `get_window_state` | `[System.Windows.Forms.Screen]::CopyFromScreen`, `nircmd savescreenshot` |
diff --git a/libs/cua-driver/rust/crates/cua-driver-contract/src/cursor.rs b/libs/cua-driver/rust/crates/cua-driver-contract/src/cursor.rs
index e8ff92a855..de9e98de9d 100644
--- a/libs/cua-driver/rust/crates/cua-driver-contract/src/cursor.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-contract/src/cursor.rs
@@ -234,8 +234,8 @@ pub fn classify_cursor_semantics(name: &str, args: &Value) -> Option<CursorSeman
CursorAction::Navigate
}
- "launch_app" | "activate_app" | "bring_to_front" | "list_apps" | "list_windows"
- | "kill_app" => CursorAction::App,
+ "launch_app" | "activate_app" | "bring_to_front" | "set_window_frame" | "list_apps"
+ | "list_windows" | "kill_app" => CursorAction::App,
"upload_file" | "download_file" | "copy_file" | "move_file" => CursorAction::Transfer,
@@ -257,6 +257,8 @@ pub fn classify_cursor_semantics(name: &str, args: &Value) -> Option<CursorSeman
let target = if name.starts_with("browser_") {
Some(CursorTarget::Browser)
+ } else if name == "set_window_frame" {
+ Some(CursorTarget::Desktop)
} else if args
.get("element_index")
.or_else(|| args.get("element_token"))
@@ -343,6 +345,17 @@ mod tests {
target: Some(CursorTarget::Ax),
})
);
+ assert_eq!(
+ classify_cursor_semantics(
+ "set_window_frame",
+ &json!({"pid": 7, "window_id": 9, "x": 0, "y": 0})
+ ),
+ Some(CursorSemantics {
+ action: CursorAction::App,
+ delivery: None,
+ target: Some(CursorTarget::Desktop),
+ })
+ );
}
#[test]
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.rs
index d22ef92cfd..3a7596bae3 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
@@ -12,7 +12,7 @@ use crate::{
ClipboardWriteOutput, CursorAction, CursorPositionOutput, CursorSemantics, DesktopStateOutput,
DragInput, GetCursorPositionInput, GetDesktopStateInput, GetScreenSizeInput, HotkeyInput,
MoveCursorInput, Platform, PressKeyInput, SchemaMode, ScreenSizeOutput, ScrollInput,
- ToolAnnotations, ToolContract, ToolInput, ToolOutput, TypeTextInput,
+ SetWindowFrameInput, ToolAnnotations, ToolContract, ToolInput, ToolOutput, TypeTextInput,
};
const ALL_PLATFORMS: [Platform; 3] = [Platform::Macos, Platform::Windows, Platform::Linux];
@@ -23,6 +23,7 @@ pub fn contracts() -> Vec<ToolContract> {
get_screen_size(),
get_cursor_position(),
move_cursor(),
+ set_window_frame(),
click(),
drag(),
scroll(),
@@ -199,6 +200,21 @@ fn move_cursor() -> ToolContract {
)
}
+fn set_window_frame() -> ToolContract {
+ contract::<SetWindowFrameInput, ActionResult>(
+ "set_window_frame",
+ "Set one exact top-level window's frame in the desktop-coordinate space reported by list_windows and verify the resulting geometry through an independent readback.",
+ &["window.frame.set"],
+ ToolAnnotations {
+ read_only: false,
+ destructive: false,
+ idempotent: true,
+ open_world: false,
+ },
+ CursorAction::App,
+ )
+}
+
fn click() -> ToolContract {
contract::<ClickInput, ActionResult>(
"click",
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.rs
index 54806c5c03..42e349d8c3 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
@@ -66,6 +66,14 @@ fn number_schema(_: &mut SchemaGenerator) -> Schema {
json_schema!({ "type": "number" })
}
+fn positive_number_schema(_: &mut SchemaGenerator) -> Schema {
+ json_schema!({ "type": "number", "minimum": 1 })
+}
+
+fn positive_integer_schema(_: &mut SchemaGenerator) -> Schema {
+ json_schema!({ "type": "integer", "minimum": 1 })
+}
+
fn click_button_schema(generator: &mut SchemaGenerator) -> Schema {
ClickButton::json_schema(generator)
}
@@ -407,6 +415,31 @@ pub struct MoveCursorInput {
pub session: Option<String>,
}
+#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, uniffi::Record)]
+#[serde(deny_unknown_fields)]
+pub struct SetWindowFrameInput {
+ #[schemars(schema_with = "positive_integer_schema")]
+ pub pid: u32,
+ #[schemars(schema_with = "positive_integer_schema")]
+ pub window_id: u64,
+ #[schemars(schema_with = "number_schema")]
+ pub x: f64,
+ #[schemars(schema_with = "number_schema")]
+ pub y: f64,
+ #[schemars(schema_with = "positive_number_schema")]
+ pub width: f64,
+ #[schemars(schema_with = "positive_number_schema")]
+ pub height: f64,
+ /// Optional session id.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ #[schemars(schema_with = "string_schema")]
+ pub session: Option<String>,
+}
+
+impl ToolInput for SetWindowFrameInput {
+ const TOOL_NAME: &'static str = "set_window_frame";
+}
+
impl ToolInput for MoveCursorInput {
const TOOL_NAME: &'static str = "move_cursor";
}
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.rs
index 0629649750..dbf3c3c560 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
@@ -32,7 +32,7 @@ pub use inputs::{
GetCursorPositionInput, GetDesktopStateInput, GetScreenSizeInput, GetSessionStateInput,
HotkeyInput, MoveCursorInput, PressKeyInput, ScrollBy, ScrollDirection, ScrollInput,
SetAgentCursorEnabledInput, SetAgentCursorMotionInput, SetAgentCursorThemeInput,
- StartSessionInput, ToolInput, TypeTextInput,
+ SetWindowFrameInput, StartSessionInput, ToolInput, TypeTextInput,
};
pub use outputs::{
ActionDelivery, ActionDeliveryMode, ActionEffect, ActionEscalation, ActionEscalationReason,
@@ -81,6 +81,7 @@ pub const ACTION_RESULT_TOOLS: &[&str] = &[
"press_key",
"hotkey",
"set_value",
+ "set_window_frame",
"browser_click",
"browser_pointer",
"browser_type",
@@ -364,6 +365,7 @@ mod tests {
"move_cursor",
"press_key",
"scroll",
+ "set_window_frame",
"type_text",
] {
assert_eq!(
@@ -374,6 +376,35 @@ mod tests {
}
}
+ #[test]
+ fn set_window_frame_is_exact_targeted_and_positive_sized() {
+ let contract = tool_contract("set_window_frame").expect("set_window_frame contract");
+ assert_eq!(
+ contract.input_schema["required"],
+ serde_json::json!(["pid", "window_id", "x", "y", "width", "height"])
+ );
+ assert_eq!(
+ contract.input_schema["properties"]["pid"]["minimum"],
+ serde_json::json!(1)
+ );
+ assert_eq!(
+ contract.input_schema["properties"]["window_id"]["minimum"],
+ serde_json::json!(1)
+ );
+ assert_eq!(
+ contract.input_schema["properties"]["width"]["minimum"],
+ serde_json::json!(1)
+ );
+ assert_eq!(
+ contract.input_schema["properties"]["height"]["minimum"],
+ serde_json::json!(1)
+ );
+ assert_eq!(
+ contract.cursor_semantics.expect("cursor semantics").action,
+ CursorAction::App
+ );
+ }
+
#[test]
fn list_windows_defines_nullable_higher_is_frontmost_z_index() {
assert!(tool_contract("list_windows").is_none());
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.rs
index 468c764a36..eaea4cea46 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
@@ -325,6 +325,7 @@ pub enum ActionRoute {
Accessibility,
SyntheticEvents,
GlobalInput,
+ SystemApi,
Dom,
TrustedInput,
}
@@ -565,6 +566,7 @@ mod tests {
"accessibility",
"synthetic_events",
"global_input",
+ "system_api",
"dom",
"trusted_input"
])
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/action_record.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/action_record.rs
index 19cfffa002..f73762857b 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/action_record.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/action_record.rs
@@ -14,6 +14,23 @@ pub enum ActionEffect {
Refused,
}
+/// Classify an idempotent native mutation using an independent value readback.
+/// A missing readback never confirms success, while a readable unchanged value
+/// is stronger evidence of a no-op than of an unknown outcome.
+pub fn effect_from_value_readback(
+ confirmed: bool,
+ changed: bool,
+ readback_available: bool,
+) -> ActionEffect {
+ if confirmed && readback_available {
+ ActionEffect::Confirmed
+ } else if changed || !readback_available {
+ ActionEffect::Unverifiable
+ } else {
+ ActionEffect::SuspectedNoop
+ }
+}
+
/// The delivery mode requested by the caller.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum RequestedDelivery {
@@ -44,6 +61,7 @@ pub enum ActionTransport {
AgentCursorOverlay,
MacosAxAction,
MacosAxValue,
+ MacosAxWindowFrame,
MacosCgEventPid,
MacosCgEventHid,
WindowsUiaInvoke,
@@ -59,6 +77,7 @@ pub enum ActionTransport {
WindowsSendInput,
WindowsSetCursorPos,
WindowsShellExecute,
+ WindowsSetWindowPos,
LinuxAtSpiAction,
LinuxAtSpiValue,
LinuxPty,
@@ -67,6 +86,7 @@ pub enum ActionTransport {
LinuxLibei,
LinuxWaylandVirtualPointer,
LinuxCuaCompositorInject,
+ LinuxX11ConfigureWindow,
BrowserCdpInputMouse,
BrowserCdpInputKey,
BrowserCdpRuntimeFunction,
@@ -77,6 +97,7 @@ impl ActionTransport {
Self::AgentCursorOverlay,
Self::MacosAxAction,
Self::MacosAxValue,
+ Self::MacosAxWindowFrame,
Self::MacosCgEventPid,
Self::MacosCgEventHid,
Self::WindowsUiaInvoke,
@@ -92,6 +113,7 @@ impl ActionTransport {
Self::WindowsSendInput,
Self::WindowsSetCursorPos,
Self::WindowsShellExecute,
+ Self::WindowsSetWindowPos,
Self::LinuxAtSpiAction,
Self::LinuxAtSpiValue,
Self::LinuxPty,
@@ -100,6 +122,7 @@ impl ActionTransport {
Self::LinuxLibei,
Self::LinuxWaylandVirtualPointer,
Self::LinuxCuaCompositorInject,
+ Self::LinuxX11ConfigureWindow,
Self::BrowserCdpInputMouse,
Self::BrowserCdpInputKey,
Self::BrowserCdpRuntimeFunction,
@@ -110,6 +133,7 @@ impl ActionTransport {
Self::AgentCursorOverlay => ActionRoute::SyntheticEvents,
Self::MacosAxAction
| Self::MacosAxValue
+ | Self::MacosAxWindowFrame
| Self::WindowsUiaInvoke
| Self::WindowsUiaToggle
| Self::WindowsUiaSelection
@@ -133,6 +157,7 @@ impl ActionTransport {
| Self::LinuxLibei
| Self::LinuxWaylandVirtualPointer
| Self::LinuxCuaCompositorInject => ActionRoute::GlobalInput,
+ Self::WindowsSetWindowPos | Self::LinuxX11ConfigureWindow => ActionRoute::SystemApi,
Self::BrowserCdpRuntimeFunction => ActionRoute::Dom,
Self::BrowserCdpInputMouse | Self::BrowserCdpInputKey => ActionRoute::TrustedInput,
}
@@ -145,6 +170,7 @@ pub enum ActionRoute {
Accessibility,
SyntheticEvents,
GlobalInput,
+ SystemApi,
Dom,
TrustedInput,
}
@@ -160,6 +186,7 @@ pub struct ActionEvidence {
pub enum EvidenceKind {
AccessibilityReadback,
BrowserReadback,
+ ValueReadback,
WindowChange,
NativeApiResult,
ScreenshotComparison,
@@ -302,6 +329,7 @@ impl ActionExecutionRecord {
ActionRoute::Accessibility => cua_driver_contract::ActionRoute::Accessibility,
ActionRoute::SyntheticEvents => cua_driver_contract::ActionRoute::SyntheticEvents,
ActionRoute::GlobalInput => cua_driver_contract::ActionRoute::GlobalInput,
+ ActionRoute::SystemApi => cua_driver_contract::ActionRoute::SystemApi,
ActionRoute::Dom => cua_driver_contract::ActionRoute::Dom,
ActionRoute::TrustedInput => cua_driver_contract::ActionRoute::TrustedInput,
},
@@ -328,7 +356,8 @@ impl ActionExecutionRecord {
.map(|evidence| cua_driver_contract::ActionEvidence {
kind: match evidence.kind {
ProjectedEvidenceKind::AccessibilityReadback
- | ProjectedEvidenceKind::BrowserReadback => {
+ | ProjectedEvidenceKind::BrowserReadback
+ | ProjectedEvidenceKind::ValueReadback => {
cua_driver_contract::ActionEvidenceKind::ValueReadback
}
ProjectedEvidenceKind::WindowChange => {
@@ -886,6 +915,7 @@ fn projected_evidence(evidence: &[ActionEvidence]) -> Option<Vec<ActionEvidenceP
let kind = match evidence.kind {
EvidenceKind::AccessibilityReadback => ProjectedEvidenceKind::AccessibilityReadback,
EvidenceKind::BrowserReadback => ProjectedEvidenceKind::BrowserReadback,
+ EvidenceKind::ValueReadback => ProjectedEvidenceKind::ValueReadback,
EvidenceKind::WindowChange => ProjectedEvidenceKind::WindowChange,
EvidenceKind::NativeApiResult
| EvidenceKind::ScreenshotComparison
@@ -916,6 +946,7 @@ fn route_name(route: ActionRoute) -> &'static str {
ActionRoute::Accessibility => "accessibility",
ActionRoute::SyntheticEvents => "synthetic_events",
ActionRoute::GlobalInput => "global_input",
+ ActionRoute::SystemApi => "system_api",
ActionRoute::Dom => "dom",
ActionRoute::TrustedInput => "trusted_input",
}
@@ -942,6 +973,7 @@ fn evidence_kind_name(kind: EvidenceKind) -> &'static str {
match kind {
EvidenceKind::AccessibilityReadback => "accessibility_readback",
EvidenceKind::BrowserReadback => "browser_readback",
+ EvidenceKind::ValueReadback => "value_readback",
EvidenceKind::WindowChange => "window_change",
EvidenceKind::NativeApiResult => "native_api_result",
EvidenceKind::ScreenshotComparison => "screenshot_comparison",
@@ -969,6 +1001,7 @@ fn transport_name(transport: ActionTransport) -> &'static str {
ActionTransport::AgentCursorOverlay => "agent_cursor_overlay",
ActionTransport::MacosAxAction => "macos_ax_action",
ActionTransport::MacosAxValue => "macos_ax_value",
+ ActionTransport::MacosAxWindowFrame => "macos_ax_window_frame",
ActionTransport::MacosCgEventPid => "macos_cg_event_pid",
ActionTransport::MacosCgEventHid => "macos_cg_event_hid",
ActionTransport::WindowsUiaInvoke => "windows_uia_invoke",
@@ -984,6 +1017,7 @@ fn transport_name(transport: ActionTransport) -> &'static str {
ActionTransport::WindowsSendInput => "windows_send_input",
ActionTransport::WindowsSetCursorPos => "windows_set_cursor_pos",
ActionTransport::WindowsShellExecute => "windows_shell_execute",
+ ActionTransport::WindowsSetWindowPos => "windows_set_window_pos",
ActionTransport::LinuxAtSpiAction => "linux_at_spi_action",
ActionTransport::LinuxAtSpiValue => "linux_at_spi_value",
ActionTransport::LinuxPty => "linux_pty",
@@ -992,6 +1026,7 @@ fn transport_name(transport: ActionTransport) -> &'static str {
ActionTransport::LinuxLibei => "linux_libei",
ActionTransport::LinuxWaylandVirtualPointer => "linux_wayland_virtual_pointer",
ActionTransport::LinuxCuaCompositorInject => "linux_cua_compositor_inject",
+ ActionTransport::LinuxX11ConfigureWindow => "linux_x11_configure_window",
ActionTransport::BrowserCdpInputMouse => "browser_cdp_input_mouse",
ActionTransport::BrowserCdpInputKey => "browser_cdp_input_key",
ActionTransport::BrowserCdpRuntimeFunction => "browser_cdp_runtime_function",
@@ -1084,6 +1119,7 @@ pub struct ActionEvidenceProjection {
pub enum ProjectedEvidenceKind {
AccessibilityReadback,
BrowserReadback,
+ ValueReadback,
WindowChange,
}
@@ -1107,7 +1143,31 @@ mod tests {
}
#[test]
- fn every_transport_maps_to_one_of_the_five_stable_routes() {
+ fn value_readback_never_claims_unobserved_success() {
+ assert_eq!(
+ effect_from_value_readback(true, false, true),
+ ActionEffect::Confirmed
+ );
+ assert_eq!(
+ effect_from_value_readback(false, true, true),
+ ActionEffect::Unverifiable
+ );
+ assert_eq!(
+ effect_from_value_readback(false, false, false),
+ ActionEffect::Unverifiable
+ );
+ assert_eq!(
+ effect_from_value_readback(true, false, false),
+ ActionEffect::Unverifiable
+ );
+ assert_eq!(
+ effect_from_value_readback(false, false, true),
+ ActionEffect::SuspectedNoop
+ );
+ }
+
+ #[test]
+ fn every_transport_maps_to_one_of_the_six_stable_routes() {
let mut routes = Vec::new();
for transport in ActionTransport::ALL {
let record = ActionExecutionRecord::builder(
@@ -1125,6 +1185,7 @@ mod tests {
assert!(routes.contains(&ActionRoute::Accessibility));
assert!(routes.contains(&ActionRoute::SyntheticEvents));
assert!(routes.contains(&ActionRoute::GlobalInput));
+ assert!(routes.contains(&ActionRoute::SystemApi));
assert!(routes.contains(&ActionRoute::Dom));
assert!(routes.contains(&ActionRoute::TrustedInput));
}
@@ -1372,6 +1433,34 @@ mod tests {
}
}
+ #[test]
+ fn system_api_value_readback_projects_without_transport_details() {
+ let result = ActionExecutionRecord::builder(
+ ActionEffect::Confirmed,
+ ActionTransport::WindowsSetWindowPos,
+ RequestedDelivery::NotApplicable,
+ )
+ .actual_delivery(ActualDelivery::NotApplicable)
+ .evidence(ActionEvidence {
+ kind: EvidenceKind::ValueReadback,
+ detail: "GetWindowRect matched exact HWND geometry".into(),
+ })
+ .build()
+ .unwrap()
+ .public_result()
+ .unwrap();
+
+ assert_eq!(
+ serde_json::to_value(result).unwrap(),
+ serde_json::json!({
+ "effect": "confirmed",
+ "route": "system_api",
+ "delivery": {"mode": "not_applicable"},
+ "evidence": [{"kind": "value_readback"}]
+ })
+ );
+ }
+
#[test]
fn confirmed_rejects_debug_only_evidence() {
let record = ActionExecutionRecord::builder(
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.rs
index 34afab88bf..fbb5efe41c 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
@@ -254,6 +254,7 @@ const DESKTOP_INPUT_OPERATIONS: &[&str] = &[
"hotkey",
"set_value",
"bring_to_front",
+ "set_window_frame",
];
const DESKTOP_INPUT_SCOPE_KEYS: &[&str] = &[
"daemon_generation",
@@ -846,6 +847,7 @@ pub fn advertised_risk_for(tool: &str) -> RiskAssessment {
| "set_value"
| "launch_app"
| "bring_to_front"
+ | "set_window_frame"
| "start_session"
| "end_session"
| "set_agent_cursor_enabled"
@@ -1739,6 +1741,10 @@ mod tests {
ids("type_text_chars", serde_json::json!({})),
vec!["desktop_input"]
);
+ assert_eq!(
+ ids("set_window_frame", serde_json::json!({})),
+ vec!["desktop_input"]
+ );
assert_eq!(
ids("replay_trajectory", serde_json::json!({})),
vec!["desktop_input", "file_transfer_and_output"]
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/protocol.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/protocol.rs
index 70780ead1c..36efce1be7 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/protocol.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/protocol.rs
@@ -371,6 +371,8 @@ fn agent_instructions() -> String {
Tools operate apps without stealing focus or moving the real pointer. Prefer `element_index` ({tree_kind}) over pixels; it works on backgrounded or hidden windows.
+Prefer any client-provided API, CLI, or filesystem operation that completes a non-GUI outcome directly; do not open a file manager for ordinary file operations. This MCP server has no shell.
+
Workflow per turn:
0. `start_session(session)` once per run; reuse that id on actions. Concurrent runs use distinct ids. End it when done.
1. `launch_app` returns pid and windows. Use `creates_new_application_instance:true` when another run may touch the app.
@@ -378,8 +380,6 @@ Workflow per turn:
3. Act with the fresh index.
4. `verify_state(pid, window_id, expect)` checks bounded structured postconditions. `unknown` is not success. Set `include_screenshot:true` when the multimodal agent should also read visual evidence and decide whether to stop, retry, or advance the ladder.
-A declared session owns a colored agent-cursor overlay; it never moves the real pointer. Pure accessibility actions show only a brief first pulse. Use `move_cursor` or a pixel action first when a recording needs a visible glide.
-
If a `cua-driver` skill is loaded in your harness (Claude Code / Codex / OpenClaw / OpenCode dirs), prefer its detailed workflow — SKILL.md plus {platform_skill_pointer}. Install with `cua-driver skills install` if not yet present."#
)
}
@@ -474,6 +474,8 @@ mod agent_instruction_tests {
assert!(instructions.contains("verify_state"));
assert!(instructions.contains("`unknown` is not success"));
assert!(instructions.contains("multimodal agent"));
+ assert!(instructions.contains("client-provided API, CLI, or filesystem operation"));
+ assert!(instructions.contains("has no shell"));
assert!(
instructions.split_whitespace().count() <= 200,
"initialize instructions should stay within the documented context budget"
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/server.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/server.rs
index 3f11d19c63..d3726af8b9 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/server.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/server.rs
@@ -484,6 +484,7 @@ pub fn is_computer_action(tool_name: &str, operation: ToolOperation) -> bool {
"app.launch"
| "app.kill"
| "window.activate"
+ | "window.frame.set"
| "browser.navigate"
| "browser.input.click"
| "browser.input.type"
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs
index 581d4cf5c9..4dfb21dea9 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
@@ -222,7 +222,7 @@ impl ToolDef {
/// `accessibility.element_tokens` (Surface 6 — tool accepts the
/// opaque `element_token` arg alongside the integer `element_index`)
/// - `app.launch`, `app.list`, `app.kill`, `window.list`,
-/// `window.activate`, `window.debug_info`
+/// `window.activate`, `window.frame.set`, `window.debug_info`
/// - `system.permissions.tcc`,
/// `system.permissions.tcc.accessibility`,
/// `system.permissions.tcc.screen_recording`
@@ -329,6 +329,7 @@ pub fn default_capabilities_for(tool_name: &str) -> Vec<String> {
"kill_app" => &["app.kill"],
"list_windows" => &["window.list"],
"bring_to_front" => &["window.activate"],
+ "set_window_frame" => &["window.frame.set"],
"debug_window_info" => &["window.debug_info"],
// ── permissions / config ─────────────────────────────────────
@@ -2286,6 +2287,7 @@ fn is_physical_desktop_action(tool: &str) -> bool {
| "hotkey"
| "set_value"
| "bring_to_front"
+ | "set_window_frame"
)
}
@@ -4128,6 +4130,7 @@ mod capability_tests {
"kill_app",
"list_windows",
"bring_to_front",
+ "set_window_frame",
"debug_window_info",
// permissions / config
"check_permissions",
@@ -4205,6 +4208,7 @@ mod capability_tests {
"app.kill",
"window.list",
"window.activate",
+ "window.frame.set",
"window.debug_info",
// permissions
"system.permissions.tcc",
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/tool_args.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/tool_args.rs
index 289447aeaf..883e9e9306 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/tool_args.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/tool_args.rs
@@ -90,7 +90,7 @@ pub fn sanitize_reserved_args(args: &mut Value) {
#[cfg(test)]
mod reserved_args_tests {
use super::{parse_typed_input, parse_typed_projection, sanitize_reserved_args};
- use cua_driver_contract::{ClickButton, ClickInput, GetScreenSizeInput};
+ use cua_driver_contract::{ClickButton, ClickInput, GetScreenSizeInput, SetWindowFrameInput};
use serde_json::json;
#[test]
@@ -134,6 +134,30 @@ mod reserved_args_tests {
));
}
+ #[test]
+ fn set_window_frame_typed_input_accepts_namespaced_session_metadata() {
+ let input = parse_typed_input::<SetWindowFrameInput>(
+ "set_window_frame",
+ json!({
+ "pid": 42,
+ "window_id": 84,
+ "x": 10,
+ "y": 20,
+ "width": 800,
+ "height": 600,
+ "session": "window-layout",
+ "_public_session_label": "window-layout",
+ "_session_id": "__cua_runtime_test:window-layout",
+ "_transport_session_id": "transport-1"
+ }),
+ )
+ .expect("trusted session metadata is not part of the public contract");
+
+ assert_eq!(input.pid, 42);
+ assert_eq!(input.window_id, 84);
+ assert_eq!(input.session.as_deref(), Some("window-layout"));
+ }
+
#[test]
fn typed_projection_preserves_rich_platform_fields_without_bypassing_portable_types() {
let input = parse_typed_projection::<ClickInput>(
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.rs
index df158f7b58..731a0a865a 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
@@ -10,8 +10,8 @@ use cua_driver_contract::{
EndSessionOutput, EscalateSessionInput, GetAgentCursorStateInput, GetCursorPositionInput,
GetDesktopStateInput, GetScreenSizeInput, GetSessionStateInput, HotkeyInput, MoveCursorInput,
PressKeyInput, ScrollInput, SessionStateOutput, SetAgentCursorEnabledInput,
- SetAgentCursorMotionInput, SetAgentCursorThemeInput, StartSessionInput, StartSessionOutput,
- ToolInput, TypeTextInput, VerifyStateInput, VerifyStateOutput,
+ SetAgentCursorMotionInput, SetAgentCursorThemeInput, SetWindowFrameInput, StartSessionInput,
+ StartSessionOutput, ToolInput, TypeTextInput, VerifyStateInput, VerifyStateOutput,
};
use cua_driver_core::daemon::{
is_daemon_listening, request_daemon_metadata, send_request, socket_path_for_namespace,
@@ -556,6 +556,7 @@ macro_rules! desktop_tool_methods {
get_cursor_position: GetCursorPositionInput,
verify_state: VerifyStateInput,
move_cursor: MoveCursorInput,
+ set_window_frame: SetWindowFrameInput,
click: ClickInput,
drag: DragInput,
scroll: ScrollInput,
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_.rs
index 14bd9fbdaf..2b59dc9e6d 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
@@ -6923,6 +6923,145 @@ fn kill_app_stale_process_refusal(message: String) -> ToolResult {
}))
}
+// ── set_window_frame (Linux) ─────────────────────────────────────────────────
+
+pub struct SetWindowFrameTool;
+
+static SET_WINDOW_FRAME_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();
+
+#[async_trait]
+impl Tool for SetWindowFrameTool {
+ fn def(&self) -> &ToolDef {
+ SET_WINDOW_FRAME_DEF.get_or_init(|| {
+ let contract = cua_driver_contract::tool_contract("set_window_frame")
+ .expect("set_window_frame contract");
+ ToolDef {
+ name: contract.name,
+ description: contract.description,
+ input_schema: contract.input_schema,
+ read_only: contract.annotations.read_only,
+ destructive: contract.annotations.destructive,
+ idempotent: contract.annotations.idempotent,
+ open_world: contract.annotations.open_world,
+ }
+ })
+ }
+
+ async fn invoke(&self, args: Value) -> ToolResult {
+ use cua_driver_contract::SetWindowFrameInput;
+ use cua_driver_core::action_record::{
+ effect_from_value_readback, ActionEvidence, ActionExecutionRecord, ActionTransport,
+ ActualDelivery, EvidenceKind, RequestedDelivery,
+ };
+
+ let input: SetWindowFrameInput =
+ match cua_driver_core::tool_args::parse_typed_input("set_window_frame", args) {
+ Ok(input) => input,
+ Err(result) => return result,
+ };
+ if crate::wayland::is_wayland() {
+ return ToolResult::error(
+ "set_window_frame: this Wayland compositor exposes no protocol that permits a client to set another top-level window's geometry",
+ );
+ }
+ let values = [input.x, input.y, input.width, input.height];
+ if values.iter().any(|value| !value.is_finite())
+ || input.width <= 0.0
+ || input.height <= 0.0
+ {
+ return ToolResult::error(
+ "set_window_frame: x/y must be finite and width/height must be finite positive numbers",
+ );
+ }
+ let to_i32 = |name: &str, value: f64| -> Result<i32, String> {
+ let rounded = value.round();
+ if rounded < i32::MIN as f64 || rounded > i32::MAX as f64 {
+ Err(format!("{name} is out of range for an X11 coordinate"))
+ } else {
+ Ok(rounded as i32)
+ }
+ };
+ let to_u32 = |name: &str, value: f64| -> Result<u32, String> {
+ let rounded = value.round();
+ if rounded < 1.0 || rounded > u32::MAX as f64 {
+ Err(format!("{name} is out of range for an X11 size"))
+ } else {
+ Ok(rounded as u32)
+ }
+ };
+ let x = match to_i32("x", input.x) {
+ Ok(value) => value,
+ Err(error) => return ToolResult::error(format!("set_window_frame: {error}")),
+ };
+ let y = match to_i32("y", input.y) {
+ Ok(value) => value,
+ Err(error) => return ToolResult::error(format!("set_window_frame: {error}")),
+ };
+ let width = match to_u32("width", input.width) {
+ Ok(value) => value,
+ Err(error) => return ToolResult::error(format!("set_window_frame: {error}")),
+ };
+ let height = match to_u32("height", input.height) {
+ Ok(value) => value,
+ Err(error) => return ToolResult::error(format!("set_window_frame: {error}")),
+ };
+ let window_id = input.window_id;
+ let pid = input.pid;
+ let outcome = tokio::task::spawn_blocking(move || {
+ let before = crate::x11::list_windows(Some(pid))
+ .into_iter()
+ .find(|window| window.xid == window_id)
+ .map(|window| (window.x, window.y, window.width, window.height));
+ let (observed, confirmed, mutation_error) =
+ crate::x11::set_window_frame(window_id, pid, x, y, width, height)
+ .map_err(|error| error.to_string())?;
+ let observed_frame =
+ observed.map(|window| (window.x, window.y, window.width, window.height));
+ let changed = observed_frame.is_some_and(|observed| before != Some(observed));
+ Ok::<_, String>((observed_frame, confirmed, changed, mutation_error))
+ })
+ .await;
+ let (observed, confirmed, changed, mutation_error) = match outcome {
+ Ok(Ok(outcome)) => outcome,
+ Ok(Err(error)) => return ToolResult::error(format!("set_window_frame: {error}")),
+ Err(error) => {
+ return ToolResult::error(format!(
+ "set_window_frame: blocking task failed: {error}"
+ ));
+ }
+ };
+ let effect = effect_from_value_readback(confirmed, changed, observed.is_some());
+ let requested = (x, y, width, height);
+ let mut record = ActionExecutionRecord::builder(
+ effect,
+ ActionTransport::LinuxX11ConfigureWindow,
+ RequestedDelivery::NotApplicable,
+ )
+ .actual_delivery(ActualDelivery::NotApplicable)
+ .detail(format!(
+ "requested={requested:?} observed={observed:?} mutation_error={mutation_error:?}"
+ ));
+ if observed.is_some() {
+ record = record.evidence(ActionEvidence {
+ kind: EvidenceKind::ValueReadback,
+ detail: if confirmed {
+ "X11 geometry readback matched the requested frame".into()
+ } else {
+ "X11 geometry readback did not match the requested frame".into()
+ },
+ });
+ }
+ ToolResult::text(if confirmed {
+ "Set and verified the requested window frame."
+ } else if observed.is_none() {
+ "The native window mutation was attempted, but its resulting frame could not be read back."
+ } else {
+ "The window frame did not settle at the requested geometry."
+ })
+ .with_action_record(record.build().expect("set_window_frame record is valid"))
+ }
+}
+
// ── bring_to_front (Linux) ───────────────────────────────────────────────────
pub struct BringToFrontTool;
@@ -7124,6 +7263,7 @@ pub fn build_registry_with_provider(
r.register(Box::new(KillAppTool));
let pid_window_candidates: WindowTargetCandidates = Arc::new(pid_window_target_candidates);
r.register(pid_window_guarded(BringToFrontTool, &pid_window_candidates));
+ r.register(Box::new(SetWindowFrameTool));
r.register(pid_window_guarded(
ClickTool {
state: state.clone(),
diff --git a/libs/cua-driver/rust/crates/platform-linux/src/x11/mod.rs b/libs/cua-driver/rust/crates/platform-linux/src/x11/mod.rs
index e65dc18f84..9bbe7f25cf 100644
--- a/libs/cua-driver/rust/crates/platform-linux/src/x11/mod.rs
+++ b/libs/cua-driver/rust/crates/platform-linux/src/x11/mod.rs
@@ -142,6 +142,73 @@ fn get_atom(conn: &RustConnection, name: &str) -> Result<Atom> {
Ok(conn.intern_atom(false, name.as_bytes())?.reply()?.atom)
}
+/// Ask the X11 window manager to set one exact top-level window frame, then
+/// read the window geometry back in the same desktop coordinate space exposed
+/// by `list_windows`. Uses EWMH rather than configuring a client directly.
+pub fn set_window_frame(
+ xid: u64,
+ pid: u32,
+ x: i32,
+ y: i32,
+ width: u32,
+ height: u32,
+) -> Result<(Option<WindowInfo>, bool, Option<String>)> {
+ let xid = u32::try_from(xid).map_err(|_| anyhow::anyhow!("window_id is out of X11 range"))?;
+ let (conn, screen_num) = RustConnection::connect(None)?;
+ let root = conn.setup().roots[screen_num].root;
+ let owner = get_window_pid(&conn, xid)?;
+ match owner {
+ Some(owner) if owner == pid => {}
+ Some(owner) => anyhow::bail!("window_id {xid} belongs to pid {owner}, not pid {pid}"),
+ None => anyhow::bail!("window_id {xid} has no verifiable _NET_WM_PID owner"),
+ }
+
+ let atom = get_atom(&conn, "_NET_MOVERESIZE_WINDOW")?;
+ let fields = (1_u32 << 8) | (1 << 9) | (1 << 10) | (1 << 11);
+ let source_indication = 1_u32 << 12; // normal application (EWMH §4.1.5)
+ let event = ClientMessageEvent::new(
+ 32,
+ xid,
+ atom,
+ ClientMessageData::from([
+ fields | source_indication,
+ x as u32,
+ y as u32,
+ width,
+ height,
+ ]),
+ );
+ let mutation_error = conn
+ .send_event(
+ false,
+ root,
+ EventMask::SUBSTRUCTURE_REDIRECT | EventMask::SUBSTRUCTURE_NOTIFY,
+ event,
+ )
+ .and_then(|_| conn.flush())
+ .err()
+ .map(|error| format!("_NET_MOVERESIZE_WINDOW request failed: {error}"));
+
+ let requested = (x, y, width, height);
+ let mut observed = None;
+ for _ in 0..8 {
+ observed = list_windows(Some(pid))
+ .into_iter()
+ .find(|window| window.xid == u64::from(xid));
+ if observed
+ .as_ref()
+ .is_some_and(|window| (window.x, window.y, window.width, window.height) == requested)
+ {
+ break;
+ }
+ std::thread::sleep(std::time::Duration::from_millis(40));
+ }
+ let confirmed = observed
+ .as_ref()
+ .is_some_and(|window| (window.x, window.y, window.width, window.height) == requested);
+ Ok((observed, confirmed, mutation_error))
+}
+
fn get_window_pid(conn: &RustConnection, window: Window) -> Result<Option<u32>> {
let atom = get_atom(conn, "_NET_WM_PID")?;
let reply = conn
diff --git a/libs/cua-driver/rust/crates/platform-macos/src/ax/bindings.rs b/libs/cua-driver/rust/crates/platform-macos/src/ax/bindings.rs
index 4d739bed7a..a54b03aab7 100644
--- a/libs/cua-driver/rust/crates/platform-macos/src/ax/bindings.rs
+++ b/libs/cua-driver/rust/crates/platform-macos/src/ax/bindings.rs
@@ -116,6 +116,7 @@ pub unsafe fn element_at_screen_position(pid: i32, x: f64, y: f64) -> Option<AXU
// ── AXValue functions ────────────────────────────────────────────────────────
#[link(name = "ApplicationServices", kind = "framework")]
extern "C" {
+ pub fn AXValueCreate(the_type: AXValueType, value_ptr: *const c_void) -> AXValueRef;
pub fn AXValueGetType(value: AXValueRef) -> AXValueType;
pub fn AXValueGetValue(
value: AXValueRef,
@@ -124,6 +125,18 @@ extern "C" {
) -> bool;
}
+#[repr(C)]
+struct CGPointValue {
+ x: f64,
+ y: f64,
+}
+
+#[repr(C)]
+struct CGSizeValue {
+ width: f64,
+ height: f64,
+}
+
// ── Helper functions ──────────────────────────────────────────────────────────
use core_foundation::{array::CFArray, base::TCFType, string::CFString as CFStr};
@@ -546,6 +559,53 @@ pub unsafe fn set_number_attr(element: AXUIElementRef, attr_name: &str, value: f
AXUIElementSetAttributeValue(element, attr.as_concrete_TypeRef(), cf_value.as_CFTypeRef())
}
+/// Set an AX CGPoint attribute such as `AXPosition`.
+///
+/// # Safety
+///
+/// `element` must be a valid, live `AXUIElementRef` for the duration of the call.
+pub unsafe fn set_point_attr(element: AXUIElementRef, attr_name: &str, x: f64, y: f64) -> AXError {
+ let attr = CFStr::new(attr_name);
+ let point = CGPointValue { x, y };
+ let value = AXValueCreate(
+ kAXValueCGPointType,
+ &point as *const CGPointValue as *const c_void,
+ );
+ if value.is_null() {
+ return kAXErrorFailure;
+ }
+ let result =
+ AXUIElementSetAttributeValue(element, attr.as_concrete_TypeRef(), value as CFTypeRef);
+ CFRelease(value as CFTypeRef);
+ result
+}
+
+/// Set an AX CGSize attribute such as `AXSize`.
+///
+/// # Safety
+///
+/// `element` must be a valid, live `AXUIElementRef` for the duration of the call.
+pub unsafe fn set_size_attr(
+ element: AXUIElementRef,
+ attr_name: &str,
+ width: f64,
+ height: f64,
+) -> AXError {
+ let attr = CFStr::new(attr_name);
+ let size = CGSizeValue { width, height };
+ let value = AXValueCreate(
+ kAXValueCGSizeType,
+ &size as *const CGSizeValue as *const c_void,
+ );
+ if value.is_null() {
+ return kAXErrorFailure;
+ }
+ let result =
+ AXUIElementSetAttributeValue(element, attr.as_concrete_TypeRef(), value as CFTypeRef);
+ CFRelease(value as CFTypeRef);
+ result
+}
+
/// Set an AX attribute to a CFBoolean true value.
///
/// # Safety
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.rs
index f0fdfbd21c..2ddcb81b0c 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
@@ -15,6 +15,7 @@ mod press_key;
mod right_click;
mod scroll;
mod set_value;
+mod set_window_frame;
mod type_text;
// `screenshot` / `screenshot_compat` modules removed in PR #1692 —
// `get_window_state` capture_mode:"vision" is the canonical screenshot
@@ -728,6 +729,7 @@ pub fn register_all(
bring_to_front::BringToFrontTool,
&pid_window_candidates,
));
+ registry.register(Box::new(set_window_frame::SetWindowFrameTool));
registry.register(pid_window_guarded(
click::ClickTool::new(state.clone()),
&pid_window_candidates,
diff --git a/libs/cua-driver/rust/crates/platform-macos/src/tools/set_window_frame.rs b/libs/cua-driver/rust/crates/platform-macos/src/tools/set_window_frame.rs
new file mode 100644
index 0000000000..c9b00f2f30
--- /dev/null
+++ b/libs/cua-driver/rust/crates/platform-macos/src/tools/set_window_frame.rs
@@ -0,0 +1,454 @@
+use async_trait::async_trait;
+use core_foundation::base::{CFRelease, CFTypeRef};
+use cua_driver_contract::SetWindowFrameInput;
+use cua_driver_core::{
+ action_record::{
+ effect_from_value_readback, ActionEvidence, ActionExecutionRecord, ActionTransport,
+ ActualDelivery, EvidenceKind, RequestedDelivery,
+ },
+ protocol::ToolResult,
+ tool::{Tool, ToolDef},
+};
+use serde_json::Value;
+
+pub struct SetWindowFrameTool;
+
+static DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();
+
+fn def() -> &'static ToolDef {
+ DEF.get_or_init(|| {
+ let contract = cua_driver_contract::tool_contract("set_window_frame")
+ .expect("set_window_frame contract");
+ ToolDef {
+ name: contract.name,
+ description: contract.description,
+ input_schema: contract.input_schema,
+ read_only: contract.annotations.read_only,
+ destructive: contract.annotations.destructive,
+ idempotent: contract.annotations.idempotent,
+ open_world: contract.annotations.open_world,
+ }
+ })
+}
+
+#[derive(Clone, Copy, Debug)]
+struct Frame {
+ x: f64,
+ y: f64,
+ width: f64,
+ height: f64,
+}
+
+impl Frame {
+ fn from_input(input: &SetWindowFrameInput) -> Self {
+ Self {
+ x: input.x,
+ y: input.y,
+ width: input.width,
+ height: input.height,
+ }
+ }
+
+ fn from_ax(rect: [f64; 4]) -> Self {
+ Self {
+ x: rect[0],
+ y: rect[1],
+ width: rect[2],
+ height: rect[3],
+ }
+ }
+
+ fn is_valid(self) -> bool {
+ self.x.is_finite()
+ && self.y.is_finite()
+ && self.width.is_finite()
+ && self.height.is_finite()
+ && self.width > 0.0
+ && self.height > 0.0
+ }
+
+ fn approximately_eq(self, other: Self, tolerance: f64) -> bool {
+ self.position_approximately_eq(other, tolerance)
+ && self.size_approximately_eq(other, tolerance)
+ }
+
+ fn position_approximately_eq(self, other: Self, tolerance: f64) -> bool {
+ (self.x - other.x).abs() <= tolerance && (self.y - other.y).abs() <= tolerance
+ }
+
+ fn size_approximately_eq(self, other: Self, tolerance: f64) -> bool {
+ (self.width - other.width).abs() <= tolerance
+ && (self.height - other.height).abs() <= tolerance
+ }
+}
+
+#[derive(Debug)]
+struct FrameOutcome {
+ requested: Frame,
+ observed: Option<Frame>,
+ confirmed: bool,
+ changed: bool,
+ mutation_errors: Vec<String>,
+}
+
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+enum FrameMutation {
+ Position,
+ Size,
+}
+
+// Position must precede size. On macOS Tahoe, writing AXPosition immediately
+// after AXSize can silently restore the window's previous size even though both
+// accessibility writes return success.
+const FRAME_MUTATION_ORDER: [FrameMutation; 2] = [FrameMutation::Position, FrameMutation::Size];
+
+const POSITION_ONLY: [FrameMutation; 1] = [FrameMutation::Position];
+const SIZE_ONLY: [FrameMutation; 1] = [FrameMutation::Size];
+
+fn corrective_mutations(requested: Frame, observed: Frame) -> &'static [FrameMutation] {
+ const TOLERANCE: f64 = 2.0;
+ match (
+ requested.position_approximately_eq(observed, TOLERANCE),
+ requested.size_approximately_eq(observed, TOLERANCE),
+ ) {
+ (true, true) => &[],
+ (false, true) => &POSITION_ONLY,
+ (true, false) => &SIZE_ONLY,
+ (false, false) => &FRAME_MUTATION_ORDER,
+ }
+}
+
+fn window_server_frame(window_id: u32) -> Option<Frame> {
+ crate::windows::window_bounds_by_id(window_id).map(|bounds| Frame {
+ x: bounds.x,
+ y: bounds.y,
+ width: bounds.width,
+ height: bounds.height,
+ })
+}
+
+fn mutate_and_verify(input: &SetWindowFrameInput) -> Result<FrameOutcome, String> {
+ use crate::{
+ ax::bindings::{
+ ax_get_window_id, copy_ax_windows, element_screen_rect, is_attribute_settable,
+ kAXErrorSuccess, set_point_attr, set_size_attr, AXUIElementCreateApplication,
+ AXUIElementSetMessagingTimeout,
+ },
+ windows::WindowOwner,
+ };
+
+ let pid = i32::try_from(input.pid)
+ .map_err(|_| format!("pid {} is out of range on macOS", input.pid))?;
+ let window_id = u32::try_from(input.window_id)
+ .map_err(|_| format!("window_id {} is out of range on macOS", input.window_id))?;
+ let requested = Frame::from_input(input);
+ if !requested.is_valid() {
+ return Err("x/y must be finite and width/height must be finite positive numbers".into());
+ }
+
+ match crate::windows::resolve_window_owner(pid, window_id) {
+ WindowOwner::SamePid => {}
+ WindowOwner::ForeignPid {
+ owner_pid,
+ owner_app_name,
+ } => {
+ return Err(format!(
+ "window_id {window_id} belongs to pid {owner_pid} ({owner_app_name}), not pid {pid}"
+ ));
+ }
+ WindowOwner::Unknown => {
+ return Err(format!(
+ "window_id {window_id} is closed, stale, or unknown to WindowServer"
+ ));
+ }
+ }
+
+ unsafe {
+ let app = AXUIElementCreateApplication(pid);
+ if app.is_null() {
+ return Err(format!(
+ "could not create an accessibility element for pid {pid}"
+ ));
+ }
+ AXUIElementSetMessagingTimeout(app, 2.0);
+ let windows = copy_ax_windows(app);
+ let target = windows
+ .iter()
+ .copied()
+ .find(|window| ax_get_window_id(*window) == Some(window_id));
+
+ let result = if let Some(target) = target {
+ AXUIElementSetMessagingTimeout(target, 2.0);
+ if !is_attribute_settable(target, "AXPosition") {
+ Err(format!(
+ "window_id {window_id} does not expose a settable AXPosition"
+ ))
+ } else if !is_attribute_settable(target, "AXSize") {
+ Err(format!(
+ "window_id {window_id} does not expose a settable AXSize"
+ ))
+ } else {
+ let before = window_server_frame(window_id).ok_or_else(|| {
+ format!(
+ "could not read the current WindowServer frame of window_id {window_id}"
+ )
+ });
+ before.and_then(|before| {
+ let mut mutation_errors = Vec::new();
+ let apply_mutations = |mutations: &[FrameMutation]| {
+ let mut errors = Vec::new();
+ for mutation in mutations {
+ let (attribute, error) = match mutation {
+ FrameMutation::Position => (
+ "AXPosition",
+ set_point_attr(target, "AXPosition", requested.x, requested.y),
+ ),
+ FrameMutation::Size => (
+ "AXSize",
+ set_size_attr(
+ target,
+ "AXSize",
+ requested.width,
+ requested.height,
+ ),
+ ),
+ };
+ if error != kAXErrorSuccess {
+ errors
+ .push(format!("{attribute} was rejected with AXError {error}"));
+ }
+ }
+ errors
+ };
+ mutation_errors.extend(apply_mutations(&FRAME_MUTATION_ORDER));
+
+ let mut observed = None;
+ for attempt in 0..20 {
+ std::thread::sleep(std::time::Duration::from_millis(50));
+
+ // Tahoe can settle either mutation while rolling the other one
+ // back. Correct only the component that still differs so the two
+ // writes converge instead of continually undoing each other.
+ if attempt < 6 {
+ if let Some(rect) = element_screen_rect(target) {
+ let corrections =
+ corrective_mutations(requested, Frame::from_ax(rect));
+ mutation_errors.extend(apply_mutations(corrections));
+ }
+ }
+
+ // Confirmation comes from WindowServer, not the AX values written
+ // above. This is also the coordinate source exposed by list_windows.
+ if let Some(frame) = window_server_frame(window_id) {
+ observed = Some(frame);
+ if frame.approximately_eq(requested, 2.0) {
+ break;
+ }
+ }
+ }
+ let confirmed =
+ observed.is_some_and(|frame| frame.approximately_eq(requested, 2.0));
+ let changed =
+ observed.is_some_and(|frame| !frame.approximately_eq(before, 2.0));
+ Ok(FrameOutcome {
+ requested,
+ observed,
+ confirmed,
+ changed,
+ mutation_errors,
+ })
+ })
+ }
+ } else {
+ Err(format!(
+ "window_id {window_id} belongs to pid {pid} in WindowServer but has no matching AXWindow"
+ ))
+ };
+
+ for window in windows {
+ CFRelease(window as CFTypeRef);
+ }
+ CFRelease(app as CFTypeRef);
+ result
+ }
+}
+
+fn action_record(outcome: &FrameOutcome) -> ActionExecutionRecord {
+ let effect = effect_from_value_readback(
+ outcome.confirmed,
+ outcome.changed,
+ outcome.observed.is_some(),
+ );
+ let mut builder = ActionExecutionRecord::builder(
+ effect,
+ ActionTransport::MacosAxWindowFrame,
+ RequestedDelivery::NotApplicable,
+ )
+ .actual_delivery(ActualDelivery::NotApplicable)
+ .detail(format!(
+ "requested={:?} observed={:?} mutation_errors={:?}",
+ outcome.requested, outcome.observed, outcome.mutation_errors,
+ ));
+ if outcome.observed.is_some() {
+ builder = builder.evidence(ActionEvidence {
+ kind: EvidenceKind::ValueReadback,
+ detail: if outcome.confirmed {
+ "WindowServer matched the requested frame within 2 points".into()
+ } else {
+ "WindowServer returned a frame that did not match the request".into()
+ },
+ });
+ }
+ builder.build().expect("set_window_frame record is valid")
+}
+
+#[async_trait]
+impl Tool for SetWindowFrameTool {
+ fn def(&self) -> &ToolDef {
+ def()
+ }
+
+ async fn invoke(&self, args: Value) -> ToolResult {
+ let input: SetWindowFrameInput =
+ match cua_driver_core::tool_args::parse_typed_input("set_window_frame", args) {
+ Ok(input) => input,
+ Err(result) => return result,
+ };
+ let outcome = match tokio::task::spawn_blocking(move || mutate_and_verify(&input)).await {
+ Ok(Ok(outcome)) => outcome,
+ Ok(Err(error)) => return ToolResult::error(format!("set_window_frame: {error}")),
+ Err(error) => {
+ return ToolResult::error(format!(
+ "set_window_frame: blocking task failed: {error}"
+ ));
+ }
+ };
+ ToolResult::text(if outcome.confirmed {
+ "Set and verified the requested window frame."
+ } else if outcome.observed.is_none() {
+ "The native window mutation was attempted, but its resulting frame could not be read back."
+ } else {
+ "The window frame did not settle at the requested geometry."
+ })
+ .with_action_record(action_record(&outcome))
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn frame_validation_rejects_non_positive_or_non_finite_size() {
+ assert!(Frame {
+ x: 0.0,
+ y: 0.0,
+ width: 800.0,
+ height: 600.0,
+ }
+ .is_valid());
+ assert!(!Frame {
+ x: 0.0,
+ y: 0.0,
+ width: 0.0,
+ height: 600.0,
+ }
+ .is_valid());
+ assert!(!Frame {
+ x: f64::NAN,
+ y: 0.0,
+ width: 800.0,
+ height: 600.0,
+ }
+ .is_valid());
+ }
+
+ #[test]
+ fn frame_readback_uses_small_platform_tolerance() {
+ let requested = Frame {
+ x: 10.0,
+ y: 20.0,
+ width: 800.0,
+ height: 600.0,
+ };
+ assert!(requested.approximately_eq(
+ Frame {
+ x: 11.5,
+ y: 19.0,
+ width: 799.0,
+ height: 601.0,
+ },
+ 2.0
+ ));
+ assert!(!requested.approximately_eq(
+ Frame {
+ x: 13.0,
+ ..requested
+ },
+ 2.0
+ ));
+ }
+
+ #[test]
+ fn macos_applies_position_before_size_to_avoid_size_rollback() {
+ assert_eq!(
+ FRAME_MUTATION_ORDER,
+ [FrameMutation::Position, FrameMutation::Size]
+ );
+ }
+
+ #[test]
+ fn corrective_pass_updates_only_the_component_that_did_not_settle() {
+ let requested = Frame {
+ x: 10.0,
+ y: 20.0,
+ width: 800.0,
+ height: 600.0,
+ };
+ assert_eq!(
+ corrective_mutations(
+ requested,
+ Frame {
+ x: 30.0,
+ y: 40.0,
+ ..requested
+ }
+ ),
+ &POSITION_ONLY
+ );
+ assert_eq!(
+ corrective_mutations(
+ requested,
+ Frame {
+ width: 900.0,
+ height: 700.0,
+ ..requested
+ }
+ ),
+ &SIZE_ONLY
+ );
+ }
+
+ #[test]
+ fn missing_frame_readback_is_unverifiable_without_fabricated_evidence() {
+ let frame = Frame {
+ x: 10.0,
+ y: 20.0,
+ width: 800.0,
+ height: 600.0,
+ };
+ let record = action_record(&FrameOutcome {
+ requested: frame,
+ observed: None,
+ confirmed: false,
+ changed: false,
+ mutation_errors: vec!["AXPosition timed out".into()],
+ });
+ let projection = record.stable_projection().expect("valid projection");
+ assert_eq!(
+ projection.effect,
+ cua_driver_core::action_record::ActionEffect::Unverifiable
+ );
+ assert_eq!(projection.evidence, None);
+ }
+}
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_.rs
index cc8af0494e..a416756c55 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
@@ -8002,6 +8002,186 @@ impl Tool for TypeTextCharsTool {
// keyed on pid. Marked `destructive: true` so MCP clients with permission
// gating prompt before invoking.
+// ── set_window_frame ──────────────────────────────────────────────────────
+
+pub struct SetWindowFrameTool;
+
+static SET_WINDOW_FRAME_DEF: std::sync::OnceLock<ToolDef> = std::sync::OnceLock::new();
+
+#[async_trait]
+impl Tool for SetWindowFrameTool {
+ fn def(&self) -> &ToolDef {
+ SET_WINDOW_FRAME_DEF.get_or_init(|| {
+ let contract = cua_driver_contract::tool_contract("set_window_frame")
+ .expect("set_window_frame contract");
+ ToolDef {
+ name: contract.name,
+ description: contract.description,
+ input_schema: contract.input_schema,
+ read_only: contract.annotations.read_only,
+ destructive: contract.annotations.destructive,
+ idempotent: contract.annotations.idempotent,
+ open_world: contract.annotations.open_world,
+ }
+ })
+ }
+
+ async fn invoke(&self, args: Value) -> ToolResult {
+ use cua_driver_contract::SetWindowFrameInput;
+ use cua_driver_core::action_record::{
+ effect_from_value_readback, ActionEvidence, ActionExecutionRecord, ActionTransport,
+ ActualDelivery, EvidenceKind, RequestedDelivery,
+ };
+
+ let input: SetWindowFrameInput =
+ match cua_driver_core::tool_args::parse_typed_input("set_window_frame", args) {
+ Ok(input) => input,
+ Err(result) => return result,
+ };
+ let outcome = tokio::task::spawn_blocking(move || {
+ use windows::Win32::{
+ Foundation::{HWND, RECT},
+ UI::WindowsAndMessaging::{
+ GetWindowRect, GetWindowThreadProcessId, IsIconic, IsWindow, IsZoomed,
+ SetWindowPos, SWP_NOACTIVATE, SWP_NOZORDER,
+ },
+ };
+
+ let values = [input.x, input.y, input.width, input.height];
+ if values.iter().any(|value| !value.is_finite())
+ || input.width <= 0.0
+ || input.height <= 0.0
+ {
+ return Err(
+ "x/y must be finite and width/height must be finite positive numbers"
+ .to_owned(),
+ );
+ }
+ let to_i32 = |name: &str, value: f64| -> Result<i32, String> {
+ let rounded = value.round();
+ if rounded < i32::MIN as f64 || rounded > i32::MAX as f64 {
+ Err(format!("{name} is out of range for a Windows window coordinate"))
+ } else {
+ Ok(rounded as i32)
+ }
+ };
+ let x = to_i32("x", input.x)?;
+ let y = to_i32("y", input.y)?;
+ let width = to_i32("width", input.width)?;
+ let height = to_i32("height", input.height)?;
+ if width <= 0 || height <= 0 {
+ return Err("width/height must round to positive Windows window sizes".to_owned());
+ }
+ let hwnd = HWND(input.window_id as usize as *mut std::ffi::c_void);
+ if !unsafe { IsWindow(hwnd).as_bool() } {
+ return Err(format!("window_id {} is closed, stale, or invalid", input.window_id));
+ }
+ let mut owner_pid = 0_u32;
+ unsafe { GetWindowThreadProcessId(hwnd, Some(&mut owner_pid)) };
+ if owner_pid != input.pid {
+ return Err(format!(
+ "window_id {} belongs to pid {owner_pid}, not pid {}",
+ input.window_id, input.pid
+ ));
+ }
+ if unsafe { IsIconic(hwnd).as_bool() } {
+ return Err(format!(
+ "window_id {} is minimized; restore it with bring_to_front before setting its frame",
+ input.window_id
+ ));
+ }
+ if unsafe { IsZoomed(hwnd).as_bool() } {
+ return Err(format!(
+ "window_id {} is maximized; restore it before setting its frame",
+ input.window_id
+ ));
+ }
+ let mut before = RECT::default();
+ unsafe { GetWindowRect(hwnd, &mut before) }
+ .map_err(|error| format!("could not read the current window frame: {error}"))?;
+ let mutation_error = unsafe {
+ SetWindowPos(
+ hwnd,
+ HWND::default(),
+ x,
+ y,
+ width,
+ height,
+ SWP_NOACTIVATE | SWP_NOZORDER,
+ )
+ }
+ .err()
+ .map(|error| format!("SetWindowPos failed: {error}"));
+
+ let requested = (x, y, width, height);
+ let mut observed = None;
+ for _ in 0..6 {
+ let mut rect = RECT::default();
+ if unsafe { GetWindowRect(hwnd, &mut rect) }.is_ok() {
+ observed = Some((
+ rect.left,
+ rect.top,
+ rect.right - rect.left,
+ rect.bottom - rect.top,
+ ));
+ if observed == Some(requested) {
+ break;
+ }
+ }
+ std::thread::sleep(std::time::Duration::from_millis(40));
+ }
+ let before = (
+ before.left,
+ before.top,
+ before.right - before.left,
+ before.bottom - before.top,
+ );
+ let changed = observed.is_some_and(|observed| before != observed);
+ Ok((requested, observed, changed, mutation_error))
+ })
+ .await;
+
+ let (requested, observed, changed, mutation_error) = match outcome {
+ Ok(Ok(outcome)) => outcome,
+ Ok(Err(error)) => return ToolResult::error(format!("set_window_frame: {error}")),
+ Err(error) => {
+ return ToolResult::error(format!(
+ "set_window_frame: blocking task failed: {error}"
+ ));
+ }
+ };
+ let confirmed = observed == Some(requested);
+ let effect = effect_from_value_readback(confirmed, changed, observed.is_some());
+ let mut record = ActionExecutionRecord::builder(
+ effect,
+ ActionTransport::WindowsSetWindowPos,
+ RequestedDelivery::NotApplicable,
+ )
+ .actual_delivery(ActualDelivery::NotApplicable)
+ .detail(format!(
+ "requested={requested:?} observed={observed:?} mutation_error={mutation_error:?}"
+ ));
+ if observed.is_some() {
+ record = record.evidence(ActionEvidence {
+ kind: EvidenceKind::ValueReadback,
+ detail: if confirmed {
+ "GetWindowRect matched the requested frame".into()
+ } else {
+ "GetWindowRect returned a frame that did not match the request".into()
+ },
+ });
+ }
+ ToolResult::text(if confirmed {
+ "Set and verified the requested window frame."
+ } else if observed.is_none() {
+ "The native window mutation was attempted, but its resulting frame could not be read back."
+ } else {
+ "The window frame did not settle at the requested geometry."
+ })
+ .with_action_record(record.build().expect("set_window_frame record is valid"))
+ }
+}
+
// ── bring_to_front ────────────────────────────────────────────────────────
pub struct BringToFrontTool;
@@ -8705,6 +8885,7 @@ pub fn build_registry_with_provider(
r.register(Box::new(KillAppTool));
let pid_window_candidates: WindowTargetCandidates = Arc::new(pid_window_target_candidates);
r.register(pid_window_guarded(BringToFrontTool, &pid_window_candidates));
+ r.register(Box::new(SetWindowFrameTool));
r.register(Box::new(DebugWindowInfoTool));
r.register(pid_window_guarded(
ClickTool {
diff --git a/libs/cua-driver/typescript/src/native/cua_driver_contract.ts b/libs/cua-driver/typescript/src/native/cua_driver_contract.ts
index d8a932475f..222f26bddd 100644
--- a/libs/cua-driver/typescript/src/native/cua_driver_contract.ts
+++ b/libs/cua-driver/typescript/src/native/cua_driver_contract.ts
@@ -323,6 +323,7 @@ export enum ActionRoute {
Accessibility,
SyntheticEvents,
GlobalInput,
+ SystemApi,
Dom,
TrustedInput
}
@@ -336,8 +337,9 @@ const FfiConverterTypeActionRoute = (() => {
case 1: return ActionRoute.Accessibility;
case 2: return ActionRoute.SyntheticEvents;
case 3: return ActionRoute.GlobalInput;
- case 4: return ActionRoute.Dom;
- case 5: return ActionRoute.TrustedInput;
+ case 4: return ActionRoute.SystemApi;
+ case 5: return ActionRoute.Dom;
+ case 6: return ActionRoute.TrustedInput;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
@@ -346,8 +348,9 @@ const FfiConverterTypeActionRoute = (() => {
case ActionRoute.Accessibility: return ordinalConverter.write(1, into);
case ActionRoute.SyntheticEvents: return ordinalConverter.write(2, into);
case ActionRoute.GlobalInput: return ordinalConverter.write(3, into);
- case ActionRoute.Dom: return ordinalConverter.write(4, into);
- case ActionRoute.TrustedInput: return ordinalConverter.write(5, into);
+ case ActionRoute.SystemApi: return ordinalConverter.write(4, into);
+ case ActionRoute.Dom: return ordinalConverter.write(5, into);
+ case ActionRoute.TrustedInput: return ordinalConverter.write(6, into);
}
}
allocationSize(value: TypeName): number {
@@ -2657,6 +2660,72 @@ const FfiConverterTypeSetAgentCursorThemeOutput = (() => {
return new FFIConverter();
})();
+export type SetWindowFrameInput = {
+ pid: number,
+ windowId: bigint,
+ x: number,
+ y: number,
+ width: number,
+ height: number,
+ /**
+ * Optional session id.
+ */
+ session?: string
+}
+
+/**
+ * Generated factory for {@link SetWindowFrameInput} record objects.
+ */
+export const SetWindowFrameInput = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<SetWindowFrameInput, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<SetWindowFrameInput>,
+ });
+})();
+
+const FfiConverterTypeSetWindowFrameInput = (() => {
+ type TypeName = SetWindowFrameInput;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ pid: FfiConverterUInt32.read(from),
+ windowId: FfiConverterUInt64.read(from),
+ x: FfiConverterFloat64.read(from),
+ y: FfiConverterFloat64.read(from),
+ width: FfiConverterFloat64.read(from),
+ height: FfiConverterFloat64.read(from),
+ session: FfiConverterOptionalString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterUInt32.write(value.pid, into);
+ FfiConverterUInt64.write(value.windowId, into);
+ FfiConverterFloat64.write(value.x, into);
+ FfiConverterFloat64.write(value.y, into);
+ FfiConverterFloat64.write(value.width, into);
+ FfiConverterFloat64.write(value.height, into);
+ FfiConverterOptionalString.write(value.session, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterUInt32.allocationSize(value.pid) +
+ FfiConverterUInt64.allocationSize(value.windowId) +
+ FfiConverterFloat64.allocationSize(value.x) +
+ FfiConverterFloat64.allocationSize(value.y) +
+ FfiConverterFloat64.allocationSize(value.width) +
+ FfiConverterFloat64.allocationSize(value.height) +
+ FfiConverterOptionalString.allocationSize(value.session);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
export type StartSessionInput = {
/**
* Stable session id for this run (e.g. "research-run-1").
@@ -3221,6 +3290,7 @@ export default Object.freeze({
FfiConverterTypeSetAgentCursorMotionOutput,
FfiConverterTypeSetAgentCursorThemeInput,
FfiConverterTypeSetAgentCursorThemeOutput,
+ FfiConverterTypeSetWindowFrameInput,
FfiConverterTypeStartSessionInput,
FfiConverterTypeStartSessionOutput,
FfiConverterTypeStatePredicate,
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.ts
index a0e386dfcc..2f85eefb17 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
@@ -533,6 +533,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cua_driver_sdk_fn_method_cuadriver_set_window_frame": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_driver_sdk_fn_method_cuadriver_shutdown": {
args: [FfiType.Handle],
ret: FfiType.Handle,
@@ -658,6 +663,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cua_driver_sdk_fn_method_cuadriversession_set_window_frame": {
+ 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,
@@ -938,6 +948,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_driver_sdk_checksum_method_cuadriver_set_window_frame": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_driver_sdk_checksum_method_cuadriver_shutdown": {
args: [],
ret: FfiType.UInt16,
@@ -1063,6 +1078,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_window_frame": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_driver_sdk_checksum_method_cuadriversession_start_session": {
args: [],
ret: FfiType.UInt16,
@@ -1303,6 +1323,7 @@ interface NativeModuleInterface {
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_set_window_frame(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;
@@ -1328,6 +1349,7 @@ interface NativeModuleInterface {
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_set_window_frame(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_method_cuadriversession_verify_state(uniffiSelf: bigint, input: Uint8Array): bigint;
@@ -1384,6 +1406,7 @@ interface NativeModuleInterface {
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_set_window_frame(): 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;
@@ -1409,6 +1432,7 @@ interface NativeModuleInterface {
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_set_window_frame(): 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_method_cuadriversession_verify_state(): number;
diff --git a/libs/cua-driver/typescript/src/native/cua_driver_sdk.ts b/libs/cua-driver/typescript/src/native/cua_driver_sdk.ts
index d88b02dc32..95142bec00 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 UniffiVTableCallbackInterfaceCuaDriverSdkDriverActivityObserver, type UniffiForeignFutureResultRustBuffer, type UniffiForeignFutureCompleterustBuffer, type UniffiVTableCallbackInterfaceCuaDriverSdkDriverAuthorizationHost,
} from "./cua_driver_sdk-ffi.js";
-import { type ActionResult, type ClickInput, type ClipboardReadInput, type ClipboardWriteInput, 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, type VerifyStateInput, type VerifyStateOutput,
+import { type ActionResult, type ClickInput, type ClipboardReadInput, type ClipboardWriteInput, 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 SetWindowFrameInput, type StartSessionInput, type StartSessionOutput, type TypeTextInput, type VerifyStateInput, type VerifyStateOutput,
} 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, uniffiTraitInterfaceCall, uniffiTraitInterfaceCallAsyncWithError, uniffiTypeNameSymbol, variantOrdinalSymbol,
} from "@ubjs/core";
import uniffiCuaDriverContractModule from "./cua_driver_contract.js";
-const { FfiConverterTypeActionResult, FfiConverterTypeClickInput, FfiConverterTypeClipboardReadInput, FfiConverterTypeClipboardWriteInput, FfiConverterTypeDragInput, FfiConverterTypeEndSessionInput, FfiConverterTypeEndSessionOutput, FfiConverterTypeEscalateSessionInput, FfiConverterTypeGetAgentCursorStateInput, FfiConverterTypeGetCursorPositionInput, FfiConverterTypeGetDesktopStateInput, FfiConverterTypeGetScreenSizeInput, FfiConverterTypeGetSessionStateInput, FfiConverterTypeHotkeyInput, FfiConverterTypeMoveCursorInput, FfiConverterTypePressKeyInput, FfiConverterTypeScrollInput, FfiConverterTypeSessionStateOutput, FfiConverterTypeSetAgentCursorEnabledInput, FfiConverterTypeSetAgentCursorMotionInput, FfiConverterTypeSetAgentCursorThemeInput, FfiConverterTypeStartSessionInput, FfiConverterTypeStartSessionOutput, FfiConverterTypeTypeTextInput, FfiConverterTypeVerifyStateInput, FfiConverterTypeVerifyStateOutput } = uniffiCuaDriverContractModule.converters;
+const { FfiConverterTypeActionResult, FfiConverterTypeClickInput, FfiConverterTypeClipboardReadInput, FfiConverterTypeClipboardWriteInput, FfiConverterTypeDragInput, FfiConverterTypeEndSessionInput, FfiConverterTypeEndSessionOutput, FfiConverterTypeEscalateSessionInput, FfiConverterTypeGetAgentCursorStateInput, FfiConverterTypeGetCursorPositionInput, FfiConverterTypeGetDesktopStateInput, FfiConverterTypeGetScreenSizeInput, FfiConverterTypeGetSessionStateInput, FfiConverterTypeHotkeyInput, FfiConverterTypeMoveCursorInput, FfiConverterTypePressKeyInput, FfiConverterTypeScrollInput, FfiConverterTypeSessionStateOutput, FfiConverterTypeSetAgentCursorEnabledInput, FfiConverterTypeSetAgentCursorMotionInput, FfiConverterTypeSetAgentCursorThemeInput, FfiConverterTypeSetWindowFrameInput, FfiConverterTypeStartSessionInput, FfiConverterTypeStartSessionOutput, FfiConverterTypeTypeTextInput, FfiConverterTypeVerifyStateInput, FfiConverterTypeVerifyStateOutput } = uniffiCuaDriverContractModule.converters;
const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
const uniffiIsDebug =
@@ -2562,6 +2562,7 @@ export interface CuaDriverLike {
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>;
+ setWindowFrame(input: SetWindowFrameInput, 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.
@@ -3565,6 +3566,38 @@ private constructor(pointer: UniffiHandle) {
}
}
+ async setWindowFrame(input: SetWindowFrameInput, 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_window_frame(
+ uniffiTypeCuaDriverObjectFactory.clonePointer(this),FfiConverterTypeSetWindowFrameInput.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.
@@ -3821,6 +3854,7 @@ export interface CuaDriverSessionLike {
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>;
+ setWindowFrame(input: SetWindowFrameInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;
startSession(input: StartSessionInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<StartSessionOutput>;
typeText(input: TypeTextInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;
verifyState(input: VerifyStateInput, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ToolResult>;
@@ -4469,6 +4503,38 @@ private constructor(pointer: UniffiHandle) {
}
}
+ async setWindowFrame(input: SetWindowFrameInput, 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_window_frame(
+ uniffiTypeCuaDriverSessionObjectFactory.clonePointer(this),FfiConverterTypeSetWindowFrameInput.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 {
@@ -5497,6 +5563,9 @@ function uniffiEnsureInitialized() {
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_set_window_frame() !== 6509) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_set_window_frame");
+ }
if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_shutdown() !== 36331) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_shutdown");
}
@@ -5572,6 +5641,9 @@ function uniffiEnsureInitialized() {
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_set_window_frame() !== 65413) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriversession_set_window_frame");
+ }
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");
}
diff --git a/scripts/docs-generators/cua-driver.ts b/scripts/docs-generators/cua-driver.ts
index 06338ed4a8..a7b5649825 100644
--- a/scripts/docs-generators/cua-driver.ts
+++ b/scripts/docs-generators/cua-driver.ts
@@ -626,6 +626,7 @@ export function generateMCPToolsMDX(docs: MCPDocumentation, releasedVersion: str
'launch_app',
'kill_app',
'bring_to_front',
+ 'set_window_frame',
'click',
'double_click',
'right_click',
@@ -810,6 +811,7 @@ function syntheticExampleValue(name: string, prop: MCPPropertyDoc): unknown {
return 100;
if (name === 'y' || name === 'y1' || name === 'y2' || name === 'from_y' || name === 'to_y')
return 200;
+ if (prop.minimum !== undefined && prop.minimum > 0.5) return prop.minimum;
return 0.5;
case 'boolean':
return false;