@trycua/cua-driver 0.11.0 → 0.12.3
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 +37 -17
- package/dist/index.d.ts +0 -6
- package/dist/index.js +6 -0
- package/dist/native/cua_driver_contract-ffi.js +1 -1
- package/dist/native/cua_driver_sdk-ffi.d.ts +27 -17
- package/dist/native/cua_driver_sdk-ffi.js +83 -33
- package/dist/native/cua_driver_sdk.d.ts +265 -41
- package/dist/native/cua_driver_sdk.js +689 -222
- package/dist/native/node-runtime.d.ts +72 -0
- package/dist/native/node-runtime.js +35 -0
- package/package.json +11 -11
|
@@ -25,6 +25,24 @@ export declare const DriverMetadata: Readonly<{
|
|
|
25
25
|
new: (partial: Partial<DriverMetadata> & Required<Omit<DriverMetadata, "hostBundleId">>) => DriverMetadata;
|
|
26
26
|
defaults: () => Partial<DriverMetadata>;
|
|
27
27
|
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Options for a same-process Cua Driver SDK runtime.
|
|
30
|
+
*/
|
|
31
|
+
export type DriverOptions = {
|
|
32
|
+
/**
|
|
33
|
+
* Preserve the temporary reduced screenshot surface used by older Claude
|
|
34
|
+
* Code integrations. New applications should leave this false.
|
|
35
|
+
*/
|
|
36
|
+
claudeCodeCompatibility: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Generated factory for {@link DriverOptions} record objects.
|
|
40
|
+
*/
|
|
41
|
+
export declare const DriverOptions: Readonly<{
|
|
42
|
+
create: (partial: Partial<DriverOptions> & Required<Omit<DriverOptions, never>>) => DriverOptions;
|
|
43
|
+
new: (partial: Partial<DriverOptions> & Required<Omit<DriverOptions, never>>) => DriverOptions;
|
|
44
|
+
defaults: () => Partial<DriverOptions>;
|
|
45
|
+
}>;
|
|
28
46
|
export type EmbeddedEnvironmentVariable = {
|
|
29
47
|
name: string;
|
|
30
48
|
value: string;
|
|
@@ -162,7 +180,8 @@ export declare enum DriverError_Tags {
|
|
|
162
180
|
InvalidArguments = "InvalidArguments",
|
|
163
181
|
Transport = "Transport",
|
|
164
182
|
Protocol = "Protocol",
|
|
165
|
-
Tool = "Tool"
|
|
183
|
+
Tool = "Tool",
|
|
184
|
+
Shutdown = "Shutdown"
|
|
166
185
|
}
|
|
167
186
|
export declare const DriverError: Readonly<{
|
|
168
187
|
instanceOf: (obj: any) => obj is DriverError;
|
|
@@ -628,8 +647,68 @@ export declare const DriverError: Readonly<{
|
|
|
628
647
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
629
648
|
stackTraceLimit: number;
|
|
630
649
|
};
|
|
650
|
+
Shutdown: {
|
|
651
|
+
new (): {
|
|
652
|
+
readonly tag: DriverError_Tags.Shutdown;
|
|
653
|
+
/**
|
|
654
|
+
* @private
|
|
655
|
+
* This field is private and should not be used, use `tag` instead.
|
|
656
|
+
*/
|
|
657
|
+
readonly [uniffiTypeNameSymbol]: "DriverError";
|
|
658
|
+
name: string;
|
|
659
|
+
message: string;
|
|
660
|
+
stack?: string;
|
|
661
|
+
cause?: unknown;
|
|
662
|
+
};
|
|
663
|
+
"new"(): {
|
|
664
|
+
readonly tag: DriverError_Tags.Shutdown;
|
|
665
|
+
/**
|
|
666
|
+
* @private
|
|
667
|
+
* This field is private and should not be used, use `tag` instead.
|
|
668
|
+
*/
|
|
669
|
+
readonly [uniffiTypeNameSymbol]: "DriverError";
|
|
670
|
+
name: string;
|
|
671
|
+
message: string;
|
|
672
|
+
stack?: string;
|
|
673
|
+
cause?: unknown;
|
|
674
|
+
};
|
|
675
|
+
instanceOf(obj: any): obj is {
|
|
676
|
+
readonly tag: DriverError_Tags.Shutdown;
|
|
677
|
+
/**
|
|
678
|
+
* @private
|
|
679
|
+
* This field is private and should not be used, use `tag` instead.
|
|
680
|
+
*/
|
|
681
|
+
readonly [uniffiTypeNameSymbol]: "DriverError";
|
|
682
|
+
name: string;
|
|
683
|
+
message: string;
|
|
684
|
+
stack?: string;
|
|
685
|
+
cause?: unknown;
|
|
686
|
+
};
|
|
687
|
+
hasInner(obj: any): obj is {
|
|
688
|
+
readonly tag: DriverError_Tags.Shutdown;
|
|
689
|
+
/**
|
|
690
|
+
* @private
|
|
691
|
+
* This field is private and should not be used, use `tag` instead.
|
|
692
|
+
*/
|
|
693
|
+
readonly [uniffiTypeNameSymbol]: "DriverError";
|
|
694
|
+
name: string;
|
|
695
|
+
message: string;
|
|
696
|
+
stack?: string;
|
|
697
|
+
cause?: unknown;
|
|
698
|
+
};
|
|
699
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
700
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
701
|
+
stackTraceLimit: number;
|
|
702
|
+
};
|
|
631
703
|
}>;
|
|
632
|
-
export type DriverError = InstanceType<typeof DriverError['Configuration' | 'InvalidArguments' | 'Transport' | 'Protocol' | 'Tool']>;
|
|
704
|
+
export type DriverError = InstanceType<typeof DriverError['Configuration' | 'InvalidArguments' | 'Transport' | 'Protocol' | 'Tool' | 'Shutdown']>;
|
|
705
|
+
/**
|
|
706
|
+
* Process topology used by this SDK object.
|
|
707
|
+
*/
|
|
708
|
+
export declare enum DriverExecutionMode {
|
|
709
|
+
Embedded = 0,
|
|
710
|
+
Daemon = 1
|
|
711
|
+
}
|
|
633
712
|
export declare enum EmbeddedDriverError_Tags {
|
|
634
713
|
Configuration = "Configuration",
|
|
635
714
|
EndpointConflict = "EndpointConflict",
|
|
@@ -1321,30 +1400,89 @@ export declare enum EmbeddedDriverHostState {
|
|
|
1321
1400
|
Ready = 2,
|
|
1322
1401
|
Stopping = 3
|
|
1323
1402
|
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Runtime that imported the shared UniFFI SDK library. The language package
|
|
1405
|
+
* selects this automatically at its root entry point; callers do not need to
|
|
1406
|
+
* supply telemetry metadata.
|
|
1407
|
+
*/
|
|
1408
|
+
export declare enum SdkClientKind {
|
|
1409
|
+
Python = 0,
|
|
1410
|
+
Typescript = 1
|
|
1411
|
+
}
|
|
1324
1412
|
export interface CuaDriverLike {
|
|
1325
1413
|
/**
|
|
1326
|
-
*
|
|
1327
|
-
*
|
|
1414
|
+
* Generic protocol-adapter surface. Ordinary applications should prefer
|
|
1415
|
+
* typed methods; MCP and other open-ended adapters use this method so they
|
|
1416
|
+
* remain downstream of the same public SDK runtime.
|
|
1328
1417
|
*/
|
|
1329
|
-
callTool(name: string, argumentsJson: string
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1418
|
+
callTool(name: string, argumentsJson: string, asyncOpts_?: {
|
|
1419
|
+
signal: AbortSignal;
|
|
1420
|
+
}): Promise<ToolResult>;
|
|
1421
|
+
click(input: ClickInput, asyncOpts_?: {
|
|
1422
|
+
signal: AbortSignal;
|
|
1423
|
+
}): Promise<ToolResult>;
|
|
1424
|
+
drag(input: DragInput, asyncOpts_?: {
|
|
1425
|
+
signal: AbortSignal;
|
|
1426
|
+
}): Promise<ToolResult>;
|
|
1427
|
+
endSession(input: EndSessionInput, asyncOpts_?: {
|
|
1428
|
+
signal: AbortSignal;
|
|
1429
|
+
}): Promise<EndSessionOutput>;
|
|
1430
|
+
escalateSession(input: EscalateSessionInput, asyncOpts_?: {
|
|
1431
|
+
signal: AbortSignal;
|
|
1432
|
+
}): Promise<SessionStateOutput>;
|
|
1433
|
+
executionMode(): DriverExecutionMode;
|
|
1434
|
+
getCursorPosition(input: GetCursorPositionInput, asyncOpts_?: {
|
|
1435
|
+
signal: AbortSignal;
|
|
1436
|
+
}): Promise<ToolResult>;
|
|
1437
|
+
getDesktopState(input: GetDesktopStateInput, asyncOpts_?: {
|
|
1438
|
+
signal: AbortSignal;
|
|
1439
|
+
}): Promise<ToolResult>;
|
|
1440
|
+
getScreenSize(input: GetScreenSizeInput, asyncOpts_?: {
|
|
1441
|
+
signal: AbortSignal;
|
|
1442
|
+
}): Promise<ToolResult>;
|
|
1443
|
+
getSessionState(input: GetSessionStateInput, asyncOpts_?: {
|
|
1444
|
+
signal: AbortSignal;
|
|
1445
|
+
}): Promise<SessionStateOutput>;
|
|
1446
|
+
hotkey(input: HotkeyInput, asyncOpts_?: {
|
|
1447
|
+
signal: AbortSignal;
|
|
1448
|
+
}): Promise<ToolResult>;
|
|
1339
1449
|
isAvailable(): boolean;
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1450
|
+
/**
|
|
1451
|
+
* Canonical tool inventory for MCP and other protocol adapters.
|
|
1452
|
+
*/
|
|
1453
|
+
listToolsJson(asyncOpts_?: {
|
|
1454
|
+
signal: AbortSignal;
|
|
1455
|
+
}): Promise<string>;
|
|
1456
|
+
metadata(asyncOpts_?: {
|
|
1457
|
+
signal: AbortSignal;
|
|
1458
|
+
}): Promise<DriverMetadata>;
|
|
1459
|
+
moveCursor(input: MoveCursorInput, asyncOpts_?: {
|
|
1460
|
+
signal: AbortSignal;
|
|
1461
|
+
}): Promise<ToolResult>;
|
|
1462
|
+
pressKey(input: PressKeyInput, asyncOpts_?: {
|
|
1463
|
+
signal: AbortSignal;
|
|
1464
|
+
}): Promise<ToolResult>;
|
|
1465
|
+
scroll(input: ScrollInput, asyncOpts_?: {
|
|
1466
|
+
signal: AbortSignal;
|
|
1467
|
+
}): Promise<ToolResult>;
|
|
1468
|
+
/**
|
|
1469
|
+
* Stop accepting new embedded operations. Repeated calls are harmless;
|
|
1470
|
+
* daemon compatibility clients do not own the daemon and therefore no-op.
|
|
1471
|
+
*/
|
|
1472
|
+
shutdown(asyncOpts_?: {
|
|
1473
|
+
signal: AbortSignal;
|
|
1474
|
+
}): Promise<void>;
|
|
1475
|
+
/**
|
|
1476
|
+
* Compatibility accessor. Embedded runtimes have no socket and return an
|
|
1477
|
+
* empty string; new code should branch on [`Self::execution_mode`].
|
|
1478
|
+
*/
|
|
1345
1479
|
socketPath(): string;
|
|
1346
|
-
startSession(input: StartSessionInput
|
|
1347
|
-
|
|
1480
|
+
startSession(input: StartSessionInput, asyncOpts_?: {
|
|
1481
|
+
signal: AbortSignal;
|
|
1482
|
+
}): Promise<StartSessionOutput>;
|
|
1483
|
+
typeText(input: TypeTextInput, asyncOpts_?: {
|
|
1484
|
+
signal: AbortSignal;
|
|
1485
|
+
}): Promise<ToolResult>;
|
|
1348
1486
|
}
|
|
1349
1487
|
/**
|
|
1350
1488
|
* @deprecated Use `CuaDriverLike` instead.
|
|
@@ -1357,32 +1495,97 @@ export declare class CuaDriver extends UniffiAbstractObject implements CuaDriver
|
|
|
1357
1495
|
private constructor();
|
|
1358
1496
|
/**
|
|
1359
1497
|
* Connect to the default installed daemon or an explicitly selected socket.
|
|
1360
|
-
*
|
|
1498
|
+
* This is the temporary compatibility path for released socket clients.
|
|
1361
1499
|
*/
|
|
1362
1500
|
static connect(socketPath: string | undefined): CuaDriverLike;
|
|
1363
1501
|
/**
|
|
1364
|
-
*
|
|
1365
|
-
*
|
|
1502
|
+
* Language-package entry point that preserves the public `connect` API
|
|
1503
|
+
* while attaching a closed runtime category to daemon requests.
|
|
1504
|
+
*/
|
|
1505
|
+
static connectWithClientKind(socketPath: string | undefined, clientKind: SdkClientKind): CuaDriverLike;
|
|
1506
|
+
/**
|
|
1507
|
+
* Create a same-process driver runtime. This constructor never launches
|
|
1508
|
+
* `cua-driver` and never opens daemon IPC.
|
|
1509
|
+
*/
|
|
1510
|
+
static create(options: DriverOptions | undefined): CuaDriverLike;
|
|
1511
|
+
/**
|
|
1512
|
+
* Language-package entry point for the same-process runtime. The wrapper
|
|
1513
|
+
* at each package root selects the client kind automatically.
|
|
1366
1514
|
*/
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1515
|
+
static createWithClientKind(options: DriverOptions | undefined, clientKind: SdkClientKind): CuaDriverLike;
|
|
1516
|
+
/**
|
|
1517
|
+
* Generic protocol-adapter surface. Ordinary applications should prefer
|
|
1518
|
+
* typed methods; MCP and other open-ended adapters use this method so they
|
|
1519
|
+
* remain downstream of the same public SDK runtime.
|
|
1520
|
+
*/
|
|
1521
|
+
callTool(name: string, argumentsJson: string, asyncOpts_?: {
|
|
1522
|
+
signal: AbortSignal;
|
|
1523
|
+
}): Promise<ToolResult>;
|
|
1524
|
+
click(input: ClickInput, asyncOpts_?: {
|
|
1525
|
+
signal: AbortSignal;
|
|
1526
|
+
}): Promise<ToolResult>;
|
|
1527
|
+
drag(input: DragInput, asyncOpts_?: {
|
|
1528
|
+
signal: AbortSignal;
|
|
1529
|
+
}): Promise<ToolResult>;
|
|
1530
|
+
endSession(input: EndSessionInput, asyncOpts_?: {
|
|
1531
|
+
signal: AbortSignal;
|
|
1532
|
+
}): Promise<EndSessionOutput>;
|
|
1533
|
+
escalateSession(input: EscalateSessionInput, asyncOpts_?: {
|
|
1534
|
+
signal: AbortSignal;
|
|
1535
|
+
}): Promise<SessionStateOutput>;
|
|
1536
|
+
executionMode(): DriverExecutionMode;
|
|
1537
|
+
getCursorPosition(input: GetCursorPositionInput, asyncOpts_?: {
|
|
1538
|
+
signal: AbortSignal;
|
|
1539
|
+
}): Promise<ToolResult>;
|
|
1540
|
+
getDesktopState(input: GetDesktopStateInput, asyncOpts_?: {
|
|
1541
|
+
signal: AbortSignal;
|
|
1542
|
+
}): Promise<ToolResult>;
|
|
1543
|
+
getScreenSize(input: GetScreenSizeInput, asyncOpts_?: {
|
|
1544
|
+
signal: AbortSignal;
|
|
1545
|
+
}): Promise<ToolResult>;
|
|
1546
|
+
getSessionState(input: GetSessionStateInput, asyncOpts_?: {
|
|
1547
|
+
signal: AbortSignal;
|
|
1548
|
+
}): Promise<SessionStateOutput>;
|
|
1549
|
+
hotkey(input: HotkeyInput, asyncOpts_?: {
|
|
1550
|
+
signal: AbortSignal;
|
|
1551
|
+
}): Promise<ToolResult>;
|
|
1377
1552
|
isAvailable(): boolean;
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1553
|
+
/**
|
|
1554
|
+
* Canonical tool inventory for MCP and other protocol adapters.
|
|
1555
|
+
*/
|
|
1556
|
+
listToolsJson(asyncOpts_?: {
|
|
1557
|
+
signal: AbortSignal;
|
|
1558
|
+
}): Promise<string>;
|
|
1559
|
+
metadata(asyncOpts_?: {
|
|
1560
|
+
signal: AbortSignal;
|
|
1561
|
+
}): Promise<DriverMetadata>;
|
|
1562
|
+
moveCursor(input: MoveCursorInput, asyncOpts_?: {
|
|
1563
|
+
signal: AbortSignal;
|
|
1564
|
+
}): Promise<ToolResult>;
|
|
1565
|
+
pressKey(input: PressKeyInput, asyncOpts_?: {
|
|
1566
|
+
signal: AbortSignal;
|
|
1567
|
+
}): Promise<ToolResult>;
|
|
1568
|
+
scroll(input: ScrollInput, asyncOpts_?: {
|
|
1569
|
+
signal: AbortSignal;
|
|
1570
|
+
}): Promise<ToolResult>;
|
|
1571
|
+
/**
|
|
1572
|
+
* Stop accepting new embedded operations. Repeated calls are harmless;
|
|
1573
|
+
* daemon compatibility clients do not own the daemon and therefore no-op.
|
|
1574
|
+
*/
|
|
1575
|
+
shutdown(asyncOpts_?: {
|
|
1576
|
+
signal: AbortSignal;
|
|
1577
|
+
}): Promise<void>;
|
|
1578
|
+
/**
|
|
1579
|
+
* Compatibility accessor. Embedded runtimes have no socket and return an
|
|
1580
|
+
* empty string; new code should branch on [`Self::execution_mode`].
|
|
1581
|
+
*/
|
|
1383
1582
|
socketPath(): string;
|
|
1384
|
-
startSession(input: StartSessionInput
|
|
1385
|
-
|
|
1583
|
+
startSession(input: StartSessionInput, asyncOpts_?: {
|
|
1584
|
+
signal: AbortSignal;
|
|
1585
|
+
}): Promise<StartSessionOutput>;
|
|
1586
|
+
typeText(input: TypeTextInput, asyncOpts_?: {
|
|
1587
|
+
signal: AbortSignal;
|
|
1588
|
+
}): Promise<ToolResult>;
|
|
1386
1589
|
uniffiDestroy(): void;
|
|
1387
1590
|
static instanceOf(obj_: any): obj_ is CuaDriver;
|
|
1388
1591
|
}
|
|
@@ -1451,6 +1654,13 @@ declare const _default: Readonly<{
|
|
|
1451
1654
|
lift(value: UniffiByteArray): DriverError;
|
|
1452
1655
|
lower(value: DriverError, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1453
1656
|
};
|
|
1657
|
+
FfiConverterTypeDriverExecutionMode: {
|
|
1658
|
+
read(from: RustBuffer): DriverExecutionMode;
|
|
1659
|
+
write(value: DriverExecutionMode, into: RustBuffer): void;
|
|
1660
|
+
allocationSize(value: DriverExecutionMode): number;
|
|
1661
|
+
lift(value: UniffiByteArray): DriverExecutionMode;
|
|
1662
|
+
lower(value: DriverExecutionMode, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1663
|
+
};
|
|
1454
1664
|
FfiConverterTypeDriverMetadata: {
|
|
1455
1665
|
read(from: RustBuffer): DriverMetadata;
|
|
1456
1666
|
write(value: DriverMetadata, into: RustBuffer): void;
|
|
@@ -1458,6 +1668,13 @@ declare const _default: Readonly<{
|
|
|
1458
1668
|
lift(value: UniffiByteArray): DriverMetadata;
|
|
1459
1669
|
lower(value: DriverMetadata, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1460
1670
|
};
|
|
1671
|
+
FfiConverterTypeDriverOptions: {
|
|
1672
|
+
read(from: RustBuffer): DriverOptions;
|
|
1673
|
+
write(value: DriverOptions, into: RustBuffer): void;
|
|
1674
|
+
allocationSize(value: DriverOptions): number;
|
|
1675
|
+
lift(value: UniffiByteArray): DriverOptions;
|
|
1676
|
+
lower(value: DriverOptions, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1677
|
+
};
|
|
1461
1678
|
FfiConverterTypeEmbeddedCuaDriverHost: FfiConverterObject<EmbeddedCuaDriverHostLike>;
|
|
1462
1679
|
FfiConverterTypeEmbeddedDriverConnection: {
|
|
1463
1680
|
read(from: RustBuffer): EmbeddedDriverConnection;
|
|
@@ -1529,6 +1746,13 @@ declare const _default: Readonly<{
|
|
|
1529
1746
|
lift(value: UniffiByteArray): MacOsPermissionStatus;
|
|
1530
1747
|
lower(value: MacOsPermissionStatus, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1531
1748
|
};
|
|
1749
|
+
FfiConverterTypeSdkClientKind: {
|
|
1750
|
+
read(from: RustBuffer): SdkClientKind;
|
|
1751
|
+
write(value: SdkClientKind, into: RustBuffer): void;
|
|
1752
|
+
allocationSize(value: SdkClientKind): number;
|
|
1753
|
+
lift(value: UniffiByteArray): SdkClientKind;
|
|
1754
|
+
lower(value: SdkClientKind, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1755
|
+
};
|
|
1532
1756
|
FfiConverterTypeToolResult: {
|
|
1533
1757
|
read(from: RustBuffer): ToolResult;
|
|
1534
1758
|
write(value: ToolResult, into: RustBuffer): void;
|