agent-device 0.12.4 → 0.12.6

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.
Files changed (31) hide show
  1. package/dist/src/152.js +1 -1
  2. package/dist/src/57.js +1 -1
  3. package/dist/src/641.js +38 -0
  4. package/dist/src/818.js +1 -1
  5. package/dist/src/backend.d.ts +527 -0
  6. package/dist/src/backend.js +1 -0
  7. package/dist/src/bin.js +62 -62
  8. package/dist/src/commands/index.d.ts +1880 -0
  9. package/dist/src/commands/index.js +1 -0
  10. package/dist/src/contracts.d.ts +1 -1
  11. package/dist/src/daemon.js +15 -15
  12. package/dist/src/index.d.ts +2029 -167
  13. package/dist/src/index.js +3 -3
  14. package/dist/src/io.d.ts +85 -0
  15. package/dist/src/io.js +1 -0
  16. package/dist/src/selectors.js +1 -1
  17. package/dist/src/testing/conformance.d.ts +753 -0
  18. package/dist/src/testing/conformance.js +1 -0
  19. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +12 -3
  20. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +1 -0
  21. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +24 -5
  22. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +2 -0
  23. package/ios-runner/AgentDeviceRunner/RecordingScripts/recording-resize.swift +182 -0
  24. package/ios-runner/RUNNER_PROTOCOL.md +1 -1
  25. package/package.json +17 -1
  26. package/skills/agent-device/references/bootstrap-install.md +13 -0
  27. package/skills/agent-device/references/macos-desktop.md +1 -1
  28. package/skills/agent-device/references/remote-tenancy.md +28 -5
  29. package/skills/agent-device/references/verification.md +1 -0
  30. package/dist/src/155.js +0 -38
  31. package/dist/src/940.js +0 -1
