@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.
@@ -0,0 +1,1857 @@
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 nativeModule from "./cua_driver_sdk-ffi.js";
7
+ import { AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterBool, FfiConverterInt32, FfiConverterObject, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, UniffiAbstractObject, UniffiError, UniffiInternalError, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTypeNameSymbol, } from "@ubjs/core";
8
+ import uniffiCuaDriverContractModule from "./cua_driver_contract.js";
9
+ const { FfiConverterTypeClickInput, FfiConverterTypeDragInput, FfiConverterTypeEndSessionInput, FfiConverterTypeEndSessionOutput, FfiConverterTypeEscalateSessionInput, FfiConverterTypeGetCursorPositionInput, FfiConverterTypeGetDesktopStateInput, FfiConverterTypeGetScreenSizeInput, FfiConverterTypeGetSessionStateInput, FfiConverterTypeHotkeyInput, FfiConverterTypeMoveCursorInput, FfiConverterTypePressKeyInput, FfiConverterTypeScrollInput, FfiConverterTypeSessionStateOutput, FfiConverterTypeStartSessionInput, FfiConverterTypeStartSessionOutput, FfiConverterTypeTypeTextInput } = uniffiCuaDriverContractModule.converters;
10
+ const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
11
+ const uniffiIsDebug =
12
+ // @ts-ignore -- The process global might not be defined
13
+ typeof process !== "object" ||
14
+ // @ts-ignore -- The process global might not be defined
15
+ process?.env?.NODE_ENV !== "production" ||
16
+ false;
17
+ // Public interface members begin here.
18
+ export function currentMacOsPermissionStatus() {
19
+ return ((__rb) => {
20
+ try {
21
+ return FfiConverterTypeMacOsPermissionStatus.lift(__rb);
22
+ }
23
+ finally {
24
+ nativeModule().rustbuffer_free(__rb);
25
+ }
26
+ })(uniffiCaller.rustCall(
27
+ /*caller:*/ (callStatus) => {
28
+ return nativeModule().uniffi_cua_driver_sdk_fn_func_current_mac_os_permission_status(callStatus);
29
+ },
30
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
31
+ }
32
+ export function openMacOsScreenRecordingSettings() {
33
+ uniffiCaller.rustCallWithError(
34
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
35
+ /*caller:*/ (callStatus) => {
36
+ nativeModule().uniffi_cua_driver_sdk_fn_func_open_mac_os_screen_recording_settings(callStatus);
37
+ },
38
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
39
+ }
40
+ export function requestMacOsPermissions() {
41
+ return ((__rb) => {
42
+ try {
43
+ return FfiConverterTypeMacOsPermissionStatus.lift(__rb);
44
+ }
45
+ finally {
46
+ nativeModule().rustbuffer_free(__rb);
47
+ }
48
+ })(uniffiCaller.rustCall(
49
+ /*caller:*/ (callStatus) => {
50
+ return nativeModule().uniffi_cua_driver_sdk_fn_func_request_mac_os_permissions(callStatus);
51
+ },
52
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
53
+ }
54
+ const stringConverter = (() => {
55
+ const encoder = new TextEncoder();
56
+ const decoder = new TextDecoder();
57
+ return {
58
+ stringToBytes: (s) => encoder.encode(s),
59
+ bytesToString: (ab) => decoder.decode(ab),
60
+ stringByteLength: (s) => encoder.encode(s).byteLength,
61
+ writeStringIntoBuffer: (s, buf, offset) => {
62
+ const view = new Uint8Array(buf.arrayBuffer, offset, buf.arrayBuffer.byteLength - offset);
63
+ return encoder.encodeInto(s, view).written;
64
+ },
65
+ readStringFromBuffer: (buf, offset, length) => decoder.decode(new Uint8Array(buf.arrayBuffer, offset, length)),
66
+ };
67
+ })();
68
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
69
+ /**
70
+ * Generated factory for {@link DriverMetadata} record objects.
71
+ */
72
+ export const DriverMetadata = (() => {
73
+ const defaults = () => ({});
74
+ const create = (() => {
75
+ return uniffiCreateRecord(defaults);
76
+ })();
77
+ return Object.freeze({
78
+ create,
79
+ new: create,
80
+ defaults: () => Object.freeze(defaults()),
81
+ });
82
+ })();
83
+ const FfiConverterTypeDriverMetadata = (() => {
84
+ class FFIConverter extends AbstractFfiConverterByteArray {
85
+ read(from) {
86
+ return {
87
+ driverVersion: FfiConverterString.read(from),
88
+ contractVersion: FfiConverterString.read(from),
89
+ toolsListSchemaVersion: FfiConverterString.read(from),
90
+ capabilityVersion: FfiConverterString.read(from),
91
+ mcpProtocolVersion: FfiConverterString.read(from),
92
+ pid: FfiConverterUInt32.read(from),
93
+ embedded: FfiConverterBool.read(from),
94
+ hostBundleId: FfiConverterOptionalString.read(from)
95
+ };
96
+ }
97
+ write(value, into) {
98
+ FfiConverterString.write(value.driverVersion, into);
99
+ FfiConverterString.write(value.contractVersion, into);
100
+ FfiConverterString.write(value.toolsListSchemaVersion, into);
101
+ FfiConverterString.write(value.capabilityVersion, into);
102
+ FfiConverterString.write(value.mcpProtocolVersion, into);
103
+ FfiConverterUInt32.write(value.pid, into);
104
+ FfiConverterBool.write(value.embedded, into);
105
+ FfiConverterOptionalString.write(value.hostBundleId, into);
106
+ }
107
+ allocationSize(value) {
108
+ return FfiConverterString.allocationSize(value.driverVersion) +
109
+ FfiConverterString.allocationSize(value.contractVersion) +
110
+ FfiConverterString.allocationSize(value.toolsListSchemaVersion) +
111
+ FfiConverterString.allocationSize(value.capabilityVersion) +
112
+ FfiConverterString.allocationSize(value.mcpProtocolVersion) +
113
+ FfiConverterUInt32.allocationSize(value.pid) +
114
+ FfiConverterBool.allocationSize(value.embedded) +
115
+ FfiConverterOptionalString.allocationSize(value.hostBundleId);
116
+ }
117
+ }
118
+ ;
119
+ return new FFIConverter();
120
+ })();
121
+ /**
122
+ * Generated factory for {@link EmbeddedEnvironmentVariable} record objects.
123
+ */
124
+ export const EmbeddedEnvironmentVariable = (() => {
125
+ const defaults = () => ({});
126
+ const create = (() => {
127
+ return uniffiCreateRecord(defaults);
128
+ })();
129
+ return Object.freeze({
130
+ create,
131
+ new: create,
132
+ defaults: () => Object.freeze(defaults()),
133
+ });
134
+ })();
135
+ const FfiConverterTypeEmbeddedEnvironmentVariable = (() => {
136
+ class FFIConverter extends AbstractFfiConverterByteArray {
137
+ read(from) {
138
+ return {
139
+ name: FfiConverterString.read(from),
140
+ value: FfiConverterString.read(from)
141
+ };
142
+ }
143
+ write(value, into) {
144
+ FfiConverterString.write(value.name, into);
145
+ FfiConverterString.write(value.value, into);
146
+ }
147
+ allocationSize(value) {
148
+ return FfiConverterString.allocationSize(value.name) +
149
+ FfiConverterString.allocationSize(value.value);
150
+ }
151
+ }
152
+ ;
153
+ return new FFIConverter();
154
+ })();
155
+ /**
156
+ * Generated factory for {@link EmbeddedMcpConfiguration} record objects.
157
+ */
158
+ export const EmbeddedMcpConfiguration = (() => {
159
+ const defaults = () => ({});
160
+ const create = (() => {
161
+ return uniffiCreateRecord(defaults);
162
+ })();
163
+ return Object.freeze({
164
+ create,
165
+ new: create,
166
+ defaults: () => Object.freeze(defaults()),
167
+ });
168
+ })();
169
+ const FfiConverterTypeEmbeddedMcpConfiguration = (() => {
170
+ class FFIConverter extends AbstractFfiConverterByteArray {
171
+ read(from) {
172
+ return {
173
+ command: FfiConverterString.read(from),
174
+ args: FfiConverterSequenceString.read(from),
175
+ environment: FfiConverterSequenceTypeEmbeddedEnvironmentVariable.read(from)
176
+ };
177
+ }
178
+ write(value, into) {
179
+ FfiConverterString.write(value.command, into);
180
+ FfiConverterSequenceString.write(value.args, into);
181
+ FfiConverterSequenceTypeEmbeddedEnvironmentVariable.write(value.environment, into);
182
+ }
183
+ allocationSize(value) {
184
+ return FfiConverterString.allocationSize(value.command) +
185
+ FfiConverterSequenceString.allocationSize(value.args) +
186
+ FfiConverterSequenceTypeEmbeddedEnvironmentVariable.allocationSize(value.environment);
187
+ }
188
+ }
189
+ ;
190
+ return new FFIConverter();
191
+ })();
192
+ /**
193
+ * Generated factory for {@link EmbeddedDriverConnection} record objects.
194
+ */
195
+ export const EmbeddedDriverConnection = (() => {
196
+ const defaults = () => ({});
197
+ const create = (() => {
198
+ return uniffiCreateRecord(defaults);
199
+ })();
200
+ return Object.freeze({
201
+ create,
202
+ new: create,
203
+ defaults: () => Object.freeze(defaults()),
204
+ });
205
+ })();
206
+ const FfiConverterTypeEmbeddedDriverConnection = (() => {
207
+ class FFIConverter extends AbstractFfiConverterByteArray {
208
+ read(from) {
209
+ return {
210
+ socketPath: FfiConverterString.read(from),
211
+ pid: FfiConverterUInt32.read(from),
212
+ generation: FfiConverterString.read(from),
213
+ driverVersion: FfiConverterString.read(from),
214
+ contractVersion: FfiConverterString.read(from),
215
+ mcpProtocolVersion: FfiConverterString.read(from),
216
+ mcp: FfiConverterTypeEmbeddedMcpConfiguration.read(from)
217
+ };
218
+ }
219
+ write(value, into) {
220
+ FfiConverterString.write(value.socketPath, into);
221
+ FfiConverterUInt32.write(value.pid, into);
222
+ FfiConverterString.write(value.generation, into);
223
+ FfiConverterString.write(value.driverVersion, into);
224
+ FfiConverterString.write(value.contractVersion, into);
225
+ FfiConverterString.write(value.mcpProtocolVersion, into);
226
+ FfiConverterTypeEmbeddedMcpConfiguration.write(value.mcp, into);
227
+ }
228
+ allocationSize(value) {
229
+ return FfiConverterString.allocationSize(value.socketPath) +
230
+ FfiConverterUInt32.allocationSize(value.pid) +
231
+ FfiConverterString.allocationSize(value.generation) +
232
+ FfiConverterString.allocationSize(value.driverVersion) +
233
+ FfiConverterString.allocationSize(value.contractVersion) +
234
+ FfiConverterString.allocationSize(value.mcpProtocolVersion) +
235
+ FfiConverterTypeEmbeddedMcpConfiguration.allocationSize(value.mcp);
236
+ }
237
+ }
238
+ ;
239
+ return new FFIConverter();
240
+ })();
241
+ /**
242
+ * Generated factory for {@link EmbeddedDriverExit} record objects.
243
+ */
244
+ export const EmbeddedDriverExit = (() => {
245
+ const defaults = () => ({});
246
+ const create = (() => {
247
+ return uniffiCreateRecord(defaults);
248
+ })();
249
+ return Object.freeze({
250
+ create,
251
+ new: create,
252
+ defaults: () => Object.freeze(defaults()),
253
+ });
254
+ })();
255
+ const FfiConverterTypeEmbeddedDriverExit = (() => {
256
+ class FFIConverter extends AbstractFfiConverterByteArray {
257
+ read(from) {
258
+ return {
259
+ generation: FfiConverterString.read(from),
260
+ code: FfiConverterOptionalInt32.read(from),
261
+ success: FfiConverterBool.read(from)
262
+ };
263
+ }
264
+ write(value, into) {
265
+ FfiConverterString.write(value.generation, into);
266
+ FfiConverterOptionalInt32.write(value.code, into);
267
+ FfiConverterBool.write(value.success, into);
268
+ }
269
+ allocationSize(value) {
270
+ return FfiConverterString.allocationSize(value.generation) +
271
+ FfiConverterOptionalInt32.allocationSize(value.code) +
272
+ FfiConverterBool.allocationSize(value.success);
273
+ }
274
+ }
275
+ ;
276
+ return new FFIConverter();
277
+ })();
278
+ export var EmbeddedPermissionMode;
279
+ (function (EmbeddedPermissionMode) {
280
+ EmbeddedPermissionMode[EmbeddedPermissionMode["Standard"] = 0] = "Standard";
281
+ EmbeddedPermissionMode[EmbeddedPermissionMode["Bounded"] = 1] = "Bounded";
282
+ EmbeddedPermissionMode[EmbeddedPermissionMode["Unrestricted"] = 2] = "Unrestricted";
283
+ })(EmbeddedPermissionMode || (EmbeddedPermissionMode = {}));
284
+ const FfiConverterTypeEmbeddedPermissionMode = (() => {
285
+ const ordinalConverter = FfiConverterInt32;
286
+ class FFIConverter extends AbstractFfiConverterByteArray {
287
+ read(from) {
288
+ switch (ordinalConverter.read(from)) {
289
+ case 1: return EmbeddedPermissionMode.Standard;
290
+ case 2: return EmbeddedPermissionMode.Bounded;
291
+ case 3: return EmbeddedPermissionMode.Unrestricted;
292
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
293
+ }
294
+ }
295
+ write(value, into) {
296
+ switch (value) {
297
+ case EmbeddedPermissionMode.Standard: return ordinalConverter.write(1, into);
298
+ case EmbeddedPermissionMode.Bounded: return ordinalConverter.write(2, into);
299
+ case EmbeddedPermissionMode.Unrestricted: return ordinalConverter.write(3, into);
300
+ }
301
+ }
302
+ allocationSize(value) {
303
+ return ordinalConverter.allocationSize(0);
304
+ }
305
+ }
306
+ return new FFIConverter();
307
+ })();
308
+ /**
309
+ * Generated factory for {@link EmbeddedDriverHostOptions} record objects.
310
+ */
311
+ export const EmbeddedDriverHostOptions = (() => {
312
+ const defaults = () => ({});
313
+ const create = (() => {
314
+ return uniffiCreateRecord(defaults);
315
+ })();
316
+ return Object.freeze({
317
+ create,
318
+ new: create,
319
+ defaults: () => Object.freeze(defaults()),
320
+ });
321
+ })();
322
+ const FfiConverterTypeEmbeddedDriverHostOptions = (() => {
323
+ class FFIConverter extends AbstractFfiConverterByteArray {
324
+ read(from) {
325
+ return {
326
+ binaryPath: FfiConverterString.read(from),
327
+ hostBundleId: FfiConverterString.read(from),
328
+ socketPath: FfiConverterOptionalString.read(from),
329
+ startupTimeoutMs: FfiConverterOptionalUInt64.read(from),
330
+ shutdownTimeoutMs: FfiConverterOptionalUInt64.read(from),
331
+ permissionMode: FfiConverterOptionalTypeEmbeddedPermissionMode.read(from),
332
+ sessionPolicyPath: FfiConverterOptionalString.read(from),
333
+ approveSessionPolicy: FfiConverterBool.read(from),
334
+ dangerouslyBypassApprovals: FfiConverterBool.read(from),
335
+ environment: FfiConverterSequenceTypeEmbeddedEnvironmentVariable.read(from),
336
+ inheritStderr: FfiConverterBool.read(from)
337
+ };
338
+ }
339
+ write(value, into) {
340
+ FfiConverterString.write(value.binaryPath, into);
341
+ FfiConverterString.write(value.hostBundleId, into);
342
+ FfiConverterOptionalString.write(value.socketPath, into);
343
+ FfiConverterOptionalUInt64.write(value.startupTimeoutMs, into);
344
+ FfiConverterOptionalUInt64.write(value.shutdownTimeoutMs, into);
345
+ FfiConverterOptionalTypeEmbeddedPermissionMode.write(value.permissionMode, into);
346
+ FfiConverterOptionalString.write(value.sessionPolicyPath, into);
347
+ FfiConverterBool.write(value.approveSessionPolicy, into);
348
+ FfiConverterBool.write(value.dangerouslyBypassApprovals, into);
349
+ FfiConverterSequenceTypeEmbeddedEnvironmentVariable.write(value.environment, into);
350
+ FfiConverterBool.write(value.inheritStderr, into);
351
+ }
352
+ allocationSize(value) {
353
+ return FfiConverterString.allocationSize(value.binaryPath) +
354
+ FfiConverterString.allocationSize(value.hostBundleId) +
355
+ FfiConverterOptionalString.allocationSize(value.socketPath) +
356
+ FfiConverterOptionalUInt64.allocationSize(value.startupTimeoutMs) +
357
+ FfiConverterOptionalUInt64.allocationSize(value.shutdownTimeoutMs) +
358
+ FfiConverterOptionalTypeEmbeddedPermissionMode.allocationSize(value.permissionMode) +
359
+ FfiConverterOptionalString.allocationSize(value.sessionPolicyPath) +
360
+ FfiConverterBool.allocationSize(value.approveSessionPolicy) +
361
+ FfiConverterBool.allocationSize(value.dangerouslyBypassApprovals) +
362
+ FfiConverterSequenceTypeEmbeddedEnvironmentVariable.allocationSize(value.environment) +
363
+ FfiConverterBool.allocationSize(value.inheritStderr);
364
+ }
365
+ }
366
+ ;
367
+ return new FFIConverter();
368
+ })();
369
+ /**
370
+ * Generated factory for {@link ImageContent} record objects.
371
+ */
372
+ export const ImageContent = (() => {
373
+ const defaults = () => ({});
374
+ const create = (() => {
375
+ return uniffiCreateRecord(defaults);
376
+ })();
377
+ return Object.freeze({
378
+ create,
379
+ new: create,
380
+ defaults: () => Object.freeze(defaults()),
381
+ });
382
+ })();
383
+ const FfiConverterTypeImageContent = (() => {
384
+ class FFIConverter extends AbstractFfiConverterByteArray {
385
+ read(from) {
386
+ return {
387
+ mimeType: FfiConverterString.read(from),
388
+ dataBase64: FfiConverterString.read(from)
389
+ };
390
+ }
391
+ write(value, into) {
392
+ FfiConverterString.write(value.mimeType, into);
393
+ FfiConverterString.write(value.dataBase64, into);
394
+ }
395
+ allocationSize(value) {
396
+ return FfiConverterString.allocationSize(value.mimeType) +
397
+ FfiConverterString.allocationSize(value.dataBase64);
398
+ }
399
+ }
400
+ ;
401
+ return new FFIConverter();
402
+ })();
403
+ /**
404
+ * Generated factory for {@link MacOsPermissionStatus} record objects.
405
+ */
406
+ export const MacOsPermissionStatus = (() => {
407
+ const defaults = () => ({});
408
+ const create = (() => {
409
+ return uniffiCreateRecord(defaults);
410
+ })();
411
+ return Object.freeze({
412
+ create,
413
+ new: create,
414
+ defaults: () => Object.freeze(defaults()),
415
+ });
416
+ })();
417
+ const FfiConverterTypeMacOsPermissionStatus = (() => {
418
+ class FFIConverter extends AbstractFfiConverterByteArray {
419
+ read(from) {
420
+ return {
421
+ accessibility: FfiConverterBool.read(from),
422
+ screenRecording: FfiConverterBool.read(from)
423
+ };
424
+ }
425
+ write(value, into) {
426
+ FfiConverterBool.write(value.accessibility, into);
427
+ FfiConverterBool.write(value.screenRecording, into);
428
+ }
429
+ allocationSize(value) {
430
+ return FfiConverterBool.allocationSize(value.accessibility) +
431
+ FfiConverterBool.allocationSize(value.screenRecording);
432
+ }
433
+ }
434
+ ;
435
+ return new FFIConverter();
436
+ })();
437
+ /**
438
+ * Generated factory for {@link ToolResult} record objects.
439
+ */
440
+ export const ToolResult = (() => {
441
+ const defaults = () => ({});
442
+ const create = (() => {
443
+ return uniffiCreateRecord(defaults);
444
+ })();
445
+ return Object.freeze({
446
+ create,
447
+ new: create,
448
+ defaults: () => Object.freeze(defaults()),
449
+ });
450
+ })();
451
+ const FfiConverterTypeToolResult = (() => {
452
+ class FFIConverter extends AbstractFfiConverterByteArray {
453
+ read(from) {
454
+ return {
455
+ text: FfiConverterString.read(from),
456
+ images: FfiConverterSequenceTypeImageContent.read(from),
457
+ structuredJson: FfiConverterOptionalString.read(from),
458
+ isError: FfiConverterBool.read(from),
459
+ errorCode: FfiConverterOptionalString.read(from),
460
+ verified: FfiConverterOptionalBoolean.read(from),
461
+ degraded: FfiConverterBool.read(from),
462
+ rawJson: FfiConverterString.read(from)
463
+ };
464
+ }
465
+ write(value, into) {
466
+ FfiConverterString.write(value.text, into);
467
+ FfiConverterSequenceTypeImageContent.write(value.images, into);
468
+ FfiConverterOptionalString.write(value.structuredJson, into);
469
+ FfiConverterBool.write(value.isError, into);
470
+ FfiConverterOptionalString.write(value.errorCode, into);
471
+ FfiConverterOptionalBoolean.write(value.verified, into);
472
+ FfiConverterBool.write(value.degraded, into);
473
+ FfiConverterString.write(value.rawJson, into);
474
+ }
475
+ allocationSize(value) {
476
+ return FfiConverterString.allocationSize(value.text) +
477
+ FfiConverterSequenceTypeImageContent.allocationSize(value.images) +
478
+ FfiConverterOptionalString.allocationSize(value.structuredJson) +
479
+ FfiConverterBool.allocationSize(value.isError) +
480
+ FfiConverterOptionalString.allocationSize(value.errorCode) +
481
+ FfiConverterOptionalBoolean.allocationSize(value.verified) +
482
+ FfiConverterBool.allocationSize(value.degraded) +
483
+ FfiConverterString.allocationSize(value.rawJson);
484
+ }
485
+ }
486
+ ;
487
+ return new FFIConverter();
488
+ })();
489
+ // Error type: DriverError
490
+ export var DriverError_Tags;
491
+ (function (DriverError_Tags) {
492
+ DriverError_Tags["Configuration"] = "Configuration";
493
+ DriverError_Tags["InvalidArguments"] = "InvalidArguments";
494
+ DriverError_Tags["Transport"] = "Transport";
495
+ DriverError_Tags["Protocol"] = "Protocol";
496
+ DriverError_Tags["Tool"] = "Tool";
497
+ })(DriverError_Tags || (DriverError_Tags = {}));
498
+ export const DriverError = (() => {
499
+ class Configuration_ extends UniffiError {
500
+ /**
501
+ * @private
502
+ * This field is private and should not be used, use `tag` instead.
503
+ */
504
+ [uniffiTypeNameSymbol] = "DriverError";
505
+ tag = DriverError_Tags.Configuration;
506
+ inner;
507
+ constructor(inner) {
508
+ super("DriverError", "Configuration");
509
+ this.inner = Object.freeze(inner);
510
+ }
511
+ static new(inner) {
512
+ return new Configuration_(inner);
513
+ }
514
+ static instanceOf(obj) {
515
+ return obj.tag === DriverError_Tags.Configuration;
516
+ }
517
+ static hasInner(obj) {
518
+ return Configuration_.instanceOf(obj);
519
+ }
520
+ static getInner(obj) {
521
+ return obj.inner;
522
+ }
523
+ }
524
+ class InvalidArguments_ extends UniffiError {
525
+ /**
526
+ * @private
527
+ * This field is private and should not be used, use `tag` instead.
528
+ */
529
+ [uniffiTypeNameSymbol] = "DriverError";
530
+ tag = DriverError_Tags.InvalidArguments;
531
+ inner;
532
+ constructor(inner) {
533
+ super("DriverError", "InvalidArguments");
534
+ this.inner = Object.freeze(inner);
535
+ }
536
+ static new(inner) {
537
+ return new InvalidArguments_(inner);
538
+ }
539
+ static instanceOf(obj) {
540
+ return obj.tag === DriverError_Tags.InvalidArguments;
541
+ }
542
+ static hasInner(obj) {
543
+ return InvalidArguments_.instanceOf(obj);
544
+ }
545
+ static getInner(obj) {
546
+ return obj.inner;
547
+ }
548
+ }
549
+ class Transport_ extends UniffiError {
550
+ /**
551
+ * @private
552
+ * This field is private and should not be used, use `tag` instead.
553
+ */
554
+ [uniffiTypeNameSymbol] = "DriverError";
555
+ tag = DriverError_Tags.Transport;
556
+ inner;
557
+ constructor(inner) {
558
+ super("DriverError", "Transport");
559
+ this.inner = Object.freeze(inner);
560
+ }
561
+ static new(inner) {
562
+ return new Transport_(inner);
563
+ }
564
+ static instanceOf(obj) {
565
+ return obj.tag === DriverError_Tags.Transport;
566
+ }
567
+ static hasInner(obj) {
568
+ return Transport_.instanceOf(obj);
569
+ }
570
+ static getInner(obj) {
571
+ return obj.inner;
572
+ }
573
+ }
574
+ class Protocol_ extends UniffiError {
575
+ /**
576
+ * @private
577
+ * This field is private and should not be used, use `tag` instead.
578
+ */
579
+ [uniffiTypeNameSymbol] = "DriverError";
580
+ tag = DriverError_Tags.Protocol;
581
+ inner;
582
+ constructor(inner) {
583
+ super("DriverError", "Protocol");
584
+ this.inner = Object.freeze(inner);
585
+ }
586
+ static new(inner) {
587
+ return new Protocol_(inner);
588
+ }
589
+ static instanceOf(obj) {
590
+ return obj.tag === DriverError_Tags.Protocol;
591
+ }
592
+ static hasInner(obj) {
593
+ return Protocol_.instanceOf(obj);
594
+ }
595
+ static getInner(obj) {
596
+ return obj.inner;
597
+ }
598
+ }
599
+ class Tool_ extends UniffiError {
600
+ /**
601
+ * @private
602
+ * This field is private and should not be used, use `tag` instead.
603
+ */
604
+ [uniffiTypeNameSymbol] = "DriverError";
605
+ tag = DriverError_Tags.Tool;
606
+ inner;
607
+ constructor(inner) {
608
+ super("DriverError", "Tool");
609
+ this.inner = Object.freeze(inner);
610
+ }
611
+ static new(inner) {
612
+ return new Tool_(inner);
613
+ }
614
+ static instanceOf(obj) {
615
+ return obj.tag === DriverError_Tags.Tool;
616
+ }
617
+ static hasInner(obj) {
618
+ return Tool_.instanceOf(obj);
619
+ }
620
+ static getInner(obj) {
621
+ return obj.inner;
622
+ }
623
+ }
624
+ function instanceOf(obj) {
625
+ return obj[uniffiTypeNameSymbol] === "DriverError";
626
+ }
627
+ return Object.freeze({
628
+ instanceOf,
629
+ Configuration: Configuration_,
630
+ InvalidArguments: InvalidArguments_,
631
+ Transport: Transport_,
632
+ Protocol: Protocol_,
633
+ Tool: Tool_
634
+ });
635
+ })();
636
+ // FfiConverter for enum DriverError
637
+ const FfiConverterTypeDriverError = (() => {
638
+ const ordinalConverter = FfiConverterInt32;
639
+ class FFIConverter extends AbstractFfiConverterByteArray {
640
+ read(from) {
641
+ switch (ordinalConverter.read(from)) {
642
+ case 1: return new DriverError.Configuration({ reason: FfiConverterString.read(from) });
643
+ case 2: return new DriverError.InvalidArguments({ tool: FfiConverterString.read(from), reason: FfiConverterString.read(from) });
644
+ case 3: return new DriverError.Transport({ socketPath: FfiConverterString.read(from), reason: FfiConverterString.read(from) });
645
+ case 4: return new DriverError.Protocol({ reason: FfiConverterString.read(from) });
646
+ case 5: return new DriverError.Tool({ tool: FfiConverterString.read(from), message: FfiConverterString.read(from), errorCode: FfiConverterString.read(from) });
647
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
648
+ }
649
+ }
650
+ write(value, into) {
651
+ switch (value.tag) {
652
+ case DriverError_Tags.Configuration: {
653
+ ordinalConverter.write(1, into);
654
+ const inner = value.inner;
655
+ FfiConverterString.write(inner.reason, into);
656
+ return;
657
+ }
658
+ case DriverError_Tags.InvalidArguments: {
659
+ ordinalConverter.write(2, into);
660
+ const inner = value.inner;
661
+ FfiConverterString.write(inner.tool, into);
662
+ FfiConverterString.write(inner.reason, into);
663
+ return;
664
+ }
665
+ case DriverError_Tags.Transport: {
666
+ ordinalConverter.write(3, into);
667
+ const inner = value.inner;
668
+ FfiConverterString.write(inner.socketPath, into);
669
+ FfiConverterString.write(inner.reason, into);
670
+ return;
671
+ }
672
+ case DriverError_Tags.Protocol: {
673
+ ordinalConverter.write(4, into);
674
+ const inner = value.inner;
675
+ FfiConverterString.write(inner.reason, into);
676
+ return;
677
+ }
678
+ case DriverError_Tags.Tool: {
679
+ ordinalConverter.write(5, into);
680
+ const inner = value.inner;
681
+ FfiConverterString.write(inner.tool, into);
682
+ FfiConverterString.write(inner.message, into);
683
+ FfiConverterString.write(inner.errorCode, into);
684
+ return;
685
+ }
686
+ default:
687
+ // Throwing from here means that DriverError_Tags hasn't matched an ordinal.
688
+ throw new UniffiInternalError.UnexpectedEnumCase();
689
+ }
690
+ }
691
+ allocationSize(value) {
692
+ switch (value.tag) {
693
+ case DriverError_Tags.Configuration: {
694
+ const inner = value.inner;
695
+ let size = ordinalConverter.allocationSize(1);
696
+ size += FfiConverterString.allocationSize(inner.reason);
697
+ return size;
698
+ }
699
+ case DriverError_Tags.InvalidArguments: {
700
+ const inner = value.inner;
701
+ let size = ordinalConverter.allocationSize(2);
702
+ size += FfiConverterString.allocationSize(inner.tool);
703
+ size += FfiConverterString.allocationSize(inner.reason);
704
+ return size;
705
+ }
706
+ case DriverError_Tags.Transport: {
707
+ const inner = value.inner;
708
+ let size = ordinalConverter.allocationSize(3);
709
+ size += FfiConverterString.allocationSize(inner.socketPath);
710
+ size += FfiConverterString.allocationSize(inner.reason);
711
+ return size;
712
+ }
713
+ case DriverError_Tags.Protocol: {
714
+ const inner = value.inner;
715
+ let size = ordinalConverter.allocationSize(4);
716
+ size += FfiConverterString.allocationSize(inner.reason);
717
+ return size;
718
+ }
719
+ case DriverError_Tags.Tool: {
720
+ const inner = value.inner;
721
+ let size = ordinalConverter.allocationSize(5);
722
+ size += FfiConverterString.allocationSize(inner.tool);
723
+ size += FfiConverterString.allocationSize(inner.message);
724
+ size += FfiConverterString.allocationSize(inner.errorCode);
725
+ return size;
726
+ }
727
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
728
+ }
729
+ }
730
+ }
731
+ return new FFIConverter();
732
+ })();
733
+ // Error type: EmbeddedDriverError
734
+ export var EmbeddedDriverError_Tags;
735
+ (function (EmbeddedDriverError_Tags) {
736
+ EmbeddedDriverError_Tags["Configuration"] = "Configuration";
737
+ EmbeddedDriverError_Tags["EndpointConflict"] = "EndpointConflict";
738
+ EmbeddedDriverError_Tags["Spawn"] = "Spawn";
739
+ EmbeddedDriverError_Tags["StartupCancelled"] = "StartupCancelled";
740
+ EmbeddedDriverError_Tags["StartupTimeout"] = "StartupTimeout";
741
+ EmbeddedDriverError_Tags["ExitedBeforeReady"] = "ExitedBeforeReady";
742
+ EmbeddedDriverError_Tags["IncompatibleDaemon"] = "IncompatibleDaemon";
743
+ EmbeddedDriverError_Tags["Lifecycle"] = "Lifecycle";
744
+ })(EmbeddedDriverError_Tags || (EmbeddedDriverError_Tags = {}));
745
+ export const EmbeddedDriverError = (() => {
746
+ class Configuration_ extends UniffiError {
747
+ /**
748
+ * @private
749
+ * This field is private and should not be used, use `tag` instead.
750
+ */
751
+ [uniffiTypeNameSymbol] = "EmbeddedDriverError";
752
+ tag = EmbeddedDriverError_Tags.Configuration;
753
+ inner;
754
+ constructor(inner) {
755
+ super("EmbeddedDriverError", "Configuration");
756
+ this.inner = Object.freeze(inner);
757
+ }
758
+ static new(inner) {
759
+ return new Configuration_(inner);
760
+ }
761
+ static instanceOf(obj) {
762
+ return obj.tag === EmbeddedDriverError_Tags.Configuration;
763
+ }
764
+ static hasInner(obj) {
765
+ return Configuration_.instanceOf(obj);
766
+ }
767
+ static getInner(obj) {
768
+ return obj.inner;
769
+ }
770
+ }
771
+ class EndpointConflict_ extends UniffiError {
772
+ /**
773
+ * @private
774
+ * This field is private and should not be used, use `tag` instead.
775
+ */
776
+ [uniffiTypeNameSymbol] = "EmbeddedDriverError";
777
+ tag = EmbeddedDriverError_Tags.EndpointConflict;
778
+ inner;
779
+ constructor(inner) {
780
+ super("EmbeddedDriverError", "EndpointConflict");
781
+ this.inner = Object.freeze(inner);
782
+ }
783
+ static new(inner) {
784
+ return new EndpointConflict_(inner);
785
+ }
786
+ static instanceOf(obj) {
787
+ return obj.tag === EmbeddedDriverError_Tags.EndpointConflict;
788
+ }
789
+ static hasInner(obj) {
790
+ return EndpointConflict_.instanceOf(obj);
791
+ }
792
+ static getInner(obj) {
793
+ return obj.inner;
794
+ }
795
+ }
796
+ class Spawn_ extends UniffiError {
797
+ /**
798
+ * @private
799
+ * This field is private and should not be used, use `tag` instead.
800
+ */
801
+ [uniffiTypeNameSymbol] = "EmbeddedDriverError";
802
+ tag = EmbeddedDriverError_Tags.Spawn;
803
+ inner;
804
+ constructor(inner) {
805
+ super("EmbeddedDriverError", "Spawn");
806
+ this.inner = Object.freeze(inner);
807
+ }
808
+ static new(inner) {
809
+ return new Spawn_(inner);
810
+ }
811
+ static instanceOf(obj) {
812
+ return obj.tag === EmbeddedDriverError_Tags.Spawn;
813
+ }
814
+ static hasInner(obj) {
815
+ return Spawn_.instanceOf(obj);
816
+ }
817
+ static getInner(obj) {
818
+ return obj.inner;
819
+ }
820
+ }
821
+ class StartupCancelled_ extends UniffiError {
822
+ /**
823
+ * @private
824
+ * This field is private and should not be used, use `tag` instead.
825
+ */
826
+ [uniffiTypeNameSymbol] = "EmbeddedDriverError";
827
+ tag = EmbeddedDriverError_Tags.StartupCancelled;
828
+ constructor() {
829
+ super("EmbeddedDriverError", "StartupCancelled");
830
+ }
831
+ static new() {
832
+ return new StartupCancelled_();
833
+ }
834
+ static instanceOf(obj) {
835
+ return obj.tag === EmbeddedDriverError_Tags.StartupCancelled;
836
+ }
837
+ static hasInner(obj) {
838
+ return false;
839
+ }
840
+ }
841
+ class StartupTimeout_ extends UniffiError {
842
+ /**
843
+ * @private
844
+ * This field is private and should not be used, use `tag` instead.
845
+ */
846
+ [uniffiTypeNameSymbol] = "EmbeddedDriverError";
847
+ tag = EmbeddedDriverError_Tags.StartupTimeout;
848
+ inner;
849
+ constructor(inner) {
850
+ super("EmbeddedDriverError", "StartupTimeout");
851
+ this.inner = Object.freeze(inner);
852
+ }
853
+ static new(inner) {
854
+ return new StartupTimeout_(inner);
855
+ }
856
+ static instanceOf(obj) {
857
+ return obj.tag === EmbeddedDriverError_Tags.StartupTimeout;
858
+ }
859
+ static hasInner(obj) {
860
+ return StartupTimeout_.instanceOf(obj);
861
+ }
862
+ static getInner(obj) {
863
+ return obj.inner;
864
+ }
865
+ }
866
+ class ExitedBeforeReady_ extends UniffiError {
867
+ /**
868
+ * @private
869
+ * This field is private and should not be used, use `tag` instead.
870
+ */
871
+ [uniffiTypeNameSymbol] = "EmbeddedDriverError";
872
+ tag = EmbeddedDriverError_Tags.ExitedBeforeReady;
873
+ inner;
874
+ constructor(inner) {
875
+ super("EmbeddedDriverError", "ExitedBeforeReady");
876
+ this.inner = Object.freeze(inner);
877
+ }
878
+ static new(inner) {
879
+ return new ExitedBeforeReady_(inner);
880
+ }
881
+ static instanceOf(obj) {
882
+ return obj.tag === EmbeddedDriverError_Tags.ExitedBeforeReady;
883
+ }
884
+ static hasInner(obj) {
885
+ return ExitedBeforeReady_.instanceOf(obj);
886
+ }
887
+ static getInner(obj) {
888
+ return obj.inner;
889
+ }
890
+ }
891
+ class IncompatibleDaemon_ extends UniffiError {
892
+ /**
893
+ * @private
894
+ * This field is private and should not be used, use `tag` instead.
895
+ */
896
+ [uniffiTypeNameSymbol] = "EmbeddedDriverError";
897
+ tag = EmbeddedDriverError_Tags.IncompatibleDaemon;
898
+ inner;
899
+ constructor(inner) {
900
+ super("EmbeddedDriverError", "IncompatibleDaemon");
901
+ this.inner = Object.freeze(inner);
902
+ }
903
+ static new(inner) {
904
+ return new IncompatibleDaemon_(inner);
905
+ }
906
+ static instanceOf(obj) {
907
+ return obj.tag === EmbeddedDriverError_Tags.IncompatibleDaemon;
908
+ }
909
+ static hasInner(obj) {
910
+ return IncompatibleDaemon_.instanceOf(obj);
911
+ }
912
+ static getInner(obj) {
913
+ return obj.inner;
914
+ }
915
+ }
916
+ class Lifecycle_ extends UniffiError {
917
+ /**
918
+ * @private
919
+ * This field is private and should not be used, use `tag` instead.
920
+ */
921
+ [uniffiTypeNameSymbol] = "EmbeddedDriverError";
922
+ tag = EmbeddedDriverError_Tags.Lifecycle;
923
+ inner;
924
+ constructor(inner) {
925
+ super("EmbeddedDriverError", "Lifecycle");
926
+ this.inner = Object.freeze(inner);
927
+ }
928
+ static new(inner) {
929
+ return new Lifecycle_(inner);
930
+ }
931
+ static instanceOf(obj) {
932
+ return obj.tag === EmbeddedDriverError_Tags.Lifecycle;
933
+ }
934
+ static hasInner(obj) {
935
+ return Lifecycle_.instanceOf(obj);
936
+ }
937
+ static getInner(obj) {
938
+ return obj.inner;
939
+ }
940
+ }
941
+ function instanceOf(obj) {
942
+ return obj[uniffiTypeNameSymbol] === "EmbeddedDriverError";
943
+ }
944
+ return Object.freeze({
945
+ instanceOf,
946
+ Configuration: Configuration_,
947
+ EndpointConflict: EndpointConflict_,
948
+ Spawn: Spawn_,
949
+ StartupCancelled: StartupCancelled_,
950
+ StartupTimeout: StartupTimeout_,
951
+ ExitedBeforeReady: ExitedBeforeReady_,
952
+ IncompatibleDaemon: IncompatibleDaemon_,
953
+ Lifecycle: Lifecycle_
954
+ });
955
+ })();
956
+ // FfiConverter for enum EmbeddedDriverError
957
+ const FfiConverterTypeEmbeddedDriverError = (() => {
958
+ const ordinalConverter = FfiConverterInt32;
959
+ class FFIConverter extends AbstractFfiConverterByteArray {
960
+ read(from) {
961
+ switch (ordinalConverter.read(from)) {
962
+ case 1: return new EmbeddedDriverError.Configuration({ reason: FfiConverterString.read(from) });
963
+ case 2: return new EmbeddedDriverError.EndpointConflict({ path: FfiConverterString.read(from), reason: FfiConverterString.read(from) });
964
+ case 3: return new EmbeddedDriverError.Spawn({ binaryPath: FfiConverterString.read(from), reason: FfiConverterString.read(from) });
965
+ case 4: return new EmbeddedDriverError.StartupCancelled();
966
+ case 5: return new EmbeddedDriverError.StartupTimeout({ timeoutMs: FfiConverterUInt64.read(from) });
967
+ case 6: return new EmbeddedDriverError.ExitedBeforeReady({ code: FfiConverterOptionalInt32.read(from) });
968
+ case 7: return new EmbeddedDriverError.IncompatibleDaemon({ reason: FfiConverterString.read(from) });
969
+ case 8: return new EmbeddedDriverError.Lifecycle({ reason: FfiConverterString.read(from) });
970
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
971
+ }
972
+ }
973
+ write(value, into) {
974
+ switch (value.tag) {
975
+ case EmbeddedDriverError_Tags.Configuration: {
976
+ ordinalConverter.write(1, into);
977
+ const inner = value.inner;
978
+ FfiConverterString.write(inner.reason, into);
979
+ return;
980
+ }
981
+ case EmbeddedDriverError_Tags.EndpointConflict: {
982
+ ordinalConverter.write(2, into);
983
+ const inner = value.inner;
984
+ FfiConverterString.write(inner.path, into);
985
+ FfiConverterString.write(inner.reason, into);
986
+ return;
987
+ }
988
+ case EmbeddedDriverError_Tags.Spawn: {
989
+ ordinalConverter.write(3, into);
990
+ const inner = value.inner;
991
+ FfiConverterString.write(inner.binaryPath, into);
992
+ FfiConverterString.write(inner.reason, into);
993
+ return;
994
+ }
995
+ case EmbeddedDriverError_Tags.StartupCancelled: {
996
+ ordinalConverter.write(4, into);
997
+ return;
998
+ }
999
+ case EmbeddedDriverError_Tags.StartupTimeout: {
1000
+ ordinalConverter.write(5, into);
1001
+ const inner = value.inner;
1002
+ FfiConverterUInt64.write(inner.timeoutMs, into);
1003
+ return;
1004
+ }
1005
+ case EmbeddedDriverError_Tags.ExitedBeforeReady: {
1006
+ ordinalConverter.write(6, into);
1007
+ const inner = value.inner;
1008
+ FfiConverterOptionalInt32.write(inner.code, into);
1009
+ return;
1010
+ }
1011
+ case EmbeddedDriverError_Tags.IncompatibleDaemon: {
1012
+ ordinalConverter.write(7, into);
1013
+ const inner = value.inner;
1014
+ FfiConverterString.write(inner.reason, into);
1015
+ return;
1016
+ }
1017
+ case EmbeddedDriverError_Tags.Lifecycle: {
1018
+ ordinalConverter.write(8, into);
1019
+ const inner = value.inner;
1020
+ FfiConverterString.write(inner.reason, into);
1021
+ return;
1022
+ }
1023
+ default:
1024
+ // Throwing from here means that EmbeddedDriverError_Tags hasn't matched an ordinal.
1025
+ throw new UniffiInternalError.UnexpectedEnumCase();
1026
+ }
1027
+ }
1028
+ allocationSize(value) {
1029
+ switch (value.tag) {
1030
+ case EmbeddedDriverError_Tags.Configuration: {
1031
+ const inner = value.inner;
1032
+ let size = ordinalConverter.allocationSize(1);
1033
+ size += FfiConverterString.allocationSize(inner.reason);
1034
+ return size;
1035
+ }
1036
+ case EmbeddedDriverError_Tags.EndpointConflict: {
1037
+ const inner = value.inner;
1038
+ let size = ordinalConverter.allocationSize(2);
1039
+ size += FfiConverterString.allocationSize(inner.path);
1040
+ size += FfiConverterString.allocationSize(inner.reason);
1041
+ return size;
1042
+ }
1043
+ case EmbeddedDriverError_Tags.Spawn: {
1044
+ const inner = value.inner;
1045
+ let size = ordinalConverter.allocationSize(3);
1046
+ size += FfiConverterString.allocationSize(inner.binaryPath);
1047
+ size += FfiConverterString.allocationSize(inner.reason);
1048
+ return size;
1049
+ }
1050
+ case EmbeddedDriverError_Tags.StartupCancelled: {
1051
+ return ordinalConverter.allocationSize(4);
1052
+ }
1053
+ case EmbeddedDriverError_Tags.StartupTimeout: {
1054
+ const inner = value.inner;
1055
+ let size = ordinalConverter.allocationSize(5);
1056
+ size += FfiConverterUInt64.allocationSize(inner.timeoutMs);
1057
+ return size;
1058
+ }
1059
+ case EmbeddedDriverError_Tags.ExitedBeforeReady: {
1060
+ const inner = value.inner;
1061
+ let size = ordinalConverter.allocationSize(6);
1062
+ size += FfiConverterOptionalInt32.allocationSize(inner.code);
1063
+ return size;
1064
+ }
1065
+ case EmbeddedDriverError_Tags.IncompatibleDaemon: {
1066
+ const inner = value.inner;
1067
+ let size = ordinalConverter.allocationSize(7);
1068
+ size += FfiConverterString.allocationSize(inner.reason);
1069
+ return size;
1070
+ }
1071
+ case EmbeddedDriverError_Tags.Lifecycle: {
1072
+ const inner = value.inner;
1073
+ let size = ordinalConverter.allocationSize(8);
1074
+ size += FfiConverterString.allocationSize(inner.reason);
1075
+ return size;
1076
+ }
1077
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
1078
+ }
1079
+ }
1080
+ }
1081
+ return new FFIConverter();
1082
+ })();
1083
+ export var EmbeddedDriverHostState;
1084
+ (function (EmbeddedDriverHostState) {
1085
+ EmbeddedDriverHostState[EmbeddedDriverHostState["Stopped"] = 0] = "Stopped";
1086
+ EmbeddedDriverHostState[EmbeddedDriverHostState["Starting"] = 1] = "Starting";
1087
+ EmbeddedDriverHostState[EmbeddedDriverHostState["Ready"] = 2] = "Ready";
1088
+ EmbeddedDriverHostState[EmbeddedDriverHostState["Stopping"] = 3] = "Stopping";
1089
+ })(EmbeddedDriverHostState || (EmbeddedDriverHostState = {}));
1090
+ const FfiConverterTypeEmbeddedDriverHostState = (() => {
1091
+ const ordinalConverter = FfiConverterInt32;
1092
+ class FFIConverter extends AbstractFfiConverterByteArray {
1093
+ read(from) {
1094
+ switch (ordinalConverter.read(from)) {
1095
+ case 1: return EmbeddedDriverHostState.Stopped;
1096
+ case 2: return EmbeddedDriverHostState.Starting;
1097
+ case 3: return EmbeddedDriverHostState.Ready;
1098
+ case 4: return EmbeddedDriverHostState.Stopping;
1099
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
1100
+ }
1101
+ }
1102
+ write(value, into) {
1103
+ switch (value) {
1104
+ case EmbeddedDriverHostState.Stopped: return ordinalConverter.write(1, into);
1105
+ case EmbeddedDriverHostState.Starting: return ordinalConverter.write(2, into);
1106
+ case EmbeddedDriverHostState.Ready: return ordinalConverter.write(3, into);
1107
+ case EmbeddedDriverHostState.Stopping: return ordinalConverter.write(4, into);
1108
+ }
1109
+ }
1110
+ allocationSize(value) {
1111
+ return ordinalConverter.allocationSize(0);
1112
+ }
1113
+ }
1114
+ return new FFIConverter();
1115
+ })();
1116
+ export class CuaDriver extends UniffiAbstractObject {
1117
+ [uniffiTypeNameSymbol] = "CuaDriver";
1118
+ [destructorGuardSymbol];
1119
+ [pointerLiteralSymbol];
1120
+ // No primary constructor declared for this class.
1121
+ constructor(pointer) {
1122
+ super();
1123
+ this[pointerLiteralSymbol] = pointer;
1124
+ this[destructorGuardSymbol] = uniffiTypeCuaDriverObjectFactory.bless(pointer);
1125
+ }
1126
+ /**
1127
+ * Connect to the default installed daemon or an explicitly selected socket.
1128
+ * Construction does not launch a process or perform I/O.
1129
+ */
1130
+ static connect(socketPath) {
1131
+ return FfiConverterTypeCuaDriver.lift(uniffiCaller.rustCallWithError(
1132
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1133
+ /*caller:*/ (callStatus) => {
1134
+ return nativeModule().uniffi_cua_driver_sdk_fn_constructor_cuadriver_connect(FfiConverterOptionalString.lower(socketPath, nativeModule().rustbuffer_alloc), callStatus);
1135
+ },
1136
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1137
+ }
1138
+ /**
1139
+ * Escape hatch for forward-compatible tools and application-owned server
1140
+ * adapters. Typed methods below serialize the same canonical Rust inputs.
1141
+ */
1142
+ callTool(name, argumentsJson) {
1143
+ return ((__rb) => {
1144
+ try {
1145
+ return FfiConverterTypeToolResult.lift(__rb);
1146
+ }
1147
+ finally {
1148
+ nativeModule().rustbuffer_free(__rb);
1149
+ }
1150
+ })(uniffiCaller.rustCallWithError(
1151
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1152
+ /*caller:*/ (callStatus) => {
1153
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_call_tool(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterString.lower(name, nativeModule().rustbuffer_alloc), FfiConverterString.lower(argumentsJson, nativeModule().rustbuffer_alloc), callStatus);
1154
+ },
1155
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1156
+ }
1157
+ click(input) {
1158
+ return ((__rb) => {
1159
+ try {
1160
+ return FfiConverterTypeToolResult.lift(__rb);
1161
+ }
1162
+ finally {
1163
+ nativeModule().rustbuffer_free(__rb);
1164
+ }
1165
+ })(uniffiCaller.rustCallWithError(
1166
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1167
+ /*caller:*/ (callStatus) => {
1168
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_click(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeClickInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1169
+ },
1170
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1171
+ }
1172
+ drag(input) {
1173
+ return ((__rb) => {
1174
+ try {
1175
+ return FfiConverterTypeToolResult.lift(__rb);
1176
+ }
1177
+ finally {
1178
+ nativeModule().rustbuffer_free(__rb);
1179
+ }
1180
+ })(uniffiCaller.rustCallWithError(
1181
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1182
+ /*caller:*/ (callStatus) => {
1183
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_drag(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeDragInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1184
+ },
1185
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1186
+ }
1187
+ endSession(input) {
1188
+ return ((__rb) => {
1189
+ try {
1190
+ return FfiConverterTypeEndSessionOutput.lift(__rb);
1191
+ }
1192
+ finally {
1193
+ nativeModule().rustbuffer_free(__rb);
1194
+ }
1195
+ })(uniffiCaller.rustCallWithError(
1196
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1197
+ /*caller:*/ (callStatus) => {
1198
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_end_session(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeEndSessionInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1199
+ },
1200
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1201
+ }
1202
+ escalateSession(input) {
1203
+ return ((__rb) => {
1204
+ try {
1205
+ return FfiConverterTypeSessionStateOutput.lift(__rb);
1206
+ }
1207
+ finally {
1208
+ nativeModule().rustbuffer_free(__rb);
1209
+ }
1210
+ })(uniffiCaller.rustCallWithError(
1211
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1212
+ /*caller:*/ (callStatus) => {
1213
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_escalate_session(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeEscalateSessionInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1214
+ },
1215
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1216
+ }
1217
+ getCursorPosition(input) {
1218
+ return ((__rb) => {
1219
+ try {
1220
+ return FfiConverterTypeToolResult.lift(__rb);
1221
+ }
1222
+ finally {
1223
+ nativeModule().rustbuffer_free(__rb);
1224
+ }
1225
+ })(uniffiCaller.rustCallWithError(
1226
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1227
+ /*caller:*/ (callStatus) => {
1228
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_get_cursor_position(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeGetCursorPositionInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1229
+ },
1230
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1231
+ }
1232
+ getDesktopState(input) {
1233
+ return ((__rb) => {
1234
+ try {
1235
+ return FfiConverterTypeToolResult.lift(__rb);
1236
+ }
1237
+ finally {
1238
+ nativeModule().rustbuffer_free(__rb);
1239
+ }
1240
+ })(uniffiCaller.rustCallWithError(
1241
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1242
+ /*caller:*/ (callStatus) => {
1243
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_get_desktop_state(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeGetDesktopStateInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1244
+ },
1245
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1246
+ }
1247
+ getScreenSize(input) {
1248
+ return ((__rb) => {
1249
+ try {
1250
+ return FfiConverterTypeToolResult.lift(__rb);
1251
+ }
1252
+ finally {
1253
+ nativeModule().rustbuffer_free(__rb);
1254
+ }
1255
+ })(uniffiCaller.rustCallWithError(
1256
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1257
+ /*caller:*/ (callStatus) => {
1258
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_get_screen_size(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeGetScreenSizeInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1259
+ },
1260
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1261
+ }
1262
+ getSessionState(input) {
1263
+ return ((__rb) => {
1264
+ try {
1265
+ return FfiConverterTypeSessionStateOutput.lift(__rb);
1266
+ }
1267
+ finally {
1268
+ nativeModule().rustbuffer_free(__rb);
1269
+ }
1270
+ })(uniffiCaller.rustCallWithError(
1271
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1272
+ /*caller:*/ (callStatus) => {
1273
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_get_session_state(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeGetSessionStateInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1274
+ },
1275
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1276
+ }
1277
+ hotkey(input) {
1278
+ return ((__rb) => {
1279
+ try {
1280
+ return FfiConverterTypeToolResult.lift(__rb);
1281
+ }
1282
+ finally {
1283
+ nativeModule().rustbuffer_free(__rb);
1284
+ }
1285
+ })(uniffiCaller.rustCallWithError(
1286
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1287
+ /*caller:*/ (callStatus) => {
1288
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_hotkey(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeHotkeyInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1289
+ },
1290
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1291
+ }
1292
+ isAvailable() {
1293
+ return FfiConverterBool.lift(uniffiCaller.rustCall(
1294
+ /*caller:*/ (callStatus) => {
1295
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_is_available(uniffiTypeCuaDriverObjectFactory.clonePointer(this), callStatus);
1296
+ },
1297
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1298
+ }
1299
+ listToolsJson() {
1300
+ return ((__rb) => {
1301
+ try {
1302
+ return FfiConverterString.lift(__rb);
1303
+ }
1304
+ finally {
1305
+ nativeModule().rustbuffer_free(__rb);
1306
+ }
1307
+ })(uniffiCaller.rustCallWithError(
1308
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1309
+ /*caller:*/ (callStatus) => {
1310
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_list_tools_json(uniffiTypeCuaDriverObjectFactory.clonePointer(this), callStatus);
1311
+ },
1312
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1313
+ }
1314
+ metadata() {
1315
+ return ((__rb) => {
1316
+ try {
1317
+ return FfiConverterTypeDriverMetadata.lift(__rb);
1318
+ }
1319
+ finally {
1320
+ nativeModule().rustbuffer_free(__rb);
1321
+ }
1322
+ })(uniffiCaller.rustCallWithError(
1323
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1324
+ /*caller:*/ (callStatus) => {
1325
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_metadata(uniffiTypeCuaDriverObjectFactory.clonePointer(this), callStatus);
1326
+ },
1327
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1328
+ }
1329
+ moveCursor(input) {
1330
+ return ((__rb) => {
1331
+ try {
1332
+ return FfiConverterTypeToolResult.lift(__rb);
1333
+ }
1334
+ finally {
1335
+ nativeModule().rustbuffer_free(__rb);
1336
+ }
1337
+ })(uniffiCaller.rustCallWithError(
1338
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1339
+ /*caller:*/ (callStatus) => {
1340
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_move_cursor(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeMoveCursorInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1341
+ },
1342
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1343
+ }
1344
+ pressKey(input) {
1345
+ return ((__rb) => {
1346
+ try {
1347
+ return FfiConverterTypeToolResult.lift(__rb);
1348
+ }
1349
+ finally {
1350
+ nativeModule().rustbuffer_free(__rb);
1351
+ }
1352
+ })(uniffiCaller.rustCallWithError(
1353
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1354
+ /*caller:*/ (callStatus) => {
1355
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_press_key(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypePressKeyInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1356
+ },
1357
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1358
+ }
1359
+ scroll(input) {
1360
+ return ((__rb) => {
1361
+ try {
1362
+ return FfiConverterTypeToolResult.lift(__rb);
1363
+ }
1364
+ finally {
1365
+ nativeModule().rustbuffer_free(__rb);
1366
+ }
1367
+ })(uniffiCaller.rustCallWithError(
1368
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1369
+ /*caller:*/ (callStatus) => {
1370
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_scroll(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeScrollInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1371
+ },
1372
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1373
+ }
1374
+ socketPath() {
1375
+ return ((__rb) => {
1376
+ try {
1377
+ return FfiConverterString.lift(__rb);
1378
+ }
1379
+ finally {
1380
+ nativeModule().rustbuffer_free(__rb);
1381
+ }
1382
+ })(uniffiCaller.rustCall(
1383
+ /*caller:*/ (callStatus) => {
1384
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_socket_path(uniffiTypeCuaDriverObjectFactory.clonePointer(this), callStatus);
1385
+ },
1386
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1387
+ }
1388
+ startSession(input) {
1389
+ return ((__rb) => {
1390
+ try {
1391
+ return FfiConverterTypeStartSessionOutput.lift(__rb);
1392
+ }
1393
+ finally {
1394
+ nativeModule().rustbuffer_free(__rb);
1395
+ }
1396
+ })(uniffiCaller.rustCallWithError(
1397
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1398
+ /*caller:*/ (callStatus) => {
1399
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_start_session(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeStartSessionInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1400
+ },
1401
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1402
+ }
1403
+ typeText(input) {
1404
+ return ((__rb) => {
1405
+ try {
1406
+ return FfiConverterTypeToolResult.lift(__rb);
1407
+ }
1408
+ finally {
1409
+ nativeModule().rustbuffer_free(__rb);
1410
+ }
1411
+ })(uniffiCaller.rustCallWithError(
1412
+ /*liftError:*/ FfiConverterTypeDriverError.lift.bind(FfiConverterTypeDriverError),
1413
+ /*caller:*/ (callStatus) => {
1414
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_cuadriver_type_text(uniffiTypeCuaDriverObjectFactory.clonePointer(this), FfiConverterTypeTypeTextInput.lower(input, nativeModule().rustbuffer_alloc), callStatus);
1415
+ },
1416
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1417
+ }
1418
+ uniffiDestroy() {
1419
+ const ptr = this[destructorGuardSymbol];
1420
+ if (ptr !== undefined) {
1421
+ const pointer = uniffiTypeCuaDriverObjectFactory.pointer(this);
1422
+ uniffiTypeCuaDriverObjectFactory.freePointer(pointer);
1423
+ uniffiTypeCuaDriverObjectFactory.unbless(ptr);
1424
+ delete this[destructorGuardSymbol];
1425
+ }
1426
+ }
1427
+ static instanceOf(obj_) {
1428
+ return uniffiTypeCuaDriverObjectFactory.isConcreteType(obj_);
1429
+ }
1430
+ }
1431
+ const uniffiTypeCuaDriverObjectFactory = (() => {
1432
+ /// <reference lib="es2021" />
1433
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
1434
+ uniffiTypeCuaDriverObjectFactory.freePointer(heldValue);
1435
+ }) : null;
1436
+ return {
1437
+ create(pointer) {
1438
+ const instance = Object.create(CuaDriver.prototype);
1439
+ instance[pointerLiteralSymbol] = pointer;
1440
+ instance[destructorGuardSymbol] = this.bless(pointer);
1441
+ instance[uniffiTypeNameSymbol] = "CuaDriver";
1442
+ return instance;
1443
+ },
1444
+ bless(p) {
1445
+ const ptr = {
1446
+ p, // make sure this object doesn't get optimized away.
1447
+ markDestroyed: () => undefined,
1448
+ };
1449
+ if (registry) {
1450
+ registry.register(ptr, p, ptr);
1451
+ }
1452
+ return ptr;
1453
+ },
1454
+ unbless(ptr_) {
1455
+ if (registry) {
1456
+ registry.unregister(ptr_);
1457
+ }
1458
+ },
1459
+ pointer(obj_) {
1460
+ if (obj_[destructorGuardSymbol] === undefined) {
1461
+ throw new UniffiInternalError.UnexpectedNullPointer();
1462
+ }
1463
+ return obj_[pointerLiteralSymbol];
1464
+ },
1465
+ clonePointer(obj_) {
1466
+ const pointer = this.pointer(obj_);
1467
+ return uniffiCaller.rustCall(
1468
+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_driver_sdk_fn_clone_cuadriver(pointer, callStatus),
1469
+ /*liftString:*/ FfiConverterString.lift);
1470
+ },
1471
+ freePointer(pointer) {
1472
+ uniffiCaller.rustCall(
1473
+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_driver_sdk_fn_free_cuadriver(pointer, callStatus),
1474
+ /*liftString:*/ FfiConverterString.lift);
1475
+ },
1476
+ isConcreteType(obj_) {
1477
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "CuaDriver";
1478
+ },
1479
+ };
1480
+ })();
1481
+ const FfiConverterTypeCuaDriver = new FfiConverterObject(uniffiTypeCuaDriverObjectFactory);
1482
+ export class EmbeddedCuaDriverHost extends UniffiAbstractObject {
1483
+ [uniffiTypeNameSymbol] = "EmbeddedCuaDriverHost";
1484
+ [destructorGuardSymbol];
1485
+ [pointerLiteralSymbol];
1486
+ constructor(binaryPath, hostBundleId) {
1487
+ super();
1488
+ const pointer = uniffiCaller.rustCallWithError(
1489
+ /*liftError:*/ FfiConverterTypeEmbeddedDriverError.lift.bind(FfiConverterTypeEmbeddedDriverError),
1490
+ /*caller:*/ (callStatus) => {
1491
+ return nativeModule().uniffi_cua_driver_sdk_fn_constructor_embeddedcuadriverhost_new(FfiConverterString.lower(binaryPath, nativeModule().rustbuffer_alloc), FfiConverterString.lower(hostBundleId, nativeModule().rustbuffer_alloc), callStatus);
1492
+ },
1493
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
1494
+ this[pointerLiteralSymbol] = pointer;
1495
+ this[destructorGuardSymbol] = uniffiTypeEmbeddedCuaDriverHostObjectFactory.bless(pointer);
1496
+ }
1497
+ static withOptions(options) {
1498
+ return FfiConverterTypeEmbeddedCuaDriverHost.lift(uniffiCaller.rustCallWithError(
1499
+ /*liftError:*/ FfiConverterTypeEmbeddedDriverError.lift.bind(FfiConverterTypeEmbeddedDriverError),
1500
+ /*caller:*/ (callStatus) => {
1501
+ return nativeModule().uniffi_cua_driver_sdk_fn_constructor_embeddedcuadriverhost_with_options(FfiConverterTypeEmbeddedDriverHostOptions.lower(options, nativeModule().rustbuffer_alloc), callStatus);
1502
+ },
1503
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1504
+ }
1505
+ connection() {
1506
+ return ((__rb) => {
1507
+ try {
1508
+ return FfiConverterOptionalTypeEmbeddedDriverConnection.lift(__rb);
1509
+ }
1510
+ finally {
1511
+ nativeModule().rustbuffer_free(__rb);
1512
+ }
1513
+ })(uniffiCaller.rustCall(
1514
+ /*caller:*/ (callStatus) => {
1515
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_connection(uniffiTypeEmbeddedCuaDriverHostObjectFactory.clonePointer(this), callStatus);
1516
+ },
1517
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1518
+ }
1519
+ async restart(asyncOpts_) {
1520
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1521
+ try {
1522
+ return await uniffiRustCallAsync(
1523
+ /*rustCaller:*/ uniffiCaller,
1524
+ /*rustFutureFunc:*/ () => {
1525
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_restart(uniffiTypeEmbeddedCuaDriverHostObjectFactory.clonePointer(this));
1526
+ },
1527
+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
1528
+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,
1529
+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
1530
+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,
1531
+ // Async returns always go through the JS-side converter: the
1532
+ // FFI symbol returns the future handle (u64), and the user-level
1533
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1534
+ // export. The bytes the runtime hands back must be deserialized
1535
+ // here using the per-callable return-type converter.
1536
+ /*liftFunc:*/ FfiConverterTypeEmbeddedDriverConnection.lift.bind(FfiConverterTypeEmbeddedDriverConnection),
1537
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1538
+ /*asyncOpts:*/ asyncOpts_,
1539
+ /*errorHandler:*/ FfiConverterTypeEmbeddedDriverError.lift.bind(FfiConverterTypeEmbeddedDriverError));
1540
+ }
1541
+ catch (__error) {
1542
+ if (uniffiIsDebug && __error instanceof Error) {
1543
+ __error.stack = __stack;
1544
+ }
1545
+ throw __error;
1546
+ }
1547
+ }
1548
+ async start(asyncOpts_) {
1549
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1550
+ try {
1551
+ return await uniffiRustCallAsync(
1552
+ /*rustCaller:*/ uniffiCaller,
1553
+ /*rustFutureFunc:*/ () => {
1554
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_start(uniffiTypeEmbeddedCuaDriverHostObjectFactory.clonePointer(this));
1555
+ },
1556
+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
1557
+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,
1558
+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
1559
+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,
1560
+ // Async returns always go through the JS-side converter: the
1561
+ // FFI symbol returns the future handle (u64), and the user-level
1562
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1563
+ // export. The bytes the runtime hands back must be deserialized
1564
+ // here using the per-callable return-type converter.
1565
+ /*liftFunc:*/ FfiConverterTypeEmbeddedDriverConnection.lift.bind(FfiConverterTypeEmbeddedDriverConnection),
1566
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1567
+ /*asyncOpts:*/ asyncOpts_,
1568
+ /*errorHandler:*/ FfiConverterTypeEmbeddedDriverError.lift.bind(FfiConverterTypeEmbeddedDriverError));
1569
+ }
1570
+ catch (__error) {
1571
+ if (uniffiIsDebug && __error instanceof Error) {
1572
+ __error.stack = __stack;
1573
+ }
1574
+ throw __error;
1575
+ }
1576
+ }
1577
+ state() {
1578
+ return ((__rb) => {
1579
+ try {
1580
+ return FfiConverterTypeEmbeddedDriverHostState.lift(__rb);
1581
+ }
1582
+ finally {
1583
+ nativeModule().rustbuffer_free(__rb);
1584
+ }
1585
+ })(uniffiCaller.rustCall(
1586
+ /*caller:*/ (callStatus) => {
1587
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_state(uniffiTypeEmbeddedCuaDriverHostObjectFactory.clonePointer(this), callStatus);
1588
+ },
1589
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1590
+ }
1591
+ async stop(asyncOpts_) {
1592
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1593
+ try {
1594
+ return await uniffiRustCallAsync(
1595
+ /*rustCaller:*/ uniffiCaller,
1596
+ /*rustFutureFunc:*/ () => {
1597
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_stop(uniffiTypeEmbeddedCuaDriverHostObjectFactory.clonePointer(this));
1598
+ },
1599
+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_void,
1600
+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_void,
1601
+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_void,
1602
+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_void,
1603
+ /*liftFunc:*/ (_v) => { },
1604
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1605
+ /*asyncOpts:*/ asyncOpts_,
1606
+ /*errorHandler:*/ FfiConverterTypeEmbeddedDriverError.lift.bind(FfiConverterTypeEmbeddedDriverError));
1607
+ }
1608
+ catch (__error) {
1609
+ if (uniffiIsDebug && __error instanceof Error) {
1610
+ __error.stack = __stack;
1611
+ }
1612
+ throw __error;
1613
+ }
1614
+ }
1615
+ async waitForExit(generation, asyncOpts_) {
1616
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1617
+ try {
1618
+ return await uniffiRustCallAsync(
1619
+ /*rustCaller:*/ uniffiCaller,
1620
+ /*rustFutureFunc:*/ () => {
1621
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_wait_for_exit(uniffiTypeEmbeddedCuaDriverHostObjectFactory.clonePointer(this), FfiConverterString.lower(generation, nativeModule().rustbuffer_alloc));
1622
+ },
1623
+ /*pollFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_poll_rust_buffer,
1624
+ /*cancelFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_cancel_rust_buffer,
1625
+ /*completeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_complete_rust_buffer,
1626
+ /*freeFunc:*/ nativeModule().ffi_cua_driver_sdk_rust_future_free_rust_buffer,
1627
+ // Async returns always go through the JS-side converter: the
1628
+ // FFI symbol returns the future handle (u64), and the user-level
1629
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1630
+ // export. The bytes the runtime hands back must be deserialized
1631
+ // here using the per-callable return-type converter.
1632
+ /*liftFunc:*/ FfiConverterTypeEmbeddedDriverExit.lift.bind(FfiConverterTypeEmbeddedDriverExit),
1633
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1634
+ /*asyncOpts:*/ asyncOpts_,
1635
+ /*errorHandler:*/ FfiConverterTypeEmbeddedDriverError.lift.bind(FfiConverterTypeEmbeddedDriverError));
1636
+ }
1637
+ catch (__error) {
1638
+ if (uniffiIsDebug && __error instanceof Error) {
1639
+ __error.stack = __stack;
1640
+ }
1641
+ throw __error;
1642
+ }
1643
+ }
1644
+ uniffiDestroy() {
1645
+ const ptr = this[destructorGuardSymbol];
1646
+ if (ptr !== undefined) {
1647
+ const pointer = uniffiTypeEmbeddedCuaDriverHostObjectFactory.pointer(this);
1648
+ uniffiTypeEmbeddedCuaDriverHostObjectFactory.freePointer(pointer);
1649
+ uniffiTypeEmbeddedCuaDriverHostObjectFactory.unbless(ptr);
1650
+ delete this[destructorGuardSymbol];
1651
+ }
1652
+ }
1653
+ static instanceOf(obj_) {
1654
+ return uniffiTypeEmbeddedCuaDriverHostObjectFactory.isConcreteType(obj_);
1655
+ }
1656
+ }
1657
+ const uniffiTypeEmbeddedCuaDriverHostObjectFactory = (() => {
1658
+ /// <reference lib="es2021" />
1659
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
1660
+ uniffiTypeEmbeddedCuaDriverHostObjectFactory.freePointer(heldValue);
1661
+ }) : null;
1662
+ return {
1663
+ create(pointer) {
1664
+ const instance = Object.create(EmbeddedCuaDriverHost.prototype);
1665
+ instance[pointerLiteralSymbol] = pointer;
1666
+ instance[destructorGuardSymbol] = this.bless(pointer);
1667
+ instance[uniffiTypeNameSymbol] = "EmbeddedCuaDriverHost";
1668
+ return instance;
1669
+ },
1670
+ bless(p) {
1671
+ const ptr = {
1672
+ p, // make sure this object doesn't get optimized away.
1673
+ markDestroyed: () => undefined,
1674
+ };
1675
+ if (registry) {
1676
+ registry.register(ptr, p, ptr);
1677
+ }
1678
+ return ptr;
1679
+ },
1680
+ unbless(ptr_) {
1681
+ if (registry) {
1682
+ registry.unregister(ptr_);
1683
+ }
1684
+ },
1685
+ pointer(obj_) {
1686
+ if (obj_[destructorGuardSymbol] === undefined) {
1687
+ throw new UniffiInternalError.UnexpectedNullPointer();
1688
+ }
1689
+ return obj_[pointerLiteralSymbol];
1690
+ },
1691
+ clonePointer(obj_) {
1692
+ const pointer = this.pointer(obj_);
1693
+ return uniffiCaller.rustCall(
1694
+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_driver_sdk_fn_clone_embeddedcuadriverhost(pointer, callStatus),
1695
+ /*liftString:*/ FfiConverterString.lift);
1696
+ },
1697
+ freePointer(pointer) {
1698
+ uniffiCaller.rustCall(
1699
+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_driver_sdk_fn_free_embeddedcuadriverhost(pointer, callStatus),
1700
+ /*liftString:*/ FfiConverterString.lift);
1701
+ },
1702
+ isConcreteType(obj_) {
1703
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "EmbeddedCuaDriverHost";
1704
+ },
1705
+ };
1706
+ })();
1707
+ const FfiConverterTypeEmbeddedCuaDriverHost = new FfiConverterObject(uniffiTypeEmbeddedCuaDriverHostObjectFactory);
1708
+ // FfiConverter for string | undefined
1709
+ const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
1710
+ // FfiConverter for Array<string>
1711
+ const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
1712
+ // FfiConverter for Array<EmbeddedEnvironmentVariable>
1713
+ const FfiConverterSequenceTypeEmbeddedEnvironmentVariable = new FfiConverterArray(FfiConverterTypeEmbeddedEnvironmentVariable);
1714
+ // FfiConverter for number | undefined
1715
+ const FfiConverterOptionalInt32 = new FfiConverterOptional(FfiConverterInt32);
1716
+ // FfiConverter for bigint | undefined
1717
+ const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
1718
+ // FfiConverter for EmbeddedPermissionMode | undefined
1719
+ const FfiConverterOptionalTypeEmbeddedPermissionMode = new FfiConverterOptional(FfiConverterTypeEmbeddedPermissionMode);
1720
+ // FfiConverter for Array<ImageContent>
1721
+ const FfiConverterSequenceTypeImageContent = new FfiConverterArray(FfiConverterTypeImageContent);
1722
+ // FfiConverter for boolean | undefined
1723
+ const FfiConverterOptionalBoolean = new FfiConverterOptional(FfiConverterBool);
1724
+ // FfiConverter for EmbeddedDriverConnection | undefined
1725
+ const FfiConverterOptionalTypeEmbeddedDriverConnection = new FfiConverterOptional(FfiConverterTypeEmbeddedDriverConnection);
1726
+ /**
1727
+ * This should be called before anything else.
1728
+ *
1729
+ * It is likely that this is being done for you by the library's `index.ts`.
1730
+ *
1731
+ * It checks versions of uniffi between when the Rust scaffolding was generated
1732
+ * and when the bindings were generated.
1733
+ *
1734
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
1735
+ */
1736
+ function uniffiEnsureInitialized() {
1737
+ // Get the bindings contract version from our ComponentInterface
1738
+ const bindingsContractVersion = 30;
1739
+ // Get the scaffolding contract version by calling the into the dylib
1740
+ const scaffoldingContractVersion = nativeModule().ffi_cua_driver_sdk_uniffi_contract_version();
1741
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
1742
+ throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
1743
+ }
1744
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_func_current_mac_os_permission_status() !== 22890) {
1745
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_current_mac_os_permission_status");
1746
+ }
1747
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_func_open_mac_os_screen_recording_settings() !== 6663) {
1748
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_open_mac_os_screen_recording_settings");
1749
+ }
1750
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_func_request_mac_os_permissions() !== 61823) {
1751
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_func_request_mac_os_permissions");
1752
+ }
1753
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_constructor_cuadriver_connect() !== 42154) {
1754
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_constructor_cuadriver_connect");
1755
+ }
1756
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_call_tool() !== 31445) {
1757
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_call_tool");
1758
+ }
1759
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_click() !== 34118) {
1760
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_click");
1761
+ }
1762
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_drag() !== 35252) {
1763
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_drag");
1764
+ }
1765
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_end_session() !== 33990) {
1766
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_end_session");
1767
+ }
1768
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_escalate_session() !== 37358) {
1769
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_escalate_session");
1770
+ }
1771
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_get_cursor_position() !== 54043) {
1772
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_get_cursor_position");
1773
+ }
1774
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_get_desktop_state() !== 32992) {
1775
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_get_desktop_state");
1776
+ }
1777
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_get_screen_size() !== 15250) {
1778
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_get_screen_size");
1779
+ }
1780
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_get_session_state() !== 51055) {
1781
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_get_session_state");
1782
+ }
1783
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_hotkey() !== 3135) {
1784
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_hotkey");
1785
+ }
1786
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_is_available() !== 42961) {
1787
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_is_available");
1788
+ }
1789
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_list_tools_json() !== 43987) {
1790
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_list_tools_json");
1791
+ }
1792
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_metadata() !== 50371) {
1793
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_metadata");
1794
+ }
1795
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_move_cursor() !== 11209) {
1796
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_move_cursor");
1797
+ }
1798
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_press_key() !== 17425) {
1799
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_press_key");
1800
+ }
1801
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_scroll() !== 21614) {
1802
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_scroll");
1803
+ }
1804
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_socket_path() !== 24461) {
1805
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_socket_path");
1806
+ }
1807
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_start_session() !== 53509) {
1808
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_start_session");
1809
+ }
1810
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_cuadriver_type_text() !== 19673) {
1811
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_cuadriver_type_text");
1812
+ }
1813
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_constructor_embeddedcuadriverhost_new() !== 10108) {
1814
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_constructor_embeddedcuadriverhost_new");
1815
+ }
1816
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_constructor_embeddedcuadriverhost_with_options() !== 41121) {
1817
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_constructor_embeddedcuadriverhost_with_options");
1818
+ }
1819
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_connection() !== 44467) {
1820
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_connection");
1821
+ }
1822
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_restart() !== 27248) {
1823
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_restart");
1824
+ }
1825
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_start() !== 16011) {
1826
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_start");
1827
+ }
1828
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_state() !== 42795) {
1829
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_state");
1830
+ }
1831
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_stop() !== 28521) {
1832
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_stop");
1833
+ }
1834
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_wait_for_exit() !== 21124) {
1835
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_wait_for_exit");
1836
+ }
1837
+ }
1838
+ export default Object.freeze({
1839
+ initialize: uniffiEnsureInitialized,
1840
+ converters: {
1841
+ FfiConverterTypeCuaDriver,
1842
+ FfiConverterTypeDriverError,
1843
+ FfiConverterTypeDriverMetadata,
1844
+ FfiConverterTypeEmbeddedCuaDriverHost,
1845
+ FfiConverterTypeEmbeddedDriverConnection,
1846
+ FfiConverterTypeEmbeddedDriverError,
1847
+ FfiConverterTypeEmbeddedDriverExit,
1848
+ FfiConverterTypeEmbeddedDriverHostOptions,
1849
+ FfiConverterTypeEmbeddedDriverHostState,
1850
+ FfiConverterTypeEmbeddedEnvironmentVariable,
1851
+ FfiConverterTypeEmbeddedMcpConfiguration,
1852
+ FfiConverterTypeEmbeddedPermissionMode,
1853
+ FfiConverterTypeImageContent,
1854
+ FfiConverterTypeMacOsPermissionStatus,
1855
+ FfiConverterTypeToolResult,
1856
+ }
1857
+ });