agent-device 0.17.0 → 0.17.2
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 +1 -1
- package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.17.0.apk → agent-device-android-multitouch-helper-0.17.2.apk} +0 -0
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.17.2.apk.sha256 +1 -0
- package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.17.0.manifest.json → agent-device-android-multitouch-helper-0.17.2.manifest.json} +4 -4
- package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.17.0.apk → agent-device-android-snapshot-helper-0.17.2.apk} +0 -0
- package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.17.2.apk.sha256 +1 -0
- package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.17.0.manifest.json → agent-device-android-snapshot-helper-0.17.2.manifest.json} +6 -6
- package/dist/src/123.js +1 -0
- package/dist/src/1352.js +1 -1
- package/dist/src/1534.js +1 -0
- package/dist/src/1620.js +1 -0
- package/dist/src/1644.js +2 -0
- package/dist/src/2284.js +1 -0
- package/dist/src/2403.js +3 -0
- package/dist/src/2415.js +28 -29
- package/dist/src/2474.js +1 -0
- package/dist/src/2672.js +1 -0
- package/dist/src/3393.js +1 -0
- package/dist/src/4778.js +1 -1
- package/dist/src/5898.js +1 -0
- package/dist/src/7556.js +1 -1
- package/dist/src/7847.js +1 -1
- package/dist/src/8173.js +27 -0
- package/dist/src/8407.js +1 -0
- package/dist/src/8699.js +1 -1
- package/dist/src/8806.js +3 -3
- package/dist/src/9010.js +1 -0
- package/dist/src/9238.js +3 -3
- package/dist/src/9471.js +1 -1
- package/dist/src/9542.js +3 -3
- package/dist/src/9616.js +1 -0
- package/dist/src/9673.js +1 -0
- package/dist/src/9974.js +1 -0
- package/dist/src/android-adb.d.ts +12 -6
- package/dist/src/android-adb.js +1 -1
- package/dist/src/android-snapshot-helper.d.ts +15 -7
- package/dist/src/android.js +1 -1
- package/dist/src/apple.js +1 -1
- package/dist/src/apps.js +2 -2
- package/dist/src/args.js +2 -2
- package/dist/src/batch.d.ts +16 -4
- package/dist/src/cli.js +18 -42
- package/dist/src/command-surface.js +1 -1
- package/dist/src/contracts.d.ts +28 -4
- package/dist/src/contracts.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/finders.d.ts +3 -1
- package/dist/src/generic.js +13 -11
- package/dist/src/index.d.ts +142 -73
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +1 -1
- package/dist/src/interaction.js +1 -1
- package/dist/src/internal/png-worker.d.ts +26 -0
- package/dist/src/internal/png-worker.js +1 -0
- package/dist/src/metro.d.ts +3 -1
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-trace-recording.js +26 -0
- package/dist/src/record-trace.js +1 -26
- package/dist/src/remote-config.d.ts +33 -7
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.d.ts +3 -3
- package/dist/src/selectors.js +1 -1
- package/dist/src/server.js +2 -2
- package/dist/src/session.js +10 -11
- package/dist/src/snapshot.js +1 -1
- package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +6 -2
- package/package.json +7 -4
- package/server.json +2 -2
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.17.0.apk.sha256 +0 -1
- package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.17.0.apk.sha256 +0 -1
- package/dist/src/1998.js +0 -1
- package/dist/src/2805.js +0 -1
- package/dist/src/4057.js +0 -1
- package/dist/src/5792.js +0 -1
- package/dist/src/6085.js +0 -1
- package/dist/src/6232.js +0 -1
- package/dist/src/8020.js +0 -1
- package/dist/src/8502.js +0 -1
- package/dist/src/940.js +0 -1
- package/dist/src/9404.js +0 -1
- package/dist/src/9533.js +0 -1
- package/dist/src/command-metadata.js +0 -1
- /package/dist/src/{1393.js → 3675.js} +0 -0
- /package/dist/src/{5310.js → 695.js} +0 -0
package/dist/src/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare type AgentDeviceClient = {
|
|
|
3
3
|
devices: {
|
|
4
4
|
list: (options?: AgentDeviceRequestOverrides & AgentDeviceSelectionOptions) => Promise<AgentDeviceDevice[]>;
|
|
5
5
|
boot: (options?: DeviceBootOptions) => Promise<CommandRequestResult>;
|
|
6
|
+
shutdown: (options?: DeviceShutdownOptions) => Promise<CommandRequestResult>;
|
|
6
7
|
};
|
|
7
8
|
sessions: {
|
|
8
9
|
list: (options?: AgentDeviceRequestOverrides) => Promise<AgentDeviceSession[]>;
|
|
@@ -87,7 +88,7 @@ export declare type AgentDeviceClientConfig = {
|
|
|
87
88
|
stateDir?: string;
|
|
88
89
|
daemonBaseUrl?: string;
|
|
89
90
|
daemonAuthToken?: string;
|
|
90
|
-
daemonTransport?:
|
|
91
|
+
daemonTransport?: DaemonTransportPreference;
|
|
91
92
|
daemonServerMode?: DaemonServerMode;
|
|
92
93
|
tenant?: string;
|
|
93
94
|
sessionIsolation?: SessionIsolationMode;
|
|
@@ -178,10 +179,12 @@ export declare type AgentDeviceSessionDevice = {
|
|
|
178
179
|
};
|
|
179
180
|
};
|
|
180
181
|
|
|
181
|
-
|
|
182
|
+
declare const ALERT_ACTIONS: readonly ["get", "accept", "dismiss", "wait"];
|
|
183
|
+
|
|
184
|
+
export declare type AlertAction = (typeof ALERT_ACTIONS)[number];
|
|
182
185
|
|
|
183
186
|
export declare type AlertCommandOptions = DeviceCommandBaseOptions & {
|
|
184
|
-
action?:
|
|
187
|
+
action?: AlertAction;
|
|
185
188
|
timeoutMs?: number;
|
|
186
189
|
};
|
|
187
190
|
|
|
@@ -216,23 +219,29 @@ declare type AndroidSnapshotBackendMetadata = {
|
|
|
216
219
|
backend: 'android-helper' | 'uiautomator-dump';
|
|
217
220
|
helperVersion?: string;
|
|
218
221
|
helperApiVersion?: string;
|
|
219
|
-
helperTransport?:
|
|
222
|
+
helperTransport?: AndroidSnapshotHelperTransport;
|
|
220
223
|
helperSessionReused?: boolean;
|
|
221
224
|
fallbackReason?: string;
|
|
222
|
-
installReason?:
|
|
225
|
+
installReason?: AndroidSnapshotHelperInstallReason;
|
|
223
226
|
waitForIdleTimeoutMs?: number;
|
|
224
227
|
waitForIdleQuietMs?: number;
|
|
225
228
|
timeoutMs?: number;
|
|
226
229
|
maxDepth?: number;
|
|
227
230
|
maxNodes?: number;
|
|
228
231
|
rootPresent?: boolean;
|
|
229
|
-
captureMode?:
|
|
232
|
+
captureMode?: AndroidSnapshotCaptureMode;
|
|
230
233
|
windowCount?: number;
|
|
231
234
|
nodeCount?: number;
|
|
232
235
|
helperTruncated?: boolean;
|
|
233
236
|
elapsedMs?: number;
|
|
234
237
|
};
|
|
235
238
|
|
|
239
|
+
declare type AndroidSnapshotCaptureMode = 'interactive-windows' | 'active-window';
|
|
240
|
+
|
|
241
|
+
declare type AndroidSnapshotHelperInstallReason = 'missing' | 'outdated' | 'forced' | 'current' | 'skipped';
|
|
242
|
+
|
|
243
|
+
declare type AndroidSnapshotHelperTransport = 'instrumentation' | 'persistent-session';
|
|
244
|
+
|
|
236
245
|
export declare type AppCloseOptions = AgentDeviceRequestOverrides & {
|
|
237
246
|
app?: string;
|
|
238
247
|
shutdown?: boolean;
|
|
@@ -294,8 +303,6 @@ export declare type AppInstallFromSourceResult = {
|
|
|
294
303
|
identifiers: AgentDeviceIdentifiers;
|
|
295
304
|
};
|
|
296
305
|
|
|
297
|
-
declare type ApplePlatform = 'ios' | 'macos';
|
|
298
|
-
|
|
299
306
|
export declare type AppListOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
|
|
300
307
|
appsFilter?: AppsFilter;
|
|
301
308
|
};
|
|
@@ -303,12 +310,13 @@ export declare type AppListOptions = AgentDeviceRequestOverrides & AgentDeviceSe
|
|
|
303
310
|
export declare type AppOpenOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
|
|
304
311
|
app?: string;
|
|
305
312
|
url?: string;
|
|
306
|
-
surface?:
|
|
313
|
+
surface?: SessionSurface;
|
|
307
314
|
activity?: string;
|
|
308
315
|
launchConsole?: string;
|
|
309
316
|
launchArgs?: string[];
|
|
310
317
|
relaunch?: boolean;
|
|
311
318
|
saveScript?: boolean | string;
|
|
319
|
+
noDeviceHub?: boolean;
|
|
312
320
|
noRecord?: boolean;
|
|
313
321
|
runtime?: SessionRuntimeHints;
|
|
314
322
|
};
|
|
@@ -327,7 +335,7 @@ export declare type AppOpenResult = {
|
|
|
327
335
|
identifiers: AgentDeviceIdentifiers;
|
|
328
336
|
};
|
|
329
337
|
|
|
330
|
-
export declare type AppPushOptions =
|
|
338
|
+
export declare type AppPushOptions = DeviceCommandBaseOptions & {
|
|
331
339
|
app: string;
|
|
332
340
|
payload: string | Record<string, unknown>;
|
|
333
341
|
};
|
|
@@ -343,14 +351,14 @@ export declare type AppStateCommandResult = DaemonResponseData & {
|
|
|
343
351
|
package?: string;
|
|
344
352
|
activity?: string;
|
|
345
353
|
source?: 'session';
|
|
346
|
-
surface?:
|
|
354
|
+
surface?: SessionSurface;
|
|
347
355
|
};
|
|
348
356
|
|
|
349
357
|
export declare type AppSwitcherCommandOptions = DeviceCommandBaseOptions;
|
|
350
358
|
|
|
351
359
|
export declare type AppSwitcherCommandResult = CommandActionResult<'app-switcher'>;
|
|
352
360
|
|
|
353
|
-
export declare type AppTriggerEventOptions =
|
|
361
|
+
export declare type AppTriggerEventOptions = DeviceCommandBaseOptions & {
|
|
354
362
|
event: string;
|
|
355
363
|
payload?: Record<string, unknown>;
|
|
356
364
|
};
|
|
@@ -377,14 +385,18 @@ export declare type ArtifactDescriptor = {
|
|
|
377
385
|
metadata?: Record<string, unknown>;
|
|
378
386
|
};
|
|
379
387
|
|
|
388
|
+
declare const BACK_MODES: readonly ["in-app", "system"];
|
|
389
|
+
|
|
380
390
|
export declare type BackCommandOptions = DeviceCommandBaseOptions & {
|
|
381
|
-
mode?:
|
|
391
|
+
mode?: BackMode;
|
|
382
392
|
};
|
|
383
393
|
|
|
384
394
|
export declare type BackCommandResult = CommandActionResult<'back'> & {
|
|
385
|
-
mode?:
|
|
395
|
+
mode?: BackMode;
|
|
386
396
|
};
|
|
387
397
|
|
|
398
|
+
declare type BackMode = (typeof BACK_MODES)[number];
|
|
399
|
+
|
|
388
400
|
export declare type BatchRunOptions = AgentDeviceRequestOverrides & {
|
|
389
401
|
steps: BatchStep[];
|
|
390
402
|
onError?: 'stop';
|
|
@@ -398,7 +410,7 @@ export declare type BatchStep = {
|
|
|
398
410
|
runtime?: unknown;
|
|
399
411
|
};
|
|
400
412
|
|
|
401
|
-
export declare type CaptureDiffOptions =
|
|
413
|
+
export declare type CaptureDiffOptions = DeviceCommandBaseOptions & Pick<CaptureSnapshotOptions, 'interactiveOnly' | 'compact' | 'depth' | 'scope' | 'raw'> & {
|
|
402
414
|
kind: 'snapshot';
|
|
403
415
|
out?: string;
|
|
404
416
|
};
|
|
@@ -409,7 +421,7 @@ export declare type CaptureScreenshotOptions = AgentDeviceRequestOverrides & {
|
|
|
409
421
|
fullscreen?: boolean;
|
|
410
422
|
maxSize?: number;
|
|
411
423
|
stabilize?: boolean;
|
|
412
|
-
surface?:
|
|
424
|
+
surface?: SessionSurface;
|
|
413
425
|
};
|
|
414
426
|
|
|
415
427
|
export declare type CaptureScreenshotResult = {
|
|
@@ -442,11 +454,13 @@ export declare type CaptureSnapshotResult = {
|
|
|
442
454
|
|
|
443
455
|
export declare function centerOfRect(rect: Rect): Point;
|
|
444
456
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
457
|
+
declare const CLICK_BUTTONS: readonly ["primary", "secondary", "middle"];
|
|
458
|
+
|
|
459
|
+
declare type ClickButton = (typeof CLICK_BUTTONS)[number];
|
|
448
460
|
|
|
449
|
-
declare type
|
|
461
|
+
export declare type ClickOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions & {
|
|
462
|
+
button?: ClickButton;
|
|
463
|
+
};
|
|
450
464
|
|
|
451
465
|
export declare type ClipboardCommandOptions = (DeviceCommandBaseOptions & {
|
|
452
466
|
action: 'read';
|
|
@@ -486,6 +500,12 @@ export declare type CreateTempFileOptions = {
|
|
|
486
500
|
ext: string;
|
|
487
501
|
};
|
|
488
502
|
|
|
503
|
+
declare const DAEMON_LOCK_POLICIES: readonly ["reject", "strip"];
|
|
504
|
+
|
|
505
|
+
declare const DAEMON_SERVER_MODES: readonly ["socket", "http", "dual"];
|
|
506
|
+
|
|
507
|
+
declare const DAEMON_TRANSPORT_PREFERENCES: readonly ["auto", "socket", "http"];
|
|
508
|
+
|
|
489
509
|
declare type DaemonArtifact = {
|
|
490
510
|
field: string;
|
|
491
511
|
artifactId?: string;
|
|
@@ -523,7 +543,7 @@ declare type DaemonInstallSource = {
|
|
|
523
543
|
artifactName: string;
|
|
524
544
|
}));
|
|
525
545
|
|
|
526
|
-
declare type DaemonLockPolicy =
|
|
546
|
+
declare type DaemonLockPolicy = (typeof DAEMON_LOCK_POLICIES)[number];
|
|
527
547
|
|
|
528
548
|
declare type DaemonRequest = {
|
|
529
549
|
token?: string;
|
|
@@ -545,7 +565,7 @@ declare type DaemonRequestMeta = {
|
|
|
545
565
|
leaseId?: string;
|
|
546
566
|
leaseTtlMs?: number;
|
|
547
567
|
leaseBackend?: LeaseBackend;
|
|
548
|
-
sessionIsolation?:
|
|
568
|
+
sessionIsolation?: SessionIsolationMode;
|
|
549
569
|
uploadedArtifactId?: string;
|
|
550
570
|
clientArtifactPaths?: Record<string, string>;
|
|
551
571
|
installSource?: DaemonInstallSource;
|
|
@@ -553,7 +573,7 @@ declare type DaemonRequestMeta = {
|
|
|
553
573
|
materializedPathRetentionMs?: number;
|
|
554
574
|
materializationId?: string;
|
|
555
575
|
lockPolicy?: DaemonLockPolicy;
|
|
556
|
-
lockPlatform?:
|
|
576
|
+
lockPlatform?: PlatformSelector;
|
|
557
577
|
requestProgress?: 'replay-test';
|
|
558
578
|
};
|
|
559
579
|
|
|
@@ -569,19 +589,29 @@ declare type DaemonResponseData = Record<string, unknown> & {
|
|
|
569
589
|
artifacts?: DaemonArtifact[];
|
|
570
590
|
};
|
|
571
591
|
|
|
572
|
-
declare type DaemonServerMode =
|
|
592
|
+
declare type DaemonServerMode = (typeof DAEMON_SERVER_MODES)[number];
|
|
593
|
+
|
|
594
|
+
declare type DaemonTransportPreference = (typeof DAEMON_TRANSPORT_PREFERENCES)[number];
|
|
595
|
+
|
|
596
|
+
declare const DEVICE_KINDS: readonly ["simulator", "emulator", "device"];
|
|
597
|
+
|
|
598
|
+
declare const DEVICE_ROTATIONS: readonly ["portrait", "portrait-upside-down", "landscape-left", "landscape-right"];
|
|
573
599
|
|
|
574
|
-
declare
|
|
600
|
+
declare const DEVICE_TARGETS: readonly ["mobile", "tv", "desktop"];
|
|
575
601
|
|
|
576
|
-
export declare type DeviceBootOptions =
|
|
602
|
+
export declare type DeviceBootOptions = DeviceCommandBaseOptions & {
|
|
577
603
|
headless?: boolean;
|
|
578
604
|
};
|
|
579
605
|
|
|
580
606
|
declare type DeviceCommandBaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions;
|
|
581
607
|
|
|
582
|
-
declare type DeviceKind =
|
|
608
|
+
declare type DeviceKind = (typeof DEVICE_KINDS)[number];
|
|
583
609
|
|
|
584
|
-
declare type
|
|
610
|
+
declare type DeviceRotation = (typeof DEVICE_ROTATIONS)[number];
|
|
611
|
+
|
|
612
|
+
export declare type DeviceShutdownOptions = DeviceCommandBaseOptions;
|
|
613
|
+
|
|
614
|
+
declare type DeviceTarget = (typeof DEVICE_TARGETS)[number];
|
|
585
615
|
|
|
586
616
|
export declare type ElementTarget = RefTarget | SelectorTarget;
|
|
587
617
|
|
|
@@ -602,19 +632,21 @@ export declare type FileOutputRef = {
|
|
|
602
632
|
fileName?: string;
|
|
603
633
|
};
|
|
604
634
|
|
|
605
|
-
export declare type FillOptions =
|
|
635
|
+
export declare type FillOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & {
|
|
606
636
|
text: string;
|
|
607
637
|
delayMs?: number;
|
|
608
638
|
};
|
|
609
639
|
|
|
610
|
-
declare
|
|
640
|
+
declare const FIND_LOCATORS: readonly ["any", "text", "label", "value", "role", "id"];
|
|
641
|
+
|
|
642
|
+
declare type FindBaseOptions = DeviceCommandBaseOptions & FindSnapshotCommandOptions & {
|
|
611
643
|
locator?: FindLocator;
|
|
612
644
|
query: string;
|
|
613
645
|
first?: boolean;
|
|
614
646
|
last?: boolean;
|
|
615
647
|
};
|
|
616
648
|
|
|
617
|
-
export declare type FindLocator =
|
|
649
|
+
export declare type FindLocator = (typeof FIND_LOCATORS)[number];
|
|
618
650
|
|
|
619
651
|
export declare type FindOptions = (FindBaseOptions & {
|
|
620
652
|
action?: 'click' | 'focus' | 'exists' | 'getText' | 'getAttrs';
|
|
@@ -628,21 +660,21 @@ export declare type FindOptions = (FindBaseOptions & {
|
|
|
628
660
|
|
|
629
661
|
declare type FindSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'raw'>;
|
|
630
662
|
|
|
631
|
-
declare type FlingOptions =
|
|
632
|
-
direction:
|
|
663
|
+
declare type FlingOptions = DeviceCommandBaseOptions & {
|
|
664
|
+
direction: ScrollDirection;
|
|
633
665
|
x: number;
|
|
634
666
|
y: number;
|
|
635
667
|
distance?: number;
|
|
636
668
|
durationMs?: number;
|
|
637
669
|
};
|
|
638
670
|
|
|
639
|
-
declare type FocusOptions_2 =
|
|
671
|
+
declare type FocusOptions_2 = DeviceCommandBaseOptions & {
|
|
640
672
|
x: number;
|
|
641
673
|
y: number;
|
|
642
674
|
};
|
|
643
675
|
export { FocusOptions_2 as FocusOptions }
|
|
644
676
|
|
|
645
|
-
export declare type GetOptions =
|
|
677
|
+
export declare type GetOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & ElementTarget & {
|
|
646
678
|
format: 'text' | 'attrs';
|
|
647
679
|
};
|
|
648
680
|
|
|
@@ -656,13 +688,13 @@ export declare function isAgentDeviceError(err: unknown): err is AppError;
|
|
|
656
688
|
|
|
657
689
|
export declare type IsOptions = IsTextPredicateOptions | IsStatePredicateOptions;
|
|
658
690
|
|
|
659
|
-
declare type IsStatePredicateOptions =
|
|
691
|
+
declare type IsStatePredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & {
|
|
660
692
|
predicate: 'visible' | 'hidden' | 'exists' | 'editable' | 'selected';
|
|
661
693
|
selector: string;
|
|
662
694
|
value?: never;
|
|
663
695
|
};
|
|
664
696
|
|
|
665
|
-
declare type IsTextPredicateOptions =
|
|
697
|
+
declare type IsTextPredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & {
|
|
666
698
|
predicate: 'text';
|
|
667
699
|
selector: string;
|
|
668
700
|
value: string;
|
|
@@ -699,13 +731,15 @@ declare type Lease = {
|
|
|
699
731
|
expiresAt?: number;
|
|
700
732
|
};
|
|
701
733
|
|
|
734
|
+
declare const LEASE_BACKENDS: readonly ["ios-simulator", "ios-instance", "android-instance"];
|
|
735
|
+
|
|
702
736
|
declare type LeaseAllocateOptions = LeaseOptions & {
|
|
703
737
|
tenant: string;
|
|
704
738
|
runId: string;
|
|
705
739
|
leaseBackend?: LeaseBackend;
|
|
706
740
|
};
|
|
707
741
|
|
|
708
|
-
declare type LeaseBackend =
|
|
742
|
+
declare type LeaseBackend = (typeof LEASE_BACKENDS)[number];
|
|
709
743
|
|
|
710
744
|
declare type LeaseOptions = AgentDeviceRequestOverrides & {
|
|
711
745
|
ttlMs?: number;
|
|
@@ -723,13 +757,17 @@ export declare type LocalArtifactAdapterOptions = {
|
|
|
723
757
|
rootDir?: string;
|
|
724
758
|
};
|
|
725
759
|
|
|
760
|
+
declare const LOG_ACTION_VALUES: readonly ["path", "start", "stop", "doctor", "mark", "clear"];
|
|
761
|
+
|
|
762
|
+
declare type LogAction = (typeof LOG_ACTION_VALUES)[number];
|
|
763
|
+
|
|
726
764
|
export declare type LogsOptions = AgentDeviceRequestOverrides & {
|
|
727
|
-
action?:
|
|
765
|
+
action?: LogAction;
|
|
728
766
|
message?: string;
|
|
729
767
|
restart?: boolean;
|
|
730
768
|
};
|
|
731
769
|
|
|
732
|
-
export declare type LongPressOptions =
|
|
770
|
+
export declare type LongPressOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & {
|
|
733
771
|
durationMs?: number;
|
|
734
772
|
};
|
|
735
773
|
|
|
@@ -803,10 +841,14 @@ export declare type MetroReloadResult = ReloadMetroResult;
|
|
|
803
841
|
/** Re-export of {@link SessionRuntimeHints} under the Metro-specific alias used by public API consumers. */
|
|
804
842
|
declare type MetroRuntimeHints = SessionRuntimeHints;
|
|
805
843
|
|
|
844
|
+
declare const NETWORK_INCLUDE_MODES: readonly ["summary", "headers", "body", "all"];
|
|
845
|
+
|
|
846
|
+
declare type NetworkIncludeMode = (typeof NETWORK_INCLUDE_MODES)[number];
|
|
847
|
+
|
|
806
848
|
export declare type NetworkOptions = AgentDeviceRequestOverrides & {
|
|
807
849
|
action?: 'dump' | 'log';
|
|
808
850
|
limit?: number;
|
|
809
|
-
include?:
|
|
851
|
+
include?: NetworkIncludeMode;
|
|
810
852
|
};
|
|
811
853
|
|
|
812
854
|
export declare function normalizeAgentDeviceError(err: unknown, context?: {
|
|
@@ -825,7 +867,7 @@ export declare type NormalizedError = {
|
|
|
825
867
|
|
|
826
868
|
export declare type OutputVisibility = 'client-visible' | 'internal';
|
|
827
869
|
|
|
828
|
-
declare type PanOptions =
|
|
870
|
+
declare type PanOptions = DeviceCommandBaseOptions & {
|
|
829
871
|
x: number;
|
|
830
872
|
y: number;
|
|
831
873
|
dx: number;
|
|
@@ -841,22 +883,26 @@ declare type PerfAction = (typeof PERF_ACTION_VALUES)[number];
|
|
|
841
883
|
|
|
842
884
|
declare type PerfArea = (typeof PERF_AREA_VALUES)[number];
|
|
843
885
|
|
|
844
|
-
export declare type PerfOptions =
|
|
886
|
+
export declare type PerfOptions = DeviceCommandBaseOptions & {
|
|
845
887
|
area?: PerfArea;
|
|
846
888
|
action?: PerfAction;
|
|
847
889
|
};
|
|
848
890
|
|
|
849
891
|
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';
|
|
850
892
|
|
|
851
|
-
export declare type PinchOptions =
|
|
893
|
+
export declare type PinchOptions = DeviceCommandBaseOptions & {
|
|
852
894
|
scale: number;
|
|
853
895
|
x?: number;
|
|
854
896
|
y?: number;
|
|
855
897
|
};
|
|
856
898
|
|
|
857
|
-
declare type Platform =
|
|
899
|
+
declare type Platform = (typeof PLATFORMS)[number];
|
|
900
|
+
|
|
901
|
+
declare const PLATFORM_SELECTORS: readonly ["ios", "macos", "android", "linux", "apple"];
|
|
858
902
|
|
|
859
|
-
declare
|
|
903
|
+
declare const PLATFORMS: readonly ["ios", "macos", "android", "linux"];
|
|
904
|
+
|
|
905
|
+
declare type PlatformSelector = (typeof PLATFORM_SELECTORS)[number];
|
|
860
906
|
|
|
861
907
|
export declare type Point = {
|
|
862
908
|
x: number;
|
|
@@ -871,7 +917,7 @@ declare type PointTarget = {
|
|
|
871
917
|
label?: never;
|
|
872
918
|
};
|
|
873
919
|
|
|
874
|
-
declare type PrepareCommandOptions =
|
|
920
|
+
declare type PrepareCommandOptions = DeviceCommandBaseOptions & {
|
|
875
921
|
action: 'ios-runner';
|
|
876
922
|
timeoutMs?: number;
|
|
877
923
|
};
|
|
@@ -892,7 +938,7 @@ declare type PrepareMetroRuntimeResult = {
|
|
|
892
938
|
bridge: MetroBridgeResult | null;
|
|
893
939
|
};
|
|
894
940
|
|
|
895
|
-
export declare type PressOptions =
|
|
941
|
+
export declare type PressOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions;
|
|
896
942
|
|
|
897
943
|
declare type RawSnapshotNode = {
|
|
898
944
|
index: number;
|
|
@@ -921,7 +967,7 @@ declare type RawSnapshotNode = {
|
|
|
921
967
|
presentationHints?: string[];
|
|
922
968
|
};
|
|
923
969
|
|
|
924
|
-
declare type ReactNativeCommandOptions =
|
|
970
|
+
declare type ReactNativeCommandOptions = DeviceCommandBaseOptions & {
|
|
925
971
|
action: 'dismiss-overlay';
|
|
926
972
|
};
|
|
927
973
|
|
|
@@ -985,6 +1031,7 @@ export declare type ReplayTestOptions = AgentDeviceRequestOverrides & AgentDevic
|
|
|
985
1031
|
failFast?: boolean;
|
|
986
1032
|
timeoutMs?: number;
|
|
987
1033
|
retries?: number;
|
|
1034
|
+
recordVideo?: boolean;
|
|
988
1035
|
artifactsDir?: string;
|
|
989
1036
|
reportJunit?: string;
|
|
990
1037
|
shardAll?: number;
|
|
@@ -1018,14 +1065,14 @@ export declare type ResolveInputOptions = {
|
|
|
1018
1065
|
};
|
|
1019
1066
|
|
|
1020
1067
|
export declare type RotateCommandOptions = DeviceCommandBaseOptions & {
|
|
1021
|
-
orientation:
|
|
1068
|
+
orientation: DeviceRotation;
|
|
1022
1069
|
};
|
|
1023
1070
|
|
|
1024
1071
|
export declare type RotateCommandResult = CommandActionResult<'rotate'> & {
|
|
1025
1072
|
orientation?: RotateCommandOptions['orientation'];
|
|
1026
1073
|
};
|
|
1027
1074
|
|
|
1028
|
-
declare type RotateGestureOptions =
|
|
1075
|
+
declare type RotateGestureOptions = DeviceCommandBaseOptions & {
|
|
1029
1076
|
degrees: number;
|
|
1030
1077
|
x?: number;
|
|
1031
1078
|
y?: number;
|
|
@@ -1040,8 +1087,16 @@ export declare type ScreenshotOverlayRef = {
|
|
|
1040
1087
|
center: Point;
|
|
1041
1088
|
};
|
|
1042
1089
|
|
|
1043
|
-
declare
|
|
1044
|
-
|
|
1090
|
+
declare const SCROLL_DIRECTIONS: readonly ["up", "down", "left", "right"];
|
|
1091
|
+
|
|
1092
|
+
declare const SCROLL_INPUT_DIRECTIONS: readonly ["up", "down", "left", "right", "top", "bottom"];
|
|
1093
|
+
|
|
1094
|
+
declare type ScrollDirection = (typeof SCROLL_DIRECTIONS)[number];
|
|
1095
|
+
|
|
1096
|
+
declare type ScrollInputDirection = (typeof SCROLL_INPUT_DIRECTIONS)[number];
|
|
1097
|
+
|
|
1098
|
+
declare type ScrollOptions_2 = DeviceCommandBaseOptions & {
|
|
1099
|
+
direction: ScrollInputDirection;
|
|
1045
1100
|
amount?: number;
|
|
1046
1101
|
pixels?: number;
|
|
1047
1102
|
};
|
|
@@ -1057,13 +1112,17 @@ declare type SelectorTarget = {
|
|
|
1057
1112
|
label?: never;
|
|
1058
1113
|
};
|
|
1059
1114
|
|
|
1115
|
+
declare const SESSION_ISOLATION_MODES: readonly ["none", "tenant"];
|
|
1116
|
+
|
|
1117
|
+
declare const SESSION_SURFACES: readonly ["app", "frontmost-app", "desktop", "menubar"];
|
|
1118
|
+
|
|
1060
1119
|
export declare type SessionCloseResult = {
|
|
1061
1120
|
session: string;
|
|
1062
1121
|
shutdown?: Record<string, unknown>;
|
|
1063
1122
|
identifiers: AgentDeviceIdentifiers;
|
|
1064
1123
|
};
|
|
1065
1124
|
|
|
1066
|
-
declare type SessionIsolationMode =
|
|
1125
|
+
declare type SessionIsolationMode = (typeof SESSION_ISOLATION_MODES)[number];
|
|
1067
1126
|
|
|
1068
1127
|
declare type SessionRuntimeHints = {
|
|
1069
1128
|
platform?: 'ios' | 'android';
|
|
@@ -1073,31 +1132,33 @@ declare type SessionRuntimeHints = {
|
|
|
1073
1132
|
launchUrl?: string;
|
|
1074
1133
|
};
|
|
1075
1134
|
|
|
1076
|
-
|
|
1135
|
+
declare type SessionSurface = (typeof SESSION_SURFACES)[number];
|
|
1136
|
+
|
|
1137
|
+
export declare type SettingsUpdateOptions = (DeviceCommandBaseOptions & {
|
|
1077
1138
|
setting: 'clear-app-state';
|
|
1078
1139
|
state: 'clear';
|
|
1079
1140
|
app?: string;
|
|
1080
|
-
}) | (
|
|
1141
|
+
}) | (DeviceCommandBaseOptions & {
|
|
1081
1142
|
setting: 'wifi' | 'airplane' | 'location';
|
|
1082
1143
|
state: 'on' | 'off';
|
|
1083
|
-
}) | (
|
|
1144
|
+
}) | (DeviceCommandBaseOptions & {
|
|
1084
1145
|
setting: 'location';
|
|
1085
1146
|
state: 'set';
|
|
1086
1147
|
latitude: number;
|
|
1087
1148
|
longitude: number;
|
|
1088
|
-
}) | (
|
|
1149
|
+
}) | (DeviceCommandBaseOptions & {
|
|
1089
1150
|
setting: 'animations';
|
|
1090
1151
|
state: 'on' | 'off';
|
|
1091
|
-
}) | (
|
|
1152
|
+
}) | (DeviceCommandBaseOptions & {
|
|
1092
1153
|
setting: 'appearance';
|
|
1093
1154
|
state: 'light' | 'dark' | 'toggle';
|
|
1094
|
-
}) | (
|
|
1155
|
+
}) | (DeviceCommandBaseOptions & {
|
|
1095
1156
|
setting: 'faceid' | 'touchid';
|
|
1096
1157
|
state: 'match' | 'nonmatch' | 'enroll' | 'unenroll';
|
|
1097
|
-
}) | (
|
|
1158
|
+
}) | (DeviceCommandBaseOptions & {
|
|
1098
1159
|
setting: 'fingerprint';
|
|
1099
1160
|
state: 'match' | 'nonmatch';
|
|
1100
|
-
}) | (
|
|
1161
|
+
}) | (DeviceCommandBaseOptions & {
|
|
1101
1162
|
setting: 'permission';
|
|
1102
1163
|
state: 'grant' | 'deny' | 'reset';
|
|
1103
1164
|
permission: PermissionTarget;
|
|
@@ -1132,12 +1193,16 @@ export declare type StartupPerfSample = {
|
|
|
1132
1193
|
appBundleId?: string;
|
|
1133
1194
|
};
|
|
1134
1195
|
|
|
1135
|
-
declare
|
|
1136
|
-
|
|
1196
|
+
declare const SWIPE_PATTERNS: readonly ["one-way", "ping-pong"];
|
|
1197
|
+
|
|
1198
|
+
declare const SWIPE_PRESETS: readonly ["left", "right", "left-edge", "right-edge"];
|
|
1199
|
+
|
|
1200
|
+
declare type SwipeGestureOptions = DeviceCommandBaseOptions & {
|
|
1201
|
+
preset: SwipePreset;
|
|
1137
1202
|
durationMs?: number;
|
|
1138
1203
|
};
|
|
1139
1204
|
|
|
1140
|
-
export declare type SwipeOptions =
|
|
1205
|
+
export declare type SwipeOptions = DeviceCommandBaseOptions & {
|
|
1141
1206
|
from: {
|
|
1142
1207
|
x: number;
|
|
1143
1208
|
y: number;
|
|
@@ -1149,9 +1214,13 @@ export declare type SwipeOptions = ClientCommandBaseOptions & {
|
|
|
1149
1214
|
durationMs?: number;
|
|
1150
1215
|
count?: number;
|
|
1151
1216
|
pauseMs?: number;
|
|
1152
|
-
pattern?:
|
|
1217
|
+
pattern?: SwipePattern;
|
|
1153
1218
|
};
|
|
1154
1219
|
|
|
1220
|
+
declare type SwipePattern = (typeof SWIPE_PATTERNS)[number];
|
|
1221
|
+
|
|
1222
|
+
declare type SwipePreset = (typeof SWIPE_PRESETS)[number];
|
|
1223
|
+
|
|
1155
1224
|
export declare type TemporaryFile = {
|
|
1156
1225
|
path: string;
|
|
1157
1226
|
visibility: 'internal';
|
|
@@ -1163,7 +1232,9 @@ export declare type TraceOptions = AgentDeviceRequestOverrides & {
|
|
|
1163
1232
|
path?: string;
|
|
1164
1233
|
};
|
|
1165
1234
|
|
|
1166
|
-
declare type TransformGestureOptions =
|
|
1235
|
+
declare type TransformGestureOptions = DeviceCommandBaseOptions & TransformGestureParams;
|
|
1236
|
+
|
|
1237
|
+
declare type TransformGestureParams = {
|
|
1167
1238
|
x: number;
|
|
1168
1239
|
y: number;
|
|
1169
1240
|
dx: number;
|
|
@@ -1173,7 +1244,7 @@ declare type TransformGestureOptions = ClientCommandBaseOptions & {
|
|
|
1173
1244
|
durationMs?: number;
|
|
1174
1245
|
};
|
|
1175
1246
|
|
|
1176
|
-
export declare type TypeTextOptions =
|
|
1247
|
+
export declare type TypeTextOptions = DeviceCommandBaseOptions & {
|
|
1177
1248
|
text: string;
|
|
1178
1249
|
delayMs?: number;
|
|
1179
1250
|
};
|
|
@@ -1192,19 +1263,19 @@ declare type WaitCommandTarget = {
|
|
|
1192
1263
|
ref?: never;
|
|
1193
1264
|
selector?: never;
|
|
1194
1265
|
timeoutMs?: never;
|
|
1195
|
-
} | (
|
|
1266
|
+
} | (SelectorSnapshotCommandOptions & {
|
|
1196
1267
|
text: string;
|
|
1197
1268
|
durationMs?: never;
|
|
1198
1269
|
ref?: never;
|
|
1199
1270
|
selector?: never;
|
|
1200
1271
|
timeoutMs?: number;
|
|
1201
|
-
}) | (
|
|
1272
|
+
}) | (SelectorSnapshotCommandOptions & {
|
|
1202
1273
|
ref: string;
|
|
1203
1274
|
durationMs?: never;
|
|
1204
1275
|
text?: never;
|
|
1205
1276
|
selector?: never;
|
|
1206
1277
|
timeoutMs?: number;
|
|
1207
|
-
}) | (
|
|
1278
|
+
}) | (SelectorSnapshotCommandOptions & {
|
|
1208
1279
|
selector: string;
|
|
1209
1280
|
durationMs?: never;
|
|
1210
1281
|
text?: never;
|
|
@@ -1212,6 +1283,4 @@ declare type WaitCommandTarget = {
|
|
|
1212
1283
|
timeoutMs?: number;
|
|
1213
1284
|
});
|
|
1214
1285
|
|
|
1215
|
-
declare type WaitSnapshotOptions = Pick<CaptureSnapshotOptions, 'depth' | 'scope' | 'raw'>;
|
|
1216
|
-
|
|
1217
1286
|
export { }
|
package/dist/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AppError,isAgentDeviceError,normalizeAgentDeviceError}from"./9152.js";export{centerOfRect}from"./
|
|
1
|
+
export{AppError,isAgentDeviceError,normalizeAgentDeviceError}from"./9152.js";export{centerOfRect}from"./1644.js";export{createAgentDeviceClient}from"./9542.js";export{createLocalArtifactAdapter}from"./7719.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{emitDiagnostic as t}from"./7599.js";import{runAndroidAdb as e}from"./8806.js";import{getAndroidKeyboardState as n,isAndroidInputMethodOwnedNode as a}from"./8133.js";import{captureAndroidUiHierarchyXml as r}from"./2415.js";import{androidUiNodes as i}from"./221.js";import{AppError as o}from"./9152.js";import{buildScrollGesturePlan as u}from"./
|
|
1
|
+
import{emitDiagnostic as t}from"./7599.js";import{runAndroidAdb as e}from"./8806.js";import{getAndroidKeyboardState as n,isAndroidInputMethodOwnedNode as a}from"./8133.js";import{captureAndroidUiHierarchyXml as r}from"./2415.js";import{androidUiNodes as i}from"./221.js";import{AppError as o}from"./9152.js";import{buildScrollGesturePlan as u}from"./1620.js";import{resolveAndroidTextInjector as l}from"./9639.js";import{sleep as c}from"./4829.js";function s(t){var e;return!!t&&(!!t.password||!!(e=t.text)&&Array.from(e).every(f))}function d(t){if(!t)return null;let e=s(t);return{...t,text:e?null:t.text,...e?{textRedacted:!0}:{}}}function f(t){return"•"===t||"*"===t||"●"===t}async function p(t,e,n,a){let r=null,i=null,o=await y(t);for(let u of[0,150,350]){u>0&&await c(u);let l=await g(t,e,n,a,o);if(r=l,"ime_capture"===l.reason)return l;i=l.ok?l:null}return i??r??{ok:!1,actual:null,reason:"text_mismatch",targetInput:null,actualInput:null}}async function h(t,e,n){var a,i,o;return a=await r(t),i=e,o=n,m(a,i,o).actualInput?.text??null}async function g(t,e,n,a,i){return function(t,e,n,a,r={}){var i,o;let u,l=m(t,e,n,r);return!function(t){let{targetInput:e,actualInput:n}=t;return!!e&&!!n&&n!==e&&n.inputMethodOwned&&!e.inputMethodOwned}(l)?function(t,e){let n=t.actualInput;if(!n||!s(n))return null;let a=n.text??null,r=Array.from(a??"").length,i=Array.from(e).length,o=null!==a&&r>0&&i>0&&r===i;return{ok:o,actual:a,reason:o?void 0:"masked_unverified",masked:!0,targetInput:t.targetInput,actualInput:n}}(l,a)??(i=l,o=a,{ok:function(t,e){if(t===e)return!0;let n=w(t),a=w(e);return!!n&&!!a&&!!(n===a||function(t,e){if(t.length!==e.length||0===t.length||t.slice(1)!==e.slice(1))return!1;let n=t[0],a=e[0];return!!n&&!!a&&a.toLowerCase()===a&&n===a.toUpperCase()}(n,a))}(u=i.actualInput?.text??null,o),actual:u,reason:"text_mismatch",targetInput:i.targetInput,actualInput:i.actualInput}):{ok:!1,actual:l.actualInput?.text??null,reason:"ime_capture",targetInput:l.targetInput,actualInput:l.actualInput}}(await r(t),e,n,a,i)}function m(t,e,n,r={}){var o;let u,l={focusedEdit:null,editAtPoint:null,anyAtPoint:null};for(let o of i(t)){let t=function(t,e){if(!t.rect)return null;let n=t.text??"",r=Math.max(1,t.rect.width*t.rect.height);return{text:n||null,className:t.className,resourceId:t.resourceId,packageName:t.packageName,rect:t.rect,focused:t.focused??!1,password:!0===t.password,inputMethodOwned:a({packageName:t.packageName,resourceId:t.resourceId,activeInputMethodPackage:e.activeInputMethodPackage}),area:r,editText:function(t){let e=t.toLowerCase();return e.includes("edittext")||e.includes("textfield")}(t.className??"")}}(o,r);t&&function(t,e,n,a){var r,i,o;let u=(r=e.rect,i=n,o=a,i>=r.x&&i<=r.x+r.width&&o>=r.y&&o<=r.y+r.height);if(u&&e.editText&&(t.editAtPoint=_(t.editAtPoint,e)),e.focused&&e.editText){t.focusedEdit=_(t.focusedEdit,e);return}u&&e.text&&(t.anyAtPoint=_(t.anyAtPoint,e))}(l,t,e,n)}return{targetInput:u=(o=l).editAtPoint??o.anyAtPoint,actualInput:(o.focusedEdit?.text?o.focusedEdit:null)??u}}function w(t){return(t??"").replace(/\s+/g," ").trim()}async function y(e){try{return{activeInputMethodPackage:(await n(e)).inputMethodPackage}}catch(e){return t({level:"warn",phase:"android_fill_verification_input_method_probe_failed",data:{error:e instanceof Error?e.message:String(e)}}),{}}}function _(t,e){return t&&t.area<e.area?t:e}async function A(t,n,a){await e(t,["shell","input","tap",String(n),String(a)])}async function x(t,n,a,r,i,o=250){await e(t,["shell","input","swipe",String(n),String(a),String(r),String(i),String(o)])}async function I(t){await e(t,["shell","input","keyevent","4"])}async function S(t){await e(t,["shell","input","keyevent","3"])}async function M(t){await e(t,["shell","input","keyevent","ENTER"])}async function k(t,n){let a=function(t){switch(t){case"portrait":return"0";case"landscape-left":return"1";case"portrait-upside-down":return"2";case"landscape-right":return"3";default:throw new o("INVALID_ARGS",`Unsupported Android rotation: ${t}`)}}(n);await e(t,["shell","settings","put","system","accelerometer_rotation","0"]),await e(t,["shell","settings","put","system","user_rotation",a])}async function E(t){await e(t,["shell","input","keyevent","187"])}async function v(t,n,a,r=800){await e(t,["shell","input","swipe",String(n),String(a),String(n),String(a),String(r)])}async function C(t,e,n=0){let a=l(t);if(a){await a({action:"type",text:e,delayMs:n}),T("type","provider-native",e);return}(z(e),await D(t,"type"),n>0&&Array.from(e).length>1)?await L(t,{action:"type",text:e,chunkSize:1,delayMs:n}):await L(t,{action:"type",text:e,chunkSize:O,delayMs:0})}async function P(t,e,n){await A(t,e,n)}async function N(t,e,n,a,r=0){let i=l(t);if(i){await i({action:"fill",target:{x:e,y:n},text:a,delayMs:r}),T("fill","provider-native",a);let o=await p(t,e,n,a);if(o.ok)return;b(a,o)}z(a);let o=Array.from(a).length,u=null;for(let i of[{clearPadding:12,minClear:8,maxClear:48,chunkSize:r>0?1:O,inputDelayMs:r},{clearPadding:24,minClear:16,maxClear:96,chunkSize:r>0?1:4,inputDelayMs:r>0?r:15}]){var c,s;await P(t,e,n),await D(t,"fill");let r=(c=o+i.clearPadding,s=i.minClear,Math.max(s,Math.min(i.maxClear,c)));await F(t,r),await L(t,{action:"fill",text:a,chunkSize:i.chunkSize,delayMs:i.inputDelayMs});let l=await p(t,e,n,a);if(u=l,l.ok)return;"ime_capture"===l.reason&&b(a,l)}b(a,u)}function b(t,e){let n;throw new o("COMMAND_FAILED",e?.reason==="ime_capture"?"Android fill input was captured by the active keyboard instead of the app field":e?.reason==="masked_unverified"?"Android fill verification could not confirm masked text value":"Android fill verification failed",(n=function(t,e){var n;if(!e)return{expected:t,actual:null,failureReason:"text_mismatch",targetInput:null,actualInput:null};let a=!0===(n=e).masked||s(n.targetInput)||s(n.actualInput),r={failureReason:e.reason??"text_mismatch",targetInput:d(e.targetInput),actualInput:d(e.actualInput)};return a?{...r,expectedLength:Array.from(t).length,actual:null,masked:!0,actualLength:Array.from(e.actual??"").length}:{...r,expected:t,actual:e.actual}}(t,e),e?.reason==="ime_capture"&&(n.hint="The focused input belongs to the Android keyboard/IME, not the app field. Disable handwriting/stylus input or switch to a standard IME, then retry fill."),n))}async function K(t,n,a){let r=await R(t),i=u({direction:n,amount:a?.amount,pixels:a?.pixels,referenceWidth:r.width,referenceHeight:r.height});return await e(t,["shell","input","swipe",String(i.x1),String(i.y1),String(i.x2),String(i.y2),"300"]),i}async function D(e,a){let r;try{r=await n(e)}catch(e){t({level:"warn",phase:"android_input_ownership_probe_failed",data:{action:a,error:e instanceof Error?e.message:String(e)}});return}if("ime"===r.inputOwner)throw new o("COMMAND_FAILED","KEYBOARD_OVERLAY_BLOCKING: Android text input is blocked because the focused input belongs to the active keyboard/IME.",{failureReason:"ime_capture",action:a,inputOwner:r.inputOwner,inputType:r.inputType,type:r.type,inputMethodPackage:r.inputMethodPackage,focusedPackage:r.focusedPackage,focusedResourceId:r.focusedResourceId,nextAction:"Focused input appears to be owned by the keyboard/IME; dismiss or change the IME before retrying text entry."})}async function R(t){let n=(await e(t,["shell","wm","size"])).stdout.match(/Physical size:\s*(\d+)x(\d+)/);if(!n)throw new o("COMMAND_FAILED","Unable to read screen size");return{width:Number(n[1]),height:Number(n[2])}}let O=8;async function L(t,n){let a=n.text.split("\n");for(let[r,i]of a.entries()){let o=function(t,e){let n=Math.max(1,Math.floor(e)),a=[],r=Array.from(t);for(let t=0;t<r.length;t+=n)a.push(r.slice(t,t+n).join(""));return a.length>0?a:[""]}(i,n.chunkSize);for(let[e,i]of o.entries())await U(t,i),n.delayMs>0&&(e+1<o.length||r+1<a.length)&&await c(n.delayMs);r+1<a.length&&await e(t,["shell","input","keyevent","ENTER"])}T(n.action,"adb-shell",n.text)}async function U(t,n){if(n)try{await e(t,["shell","input","text",n.replace(/ /g,"%s")])}catch(t){if(function(t){if(!(t instanceof o)||"COMMAND_FAILED"!==t.code)return!1;let e=t.details?.stderr,n=("string"==typeof e?e:"").toLowerCase();return!!(n.includes("exception occurred while executing 'text'")||n.includes("nullpointerexception")&&n.includes("inputshellcommand.sendtext"))}(t))throw H(n,t);throw t}}function z(t){if(!function(t){for(let e of t){let t=e.codePointAt(0);if(void 0!==t&&"\n"!==e&&(t<32||t>126))return!1}return!0}(t))throw H(t)}function H(t,e){return new o("COMMAND_FAILED","Android text input requires provider-native text injection for non-ASCII/control characters; the current adb-shell fallback supports ASCII text only.",{backend:"adb-shell",textLength:Array.from(t).length,textPreview:t.slice(0,32)},e instanceof Error?e:void 0)}function T(e,n,a){t({phase:"android_text_injection",data:{action:e,backend:n,textLength:Array.from(a).length}})}async function F(t,n){let a=Math.max(0,n);await e(t,["shell","input","keyevent","KEYCODE_MOVE_END"],{allowFailure:!0});for(let n=0;n<a;n+=24){let r=Math.min(24,a-n);await e(t,["shell","input","keyevent",...Array(r).fill("KEYCODE_DEL")],{allowFailure:!0})}}export{E as appSwitcherAndroid,I as backAndroid,N as fillAndroid,P as focusAndroid,R as getAndroidScreenSize,S as homeAndroid,v as longPressAndroid,A as pressAndroid,M as pressAndroidEnter,h as readAndroidTextAtPoint,k as rotateAndroid,K as scrollAndroid,x as swipeAndroid,C as typeAndroid};
|