@trycua/cua-driver 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # cua-driver TypeScript SDK
2
+
3
+ Rust-backed TypeScript/Node SDK for Cua Driver client applications.
4
+
5
+ ## Product boundary
6
+
7
+ The package root exposes the native daemon SDK:
8
+
9
+ ```ts
10
+ import { CuaDriver } from "@trycua/cua-driver"
11
+ ```
12
+
13
+ `EmbeddedCuaDriverHost` is exported from both the package root and the
14
+ organizational `/embedded` entrypoint; they are the same generated Rust object.
15
+ The `/electron` entrypoint is a thin compatibility naming layer over the same
16
+ generated macOS permission functions. The package does not contain a TypeScript
17
+ MCP client. Agents already have
18
+ runtime-neutral MCP clients and should configure the executable directly:
19
+
20
+ ```text
21
+ cua-driver mcp
22
+ ```
23
+
24
+ The removed pre-release MCP facade used `CuaDriver.stdio()`, async methods,
25
+ `*Args` interfaces, and a TypeScript stdio transport. Application code migrates
26
+ to the synchronous Rust-backed methods shown below; agent code removes the Cua
27
+ package import and supplies `cua-driver mcp` to its agent SDK.
28
+
29
+ ## SDK example
30
+
31
+ ```ts
32
+ import {
33
+ CaptureScope,
34
+ CuaDriver,
35
+ EndSessionInput,
36
+ GetDesktopStateInput,
37
+ StartSessionInput,
38
+ } from "@trycua/cua-driver"
39
+
40
+ const driver = CuaDriver.connect(undefined) // default installed daemon socket
41
+ driver.startSession(
42
+ StartSessionInput.new({
43
+ session: "demo",
44
+ captureScope: CaptureScope.Desktop,
45
+ }),
46
+ )
47
+
48
+ try {
49
+ const desktop = driver.getDesktopState(
50
+ GetDesktopStateInput.new({ session: "demo" }),
51
+ )
52
+ console.log(desktop.images[0]?.mimeType)
53
+ } finally {
54
+ driver.endSession(EndSessionInput.new({ session: "demo" }))
55
+ driver.uniffiDestroy()
56
+ }
57
+ ```
58
+
59
+ The SDK is currently synchronous and requires a native library matching the
60
+ host OS and architecture. Desktop calls return a typed `ToolResult` with text,
61
+ images, verification/error metadata, and `structuredJson` / `rawJson` for
62
+ platform-extensible results. Session lifecycle calls return dedicated
63
+ generated records.
64
+
65
+ ## Embedded Node and Electron hosts
66
+
67
+ A signed desktop application can bundle `cua-driver`, start it as a direct
68
+ child, and connect both the native SDK and its agent runtime to the same private
69
+ daemon:
70
+
71
+ ```ts
72
+ import { CuaDriver, EmbeddedCuaDriverHost } from "@trycua/cua-driver"
73
+
74
+ const embedded = new EmbeddedCuaDriverHost(
75
+ "/path/inside/YourApp.app/Contents/Resources/cua-driver",
76
+ "com.example.your-app",
77
+ )
78
+
79
+ try {
80
+ const connection = await embedded.start()
81
+ const driver = CuaDriver.connect(connection.socketPath)
82
+ try {
83
+ // Application calls use driver; an agent runtime uses connection.mcp.
84
+ } finally {
85
+ driver.uniffiDestroy()
86
+ }
87
+ } finally {
88
+ await embedded.stop()
89
+ embedded.uniffiDestroy()
90
+ }
91
+ ```
92
+
93
+ On macOS, the application must spawn the daemon from the process that owns the
94
+ Accessibility and Screen Recording grants. Launching through a gateway,
95
+ terminal, `open`, or `NSWorkspace` changes the responsibility chain.
96
+
97
+ Electron main processes can call the permission primitives after
98
+ `app.whenReady()`. These functions run in the importing host process, so macOS
99
+ attributes their requests to the host rather than to the npm package or child
100
+ driver:
101
+
102
+ ```ts
103
+ import {
104
+ hasRequiredMacOSPermissions,
105
+ openMacOSScreenRecordingSettings,
106
+ requestMacOSPermissions,
107
+ } from "@trycua/cua-driver/electron"
108
+
109
+ const permissions = requestMacOSPermissions()
110
+ if (!hasRequiredMacOSPermissions(permissions) && !permissions.screenRecording) {
111
+ await openMacOSScreenRecordingSettings()
112
+ }
113
+ ```
114
+
115
+ The adapter does not provide dialogs, settings rows, or onboarding policy. Do
116
+ not start the daemon until `hasRequiredMacOSPermissions()` returns true. Stop the
117
+ daemon before the host exits. If grants change while it is running, destroy all
118
+ SDK clients and MCP proxies, call `embedded.restart()`, and reconnect using the
119
+ new connection: every restart changes the generation, PID, and endpoint.
120
+
121
+ `start()` is concurrency-safe and coalesces callers. `stop()` cancels an
122
+ in-progress start and is idempotent. Treat a returned connection as valid only
123
+ for its generation, observe unexpected termination with
124
+ `waitForExit(connection.generation)`, and stop new work before teardown. The
125
+ Rust host also closes a parent-liveness pipe on normal destruction so the daemon
126
+ cannot remain orphaned after a host crash.
127
+
128
+ The npm package installs one optional native package selected for the current
129
+ OS and CPU. It does not bundle the `cua-driver` executable: ship that executable
130
+ outside ASAR, preserve its executable bit, and sign it before signing and
131
+ notarizing the enclosing app.
@@ -0,0 +1,7 @@
1
+ import { type MacOsPermissionStatus } from './native/index.js';
2
+ /** Compatibility spelling retained for the Electron-specific entry point. */
3
+ export type MacOSPermissionStatus = MacOsPermissionStatus;
4
+ /** Call after Electron's app.whenReady(), from the Electron main process. */
5
+ export declare const requestMacOSPermissions: () => MacOSPermissionStatus;
6
+ export declare const hasRequiredMacOSPermissions: (status: MacOSPermissionStatus) => boolean;
7
+ export declare const openMacOSScreenRecordingSettings: () => Promise<void>;
@@ -0,0 +1,7 @@
1
+ import { openMacOsScreenRecordingSettings as openGeneratedSettings, requestMacOsPermissions as requestGeneratedPermissions, } from './native/index.js';
2
+ /** Call after Electron's app.whenReady(), from the Electron main process. */
3
+ export const requestMacOSPermissions = () => {
4
+ return requestGeneratedPermissions();
5
+ };
6
+ export const hasRequiredMacOSPermissions = (status) => status.accessibility && status.screenRecording;
7
+ export const openMacOSScreenRecordingSettings = async () => openGeneratedSettings();
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Embedded-host exports backed by the same Rust/UniFFI implementation as the
3
+ * package root. This subpath is organizational only; it contains no independent
4
+ * process, socket, authorization, or restart logic.
5
+ */
6
+ export { EmbeddedCuaDriverHost, EmbeddedDriverConnection, EmbeddedDriverError, EmbeddedDriverExit, EmbeddedDriverHostOptions, EmbeddedDriverHostState, EmbeddedEnvironmentVariable, EmbeddedMcpConfiguration, EmbeddedPermissionMode, } from "./native/cua_driver_sdk.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Embedded-host exports backed by the same Rust/UniFFI implementation as the
3
+ * package root. This subpath is organizational only; it contains no independent
4
+ * process, socket, authorization, or restart logic.
5
+ */
6
+ export { EmbeddedCuaDriverHost, EmbeddedDriverConnection, EmbeddedDriverError, EmbeddedDriverExit, EmbeddedDriverHostOptions, EmbeddedDriverHostState, EmbeddedEnvironmentVariable, EmbeddedMcpConfiguration, EmbeddedPermissionMode, } from "./native/cua_driver_sdk.js";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Rust-backed SDK for Cua Driver client applications.
3
+ *
4
+ * Agents should configure `cua-driver mcp` through their runtime's existing
5
+ * MCP client instead of importing a language MCP facade.
6
+ */
7
+ export * from "./native/index.js";
8
+ export { default } from "./native/index.js";
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Rust-backed SDK for Cua Driver client applications.
3
+ *
4
+ * Agents should configure `cua-driver mcp` through their runtime's existing
5
+ * MCP client instead of importing a language MCP facade.
6
+ */
7
+ export * from "./native/index.js";
8
+ export { default } from "./native/index.js";
@@ -0,0 +1,62 @@
1
+ import { type UniffiRustCallStatus } from '@ubjs/core';
2
+ interface NativeModuleInterface {
3
+ ffi_cua_driver_contract_rust_future_poll_u8(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
4
+ ffi_cua_driver_contract_rust_future_cancel_u8(handle: bigint): void;
5
+ ffi_cua_driver_contract_rust_future_complete_u8(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
6
+ ffi_cua_driver_contract_rust_future_free_u8(handle: bigint): void;
7
+ ffi_cua_driver_contract_rust_future_poll_i8(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
8
+ ffi_cua_driver_contract_rust_future_cancel_i8(handle: bigint): void;
9
+ ffi_cua_driver_contract_rust_future_complete_i8(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
10
+ ffi_cua_driver_contract_rust_future_free_i8(handle: bigint): void;
11
+ ffi_cua_driver_contract_rust_future_poll_u16(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
12
+ ffi_cua_driver_contract_rust_future_cancel_u16(handle: bigint): void;
13
+ ffi_cua_driver_contract_rust_future_complete_u16(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
14
+ ffi_cua_driver_contract_rust_future_free_u16(handle: bigint): void;
15
+ ffi_cua_driver_contract_rust_future_poll_i16(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
16
+ ffi_cua_driver_contract_rust_future_cancel_i16(handle: bigint): void;
17
+ ffi_cua_driver_contract_rust_future_complete_i16(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
18
+ ffi_cua_driver_contract_rust_future_free_i16(handle: bigint): void;
19
+ ffi_cua_driver_contract_rust_future_poll_u32(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
20
+ ffi_cua_driver_contract_rust_future_cancel_u32(handle: bigint): void;
21
+ ffi_cua_driver_contract_rust_future_complete_u32(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
22
+ ffi_cua_driver_contract_rust_future_free_u32(handle: bigint): void;
23
+ ffi_cua_driver_contract_rust_future_poll_i32(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
24
+ ffi_cua_driver_contract_rust_future_cancel_i32(handle: bigint): void;
25
+ ffi_cua_driver_contract_rust_future_complete_i32(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
26
+ ffi_cua_driver_contract_rust_future_free_i32(handle: bigint): void;
27
+ ffi_cua_driver_contract_rust_future_poll_u64(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
28
+ ffi_cua_driver_contract_rust_future_cancel_u64(handle: bigint): void;
29
+ ffi_cua_driver_contract_rust_future_complete_u64(handle: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
30
+ ffi_cua_driver_contract_rust_future_free_u64(handle: bigint): void;
31
+ ffi_cua_driver_contract_rust_future_poll_i64(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
32
+ ffi_cua_driver_contract_rust_future_cancel_i64(handle: bigint): void;
33
+ ffi_cua_driver_contract_rust_future_complete_i64(handle: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
34
+ ffi_cua_driver_contract_rust_future_free_i64(handle: bigint): void;
35
+ ffi_cua_driver_contract_rust_future_poll_f32(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
36
+ ffi_cua_driver_contract_rust_future_cancel_f32(handle: bigint): void;
37
+ ffi_cua_driver_contract_rust_future_complete_f32(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
38
+ ffi_cua_driver_contract_rust_future_free_f32(handle: bigint): void;
39
+ ffi_cua_driver_contract_rust_future_poll_f64(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
40
+ ffi_cua_driver_contract_rust_future_cancel_f64(handle: bigint): void;
41
+ ffi_cua_driver_contract_rust_future_complete_f64(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
42
+ ffi_cua_driver_contract_rust_future_free_f64(handle: bigint): void;
43
+ ffi_cua_driver_contract_rust_future_poll_rust_buffer(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
44
+ ffi_cua_driver_contract_rust_future_cancel_rust_buffer(handle: bigint): void;
45
+ ffi_cua_driver_contract_rust_future_complete_rust_buffer(handle: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
46
+ ffi_cua_driver_contract_rust_future_free_rust_buffer(handle: bigint): void;
47
+ ffi_cua_driver_contract_rust_future_poll_void(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
48
+ ffi_cua_driver_contract_rust_future_cancel_void(handle: bigint): void;
49
+ ffi_cua_driver_contract_rust_future_complete_void(handle: bigint, uniffi_out_err: UniffiRustCallStatus): void;
50
+ ffi_cua_driver_contract_rust_future_free_void(handle: bigint): void;
51
+ ffi_cua_driver_contract_uniffi_contract_version(): number;
52
+ rustbuffer_alloc(n: number): Uint8Array;
53
+ rustbuffer_free(view: Uint8Array): void;
54
+ }
55
+ declare const getter: () => NativeModuleInterface;
56
+ export default getter;
57
+ export type UniffiRustFutureContinuationCallback = (data: bigint, pollResult: number) => void;
58
+ export type UniffiForeignFutureDroppedCallback = (handle: bigint) => void;
59
+ export type UniffiForeignFutureDroppedCallbackStruct = {
60
+ handle: bigint;
61
+ free: UniffiForeignFutureDroppedCallback;
62
+ };
@@ -0,0 +1,294 @@
1
+ // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
2
+ // Trust me, you don't want to mess with it!
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ // @ts-nocheck
6
+ import lib from "@ubjs/node";
7
+ const { UniffiNativeModule, FfiType, resolveLibPath } = lib;
8
+ const DEFINITIONS = {
9
+ symbols: {
10
+ rustbuffer_alloc: "ffi_cua_driver_contract_rustbuffer_alloc",
11
+ rustbuffer_free: "ffi_cua_driver_contract_rustbuffer_free",
12
+ rustbuffer_from_bytes: "ffi_cua_driver_contract_rustbuffer_from_bytes",
13
+ },
14
+ functions: {
15
+ "ffi_cua_driver_contract_rust_future_poll_u8": {
16
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
17
+ ret: FfiType.Void,
18
+ hasRustCallStatus: false,
19
+ },
20
+ "ffi_cua_driver_contract_rust_future_cancel_u8": {
21
+ args: [FfiType.Handle],
22
+ ret: FfiType.Void,
23
+ hasRustCallStatus: false,
24
+ },
25
+ "ffi_cua_driver_contract_rust_future_complete_u8": {
26
+ args: [FfiType.Handle],
27
+ ret: FfiType.UInt8,
28
+ hasRustCallStatus: true,
29
+ },
30
+ "ffi_cua_driver_contract_rust_future_free_u8": {
31
+ args: [FfiType.Handle],
32
+ ret: FfiType.Void,
33
+ hasRustCallStatus: false,
34
+ },
35
+ "ffi_cua_driver_contract_rust_future_poll_i8": {
36
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
37
+ ret: FfiType.Void,
38
+ hasRustCallStatus: false,
39
+ },
40
+ "ffi_cua_driver_contract_rust_future_cancel_i8": {
41
+ args: [FfiType.Handle],
42
+ ret: FfiType.Void,
43
+ hasRustCallStatus: false,
44
+ },
45
+ "ffi_cua_driver_contract_rust_future_complete_i8": {
46
+ args: [FfiType.Handle],
47
+ ret: FfiType.Int8,
48
+ hasRustCallStatus: true,
49
+ },
50
+ "ffi_cua_driver_contract_rust_future_free_i8": {
51
+ args: [FfiType.Handle],
52
+ ret: FfiType.Void,
53
+ hasRustCallStatus: false,
54
+ },
55
+ "ffi_cua_driver_contract_rust_future_poll_u16": {
56
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
57
+ ret: FfiType.Void,
58
+ hasRustCallStatus: false,
59
+ },
60
+ "ffi_cua_driver_contract_rust_future_cancel_u16": {
61
+ args: [FfiType.Handle],
62
+ ret: FfiType.Void,
63
+ hasRustCallStatus: false,
64
+ },
65
+ "ffi_cua_driver_contract_rust_future_complete_u16": {
66
+ args: [FfiType.Handle],
67
+ ret: FfiType.UInt16,
68
+ hasRustCallStatus: true,
69
+ },
70
+ "ffi_cua_driver_contract_rust_future_free_u16": {
71
+ args: [FfiType.Handle],
72
+ ret: FfiType.Void,
73
+ hasRustCallStatus: false,
74
+ },
75
+ "ffi_cua_driver_contract_rust_future_poll_i16": {
76
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
77
+ ret: FfiType.Void,
78
+ hasRustCallStatus: false,
79
+ },
80
+ "ffi_cua_driver_contract_rust_future_cancel_i16": {
81
+ args: [FfiType.Handle],
82
+ ret: FfiType.Void,
83
+ hasRustCallStatus: false,
84
+ },
85
+ "ffi_cua_driver_contract_rust_future_complete_i16": {
86
+ args: [FfiType.Handle],
87
+ ret: FfiType.Int16,
88
+ hasRustCallStatus: true,
89
+ },
90
+ "ffi_cua_driver_contract_rust_future_free_i16": {
91
+ args: [FfiType.Handle],
92
+ ret: FfiType.Void,
93
+ hasRustCallStatus: false,
94
+ },
95
+ "ffi_cua_driver_contract_rust_future_poll_u32": {
96
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
97
+ ret: FfiType.Void,
98
+ hasRustCallStatus: false,
99
+ },
100
+ "ffi_cua_driver_contract_rust_future_cancel_u32": {
101
+ args: [FfiType.Handle],
102
+ ret: FfiType.Void,
103
+ hasRustCallStatus: false,
104
+ },
105
+ "ffi_cua_driver_contract_rust_future_complete_u32": {
106
+ args: [FfiType.Handle],
107
+ ret: FfiType.UInt32,
108
+ hasRustCallStatus: true,
109
+ },
110
+ "ffi_cua_driver_contract_rust_future_free_u32": {
111
+ args: [FfiType.Handle],
112
+ ret: FfiType.Void,
113
+ hasRustCallStatus: false,
114
+ },
115
+ "ffi_cua_driver_contract_rust_future_poll_i32": {
116
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
117
+ ret: FfiType.Void,
118
+ hasRustCallStatus: false,
119
+ },
120
+ "ffi_cua_driver_contract_rust_future_cancel_i32": {
121
+ args: [FfiType.Handle],
122
+ ret: FfiType.Void,
123
+ hasRustCallStatus: false,
124
+ },
125
+ "ffi_cua_driver_contract_rust_future_complete_i32": {
126
+ args: [FfiType.Handle],
127
+ ret: FfiType.Int32,
128
+ hasRustCallStatus: true,
129
+ },
130
+ "ffi_cua_driver_contract_rust_future_free_i32": {
131
+ args: [FfiType.Handle],
132
+ ret: FfiType.Void,
133
+ hasRustCallStatus: false,
134
+ },
135
+ "ffi_cua_driver_contract_rust_future_poll_u64": {
136
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
137
+ ret: FfiType.Void,
138
+ hasRustCallStatus: false,
139
+ },
140
+ "ffi_cua_driver_contract_rust_future_cancel_u64": {
141
+ args: [FfiType.Handle],
142
+ ret: FfiType.Void,
143
+ hasRustCallStatus: false,
144
+ },
145
+ "ffi_cua_driver_contract_rust_future_complete_u64": {
146
+ args: [FfiType.Handle],
147
+ ret: FfiType.Handle,
148
+ hasRustCallStatus: true,
149
+ },
150
+ "ffi_cua_driver_contract_rust_future_free_u64": {
151
+ args: [FfiType.Handle],
152
+ ret: FfiType.Void,
153
+ hasRustCallStatus: false,
154
+ },
155
+ "ffi_cua_driver_contract_rust_future_poll_i64": {
156
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
157
+ ret: FfiType.Void,
158
+ hasRustCallStatus: false,
159
+ },
160
+ "ffi_cua_driver_contract_rust_future_cancel_i64": {
161
+ args: [FfiType.Handle],
162
+ ret: FfiType.Void,
163
+ hasRustCallStatus: false,
164
+ },
165
+ "ffi_cua_driver_contract_rust_future_complete_i64": {
166
+ args: [FfiType.Handle],
167
+ ret: FfiType.Int64,
168
+ hasRustCallStatus: true,
169
+ },
170
+ "ffi_cua_driver_contract_rust_future_free_i64": {
171
+ args: [FfiType.Handle],
172
+ ret: FfiType.Void,
173
+ hasRustCallStatus: false,
174
+ },
175
+ "ffi_cua_driver_contract_rust_future_poll_f32": {
176
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
177
+ ret: FfiType.Void,
178
+ hasRustCallStatus: false,
179
+ },
180
+ "ffi_cua_driver_contract_rust_future_cancel_f32": {
181
+ args: [FfiType.Handle],
182
+ ret: FfiType.Void,
183
+ hasRustCallStatus: false,
184
+ },
185
+ "ffi_cua_driver_contract_rust_future_complete_f32": {
186
+ args: [FfiType.Handle],
187
+ ret: FfiType.Float32,
188
+ hasRustCallStatus: true,
189
+ },
190
+ "ffi_cua_driver_contract_rust_future_free_f32": {
191
+ args: [FfiType.Handle],
192
+ ret: FfiType.Void,
193
+ hasRustCallStatus: false,
194
+ },
195
+ "ffi_cua_driver_contract_rust_future_poll_f64": {
196
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
197
+ ret: FfiType.Void,
198
+ hasRustCallStatus: false,
199
+ },
200
+ "ffi_cua_driver_contract_rust_future_cancel_f64": {
201
+ args: [FfiType.Handle],
202
+ ret: FfiType.Void,
203
+ hasRustCallStatus: false,
204
+ },
205
+ "ffi_cua_driver_contract_rust_future_complete_f64": {
206
+ args: [FfiType.Handle],
207
+ ret: FfiType.Float64,
208
+ hasRustCallStatus: true,
209
+ },
210
+ "ffi_cua_driver_contract_rust_future_free_f64": {
211
+ args: [FfiType.Handle],
212
+ ret: FfiType.Void,
213
+ hasRustCallStatus: false,
214
+ },
215
+ "ffi_cua_driver_contract_rust_future_poll_rust_buffer": {
216
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
217
+ ret: FfiType.Void,
218
+ hasRustCallStatus: false,
219
+ },
220
+ "ffi_cua_driver_contract_rust_future_cancel_rust_buffer": {
221
+ args: [FfiType.Handle],
222
+ ret: FfiType.Void,
223
+ hasRustCallStatus: false,
224
+ },
225
+ "ffi_cua_driver_contract_rust_future_complete_rust_buffer": {
226
+ args: [FfiType.Handle],
227
+ ret: FfiType.RustBuffer,
228
+ hasRustCallStatus: true,
229
+ },
230
+ "ffi_cua_driver_contract_rust_future_free_rust_buffer": {
231
+ args: [FfiType.Handle],
232
+ ret: FfiType.Void,
233
+ hasRustCallStatus: false,
234
+ },
235
+ "ffi_cua_driver_contract_rust_future_poll_void": {
236
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
237
+ ret: FfiType.Void,
238
+ hasRustCallStatus: false,
239
+ },
240
+ "ffi_cua_driver_contract_rust_future_cancel_void": {
241
+ args: [FfiType.Handle],
242
+ ret: FfiType.Void,
243
+ hasRustCallStatus: false,
244
+ },
245
+ "ffi_cua_driver_contract_rust_future_complete_void": {
246
+ args: [FfiType.Handle],
247
+ ret: FfiType.Void,
248
+ hasRustCallStatus: true,
249
+ },
250
+ "ffi_cua_driver_contract_rust_future_free_void": {
251
+ args: [FfiType.Handle],
252
+ ret: FfiType.Void,
253
+ hasRustCallStatus: false,
254
+ },
255
+ "ffi_cua_driver_contract_uniffi_contract_version": {
256
+ args: [],
257
+ ret: FfiType.UInt32,
258
+ hasRustCallStatus: false,
259
+ },
260
+ },
261
+ callbacks: {
262
+ "RustFutureContinuationCallback": {
263
+ args: [FfiType.Handle, FfiType.Int8],
264
+ ret: FfiType.Void,
265
+ hasRustCallStatus: false,
266
+ },
267
+ "ForeignFutureDroppedCallback": {
268
+ args: [FfiType.Handle],
269
+ ret: FfiType.Void,
270
+ hasRustCallStatus: false,
271
+ },
272
+ },
273
+ structs: {
274
+ "ForeignFutureDroppedCallbackStruct": [
275
+ { name: "handle", type: FfiType.Handle },
276
+ { name: "free", type: FfiType.Callback("ForeignFutureDroppedCallback") },
277
+ ],
278
+ },
279
+ };
280
+ let _nativeModule;
281
+ const getter = () => {
282
+ if (!_nativeModule) {
283
+ const libPath = resolveLibPath({
284
+ crateName: "cua_driver_sdk",
285
+ callerUrl: import.meta.url,
286
+ npmPackageBase: "@trycua/cua-driver-",
287
+ tripleStyle: "node",
288
+ });
289
+ const mod_ = UniffiNativeModule.open(libPath);
290
+ _nativeModule = mod_.register(DEFINITIONS);
291
+ }
292
+ return _nativeModule;
293
+ };
294
+ export default getter;