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): plan cursor motions from the SDKs through UniFFI (#4767)

Francesco Bonacci365f5e3c5b92
diff --git a/.github/workflows/ci-cua-driver-contract-clients.yml b/.github/workflows/ci-cua-driver-contract-clients.yml
index a502d8ca0b..61d3bcd1a8 100644
--- a/.github/workflows/ci-cua-driver-contract-clients.yml
+++ b/.github/workflows/ci-cua-driver-contract-clients.yml
@@ -18,6 +18,7 @@ on:
- "libs/cua-driver/rust/crates/cua-driver-bindgen/**"
- "libs/cua-driver/rust/crates/cua-driver-core/**"
- "libs/cua-driver/rust/crates/cua-driver-sdk/**"
+ - "libs/cua-driver/rust/crates/cua-cursor-motion/**"
- "libs/cua-driver/rust/crates/cua-driver-testkit/**"
- "libs/cua-driver/rust/crates/platform-linux/**"
- "libs/cua-driver/rust/crates/platform-macos/**"
@@ -46,6 +47,7 @@ on:
- "libs/cua-driver/rust/crates/cua-driver-bindgen/**"
- "libs/cua-driver/rust/crates/cua-driver-core/**"
- "libs/cua-driver/rust/crates/cua-driver-sdk/**"
+ - "libs/cua-driver/rust/crates/cua-cursor-motion/**"
- "libs/cua-driver/rust/crates/cua-driver-testkit/**"
- "libs/cua-driver/rust/crates/platform-linux/**"
- "libs/cua-driver/rust/crates/platform-macos/**"
@@ -319,7 +321,7 @@ jobs:
working-directory: libs/cua-driver/python
run: |
CUA_DRIVER_REQUIRE_UNIFFI=1 PYTHONPATH=src \
- python -m unittest tests/test_uniffi_loader.py tests/test_remote_channel.py -v
+ python -m unittest tests/test_uniffi_loader.py tests/test_remote_channel.py tests/test_cursor_motion.py -v
python -m pip install --extra-index-url https://wheels.cua.ai/simple cua-fleet==0.1.17
CUA_DRIVER_REQUIRE_UNIFFI=1 PYTHONPATH=src python -m pytest tests/test_fleet.py -q
CUA_DRIVER_REQUIRE_UNIFFI=1 PYTHONPATH=src python -c \
diff --git a/docs/content/docs/cua-driver/guides/cursor-motion.mdx b/docs/content/docs/cua-driver/guides/cursor-motion.mdx
index c20ce438d0..8d69224795 100644
--- a/docs/content/docs/cua-driver/guides/cursor-motion.mdx
+++ b/docs/content/docs/cua-driver/guides/cursor-motion.mdx
@@ -43,6 +43,54 @@ The file has no imports, so it also loads from a plain
`<script type="module">`. In a TypeScript project with a bundler you can copy
`libs/typescript/cursor-motion/src/` instead.
+## From the Cua Driver SDKs
+
+The Cua Driver SDKs export the planner through the same UniFFI boundary as
+the rest of the driver, so Python and TypeScript hosts plan moves with the
+Rust code itself. A planned move is a `CursorTrajectory`: read its samples
+once with `samples()` and interpolate locally each frame.
+
+```python skip="no-runner"
+import cua_driver as cd
+
+params = cd.default_cursor_motion_params()
+params.style = cd.CursorMotionStyle.SPRING_SETTLE
+trajectory = cd.plan_cursor_move(
+ params,
+ cd.CursorMoveRequest(
+ from_point=cd.CursorMotionPoint(x=100, y=100),
+ to_point=cd.CursorMotionPoint(x=700, y=400),
+ from_heading=None,
+ end_heading=None,
+ target=cd.CursorMotionRect(x=660, y=380, width=80, height=40),
+ seed="demo",
+ reduced_motion=False,
+ ),
+)
+samples = trajectory.samples()
+```
+
+```ts skip="no-runner"
+import { CursorMotionStyle, defaultCursorMotionParams, planCursorMove } from '@trycua/cua-driver';
+
+const trajectory = planCursorMove(
+ { ...defaultCursorMotionParams(), style: CursorMotionStyle.SpringSettle },
+ {
+ fromPoint: { x: 100, y: 100 },
+ toPoint: { x: 700, y: 400 },
+ target: { x: 660, y: 380, width: 80, height: 40 },
+ seed: 'demo',
+ reducedMotion: false,
+ }
+);
+const samples = trajectory.samples();
+```
+
+`plan_cursor_spec` takes a custom `CursorMotionSpec`, and
+`CursorTrajectory.effect_frame(t, blend)` returns the trail, glow and magnet to
+paint. For a web page without the native library, use the single-file web port
+(see [Use it from the repository](#use-it-from-the-repository)).
+
## Plan a move
A move is planned once, as samples at 120 Hz, then played back by time. It
diff --git a/libs/cua-driver/python/src/cua_driver/__init__.py b/libs/cua-driver/python/src/cua_driver/__init__.py
index 673f37c99a..11e8ee36c7 100644
--- a/libs/cua-driver/python/src/cua_driver/__init__.py
+++ b/libs/cua-driver/python/src/cua_driver/__init__.py
@@ -64,7 +64,34 @@ from ._native import (
open_mac_os_screen_recording_settings,
request_mac_os_permissions,
)
+# Cua Cursor Motion: plan and play the agent cursor's motions.
+from ._native import (
+ CursorEase,
+ CursorEffectFrame,
+ CursorGlow,
+ CursorHeading,
+ CursorMagnet,
+ CursorMotionDuration,
+ CursorMotionParams,
+ CursorMotionPoint,
+ CursorMotionRect,
+ CursorMotionSample,
+ CursorMotionSpec,
+ CursorMoveRequest,
+ CursorPathShape,
+ CursorRipple,
+ CursorSettle,
+ CursorTrailSegment,
+ CursorTrailSpec,
+ CursorTrajectory,
+ cursor_click_effects,
+ cursor_motion_spec_for_style,
+ default_cursor_motion_params,
+ plan_cursor_move,
+ plan_cursor_spec,
+)
from ._native_contract import (
+ CursorMotionEffectsOutput,
AppInfo,
ClickPosition,
ElementFrame,
@@ -366,4 +393,28 @@ __all__ = [
"open_mac_os_screen_recording_settings",
"request_mac_os_permissions",
"run_cua_driver",
+ "CursorEase",
+ "CursorEffectFrame",
+ "CursorGlow",
+ "CursorHeading",
+ "CursorMagnet",
+ "CursorMotionDuration",
+ "CursorMotionParams",
+ "CursorMotionPoint",
+ "CursorMotionRect",
+ "CursorMotionSample",
+ "CursorMotionSpec",
+ "CursorMoveRequest",
+ "CursorPathShape",
+ "CursorRipple",
+ "CursorSettle",
+ "CursorTrailSegment",
+ "CursorTrailSpec",
+ "CursorTrajectory",
+ "cursor_click_effects",
+ "cursor_motion_spec_for_style",
+ "default_cursor_motion_params",
+ "plan_cursor_move",
+ "plan_cursor_spec",
+ "CursorMotionEffectsOutput",
]
diff --git a/libs/cua-driver/python/src/cua_driver/_native.py b/libs/cua-driver/python/src/cua_driver/_native.py
index a2e0d20f34..829ecf0ef3 100644
--- a/libs/cua-driver/python/src/cua_driver/_native.py
+++ b/libs/cua-driver/python/src/cua_driver/_native.py
@@ -488,10 +488,20 @@ 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_func_current_mac_os_permission_status() != 22890:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_func_cursor_click_effects() != 47083:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_func_cursor_motion_spec_for_style() != 60220:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_func_default_cursor_motion_params() != 63994:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_driver_sdk_checksum_func_open_mac_os_screen_recording_settings() != 6663:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_driver_sdk_checksum_func_open_mcp_driver_channel() != 952:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_func_plan_cursor_move() != 47047:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_func_plan_cursor_spec() != 61096:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_driver_sdk_checksum_func_request_mac_os_permissions() != 61823:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_driver_sdk_checksum_constructor_cuadriver_connect() != 60859:
@@ -660,6 +670,26 @@ 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_verify_state() != 36472:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_arrival_t() != 18003:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_duration() != 45567:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effect_frame() != 63284:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effects() != 30979:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_linger() != 61008:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_sample_at() != 63579:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_samples() != 43656:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_snap_t() != 61947:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target() != 1238:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target_known() != 24778:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_driver_sdk_checksum_method_driveractivityobserver_on_activity() != 9786:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_driver_sdk_checksum_method_driverauthorizationhost_authorize() != 10089:
@@ -985,6 +1015,16 @@ _UniffiLib.uniffi_cua_driver_sdk_fn_free_cuadriversession.argtypes = (
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cua_driver_sdk_fn_free_cuadriversession.restype = None
+_UniffiLib.uniffi_cua_driver_sdk_fn_clone_cursortrajectory.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_clone_cursortrajectory.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cua_driver_sdk_fn_free_cursortrajectory.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_free_cursortrajectory.restype = None
_UniffiLib.uniffi_cua_driver_sdk_fn_clone_driveractivityobserver.argtypes = (
ctypes.c_uint64,
ctypes.POINTER(_UniffiRustCallStatus),
@@ -1159,6 +1199,24 @@ _UniffiLib.uniffi_cua_driver_sdk_fn_func_current_mac_os_permission_status.argtyp
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cua_driver_sdk_fn_func_current_mac_os_permission_status.restype = _UniffiRustBuffer
+_UniffiLib.uniffi_cua_driver_sdk_fn_func_cursor_click_effects.argtypes = (
+ cua_driver._native_contract._UniffiRustBuffer,
+ ctypes.c_double,
+ ctypes.c_double,
+ ctypes.c_double,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_func_cursor_click_effects.restype = _UniffiRustBuffer
+_UniffiLib.uniffi_cua_driver_sdk_fn_func_cursor_motion_spec_for_style.argtypes = (
+ cua_driver._native_contract._UniffiRustBuffer,
+ _UniffiRustBuffer,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_func_cursor_motion_spec_for_style.restype = _UniffiRustBuffer
+_UniffiLib.uniffi_cua_driver_sdk_fn_func_default_cursor_motion_params.argtypes = (
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_func_default_cursor_motion_params.restype = _UniffiRustBuffer
_UniffiLib.uniffi_cua_driver_sdk_fn_func_open_mac_os_screen_recording_settings.argtypes = (
ctypes.POINTER(_UniffiRustCallStatus),
)
@@ -1169,6 +1227,18 @@ _UniffiLib.uniffi_cua_driver_sdk_fn_func_open_mcp_driver_channel.argtypes = (
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cua_driver_sdk_fn_func_open_mcp_driver_channel.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cua_driver_sdk_fn_func_plan_cursor_move.argtypes = (
+ _UniffiRustBuffer,
+ _UniffiRustBuffer,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_func_plan_cursor_move.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cua_driver_sdk_fn_func_plan_cursor_spec.argtypes = (
+ _UniffiRustBuffer,
+ _UniffiRustBuffer,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_func_plan_cursor_spec.restype = ctypes.c_uint64
_UniffiLib.uniffi_cua_driver_sdk_fn_func_request_mac_os_permissions.argtypes = (
ctypes.POINTER(_UniffiRustCallStatus),
)
@@ -1601,6 +1671,59 @@ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_verify_state.argtype
cua_driver._native_contract._UniffiRustBuffer,
)
_UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_verify_state.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_arrival_t.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_arrival_t.restype = ctypes.c_double
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_duration.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_duration.restype = ctypes.c_double
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_effect_frame.argtypes = (
+ ctypes.c_uint64,
+ ctypes.c_double,
+ ctypes.c_int8,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_effect_frame.restype = _UniffiRustBuffer
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_effects.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_effects.restype = cua_driver._native_contract._UniffiRustBuffer
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_linger.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_linger.restype = ctypes.c_double
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_sample_at.argtypes = (
+ ctypes.c_uint64,
+ ctypes.c_double,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_sample_at.restype = _UniffiRustBuffer
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_samples.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_samples.restype = _UniffiRustBuffer
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_snap_t.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_snap_t.restype = _UniffiRustBuffer
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_target.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_target.restype = _UniffiRustBuffer
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_target_known.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_target_known.restype = ctypes.c_int8
_UniffiLib.uniffi_cua_driver_sdk_fn_method_driveractivityobserver_on_activity.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -1716,12 +1839,27 @@ _UniffiLib.uniffi_cua_driver_sdk_checksum_func_create_trusted_session.restype =
_UniffiLib.uniffi_cua_driver_sdk_checksum_func_current_mac_os_permission_status.argtypes = (
)
_UniffiLib.uniffi_cua_driver_sdk_checksum_func_current_mac_os_permission_status.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_func_cursor_click_effects.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_func_cursor_click_effects.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_func_cursor_motion_spec_for_style.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_func_cursor_motion_spec_for_style.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_func_default_cursor_motion_params.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_func_default_cursor_motion_params.restype = ctypes.c_uint16
_UniffiLib.uniffi_cua_driver_sdk_checksum_func_open_mac_os_screen_recording_settings.argtypes = (
)
_UniffiLib.uniffi_cua_driver_sdk_checksum_func_open_mac_os_screen_recording_settings.restype = ctypes.c_uint16
_UniffiLib.uniffi_cua_driver_sdk_checksum_func_open_mcp_driver_channel.argtypes = (
)
_UniffiLib.uniffi_cua_driver_sdk_checksum_func_open_mcp_driver_channel.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_func_plan_cursor_move.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_func_plan_cursor_move.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_func_plan_cursor_spec.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_func_plan_cursor_spec.restype = ctypes.c_uint16
_UniffiLib.uniffi_cua_driver_sdk_checksum_func_request_mac_os_permissions.argtypes = (
)
_UniffiLib.uniffi_cua_driver_sdk_checksum_func_request_mac_os_permissions.restype = ctypes.c_uint16
@@ -1974,6 +2112,36 @@ _UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_type_text.rest
_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_verify_state.argtypes = (
)
_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cuadriversession_verify_state.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_arrival_t.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_arrival_t.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_duration.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_duration.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effect_frame.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effect_frame.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effects.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effects.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_linger.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_linger.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_sample_at.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_sample_at.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_samples.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_samples.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_snap_t.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_snap_t.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target_known.argtypes = (
+)
+_UniffiLib.uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target_known.restype = ctypes.c_uint16
_UniffiLib.uniffi_cua_driver_sdk_checksum_method_driveractivityobserver_on_activity.argtypes = (
)
_UniffiLib.uniffi_cua_driver_sdk_checksum_method_driveractivityobserver_on_activity.restype = ctypes.c_uint16
@@ -2491,98 +2659,166 @@ class _UniffiFfiConverterTypeConfiguredDriverOptions(_UniffiConverterRustBuffer)
_UniffiFfiConverterBoolean.write(value.claude_code_compatibility, buf)
_UniffiFfiConverterTypeRuntimeAuthorizationOptions.write(value.authorization, buf)
+class _UniffiFfiConverterFloat64(_UniffiConverterPrimitiveFloat):
+ @staticmethod
+ def read(buf):
+ return buf.read_double()
+ @staticmethod
+ def write(value, buf):
+ buf.write_double(value)
+@dataclass
+class CursorGlow:
+ """
+ Speed glow.
+"""
+ def __init__(self, *, x:float, y:float, r:float, alpha:float):
+ self.x = x
+ self.y = y
+ self.r = r
+ self.alpha = alpha
-class DriverActivityKind(enum.Enum):
- AUTHORIZED_ACTION = 0
+ def __str__(self):
+ return "CursorGlow(x={}, y={}, r={}, alpha={})".format(self.x, self.y, self.r, self.alpha)
+ def __eq__(self, other):
+ if self.x != other.x:
+ return False
+ if self.y != other.y:
+ return False
+ if self.r != other.r:
+ return False
+ if self.alpha != other.alpha:
+ return False
+ return True
- AUTHORIZATION_REFUSED = 1
+class _UniffiFfiConverterTypeCursorGlow(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CursorGlow(
+ x=_UniffiFfiConverterFloat64.read(buf),
+ y=_UniffiFfiConverterFloat64.read(buf),
+ r=_UniffiFfiConverterFloat64.read(buf),
+ alpha=_UniffiFfiConverterFloat64.read(buf),
+ )
- ACTION_FAILED = 2
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterFloat64.check_lower(value.x)
+ _UniffiFfiConverterFloat64.check_lower(value.y)
+ _UniffiFfiConverterFloat64.check_lower(value.r)
+ _UniffiFfiConverterFloat64.check_lower(value.alpha)
- GRANT_ISSUED = 3
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterFloat64.write(value.x, buf)
+ _UniffiFfiConverterFloat64.write(value.y, buf)
+ _UniffiFfiConverterFloat64.write(value.r, buf)
+ _UniffiFfiConverterFloat64.write(value.alpha, buf)
- GRANT_REVOKED = 4
+class _UniffiFfiConverterOptionalTypeCursorGlow(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ if value is not None:
+ _UniffiFfiConverterTypeCursorGlow.check_lower(value)
- SESSION_STARTED = 5
+ @classmethod
+ def write(cls, value, buf):
+ if value is None:
+ buf.write_u8(0)
+ return
- SESSION_ENDED = 6
+ buf.write_u8(1)
+ _UniffiFfiConverterTypeCursorGlow.write(value, buf)
+
+ @classmethod
+ def read(cls, buf):
+ flag = buf.read_u8()
+ if flag == 0:
+ return None
+ elif flag == 1:
+ return _UniffiFfiConverterTypeCursorGlow.read(buf)
+ else:
+ raise InternalError("Unexpected flag byte for optional type")
+
+@dataclass
+class CursorTrailSegment:
+ """
+ One round-capped stroke of the comet trail.
+"""
+ def __init__(self, *, ax:float, ay:float, bx:float, by:float, width:float, alpha:float):
+ self.ax = ax
+ self.ay = ay
+ self.bx = bx
+ self.by = by
+ self.width = width
+ self.alpha = alpha
-class _UniffiFfiConverterTypeDriverActivityKind(_UniffiConverterRustBuffer):
+
+ def __str__(self):
+ return "CursorTrailSegment(ax={}, ay={}, bx={}, by={}, width={}, alpha={})".format(self.ax, self.ay, self.bx, self.by, self.width, self.alpha)
+ def __eq__(self, other):
+ if self.ax != other.ax:
+ return False
+ if self.ay != other.ay:
+ return False
+ if self.bx != other.bx:
+ return False
+ if self.by != other.by:
+ return False
+ if self.width != other.width:
+ return False
+ if self.alpha != other.alpha:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCursorTrailSegment(_UniffiConverterRustBuffer):
@staticmethod
def read(buf):
- variant = buf.read_i32()
- if variant == 1:
- return DriverActivityKind.AUTHORIZED_ACTION
- if variant == 2:
- return DriverActivityKind.AUTHORIZATION_REFUSED
- if variant == 3:
- return DriverActivityKind.ACTION_FAILED
- if variant == 4:
- return DriverActivityKind.GRANT_ISSUED
- if variant == 5:
- return DriverActivityKind.GRANT_REVOKED
- if variant == 6:
- return DriverActivityKind.SESSION_STARTED
- if variant == 7:
- return DriverActivityKind.SESSION_ENDED
- raise InternalError("Raw enum value doesn't match any cases")
+ return CursorTrailSegment(
+ ax=_UniffiFfiConverterFloat64.read(buf),
+ ay=_UniffiFfiConverterFloat64.read(buf),
+ bx=_UniffiFfiConverterFloat64.read(buf),
+ by=_UniffiFfiConverterFloat64.read(buf),
+ width=_UniffiFfiConverterFloat64.read(buf),
+ alpha=_UniffiFfiConverterFloat64.read(buf),
+ )
@staticmethod
def check_lower(value):
- if value == DriverActivityKind.AUTHORIZED_ACTION:
- return
- if value == DriverActivityKind.AUTHORIZATION_REFUSED:
- return
- if value == DriverActivityKind.ACTION_FAILED:
- return
- if value == DriverActivityKind.GRANT_ISSUED:
- return
- if value == DriverActivityKind.GRANT_REVOKED:
- return
- if value == DriverActivityKind.SESSION_STARTED:
- return
- if value == DriverActivityKind.SESSION_ENDED:
- return
- raise ValueError(value)
+ _UniffiFfiConverterFloat64.check_lower(value.ax)
+ _UniffiFfiConverterFloat64.check_lower(value.ay)
+ _UniffiFfiConverterFloat64.check_lower(value.bx)
+ _UniffiFfiConverterFloat64.check_lower(value.by)
+ _UniffiFfiConverterFloat64.check_lower(value.width)
+ _UniffiFfiConverterFloat64.check_lower(value.alpha)
@staticmethod
def write(value, buf):
- if value == DriverActivityKind.AUTHORIZED_ACTION:
- buf.write_i32(1)
- if value == DriverActivityKind.AUTHORIZATION_REFUSED:
- buf.write_i32(2)
- if value == DriverActivityKind.ACTION_FAILED:
- buf.write_i32(3)
- if value == DriverActivityKind.GRANT_ISSUED:
- buf.write_i32(4)
- if value == DriverActivityKind.GRANT_REVOKED:
- buf.write_i32(5)
- if value == DriverActivityKind.SESSION_STARTED:
- buf.write_i32(6)
- if value == DriverActivityKind.SESSION_ENDED:
- buf.write_i32(7)
-
-
-
-class _UniffiFfiConverterSequenceString(_UniffiConverterRustBuffer):
+ _UniffiFfiConverterFloat64.write(value.ax, buf)
+ _UniffiFfiConverterFloat64.write(value.ay, buf)
+ _UniffiFfiConverterFloat64.write(value.bx, buf)
+ _UniffiFfiConverterFloat64.write(value.by, buf)
+ _UniffiFfiConverterFloat64.write(value.width, buf)
+ _UniffiFfiConverterFloat64.write(value.alpha, buf)
+
+class _UniffiFfiConverterSequenceTypeCursorTrailSegment(_UniffiConverterRustBuffer):
@classmethod
def check_lower(cls, value):
for item in value:
- _UniffiFfiConverterString.check_lower(item)
+ _UniffiFfiConverterTypeCursorTrailSegment.check_lower(item)
@classmethod
def write(cls, value, buf):
items = len(value)
buf.write_i32(items)
for item in value:
- _UniffiFfiConverterString.write(item, buf)
+ _UniffiFfiConverterTypeCursorTrailSegment.write(item, buf)
@classmethod
def read(cls, buf):
@@ -2591,88 +2827,1852 @@ class _UniffiFfiConverterSequenceString(_UniffiConverterRustBuffer):
raise InternalError("Unexpected negative sequence length")
return [
- _UniffiFfiConverterString.read(buf) for i in range(count)
+ _UniffiFfiConverterTypeCursorTrailSegment.read(buf) for i in range(count)
]
@dataclass
-class DriverActivityEvent:
+class CursorMotionRect:
"""
- A content-free lifecycle event emitted after native authorization decides
- a call. It never carries arguments, page text, paths, typed input, images,
- or raw resource identities.
+ A target rect in screen points.
"""
- def __init__(self, *, kind:DriverActivityKind, unix_ms:int, tool_name:str, adapter_ids:typing.List[str], risk_class:str, public_session:typing.Optional[str], refusal_code:typing.Optional[str]):
- self.kind = kind
- self.unix_ms = unix_ms
- self.tool_name = tool_name
- self.adapter_ids = adapter_ids
- self.risk_class = risk_class
- self.public_session = public_session
- self.refusal_code = refusal_code
+ def __init__(self, *, x:float, y:float, width:float, height:float):
+ self.x = x
+ self.y = y
+ self.width = width
+ self.height = height
def __str__(self):
- return "DriverActivityEvent(kind={}, unix_ms={}, tool_name={}, adapter_ids={}, risk_class={}, public_session={}, refusal_code={})".format(self.kind, self.unix_ms, self.tool_name, self.adapter_ids, self.risk_class, self.public_session, self.refusal_code)
+ return "CursorMotionRect(x={}, y={}, width={}, height={})".format(self.x, self.y, self.width, self.height)
def __eq__(self, other):
- if self.kind != other.kind:
- return False
- if self.unix_ms != other.unix_ms:
- return False
- if self.tool_name != other.tool_name:
- return False
- if self.adapter_ids != other.adapter_ids:
+ if self.x != other.x:
return False
- if self.risk_class != other.risk_class:
+ if self.y != other.y:
return False
- if self.public_session != other.public_session:
+ if self.width != other.width:
return False
- if self.refusal_code != other.refusal_code:
+ if self.height != other.height:
return False
return True
-class _UniffiFfiConverterTypeDriverActivityEvent(_UniffiConverterRustBuffer):
+class _UniffiFfiConverterTypeCursorMotionRect(_UniffiConverterRustBuffer):
@staticmethod
def read(buf):
- return DriverActivityEvent(
- kind=_UniffiFfiConverterTypeDriverActivityKind.read(buf),
- unix_ms=_UniffiFfiConverterUInt64.read(buf),
- tool_name=_UniffiFfiConverterString.read(buf),
- adapter_ids=_UniffiFfiConverterSequenceString.read(buf),
- risk_class=_UniffiFfiConverterString.read(buf),
- public_session=_UniffiFfiConverterOptionalString.read(buf),
- refusal_code=_UniffiFfiConverterOptionalString.read(buf),
+ return CursorMotionRect(
+ x=_UniffiFfiConverterFloat64.read(buf),
+ y=_UniffiFfiConverterFloat64.read(buf),
+ width=_UniffiFfiConverterFloat64.read(buf),
+ height=_UniffiFfiConverterFloat64.read(buf),
)
@staticmethod
def check_lower(value):
- _UniffiFfiConverterTypeDriverActivityKind.check_lower(value.kind)
- _UniffiFfiConverterUInt64.check_lower(value.unix_ms)
- _UniffiFfiConverterString.check_lower(value.tool_name)
- _UniffiFfiConverterSequenceString.check_lower(value.adapter_ids)
- _UniffiFfiConverterString.check_lower(value.risk_class)
- _UniffiFfiConverterOptionalString.check_lower(value.public_session)
- _UniffiFfiConverterOptionalString.check_lower(value.refusal_code)
+ _UniffiFfiConverterFloat64.check_lower(value.x)
+ _UniffiFfiConverterFloat64.check_lower(value.y)
+ _UniffiFfiConverterFloat64.check_lower(value.width)
+ _UniffiFfiConverterFloat64.check_lower(value.height)
@staticmethod
def write(value, buf):
- _UniffiFfiConverterTypeDriverActivityKind.write(value.kind, buf)
- _UniffiFfiConverterUInt64.write(value.unix_ms, buf)
- _UniffiFfiConverterString.write(value.tool_name, buf)
- _UniffiFfiConverterSequenceString.write(value.adapter_ids, buf)
- _UniffiFfiConverterString.write(value.risk_class, buf)
- _UniffiFfiConverterOptionalString.write(value.public_session, buf)
- _UniffiFfiConverterOptionalString.write(value.refusal_code, buf)
-
+ _UniffiFfiConverterFloat64.write(value.x, buf)
+ _UniffiFfiConverterFloat64.write(value.y, buf)
+ _UniffiFfiConverterFloat64.write(value.width, buf)
+ _UniffiFfiConverterFloat64.write(value.height, buf)
+@dataclass
+class CursorMagnet:
+ """
+ Glow around the target after a magnetic lock-on.
+"""
+ def __init__(self, *, rect:CursorMotionRect, glow:float):
+ self.rect = rect
+ self.glow = glow
-class DriverAuthorizationAction(enum.Enum):
+ def __str__(self):
+ return "CursorMagnet(rect={}, glow={})".format(self.rect, self.glow)
+ def __eq__(self, other):
+ if self.rect != other.rect:
+ return False
+ if self.glow != other.glow:
+ return False
+ return True
- ALLOW = 0
+class _UniffiFfiConverterTypeCursorMagnet(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CursorMagnet(
+ rect=_UniffiFfiConverterTypeCursorMotionRect.read(buf),
+ glow=_UniffiFfiConverterFloat64.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterTypeCursorMotionRect.check_lower(value.rect)
+ _UniffiFfiConverterFloat64.check_lower(value.glow)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterTypeCursorMotionRect.write(value.rect, buf)
+ _UniffiFfiConverterFloat64.write(value.glow, buf)
+
+class _UniffiFfiConverterOptionalTypeCursorMagnet(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ if value is not None:
+ _UniffiFfiConverterTypeCursorMagnet.check_lower(value)
+
+ @classmethod
+ def write(cls, value, buf):
+ if value is None:
+ buf.write_u8(0)
+ return
+
+ buf.write_u8(1)
+ _UniffiFfiConverterTypeCursorMagnet.write(value, buf)
+
+ @classmethod
+ def read(cls, buf):
+ flag = buf.read_u8()
+ if flag == 0:
+ return None
+ elif flag == 1:
+ return _UniffiFfiConverterTypeCursorMagnet.read(buf)
+ else:
+ raise InternalError("Unexpected flag byte for optional type")
+
+@dataclass
+class CursorRipple:
+ """
+ Expanding click ring.
+"""
+ def __init__(self, *, x:float, y:float, r:float, width:float, alpha:float):
+ self.x = x
+ self.y = y
+ self.r = r
+ self.width = width
+ self.alpha = alpha
+
+
+
+
+ def __str__(self):
+ return "CursorRipple(x={}, y={}, r={}, width={}, alpha={})".format(self.x, self.y, self.r, self.width, self.alpha)
+ def __eq__(self, other):
+ if self.x != other.x:
+ return False
+ if self.y != other.y:
+ return False
+ if self.r != other.r:
+ return False
+ if self.width != other.width:
+ return False
+ if self.alpha != other.alpha:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCursorRipple(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CursorRipple(
+ x=_UniffiFfiConverterFloat64.read(buf),
+ y=_UniffiFfiConverterFloat64.read(buf),
+ r=_UniffiFfiConverterFloat64.read(buf),
+ width=_UniffiFfiConverterFloat64.read(buf),
+ alpha=_UniffiFfiConverterFloat64.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterFloat64.check_lower(value.x)
+ _UniffiFfiConverterFloat64.check_lower(value.y)
+ _UniffiFfiConverterFloat64.check_lower(value.r)
+ _UniffiFfiConverterFloat64.check_lower(value.width)
+ _UniffiFfiConverterFloat64.check_lower(value.alpha)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterFloat64.write(value.x, buf)
+ _UniffiFfiConverterFloat64.write(value.y, buf)
+ _UniffiFfiConverterFloat64.write(value.r, buf)
+ _UniffiFfiConverterFloat64.write(value.width, buf)
+ _UniffiFfiConverterFloat64.write(value.alpha, buf)
+
+class _UniffiFfiConverterOptionalTypeCursorRipple(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ if value is not None:
+ _UniffiFfiConverterTypeCursorRipple.check_lower(value)
+
+ @classmethod
+ def write(cls, value, buf):
+ if value is None:
+ buf.write_u8(0)
+ return
+
+ buf.write_u8(1)
+ _UniffiFfiConverterTypeCursorRipple.write(value, buf)
+
+ @classmethod
+ def read(cls, buf):
+ flag = buf.read_u8()
+ if flag == 0:
+ return None
+ elif flag == 1:
+ return _UniffiFfiConverterTypeCursorRipple.read(buf)
+ else:
+ raise InternalError("Unexpected flag byte for optional type")
+
+@dataclass
+class CursorEffectFrame:
+ """
+ The effects to paint at one moment.
+"""
+ def __init__(self, *, glow:typing.Optional[CursorGlow], trail:typing.List[CursorTrailSegment], magnet:typing.Optional[CursorMagnet], ripple:typing.Optional[CursorRipple], squish:float):
+ self.glow = glow
+ self.trail = trail
+ self.magnet = magnet
+ self.ripple = ripple
+ self.squish = squish
+
+
+
+
+ def __str__(self):
+ return "CursorEffectFrame(glow={}, trail={}, magnet={}, ripple={}, squish={})".format(self.glow, self.trail, self.magnet, self.ripple, self.squish)
+ def __eq__(self, other):
+ if self.glow != other.glow:
+ return False
+ if self.trail != other.trail:
+ return False
+ if self.magnet != other.magnet:
+ return False
+ if self.ripple != other.ripple:
+ return False
+ if self.squish != other.squish:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCursorEffectFrame(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CursorEffectFrame(
+ glow=_UniffiFfiConverterOptionalTypeCursorGlow.read(buf),
+ trail=_UniffiFfiConverterSequenceTypeCursorTrailSegment.read(buf),
+ magnet=_UniffiFfiConverterOptionalTypeCursorMagnet.read(buf),
+ ripple=_UniffiFfiConverterOptionalTypeCursorRipple.read(buf),
+ squish=_UniffiFfiConverterFloat64.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterOptionalTypeCursorGlow.check_lower(value.glow)
+ _UniffiFfiConverterSequenceTypeCursorTrailSegment.check_lower(value.trail)
+ _UniffiFfiConverterOptionalTypeCursorMagnet.check_lower(value.magnet)
+ _UniffiFfiConverterOptionalTypeCursorRipple.check_lower(value.ripple)
+ _UniffiFfiConverterFloat64.check_lower(value.squish)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterOptionalTypeCursorGlow.write(value.glow, buf)
+ _UniffiFfiConverterSequenceTypeCursorTrailSegment.write(value.trail, buf)
+ _UniffiFfiConverterOptionalTypeCursorMagnet.write(value.magnet, buf)
+ _UniffiFfiConverterOptionalTypeCursorRipple.write(value.ripple, buf)
+ _UniffiFfiConverterFloat64.write(value.squish, buf)
+
+
+
+
+
+
+
+@dataclass
+class CursorMotionParams:
+ """
+ Knobs of the built-in styles. Defaults match Cua Driver
+ (`default_cursor_motion_params`).
+"""
+ def __init__(self, *, style:cua_driver._native_contract.CursorMotionStyle, timing:cua_driver._native_contract.CursorMotionTiming, effects:cua_driver._native_contract.CursorMotionEffects, start_handle:float, end_handle:float, arc_size:float, arc_flow:float, spring:float, glide_duration_ms:float, peak_speed:float, min_start_speed:float, min_end_speed:float, turn_radius:float):
+ self.style = style
+ self.timing = timing
+ self.effects = effects
+ self.start_handle = start_handle
+ self.end_handle = end_handle
+ self.arc_size = arc_size
+ self.arc_flow = arc_flow
+ self.spring = spring
+ self.glide_duration_ms = glide_duration_ms
+ self.peak_speed = peak_speed
+ self.min_start_speed = min_start_speed
+ self.min_end_speed = min_end_speed
+ self.turn_radius = turn_radius
+
+
+
+
+ def __str__(self):
+ return "CursorMotionParams(style={}, timing={}, effects={}, start_handle={}, end_handle={}, arc_size={}, arc_flow={}, spring={}, glide_duration_ms={}, peak_speed={}, min_start_speed={}, min_end_speed={}, turn_radius={})".format(self.style, self.timing, self.effects, self.start_handle, self.end_handle, self.arc_size, self.arc_flow, self.spring, self.glide_duration_ms, self.peak_speed, self.min_start_speed, self.min_end_speed, self.turn_radius)
+ def __eq__(self, other):
+ if self.style != other.style:
+ return False
+ if self.timing != other.timing:
+ return False
+ if self.effects != other.effects:
+ return False
+ if self.start_handle != other.start_handle:
+ return False
+ if self.end_handle != other.end_handle:
+ return False
+ if self.arc_size != other.arc_size:
+ return False
+ if self.arc_flow != other.arc_flow:
+ return False
+ if self.spring != other.spring:
+ return False
+ if self.glide_duration_ms != other.glide_duration_ms:
+ return False
+ if self.peak_speed != other.peak_speed:
+ return False
+ if self.min_start_speed != other.min_start_speed:
+ return False
+ if self.min_end_speed != other.min_end_speed:
+ return False
+ if self.turn_radius != other.turn_radius:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCursorMotionParams(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CursorMotionParams(
+ style=cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionStyle.read(buf),
+ timing=cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionTiming.read(buf),
+ effects=cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionEffects.read(buf),
+ start_handle=_UniffiFfiConverterFloat64.read(buf),
+ end_handle=_UniffiFfiConverterFloat64.read(buf),
+ arc_size=_UniffiFfiConverterFloat64.read(buf),
+ arc_flow=_UniffiFfiConverterFloat64.read(buf),
+ spring=_UniffiFfiConverterFloat64.read(buf),
+ glide_duration_ms=_UniffiFfiConverterFloat64.read(buf),
+ peak_speed=_UniffiFfiConverterFloat64.read(buf),
+ min_start_speed=_UniffiFfiConverterFloat64.read(buf),
+ min_end_speed=_UniffiFfiConverterFloat64.read(buf),
+ turn_radius=_UniffiFfiConverterFloat64.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionStyle.check_lower(value.style)
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionTiming.check_lower(value.timing)
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionEffects.check_lower(value.effects)
+ _UniffiFfiConverterFloat64.check_lower(value.start_handle)
+ _UniffiFfiConverterFloat64.check_lower(value.end_handle)
+ _UniffiFfiConverterFloat64.check_lower(value.arc_size)
+ _UniffiFfiConverterFloat64.check_lower(value.arc_flow)
+ _UniffiFfiConverterFloat64.check_lower(value.spring)
+ _UniffiFfiConverterFloat64.check_lower(value.glide_duration_ms)
+ _UniffiFfiConverterFloat64.check_lower(value.peak_speed)
+ _UniffiFfiConverterFloat64.check_lower(value.min_start_speed)
+ _UniffiFfiConverterFloat64.check_lower(value.min_end_speed)
+ _UniffiFfiConverterFloat64.check_lower(value.turn_radius)
+
+ @staticmethod
+ def write(value, buf):
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionStyle.write(value.style, buf)
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionTiming.write(value.timing, buf)
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionEffects.write(value.effects, buf)
+ _UniffiFfiConverterFloat64.write(value.start_handle, buf)
+ _UniffiFfiConverterFloat64.write(value.end_handle, buf)
+ _UniffiFfiConverterFloat64.write(value.arc_size, buf)
+ _UniffiFfiConverterFloat64.write(value.arc_flow, buf)
+ _UniffiFfiConverterFloat64.write(value.spring, buf)
+ _UniffiFfiConverterFloat64.write(value.glide_duration_ms, buf)
+ _UniffiFfiConverterFloat64.write(value.peak_speed, buf)
+ _UniffiFfiConverterFloat64.write(value.min_start_speed, buf)
+ _UniffiFfiConverterFloat64.write(value.min_end_speed, buf)
+ _UniffiFfiConverterFloat64.write(value.turn_radius, buf)
+
+@dataclass
+class CursorMotionPoint:
+ """
+ A point in screen points (y down).
+"""
+ def __init__(self, *, x:float, y:float):
+ self.x = x
+ self.y = y
+
+
+
+
+ def __str__(self):
+ return "CursorMotionPoint(x={}, y={})".format(self.x, self.y)
+ def __eq__(self, other):
+ if self.x != other.x:
+ return False
+ if self.y != other.y:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCursorMotionPoint(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CursorMotionPoint(
+ x=_UniffiFfiConverterFloat64.read(buf),
+ y=_UniffiFfiConverterFloat64.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterFloat64.check_lower(value.x)
+ _UniffiFfiConverterFloat64.check_lower(value.y)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterFloat64.write(value.x, buf)
+ _UniffiFfiConverterFloat64.write(value.y, buf)
+
+@dataclass
+class CursorMotionSample:
+ """
+ One sample: seconds from the start, the hotspot, and the arrow's heading.
+"""
+ def __init__(self, *, t:float, x:float, y:float, heading:float):
+ self.t = t
+ self.x = x
+ self.y = y
+ self.heading = heading
+
+
+
+
+ def __str__(self):
+ return "CursorMotionSample(t={}, x={}, y={}, heading={})".format(self.t, self.x, self.y, self.heading)
+ def __eq__(self, other):
+ if self.t != other.t:
+ return False
+ if self.x != other.x:
+ return False
+ if self.y != other.y:
+ return False
+ if self.heading != other.heading:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCursorMotionSample(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CursorMotionSample(
+ t=_UniffiFfiConverterFloat64.read(buf),
+ x=_UniffiFfiConverterFloat64.read(buf),
+ y=_UniffiFfiConverterFloat64.read(buf),
+ heading=_UniffiFfiConverterFloat64.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterFloat64.check_lower(value.t)
+ _UniffiFfiConverterFloat64.check_lower(value.x)
+ _UniffiFfiConverterFloat64.check_lower(value.y)
+ _UniffiFfiConverterFloat64.check_lower(value.heading)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterFloat64.write(value.t, buf)
+ _UniffiFfiConverterFloat64.write(value.x, buf)
+ _UniffiFfiConverterFloat64.write(value.y, buf)
+ _UniffiFfiConverterFloat64.write(value.heading, buf)
+
+
+
+
+
+
+class CursorPathShape:
+ """
+ Path shape of a custom motion.
+"""
+ def __init__(self):
+ raise RuntimeError("CursorPathShape cannot be instantiated directly")
+
+ # Each enum variant is a nested class of the enum itself.
+ @dataclass
+ class STRAIGHT:
+
+ def __init__(self, ):
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorPathShape.STRAIGHT()".format()
+ def __eq__(self, other):
+ if not isinstance(other, CursorPathShape):
+ return NotImplemented
+ if not other.is_STRAIGHT():
+ return False
+ return True
+
+ @dataclass
+ class ARC:
+ """
+ The Cua cubic bezier; a positive `arc_size` bends to the natural side.
+"""
+
+ def __init__(self, start_handle:float, end_handle:float, arc_size:float, arc_flow:float):
+ self.start_handle = start_handle
+
+
+ self.end_handle = end_handle
+
+
+ self.arc_size = arc_size
+
+
+ self.arc_flow = arc_flow
+
+
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorPathShape.ARC(start_handle={}, end_handle={}, arc_size={}, arc_flow={})".format(self.start_handle, self.end_handle, self.arc_size, self.arc_flow)
+ def __eq__(self, other):
+ if not isinstance(other, CursorPathShape):
+ return NotImplemented
+ if not other.is_ARC():
+ return False
+ if self.start_handle != other.start_handle:
+ return False
+ if self.end_handle != other.end_handle:
+ return False
+ if self.arc_size != other.arc_size:
+ return False
+ if self.arc_flow != other.arc_flow:
+ return False
+ return True
+
+ @dataclass
+ class BOW:
+ """
+ A gentle quadratic bow.
+"""
+
+ def __init__(self, amount:float):
+ self.amount = amount
+
+
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorPathShape.BOW(amount={})".format(self.amount)
+ def __eq__(self, other):
+ if not isinstance(other, CursorPathShape):
+ return NotImplemented
+ if not other.is_BOW():
+ return False
+ if self.amount != other.amount:
+ return False
+ return True
+
+
+
+ # For each variant, we have `is_NAME` and `is_name` methods for easily checking
+ # whether an instance is that variant.
+ def is_STRAIGHT(self) -> bool:
+ return isinstance(self, CursorPathShape.STRAIGHT)
+ def is_straight(self) -> bool:
+ return isinstance(self, CursorPathShape.STRAIGHT)
+ def is_ARC(self) -> bool:
+ return isinstance(self, CursorPathShape.ARC)
+ def is_arc(self) -> bool:
+ return isinstance(self, CursorPathShape.ARC)
+ def is_BOW(self) -> bool:
+ return isinstance(self, CursorPathShape.BOW)
+ def is_bow(self) -> bool:
+ return isinstance(self, CursorPathShape.BOW)
+
+
+# Now, a little trick - we make each nested variant class be a subclass of the main
+# enum class, so that method calls and instance checks etc will work intuitively.
+# We might be able to do this a little more neatly with a metaclass, but this'll do.
+CursorPathShape.STRAIGHT = type("CursorPathShape.STRAIGHT", (CursorPathShape.STRAIGHT, CursorPathShape,), {}) # type: ignore
+CursorPathShape.ARC = type("CursorPathShape.ARC", (CursorPathShape.ARC, CursorPathShape,), {}) # type: ignore
+CursorPathShape.BOW = type("CursorPathShape.BOW", (CursorPathShape.BOW, CursorPathShape,), {}) # type: ignore
+
+
+
+
+class _UniffiFfiConverterTypeCursorPathShape(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ variant = buf.read_i32()
+ if variant == 1:
+ return CursorPathShape.STRAIGHT(
+ )
+ if variant == 2:
+ return CursorPathShape.ARC(
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ )
+ if variant == 3:
+ return CursorPathShape.BOW(
+ _UniffiFfiConverterFloat64.read(buf),
+ )
+ raise InternalError("Raw enum value doesn't match any cases")
+
+ @staticmethod
+ def check_lower(value):
+ if value.is_STRAIGHT():
+ return
+ if value.is_ARC():
+ _UniffiFfiConverterFloat64.check_lower(value.start_handle)
+ _UniffiFfiConverterFloat64.check_lower(value.end_handle)
+ _UniffiFfiConverterFloat64.check_lower(value.arc_size)
+ _UniffiFfiConverterFloat64.check_lower(value.arc_flow)
+ return
+ if value.is_BOW():
+ _UniffiFfiConverterFloat64.check_lower(value.amount)
+ return
+ raise ValueError(value)
+
+ @staticmethod
+ def write(value, buf):
+ if value.is_STRAIGHT():
+ buf.write_i32(1)
+ if value.is_ARC():
+ buf.write_i32(2)
+ _UniffiFfiConverterFloat64.write(value.start_handle, buf)
+ _UniffiFfiConverterFloat64.write(value.end_handle, buf)
+ _UniffiFfiConverterFloat64.write(value.arc_size, buf)
+ _UniffiFfiConverterFloat64.write(value.arc_flow, buf)
+ if value.is_BOW():
+ buf.write_i32(3)
+ _UniffiFfiConverterFloat64.write(value.amount, buf)
+
+
+
+
+
+
+
+
+class CursorEase:
+ """
+ Speed curve along the path.
+"""
+ def __init__(self):
+ raise RuntimeError("CursorEase cannot be instantiated directly")
+
+ # Each enum variant is a nested class of the enum itself.
+ @dataclass
+ class LINEAR:
+
+ def __init__(self, ):
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorEase.LINEAR()".format()
+ def __eq__(self, other):
+ if not isinstance(other, CursorEase):
+ return NotImplemented
+ if not other.is_LINEAR():
+ return False
+ return True
+
+ @dataclass
+ class MIN_JERK:
+
+ def __init__(self, ):
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorEase.MIN_JERK()".format()
+ def __eq__(self, other):
+ if not isinstance(other, CursorEase):
+ return NotImplemented
+ if not other.is_MIN_JERK():
+ return False
+ return True
+
+ @dataclass
+ class SMOOTHERSTEP:
+
+ def __init__(self, ):
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorEase.SMOOTHERSTEP()".format()
+ def __eq__(self, other):
+ if not isinstance(other, CursorEase):
+ return NotImplemented
+ if not other.is_SMOOTHERSTEP():
+ return False
+ return True
+
+ @dataclass
+ class IN_OUT_CUBIC:
+
+ def __init__(self, ):
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorEase.IN_OUT_CUBIC()".format()
+ def __eq__(self, other):
+ if not isinstance(other, CursorEase):
+ return NotImplemented
+ if not other.is_IN_OUT_CUBIC():
+ return False
+ return True
+
+ @dataclass
+ class IN_OUT_SINE:
+
+ def __init__(self, ):
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorEase.IN_OUT_SINE()".format()
+ def __eq__(self, other):
+ if not isinstance(other, CursorEase):
+ return NotImplemented
+ if not other.is_IN_OUT_SINE():
+ return False
+ return True
+
+ @dataclass
+ class OUT_CUBIC:
+
+ def __init__(self, ):
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorEase.OUT_CUBIC()".format()
+ def __eq__(self, other):
+ if not isinstance(other, CursorEase):
+ return NotImplemented
+ if not other.is_OUT_CUBIC():
+ return False
+ return True
+
+ @dataclass
+ class CUBIC_BEZIER:
+
+ def __init__(self, x1:float, y1:float, x2:float, y2:float):
+ self.x1 = x1
+
+
+ self.y1 = y1
+
+
+ self.x2 = x2
+
+
+ self.y2 = y2
+
+
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorEase.CUBIC_BEZIER(x1={}, y1={}, x2={}, y2={})".format(self.x1, self.y1, self.x2, self.y2)
+ def __eq__(self, other):
+ if not isinstance(other, CursorEase):
+ return NotImplemented
+ if not other.is_CUBIC_BEZIER():
+ return False
+ if self.x1 != other.x1:
+ return False
+ if self.y1 != other.y1:
+ return False
+ if self.x2 != other.x2:
+ return False
+ if self.y2 != other.y2:
+ return False
+ return True
+
+
+
+ # For each variant, we have `is_NAME` and `is_name` methods for easily checking
+ # whether an instance is that variant.
+ def is_LINEAR(self) -> bool:
+ return isinstance(self, CursorEase.LINEAR)
+ def is_linear(self) -> bool:
+ return isinstance(self, CursorEase.LINEAR)
+ def is_MIN_JERK(self) -> bool:
+ return isinstance(self, CursorEase.MIN_JERK)
+ def is_min_jerk(self) -> bool:
+ return isinstance(self, CursorEase.MIN_JERK)
+ def is_SMOOTHERSTEP(self) -> bool:
+ return isinstance(self, CursorEase.SMOOTHERSTEP)
+ def is_smootherstep(self) -> bool:
+ return isinstance(self, CursorEase.SMOOTHERSTEP)
+ def is_IN_OUT_CUBIC(self) -> bool:
+ return isinstance(self, CursorEase.IN_OUT_CUBIC)
+ def is_in_out_cubic(self) -> bool:
+ return isinstance(self, CursorEase.IN_OUT_CUBIC)
+ def is_IN_OUT_SINE(self) -> bool:
+ return isinstance(self, CursorEase.IN_OUT_SINE)
+ def is_in_out_sine(self) -> bool:
+ return isinstance(self, CursorEase.IN_OUT_SINE)
+ def is_OUT_CUBIC(self) -> bool:
+ return isinstance(self, CursorEase.OUT_CUBIC)
+ def is_out_cubic(self) -> bool:
+ return isinstance(self, CursorEase.OUT_CUBIC)
+ def is_CUBIC_BEZIER(self) -> bool:
+ return isinstance(self, CursorEase.CUBIC_BEZIER)
+ def is_cubic_bezier(self) -> bool:
+ return isinstance(self, CursorEase.CUBIC_BEZIER)
+
+
+# Now, a little trick - we make each nested variant class be a subclass of the main
+# enum class, so that method calls and instance checks etc will work intuitively.
+# We might be able to do this a little more neatly with a metaclass, but this'll do.
+CursorEase.LINEAR = type("CursorEase.LINEAR", (CursorEase.LINEAR, CursorEase,), {}) # type: ignore
+CursorEase.MIN_JERK = type("CursorEase.MIN_JERK", (CursorEase.MIN_JERK, CursorEase,), {}) # type: ignore
+CursorEase.SMOOTHERSTEP = type("CursorEase.SMOOTHERSTEP", (CursorEase.SMOOTHERSTEP, CursorEase,), {}) # type: ignore
+CursorEase.IN_OUT_CUBIC = type("CursorEase.IN_OUT_CUBIC", (CursorEase.IN_OUT_CUBIC, CursorEase,), {}) # type: ignore
+CursorEase.IN_OUT_SINE = type("CursorEase.IN_OUT_SINE", (CursorEase.IN_OUT_SINE, CursorEase,), {}) # type: ignore
+CursorEase.OUT_CUBIC = type("CursorEase.OUT_CUBIC", (CursorEase.OUT_CUBIC, CursorEase,), {}) # type: ignore
+CursorEase.CUBIC_BEZIER = type("CursorEase.CUBIC_BEZIER", (CursorEase.CUBIC_BEZIER, CursorEase,), {}) # type: ignore
+
+
+
+
+class _UniffiFfiConverterTypeCursorEase(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ variant = buf.read_i32()
+ if variant == 1:
+ return CursorEase.LINEAR(
+ )
+ if variant == 2:
+ return CursorEase.MIN_JERK(
+ )
+ if variant == 3:
+ return CursorEase.SMOOTHERSTEP(
+ )
+ if variant == 4:
+ return CursorEase.IN_OUT_CUBIC(
+ )
+ if variant == 5:
+ return CursorEase.IN_OUT_SINE(
+ )
+ if variant == 6:
+ return CursorEase.OUT_CUBIC(
+ )
+ if variant == 7:
+ return CursorEase.CUBIC_BEZIER(
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ )
+ raise InternalError("Raw enum value doesn't match any cases")
+
+ @staticmethod
+ def check_lower(value):
+ if value.is_LINEAR():
+ return
+ if value.is_MIN_JERK():
+ return
+ if value.is_SMOOTHERSTEP():
+ return
+ if value.is_IN_OUT_CUBIC():
+ return
+ if value.is_IN_OUT_SINE():
+ return
+ if value.is_OUT_CUBIC():
+ return
+ if value.is_CUBIC_BEZIER():
+ _UniffiFfiConverterFloat64.check_lower(value.x1)
+ _UniffiFfiConverterFloat64.check_lower(value.y1)
+ _UniffiFfiConverterFloat64.check_lower(value.x2)
+ _UniffiFfiConverterFloat64.check_lower(value.y2)
+ return
+ raise ValueError(value)
+
+ @staticmethod
+ def write(value, buf):
+ if value.is_LINEAR():
+ buf.write_i32(1)
+ if value.is_MIN_JERK():
+ buf.write_i32(2)
+ if value.is_SMOOTHERSTEP():
+ buf.write_i32(3)
+ if value.is_IN_OUT_CUBIC():
+ buf.write_i32(4)
+ if value.is_IN_OUT_SINE():
+ buf.write_i32(5)
+ if value.is_OUT_CUBIC():
+ buf.write_i32(6)
+ if value.is_CUBIC_BEZIER():
+ buf.write_i32(7)
+ _UniffiFfiConverterFloat64.write(value.x1, buf)
+ _UniffiFfiConverterFloat64.write(value.y1, buf)
+ _UniffiFfiConverterFloat64.write(value.x2, buf)
+ _UniffiFfiConverterFloat64.write(value.y2, buf)
+
+
+
+
+
+
+
+
+class CursorSettle:
+ """
+ Overshoot or settle at the end of the glide.
+"""
+ def __init__(self):
+ raise RuntimeError("CursorSettle cannot be instantiated directly")
+
+ # Each enum variant is a nested class of the enum itself.
+ @dataclass
+ class NONE:
+
+ def __init__(self, ):
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorSettle.NONE()".format()
+ def __eq__(self, other):
+ if not isinstance(other, CursorSettle):
+ return NotImplemented
+ if not other.is_NONE():
+ return False
+ return True
+
+ @dataclass
+ class FOLLOW_THROUGH:
+
+ def __init__(self, amount:float, max_pt:float, at:float):
+ self.amount = amount
+
+
+ self.max_pt = max_pt
+
+
+ self.at = at
+
+
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorSettle.FOLLOW_THROUGH(amount={}, max_pt={}, at={})".format(self.amount, self.max_pt, self.at)
+ def __eq__(self, other):
+ if not isinstance(other, CursorSettle):
+ return NotImplemented
+ if not other.is_FOLLOW_THROUGH():
+ return False
+ if self.amount != other.amount:
+ return False
+ if self.max_pt != other.max_pt:
+ return False
+ if self.at != other.at:
+ return False
+ return True
+
+ @dataclass
+ class SPRING:
+
+ def __init__(self, amount:float, max_pt:float, cycles:float, decay:float, start:float, glide_end:float):
+ self.amount = amount
+
+
+ self.max_pt = max_pt
+
+
+ self.cycles = cycles
+
+
+ self.decay = decay
+
+
+ self.start = start
+
+
+ self.glide_end = glide_end
+
+
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorSettle.SPRING(amount={}, max_pt={}, cycles={}, decay={}, start={}, glide_end={})".format(self.amount, self.max_pt, self.cycles, self.decay, self.start, self.glide_end)
+ def __eq__(self, other):
+ if not isinstance(other, CursorSettle):
+ return NotImplemented
+ if not other.is_SPRING():
+ return False
+ if self.amount != other.amount:
+ return False
+ if self.max_pt != other.max_pt:
+ return False
+ if self.cycles != other.cycles:
+ return False
+ if self.decay != other.decay:
+ return False
+ if self.start != other.start:
+ return False
+ if self.glide_end != other.glide_end:
+ return False
+ return True
+
+
+
+ # For each variant, we have `is_NAME` and `is_name` methods for easily checking
+ # whether an instance is that variant.
+ def is_NONE(self) -> bool:
+ return isinstance(self, CursorSettle.NONE)
+ def is_none(self) -> bool:
+ return isinstance(self, CursorSettle.NONE)
+ def is_FOLLOW_THROUGH(self) -> bool:
+ return isinstance(self, CursorSettle.FOLLOW_THROUGH)
+ def is_follow_through(self) -> bool:
+ return isinstance(self, CursorSettle.FOLLOW_THROUGH)
+ def is_SPRING(self) -> bool:
+ return isinstance(self, CursorSettle.SPRING)
+ def is_spring(self) -> bool:
+ return isinstance(self, CursorSettle.SPRING)
+
+
+# Now, a little trick - we make each nested variant class be a subclass of the main
+# enum class, so that method calls and instance checks etc will work intuitively.
+# We might be able to do this a little more neatly with a metaclass, but this'll do.
+CursorSettle.NONE = type("CursorSettle.NONE", (CursorSettle.NONE, CursorSettle,), {}) # type: ignore
+CursorSettle.FOLLOW_THROUGH = type("CursorSettle.FOLLOW_THROUGH", (CursorSettle.FOLLOW_THROUGH, CursorSettle,), {}) # type: ignore
+CursorSettle.SPRING = type("CursorSettle.SPRING", (CursorSettle.SPRING, CursorSettle,), {}) # type: ignore
+
+
+
+
+class _UniffiFfiConverterTypeCursorSettle(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ variant = buf.read_i32()
+ if variant == 1:
+ return CursorSettle.NONE(
+ )
+ if variant == 2:
+ return CursorSettle.FOLLOW_THROUGH(
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ )
+ if variant == 3:
+ return CursorSettle.SPRING(
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ )
+ raise InternalError("Raw enum value doesn't match any cases")
+
+ @staticmethod
+ def check_lower(value):
+ if value.is_NONE():
+ return
+ if value.is_FOLLOW_THROUGH():
+ _UniffiFfiConverterFloat64.check_lower(value.amount)
+ _UniffiFfiConverterFloat64.check_lower(value.max_pt)
+ _UniffiFfiConverterFloat64.check_lower(value.at)
+ return
+ if value.is_SPRING():
+ _UniffiFfiConverterFloat64.check_lower(value.amount)
+ _UniffiFfiConverterFloat64.check_lower(value.max_pt)
+ _UniffiFfiConverterFloat64.check_lower(value.cycles)
+ _UniffiFfiConverterFloat64.check_lower(value.decay)
+ _UniffiFfiConverterFloat64.check_lower(value.start)
+ _UniffiFfiConverterFloat64.check_lower(value.glide_end)
+ return
+ raise ValueError(value)
+
+ @staticmethod
+ def write(value, buf):
+ if value.is_NONE():
+ buf.write_i32(1)
+ if value.is_FOLLOW_THROUGH():
+ buf.write_i32(2)
+ _UniffiFfiConverterFloat64.write(value.amount, buf)
+ _UniffiFfiConverterFloat64.write(value.max_pt, buf)
+ _UniffiFfiConverterFloat64.write(value.at, buf)
+ if value.is_SPRING():
+ buf.write_i32(3)
+ _UniffiFfiConverterFloat64.write(value.amount, buf)
+ _UniffiFfiConverterFloat64.write(value.max_pt, buf)
+ _UniffiFfiConverterFloat64.write(value.cycles, buf)
+ _UniffiFfiConverterFloat64.write(value.decay, buf)
+ _UniffiFfiConverterFloat64.write(value.start, buf)
+ _UniffiFfiConverterFloat64.write(value.glide_end, buf)
+
+
+
+
+
+
+
+
+class CursorMotionDuration:
+ """
+ Duration model of a custom motion.
+"""
+ def __init__(self):
+ raise RuntimeError("CursorMotionDuration cannot be instantiated directly")
+
+ # Each enum variant is a nested class of the enum itself.
+ @dataclass
+ class FIXED:
+
+ def __init__(self, ms:float):
+ self.ms = ms
+
+
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorMotionDuration.FIXED(ms={})".format(self.ms)
+ def __eq__(self, other):
+ if not isinstance(other, CursorMotionDuration):
+ return NotImplemented
+ if not other.is_FIXED():
+ return False
+ if self.ms != other.ms:
+ return False
+ return True
+
+ @dataclass
+ class FITTS:
+
+ def __init__(self, a:float, b:float, min_ms:float, max_ms:float, scale:float):
+ self.a = a
+
+
+ self.b = b
+
+
+ self.min_ms = min_ms
+
+
+ self.max_ms = max_ms
+
+
+ self.scale = scale
+
+
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorMotionDuration.FITTS(a={}, b={}, min_ms={}, max_ms={}, scale={})".format(self.a, self.b, self.min_ms, self.max_ms, self.scale)
+ def __eq__(self, other):
+ if not isinstance(other, CursorMotionDuration):
+ return NotImplemented
+ if not other.is_FITTS():
+ return False
+ if self.a != other.a:
+ return False
+ if self.b != other.b:
+ return False
+ if self.min_ms != other.min_ms:
+ return False
+ if self.max_ms != other.max_ms:
+ return False
+ if self.scale != other.scale:
+ return False
+ return True
+
+ @dataclass
+ class DISTANCE:
+
+ def __init__(self, base_ms:float, ms_per_pt:float, min_ms:float, max_ms:float):
+ self.base_ms = base_ms
+
+
+ self.ms_per_pt = ms_per_pt
+
+
+ self.min_ms = min_ms
+
+
+ self.max_ms = max_ms
+
+
+ pass
+
+
+
+
+
+ def __str__(self):
+ return "CursorMotionDuration.DISTANCE(base_ms={}, ms_per_pt={}, min_ms={}, max_ms={})".format(self.base_ms, self.ms_per_pt, self.min_ms, self.max_ms)
+ def __eq__(self, other):
+ if not isinstance(other, CursorMotionDuration):
+ return NotImplemented
+ if not other.is_DISTANCE():
+ return False
+ if self.base_ms != other.base_ms:
+ return False
+ if self.ms_per_pt != other.ms_per_pt:
+ return False
+ if self.min_ms != other.min_ms:
+ return False
+ if self.max_ms != other.max_ms:
+ return False
+ return True
+
+
+
+ # For each variant, we have `is_NAME` and `is_name` methods for easily checking
+ # whether an instance is that variant.
+ def is_FIXED(self) -> bool:
+ return isinstance(self, CursorMotionDuration.FIXED)
+ def is_fixed(self) -> bool:
+ return isinstance(self, CursorMotionDuration.FIXED)
+ def is_FITTS(self) -> bool:
+ return isinstance(self, CursorMotionDuration.FITTS)
+ def is_fitts(self) -> bool:
+ return isinstance(self, CursorMotionDuration.FITTS)
+ def is_DISTANCE(self) -> bool:
+ return isinstance(self, CursorMotionDuration.DISTANCE)
+ def is_distance(self) -> bool:
+ return isinstance(self, CursorMotionDuration.DISTANCE)
+
+
+# Now, a little trick - we make each nested variant class be a subclass of the main
+# enum class, so that method calls and instance checks etc will work intuitively.
+# We might be able to do this a little more neatly with a metaclass, but this'll do.
+CursorMotionDuration.FIXED = type("CursorMotionDuration.FIXED", (CursorMotionDuration.FIXED, CursorMotionDuration,), {}) # type: ignore
+CursorMotionDuration.FITTS = type("CursorMotionDuration.FITTS", (CursorMotionDuration.FITTS, CursorMotionDuration,), {}) # type: ignore
+CursorMotionDuration.DISTANCE = type("CursorMotionDuration.DISTANCE", (CursorMotionDuration.DISTANCE, CursorMotionDuration,), {}) # type: ignore
+
+
+
+
+class _UniffiFfiConverterTypeCursorMotionDuration(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ variant = buf.read_i32()
+ if variant == 1:
+ return CursorMotionDuration.FIXED(
+ _UniffiFfiConverterFloat64.read(buf),
+ )
+ if variant == 2:
+ return CursorMotionDuration.FITTS(
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ )
+ if variant == 3:
+ return CursorMotionDuration.DISTANCE(
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ _UniffiFfiConverterFloat64.read(buf),
+ )
+ raise InternalError("Raw enum value doesn't match any cases")
+
+ @staticmethod
+ def check_lower(value):
+ if value.is_FIXED():
+ _UniffiFfiConverterFloat64.check_lower(value.ms)
+ return
+ if value.is_FITTS():
+ _UniffiFfiConverterFloat64.check_lower(value.a)
+ _UniffiFfiConverterFloat64.check_lower(value.b)
+ _UniffiFfiConverterFloat64.check_lower(value.min_ms)
+ _UniffiFfiConverterFloat64.check_lower(value.max_ms)
+ _UniffiFfiConverterFloat64.check_lower(value.scale)
+ return
+ if value.is_DISTANCE():
+ _UniffiFfiConverterFloat64.check_lower(value.base_ms)
+ _UniffiFfiConverterFloat64.check_lower(value.ms_per_pt)
+ _UniffiFfiConverterFloat64.check_lower(value.min_ms)
+ _UniffiFfiConverterFloat64.check_lower(value.max_ms)
+ return
+ raise ValueError(value)
+
+ @staticmethod
+ def write(value, buf):
+ if value.is_FIXED():
+ buf.write_i32(1)
+ _UniffiFfiConverterFloat64.write(value.ms, buf)
+ if value.is_FITTS():
+ buf.write_i32(2)
+ _UniffiFfiConverterFloat64.write(value.a, buf)
+ _UniffiFfiConverterFloat64.write(value.b, buf)
+ _UniffiFfiConverterFloat64.write(value.min_ms, buf)
+ _UniffiFfiConverterFloat64.write(value.max_ms, buf)
+ _UniffiFfiConverterFloat64.write(value.scale, buf)
+ if value.is_DISTANCE():
+ buf.write_i32(3)
+ _UniffiFfiConverterFloat64.write(value.base_ms, buf)
+ _UniffiFfiConverterFloat64.write(value.ms_per_pt, buf)
+ _UniffiFfiConverterFloat64.write(value.min_ms, buf)
+ _UniffiFfiConverterFloat64.write(value.max_ms, buf)
+
+
+
+
+
+
+
+
+class CursorHeading(enum.Enum):
+ """
+ `Tangent`: the tip leads the motion. `Fixed`: the rest pose.
+"""
+
+ TANGENT = 0
+
+ FIXED = 1
+
+
+
+class _UniffiFfiConverterTypeCursorHeading(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ variant = buf.read_i32()
+ if variant == 1:
+ return CursorHeading.TANGENT
+ if variant == 2:
+ return CursorHeading.FIXED
+ raise InternalError("Raw enum value doesn't match any cases")
+
+ @staticmethod
+ def check_lower(value):
+ if value == CursorHeading.TANGENT:
+ return
+ if value == CursorHeading.FIXED:
+ return
+ raise ValueError(value)
+
+ @staticmethod
+ def write(value, buf):
+ if value == CursorHeading.TANGENT:
+ buf.write_i32(1)
+ if value == CursorHeading.FIXED:
+ buf.write_i32(2)
+
+
+
+
+
+class _UniffiFfiConverterUInt32(_UniffiConverterPrimitiveInt):
+ CLASS_NAME = "u32"
+ VALUE_MIN = 0
+ VALUE_MAX = 2**32
+
+ @staticmethod
+ def read(buf):
+ return buf.read_u32()
+
+ @staticmethod
+ def write(value, buf):
+ buf.write_u32(value)
+
+@dataclass
+class CursorTrailSpec:
+ """
+ The comet trail.
+"""
+ def __init__(self, *, secs:float, fade_len:float, steps:int, tail_width:float, head_width:float, alpha:float, anchor_offset:float):
+ self.secs = secs
+ self.fade_len = fade_len
+ self.steps = steps
+ self.tail_width = tail_width
+ self.head_width = head_width
+ self.alpha = alpha
+ self.anchor_offset = anchor_offset
+
+
+
+
+ def __str__(self):
+ return "CursorTrailSpec(secs={}, fade_len={}, steps={}, tail_width={}, head_width={}, alpha={}, anchor_offset={})".format(self.secs, self.fade_len, self.steps, self.tail_width, self.head_width, self.alpha, self.anchor_offset)
+ def __eq__(self, other):
+ if self.secs != other.secs:
+ return False
+ if self.fade_len != other.fade_len:
+ return False
+ if self.steps != other.steps:
+ return False
+ if self.tail_width != other.tail_width:
+ return False
+ if self.head_width != other.head_width:
+ return False
+ if self.alpha != other.alpha:
+ return False
+ if self.anchor_offset != other.anchor_offset:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCursorTrailSpec(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CursorTrailSpec(
+ secs=_UniffiFfiConverterFloat64.read(buf),
+ fade_len=_UniffiFfiConverterFloat64.read(buf),
+ steps=_UniffiFfiConverterUInt32.read(buf),
+ tail_width=_UniffiFfiConverterFloat64.read(buf),
+ head_width=_UniffiFfiConverterFloat64.read(buf),
+ alpha=_UniffiFfiConverterFloat64.read(buf),
+ anchor_offset=_UniffiFfiConverterFloat64.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterFloat64.check_lower(value.secs)
+ _UniffiFfiConverterFloat64.check_lower(value.fade_len)
+ _UniffiFfiConverterUInt32.check_lower(value.steps)
+ _UniffiFfiConverterFloat64.check_lower(value.tail_width)
+ _UniffiFfiConverterFloat64.check_lower(value.head_width)
+ _UniffiFfiConverterFloat64.check_lower(value.alpha)
+ _UniffiFfiConverterFloat64.check_lower(value.anchor_offset)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterFloat64.write(value.secs, buf)
+ _UniffiFfiConverterFloat64.write(value.fade_len, buf)
+ _UniffiFfiConverterUInt32.write(value.steps, buf)
+ _UniffiFfiConverterFloat64.write(value.tail_width, buf)
+ _UniffiFfiConverterFloat64.write(value.head_width, buf)
+ _UniffiFfiConverterFloat64.write(value.alpha, buf)
+ _UniffiFfiConverterFloat64.write(value.anchor_offset, buf)
+
+@dataclass
+class CursorMotionSpec:
+ """
+ A complete custom motion.
+"""
+ def __init__(self, *, path:CursorPathShape, ease:CursorEase, settle:CursorSettle, duration:CursorMotionDuration, heading:CursorHeading, effects:cua_driver._native_contract.CursorMotionEffectsOutput, trail:CursorTrailSpec):
+ self.path = path
+ self.ease = ease
+ self.settle = settle
+ self.duration = duration
+ self.heading = heading
+ self.effects = effects
+ self.trail = trail
+
+
+
+
+ def __str__(self):
+ return "CursorMotionSpec(path={}, ease={}, settle={}, duration={}, heading={}, effects={}, trail={})".format(self.path, self.ease, self.settle, self.duration, self.heading, self.effects, self.trail)
+ def __eq__(self, other):
+ if self.path != other.path:
+ return False
+ if self.ease != other.ease:
+ return False
+ if self.settle != other.settle:
+ return False
+ if self.duration != other.duration:
+ return False
+ if self.heading != other.heading:
+ return False
+ if self.effects != other.effects:
+ return False
+ if self.trail != other.trail:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCursorMotionSpec(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CursorMotionSpec(
+ path=_UniffiFfiConverterTypeCursorPathShape.read(buf),
+ ease=_UniffiFfiConverterTypeCursorEase.read(buf),
+ settle=_UniffiFfiConverterTypeCursorSettle.read(buf),
+ duration=_UniffiFfiConverterTypeCursorMotionDuration.read(buf),
+ heading=_UniffiFfiConverterTypeCursorHeading.read(buf),
+ effects=cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionEffectsOutput.read(buf),
+ trail=_UniffiFfiConverterTypeCursorTrailSpec.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterTypeCursorPathShape.check_lower(value.path)
+ _UniffiFfiConverterTypeCursorEase.check_lower(value.ease)
+ _UniffiFfiConverterTypeCursorSettle.check_lower(value.settle)
+ _UniffiFfiConverterTypeCursorMotionDuration.check_lower(value.duration)
+ _UniffiFfiConverterTypeCursorHeading.check_lower(value.heading)
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionEffectsOutput.check_lower(value.effects)
+ _UniffiFfiConverterTypeCursorTrailSpec.check_lower(value.trail)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterTypeCursorPathShape.write(value.path, buf)
+ _UniffiFfiConverterTypeCursorEase.write(value.ease, buf)
+ _UniffiFfiConverterTypeCursorSettle.write(value.settle, buf)
+ _UniffiFfiConverterTypeCursorMotionDuration.write(value.duration, buf)
+ _UniffiFfiConverterTypeCursorHeading.write(value.heading, buf)
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionEffectsOutput.write(value.effects, buf)
+ _UniffiFfiConverterTypeCursorTrailSpec.write(value.trail, buf)
+
+class _UniffiFfiConverterOptionalFloat64(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ if value is not None:
+ _UniffiFfiConverterFloat64.check_lower(value)
+
+ @classmethod
+ def write(cls, value, buf):
+ if value is None:
+ buf.write_u8(0)
+ return
+
+ buf.write_u8(1)
+ _UniffiFfiConverterFloat64.write(value, buf)
+
+ @classmethod
+ def read(cls, buf):
+ flag = buf.read_u8()
+ if flag == 0:
+ return None
+ elif flag == 1:
+ return _UniffiFfiConverterFloat64.read(buf)
+ else:
+ raise InternalError("Unexpected flag byte for optional type")
+
+class _UniffiFfiConverterOptionalTypeCursorMotionRect(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ if value is not None:
+ _UniffiFfiConverterTypeCursorMotionRect.check_lower(value)
+
+ @classmethod
+ def write(cls, value, buf):
+ if value is None:
+ buf.write_u8(0)
+ return
+
+ buf.write_u8(1)
+ _UniffiFfiConverterTypeCursorMotionRect.write(value, buf)
+
+ @classmethod
+ def read(cls, buf):
+ flag = buf.read_u8()
+ if flag == 0:
+ return None
+ elif flag == 1:
+ return _UniffiFfiConverterTypeCursorMotionRect.read(buf)
+ else:
+ raise InternalError("Unexpected flag byte for optional type")
+
+@dataclass
+class CursorMoveRequest:
+ """
+ One move to plan.
+"""
+ def __init__(self, *, from_point:CursorMotionPoint, to_point:CursorMotionPoint, from_heading:typing.Optional[float], end_heading:typing.Optional[float], target:typing.Optional[CursorMotionRect], seed:str, reduced_motion:bool):
+ self.from_point = from_point
+ self.to_point = to_point
+ self.from_heading = from_heading
+ self.end_heading = end_heading
+ self.target = target
+ self.seed = seed
+ self.reduced_motion = reduced_motion
+
+
+
+
+ def __str__(self):
+ return "CursorMoveRequest(from_point={}, to_point={}, from_heading={}, end_heading={}, target={}, seed={}, reduced_motion={})".format(self.from_point, self.to_point, self.from_heading, self.end_heading, self.target, self.seed, self.reduced_motion)
+ def __eq__(self, other):
+ if self.from_point != other.from_point:
+ return False
+ if self.to_point != other.to_point:
+ return False
+ if self.from_heading != other.from_heading:
+ return False
+ if self.end_heading != other.end_heading:
+ return False
+ if self.target != other.target:
+ return False
+ if self.seed != other.seed:
+ return False
+ if self.reduced_motion != other.reduced_motion:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCursorMoveRequest(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CursorMoveRequest(
+ from_point=_UniffiFfiConverterTypeCursorMotionPoint.read(buf),
+ to_point=_UniffiFfiConverterTypeCursorMotionPoint.read(buf),
+ from_heading=_UniffiFfiConverterOptionalFloat64.read(buf),
+ end_heading=_UniffiFfiConverterOptionalFloat64.read(buf),
+ target=_UniffiFfiConverterOptionalTypeCursorMotionRect.read(buf),
+ seed=_UniffiFfiConverterString.read(buf),
+ reduced_motion=_UniffiFfiConverterBoolean.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterTypeCursorMotionPoint.check_lower(value.from_point)
+ _UniffiFfiConverterTypeCursorMotionPoint.check_lower(value.to_point)
+ _UniffiFfiConverterOptionalFloat64.check_lower(value.from_heading)
+ _UniffiFfiConverterOptionalFloat64.check_lower(value.end_heading)
+ _UniffiFfiConverterOptionalTypeCursorMotionRect.check_lower(value.target)
+ _UniffiFfiConverterString.check_lower(value.seed)
+ _UniffiFfiConverterBoolean.check_lower(value.reduced_motion)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterTypeCursorMotionPoint.write(value.from_point, buf)
+ _UniffiFfiConverterTypeCursorMotionPoint.write(value.to_point, buf)
+ _UniffiFfiConverterOptionalFloat64.write(value.from_heading, buf)
+ _UniffiFfiConverterOptionalFloat64.write(value.end_heading, buf)
+ _UniffiFfiConverterOptionalTypeCursorMotionRect.write(value.target, buf)
+ _UniffiFfiConverterString.write(value.seed, buf)
+ _UniffiFfiConverterBoolean.write(value.reduced_motion, buf)
+
+
+
+
+
+
+class DriverActivityKind(enum.Enum):
+
+ AUTHORIZED_ACTION = 0
+
+ AUTHORIZATION_REFUSED = 1
+
+ ACTION_FAILED = 2
+
+ GRANT_ISSUED = 3
+
+ GRANT_REVOKED = 4
+
+ SESSION_STARTED = 5
+
+ SESSION_ENDED = 6
+
+
+
+class _UniffiFfiConverterTypeDriverActivityKind(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ variant = buf.read_i32()
+ if variant == 1:
+ return DriverActivityKind.AUTHORIZED_ACTION
+ if variant == 2:
+ return DriverActivityKind.AUTHORIZATION_REFUSED
+ if variant == 3:
+ return DriverActivityKind.ACTION_FAILED
+ if variant == 4:
+ return DriverActivityKind.GRANT_ISSUED
+ if variant == 5:
+ return DriverActivityKind.GRANT_REVOKED
+ if variant == 6:
+ return DriverActivityKind.SESSION_STARTED
+ if variant == 7:
+ return DriverActivityKind.SESSION_ENDED
+ raise InternalError("Raw enum value doesn't match any cases")
+
+ @staticmethod
+ def check_lower(value):
+ if value == DriverActivityKind.AUTHORIZED_ACTION:
+ return
+ if value == DriverActivityKind.AUTHORIZATION_REFUSED:
+ return
+ if value == DriverActivityKind.ACTION_FAILED:
+ return
+ if value == DriverActivityKind.GRANT_ISSUED:
+ return
+ if value == DriverActivityKind.GRANT_REVOKED:
+ return
+ if value == DriverActivityKind.SESSION_STARTED:
+ return
+ if value == DriverActivityKind.SESSION_ENDED:
+ return
+ raise ValueError(value)
+
+ @staticmethod
+ def write(value, buf):
+ if value == DriverActivityKind.AUTHORIZED_ACTION:
+ buf.write_i32(1)
+ if value == DriverActivityKind.AUTHORIZATION_REFUSED:
+ buf.write_i32(2)
+ if value == DriverActivityKind.ACTION_FAILED:
+ buf.write_i32(3)
+ if value == DriverActivityKind.GRANT_ISSUED:
+ buf.write_i32(4)
+ if value == DriverActivityKind.GRANT_REVOKED:
+ buf.write_i32(5)
+ if value == DriverActivityKind.SESSION_STARTED:
+ buf.write_i32(6)
+ if value == DriverActivityKind.SESSION_ENDED:
+ buf.write_i32(7)
+
+
+
+class _UniffiFfiConverterSequenceString(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ for item in value:
+ _UniffiFfiConverterString.check_lower(item)
+
+ @classmethod
+ def write(cls, value, buf):
+ items = len(value)
+ buf.write_i32(items)
+ for item in value:
+ _UniffiFfiConverterString.write(item, buf)
+
+ @classmethod
+ def read(cls, buf):
+ count = buf.read_i32()
+ if count < 0:
+ raise InternalError("Unexpected negative sequence length")
+
+ return [
+ _UniffiFfiConverterString.read(buf) for i in range(count)
+ ]
+
+@dataclass
+class DriverActivityEvent:
+ """
+ A content-free lifecycle event emitted after native authorization decides
+ a call. It never carries arguments, page text, paths, typed input, images,
+ or raw resource identities.
+"""
+ def __init__(self, *, kind:DriverActivityKind, unix_ms:int, tool_name:str, adapter_ids:typing.List[str], risk_class:str, public_session:typing.Optional[str], refusal_code:typing.Optional[str]):
+ self.kind = kind
+ self.unix_ms = unix_ms
+ self.tool_name = tool_name
+ self.adapter_ids = adapter_ids
+ self.risk_class = risk_class
+ self.public_session = public_session
+ self.refusal_code = refusal_code
+
+
+
+
+ def __str__(self):
+ return "DriverActivityEvent(kind={}, unix_ms={}, tool_name={}, adapter_ids={}, risk_class={}, public_session={}, refusal_code={})".format(self.kind, self.unix_ms, self.tool_name, self.adapter_ids, self.risk_class, self.public_session, self.refusal_code)
+ def __eq__(self, other):
+ if self.kind != other.kind:
+ return False
+ if self.unix_ms != other.unix_ms:
+ return False
+ if self.tool_name != other.tool_name:
+ return False
+ if self.adapter_ids != other.adapter_ids:
+ return False
+ if self.risk_class != other.risk_class:
+ return False
+ if self.public_session != other.public_session:
+ return False
+ if self.refusal_code != other.refusal_code:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeDriverActivityEvent(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return DriverActivityEvent(
+ kind=_UniffiFfiConverterTypeDriverActivityKind.read(buf),
+ unix_ms=_UniffiFfiConverterUInt64.read(buf),
+ tool_name=_UniffiFfiConverterString.read(buf),
+ adapter_ids=_UniffiFfiConverterSequenceString.read(buf),
+ risk_class=_UniffiFfiConverterString.read(buf),
+ public_session=_UniffiFfiConverterOptionalString.read(buf),
+ refusal_code=_UniffiFfiConverterOptionalString.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterTypeDriverActivityKind.check_lower(value.kind)
+ _UniffiFfiConverterUInt64.check_lower(value.unix_ms)
+ _UniffiFfiConverterString.check_lower(value.tool_name)
+ _UniffiFfiConverterSequenceString.check_lower(value.adapter_ids)
+ _UniffiFfiConverterString.check_lower(value.risk_class)
+ _UniffiFfiConverterOptionalString.check_lower(value.public_session)
+ _UniffiFfiConverterOptionalString.check_lower(value.refusal_code)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterTypeDriverActivityKind.write(value.kind, buf)
+ _UniffiFfiConverterUInt64.write(value.unix_ms, buf)
+ _UniffiFfiConverterString.write(value.tool_name, buf)
+ _UniffiFfiConverterSequenceString.write(value.adapter_ids, buf)
+ _UniffiFfiConverterString.write(value.risk_class, buf)
+ _UniffiFfiConverterOptionalString.write(value.public_session, buf)
+ _UniffiFfiConverterOptionalString.write(value.refusal_code, buf)
+
+
+
+
+
+
+class DriverAuthorizationAction(enum.Enum):
+
+ ALLOW = 0
DENY = 1
@@ -2869,19 +4869,6 @@ class _UniffiFfiConverterTypeDriverAuthorizationRequest(_UniffiConverterRustBuff
_UniffiFfiConverterUInt64.write(value.expires_unix_ms, buf)
_UniffiFfiConverterString.write(value.request_digest, buf)
-class _UniffiFfiConverterUInt32(_UniffiConverterPrimitiveInt):
- CLASS_NAME = "u32"
- VALUE_MIN = 0
- VALUE_MAX = 2**32
-
- @staticmethod
- def read(buf):
- return buf.read_u32()
-
- @staticmethod
- def write(value, buf):
- buf.write_u32(value)
-
@dataclass
class DriverMetadata:
"""
@@ -6887,459 +8874,745 @@ class CuaDriverSession(CuaDriverSessionProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def end_session(self, input: cua_driver._native_contract.EndSessionInput) -> cua_driver._native_contract.EndSessionOutput:
+ async def end_session(self, input: cua_driver._native_contract.EndSessionInput) -> cua_driver._native_contract.EndSessionOutput:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeEndSessionInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeEndSessionInput.lower(input),
+ )
+ _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeEndSessionOutput.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_end_session(*_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 escalate_session(self, input: cua_driver._native_contract.EscalateSessionInput) -> cua_driver._native_contract.SessionStateOutput:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeEscalateSessionInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeEscalateSessionInput.lower(input),
+ )
+ _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeSessionStateOutput.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_escalate_session(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
+ async def get_agent_cursor_state(self, input: cua_driver._native_contract.GetAgentCursorStateInput) -> ToolResult:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeGetAgentCursorStateInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeGetAgentCursorStateInput.lower(input),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_agent_cursor_state(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
+ async def get_cursor_position(self, input: cua_driver._native_contract.GetCursorPositionInput) -> ToolResult:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeGetCursorPositionInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeGetCursorPositionInput.lower(input),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_cursor_position(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
+ async def get_desktop_state(self, input: cua_driver._native_contract.GetDesktopStateInput) -> ToolResult:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeGetDesktopStateInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeGetDesktopStateInput.lower(input),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_desktop_state(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
+ async def get_screen_size(self, input: cua_driver._native_contract.GetScreenSizeInput) -> ToolResult:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeGetScreenSizeInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeGetScreenSizeInput.lower(input),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_screen_size(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
+ async def get_session(self, input: cua_driver._native_contract.GetSessionInput) -> cua_driver._native_contract.SessionOutput:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeGetSessionInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeGetSessionInput.lower(input),
+ )
+ _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeSessionOutput.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_session(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
+ async def get_session_state(self, input: cua_driver._native_contract.GetSessionStateInput) -> cua_driver._native_contract.SessionStateOutput:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeGetSessionStateInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeGetSessionStateInput.lower(input),
+ )
+ _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeSessionStateOutput.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_session_state(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
+ async def get_window_state(self, input: cua_driver._native_contract.GetWindowStateInput) -> cua_driver._native_contract.WindowStateOutput:
+
+ cua_driver._native_contract._UniffiFfiConverterTypeGetWindowStateInput.check_lower(input)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ cua_driver._native_contract._UniffiFfiConverterTypeGetWindowStateInput.lower(input),
+ )
+ _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeWindowStateOutput.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_window_state(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
+ async def hotkey(self, input: cua_driver._native_contract.HotkeyInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeEndSessionInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeHotkeyInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeEndSessionInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeHotkeyInput.lower(input),
)
- _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeEndSessionOutput.lift
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_end_session(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_hotkey(*_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 escalate_session(self, input: cua_driver._native_contract.EscalateSessionInput) -> cua_driver._native_contract.SessionStateOutput:
+ async def invoke_menu(self, input: cua_driver._native_contract.InvokeMenuInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeEscalateSessionInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeInvokeMenuInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeEscalateSessionInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeInvokeMenuInput.lower(input),
)
- _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeSessionStateOutput.lift
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_escalate_session(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_invoke_menu(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def get_agent_cursor_state(self, input: cua_driver._native_contract.GetAgentCursorStateInput) -> ToolResult:
+ async def list_apps(self, input: cua_driver._native_contract.ListAppsInput) -> cua_driver._native_contract.ListAppsOutput:
- cua_driver._native_contract._UniffiFfiConverterTypeGetAgentCursorStateInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeListAppsInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeGetAgentCursorStateInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeListAppsInput.lower(input),
)
- _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
+ _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeListAppsOutput.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_agent_cursor_state(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_list_apps(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def get_cursor_position(self, input: cua_driver._native_contract.GetCursorPositionInput) -> ToolResult:
+ async def list_sessions(self, input: cua_driver._native_contract.ListSessionsInput) -> cua_driver._native_contract.ListSessionsOutput:
- cua_driver._native_contract._UniffiFfiConverterTypeGetCursorPositionInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeListSessionsInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeGetCursorPositionInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeListSessionsInput.lower(input),
)
- _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
+ _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeListSessionsOutput.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_cursor_position(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_list_sessions(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def get_desktop_state(self, input: cua_driver._native_contract.GetDesktopStateInput) -> ToolResult:
+ async def list_windows(self, input: cua_driver._native_contract.ListWindowsInput) -> cua_driver._native_contract.ListWindowsOutput:
- cua_driver._native_contract._UniffiFfiConverterTypeGetDesktopStateInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeListWindowsInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeGetDesktopStateInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeListWindowsInput.lower(input),
)
- _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
+ _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeListWindowsOutput.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_desktop_state(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_list_windows(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def get_screen_size(self, input: cua_driver._native_contract.GetScreenSizeInput) -> ToolResult:
+ async def move_cursor(self, input: cua_driver._native_contract.MoveCursorInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeGetScreenSizeInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeMoveCursorInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeGetScreenSizeInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeMoveCursorInput.lower(input),
)
_uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_screen_size(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_move_cursor(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def get_session(self, input: cua_driver._native_contract.GetSessionInput) -> cua_driver._native_contract.SessionOutput:
+ async def parse_visual_regions(self, input: cua_driver._native_contract.ParseVisualRegionsInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeGetSessionInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeParseVisualRegionsInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeGetSessionInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeParseVisualRegionsInput.lower(input),
)
- _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeSessionOutput.lift
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_session(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_parse_visual_regions(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def get_session_state(self, input: cua_driver._native_contract.GetSessionStateInput) -> cua_driver._native_contract.SessionStateOutput:
+ async def press_key(self, input: cua_driver._native_contract.PressKeyInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeGetSessionStateInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypePressKeyInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeGetSessionStateInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypePressKeyInput.lower(input),
)
- _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeSessionStateOutput.lift
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_session_state(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_press_key(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def get_window_state(self, input: cua_driver._native_contract.GetWindowStateInput) -> cua_driver._native_contract.WindowStateOutput:
+ async def scroll(self, input: cua_driver._native_contract.ScrollInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeGetWindowStateInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeScrollInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeGetWindowStateInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeScrollInput.lower(input),
)
- _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeWindowStateOutput.lift
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_get_window_state(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_scroll(*_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 hotkey(self, input: cua_driver._native_contract.HotkeyInput) -> ToolResult:
+ async def set_agent_cursor_enabled(self, input: cua_driver._native_contract.SetAgentCursorEnabledInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeHotkeyInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorEnabledInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeHotkeyInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorEnabledInput.lower(input),
)
_uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_hotkey(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_enabled(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def invoke_menu(self, input: cua_driver._native_contract.InvokeMenuInput) -> ToolResult:
+ async def set_agent_cursor_motion(self, input: cua_driver._native_contract.SetAgentCursorMotionInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeInvokeMenuInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorMotionInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeInvokeMenuInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorMotionInput.lower(input),
)
_uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_invoke_menu(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_motion(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def list_apps(self, input: cua_driver._native_contract.ListAppsInput) -> cua_driver._native_contract.ListAppsOutput:
+ async def set_agent_cursor_theme(self, input: cua_driver._native_contract.SetAgentCursorThemeInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeListAppsInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorThemeInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeListAppsInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorThemeInput.lower(input),
)
- _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeListAppsOutput.lift
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_list_apps(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_theme(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def list_sessions(self, input: cua_driver._native_contract.ListSessionsInput) -> cua_driver._native_contract.ListSessionsOutput:
+ async def set_window_frame(self, input: cua_driver._native_contract.SetWindowFrameInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeListSessionsInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeSetWindowFrameInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeListSessionsInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeSetWindowFrameInput.lower(input),
)
- _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeListSessionsOutput.lift
+ _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_list_sessions(*_uniffi_lowered_args),
+ _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 list_windows(self, input: cua_driver._native_contract.ListWindowsInput) -> cua_driver._native_contract.ListWindowsOutput:
+ async def start_session(self, input: cua_driver._native_contract.StartSessionInput) -> cua_driver._native_contract.StartSessionOutput:
- cua_driver._native_contract._UniffiFfiConverterTypeListWindowsInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeStartSessionInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeListWindowsInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeStartSessionInput.lower(input),
)
- _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeListWindowsOutput.lift
+ _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeStartSessionOutput.lift
_uniffi_error_converter = _UniffiFfiConverterTypeDriverError
return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_list_windows(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_start_session(*_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 move_cursor(self, input: cua_driver._native_contract.MoveCursorInput) -> ToolResult:
+ async def type_text(self, input: cua_driver._native_contract.TypeTextInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeMoveCursorInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeTypeTextInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeMoveCursorInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeTypeTextInput.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_move_cursor(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_type_text(*_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 parse_visual_regions(self, input: cua_driver._native_contract.ParseVisualRegionsInput) -> ToolResult:
+ async def verify_state(self, input: cua_driver._native_contract.VerifyStateInput) -> ToolResult:
- cua_driver._native_contract._UniffiFfiConverterTypeParseVisualRegionsInput.check_lower(input)
+ cua_driver._native_contract._UniffiFfiConverterTypeVerifyStateInput.check_lower(input)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeParseVisualRegionsInput.lower(input),
+ cua_driver._native_contract._UniffiFfiConverterTypeVerifyStateInput.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_parse_visual_regions(*_uniffi_lowered_args),
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_verify_state(*_uniffi_lowered_args),
_UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
_UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
_uniffi_lift_return,
_uniffi_error_converter,
)
- async def press_key(self, input: cua_driver._native_contract.PressKeyInput) -> ToolResult:
-
- cua_driver._native_contract._UniffiFfiConverterTypePressKeyInput.check_lower(input)
+
+
+
+
+
+class _UniffiFfiConverterTypeCuaDriverSession:
+ @staticmethod
+ def lift(value: int) -> CuaDriverSession:
+ return CuaDriverSession._uniffi_make_instance(value)
+
+ @staticmethod
+ def check_lower(value: CuaDriverSession):
+ if not isinstance(value, CuaDriverSession):
+ raise TypeError("Expected CuaDriverSession instance, {} found".format(type(value).__name__))
+
+ @staticmethod
+ def lower(value: CuaDriverSession) -> ctypes.c_uint64:
+ return value._uniffi_clone_handle()
+
+ @classmethod
+ def read(cls, buf: _UniffiRustBuffer) -> CuaDriverSession:
+ ptr = buf.read_u64()
+ if ptr == 0:
+ raise InternalError("Raw handle value was null")
+ return cls.lift(ptr)
+
+ @classmethod
+ def write(cls, value: CuaDriverSession, buf: _UniffiRustBuffer):
+ buf.write_u64(cls.lower(value))
+
+class _UniffiFfiConverterSequenceTypeCursorMotionSample(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ for item in value:
+ _UniffiFfiConverterTypeCursorMotionSample.check_lower(item)
+
+ @classmethod
+ def write(cls, value, buf):
+ items = len(value)
+ buf.write_i32(items)
+ for item in value:
+ _UniffiFfiConverterTypeCursorMotionSample.write(item, buf)
+
+ @classmethod
+ def read(cls, buf):
+ count = buf.read_i32()
+ if count < 0:
+ raise InternalError("Unexpected negative sequence length")
+
+ return [
+ _UniffiFfiConverterTypeCursorMotionSample.read(buf) for i in range(count)
+ ]
+
+
+class CursorTrajectoryProtocol(typing.Protocol):
+ """
+ A planned move, played back by time.
+"""
+
+ def arrival_t(self, ) -> float:
+ """
+ When the tip first reaches the target, seconds.
+"""
+ raise NotImplementedError
+ def duration(self, ) -> float:
+ """
+ Seconds until the last sample (any settle included).
+"""
+ raise NotImplementedError
+ def effect_frame(self, t: float,blend: bool) -> CursorEffectFrame:
+ """
+ The move's effects (glow, trail, magnet) at `t`, around the arrow's
+ body. `blend` is whether the surface can draw translucency.
+"""
+ raise NotImplementedError
+ def effects(self, ) -> cua_driver._native_contract.CursorMotionEffectsOutput:
+ raise NotImplementedError
+ def linger(self, ) -> float:
+ """
+ When the move and its trail or magnet glow have finished, seconds.
+"""
+ raise NotImplementedError
+ def sample_at(self, t: float) -> CursorMotionSample:
+ """
+ Interpolated sample at `t` seconds, clamped to the ends.
+"""
+ raise NotImplementedError
+ def samples(self, ) -> typing.List[CursorMotionSample]:
+ """
+ Every sample at 120 Hz. Read once; interpolate locally per frame.
+"""
+ raise NotImplementedError
+ def snap_t(self, ) -> typing.Optional[float]:
+ """
+ Magnetic lock-on time, seconds.
+"""
+ raise NotImplementedError
+ def target(self, ) -> CursorMotionRect:
+ """
+ The target used for timing (the request's, or a 24 pt box).
+"""
+ raise NotImplementedError
+ def target_known(self, ) -> bool:
+ raise NotImplementedError
+
+class CursorTrajectory(CursorTrajectoryProtocol):
+ """
+ A planned move, played back by time.
+"""
+
+ _handle: ctypes.c_uint64
+
+ def __init__(self, *args, **kwargs):
+ raise ValueError("This class has no default constructor")
+
+ def __del__(self):
+ # In case of partial initialization of instances.
+ handle = getattr(self, "_handle", None)
+ if handle is not None:
+ _uniffi_rust_call(_UniffiLib.uniffi_cua_driver_sdk_fn_free_cursortrajectory, handle)
+
+ def _uniffi_clone_handle(self):
+ return _uniffi_rust_call(_UniffiLib.uniffi_cua_driver_sdk_fn_clone_cursortrajectory, self._handle)
+
+ # Used by alternative constructors or any methods which return this type.
+ @classmethod
+ def _uniffi_make_instance(cls, handle):
+ # Lightly yucky way to bypass the usual __init__ logic
+ # and just create a new instance with the required handle.
+ inst = cls.__new__(cls)
+ inst._handle = handle
+ return inst
+ def arrival_t(self, ) -> float:
+ """
+ When the tip first reaches the target, seconds.
+"""
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterFloat64.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_arrival_t,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def duration(self, ) -> float:
+ """
+ Seconds until the last sample (any settle included).
+"""
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypePressKeyInput.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_press_key(*_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_lift_return = _UniffiFfiConverterFloat64.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
_uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_duration,
+ *_uniffi_lowered_args,
)
- async def scroll(self, input: cua_driver._native_contract.ScrollInput) -> ToolResult:
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def effect_frame(self, t: float,blend: bool) -> CursorEffectFrame:
+ """
+ The move's effects (glow, trail, magnet) at `t`, around the arrow's
+ body. `blend` is whether the surface can draw translucency.
+"""
- cua_driver._native_contract._UniffiFfiConverterTypeScrollInput.check_lower(input)
+ _UniffiFfiConverterFloat64.check_lower(t)
+
+ _UniffiFfiConverterBoolean.check_lower(blend)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeScrollInput.lower(input),
+ _UniffiFfiConverterFloat64.lower(t),
+ _UniffiFfiConverterBoolean.lower(blend),
)
- _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
- _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
- return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_scroll(*_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_lift_return = _UniffiFfiConverterTypeCursorEffectFrame.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
_uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_effect_frame,
+ *_uniffi_lowered_args,
)
- async def set_agent_cursor_enabled(self, input: cua_driver._native_contract.SetAgentCursorEnabledInput) -> ToolResult:
-
- cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorEnabledInput.check_lower(input)
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def effects(self, ) -> cua_driver._native_contract.CursorMotionEffectsOutput:
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorEnabledInput.lower(input),
)
- _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
- _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
- return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_enabled(*_uniffi_lowered_args),
- _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
- _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
- _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
- _uniffi_lift_return,
+ _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionEffectsOutput.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
_uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_effects,
+ *_uniffi_lowered_args,
)
- async def set_agent_cursor_motion(self, input: cua_driver._native_contract.SetAgentCursorMotionInput) -> ToolResult:
-
- cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorMotionInput.check_lower(input)
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def linger(self, ) -> float:
+ """
+ When the move and its trail or magnet glow have finished, seconds.
+"""
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorMotionInput.lower(input),
)
- _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
- _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
- return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_motion(*_uniffi_lowered_args),
- _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
- _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
- _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
- _uniffi_lift_return,
+ _uniffi_lift_return = _UniffiFfiConverterFloat64.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
_uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_linger,
+ *_uniffi_lowered_args,
)
- async def set_agent_cursor_theme(self, input: cua_driver._native_contract.SetAgentCursorThemeInput) -> ToolResult:
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def sample_at(self, t: float) -> CursorMotionSample:
+ """
+ Interpolated sample at `t` seconds, clamped to the ends.
+"""
- cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorThemeInput.check_lower(input)
+ _UniffiFfiConverterFloat64.check_lower(t)
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeSetAgentCursorThemeInput.lower(input),
+ _UniffiFfiConverterFloat64.lower(t),
)
- _uniffi_lift_return = _UniffiFfiConverterTypeToolResult.lift
- _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
- return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_set_agent_cursor_theme(*_uniffi_lowered_args),
- _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
- _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
- _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
- _uniffi_lift_return,
+ _uniffi_lift_return = _UniffiFfiConverterTypeCursorMotionSample.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
_uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_sample_at,
+ *_uniffi_lowered_args,
)
- async def set_window_frame(self, input: cua_driver._native_contract.SetWindowFrameInput) -> ToolResult:
-
- cua_driver._native_contract._UniffiFfiConverterTypeSetWindowFrameInput.check_lower(input)
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def samples(self, ) -> typing.List[CursorMotionSample]:
+ """
+ Every sample at 120 Hz. Read once; interpolate locally per frame.
+"""
_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_lift_return = _UniffiFfiConverterSequenceTypeCursorMotionSample.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
_uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_samples,
+ *_uniffi_lowered_args,
)
- async def start_session(self, input: cua_driver._native_contract.StartSessionInput) -> cua_driver._native_contract.StartSessionOutput:
-
- cua_driver._native_contract._UniffiFfiConverterTypeStartSessionInput.check_lower(input)
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def snap_t(self, ) -> typing.Optional[float]:
+ """
+ Magnetic lock-on time, seconds.
+"""
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeStartSessionInput.lower(input),
)
- _uniffi_lift_return = cua_driver._native_contract._UniffiFfiConverterTypeStartSessionOutput.lift
- _uniffi_error_converter = _UniffiFfiConverterTypeDriverError
- return await _uniffi_rust_call_async(
- _UniffiLib.uniffi_cua_driver_sdk_fn_method_cuadriversession_start_session(*_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_lift_return = _UniffiFfiConverterOptionalFloat64.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
_uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_snap_t,
+ *_uniffi_lowered_args,
)
- async def type_text(self, input: cua_driver._native_contract.TypeTextInput) -> ToolResult:
-
- cua_driver._native_contract._UniffiFfiConverterTypeTypeTextInput.check_lower(input)
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def target(self, ) -> CursorMotionRect:
+ """
+ The target used for timing (the request's, or a 24 pt box).
+"""
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeTypeTextInput.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_type_text(*_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_lift_return = _UniffiFfiConverterTypeCursorMotionRect.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
_uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_target,
+ *_uniffi_lowered_args,
)
- async def verify_state(self, input: cua_driver._native_contract.VerifyStateInput) -> ToolResult:
-
- cua_driver._native_contract._UniffiFfiConverterTypeVerifyStateInput.check_lower(input)
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def target_known(self, ) -> bool:
_uniffi_lowered_args = (
self._uniffi_clone_handle(),
- cua_driver._native_contract._UniffiFfiConverterTypeVerifyStateInput.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_verify_state(*_uniffi_lowered_args),
- _UniffiLib.ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
- _UniffiLib.ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
- _UniffiLib.ffi_cua_driver_sdk_rust_future_free_rust_buffer,
- _uniffi_lift_return,
+ _uniffi_lift_return = _UniffiFfiConverterBoolean.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
_uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_method_cursortrajectory_target_known,
+ *_uniffi_lowered_args,
)
+ return _uniffi_lift_return(_uniffi_ffi_result)
-class _UniffiFfiConverterTypeCuaDriverSession:
+class _UniffiFfiConverterTypeCursorTrajectory:
@staticmethod
- def lift(value: int) -> CuaDriverSession:
- return CuaDriverSession._uniffi_make_instance(value)
+ def lift(value: int) -> CursorTrajectory:
+ return CursorTrajectory._uniffi_make_instance(value)
@staticmethod
- def check_lower(value: CuaDriverSession):
- if not isinstance(value, CuaDriverSession):
- raise TypeError("Expected CuaDriverSession instance, {} found".format(type(value).__name__))
+ def check_lower(value: CursorTrajectory):
+ if not isinstance(value, CursorTrajectory):
+ raise TypeError("Expected CursorTrajectory instance, {} found".format(type(value).__name__))
@staticmethod
- def lower(value: CuaDriverSession) -> ctypes.c_uint64:
+ def lower(value: CursorTrajectory) -> ctypes.c_uint64:
return value._uniffi_clone_handle()
@classmethod
- def read(cls, buf: _UniffiRustBuffer) -> CuaDriverSession:
+ def read(cls, buf: _UniffiRustBuffer) -> CursorTrajectory:
ptr = buf.read_u64()
if ptr == 0:
raise InternalError("Raw handle value was null")
return cls.lift(ptr)
@classmethod
- def write(cls, value: CuaDriverSession, buf: _UniffiRustBuffer):
+ def write(cls, value: CursorTrajectory, buf: _UniffiRustBuffer):
buf.write_u64(cls.lower(value))
@@ -8140,6 +10413,31 @@ class _UniffiFfiConverterTypeMcpDriverChannel:
def write(cls, value: McpDriverChannel, buf: _UniffiRustBuffer):
buf.write_u64(cls.lower(value))
+class _UniffiFfiConverterOptionalTypeCursorMotionSpec(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ if value is not None:
+ _UniffiFfiConverterTypeCursorMotionSpec.check_lower(value)
+
+ @classmethod
+ def write(cls, value, buf):
+ if value is None:
+ buf.write_u8(0)
+ return
+
+ buf.write_u8(1)
+ _UniffiFfiConverterTypeCursorMotionSpec.write(value, buf)
+
+ @classmethod
+ def read(cls, buf):
+ flag = buf.read_u8()
+ if flag == 0:
+ return None
+ elif flag == 1:
+ return _UniffiFfiConverterTypeCursorMotionSpec.read(buf)
+ else:
+ raise InternalError("Unexpected flag byte for optional type")
+
class _UniffiFfiConverterUInt8(_UniffiConverterPrimitiveInt):
CLASS_NAME = "u8"
VALUE_MIN = 0
@@ -8251,6 +10549,67 @@ def current_mac_os_permission_status() -> MacOsPermissionStatus:
*_uniffi_lowered_args,
)
return _uniffi_lift_return(_uniffi_ffi_result)
+def cursor_click_effects(effects: cua_driver._native_contract.CursorMotionEffectsOutput,age: float,x: float,y: float) -> CursorEffectFrame:
+ """
+ Click effects (ripple, squish) `age` seconds after a click at `(x, y)`.
+"""
+
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionEffectsOutput.check_lower(effects)
+
+ _UniffiFfiConverterFloat64.check_lower(age)
+
+ _UniffiFfiConverterFloat64.check_lower(x)
+
+ _UniffiFfiConverterFloat64.check_lower(y)
+ _uniffi_lowered_args = (
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionEffectsOutput.lower(effects),
+ _UniffiFfiConverterFloat64.lower(age),
+ _UniffiFfiConverterFloat64.lower(x),
+ _UniffiFfiConverterFloat64.lower(y),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCursorEffectFrame.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_func_cursor_click_effects,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
+def cursor_motion_spec_for_style(style: cua_driver._native_contract.CursorMotionStyle,params: CursorMotionParams) -> typing.Optional[CursorMotionSpec]:
+ """
+ The spec behind a built-in style (`signature_arc`, `spring_settle` and
+ `comet_swoop`); `None` for the simulated styles.
+"""
+
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionStyle.check_lower(style)
+
+ _UniffiFfiConverterTypeCursorMotionParams.check_lower(params)
+ _uniffi_lowered_args = (
+ cua_driver._native_contract._UniffiFfiConverterTypeCursorMotionStyle.lower(style),
+ _UniffiFfiConverterTypeCursorMotionParams.lower(params),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterOptionalTypeCursorMotionSpec.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_func_cursor_motion_spec_for_style,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
+def default_cursor_motion_params() -> CursorMotionParams:
+ """
+ Cua Driver's default motion knobs.
+"""
+ _uniffi_lowered_args = (
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCursorMotionParams.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_func_default_cursor_motion_params,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
def open_mac_os_screen_recording_settings() -> None:
_uniffi_lowered_args = (
)
@@ -8282,6 +10641,46 @@ def open_mcp_driver_channel(transport: DriverServiceTransport,authenticated_prin
*_uniffi_lowered_args,
)
return _uniffi_lift_return(_uniffi_ffi_result)
+def plan_cursor_move(params: CursorMotionParams,request: CursorMoveRequest) -> CursorTrajectory:
+ """
+ Plan one move for a built-in style.
+"""
+
+ _UniffiFfiConverterTypeCursorMotionParams.check_lower(params)
+
+ _UniffiFfiConverterTypeCursorMoveRequest.check_lower(request)
+ _uniffi_lowered_args = (
+ _UniffiFfiConverterTypeCursorMotionParams.lower(params),
+ _UniffiFfiConverterTypeCursorMoveRequest.lower(request),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCursorTrajectory.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_func_plan_cursor_move,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
+def plan_cursor_spec(spec: CursorMotionSpec,request: CursorMoveRequest) -> CursorTrajectory:
+ """
+ Plan one move for a custom spec.
+"""
+
+ _UniffiFfiConverterTypeCursorMotionSpec.check_lower(spec)
+
+ _UniffiFfiConverterTypeCursorMoveRequest.check_lower(request)
+ _uniffi_lowered_args = (
+ _UniffiFfiConverterTypeCursorMotionSpec.lower(spec),
+ _UniffiFfiConverterTypeCursorMoveRequest.lower(request),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCursorTrajectory.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cua_driver_sdk_fn_func_plan_cursor_spec,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
def request_mac_os_permissions() -> MacOsPermissionStatus:
_uniffi_lowered_args = (
)
@@ -8297,6 +10696,11 @@ def request_mac_os_permissions() -> MacOsPermissionStatus:
__all__ = [
"InternalError",
"SessionPermissionMode",
+ "CursorPathShape",
+ "CursorEase",
+ "CursorSettle",
+ "CursorMotionDuration",
+ "CursorHeading",
"DriverActivityKind",
"DriverAuthorizationAction",
"EmbeddedPermissionMode",
@@ -8311,6 +10715,18 @@ __all__ = [
"SdkClientKind",
"RuntimeAuthorizationOptions",
"ConfiguredDriverOptions",
+ "CursorGlow",
+ "CursorTrailSegment",
+ "CursorMotionRect",
+ "CursorMagnet",
+ "CursorRipple",
+ "CursorEffectFrame",
+ "CursorMotionParams",
+ "CursorMotionPoint",
+ "CursorMotionSample",
+ "CursorTrailSpec",
+ "CursorMotionSpec",
+ "CursorMoveRequest",
"DriverActivityEvent",
"DriverAuthorizationDecision",
"DriverAuthorizationRequest",
@@ -8338,8 +10754,13 @@ __all__ = [
"create_remote_trusted_session",
"create_trusted_session",
"current_mac_os_permission_status",
+ "cursor_click_effects",
+ "cursor_motion_spec_for_style",
+ "default_cursor_motion_params",
"open_mac_os_screen_recording_settings",
"open_mcp_driver_channel",
+ "plan_cursor_move",
+ "plan_cursor_spec",
"request_mac_os_permissions",
"ForeignDriverEnvelopeChannelImpl",
"ForeignDriverEnvelopeChannel",
@@ -8347,6 +10768,8 @@ __all__ = [
"CuaDriverProtocol",
"CuaDriverSession",
"CuaDriverSessionProtocol",
+ "CursorTrajectory",
+ "CursorTrajectoryProtocol",
"DriverActivityObserverImpl",
"DriverActivityObserver",
"DriverAuthorizationHostImpl",
diff --git a/libs/cua-driver/python/tests/test_cursor_motion.py b/libs/cua-driver/python/tests/test_cursor_motion.py
new file mode 100644
index 0000000000..17f481b61f
--- /dev/null
+++ b/libs/cua-driver/python/tests/test_cursor_motion.py
@@ -0,0 +1,192 @@
+"""Cua Cursor Motion through the generated Python bindings.
+
+Replays the golden trajectories that the Rust crate and the TypeScript port
+share (libs/cua-driver/rust/crates/cua-cursor-motion/fixtures/golden.json)
+through `plan_cursor_move` / `plan_cursor_spec` in the staged native library.
+"""
+
+from __future__ import annotations
+
+import json
+import math
+import os
+import platform
+import unittest
+from pathlib import Path
+
+
+def _library_name() -> str:
+ if os.name == "nt":
+ return "cua_driver_sdk.dll"
+ if platform.system() == "Darwin":
+ return "libcua_driver_sdk.dylib"
+ return "libcua_driver_sdk.so"
+
+
+ROOT = Path(__file__).parents[1]
+LIBRARY = ROOT / "src" / "cua_driver" / _library_name()
+GOLDEN = ROOT.parent / "rust/crates/cua-cursor-motion/fixtures/golden.json"
+# The fixture rounds to 1e-9; the bindings run the same Rust code.
+TOL = 1e-8
+FRAME_FRACTIONS = (0.2, 0.5, 0.8, 1.0)
+
+if os.environ.get("CUA_DRIVER_REQUIRE_UNIFFI") == "1" and not LIBRARY.exists():
+ raise RuntimeError(f"required staged UniFFI library is missing: {LIBRARY}")
+
+
[email protected](LIBRARY.exists(), "host-native UniFFI library is not staged")
+class CursorMotionGoldenTests(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls) -> None:
+ from cua_driver import _native as n
+ from cua_driver import _native_contract as c
+
+ cls.n = n
+ cls.c = c
+ cls.golden = json.loads(GOLDEN.read_text())
+
+ # Fixture JSON -> generated records -------------------------------------
+
+ def params(self, p: dict):
+ n, c = self.n, self.c
+ return n.CursorMotionParams(
+ style=getattr(c.CursorMotionStyle, p["style"].upper()),
+ timing=getattr(c.CursorMotionTiming, p["timing"].upper()),
+ effects=c.CursorMotionEffects(**{k: p["effects"][k] for k in self.effect_names}),
+ start_handle=p["start_handle"],
+ end_handle=p["end_handle"],
+ arc_size=p["arc_size"],
+ arc_flow=p["arc_flow"],
+ spring=p["spring"],
+ glide_duration_ms=p["glide_duration_ms"],
+ peak_speed=p["peak_speed"],
+ min_start_speed=p["min_start_speed"],
+ min_end_speed=p["min_end_speed"],
+ turn_radius=p["turn_radius"],
+ )
+
+ effect_names = ("trail", "glow", "magnet", "ripple", "squish")
+
+ def request(self, r: dict):
+ n = self.n
+ target = r["target"]
+ return n.CursorMoveRequest(
+ from_point=n.CursorMotionPoint(x=r["from"][0], y=r["from"][1]),
+ to_point=n.CursorMotionPoint(x=r["to"][0], y=r["to"][1]),
+ from_heading=r["from_heading"],
+ end_heading=r["end_heading"],
+ target=None
+ if target is None
+ else n.CursorMotionRect(x=target[0], y=target[1], width=target[2], height=target[3]),
+ seed=r["seed"],
+ reduced_motion=r["reduced_motion"],
+ )
+
+ @staticmethod
+ def variant(enum_type, value: dict):
+ fields = {k: v for k, v in value.items() if k != "type"}
+ return getattr(enum_type, value["type"].upper())(**fields)
+
+ def spec(self, s: dict):
+ n, c = self.n, self.c
+ return n.CursorMotionSpec(
+ path=self.variant(n.CursorPathShape, s["path"]),
+ ease=self.variant(n.CursorEase, s["ease"]),
+ settle=self.variant(n.CursorSettle, s["settle"]),
+ duration=self.variant(n.CursorMotionDuration, s["duration"]),
+ heading=getattr(n.CursorHeading, s["heading"].upper()),
+ effects=c.CursorMotionEffectsOutput(**s["effects"]),
+ trail=n.CursorTrailSpec(**s["trail"]),
+ )
+
+ # Comparison --------------------------------------------------------------
+
+ def near(self, name: str, got: float, want: float) -> None:
+ self.assertLessEqual(abs(got - want), TOL, f"{name}: {got} vs {want}")
+
+ def check_frame(self, name: str, frame, click, want: dict) -> None:
+ def present(value, expected, fields):
+ self.assertEqual(value is None, expected is None, f"{name} presence")
+ if value is not None:
+ for i, field in enumerate(fields):
+ self.near(f"{name}.{field}", field(value), expected[i])
+
+ present(frame.glow, want["glow"], [lambda g: g.x, lambda g: g.y, lambda g: g.r, lambda g: g.alpha])
+ present(
+ frame.magnet,
+ want["magnet"],
+ [lambda m: m.rect.x, lambda m: m.rect.y, lambda m: m.rect.width, lambda m: m.rect.height, lambda m: m.glow],
+ )
+ present(
+ click.ripple,
+ want["ripple"],
+ [lambda r: r.x, lambda r: r.y, lambda r: r.r, lambda r: r.width, lambda r: r.alpha],
+ )
+ self.near(f"{name}.squish", click.squish, want["squish"])
+ self.assertEqual(len(frame.trail), len(want["trail"]), f"{name} trail length")
+ for seg, w in zip(frame.trail, want["trail"]):
+ for got, expected in zip((seg.ax, seg.ay, seg.bx, seg.by, seg.width, seg.alpha), w):
+ self.near(f"{name}.trail", got, expected)
+
+ def check(self, name: str, traj, out: dict) -> None:
+ n, c = self.n, self.c
+ samples = traj.samples()
+ self.assertEqual(len(samples), out["samples"], f"{name}: sample count")
+ self.near(f"{name}.duration", traj.duration(), out["duration"])
+ self.near(f"{name}.arrival", traj.arrival_t(), out["arrival_t"])
+ snap = traj.snap_t()
+ self.assertEqual(snap is None, out["snap_t"] is None, f"{name}: snap")
+ if snap is not None:
+ self.near(f"{name}.snap", snap, out["snap_t"])
+ t = traj.target()
+ for got, want in zip((t.x, t.y, t.width, t.height), out["target"]):
+ self.near(f"{name}.target", got, want)
+ self.assertEqual(traj.target_known(), out["target_known"])
+ fx = traj.effects()
+ self.assertEqual({k: getattr(fx, k) for k in self.effect_names}, out["effects"])
+ d = traj.duration()
+ grid = self.golden["grid"]
+ for i, want in enumerate(out["grid"]):
+ s = traj.sample_at(d * i / grid)
+ for field, got, expected in zip("txyh", (s.t, s.x, s.y, s.heading), want):
+ self.near(f"{name}.grid[{i}].{field}", got, expected)
+ if "frames" in out:
+ self.near(f"{name}.linger", traj.linger(), out["linger"])
+ clicks = c.CursorMotionEffectsOutput(trail=False, glow=False, magnet=False, ripple=True, squish=True)
+ for k, f in zip(FRAME_FRACTIONS, out["frames"]):
+ at = d * k
+ s = traj.sample_at(at)
+ frame = traj.effect_frame(at, True)
+ click = n.cursor_click_effects(clicks, 0.03 + 0.4 * k, s.x, s.y)
+ self.check_frame(f"{name}@{k}", frame, click, f["frame"])
+
+ # Tests -------------------------------------------------------------------
+
+ def test_built_in_styles_match_the_golden_trajectories(self) -> None:
+ cases = self.golden["cases"]
+ self.assertGreater(len(cases), 100)
+ for case in cases:
+ traj = self.n.plan_cursor_move(self.params(case["params"]), self.request(case["request"]))
+ self.check(case["name"], traj, case["out"])
+
+ def test_custom_specs_match_the_golden_trajectories(self) -> None:
+ for case in self.golden["spec_cases"]:
+ traj = self.n.plan_cursor_spec(self.spec(case["spec"]), self.request(case["request"]))
+ self.check(case["name"], traj, case["out"])
+
+ def test_the_arc_styles_are_specs(self) -> None:
+ n, c = self.n, self.c
+ params = n.default_cursor_motion_params()
+ request = self.request(self.golden["cases"][0]["request"])
+ spec = n.cursor_motion_spec_for_style(c.CursorMotionStyle.COMET_SWOOP, params)
+ self.assertIsNotNone(spec)
+ params.style = c.CursorMotionStyle.COMET_SWOOP
+ a = n.plan_cursor_move(params, request).samples()
+ b = n.plan_cursor_spec(spec, request).samples()
+ self.assertEqual(a, b)
+ self.assertIsNone(n.cursor_motion_spec_for_style(c.CursorMotionStyle.MAGNETIC, params))
+ self.assertTrue(math.isclose(params.arc_size, 0.25))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/libs/cua-driver/rust/Cargo.lock b/libs/cua-driver/rust/Cargo.lock
index 9a294009ff..805f0331e4 100644
--- a/libs/cua-driver/rust/Cargo.lock
+++ b/libs/cua-driver/rust/Cargo.lock
@@ -1345,6 +1345,7 @@ version = "0.34.0"
dependencies = [
"async-trait",
"core-foundation",
+ "cua-cursor-motion",
"cua-driver-contract",
"cua-driver-core",
"cursor-overlay",
diff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/Cargo.toml b/libs/cua-driver/rust/crates/cua-driver-sdk/Cargo.toml
index d7b4cc762f..cdadd053eb 100644
--- a/libs/cua-driver/rust/crates/cua-driver-sdk/Cargo.toml
+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/Cargo.toml
@@ -23,6 +23,7 @@ tracing = { workspace = true }
uniffi = { workspace = true, features = ["tokio"] }
uuid = { workspace = true }
cursor-overlay = { path = "../cursor-overlay" }
+cua-cursor-motion = { path = "../cua-cursor-motion" }
[target.'cfg(target_os = "macos")'.dependencies]
platform-macos = { path = "../platform-macos" }
diff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/src/cursor_motion.rs b/libs/cua-driver/rust/crates/cua-driver-sdk/src/cursor_motion.rs
new file mode 100644
index 0000000000..e27e5a84ec
--- /dev/null
+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/src/cursor_motion.rs
@@ -0,0 +1,722 @@
+//! Cua Cursor Motion through the UniFFI boundary.
+//!
+//! The planner lives in the dependency-free `cua-cursor-motion` crate; this
+//! module mirrors its public API as UniFFI records, enums and one object, so
+//! every generated SDK (Python, TypeScript, the C header) can plan and play
+//! the agent cursor's motions. A planned move is a `CursorTrajectory`: read
+//! all samples once with `samples()` rather than calling across the FFI every
+//! frame.
+
+use cua_cursor_motion as cm;
+use cua_driver_contract::{
+ CursorMotionEffects, CursorMotionEffectsOutput, CursorMotionStyle, CursorMotionTiming,
+};
+use std::sync::Arc;
+
+fn style_in(style: CursorMotionStyle) -> cm::MotionStyle {
+ cm::MotionStyle::parse(style.as_str()).expect("contract styles match cua-cursor-motion")
+}
+
+fn style_out(style: cm::MotionStyle) -> CursorMotionStyle {
+ CursorMotionStyle::ALL
+ .into_iter()
+ .find(|s| s.as_str() == style.as_str())
+ .expect("contract styles match cua-cursor-motion")
+}
+
+fn timing_in(timing: CursorMotionTiming) -> cm::MotionTiming {
+ match timing {
+ CursorMotionTiming::Native => cm::MotionTiming::Native,
+ CursorMotionTiming::Fitts => cm::MotionTiming::Fitts,
+ CursorMotionTiming::Fixed => cm::MotionTiming::Fixed,
+ }
+}
+
+fn overrides_in(e: CursorMotionEffects) -> cm::MotionEffects {
+ cm::MotionEffects {
+ trail: e.trail,
+ glow: e.glow,
+ magnet: e.magnet,
+ ripple: e.ripple,
+ squish: e.squish,
+ }
+}
+
+fn effects_in(e: CursorMotionEffectsOutput) -> cm::ResolvedEffects {
+ cm::ResolvedEffects {
+ trail: e.trail,
+ glow: e.glow,
+ magnet: e.magnet,
+ ripple: e.ripple,
+ squish: e.squish,
+ }
+}
+
+fn effects_out(e: cm::ResolvedEffects) -> CursorMotionEffectsOutput {
+ CursorMotionEffectsOutput {
+ trail: e.trail,
+ glow: e.glow,
+ magnet: e.magnet,
+ ripple: e.ripple,
+ squish: e.squish,
+ }
+}
+
+/// Knobs of the built-in styles. Defaults match Cua Driver
+/// (`default_cursor_motion_params`).
+#[derive(Debug, Clone, PartialEq, uniffi::Record)]
+pub struct CursorMotionParams {
+ pub style: CursorMotionStyle,
+ pub timing: CursorMotionTiming,
+ pub effects: CursorMotionEffects,
+ pub start_handle: f64,
+ pub end_handle: f64,
+ pub arc_size: f64,
+ pub arc_flow: f64,
+ pub spring: f64,
+ pub glide_duration_ms: f64,
+ pub peak_speed: f64,
+ pub min_start_speed: f64,
+ pub min_end_speed: f64,
+ pub turn_radius: f64,
+}
+
+impl From<CursorMotionParams> for cm::MotionParams {
+ fn from(p: CursorMotionParams) -> Self {
+ Self {
+ style: style_in(p.style),
+ timing: timing_in(p.timing),
+ effects: overrides_in(p.effects),
+ start_handle: p.start_handle,
+ end_handle: p.end_handle,
+ arc_size: p.arc_size,
+ arc_flow: p.arc_flow,
+ spring: p.spring,
+ glide_duration_ms: p.glide_duration_ms,
+ peak_speed: p.peak_speed,
+ min_start_speed: p.min_start_speed,
+ min_end_speed: p.min_end_speed,
+ turn_radius: p.turn_radius,
+ }
+ }
+}
+
+/// Cua Driver's default motion knobs.
+#[uniffi::export]
+pub fn default_cursor_motion_params() -> CursorMotionParams {
+ let d = cm::MotionParams::default();
+ CursorMotionParams {
+ style: style_out(d.style),
+ timing: CursorMotionTiming::Native,
+ effects: CursorMotionEffects::default(),
+ start_handle: d.start_handle,
+ end_handle: d.end_handle,
+ arc_size: d.arc_size,
+ arc_flow: d.arc_flow,
+ spring: d.spring,
+ glide_duration_ms: d.glide_duration_ms,
+ peak_speed: d.peak_speed,
+ min_start_speed: d.min_start_speed,
+ min_end_speed: d.min_end_speed,
+ turn_radius: d.turn_radius,
+ }
+}
+
+/// A point in screen points (y down).
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Record)]
+pub struct CursorMotionPoint {
+ pub x: f64,
+ pub y: f64,
+}
+
+/// A target rect in screen points.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Record)]
+pub struct CursorMotionRect {
+ pub x: f64,
+ pub y: f64,
+ pub width: f64,
+ pub height: f64,
+}
+
+/// One move to plan.
+#[derive(Debug, Clone, PartialEq, uniffi::Record)]
+pub struct CursorMoveRequest {
+ /// Current hotspot.
+ pub from_point: CursorMotionPoint,
+ /// Requested hotspot.
+ pub to_point: CursorMotionPoint,
+ /// Current heading; the rest heading (pi/4) when unset.
+ pub from_heading: Option<f64>,
+ /// Heading on arrival; the rest heading when unset.
+ pub end_heading: Option<f64>,
+ /// The target element's rect; it sets the Fitts width.
+ pub target: Option<CursorMotionRect>,
+ /// Same seed, same motion.
+ pub seed: String,
+ /// A short straight glide without effects.
+ pub reduced_motion: bool,
+}
+
+impl From<CursorMoveRequest> for cm::MoveRequest {
+ fn from(r: CursorMoveRequest) -> Self {
+ Self {
+ from: cm::Pt::new(r.from_point.x, r.from_point.y),
+ from_heading: r.from_heading.unwrap_or(cm::REST_HEADING),
+ to: cm::Pt::new(r.to_point.x, r.to_point.y),
+ end_heading: r.end_heading.unwrap_or(cm::REST_HEADING),
+ target: r.target.map(|t| [t.x, t.y, t.width, t.height]),
+ seed: r.seed,
+ reduced_motion: r.reduced_motion,
+ }
+ }
+}
+
+/// Path shape of a custom motion.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Enum)]
+pub enum CursorPathShape {
+ Straight,
+ /// The Cua cubic bezier; a positive `arc_size` bends to the natural side.
+ Arc {
+ start_handle: f64,
+ end_handle: f64,
+ arc_size: f64,
+ arc_flow: f64,
+ },
+ /// A gentle quadratic bow.
+ Bow {
+ amount: f64,
+ },
+}
+
+/// Speed curve along the path.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Enum)]
+pub enum CursorEase {
+ Linear,
+ MinJerk,
+ Smootherstep,
+ InOutCubic,
+ InOutSine,
+ OutCubic,
+ CubicBezier { x1: f64, y1: f64, x2: f64, y2: f64 },
+}
+
+/// Overshoot or settle at the end of the glide.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Enum)]
+pub enum CursorSettle {
+ None,
+ FollowThrough {
+ amount: f64,
+ max_pt: f64,
+ at: f64,
+ },
+ Spring {
+ amount: f64,
+ max_pt: f64,
+ cycles: f64,
+ decay: f64,
+ start: f64,
+ glide_end: f64,
+ },
+}
+
+/// Duration model of a custom motion.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Enum)]
+pub enum CursorMotionDuration {
+ Fixed {
+ ms: f64,
+ },
+ Fitts {
+ a: f64,
+ b: f64,
+ min_ms: f64,
+ max_ms: f64,
+ scale: f64,
+ },
+ Distance {
+ base_ms: f64,
+ ms_per_pt: f64,
+ min_ms: f64,
+ max_ms: f64,
+ },
+}
+
+/// `Tangent`: the tip leads the motion. `Fixed`: the rest pose.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, uniffi::Enum)]
+pub enum CursorHeading {
+ Tangent,
+ Fixed,
+}
+
+/// The comet trail.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Record)]
+pub struct CursorTrailSpec {
+ pub secs: f64,
+ pub fade_len: f64,
+ pub steps: u32,
+ pub tail_width: f64,
+ pub head_width: f64,
+ pub alpha: f64,
+ pub anchor_offset: f64,
+}
+
+/// A complete custom motion.
+#[derive(Debug, Clone, PartialEq, uniffi::Record)]
+pub struct CursorMotionSpec {
+ pub path: CursorPathShape,
+ pub ease: CursorEase,
+ pub settle: CursorSettle,
+ pub duration: CursorMotionDuration,
+ pub heading: CursorHeading,
+ pub effects: CursorMotionEffectsOutput,
+ pub trail: CursorTrailSpec,
+}
+
+impl From<CursorMotionSpec> for cm::MotionSpec {
+ fn from(s: CursorMotionSpec) -> Self {
+ Self {
+ path: match s.path {
+ CursorPathShape::Straight => cm::PathShape::Straight,
+ CursorPathShape::Arc {
+ start_handle,
+ end_handle,
+ arc_size,
+ arc_flow,
+ } => cm::PathShape::Arc(cm::ArcShape {
+ start_handle,
+ end_handle,
+ arc_size,
+ arc_flow,
+ }),
+ CursorPathShape::Bow { amount } => cm::PathShape::Bow { amount },
+ },
+ ease: match s.ease {
+ CursorEase::Linear => cm::Ease::Linear,
+ CursorEase::MinJerk => cm::Ease::MinJerk,
+ CursorEase::Smootherstep => cm::Ease::Smootherstep,
+ CursorEase::InOutCubic => cm::Ease::InOutCubic,
+ CursorEase::InOutSine => cm::Ease::InOutSine,
+ CursorEase::OutCubic => cm::Ease::OutCubic,
+ CursorEase::CubicBezier { x1, y1, x2, y2 } => {
+ cm::Ease::CubicBezier { x1, y1, x2, y2 }
+ }
+ },
+ settle: match s.settle {
+ CursorSettle::None => cm::Settle::None,
+ CursorSettle::FollowThrough { amount, max_pt, at } => {
+ cm::Settle::FollowThrough { amount, max_pt, at }
+ }
+ CursorSettle::Spring {
+ amount,
+ max_pt,
+ cycles,
+ decay,
+ start,
+ glide_end,
+ } => cm::Settle::Spring {
+ amount,
+ max_pt,
+ cycles,
+ decay,
+ start,
+ glide_end,
+ },
+ },
+ duration: match s.duration {
+ CursorMotionDuration::Fixed { ms } => cm::Duration::Fixed { ms },
+ CursorMotionDuration::Fitts {
+ a,
+ b,
+ min_ms,
+ max_ms,
+ scale,
+ } => cm::Duration::Fitts {
+ a,
+ b,
+ min_ms,
+ max_ms,
+ scale,
+ },
+ CursorMotionDuration::Distance {
+ base_ms,
+ ms_per_pt,
+ min_ms,
+ max_ms,
+ } => cm::Duration::Distance {
+ base_ms,
+ ms_per_pt,
+ min_ms,
+ max_ms,
+ },
+ },
+ heading: match s.heading {
+ CursorHeading::Tangent => cm::Heading::Tangent,
+ CursorHeading::Fixed => cm::Heading::Fixed,
+ },
+ effects: effects_in(s.effects),
+ trail: trail_in(s.trail),
+ }
+ }
+}
+
+fn trail_in(t: CursorTrailSpec) -> cm::TrailSpec {
+ cm::TrailSpec {
+ secs: t.secs,
+ fade_len: t.fade_len,
+ steps: t.steps as usize,
+ tail_width: t.tail_width,
+ head_width: t.head_width,
+ alpha: t.alpha,
+ anchor_offset: t.anchor_offset,
+ }
+}
+
+fn trail_out(t: cm::TrailSpec) -> CursorTrailSpec {
+ CursorTrailSpec {
+ secs: t.secs,
+ fade_len: t.fade_len,
+ steps: u32::try_from(t.steps).unwrap_or(u32::MAX),
+ tail_width: t.tail_width,
+ head_width: t.head_width,
+ alpha: t.alpha,
+ anchor_offset: t.anchor_offset,
+ }
+}
+
+impl From<cm::MotionSpec> for CursorMotionSpec {
+ fn from(s: cm::MotionSpec) -> Self {
+ Self {
+ path: match s.path {
+ cm::PathShape::Straight => CursorPathShape::Straight,
+ cm::PathShape::Arc(a) => CursorPathShape::Arc {
+ start_handle: a.start_handle,
+ end_handle: a.end_handle,
+ arc_size: a.arc_size,
+ arc_flow: a.arc_flow,
+ },
+ cm::PathShape::Bow { amount } => CursorPathShape::Bow { amount },
+ },
+ ease: match s.ease {
+ cm::Ease::Linear => CursorEase::Linear,
+ cm::Ease::MinJerk => CursorEase::MinJerk,
+ cm::Ease::Smootherstep => CursorEase::Smootherstep,
+ cm::Ease::InOutCubic => CursorEase::InOutCubic,
+ cm::Ease::InOutSine => CursorEase::InOutSine,
+ cm::Ease::OutCubic => CursorEase::OutCubic,
+ cm::Ease::CubicBezier { x1, y1, x2, y2 } => {
+ CursorEase::CubicBezier { x1, y1, x2, y2 }
+ }
+ },
+ settle: match s.settle {
+ cm::Settle::None => CursorSettle::None,
+ cm::Settle::FollowThrough { amount, max_pt, at } => {
+ CursorSettle::FollowThrough { amount, max_pt, at }
+ }
+ cm::Settle::Spring {
+ amount,
+ max_pt,
+ cycles,
+ decay,
+ start,
+ glide_end,
+ } => CursorSettle::Spring {
+ amount,
+ max_pt,
+ cycles,
+ decay,
+ start,
+ glide_end,
+ },
+ },
+ duration: match s.duration {
+ cm::Duration::Fixed { ms } => CursorMotionDuration::Fixed { ms },
+ cm::Duration::Fitts {
+ a,
+ b,
+ min_ms,
+ max_ms,
+ scale,
+ } => CursorMotionDuration::Fitts {
+ a,
+ b,
+ min_ms,
+ max_ms,
+ scale,
+ },
+ cm::Duration::Distance {
+ base_ms,
+ ms_per_pt,
+ min_ms,
+ max_ms,
+ } => CursorMotionDuration::Distance {
+ base_ms,
+ ms_per_pt,
+ min_ms,
+ max_ms,
+ },
+ },
+ heading: match s.heading {
+ cm::Heading::Tangent => CursorHeading::Tangent,
+ cm::Heading::Fixed => CursorHeading::Fixed,
+ },
+ effects: effects_out(s.effects),
+ trail: trail_out(s.trail),
+ }
+ }
+}
+
+/// The spec behind a built-in style (`signature_arc`, `spring_settle` and
+/// `comet_swoop`); `None` for the simulated styles.
+#[uniffi::export]
+pub fn cursor_motion_spec_for_style(
+ style: CursorMotionStyle,
+ params: CursorMotionParams,
+) -> Option<CursorMotionSpec> {
+ cm::MotionSpec::for_style(style_in(style), &params.into()).map(Into::into)
+}
+
+/// One sample: seconds from the start, the hotspot, and the arrow's heading.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Record)]
+pub struct CursorMotionSample {
+ pub t: f64,
+ pub x: f64,
+ pub y: f64,
+ pub heading: f64,
+}
+
+impl From<cm::Sample> for CursorMotionSample {
+ fn from(s: cm::Sample) -> Self {
+ Self {
+ t: s.t,
+ x: s.x,
+ y: s.y,
+ heading: s.heading,
+ }
+ }
+}
+
+/// Speed glow.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Record)]
+pub struct CursorGlow {
+ pub x: f64,
+ pub y: f64,
+ pub r: f64,
+ pub alpha: f64,
+}
+
+/// One round-capped stroke of the comet trail.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Record)]
+pub struct CursorTrailSegment {
+ pub ax: f64,
+ pub ay: f64,
+ pub bx: f64,
+ pub by: f64,
+ pub width: f64,
+ pub alpha: f64,
+}
+
+/// Glow around the target after a magnetic lock-on.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Record)]
+pub struct CursorMagnet {
+ pub rect: CursorMotionRect,
+ pub glow: f64,
+}
+
+/// Expanding click ring.
+#[derive(Debug, Clone, Copy, PartialEq, uniffi::Record)]
+pub struct CursorRipple {
+ pub x: f64,
+ pub y: f64,
+ pub r: f64,
+ pub width: f64,
+ pub alpha: f64,
+}
+
+/// The effects to paint at one moment.
+#[derive(Debug, Clone, PartialEq, uniffi::Record)]
+pub struct CursorEffectFrame {
+ pub glow: Option<CursorGlow>,
+ pub trail: Vec<CursorTrailSegment>,
+ pub magnet: Option<CursorMagnet>,
+ pub ripple: Option<CursorRipple>,
+ /// Scale-down of the cursor, 0 = none.
+ pub squish: f64,
+}
+
+impl From<cm::EffectFrame> for CursorEffectFrame {
+ fn from(f: cm::EffectFrame) -> Self {
+ Self {
+ glow: f.glow.map(|g| CursorGlow {
+ x: g.x,
+ y: g.y,
+ r: g.r,
+ alpha: g.alpha,
+ }),
+ trail: f
+ .trail
+ .into_iter()
+ .map(|s| CursorTrailSegment {
+ ax: s.a.0,
+ ay: s.a.1,
+ bx: s.b.0,
+ by: s.b.1,
+ width: s.width,
+ alpha: s.alpha,
+ })
+ .collect(),
+ magnet: f.magnet.map(|m| CursorMagnet {
+ rect: rect_out(m.rect),
+ glow: m.glow,
+ }),
+ ripple: f.ripple.map(|r| CursorRipple {
+ x: r.x,
+ y: r.y,
+ r: r.r,
+ width: r.width,
+ alpha: r.alpha,
+ }),
+ squish: f.squish,
+ }
+ }
+}
+
+fn rect_out(r: [f64; 4]) -> CursorMotionRect {
+ CursorMotionRect {
+ x: r[0],
+ y: r[1],
+ width: r[2],
+ height: r[3],
+ }
+}
+
+/// A planned move, played back by time.
+#[derive(Debug, uniffi::Object)]
+pub struct CursorTrajectory {
+ inner: cm::Trajectory,
+}
+
+#[uniffi::export]
+impl CursorTrajectory {
+ /// Every sample at 120 Hz. Read once; interpolate locally per frame.
+ pub fn samples(&self) -> Vec<CursorMotionSample> {
+ self.inner.samples.iter().copied().map(Into::into).collect()
+ }
+
+ /// Interpolated sample at `t` seconds, clamped to the ends.
+ pub fn sample_at(&self, t: f64) -> CursorMotionSample {
+ self.inner.sample_at(t).into()
+ }
+
+ /// When the tip first reaches the target, seconds.
+ pub fn arrival_t(&self) -> f64 {
+ self.inner.arrival_t
+ }
+
+ /// Seconds until the last sample (any settle included).
+ pub fn duration(&self) -> f64 {
+ self.inner.duration()
+ }
+
+ /// Magnetic lock-on time, seconds.
+ pub fn snap_t(&self) -> Option<f64> {
+ self.inner.snap_t
+ }
+
+ /// The target used for timing (the request's, or a 24 pt box).
+ pub fn target(&self) -> CursorMotionRect {
+ rect_out(self.inner.target)
+ }
+
+ pub fn target_known(&self) -> bool {
+ self.inner.target_known
+ }
+
+ pub fn effects(&self) -> CursorMotionEffectsOutput {
+ effects_out(self.inner.effects)
+ }
+
+ /// When the move and its trail or magnet glow have finished, seconds.
+ pub fn linger(&self) -> f64 {
+ cm::effects::linger(&self.inner)
+ }
+
+ /// The move's effects (glow, trail, magnet) at `t`, around the arrow's
+ /// body. `blend` is whether the surface can draw translucency.
+ pub fn effect_frame(&self, t: f64, blend: bool) -> CursorEffectFrame {
+ let s = self.inner.sample_at(t);
+ let body = cm::anchor_for_pointer(s.x, s.y, s.heading);
+ cm::effects::motion_frame(&self.inner, t, body, blend).into()
+ }
+}
+
+/// Plan one move for a built-in style.
+#[uniffi::export]
+pub fn plan_cursor_move(
+ params: CursorMotionParams,
+ request: CursorMoveRequest,
+) -> Arc<CursorTrajectory> {
+ Arc::new(CursorTrajectory {
+ inner: cm::plan_move(&params.into(), &request.into()),
+ })
+}
+
+/// Plan one move for a custom spec.
+#[uniffi::export]
+pub fn plan_cursor_spec(
+ spec: CursorMotionSpec,
+ request: CursorMoveRequest,
+) -> Arc<CursorTrajectory> {
+ Arc::new(CursorTrajectory {
+ inner: cm::plan_spec(&spec.into(), &request.into()),
+ })
+}
+
+/// Click effects (ripple, squish) `age` seconds after a click at `(x, y)`.
+#[uniffi::export]
+pub fn cursor_click_effects(
+ effects: CursorMotionEffectsOutput,
+ age: f64,
+ x: f64,
+ y: f64,
+) -> CursorEffectFrame {
+ let mut frame = cm::EffectFrame::default();
+ cm::effects::add_click(&mut frame, effects_in(effects), age, (x, y));
+ frame.into()
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn the_ffi_planner_matches_the_crate() {
+ let params = CursorMotionParams {
+ style: CursorMotionStyle::CometSwoop,
+ ..default_cursor_motion_params()
+ };
+ let request = CursorMoveRequest {
+ from_point: CursorMotionPoint { x: 100.0, y: 100.0 },
+ to_point: CursorMotionPoint { x: 700.0, y: 400.0 },
+ from_heading: None,
+ end_heading: None,
+ target: Some(CursorMotionRect {
+ x: 660.0,
+ y: 380.0,
+ width: 80.0,
+ height: 40.0,
+ }),
+ seed: "s".into(),
+ reduced_motion: false,
+ };
+ let ffi = plan_cursor_move(params.clone(), request.clone());
+ let native = cm::plan_move(&params.clone().into(), &request.clone().into());
+ assert_eq!(ffi.samples().len(), native.samples.len());
+ assert_eq!(ffi.arrival_t(), native.arrival_t);
+ let spec = cursor_motion_spec_for_style(CursorMotionStyle::CometSwoop, params).unwrap();
+ let from_spec = plan_cursor_spec(spec, request);
+ assert_eq!(from_spec.samples(), ffi.samples());
+ assert!(!ffi
+ .effect_frame(ffi.duration() / 2.0, true)
+ .trail
+ .is_empty());
+ }
+}
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 11e7205cfc..776cd63ec9 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
@@ -28,6 +28,7 @@ use thiserror::Error;
mod abi;
mod activity_observer;
mod authorization_host;
+mod cursor_motion;
mod embedded;
pub mod remote;
pub mod remote_foreign;
@@ -43,6 +44,7 @@ pub use authorization_host::{
DriverAuthorizationAction, DriverAuthorizationDecision, DriverAuthorizationHost,
DriverAuthorizationHostError, DriverAuthorizationRequest,
};
+pub use cursor_motion::*;
pub use embedded::*;
use remote::{DriverEnvelopeChannel, RemoteBoundSession, RemoteDriverClient};
pub use remote_mcp::{
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 0dc83f185c..b3e2ffcb6d 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
@@ -283,6 +283,16 @@ const DEFINITIONS = {
ret: FfiType.Void,
hasRustCallStatus: true,
},
+ "uniffi_cua_driver_sdk_fn_clone_cursortrajectory": {
+ args: [FfiType.Handle],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_free_cursortrajectory": {
+ args: [FfiType.Handle],
+ ret: FfiType.Void,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_driver_sdk_fn_clone_driveractivityobserver": {
args: [FfiType.Handle],
ret: FfiType.Handle,
@@ -383,6 +393,21 @@ const DEFINITIONS = {
ret: FfiType.RustBuffer,
hasRustCallStatus: true,
},
+ "uniffi_cua_driver_sdk_fn_func_cursor_click_effects": {
+ args: [FfiType.RustBuffer, FfiType.Float64, FfiType.Float64, FfiType.Float64],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_func_cursor_motion_spec_for_style": {
+ args: [FfiType.RustBuffer, FfiType.RustBuffer],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_func_default_cursor_motion_params": {
+ args: [],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_driver_sdk_fn_func_open_mac_os_screen_recording_settings": {
args: [],
ret: FfiType.Void,
@@ -393,6 +418,16 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: true,
},
+ "uniffi_cua_driver_sdk_fn_func_plan_cursor_move": {
+ args: [FfiType.RustBuffer, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_func_plan_cursor_spec": {
+ args: [FfiType.RustBuffer, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_driver_sdk_fn_func_request_mac_os_permissions": {
args: [],
ret: FfiType.RustBuffer,
@@ -813,6 +848,56 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cua_driver_sdk_fn_method_cursortrajectory_arrival_t": {
+ args: [FfiType.Handle],
+ ret: FfiType.Float64,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_method_cursortrajectory_duration": {
+ args: [FfiType.Handle],
+ ret: FfiType.Float64,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_method_cursortrajectory_effect_frame": {
+ args: [FfiType.Handle, FfiType.Float64, FfiType.Int8],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_method_cursortrajectory_effects": {
+ args: [FfiType.Handle],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_method_cursortrajectory_linger": {
+ args: [FfiType.Handle],
+ ret: FfiType.Float64,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_method_cursortrajectory_sample_at": {
+ args: [FfiType.Handle, FfiType.Float64],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_method_cursortrajectory_samples": {
+ args: [FfiType.Handle],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_method_cursortrajectory_snap_t": {
+ args: [FfiType.Handle],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_method_cursortrajectory_target": {
+ args: [FfiType.Handle],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_driver_sdk_fn_method_cursortrajectory_target_known": {
+ args: [FfiType.Handle],
+ ret: FfiType.Int8,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_driver_sdk_fn_method_driveractivityobserver_on_activity": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Void,
@@ -943,6 +1028,21 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_driver_sdk_checksum_func_cursor_click_effects": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_func_cursor_motion_spec_for_style": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_func_default_cursor_motion_params": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_driver_sdk_checksum_func_open_mac_os_screen_recording_settings": {
args: [],
ret: FfiType.UInt16,
@@ -953,6 +1053,16 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_driver_sdk_checksum_func_plan_cursor_move": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_func_plan_cursor_spec": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_driver_sdk_checksum_func_request_mac_os_permissions": {
args: [],
ret: FfiType.UInt16,
@@ -1373,6 +1483,56 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_driver_sdk_checksum_method_cursortrajectory_arrival_t": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_method_cursortrajectory_duration": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effect_frame": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effects": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_method_cursortrajectory_linger": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_method_cursortrajectory_sample_at": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_method_cursortrajectory_samples": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_method_cursortrajectory_snap_t": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target_known": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_driver_sdk_checksum_method_driveractivityobserver_on_activity": {
args: [],
ret: FfiType.UInt16,
@@ -1688,6 +1848,8 @@ interface NativeModuleInterface {
uniffi_cua_driver_sdk_fn_free_cuadriver(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cua_driver_sdk_fn_clone_cuadriversession(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cua_driver_sdk_fn_free_cuadriversession(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
+ uniffi_cua_driver_sdk_fn_clone_cursortrajectory(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cua_driver_sdk_fn_free_cursortrajectory(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cua_driver_sdk_fn_clone_driveractivityobserver(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cua_driver_sdk_fn_free_driveractivityobserver(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cua_driver_sdk_fn_clone_driverauthorizationhost(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
@@ -1708,8 +1870,13 @@ interface NativeModuleInterface {
uniffi_cua_driver_sdk_fn_func_create_remote_trusted_session(driver: bigint, options: Uint8Array): bigint;
uniffi_cua_driver_sdk_fn_func_create_trusted_session(driver: bigint, options: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cua_driver_sdk_fn_func_current_mac_os_permission_status(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_driver_sdk_fn_func_cursor_click_effects(effects: Uint8Array, age: number, x: number, y: number, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_driver_sdk_fn_func_cursor_motion_spec_for_style(style: Uint8Array, params: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_driver_sdk_fn_func_default_cursor_motion_params(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_driver_sdk_fn_func_open_mac_os_screen_recording_settings(uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cua_driver_sdk_fn_func_open_mcp_driver_channel(transport: bigint, authenticatedPrincipal: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cua_driver_sdk_fn_func_plan_cursor_move(params: Uint8Array, request: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cua_driver_sdk_fn_func_plan_cursor_spec(spec: Uint8Array, request: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cua_driver_sdk_fn_func_request_mac_os_permissions(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_driver_sdk_fn_constructor_cuadriver_connect(socketPath: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cua_driver_sdk_fn_constructor_cuadriver_connect_with_client_kind(socketPath: Uint8Array, clientKind: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
@@ -1794,6 +1961,16 @@ interface NativeModuleInterface {
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;
+ uniffi_cua_driver_sdk_fn_method_cursortrajectory_arrival_t(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): number;
+ uniffi_cua_driver_sdk_fn_method_cursortrajectory_duration(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): number;
+ uniffi_cua_driver_sdk_fn_method_cursortrajectory_effect_frame(uniffiSelf: bigint, t: number, blend: number, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_driver_sdk_fn_method_cursortrajectory_effects(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_driver_sdk_fn_method_cursortrajectory_linger(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): number;
+ uniffi_cua_driver_sdk_fn_method_cursortrajectory_sample_at(uniffiSelf: bigint, t: number, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_driver_sdk_fn_method_cursortrajectory_samples(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_driver_sdk_fn_method_cursortrajectory_snap_t(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_driver_sdk_fn_method_cursortrajectory_target(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_driver_sdk_fn_method_cursortrajectory_target_known(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): number;
uniffi_cua_driver_sdk_fn_method_driveractivityobserver_on_activity(uniffiSelf: bigint, event: Uint8Array, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cua_driver_sdk_fn_method_driverauthorizationhost_authorize(uniffiSelf: bigint, request: Uint8Array): bigint;
uniffi_cua_driver_sdk_fn_method_driverservicetransport_send(uniffiSelf: bigint, request: Uint8Array): bigint;
@@ -1820,8 +1997,13 @@ interface NativeModuleInterface {
uniffi_cua_driver_sdk_checksum_func_create_remote_trusted_session(): number;
uniffi_cua_driver_sdk_checksum_func_create_trusted_session(): number;
uniffi_cua_driver_sdk_checksum_func_current_mac_os_permission_status(): number;
+ uniffi_cua_driver_sdk_checksum_func_cursor_click_effects(): number;
+ uniffi_cua_driver_sdk_checksum_func_cursor_motion_spec_for_style(): number;
+ uniffi_cua_driver_sdk_checksum_func_default_cursor_motion_params(): number;
uniffi_cua_driver_sdk_checksum_func_open_mac_os_screen_recording_settings(): number;
uniffi_cua_driver_sdk_checksum_func_open_mcp_driver_channel(): number;
+ uniffi_cua_driver_sdk_checksum_func_plan_cursor_move(): number;
+ uniffi_cua_driver_sdk_checksum_func_plan_cursor_spec(): number;
uniffi_cua_driver_sdk_checksum_func_request_mac_os_permissions(): number;
uniffi_cua_driver_sdk_checksum_constructor_cuadriver_connect(): number;
uniffi_cua_driver_sdk_checksum_constructor_cuadriver_connect_with_client_kind(): number;
@@ -1906,6 +2088,16 @@ interface NativeModuleInterface {
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;
+ uniffi_cua_driver_sdk_checksum_method_cursortrajectory_arrival_t(): number;
+ uniffi_cua_driver_sdk_checksum_method_cursortrajectory_duration(): number;
+ uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effect_frame(): number;
+ uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effects(): number;
+ uniffi_cua_driver_sdk_checksum_method_cursortrajectory_linger(): number;
+ uniffi_cua_driver_sdk_checksum_method_cursortrajectory_sample_at(): number;
+ uniffi_cua_driver_sdk_checksum_method_cursortrajectory_samples(): number;
+ uniffi_cua_driver_sdk_checksum_method_cursortrajectory_snap_t(): number;
+ uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target(): number;
+ uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target_known(): number;
uniffi_cua_driver_sdk_checksum_method_driveractivityobserver_on_activity(): number;
uniffi_cua_driver_sdk_checksum_method_driverauthorizationhost_authorize(): number;
uniffi_cua_driver_sdk_checksum_method_driverservicetransport_send(): 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 542c14c79a..4c5487c8e8 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, type UniffiVTableCallbackInterfaceCuaDriverSdkDriverServiceTransport, type UniffiForeignFutureResultVoid, type UniffiForeignFutureCompletevoid, type UniffiVTableCallbackInterfaceCuaDriverSdkForeignDriverEnvelopeChannel,
} 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 GetSessionInput, type GetSessionStateInput, type GetWindowStateInput, type HotkeyInput, type InvokeMenuInput, type ListAppsInput, type ListAppsOutput, type ListSessionsInput, type ListSessionsOutput, type ListWindowsInput, type ListWindowsOutput, type MoveCursorInput, type ParseVisualRegionsInput, type PressKeyInput, type ScrollInput, type SessionOutput, type SessionStateOutput, type SetAgentCursorEnabledInput, type SetAgentCursorMotionInput, type SetAgentCursorThemeInput, type SetWindowFrameInput, type StartSessionInput, type StartSessionOutput, type TypeTextInput, type VerifyStateInput, type VerifyStateOutput, type WindowStateOutput,
+import { type ActionResult, type ClickInput, type ClipboardReadInput, type ClipboardWriteInput, type CursorMotionEffects, type CursorMotionEffectsOutput, type DragInput, type EndSessionInput, type EndSessionOutput, type EscalateSessionInput, type GetAgentCursorStateInput, type GetCursorPositionInput, type GetDesktopStateInput, type GetScreenSizeInput, type GetSessionInput, type GetSessionStateInput, type GetWindowStateInput, type HotkeyInput, type InvokeMenuInput, type ListAppsInput, type ListAppsOutput, type ListSessionsInput, type ListSessionsOutput, type ListWindowsInput, type ListWindowsOutput, type MoveCursorInput, type ParseVisualRegionsInput, type PressKeyInput, type ScrollInput, type SessionOutput, type SessionStateOutput, type SetAgentCursorEnabledInput, type SetAgentCursorMotionInput, type SetAgentCursorThemeInput, type SetWindowFrameInput, type StartSessionInput, type StartSessionOutput, type TypeTextInput, type VerifyStateInput, type VerifyStateOutput, type WindowStateOutput, CursorMotionStyle, CursorMotionTiming,
} from "./cua_driver_contract.js";
-import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustCallStatus, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterInt32, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCall, uniffiTraitInterfaceCallAsyncWithError, uniffiTraitInterfaceCallWithError, uniffiTypeNameSymbol, variantOrdinalSymbol,
+import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustCallStatus, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterFloat64, FfiConverterInt32, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCall, uniffiTraitInterfaceCallAsyncWithError, uniffiTraitInterfaceCallWithError, 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, FfiConverterTypeGetSessionInput, FfiConverterTypeGetSessionStateInput, FfiConverterTypeGetWindowStateInput, FfiConverterTypeHotkeyInput, FfiConverterTypeInvokeMenuInput, FfiConverterTypeListAppsInput, FfiConverterTypeListAppsOutput, FfiConverterTypeListSessionsInput, FfiConverterTypeListSessionsOutput, FfiConverterTypeListWindowsInput, FfiConverterTypeListWindowsOutput, FfiConverterTypeMoveCursorInput, FfiConverterTypeParseVisualRegionsInput, FfiConverterTypePressKeyInput, FfiConverterTypeScrollInput, FfiConverterTypeSessionOutput, FfiConverterTypeSessionStateOutput, FfiConverterTypeSetAgentCursorEnabledInput, FfiConverterTypeSetAgentCursorMotionInput, FfiConverterTypeSetAgentCursorThemeInput, FfiConverterTypeSetWindowFrameInput, FfiConverterTypeStartSessionInput, FfiConverterTypeStartSessionOutput, FfiConverterTypeTypeTextInput, FfiConverterTypeVerifyStateInput, FfiConverterTypeVerifyStateOutput, FfiConverterTypeWindowStateOutput } = uniffiCuaDriverContractModule.converters;
+const { FfiConverterTypeActionResult, FfiConverterTypeClickInput, FfiConverterTypeClipboardReadInput, FfiConverterTypeClipboardWriteInput, FfiConverterTypeCursorMotionEffects, FfiConverterTypeCursorMotionEffectsOutput, FfiConverterTypeCursorMotionStyle, FfiConverterTypeCursorMotionTiming, FfiConverterTypeDragInput, FfiConverterTypeEndSessionInput, FfiConverterTypeEndSessionOutput, FfiConverterTypeEscalateSessionInput, FfiConverterTypeGetAgentCursorStateInput, FfiConverterTypeGetCursorPositionInput, FfiConverterTypeGetDesktopStateInput, FfiConverterTypeGetScreenSizeInput, FfiConverterTypeGetSessionInput, FfiConverterTypeGetSessionStateInput, FfiConverterTypeGetWindowStateInput, FfiConverterTypeHotkeyInput, FfiConverterTypeInvokeMenuInput, FfiConverterTypeListAppsInput, FfiConverterTypeListAppsOutput, FfiConverterTypeListSessionsInput, FfiConverterTypeListSessionsOutput, FfiConverterTypeListWindowsInput, FfiConverterTypeListWindowsOutput, FfiConverterTypeMoveCursorInput, FfiConverterTypeParseVisualRegionsInput, FfiConverterTypePressKeyInput, FfiConverterTypeScrollInput, FfiConverterTypeSessionOutput, FfiConverterTypeSessionStateOutput, FfiConverterTypeSetAgentCursorEnabledInput, FfiConverterTypeSetAgentCursorMotionInput, FfiConverterTypeSetAgentCursorThemeInput, FfiConverterTypeSetWindowFrameInput, FfiConverterTypeStartSessionInput, FfiConverterTypeStartSessionOutput, FfiConverterTypeTypeTextInput, FfiConverterTypeVerifyStateInput, FfiConverterTypeVerifyStateOutput, FfiConverterTypeWindowStateOutput } = uniffiCuaDriverContractModule.converters;
const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
const uniffiIsDebug =
@@ -108,6 +108,70 @@ export function currentMacOsPermissionStatus(): MacOsPermissionStatus {
));
}
+/**
+ * Click effects (ripple, squish) `age` seconds after a click at `(x, y)`.
+ */
+export function cursorClickEffects(effects: CursorMotionEffectsOutput, age: number, x: number, y: number): CursorEffectFrame {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeCursorEffectFrame.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_func_cursor_click_effects(
+ FfiConverterTypeCursorMotionEffectsOutput.lower(effects, nativeModule().rustbuffer_alloc),
+ FfiConverterFloat64.lower(age, nativeModule().rustbuffer_alloc),
+ FfiConverterFloat64.lower(x, nativeModule().rustbuffer_alloc),
+ FfiConverterFloat64.lower(y, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * The spec behind a built-in style (`signature_arc`, `spring_settle` and
+ * `comet_swoop`); `None` for the simulated styles.
+ */
+export function cursorMotionSpecForStyle(style: CursorMotionStyle, params: CursorMotionParams): CursorMotionSpec | undefined {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterOptionalTypeCursorMotionSpec.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_func_cursor_motion_spec_for_style(
+ FfiConverterTypeCursorMotionStyle.lower(style, nativeModule().rustbuffer_alloc),
+ FfiConverterTypeCursorMotionParams.lower(params, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * Cua Driver's default motion knobs.
+ */
+export function defaultCursorMotionParams(): CursorMotionParams {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeCursorMotionParams.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_func_default_cursor_motion_params(
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
export function openMacOsScreenRecordingSettings(): void /*throws*/ {uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_driver_sdk_fn_func_open_mac_os_screen_recording_settings(
@@ -133,6 +197,36 @@ export function openMcpDriverChannel(transport: DriverServiceTransport, authenti
));
}
+/**
+ * Plan one move for a built-in style.
+ */
+export function planCursorMove(params: CursorMotionParams, request: CursorMoveRequest): CursorTrajectoryLike {
+ return FfiConverterTypeCursorTrajectory.lift(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_func_plan_cursor_move(
+ FfiConverterTypeCursorMotionParams.lower(params, nativeModule().rustbuffer_alloc),
+ FfiConverterTypeCursorMoveRequest.lower(request, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * Plan one move for a custom spec.
+ */
+export function planCursorSpec(spec: CursorMotionSpec, request: CursorMoveRequest): CursorTrajectoryLike {
+ return FfiConverterTypeCursorTrajectory.lift(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_func_plan_cursor_spec(
+ FfiConverterTypeCursorMotionSpec.lower(spec, nativeModule().rustbuffer_alloc),
+ FfiConverterTypeCursorMoveRequest.lower(request, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
export function requestMacOsPermissions(): MacOsPermissionStatus {
return ((__rb: Uint8Array) => {
try {
@@ -307,22 +401,1689 @@ export const ConfiguredDriverOptions = (() => {
});
})();
-const FfiConverterTypeConfiguredDriverOptions = (() => {
- type TypeName = ConfiguredDriverOptions;
+const FfiConverterTypeConfiguredDriverOptions = (() => {
+ type TypeName = ConfiguredDriverOptions;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ claudeCodeCompatibility: FfiConverterBool.read(from),
+ authorization: FfiConverterTypeRuntimeAuthorizationOptions.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterBool.write(value.claudeCodeCompatibility, into);
+ FfiConverterTypeRuntimeAuthorizationOptions.write(value.authorization, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterBool.allocationSize(value.claudeCodeCompatibility) +
+ FfiConverterTypeRuntimeAuthorizationOptions.allocationSize(value.authorization);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * Speed glow.
+ */
+export type CursorGlow = {
+ x: number,
+ y: number,
+ r: number,
+ alpha: number
+}
+
+/**
+ * Generated factory for {@link CursorGlow} record objects.
+ */
+export const CursorGlow = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorGlow, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorGlow>,
+ });
+})();
+
+const FfiConverterTypeCursorGlow = (() => {
+ type TypeName = CursorGlow;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ x: FfiConverterFloat64.read(from),
+ y: FfiConverterFloat64.read(from),
+ r: FfiConverterFloat64.read(from),
+ alpha: FfiConverterFloat64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterFloat64.write(value.x, into);
+ FfiConverterFloat64.write(value.y, into);
+ FfiConverterFloat64.write(value.r, into);
+ FfiConverterFloat64.write(value.alpha, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterFloat64.allocationSize(value.x) +
+ FfiConverterFloat64.allocationSize(value.y) +
+ FfiConverterFloat64.allocationSize(value.r) +
+ FfiConverterFloat64.allocationSize(value.alpha);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * One round-capped stroke of the comet trail.
+ */
+export type CursorTrailSegment = {
+ ax: number,
+ ay: number,
+ bx: number,
+ by: number,
+ width: number,
+ alpha: number
+}
+
+/**
+ * Generated factory for {@link CursorTrailSegment} record objects.
+ */
+export const CursorTrailSegment = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorTrailSegment, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorTrailSegment>,
+ });
+})();
+
+const FfiConverterTypeCursorTrailSegment = (() => {
+ type TypeName = CursorTrailSegment;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ ax: FfiConverterFloat64.read(from),
+ ay: FfiConverterFloat64.read(from),
+ bx: FfiConverterFloat64.read(from),
+ by: FfiConverterFloat64.read(from),
+ width: FfiConverterFloat64.read(from),
+ alpha: FfiConverterFloat64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterFloat64.write(value.ax, into);
+ FfiConverterFloat64.write(value.ay, into);
+ FfiConverterFloat64.write(value.bx, into);
+ FfiConverterFloat64.write(value.by, into);
+ FfiConverterFloat64.write(value.width, into);
+ FfiConverterFloat64.write(value.alpha, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterFloat64.allocationSize(value.ax) +
+ FfiConverterFloat64.allocationSize(value.ay) +
+ FfiConverterFloat64.allocationSize(value.bx) +
+ FfiConverterFloat64.allocationSize(value.by) +
+ FfiConverterFloat64.allocationSize(value.width) +
+ FfiConverterFloat64.allocationSize(value.alpha);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * A target rect in screen points.
+ */
+export type CursorMotionRect = {
+ x: number,
+ y: number,
+ width: number,
+ height: number
+}
+
+/**
+ * Generated factory for {@link CursorMotionRect} record objects.
+ */
+export const CursorMotionRect = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorMotionRect, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorMotionRect>,
+ });
+})();
+
+const FfiConverterTypeCursorMotionRect = (() => {
+ type TypeName = CursorMotionRect;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ x: FfiConverterFloat64.read(from),
+ y: FfiConverterFloat64.read(from),
+ width: FfiConverterFloat64.read(from),
+ height: FfiConverterFloat64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterFloat64.write(value.x, into);
+ FfiConverterFloat64.write(value.y, into);
+ FfiConverterFloat64.write(value.width, into);
+ FfiConverterFloat64.write(value.height, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterFloat64.allocationSize(value.x) +
+ FfiConverterFloat64.allocationSize(value.y) +
+ FfiConverterFloat64.allocationSize(value.width) +
+ FfiConverterFloat64.allocationSize(value.height);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * Glow around the target after a magnetic lock-on.
+ */
+export type CursorMagnet = {
+ rect: CursorMotionRect,
+ glow: number
+}
+
+/**
+ * Generated factory for {@link CursorMagnet} record objects.
+ */
+export const CursorMagnet = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorMagnet, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorMagnet>,
+ });
+})();
+
+const FfiConverterTypeCursorMagnet = (() => {
+ type TypeName = CursorMagnet;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ rect: FfiConverterTypeCursorMotionRect.read(from),
+ glow: FfiConverterFloat64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterTypeCursorMotionRect.write(value.rect, into);
+ FfiConverterFloat64.write(value.glow, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterTypeCursorMotionRect.allocationSize(value.rect) +
+ FfiConverterFloat64.allocationSize(value.glow);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * Expanding click ring.
+ */
+export type CursorRipple = {
+ x: number,
+ y: number,
+ r: number,
+ width: number,
+ alpha: number
+}
+
+/**
+ * Generated factory for {@link CursorRipple} record objects.
+ */
+export const CursorRipple = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorRipple, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorRipple>,
+ });
+})();
+
+const FfiConverterTypeCursorRipple = (() => {
+ type TypeName = CursorRipple;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ x: FfiConverterFloat64.read(from),
+ y: FfiConverterFloat64.read(from),
+ r: FfiConverterFloat64.read(from),
+ width: FfiConverterFloat64.read(from),
+ alpha: FfiConverterFloat64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterFloat64.write(value.x, into);
+ FfiConverterFloat64.write(value.y, into);
+ FfiConverterFloat64.write(value.r, into);
+ FfiConverterFloat64.write(value.width, into);
+ FfiConverterFloat64.write(value.alpha, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterFloat64.allocationSize(value.x) +
+ FfiConverterFloat64.allocationSize(value.y) +
+ FfiConverterFloat64.allocationSize(value.r) +
+ FfiConverterFloat64.allocationSize(value.width) +
+ FfiConverterFloat64.allocationSize(value.alpha);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * The effects to paint at one moment.
+ */
+export type CursorEffectFrame = {
+ glow?: CursorGlow,
+ trail: Array<CursorTrailSegment>,
+ magnet?: CursorMagnet,
+ ripple?: CursorRipple,
+ /**
+ * Scale-down of the cursor, 0 = none.
+ */
+ squish: number
+}
+
+/**
+ * Generated factory for {@link CursorEffectFrame} record objects.
+ */
+export const CursorEffectFrame = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorEffectFrame, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorEffectFrame>,
+ });
+})();
+
+const FfiConverterTypeCursorEffectFrame = (() => {
+ type TypeName = CursorEffectFrame;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ glow: FfiConverterOptionalTypeCursorGlow.read(from),
+ trail: FfiConverterSequenceTypeCursorTrailSegment.read(from),
+ magnet: FfiConverterOptionalTypeCursorMagnet.read(from),
+ ripple: FfiConverterOptionalTypeCursorRipple.read(from),
+ squish: FfiConverterFloat64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterOptionalTypeCursorGlow.write(value.glow, into);
+ FfiConverterSequenceTypeCursorTrailSegment.write(value.trail, into);
+ FfiConverterOptionalTypeCursorMagnet.write(value.magnet, into);
+ FfiConverterOptionalTypeCursorRipple.write(value.ripple, into);
+ FfiConverterFloat64.write(value.squish, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterOptionalTypeCursorGlow.allocationSize(value.glow) +
+ FfiConverterSequenceTypeCursorTrailSegment.allocationSize(value.trail) +
+ FfiConverterOptionalTypeCursorMagnet.allocationSize(value.magnet) +
+ FfiConverterOptionalTypeCursorRipple.allocationSize(value.ripple) +
+ FfiConverterFloat64.allocationSize(value.squish);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * Knobs of the built-in styles. Defaults match Cua Driver
+ * (`default_cursor_motion_params`).
+ */
+export type CursorMotionParams = {
+ style: CursorMotionStyle,
+ timing: CursorMotionTiming,
+ effects: CursorMotionEffects,
+ startHandle: number,
+ endHandle: number,
+ arcSize: number,
+ arcFlow: number,
+ spring: number,
+ glideDurationMs: number,
+ peakSpeed: number,
+ minStartSpeed: number,
+ minEndSpeed: number,
+ turnRadius: number
+}
+
+/**
+ * Generated factory for {@link CursorMotionParams} record objects.
+ */
+export const CursorMotionParams = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorMotionParams, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorMotionParams>,
+ });
+})();
+
+const FfiConverterTypeCursorMotionParams = (() => {
+ type TypeName = CursorMotionParams;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ style: FfiConverterTypeCursorMotionStyle.read(from),
+ timing: FfiConverterTypeCursorMotionTiming.read(from),
+ effects: FfiConverterTypeCursorMotionEffects.read(from),
+ startHandle: FfiConverterFloat64.read(from),
+ endHandle: FfiConverterFloat64.read(from),
+ arcSize: FfiConverterFloat64.read(from),
+ arcFlow: FfiConverterFloat64.read(from),
+ spring: FfiConverterFloat64.read(from),
+ glideDurationMs: FfiConverterFloat64.read(from),
+ peakSpeed: FfiConverterFloat64.read(from),
+ minStartSpeed: FfiConverterFloat64.read(from),
+ minEndSpeed: FfiConverterFloat64.read(from),
+ turnRadius: FfiConverterFloat64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterTypeCursorMotionStyle.write(value.style, into);
+ FfiConverterTypeCursorMotionTiming.write(value.timing, into);
+ FfiConverterTypeCursorMotionEffects.write(value.effects, into);
+ FfiConverterFloat64.write(value.startHandle, into);
+ FfiConverterFloat64.write(value.endHandle, into);
+ FfiConverterFloat64.write(value.arcSize, into);
+ FfiConverterFloat64.write(value.arcFlow, into);
+ FfiConverterFloat64.write(value.spring, into);
+ FfiConverterFloat64.write(value.glideDurationMs, into);
+ FfiConverterFloat64.write(value.peakSpeed, into);
+ FfiConverterFloat64.write(value.minStartSpeed, into);
+ FfiConverterFloat64.write(value.minEndSpeed, into);
+ FfiConverterFloat64.write(value.turnRadius, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterTypeCursorMotionStyle.allocationSize(value.style) +
+ FfiConverterTypeCursorMotionTiming.allocationSize(value.timing) +
+ FfiConverterTypeCursorMotionEffects.allocationSize(value.effects) +
+ FfiConverterFloat64.allocationSize(value.startHandle) +
+ FfiConverterFloat64.allocationSize(value.endHandle) +
+ FfiConverterFloat64.allocationSize(value.arcSize) +
+ FfiConverterFloat64.allocationSize(value.arcFlow) +
+ FfiConverterFloat64.allocationSize(value.spring) +
+ FfiConverterFloat64.allocationSize(value.glideDurationMs) +
+ FfiConverterFloat64.allocationSize(value.peakSpeed) +
+ FfiConverterFloat64.allocationSize(value.minStartSpeed) +
+ FfiConverterFloat64.allocationSize(value.minEndSpeed) +
+ FfiConverterFloat64.allocationSize(value.turnRadius);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * A point in screen points (y down).
+ */
+export type CursorMotionPoint = {
+ x: number,
+ y: number
+}
+
+/**
+ * Generated factory for {@link CursorMotionPoint} record objects.
+ */
+export const CursorMotionPoint = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorMotionPoint, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorMotionPoint>,
+ });
+})();
+
+const FfiConverterTypeCursorMotionPoint = (() => {
+ type TypeName = CursorMotionPoint;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ x: FfiConverterFloat64.read(from),
+ y: FfiConverterFloat64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterFloat64.write(value.x, into);
+ FfiConverterFloat64.write(value.y, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterFloat64.allocationSize(value.x) +
+ FfiConverterFloat64.allocationSize(value.y);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * One sample: seconds from the start, the hotspot, and the arrow's heading.
+ */
+export type CursorMotionSample = {
+ t: number,
+ x: number,
+ y: number,
+ heading: number
+}
+
+/**
+ * Generated factory for {@link CursorMotionSample} record objects.
+ */
+export const CursorMotionSample = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorMotionSample, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorMotionSample>,
+ });
+})();
+
+const FfiConverterTypeCursorMotionSample = (() => {
+ type TypeName = CursorMotionSample;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ t: FfiConverterFloat64.read(from),
+ x: FfiConverterFloat64.read(from),
+ y: FfiConverterFloat64.read(from),
+ heading: FfiConverterFloat64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterFloat64.write(value.t, into);
+ FfiConverterFloat64.write(value.x, into);
+ FfiConverterFloat64.write(value.y, into);
+ FfiConverterFloat64.write(value.heading, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterFloat64.allocationSize(value.t) +
+ FfiConverterFloat64.allocationSize(value.x) +
+ FfiConverterFloat64.allocationSize(value.y) +
+ FfiConverterFloat64.allocationSize(value.heading);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+
+// Enum: CursorPathShape
+export enum CursorPathShape_Tags {
+ Straight = "Straight",
+ Arc = "Arc",
+ Bow = "Bow"
+}
+/**
+ * Path shape of a custom motion.
+ */
+export const CursorPathShape = (() => {
+
+ type Straight__interface = {
+ tag: CursorPathShape_Tags.Straight
+ };
+ class Straight_ extends UniffiEnum implements Straight__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorPathShape";
+ readonly tag = CursorPathShape_Tags.Straight;
+ constructor() {
+ super("CursorPathShape", "Straight");
+ }
+
+ static new(): Straight_ {
+ return new Straight_();
+ }
+
+ static instanceOf(obj: any): obj is Straight_ {
+ return obj.tag === CursorPathShape_Tags.Straight;
+ }
+
+ }
+
+ type Arc__interface = {
+ tag: CursorPathShape_Tags.Arc;
+ inner:
+Readonly<{startHandle: number; endHandle: number; arcSize: number; arcFlow: number}>
+ };
+ /**
+ * The Cua cubic bezier; a positive `arc_size` bends to the natural side.
+ */
+ class Arc_ extends UniffiEnum implements Arc__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorPathShape";
+ readonly tag = CursorPathShape_Tags.Arc;
+ readonly inner:
+Readonly<{startHandle: number; endHandle: number; arcSize: number; arcFlow: number}>;
+ constructor(
+inner: {startHandle: number; endHandle: number; arcSize: number; arcFlow: number }) {
+ super("CursorPathShape", "Arc");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {startHandle: number; endHandle: number; arcSize: number; arcFlow: number }): Arc_ {
+ return new Arc_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Arc_ {
+ return obj.tag === CursorPathShape_Tags.Arc;
+ }
+
+ }
+
+ type Bow__interface = {
+ tag: CursorPathShape_Tags.Bow;
+ inner:
+Readonly<{amount: number}>
+ };
+ /**
+ * A gentle quadratic bow.
+ */
+ class Bow_ extends UniffiEnum implements Bow__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorPathShape";
+ readonly tag = CursorPathShape_Tags.Bow;
+ readonly inner:
+Readonly<{amount: number}>;
+ constructor(
+inner: {amount: number }) {
+ super("CursorPathShape", "Bow");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {amount: number }): Bow_ {
+ return new Bow_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Bow_ {
+ return obj.tag === CursorPathShape_Tags.Bow;
+ }
+
+ }
+
+ function instanceOf(obj: any): obj is CursorPathShape {
+ return obj[uniffiTypeNameSymbol] === "CursorPathShape";
+ }
+
+ return Object.freeze({
+ instanceOf,
+ Straight: Straight_,
+ Arc: Arc_,
+ Bow: Bow_
+ });
+
+})();
+/**
+ * Path shape of a custom motion.
+ */
+export type CursorPathShape = InstanceType<
+ typeof CursorPathShape['Straight' | 'Arc' | 'Bow']
+>;
+
+// FfiConverter for enum CursorPathShape
+const FfiConverterTypeCursorPathShape = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = CursorPathShape;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return new CursorPathShape.Straight();
+ case 2: return new CursorPathShape.Arc({startHandle: FfiConverterFloat64.read(from), endHandle: FfiConverterFloat64.read(from), arcSize: FfiConverterFloat64.read(from), arcFlow: FfiConverterFloat64.read(from) });
+ case 3: return new CursorPathShape.Bow({amount: FfiConverterFloat64.read(from) });
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value.tag) {
+ case CursorPathShape_Tags.Straight: {
+ ordinalConverter.write(1, into);
+ return;
+ }
+ case CursorPathShape_Tags.Arc: {
+ ordinalConverter.write(2, into);
+ const inner = value.inner;
+ FfiConverterFloat64.write(inner.startHandle, into);
+ FfiConverterFloat64.write(inner.endHandle, into);
+ FfiConverterFloat64.write(inner.arcSize, into);
+ FfiConverterFloat64.write(inner.arcFlow, into);
+ return;
+ }
+ case CursorPathShape_Tags.Bow: {
+ ordinalConverter.write(3, into);
+ const inner = value.inner;
+ FfiConverterFloat64.write(inner.amount, into);
+ return;
+ }
+ default:
+ // Throwing from here means that CursorPathShape_Tags hasn't matched an ordinal.
+ throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ allocationSize(value: TypeName): number {
+ switch (value.tag) {
+ case CursorPathShape_Tags.Straight: {
+ return ordinalConverter.allocationSize(1);
+ }
+ case CursorPathShape_Tags.Arc: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(2);
+ size += FfiConverterFloat64.allocationSize(inner.startHandle);
+ size += FfiConverterFloat64.allocationSize(inner.endHandle);
+ size += FfiConverterFloat64.allocationSize(inner.arcSize);
+ size += FfiConverterFloat64.allocationSize(inner.arcFlow);
+ return size;
+ }
+ case CursorPathShape_Tags.Bow: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(3);
+ size += FfiConverterFloat64.allocationSize(inner.amount);
+ return size;
+ }
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ }
+ return new FFIConverter();
+})();
+
+
+// Enum: CursorEase
+export enum CursorEase_Tags {
+ Linear = "Linear",
+ MinJerk = "MinJerk",
+ Smootherstep = "Smootherstep",
+ InOutCubic = "InOutCubic",
+ InOutSine = "InOutSine",
+ OutCubic = "OutCubic",
+ CubicBezier = "CubicBezier"
+}
+/**
+ * Speed curve along the path.
+ */
+export const CursorEase = (() => {
+
+ type Linear__interface = {
+ tag: CursorEase_Tags.Linear
+ };
+ class Linear_ extends UniffiEnum implements Linear__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorEase";
+ readonly tag = CursorEase_Tags.Linear;
+ constructor() {
+ super("CursorEase", "Linear");
+ }
+
+ static new(): Linear_ {
+ return new Linear_();
+ }
+
+ static instanceOf(obj: any): obj is Linear_ {
+ return obj.tag === CursorEase_Tags.Linear;
+ }
+
+ }
+
+ type MinJerk__interface = {
+ tag: CursorEase_Tags.MinJerk
+ };
+ class MinJerk_ extends UniffiEnum implements MinJerk__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorEase";
+ readonly tag = CursorEase_Tags.MinJerk;
+ constructor() {
+ super("CursorEase", "MinJerk");
+ }
+
+ static new(): MinJerk_ {
+ return new MinJerk_();
+ }
+
+ static instanceOf(obj: any): obj is MinJerk_ {
+ return obj.tag === CursorEase_Tags.MinJerk;
+ }
+
+ }
+
+ type Smootherstep__interface = {
+ tag: CursorEase_Tags.Smootherstep
+ };
+ class Smootherstep_ extends UniffiEnum implements Smootherstep__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorEase";
+ readonly tag = CursorEase_Tags.Smootherstep;
+ constructor() {
+ super("CursorEase", "Smootherstep");
+ }
+
+ static new(): Smootherstep_ {
+ return new Smootherstep_();
+ }
+
+ static instanceOf(obj: any): obj is Smootherstep_ {
+ return obj.tag === CursorEase_Tags.Smootherstep;
+ }
+
+ }
+
+ type InOutCubic__interface = {
+ tag: CursorEase_Tags.InOutCubic
+ };
+ class InOutCubic_ extends UniffiEnum implements InOutCubic__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorEase";
+ readonly tag = CursorEase_Tags.InOutCubic;
+ constructor() {
+ super("CursorEase", "InOutCubic");
+ }
+
+ static new(): InOutCubic_ {
+ return new InOutCubic_();
+ }
+
+ static instanceOf(obj: any): obj is InOutCubic_ {
+ return obj.tag === CursorEase_Tags.InOutCubic;
+ }
+
+ }
+
+ type InOutSine__interface = {
+ tag: CursorEase_Tags.InOutSine
+ };
+ class InOutSine_ extends UniffiEnum implements InOutSine__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorEase";
+ readonly tag = CursorEase_Tags.InOutSine;
+ constructor() {
+ super("CursorEase", "InOutSine");
+ }
+
+ static new(): InOutSine_ {
+ return new InOutSine_();
+ }
+
+ static instanceOf(obj: any): obj is InOutSine_ {
+ return obj.tag === CursorEase_Tags.InOutSine;
+ }
+
+ }
+
+ type OutCubic__interface = {
+ tag: CursorEase_Tags.OutCubic
+ };
+ class OutCubic_ extends UniffiEnum implements OutCubic__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorEase";
+ readonly tag = CursorEase_Tags.OutCubic;
+ constructor() {
+ super("CursorEase", "OutCubic");
+ }
+
+ static new(): OutCubic_ {
+ return new OutCubic_();
+ }
+
+ static instanceOf(obj: any): obj is OutCubic_ {
+ return obj.tag === CursorEase_Tags.OutCubic;
+ }
+
+ }
+
+ type CubicBezier__interface = {
+ tag: CursorEase_Tags.CubicBezier;
+ inner:
+Readonly<{x1: number; y1: number; x2: number; y2: number}>
+ };
+ class CubicBezier_ extends UniffiEnum implements CubicBezier__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorEase";
+ readonly tag = CursorEase_Tags.CubicBezier;
+ readonly inner:
+Readonly<{x1: number; y1: number; x2: number; y2: number}>;
+ constructor(
+inner: {x1: number; y1: number; x2: number; y2: number }) {
+ super("CursorEase", "CubicBezier");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {x1: number; y1: number; x2: number; y2: number }): CubicBezier_ {
+ return new CubicBezier_(inner);
+ }
+
+ static instanceOf(obj: any): obj is CubicBezier_ {
+ return obj.tag === CursorEase_Tags.CubicBezier;
+ }
+
+ }
+
+ function instanceOf(obj: any): obj is CursorEase {
+ return obj[uniffiTypeNameSymbol] === "CursorEase";
+ }
+
+ return Object.freeze({
+ instanceOf,
+ Linear: Linear_,
+ MinJerk: MinJerk_,
+ Smootherstep: Smootherstep_,
+ InOutCubic: InOutCubic_,
+ InOutSine: InOutSine_,
+ OutCubic: OutCubic_,
+ CubicBezier: CubicBezier_
+ });
+
+})();
+/**
+ * Speed curve along the path.
+ */
+export type CursorEase = InstanceType<
+ typeof CursorEase['Linear' | 'MinJerk' | 'Smootherstep' | 'InOutCubic' | 'InOutSine' | 'OutCubic' | 'CubicBezier']
+>;
+
+// FfiConverter for enum CursorEase
+const FfiConverterTypeCursorEase = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = CursorEase;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return new CursorEase.Linear();
+ case 2: return new CursorEase.MinJerk();
+ case 3: return new CursorEase.Smootherstep();
+ case 4: return new CursorEase.InOutCubic();
+ case 5: return new CursorEase.InOutSine();
+ case 6: return new CursorEase.OutCubic();
+ case 7: return new CursorEase.CubicBezier({x1: FfiConverterFloat64.read(from), y1: FfiConverterFloat64.read(from), x2: FfiConverterFloat64.read(from), y2: FfiConverterFloat64.read(from) });
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value.tag) {
+ case CursorEase_Tags.Linear: {
+ ordinalConverter.write(1, into);
+ return;
+ }
+ case CursorEase_Tags.MinJerk: {
+ ordinalConverter.write(2, into);
+ return;
+ }
+ case CursorEase_Tags.Smootherstep: {
+ ordinalConverter.write(3, into);
+ return;
+ }
+ case CursorEase_Tags.InOutCubic: {
+ ordinalConverter.write(4, into);
+ return;
+ }
+ case CursorEase_Tags.InOutSine: {
+ ordinalConverter.write(5, into);
+ return;
+ }
+ case CursorEase_Tags.OutCubic: {
+ ordinalConverter.write(6, into);
+ return;
+ }
+ case CursorEase_Tags.CubicBezier: {
+ ordinalConverter.write(7, into);
+ const inner = value.inner;
+ FfiConverterFloat64.write(inner.x1, into);
+ FfiConverterFloat64.write(inner.y1, into);
+ FfiConverterFloat64.write(inner.x2, into);
+ FfiConverterFloat64.write(inner.y2, into);
+ return;
+ }
+ default:
+ // Throwing from here means that CursorEase_Tags hasn't matched an ordinal.
+ throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ allocationSize(value: TypeName): number {
+ switch (value.tag) {
+ case CursorEase_Tags.Linear: {
+ return ordinalConverter.allocationSize(1);
+ }
+ case CursorEase_Tags.MinJerk: {
+ return ordinalConverter.allocationSize(2);
+ }
+ case CursorEase_Tags.Smootherstep: {
+ return ordinalConverter.allocationSize(3);
+ }
+ case CursorEase_Tags.InOutCubic: {
+ return ordinalConverter.allocationSize(4);
+ }
+ case CursorEase_Tags.InOutSine: {
+ return ordinalConverter.allocationSize(5);
+ }
+ case CursorEase_Tags.OutCubic: {
+ return ordinalConverter.allocationSize(6);
+ }
+ case CursorEase_Tags.CubicBezier: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(7);
+ size += FfiConverterFloat64.allocationSize(inner.x1);
+ size += FfiConverterFloat64.allocationSize(inner.y1);
+ size += FfiConverterFloat64.allocationSize(inner.x2);
+ size += FfiConverterFloat64.allocationSize(inner.y2);
+ return size;
+ }
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ }
+ return new FFIConverter();
+})();
+
+
+// Enum: CursorSettle
+export enum CursorSettle_Tags {
+ None = "None",
+ FollowThrough = "FollowThrough",
+ Spring = "Spring"
+}
+/**
+ * Overshoot or settle at the end of the glide.
+ */
+export const CursorSettle = (() => {
+
+ type None__interface = {
+ tag: CursorSettle_Tags.None
+ };
+ class None_ extends UniffiEnum implements None__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorSettle";
+ readonly tag = CursorSettle_Tags.None;
+ constructor() {
+ super("CursorSettle", "None");
+ }
+
+ static new(): None_ {
+ return new None_();
+ }
+
+ static instanceOf(obj: any): obj is None_ {
+ return obj.tag === CursorSettle_Tags.None;
+ }
+
+ }
+
+ type FollowThrough__interface = {
+ tag: CursorSettle_Tags.FollowThrough;
+ inner:
+Readonly<{amount: number; maxPt: number; at: number}>
+ };
+ class FollowThrough_ extends UniffiEnum implements FollowThrough__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorSettle";
+ readonly tag = CursorSettle_Tags.FollowThrough;
+ readonly inner:
+Readonly<{amount: number; maxPt: number; at: number}>;
+ constructor(
+inner: {amount: number; maxPt: number; at: number }) {
+ super("CursorSettle", "FollowThrough");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {amount: number; maxPt: number; at: number }): FollowThrough_ {
+ return new FollowThrough_(inner);
+ }
+
+ static instanceOf(obj: any): obj is FollowThrough_ {
+ return obj.tag === CursorSettle_Tags.FollowThrough;
+ }
+
+ }
+
+ type Spring__interface = {
+ tag: CursorSettle_Tags.Spring;
+ inner:
+Readonly<{amount: number; maxPt: number; cycles: number; decay: number; start: number; glideEnd: number}>
+ };
+ class Spring_ extends UniffiEnum implements Spring__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorSettle";
+ readonly tag = CursorSettle_Tags.Spring;
+ readonly inner:
+Readonly<{amount: number; maxPt: number; cycles: number; decay: number; start: number; glideEnd: number}>;
+ constructor(
+inner: {amount: number; maxPt: number; cycles: number; decay: number; start: number; glideEnd: number }) {
+ super("CursorSettle", "Spring");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {amount: number; maxPt: number; cycles: number; decay: number; start: number; glideEnd: number }): Spring_ {
+ return new Spring_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Spring_ {
+ return obj.tag === CursorSettle_Tags.Spring;
+ }
+
+ }
+
+ function instanceOf(obj: any): obj is CursorSettle {
+ return obj[uniffiTypeNameSymbol] === "CursorSettle";
+ }
+
+ return Object.freeze({
+ instanceOf,
+ None: None_,
+ FollowThrough: FollowThrough_,
+ Spring: Spring_
+ });
+
+})();
+/**
+ * Overshoot or settle at the end of the glide.
+ */
+export type CursorSettle = InstanceType<
+ typeof CursorSettle['None' | 'FollowThrough' | 'Spring']
+>;
+
+// FfiConverter for enum CursorSettle
+const FfiConverterTypeCursorSettle = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = CursorSettle;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return new CursorSettle.None();
+ case 2: return new CursorSettle.FollowThrough({amount: FfiConverterFloat64.read(from), maxPt: FfiConverterFloat64.read(from), at: FfiConverterFloat64.read(from) });
+ case 3: return new CursorSettle.Spring({amount: FfiConverterFloat64.read(from), maxPt: FfiConverterFloat64.read(from), cycles: FfiConverterFloat64.read(from), decay: FfiConverterFloat64.read(from), start: FfiConverterFloat64.read(from), glideEnd: FfiConverterFloat64.read(from) });
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value.tag) {
+ case CursorSettle_Tags.None: {
+ ordinalConverter.write(1, into);
+ return;
+ }
+ case CursorSettle_Tags.FollowThrough: {
+ ordinalConverter.write(2, into);
+ const inner = value.inner;
+ FfiConverterFloat64.write(inner.amount, into);
+ FfiConverterFloat64.write(inner.maxPt, into);
+ FfiConverterFloat64.write(inner.at, into);
+ return;
+ }
+ case CursorSettle_Tags.Spring: {
+ ordinalConverter.write(3, into);
+ const inner = value.inner;
+ FfiConverterFloat64.write(inner.amount, into);
+ FfiConverterFloat64.write(inner.maxPt, into);
+ FfiConverterFloat64.write(inner.cycles, into);
+ FfiConverterFloat64.write(inner.decay, into);
+ FfiConverterFloat64.write(inner.start, into);
+ FfiConverterFloat64.write(inner.glideEnd, into);
+ return;
+ }
+ default:
+ // Throwing from here means that CursorSettle_Tags hasn't matched an ordinal.
+ throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ allocationSize(value: TypeName): number {
+ switch (value.tag) {
+ case CursorSettle_Tags.None: {
+ return ordinalConverter.allocationSize(1);
+ }
+ case CursorSettle_Tags.FollowThrough: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(2);
+ size += FfiConverterFloat64.allocationSize(inner.amount);
+ size += FfiConverterFloat64.allocationSize(inner.maxPt);
+ size += FfiConverterFloat64.allocationSize(inner.at);
+ return size;
+ }
+ case CursorSettle_Tags.Spring: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(3);
+ size += FfiConverterFloat64.allocationSize(inner.amount);
+ size += FfiConverterFloat64.allocationSize(inner.maxPt);
+ size += FfiConverterFloat64.allocationSize(inner.cycles);
+ size += FfiConverterFloat64.allocationSize(inner.decay);
+ size += FfiConverterFloat64.allocationSize(inner.start);
+ size += FfiConverterFloat64.allocationSize(inner.glideEnd);
+ return size;
+ }
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ }
+ return new FFIConverter();
+})();
+
+
+// Enum: CursorMotionDuration
+export enum CursorMotionDuration_Tags {
+ Fixed = "Fixed",
+ Fitts = "Fitts",
+ Distance = "Distance"
+}
+/**
+ * Duration model of a custom motion.
+ */
+export const CursorMotionDuration = (() => {
+
+ type Fixed__interface = {
+ tag: CursorMotionDuration_Tags.Fixed;
+ inner:
+Readonly<{ms: number}>
+ };
+ class Fixed_ extends UniffiEnum implements Fixed__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorMotionDuration";
+ readonly tag = CursorMotionDuration_Tags.Fixed;
+ readonly inner:
+Readonly<{ms: number}>;
+ constructor(
+inner: {ms: number }) {
+ super("CursorMotionDuration", "Fixed");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {ms: number }): Fixed_ {
+ return new Fixed_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Fixed_ {
+ return obj.tag === CursorMotionDuration_Tags.Fixed;
+ }
+
+ }
+
+ type Fitts__interface = {
+ tag: CursorMotionDuration_Tags.Fitts;
+ inner:
+Readonly<{a: number; b: number; minMs: number; maxMs: number; scale: number}>
+ };
+ class Fitts_ extends UniffiEnum implements Fitts__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorMotionDuration";
+ readonly tag = CursorMotionDuration_Tags.Fitts;
+ readonly inner:
+Readonly<{a: number; b: number; minMs: number; maxMs: number; scale: number}>;
+ constructor(
+inner: {a: number; b: number; minMs: number; maxMs: number; scale: number }) {
+ super("CursorMotionDuration", "Fitts");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {a: number; b: number; minMs: number; maxMs: number; scale: number }): Fitts_ {
+ return new Fitts_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Fitts_ {
+ return obj.tag === CursorMotionDuration_Tags.Fitts;
+ }
+
+ }
+
+ type Distance__interface = {
+ tag: CursorMotionDuration_Tags.Distance;
+ inner:
+Readonly<{baseMs: number; msPerPt: number; minMs: number; maxMs: number}>
+ };
+ class Distance_ extends UniffiEnum implements Distance__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "CursorMotionDuration";
+ readonly tag = CursorMotionDuration_Tags.Distance;
+ readonly inner:
+Readonly<{baseMs: number; msPerPt: number; minMs: number; maxMs: number}>;
+ constructor(
+inner: {baseMs: number; msPerPt: number; minMs: number; maxMs: number }) {
+ super("CursorMotionDuration", "Distance");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {baseMs: number; msPerPt: number; minMs: number; maxMs: number }): Distance_ {
+ return new Distance_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Distance_ {
+ return obj.tag === CursorMotionDuration_Tags.Distance;
+ }
+
+ }
+
+ function instanceOf(obj: any): obj is CursorMotionDuration {
+ return obj[uniffiTypeNameSymbol] === "CursorMotionDuration";
+ }
+
+ return Object.freeze({
+ instanceOf,
+ Fixed: Fixed_,
+ Fitts: Fitts_,
+ Distance: Distance_
+ });
+
+})();
+/**
+ * Duration model of a custom motion.
+ */
+export type CursorMotionDuration = InstanceType<
+ typeof CursorMotionDuration['Fixed' | 'Fitts' | 'Distance']
+>;
+
+// FfiConverter for enum CursorMotionDuration
+const FfiConverterTypeCursorMotionDuration = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = CursorMotionDuration;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return new CursorMotionDuration.Fixed({ms: FfiConverterFloat64.read(from) });
+ case 2: return new CursorMotionDuration.Fitts({a: FfiConverterFloat64.read(from), b: FfiConverterFloat64.read(from), minMs: FfiConverterFloat64.read(from), maxMs: FfiConverterFloat64.read(from), scale: FfiConverterFloat64.read(from) });
+ case 3: return new CursorMotionDuration.Distance({baseMs: FfiConverterFloat64.read(from), msPerPt: FfiConverterFloat64.read(from), minMs: FfiConverterFloat64.read(from), maxMs: FfiConverterFloat64.read(from) });
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value.tag) {
+ case CursorMotionDuration_Tags.Fixed: {
+ ordinalConverter.write(1, into);
+ const inner = value.inner;
+ FfiConverterFloat64.write(inner.ms, into);
+ return;
+ }
+ case CursorMotionDuration_Tags.Fitts: {
+ ordinalConverter.write(2, into);
+ const inner = value.inner;
+ FfiConverterFloat64.write(inner.a, into);
+ FfiConverterFloat64.write(inner.b, into);
+ FfiConverterFloat64.write(inner.minMs, into);
+ FfiConverterFloat64.write(inner.maxMs, into);
+ FfiConverterFloat64.write(inner.scale, into);
+ return;
+ }
+ case CursorMotionDuration_Tags.Distance: {
+ ordinalConverter.write(3, into);
+ const inner = value.inner;
+ FfiConverterFloat64.write(inner.baseMs, into);
+ FfiConverterFloat64.write(inner.msPerPt, into);
+ FfiConverterFloat64.write(inner.minMs, into);
+ FfiConverterFloat64.write(inner.maxMs, into);
+ return;
+ }
+ default:
+ // Throwing from here means that CursorMotionDuration_Tags hasn't matched an ordinal.
+ throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ allocationSize(value: TypeName): number {
+ switch (value.tag) {
+ case CursorMotionDuration_Tags.Fixed: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(1);
+ size += FfiConverterFloat64.allocationSize(inner.ms);
+ return size;
+ }
+ case CursorMotionDuration_Tags.Fitts: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(2);
+ size += FfiConverterFloat64.allocationSize(inner.a);
+ size += FfiConverterFloat64.allocationSize(inner.b);
+ size += FfiConverterFloat64.allocationSize(inner.minMs);
+ size += FfiConverterFloat64.allocationSize(inner.maxMs);
+ size += FfiConverterFloat64.allocationSize(inner.scale);
+ return size;
+ }
+ case CursorMotionDuration_Tags.Distance: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(3);
+ size += FfiConverterFloat64.allocationSize(inner.baseMs);
+ size += FfiConverterFloat64.allocationSize(inner.msPerPt);
+ size += FfiConverterFloat64.allocationSize(inner.minMs);
+ size += FfiConverterFloat64.allocationSize(inner.maxMs);
+ return size;
+ }
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ }
+ return new FFIConverter();
+})();
+
+/**
+ * `Tangent`: the tip leads the motion. `Fixed`: the rest pose.
+ */
+export enum CursorHeading {
+ Tangent,
+ Fixed
+}
+
+const FfiConverterTypeCursorHeading = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = CursorHeading;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return CursorHeading.Tangent;
+ case 2: return CursorHeading.Fixed;
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value) {
+ case CursorHeading.Tangent: return ordinalConverter.write(1, into);
+ case CursorHeading.Fixed: return ordinalConverter.write(2, into);
+ }
+ }
+ allocationSize(value: TypeName): number {
+ return ordinalConverter.allocationSize(0);
+ }
+ }
+ return new FFIConverter();
+})();
+
+/**
+ * The comet trail.
+ */
+export type CursorTrailSpec = {
+ secs: number,
+ fadeLen: number,
+ steps: number,
+ tailWidth: number,
+ headWidth: number,
+ alpha: number,
+ anchorOffset: number
+}
+
+/**
+ * Generated factory for {@link CursorTrailSpec} record objects.
+ */
+export const CursorTrailSpec = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorTrailSpec, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorTrailSpec>,
+ });
+})();
+
+const FfiConverterTypeCursorTrailSpec = (() => {
+ type TypeName = CursorTrailSpec;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ secs: FfiConverterFloat64.read(from),
+ fadeLen: FfiConverterFloat64.read(from),
+ steps: FfiConverterUInt32.read(from),
+ tailWidth: FfiConverterFloat64.read(from),
+ headWidth: FfiConverterFloat64.read(from),
+ alpha: FfiConverterFloat64.read(from),
+ anchorOffset: FfiConverterFloat64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterFloat64.write(value.secs, into);
+ FfiConverterFloat64.write(value.fadeLen, into);
+ FfiConverterUInt32.write(value.steps, into);
+ FfiConverterFloat64.write(value.tailWidth, into);
+ FfiConverterFloat64.write(value.headWidth, into);
+ FfiConverterFloat64.write(value.alpha, into);
+ FfiConverterFloat64.write(value.anchorOffset, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterFloat64.allocationSize(value.secs) +
+ FfiConverterFloat64.allocationSize(value.fadeLen) +
+ FfiConverterUInt32.allocationSize(value.steps) +
+ FfiConverterFloat64.allocationSize(value.tailWidth) +
+ FfiConverterFloat64.allocationSize(value.headWidth) +
+ FfiConverterFloat64.allocationSize(value.alpha) +
+ FfiConverterFloat64.allocationSize(value.anchorOffset);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * A complete custom motion.
+ */
+export type CursorMotionSpec = {
+ path: CursorPathShape,
+ ease: CursorEase,
+ settle: CursorSettle,
+ duration: CursorMotionDuration,
+ heading: CursorHeading,
+ effects: CursorMotionEffectsOutput,
+ trail: CursorTrailSpec
+}
+
+/**
+ * Generated factory for {@link CursorMotionSpec} record objects.
+ */
+export const CursorMotionSpec = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorMotionSpec, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorMotionSpec>,
+ });
+})();
+
+const FfiConverterTypeCursorMotionSpec = (() => {
+ type TypeName = CursorMotionSpec;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ path: FfiConverterTypeCursorPathShape.read(from),
+ ease: FfiConverterTypeCursorEase.read(from),
+ settle: FfiConverterTypeCursorSettle.read(from),
+ duration: FfiConverterTypeCursorMotionDuration.read(from),
+ heading: FfiConverterTypeCursorHeading.read(from),
+ effects: FfiConverterTypeCursorMotionEffectsOutput.read(from),
+ trail: FfiConverterTypeCursorTrailSpec.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterTypeCursorPathShape.write(value.path, into);
+ FfiConverterTypeCursorEase.write(value.ease, into);
+ FfiConverterTypeCursorSettle.write(value.settle, into);
+ FfiConverterTypeCursorMotionDuration.write(value.duration, into);
+ FfiConverterTypeCursorHeading.write(value.heading, into);
+ FfiConverterTypeCursorMotionEffectsOutput.write(value.effects, into);
+ FfiConverterTypeCursorTrailSpec.write(value.trail, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterTypeCursorPathShape.allocationSize(value.path) +
+ FfiConverterTypeCursorEase.allocationSize(value.ease) +
+ FfiConverterTypeCursorSettle.allocationSize(value.settle) +
+ FfiConverterTypeCursorMotionDuration.allocationSize(value.duration) +
+ FfiConverterTypeCursorHeading.allocationSize(value.heading) +
+ FfiConverterTypeCursorMotionEffectsOutput.allocationSize(value.effects) +
+ FfiConverterTypeCursorTrailSpec.allocationSize(value.trail);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+/**
+ * One move to plan.
+ */
+export type CursorMoveRequest = {
+ /**
+ * Current hotspot.
+ */
+ fromPoint: CursorMotionPoint,
+ /**
+ * Requested hotspot.
+ */
+ toPoint: CursorMotionPoint,
+ /**
+ * Current heading; the rest heading (pi/4) when unset.
+ */
+ fromHeading?: number,
+ /**
+ * Heading on arrival; the rest heading when unset.
+ */
+ endHeading?: number,
+ /**
+ * The target element's rect; it sets the Fitts width.
+ */
+ target?: CursorMotionRect,
+ /**
+ * Same seed, same motion.
+ */
+ seed: string,
+ /**
+ * A short straight glide without effects.
+ */
+ reducedMotion: boolean
+}
+
+/**
+ * Generated factory for {@link CursorMoveRequest} record objects.
+ */
+export const CursorMoveRequest = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CursorMoveRequest, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CursorMoveRequest>,
+ });
+})();
+
+const FfiConverterTypeCursorMoveRequest = (() => {
+ type TypeName = CursorMoveRequest;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- claudeCodeCompatibility: FfiConverterBool.read(from),
- authorization: FfiConverterTypeRuntimeAuthorizationOptions.read(from)
+ fromPoint: FfiConverterTypeCursorMotionPoint.read(from),
+ toPoint: FfiConverterTypeCursorMotionPoint.read(from),
+ fromHeading: FfiConverterOptionalFloat64.read(from),
+ endHeading: FfiConverterOptionalFloat64.read(from),
+ target: FfiConverterOptionalTypeCursorMotionRect.read(from),
+ seed: FfiConverterString.read(from),
+ reducedMotion: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
- FfiConverterBool.write(value.claudeCodeCompatibility, into);
- FfiConverterTypeRuntimeAuthorizationOptions.write(value.authorization, into);
+ FfiConverterTypeCursorMotionPoint.write(value.fromPoint, into);
+ FfiConverterTypeCursorMotionPoint.write(value.toPoint, into);
+ FfiConverterOptionalFloat64.write(value.fromHeading, into);
+ FfiConverterOptionalFloat64.write(value.endHeading, into);
+ FfiConverterOptionalTypeCursorMotionRect.write(value.target, into);
+ FfiConverterString.write(value.seed, into);
+ FfiConverterBool.write(value.reducedMotion, into);
}
allocationSize(value: TypeName): number {
- return FfiConverterBool.allocationSize(value.claudeCodeCompatibility) +
- FfiConverterTypeRuntimeAuthorizationOptions.allocationSize(value.authorization);
+ return FfiConverterTypeCursorMotionPoint.allocationSize(value.fromPoint) +
+ FfiConverterTypeCursorMotionPoint.allocationSize(value.toPoint) +
+ FfiConverterOptionalFloat64.allocationSize(value.fromHeading) +
+ FfiConverterOptionalFloat64.allocationSize(value.endHeading) +
+ FfiConverterOptionalTypeCursorMotionRect.allocationSize(value.target) +
+ FfiConverterString.allocationSize(value.seed) +
+ FfiConverterBool.allocationSize(value.reducedMotion);
}
};
@@ -6461,6 +8222,325 @@ const uniffiTypeCuaDriverSessionObjectFactory: UniffiObjectFactory<CuaDriverSess
}})();
const FfiConverterTypeCuaDriverSession = new FfiConverterObject(uniffiTypeCuaDriverSessionObjectFactory);
+/**
+ * A planned move, played back by time.
+ */
+export interface CursorTrajectoryLike {
+
+/**
+ * When the tip first reaches the target, seconds.
+ */
+ arrivalT(): number;
+/**
+ * Seconds until the last sample (any settle included).
+ */
+ duration(): number;
+/**
+ * The move's effects (glow, trail, magnet) at `t`, around the arrow's
+ * body. `blend` is whether the surface can draw translucency.
+ */
+ effectFrame(t: number, blend: boolean): CursorEffectFrame;
+ effects(): CursorMotionEffectsOutput;
+/**
+ * When the move and its trail or magnet glow have finished, seconds.
+ */
+ linger(): number;
+/**
+ * Interpolated sample at `t` seconds, clamped to the ends.
+ */
+ sampleAt(t: number): CursorMotionSample;
+/**
+ * Every sample at 120 Hz. Read once; interpolate locally per frame.
+ */
+ samples(): Array<CursorMotionSample>;
+/**
+ * Magnetic lock-on time, seconds.
+ */
+ snapT(): number | undefined;
+/**
+ * The target used for timing (the request's, or a 24 pt box).
+ */
+ target(): CursorMotionRect;
+ targetKnown(): boolean;
+}
+/**
+ * @deprecated Use `CursorTrajectoryLike` instead.
+ */
+export type CursorTrajectoryInterface = CursorTrajectoryLike;
+
+
+/**
+ * A planned move, played back by time.
+ */
+export class CursorTrajectory extends UniffiAbstractObject implements CursorTrajectoryLike {
+
+ readonly [uniffiTypeNameSymbol] = "CursorTrajectory";
+ readonly [destructorGuardSymbol]: UniffiGcObject;
+ readonly [pointerLiteralSymbol]: UniffiHandle;
+ // No primary constructor declared for this class.
+private constructor(pointer: UniffiHandle) {
+ super();
+ this[pointerLiteralSymbol] = pointer;
+ this[destructorGuardSymbol] = uniffiTypeCursorTrajectoryObjectFactory.bless(pointer);
+}
+
+
+
+
+/**
+ * When the tip first reaches the target, seconds.
+ */
+ arrivalT(): number {
+ return FfiConverterFloat64.lift(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cursortrajectory_arrival_t(
+ uniffiTypeCursorTrajectoryObjectFactory.clonePointer(this),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * Seconds until the last sample (any settle included).
+ */
+ duration(): number {
+ return FfiConverterFloat64.lift(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cursortrajectory_duration(
+ uniffiTypeCursorTrajectoryObjectFactory.clonePointer(this),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * The move's effects (glow, trail, magnet) at `t`, around the arrow's
+ * body. `blend` is whether the surface can draw translucency.
+ */
+ effectFrame(t: number, blend: boolean): CursorEffectFrame {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeCursorEffectFrame.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cursortrajectory_effect_frame(
+ uniffiTypeCursorTrajectoryObjectFactory.clonePointer(this),
+ FfiConverterFloat64.lower(t, nativeModule().rustbuffer_alloc),
+ FfiConverterBool.lower(blend, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+ effects(): CursorMotionEffectsOutput {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeCursorMotionEffectsOutput.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cursortrajectory_effects(
+ uniffiTypeCursorTrajectoryObjectFactory.clonePointer(this),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * When the move and its trail or magnet glow have finished, seconds.
+ */
+ linger(): number {
+ return FfiConverterFloat64.lift(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cursortrajectory_linger(
+ uniffiTypeCursorTrajectoryObjectFactory.clonePointer(this),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * Interpolated sample at `t` seconds, clamped to the ends.
+ */
+ sampleAt(t: number): CursorMotionSample {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeCursorMotionSample.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cursortrajectory_sample_at(
+ uniffiTypeCursorTrajectoryObjectFactory.clonePointer(this),
+ FfiConverterFloat64.lower(t, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * Every sample at 120 Hz. Read once; interpolate locally per frame.
+ */
+ samples(): Array<CursorMotionSample> {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterSequenceTypeCursorMotionSample.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cursortrajectory_samples(
+ uniffiTypeCursorTrajectoryObjectFactory.clonePointer(this),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * Magnetic lock-on time, seconds.
+ */
+ snapT(): number | undefined {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterOptionalFloat64.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cursortrajectory_snap_t(
+ uniffiTypeCursorTrajectoryObjectFactory.clonePointer(this),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * The target used for timing (the request's, or a 24 pt box).
+ */
+ target(): CursorMotionRect {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeCursorMotionRect.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cursortrajectory_target(
+ uniffiTypeCursorTrajectoryObjectFactory.clonePointer(this),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+ targetKnown(): boolean {
+ return FfiConverterBool.lift(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cursortrajectory_target_known(
+ uniffiTypeCursorTrajectoryObjectFactory.clonePointer(this),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+
+ uniffiDestroy(): void {
+ const ptr = (this as any)[destructorGuardSymbol];
+ if (ptr !== undefined) {
+ const pointer = uniffiTypeCursorTrajectoryObjectFactory.pointer(this);
+ uniffiTypeCursorTrajectoryObjectFactory.freePointer(pointer);
+ uniffiTypeCursorTrajectoryObjectFactory.unbless(ptr);
+ delete (this as any)[destructorGuardSymbol];
+ }
+ }
+
+ static instanceOf(obj_: any): obj_ is CursorTrajectory {
+ return uniffiTypeCursorTrajectoryObjectFactory.isConcreteType(obj_);
+ }
+
+
+}
+
+const uniffiTypeCursorTrajectoryObjectFactory: UniffiObjectFactory<CursorTrajectoryLike> = (() => {
+
+ /// <reference lib="es2021" />
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
+ uniffiTypeCursorTrajectoryObjectFactory.freePointer(heldValue);
+ }) : null;
+
+ return {
+ create(pointer: UniffiHandle): CursorTrajectoryLike {
+ const instance = Object.create(CursorTrajectory.prototype);
+ instance[pointerLiteralSymbol] = pointer;
+ instance[destructorGuardSymbol] = this.bless(pointer);
+ instance[uniffiTypeNameSymbol] = "CursorTrajectory";
+ return instance;
+ },
+
+
+ bless(p: UniffiHandle): UniffiGcObject {
+ const ptr = {
+ p, // make sure this object doesn't get optimized away.
+ markDestroyed: () => undefined,
+ };
+ if (registry) {
+ registry.register(ptr, p, ptr);
+ }
+ return ptr;
+ },
+
+ unbless(ptr_: UniffiGcObject) {
+ if (registry) {
+ registry.unregister(ptr_);
+ }
+ },
+
+ pointer(obj_: CursorTrajectoryLike): UniffiHandle {
+ if ((obj_ as any)[destructorGuardSymbol] === undefined) {
+ throw new UniffiInternalError.UnexpectedNullPointer();
+ }
+ return (obj_ as any)[pointerLiteralSymbol];
+ },
+
+ clonePointer(obj_: CursorTrajectoryLike): UniffiHandle {
+ const pointer = this.pointer(obj_);
+ return uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_driver_sdk_fn_clone_cursortrajectory(pointer, callStatus),
+ /*liftString:*/ FfiConverterString.lift
+ );
+ },
+
+ freePointer(pointer: UniffiHandle): void {
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_driver_sdk_fn_free_cursortrajectory(pointer, callStatus),
+ /*liftString:*/ FfiConverterString.lift
+ );
+ },
+
+ isConcreteType(obj_: any): obj_ is CursorTrajectoryLike {
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "CursorTrajectory";
+ },
+}})();
+const FfiConverterTypeCursorTrajectory = new FfiConverterObject(uniffiTypeCursorTrajectoryObjectFactory);
+
/**
* Optional observer implemented by trusted embedding-host code.
*
@@ -7541,6 +9621,24 @@ const FfiConverterSequenceTypeSessionPermissionMode = new FfiConverterArray(FfiC
// FfiConverter for string | undefined
const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
+// FfiConverter for CursorGlow | undefined
+const FfiConverterOptionalTypeCursorGlow = new FfiConverterOptional(FfiConverterTypeCursorGlow);
+
+// FfiConverter for Array<CursorTrailSegment>
+const FfiConverterSequenceTypeCursorTrailSegment = new FfiConverterArray(FfiConverterTypeCursorTrailSegment);
+
+// FfiConverter for CursorMagnet | undefined
+const FfiConverterOptionalTypeCursorMagnet = new FfiConverterOptional(FfiConverterTypeCursorMagnet);
+
+// FfiConverter for CursorRipple | undefined
+const FfiConverterOptionalTypeCursorRipple = new FfiConverterOptional(FfiConverterTypeCursorRipple);
+
+// FfiConverter for number | undefined
+const FfiConverterOptionalFloat64 = new FfiConverterOptional(FfiConverterFloat64);
+
+// FfiConverter for CursorMotionRect | undefined
+const FfiConverterOptionalTypeCursorMotionRect = new FfiConverterOptional(FfiConverterTypeCursorMotionRect);
+
// FfiConverter for Array<string>
const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
@@ -7568,9 +9666,15 @@ const FfiConverterOptionalTypeActionResult = new FfiConverterOptional(FfiConvert
// FfiConverter for VerifyStateOutput | undefined
const FfiConverterOptionalTypeVerifyStateOutput = new FfiConverterOptional(FfiConverterTypeVerifyStateOutput);
+// FfiConverter for Array<CursorMotionSample>
+const FfiConverterSequenceTypeCursorMotionSample = new FfiConverterArray(FfiConverterTypeCursorMotionSample);
+
// FfiConverter for EmbeddedDriverConnection | undefined
const FfiConverterOptionalTypeEmbeddedDriverConnection = new FfiConverterOptional(FfiConverterTypeEmbeddedDriverConnection);
+// FfiConverter for CursorMotionSpec | undefined
+const FfiConverterOptionalTypeCursorMotionSpec = new FfiConverterOptional(FfiConverterTypeCursorMotionSpec);
+
// FfiConverter for DriverOptions | undefined
const FfiConverterOptionalTypeDriverOptions = new FfiConverterOptional(FfiConverterTypeDriverOptions);
@@ -7605,12 +9709,27 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_driver_sdk_checksum_func_current_mac_os_permission_status() !== 22890) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_current_mac_os_permission_status");
}
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_func_cursor_click_effects() !== 47083) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_cursor_click_effects");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_func_cursor_motion_spec_for_style() !== 60220) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_cursor_motion_spec_for_style");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_func_default_cursor_motion_params() !== 63994) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_default_cursor_motion_params");
+ }
if (nativeModule().uniffi_cua_driver_sdk_checksum_func_open_mac_os_screen_recording_settings() !== 6663) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_open_mac_os_screen_recording_settings");
}
if (nativeModule().uniffi_cua_driver_sdk_checksum_func_open_mcp_driver_channel() !== 952) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_open_mcp_driver_channel");
}
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_func_plan_cursor_move() !== 47047) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_plan_cursor_move");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_func_plan_cursor_spec() !== 61096) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_plan_cursor_spec");
+ }
if (nativeModule().uniffi_cua_driver_sdk_checksum_func_request_mac_os_permissions() !== 61823) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_request_mac_os_permissions");
}
@@ -7863,6 +9982,36 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriversession_verify_state() !== 36472) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriversession_verify_state");
}
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cursortrajectory_arrival_t() !== 18003) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cursortrajectory_arrival_t");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cursortrajectory_duration() !== 45567) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cursortrajectory_duration");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effect_frame() !== 63284) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effect_frame");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effects() !== 30979) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cursortrajectory_effects");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cursortrajectory_linger() !== 61008) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cursortrajectory_linger");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cursortrajectory_sample_at() !== 63579) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cursortrajectory_sample_at");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cursortrajectory_samples() !== 43656) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cursortrajectory_samples");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cursortrajectory_snap_t() !== 61947) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cursortrajectory_snap_t");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target() !== 1238) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target");
+ }
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target_known() !== 24778) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cursortrajectory_target_known");
+ }
if (nativeModule().uniffi_cua_driver_sdk_checksum_method_driveractivityobserver_on_activity() !== 9786) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_driveractivityobserver_on_activity");
}
@@ -7940,6 +10089,24 @@ export default Object.freeze({
FfiConverterTypeConfiguredDriverOptions,
FfiConverterTypeCuaDriver,
FfiConverterTypeCuaDriverSession,
+ FfiConverterTypeCursorEase,
+ FfiConverterTypeCursorEffectFrame,
+ FfiConverterTypeCursorGlow,
+ FfiConverterTypeCursorHeading,
+ FfiConverterTypeCursorMagnet,
+ FfiConverterTypeCursorMotionDuration,
+ FfiConverterTypeCursorMotionParams,
+ FfiConverterTypeCursorMotionPoint,
+ FfiConverterTypeCursorMotionRect,
+ FfiConverterTypeCursorMotionSample,
+ FfiConverterTypeCursorMotionSpec,
+ FfiConverterTypeCursorMoveRequest,
+ FfiConverterTypeCursorPathShape,
+ FfiConverterTypeCursorRipple,
+ FfiConverterTypeCursorSettle,
+ FfiConverterTypeCursorTrailSegment,
+ FfiConverterTypeCursorTrailSpec,
+ FfiConverterTypeCursorTrajectory,
FfiConverterTypeDriverActivityEvent,
FfiConverterTypeDriverActivityKind,
FfiConverterTypeDriverActivityObserver,
diff --git a/libs/cua-driver/typescript/test/cursor-motion.test.mjs b/libs/cua-driver/typescript/test/cursor-motion.test.mjs
new file mode 100644
index 0000000000..1eaf85bc99
--- /dev/null
+++ b/libs/cua-driver/typescript/test/cursor-motion.test.mjs
@@ -0,0 +1,181 @@
+// Cua Cursor Motion through the generated TypeScript bindings: replays the
+// golden trajectories the Rust crate and the standalone web port share
+// (rust/crates/cua-cursor-motion/fixtures/golden.json) through
+// planCursorMove / planCursorSpec in the staged native library.
+import assert from "node:assert/strict"
+import { existsSync, readFileSync } from "node:fs"
+import path from "node:path"
+import test from "node:test"
+import { fileURLToPath } from "node:url"
+
+const testDirectory = path.dirname(fileURLToPath(import.meta.url))
+const libraryName =
+ process.platform === "darwin"
+ ? "libcua_driver_sdk.dylib"
+ : process.platform === "win32"
+ ? "cua_driver_sdk.dll"
+ : "libcua_driver_sdk.so"
+const nodeTriple =
+ process.platform === "darwin"
+ ? `darwin-${process.arch}`
+ : process.platform === "win32"
+ ? `win32-${process.arch}-msvc`
+ : `linux-${process.arch}-${process.report.getReport().header.glibcVersionRuntime ? "gnu" : "musl"}`
+const library = path.resolve(
+ testDirectory,
+ "../node_modules/@trycua",
+ `cua-driver-${nodeTriple}`,
+ libraryName,
+)
+if (process.env.CUA_DRIVER_REQUIRE_UNIFFI === "1" && !existsSync(library)) {
+ throw new Error(`required staged UniFFI library is missing: ${library}`)
+}
+const skip = !existsSync(library)
+
+const golden = JSON.parse(
+ readFileSync(
+ path.resolve(testDirectory, "../../rust/crates/cua-cursor-motion/fixtures/golden.json"),
+ "utf8",
+ ),
+)
+// The fixture rounds to 1e-9; the bindings run the same Rust code.
+const TOL = 1e-8
+const FRAME_FRACTIONS = [0.2, 0.5, 0.8, 1.0]
+const EFFECTS = ["trail", "glow", "magnet", "ripple", "squish"]
+
+const pascal = (snake) => snake.replace(/(^|_)([a-z])/g, (_, __, c) => c.toUpperCase())
+const camel = (snake) => snake.replace(/_([a-z])/g, (_, c) => c.toUpperCase())
+const camelKeys = (o) => Object.fromEntries(Object.entries(o).map(([k, v]) => [camel(k), v]))
+
+function near(name, got, want) {
+ assert.ok(Math.abs(got - want) <= TOL, `${name}: ${got} vs ${want}`)
+}
+
+async function load() {
+ const m = await import("@trycua/cua-driver")
+ const variant = (enumType, value) => {
+ const { type, ...fields } = value
+ const ctor = enumType[pascal(type)]
+ return Object.keys(fields).length ? ctor.new(camelKeys(fields)) : ctor.new()
+ }
+ const effects = (o) =>
+ Object.fromEntries(EFFECTS.map((k) => [k, o[k] === null ? undefined : o[k]]))
+ const params = (p) => ({
+ style: m.CursorMotionStyle[pascal(p.style)],
+ timing: m.CursorMotionTiming[pascal(p.timing)],
+ effects: effects(p.effects),
+ startHandle: p.start_handle,
+ endHandle: p.end_handle,
+ arcSize: p.arc_size,
+ arcFlow: p.arc_flow,
+ spring: p.spring,
+ glideDurationMs: p.glide_duration_ms,
+ peakSpeed: p.peak_speed,
+ minStartSpeed: p.min_start_speed,
+ minEndSpeed: p.min_end_speed,
+ turnRadius: p.turn_radius,
+ })
+ const request = (r) => ({
+ fromPoint: { x: r.from[0], y: r.from[1] },
+ toPoint: { x: r.to[0], y: r.to[1] },
+ fromHeading: r.from_heading,
+ endHeading: r.end_heading,
+ target: r.target
+ ? { x: r.target[0], y: r.target[1], width: r.target[2], height: r.target[3] }
+ : undefined,
+ seed: r.seed,
+ reducedMotion: r.reduced_motion,
+ })
+ const spec = (s) => ({
+ path: variant(m.CursorPathShape, s.path),
+ ease: variant(m.CursorEase, s.ease),
+ settle: variant(m.CursorSettle, s.settle),
+ duration: variant(m.CursorMotionDuration, s.duration),
+ heading: m.CursorHeading[pascal(s.heading)],
+ effects: s.effects,
+ trail: camelKeys(s.trail),
+ })
+ return { m, params, request, spec }
+}
+
+function checkFrame(name, frame, click, want) {
+ const present = (label, value, expected, fields) => {
+ assert.equal(value === undefined, expected === null, `${name}.${label} presence`)
+ if (value !== undefined) fields(value).forEach((v, i) => near(`${name}.${label}[${i}]`, v, expected[i]))
+ }
+ present("glow", frame.glow, want.glow, (g) => [g.x, g.y, g.r, g.alpha])
+ present("magnet", frame.magnet, want.magnet, (mg) => [
+ mg.rect.x,
+ mg.rect.y,
+ mg.rect.width,
+ mg.rect.height,
+ mg.glow,
+ ])
+ present("ripple", click.ripple, want.ripple, (r) => [r.x, r.y, r.r, r.width, r.alpha])
+ near(`${name}.squish`, click.squish, want.squish)
+ assert.equal(frame.trail.length, want.trail.length, `${name}.trail length`)
+ frame.trail.forEach((s, i) =>
+ [s.ax, s.ay, s.bx, s.by, s.width, s.alpha].forEach((v, j) =>
+ near(`${name}.trail[${i}][${j}]`, v, want.trail[i][j]),
+ ),
+ )
+}
+
+function check(m, name, traj, out) {
+ assert.equal(traj.samples().length, out.samples, `${name}: sample count`)
+ const d = traj.duration()
+ near(`${name}.duration`, d, out.duration)
+ near(`${name}.arrival`, traj.arrivalT(), out.arrival_t)
+ const snap = traj.snapT()
+ assert.equal(snap === undefined, out.snap_t === null, `${name}: snap`)
+ if (snap !== undefined) near(`${name}.snap`, snap, out.snap_t)
+ const t = traj.target()
+ ;[t.x, t.y, t.width, t.height].forEach((v, i) => near(`${name}.target`, v, out.target[i]))
+ assert.equal(traj.targetKnown(), out.target_known)
+ const fx = traj.effects()
+ assert.deepEqual(Object.fromEntries(EFFECTS.map((k) => [k, fx[k]])), out.effects)
+ out.grid.forEach((w, i) => {
+ const s = traj.sampleAt((d * i) / golden.grid)
+ ;[s.t, s.x, s.y, s.heading].forEach((v, j) => near(`${name}.grid[${i}][${j}]`, v, w[j]))
+ })
+ if (out.frames) {
+ near(`${name}.linger`, traj.linger(), out.linger)
+ const clicks = { trail: false, glow: false, magnet: false, ripple: true, squish: true }
+ out.frames.forEach((f, i) => {
+ const k = FRAME_FRACTIONS[i]
+ const at = d * k
+ const s = traj.sampleAt(at)
+ checkFrame(
+ `${name}@${k}`,
+ traj.effectFrame(at, true),
+ m.cursorClickEffects(clicks, 0.03 + 0.4 * k, s.x, s.y),
+ f.frame,
+ )
+ })
+ }
+}
+
+test("built-in styles match the golden trajectories", { skip }, async () => {
+ const { m, params, request } = await load()
+ assert.ok(golden.cases.length > 100)
+ for (const c of golden.cases) {
+ check(m, c.name, m.planCursorMove(params(c.params), request(c.request)), c.out)
+ }
+})
+
+test("custom specs match the golden trajectories", { skip }, async () => {
+ const { m, request, spec } = await load()
+ for (const c of golden.spec_cases) {
+ check(m, c.name, m.planCursorSpec(spec(c.spec), request(c.request)), c.out)
+ }
+})
+
+test("the arc styles are specs", { skip }, async () => {
+ const { m, request } = await load()
+ const params = { ...m.defaultCursorMotionParams(), style: m.CursorMotionStyle.CometSwoop }
+ const req = request(golden.cases[0].request)
+ const spec = m.cursorMotionSpecForStyle(m.CursorMotionStyle.CometSwoop, params)
+ assert.ok(spec)
+ assert.deepEqual(m.planCursorSpec(spec, req).samples(), m.planCursorMove(params, req).samples())
+ assert.equal(m.cursorMotionSpecForStyle(m.CursorMotionStyle.Magnetic, params), undefined)
+})
diff --git a/libs/cua-spacesd/Cargo.lock b/libs/cua-spacesd/Cargo.lock
index 415b4c8f72..b1e45c8092 100644
--- a/libs/cua-spacesd/Cargo.lock
+++ b/libs/cua-spacesd/Cargo.lock
@@ -1413,6 +1413,7 @@ version = "0.34.0"
dependencies = [
"async-trait",
"core-foundation",
+ "cua-cursor-motion",
"cua-driver-contract",
"cua-driver-core",
"cursor-overlay",
diff --git a/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock b/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock
index 84015dc429..fbf8a2f933 100644
--- a/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock
+++ b/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock
@@ -2136,6 +2136,7 @@ version = "0.34.0"
dependencies = [
"async-trait",
"core-foundation 0.10.1",
+ "cua-cursor-motion",
"cua-driver-contract",
"cua-driver-core",
"cursor-overlay",
diff --git a/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock b/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock
index 5a13385b8d..ca5699f537 100644
--- a/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock
+++ b/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock
@@ -1332,6 +1332,7 @@ version = "0.34.0"
dependencies = [
"async-trait",
"core-foundation",
+ "cua-cursor-motion",
"cua-driver-contract",
"cua-driver-core",
"cursor-overlay",