agent-device 0.12.5 → 0.12.7
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/641.js +33 -33
- package/dist/src/818.js +1 -1
- package/dist/src/backend.d.ts +326 -4
- package/dist/src/bin.js +36 -36
- package/dist/src/commands/index.d.ts +978 -6
- package/dist/src/commands/index.js +1 -1
- package/dist/src/daemon.js +15 -15
- package/dist/src/index.d.ts +977 -5
- package/dist/src/index.js +3 -3
- package/dist/src/testing/conformance.d.ts +341 -4
- package/dist/src/testing/conformance.js +1 -1
- package/package.json +1 -1
- package/skills/agent-device/references/bootstrap-install.md +5 -3
- package/skills/agent-device/references/macos-desktop.md +1 -1
- package/skills/agent-device/references/remote-tenancy.md +64 -16
package/dist/src/818.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{constants as
|
|
1
|
+
import{constants as t}from"node:fs";import{access as e,stat as r}from"node:fs/promises";import o from"node:path";import{spawn as n,spawnSync as i}from"node:child_process";import{AppError as u}from"./152.js";let s=/^[A-Za-z0-9][A-Za-z0-9._+-]*$/,d=[".com",".exe",".bat",".cmd"];async function f(t,e,r={}){let o=m(t);return new Promise((i,s)=>{let d=n(o,e,{cwd:r.cwd,env:r.env,stdio:["pipe","pipe","pipe"],detached:r.detached,shell:!1}),f="",l=r.binaryStdout?Buffer.alloc(0):void 0,a="",c=!1,m=A(r.timeoutMs),p=m?setTimeout(()=>{c=!0,d.kill("SIGKILL")},m):null;r.binaryStdout||d.stdout.setEncoding("utf8"),d.stderr.setEncoding("utf8"),void 0!==r.stdin&&d.stdin.write(r.stdin),d.stdin.end(),d.stdout.on("data",t=>{r.binaryStdout?l=Buffer.concat([l??Buffer.alloc(0),Buffer.isBuffer(t)?t:Buffer.from(t)]):f+=t}),d.stderr.on("data",t=>{a+=t}),d.on("error",r=>{(p&&clearTimeout(p),"ENOENT"===r.code)?s(new u("TOOL_MISSING",`${o} not found in PATH`,{cmd:t},r)):s(new u("COMMAND_FAILED",`Failed to run ${o}`,{cmd:t,args:e},r))}),d.on("close",n=>{p&&clearTimeout(p);let d=n??1;c&&m?s(new u("COMMAND_FAILED",`${o} timed out after ${m}ms`,{cmd:t,args:e,stdout:f,stderr:a,exitCode:d,timeoutMs:m})):0===d||r.allowFailure?i({stdout:f,stderr:a,exitCode:d,stdoutBuffer:l}):s(new u("COMMAND_FAILED",`${o} exited with code ${d}`,{cmd:t,args:e,stdout:f,stderr:a,exitCode:d,processExitError:!0}))})})}async function l(t){let e=p(t);if(!e)return!1;if(o.isAbsolute(e))return w(e);let r=process.env.PATH;if(!r)return!1;let n=function(){if("win32"!==process.platform)return[""];let t=process.env.PATHEXT;if(!t)return d;let e=t.split(";").map(t=>t.trim().toLowerCase()).filter(t=>t.length>0);return e.length>0?e:d}();for(let t of r.split(o.delimiter)){let r=t.trim();if(r){for(let t of function(t,e){if("win32"!==process.platform)return[t];let r=t.toLowerCase();return e.some(t=>r.endsWith(t))?[t]:e.map(e=>`${t}${e}`)}(e,n))if(await w(o.join(r,t)))return!0}}return!1}function a(t,e,r={}){let o=m(t),n=i(o,e,{cwd:r.cwd,env:r.env,stdio:["pipe","pipe","pipe"],encoding:r.binaryStdout?void 0:"utf8",input:r.stdin,timeout:A(r.timeoutMs),shell:!1});if(n.error){let i=n.error.code;if("ETIMEDOUT"===i)throw new u("COMMAND_FAILED",`${o} timed out after ${A(r.timeoutMs)}ms`,{cmd:t,args:e,timeoutMs:A(r.timeoutMs)},n.error);if("ENOENT"===i)throw new u("TOOL_MISSING",`${o} not found in PATH`,{cmd:t},n.error);throw new u("COMMAND_FAILED",`Failed to run ${o}`,{cmd:t,args:e},n.error)}let s=r.binaryStdout?Buffer.isBuffer(n.stdout)?n.stdout:Buffer.from(n.stdout??""):void 0,d=r.binaryStdout?"":"string"==typeof n.stdout?n.stdout:(n.stdout??"").toString(),f="string"==typeof n.stderr?n.stderr:(n.stderr??"").toString(),l=n.status??1;if(0!==l&&!r.allowFailure)throw new u("COMMAND_FAILED",`${o} exited with code ${l}`,{cmd:t,args:e,stdout:d,stderr:f,exitCode:l,processExitError:!0});return{stdout:d,stderr:f,exitCode:l,stdoutBuffer:s}}function c(t,e,r={}){let o=n(m(t),e,{cwd:r.cwd,env:r.env,stdio:r.stdio??"ignore",detached:!0,shell:!1});return o.unref(),o.pid??0}function m(t){let e=p(t);if(!e)throw new u("INVALID_ARGS",`Invalid executable command: ${JSON.stringify(t)}`,{cmd:t,hint:"Use a bare command name from PATH or an absolute executable path."});return e}function p(t){let e=t.trim();return!e||e.includes("\0")?null:o.isAbsolute(e)?e:e.includes("/")||e.includes("\\")?null:s.test(e)?e:null}async function w(r){try{if(!await h(r))return!1;return await e(r,"win32"===process.platform?t.F_OK:t.X_OK),!0}catch{return!1}}async function h(t){try{return(await r(t)).isFile()}catch{return!1}}function A(t){if(!Number.isFinite(t))return;let e=Math.floor(t);if(!(e<=0))return e}export{w as isExecutablePath,f as runCmd,c as runCmdDetached,a as runCmdSync,l as whichCmd};(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};
|
package/dist/src/backend.d.ts
CHANGED
|
@@ -11,12 +11,44 @@ export declare type AgentDeviceBackend = {
|
|
|
11
11
|
typeText?(context: BackendCommandContext, text: string, options?: {
|
|
12
12
|
delayMs?: number;
|
|
13
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>;
|
|
14
19
|
pressKey?(context: BackendCommandContext, key: string, options?: {
|
|
15
20
|
modifiers?: string[];
|
|
16
21
|
}): Promise<BackendActionResult>;
|
|
17
|
-
|
|
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>;
|
|
18
34
|
closeApp?(context: BackendCommandContext, app?: string): Promise<BackendActionResult>;
|
|
19
|
-
|
|
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>;
|
|
20
52
|
};
|
|
21
53
|
|
|
22
54
|
export declare type AgentDeviceBackendPlatform = 'ios' | 'android' | 'macos' | 'linux';
|
|
@@ -31,10 +63,65 @@ export declare const BACKEND_CAPABILITY_NAMES: readonly ["android.shell", "ios.r
|
|
|
31
63
|
|
|
32
64
|
export declare type BackendActionResult = Record<string, unknown> | void;
|
|
33
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
|
+
|
|
34
117
|
export declare type BackendCapabilityName = (typeof BACKEND_CAPABILITY_NAMES)[number];
|
|
35
118
|
|
|
36
119
|
export declare type BackendCapabilitySet = readonly BackendCapabilityName[];
|
|
37
120
|
|
|
121
|
+
export declare type BackendClipboardTextResult = {
|
|
122
|
+
text: string;
|
|
123
|
+
};
|
|
124
|
+
|
|
38
125
|
export declare type BackendCommandContext = {
|
|
39
126
|
session?: string;
|
|
40
127
|
requestId?: string;
|
|
@@ -44,6 +131,71 @@ export declare type BackendCommandContext = {
|
|
|
44
131
|
metadata?: Record<string, unknown>;
|
|
45
132
|
};
|
|
46
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
|
+
|
|
47
199
|
export declare type BackendEscapeHatches = {
|
|
48
200
|
androidShell?(context: BackendCommandContext, args: readonly string[]): Promise<BackendShellResult>;
|
|
49
201
|
iosRunnerCommand?(context: BackendCommandContext, command: BackendRunnerCommand): Promise<BackendActionResult>;
|
|
@@ -58,21 +210,166 @@ export declare type BackendFindTextResult = {
|
|
|
58
210
|
found: boolean;
|
|
59
211
|
};
|
|
60
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
|
+
|
|
61
234
|
export declare type BackendInstallTarget = {
|
|
62
|
-
app
|
|
63
|
-
|
|
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;
|
|
64
297
|
};
|
|
65
298
|
|
|
66
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
|
+
*/
|
|
67
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
|
+
*/
|
|
68
312
|
url?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Platform-specific activity override, primarily for Android app launches.
|
|
315
|
+
*/
|
|
69
316
|
activity?: string;
|
|
70
317
|
};
|
|
71
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
|
+
|
|
72
356
|
export declare type BackendReadTextResult = {
|
|
73
357
|
text: string;
|
|
74
358
|
};
|
|
75
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
|
+
|
|
76
373
|
export declare type BackendRunnerCommand = {
|
|
77
374
|
command: string;
|
|
78
375
|
args?: readonly string[];
|
|
@@ -90,6 +387,19 @@ export declare type BackendScreenshotResult = {
|
|
|
90
387
|
overlayRefs?: ScreenshotOverlayRef[];
|
|
91
388
|
};
|
|
92
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
|
+
|
|
93
403
|
export declare type BackendShellResult = {
|
|
94
404
|
exitCode: number;
|
|
95
405
|
stdout: string;
|
|
@@ -124,6 +434,10 @@ export declare type BackendSnapshotResult = {
|
|
|
124
434
|
appBundleId?: string;
|
|
125
435
|
};
|
|
126
436
|
|
|
437
|
+
export declare type BackendSwipeOptions = {
|
|
438
|
+
durationMs?: number;
|
|
439
|
+
};
|
|
440
|
+
|
|
127
441
|
export declare type BackendTapOptions = {
|
|
128
442
|
button?: 'primary' | 'secondary' | 'middle';
|
|
129
443
|
count?: number;
|
|
@@ -133,6 +447,14 @@ export declare type BackendTapOptions = {
|
|
|
133
447
|
doubleTap?: boolean;
|
|
134
448
|
};
|
|
135
449
|
|
|
450
|
+
export declare type BackendTraceOptions = {
|
|
451
|
+
outPath?: string;
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
export declare type BackendTraceResult = Record<string, unknown> & {
|
|
455
|
+
outPath?: string;
|
|
456
|
+
};
|
|
457
|
+
|
|
136
458
|
export declare function hasBackendCapability(backend: Pick<AgentDeviceBackend, 'platform' | 'capabilities'>, capability: BackendCapabilityName): boolean;
|
|
137
459
|
|
|
138
460
|
export declare function hasBackendEscapeHatch(backend: Pick<AgentDeviceBackend, 'escapeHatches'>, capability: BackendCapabilityName): boolean;
|