agent-device 0.12.4 → 0.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/152.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/backend.d.ts +527 -0
- package/dist/src/backend.js +1 -0
- package/dist/src/bin.js +62 -62
- package/dist/src/commands/index.d.ts +1880 -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 +2029 -167
- 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/selectors.js +1 -1
- package/dist/src/testing/conformance.d.ts +753 -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/macos-desktop.md +1 -1
- package/skills/agent-device/references/remote-tenancy.md +28 -5
- package/skills/agent-device/references/verification.md +1 -0
- package/dist/src/155.js +0 -38
- package/dist/src/940.js +0 -1
package/dist/src/818.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{constants as e}from"node:fs";import{access as t,stat as r}from"node:fs/promises";import n from"node:path";import{spawn as o,spawnSync as i}from"node:child_process";let s=/(token|secret|password|authorization|cookie|api[_-]?key|access[_-]?key|private[_-]?key)/i,a=/(bearer\s+[a-z0-9._-]+|(?:api[_-]?key|token|secret|password)\s*[=:]\s*\S+)/i;function
|
|
1
|
+
import{constants as e}from"node:fs";import{access as t,stat as r}from"node:fs/promises";import n from"node:path";import{spawn as o,spawnSync as i}from"node:child_process";let s=/(token|secret|password|authorization|cookie|api[_-]?key|access[_-]?key|private[_-]?key)/i,a=/(bearer\s+[a-z0-9._-]+|(?:api[_-]?key|token|secret|password)\s*[=:]\s*\S+)/i;function d(e){return function e(t,r,n){if(null==t)return t;if("string"==typeof t){var o=t,i=n;let e=o.trim();if(!e)return o;if(i&&s.test(i)||a.test(e))return"[REDACTED]";let r=function(e){try{let t=new URL(e);return t.search&&(t.search="?REDACTED"),(t.username||t.password)&&(t.username="REDACTED",t.password="REDACTED"),t.toString()}catch{return null}}(e);return r||(e.length>400?`${e.slice(0,200)}...<truncated>`:e)}if("object"!=typeof t)return t;if(r.has(t))return"[Circular]";if(r.add(t),Array.isArray(t))return t.map(t=>e(t,r));let d={};for(let[n,o]of Object.entries(t)){if(s.test(n)){d[n]="[REDACTED]";continue}d[n]=e(o,r,n)}return d}(e,new WeakSet)}class u extends Error{code;details;cause;constructor(e,t,r,n){super(t),this.code=e,this.details=r,this.cause=n}}function l(e){return e instanceof u?e:e instanceof Error?new u("UNKNOWN",e.message,void 0,e):new u("UNKNOWN","Unknown error",{err:e})}function c(e,t={}){let r=l(e),n=r.details?d(r.details):void 0,o=n&&"string"==typeof n.hint?n.hint:void 0,i=(n&&"string"==typeof n.diagnosticId?n.diagnosticId:void 0)??t.diagnosticId,s=(n&&"string"==typeof n.logPath?n.logPath:void 0)??t.logPath,a=o??function(e){switch(e){case"INVALID_ARGS":return"Check command arguments and run --help for usage examples.";case"SESSION_NOT_FOUND":return"Run open first or pass an explicit device selector.";case"TOOL_MISSING":return"Install required platform tooling and ensure it is available in PATH.";case"DEVICE_NOT_FOUND":return"Verify the target device is booted/connected and selectors match.";case"APP_NOT_INSTALLED":return"Run apps to discover the exact installed package or bundle id, or install the app before open.";case"UNSUPPORTED_OPERATION":return"This command is not available for the selected platform/device.";case"NOT_IMPLEMENTED":return"This command is part of the planned API but is not implemented yet.";case"COMMAND_FAILED":default:return"Retry with --debug and inspect diagnostics log for details.";case"UNAUTHORIZED":return"Refresh daemon metadata and retry the command."}}(r.code),u=function(e){if(!e)return;let t={...e};return delete t.hint,delete t.diagnosticId,delete t.logPath,Object.keys(t).length>0?t:void 0}(n),f=function(e,t,r){if("COMMAND_FAILED"!==e||r?.processExitError!==!0)return t;let n=function(e){let t=[/^an error was encountered processing the command/i,/^underlying error\b/i,/^simulator device failed to complete the requested operation/i];for(let r of e.split("\n")){let e=r.trim();if(e&&!t.some(t=>t.test(e)))return e.length>200?`${e.slice(0,200)}...`:e}return null}("string"==typeof r?.stderr?r.stderr:"");return n||t}(r.code,r.message,n);return{code:r.code,message:f,hint:a,diagnosticId:i,logPath:s,details:u}}let f=/^[A-Za-z0-9][A-Za-z0-9._+-]*$/,p=[".com",".exe",".bat",".cmd"];async function m(e,t,r={}){let n=I(e);return new Promise((i,s)=>{let a=o(n,t,{cwd:r.cwd,env:r.env,stdio:["pipe","pipe","pipe"],detached:r.detached,shell:!1}),d="",l=r.binaryStdout?Buffer.alloc(0):void 0,c="",f=!1,p=y(r.timeoutMs),m=p?setTimeout(()=>{f=!0,a.kill("SIGKILL")},p):null;r.binaryStdout||a.stdout.setEncoding("utf8"),a.stderr.setEncoding("utf8"),void 0!==r.stdin&&a.stdin.write(r.stdin),a.stdin.end(),a.stdout.on("data",e=>{r.binaryStdout?l=Buffer.concat([l??Buffer.alloc(0),Buffer.isBuffer(e)?e:Buffer.from(e)]):d+=e}),a.stderr.on("data",e=>{c+=e}),a.on("error",r=>{(m&&clearTimeout(m),"ENOENT"===r.code)?s(new u("TOOL_MISSING",`${n} not found in PATH`,{cmd:e},r)):s(new u("COMMAND_FAILED",`Failed to run ${n}`,{cmd:e,args:t},r))}),a.on("close",o=>{m&&clearTimeout(m);let a=o??1;f&&p?s(new u("COMMAND_FAILED",`${n} timed out after ${p}ms`,{cmd:e,args:t,stdout:d,stderr:c,exitCode:a,timeoutMs:p})):0===a||r.allowFailure?i({stdout:d,stderr:c,exitCode:a,stdoutBuffer:l}):s(new u("COMMAND_FAILED",`${n} exited with code ${a}`,{cmd:e,args:t,stdout:d,stderr:c,exitCode:a,processExitError:!0}))})})}async function h(e){let t=S(e);if(!t)return!1;if(n.isAbsolute(t))return T(t);let r=process.env.PATH;if(!r)return!1;let o=function(){if("win32"!==process.platform)return[""];let e=process.env.PATHEXT;if(!e)return p;let t=e.split(";").map(e=>e.trim().toLowerCase()).filter(e=>e.length>0);return t.length>0?t:p}();for(let e of r.split(n.delimiter)){let r=e.trim();if(r){for(let e of function(e,t){if("win32"!==process.platform)return[e];let r=e.toLowerCase();return t.some(e=>r.endsWith(e))?[e]:t.map(t=>`${e}${t}`)}(t,o))if(await T(n.join(r,e)))return!0}}return!1}async function w(e,t){let r=D(e,t,"executable");if(r){if(!await T(r))throw new u("TOOL_MISSING",`${t} points to a missing or non-executable file: ${r}`,{envName:t,path:r});return r}}async function E(e,t){let r=D(e,t,"file");if(r){if(!await M(r))throw new u("TOOL_MISSING",`${t} points to a missing or non-file path: ${r}`,{envName:t,path:r});return r}}function A(e,t,r={}){let n=I(e),o=i(n,t,{cwd:r.cwd,env:r.env,stdio:["pipe","pipe","pipe"],encoding:r.binaryStdout?void 0:"utf8",input:r.stdin,timeout:y(r.timeoutMs),shell:!1});if(o.error){let i=o.error.code;if("ETIMEDOUT"===i)throw new u("COMMAND_FAILED",`${n} timed out after ${y(r.timeoutMs)}ms`,{cmd:e,args:t,timeoutMs:y(r.timeoutMs)},o.error);if("ENOENT"===i)throw new u("TOOL_MISSING",`${n} not found in PATH`,{cmd:e},o.error);throw new u("COMMAND_FAILED",`Failed to run ${n}`,{cmd:e,args:t},o.error)}let s=r.binaryStdout?Buffer.isBuffer(o.stdout)?o.stdout:Buffer.from(o.stdout??""):void 0,a=r.binaryStdout?"":"string"==typeof o.stdout?o.stdout:(o.stdout??"").toString(),d="string"==typeof o.stderr?o.stderr:(o.stderr??"").toString(),l=o.status??1;if(0!==l&&!r.allowFailure)throw new u("COMMAND_FAILED",`${n} exited with code ${l}`,{cmd:e,args:t,stdout:a,stderr:d,exitCode:l,processExitError:!0});return{stdout:a,stderr:d,exitCode:l,stdoutBuffer:s}}function g(e,t,r={}){let n=o(I(e),t,{cwd:r.cwd,env:r.env,stdio:r.stdio??"ignore",detached:!0,shell:!1});return n.unref(),n.pid??0}async function O(e,t,r={}){let n=I(e);return new Promise((i,s)=>{let a=o(n,t,{cwd:r.cwd,env:r.env,stdio:["pipe","pipe","pipe"],detached:r.detached,shell:!1});r.onSpawn?.(a);let d="",l="",c=r.binaryStdout?Buffer.alloc(0):void 0,f=!1,p=y(r.timeoutMs),m=p?setTimeout(()=>{f=!0,a.kill("SIGKILL")},p):null;r.binaryStdout||a.stdout.setEncoding("utf8"),a.stderr.setEncoding("utf8"),void 0!==r.stdin&&a.stdin.write(r.stdin),a.stdin.end(),a.stdout.on("data",e=>{if(r.binaryStdout){c=Buffer.concat([c??Buffer.alloc(0),Buffer.isBuffer(e)?e:Buffer.from(e)]);return}let t=String(e);d+=t,r.onStdoutChunk?.(t)}),a.stderr.on("data",e=>{let t=String(e);l+=t,r.onStderrChunk?.(t)}),a.on("error",r=>{(m&&clearTimeout(m),"ENOENT"===r.code)?s(new u("TOOL_MISSING",`${n} not found in PATH`,{cmd:e},r)):s(new u("COMMAND_FAILED",`Failed to run ${n}`,{cmd:e,args:t},r))}),a.on("close",o=>{m&&clearTimeout(m);let a=o??1;f&&p?s(new u("COMMAND_FAILED",`${n} timed out after ${p}ms`,{cmd:e,args:t,stdout:d,stderr:l,exitCode:a,timeoutMs:p})):0===a||r.allowFailure?i({stdout:d,stderr:l,exitCode:a,stdoutBuffer:c}):s(new u("COMMAND_FAILED",`${n} exited with code ${a}`,{cmd:e,args:t,stdout:d,stderr:l,exitCode:a,processExitError:!0}))})})}function N(e,t,r={}){let n=I(e),i=o(n,t,{cwd:r.cwd,env:r.env,stdio:["ignore","pipe","pipe"],detached:r.detached,shell:!1}),s="",a="";i.stdout.setEncoding("utf8"),i.stderr.setEncoding("utf8"),i.stdout.on("data",e=>{s+=e}),i.stderr.on("data",e=>{a+=e});let d=new Promise((o,d)=>{i.on("error",r=>{"ENOENT"===r.code?d(new u("TOOL_MISSING",`${n} not found in PATH`,{cmd:e},r)):d(new u("COMMAND_FAILED",`Failed to run ${n}`,{cmd:e,args:t},r))}),i.on("close",i=>{let l=i??1;0===l||r.allowFailure?o({stdout:s,stderr:a,exitCode:l}):d(new u("COMMAND_FAILED",`${n} exited with code ${l}`,{cmd:e,args:t,stdout:s,stderr:a,exitCode:l,processExitError:!0}))})});return{child:i,wait:d}}function I(e){let t=S(e);if(!t)throw new u("INVALID_ARGS",`Invalid executable command: ${JSON.stringify(e)}`,{cmd:e,hint:"Use a bare command name from PATH or an absolute executable path."});return t}function D(e,t,r){let o=e?.trim();if(o){if(!n.isAbsolute(o)||o.includes("\0"))throw new u("INVALID_ARGS",`${t} must be an absolute ${r} path, not ${JSON.stringify(e)}`,{envName:t,path:e});return o}}function S(e){let t=e.trim();return!t||t.includes("\0")?null:n.isAbsolute(t)?t:t.includes("/")||t.includes("\\")?null:f.test(t)?t:null}async function T(r){try{if(!await M(r))return!1;return await t(r,"win32"===process.platform?e.F_OK:e.X_OK),!0}catch{return!1}}async function M(e){try{return(await r(e)).isFile()}catch{return!1}}function y(e){if(!Number.isFinite(e))return;let t=Math.floor(e);if(!(t<=0))return t}export{u as AppError,l as asAppError,T as isExecutablePath,c as normalizeError,d as redactDiagnosticData,w as resolveExecutableOverridePath,E as resolveFileOverridePath,m as runCmd,N as runCmdBackground,g as runCmdDetached,O as runCmdStreaming,A as runCmdSync,h as whichCmd};
|
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
export 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
|
+
focus?(context: BackendCommandContext, point: Point): Promise<BackendActionResult>;
|
|
15
|
+
longPress?(context: BackendCommandContext, point: Point, options?: BackendLongPressOptions): Promise<BackendActionResult>;
|
|
16
|
+
swipe?(context: BackendCommandContext, from: Point, to: Point, options?: BackendSwipeOptions): Promise<BackendActionResult>;
|
|
17
|
+
scroll?(context: BackendCommandContext, target: BackendScrollTarget, options: BackendScrollOptions): Promise<BackendActionResult>;
|
|
18
|
+
pinch?(context: BackendCommandContext, options: BackendPinchOptions): Promise<BackendActionResult>;
|
|
19
|
+
pressKey?(context: BackendCommandContext, key: string, options?: {
|
|
20
|
+
modifiers?: string[];
|
|
21
|
+
}): Promise<BackendActionResult>;
|
|
22
|
+
pressBack?(context: BackendCommandContext, options?: BackendBackOptions): Promise<BackendActionResult>;
|
|
23
|
+
pressHome?(context: BackendCommandContext): Promise<BackendActionResult>;
|
|
24
|
+
rotate?(context: BackendCommandContext, orientation: BackendDeviceOrientation): Promise<BackendActionResult>;
|
|
25
|
+
setKeyboard?(context: BackendCommandContext, options: BackendKeyboardOptions): Promise<BackendKeyboardResult | BackendActionResult>;
|
|
26
|
+
getClipboard?(context: BackendCommandContext): Promise<string | BackendClipboardTextResult>;
|
|
27
|
+
setClipboard?(context: BackendCommandContext, text: string): Promise<BackendActionResult>;
|
|
28
|
+
openSettings?(context: BackendCommandContext, target?: string): Promise<BackendActionResult>;
|
|
29
|
+
handleAlert?(context: BackendCommandContext, action: BackendAlertAction, options?: {
|
|
30
|
+
timeoutMs?: number;
|
|
31
|
+
}): Promise<BackendAlertResult>;
|
|
32
|
+
openAppSwitcher?(context: BackendCommandContext): Promise<BackendActionResult>;
|
|
33
|
+
openApp?(context: BackendCommandContext, target: BackendOpenTarget, options?: BackendOpenOptions): Promise<BackendActionResult>;
|
|
34
|
+
closeApp?(context: BackendCommandContext, app?: string): Promise<BackendActionResult>;
|
|
35
|
+
listApps?(context: BackendCommandContext, filter?: BackendAppListFilter): Promise<readonly BackendAppInfo[]>;
|
|
36
|
+
getAppState?(context: BackendCommandContext, app: string): Promise<BackendAppState>;
|
|
37
|
+
pushFile?(context: BackendCommandContext, input: BackendPushInput, target: string): Promise<BackendActionResult>;
|
|
38
|
+
triggerAppEvent?(context: BackendCommandContext, event: BackendAppEvent): Promise<BackendActionResult>;
|
|
39
|
+
listDevices?(context: BackendCommandContext, filter?: BackendDeviceFilter): Promise<readonly BackendDeviceInfo[]>;
|
|
40
|
+
bootDevice?(context: BackendCommandContext, target?: BackendDeviceTarget): Promise<BackendActionResult>;
|
|
41
|
+
ensureSimulator?(context: BackendCommandContext, options: BackendEnsureSimulatorOptions): Promise<BackendEnsureSimulatorResult>;
|
|
42
|
+
resolveInstallSource?(context: BackendCommandContext, source: BackendInstallSource): Promise<BackendInstallSource>;
|
|
43
|
+
installApp?(context: BackendCommandContext, target: BackendInstallTarget): Promise<BackendInstallResult>;
|
|
44
|
+
reinstallApp?(context: BackendCommandContext, target: BackendInstallTarget): Promise<BackendInstallResult>;
|
|
45
|
+
startRecording?(context: BackendCommandContext, options?: BackendRecordingOptions): Promise<BackendRecordingResult>;
|
|
46
|
+
stopRecording?(context: BackendCommandContext, options?: BackendRecordingOptions): Promise<BackendRecordingResult>;
|
|
47
|
+
startTrace?(context: BackendCommandContext, options?: BackendTraceOptions): Promise<BackendTraceResult>;
|
|
48
|
+
stopTrace?(context: BackendCommandContext, options?: BackendTraceOptions): Promise<BackendTraceResult>;
|
|
49
|
+
readLogs?(context: BackendCommandContext, options?: BackendReadLogsOptions): Promise<BackendReadLogsResult>;
|
|
50
|
+
dumpNetwork?(context: BackendCommandContext, options?: BackendDumpNetworkOptions): Promise<BackendDumpNetworkResult>;
|
|
51
|
+
measurePerf?(context: BackendCommandContext, options?: BackendMeasurePerfOptions): Promise<BackendMeasurePerfResult>;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export declare type AgentDeviceBackendPlatform = 'ios' | 'android' | 'macos' | 'linux';
|
|
55
|
+
|
|
56
|
+
export declare const BACKEND_CAPABILITY_ESCAPE_HATCH_METHODS: {
|
|
57
|
+
readonly 'android.shell': "androidShell";
|
|
58
|
+
readonly 'ios.runnerCommand': "iosRunnerCommand";
|
|
59
|
+
readonly 'macos.desktopScreenshot': "macosDesktopScreenshot";
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export declare const BACKEND_CAPABILITY_NAMES: readonly ["android.shell", "ios.runnerCommand", "macos.desktopScreenshot"];
|
|
63
|
+
|
|
64
|
+
export declare type BackendActionResult = Record<string, unknown> | void;
|
|
65
|
+
|
|
66
|
+
export declare type BackendAlertAction = 'get' | 'accept' | 'dismiss' | 'wait';
|
|
67
|
+
|
|
68
|
+
export declare type BackendAlertInfo = {
|
|
69
|
+
title?: string;
|
|
70
|
+
message?: string;
|
|
71
|
+
buttons?: string[];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export declare type BackendAlertResult = {
|
|
75
|
+
kind: 'alertStatus';
|
|
76
|
+
alert: BackendAlertInfo | null;
|
|
77
|
+
} | {
|
|
78
|
+
kind: 'alertHandled';
|
|
79
|
+
handled: boolean;
|
|
80
|
+
alert?: BackendAlertInfo;
|
|
81
|
+
button?: string;
|
|
82
|
+
} | {
|
|
83
|
+
kind: 'alertWait';
|
|
84
|
+
alert: BackendAlertInfo | null;
|
|
85
|
+
waitedMs?: number;
|
|
86
|
+
timedOut?: boolean;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export declare type BackendAppEvent = {
|
|
90
|
+
name: string;
|
|
91
|
+
payload?: Record<string, unknown>;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export declare type BackendAppInfo = {
|
|
95
|
+
id: string;
|
|
96
|
+
name?: string;
|
|
97
|
+
bundleId?: string;
|
|
98
|
+
packageName?: string;
|
|
99
|
+
activity?: string;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export declare type BackendAppListFilter = 'all' | 'user-installed';
|
|
103
|
+
|
|
104
|
+
export declare type BackendAppState = {
|
|
105
|
+
appId?: string;
|
|
106
|
+
bundleId?: string;
|
|
107
|
+
packageName?: string;
|
|
108
|
+
activity?: string;
|
|
109
|
+
state?: 'unknown' | 'notRunning' | 'running' | 'foreground' | 'background';
|
|
110
|
+
details?: Record<string, unknown>;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export declare type BackendBackOptions = {
|
|
114
|
+
mode?: 'in-app' | 'system';
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export declare type BackendCapabilityName = (typeof BACKEND_CAPABILITY_NAMES)[number];
|
|
118
|
+
|
|
119
|
+
export declare type BackendCapabilitySet = readonly BackendCapabilityName[];
|
|
120
|
+
|
|
121
|
+
export declare type BackendClipboardTextResult = {
|
|
122
|
+
text: string;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export declare type BackendCommandContext = {
|
|
126
|
+
session?: string;
|
|
127
|
+
requestId?: string;
|
|
128
|
+
appId?: string;
|
|
129
|
+
appBundleId?: string;
|
|
130
|
+
signal?: AbortSignal;
|
|
131
|
+
metadata?: Record<string, unknown>;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export declare type BackendDeviceFilter = {
|
|
135
|
+
platform?: AgentDeviceBackendPlatform | 'apple';
|
|
136
|
+
target?: 'mobile' | 'tv' | 'desktop';
|
|
137
|
+
kind?: 'simulator' | 'emulator' | 'device' | 'desktop';
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export declare type BackendDeviceInfo = {
|
|
141
|
+
id: string;
|
|
142
|
+
name: string;
|
|
143
|
+
platform: AgentDeviceBackendPlatform;
|
|
144
|
+
target?: 'mobile' | 'tv' | 'desktop';
|
|
145
|
+
kind?: 'simulator' | 'emulator' | 'device' | 'desktop';
|
|
146
|
+
booted?: boolean;
|
|
147
|
+
details?: Record<string, unknown>;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export declare type BackendDeviceOrientation = 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right';
|
|
151
|
+
|
|
152
|
+
export declare type BackendDeviceTarget = {
|
|
153
|
+
id?: string;
|
|
154
|
+
name?: string;
|
|
155
|
+
platform?: AgentDeviceBackendPlatform;
|
|
156
|
+
target?: 'mobile' | 'tv' | 'desktop';
|
|
157
|
+
headless?: boolean;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export declare type BackendDiagnosticsPageOptions = BackendDiagnosticsTimeWindow & {
|
|
161
|
+
cursor?: string;
|
|
162
|
+
limit?: number;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export declare type BackendDiagnosticsTimeWindow = {
|
|
166
|
+
since?: string;
|
|
167
|
+
until?: string;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export declare type BackendDumpNetworkOptions = BackendDiagnosticsPageOptions & {
|
|
171
|
+
include?: BackendNetworkIncludeMode;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export declare type BackendDumpNetworkResult = {
|
|
175
|
+
entries: readonly BackendNetworkEntry[];
|
|
176
|
+
nextCursor?: string;
|
|
177
|
+
timeWindow?: BackendDiagnosticsTimeWindow;
|
|
178
|
+
backend?: string;
|
|
179
|
+
redacted?: boolean;
|
|
180
|
+
notes?: readonly string[];
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export declare type BackendEnsureSimulatorOptions = {
|
|
184
|
+
device: string;
|
|
185
|
+
runtime?: string;
|
|
186
|
+
boot?: boolean;
|
|
187
|
+
reuseExisting?: boolean;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export declare type BackendEnsureSimulatorResult = {
|
|
191
|
+
udid: string;
|
|
192
|
+
device: string;
|
|
193
|
+
runtime: string;
|
|
194
|
+
created: boolean;
|
|
195
|
+
booted: boolean;
|
|
196
|
+
simulatorSetPath?: string | null;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export declare type BackendEscapeHatches = {
|
|
200
|
+
androidShell?(context: BackendCommandContext, args: readonly string[]): Promise<BackendShellResult>;
|
|
201
|
+
iosRunnerCommand?(context: BackendCommandContext, command: BackendRunnerCommand): Promise<BackendActionResult>;
|
|
202
|
+
macosDesktopScreenshot?(context: BackendCommandContext, outPath: string, options?: BackendScreenshotOptions): Promise<BackendScreenshotResult | void>;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export declare type BackendFillOptions = {
|
|
206
|
+
delayMs?: number;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export declare type BackendFindTextResult = {
|
|
210
|
+
found: boolean;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export declare type BackendInstallResult = Record<string, unknown> & {
|
|
214
|
+
appId?: string;
|
|
215
|
+
appName?: string;
|
|
216
|
+
bundleId?: string;
|
|
217
|
+
packageName?: string;
|
|
218
|
+
launchTarget?: string;
|
|
219
|
+
installablePath?: string;
|
|
220
|
+
archivePath?: string;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export declare type BackendInstallSource = {
|
|
224
|
+
kind: 'path';
|
|
225
|
+
path: string;
|
|
226
|
+
} | {
|
|
227
|
+
kind: 'uploadedArtifact';
|
|
228
|
+
id: string;
|
|
229
|
+
} | {
|
|
230
|
+
kind: 'url';
|
|
231
|
+
url: string;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export declare type BackendInstallTarget = {
|
|
235
|
+
app?: string;
|
|
236
|
+
source: BackendInstallSource;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export declare type BackendKeyboardOptions = {
|
|
240
|
+
action: 'status' | 'get' | 'dismiss';
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export declare type BackendKeyboardResult = {
|
|
244
|
+
platform?: 'android' | 'ios' | 'macos' | 'linux';
|
|
245
|
+
action?: BackendKeyboardOptions['action'];
|
|
246
|
+
visible?: boolean;
|
|
247
|
+
inputType?: string | null;
|
|
248
|
+
type?: string | null;
|
|
249
|
+
wasVisible?: boolean;
|
|
250
|
+
dismissed?: boolean;
|
|
251
|
+
attempts?: number;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export declare type BackendLogEntry = {
|
|
255
|
+
timestamp?: string;
|
|
256
|
+
level?: 'debug' | 'info' | 'warn' | 'error' | string;
|
|
257
|
+
message: string;
|
|
258
|
+
source?: string;
|
|
259
|
+
metadata?: Record<string, unknown>;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export declare type BackendLongPressOptions = {
|
|
263
|
+
durationMs?: number;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
export declare type BackendMeasurePerfOptions = BackendDiagnosticsTimeWindow & {
|
|
267
|
+
sampleMs?: number;
|
|
268
|
+
metrics?: readonly string[];
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export declare type BackendMeasurePerfResult = {
|
|
272
|
+
metrics: readonly BackendPerfMetric[];
|
|
273
|
+
startedAt?: string;
|
|
274
|
+
endedAt?: string;
|
|
275
|
+
backend?: string;
|
|
276
|
+
redacted?: boolean;
|
|
277
|
+
notes?: readonly string[];
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
export declare type BackendNetworkEntry = {
|
|
281
|
+
timestamp?: string;
|
|
282
|
+
method?: string;
|
|
283
|
+
url?: string;
|
|
284
|
+
status?: number;
|
|
285
|
+
durationMs?: number;
|
|
286
|
+
requestHeaders?: Record<string, string>;
|
|
287
|
+
responseHeaders?: Record<string, string>;
|
|
288
|
+
requestBody?: string;
|
|
289
|
+
responseBody?: string;
|
|
290
|
+
metadata?: Record<string, unknown>;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
export declare type BackendNetworkIncludeMode = 'summary' | 'headers' | 'body' | 'all';
|
|
294
|
+
|
|
295
|
+
export declare type BackendOpenOptions = {
|
|
296
|
+
relaunch?: boolean;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export declare type BackendOpenTarget = {
|
|
300
|
+
/**
|
|
301
|
+
* Generic app identifier accepted by the backend. Hosted adapters should
|
|
302
|
+
* prefer structured appId, bundleId, or packageName when available.
|
|
303
|
+
*/
|
|
304
|
+
app?: string;
|
|
305
|
+
appId?: string;
|
|
306
|
+
bundleId?: string;
|
|
307
|
+
packageName?: string;
|
|
308
|
+
/**
|
|
309
|
+
* URL may be used by itself for a deep link or with an app identifier when
|
|
310
|
+
* the backend supports opening a URL in a specific app context.
|
|
311
|
+
*/
|
|
312
|
+
url?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Platform-specific activity override, primarily for Android app launches.
|
|
315
|
+
*/
|
|
316
|
+
activity?: string;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
export declare type BackendPerfMetric = {
|
|
320
|
+
name: string;
|
|
321
|
+
value?: number;
|
|
322
|
+
unit?: string;
|
|
323
|
+
status?: 'ok' | 'unavailable' | 'error';
|
|
324
|
+
message?: string;
|
|
325
|
+
metadata?: Record<string, unknown>;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export declare type BackendPinchOptions = {
|
|
329
|
+
scale: number;
|
|
330
|
+
center?: Point;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
export declare type BackendPushInput = {
|
|
334
|
+
kind: 'json';
|
|
335
|
+
payload: Record<string, unknown>;
|
|
336
|
+
} | {
|
|
337
|
+
kind: 'file';
|
|
338
|
+
path: string;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
export declare type BackendReadLogsOptions = BackendDiagnosticsPageOptions & {
|
|
342
|
+
levels?: readonly string[];
|
|
343
|
+
search?: string;
|
|
344
|
+
source?: string;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
export declare type BackendReadLogsResult = {
|
|
348
|
+
entries: readonly BackendLogEntry[];
|
|
349
|
+
nextCursor?: string;
|
|
350
|
+
timeWindow?: BackendDiagnosticsTimeWindow;
|
|
351
|
+
backend?: string;
|
|
352
|
+
redacted?: boolean;
|
|
353
|
+
notes?: readonly string[];
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
export declare type BackendReadTextResult = {
|
|
357
|
+
text: string;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
export declare type BackendRecordingOptions = {
|
|
361
|
+
outPath?: string;
|
|
362
|
+
fps?: number;
|
|
363
|
+
quality?: number;
|
|
364
|
+
showTouches?: boolean;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
export declare type BackendRecordingResult = Record<string, unknown> & {
|
|
368
|
+
path?: string;
|
|
369
|
+
telemetryPath?: string;
|
|
370
|
+
warning?: string;
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
export declare type BackendRunnerCommand = {
|
|
374
|
+
command: string;
|
|
375
|
+
args?: readonly string[];
|
|
376
|
+
payload?: Record<string, unknown>;
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
export declare type BackendScreenshotOptions = {
|
|
380
|
+
fullscreen?: boolean;
|
|
381
|
+
overlayRefs?: boolean;
|
|
382
|
+
surface?: 'app' | 'frontmost-app' | 'desktop' | 'menubar';
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
export declare type BackendScreenshotResult = {
|
|
386
|
+
path?: string;
|
|
387
|
+
overlayRefs?: ScreenshotOverlayRef[];
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
export declare type BackendScrollOptions = {
|
|
391
|
+
direction: 'up' | 'down' | 'left' | 'right';
|
|
392
|
+
amount?: number;
|
|
393
|
+
pixels?: number;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
export declare type BackendScrollTarget = {
|
|
397
|
+
kind: 'viewport';
|
|
398
|
+
} | {
|
|
399
|
+
kind: 'point';
|
|
400
|
+
point: Point;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
export declare type BackendShellResult = {
|
|
404
|
+
exitCode: number;
|
|
405
|
+
stdout: string;
|
|
406
|
+
stderr: string;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
export declare type BackendSnapshotAnalysis = {
|
|
410
|
+
rawNodeCount?: number;
|
|
411
|
+
maxDepth?: number;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
export declare type BackendSnapshotFreshness = {
|
|
415
|
+
action: string;
|
|
416
|
+
retryCount: number;
|
|
417
|
+
staleAfterRetries: boolean;
|
|
418
|
+
reason?: 'empty-interactive' | 'sharp-drop' | 'stuck-route';
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
export declare type BackendSnapshotOptions = SnapshotOptions & {
|
|
422
|
+
outPath?: string;
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
export declare type BackendSnapshotResult = {
|
|
426
|
+
nodes?: SnapshotNode[];
|
|
427
|
+
truncated?: boolean;
|
|
428
|
+
backend?: string;
|
|
429
|
+
snapshot?: SnapshotState;
|
|
430
|
+
analysis?: BackendSnapshotAnalysis;
|
|
431
|
+
freshness?: BackendSnapshotFreshness;
|
|
432
|
+
warnings?: string[];
|
|
433
|
+
appName?: string;
|
|
434
|
+
appBundleId?: string;
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
export declare type BackendSwipeOptions = {
|
|
438
|
+
durationMs?: number;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
export declare type BackendTapOptions = {
|
|
442
|
+
button?: 'primary' | 'secondary' | 'middle';
|
|
443
|
+
count?: number;
|
|
444
|
+
intervalMs?: number;
|
|
445
|
+
holdMs?: number;
|
|
446
|
+
jitterPx?: number;
|
|
447
|
+
doubleTap?: boolean;
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
export declare type BackendTraceOptions = {
|
|
451
|
+
outPath?: string;
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
export declare type BackendTraceResult = Record<string, unknown> & {
|
|
455
|
+
outPath?: string;
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
export declare function hasBackendCapability(backend: Pick<AgentDeviceBackend, 'platform' | 'capabilities'>, capability: BackendCapabilityName): boolean;
|
|
459
|
+
|
|
460
|
+
export declare function hasBackendEscapeHatch(backend: Pick<AgentDeviceBackend, 'escapeHatches'>, capability: BackendCapabilityName): boolean;
|
|
461
|
+
|
|
462
|
+
declare type Point = {
|
|
463
|
+
x: number;
|
|
464
|
+
y: number;
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
declare type RawSnapshotNode = {
|
|
468
|
+
index: number;
|
|
469
|
+
type?: string;
|
|
470
|
+
role?: string;
|
|
471
|
+
subrole?: string;
|
|
472
|
+
label?: string;
|
|
473
|
+
value?: string;
|
|
474
|
+
identifier?: string;
|
|
475
|
+
rect?: Rect;
|
|
476
|
+
enabled?: boolean;
|
|
477
|
+
selected?: boolean;
|
|
478
|
+
hittable?: boolean;
|
|
479
|
+
depth?: number;
|
|
480
|
+
parentIndex?: number;
|
|
481
|
+
pid?: number;
|
|
482
|
+
bundleId?: string;
|
|
483
|
+
appName?: string;
|
|
484
|
+
windowTitle?: string;
|
|
485
|
+
surface?: string;
|
|
486
|
+
hiddenContentAbove?: boolean;
|
|
487
|
+
hiddenContentBelow?: boolean;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
declare type Rect = {
|
|
491
|
+
x: number;
|
|
492
|
+
y: number;
|
|
493
|
+
width: number;
|
|
494
|
+
height: number;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
declare type ScreenshotOverlayRef = {
|
|
498
|
+
ref: string;
|
|
499
|
+
label?: string;
|
|
500
|
+
rect: Rect;
|
|
501
|
+
overlayRect: Rect;
|
|
502
|
+
center: Point;
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
declare type SnapshotBackend = 'xctest' | 'android' | 'macos-helper' | 'linux-atspi';
|
|
506
|
+
|
|
507
|
+
declare type SnapshotNode = RawSnapshotNode & {
|
|
508
|
+
ref: string;
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
declare type SnapshotOptions = {
|
|
512
|
+
interactiveOnly?: boolean;
|
|
513
|
+
compact?: boolean;
|
|
514
|
+
depth?: number;
|
|
515
|
+
scope?: string;
|
|
516
|
+
raw?: boolean;
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
declare type SnapshotState = {
|
|
520
|
+
nodes: SnapshotNode[];
|
|
521
|
+
createdAt: number;
|
|
522
|
+
truncated?: boolean;
|
|
523
|
+
backend?: SnapshotBackend;
|
|
524
|
+
comparisonSafe?: boolean;
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
export { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=["android.shell","ios.runnerCommand","macos.desktopScreenshot"],n={"android.shell":"androidShell","ios.runnerCommand":"iosRunnerCommand","macos.desktopScreenshot":"macosDesktopScreenshot"};function o(e,n){return e.capabilities?.includes(n)??!1}function a(e,o){let a=n[o];return"function"==typeof e.escapeHatches?.[a]}export{n as BACKEND_CAPABILITY_ESCAPE_HATCH_METHODS,e as BACKEND_CAPABILITY_NAMES,o as hasBackendCapability,a as hasBackendEscapeHatch};
|