agent-device 0.12.3 → 0.12.5
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/dist/src/152.js +1 -1
- package/dist/src/320.js +1 -1
- package/dist/src/57.js +1 -1
- package/dist/src/641.js +38 -0
- package/dist/src/818.js +1 -1
- package/dist/src/974.js +2 -2
- package/dist/src/backend.d.ts +205 -0
- package/dist/src/backend.js +1 -0
- package/dist/src/bin.js +63 -63
- package/dist/src/commands/index.d.ts +908 -0
- package/dist/src/commands/index.js +1 -0
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/daemon.js +15 -15
- package/dist/src/index.d.ts +898 -3
- package/dist/src/index.js +3 -3
- package/dist/src/io.d.ts +85 -0
- package/dist/src/io.js +1 -0
- package/dist/src/metro-companion.js +1 -1
- package/dist/src/metro.d.ts +10 -0
- package/dist/src/metro.js +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/testing/conformance.d.ts +416 -0
- package/dist/src/testing/conformance.js +1 -0
- package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +12 -3
- package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +1 -0
- package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +24 -5
- package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +2 -0
- package/ios-runner/AgentDeviceRunner/RecordingScripts/recording-resize.swift +182 -0
- package/ios-runner/RUNNER_PROTOCOL.md +1 -1
- package/package.json +17 -1
- package/skills/agent-device/references/bootstrap-install.md +13 -0
- package/skills/agent-device/references/remote-tenancy.md +15 -0
- package/skills/agent-device/references/verification.md +1 -0
- package/dist/src/155.js +0 -38
- package/dist/src/940.js +0 -1
|
@@ -0,0 +1,908 @@
|
|
|
1
|
+
declare type AgentDeviceBackend = {
|
|
2
|
+
platform: AgentDeviceBackendPlatform;
|
|
3
|
+
capabilities?: BackendCapabilitySet;
|
|
4
|
+
escapeHatches?: BackendEscapeHatches;
|
|
5
|
+
captureSnapshot?(context: BackendCommandContext, options?: BackendSnapshotOptions): Promise<BackendSnapshotResult>;
|
|
6
|
+
captureScreenshot?(context: BackendCommandContext, outPath: string, options?: BackendScreenshotOptions): Promise<BackendScreenshotResult | void>;
|
|
7
|
+
readText?(context: BackendCommandContext, node: SnapshotNode): Promise<BackendReadTextResult>;
|
|
8
|
+
findText?(context: BackendCommandContext, text: string): Promise<BackendFindTextResult>;
|
|
9
|
+
tap?(context: BackendCommandContext, point: Point, options?: BackendTapOptions): Promise<BackendActionResult>;
|
|
10
|
+
fill?(context: BackendCommandContext, point: Point, text: string, options?: BackendFillOptions): Promise<BackendActionResult>;
|
|
11
|
+
typeText?(context: BackendCommandContext, text: string, options?: {
|
|
12
|
+
delayMs?: number;
|
|
13
|
+
}): Promise<BackendActionResult>;
|
|
14
|
+
pressKey?(context: BackendCommandContext, key: string, options?: {
|
|
15
|
+
modifiers?: string[];
|
|
16
|
+
}): Promise<BackendActionResult>;
|
|
17
|
+
openApp?(context: BackendCommandContext, target: BackendOpenTarget): Promise<BackendActionResult>;
|
|
18
|
+
closeApp?(context: BackendCommandContext, app?: string): Promise<BackendActionResult>;
|
|
19
|
+
installApp?(context: BackendCommandContext, target: BackendInstallTarget): Promise<BackendActionResult>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
declare type AgentDeviceBackendPlatform = 'ios' | 'android' | 'macos' | 'linux';
|
|
23
|
+
|
|
24
|
+
export declare type AgentDeviceCommands = {
|
|
25
|
+
capture: {
|
|
26
|
+
screenshot: RuntimeCommand<ScreenshotCommandOptions, ScreenshotCommandResult>;
|
|
27
|
+
diffScreenshot: RuntimeCommand<DiffScreenshotCommandOptions, DiffScreenshotCommandResult>;
|
|
28
|
+
snapshot: RuntimeCommand<SnapshotCommandOptions, SnapshotCommandResult>;
|
|
29
|
+
diffSnapshot: RuntimeCommand<DiffSnapshotCommandOptions, DiffSnapshotCommandResult>;
|
|
30
|
+
};
|
|
31
|
+
selectors: {
|
|
32
|
+
find: RuntimeCommand<FindReadCommandOptions, FindReadCommandResult>;
|
|
33
|
+
get: RuntimeCommand<GetCommandOptions, GetCommandResult>;
|
|
34
|
+
getText: RuntimeCommand<GetTextCommandOptions, Extract<GetCommandResult, {
|
|
35
|
+
kind: 'text';
|
|
36
|
+
}>>;
|
|
37
|
+
getAttrs: RuntimeCommand<GetAttrsCommandOptions, Extract<GetCommandResult, {
|
|
38
|
+
kind: 'attrs';
|
|
39
|
+
}>>;
|
|
40
|
+
is: RuntimeCommand<IsCommandOptions, IsCommandResult>;
|
|
41
|
+
isVisible: RuntimeCommand<IsSelectorCommandOptions, IsCommandResult>;
|
|
42
|
+
isHidden: RuntimeCommand<IsSelectorCommandOptions, IsCommandResult>;
|
|
43
|
+
wait: RuntimeCommand<WaitCommandOptions, WaitCommandResult>;
|
|
44
|
+
waitForText: RuntimeCommand<WaitForTextCommandOptions, Extract<WaitCommandResult, {
|
|
45
|
+
kind: 'text';
|
|
46
|
+
}>>;
|
|
47
|
+
};
|
|
48
|
+
interactions: {
|
|
49
|
+
click: RuntimeCommand<ClickCommandOptions, PressCommandResult>;
|
|
50
|
+
press: RuntimeCommand<PressCommandOptions, PressCommandResult>;
|
|
51
|
+
fill: RuntimeCommand<FillCommandOptions, FillCommandResult>;
|
|
52
|
+
typeText: RuntimeCommand<TypeTextCommandOptions, TypeTextCommandResult>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
declare type AgentDeviceRuntime = {
|
|
57
|
+
backend: AgentDeviceBackend;
|
|
58
|
+
artifacts: ArtifactAdapter;
|
|
59
|
+
sessions: CommandSessionStore;
|
|
60
|
+
policy: CommandPolicy;
|
|
61
|
+
diagnostics?: DiagnosticsSink;
|
|
62
|
+
clock?: CommandClock;
|
|
63
|
+
signal?: AbortSignal;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
declare type ArtifactAdapter = {
|
|
67
|
+
resolveInput(ref: FileInputRef, options: ResolveInputOptions): Promise<ResolvedInputFile>;
|
|
68
|
+
reserveOutput(ref: FileOutputRef | undefined, options: ReserveOutputOptions): Promise<ReservedOutputFile>;
|
|
69
|
+
createTempFile(options: CreateTempFileOptions): Promise<TemporaryFile>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
declare type ArtifactDescriptor = {
|
|
73
|
+
kind: 'localPath';
|
|
74
|
+
field: string;
|
|
75
|
+
path: string;
|
|
76
|
+
fileName?: string;
|
|
77
|
+
metadata?: Record<string, unknown>;
|
|
78
|
+
} | {
|
|
79
|
+
kind: 'artifact';
|
|
80
|
+
field: string;
|
|
81
|
+
artifactId: string;
|
|
82
|
+
fileName?: string;
|
|
83
|
+
url?: string;
|
|
84
|
+
clientPath?: string;
|
|
85
|
+
metadata?: Record<string, unknown>;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
declare const BACKEND_CAPABILITY_NAMES: readonly ["android.shell", "ios.runnerCommand", "macos.desktopScreenshot"];
|
|
89
|
+
|
|
90
|
+
declare type BackendActionResult = Record<string, unknown> | void;
|
|
91
|
+
|
|
92
|
+
declare type BackendCapabilityName = (typeof BACKEND_CAPABILITY_NAMES)[number];
|
|
93
|
+
|
|
94
|
+
declare type BackendCapabilitySet = readonly BackendCapabilityName[];
|
|
95
|
+
|
|
96
|
+
declare type BackendCommandContext = {
|
|
97
|
+
session?: string;
|
|
98
|
+
requestId?: string;
|
|
99
|
+
appId?: string;
|
|
100
|
+
appBundleId?: string;
|
|
101
|
+
signal?: AbortSignal;
|
|
102
|
+
metadata?: Record<string, unknown>;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
declare type BackendEscapeHatches = {
|
|
106
|
+
androidShell?(context: BackendCommandContext, args: readonly string[]): Promise<BackendShellResult>;
|
|
107
|
+
iosRunnerCommand?(context: BackendCommandContext, command: BackendRunnerCommand): Promise<BackendActionResult>;
|
|
108
|
+
macosDesktopScreenshot?(context: BackendCommandContext, outPath: string, options?: BackendScreenshotOptions): Promise<BackendScreenshotResult | void>;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
declare type BackendFillOptions = {
|
|
112
|
+
delayMs?: number;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
declare type BackendFindTextResult = {
|
|
116
|
+
found: boolean;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
declare type BackendInstallTarget = {
|
|
120
|
+
app: string;
|
|
121
|
+
artifactPath: string;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
declare type BackendOpenTarget = {
|
|
125
|
+
app?: string;
|
|
126
|
+
url?: string;
|
|
127
|
+
activity?: string;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
declare type BackendReadTextResult = {
|
|
131
|
+
text: string;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
declare type BackendRunnerCommand = {
|
|
135
|
+
command: string;
|
|
136
|
+
args?: readonly string[];
|
|
137
|
+
payload?: Record<string, unknown>;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
declare type BackendScreenshotOptions = {
|
|
141
|
+
fullscreen?: boolean;
|
|
142
|
+
overlayRefs?: boolean;
|
|
143
|
+
surface?: 'app' | 'frontmost-app' | 'desktop' | 'menubar';
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
declare type BackendScreenshotResult = {
|
|
147
|
+
path?: string;
|
|
148
|
+
overlayRefs?: ScreenshotOverlayRef[];
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
declare type BackendShellResult = {
|
|
152
|
+
exitCode: number;
|
|
153
|
+
stdout: string;
|
|
154
|
+
stderr: string;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
declare type BackendSnapshotAnalysis = {
|
|
158
|
+
rawNodeCount?: number;
|
|
159
|
+
maxDepth?: number;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
declare type BackendSnapshotFreshness = {
|
|
163
|
+
action: string;
|
|
164
|
+
retryCount: number;
|
|
165
|
+
staleAfterRetries: boolean;
|
|
166
|
+
reason?: 'empty-interactive' | 'sharp-drop' | 'stuck-route';
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
declare type BackendSnapshotOptions = SnapshotOptions & {
|
|
170
|
+
outPath?: string;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
declare type BackendSnapshotResult = {
|
|
174
|
+
nodes?: SnapshotNode[];
|
|
175
|
+
truncated?: boolean;
|
|
176
|
+
backend?: string;
|
|
177
|
+
snapshot?: SnapshotState;
|
|
178
|
+
analysis?: BackendSnapshotAnalysis;
|
|
179
|
+
freshness?: BackendSnapshotFreshness;
|
|
180
|
+
warnings?: string[];
|
|
181
|
+
appName?: string;
|
|
182
|
+
appBundleId?: string;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
declare type BackendTapOptions = {
|
|
186
|
+
button?: 'primary' | 'secondary' | 'middle';
|
|
187
|
+
count?: number;
|
|
188
|
+
intervalMs?: number;
|
|
189
|
+
holdMs?: number;
|
|
190
|
+
jitterPx?: number;
|
|
191
|
+
doubleTap?: boolean;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export declare function bindCommands(runtime: AgentDeviceRuntime): BoundAgentDeviceCommands;
|
|
195
|
+
|
|
196
|
+
export declare type BoundAgentDeviceCommands = {
|
|
197
|
+
capture: {
|
|
198
|
+
screenshot: BoundRuntimeCommand<ScreenshotCommandOptions, ScreenshotCommandResult>;
|
|
199
|
+
diffScreenshot: BoundRuntimeCommand<DiffScreenshotCommandOptions, DiffScreenshotCommandResult>;
|
|
200
|
+
snapshot: BoundRuntimeCommand<SnapshotCommandOptions, SnapshotCommandResult>;
|
|
201
|
+
diffSnapshot: BoundRuntimeCommand<DiffSnapshotCommandOptions, DiffSnapshotCommandResult>;
|
|
202
|
+
};
|
|
203
|
+
selectors: {
|
|
204
|
+
find: BoundRuntimeCommand<FindReadCommandOptions, FindReadCommandResult>;
|
|
205
|
+
get: BoundRuntimeCommand<GetCommandOptions, GetCommandResult>;
|
|
206
|
+
getText: (target: ElementTarget, options?: Omit<GetTextCommandOptions, 'target'>) => Promise<Extract<GetCommandResult, {
|
|
207
|
+
kind: 'text';
|
|
208
|
+
}>>;
|
|
209
|
+
getAttrs: (target: ElementTarget, options?: Omit<GetAttrsCommandOptions, 'target'>) => Promise<Extract<GetCommandResult, {
|
|
210
|
+
kind: 'attrs';
|
|
211
|
+
}>>;
|
|
212
|
+
is: BoundRuntimeCommand<IsCommandOptions, IsCommandResult>;
|
|
213
|
+
isVisible: (target: SelectorTarget, options?: Omit<IsSelectorCommandOptions, 'target'>) => Promise<IsCommandResult>;
|
|
214
|
+
isHidden: (target: SelectorTarget, options?: Omit<IsSelectorCommandOptions, 'target'>) => Promise<IsCommandResult>;
|
|
215
|
+
wait: BoundRuntimeCommand<WaitCommandOptions, WaitCommandResult>;
|
|
216
|
+
waitForText: (text: string, options?: Omit<WaitForTextCommandOptions, 'text'>) => Promise<Extract<WaitCommandResult, {
|
|
217
|
+
kind: 'text';
|
|
218
|
+
}>>;
|
|
219
|
+
};
|
|
220
|
+
interactions: {
|
|
221
|
+
click: (target: InteractionTarget, options?: Omit<ClickCommandOptions, 'target'>) => Promise<PressCommandResult>;
|
|
222
|
+
press: (target: InteractionTarget, options?: Omit<PressCommandOptions, 'target'>) => Promise<PressCommandResult>;
|
|
223
|
+
fill: (target: InteractionTarget, text: string, options?: Omit<FillCommandOptions, 'target' | 'text'>) => Promise<FillCommandResult>;
|
|
224
|
+
typeText: (text: string, options?: Omit<TypeTextCommandOptions, 'text'>) => Promise<TypeTextCommandResult>;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export declare type BoundRuntimeCommand<TOptions = Record<string, unknown>, TResult = CommandResult> = (options: TOptions) => Promise<TResult>;
|
|
229
|
+
|
|
230
|
+
export declare type ClickCommandOptions = PressCommandOptions;
|
|
231
|
+
|
|
232
|
+
export declare const commandCatalog: readonly CommandCatalogEntry[];
|
|
233
|
+
|
|
234
|
+
export declare type CommandCatalogEntry = {
|
|
235
|
+
command: string;
|
|
236
|
+
category: 'portable-runtime' | 'backend-admin' | 'transport-session' | 'environment' | 'capability-gated';
|
|
237
|
+
status: 'implemented' | 'planned';
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
declare type CommandClock = {
|
|
241
|
+
now(): number;
|
|
242
|
+
sleep(ms: number): Promise<void>;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
declare type CommandContext = {
|
|
246
|
+
session?: string;
|
|
247
|
+
requestId?: string;
|
|
248
|
+
signal?: AbortSignal;
|
|
249
|
+
metadata?: Record<string, unknown>;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
declare type CommandPolicy = {
|
|
253
|
+
allowLocalInputPaths: boolean;
|
|
254
|
+
allowLocalOutputPaths: boolean;
|
|
255
|
+
maxImagePixels: number;
|
|
256
|
+
allowNamedBackendCapabilities: readonly BackendCapabilityName[];
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export declare type CommandResult = Record<string, unknown>;
|
|
260
|
+
|
|
261
|
+
export declare type CommandRouter<TContext = unknown> = {
|
|
262
|
+
dispatch(request: CommandRouterRequest<TContext>): Promise<CommandRouterResponse>;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export declare type CommandRouterConfig<TContext = unknown> = {
|
|
266
|
+
createRuntime(request: CommandRouterRequest<TContext>): AgentDeviceRuntime | Promise<AgentDeviceRuntime>;
|
|
267
|
+
beforeDispatch?(request: CommandRouterRequest<TContext>): void | Promise<void>;
|
|
268
|
+
formatError?(error: unknown, request: CommandRouterRequest<TContext>): NormalizedError;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export declare type CommandRouterRequest<TContext = unknown> = {
|
|
272
|
+
command: 'capture.screenshot';
|
|
273
|
+
options: ScreenshotCommandOptions;
|
|
274
|
+
context?: TContext;
|
|
275
|
+
} | {
|
|
276
|
+
command: 'capture.diffScreenshot';
|
|
277
|
+
options: DiffScreenshotCommandOptions;
|
|
278
|
+
context?: TContext;
|
|
279
|
+
} | {
|
|
280
|
+
command: 'capture.snapshot';
|
|
281
|
+
options: SnapshotCommandOptions;
|
|
282
|
+
context?: TContext;
|
|
283
|
+
} | {
|
|
284
|
+
command: 'capture.diffSnapshot';
|
|
285
|
+
options: DiffSnapshotCommandOptions;
|
|
286
|
+
context?: TContext;
|
|
287
|
+
} | {
|
|
288
|
+
command: 'selectors.find';
|
|
289
|
+
options: FindReadCommandOptions;
|
|
290
|
+
context?: TContext;
|
|
291
|
+
} | {
|
|
292
|
+
command: 'selectors.get';
|
|
293
|
+
options: GetCommandOptions;
|
|
294
|
+
context?: TContext;
|
|
295
|
+
} | {
|
|
296
|
+
command: 'selectors.is';
|
|
297
|
+
options: IsCommandOptions;
|
|
298
|
+
context?: TContext;
|
|
299
|
+
} | {
|
|
300
|
+
command: 'selectors.wait';
|
|
301
|
+
options: WaitCommandOptions;
|
|
302
|
+
context?: TContext;
|
|
303
|
+
} | {
|
|
304
|
+
command: 'interactions.click';
|
|
305
|
+
options: ClickCommandOptions;
|
|
306
|
+
context?: TContext;
|
|
307
|
+
} | {
|
|
308
|
+
command: 'interactions.press';
|
|
309
|
+
options: PressCommandOptions;
|
|
310
|
+
context?: TContext;
|
|
311
|
+
} | {
|
|
312
|
+
command: 'interactions.fill';
|
|
313
|
+
options: FillCommandOptions;
|
|
314
|
+
context?: TContext;
|
|
315
|
+
} | {
|
|
316
|
+
command: 'interactions.typeText';
|
|
317
|
+
options: TypeTextCommandOptions;
|
|
318
|
+
context?: TContext;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
export declare type CommandRouterResponse = {
|
|
322
|
+
ok: true;
|
|
323
|
+
data: CommandRouterResult;
|
|
324
|
+
} | {
|
|
325
|
+
ok: false;
|
|
326
|
+
error: NormalizedError;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
export declare type CommandRouterResult = ScreenshotCommandResult | DiffScreenshotCommandResult | SnapshotCommandResult | DiffSnapshotCommandResult | FindReadCommandResult | GetCommandResult | IsCommandResult | WaitCommandResult | PressCommandResult | FillCommandResult | TypeTextCommandResult;
|
|
330
|
+
|
|
331
|
+
export declare const commands: AgentDeviceCommands;
|
|
332
|
+
|
|
333
|
+
declare type CommandSessionRecord = {
|
|
334
|
+
name: string;
|
|
335
|
+
appId?: string;
|
|
336
|
+
appBundleId?: string;
|
|
337
|
+
appName?: string;
|
|
338
|
+
backendSessionId?: string;
|
|
339
|
+
snapshot?: SnapshotState;
|
|
340
|
+
metadata?: Record<string, unknown>;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
declare type CommandSessionStore = {
|
|
344
|
+
get(name: string): CommandSessionRecord | undefined | Promise<CommandSessionRecord | undefined>;
|
|
345
|
+
set(record: CommandSessionRecord): void | Promise<void>;
|
|
346
|
+
delete?(name: string): void | Promise<void>;
|
|
347
|
+
list?(): readonly CommandSessionRecord[] | Promise<readonly CommandSessionRecord[]>;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export declare function createCommandRouter<TContext = unknown>(config: CommandRouterConfig<TContext>): CommandRouter<TContext>;
|
|
351
|
+
|
|
352
|
+
declare type CreateTempFileOptions = {
|
|
353
|
+
prefix: string;
|
|
354
|
+
ext: string;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
declare type DiagnosticsSink = {
|
|
358
|
+
emit(event: {
|
|
359
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
360
|
+
message: string;
|
|
361
|
+
data?: unknown;
|
|
362
|
+
}): void;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
export declare type DiffScreenshotCommandOptions = CommandContext & {
|
|
366
|
+
baseline: FileInputRef;
|
|
367
|
+
current?: FileInputRef | LiveScreenshotInputRef;
|
|
368
|
+
out?: FileOutputRef;
|
|
369
|
+
currentOverlayOut?: FileOutputRef;
|
|
370
|
+
threshold?: number;
|
|
371
|
+
overlayRefs?: boolean;
|
|
372
|
+
surface?: BackendScreenshotOptions['surface'];
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
export declare type DiffScreenshotCommandResult = ScreenshotDiffResult & {
|
|
376
|
+
artifacts?: ArtifactDescriptor[];
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
export declare type DiffSnapshotCommandOptions = SnapshotCommandOptions;
|
|
380
|
+
|
|
381
|
+
export declare type DiffSnapshotCommandResult = {
|
|
382
|
+
mode: 'snapshot';
|
|
383
|
+
baselineInitialized: boolean;
|
|
384
|
+
summary: SnapshotDiffSummary;
|
|
385
|
+
lines: SnapshotDiffLine[];
|
|
386
|
+
warnings?: string[];
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
export declare type ElementTarget = SelectorTarget | RefTarget;
|
|
390
|
+
|
|
391
|
+
declare type FileInputRef = {
|
|
392
|
+
kind: 'path';
|
|
393
|
+
path: string;
|
|
394
|
+
} | {
|
|
395
|
+
kind: 'uploadedArtifact';
|
|
396
|
+
id: string;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
declare type FileOutputRef = {
|
|
400
|
+
kind: 'path';
|
|
401
|
+
path: string;
|
|
402
|
+
} | {
|
|
403
|
+
kind: 'downloadableArtifact';
|
|
404
|
+
clientPath?: string;
|
|
405
|
+
fileName?: string;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
export declare type FillCommandOptions = CommandContext & {
|
|
409
|
+
target: InteractionTarget;
|
|
410
|
+
text: string;
|
|
411
|
+
delayMs?: number;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
export declare type FillCommandResult = ResolvedInteractionTarget & {
|
|
415
|
+
text: string;
|
|
416
|
+
warning?: string;
|
|
417
|
+
backendResult?: Record<string, unknown>;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
declare type FindAction = {
|
|
421
|
+
kind: 'click';
|
|
422
|
+
} | {
|
|
423
|
+
kind: 'focus';
|
|
424
|
+
} | {
|
|
425
|
+
kind: 'fill';
|
|
426
|
+
value: string;
|
|
427
|
+
} | {
|
|
428
|
+
kind: 'type';
|
|
429
|
+
value: string;
|
|
430
|
+
} | {
|
|
431
|
+
kind: 'get_text';
|
|
432
|
+
} | {
|
|
433
|
+
kind: 'get_attrs';
|
|
434
|
+
} | {
|
|
435
|
+
kind: 'exists';
|
|
436
|
+
} | {
|
|
437
|
+
kind: 'wait';
|
|
438
|
+
timeoutMs?: number;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
declare type FindLocator = 'any' | 'text' | 'label' | 'value' | 'role' | 'id';
|
|
442
|
+
|
|
443
|
+
export declare type FindReadCommandOptions = CommandContext & {
|
|
444
|
+
locator?: FindLocator;
|
|
445
|
+
query: string;
|
|
446
|
+
action: Extract<FindAction['kind'], 'exists' | 'wait' | 'get_text' | 'get_attrs'>;
|
|
447
|
+
timeoutMs?: number;
|
|
448
|
+
} & SelectorSnapshotOptions;
|
|
449
|
+
|
|
450
|
+
export declare type FindReadCommandResult = {
|
|
451
|
+
kind: 'found';
|
|
452
|
+
found: true;
|
|
453
|
+
waitedMs?: number;
|
|
454
|
+
} | {
|
|
455
|
+
kind: 'text';
|
|
456
|
+
ref: string;
|
|
457
|
+
text: string;
|
|
458
|
+
node: SnapshotNode;
|
|
459
|
+
} | {
|
|
460
|
+
kind: 'attrs';
|
|
461
|
+
ref: string;
|
|
462
|
+
node: SnapshotNode;
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
export declare type GetAttrsCommandOptions = CommandContext & SelectorSnapshotOptions & {
|
|
466
|
+
target: ElementTarget;
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
export declare type GetCommandOptions = CommandContext & SelectorSnapshotOptions & {
|
|
470
|
+
property: 'text' | 'attrs';
|
|
471
|
+
target: ElementTarget;
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
export declare type GetCommandResult = {
|
|
475
|
+
kind: 'text';
|
|
476
|
+
target: ResolvedTarget;
|
|
477
|
+
text: string;
|
|
478
|
+
node: SnapshotNode;
|
|
479
|
+
selectorChain?: string[];
|
|
480
|
+
} | {
|
|
481
|
+
kind: 'attrs';
|
|
482
|
+
target: ResolvedTarget;
|
|
483
|
+
node: SnapshotNode;
|
|
484
|
+
selectorChain?: string[];
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
export declare type GetTextCommandOptions = CommandContext & SelectorSnapshotOptions & {
|
|
488
|
+
target: ElementTarget;
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
export declare type InteractionTarget = ElementTarget | PointTarget;
|
|
492
|
+
|
|
493
|
+
export declare type IsCommandOptions = CommandContext & SelectorSnapshotOptions & {
|
|
494
|
+
predicate: 'visible' | 'hidden' | 'exists' | 'editable' | 'selected' | 'text';
|
|
495
|
+
selector: string;
|
|
496
|
+
expectedText?: string;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
export declare type IsCommandResult = {
|
|
500
|
+
predicate: IsCommandOptions['predicate'];
|
|
501
|
+
pass: true;
|
|
502
|
+
selector: string;
|
|
503
|
+
matches?: number;
|
|
504
|
+
text?: string;
|
|
505
|
+
selectorChain?: string[];
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
export declare type IsSelectorCommandOptions = CommandContext & SelectorSnapshotOptions & {
|
|
509
|
+
target: SelectorTarget;
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
export declare type LiveScreenshotInputRef = {
|
|
513
|
+
kind: 'live';
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
declare type NormalizedError = {
|
|
517
|
+
code: string;
|
|
518
|
+
message: string;
|
|
519
|
+
hint?: string;
|
|
520
|
+
diagnosticId?: string;
|
|
521
|
+
logPath?: string;
|
|
522
|
+
details?: Record<string, unknown>;
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
declare type OutputVisibility = 'client-visible' | 'internal';
|
|
526
|
+
|
|
527
|
+
declare type Point = {
|
|
528
|
+
x: number;
|
|
529
|
+
y: number;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
export declare type PointTarget = {
|
|
533
|
+
kind: 'point';
|
|
534
|
+
x: number;
|
|
535
|
+
y: number;
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
export declare type PressCommandOptions = CommandContext & {
|
|
539
|
+
target: InteractionTarget;
|
|
540
|
+
button?: 'primary' | 'secondary' | 'middle';
|
|
541
|
+
count?: number;
|
|
542
|
+
intervalMs?: number;
|
|
543
|
+
holdMs?: number;
|
|
544
|
+
jitterPx?: number;
|
|
545
|
+
doubleTap?: boolean;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
export declare type PressCommandResult = ResolvedInteractionTarget & {
|
|
549
|
+
backendResult?: Record<string, unknown>;
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
declare type RawSnapshotNode = {
|
|
553
|
+
index: number;
|
|
554
|
+
type?: string;
|
|
555
|
+
role?: string;
|
|
556
|
+
subrole?: string;
|
|
557
|
+
label?: string;
|
|
558
|
+
value?: string;
|
|
559
|
+
identifier?: string;
|
|
560
|
+
rect?: Rect;
|
|
561
|
+
enabled?: boolean;
|
|
562
|
+
selected?: boolean;
|
|
563
|
+
hittable?: boolean;
|
|
564
|
+
depth?: number;
|
|
565
|
+
parentIndex?: number;
|
|
566
|
+
pid?: number;
|
|
567
|
+
bundleId?: string;
|
|
568
|
+
appName?: string;
|
|
569
|
+
windowTitle?: string;
|
|
570
|
+
surface?: string;
|
|
571
|
+
hiddenContentAbove?: boolean;
|
|
572
|
+
hiddenContentBelow?: boolean;
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
declare type Rect = {
|
|
576
|
+
x: number;
|
|
577
|
+
y: number;
|
|
578
|
+
width: number;
|
|
579
|
+
height: number;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
export declare function ref(refInput: string, options?: {
|
|
583
|
+
fallbackLabel?: string;
|
|
584
|
+
}): RefTarget;
|
|
585
|
+
|
|
586
|
+
export declare type RefTarget = {
|
|
587
|
+
kind: 'ref';
|
|
588
|
+
ref: string;
|
|
589
|
+
fallbackLabel?: string;
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
declare type ReservedOutputFile = {
|
|
593
|
+
path: string;
|
|
594
|
+
visibility: OutputVisibility;
|
|
595
|
+
publish: () => Promise<ArtifactDescriptor | undefined>;
|
|
596
|
+
cleanup?: () => Promise<void>;
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
declare type ReserveOutputOptions = {
|
|
600
|
+
field: string;
|
|
601
|
+
ext: string;
|
|
602
|
+
requestedClientPath?: string;
|
|
603
|
+
visibility?: OutputVisibility;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
declare type ResolvedInputFile = {
|
|
607
|
+
path: string;
|
|
608
|
+
cleanup?: () => Promise<void>;
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
declare type ResolvedInteractionTarget = {
|
|
612
|
+
kind: 'point';
|
|
613
|
+
point: Point;
|
|
614
|
+
} | {
|
|
615
|
+
kind: 'ref';
|
|
616
|
+
point: Point;
|
|
617
|
+
target: Extract<ResolvedTarget, {
|
|
618
|
+
kind: 'ref';
|
|
619
|
+
}>;
|
|
620
|
+
node: SnapshotNode;
|
|
621
|
+
selectorChain: string[];
|
|
622
|
+
refLabel?: string;
|
|
623
|
+
} | {
|
|
624
|
+
kind: 'selector';
|
|
625
|
+
point: Point;
|
|
626
|
+
target: Extract<ResolvedTarget, {
|
|
627
|
+
kind: 'selector';
|
|
628
|
+
}>;
|
|
629
|
+
node: SnapshotNode;
|
|
630
|
+
selectorChain: string[];
|
|
631
|
+
refLabel?: string;
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
export declare type ResolvedTarget = {
|
|
635
|
+
kind: 'selector';
|
|
636
|
+
selector: string;
|
|
637
|
+
} | {
|
|
638
|
+
kind: 'ref';
|
|
639
|
+
ref: string;
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
declare type ResolveInputOptions = {
|
|
643
|
+
usage: string;
|
|
644
|
+
field?: string;
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
export declare type RuntimeCommand<TOptions = Record<string, unknown>, TResult = CommandResult> = (runtime: AgentDeviceRuntime, options: TOptions) => Promise<TResult>;
|
|
648
|
+
|
|
649
|
+
export declare type ScreenshotCommandOptions = CommandContext & {
|
|
650
|
+
out?: FileOutputRef;
|
|
651
|
+
fullscreen?: boolean;
|
|
652
|
+
overlayRefs?: boolean;
|
|
653
|
+
appId?: string;
|
|
654
|
+
appBundleId?: string;
|
|
655
|
+
surface?: 'app' | 'frontmost-app' | 'desktop' | 'menubar';
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
export declare type ScreenshotCommandResult = {
|
|
659
|
+
path: string;
|
|
660
|
+
artifacts?: ArtifactDescriptor[];
|
|
661
|
+
message?: string;
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
declare type ScreenshotDiffRegion = {
|
|
665
|
+
index: number;
|
|
666
|
+
rect: {
|
|
667
|
+
x: number;
|
|
668
|
+
y: number;
|
|
669
|
+
width: number;
|
|
670
|
+
height: number;
|
|
671
|
+
};
|
|
672
|
+
normalizedRect: {
|
|
673
|
+
x: number;
|
|
674
|
+
y: number;
|
|
675
|
+
width: number;
|
|
676
|
+
height: number;
|
|
677
|
+
};
|
|
678
|
+
differentPixels: number;
|
|
679
|
+
shareOfDiffPercentage: number;
|
|
680
|
+
densityPercentage: number;
|
|
681
|
+
shape: 'compact' | 'horizontal-band' | 'vertical-band' | 'large-area';
|
|
682
|
+
size: 'small' | 'medium' | 'large';
|
|
683
|
+
location: string;
|
|
684
|
+
averageBaselineColorHex: string;
|
|
685
|
+
averageCurrentColorHex: string;
|
|
686
|
+
baselineLuminance: number;
|
|
687
|
+
currentLuminance: number;
|
|
688
|
+
dominantChange: 'brighter' | 'darker' | 'color-shift' | 'mixed';
|
|
689
|
+
currentOverlayMatches?: ScreenshotDiffRegionOverlayMatch[];
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
declare type ScreenshotDiffRegionOverlayMatch = {
|
|
693
|
+
ref: string;
|
|
694
|
+
label?: string;
|
|
695
|
+
regionCoveragePercentage: number;
|
|
696
|
+
rect: {
|
|
697
|
+
x: number;
|
|
698
|
+
y: number;
|
|
699
|
+
width: number;
|
|
700
|
+
height: number;
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
declare type ScreenshotDiffResult = {
|
|
705
|
+
diffPath?: string;
|
|
706
|
+
totalPixels: number;
|
|
707
|
+
differentPixels: number;
|
|
708
|
+
mismatchPercentage: number;
|
|
709
|
+
match: boolean;
|
|
710
|
+
dimensionMismatch?: ScreenshotDimensionMismatch;
|
|
711
|
+
regions?: ScreenshotDiffRegion[];
|
|
712
|
+
currentOverlayPath?: string;
|
|
713
|
+
currentOverlayRefCount?: number;
|
|
714
|
+
ocr?: ScreenshotOcrSummary;
|
|
715
|
+
nonTextDeltas?: ScreenshotNonTextDelta[];
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
declare type ScreenshotDimensionMismatch = {
|
|
719
|
+
expected: {
|
|
720
|
+
width: number;
|
|
721
|
+
height: number;
|
|
722
|
+
};
|
|
723
|
+
actual: {
|
|
724
|
+
width: number;
|
|
725
|
+
height: number;
|
|
726
|
+
};
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
declare type ScreenshotNonTextDelta = {
|
|
730
|
+
index: number;
|
|
731
|
+
regionIndex?: number;
|
|
732
|
+
slot: 'leading' | 'trailing' | 'background' | 'separator' | 'unknown';
|
|
733
|
+
likelyKind: 'icon' | 'toggle' | 'chevron' | 'separator' | 'visual';
|
|
734
|
+
rect: Rect;
|
|
735
|
+
nearestText?: string;
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
declare type ScreenshotOcrMovementCluster = {
|
|
739
|
+
texts: string[];
|
|
740
|
+
xRange: {
|
|
741
|
+
min: number;
|
|
742
|
+
max: number;
|
|
743
|
+
};
|
|
744
|
+
yRange: {
|
|
745
|
+
min: number;
|
|
746
|
+
max: number;
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
declare type ScreenshotOcrSummary = {
|
|
751
|
+
provider: 'tesseract';
|
|
752
|
+
baselineBlocks: number;
|
|
753
|
+
currentBlocks: number;
|
|
754
|
+
matches: ScreenshotOcrTextMatch[];
|
|
755
|
+
movementClusters?: ScreenshotOcrMovementCluster[];
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
declare type ScreenshotOcrTextMatch = {
|
|
759
|
+
text: string;
|
|
760
|
+
baselineRect: Rect;
|
|
761
|
+
currentRect: Rect;
|
|
762
|
+
delta: {
|
|
763
|
+
x: number;
|
|
764
|
+
y: number;
|
|
765
|
+
width: number;
|
|
766
|
+
height: number;
|
|
767
|
+
};
|
|
768
|
+
confidence: number;
|
|
769
|
+
possibleTextMetricMismatch: boolean;
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
declare type ScreenshotOverlayRef = {
|
|
773
|
+
ref: string;
|
|
774
|
+
label?: string;
|
|
775
|
+
rect: Rect;
|
|
776
|
+
overlayRect: Rect;
|
|
777
|
+
center: Point;
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
export declare function selector(expression: string): SelectorTarget;
|
|
781
|
+
|
|
782
|
+
export declare type SelectorSnapshotOptions = {
|
|
783
|
+
depth?: number;
|
|
784
|
+
scope?: string;
|
|
785
|
+
raw?: boolean;
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
export declare type SelectorTarget = {
|
|
789
|
+
kind: 'selector';
|
|
790
|
+
selector: string;
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
declare type SnapshotBackend = 'xctest' | 'android' | 'macos-helper' | 'linux-atspi';
|
|
794
|
+
|
|
795
|
+
export declare type SnapshotCommandOptions = CommandContext & {
|
|
796
|
+
interactiveOnly?: boolean;
|
|
797
|
+
compact?: boolean;
|
|
798
|
+
depth?: number;
|
|
799
|
+
scope?: string;
|
|
800
|
+
raw?: boolean;
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
export declare type SnapshotCommandResult = {
|
|
804
|
+
nodes: SnapshotNode[];
|
|
805
|
+
truncated: boolean;
|
|
806
|
+
appName?: string;
|
|
807
|
+
appBundleId?: string;
|
|
808
|
+
visibility?: SnapshotVisibility;
|
|
809
|
+
warnings?: string[];
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
export declare type SnapshotDiffLine = {
|
|
813
|
+
kind: 'added' | 'removed' | 'unchanged';
|
|
814
|
+
text: string;
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
export declare type SnapshotDiffSummary = {
|
|
818
|
+
additions: number;
|
|
819
|
+
removals: number;
|
|
820
|
+
unchanged: number;
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
declare type SnapshotNode = RawSnapshotNode & {
|
|
824
|
+
ref: string;
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
declare type SnapshotOptions = {
|
|
828
|
+
interactiveOnly?: boolean;
|
|
829
|
+
compact?: boolean;
|
|
830
|
+
depth?: number;
|
|
831
|
+
scope?: string;
|
|
832
|
+
raw?: boolean;
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
declare type SnapshotState = {
|
|
836
|
+
nodes: SnapshotNode[];
|
|
837
|
+
createdAt: number;
|
|
838
|
+
truncated?: boolean;
|
|
839
|
+
backend?: SnapshotBackend;
|
|
840
|
+
comparisonSafe?: boolean;
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
declare type SnapshotVisibility = {
|
|
844
|
+
partial: boolean;
|
|
845
|
+
visibleNodeCount: number;
|
|
846
|
+
totalNodeCount: number;
|
|
847
|
+
reasons: SnapshotVisibilityReason[];
|
|
848
|
+
};
|
|
849
|
+
|
|
850
|
+
declare type SnapshotVisibilityReason = 'offscreen-nodes' | 'scroll-hidden-above' | 'scroll-hidden-below';
|
|
851
|
+
|
|
852
|
+
declare type TemporaryFile = {
|
|
853
|
+
path: string;
|
|
854
|
+
visibility: 'internal';
|
|
855
|
+
cleanup: () => Promise<void>;
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
export declare type TypeTextCommandOptions = CommandContext & {
|
|
859
|
+
text: string;
|
|
860
|
+
delayMs?: number;
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
export declare type TypeTextCommandResult = {
|
|
864
|
+
kind: 'text';
|
|
865
|
+
text: string;
|
|
866
|
+
delayMs: number;
|
|
867
|
+
backendResult?: Record<string, unknown>;
|
|
868
|
+
message?: string;
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
export declare type WaitCommandOptions = CommandContext & SelectorSnapshotOptions & {
|
|
872
|
+
target: {
|
|
873
|
+
kind: 'sleep';
|
|
874
|
+
durationMs: number;
|
|
875
|
+
} | {
|
|
876
|
+
kind: 'text';
|
|
877
|
+
text: string;
|
|
878
|
+
timeoutMs?: number | null;
|
|
879
|
+
} | {
|
|
880
|
+
kind: 'ref';
|
|
881
|
+
ref: string;
|
|
882
|
+
timeoutMs?: number | null;
|
|
883
|
+
} | {
|
|
884
|
+
kind: 'selector';
|
|
885
|
+
selector: string;
|
|
886
|
+
timeoutMs?: number | null;
|
|
887
|
+
};
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
export declare type WaitCommandResult = {
|
|
891
|
+
kind: 'sleep';
|
|
892
|
+
waitedMs: number;
|
|
893
|
+
} | {
|
|
894
|
+
kind: 'text';
|
|
895
|
+
waitedMs: number;
|
|
896
|
+
text: string;
|
|
897
|
+
} | {
|
|
898
|
+
kind: 'selector';
|
|
899
|
+
waitedMs: number;
|
|
900
|
+
selector: string;
|
|
901
|
+
};
|
|
902
|
+
|
|
903
|
+
export declare type WaitForTextCommandOptions = CommandContext & SelectorSnapshotOptions & {
|
|
904
|
+
text: string;
|
|
905
|
+
timeoutMs?: number | null;
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
export { }
|