@@ -1,3 +1,113 @@
1
+ export declare type AdminBootCommandOptions = CommandContext & {
2
+ target?: BackendDeviceTarget;
3
+ };
4
+
5
+ export declare type AdminBootCommandResult = {
6
+ kind: 'deviceBooted';
7
+ target?: BackendDeviceTarget;
8
+ backendResult?: Record<string, unknown>;
9
+ message?: string;
10
+ };
11
+
12
+ export declare type AdminDevicesCommandOptions = CommandContext & {
13
+ filter?: BackendDeviceFilter;
14
+ };
15
+
16
+ export declare type AdminDevicesCommandResult = {
17
+ kind: 'adminDevices';
18
+ devices: readonly BackendDeviceInfo[];
19
+ };
20
+
21
+ export declare type AdminEnsureSimulatorCommandOptions = CommandContext & BackendEnsureSimulatorOptions;
22
+
23
+ export declare type AdminEnsureSimulatorCommandResult = {
24
+ kind: 'simulatorEnsured';
25
+ } & BackendEnsureSimulatorResult;
26
+
27
+ export declare type AdminInstallCommandOptions = CommandContext & {
28
+ app: string;
29
+ source: BackendInstallSource;
30
+ };
31
+
32
+ export declare type AdminInstallCommandResult = {
33
+ kind: 'appInstalled' | 'appReinstalled' | 'appInstalledFromSource';
34
+ app?: string;
35
+ source: BackendInstallSource;
36
+ appId?: string;
37
+ appName?: string;
38
+ bundleId?: string;
39
+ packageName?: string;
40
+ launchTarget?: string;
41
+ installablePath?: string;
42
+ archivePath?: string;
43
+ backendResult?: Record<string, unknown>;
44
+ message?: string;
45
+ };
46
+
47
+ export declare type AdminInstallFromSourceCommandOptions = CommandContext & {
48
+ app?: string;
49
+ source: BackendInstallSource;
50
+ };
51
+
52
+ export declare type AdminReinstallCommandOptions = AdminInstallCommandOptions;
53
+
54
+ export declare type AgentDevice = AgentDeviceRuntime & BoundAgentDeviceCommands;
55
+
56
+ export declare type AgentDeviceBackend = {
57
+ platform: AgentDeviceBackendPlatform;
58
+ capabilities?: BackendCapabilitySet;
59
+ escapeHatches?: BackendEscapeHatches;
60
+ captureSnapshot?(context: BackendCommandContext, options?: BackendSnapshotOptions): Promise<BackendSnapshotResult>;
61
+ captureScreenshot?(context: BackendCommandContext, outPath: string, options?: BackendScreenshotOptions): Promise<BackendScreenshotResult | void>;
62
+ readText?(context: BackendCommandContext, node: SnapshotNode): Promise<BackendReadTextResult>;
63
+ findText?(context: BackendCommandContext, text: string): Promise<BackendFindTextResult>;
64
+ tap?(context: BackendCommandContext, point: Point, options?: BackendTapOptions): Promise<BackendActionResult>;
65
+ fill?(context: BackendCommandContext, point: Point, text: string, options?: BackendFillOptions): Promise<BackendActionResult>;
66
+ typeText?(context: BackendCommandContext, text: string, options?: {
67
+ delayMs?: number;
68
+ }): Promise<BackendActionResult>;
69
+ focus?(context: BackendCommandContext, point: Point): Promise<BackendActionResult>;
70
+ longPress?(context: BackendCommandContext, point: Point, options?: BackendLongPressOptions): Promise<BackendActionResult>;
71
+ swipe?(context: BackendCommandContext, from: Point, to: Point, options?: BackendSwipeOptions): Promise<BackendActionResult>;
72
+ scroll?(context: BackendCommandContext, target: BackendScrollTarget, options: BackendScrollOptions): Promise<BackendActionResult>;
73
+ pinch?(context: BackendCommandContext, options: BackendPinchOptions): Promise<BackendActionResult>;
74
+ pressKey?(context: BackendCommandContext, key: string, options?: {
75
+ modifiers?: string[];
76
+ }): Promise<BackendActionResult>;
77
+ pressBack?(context: BackendCommandContext, options?: BackendBackOptions): Promise<BackendActionResult>;
78
+ pressHome?(context: BackendCommandContext): Promise<BackendActionResult>;
79
+ rotate?(context: BackendCommandContext, orientation: BackendDeviceOrientation): Promise<BackendActionResult>;
80
+ setKeyboard?(context: BackendCommandContext, options: BackendKeyboardOptions): Promise<BackendKeyboardResult | BackendActionResult>;
81
+ getClipboard?(context: BackendCommandContext): Promise<string | BackendClipboardTextResult>;
82
+ setClipboard?(context: BackendCommandContext, text: string): Promise<BackendActionResult>;
83
+ openSettings?(context: BackendCommandContext, target?: string): Promise<BackendActionResult>;
84
+ handleAlert?(context: BackendCommandContext, action: BackendAlertAction, options?: {
85
+ timeoutMs?: number;
86
+ }): Promise<BackendAlertResult>;
87
+ openAppSwitcher?(context: BackendCommandContext): Promise<BackendActionResult>;
88
+ openApp?(context: BackendCommandContext, target: BackendOpenTarget, options?: BackendOpenOptions): Promise<BackendActionResult>;
89
+ closeApp?(context: BackendCommandContext, app?: string): Promise<BackendActionResult>;
90
+ listApps?(context: BackendCommandContext, filter?: BackendAppListFilter): Promise<readonly BackendAppInfo[]>;
91
+ getAppState?(context: BackendCommandContext, app: string): Promise<BackendAppState>;
92
+ pushFile?(context: BackendCommandContext, input: BackendPushInput, target: string): Promise<BackendActionResult>;
93
+ triggerAppEvent?(context: BackendCommandContext, event: BackendAppEvent): Promise<BackendActionResult>;
94
+ listDevices?(context: BackendCommandContext, filter?: BackendDeviceFilter): Promise<readonly BackendDeviceInfo[]>;
95
+ bootDevice?(context: BackendCommandContext, target?: BackendDeviceTarget): Promise<BackendActionResult>;
96
+ ensureSimulator?(context: BackendCommandContext, options: BackendEnsureSimulatorOptions): Promise<BackendEnsureSimulatorResult>;
97
+ resolveInstallSource?(context: BackendCommandContext, source: BackendInstallSource): Promise<BackendInstallSource>;
98
+ installApp?(context: BackendCommandContext, target: BackendInstallTarget): Promise<BackendInstallResult>;
99
+ reinstallApp?(context: BackendCommandContext, target: BackendInstallTarget): Promise<BackendInstallResult>;
100
+ startRecording?(context: BackendCommandContext, options?: BackendRecordingOptions): Promise<BackendRecordingResult>;
101
+ stopRecording?(context: BackendCommandContext, options?: BackendRecordingOptions): Promise<BackendRecordingResult>;
102
+ startTrace?(context: BackendCommandContext, options?: BackendTraceOptions): Promise<BackendTraceResult>;
103
+ stopTrace?(context: BackendCommandContext, options?: BackendTraceOptions): Promise<BackendTraceResult>;
104
+ readLogs?(context: BackendCommandContext, options?: BackendReadLogsOptions): Promise<BackendReadLogsResult>;
105
+ dumpNetwork?(context: BackendCommandContext, options?: BackendDumpNetworkOptions): Promise<BackendDumpNetworkResult>;
106
+ measurePerf?(context: BackendCommandContext, options?: BackendMeasurePerfOptions): Promise<BackendMeasurePerfResult>;
107
+ };
108
+
109
+ export declare type AgentDeviceBackendPlatform = 'ios' | 'android' | 'macos' | 'linux';
110
+
1
111
  export declare type AgentDeviceClient = {
2
112
  command: AgentDeviceCommandClient;
3
113
  devices: {
@@ -108,6 +218,78 @@ export declare type AgentDeviceCommandClient = {
108
218
  clipboard: (options: ClipboardCommandOptions) => Promise<ClipboardCommandResult>;
109
219
  };
110
220
 
221
+ declare type AgentDeviceCommands = {
222
+ capture: {
223
+ screenshot: RuntimeCommand<ScreenshotCommandOptions, ScreenshotCommandResult>;
224
+ diffScreenshot: RuntimeCommand<DiffScreenshotCommandOptions, DiffScreenshotCommandResult>;
225
+ snapshot: RuntimeCommand<SnapshotCommandOptions, SnapshotCommandResult>;
226
+ diffSnapshot: RuntimeCommand<DiffSnapshotCommandOptions, DiffSnapshotCommandResult>;
227
+ };
228
+ selectors: {
229
+ find: RuntimeCommand<FindReadCommandOptions, FindReadCommandResult>;
230
+ get: RuntimeCommand<GetCommandOptions, GetCommandResult>;
231
+ getText: RuntimeCommand<GetTextCommandOptions, Extract<GetCommandResult, {
232
+ kind: 'text';
233
+ }>>;
234
+ getAttrs: RuntimeCommand<GetAttrsCommandOptions, Extract<GetCommandResult, {
235
+ kind: 'attrs';
236
+ }>>;
237
+ is: RuntimeCommand<IsCommandOptions, IsCommandResult>;
238
+ isVisible: RuntimeCommand<IsSelectorCommandOptions, IsCommandResult>;
239
+ isHidden: RuntimeCommand<IsSelectorCommandOptions, IsCommandResult>;
240
+ wait: RuntimeCommand<WaitCommandOptions_2, WaitCommandResult_2>;
241
+ waitForText: RuntimeCommand<WaitForTextCommandOptions, Extract<WaitCommandResult_2, {
242
+ kind: 'text';
243
+ }>>;
244
+ };
245
+ interactions: {
246
+ click: RuntimeCommand<ClickCommandOptions, PressCommandResult>;
247
+ press: RuntimeCommand<PressCommandOptions, PressCommandResult>;
248
+ fill: RuntimeCommand<FillCommandOptions, FillCommandResult>;
249
+ typeText: RuntimeCommand<TypeTextCommandOptions, TypeTextCommandResult>;
250
+ focus: RuntimeCommand<FocusCommandOptions, FocusCommandResult>;
251
+ longPress: RuntimeCommand<LongPressCommandOptions, LongPressCommandResult>;
252
+ swipe: RuntimeCommand<SwipeCommandOptions, SwipeCommandResult>;
253
+ scroll: RuntimeCommand<ScrollCommandOptions, ScrollCommandResult>;
254
+ pinch: RuntimeCommand<PinchCommandOptions, PinchCommandResult>;
255
+ };
256
+ system: {
257
+ back: RuntimeCommand<SystemBackCommandOptions | undefined, SystemBackCommandResult>;
258
+ home: RuntimeCommand<SystemHomeCommandOptions | undefined, SystemHomeCommandResult>;
259
+ rotate: RuntimeCommand<SystemRotateCommandOptions, SystemRotateCommandResult>;
260
+ keyboard: RuntimeCommand<SystemKeyboardCommandOptions | undefined, SystemKeyboardCommandResult>;
261
+ clipboard: RuntimeCommand<SystemClipboardCommandOptions, SystemClipboardCommandResult>;
262
+ settings: RuntimeCommand<SystemSettingsCommandOptions | undefined, SystemSettingsCommandResult>;
263
+ alert: RuntimeCommand<SystemAlertCommandOptions | undefined, SystemAlertCommandResult>;
264
+ appSwitcher: RuntimeCommand<SystemAppSwitcherCommandOptions | undefined, SystemAppSwitcherCommandResult>;
265
+ };
266
+ apps: {
267
+ open: RuntimeCommand<OpenAppCommandOptions, OpenAppCommandResult>;
268
+ close: RuntimeCommand<CloseAppCommandOptions | undefined, CloseAppCommandResult>;
269
+ list: RuntimeCommand<ListAppsCommandOptions | undefined, ListAppsCommandResult>;
270
+ state: RuntimeCommand<GetAppStateCommandOptions, GetAppStateCommandResult>;
271
+ push: RuntimeCommand<PushAppCommandOptions, PushAppCommandResult>;
272
+ triggerEvent: RuntimeCommand<TriggerAppEventCommandOptions, TriggerAppEventCommandResult>;
273
+ };
274
+ admin: {
275
+ devices: RuntimeCommand<AdminDevicesCommandOptions | undefined, AdminDevicesCommandResult>;
276
+ boot: RuntimeCommand<AdminBootCommandOptions | undefined, AdminBootCommandResult>;
277
+ ensureSimulator: RuntimeCommand<AdminEnsureSimulatorCommandOptions, AdminEnsureSimulatorCommandResult>;
278
+ install: RuntimeCommand<AdminInstallCommandOptions, AdminInstallCommandResult>;
279
+ reinstall: RuntimeCommand<AdminReinstallCommandOptions, AdminInstallCommandResult>;
280
+ installFromSource: RuntimeCommand<AdminInstallFromSourceCommandOptions, AdminInstallCommandResult>;
281
+ };
282
+ recording: {
283
+ record: RuntimeCommand<RecordingRecordCommandOptions, RecordingRecordCommandResult>;
284
+ trace: RuntimeCommand<RecordingTraceCommandOptions, RecordingTraceCommandResult>;
285
+ };
286
+ diagnostics: {
287
+ logs: RuntimeCommand<DiagnosticsLogsCommandOptions | undefined, DiagnosticsLogsCommandResult>;
288
+ network: RuntimeCommand<DiagnosticsNetworkCommandOptions | undefined, DiagnosticsNetworkCommandResult>;
289
+ perf: RuntimeCommand<DiagnosticsPerfCommandOptions | undefined, DiagnosticsPerfCommandResult>;
290
+ };
291
+ };
292
+
111
293
  export declare type AgentDeviceDaemonTransport = (req: Omit<DaemonRequest, 'token'>) => Promise<DaemonResponse>;
112
294
 
113
295
  export declare type AgentDeviceDevice = {
@@ -139,6 +321,26 @@ export declare type AgentDeviceIdentifiers = {
139
321
 
140
322
  export declare type AgentDeviceRequestOverrides = Pick<AgentDeviceClientConfig, 'session' | 'lockPolicy' | 'lockPlatform' | 'requestId' | 'daemonBaseUrl' | 'daemonAuthToken' | 'daemonTransport' | 'daemonServerMode' | 'tenant' | 'sessionIsolation' | 'runId' | 'leaseId' | 'leaseBackend' | 'cwd' | 'debug'>;
141
323
 
324
+ export declare type AgentDeviceRuntime = {
325
+ backend: AgentDeviceBackend;
326
+ artifacts: ArtifactAdapter;
327
+ sessions: CommandSessionStore;
328
+ policy: CommandPolicy;
329
+ diagnostics?: DiagnosticsSink;
330
+ clock?: CommandClock;
331
+ signal?: AbortSignal;
332
+ };
333
+
334
+ export declare type AgentDeviceRuntimeConfig = {
335
+ backend: AgentDeviceBackend;
336
+ artifacts: ArtifactAdapter;
337
+ sessions?: CommandSessionStore;
338
+ policy?: CommandPolicy;
339
+ diagnostics?: DiagnosticsSink;
340
+ clock?: CommandClock;
341
+ signal?: AbortSignal;
342
+ };
343
+
142
344
  export declare type AgentDeviceSelectionOptions = {
143
345
  platform?: PlatformSelector;
144
346
  target?: DeviceTarget;
@@ -212,7 +414,7 @@ export declare class AppError extends Error {
212
414
  constructor(code: AppErrorCode, message: string, details?: AppErrorDetails, cause?: unknown);
213
415
  }
214
416
 
215
- declare type AppErrorCode = 'INVALID_ARGS' | 'DEVICE_NOT_FOUND' | 'TOOL_MISSING' | 'APP_NOT_INSTALLED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_OPERATION' | 'COMMAND_FAILED' | 'SESSION_NOT_FOUND' | 'UNAUTHORIZED' | 'UNKNOWN';
417
+ export declare type AppErrorCode = 'INVALID_ARGS' | 'DEVICE_NOT_FOUND' | 'TOOL_MISSING' | 'APP_NOT_INSTALLED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_OPERATION' | 'NOT_IMPLEMENTED' | 'COMMAND_FAILED' | 'SESSION_NOT_FOUND' | 'UNAUTHORIZED' | 'UNKNOWN';
216
418
 
217
419
  declare type AppErrorDetails = Record<string, unknown> & {
218
420
  hint?: string;
@@ -267,6 +469,11 @@ export declare type AppOpenResult = {
267
469
  identifiers: AgentDeviceIdentifiers;
268
470
  };
269
471
 
472
+ export declare type AppPushInput = {
473
+ kind: 'json';
474
+ payload: Record<string, unknown>;
475
+ } | FileInputRef;
476
+
270
477
  export declare type AppPushOptions = ClientCommandBaseOptions & {
271
478
  app: string;
272
479
  payload: string | Record<string, unknown>;
@@ -293,6 +500,30 @@ export declare type AppTriggerEventOptions = ClientCommandBaseOptions & {
293
500
  payload?: Record<string, unknown>;
294
501
  };
295
502
 
503
+ export declare type ArtifactAdapter = {
504
+ resolveInput(ref: FileInputRef, options: ResolveInputOptions): Promise<ResolvedInputFile>;
505
+ reserveOutput(ref: FileOutputRef | undefined, options: ReserveOutputOptions): Promise<ReservedOutputFile>;
506
+ createTempFile(options: CreateTempFileOptions): Promise<TemporaryFile>;
507
+ };
508
+
509
+ export declare type ArtifactDescriptor = {
510
+ kind: 'localPath';
511
+ field: string;
512
+ path: string;
513
+ fileName?: string;
514
+ metadata?: Record<string, unknown>;
515
+ } | {
516
+ kind: 'artifact';
517
+ field: string;
518
+ artifactId: string;
519
+ fileName?: string;
520
+ url?: string;
521
+ clientPath?: string;
522
+ metadata?: Record<string, unknown>;
523
+ };
524
+
525
+ export declare function assertBackendCapabilityAllowed(runtime: Pick<AgentDeviceRuntime, 'backend' | 'policy'>, capability: BackendCapabilityName): void;
526
+
296
527
  export declare type BackCommandOptions = DeviceCommandBaseOptions & {
297
528
  mode?: 'in-app' | 'system';
298
529
  };
@@ -301,235 +532,1243 @@ export declare type BackCommandResult = CommandActionResult<'back'> & {
301
532
  mode?: 'in-app' | 'system';
302
533
  };
303
534
 
304
- export declare type BatchRunOptions = AgentDeviceRequestOverrides & {
305
- steps: BatchStep[];
306
- onError?: 'stop';
307
- maxSteps?: number;
308
- out?: string;
309
- };
535
+ declare const BACKEND_CAPABILITY_NAMES: readonly ["android.shell", "ios.runnerCommand", "macos.desktopScreenshot"];
310
536
 
311
- export declare type BatchStep = {
312
- command: string;
313
- positionals?: string[];
314
- flags?: Record<string, unknown>;
315
- };
537
+ export declare type BackendActionResult = Record<string, unknown> | void;
316
538
 
317
- export declare type CaptureDiffOptions = ClientCommandBaseOptions & Pick<CaptureSnapshotOptions, 'interactiveOnly' | 'compact' | 'depth' | 'scope' | 'raw'> & {
318
- kind: 'snapshot';
319
- out?: string;
320
- };
539
+ export declare type BackendAlertAction = 'get' | 'accept' | 'dismiss' | 'wait';
321
540
 
322
- export declare type CaptureScreenshotOptions = AgentDeviceRequestOverrides & {
323
- path?: string;
324
- overlayRefs?: boolean;
325
- fullscreen?: boolean;
541
+ export declare type BackendAlertInfo = {
542
+ title?: string;
543
+ message?: string;
544
+ buttons?: string[];
326
545
  };
327
546
 
328
- export declare type CaptureScreenshotResult = {
329
- path: string;
330
- overlayRefs?: ScreenshotOverlayRef[];
331
- identifiers: AgentDeviceIdentifiers;
547
+ export declare type BackendAlertResult = {
548
+ kind: 'alertStatus';
549
+ alert: BackendAlertInfo | null;
550
+ } | {
551
+ kind: 'alertHandled';
552
+ handled: boolean;
553
+ alert?: BackendAlertInfo;
554
+ button?: string;
555
+ } | {
556
+ kind: 'alertWait';
557
+ alert: BackendAlertInfo | null;
558
+ waitedMs?: number;
559
+ timedOut?: boolean;
332
560
  };
333
561
 
334
- export declare type CaptureSnapshotOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
335
- interactiveOnly?: boolean;
336
- compact?: boolean;
337
- depth?: number;
338
- scope?: string;
339
- raw?: boolean;
562
+ export declare type BackendAppEvent = {
563
+ name: string;
564
+ payload?: Record<string, unknown>;
340
565
  };
341
566
 
342
- export declare type CaptureSnapshotResult = {
343
- nodes: SnapshotNode[];
344
- truncated: boolean;
345
- appName?: string;
346
- appBundleId?: string;
347
- visibility?: SnapshotVisibility;
348
- warnings?: string[];
349
- identifiers: AgentDeviceIdentifiers;
567
+ export declare type BackendAppInfo = {
568
+ id: string;
569
+ name?: string;
570
+ bundleId?: string;
571
+ packageName?: string;
572
+ activity?: string;
350
573
  };
351
574
 
352
- export declare function centerOfRect(rect: Rect): Point;
575
+ export declare type BackendAppListFilter = 'all' | 'user-installed';
353
576
 
354
- export declare type ClickOptions = ClientCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions & {
355
- button?: 'primary' | 'secondary' | 'middle';
577
+ export declare type BackendAppState = {
578
+ appId?: string;
579
+ bundleId?: string;
580
+ packageName?: string;
581
+ activity?: string;
582
+ state?: 'unknown' | 'notRunning' | 'running' | 'foreground' | 'background';
583
+ details?: Record<string, unknown>;
356
584
  };
357
585
 
358
- declare type ClientCommandBaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions;
359
-
360
- export declare type ClipboardCommandOptions = (DeviceCommandBaseOptions & {
361
- action: 'read';
362
- }) | (DeviceCommandBaseOptions & {
363
- action: 'write';
364
- text: string;
365
- });
366
-
367
- export declare type ClipboardCommandResult = (DaemonResponseData & {
368
- action: 'read';
369
- text: string;
370
- }) | (DaemonResponseData & {
371
- action: 'write';
372
- textLength: number;
373
- });
374
-
375
- declare type CommandActionResult<T extends string> = DaemonResponseData & {
376
- action?: T;
586
+ export declare type BackendBackOptions = {
587
+ mode?: 'in-app' | 'system';
377
588
  };
378
589
 
379
- export declare type CommandRequestResult = DaemonResponseData;
380
-
381
- export declare function createAgentDeviceClient(config?: AgentDeviceClientConfig, deps?: {
382
- transport?: AgentDeviceDaemonTransport;
383
- }): AgentDeviceClient;
384
-
385
- declare type DaemonArtifact = {
386
- field: string;
387
- artifactId?: string;
388
- fileName?: string;
389
- localPath?: string;
390
- path?: string;
391
- };
590
+ export declare type BackendCapabilityName = (typeof BACKEND_CAPABILITY_NAMES)[number];
392
591
 
393
- declare type DaemonError = {
394
- code: string;
395
- message: string;
396
- hint?: string;
397
- diagnosticId?: string;
398
- logPath?: string;
399
- details?: Record<string, unknown>;
400
- };
592
+ export declare type BackendCapabilitySet = readonly BackendCapabilityName[];
401
593
 
402
- declare type DaemonInstallSource = {
403
- kind: 'url';
404
- url: string;
405
- headers?: Record<string, string>;
406
- } | {
407
- kind: 'path';
408
- path: string;
594
+ export declare type BackendClipboardTextResult = {
595
+ text: string;
409
596
  };
410
597
 
411
- declare type DaemonLockPolicy = 'reject' | 'strip';
412
-
413
- declare type DaemonRequest = {
414
- token?: string;
598
+ export declare type BackendCommandContext = {
415
599
  session?: string;
416
- command: string;
417
- positionals: string[];
418
- flags?: Record<string, unknown>;
419
- runtime?: SessionRuntimeHints;
420
- meta?: DaemonRequestMeta;
421
- };
422
-
423
- declare type DaemonRequestMeta = {
424
600
  requestId?: string;
425
- debug?: boolean;
426
- cwd?: string;
427
- tenantId?: string;
428
- runId?: string;
429
- leaseId?: string;
430
- leaseTtlMs?: number;
431
- leaseBackend?: LeaseBackend;
432
- sessionIsolation?: 'none' | 'tenant';
433
- uploadedArtifactId?: string;
434
- clientArtifactPaths?: Record<string, string>;
435
- installSource?: DaemonInstallSource;
436
- retainMaterializedPaths?: boolean;
437
- materializedPathRetentionMs?: number;
438
- materializationId?: string;
439
- lockPolicy?: DaemonLockPolicy;
440
- lockPlatform?: 'ios' | 'macos' | 'android' | 'linux' | 'apple';
601
+ appId?: string;
602
+ appBundleId?: string;
603
+ signal?: AbortSignal;
604
+ metadata?: Record<string, unknown>;
441
605
  };
442
606
 
443
- declare type DaemonResponse = {
444
- ok: true;
445
- data?: DaemonResponseData;
446
- } | {
447
- ok: false;
448
- error: DaemonError;
607
+ export declare type BackendDeviceFilter = {
608
+ platform?: AgentDeviceBackendPlatform | 'apple';
609
+ target?: 'mobile' | 'tv' | 'desktop';
610
+ kind?: 'simulator' | 'emulator' | 'device' | 'desktop';
449
611
  };
450
612
 
451
- declare type DaemonResponseData = Record<string, unknown> & {
452
- artifacts?: DaemonArtifact[];
613
+ export declare type BackendDeviceInfo = {
614
+ id: string;
615
+ name: string;
616
+ platform: AgentDeviceBackendPlatform;
617
+ target?: 'mobile' | 'tv' | 'desktop';
618
+ kind?: 'simulator' | 'emulator' | 'device' | 'desktop';
619
+ booted?: boolean;
620
+ details?: Record<string, unknown>;
453
621
  };
454
622
 
455
- declare type DaemonServerMode = 'socket' | 'http' | 'dual';
456
-
457
- declare type DaemonTransportMode = 'auto' | 'socket' | 'http';
623
+ export declare type BackendDeviceOrientation = 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right';
458
624
 
459
- export declare type DeviceBootOptions = ClientCommandBaseOptions & {
625
+ export declare type BackendDeviceTarget = {
626
+ id?: string;
627
+ name?: string;
628
+ platform?: AgentDeviceBackendPlatform;
629
+ target?: 'mobile' | 'tv' | 'desktop';
460
630
  headless?: boolean;
461
631
  };
462
632
 
463
- declare type DeviceCommandBaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions;
633
+ export declare type BackendDiagnosticsPageOptions = BackendDiagnosticsTimeWindow & {
634
+ cursor?: string;
635
+ limit?: number;
636
+ };
464
637
 
465
- declare type DeviceKind = 'simulator' | 'emulator' | 'device';
638
+ export declare type BackendDiagnosticsTimeWindow = {
639
+ since?: string;
640
+ until?: string;
641
+ };
466
642
 
467
- declare type DeviceTarget = 'mobile' | 'tv' | 'desktop';
643
+ export declare type BackendDumpNetworkOptions = BackendDiagnosticsPageOptions & {
644
+ include?: BackendNetworkIncludeMode;
645
+ };
468
646
 
469
- export declare type ElementTarget = RefTarget | SelectorTarget;
647
+ export declare type BackendDumpNetworkResult = {
648
+ entries: readonly BackendNetworkEntry[];
649
+ nextCursor?: string;
650
+ timeWindow?: BackendDiagnosticsTimeWindow;
651
+ backend?: string;
652
+ redacted?: boolean;
653
+ notes?: readonly string[];
654
+ };
470
655
 
471
- export declare type EnsureSimulatorOptions = AgentDeviceRequestOverrides & {
656
+ export declare type BackendEnsureSimulatorOptions = {
472
657
  device: string;
473
658
  runtime?: string;
474
659
  boot?: boolean;
475
660
  reuseExisting?: boolean;
476
- iosSimulatorDeviceSet?: string;
477
661
  };
478
662
 
479
- export declare type EnsureSimulatorResult = {
663
+ export declare type BackendEnsureSimulatorResult = {
480
664
  udid: string;
481
665
  device: string;
482
666
  runtime: string;
483
667
  created: boolean;
484
668
  booted: boolean;
485
- iosSimulatorDeviceSet?: string | null;
486
- identifiers: AgentDeviceIdentifiers;
669
+ simulatorSetPath?: string | null;
487
670
  };
488
671
 
489
- export declare type FillOptions = ClientCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & {
490
- text: string;
491
- delayMs?: number;
672
+ export declare type BackendEscapeHatches = {
673
+ androidShell?(context: BackendCommandContext, args: readonly string[]): Promise<BackendShellResult>;
674
+ iosRunnerCommand?(context: BackendCommandContext, command: BackendRunnerCommand): Promise<BackendActionResult>;
675
+ macosDesktopScreenshot?(context: BackendCommandContext, outPath: string, options?: BackendScreenshotOptions): Promise<BackendScreenshotResult | void>;
492
676
  };
493
677
 
494
- declare type FindBaseOptions = ClientCommandBaseOptions & FindSnapshotCommandOptions & {
495
- locator?: FindLocator;
496
- query: string;
497
- first?: boolean;
498
- last?: boolean;
678
+ export declare type BackendFillOptions = {
679
+ delayMs?: number;
499
680
  };
500
681
 
501
- export declare type FindLocator = 'any' | 'text' | 'label' | 'value' | 'role' | 'id';
502
-
503
- export declare type FindOptions = (FindBaseOptions & {
504
- action?: 'click' | 'focus' | 'exists' | 'getText' | 'getAttrs';
505
- }) | (FindBaseOptions & {
506
- action: 'wait';
507
- timeoutMs?: number;
508
- }) | (FindBaseOptions & {
509
- action: 'fill' | 'type';
510
- value: string;
511
- });
512
-
513
- declare type FindSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'raw'>;
514
-
515
- declare type FocusOptions_2 = ClientCommandBaseOptions & {
516
- x: number;
517
- y: number;
682
+ export declare type BackendFindTextResult = {
683
+ found: boolean;
518
684
  };
519
- export { FocusOptions_2 as FocusOptions }
520
685
 
521
- export declare type GetOptions = ClientCommandBaseOptions & SelectorSnapshotCommandOptions & ElementTarget & {
522
- format: 'text' | 'attrs';
686
+ export declare type BackendInstallResult = Record<string, unknown> & {
687
+ appId?: string;
688
+ appName?: string;
689
+ bundleId?: string;
690
+ packageName?: string;
691
+ launchTarget?: string;
692
+ installablePath?: string;
693
+ archivePath?: string;
523
694
  };
524
695
 
525
- export declare type HomeCommandOptions = DeviceCommandBaseOptions;
696
+ export declare type BackendInstallSource = {
697
+ kind: 'path';
698
+ path: string;
699
+ } | {
700
+ kind: 'uploadedArtifact';
701
+ id: string;
702
+ } | {
703
+ kind: 'url';
704
+ url: string;
705
+ };
706
+
707
+ export declare type BackendInstallTarget = {
708
+ app?: string;
709
+ source: BackendInstallSource;
710
+ };
711
+
712
+ export declare type BackendKeyboardOptions = {
713
+ action: 'status' | 'get' | 'dismiss';
714
+ };
715
+
716
+ export declare type BackendKeyboardResult = {
717
+ platform?: 'android' | 'ios' | 'macos' | 'linux';
718
+ action?: BackendKeyboardOptions['action'];
719
+ visible?: boolean;
720
+ inputType?: string | null;
721
+ type?: string | null;
722
+ wasVisible?: boolean;
723
+ dismissed?: boolean;
724
+ attempts?: number;
725
+ };
726
+
727
+ export declare type BackendLogEntry = {
728
+ timestamp?: string;
729
+ level?: 'debug' | 'info' | 'warn' | 'error' | string;
730
+ message: string;
731
+ source?: string;
732
+ metadata?: Record<string, unknown>;
733
+ };
734
+
735
+ export declare type BackendLongPressOptions = {
736
+ durationMs?: number;
737
+ };
738
+
739
+ export declare type BackendMeasurePerfOptions = BackendDiagnosticsTimeWindow & {
740
+ sampleMs?: number;
741
+ metrics?: readonly string[];
742
+ };
743
+
744
+ export declare type BackendMeasurePerfResult = {
745
+ metrics: readonly BackendPerfMetric[];
746
+ startedAt?: string;
747
+ endedAt?: string;
748
+ backend?: string;
749
+ redacted?: boolean;
750
+ notes?: readonly string[];
751
+ };
752
+
753
+ export declare type BackendNetworkEntry = {
754
+ timestamp?: string;
755
+ method?: string;
756
+ url?: string;
757
+ status?: number;
758
+ durationMs?: number;
759
+ requestHeaders?: Record<string, string>;
760
+ responseHeaders?: Record<string, string>;
761
+ requestBody?: string;
762
+ responseBody?: string;
763
+ metadata?: Record<string, unknown>;
764
+ };
765
+
766
+ export declare type BackendNetworkIncludeMode = 'summary' | 'headers' | 'body' | 'all';
767
+
768
+ export declare type BackendOpenOptions = {
769
+ relaunch?: boolean;
770
+ };
771
+
772
+ export declare type BackendOpenTarget = {
773
+ /**
774
+ * Generic app identifier accepted by the backend. Hosted adapters should
775
+ * prefer structured appId, bundleId, or packageName when available.
776
+ */
777
+ app?: string;
778
+ appId?: string;
779
+ bundleId?: string;
780
+ packageName?: string;
781
+ /**
782
+ * URL may be used by itself for a deep link or with an app identifier when
783
+ * the backend supports opening a URL in a specific app context.
784
+ */
785
+ url?: string;
786
+ /**
787
+ * Platform-specific activity override, primarily for Android app launches.
788
+ */
789
+ activity?: string;
790
+ };
791
+
792
+ export declare type BackendPerfMetric = {
793
+ name: string;
794
+ value?: number;
795
+ unit?: string;
796
+ status?: 'ok' | 'unavailable' | 'error';
797
+ message?: string;
798
+ metadata?: Record<string, unknown>;
799
+ };
800
+
801
+ export declare type BackendPinchOptions = {
802
+ scale: number;
803
+ center?: Point;
804
+ };
805
+
806
+ export declare type BackendPushInput = {
807
+ kind: 'json';
808
+ payload: Record<string, unknown>;
809
+ } | {
810
+ kind: 'file';
811
+ path: string;
812
+ };
813
+
814
+ export declare type BackendReadLogsOptions = BackendDiagnosticsPageOptions & {
815
+ levels?: readonly string[];
816
+ search?: string;
817
+ source?: string;
818
+ };
819
+
820
+ export declare type BackendReadLogsResult = {
821
+ entries: readonly BackendLogEntry[];
822
+ nextCursor?: string;
823
+ timeWindow?: BackendDiagnosticsTimeWindow;
824
+ backend?: string;
825
+ redacted?: boolean;
826
+ notes?: readonly string[];
827
+ };
828
+
829
+ export declare type BackendReadTextResult = {
830
+ text: string;
831
+ };
832
+
833
+ export declare type BackendRecordingOptions = {
834
+ outPath?: string;
835
+ fps?: number;
836
+ quality?: number;
837
+ showTouches?: boolean;
838
+ };
839
+
840
+ export declare type BackendRecordingResult = Record<string, unknown> & {
841
+ path?: string;
842
+ telemetryPath?: string;
843
+ warning?: string;
844
+ };
845
+
846
+ export declare type BackendRunnerCommand = {
847
+ command: string;
848
+ args?: readonly string[];
849
+ payload?: Record<string, unknown>;
850
+ };
851
+
852
+ export declare type BackendScreenshotOptions = {
853
+ fullscreen?: boolean;
854
+ overlayRefs?: boolean;
855
+ surface?: 'app' | 'frontmost-app' | 'desktop' | 'menubar';
856
+ };
857
+
858
+ export declare type BackendScreenshotResult = {
859
+ path?: string;
860
+ overlayRefs?: ScreenshotOverlayRef[];
861
+ };
862
+
863
+ export declare type BackendScrollOptions = {
864
+ direction: 'up' | 'down' | 'left' | 'right';
865
+ amount?: number;
866
+ pixels?: number;
867
+ };
868
+
869
+ export declare type BackendScrollTarget = {
870
+ kind: 'viewport';
871
+ } | {
872
+ kind: 'point';
873
+ point: Point;
874
+ };
875
+
876
+ export declare type BackendShellResult = {
877
+ exitCode: number;
878
+ stdout: string;
879
+ stderr: string;
880
+ };
881
+
882
+ export declare type BackendSnapshotAnalysis = {
883
+ rawNodeCount?: number;
884
+ maxDepth?: number;
885
+ };
886
+
887
+ export declare type BackendSnapshotFreshness = {
888
+ action: string;
889
+ retryCount: number;
890
+ staleAfterRetries: boolean;
891
+ reason?: 'empty-interactive' | 'sharp-drop' | 'stuck-route';
892
+ };
893
+
894
+ export declare type BackendSnapshotOptions = SnapshotOptions & {
895
+ outPath?: string;
896
+ };
897
+
898
+ export declare type BackendSnapshotResult = {
899
+ nodes?: SnapshotNode[];
900
+ truncated?: boolean;
901
+ backend?: string;
902
+ snapshot?: SnapshotState;
903
+ analysis?: BackendSnapshotAnalysis;
904
+ freshness?: BackendSnapshotFreshness;
905
+ warnings?: string[];
906
+ appName?: string;
907
+ appBundleId?: string;
908
+ };
909
+
910
+ export declare type BackendSwipeOptions = {
911
+ durationMs?: number;
912
+ };
913
+
914
+ export declare type BackendTapOptions = {
915
+ button?: 'primary' | 'secondary' | 'middle';
916
+ count?: number;
917
+ intervalMs?: number;
918
+ holdMs?: number;
919
+ jitterPx?: number;
920
+ doubleTap?: boolean;
921
+ };
922
+
923
+ export declare type BackendTraceOptions = {
924
+ outPath?: string;
925
+ };
926
+
927
+ export declare type BackendTraceResult = Record<string, unknown> & {
928
+ outPath?: string;
929
+ };
930
+
931
+ export declare type BatchCommandOptions<TContext = unknown> = CommandContext & {
932
+ steps: readonly CommandRouterRequest<TContext>[];
933
+ stopOnError?: boolean;
934
+ maxSteps?: number;
935
+ };
936
+
937
+ export declare type BatchCommandResult = {
938
+ kind: 'batch';
939
+ total: number;
940
+ executed: number;
941
+ failed: number;
942
+ totalDurationMs: number;
943
+ results: readonly BatchCommandStepResult[];
944
+ };
945
+
946
+ export declare type BatchCommandStepResult = {
947
+ step: number;
948
+ command: string;
949
+ ok: true;
950
+ data: CommandRouterResult;
951
+ durationMs: number;
952
+ } | {
953
+ step: number;
954
+ command: string;
955
+ ok: false;
956
+ error: NormalizedError;
957
+ durationMs: number;
958
+ };
959
+
960
+ export declare type BatchRunOptions = AgentDeviceRequestOverrides & {
961
+ steps: BatchStep[];
962
+ onError?: 'stop';
963
+ maxSteps?: number;
964
+ out?: string;
965
+ };
966
+
967
+ export declare type BatchStep = {
968
+ command: string;
969
+ positionals?: string[];
970
+ flags?: Record<string, unknown>;
971
+ };
972
+
973
+ export declare type BoundAgentDeviceCommands = {
974
+ capture: {
975
+ screenshot: BoundRuntimeCommand<ScreenshotCommandOptions, ScreenshotCommandResult>;
976
+ diffScreenshot: BoundRuntimeCommand<DiffScreenshotCommandOptions, DiffScreenshotCommandResult>;
977
+ snapshot: BoundRuntimeCommand<SnapshotCommandOptions, SnapshotCommandResult>;
978
+ diffSnapshot: BoundRuntimeCommand<DiffSnapshotCommandOptions, DiffSnapshotCommandResult>;
979
+ };
980
+ selectors: {
981
+ find: BoundRuntimeCommand<FindReadCommandOptions, FindReadCommandResult>;
982
+ get: BoundRuntimeCommand<GetCommandOptions, GetCommandResult>;
983
+ getText: (target: ElementTarget_2, options?: Omit<GetTextCommandOptions, 'target'>) => Promise<Extract<GetCommandResult, {
984
+ kind: 'text';
985
+ }>>;
986
+ getAttrs: (target: ElementTarget_2, options?: Omit<GetAttrsCommandOptions, 'target'>) => Promise<Extract<GetCommandResult, {
987
+ kind: 'attrs';
988
+ }>>;
989
+ is: BoundRuntimeCommand<IsCommandOptions, IsCommandResult>;
990
+ isVisible: (target: SelectorTarget, options?: Omit<IsSelectorCommandOptions, 'target'>) => Promise<IsCommandResult>;
991
+ isHidden: (target: SelectorTarget, options?: Omit<IsSelectorCommandOptions, 'target'>) => Promise<IsCommandResult>;
992
+ wait: BoundRuntimeCommand<WaitCommandOptions_2, WaitCommandResult_2>;
993
+ waitForText: (text: string, options?: Omit<WaitForTextCommandOptions, 'text'>) => Promise<Extract<WaitCommandResult_2, {
994
+ kind: 'text';
995
+ }>>;
996
+ };
997
+ interactions: {
998
+ click: (target: InteractionTarget_2, options?: Omit<ClickCommandOptions, 'target'>) => Promise<PressCommandResult>;
999
+ press: (target: InteractionTarget_2, options?: Omit<PressCommandOptions, 'target'>) => Promise<PressCommandResult>;
1000
+ fill: (target: InteractionTarget_2, text: string, options?: Omit<FillCommandOptions, 'target' | 'text'>) => Promise<FillCommandResult>;
1001
+ typeText: (text: string, options?: Omit<TypeTextCommandOptions, 'text'>) => Promise<TypeTextCommandResult>;
1002
+ focus: (target: InteractionTarget_2, options?: Omit<FocusCommandOptions, 'target'>) => Promise<FocusCommandResult>;
1003
+ longPress: (target: InteractionTarget_2, options?: Omit<LongPressCommandOptions, 'target'>) => Promise<LongPressCommandResult>;
1004
+ swipe: BoundRuntimeCommand<SwipeCommandOptions, SwipeCommandResult>;
1005
+ scroll: BoundRuntimeCommand<ScrollCommandOptions, ScrollCommandResult>;
1006
+ pinch: BoundRuntimeCommand<PinchCommandOptions, PinchCommandResult>;
1007
+ };
1008
+ system: {
1009
+ back: (options?: SystemBackCommandOptions) => Promise<SystemBackCommandResult>;
1010
+ home: (options?: SystemHomeCommandOptions) => Promise<SystemHomeCommandResult>;
1011
+ rotate: BoundRuntimeCommand<SystemRotateCommandOptions, SystemRotateCommandResult>;
1012
+ keyboard: (options?: SystemKeyboardCommandOptions) => Promise<SystemKeyboardCommandResult>;
1013
+ clipboard: BoundRuntimeCommand<SystemClipboardCommandOptions, SystemClipboardCommandResult>;
1014
+ settings: (options?: SystemSettingsCommandOptions) => Promise<SystemSettingsCommandResult>;
1015
+ alert: (options?: SystemAlertCommandOptions) => Promise<SystemAlertCommandResult>;
1016
+ appSwitcher: (options?: SystemAppSwitcherCommandOptions) => Promise<SystemAppSwitcherCommandResult>;
1017
+ };
1018
+ apps: {
1019
+ open: BoundRuntimeCommand<OpenAppCommandOptions, OpenAppCommandResult>;
1020
+ close: (options?: CloseAppCommandOptions) => Promise<CloseAppCommandResult>;
1021
+ list: (options?: ListAppsCommandOptions) => Promise<ListAppsCommandResult>;
1022
+ state: BoundRuntimeCommand<GetAppStateCommandOptions, GetAppStateCommandResult>;
1023
+ push: BoundRuntimeCommand<PushAppCommandOptions, PushAppCommandResult>;
1024
+ triggerEvent: BoundRuntimeCommand<TriggerAppEventCommandOptions, TriggerAppEventCommandResult>;
1025
+ };
1026
+ admin: {
1027
+ devices: (options?: AdminDevicesCommandOptions) => Promise<AdminDevicesCommandResult>;
1028
+ boot: (options?: AdminBootCommandOptions) => Promise<AdminBootCommandResult>;
1029
+ ensureSimulator: BoundRuntimeCommand<AdminEnsureSimulatorCommandOptions, AdminEnsureSimulatorCommandResult>;
1030
+ install: BoundRuntimeCommand<AdminInstallCommandOptions, AdminInstallCommandResult>;
1031
+ reinstall: BoundRuntimeCommand<AdminReinstallCommandOptions, AdminInstallCommandResult>;
1032
+ installFromSource: BoundRuntimeCommand<AdminInstallFromSourceCommandOptions, AdminInstallCommandResult>;
1033
+ };
1034
+ recording: {
1035
+ record: BoundRuntimeCommand<RecordingRecordCommandOptions, RecordingRecordCommandResult>;
1036
+ trace: BoundRuntimeCommand<RecordingTraceCommandOptions, RecordingTraceCommandResult>;
1037
+ };
1038
+ observability: {
1039
+ logs: (options?: DiagnosticsLogsCommandOptions) => Promise<DiagnosticsLogsCommandResult>;
1040
+ network: (options?: DiagnosticsNetworkCommandOptions) => Promise<DiagnosticsNetworkCommandResult>;
1041
+ perf: (options?: DiagnosticsPerfCommandOptions) => Promise<DiagnosticsPerfCommandResult>;
1042
+ };
1043
+ };
1044
+
1045
+ export declare type BoundRuntimeCommand<TOptions = Record<string, unknown>, TResult = CommandResult> = (options: TOptions) => Promise<TResult>;
1046
+
1047
+ export declare type CaptureDiffOptions = ClientCommandBaseOptions & Pick<CaptureSnapshotOptions, 'interactiveOnly' | 'compact' | 'depth' | 'scope' | 'raw'> & {
1048
+ kind: 'snapshot';
1049
+ out?: string;
1050
+ };
1051
+
1052
+ export declare type CaptureScreenshotOptions = AgentDeviceRequestOverrides & {
1053
+ path?: string;
1054
+ overlayRefs?: boolean;
1055
+ fullscreen?: boolean;
1056
+ surface?: 'app' | 'frontmost-app' | 'desktop' | 'menubar';
1057
+ };
1058
+
1059
+ export declare type CaptureScreenshotResult = {
1060
+ path: string;
1061
+ overlayRefs?: ScreenshotOverlayRef[];
1062
+ identifiers: AgentDeviceIdentifiers;
1063
+ };
1064
+
1065
+ export declare type CaptureSnapshotOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
1066
+ interactiveOnly?: boolean;
1067
+ compact?: boolean;
1068
+ depth?: number;
1069
+ scope?: string;
1070
+ raw?: boolean;
1071
+ };
1072
+
1073
+ export declare type CaptureSnapshotResult = {
1074
+ nodes: SnapshotNode[];
1075
+ truncated: boolean;
1076
+ appName?: string;
1077
+ appBundleId?: string;
1078
+ visibility?: SnapshotVisibility;
1079
+ warnings?: string[];
1080
+ identifiers: AgentDeviceIdentifiers;
1081
+ };
1082
+
1083
+ export declare function centerOfRect(rect: Rect): Point;
1084
+
1085
+ declare type ClickCommandOptions = PressCommandOptions;
1086
+
1087
+ export declare type ClickOptions = ClientCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions & {
1088
+ button?: 'primary' | 'secondary' | 'middle';
1089
+ };
1090
+
1091
+ declare type ClientCommandBaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions;
1092
+
1093
+ export declare type ClipboardCommandOptions = (DeviceCommandBaseOptions & {
1094
+ action: 'read';
1095
+ }) | (DeviceCommandBaseOptions & {
1096
+ action: 'write';
1097
+ text: string;
1098
+ });
1099
+
1100
+ export declare type ClipboardCommandResult = (DaemonResponseData & {
1101
+ action: 'read';
1102
+ text: string;
1103
+ }) | (DaemonResponseData & {
1104
+ action: 'write';
1105
+ textLength: number;
1106
+ });
1107
+
1108
+ export declare type CloseAppCommandOptions = CommandContext & {
1109
+ app?: string;
1110
+ };
1111
+
1112
+ export declare type CloseAppCommandResult = {
1113
+ kind: 'appClosed';
1114
+ app?: string;
1115
+ backendResult?: Record<string, unknown>;
1116
+ message?: string;
1117
+ };
1118
+
1119
+ declare type CommandActionResult<T extends string> = DaemonResponseData & {
1120
+ action?: T;
1121
+ };
1122
+
1123
+ export declare const commandCatalog: readonly CommandCatalogEntry[];
1124
+
1125
+ export declare type CommandCatalogEntry = {
1126
+ /**
1127
+ * CLI command names track daemon compatibility migration. Namespaced entries
1128
+ * track runtime router/API commands that are available independently.
1129
+ */
1130
+ command: string;
1131
+ category: 'portable-runtime' | 'backend-admin' | 'transport-session' | 'environment' | 'capability-gated';
1132
+ status: 'implemented' | 'planned';
1133
+ };
1134
+
1135
+ export declare type CommandClock = {
1136
+ now(): number;
1137
+ sleep(ms: number): Promise<void>;
1138
+ };
1139
+
1140
+ export declare type CommandContext = {
1141
+ session?: string;
1142
+ requestId?: string;
1143
+ signal?: AbortSignal;
1144
+ metadata?: Record<string, unknown>;
1145
+ };
1146
+
1147
+ export declare type CommandPolicy = {
1148
+ allowLocalInputPaths: boolean;
1149
+ allowLocalOutputPaths: boolean;
1150
+ maxImagePixels: number;
1151
+ allowNamedBackendCapabilities: readonly BackendCapabilityName[];
1152
+ };
1153
+
1154
+ export declare type CommandRequestResult = DaemonResponseData;
1155
+
1156
+ export declare type CommandResult = Record<string, unknown>;
1157
+
1158
+ export declare type CommandRouter<TContext = unknown> = {
1159
+ dispatch(request: CommandRouterRequest<TContext>): Promise<CommandRouterResponse>;
1160
+ };
1161
+
1162
+ export declare type CommandRouterConfig<TContext = unknown> = {
1163
+ createRuntime(request: CommandRouterRequest<TContext>): AgentDeviceRuntime | Promise<AgentDeviceRuntime>;
1164
+ beforeDispatch?(request: CommandRouterRequest<TContext>): void | Promise<void>;
1165
+ formatError?(error: unknown, request: CommandRouterRequest<TContext>): NormalizedError;
1166
+ };
1167
+
1168
+ export declare type CommandRouterRequest<TContext = unknown> = {
1169
+ command: 'capture.screenshot';
1170
+ options: ScreenshotCommandOptions;
1171
+ context?: TContext;
1172
+ } | {
1173
+ command: 'capture.diffScreenshot';
1174
+ options: DiffScreenshotCommandOptions;
1175
+ context?: TContext;
1176
+ } | {
1177
+ command: 'capture.snapshot';
1178
+ options: SnapshotCommandOptions;
1179
+ context?: TContext;
1180
+ } | {
1181
+ command: 'capture.diffSnapshot';
1182
+ options: DiffSnapshotCommandOptions;
1183
+ context?: TContext;
1184
+ } | {
1185
+ command: 'selectors.find';
1186
+ options: FindReadCommandOptions;
1187
+ context?: TContext;
1188
+ } | {
1189
+ command: 'selectors.get';
1190
+ options: GetCommandOptions;
1191
+ context?: TContext;
1192
+ } | {
1193
+ command: 'selectors.is';
1194
+ options: IsCommandOptions;
1195
+ context?: TContext;
1196
+ } | {
1197
+ command: 'selectors.wait';
1198
+ options: WaitCommandOptions_2;
1199
+ context?: TContext;
1200
+ } | {
1201
+ command: 'interactions.click';
1202
+ options: ClickCommandOptions;
1203
+ context?: TContext;
1204
+ } | {
1205
+ command: 'interactions.press';
1206
+ options: PressCommandOptions;
1207
+ context?: TContext;
1208
+ } | {
1209
+ command: 'interactions.fill';
1210
+ options: FillCommandOptions;
1211
+ context?: TContext;
1212
+ } | {
1213
+ command: 'interactions.typeText';
1214
+ options: TypeTextCommandOptions;
1215
+ context?: TContext;
1216
+ } | {
1217
+ command: 'interactions.focus';
1218
+ options: FocusCommandOptions;
1219
+ context?: TContext;
1220
+ } | {
1221
+ command: 'interactions.longPress';
1222
+ options: LongPressCommandOptions;
1223
+ context?: TContext;
1224
+ } | {
1225
+ command: 'interactions.swipe';
1226
+ options: SwipeCommandOptions;
1227
+ context?: TContext;
1228
+ } | {
1229
+ command: 'interactions.scroll';
1230
+ options: ScrollCommandOptions;
1231
+ context?: TContext;
1232
+ } | {
1233
+ command: 'interactions.pinch';
1234
+ options: PinchCommandOptions;
1235
+ context?: TContext;
1236
+ } | {
1237
+ command: 'system.back';
1238
+ options?: SystemBackCommandOptions;
1239
+ context?: TContext;
1240
+ } | {
1241
+ command: 'system.home';
1242
+ options?: SystemHomeCommandOptions;
1243
+ context?: TContext;
1244
+ } | {
1245
+ command: 'system.rotate';
1246
+ options: SystemRotateCommandOptions;
1247
+ context?: TContext;
1248
+ } | {
1249
+ command: 'system.keyboard';
1250
+ options?: SystemKeyboardCommandOptions;
1251
+ context?: TContext;
1252
+ } | {
1253
+ command: 'system.clipboard';
1254
+ options: SystemClipboardCommandOptions;
1255
+ context?: TContext;
1256
+ } | {
1257
+ command: 'system.settings';
1258
+ options?: SystemSettingsCommandOptions;
1259
+ context?: TContext;
1260
+ } | {
1261
+ command: 'system.alert';
1262
+ options?: SystemAlertCommandOptions;
1263
+ context?: TContext;
1264
+ } | {
1265
+ command: 'system.appSwitcher';
1266
+ options?: SystemAppSwitcherCommandOptions;
1267
+ context?: TContext;
1268
+ } | {
1269
+ command: 'apps.open';
1270
+ options: OpenAppCommandOptions;
1271
+ context?: TContext;
1272
+ } | {
1273
+ command: 'apps.close';
1274
+ options?: CloseAppCommandOptions;
1275
+ context?: TContext;
1276
+ } | {
1277
+ command: 'apps.list';
1278
+ options?: ListAppsCommandOptions;
1279
+ context?: TContext;
1280
+ } | {
1281
+ command: 'apps.state';
1282
+ options: GetAppStateCommandOptions;
1283
+ context?: TContext;
1284
+ } | {
1285
+ command: 'apps.push';
1286
+ options: PushAppCommandOptions;
1287
+ context?: TContext;
1288
+ } | {
1289
+ command: 'apps.triggerEvent';
1290
+ options: TriggerAppEventCommandOptions;
1291
+ context?: TContext;
1292
+ } | {
1293
+ command: 'admin.devices';
1294
+ options?: AdminDevicesCommandOptions;
1295
+ context?: TContext;
1296
+ } | {
1297
+ command: 'admin.boot';
1298
+ options?: AdminBootCommandOptions;
1299
+ context?: TContext;
1300
+ } | {
1301
+ command: 'admin.ensureSimulator';
1302
+ options: AdminEnsureSimulatorCommandOptions;
1303
+ context?: TContext;
1304
+ } | {
1305
+ command: 'admin.install';
1306
+ options: AdminInstallCommandOptions;
1307
+ context?: TContext;
1308
+ } | {
1309
+ command: 'admin.reinstall';
1310
+ options: AdminReinstallCommandOptions;
1311
+ context?: TContext;
1312
+ } | {
1313
+ command: 'admin.installFromSource';
1314
+ options: AdminInstallFromSourceCommandOptions;
1315
+ context?: TContext;
1316
+ } | {
1317
+ command: 'record';
1318
+ options: RecordingRecordCommandOptions;
1319
+ context?: TContext;
1320
+ } | {
1321
+ command: 'trace';
1322
+ options: RecordingTraceCommandOptions;
1323
+ context?: TContext;
1324
+ } | {
1325
+ command: 'diagnostics.logs';
1326
+ options?: DiagnosticsLogsCommandOptions;
1327
+ context?: TContext;
1328
+ } | {
1329
+ command: 'diagnostics.network';
1330
+ options?: DiagnosticsNetworkCommandOptions;
1331
+ context?: TContext;
1332
+ } | {
1333
+ command: 'diagnostics.perf';
1334
+ options?: DiagnosticsPerfCommandOptions;
1335
+ context?: TContext;
1336
+ } | {
1337
+ command: 'batch';
1338
+ options: BatchCommandOptions<TContext>;
1339
+ context?: TContext;
1340
+ };
1341
+
1342
+ export declare type CommandRouterResponse = {
1343
+ ok: true;
1344
+ data: CommandRouterResult;
1345
+ } | {
1346
+ ok: false;
1347
+ error: NormalizedError;
1348
+ };
1349
+
1350
+ export declare type CommandRouterResult = ScreenshotCommandResult | DiffScreenshotCommandResult | SnapshotCommandResult | DiffSnapshotCommandResult | FindReadCommandResult | GetCommandResult | IsCommandResult | WaitCommandResult_2 | PressCommandResult | FillCommandResult | TypeTextCommandResult | FocusCommandResult | LongPressCommandResult | SwipeCommandResult | ScrollCommandResult | PinchCommandResult | SystemBackCommandResult | SystemHomeCommandResult | SystemRotateCommandResult | SystemKeyboardCommandResult | SystemClipboardCommandResult | SystemSettingsCommandResult | SystemAlertCommandResult | SystemAppSwitcherCommandResult | OpenAppCommandResult | CloseAppCommandResult | ListAppsCommandResult | GetAppStateCommandResult | PushAppCommandResult | TriggerAppEventCommandResult | AdminDevicesCommandResult | AdminBootCommandResult | AdminEnsureSimulatorCommandResult | AdminInstallCommandResult | RecordingRecordCommandResult | RecordingTraceCommandResult | DiagnosticsLogsCommandResult | DiagnosticsNetworkCommandResult | DiagnosticsPerfCommandResult | BatchCommandResult;
1351
+
1352
+ export declare const commands: AgentDeviceCommands;
1353
+
1354
+ export declare type CommandSessionRecord = {
1355
+ name: string;
1356
+ appId?: string;
1357
+ appBundleId?: string;
1358
+ appName?: string;
1359
+ backendSessionId?: string;
1360
+ snapshot?: SnapshotState;
1361
+ metadata?: Record<string, unknown>;
1362
+ };
1363
+
1364
+ export declare type CommandSessionStore = {
1365
+ get(name: string): CommandSessionRecord | undefined | Promise<CommandSessionRecord | undefined>;
1366
+ set(record: CommandSessionRecord): void | Promise<void>;
1367
+ delete?(name: string): void | Promise<void>;
1368
+ list?(): readonly CommandSessionRecord[] | Promise<readonly CommandSessionRecord[]>;
1369
+ };
1370
+
1371
+ export declare function createAgentDevice(config: AgentDeviceRuntimeConfig): AgentDevice;
1372
+
1373
+ export declare function createAgentDeviceClient(config?: AgentDeviceClientConfig, deps?: {
1374
+ transport?: AgentDeviceDaemonTransport;
1375
+ }): AgentDeviceClient;
1376
+
1377
+ export declare function createCommandRouter<TContext = unknown>(config: CommandRouterConfig<TContext>): CommandRouter<TContext>;
1378
+
1379
+ export declare function createLocalArtifactAdapter(options?: LocalArtifactAdapterOptions): ArtifactAdapter;
1380
+
1381
+ export declare function createMemorySessionStore(records?: readonly CommandSessionRecord[]): CommandSessionStore;
1382
+
1383
+ export declare type CreateTempFileOptions = {
1384
+ prefix: string;
1385
+ ext: string;
1386
+ };
1387
+
1388
+ declare type DaemonArtifact = {
1389
+ field: string;
1390
+ artifactId?: string;
1391
+ fileName?: string;
1392
+ localPath?: string;
1393
+ path?: string;
1394
+ };
1395
+
1396
+ declare type DaemonError = {
1397
+ code: string;
1398
+ message: string;
1399
+ hint?: string;
1400
+ diagnosticId?: string;
1401
+ logPath?: string;
1402
+ details?: Record<string, unknown>;
1403
+ };
1404
+
1405
+ declare type DaemonInstallSource = {
1406
+ kind: 'url';
1407
+ url: string;
1408
+ headers?: Record<string, string>;
1409
+ } | {
1410
+ kind: 'path';
1411
+ path: string;
1412
+ };
1413
+
1414
+ declare type DaemonLockPolicy = 'reject' | 'strip';
1415
+
1416
+ declare type DaemonRequest = {
1417
+ token?: string;
1418
+ session?: string;
1419
+ command: string;
1420
+ positionals: string[];
1421
+ flags?: Record<string, unknown>;
1422
+ runtime?: SessionRuntimeHints;
1423
+ meta?: DaemonRequestMeta;
1424
+ };
1425
+
1426
+ declare type DaemonRequestMeta = {
1427
+ requestId?: string;
1428
+ debug?: boolean;
1429
+ cwd?: string;
1430
+ tenantId?: string;
1431
+ runId?: string;
1432
+ leaseId?: string;
1433
+ leaseTtlMs?: number;
1434
+ leaseBackend?: LeaseBackend;
1435
+ sessionIsolation?: 'none' | 'tenant';
1436
+ uploadedArtifactId?: string;
1437
+ clientArtifactPaths?: Record<string, string>;
1438
+ installSource?: DaemonInstallSource;
1439
+ retainMaterializedPaths?: boolean;
1440
+ materializedPathRetentionMs?: number;
1441
+ materializationId?: string;
1442
+ lockPolicy?: DaemonLockPolicy;
1443
+ lockPlatform?: 'ios' | 'macos' | 'android' | 'linux' | 'apple';
1444
+ };
1445
+
1446
+ declare type DaemonResponse = {
1447
+ ok: true;
1448
+ data?: DaemonResponseData;
1449
+ } | {
1450
+ ok: false;
1451
+ error: DaemonError;
1452
+ };
1453
+
1454
+ declare type DaemonResponseData = Record<string, unknown> & {
1455
+ artifacts?: DaemonArtifact[];
1456
+ };
1457
+
1458
+ declare type DaemonServerMode = 'socket' | 'http' | 'dual';
1459
+
1460
+ declare type DaemonTransportMode = 'auto' | 'socket' | 'http';
1461
+
1462
+ export declare type DeviceBootOptions = ClientCommandBaseOptions & {
1463
+ headless?: boolean;
1464
+ };
1465
+
1466
+ declare type DeviceCommandBaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions;
1467
+
1468
+ declare type DeviceKind = 'simulator' | 'emulator' | 'device';
1469
+
1470
+ declare type DeviceTarget = 'mobile' | 'tv' | 'desktop';
1471
+
1472
+ export declare type DiagnosticsLogsCommandOptions = DiagnosticsPageOptions & {
1473
+ levels?: readonly string[];
1474
+ search?: string;
1475
+ source?: string;
1476
+ };
1477
+
1478
+ export declare type DiagnosticsLogsCommandResult = {
1479
+ kind: 'diagnosticsLogs';
1480
+ entries: readonly BackendLogEntry[];
1481
+ nextCursor?: string;
1482
+ timeWindow?: BackendDiagnosticsTimeWindow;
1483
+ backend?: string;
1484
+ redacted: boolean;
1485
+ notes?: readonly string[];
1486
+ };
1487
+
1488
+ export declare type DiagnosticsNetworkCommandOptions = DiagnosticsPageOptions & {
1489
+ include?: BackendNetworkIncludeMode;
1490
+ };
1491
+
1492
+ export declare type DiagnosticsNetworkCommandResult = {
1493
+ kind: 'diagnosticsNetwork';
1494
+ entries: readonly BackendNetworkEntry[];
1495
+ nextCursor?: string;
1496
+ timeWindow?: BackendDiagnosticsTimeWindow;
1497
+ backend?: string;
1498
+ redacted: boolean;
1499
+ notes?: readonly string[];
1500
+ };
1501
+
1502
+ declare type DiagnosticsPageOptions = CommandContext & {
1503
+ appId?: string;
1504
+ appBundleId?: string;
1505
+ since?: string;
1506
+ until?: string;
1507
+ cursor?: string;
1508
+ limit?: number;
1509
+ };
1510
+
1511
+ export declare type DiagnosticsPerfCommandOptions = CommandContext & {
1512
+ appId?: string;
1513
+ appBundleId?: string;
1514
+ since?: string;
1515
+ until?: string;
1516
+ sampleMs?: number;
1517
+ metrics?: readonly string[];
1518
+ };
1519
+
1520
+ export declare type DiagnosticsPerfCommandResult = {
1521
+ kind: 'diagnosticsPerf';
1522
+ metrics: readonly BackendPerfMetric[];
1523
+ startedAt?: string;
1524
+ endedAt?: string;
1525
+ backend?: string;
1526
+ redacted: boolean;
1527
+ notes?: readonly string[];
1528
+ };
1529
+
1530
+ export declare type DiagnosticsSink = {
1531
+ emit(event: {
1532
+ level: 'debug' | 'info' | 'warn' | 'error';
1533
+ message: string;
1534
+ data?: unknown;
1535
+ }): void;
1536
+ };
1537
+
1538
+ declare type DiffScreenshotCommandOptions = CommandContext & {
1539
+ baseline: FileInputRef;
1540
+ current?: FileInputRef | LiveScreenshotInputRef;
1541
+ out?: FileOutputRef;
1542
+ currentOverlayOut?: FileOutputRef;
1543
+ threshold?: number;
1544
+ overlayRefs?: boolean;
1545
+ surface?: BackendScreenshotOptions['surface'];
1546
+ };
1547
+
1548
+ declare type DiffScreenshotCommandResult = ScreenshotDiffResult & {
1549
+ artifacts?: ArtifactDescriptor[];
1550
+ };
1551
+
1552
+ declare type DiffSnapshotCommandOptions = SnapshotCommandOptions;
1553
+
1554
+ declare type DiffSnapshotCommandResult = {
1555
+ mode: 'snapshot';
1556
+ baselineInitialized: boolean;
1557
+ summary: SnapshotDiffSummary;
1558
+ lines: SnapshotDiffLine[];
1559
+ warnings?: string[];
1560
+ };
1561
+
1562
+ export declare type ElementTarget = RefTarget_2 | SelectorTarget_2;
1563
+
1564
+ declare type ElementTarget_2 = SelectorTarget | RefTarget;
1565
+
1566
+ export declare type EnsureSimulatorOptions = AgentDeviceRequestOverrides & {
1567
+ device: string;
1568
+ runtime?: string;
1569
+ boot?: boolean;
1570
+ reuseExisting?: boolean;
1571
+ iosSimulatorDeviceSet?: string;
1572
+ };
1573
+
1574
+ export declare type EnsureSimulatorResult = {
1575
+ udid: string;
1576
+ device: string;
1577
+ runtime: string;
1578
+ created: boolean;
1579
+ booted: boolean;
1580
+ iosSimulatorDeviceSet?: string | null;
1581
+ identifiers: AgentDeviceIdentifiers;
1582
+ };
1583
+
1584
+ export declare type FileInputRef = {
1585
+ kind: 'path';
1586
+ path: string;
1587
+ } | {
1588
+ kind: 'uploadedArtifact';
1589
+ id: string;
1590
+ };
1591
+
1592
+ export declare type FileOutputRef = {
1593
+ kind: 'path';
1594
+ path: string;
1595
+ } | {
1596
+ kind: 'downloadableArtifact';
1597
+ clientPath?: string;
1598
+ fileName?: string;
1599
+ };
1600
+
1601
+ declare type FillCommandOptions = CommandContext & {
1602
+ target: InteractionTarget_2;
1603
+ text: string;
1604
+ delayMs?: number;
1605
+ };
1606
+
1607
+ declare type FillCommandResult = ResolvedInteractionTarget & {
1608
+ text: string;
1609
+ warning?: string;
1610
+ backendResult?: Record<string, unknown>;
1611
+ };
1612
+
1613
+ export declare type FillOptions = ClientCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & {
1614
+ text: string;
1615
+ delayMs?: number;
1616
+ };
1617
+
1618
+ declare type FindAction = {
1619
+ kind: 'click';
1620
+ } | {
1621
+ kind: 'focus';
1622
+ } | {
1623
+ kind: 'fill';
1624
+ value: string;
1625
+ } | {
1626
+ kind: 'type';
1627
+ value: string;
1628
+ } | {
1629
+ kind: 'get_text';
1630
+ } | {
1631
+ kind: 'get_attrs';
1632
+ } | {
1633
+ kind: 'exists';
1634
+ } | {
1635
+ kind: 'wait';
1636
+ timeoutMs?: number;
1637
+ };
1638
+
1639
+ declare type FindBaseOptions = ClientCommandBaseOptions & FindSnapshotCommandOptions & {
1640
+ locator?: FindLocator;
1641
+ query: string;
1642
+ first?: boolean;
1643
+ last?: boolean;
1644
+ };
1645
+
1646
+ export declare type FindLocator = 'any' | 'text' | 'label' | 'value' | 'role' | 'id';
1647
+
1648
+ declare type FindLocator_2 = 'any' | 'text' | 'label' | 'value' | 'role' | 'id';
1649
+
1650
+ export declare type FindOptions = (FindBaseOptions & {
1651
+ action?: 'click' | 'focus' | 'exists' | 'getText' | 'getAttrs';
1652
+ }) | (FindBaseOptions & {
1653
+ action: 'wait';
1654
+ timeoutMs?: number;
1655
+ }) | (FindBaseOptions & {
1656
+ action: 'fill' | 'type';
1657
+ value: string;
1658
+ });
1659
+
1660
+ declare type FindReadCommandOptions = CommandContext & {
1661
+ locator?: FindLocator_2;
1662
+ query: string;
1663
+ action: Extract<FindAction['kind'], 'exists' | 'wait' | 'get_text' | 'get_attrs'>;
1664
+ timeoutMs?: number;
1665
+ } & SelectorSnapshotOptions;
1666
+
1667
+ declare type FindReadCommandResult = {
1668
+ kind: 'found';
1669
+ found: true;
1670
+ waitedMs?: number;
1671
+ } | {
1672
+ kind: 'text';
1673
+ ref: string;
1674
+ text: string;
1675
+ node: SnapshotNode;
1676
+ } | {
1677
+ kind: 'attrs';
1678
+ ref: string;
1679
+ node: SnapshotNode;
1680
+ };
1681
+
1682
+ declare type FindSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'raw'>;
1683
+
1684
+ declare type FocusCommandOptions = CommandContext & {
1685
+ target: InteractionTarget_2;
1686
+ };
1687
+
1688
+ declare type FocusCommandResult = ResolvedInteractionTarget & {
1689
+ backendResult?: Record<string, unknown>;
1690
+ message?: string;
1691
+ };
1692
+
1693
+ declare type FocusOptions_2 = ClientCommandBaseOptions & {
1694
+ x: number;
1695
+ y: number;
1696
+ };
1697
+ export { FocusOptions_2 as FocusOptions }
1698
+
1699
+ declare type GestureDirection = 'up' | 'down' | 'left' | 'right';
1700
+
1701
+ export declare type GetAppStateCommandOptions = CommandContext & {
1702
+ app: string;
1703
+ };
1704
+
1705
+ export declare type GetAppStateCommandResult = {
1706
+ kind: 'appState';
1707
+ app: string;
1708
+ state: BackendAppState;
1709
+ };
1710
+
1711
+ declare type GetAttrsCommandOptions = CommandContext & SelectorSnapshotOptions & {
1712
+ target: ElementTarget_2;
1713
+ };
1714
+
1715
+ declare type GetCommandOptions = CommandContext & SelectorSnapshotOptions & {
1716
+ property: 'text' | 'attrs';
1717
+ target: ElementTarget_2;
1718
+ };
1719
+
1720
+ declare type GetCommandResult = {
1721
+ kind: 'text';
1722
+ target: ResolvedTarget;
1723
+ text: string;
1724
+ node: SnapshotNode;
1725
+ selectorChain?: string[];
1726
+ } | {
1727
+ kind: 'attrs';
1728
+ target: ResolvedTarget;
1729
+ node: SnapshotNode;
1730
+ selectorChain?: string[];
1731
+ };
1732
+
1733
+ export declare type GetOptions = ClientCommandBaseOptions & SelectorSnapshotCommandOptions & ElementTarget & {
1734
+ format: 'text' | 'attrs';
1735
+ };
1736
+
1737
+ declare type GetTextCommandOptions = CommandContext & SelectorSnapshotOptions & {
1738
+ target: ElementTarget_2;
1739
+ };
1740
+
1741
+ export declare type HomeCommandOptions = DeviceCommandBaseOptions;
526
1742
 
527
1743
  export declare type HomeCommandResult = CommandActionResult<'home'>;
528
1744
 
529
- export declare type InteractionTarget = PointTarget | RefTarget | SelectorTarget;
1745
+ export declare type InteractionTarget = PointTarget_2 | RefTarget_2 | SelectorTarget_2;
1746
+
1747
+ declare type InteractionTarget_2 = ElementTarget_2 | PointTarget;
1748
+
1749
+ export declare function isAgentDeviceError(err: unknown): err is AppError;
1750
+
1751
+ declare type IsCommandOptions = CommandContext & SelectorSnapshotOptions & {
1752
+ predicate: 'visible' | 'hidden' | 'exists' | 'editable' | 'selected' | 'text';
1753
+ selector: string;
1754
+ expectedText?: string;
1755
+ };
1756
+
1757
+ declare type IsCommandResult = {
1758
+ predicate: IsCommandOptions['predicate'];
1759
+ pass: true;
1760
+ selector: string;
1761
+ matches?: number;
1762
+ text?: string;
1763
+ selectorChain?: string[];
1764
+ };
530
1765
 
531
1766
  export declare type IsOptions = IsTextPredicateOptions | IsStatePredicateOptions;
532
1767
 
1768
+ declare type IsSelectorCommandOptions = CommandContext & SelectorSnapshotOptions & {
1769
+ target: SelectorTarget;
1770
+ };
1771
+
533
1772
  declare type IsStatePredicateOptions = ClientCommandBaseOptions & SelectorSnapshotCommandOptions & {
534
1773
  predicate: 'visible' | 'hidden' | 'exists' | 'editable' | 'selected';
535
1774
  selector: string;
@@ -585,12 +1824,44 @@ declare type LeaseScopedOptions = LeaseOptions & {
585
1824
  leaseId: string;
586
1825
  };
587
1826
 
1827
+ export declare type ListAppsCommandOptions = CommandContext & {
1828
+ filter?: BackendAppListFilter;
1829
+ };
1830
+
1831
+ export declare type ListAppsCommandResult = {
1832
+ kind: 'appsList';
1833
+ apps: readonly BackendAppInfo[];
1834
+ };
1835
+
1836
+ declare type LiveScreenshotInputRef = {
1837
+ kind: 'live';
1838
+ };
1839
+
1840
+ export declare type LocalArtifactAdapterOptions = {
1841
+ cwd?: string;
1842
+ tempDir?: string;
1843
+ rootDir?: string;
1844
+ };
1845
+
1846
+ export declare function localCommandPolicy(overrides?: Partial<CommandPolicy>): CommandPolicy;
1847
+
588
1848
  export declare type LogsOptions = AgentDeviceRequestOverrides & {
589
1849
  action?: 'path' | 'start' | 'stop' | 'doctor' | 'mark' | 'clear';
590
1850
  message?: string;
591
1851
  restart?: boolean;
592
1852
  };
593
1853
 
1854
+ declare type LongPressCommandOptions = CommandContext & {
1855
+ target: InteractionTarget_2;
1856
+ durationMs?: number;
1857
+ };
1858
+
1859
+ declare type LongPressCommandResult = ResolvedInteractionTarget & {
1860
+ durationMs?: number;
1861
+ backendResult?: Record<string, unknown>;
1862
+ message?: string;
1863
+ };
1864
+
594
1865
  export declare type LongPressOptions = ClientCommandBaseOptions & {
595
1866
  x: number;
596
1867
  y: number;
@@ -666,10 +1937,52 @@ export declare type NetworkOptions = AgentDeviceRequestOverrides & {
666
1937
  include?: 'summary' | 'headers' | 'body' | 'all';
667
1938
  };
668
1939
 
1940
+ export declare function normalizeAgentDeviceError(err: unknown, context?: {
1941
+ diagnosticId?: string;
1942
+ logPath?: string;
1943
+ }): NormalizedError;
1944
+
1945
+ export declare type NormalizedError = {
1946
+ code: string;
1947
+ message: string;
1948
+ hint?: string;
1949
+ diagnosticId?: string;
1950
+ logPath?: string;
1951
+ details?: Record<string, unknown>;
1952
+ };
1953
+
1954
+ export declare type OpenAppCommandOptions = CommandContext & BackendOpenTarget & {
1955
+ relaunch?: boolean;
1956
+ };
1957
+
1958
+ export declare type OpenAppCommandResult = {
1959
+ kind: 'appOpened';
1960
+ target: BackendOpenTarget;
1961
+ relaunch: boolean;
1962
+ backendResult?: Record<string, unknown>;
1963
+ message?: string;
1964
+ };
1965
+
1966
+ export declare type OutputVisibility = 'client-visible' | 'internal';
1967
+
669
1968
  export declare type PerfOptions = ClientCommandBaseOptions;
670
1969
 
671
1970
  export declare type PermissionTarget = 'camera' | 'microphone' | 'photos' | 'contacts' | 'contacts-limited' | 'notifications' | 'calendar' | 'location' | 'location-always' | 'media-library' | 'motion' | 'reminders' | 'siri' | 'accessibility' | 'screen-recording' | 'input-monitoring';
672
1971
 
1972
+ declare type PinchCommandOptions = CommandContext & {
1973
+ scale: number;
1974
+ center?: InteractionTarget_2;
1975
+ };
1976
+
1977
+ declare type PinchCommandResult = {
1978
+ kind: 'pinch';
1979
+ scale: number;
1980
+ center?: Point;
1981
+ centerTarget?: ResolvedInteractionTarget;
1982
+ backendResult?: Record<string, unknown>;
1983
+ message?: string;
1984
+ };
1985
+
673
1986
  export declare type PinchOptions = ClientCommandBaseOptions & {
674
1987
  scale: number;
675
1988
  x?: number;
@@ -686,6 +1999,12 @@ export declare type Point = {
686
1999
  };
687
2000
 
688
2001
  declare type PointTarget = {
2002
+ kind: 'point';
2003
+ x: number;
2004
+ y: number;
2005
+ };
2006
+
2007
+ declare type PointTarget_2 = {
689
2008
  x: number;
690
2009
  y: number;
691
2010
  ref?: never;
@@ -709,8 +2028,35 @@ declare type PrepareMetroRuntimeResult = {
709
2028
  bridge: MetroBridgeResult | null;
710
2029
  };
711
2030
 
2031
+ declare type PressCommandOptions = CommandContext & {
2032
+ target: InteractionTarget_2;
2033
+ button?: 'primary' | 'secondary' | 'middle';
2034
+ count?: number;
2035
+ intervalMs?: number;
2036
+ holdMs?: number;
2037
+ jitterPx?: number;
2038
+ doubleTap?: boolean;
2039
+ };
2040
+
2041
+ declare type PressCommandResult = ResolvedInteractionTarget & {
2042
+ backendResult?: Record<string, unknown>;
2043
+ };
2044
+
712
2045
  export declare type PressOptions = ClientCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions;
713
2046
 
2047
+ export declare type PushAppCommandOptions = CommandContext & {
2048
+ app: string;
2049
+ input: AppPushInput;
2050
+ };
2051
+
2052
+ export declare type PushAppCommandResult = {
2053
+ kind: 'appPushed';
2054
+ app: string;
2055
+ inputKind: 'json' | 'file';
2056
+ backendResult?: Record<string, unknown>;
2057
+ message?: string;
2058
+ };
2059
+
714
2060
  declare type RawSnapshotNode = {
715
2061
  index: number;
716
2062
  type?: string;
@@ -734,10 +2080,46 @@ declare type RawSnapshotNode = {
734
2080
  hiddenContentBelow?: boolean;
735
2081
  };
736
2082
 
2083
+ declare type RecordingQuality = 5 | 6 | 7 | 8 | 9 | 10;
2084
+
2085
+ export declare type RecordingRecordCommandOptions = CommandContext & {
2086
+ action: 'start' | 'stop';
2087
+ out?: FileOutputRef;
2088
+ fps?: number;
2089
+ quality?: number;
2090
+ hideTouches?: boolean;
2091
+ };
2092
+
2093
+ export declare type RecordingRecordCommandResult = {
2094
+ kind: 'recordingStarted' | 'recordingStopped';
2095
+ action: 'start' | 'stop';
2096
+ path?: string;
2097
+ telemetryPath?: string;
2098
+ artifact?: ArtifactDescriptor;
2099
+ backendResult?: Record<string, unknown>;
2100
+ warning?: string;
2101
+ message?: string;
2102
+ };
2103
+
2104
+ export declare type RecordingTraceCommandOptions = CommandContext & {
2105
+ action: 'start' | 'stop';
2106
+ out?: FileOutputRef;
2107
+ };
2108
+
2109
+ export declare type RecordingTraceCommandResult = {
2110
+ kind: 'traceStarted' | 'traceStopped';
2111
+ action: 'start' | 'stop';
2112
+ outPath?: string;
2113
+ artifact?: ArtifactDescriptor;
2114
+ backendResult?: Record<string, unknown>;
2115
+ message?: string;
2116
+ };
2117
+
737
2118
  export declare type RecordOptions = AgentDeviceRequestOverrides & {
738
2119
  action: 'start' | 'stop';
739
2120
  path?: string;
740
2121
  fps?: number;
2122
+ quality?: RecordingQuality;
741
2123
  hideTouches?: boolean;
742
2124
  };
743
2125
 
@@ -748,7 +2130,17 @@ export declare type Rect = {
748
2130
  height: number;
749
2131
  };
750
2132
 
2133
+ export declare function ref(refInput: string, options?: {
2134
+ fallbackLabel?: string;
2135
+ }): RefTarget;
2136
+
751
2137
  declare type RefTarget = {
2138
+ kind: 'ref';
2139
+ ref: string;
2140
+ fallbackLabel?: string;
2141
+ };
2142
+
2143
+ declare type RefTarget_2 = {
752
2144
  ref: string;
753
2145
  label?: string;
754
2146
  x?: never;
@@ -779,8 +2171,65 @@ export declare type ReplayTestOptions = AgentDeviceRequestOverrides & AgentDevic
779
2171
  reportJunit?: string;
780
2172
  };
781
2173
 
2174
+ export declare type ReservedOutputFile = {
2175
+ path: string;
2176
+ visibility: OutputVisibility;
2177
+ publish: () => Promise<ArtifactDescriptor | undefined>;
2178
+ cleanup?: () => Promise<void>;
2179
+ };
2180
+
2181
+ export declare type ReserveOutputOptions = {
2182
+ field: string;
2183
+ ext: string;
2184
+ requestedClientPath?: string;
2185
+ visibility?: OutputVisibility;
2186
+ };
2187
+
2188
+ export declare type ResolvedInputFile = {
2189
+ path: string;
2190
+ cleanup?: () => Promise<void>;
2191
+ };
2192
+
2193
+ declare type ResolvedInteractionTarget = {
2194
+ kind: 'point';
2195
+ point: Point;
2196
+ } | {
2197
+ kind: 'ref';
2198
+ point: Point;
2199
+ target: Extract<ResolvedTarget, {
2200
+ kind: 'ref';
2201
+ }>;
2202
+ node: SnapshotNode;
2203
+ selectorChain: string[];
2204
+ refLabel?: string;
2205
+ } | {
2206
+ kind: 'selector';
2207
+ point: Point;
2208
+ target: Extract<ResolvedTarget, {
2209
+ kind: 'selector';
2210
+ }>;
2211
+ node: SnapshotNode;
2212
+ selectorChain: string[];
2213
+ refLabel?: string;
2214
+ };
2215
+
782
2216
  declare type ResolvedMetroKind = Exclude<MetroPrepareKind, 'auto'>;
783
2217
 
2218
+ declare type ResolvedTarget = {
2219
+ kind: 'selector';
2220
+ selector: string;
2221
+ } | {
2222
+ kind: 'ref';
2223
+ ref: string;
2224
+ };
2225
+
2226
+ export declare type ResolveInputOptions = {
2227
+ usage: string;
2228
+ field?: string;
2229
+ };
2230
+
2231
+ export declare function restrictedCommandPolicy(overrides?: Partial<CommandPolicy>): CommandPolicy;
2232
+
784
2233
  export declare type RotateCommandOptions = DeviceCommandBaseOptions & {
785
2234
  orientation: 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right';
786
2235
  };
@@ -789,6 +2238,131 @@ export declare type RotateCommandResult = CommandActionResult<'rotate'> & {
789
2238
  orientation?: RotateCommandOptions['orientation'];
790
2239
  };
791
2240
 
2241
+ export declare type RuntimeCommand<TOptions = Record<string, unknown>, TResult = CommandResult> = (runtime: AgentDeviceRuntime, options: TOptions) => Promise<TResult>;
2242
+
2243
+ declare type ScreenshotCommandOptions = CommandContext & {
2244
+ out?: FileOutputRef;
2245
+ fullscreen?: boolean;
2246
+ overlayRefs?: boolean;
2247
+ appId?: string;
2248
+ appBundleId?: string;
2249
+ surface?: 'app' | 'frontmost-app' | 'desktop' | 'menubar';
2250
+ };
2251
+
2252
+ declare type ScreenshotCommandResult = {
2253
+ path: string;
2254
+ artifacts?: ArtifactDescriptor[];
2255
+ message?: string;
2256
+ };
2257
+
2258
+ declare type ScreenshotDiffRegion = {
2259
+ index: number;
2260
+ rect: {
2261
+ x: number;
2262
+ y: number;
2263
+ width: number;
2264
+ height: number;
2265
+ };
2266
+ normalizedRect: {
2267
+ x: number;
2268
+ y: number;
2269
+ width: number;
2270
+ height: number;
2271
+ };
2272
+ differentPixels: number;
2273
+ shareOfDiffPercentage: number;
2274
+ densityPercentage: number;
2275
+ shape: 'compact' | 'horizontal-band' | 'vertical-band' | 'large-area';
2276
+ size: 'small' | 'medium' | 'large';
2277
+ location: string;
2278
+ averageBaselineColorHex: string;
2279
+ averageCurrentColorHex: string;
2280
+ baselineLuminance: number;
2281
+ currentLuminance: number;
2282
+ dominantChange: 'brighter' | 'darker' | 'color-shift' | 'mixed';
2283
+ currentOverlayMatches?: ScreenshotDiffRegionOverlayMatch[];
2284
+ };
2285
+
2286
+ declare type ScreenshotDiffRegionOverlayMatch = {
2287
+ ref: string;
2288
+ label?: string;
2289
+ regionCoveragePercentage: number;
2290
+ rect: {
2291
+ x: number;
2292
+ y: number;
2293
+ width: number;
2294
+ height: number;
2295
+ };
2296
+ };
2297
+
2298
+ declare type ScreenshotDiffResult = {
2299
+ diffPath?: string;
2300
+ totalPixels: number;
2301
+ differentPixels: number;
2302
+ mismatchPercentage: number;
2303
+ match: boolean;
2304
+ dimensionMismatch?: ScreenshotDimensionMismatch;
2305
+ regions?: ScreenshotDiffRegion[];
2306
+ currentOverlayPath?: string;
2307
+ currentOverlayRefCount?: number;
2308
+ ocr?: ScreenshotOcrSummary;
2309
+ nonTextDeltas?: ScreenshotNonTextDelta[];
2310
+ };
2311
+
2312
+ declare type ScreenshotDimensionMismatch = {
2313
+ expected: {
2314
+ width: number;
2315
+ height: number;
2316
+ };
2317
+ actual: {
2318
+ width: number;
2319
+ height: number;
2320
+ };
2321
+ };
2322
+
2323
+ declare type ScreenshotNonTextDelta = {
2324
+ index: number;
2325
+ regionIndex?: number;
2326
+ slot: 'leading' | 'trailing' | 'background' | 'separator' | 'unknown';
2327
+ likelyKind: 'icon' | 'toggle' | 'chevron' | 'separator' | 'visual';
2328
+ rect: Rect;
2329
+ nearestText?: string;
2330
+ };
2331
+
2332
+ declare type ScreenshotOcrMovementCluster = {
2333
+ texts: string[];
2334
+ xRange: {
2335
+ min: number;
2336
+ max: number;
2337
+ };
2338
+ yRange: {
2339
+ min: number;
2340
+ max: number;
2341
+ };
2342
+ };
2343
+
2344
+ declare type ScreenshotOcrSummary = {
2345
+ provider: 'tesseract';
2346
+ baselineBlocks: number;
2347
+ currentBlocks: number;
2348
+ matches: ScreenshotOcrTextMatch[];
2349
+ movementClusters?: ScreenshotOcrMovementCluster[];
2350
+ };
2351
+
2352
+ declare type ScreenshotOcrTextMatch = {
2353
+ text: string;
2354
+ baselineRect: Rect;
2355
+ currentRect: Rect;
2356
+ delta: {
2357
+ x: number;
2358
+ y: number;
2359
+ width: number;
2360
+ height: number;
2361
+ };
2362
+ confidence: number;
2363
+ possibleTextMetricMismatch: boolean;
2364
+ };
2365
+
792
2366
  export declare type ScreenshotOverlayRef = {
793
2367
  ref: string;
794
2368
  label?: string;
@@ -797,6 +2371,28 @@ export declare type ScreenshotOverlayRef = {
797
2371
  center: Point;
798
2372
  };
799
2373
 
2374
+ declare type ScrollCommandOptions = CommandContext & {
2375
+ target?: ScrollTarget;
2376
+ direction: GestureDirection;
2377
+ amount?: number;
2378
+ pixels?: number;
2379
+ };
2380
+
2381
+ declare type ScrollCommandResult = {
2382
+ kind: 'viewport';
2383
+ direction: GestureDirection;
2384
+ amount?: number;
2385
+ pixels?: number;
2386
+ backendResult?: Record<string, unknown>;
2387
+ message?: string;
2388
+ } | (ResolvedInteractionTarget & {
2389
+ direction: GestureDirection;
2390
+ amount?: number;
2391
+ pixels?: number;
2392
+ backendResult?: Record<string, unknown>;
2393
+ message?: string;
2394
+ });
2395
+
800
2396
  declare type ScrollOptions_2 = ClientCommandBaseOptions & {
801
2397
  direction: 'up' | 'down' | 'left' | 'right';
802
2398
  amount?: number;
@@ -804,9 +2400,26 @@ declare type ScrollOptions_2 = ClientCommandBaseOptions & {
804
2400
  };
805
2401
  export { ScrollOptions_2 as ScrollOptions }
806
2402
 
2403
+ declare type ScrollTarget = InteractionTarget_2 | {
2404
+ kind: 'viewport';
2405
+ };
2406
+
2407
+ export declare function selector(expression: string): SelectorTarget;
2408
+
807
2409
  declare type SelectorSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'scope' | 'raw'>;
808
2410
 
2411
+ export declare type SelectorSnapshotOptions = {
2412
+ depth?: number;
2413
+ scope?: string;
2414
+ raw?: boolean;
2415
+ };
2416
+
809
2417
  declare type SelectorTarget = {
2418
+ kind: 'selector';
2419
+ selector: string;
2420
+ };
2421
+
2422
+ declare type SelectorTarget_2 = {
810
2423
  selector: string;
811
2424
  x?: never;
812
2425
  y?: never;
@@ -849,10 +2462,56 @@ export declare type SettingsUpdateOptions = (ClientCommandBaseOptions & {
849
2462
  mode?: 'full' | 'limited';
850
2463
  });
851
2464
 
2465
+ declare type SnapshotBackend = 'xctest' | 'android' | 'macos-helper' | 'linux-atspi';
2466
+
2467
+ declare type SnapshotCommandOptions = CommandContext & {
2468
+ interactiveOnly?: boolean;
2469
+ compact?: boolean;
2470
+ depth?: number;
2471
+ scope?: string;
2472
+ raw?: boolean;
2473
+ };
2474
+
2475
+ declare type SnapshotCommandResult = {
2476
+ nodes: SnapshotNode[];
2477
+ truncated: boolean;
2478
+ appName?: string;
2479
+ appBundleId?: string;
2480
+ visibility?: SnapshotVisibility;
2481
+ warnings?: string[];
2482
+ };
2483
+
2484
+ declare type SnapshotDiffLine = {
2485
+ kind: 'added' | 'removed' | 'unchanged';
2486
+ text: string;
2487
+ };
2488
+
2489
+ declare type SnapshotDiffSummary = {
2490
+ additions: number;
2491
+ removals: number;
2492
+ unchanged: number;
2493
+ };
2494
+
852
2495
  export declare type SnapshotNode = RawSnapshotNode & {
853
2496
  ref: string;
854
2497
  };
855
2498
 
2499
+ declare type SnapshotOptions = {
2500
+ interactiveOnly?: boolean;
2501
+ compact?: boolean;
2502
+ depth?: number;
2503
+ scope?: string;
2504
+ raw?: boolean;
2505
+ };
2506
+
2507
+ declare type SnapshotState = {
2508
+ nodes: SnapshotNode[];
2509
+ createdAt: number;
2510
+ truncated?: boolean;
2511
+ backend?: SnapshotBackend;
2512
+ comparisonSafe?: boolean;
2513
+ };
2514
+
856
2515
  export declare type SnapshotVisibility = {
857
2516
  partial: boolean;
858
2517
  visibleNodeCount: number;
@@ -870,6 +2529,22 @@ export declare type StartupPerfSample = {
870
2529
  appBundleId?: string;
871
2530
  };
872
2531
 
2532
+ declare type SwipeCommandOptions = CommandContext & SwipeOptions_2;
2533
+
2534
+ declare type SwipeCommandResult = {
2535
+ kind: 'swipe';
2536
+ from: Point;
2537
+ to: Point;
2538
+ direction?: GestureDirection;
2539
+ distance?: number;
2540
+ durationMs?: number;
2541
+ fromTarget?: ResolvedInteractionTarget | {
2542
+ kind: 'viewport';
2543
+ };
2544
+ backendResult?: Record<string, unknown>;
2545
+ message?: string;
2546
+ };
2547
+
873
2548
  export declare type SwipeOptions = ClientCommandBaseOptions & {
874
2549
  from: {
875
2550
  x: number;
@@ -885,11 +2560,161 @@ export declare type SwipeOptions = ClientCommandBaseOptions & {
885
2560
  pattern?: 'one-way' | 'ping-pong';
886
2561
  };
887
2562
 
2563
+ declare type SwipeOptions_2 = {
2564
+ from?: Point | InteractionTarget_2;
2565
+ to?: Point;
2566
+ direction?: GestureDirection;
2567
+ distance?: number;
2568
+ durationMs?: number;
2569
+ };
2570
+
2571
+ declare type SystemAlertCommandOptions = CommandContext & {
2572
+ action?: BackendAlertAction;
2573
+ timeoutMs?: number;
2574
+ };
2575
+
2576
+ declare type SystemAlertCommandResult = {
2577
+ kind: 'alertStatus';
2578
+ action: 'get';
2579
+ alert: BackendAlertInfo | null;
2580
+ } | {
2581
+ kind: 'alertHandled';
2582
+ action: 'accept' | 'dismiss';
2583
+ handled: boolean;
2584
+ alert?: BackendAlertInfo;
2585
+ button?: string;
2586
+ message?: string;
2587
+ } | {
2588
+ kind: 'alertWait';
2589
+ action: 'wait';
2590
+ alert: BackendAlertInfo | null;
2591
+ waitedMs?: number;
2592
+ timedOut?: boolean;
2593
+ message?: string;
2594
+ };
2595
+
2596
+ declare type SystemAppSwitcherCommandOptions = CommandContext;
2597
+
2598
+ declare type SystemAppSwitcherCommandResult = {
2599
+ kind: 'appSwitcherOpened';
2600
+ backendResult?: Record<string, unknown>;
2601
+ message?: string;
2602
+ };
2603
+
2604
+ declare type SystemBackCommandOptions = CommandContext & {
2605
+ mode?: 'in-app' | 'system';
2606
+ };
2607
+
2608
+ declare type SystemBackCommandResult = {
2609
+ kind: 'systemBack';
2610
+ mode: 'in-app' | 'system';
2611
+ backendResult?: Record<string, unknown>;
2612
+ message?: string;
2613
+ };
2614
+
2615
+ declare type SystemClipboardCommandOptions = (CommandContext & {
2616
+ action: 'read';
2617
+ }) | (CommandContext & {
2618
+ action: 'write';
2619
+ text: string;
2620
+ });
2621
+
2622
+ declare type SystemClipboardCommandResult = {
2623
+ kind: 'clipboardText';
2624
+ action: 'read';
2625
+ text: string;
2626
+ } | {
2627
+ kind: 'clipboardUpdated';
2628
+ action: 'write';
2629
+ textLength: number;
2630
+ backendResult?: Record<string, unknown>;
2631
+ message?: string;
2632
+ };
2633
+
2634
+ declare type SystemHomeCommandOptions = CommandContext;
2635
+
2636
+ declare type SystemHomeCommandResult = {
2637
+ kind: 'systemHome';
2638
+ backendResult?: Record<string, unknown>;
2639
+ message?: string;
2640
+ };
2641
+
2642
+ declare type SystemKeyboardCommandOptions = CommandContext & {
2643
+ action?: 'status' | 'get' | 'dismiss';
2644
+ };
2645
+
2646
+ declare type SystemKeyboardCommandResult = {
2647
+ kind: 'keyboardState';
2648
+ action: 'status' | 'get';
2649
+ state: BackendKeyboardResult;
2650
+ backendResult?: Record<string, unknown>;
2651
+ } | {
2652
+ kind: 'keyboardDismissed';
2653
+ action: 'dismiss';
2654
+ state: BackendKeyboardResult;
2655
+ backendResult?: Record<string, unknown>;
2656
+ message?: string;
2657
+ };
2658
+
2659
+ declare type SystemRotateCommandOptions = CommandContext & {
2660
+ orientation: BackendDeviceOrientation;
2661
+ };
2662
+
2663
+ declare type SystemRotateCommandResult = {
2664
+ kind: 'systemRotated';
2665
+ orientation: BackendDeviceOrientation;
2666
+ backendResult?: Record<string, unknown>;
2667
+ message?: string;
2668
+ };
2669
+
2670
+ declare type SystemSettingsCommandOptions = CommandContext & {
2671
+ target?: string;
2672
+ };
2673
+
2674
+ declare type SystemSettingsCommandResult = {
2675
+ kind: 'settingsOpened';
2676
+ target?: string;
2677
+ backendResult?: Record<string, unknown>;
2678
+ message?: string;
2679
+ };
2680
+
2681
+ export declare type TemporaryFile = {
2682
+ path: string;
2683
+ visibility: 'internal';
2684
+ cleanup: () => Promise<void>;
2685
+ };
2686
+
888
2687
  export declare type TraceOptions = AgentDeviceRequestOverrides & {
889
2688
  action: 'start' | 'stop';
890
2689
  path?: string;
891
2690
  };
892
2691
 
2692
+ export declare type TriggerAppEventCommandOptions = CommandContext & {
2693
+ name: string;
2694
+ payload?: Record<string, unknown>;
2695
+ };
2696
+
2697
+ export declare type TriggerAppEventCommandResult = {
2698
+ kind: 'appEventTriggered';
2699
+ name: string;
2700
+ payload?: Record<string, unknown>;
2701
+ backendResult?: Record<string, unknown>;
2702
+ message?: string;
2703
+ };
2704
+
2705
+ export declare type TypeTextCommandOptions = CommandContext & {
2706
+ text: string;
2707
+ delayMs?: number;
2708
+ };
2709
+
2710
+ export declare type TypeTextCommandResult = {
2711
+ kind: 'text';
2712
+ text: string;
2713
+ delayMs: number;
2714
+ backendResult?: Record<string, unknown>;
2715
+ message?: string;
2716
+ };
2717
+
893
2718
  export declare type TypeTextOptions = ClientCommandBaseOptions & {
894
2719
  text: string;
895
2720
  delayMs?: number;
@@ -897,12 +2722,44 @@ export declare type TypeTextOptions = ClientCommandBaseOptions & {
897
2722
 
898
2723
  export declare type WaitCommandOptions = DeviceCommandBaseOptions & WaitCommandTarget;
899
2724
 
2725
+ declare type WaitCommandOptions_2 = CommandContext & SelectorSnapshotOptions & {
2726
+ target: {
2727
+ kind: 'sleep';
2728
+ durationMs: number;
2729
+ } | {
2730
+ kind: 'text';
2731
+ text: string;
2732
+ timeoutMs?: number | null;
2733
+ } | {
2734
+ kind: 'ref';
2735
+ ref: string;
2736
+ timeoutMs?: number | null;
2737
+ } | {
2738
+ kind: 'selector';
2739
+ selector: string;
2740
+ timeoutMs?: number | null;
2741
+ };
2742
+ };
2743
+
900
2744
  export declare type WaitCommandResult = DaemonResponseData & {
901
2745
  waitedMs?: number;
902
2746
  text?: string;
903
2747
  selector?: string;
904
2748
  };
905
2749
 
2750
+ declare type WaitCommandResult_2 = {
2751
+ kind: 'sleep';
2752
+ waitedMs: number;
2753
+ } | {
2754
+ kind: 'text';
2755
+ waitedMs: number;
2756
+ text: string;
2757
+ } | {
2758
+ kind: 'selector';
2759
+ waitedMs: number;
2760
+ selector: string;
2761
+ };
2762
+
906
2763
  declare type WaitCommandTarget = {
907
2764
  durationMs: number;
908
2765
  text?: never;
@@ -929,6 +2786,11 @@ declare type WaitCommandTarget = {
929
2786
  timeoutMs?: number;
930
2787
  });
931
2788
 
2789
+ declare type WaitForTextCommandOptions = CommandContext & SelectorSnapshotOptions & {
2790
+ text: string;
2791
+ timeoutMs?: number | null;
2792
+ };
2793
+
932
2794
  declare type WaitSnapshotOptions = Pick<CaptureSnapshotOptions, 'depth' | 'scope' | 'raw'>;
933
2795
 
934
2796
  export { }