agent-device 0.14.3 → 0.14.4

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.
@@ -1,632 +0,0 @@
1
- import { ChildProcess } from 'node:child_process';
2
- import { spawn } from 'node:child_process';
3
- import { SpawnOptions } from 'node:child_process';
4
-
5
- export declare type AdmissionRequest = {
6
- tenantId: string | undefined;
7
- runId: string | undefined;
8
- leaseId: string | undefined;
9
- backend?: LeaseBackend;
10
- };
11
-
12
- export declare type AllocateLeaseRequest = {
13
- tenantId: string;
14
- runId: string;
15
- backend?: LeaseBackend;
16
- ttlMs?: number;
17
- };
18
-
19
- /**
20
- * Runs device-scoped adb arguments after the device serial has already been selected.
21
- * Implementations must be safe to call concurrently for one request.
22
- */
23
- export declare type AndroidAdbExecutor = (args: string[], options?: AndroidAdbExecutorOptions) => Promise<AndroidAdbExecutorResult>;
24
-
25
- export declare type AndroidAdbExecutorOptions = Pick<ExecOptions, 'allowFailure' | 'timeoutMs' | 'binaryStdout' | 'stdin' | 'signal'>;
26
-
27
- export declare type AndroidAdbExecutorResult = Pick<ExecResult, 'exitCode' | 'stdout' | 'stderr' | 'stdoutBuffer'>;
28
-
29
- export declare type AndroidAdbProvider = {
30
- exec: AndroidAdbExecutor;
31
- spawn?: AndroidAdbSpawner;
32
- };
33
-
34
- export declare type AndroidAdbProviderResolver = (params: {
35
- req: DaemonRequest;
36
- device: DeviceInfo;
37
- session?: SessionState;
38
- }) => AndroidAdbProvider | AndroidAdbExecutor | undefined;
39
-
40
- declare type AndroidAdbSpawner = (args: string[], options?: SpawnOptions) => ChildProcess;
41
-
42
- declare type AndroidSnapshotFreshness = {
43
- action: string;
44
- markedAt: number;
45
- baselineCount: number;
46
- baselineSignatures?: string[];
47
- routeComparable: boolean;
48
- };
49
-
50
- declare type ApplePlatform = 'ios' | 'macos';
51
-
52
- declare type AppLogState = 'active' | 'recovering' | 'failed';
53
-
54
- declare type BatchStep = {
55
- command: string;
56
- positionals?: string[];
57
- flags?: Partial<CommandFlags>;
58
- runtime?: unknown;
59
- };
60
-
61
- export declare function cleanupDownloadableArtifact(artifactId: string): void;
62
-
63
- export declare function cleanupUploadedArtifact(uploadId: string): void;
64
-
65
- declare type CliFlags = {
66
- json: boolean;
67
- config?: string;
68
- remoteConfig?: string;
69
- stateDir?: string;
70
- daemonBaseUrl?: string;
71
- daemonAuthToken?: string;
72
- daemonTransport?: 'auto' | 'socket' | 'http';
73
- daemonServerMode?: 'socket' | 'http' | 'dual';
74
- tenant?: string;
75
- sessionIsolation?: 'none' | 'tenant';
76
- runId?: string;
77
- leaseId?: string;
78
- leaseBackend?: 'ios-simulator' | 'ios-instance' | 'android-instance';
79
- force?: boolean;
80
- noLogin?: boolean;
81
- sessionLock?: 'reject' | 'strip';
82
- sessionLocked?: boolean;
83
- sessionLockConflicts?: 'reject' | 'strip';
84
- platform?: 'ios' | 'macos' | 'android' | 'linux' | 'apple';
85
- target?: 'mobile' | 'tv' | 'desktop';
86
- device?: string;
87
- udid?: string;
88
- serial?: string;
89
- iosSimulatorDeviceSet?: string;
90
- androidDeviceAllowlist?: string;
91
- out?: string;
92
- session?: string;
93
- runtime?: string;
94
- metroHost?: string;
95
- metroPort?: number;
96
- metroProjectRoot?: string;
97
- metroKind?: 'auto' | 'react-native' | 'expo';
98
- metroPublicBaseUrl?: string;
99
- metroProxyBaseUrl?: string;
100
- metroBearerToken?: string;
101
- metroPreparePort?: number;
102
- metroListenHost?: string;
103
- metroStatusHost?: string;
104
- metroStartupTimeoutMs?: number;
105
- metroProbeTimeoutMs?: number;
106
- metroRuntimeFile?: string;
107
- metroNoReuseExisting?: boolean;
108
- metroNoInstallDeps?: boolean;
109
- bundleUrl?: string;
110
- launchUrl?: string;
111
- boot?: boolean;
112
- reuseExisting?: boolean;
113
- verbose?: boolean;
114
- snapshotInteractiveOnly?: boolean;
115
- snapshotDiff?: boolean;
116
- snapshotCompact?: boolean;
117
- snapshotDepth?: number;
118
- snapshotScope?: string;
119
- snapshotRaw?: boolean;
120
- networkInclude?: 'summary' | 'headers' | 'body' | 'all';
121
- overlayRefs?: boolean;
122
- screenshotFullscreen?: boolean;
123
- screenshotMaxSize?: number;
124
- baseline?: string;
125
- threshold?: string;
126
- appsFilter?: 'user-installed' | 'all';
127
- count?: number;
128
- fps?: number;
129
- quality?: number;
130
- hideTouches?: boolean;
131
- intervalMs?: number;
132
- delayMs?: number;
133
- holdMs?: number;
134
- jitterPx?: number;
135
- pixels?: number;
136
- doubleTap?: boolean;
137
- clickButton?: 'primary' | 'secondary' | 'middle';
138
- backMode?: 'in-app' | 'system';
139
- pauseMs?: number;
140
- pattern?: 'one-way' | 'ping-pong';
141
- activity?: string;
142
- header?: string[];
143
- githubActionsArtifact?: string;
144
- installSource?: DaemonInstallSource_2;
145
- saveScript?: boolean | string;
146
- shutdown?: boolean;
147
- relaunch?: boolean;
148
- surface?: 'app' | 'frontmost-app' | 'desktop' | 'menubar';
149
- headless?: boolean;
150
- restart?: boolean;
151
- noRecord?: boolean;
152
- retainPaths?: boolean;
153
- retentionMs?: number;
154
- replayUpdate?: boolean;
155
- replayEnv?: string[];
156
- replayShellEnv?: Record<string, string>;
157
- failFast?: boolean;
158
- timeoutMs?: number;
159
- retries?: number;
160
- artifactsDir?: string;
161
- reportJunit?: string;
162
- steps?: string;
163
- stepsFile?: string;
164
- findFirst?: boolean;
165
- findLast?: boolean;
166
- batchOnError?: 'stop';
167
- batchMaxSteps?: number;
168
- batchSteps?: Array<{
169
- command: string;
170
- positionals?: string[];
171
- flags?: Record<string, unknown>;
172
- }>;
173
- help: boolean;
174
- version: boolean;
175
- };
176
-
177
- declare type CommandFlags = Omit<CliFlags, 'json' | 'help' | 'version' | 'batchSteps'> & {
178
- batchSteps?: BatchStep[];
179
- };
180
-
181
- export declare function createRequestHandler(deps: RequestRouterDeps): (req: DaemonRequest) => Promise<DaemonResponse>;
182
-
183
- export declare type DaemonArtifact = DaemonArtifact_2;
184
-
185
- declare type DaemonArtifact_2 = {
186
- field: string;
187
- artifactId?: string;
188
- fileName?: string;
189
- localPath?: string;
190
- path?: string;
191
- };
192
-
193
- declare type DaemonError = {
194
- code: string;
195
- message: string;
196
- hint?: string;
197
- diagnosticId?: string;
198
- logPath?: string;
199
- details?: Record<string, unknown>;
200
- };
201
-
202
- export declare type DaemonInstallSource = DaemonInstallSource_2;
203
-
204
- declare type DaemonInstallSource_2 = {
205
- kind: 'url';
206
- url: string;
207
- headers?: Record<string, string>;
208
- } | {
209
- kind: 'path';
210
- path: string;
211
- } | ({
212
- kind: 'github-actions-artifact';
213
- owner: string;
214
- repo: string;
215
- } & ({
216
- artifactId: number;
217
- } | {
218
- runId: number;
219
- artifactName: string;
220
- } | {
221
- artifactName: string;
222
- }));
223
-
224
- declare type DaemonLockPolicy = 'reject' | 'strip';
225
-
226
- export declare type DaemonRequest = Omit<DaemonRequest_2, 'token' | 'session' | 'flags' | 'meta'> & {
227
- token: string;
228
- session: string;
229
- flags?: CommandFlags;
230
- meta?: DaemonRequestMeta_2;
231
- };
232
-
233
- declare type DaemonRequest_2 = {
234
- token?: string;
235
- session?: string;
236
- command: string;
237
- positionals: string[];
238
- flags?: Record<string, unknown>;
239
- runtime?: SessionRuntimeHints_2;
240
- meta?: DaemonRequestMeta;
241
- };
242
-
243
- declare type DaemonRequestMeta = {
244
- requestId?: string;
245
- debug?: boolean;
246
- cwd?: string;
247
- tenantId?: string;
248
- runId?: string;
249
- leaseId?: string;
250
- leaseTtlMs?: number;
251
- leaseBackend?: LeaseBackend;
252
- sessionIsolation?: 'none' | 'tenant';
253
- uploadedArtifactId?: string;
254
- clientArtifactPaths?: Record<string, string>;
255
- installSource?: DaemonInstallSource_2;
256
- retainMaterializedPaths?: boolean;
257
- materializedPathRetentionMs?: number;
258
- materializationId?: string;
259
- lockPolicy?: DaemonLockPolicy;
260
- lockPlatform?: 'ios' | 'macos' | 'android' | 'linux' | 'apple';
261
- };
262
-
263
- declare type DaemonRequestMeta_2 = Omit<DaemonRequestMeta, 'installSource' | 'lockPlatform'> & {
264
- installSource?: DaemonInstallSource;
265
- lockPlatform?: PlatformSelector;
266
- leaseBackend?: LeaseBackend;
267
- };
268
-
269
- export declare type DaemonResponse = DaemonResponse_2;
270
-
271
- declare type DaemonResponse_2 = {
272
- ok: true;
273
- data?: DaemonResponseData_2;
274
- } | {
275
- ok: false;
276
- error: DaemonError;
277
- };
278
-
279
- export declare type DaemonResponseData = DaemonResponseData_2;
280
-
281
- declare type DaemonResponseData_2 = Record<string, unknown> & {
282
- artifacts?: DaemonArtifact_2[];
283
- };
284
-
285
- export declare type DeviceInfo = {
286
- platform: Platform;
287
- id: string;
288
- name: string;
289
- kind: DeviceKind;
290
- target?: DeviceTarget;
291
- booted?: boolean;
292
- simulatorSetPath?: string;
293
- };
294
-
295
- export declare type DeviceInventoryProvider = (request: DeviceInventoryRequest) => Promise<DeviceInfo[] | null | undefined>;
296
-
297
- export declare type DeviceInventoryRequest = {
298
- platform?: PlatformSelector;
299
- target?: DeviceTarget;
300
- deviceName?: string;
301
- udid?: string;
302
- serial?: string;
303
- iosSimulatorSetPath?: string;
304
- androidSerialAllowlist?: string[];
305
- };
306
-
307
- declare type DeviceKind = 'simulator' | 'emulator' | 'device';
308
-
309
- declare type DeviceTarget = 'mobile' | 'tv' | 'desktop';
310
-
311
- declare type ExecOptions = {
312
- cwd?: string;
313
- env?: NodeJS.ProcessEnv;
314
- allowFailure?: boolean;
315
- binaryStdout?: boolean;
316
- stdin?: string | Buffer;
317
- timeoutMs?: number;
318
- detached?: boolean;
319
- signal?: AbortSignal;
320
- };
321
-
322
- declare type ExecResult = {
323
- stdout: string;
324
- stderr: string;
325
- exitCode: number;
326
- stdoutBuffer?: Buffer;
327
- };
328
-
329
- export declare type HeartbeatLeaseRequest = {
330
- leaseId: string;
331
- tenantId?: string;
332
- runId?: string;
333
- ttlMs?: number;
334
- };
335
-
336
- declare type LeaseBackend = 'ios-simulator' | 'ios-instance' | 'android-instance';
337
-
338
- export declare class LeaseRegistry {
339
- private readonly leases;
340
- private readonly runBindings;
341
- private readonly maxActiveSimulatorLeases;
342
- private readonly defaultLeaseTtlMs;
343
- private readonly minLeaseTtlMs;
344
- private readonly maxLeaseTtlMs;
345
- private readonly now;
346
- constructor(options?: LeaseRegistryOptions);
347
- allocateLease(request: AllocateLeaseRequest): SimulatorLease;
348
- heartbeatLease(request: HeartbeatLeaseRequest): SimulatorLease;
349
- releaseLease(request: ReleaseLeaseRequest): {
350
- released: boolean;
351
- };
352
- assertLeaseAdmission(request: AdmissionRequest): void;
353
- listActiveLeases(): SimulatorLease[];
354
- private cleanupExpiredLeases;
355
- private enforceCapacity;
356
- private resolveLeaseTtlMs;
357
- private refreshLease;
358
- private bindingKey;
359
- private assertOptionalScopeMatch;
360
- }
361
-
362
- export declare type LeaseRegistryOptions = {
363
- maxActiveSimulatorLeases?: number;
364
- defaultLeaseTtlMs?: number;
365
- minLeaseTtlMs?: number;
366
- maxLeaseTtlMs?: number;
367
- now?: () => number;
368
- };
369
-
370
- export declare type Platform = ApplePlatform | 'android' | 'linux';
371
-
372
- export declare type PlatformSelector = Platform | 'apple';
373
-
374
- export declare function prepareDownloadableArtifact(artifactId: string, tenantId?: string): {
375
- artifactPath: string;
376
- fileName?: string;
377
- deleteAfterDownload: boolean;
378
- };
379
-
380
- export declare function prepareUploadedArtifact(uploadId: string, tenantId?: string): string;
381
-
382
- declare type RawSnapshotNode = {
383
- index: number;
384
- type?: string;
385
- role?: string;
386
- subrole?: string;
387
- label?: string;
388
- value?: string;
389
- identifier?: string;
390
- rect?: Rect;
391
- enabled?: boolean;
392
- selected?: boolean;
393
- hittable?: boolean;
394
- depth?: number;
395
- parentIndex?: number;
396
- pid?: number;
397
- bundleId?: string;
398
- appName?: string;
399
- windowTitle?: string;
400
- surface?: string;
401
- hiddenContentAbove?: boolean;
402
- hiddenContentBelow?: boolean;
403
- };
404
-
405
- declare type RecordingGestureEvent = (RecordingTelemetryBase & {
406
- kind: 'tap' | 'longpress';
407
- durationMs?: number;
408
- }) | (RecordingTelemetryTravel & {
409
- kind: 'swipe';
410
- }) | (RecordingTelemetryTravel & {
411
- kind: 'scroll';
412
- contentDirection: 'up' | 'down' | 'left' | 'right';
413
- amount?: number;
414
- pixels?: number;
415
- }) | (RecordingTelemetryTravel & {
416
- kind: 'back-swipe';
417
- edge: 'left' | 'right';
418
- }) | (RecordingTelemetryBase & {
419
- kind: 'pinch';
420
- scale: number;
421
- durationMs: number;
422
- });
423
-
424
- declare type RecordingTelemetryBase = {
425
- tMs: number;
426
- x: number;
427
- y: number;
428
- referenceWidth?: number;
429
- referenceHeight?: number;
430
- };
431
-
432
- declare type RecordingTelemetryTravel = RecordingTelemetryBase & {
433
- x2: number;
434
- y2: number;
435
- durationMs: number;
436
- };
437
-
438
- declare type Rect = {
439
- x: number;
440
- y: number;
441
- width: number;
442
- height: number;
443
- };
444
-
445
- export declare type ReleaseLeaseRequest = {
446
- leaseId: string;
447
- tenantId?: string;
448
- runId?: string;
449
- };
450
-
451
- export declare type RequestRouterDeps = {
452
- logPath: string;
453
- token: string;
454
- sessionStore: SessionStore;
455
- leaseRegistry: LeaseRegistry;
456
- androidAdbProvider?: AndroidAdbProviderResolver;
457
- deviceInventoryProvider?: DeviceInventoryProvider;
458
- trackDownloadableArtifact: (opts: {
459
- artifactPath: string;
460
- tenantId?: string;
461
- fileName?: string;
462
- }) => string;
463
- };
464
-
465
- declare type SessionAction = {
466
- ts: number;
467
- command: string;
468
- positionals: string[];
469
- runtime?: SessionRuntimeHints;
470
- flags: Partial<CommandFlags> & {
471
- snapshotInteractiveOnly?: boolean;
472
- snapshotCompact?: boolean;
473
- snapshotDepth?: number;
474
- snapshotScope?: string;
475
- snapshotRaw?: boolean;
476
- saveScript?: boolean | string;
477
- noRecord?: boolean;
478
- };
479
- result?: Record<string, unknown>;
480
- };
481
-
482
- declare type SessionRecordingBase = {
483
- outPath: string;
484
- clientOutPath?: string;
485
- telemetryPath?: string;
486
- overlayWarning?: string;
487
- startedAt: number;
488
- quality?: number;
489
- showTouches: boolean;
490
- gestureEvents: RecordingGestureEvent[];
491
- touchReferenceFrame?: {
492
- referenceWidth: number;
493
- referenceHeight: number;
494
- };
495
- gestureClockOriginAtMs?: number;
496
- gestureClockOriginUptimeMs?: number;
497
- runnerSessionId?: string;
498
- invalidatedReason?: string;
499
- };
500
-
501
- export declare type SessionRuntimeHints = SessionRuntimeHints_2;
502
-
503
- declare type SessionRuntimeHints_2 = {
504
- platform?: 'ios' | 'android';
505
- metroHost?: string;
506
- metroPort?: number;
507
- bundleUrl?: string;
508
- launchUrl?: string;
509
- };
510
-
511
- export declare type SessionState = {
512
- name: string;
513
- device: DeviceInfo;
514
- createdAt: number;
515
- surface?: SessionSurface;
516
- appBundleId?: string;
517
- appName?: string;
518
- snapshot?: SnapshotState;
519
- /** Source snapshot used to resolve repeated `snapshot -s @ref` after scoped output replaces refs. */
520
- snapshotScopeSource?: SnapshotState;
521
- androidSnapshotFreshness?: AndroidSnapshotFreshness;
522
- trace?: {
523
- outPath: string;
524
- startedAt: number;
525
- };
526
- recordSession?: boolean;
527
- saveScriptPath?: string;
528
- actions: SessionAction[];
529
- recording?: (SessionRecordingBase & {
530
- platform: 'ios';
531
- child: ReturnType<spawn>;
532
- wait: Promise<ExecResult>;
533
- remotePath?: string;
534
- }) | (SessionRecordingBase & {
535
- platform: 'android';
536
- remotePath: string;
537
- remotePid: string;
538
- }) | (SessionRecordingBase & {
539
- platform: 'ios-device-runner';
540
- remotePath: string;
541
- runnerStartedAtUptimeMs?: number;
542
- targetAppReadyUptimeMs?: number;
543
- }) | (SessionRecordingBase & {
544
- platform: 'macos-runner';
545
- remotePath?: string;
546
- });
547
- /** Session-scoped app log stream; logs written to outPath for agent to grep */
548
- appLog?: {
549
- platform: Platform;
550
- backend: 'ios-simulator' | 'ios-device' | 'android' | 'macos';
551
- outPath: string;
552
- startedAt: number;
553
- getState: () => AppLogState;
554
- stop: () => Promise<void>;
555
- wait: Promise<ExecResult>;
556
- };
557
- };
558
-
559
- export declare class SessionStore {
560
- private readonly sessions;
561
- private readonly runtimeHints;
562
- private readonly sessionsDir;
563
- constructor(sessionsDir: string);
564
- get(name: string): SessionState | undefined;
565
- has(name: string): boolean;
566
- set(name: string, session: SessionState): void;
567
- delete(name: string): boolean;
568
- values(): IterableIterator<SessionState>;
569
- toArray(): SessionState[];
570
- getRuntimeHints(name: string): SessionRuntimeHints | undefined;
571
- setRuntimeHints(name: string, hints: SessionRuntimeHints): void;
572
- clearRuntimeHints(name: string): boolean;
573
- recordAction(session: SessionState, entry: {
574
- command: string;
575
- positionals: string[];
576
- flags: CommandFlags;
577
- runtime?: SessionRuntimeHints;
578
- result?: Record<string, unknown>;
579
- }): void;
580
- writeSessionLog(session: SessionState): void;
581
- defaultTracePath(session: SessionState): string;
582
- /** Path to session-scoped app log file. Agent can grep this for token-efficient debugging. */
583
- resolveAppLogPath(sessionName: string): string;
584
- resolveAppLogPidPath(sessionName: string): string;
585
- static safeSessionName(name: string): string;
586
- static expandHome(filePath: string, cwd?: string): string;
587
- private resolveScriptPath;
588
- private buildOptimizedActions;
589
- }
590
-
591
- declare type SessionSurface = 'app' | 'frontmost-app' | 'desktop' | 'menubar';
592
-
593
- export declare type SimulatorLease = {
594
- leaseId: string;
595
- tenantId: string;
596
- runId: string;
597
- backend: LeaseBackend;
598
- createdAt: number;
599
- heartbeatAt: number;
600
- expiresAt: number;
601
- };
602
-
603
- declare type SnapshotBackend = 'xctest' | 'android' | 'macos-helper' | 'linux-atspi';
604
-
605
- declare type SnapshotNode = RawSnapshotNode & {
606
- ref: string;
607
- };
608
-
609
- declare type SnapshotState = {
610
- nodes: SnapshotNode[];
611
- createdAt: number;
612
- truncated?: boolean;
613
- backend?: SnapshotBackend;
614
- comparisonSafe?: boolean;
615
- };
616
-
617
- export declare function trackDownloadableArtifact(params: {
618
- artifactPath: string;
619
- tenantId?: string;
620
- fileName?: string;
621
- deleteAfterDownload?: boolean;
622
- }): string;
623
-
624
- export declare function trackUploadedArtifact(params: {
625
- artifactPath: string;
626
- tempDir: string;
627
- tenantId?: string;
628
- }): string;
629
-
630
- export declare function withDeviceInventoryProvider<T>(provider: DeviceInventoryProvider | undefined, task: () => Promise<T>): Promise<T>;
631
-
632
- export { }
@@ -1 +0,0 @@
1
- export{LeaseRegistry,SessionStore,cleanupDownloadableArtifact,cleanupUploadedArtifact,createRequestHandler,prepareDownloadableArtifact,prepareUploadedArtifact,trackDownloadableArtifact,trackUploadedArtifact}from"./6479.js";export{withDeviceInventoryProvider}from"./2007.js";