agent-device 0.19.3 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -70
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.0.apk +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.0.apk.sha256 +1 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.0.manifest.json +10 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.0.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.0.apk.sha256 +1 -0
- package/{android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.3.manifest.json → android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.0.manifest.json} +6 -6
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +2 -0
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +5 -0
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +5 -10
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +74 -174
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +113 -19
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+BlockingSystemModalResolution.swift +82 -0
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +272 -118
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +2 -2
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +134 -101
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +56 -2
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+LifecycleCacheTests.swift +73 -0
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +44 -24
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +2 -2
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +2 -107
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +126 -11
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +51 -8
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTraversalIdentityTests.swift +24 -0
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +1 -1
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +43 -35
- package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +14 -0
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +3 -0
- package/dist/src/android-adb.d.ts +1 -1
- package/dist/src/android-adb.js +1 -1
- package/dist/src/android-input-method-overlays.js +1 -0
- package/dist/src/android-input-ownership.js +1 -6
- package/dist/src/android-system-chrome.js +1 -0
- package/dist/src/android.js +1 -1
- package/dist/src/app-lifecycle.js +5 -5
- package/dist/src/app-log-request-scope.js +1 -0
- package/dist/src/app-resolution.js +1 -0
- package/dist/src/apple-multitouch-support.js +1 -0
- package/dist/src/apps.js +5 -5
- package/dist/src/boot-diagnostics.js +2 -0
- package/dist/src/cli-config.js +1 -0
- package/dist/src/cli-help.js +61 -27
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +15 -11
- package/dist/src/command-schema.js +3 -3
- package/dist/src/config.js +1 -0
- package/dist/src/context.js +1 -0
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/daemon-shutdown-report.js +1 -0
- package/dist/src/debug-symbols.js +1 -1
- package/dist/src/device-input-state.js +1 -1
- package/dist/src/devices2.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/finders.js +1 -1
- package/dist/src/generic.js +1 -1
- package/dist/src/helper.js +1 -1
- package/dist/src/index.d.ts +412 -293
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +4 -3
- package/dist/src/install-artifact.js +1 -0
- package/dist/src/install-source.d.ts +5 -1
- package/dist/src/install-source.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-snapshot.js +1 -1
- package/dist/src/interaction.d.ts +230 -0
- package/dist/src/interaction.js +1 -1
- package/dist/src/interactor.js +2 -2
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/internal/daemon.js +42 -20
- package/dist/src/internal/png-worker.d.ts +22 -0
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/launch-console.js +1 -0
- package/dist/src/lease-context.js +1 -0
- package/dist/src/lease.js +1 -1
- package/dist/src/linux.js +1 -1
- package/dist/src/logcat.js +5 -0
- package/dist/src/metro.d.ts +2 -2
- package/dist/src/notifications.js +1 -1
- package/dist/src/png-worker-contract.js +1 -1
- package/dist/src/process-lock.js +1 -0
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-trace.js +1 -1
- package/dist/src/register-builtins.js +1 -0
- package/dist/src/registry.js +24 -24
- package/dist/src/reporting.js +8 -7
- package/dist/src/runner-client.js +1 -1
- package/dist/src/runner-disposal.js +2 -0
- package/dist/src/runner-lease.js +1 -0
- package/dist/src/runner-sequence.js +1 -1
- package/dist/src/runtime.js +3 -3
- package/dist/src/runtime2.js +1 -0
- package/dist/src/sdk-android-adb.d.ts +119 -33
- package/dist/src/sdk-android-adb.js +2 -2
- package/dist/src/sdk-batch-runner.d.ts +2 -1
- package/dist/src/sdk-batch-runner.js +2 -2
- package/dist/src/sdk-batch.js +2 -2
- package/dist/src/sdk-contracts.d.ts +105 -98
- package/dist/src/sdk-contracts.js +1 -1
- package/dist/src/sdk-device.js +1 -1
- package/dist/src/sdk-finders.d.ts +3 -3
- package/dist/src/sdk-finders.js +1 -1
- package/dist/src/sdk-io.d.ts +1 -1
- package/dist/src/sdk-remote-config.d.ts +9 -1
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selector-vocabulary.js +1 -0
- package/dist/src/selectors.d.ts +12 -3
- package/dist/src/selectors.js +1 -1
- package/dist/src/server.js +3 -3
- package/dist/src/session-target-evidence.js +1 -0
- package/dist/src/session.js +8 -10
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-diagnostics.js +5 -2
- package/dist/src/snapshot.js +1 -1
- package/dist/src/snapshot2.js +1 -2
- package/dist/src/tv-remote.js +13 -12
- package/dist/src/url.js +1 -1
- package/dist/src/web.js +1 -1
- package/package.json +28 -23
- package/server.json +2 -2
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.3.apk +0 -0
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.3.apk.sha256 +0 -1
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.3.manifest.json +0 -10
- package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.3.apk +0 -0
- package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.3.apk.sha256 +0 -1
- package/dist/src/apple-runner-options.js +0 -1
- package/dist/src/cli-output.js +0 -1
- package/dist/src/client.js +0 -3
- package/dist/src/handler-utils.js +0 -1
- package/dist/src/output-path.js +0 -1
- package/dist/src/points.js +0 -4
- package/dist/src/provider.js +0 -1
- package/dist/src/providers.js +0 -1
- package/dist/src/record-trace-recording.js +0 -23
- package/dist/src/recording-provider.js +0 -1
- package/dist/src/selectors2.js +0 -1
- package/dist/src/simctl.js +0 -1
- package/dist/src/ttl-memo.js +0 -1
- package/dist/src/xml.js +0 -2
- /package/{macos-helper → apple/macos-helper}/Package.swift +0 -0
- /package/{macos-helper → apple/macos-helper}/Sources/AgentDeviceMacOSHelper/AudioProbe.swift +0 -0
- /package/{macos-helper → apple/macos-helper}/Sources/AgentDeviceMacOSHelper/SnapshotTraversal.swift +0 -0
- /package/{macos-helper → apple/macos-helper}/Sources/AgentDeviceMacOSHelper/main.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/xcshareddata/xcschemes/AgentDeviceRunner.xcscheme +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests-Bridging-Header.h +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests.entitlements +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.h +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.m +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests.xctestplan +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/RecordingScripts/recording-resize.swift +0 -0
- /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/RecordingScripts/recording-trim.swift +0 -0
- /package/{src/platforms/linux → linux}/atspi-dump.py +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{t as e}from"./rolldown-runtime.js";import{T as t,_ as n}from"./sdk-contracts.js";import{AsyncLocalStorage as r}from"node:async_hooks";import i from"node:crypto";import a,{constants as o}from"node:fs";import s from"node:os";import c from"node:path";import{pipeline as l}from"node:stream/promises";import{Readable as u}from"node:stream";import{access as d,stat as f}from"node:fs/promises";import{spawn as p,spawnSync as m}from"node:child_process";const h=new r;function g(){return i.randomBytes(8).toString(`hex`)}function ee(){return`${Date.now().toString(36)}-${i.randomBytes(4).toString(`hex`)}`}async function te(e,t){let n={...e,diagnosticId:ee(),events:[],liveWrittenEventCount:0,phaseCounts:new Map};return await h.run(n,t)}function ne(e){let t=h.getStore();t&&Object.assign(t,e)}function re(){let e=h.getStore();return e?{diagnosticId:e.diagnosticId,requestId:e.requestId,session:e.session,command:e.command,debug:e.debug,flushOnSuccess:e.flushOnSuccess}:{}}function ie(e){let t=h.getStore();if(!t)return 0;let n=0;for(let r of e)n+=t.phaseCounts.get(r)??0;return n}function _(e){let n=h.getStore();if(!n)return;let r={ts:new Date().toISOString(),level:e.level??`info`,phase:e.phase,session:n.session,requestId:n.requestId,command:n.command,durationMs:e.durationMs,data:e.data?t(e.data):void 0};if(n.events.push(r),n.phaseCounts.set(e.phase,(n.phaseCounts.get(e.phase)??0)+1),!n.debug)return;let i=`${JSON.stringify(r)}\n`;try{n.logPath&&(v(n.logPath,i),n.liveWrittenEventCount=n.events.length),n.traceLogPath&&v(n.traceLogPath,i),!n.logPath&&!n.traceLogPath&&process.stderr.write(`[agent-device][diag] ${i}`)}catch{}}async function ae(e,t,n){let r=Date.now();try{let i=await t();return _({level:`info`,phase:e,durationMs:Date.now()-r,data:n}),i}catch(t){throw _({level:`error`,phase:e,durationMs:Date.now()-r,data:{...n??{},error:t instanceof Error?t.message:String(t)}}),t}}function oe(e={}){let n=h.getStore();if(!n||!e.force&&!n.debug&&!n.flushOnSuccess||n.events.length===0)return null;try{if(n.logPath){let e=n.events.slice(n.liveWrittenEventCount);if(e.length>0){let r=e.map(e=>JSON.stringify(t(e)));v(n.logPath,`${r.join(`
|
|
2
2
|
`)}\n`)}let r=n.logPath;return n.events=[],n.liveWrittenEventCount=0,r}let e=se(n.session??`default`),r=new Date().toISOString().slice(0,10),i=c.join(s.homedir(),`.agent-device`,`logs`,e,r);a.mkdirSync(i,{recursive:!0});let o=new Date().toISOString().replace(/[:.]/g,`-`),l=c.join(i,`${o}-${n.diagnosticId}.ndjson`),u=n.events.map(e=>JSON.stringify(t(e)));return a.writeFileSync(l,`${u.join(`
|
|
3
|
-
`)}\n`),n.events=[],l}catch{return null}}function se(e){return e.replace(/[^a-zA-Z0-9._-]/g,`_`)}function v(e,t){a.mkdirSync(c.dirname(e),{recursive:!0}),a.appendFileSync(e,t,`utf8`)}const ce=new Set([`1`,`true`,`yes`,`on`]),le=new Set([`0`,`false`,`no`,`off`]);function ue(e){return`AGENT_DEVICE_${e.replace(/([A-Z])/g,`_$1`).replace(/[^A-Za-z0-9_]/g,`_`).toUpperCase()}`}function de(e,t,r,i){if(e.multiple)return(Array.isArray(t)?t:[t]).map(t=>de({...e,multiple:!1},t,r,i));if(e.type===`boolean`)return fe(t,r,i);if(e.type===`booleanOrString`){if(typeof t==`boolean`)return t;if(typeof t==`string`&&y(t)!==void 0)return y(t);if(typeof t==`string`&&t.trim().length>0)return t;throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected boolean or non-empty string.`)}if(e.type===`string`){if(typeof t==`string`&&t.trim().length>0)return t;throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected non-empty string.`)}if(e.type===`enum`){if(e.setValue!==void 0)return pe(e,t,r,i);if(typeof t!=`string`||!e.enumValues?.includes(t))throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected one of: ${e.enumValues?.join(`, `)}.`);return t}let a=typeof t==`number`?t:typeof t==`string`?Number(t):NaN;if(!Number.isFinite(a)||!Number.isInteger(a))throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected integer.`);if(typeof e.min==`number`&&a<e.min)throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Must be >= ${e.min}.`);if(typeof e.max==`number`&&a>e.max)throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Must be <= ${e.max}.`);return a}function fe(e,t,r){if(typeof e==`boolean`)return e;if(typeof e==`string`){let t=y(e);if(t!==void 0)return t}throw new n(`INVALID_ARGS`,`Invalid value for "${r}" in ${t}. Expected boolean.`)}function y(e){let t=e.trim().toLowerCase();if(ce.has(t))return!0;if(le.has(t))return!1}function pe(e,t,r,i){let a=e.setValue;if(t===a)return a;if(typeof t==`string`){let e=t.trim();if(e===``||e===`true`||e===`1`)return a;if(e===`false`||e===`0`)return}if(t===!0)return a;if(t!==!1)throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected boolean-like value for enum flag.`)}const me=/^[A-Za-z0-9][A-Za-z0-9._+-]*$/,he=[`.com`,`.exe`,`.bat`,`.cmd`],b=new r;async function ge(e,t){return e?await b.run(e,t):await t()}async function x(e){return await b.run(void 0,e)}async function _e(e,t,n={}){let r=b.getStore()?.(e,t,n);return r?S(await r):await C(e,t,n)}async function ve(e,t,n={}){let r=b.getStore()?.(e,t,n);return r?S(await r):await C(e,t,n)}function S(e){let t=typeof e.stdout==`string`?e.stdout:String(e.stdout??``),n=typeof e.stderr==`string`?e.stderr:String(e.stderr??``),r=typeof e.exitCode==`number`?e.exitCode:1;return t===e.stdout&&n===e.stderr&&r===e.exitCode?e:{...e,stdout:t,stderr:n,exitCode:r}}function C(e,t,n={}){let r=O(e),i=E();return new Promise((a,o)=>{let s=p(r,t,{cwd:n.cwd,env:n.env,stdio:[`pipe`,`pipe`,`pipe`],detached:n.detached,windowsHide:!0,shell:!1});n.onSpawn?.(s);let c=``,l=n.binaryStdout?[]:void 0,u=``,d=!1,f=B(n.timeoutMs),m=f?setTimeout(()=>{d=!0,H(s,n.detached)},f):null,h=V(s,n);n.binaryStdout||s.stdout.setEncoding(`utf8`),s.stderr.setEncoding(`utf8`),je(s,n.stdin).catch(i=>{h.didAbort||d||Me(i)||(o(Ee(r,e,t,i)),H(s,n.detached))}),s.stdout.on(`data`,e=>{if(n.binaryStdout){l?.push(Buffer.isBuffer(e)?e:Buffer.from(e));return}let t=String(e);c+=t,n.onStdoutChunk?.(t)}),s.stderr.on(`data`,e=>{let t=String(e);u+=t,n.onStderrChunk?.(t)}),s.on(`error`,n=>{m&&clearTimeout(m),h.dispose(),i.emitForegroundCompletion(e,t),o(P(h,r,e,t,n))}),s.on(`close`,s=>{m&&clearTimeout(m),h.dispose(),i.emitForegroundCompletion(e,t);let p=s??1;if(!h.didAbort&&d&&f){o(De(r,e,t,f,p,c,u));return}let g=F(h,r,e,t,p,n.allowFailure,c,u);if(g){o(g);return}a({stdout:c,stderr:u,exitCode:p,stdoutBuffer:l?Buffer.concat(l):void 0})})})}async function ye(e){let t=L(e);if(!t)return!1;if(c.isAbsolute(t))return R(t);let n=process.env.PATH;if(!n)return!1;let r=ke();for(let e of n.split(c.delimiter)){let n=e.trim();if(n){for(let e of Ae(t,r))if(await R(c.join(n,e)))return!0}}return!1}async function be(e,t){let r=I(e,t,`executable`);if(r){if(!await R(r))throw new n(`TOOL_MISSING`,`${t} points to a missing or non-executable file: ${r}`,{envName:t,path:r});return r}}async function xe(e,t){let r=I(e,t,`file`);if(r){if(!await z(r))throw new n(`TOOL_MISSING`,`${t} points to a missing or non-file path: ${r}`,{envName:t,path:r});return r}}function Se(e,t,r={}){let i=O(e),a=m(i,t,{cwd:r.cwd,env:r.env,stdio:[`pipe`,`pipe`,`pipe`],encoding:r.binaryStdout?void 0:`utf8`,input:r.stdin,timeout:B(r.timeoutMs),windowsHide:!0,shell:!1,...r.maxBuffer===void 0?{}:{maxBuffer:r.maxBuffer}});if(a.error){let o=a.error.code;throw o===`ETIMEDOUT`?new n(`COMMAND_FAILED`,`${i} timed out after ${B(r.timeoutMs)}ms`,{cmd:e,args:t,timeoutMs:B(r.timeoutMs)},a.error):o===`ENOENT`?k(i,e,a.error):A(i,e,t,a.error)}let o=r.binaryStdout?Buffer.isBuffer(a.stdout)?a.stdout:Buffer.from(a.stdout??``):void 0,s=r.binaryStdout?``:typeof a.stdout==`string`?a.stdout:(a.stdout??``).toString(),c=typeof a.stderr==`string`?a.stderr:(a.stderr??``).toString(),l=a.status??1;if(l!==0&&!r.allowFailure)throw M(i,e,t,l,s,c);return{stdout:s,stderr:c,exitCode:l,stdoutBuffer:o}}function Ce(e,t,n={}){return w(e,t,n).pid}function w(e,t,n={}){let r=p(O(e),t,{cwd:n.cwd,env:n.env,stdio:n.stdio??`ignore`,detached:!0,windowsHide:!0,shell:!1}),i=r.pid??0,a=new Promise(e=>{r.once(`error`,t=>{e({pid:i,error:t.message})}),r.once(`exit`,(t,n)=>{e({pid:i,...typeof t==`number`?{exitCode:t}:{},...n?{signal:n}:{}})})});return r.unref(),{pid:i,exited:a}}function T(e,t,n={}){let r=O(e),i=E(),a=p(r,t,{cwd:n.cwd,env:n.env,stdio:n.stdio??[`ignore`,`pipe`,`pipe`],detached:n.detached,windowsHide:!0,shell:!1});i.emitBackgroundSpawn(e,t);let o=``,s=``,c=n.captureOutput??!0,l=V(a,n);return c&&(a.stdout?.setEncoding(`utf8`),a.stderr?.setEncoding(`utf8`),a.stdout?.on(`data`,e=>{o+=e}),a.stderr?.on(`data`,e=>{s+=e})),{child:a,wait:new Promise((c,u)=>{a.on(`error`,n=>{l.dispose(),i.emitBackgroundCompletion(e,t,`error`),u(P(l,r,e,t,n))}),a.on(`close`,a=>{l.dispose(),i.emitBackgroundCompletion(e,t,`exit`);let d=a??1,f=F(l,r,e,t,d,n.allowFailure,o,s);if(f){u(f);return}c({stdout:o,stderr:s,exitCode:d})})})}}function E(){let e=re(),t=e.debug===!0,n=y(process.env.AGENT_DEVICE_EXEC_TRACE??``)===!0;if(!t&&!n)return we();n&&e.flushOnSuccess!==!0&&ne({flushOnSuccess:!0});let r=Date.now(),i=!1;return{emitForegroundCompletion:(e,t)=>{i||(i=!0,D({cmd:e,args:t,startedAtMs:r}))},emitBackgroundSpawn:(e,t)=>{D({cmd:e,args:t,data:{event:`spawn`}})},emitBackgroundCompletion:(e,t,n)=>{i||(i=!0,D({cmd:e,args:t,startedAtMs:r,data:{event:n}}))}}}function we(){return{emitForegroundCompletion:()=>{},emitBackgroundSpawn:()=>{},emitBackgroundCompletion:()=>{}}}function D(e){let t=e.args.slice(0,6);_({level:`debug`,phase:`exec_command`,durationMs:e.startedAtMs===void 0?void 0:Math.max(0,Date.now()-e.startedAtMs),data:{command:e.cmd,argsPrefix:t,...e.args.length>t.length?{omittedArgCount:e.args.length-t.length}:{},...e.data??{}}})}function O(e){let t=L(e);if(!t)throw new n(`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 Te(e,t,n,r){return r.code===`ENOENT`?k(e,t,r):A(e,t,n,r)}function k(e,t,r){return new n(`TOOL_MISSING`,`${e} not found in PATH`,{cmd:t},r)}function A(e,t,r,i){return new n(`COMMAND_FAILED`,`Failed to run ${e}`,{cmd:t,args:r},i)}function Ee(e,t,r,i){return new n(`COMMAND_FAILED`,`Failed to write stdin for ${e}`,{cmd:t,args:r},i instanceof Error?i:void 0)}function j(e,t,r){return new n(`COMMAND_FAILED`,`request canceled`,{cmd:t,args:r,executable:e,reason:`request_canceled`})}function De(e,t,r,i,a,o,s){return new n(`COMMAND_FAILED`,`${e} timed out after ${i}ms`,{cmd:t,args:r,stdout:o,stderr:s,exitCode:a,timeoutMs:i})}function M(e,t,r,i,a,o){return new n(`COMMAND_FAILED`,`${e} exited with code ${i}`,N({stdout:a,stderr:o,exitCode:i},{cmd:t,args:r}))}function Oe(e,t,r){if(e.exitCode===0)return e;throw new n(`COMMAND_FAILED`,t,N(e,typeof r==`function`?r(e):r))}function N(e,t){return{stdout:e.stdout,stderr:e.stderr,exitCode:e.exitCode,processExitError:!0,...t}}function P(e,t,n,r,i){return e.didAbort?j(t,n,r):Te(t,n,r,i)}function F(e,t,n,r,i,a,o,s){return e.didAbort?j(t,n,r):i!==0&&!a?M(t,n,r,i,o,s):null}function I(e,t,r){let i=e?.trim();if(i){if(!c.isAbsolute(i)||i.includes(`\0`))throw new n(`INVALID_ARGS`,`${t} must be an absolute ${r} path, not ${JSON.stringify(e)}`,{envName:t,path:e});return i}}function L(e){let t=e.trim();return!t||t.includes(`\0`)?null:c.isAbsolute(t)?t:t.includes(`/`)||t.includes(`\\`)?null:me.test(t)?t:null}function ke(){if(process.platform!==`win32`)return[``];let e=process.env.PATHEXT;if(!e)return he;let t=e.split(`;`).map(e=>e.trim().toLowerCase()).filter(e=>e.length>0);return t.length>0?t:he}function Ae(e,t){if(process.platform!==`win32`)return[e];let n=e.toLowerCase();return t.some(e=>n.endsWith(e))?[e]:t.map(t=>`${e}${t}`)}async function R(e){try{return await z(e)?(await d(e,process.platform===`win32`?o.F_OK:o.X_OK),!0):!1}catch{return!1}}async function z(e){try{return(await f(e)).isFile()}catch{return!1}}function B(e){if(!Number.isFinite(e))return;let t=Math.floor(e);if(!(t<=0))return t}function V(e,t){let n=!1,r=()=>{n=!0,H(e,t.detached)};return t.signal?.aborted?r():t.signal?.addEventListener(`abort`,r,{once:!0}),{get didAbort(){return n},dispose:()=>{t.signal?.removeEventListener(`abort`,r)}}}function H(e,t){if(t&&e.pid&&process.platform!==`win32`)try{process.kill(-e.pid,`SIGKILL`);return}catch{}e.kill(`SIGKILL`)}async function je(e,t){if(e.stdin){if(t===void 0){e.stdin?.end();return}await l(u.from([t]),e.stdin)}}function Me(e){return e instanceof Error&&`code`in e&&e.code===`EPIPE`}var Ne=e({androidAdbResultError:()=>K,attachAdbFailureHint:()=>G,classifyAdbFailure:()=>W,createAndroidPortReverseManager:()=>We,createDeviceAdbExecutor:()=>Y,createLocalAndroidAdbProvider:()=>Ve,installAndroidAdbPackage:()=>Ke,pullAndroidAdbFile:()=>Ge,resolveAndroidAdbExecutor:()=>He,resolveAndroidAdbProvider:()=>X,resolveAndroidTextInjector:()=>Ue,resolveAndroidTouchInjector:()=>Z,withAndroidAdbProvider:()=>Je});const U=new r,Pe=[{reason:`device_unauthorized`,pattern:/device unauthorized|device still authorizing/,hint:`USB debugging is not authorized — accept the authorization prompt on the device screen (re-plug the cable if none appears), then retry.`},{reason:`device_offline`,pattern:/device offline/,hint:`The device is connected but offline — wait for it to finish booting or run adb reconnect, then retry.`,retriable:!0},{reason:`multiple_devices`,pattern:/more than one (?:device\/emulator|device and emulator)/,hint:`Multiple Android devices are connected — pass --serial <serial> (see adb devices) to select one.`},{reason:`no_devices`,pattern:/no devices\/emulators found|no devices found/,hint:`No Android devices detected — boot an emulator or connect a device and verify it appears in adb devices.`},{reason:`device_not_found`,pattern:/device (?:'[^']*' )?not found/,hint:`The device disconnected or is restarting — verify it is listed in adb devices, then retry.`,retriable:!0},{reason:`server_version_mismatch`,pattern:/adb server version \(\d+\) doesn't match this client/,hint:`Multiple adb installs conflict — adb restarts its server automatically, so retry; align PATH to a single adb to stop recurrences.`,retriable:!0},{reason:`connection_dropped`,pattern:/transport error|connection reset|broken pipe|protocol fault/,hint:`The adb connection dropped — retry; if it persists, run adb kill-server and reconnect the device.`,retriable:!0},{reason:`install_insufficient_storage`,pattern:/install_failed_insufficient_storage/,hint:`The device is out of storage — free up space or uninstall unused apps, then retry the install.`,matchStdout:!0},{reason:`install_update_incompatible`,pattern:/install_failed_update_incompatible/,hint:`The installed app has an incompatible signature — uninstall the existing app first, then retry the install.`,matchStdout:!0},{reason:`install_version_downgrade`,pattern:/install_failed_version_downgrade/,hint:`The APK is older than the installed app — uninstall the app first (or install with downgrade allowed), then retry.`,matchStdout:!0},{reason:`install_failed`,pattern:/install_failed_\w+|install_parse_failed_\w+/,hint:`The Android package installer rejected the APK — see the INSTALL_FAILED code in the error output for the exact cause.`,matchStdout:!0}],Fe={reason:`timeout`,hint:`adb timed out — the adb server may be wedged. Run adb kill-server && adb start-server, check adb devices, then retry.`};function W(e,t=``){let n=e.toLowerCase(),r=t.toLowerCase();for(let{pattern:e,matchStdout:t,...i}of Pe)if(e.test(n)||t&&e.test(r))return i}function G(e){if(!(e instanceof n)||e.code!==`COMMAND_FAILED`)return e;let t=Ie(e);return t&&(e.details={...e.details,adbFailure:t.reason,...typeof e.details?.hint==`string`?{}:{hint:t.hint},...t.retriable!==void 0&&e.details?.retriable===void 0?{retriable:t.retriable}:{}}),e}function Ie(e){return typeof e.details?.timeoutMs==`number`?Fe:W(typeof e.details?.stderr==`string`?e.details.stderr:``,typeof e.details?.stdout==`string`?e.details.stdout:``)}function K(e,t,r){return G(new n(`COMMAND_FAILED`,e,t.exitCode===0?{stdout:t.stdout,stderr:t.stderr,exitCode:t.exitCode,...r}:N(t,r)))}function q(e){return async(...t)=>{try{return await e(...t)}catch(e){throw G(e)}}}const Le=new WeakSet;function Re(e){if(Le.has(e))return e;let t={...e,exec:q(J(e.exec)),...e.pull?{pull:q(J(e.pull))}:{},...e.install?{install:q(J(e.install))}:{},...e.installBundle?{installBundle:q(e.installBundle)}:{}};return Le.add(t),t}function J(e){return async(...t)=>S(await e(...t))}function Y(e){return ze(e.id)}function ze(e){return q(async(t,n)=>await x(async()=>await _e(`adb`,[`-s`,e,...t],{...n,detached:process.platform!==`win32`})))}function Be(e){return(t,n)=>{let r=T(`adb`,[`-s`,e,...t],{...n,allowFailure:!0,captureOutput:!1});return r.wait.catch(()=>{}),r.child}}function Ve(e){let t=Y(e);return{exec:t,spawn:Be(e.id),reverse:Ze(t),pull:async(e,n,r)=>await t([`pull`,e,n],r),install:async(e,n)=>{let{installArgs:r,execOptions:i}=$(n);return await t([`install`,...r,e],i)}}}function He(e,t){let n=U.getStore();return t||(n?.serial===e.id?n.provider.exec:Y(e))}function X(e,t){if(t)return Q(t);let n=U.getStore();return n?.serial===e.id?Q(n.provider):Ve(e)}function Ue(e){let t=U.getStore();return t?.serial===e.id?t.provider.text:void 0}function Z(e){let t=U.getStore();return t?.serial===e.id?t.provider.touch:void 0}function We(e){let t=Q(e),r=t.reverse??Ze(t.exec),i=new Map;return{async ensure(e,t){let a=i.get(e.local);if(a&&a.ownerId!==e.ownerId)throw new n(`COMMAND_FAILED`,`Android port reverse ${e.local} is already owned by ${a.ownerId??`another session`}`,{current:a,requested:e});a?.remote!==e.remote&&(await r.ensure(e,t),i.set(e.local,{...e}))},async remove(e,t){if(!i.has(e)){await r.remove(e,t);return}await r.remove(e,t),i.delete(e)},async removeAllOwned(e,t){let n=[...i.values()].filter(t=>t.ownerId===e).map(e=>e.local);if(n.length===0){await r.removeAllOwned(e,t);return}for(let e of n)await r.remove(e,t),i.delete(e)},async list(e){return r.list?await r.list(e):[...i.values()]}}}function Q(e){return Re(typeof e==`function`?{exec:e}:e)}async function Ge(e,t,r){let{device:i,provider:a,...o}=r??{},s=qe(i,a),c=s?.pull;if(c)return await x(async()=>await c(e,t,o));let l=s?.exec;if(!l)throw new n(`COMMAND_FAILED`,`Android adb pull requires an adb provider`);return await x(async()=>await l([`pull`,e,t],o))}async function Ke(e,t){let{device:r,provider:i,...a}=t??{},o=qe(r,i),s=o?.install;if(s)return await x(async()=>await s(e,a));let c=o?.exec;if(!c)throw new n(`COMMAND_FAILED`,`Android adb install requires an adb provider`);let{installArgs:l,execOptions:u}=$(a);return await x(async()=>await c([`install`,...l,e],u))}function qe(e,t){if(t)return Q(t);if(e)return X(e);let n=U.getStore();if(n)return Q(n.provider)}async function Je(e,t,n){if(!e)return await n();let r={provider:Q(e),serial:t.serial},i=Ye(r);return await U.run(r,async()=>await ge(i,n))}function Ye(e){return(t,n,r)=>{if(t!==`adb`)return;let i=Xe(n,e.serial);if(i)return x(async()=>await e.provider.exec(i,r))}}function Xe(e,t){if(!(e[0]!==`-s`||!e[1])&&e[1]===t)return e.slice(2)}function Ze(e){let t=new Map;return{async ensure(n,r){if(await e([`reverse`,n.local,n.remote],{allowFailure:!1,signal:r?.signal,timeoutMs:r?.timeoutMs}),n.ownerId){let e=t.get(n.ownerId)??new Set;e.add(n.local),t.set(n.ownerId,e)}},async remove(n,r){let i=await e([`reverse`,`--remove`,n],{allowFailure:!0,signal:r?.signal,timeoutMs:r?.timeoutMs});if(i.exitCode!==0&&!$e(i.stdout,i.stderr))throw K(`Failed to remove Android port reverse ${n}`,i,{local:n});for(let e of t.values())e.delete(n)},async removeAllOwned(e,n){let r=[...t.get(e)??[]];for(let e of r)await this.remove(e,n);t.delete(e)},async list(n){let r=await e([`reverse`,`--list`],{allowFailure:!0,signal:n?.signal,timeoutMs:n?.timeoutMs});return r.exitCode===0?Qe(r.stdout,t):[]}}}function Qe(e,t){let n=new Map;for(let[e,r]of t)for(let t of r)n.set(t,e);return e.split(`
|
|
4
|
-
`).map(e=>e.trim().split(/\s+/)).filter(e=>e.length>=3).map(([,e,t])=>{let r=e;return{local:r,remote:t,ownerId:n.get(r)}})}function $e(e,t){let n=`${e}\n${t}`.toLowerCase();return n.includes(`listener`)&&n.includes(`not found`)}function
|
|
3
|
+
`)}\n`),n.events=[],l}catch{return null}}function se(e){return e.replace(/[^a-zA-Z0-9._-]/g,`_`)}function v(e,t){a.mkdirSync(c.dirname(e),{recursive:!0}),a.appendFileSync(e,t,`utf8`)}const ce=new Set([`1`,`true`,`yes`,`on`]),le=new Set([`0`,`false`,`no`,`off`]);function ue(e){return`AGENT_DEVICE_${e.replace(/([A-Z])/g,`_$1`).replace(/[^A-Za-z0-9_]/g,`_`).toUpperCase()}`}function de(e,t,r,i){if(e.multiple)return(Array.isArray(t)?t:[t]).map(t=>de({...e,multiple:!1},t,r,i));if(e.type===`boolean`)return fe(t,r,i);if(e.type===`booleanOrString`){if(typeof t==`boolean`)return t;if(typeof t==`string`&&y(t)!==void 0)return y(t);if(typeof t==`string`&&t.trim().length>0)return t;throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected boolean or non-empty string.`)}if(e.type===`string`){if(typeof t==`string`&&t.trim().length>0)return t;throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected non-empty string.`)}if(e.type===`enum`){if(e.setValue!==void 0)return pe(e,t,r,i);if(typeof t!=`string`||!e.enumValues?.includes(t))throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected one of: ${e.enumValues?.join(`, `)}.`);return t}let a=typeof t==`number`?t:typeof t==`string`?Number(t):NaN;if(!Number.isFinite(a)||!Number.isInteger(a))throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected integer.`);if(typeof e.min==`number`&&a<e.min)throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Must be >= ${e.min}.`);if(typeof e.max==`number`&&a>e.max)throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Must be <= ${e.max}.`);return a}function fe(e,t,r){if(typeof e==`boolean`)return e;if(typeof e==`string`){let t=y(e);if(t!==void 0)return t}throw new n(`INVALID_ARGS`,`Invalid value for "${r}" in ${t}. Expected boolean.`)}function y(e){let t=e.trim().toLowerCase();if(ce.has(t))return!0;if(le.has(t))return!1}function pe(e,t,r,i){let a=e.setValue;if(t===a)return a;if(typeof t==`string`){let e=t.trim();if(e===``||e===`true`||e===`1`)return a;if(e===`false`||e===`0`)return}if(t===!0)return a;if(t!==!1)throw new n(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected boolean-like value for enum flag.`)}const me=/^[A-Za-z0-9][A-Za-z0-9._+-]*$/,he=[`.com`,`.exe`,`.bat`,`.cmd`],b=new r;async function ge(e,t){return e?await b.run(e,t):await t()}async function x(e){return await b.run(void 0,e)}async function S(e,t,n={}){let r=b.getStore()?.(e,t,n);return r?C(await r):await w(e,t,n)}async function _e(e,t,n={}){let r=b.getStore()?.(e,t,n);return r?C(await r):await w(e,t,n)}function C(e){let t=typeof e.stdout==`string`?e.stdout:String(e.stdout??``),n=typeof e.stderr==`string`?e.stderr:String(e.stderr??``),r=typeof e.exitCode==`number`?e.exitCode:1;return t===e.stdout&&n===e.stderr&&r===e.exitCode?e:{...e,stdout:t,stderr:n,exitCode:r}}function w(e,t,n={}){let r=k(e),i=D();return new Promise((a,o)=>{let s=p(r,t,{cwd:n.cwd,env:n.env,stdio:[`pipe`,`pipe`,`pipe`],detached:n.detached,windowsHide:!0,shell:!1});n.onSpawn?.(s);let c=``,l=n.binaryStdout?[]:void 0,u=``,d=!1,f=V(n.timeoutMs),m=f?setTimeout(()=>{d=!0,U(s,n.detached)},f):null,h=H(s,n);n.binaryStdout||s.stdout.setEncoding(`utf8`),s.stderr.setEncoding(`utf8`),Ae(s,n.stdin).catch(i=>{h.didAbort||d||je(i)||(o(Te(r,e,t,i)),U(s,n.detached))}),s.stdout.on(`data`,e=>{if(n.binaryStdout){l?.push(Buffer.isBuffer(e)?e:Buffer.from(e));return}let t=String(e);c+=t,n.onStdoutChunk?.(t)}),s.stderr.on(`data`,e=>{let t=String(e);u+=t,n.onStderrChunk?.(t)}),s.on(`error`,n=>{m&&clearTimeout(m),h.dispose(),i.emitForegroundCompletion(e,t),o(F(h,r,e,t,n))}),s.on(`close`,s=>{m&&clearTimeout(m),h.dispose(),i.emitForegroundCompletion(e,t);let p=s??1;if(!h.didAbort&&d&&f){o(Ee(r,e,t,f,p,c,u));return}let g=I(h,r,e,t,p,n.allowFailure,c,u);if(g){o(g);return}a({stdout:c,stderr:u,exitCode:p,stdoutBuffer:l?Buffer.concat(l):void 0})})})}async function ve(e){let t=R(e);if(!t)return!1;if(c.isAbsolute(t))return z(t);let n=process.env.PATH;if(!n)return!1;let r=Oe();for(let e of n.split(c.delimiter)){let n=e.trim();if(n){for(let e of ke(t,r))if(await z(c.join(n,e)))return!0}}return!1}async function ye(e,t){let r=L(e,t,`executable`);if(r){if(!await z(r))throw new n(`TOOL_MISSING`,`${t} points to a missing or non-executable file: ${r}`,{envName:t,path:r});return r}}async function be(e,t){let r=L(e,t,`file`);if(r){if(!await B(r))throw new n(`TOOL_MISSING`,`${t} points to a missing or non-file path: ${r}`,{envName:t,path:r});return r}}function xe(e,t,r={}){let i=k(e),a=m(i,t,{cwd:r.cwd,env:r.env,stdio:[`pipe`,`pipe`,`pipe`],encoding:r.binaryStdout?void 0:`utf8`,input:r.stdin,timeout:V(r.timeoutMs),windowsHide:!0,shell:!1,...r.maxBuffer===void 0?{}:{maxBuffer:r.maxBuffer}});if(a.error){let o=a.error.code;throw o===`ETIMEDOUT`?new n(`COMMAND_FAILED`,`${i} timed out after ${V(r.timeoutMs)}ms`,{cmd:e,args:t,timeoutMs:V(r.timeoutMs)},a.error):o===`ENOENT`?A(i,e,a.error):j(i,e,t,a.error)}let o=r.binaryStdout?Buffer.isBuffer(a.stdout)?a.stdout:Buffer.from(a.stdout??``):void 0,s=r.binaryStdout?``:typeof a.stdout==`string`?a.stdout:(a.stdout??``).toString(),c=typeof a.stderr==`string`?a.stderr:(a.stderr??``).toString(),l=a.status??1;if(l!==0&&!r.allowFailure)throw N(i,e,t,l,s,c);return{stdout:s,stderr:c,exitCode:l,stdoutBuffer:o}}function Se(e,t,n={}){return T(e,t,n).pid}function T(e,t,n={}){let r=p(k(e),t,{cwd:n.cwd,env:n.env,stdio:n.stdio??`ignore`,detached:!0,windowsHide:!0,shell:!1}),i=r.pid??0,a=new Promise(e=>{r.once(`error`,t=>{e({pid:i,error:t.message})}),r.once(`exit`,(t,n)=>{e({pid:i,...typeof t==`number`?{exitCode:t}:{},...n?{signal:n}:{}})})});return r.unref(),{pid:i,exited:a}}function E(e,t,n={}){let r=k(e),i=D(),a=p(r,t,{cwd:n.cwd,env:n.env,stdio:n.stdio??[`ignore`,`pipe`,`pipe`],detached:n.detached,windowsHide:!0,shell:!1});i.emitBackgroundSpawn(e,t);let o=``,s=``,c=n.captureOutput??!0,l=H(a,n);return c&&(a.stdout?.setEncoding(`utf8`),a.stderr?.setEncoding(`utf8`),a.stdout?.on(`data`,e=>{o+=e}),a.stderr?.on(`data`,e=>{s+=e})),{child:a,wait:new Promise((c,u)=>{a.on(`error`,n=>{l.dispose(),i.emitBackgroundCompletion(e,t,`error`),u(F(l,r,e,t,n))}),a.on(`close`,a=>{l.dispose(),i.emitBackgroundCompletion(e,t,`exit`);let d=a??1,f=I(l,r,e,t,d,n.allowFailure,o,s);if(f){u(f);return}c({stdout:o,stderr:s,exitCode:d})})})}}function D(){let e=re(),t=e.debug===!0,n=y(process.env.AGENT_DEVICE_EXEC_TRACE??``)===!0;if(!t&&!n)return Ce();n&&e.flushOnSuccess!==!0&&ne({flushOnSuccess:!0});let r=Date.now(),i=!1;return{emitForegroundCompletion:(e,t)=>{i||(i=!0,O({cmd:e,args:t,startedAtMs:r}))},emitBackgroundSpawn:(e,t)=>{O({cmd:e,args:t,data:{event:`spawn`}})},emitBackgroundCompletion:(e,t,n)=>{i||(i=!0,O({cmd:e,args:t,startedAtMs:r,data:{event:n}}))}}}function Ce(){return{emitForegroundCompletion:()=>{},emitBackgroundSpawn:()=>{},emitBackgroundCompletion:()=>{}}}function O(e){let t=e.args.slice(0,6);_({level:`debug`,phase:`exec_command`,durationMs:e.startedAtMs===void 0?void 0:Math.max(0,Date.now()-e.startedAtMs),data:{command:e.cmd,argsPrefix:t,...e.args.length>t.length?{omittedArgCount:e.args.length-t.length}:{},...e.data??{}}})}function k(e){let t=R(e);if(!t)throw new n(`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 we(e,t,n,r){return r.code===`ENOENT`?A(e,t,r):j(e,t,n,r)}function A(e,t,r){return new n(`TOOL_MISSING`,`${e} not found in PATH`,{cmd:t},r)}function j(e,t,r,i){return new n(`COMMAND_FAILED`,`Failed to run ${e}`,{cmd:t,args:r},i)}function Te(e,t,r,i){return new n(`COMMAND_FAILED`,`Failed to write stdin for ${e}`,{cmd:t,args:r},i instanceof Error?i:void 0)}function M(e,t,r){return new n(`COMMAND_FAILED`,`request canceled`,{cmd:t,args:r,executable:e,reason:`request_canceled`})}function Ee(e,t,r,i,a,o,s){return new n(`COMMAND_FAILED`,`${e} timed out after ${i}ms`,{cmd:t,args:r,stdout:o,stderr:s,exitCode:a,timeoutMs:i})}function N(e,t,r,i,a,o){return new n(`COMMAND_FAILED`,`${e} exited with code ${i}`,P({stdout:a,stderr:o,exitCode:i},{cmd:t,args:r}))}function De(e,t,r){if(e.exitCode===0)return e;throw new n(`COMMAND_FAILED`,t,P(e,typeof r==`function`?r(e):r))}function P(e,t){return{stdout:e.stdout,stderr:e.stderr,exitCode:e.exitCode,processExitError:!0,...t}}function F(e,t,n,r,i){return e.didAbort?M(t,n,r):we(t,n,r,i)}function I(e,t,n,r,i,a,o,s){return e.didAbort?M(t,n,r):i!==0&&!a?N(t,n,r,i,o,s):null}function L(e,t,r){let i=e?.trim();if(i){if(!c.isAbsolute(i)||i.includes(`\0`))throw new n(`INVALID_ARGS`,`${t} must be an absolute ${r} path, not ${JSON.stringify(e)}`,{envName:t,path:e});return i}}function R(e){let t=e.trim();return!t||t.includes(`\0`)?null:c.isAbsolute(t)?t:t.includes(`/`)||t.includes(`\\`)?null:me.test(t)?t:null}function Oe(){if(process.platform!==`win32`)return[``];let e=process.env.PATHEXT;if(!e)return he;let t=e.split(`;`).map(e=>e.trim().toLowerCase()).filter(e=>e.length>0);return t.length>0?t:he}function ke(e,t){if(process.platform!==`win32`)return[e];let n=e.toLowerCase();return t.some(e=>n.endsWith(e))?[e]:t.map(t=>`${e}${t}`)}async function z(e){try{return await B(e)?(await d(e,process.platform===`win32`?o.F_OK:o.X_OK),!0):!1}catch{return!1}}async function B(e){try{return(await f(e)).isFile()}catch{return!1}}function V(e){if(!Number.isFinite(e))return;let t=Math.floor(e);if(!(t<=0))return t}function H(e,t){let n=!1,r=()=>{n=!0,U(e,t.detached)};return t.signal?.aborted?r():t.signal?.addEventListener(`abort`,r,{once:!0}),{get didAbort(){return n},dispose:()=>{t.signal?.removeEventListener(`abort`,r)}}}function U(e,t){if(t&&e.pid&&process.platform!==`win32`)try{process.kill(-e.pid,`SIGKILL`);return}catch{}e.kill(`SIGKILL`)}async function Ae(e,t){if(e.stdin){if(t===void 0){e.stdin?.end();return}await l(u.from([t]),e.stdin)}}function je(e){return e instanceof Error&&`code`in e&&e.code===`EPIPE`}var Me=e({androidAdbResultError:()=>q,attachAdbFailureHint:()=>K,classifyAdbFailure:()=>G,createAndroidPortReverseManager:()=>Ue,createDeviceAdbExecutor:()=>X,createLocalAndroidAdbProvider:()=>Be,installAndroidAdbPackage:()=>Ge,pullAndroidAdbFile:()=>We,resolveAndroidAdbExecutor:()=>Ve,resolveAndroidAdbProvider:()=>Z,resolveAndroidTextInjector:()=>He,resolveAndroidTouchProvider:()=>Q,withAndroidAdbProvider:()=>qe});const W=new r,Ne=[{reason:`device_unauthorized`,pattern:/device unauthorized|device still authorizing/,hint:`USB debugging is not authorized — accept the authorization prompt on the device screen (re-plug the cable if none appears), then retry.`},{reason:`device_offline`,pattern:/device offline/,hint:`The device is connected but offline — wait for it to finish booting or run adb reconnect, then retry.`,retriable:!0},{reason:`multiple_devices`,pattern:/more than one (?:device\/emulator|device and emulator)/,hint:`Multiple Android devices are connected — pass --serial <serial> (see adb devices) to select one.`},{reason:`no_devices`,pattern:/no devices\/emulators found|no devices found/,hint:`No Android devices detected — boot an emulator or connect a device and verify it appears in adb devices.`},{reason:`device_not_found`,pattern:/device (?:'[^']*' )?not found/,hint:`The device disconnected or is restarting — verify it is listed in adb devices, then retry.`,retriable:!0},{reason:`server_version_mismatch`,pattern:/adb server version \(\d+\) doesn't match this client/,hint:`Multiple adb installs conflict — adb restarts its server automatically, so retry; align PATH to a single adb to stop recurrences.`,retriable:!0},{reason:`connection_dropped`,pattern:/transport error|connection reset|broken pipe|protocol fault/,hint:`The adb connection dropped — retry; if it persists, run adb kill-server and reconnect the device.`,retriable:!0},{reason:`install_insufficient_storage`,pattern:/install_failed_insufficient_storage/,hint:`The device is out of storage — free up space or uninstall unused apps, then retry the install.`,matchStdout:!0},{reason:`install_update_incompatible`,pattern:/install_failed_update_incompatible/,hint:`The installed app has an incompatible signature — uninstall the existing app first, then retry the install.`,matchStdout:!0},{reason:`install_version_downgrade`,pattern:/install_failed_version_downgrade/,hint:`The APK is older than the installed app — uninstall the app first (or install with downgrade allowed), then retry.`,matchStdout:!0},{reason:`install_failed`,pattern:/install_failed_\w+|install_parse_failed_\w+/,hint:`The Android package installer rejected the APK — see the INSTALL_FAILED code in the error output for the exact cause.`,matchStdout:!0}],Pe={reason:`timeout`,hint:`adb timed out — the adb server may be wedged. Run adb kill-server && adb start-server, check adb devices, then retry.`};function G(e,t=``){let n=e.toLowerCase(),r=t.toLowerCase();for(let{pattern:e,matchStdout:t,...i}of Ne)if(e.test(n)||t&&e.test(r))return i}function K(e){if(!(e instanceof n)||e.code!==`COMMAND_FAILED`)return e;let t=Fe(e);return t&&(e.details={...e.details,adbFailure:t.reason,...typeof e.details?.hint==`string`?{}:{hint:t.hint},...t.retriable!==void 0&&e.details?.retriable===void 0?{retriable:t.retriable}:{}}),e}function Fe(e){return typeof e.details?.timeoutMs==`number`?Pe:G(typeof e.details?.stderr==`string`?e.details.stderr:``,typeof e.details?.stdout==`string`?e.details.stdout:``)}function q(e,t,r){return K(new n(`COMMAND_FAILED`,e,t.exitCode===0?{stdout:t.stdout,stderr:t.stderr,exitCode:t.exitCode,...r}:P(t,r)))}function J(e){return async(...t)=>{try{return await e(...t)}catch(e){throw K(e)}}}const Ie=new WeakSet;function Le(e){if(Ie.has(e))return e;let t={...e,exec:J(Y(e.exec)),...e.pull?{pull:J(Y(e.pull))}:{},...e.install?{install:J(Y(e.install))}:{},...e.installBundle?{installBundle:J(e.installBundle)}:{}};return Ie.add(t),t}function Y(e){return async(...t)=>C(await e(...t))}function X(e){return Re(e.id)}function Re(e){return J(async(t,n)=>await x(async()=>await S(`adb`,[`-s`,e,...t],{...n,detached:process.platform!==`win32`})))}function ze(e){return(t,n)=>{let r=E(`adb`,[`-s`,e,...t],{...n,allowFailure:!0,captureOutput:!1});return r.wait.catch(()=>{}),r.child}}function Be(e){let t=X(e);return{exec:t,spawn:ze(e.id),reverse:Ze(t),pull:async(e,n,r)=>await t([`pull`,e,n],r),install:async(e,n)=>{let{installArgs:r,execOptions:i}=et(n);return await t([`install`,...r,e],i)}}}function Ve(e,t){let n=W.getStore();return t||(n?.serial===e.id?n.provider.exec:X(e))}function Z(e,t){if(t)return $(t);let n=W.getStore();return n?.serial===e.id?$(n.provider):Be(e)}function He(e){let t=W.getStore();return t?.serial===e.id?t.provider.text:void 0}function Q(e){let t=W.getStore();return t?.serial===e.id&&t.provider.touch?t.provider:void 0}function Ue(e){let t=$(e);if(t.reverse&&Xe.has(t.reverse))return t.reverse;let r=t.reverse??Ze(t.exec),i=new Map,a={async ensure(e,t){let a=i.get(e.local);if(a&&a.ownerId!==e.ownerId)throw new n(`COMMAND_FAILED`,`Android port reverse ${e.local} is already owned by ${a.ownerId??`another session`}`,{current:a,requested:e});a?.remote!==e.remote&&(await r.ensure(e,t),i.set(e.local,{...e}))},async remove(e,t){if(!i.has(e)){await r.remove(e,t);return}await r.remove(e,t),i.delete(e)},async removeAllOwned(e,t){let n=[...i.values()].filter(t=>t.ownerId===e).map(e=>e.local);if(n.length===0){await r.removeAllOwned(e,t);return}for(let e of n)await r.remove(e,t),i.delete(e)},async list(e){return r.list?await r.list(e):[...i.values()]}};return Xe.add(a),a}function $(e){return Le(typeof e==`function`?{exec:e}:e)}async function We(e,t,r){let{device:i,provider:a,...o}=r??{},s=Ke(i,a),c=s?.pull;if(c)return await x(async()=>await c(e,t,o));let l=s?.exec;if(!l)throw new n(`COMMAND_FAILED`,`Android adb pull requires an adb provider`);return await x(async()=>await l([`pull`,e,t],o))}async function Ge(e,t){let{device:r,provider:i,...a}=t??{},o=Ke(r,i),s=o?.install;if(s)return await x(async()=>await s(e,a));let c=o?.exec;if(!c)throw new n(`COMMAND_FAILED`,`Android adb install requires an adb provider`);let{installArgs:l,execOptions:u}=et(a);return await x(async()=>await c([`install`,...l,e],u))}function Ke(e,t){if(t)return $(t);if(e)return Z(e);let n=W.getStore();if(n)return $(n.provider)}async function qe(e,t,n){if(!e)return await n();let r={provider:$(e),serial:t.serial},i=Je(r);return await W.run(r,async()=>await ge(i,n))}function Je(e){return(t,n,r)=>{if(t!==`adb`)return;let i=Ye(n,e.serial);if(i)return x(async()=>await e.provider.exec(i,r))}}function Ye(e,t){if(!(e[0]!==`-s`||!e[1])&&e[1]===t)return e.slice(2)}const Xe=new WeakSet;function Ze(e){let t=new Map;return{async ensure(n,r){if(await e([`reverse`,n.local,n.remote],{allowFailure:!1,signal:r?.signal,timeoutMs:r?.timeoutMs}),n.ownerId){let e=t.get(n.ownerId)??new Set;e.add(n.local),t.set(n.ownerId,e)}},async remove(n,r){let i=await e([`reverse`,`--remove`,n],{allowFailure:!0,signal:r?.signal,timeoutMs:r?.timeoutMs});if(i.exitCode!==0&&!$e(i.stdout,i.stderr))throw q(`Failed to remove Android port reverse ${n}`,i,{local:n});for(let e of t.values())e.delete(n)},async removeAllOwned(e,n){let r=[...t.get(e)??[]];for(let e of r)await this.remove(e,n);t.delete(e)},async list(n){let r=await e([`reverse`,`--list`],{allowFailure:!0,signal:n?.signal,timeoutMs:n?.timeoutMs});return r.exitCode===0?Qe(r.stdout,t):[]}}}function Qe(e,t){let n=new Map;for(let[e,r]of t)for(let t of r)n.set(t,e);return e.split(`
|
|
4
|
+
`).map(e=>e.trim().split(/\s+/)).filter(e=>e.length>=3).map(([,e,t])=>{let r=e;return{local:r,remote:t,ownerId:n.get(r)}})}function $e(e,t){let n=`${e}\n${t}`.toLowerCase();return n.includes(`listener`)&&n.includes(`not found`)}function et(e){let{replace:t,allowTestPackages:n,allowDowngrade:r,grantPermissions:i,...a}=e??{},o=[];return t&&o.push(`-r`),n&&o.push(`-t`),r&&o.push(`-d`),i&&o.push(`-g`),{installArgs:o,execOptions:a}}export{g as A,xe as C,y as D,ue as E,ae as F,te as I,oe as M,re as N,de as O,ne as P,_e as S,x as T,be as _,Ge as a,Se as b,Z as c,qe as d,C as f,ye as g,De as h,Ue as i,_ as j,ie as k,He as l,z as m,q as n,We as o,P as p,K as r,Ve as s,Me as t,Q as u,S as v,ve as w,T as x,E as y};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as DaemonRequest, s as DaemonResponse } from "./sdk-contracts.js";
|
|
2
2
|
//#region src/core/batch.d.ts
|
|
3
3
|
type DaemonBatchStep = {
|
|
4
4
|
command: string;
|
|
5
5
|
positionals?: string[];
|
|
6
|
+
input?: Record<string, unknown>;
|
|
6
7
|
flags?: Record<string, unknown>;
|
|
7
8
|
runtime?: DaemonRequest['runtime'];
|
|
8
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,a as t,i as n,v as r}from"./sdk-contracts.js";import{a as i,i as a,n as o,t as s}from"./sdk-batch.js";function c(t,n,r,i){let a=r(t[n]);if(a===void 0)throw new e(`COMMAND_FAILED`,i,{response:t});return a}function l(e,t,n){return n(e[t])}function u(e,t,n){let r=e[t];return r===null?null:n(r)}function d(e,t){return c(e,t,x,`Daemon response is missing "${t}".`)}function f(e,t){return l(e,t,x)}function p(e,t){return u(e,t,x)}function m(e,t){return c(e,t,S,`Daemon response is missing numeric "${t}".`)}function h(e,t){return c(e,t,C,`Daemon response has invalid "${t}".`)}function g(e,t){return c(e,t,w,`Daemon response has invalid "${t}".`)}function _(e,t){return l(e,t,T)??`mobile`}function v(e){if(!D(e))return;let t=b(e,`x`),n=b(e,`y`),r=b(e,`width`),i=b(e,`height`);if(!(t===void 0||n===void 0||r===void 0||i===void 0))return{x:t,y:n,width:r,height:i}}function y(e){if(!D(e))return;let t=b(e,`x`),n=b(e,`y`);if(!(t===void 0||n===void 0))return{x:t,y:n}}function b(e,t){let n=e[t];return typeof n==`number`?n:void 0}function x(e){return typeof e==`string`&&e.length>0?e:void 0}function S(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function C(e){return e===`apple`?`ios`:e===`ios`||e===`macos`||e===`android`||e===`linux`||e===`web`?e:void 0}function w(e){return e===`simulator`||e===`emulator`||e===`device`?e:void 0}function T(e){return e===`tv`||e===`mobile`||e===`desktop`?e:void 0}function E(t){if(!D(t))throw new e(`COMMAND_FAILED`,`Daemon returned an unexpected response shape.`,{value:t});return t}function D(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function O(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function
|
|
2
|
-
`).map(e=>e.trim()).filter(e=>e.length>0)}function
|
|
1
|
+
import{_ as e,a as t,i as n,v as r}from"./sdk-contracts.js";import{a as i,i as a,n as o,t as s}from"./sdk-batch.js";function c(t,n,r,i){let a=r(t[n]);if(a===void 0)throw new e(`COMMAND_FAILED`,i,{response:t});return a}function l(e,t,n){return n(e[t])}function u(e,t,n){let r=e[t];return r===null?null:n(r)}function d(e,t){return c(e,t,x,`Daemon response is missing "${t}".`)}function f(e,t){return l(e,t,x)}function p(e,t){return u(e,t,x)}function m(e,t){return c(e,t,S,`Daemon response is missing numeric "${t}".`)}function h(e,t){return c(e,t,C,`Daemon response has invalid "${t}".`)}function g(e,t){return c(e,t,w,`Daemon response has invalid "${t}".`)}function _(e,t){return l(e,t,T)??`mobile`}function v(e){if(!D(e))return;let t=b(e,`x`),n=b(e,`y`),r=b(e,`width`),i=b(e,`height`);if(!(t===void 0||n===void 0||r===void 0||i===void 0))return{x:t,y:n,width:r,height:i}}function y(e){if(!D(e))return;let t=b(e,`x`),n=b(e,`y`);if(!(t===void 0||n===void 0))return{x:t,y:n}}function b(e,t){let n=e[t];return typeof n==`number`?n:void 0}function x(e){return typeof e==`string`&&e.length>0?e:void 0}function S(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function C(e){return e===`apple`?`ios`:e===`ios`||e===`macos`||e===`android`||e===`linux`||e===`web`?e:void 0}function w(e){return e===`simulator`||e===`emulator`||e===`device`?e:void 0}function T(e){return e===`tv`||e===`mobile`||e===`desktop`?e:void 0}function E(t){if(!D(t))throw new e(`COMMAND_FAILED`,`Daemon returned an unexpected response shape.`,{value:t});return t}function D(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function O(e){return D(e)?e:void 0}function k(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function A(e){return e.split(`
|
|
2
|
+
`).map(e=>e.trim()).filter(e=>e.length>0)}function j(e){return Number.isInteger(e)&&e>=1&&e<=1e3}function M(t,n){if(t>n)throw new e(`INVALID_ARGS`,`batch has ${t} steps; max allowed is ${n}.`)}function N(t,n){if(!D(t))throw new e(`INVALID_ARGS`,`Invalid batch step ${n}.`);return t}function P(t,n){let r=t.input;if(!D(r))throw new e(`INVALID_ARGS`,`Batch step ${n} input must be an object.`);return r}function F(t,r){if(t!==void 0)try{return n.parse(t)}catch(t){throw new e(`INVALID_ARGS`,`Batch step ${r} runtime is invalid: ${t instanceof Error?t.message:String(t)}`)}}const I=new Set(s);async function L(e,t,n){let i=W(e.flags),a=i?.batchOnError??`stop`;if(a!==`stop`)return G(`INVALID_ARGS`,`Unsupported batch on-error mode: ${a}.`);let o=i?.batchMaxSteps??100;if(!j(o))return G(`INVALID_ARGS`,`Invalid batch max-steps: ${String(i?.batchMaxSteps)}`);try{let r=R(i?.batchSteps,o),a=Date.now(),s=[];for(let[i,a]of r.entries()){let o=await U(e,t,a,n,i+1,i===r.length-1);if(!o.ok)return{ok:!1,error:{code:o.error.code,message:`Batch failed at step ${o.step} (${a.command}): ${o.error.message}`,hint:o.error.hint,diagnosticId:o.error.diagnosticId,logPath:o.error.logPath,details:{...o.error.details??{},step:o.step,command:a.command,positionals:a.positionals,executed:i,total:r.length,partialResults:s}}};s.push(o.result)}return{ok:!0,data:{total:r.length,executed:r.length,totalDurationMs:Date.now()-a,results:s}}}catch(e){let t=r(e);return G(t.code,t.message,t.details)}}function R(t,n){if(!Array.isArray(t)||t.length===0)throw new e(`INVALID_ARGS`,`batch requires a non-empty batchSteps array.`);M(t.length,n);let r=[];for(let n=0;n<t.length;n+=1){let o=t[n];if(!D(o))throw new e(`INVALID_ARGS`,`Invalid batch step at index ${n}.`);let s=Object.keys(o).filter(e=>!I.has(e));if(s.length>0){let t=s.map(e=>`"${e}"`).join(`, `);throw new e(`INVALID_ARGS`,`Batch step ${n+1} has unknown field(s): ${t}. Allowed fields: command, positionals, input, flags, runtime.`)}let c=i(o.command);if(!c)throw new e(`INVALID_ARGS`,`Batch step ${n+1} requires command.`);if(a(c,n+1),o.positionals!==void 0&&!Array.isArray(o.positionals))throw new e(`INVALID_ARGS`,`Batch step ${n+1} positionals must be an array.`);let l=o.positionals??[];if(l.some(e=>typeof e!=`string`))throw new e(`INVALID_ARGS`,`Batch step ${n+1} positionals must contain only strings.`);if(o.flags!==void 0&&!D(o.flags))throw new e(`INVALID_ARGS`,`Batch step ${n+1} flags must be an object.`);if(o.input!==void 0&&!D(o.input))throw new e(`INVALID_ARGS`,`Batch step ${n+1} input must be an object.`);r.push({command:c,positionals:l,input:o.input,flags:o.flags??{},runtime:F(o.runtime,n+1)})}return r}function z(e,t){let{batchSteps:n,batchOnError:r,batchMaxSteps:i,...a}=t??{};return B(W(e),a)}function B(e,t){let n=W(e)??{},r=t;for(let e of o)r[e]===void 0&&n[e]!==void 0&&(r[e]=n[e]);return t}function V(e,n){return t(e)?n?e:`digest`:e}function H(e,t){let n=e?.responseLevel,r=V(n,t);return r===n?e:{...e,responseLevel:r}}async function U(e,t,n,r,i,a){let o=Date.now(),s=z(e.flags,n.flags);s.session===void 0&&(s.session=t);let c=await r({token:e.token,session:t,command:n.command,positionals:n.positionals,input:n.input,flags:s,runtime:n.runtime===void 0?e.runtime:n.runtime,meta:H(e.meta,a)}),l=Date.now()-o;return c.ok?{ok:!0,step:i,result:{step:i,command:n.command,ok:!0,data:c.data??{},durationMs:l}}:{ok:!1,step:i,error:c.error}}function W(e){return e}function G(e,t,n){return{ok:!1,error:{code:e,message:t,...n?{details:n}:{}}}}export{m as _,F as a,A as b,O as c,y as d,v as f,g,f as h,j as i,E as l,p as m,L as n,P as o,_ as p,M as r,N as s,B as t,D as u,h as v,k as x,d as y};
|
package/dist/src/sdk-batch.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e}from"./sdk-contracts.js";
|
|
2
|
-
`],[`r`,`\r`],[`t`,` `]]);function c(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Selector expression cannot be empty`);let r=h(n);if(r.length===0)throw new e(`INVALID_ARGS`,`Selector expression cannot be empty`);return{raw:n,selectors:r.map(e=>p(e))}}function l(e){try{return c(e)}catch{return null}}function u(e){let t=e.trim();if(!t)return!1;if(t===`||`)return!0;let n=t.indexOf(`=`);if(n!==-1){let e=t.slice(0,n).trim().toLowerCase();return i.has(e)}return i.has(t.toLowerCase())}function d(e){let t=e.trim(),n=t.indexOf(`=`);if(n===-1)return null;let r=t.slice(0,n).trim().toLowerCase();if(!r||i.has(r))return null;let a=t.slice(n+1).trim();if(!a)return null;let o=_(a).trim();return o?{key:r,value:o}:null}function f(e,t={}){if(e.length===0)return null;let n=t.preferTrailingValue??!1,r=0,i=[];for(;r<e.length;){let t=e[r];if(t===void 0||!u(t))break;r+=1;let n=e.slice(0,r).join(` `).trim();n&&l(n)&&i.push(r)}if(i.length===0)return null;let a=i.at(-1);if(a===void 0)return null;let o=a;if(n)for(let t=i.length-1;t>=0;--t){let n=i[t];if(n!==void 0&&n<e.length){o=n;break}}let s=e.slice(0,o).join(` `).trim();return s?{selectorExpression:s,rest:e.slice(o)}:null}function p(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Selector segment cannot be empty`);let r=te(n);if(r.length===0)throw new e(`INVALID_ARGS`,`Invalid selector segment: ${t}`);return{raw:n,terms:r.map(m)}}function m(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Empty selector term`);let a=n.indexOf(`=`);if(a===-1){let i=n.toLowerCase();if(!r.has(i))throw new e(`INVALID_ARGS`,`Invalid selector term "${t}", expected key=value`);return{key:i,value:!0}}let o=n.slice(0,a).trim().toLowerCase(),s=n.slice(a+1).trim();if(!i.has(o))throw new e(`INVALID_ARGS`,`Unknown selector key: ${o}`);if(!s)throw new e(`INVALID_ARGS`,`Missing selector value for key: ${o}`);if(r.has(o)){let t=v(s);if(t===null)throw new e(`INVALID_ARGS`,`Invalid boolean value for ${o}: ${s}`);return{key:o,value:t}}return{key:o,value:_(s)}}function h(t){let n=[],r=``,i=null;for(let a=0;a<t.length;a+=1){let o=t[a];if((o===`"`||o===`'`)&&!y(t,a)){i=g(i,o),r+=o;continue}if(!i&&o===`|`&&t[a+1]===`|`){let i=r.trim();if(!i)throw new e(`INVALID_ARGS`,`Invalid selector fallback expression: ${t}`);n.push(i),r=``,a+=1;continue}r+=o}let a=r.trim();if(!a)throw new e(`INVALID_ARGS`,`Invalid selector fallback expression: ${t}`);return n.push(a),n}function te(t){let n=[],r=``,i=null;for(let e=0;e<t.length;e+=1){let a=t.charAt(e);if((a===`"`||a===`'`)&&!y(t,e)){i=g(i,a),r+=a;continue}if(!i&&/\s/.test(a)){r.trim()&&n.push(r.trim()),r=``;continue}r+=a}if(i)throw new e(`INVALID_ARGS`,`Unclosed quote in selector: ${t}`);return r.trim()&&n.push(r.trim()),n}function g(e,t){return e?e===t?null:e:t}function _(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?ne(t.slice(1,-1)):t}function ne(e){let t=``,n=0;for(;n<e.length;){let r=e.charAt(n);if(r!==`\\`){t+=r,n+=1;continue}let i=e.charAt(n+1);if(!i){t+=r,n+=1;continue}let a=re(i);if(a!==null){t+=a,n+=2;continue}if(i===`u`){let r=e.slice(n+2,n+6);if(/^[0-9a-fA-F]{4}$/.test(r)){t+=String.fromCharCode(Number.parseInt(r,16)),n+=6;continue}}t+=r,n+=1}return t}function re(e){return ee.get(e)??null}function v(e){let t=_(e).toLowerCase();return t===`true`?!0:t===`false`?!1:null}function y(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function b(e){let n=e[0];if(n===void 0)return null;let r=t(n);if(r!==null)return{kind:`sleep`,durationMs:r};let i=t(e[e.length-1]);if(n===`text`)return{kind:`text`,text:(i===null?e.slice(1).join(` `):e.slice(1,-1).join(` `)).trim(),timeoutMs:i};if(n===`stable`){let n=e.slice(1),r=n.length>1?t(n[1]):null;return{kind:`stable`,quietMs:n.length>0?t(n[0]):null,timeoutMs:r}}if(n.startsWith(`@`))return{kind:`ref`,rawRef:n,timeoutMs:i};let a=f(i===null?e.slice():e.slice(0,-1));return a&&a.rest.length===0&&l(a.selectorExpression)?{kind:`selector`,selectorExpression:a.selectorExpression,timeoutMs:i}:{kind:`text`,text:(i===null?e.join(` `):e.slice(0,-1).join(` `)).trim(),timeoutMs:i}}function ie(e){let t=b(e);return t?t.kind===`sleep`?t.durationMs:t.timeoutMs:null}const x=24e4,S={budget:{source:`none`},envelopeMs:9e4,onTimeout:`reset-daemon`},C={click:`settle-and-verify`,press:`settle-and-verify`,fill:`settle-and-verify`,longpress:`settle`};function w(e){if(e!==void 0)return C[e]}const T={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0},E={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0,selectorValidationExempt:!0},D=()=>!0,ae=e=>(e.positionals?.[0]??``).toLowerCase()===`start`,O=e=>e.command===`test`&&(typeof e.flags?.shardAll==`number`||typeof e.flags?.shardSplit==`number`),k={simulator:!0,device:!0},A={emulator:!0,device:!0,unknown:!0},j={device:!0},M={},N={apple:k,android:A,linux:j},P=N,oe={apple:k,android:A,linux:M},F={apple:k,android:A,linux:M},I={...S,onTimeout:`preserve-daemon`},L={...S,envelopeMs:18e4},se={...S,budget:{source:`flag`,envelope:`widen`,defaultBudgetMs:1e4},onTimeout:`preserve-daemon`},R={fields:{count:{defaultValue:1,omitDefault:!0},intervalMs:{defaultValue:0,omitDefault:!0},holdMs:{defaultValue:0,omitDefault:!0},jitterPx:{defaultValue:0,omitDefault:!0},doubleTap:{defaultValue:!1,omitDefault:!0}}},z={fields:{delayMs:{defaultValue:0}}};function B(e){return w(e)===void 0?I:se}function V(e){let t=w(e);if(t===void 0)throw Error(`Missing post-action observation descriptor support for ${e}`);return t}const H=[{name:`lease_allocate`,ownerFiles:[`src/daemon/handlers/lease.ts`],catalog:{group:`internal`,key:`leaseAllocate`},daemon:{route:`lease`,...T},timeoutPolicy:S,batchable:!1},{name:`lease_heartbeat`,ownerFiles:[`src/daemon/handlers/lease.ts`],catalog:{group:`internal`,key:`leaseHeartbeat`},daemon:{route:`lease`,...T},timeoutPolicy:S,batchable:!1},{name:`lease_release`,ownerFiles:[`src/daemon/handlers/lease.ts`],catalog:{group:`internal`,key:`leaseRelease`},daemon:{route:`lease`,...T},timeoutPolicy:S,batchable:!1},{name:`artifacts`,ownerFiles:[`src/commands/management/artifacts.ts`],catalog:{group:`public`},daemon:{route:`lease`,...T},timeoutPolicy:S,batchable:!1},{name:`session_list`,ownerFiles:[`src/daemon/handlers/session-inventory.ts`],catalog:{group:`internal`,key:`sessionList`},daemon:{route:`session`,sessionKind:`inventory`,...E},timeoutPolicy:S,batchable:!1},{name:`devices`,ownerFiles:[`src/commands/management/device.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,...E},timeoutPolicy:S,batchable:!0},{name:`capabilities`,ownerFiles:[`src/commands/management/device.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0,...E},timeoutPolicy:S,batchable:!0},{name:`doctor`,ownerFiles:[`src/commands/management/doctor.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,allowSessionlessDefaultDevice:D,...E},timeoutPolicy:S,batchable:!0},{name:`apps`,ownerFiles:[`src/commands/management/app.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0},capability:oe,timeoutPolicy:S,batchable:!0},{name:`boot`,ownerFiles:[`src/commands/management/device.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`state`},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`shutdown`,ownerFiles:[`src/commands/management/device.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`state`},capability:{apple:{simulator:!0},android:{emulator:!0},linux:M},timeoutPolicy:S,batchable:!0},{name:`appstate`,ownerFiles:[`src/commands/system/index.ts`],catalog:{group:`public`,key:`appState`},daemon:{route:`session`,sessionKind:`state`},timeoutPolicy:S,batchable:!0},{name:`perf`,ownerFiles:[`src/commands/perf/index.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`observability`},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`logs`,ownerFiles:[`src/commands/observability/index.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`observability`},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`events`,ownerFiles:[`src/commands/observability/index.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`observability`,allowInvalidRecording:!0,...E},timeoutPolicy:S,batchable:!1},{name:`network`,ownerFiles:[`src/commands/observability/index.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`observability`},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`audio`,ownerFiles:[`src/commands/observability/index.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`observability`},capability:{apple:k,android:{emulator:!0},linux:M},timeoutPolicy:S,batchable:!0},{name:`replay`,ownerFiles:[`src/commands/replay/index.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`replay`,skipSessionlessProviderDevice:O},timeoutPolicy:{...S,budget:{source:`flag`}},batchable:!1},{name:`test`,ownerFiles:[`src/commands/replay/index.ts`],catalog:{group:`public`},daemon:{route:`session`,sessionKind:`replay`,skipSessionlessProviderDevice:O},timeoutPolicy:{...S,envelopeMs:`unbounded`},batchable:!0},{name:`runtime`,ownerFiles:[`src/daemon/handlers/session-runtime-command.ts`],catalog:{group:`internal`},daemon:{route:`session`},timeoutPolicy:S,batchable:!1},{name:`clipboard`,ownerFiles:[`src/commands/system/index.ts`],catalog:{group:`public`},daemon:{route:`session`,replayScopedAction:!0},dispatch:{},capability:{apple:k,android:A,linux:j},timeoutPolicy:S,batchable:!0},{name:`keyboard`,ownerFiles:[`src/commands/system/index.ts`],catalog:{group:`public`},daemon:{route:`session`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`install`,ownerFiles:[`src/commands/management/install.ts`],catalog:{group:`public`},daemon:{route:`session`},capability:F,timeoutPolicy:L,batchable:!0},{name:`reinstall`,ownerFiles:[`src/commands/management/install.ts`],catalog:{group:`public`},daemon:{route:`session`},capability:F,timeoutPolicy:L,batchable:!0},{name:`install_source`,ownerFiles:[`src/daemon/handlers/install-source.ts`],catalog:{group:`internal`,key:`installSource`},daemon:{route:`session`},timeoutPolicy:L,batchable:!1},{name:`release_materialized_paths`,ownerFiles:[`src/daemon/handlers/install-source.ts`],catalog:{group:`internal`,key:`releaseMaterializedPaths`},daemon:{route:`session`,...E},timeoutPolicy:S,batchable:!1},{name:`push`,ownerFiles:[`src/commands/management/push.ts`],catalog:{group:`public`},daemon:{route:`session`},dispatch:{},capability:{apple:{simulator:!0},android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`trigger-app-event`,ownerFiles:[`src/commands/management/push.ts`],catalog:{group:`public`,key:`triggerAppEvent`},daemon:{route:`session`},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`open`,ownerFiles:[`src/commands/management/app.ts`],catalog:{group:`public`},daemon:{route:`session`,allowSessionlessDefaultDevice:D},dispatch:{},capability:P,timeoutPolicy:S,batchable:!0},{name:`prepare`,ownerFiles:[`src/commands/management/prepare.ts`],catalog:{group:`public`},daemon:{route:`session`},timeoutPolicy:{budget:{source:`flag`},envelopeMs:x,onTimeout:`reset-daemon`},batchable:!1,mcpExposed:!1},{name:`batch`,ownerFiles:[`src/commands/batch/index.ts`],catalog:{group:`public`},daemon:{route:`session`},timeoutPolicy:S,batchable:!1},{name:`close`,ownerFiles:[`src/commands/management/app.ts`],catalog:{group:`public`},daemon:{route:`session`,allowInvalidRecording:!0},dispatch:{},capability:P,timeoutPolicy:S,batchable:!0},{name:`snapshot`,ownerFiles:[`src/commands/capture/snapshot.ts`],catalog:{group:`public`},daemon:{route:`snapshot`,replayScopedAction:!0},dispatch:{},capability:N,timeoutPolicy:{...I,budget:{source:`flag`}},batchable:!0},{name:`diff`,ownerFiles:[`src/commands/capture/diff.ts`],catalog:{group:`public`},daemon:{route:`snapshot`,replayScopedAction:!0},capability:N,timeoutPolicy:S,batchable:!0},{name:`wait`,ownerFiles:[`src/commands/capture/wait.ts`],catalog:{group:`public`},daemon:{route:`snapshot`,replayScopedAction:!0},capability:N,timeoutPolicy:{...I,budget:{source:`positional-parser`,parser:ie}},batchable:!0},{name:`alert`,ownerFiles:[`src/commands/capture/alert.ts`],catalog:{group:`public`},daemon:{route:`snapshot`,replayScopedAction:!0},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`settings`,ownerFiles:[`src/commands/capture/settings.ts`],catalog:{group:`public`},daemon:{route:`snapshot`,replayScopedAction:!0},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`react-native`,ownerFiles:[`src/commands/react-native/index.ts`],catalog:{group:`public`,key:`reactNative`},daemon:{route:`reactNative`,replayScopedAction:!0},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`record`,ownerFiles:[`src/commands/recording/index.ts`],catalog:{group:`public`},daemon:{route:`recordTrace`,replayScopedAction:!0,allowInvalidRecording:!0,allowSessionlessDefaultDevice:ae},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`trace`,ownerFiles:[`src/commands/recording/index.ts`],catalog:{group:`public`},daemon:{route:`recordTrace`},timeoutPolicy:S,batchable:!0},{name:`find`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`find`,replayScopedAction:!0},capability:N,timeoutPolicy:I,batchable:!0},{name:`click`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`interaction`,replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:k,android:A,linux:j},timeoutPolicy:B(`click`),postActionObservation:V(`click`),responseDataTransform:R,batchable:!0},{name:`fill`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`interaction`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:j},timeoutPolicy:B(`fill`),postActionObservation:V(`fill`),responseDataTransform:z,batchable:!0},{name:`longpress`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`,key:`longPress`},daemon:{route:`interaction`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:j},timeoutPolicy:B(`longpress`),postActionObservation:V(`longpress`),batchable:!0},{name:`press`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`interaction`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:j},timeoutPolicy:B(`press`),postActionObservation:V(`press`),responseDataTransform:R,batchable:!0},{name:`type`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`interaction`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:N,timeoutPolicy:B(`type`),batchable:!0},{name:`get`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`interaction`,replayScopedAction:!0},capability:N,timeoutPolicy:B(`get`),batchable:!0},{name:`read`,ownerFiles:[`src/daemon/handlers/interaction.ts`],catalog:{group:`dispatch-alias`},dispatch:{},timeoutPolicy:S,batchable:!1},{name:`is`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`interaction`,replayScopedAction:!0},capability:N,timeoutPolicy:B(`is`),batchable:!0},{name:`back`,ownerFiles:[`src/commands/system/index.ts`],catalog:{group:`public`},daemon:{route:`generic`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:j},timeoutPolicy:S,batchable:!0},{name:`gesture`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`generic`,replayScopedAction:!0,androidBlockingDialogGuard:!0},timeoutPolicy:S,batchable:!0},{name:`home`,ownerFiles:[`src/commands/system/index.ts`],catalog:{group:`public`},daemon:{route:`generic`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:j},timeoutPolicy:S,batchable:!0},{name:`tv-remote`,ownerFiles:[`src/commands/system/index.ts`],catalog:{group:`public`,key:`tvRemote`},daemon:{route:`generic`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`rotate`,ownerFiles:[`src/commands/system/index.ts`],catalog:{group:`public`},daemon:{route:`generic`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`scroll`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`generic`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:j},timeoutPolicy:S,batchable:!0},{name:`swipe`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`generic`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:j},timeoutPolicy:S,batchable:!0},{name:`swipe-preset`,ownerFiles:[`src/core/dispatch.ts`],catalog:{group:`dispatch-alias`},dispatch:{},timeoutPolicy:S,batchable:!1},{name:`pinch`,ownerFiles:[`src/core/dispatch.ts`],catalog:{group:`dispatch-alias`},daemon:{route:`generic`,replayScopedAction:!0,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!1},{name:`focus`,ownerFiles:[`src/commands/interaction/index.ts`],catalog:{group:`public`},daemon:{route:`generic`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:j},timeoutPolicy:S,batchable:!0},{name:`screenshot`,ownerFiles:[`src/commands/capture/screenshot.ts`],catalog:{group:`public`},daemon:{route:`generic`,replayScopedAction:!0},dispatch:{},capability:N,timeoutPolicy:S,batchable:!0},{name:`viewport`,ownerFiles:[`src/commands/management/viewport.ts`],catalog:{group:`public`},daemon:{route:`generic`,replayScopedAction:!0},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!1},{name:`pan`,ownerFiles:[`src/core/dispatch.ts`],catalog:{group:`dispatch-alias`},daemon:{route:`generic`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:j},timeoutPolicy:S,batchable:!1},{name:`fling`,ownerFiles:[`src/core/dispatch.ts`],catalog:{group:`dispatch-alias`},daemon:{route:`generic`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!1},{name:`rotate-gesture`,ownerFiles:[`src/core/dispatch.ts`],catalog:{group:`dispatch-alias`},daemon:{route:`generic`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!1},{name:`transform-gesture`,ownerFiles:[`src/core/dispatch.ts`],catalog:{group:`dispatch-alias`},daemon:{route:`generic`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!1},{name:`app-switcher`,ownerFiles:[`src/commands/system/index.ts`],catalog:{group:`public`,key:`appSwitcher`},dispatch:{},capability:{apple:k,android:A,linux:M},timeoutPolicy:S,batchable:!0},{name:`install-from-source`,ownerFiles:[`src/commands/management/install.ts`],catalog:{group:`public`,key:`installFromSource`},capability:F,timeoutPolicy:S,batchable:!0},{name:`debug`,ownerFiles:[`src/commands/debugging/index.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1},{name:`metro`,ownerFiles:[`src/commands/metro/index.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1},{name:`session`,ownerFiles:[`src/commands/management/session.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1},{name:`cdp`,ownerFiles:[`src/cli/commands/agent-cdp.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`auth`,ownerFiles:[`src/cli/commands/auth.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`connect`,ownerFiles:[`src/cli/commands/connection.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`connection`,ownerFiles:[`src/cli/commands/connection.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`disconnect`,ownerFiles:[`src/cli/commands/connection.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`mcp`,ownerFiles:[`src/bin.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`proxy`,ownerFiles:[`src/cli/commands/proxy.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`react-devtools`,ownerFiles:[`src/cli/commands/react-devtools.ts`],catalog:{group:`local-cli`,key:`reactDevtools`},timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`web`,ownerFiles:[`src/cli/commands/web.ts`],catalog:{group:`local-cli`},timeoutPolicy:S,batchable:!1,mcpExposed:!1}],U=new Set([`public`,`local-cli`]),W=new Set(H.filter(e=>U.has(J(e))).map(e=>e.name)),G=H.map(e=>({...e,mcpExposed:ue(e)}));function K(e){return G.filter(t=>J(t)===e).map(e=>[fe(e),e.name])}function ce(){return G.filter(e=>de(e)).map(e=>e.name).sort()}const q=new Map(G.map(e=>[e.name,e]));function le(e){return W.has(e)}function ue(e){return e.mcpExposed??W.has(e.name)}function de(e){return e.mcpExposed&&le(e.name)}function J(e){return e.catalog.group}function fe(e){return e.catalog.key??e.name}const pe=new Map(G.map(e=>[e.name,e.timeoutPolicy])),Y=new Map(Array.from(q.values()).flatMap(e=>e.responseDataTransform?[[e.name,e.responseDataTransform]]:[]));function X(e){if(e!==void 0)return q.get(e)?.postActionObservation}function me(e){return X(e)!==void 0}function he(e){return X(e)===`settle-and-verify`}function ge(e){return e===void 0?S:pe.get(e)??S}function _e(e){if(e!==void 0)return Y.get(e)}function ve(){return[...new Set(Array.from(Y.values()).flatMap(e=>Object.keys(e.fields)))].sort()}function ye(e){let t=[];for(let n of e)n.daemon&&t.push({command:n.name,...n.daemon});return t}function be(e){let t={};for(let n of e)n.capability&&(t[n.name]=n.capability);return t}function xe(e){return e.filter(e=>e.batchable).map(e=>e.name)}const Z=xe(G),Q=new Set([`batch`,`replay`]),Se=[`command`,`positionals`,`flags`,`runtime`],Ce=[`platform`,`target`,`device`,`udid`,`serial`,`verbose`,`out`],we=new Set(Z);function Te(e){return we.has(e)}function $(e){return typeof e==`string`?e.trim().toLowerCase():``}function Ee(t,n){let r=$(t);if(Te(r))return r;throw new e(`INVALID_ARGS`,`Batch step ${n} command is not available through command batch: ${String(t)}`)}function De(t,n){if(Q.has(t))throw new e(`INVALID_ARGS`,`Batch step ${n} cannot run ${t}.`)}export{c as C,t as E,u as S,l as T,x as _,$ as a,d as b,ye as c,he as d,ve as f,ge as g,_e as h,De as i,G as l,ce as m,Ce as n,Ee as o,K as p,Z as r,be as s,Se as t,me as u,b as v,f as w,s as x,a as y};
|
|
1
|
+
import{_ as e}from"./sdk-contracts.js";const t=new Set([`id`,`role`,`text`,`label`,`value`,`appname`,`windowtitle`]),n=new Set([`visible`,`hidden`,`editable`,`selected`,`focused`,`enabled`,`hittable`]),r=new Set([...t,...n]),i=[...r],a=new Set(`button.imagebutton.link.cell.statictext.checkedtextview.textfield.textbox.edittext.textarea.switch.slider.image.imageview.webview.framelayout.linearlayout.relativelayout.constraintlayout.viewgroup.view.listview.recyclerview.collectionview.list.searchfield.segmentedcontrol.group.window.checkbox.radio.menuitem.toolbar.scrollarea.scrollview.nestedscrollview.table.application.navigationbar.tabbar.tab.alert.dialog.header`.split(`.`));function o(e){return a.has(e.trim().toLowerCase())}const s=new Map([[`"`,`"`],[`'`,`'`],[`\\`,`\\`],[`/`,`/`],[`b`,`\b`],[`f`,`\f`],[`n`,`
|
|
2
|
+
`],[`r`,`\r`],[`t`,` `]]);function c(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Selector expression cannot be empty`);let r=re(n);if(r.length===0)throw new e(`INVALID_ARGS`,`Selector expression cannot be empty`);return{raw:n,selectors:r.map(e=>te(e))}}function l(e){try{return c(e)}catch{return null}}function u(e){let t=e.trim();if(!t)return!1;if(t===`||`)return!0;let n=t.indexOf(`=`);if(n!==-1){let e=t.slice(0,n).trim().toLowerCase();return r.has(e)}return r.has(t.toLowerCase())}function ee(e){let t=e.trim(),n=t.indexOf(`=`);if(n===-1)return null;let i=t.slice(0,n).trim().toLowerCase();if(!i||r.has(i))return null;let a=t.slice(n+1).trim();if(!a)return null;let o=p(a).trim();return o?{key:i,value:o}:null}function d(e,t={}){if(e.length===0)return null;let n=t.preferTrailingValue??!1,r=0,i=[];for(;r<e.length;){let t=e[r];if(t===void 0||!u(t))break;r+=1;let n=e.slice(0,r).join(` `).trim();n&&l(n)&&i.push(r)}if(i.length===0)return null;let a=i.at(-1);if(a===void 0)return null;let o=a;if(n)for(let t=i.length-1;t>=0;--t){let n=i[t];if(n!==void 0&&n<e.length){o=n;break}}let s=e.slice(0,o).join(` `).trim();return s?{selectorExpression:s,rest:e.slice(o)}:null}function te(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Selector segment cannot be empty`);let r=ie(n);if(r.length===0)throw new e(`INVALID_ARGS`,`Invalid selector segment: ${t}`);return{raw:n,terms:r.map(ne)}}function ne(t){let i=t.trim();if(!i)throw new e(`INVALID_ARGS`,`Empty selector term`);let a=i.indexOf(`=`);if(a===-1){let r=i.toLowerCase();if(!n.has(r))throw new e(`INVALID_ARGS`,`Invalid selector term "${t}", expected key=value`);return{key:r,value:!0}}let o=i.slice(0,a).trim().toLowerCase(),s=i.slice(a+1).trim();if(!r.has(o))throw new e(`INVALID_ARGS`,`Unknown selector key: ${o}`);if(!s)throw new e(`INVALID_ARGS`,`Missing selector value for key: ${o}`);if(n.has(o)){let t=se(s);if(t===null)throw new e(`INVALID_ARGS`,`Invalid boolean value for ${o}: ${s}`);return{key:o,value:t}}return{key:o,value:p(s)}}function re(t){let n=[],r=``,i=null;for(let a=0;a<t.length;a+=1){let o=t[a];if((o===`"`||o===`'`)&&!m(t,a)){i=f(i,o),r+=o;continue}if(!i&&o===`|`&&t[a+1]===`|`){let i=r.trim();if(!i)throw new e(`INVALID_ARGS`,`Invalid selector fallback expression: ${t}`);n.push(i),r=``,a+=1;continue}r+=o}let a=r.trim();if(!a)throw new e(`INVALID_ARGS`,`Invalid selector fallback expression: ${t}`);return n.push(a),n}function ie(t){let n=[],r=``,i=null;for(let e=0;e<t.length;e+=1){let a=t.charAt(e);if((a===`"`||a===`'`)&&!m(t,e)){i=f(i,a),r+=a;continue}if(!i&&/\s/.test(a)){r.trim()&&n.push(r.trim()),r=``;continue}r+=a}if(i)throw new e(`INVALID_ARGS`,`Unclosed quote in selector: ${t}`);return r.trim()&&n.push(r.trim()),n}function f(e,t){return e?e===t?null:e:t}function p(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?ae(t.slice(1,-1)):t}function ae(e){let t=``,n=0;for(;n<e.length;){let r=e.charAt(n);if(r!==`\\`){t+=r,n+=1;continue}let i=e.charAt(n+1);if(!i){t+=r,n+=1;continue}let a=oe(i);if(a!==null){t+=a,n+=2;continue}if(i===`u`){let r=e.slice(n+2,n+6);if(/^[0-9a-fA-F]{4}$/.test(r)){t+=String.fromCharCode(Number.parseInt(r,16)),n+=6;continue}}t+=r,n+=1}return t}function oe(e){return s.get(e)??null}function se(e){let t=p(e).toLowerCase();return t===`true`?!0:t===`false`?!1:null}function m(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}const ce=[`any`,`text`,`label`,`value`,`role`,`id`],le=[`text`,`label`,`value`,`role`,`id`];function h(e){return e===`exists`||e===`wait`||e===`get_text`||e===`get_attrs`}function ue(e,t,n,r={}){let i=_(n);if(!i)return{matches:[],score:0};let a=0,o=[];for(let n of e){if(r.requireRect&&!n.rect)continue;let e=de(n,t,i);if(!(e<=0)){if(e>a){a=e,o.length=0,o.push(n);continue}e===a&&o.push(n)}}return{matches:o,score:a}}function de(e,t,n){switch(t){case`role`:return fe(e.type,n);case`label`:return g(e.label,n);case`value`:return g(e.value,n);case`id`:return g(e.identifier,n);default:return Math.max(g(e.label,n),g(e.value,n),g(e.identifier,n))}}function g(e,t){let n=_(e??``);return n?n===t?2:+!!n.includes(t):0}function fe(e,t){let n=pe(e??``);return n?n===t?2:+!!n.includes(t):0}function _(e){return e.trim().toLowerCase().replace(/\s+/g,` `)}function pe(e){let t=e.trim();return t?(t=(t.split(`.`).pop()??t).replace(/XCUIElementType/gi,``).toLowerCase(),t):``}function v(t){let n=`any`,r=0;le.includes(t[0])&&(n=t[0],r=1);let i=t[r]??``,a=t.slice(r+1);if(a.length===0)return{locator:n,query:i,action:`click`};let o=a[0]?.toLowerCase();if(o===`get`){let t=a[1]?.toLowerCase();if(t===`text`)return{locator:n,query:i,action:`get_text`};if(t===`attrs`)return{locator:n,query:i,action:`get_attrs`};throw new e(`INVALID_ARGS`,`find get only supports text or attrs`)}if(o===`wait`){let e=he(a[1]);return{locator:n,query:i,action:`wait`,timeoutMs:e??void 0}}if(o===`exists`)return{locator:n,query:i,action:`exists`};if(o===`click`)return{locator:n,query:i,action:`click`};if(o===`focus`)return{locator:n,query:i,action:`focus`};if(o===`fill`){let e=a.slice(1).join(` `);return{locator:n,query:i,action:`fill`,value:e}}if(o===`type`){let e=a.slice(1).join(` `);return{locator:n,query:i,action:`type`,value:e}}throw new e(`INVALID_ARGS`,`Unsupported find action: ${a[0]}`)}function me(e,t){return e!==`any`||!t.includes(`=`)&&!t.includes(`||`)?null:l(t)}function he(e){if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}function y(e){if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}function b(e){let t=e[0];if(t===void 0)return null;let n=y(t);if(n!==null)return{kind:`sleep`,durationMs:n};let r=y(e[e.length-1]);if(t===`text`)return{kind:`text`,text:(r===null?e.slice(1).join(` `):e.slice(1,-1).join(` `)).trim(),timeoutMs:r};if(t===`stable`){let t=e.slice(1),n=t.length>1?y(t[1]):null;return{kind:`stable`,quietMs:t.length>0?y(t[0]):null,timeoutMs:n}}if(t.startsWith(`@`))return{kind:`ref`,rawRef:t,timeoutMs:r};let i=d(r===null?e.slice():e.slice(0,-1));return i&&i.rest.length===0&&l(i.selectorExpression)?{kind:`selector`,selectorExpression:i.selectorExpression,timeoutMs:r}:{kind:`text`,text:(r===null?e.join(` `):e.slice(0,-1).join(` `)).trim(),timeoutMs:r}}function ge(e){let t=b(e);return t?t.kind===`sleep`?t.durationMs:t.timeoutMs:null}const x=24e4,S={budget:{source:`none`},envelopeMs:9e4,onTimeout:`reset-daemon`},_e={click:`settle-and-verify`,press:`settle-and-verify`,fill:`settle-and-verify`,longpress:`settle`};function C(e){if(e!==void 0)return _e[e]}const w={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0},T={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0,selectorValidationExempt:!0},E=()=>!0,ve=e=>(e.positionals?.[0]??``).toLowerCase()===`start`,D=e=>e.command===`test`&&(typeof e.flags?.shardAll==`number`||typeof e.flags?.shardSplit==`number`),O=new Set([`status`,`get`]),ye=e=>A(e,O,`status`),k=new Set([`get`,`wait`]),be=e=>A(e,k,`get`),xe=e=>j(e,O,`status`),Se=e=>j(e,k,`get`),Ce=e=>{try{return h(v(e.positionals??[]).action)?`observes-app`:`mutates-app`}catch{return`mutates-app`}};function A(e,t,n){return t.has((e.positionals?.[0]??n).toLowerCase())?`preserve`:`may-invalidate`}function j(e,t,n){return t.has((e.positionals?.[0]??n).toLowerCase())?`observes-app`:`mutates-app`}const M={simulator:!0,device:!0},N={emulator:!0,device:!0,unknown:!0},P={device:!0},F={},I={apple:M,android:N,linux:P},L=I,we={apple:M,android:N,linux:F},R={apple:M,android:N,linux:F},z={recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:M,android:N,linux:P},timeoutPolicy:S,batchable:!0},B={...S,onTimeout:`preserve-daemon`},V={...S,envelopeMs:18e4},H={...S,budget:{source:`flag`,envelope:`widen`,defaultBudgetMs:1e4},onTimeout:`preserve-daemon`},U={fields:{count:{defaultValue:1,omitDefault:!0},intervalMs:{defaultValue:0,omitDefault:!0},holdMs:{defaultValue:0,omitDefault:!0},jitterPx:{defaultValue:0,omitDefault:!0},doubleTap:{defaultValue:!1,omitDefault:!0}}},Te={fields:{delayMs:{defaultValue:0}}};function W(e){return C(e)===void 0?B:H}function G(e){let t=C(e);if(t===void 0)throw Error(`Missing post-action observation descriptor support for ${e}`);return t}const K=[{name:`lease_allocate`,catalog:{group:`internal`,key:`leaseAllocate`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...w},timeoutPolicy:S,batchable:!1},{name:`lease_heartbeat`,catalog:{group:`internal`,key:`leaseHeartbeat`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...w},timeoutPolicy:S,batchable:!1},{name:`lease_release`,catalog:{group:`internal`,key:`leaseRelease`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...w},timeoutPolicy:S,batchable:!1},{name:`artifacts`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...w},timeoutPolicy:S,batchable:!1},{name:`session_list`,catalog:{group:`internal`,key:`sessionList`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,...T},timeoutPolicy:S,batchable:!1},{name:`session_save_script`,catalog:{group:`internal`,key:`sessionSaveScript`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`publication`},timeoutPolicy:S,batchable:!1},{name:`devices`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,...T},timeoutPolicy:S,batchable:!0},{name:`capabilities`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0,...T},timeoutPolicy:S,batchable:!0},{name:`doctor`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,allowSessionlessDefaultDevice:E,...T},timeoutPolicy:S,batchable:!0},{name:`apps`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0},capability:we,timeoutPolicy:S,batchable:!0},{name:`boot`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`may-invalidate`,sessionKind:`state`},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`shutdown`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`may-invalidate`,sessionKind:`state`},capability:{apple:{simulator:!0},android:{emulator:!0},linux:F},timeoutPolicy:S,batchable:!0},{name:`appstate`,catalog:{group:`public`,key:`appState`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`state`},timeoutPolicy:S,batchable:!0},{name:`perf`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`logs`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`events`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`,allowInvalidRecording:!0,...T},timeoutPolicy:S,batchable:!1},{name:`network`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`audio`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:M,android:{emulator:!0},linux:F},timeoutPolicy:S,batchable:!0},{name:`replay`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`,sessionKind:`replay`,skipSessionlessProviderDevice:D},timeoutPolicy:{...S,budget:{source:`flag`}},batchable:!1},{name:`test`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`,sessionKind:`replay`,skipSessionlessProviderDevice:D},timeoutPolicy:{...S,envelopeMs:`unbounded`},batchable:!0},{name:`runtime`,catalog:{group:`internal`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`},timeoutPolicy:S,batchable:!1},{name:`clipboard`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`session`,refFrameEffect:`preserve`},dispatch:{},capability:{apple:M,android:N,linux:P},timeoutPolicy:S,batchable:!0},{name:`keyboard`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:xe,daemon:{route:`session`,refFrameEffect:ye,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`install`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},capability:R,timeoutPolicy:V,batchable:!0},{name:`reinstall`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},capability:R,timeoutPolicy:V,batchable:!0},{name:`install_source`,catalog:{group:`internal`,key:`installSource`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},timeoutPolicy:V,batchable:!1},{name:`release_materialized_paths`,catalog:{group:`internal`,key:`releaseMaterializedPaths`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,...T},timeoutPolicy:S,batchable:!1},{name:`push`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:{simulator:!0},android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`trigger-app-event`,catalog:{group:`public`,key:`triggerAppEvent`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`open`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`,allowSessionlessDefaultDevice:E},dispatch:{},capability:L,timeoutPolicy:S,batchable:!0},{name:`prepare`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`},timeoutPolicy:{budget:{source:`flag`},envelopeMs:x,onTimeout:`reset-daemon`},batchable:!1,mcpExposed:!1},{name:`batch`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`},timeoutPolicy:S,batchable:!1},{name:`close`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`,allowInvalidRecording:!0},dispatch:{},capability:L,timeoutPolicy:S,batchable:!0},{name:`snapshot`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},dispatch:{},capability:I,timeoutPolicy:{...B,budget:{source:`flag`}},batchable:!0},{name:`diff`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},capability:I,timeoutPolicy:S,batchable:!0},{name:`wait`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},capability:I,timeoutPolicy:{...B,budget:{source:`positional-parser`,parser:ge}},batchable:!0},{name:`alert`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:Se,daemon:{route:`snapshot`,refFrameEffect:be},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`settings`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`snapshot`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`react-native`,catalog:{group:`public`,key:`reactNative`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`reactNative`,refFrameEffect:`may-invalidate`},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`record`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`recordTrace`,refFrameEffect:`preserve`,allowInvalidRecording:!0,allowSessionlessDefaultDevice:ve},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`trace`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`recordTrace`,refFrameEffect:`preserve`},timeoutPolicy:S,batchable:!0},{name:`find`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:Ce,daemon:{route:`find`,refFrameEffect:`may-invalidate`},capability:I,timeoutPolicy:B,batchable:!0},{name:`click`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},capability:{apple:M,android:N,linux:P},timeoutPolicy:W(`click`),postActionObservation:G(`click`),responseDataTransform:U,batchable:!0},{name:`fill`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:M,android:N,linux:P},timeoutPolicy:W(`fill`),postActionObservation:G(`fill`),responseDataTransform:Te,batchable:!0},{name:`longpress`,catalog:{group:`public`,key:`longPress`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:M,android:N,linux:P},timeoutPolicy:{...H,envelopeMs:21e4},postActionObservation:G(`longpress`),batchable:!0},{name:`press`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:M,android:N,linux:P},timeoutPolicy:W(`press`),postActionObservation:G(`press`),responseDataTransform:U,batchable:!0},{name:`type`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:I,timeoutPolicy:W(`type`),batchable:!0},{name:`get`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`interaction`,refFrameEffect:`preserve`},capability:I,timeoutPolicy:W(`get`),batchable:!0},{name:`read`,catalog:{group:`dispatch-alias`},recordsSessionAction:!1,dispatch:{},timeoutPolicy:S,batchable:!1},{name:`is`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`interaction`,refFrameEffect:`preserve`},capability:I,timeoutPolicy:W(`is`),batchable:!0},{name:`back`,catalog:{group:`public`},...z},{name:`gesture`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},capability:I,timeoutPolicy:S,batchable:!0},{name:`home`,catalog:{group:`public`},...z},{name:`tv-remote`,catalog:{group:`public`,key:`tvRemote`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`orientation`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`scroll`,catalog:{group:`public`},...z},{name:`swipe`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},capability:{apple:M,android:N,linux:P},timeoutPolicy:S,batchable:!0},{name:`focus`,catalog:{group:`public`},...z},{name:`screenshot`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`generic`,refFrameEffect:`preserve`},dispatch:{},capability:I,timeoutPolicy:S,batchable:!0},{name:`viewport`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!1},{name:`app-switcher`,catalog:{group:`public`,key:`appSwitcher`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:M,android:N,linux:F},timeoutPolicy:S,batchable:!0},{name:`install-from-source`,catalog:{group:`public`,key:`installFromSource`},recordsSessionAction:!0,recordingEffect:`mutates-app`,capability:R,timeoutPolicy:S,batchable:!0},{name:`debug`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1},{name:`daemon`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`device`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`metro`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1},{name:`session`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1},{name:`cdp`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`auth`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`connect`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`connection`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`disconnect`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`mcp`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`proxy`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`react-devtools`,catalog:{group:`local-cli`,key:`reactDevtools`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1},{name:`web`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:S,batchable:!1,mcpExposed:!1}],Ee=new Set([`public`,`local-cli`]),q=new Set(K.filter(e=>Ee.has(X(e))).map(e=>e.name)),J=K.map(e=>({...e,mcpExposed:Ae(e)}));function De(e){return J.filter(t=>X(t)===e).map(e=>[Me(e),e.name])}function Oe(){return J.filter(e=>je(e)).map(e=>e.name).sort()}const Y=new Map(J.map(e=>[e.name,e]));function ke(e){return q.has(e)}function Ae(e){return e.mcpExposed??q.has(e.name)}function je(e){return e.mcpExposed&&ke(e.name)}function X(e){return e.catalog.group}function Me(e){return e.catalog.key??e.name}const Ne=new Map(J.map(e=>[e.name,e.timeoutPolicy])),Z=new Map(Array.from(Y.values()).flatMap(e=>e.responseDataTransform?[[e.name,e.responseDataTransform]]:[]));function Q(e){if(e!==void 0)return Y.get(e)?.postActionObservation}function Pe(e){return Q(e)!==void 0}function Fe(e){return Q(e)===`settle-and-verify`}function Ie(e){return e===void 0?S:Ne.get(e)??S}function Le(e){if(e!==void 0)return Z.get(e)}function Re(e){return e===void 0?!1:Y.get(e)?.recordsSessionAction??!1}function ze(e){let t=Y.get(e.command);if(t?.recordsSessionAction)return typeof t.recordingEffect==`function`?t.recordingEffect(e):t.recordingEffect}function Be(){return[...new Set(Array.from(Z.values()).flatMap(e=>Object.keys(e.fields)))].sort()}function Ve(e){let t=[];for(let n of e)n.daemon&&t.push({command:n.name,...n.daemon,replayScopedAction:n.recordsSessionAction});return t}function He(e){let t={};for(let n of e)n.capability&&(t[n.name]=n.capability);return t}function Ue(e){return e.filter(e=>e.batchable).map(e=>e.name)}const $=Ue(J),We=new Set([`batch`,`replay`]),Ge=[`command`,`positionals`,`input`,`flags`,`runtime`],Ke=[`platform`,`target`,`device`,`udid`,`serial`,`verbose`,`out`],qe=new Set($);function Je(e){return qe.has(e)}function Ye(e){return typeof e==`string`?e.trim().toLowerCase():``}function Xe(t,n){let r=Ye(t);if(Je(r))return r;throw new e(`INVALID_ARGS`,`Batch step ${n} command is not available through command batch: ${String(t)}`)}function Ze(t,n){if(We.has(t))throw new e(`INVALID_ARGS`,`Batch step ${n} cannot run ${t}.`)}export{o as A,ue as C,me as D,v as E,c as M,d as N,i as O,l as P,ce as S,_ as T,Le as _,Ye as a,b,Ve as c,Fe as d,Be as f,Re as g,ze as h,Ze as i,u as j,ee as k,J as l,Oe as m,Ke as n,Xe as o,De as p,$ as r,He as s,Ge as t,Pe as u,Ie as v,h as w,y as x,x as y};
|
|
@@ -12,8 +12,110 @@ type DeviceKind = (typeof DEVICE_KINDS)[number];
|
|
|
12
12
|
declare const DEVICE_TARGETS: readonly ['mobile', 'tv', 'desktop'];
|
|
13
13
|
type DeviceTarget = (typeof DEVICE_TARGETS)[number];
|
|
14
14
|
//#endregion
|
|
15
|
+
//#region src/kernel/snapshot.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* Structured quality verdict computed once by the iOS runner's snapshot capture plan.
|
|
18
|
+
* The daemon renders it; it never re-derives degradation from node shapes.
|
|
19
|
+
*
|
|
20
|
+
* Defined here (the foundational snapshot type module) rather than in
|
|
21
|
+
* snapshot-quality.ts so SnapshotNode can reference it without a cyclic import;
|
|
22
|
+
* snapshot-quality.ts (the validation logic) re-exports it for existing callers.
|
|
23
|
+
*/
|
|
24
|
+
type SnapshotQualityVerdict = {
|
|
25
|
+
state: 'healthy' | 'recovered' | 'sparse';
|
|
26
|
+
backend: 'tree' | 'queries' | 'private-ax';
|
|
27
|
+
reason?: string;
|
|
28
|
+
reasonCode?: 'ax-rejected' | 'sparse-tree' | 'budget' | 'no-nodes' | 'capture-failed';
|
|
29
|
+
effectiveDepth?: number;
|
|
30
|
+
collapsedLeafIndexes?: number[];
|
|
31
|
+
};
|
|
32
|
+
type Rect = {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
};
|
|
38
|
+
type Point = {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
};
|
|
42
|
+
type RawSnapshotNode = {
|
|
43
|
+
index: number;
|
|
44
|
+
type?: string;
|
|
45
|
+
role?: string;
|
|
46
|
+
subrole?: string;
|
|
47
|
+
label?: string;
|
|
48
|
+
value?: string;
|
|
49
|
+
identifier?: string;
|
|
50
|
+
rect?: Rect;
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
selected?: boolean;
|
|
53
|
+
focused?: boolean;
|
|
54
|
+
visibleToUser?: boolean;
|
|
55
|
+
hittable?: boolean;
|
|
56
|
+
depth?: number;
|
|
57
|
+
parentIndex?: number;
|
|
58
|
+
pid?: number;
|
|
59
|
+
bundleId?: string;
|
|
60
|
+
appName?: string;
|
|
61
|
+
windowTitle?: string;
|
|
62
|
+
surface?: string;
|
|
63
|
+
hiddenContentAbove?: boolean;
|
|
64
|
+
hiddenContentBelow?: boolean;
|
|
65
|
+
interactionBlocked?: 'covered';
|
|
66
|
+
presentationHints?: string[];
|
|
67
|
+
};
|
|
68
|
+
type SnapshotNode = RawSnapshotNode & {
|
|
69
|
+
ref: string;
|
|
70
|
+
/**
|
|
71
|
+
* Output-only marker set by client-serialization dedup (see
|
|
72
|
+
* ../snapshot/snapshot-label-dedup.ts) when `label`/`identifier` was omitted
|
|
73
|
+
* because it string-equals the nearest ancestor's value in the parent chain.
|
|
74
|
+
* Never set on the in-daemon session tree used by selectors/wait/replay.
|
|
75
|
+
*/
|
|
76
|
+
inheritsLabel?: true;
|
|
77
|
+
inheritsIdentifier?: true;
|
|
78
|
+
};
|
|
79
|
+
type SnapshotBackend = 'xctest' | 'android' | 'macos-helper' | 'linux-atspi' | 'web';
|
|
80
|
+
type SnapshotState = {
|
|
81
|
+
nodes: SnapshotNode[];
|
|
82
|
+
createdAt: number;
|
|
83
|
+
truncated?: boolean;
|
|
84
|
+
backend?: SnapshotBackend;
|
|
85
|
+
snapshotQuality?: SnapshotQualityVerdict;
|
|
86
|
+
comparisonSafe?: boolean;
|
|
87
|
+
presentationKey?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Android: the capture is an occluding system surface (notification shade, quick settings)
|
|
90
|
+
* rather than app content. Consumers that surface this tree to the agent must disclose the
|
|
91
|
+
* occlusion (see snapshot/system-surface-disclosure.ts).
|
|
92
|
+
*/
|
|
93
|
+
systemSurfaceOnly?: boolean;
|
|
94
|
+
};
|
|
95
|
+
type SnapshotUnchanged = {
|
|
96
|
+
ageMs: number;
|
|
97
|
+
nodeCount: number;
|
|
98
|
+
interactiveOnly?: boolean;
|
|
99
|
+
scope?: string;
|
|
100
|
+
};
|
|
101
|
+
type SnapshotVisibilityReason = 'offscreen-nodes' | 'scroll-hidden-above' | 'scroll-hidden-below';
|
|
102
|
+
type SnapshotVisibility = {
|
|
103
|
+
partial: boolean;
|
|
104
|
+
visibleNodeCount: number;
|
|
105
|
+
totalNodeCount: number;
|
|
106
|
+
reasons: SnapshotVisibilityReason[];
|
|
107
|
+
};
|
|
108
|
+
type ScreenshotOverlayRef = {
|
|
109
|
+
ref: string;
|
|
110
|
+
label?: string;
|
|
111
|
+
rect: Rect;
|
|
112
|
+
overlayRect: Rect;
|
|
113
|
+
center: Point;
|
|
114
|
+
};
|
|
115
|
+
declare function centerOfRect(rect: Rect): Point;
|
|
116
|
+
//#endregion
|
|
15
117
|
//#region src/kernel/errors.d.ts
|
|
16
|
-
type KnownAppErrorCode = 'INVALID_ARGS' | 'DEVICE_NOT_FOUND' | 'DEVICE_IN_USE' | 'TOOL_MISSING' | 'APP_NOT_INSTALLED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_OPERATION' | 'NOT_IMPLEMENTED' | 'COMMAND_FAILED' | 'SESSION_NOT_FOUND' | 'UNAUTHORIZED' | 'AMBIGUOUS_MATCH' | 'UNKNOWN';
|
|
118
|
+
type KnownAppErrorCode = 'INVALID_ARGS' | 'DEVICE_NOT_FOUND' | 'DEVICE_IN_USE' | 'TOOL_MISSING' | 'APP_NOT_INSTALLED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_OPERATION' | 'NOT_IMPLEMENTED' | 'COMMAND_FAILED' | 'SESSION_NOT_FOUND' | 'UNAUTHORIZED' | 'AMBIGUOUS_MATCH' | 'REPLAY_DIVERGENCE' | 'REPAIR_SESSION_EXPIRED' | 'REPAIR_COMMIT_FAILED' | 'UNKNOWN';
|
|
17
119
|
type AppErrorCode = KnownAppErrorCode | (string & {});
|
|
18
120
|
/**
|
|
19
121
|
* Details bag for AppError. Free-form context is allowed, but these keys carry
|
|
@@ -120,102 +222,6 @@ type DebugSymbolsResult = {
|
|
|
120
222
|
message: string;
|
|
121
223
|
};
|
|
122
224
|
//#endregion
|
|
123
|
-
//#region src/kernel/snapshot.d.ts
|
|
124
|
-
/**
|
|
125
|
-
* Structured quality verdict computed once by the iOS runner's snapshot capture plan.
|
|
126
|
-
* The daemon renders it; it never re-derives degradation from node shapes.
|
|
127
|
-
*
|
|
128
|
-
* Defined here (the foundational snapshot type module) rather than in
|
|
129
|
-
* snapshot-quality.ts so SnapshotNode can reference it without a cyclic import;
|
|
130
|
-
* snapshot-quality.ts (the validation logic) re-exports it for existing callers.
|
|
131
|
-
*/
|
|
132
|
-
type SnapshotQualityVerdict = {
|
|
133
|
-
state: 'healthy' | 'recovered' | 'sparse';
|
|
134
|
-
backend: 'tree' | 'queries' | 'private-ax';
|
|
135
|
-
reason?: string;
|
|
136
|
-
reasonCode?: 'ax-rejected' | 'sparse-tree' | 'budget' | 'no-nodes' | 'capture-failed';
|
|
137
|
-
effectiveDepth?: number;
|
|
138
|
-
collapsedLeafIndexes?: number[];
|
|
139
|
-
};
|
|
140
|
-
type Rect = {
|
|
141
|
-
x: number;
|
|
142
|
-
y: number;
|
|
143
|
-
width: number;
|
|
144
|
-
height: number;
|
|
145
|
-
};
|
|
146
|
-
type Point = {
|
|
147
|
-
x: number;
|
|
148
|
-
y: number;
|
|
149
|
-
};
|
|
150
|
-
type RawSnapshotNode = {
|
|
151
|
-
index: number;
|
|
152
|
-
type?: string;
|
|
153
|
-
role?: string;
|
|
154
|
-
subrole?: string;
|
|
155
|
-
label?: string;
|
|
156
|
-
value?: string;
|
|
157
|
-
identifier?: string;
|
|
158
|
-
rect?: Rect;
|
|
159
|
-
enabled?: boolean;
|
|
160
|
-
selected?: boolean;
|
|
161
|
-
focused?: boolean;
|
|
162
|
-
visibleToUser?: boolean;
|
|
163
|
-
hittable?: boolean;
|
|
164
|
-
depth?: number;
|
|
165
|
-
parentIndex?: number;
|
|
166
|
-
pid?: number;
|
|
167
|
-
bundleId?: string;
|
|
168
|
-
appName?: string;
|
|
169
|
-
windowTitle?: string;
|
|
170
|
-
surface?: string;
|
|
171
|
-
hiddenContentAbove?: boolean;
|
|
172
|
-
hiddenContentBelow?: boolean;
|
|
173
|
-
interactionBlocked?: 'covered';
|
|
174
|
-
presentationHints?: string[];
|
|
175
|
-
};
|
|
176
|
-
type SnapshotNode = RawSnapshotNode & {
|
|
177
|
-
ref: string;
|
|
178
|
-
/**
|
|
179
|
-
* Output-only marker set by client-serialization dedup (see
|
|
180
|
-
* ../snapshot/snapshot-label-dedup.ts) when `label`/`identifier` was omitted
|
|
181
|
-
* because it string-equals the nearest ancestor's value in the parent chain.
|
|
182
|
-
* Never set on the in-daemon session tree used by selectors/wait/replay.
|
|
183
|
-
*/
|
|
184
|
-
inheritsLabel?: true;
|
|
185
|
-
inheritsIdentifier?: true;
|
|
186
|
-
};
|
|
187
|
-
type SnapshotBackend = 'xctest' | 'android' | 'macos-helper' | 'linux-atspi' | 'web';
|
|
188
|
-
type SnapshotState = {
|
|
189
|
-
nodes: SnapshotNode[];
|
|
190
|
-
createdAt: number;
|
|
191
|
-
truncated?: boolean;
|
|
192
|
-
backend?: SnapshotBackend;
|
|
193
|
-
snapshotQuality?: SnapshotQualityVerdict;
|
|
194
|
-
comparisonSafe?: boolean;
|
|
195
|
-
presentationKey?: string;
|
|
196
|
-
};
|
|
197
|
-
type SnapshotUnchanged = {
|
|
198
|
-
ageMs: number;
|
|
199
|
-
nodeCount: number;
|
|
200
|
-
interactiveOnly?: boolean;
|
|
201
|
-
scope?: string;
|
|
202
|
-
};
|
|
203
|
-
type SnapshotVisibilityReason = 'offscreen-nodes' | 'scroll-hidden-above' | 'scroll-hidden-below';
|
|
204
|
-
type SnapshotVisibility = {
|
|
205
|
-
partial: boolean;
|
|
206
|
-
visibleNodeCount: number;
|
|
207
|
-
totalNodeCount: number;
|
|
208
|
-
reasons: SnapshotVisibilityReason[];
|
|
209
|
-
};
|
|
210
|
-
type ScreenshotOverlayRef = {
|
|
211
|
-
ref: string;
|
|
212
|
-
label?: string;
|
|
213
|
-
rect: Rect;
|
|
214
|
-
overlayRect: Rect;
|
|
215
|
-
center: Point;
|
|
216
|
-
};
|
|
217
|
-
declare function centerOfRect(rect: Rect): Point;
|
|
218
|
-
//#endregion
|
|
219
225
|
//#region src/kernel/contracts.d.ts
|
|
220
226
|
type SessionRuntimeHints = {
|
|
221
227
|
platform?: 'ios' | 'android';
|
|
@@ -288,6 +294,7 @@ type DaemonRequest = {
|
|
|
288
294
|
session?: string;
|
|
289
295
|
command: string;
|
|
290
296
|
positionals: string[];
|
|
297
|
+
input?: Record<string, unknown>;
|
|
291
298
|
flags?: Record<string, unknown>;
|
|
292
299
|
runtime?: SessionRuntimeHints;
|
|
293
300
|
meta?: DaemonRequestMeta;
|
|
@@ -383,4 +390,4 @@ type JsonRpcRequestEnvelope<TParams = unknown> = {
|
|
|
383
390
|
params?: TParams;
|
|
384
391
|
};
|
|
385
392
|
//#endregion
|
|
386
|
-
export {
|
|
393
|
+
export { Point as A, DeviceKind as B, DebugSymbolsResult as C, isAgentDeviceError as D, defaultHintForCode as E, SnapshotState as F, Platform as H, SnapshotUnchanged as I, SnapshotVisibility as L, ScreenshotOverlayRef as M, SnapshotNode as N, normalizeAgentDeviceError as O, SnapshotQualityVerdict as P, centerOfRect as R, DebugSymbolsOptions as S, NormalizedError as T, PlatformSelector as U, DeviceTarget as V, PublicPlatform as W, NetworkIncludeMode as _, DaemonLockPolicy as a, SessionIsolationMode as b, DaemonResponseData as c, JsonRpcId as d, JsonRpcRequestEnvelope as f, LeaseReleasePayload as g, LeaseHeartbeatPayload as h, DaemonInstallSource as i, Rect as j, normalizeError as k, DaemonServerMode as l, LeaseBackend as m, DaemonArtifactType as n, DaemonRequest as o, LeaseAllocatePayload as p, DaemonError as r, DaemonResponse as s, DaemonArtifact as t, DaemonTransportPreference as u, ResponseCost as v, AppError as w, SessionRuntimeHints as x, ResponseLevel as y, AppleOS as z };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const e=/(token|secret|password|authorization|cookie|api[_-]?key|access[_-]?key|private[_-]?key|user[_-]?code|device[_-]?code|refresh[_-]?credential)/i,t=/\b(?:bearer\s+[a-z0-9._-]+|adc_(?:agent|live|refresh|cli)_[a-z0-9._-]+)\b/gi,n=/\b([a-z0-9_-]*(?:api[_-]?key|token|secret|password|user[_-]?code|device[_-]?code|refresh[_-]?credential)[a-z0-9_-]*)(\s*[=:]\s*)("[^"]*"|'[^']*'|\S+)/gi,r=/https?:\/\/[^\s"'<>]+/gi;function i(e){return a(e,new WeakSet)}function a(t,n,r){if(t==null)return t;if(typeof t==`string`)return o(t,r);if(typeof t!=`object`)return t;if(n.has(t))return`[Circular]`;if(n.add(t),Array.isArray(t))return t.map(e=>a(e,n));let i={};for(let[r,o]of Object.entries(t)){if(e.test(r)){i[r]=`[REDACTED]`;continue}i[r]=a(o,n,r)}return i}function o(r,i){let a=r.trim();if(!a)return r;if(i&&e.test(i))return`[REDACTED]`;let o=s(a);return o=o.replace(t,`[REDACTED]`),o=o.replace(n,(e,t,n,r,i,a)=>l({key:t,separator:n,rawValue:r,offset:i,input:a})||c(r)?e:`${t}${n}[REDACTED]`),o===a?a.length>400?`${a.slice(0,200)}...<truncated>`:a:o}function s(e){return e.replace(r,e=>u(e)??e)}function c(e){return/^adc_(?:agent|live|refresh|cli)_\.\.\.$/i.test(e)}function l(e){if(e.key.toLowerCase()!==`token`||!e.separator.includes(`:`))return!1;try{return new URL(e.rawValue).pathname.replace(/\/+$/,``)===`/api-keys`?/(?:^|\b)(?:service\/)?api\s+$/i.test(e.input.slice(0,e.offset)):!1}catch{return!1}}function u(e){try{let t=new URL(e);return t.search&&=`?REDACTED`,(t.username||t.password)&&(t.username=`REDACTED`,t.password=`REDACTED`),t.toString()}catch{return null}}function d(e,t=`COMMAND_FAILED`){return typeof e==`string`&&e.length>0?e:t}var f=class extends Error{code;details;cause;constructor(e,t,n,r){super(t),this.code=e,this.details=n,this.cause=r}};function p(e,t=`UNKNOWN`){return e instanceof f?e:e instanceof Error?new f(t,e.message,void 0,e):new f(t,`Unknown error`,{err:e})}function m(e){return e instanceof f}function h(e,t={}){return g(e,t)}function g(e,t={}){let n=p(e),r=n.details?i(n.details):void 0,a=S(r,`diagnosticId`)??t.diagnosticId,o=S(r,`logPath`)??t.logPath,s=S(r,`hint`)??E(n.code),c=C(r,`retriable`)??T(n.code),l=S(r,`supportedOn`),u=w(r),d=v(n.code,n.message,r);return{code:n.code,message:d,hint:s,diagnosticId:a,logPath:o,...c===void 0?{}:{retriable:c},...l===void 0?{}:{supportedOn:l},details:u}}const _=/^\S+ exited with code -?\d+$/;function v(e,t,n){if(e!==`COMMAND_FAILED`||n?.processExitError!==!0)return t;let r=x(typeof n?.stderr==`string`?n.stderr:``);return r?_.test(t)?r:t.includes(r)?t:`${t}: ${r}`:t}const y=[/^an error was encountered processing the command/i,/^underlying error\b/i,/^simulator device failed to complete the requested operation/i],b=/^(?:(?:adb|xcrun|simctl):\s*)?(?:error:\s*)?/i;function x(e){for(let t of e.split(`
|
|
2
|
-
`)){let e=t.trim();if(!e||y.some(t=>t.test(e)))continue;let n=e.replace(b,``).trim();if(n)return n.length>200?`${n.slice(0,200)}...`:n}return null}function S(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function C(e,t){let n=e?.[t];return typeof n==`boolean`?n:void 0}function w(e){if(!e)return;let t={...e};return delete t.hint,delete t.diagnosticId,delete t.logPath,delete t.retriable,delete t.supportedOn,Object.keys(t).length>0?t:void 0}function T(e){switch(e){case`DEVICE_IN_USE`:return!0;default:return}}function E(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`UNSUPPORTED_PLATFORM`:return`This platform is not supported for the requested operation; run devices to inspect available targets.`;case`AMBIGUOUS_MATCH`:return`Multiple candidates matched. Narrow the query or pass an exact identifier.`;case`DEVICE_IN_USE`:return`The device is busy with another agent-device request; retry once it frees up.`;case`NOT_IMPLEMENTED`:return`This command is part of the planned API but is not implemented yet.`;case`COMMAND_FAILED`:return`Retry with --debug and inspect diagnostics log for details.`;case`UNAUTHORIZED`:return`Refresh daemon metadata and retry the command.`;case`UNKNOWN`:return`Unexpected internal error. Retry with --debug and report the diagnostics log if it persists.`;default:return`Retry with --debug and inspect diagnostics log for details.`}}function D(e){return e===`xctest`||e===`android`||e===`macos-helper`||e===`linux-atspi`||e===`web`}function O(e){return e===void 0||e===`xctest`||e===`android`}function k(e){return e.map((e,t)=>({...e,ref:`e${t+1}`}))}const A=/^~s(\d+)$/,j=`Refs look like @e12, optionally pinned to the snapshot generation that minted them: @e12~s3 (the ref, then "~s" and the refsGeneration reported by the issuing snapshot/find response).`;function M(e){let t=e.trim(),n=t.indexOf(`~`);if(n===-1)return{base:t};let r=A.exec(t.slice(n));return!r||n===0?null:{base:t.slice(0,n),generation:Number(r[1])}}function N(e){let t=M(e);if(!t)return null;let n=t.base;return n.startsWith(`@`)?n.slice(1)||null:n.startsWith(`e`)?n:null}function P(e,t){return e.find(e=>e.ref===t)??null}function F(e){return JSON.stringify({interactiveOnly:e?.interactiveOnly===!0,depth:typeof e?.depth==`number`?e.depth:null,scope:e?.scope?.trim()||null,raw:e?.raw===!0})}function I(e){if(e)return{depth:e.snapshotDepth,interactiveOnly:e.snapshotInteractiveOnly,raw:e.snapshotRaw,scope:e.snapshotScope}}function L(e){return{x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)}}const R=[`summary`,`headers`,`body`,`all`],z=[`digest`,`default`,`full`];function B(e){return e!==void 0&&e!=="default"}function V(e){return{parse(t){return e(t,`$`)}}}function H(e,t){throw Error(`${e}: ${t}`)}function U(e,t){return(!e||typeof e!=`object`||Array.isArray(e))&&H(t,`Expected an object`),e}function W(e,t){return typeof e!=`string`&&H(t,`Expected a string`),e}function G(e,t){return Number.isInteger(e)||H(t,`Expected an integer`),e}function K(e,t){return Array.isArray(e)||H(t,`Expected an array`),e}function q(e,t,n){let r=e[t];return r===void 0?void 0:W(r,`${n}.${t}`)}function J(e,t,n){let r=e[t];if(r!==void 0)return K(r,`${n}.${t}`).map((e,r)=>W(e,`${n}.${t}[${String(r)}]`))}function Y(e,t,n){let r=e[t];return r===void 0?void 0:G(r,`${n}.${t}`)}function X(e,t,n){let r=e[t];return r===void 0?void 0:U(r,`${n}.${t}`)}function Z(e,t,n,r){let i=e[t];if(i!==void 0)return(typeof i!=`string`||!n.includes(i))&&H(`${r}.${t}`,`Expected one of: ${n.join(`, `)}`),i}const Q=V((e,t)=>{let n=U(e,t);return{platform:Z(n,`platform`,[`ios`,`android`],t),metroHost:q(n,`metroHost`,t),metroPort:Y(n,`metroPort`,t),bundleUrl:q(n,`bundleUrl`,t),launchUrl:q(n,`launchUrl`,t)}});function $(e,t){let n=e.id;return n==null||typeof n!=`string`&&typeof n!=`number`&&H(`${t}.id`,`Expected a string, number, or null`),n}const ee=V((e,t)=>{let n=U(e,t);return{jsonrpc:q(n,`jsonrpc`,t),id:$(n,t),method:q(n,`method`,t),params:n.params}}),te=V((e,t)=>{let n=U(e,t);return{token:q(n,`token`,t),session:q(n,`session`,t),command:q(n,`command`,t),positionals:J(n,`positionals`,t),flags:X(n,`flags`,t),runtime:X(n,`runtime`,t),meta:X(n,`meta`,t)}});export{T as C,g as S,i as T,f as _,B as a,m as b,k as c,P as d,D as f,O as g,M as h,Q as i,F as l,I as m,z as n,ee as o,N as p,te as r,j as s,R as t,L as u,p as v,d as w,h as x,E as y};
|
|
2
|
+
`)){let e=t.trim();if(!e||y.some(t=>t.test(e)))continue;let n=e.replace(b,``).trim();if(n)return n.length>200?`${n.slice(0,200)}...`:n}return null}function S(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function C(e,t){let n=e?.[t];return typeof n==`boolean`?n:void 0}function w(e){if(!e)return;let t={...e};return delete t.hint,delete t.diagnosticId,delete t.logPath,delete t.retriable,delete t.supportedOn,Object.keys(t).length>0?t:void 0}function T(e){switch(e){case`DEVICE_IN_USE`:return!0;default:return}}function E(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`UNSUPPORTED_PLATFORM`:return`This platform is not supported for the requested operation; run devices to inspect available targets.`;case`AMBIGUOUS_MATCH`:return`Multiple candidates matched. Narrow the query or pass an exact identifier.`;case`DEVICE_IN_USE`:return`The device is busy with another agent-device request; retry once it frees up.`;case`REPLAY_DIVERGENCE`:return`Read details.divergence (screen/suggestions) for repair context, or rerun with --json for the full report.`;case`REPAIR_SESSION_EXPIRED`:return`The --save-script repair session was reaped before it was finalized; re-run replay <script> --save-script from the start.`;case`REPAIR_COMMIT_FAILED`:return`The repair transaction completed, but committing its healed script failed at teardown (no-clobber refusal or a filesystem error); inspect the target path/permissions, then re-run replay <script> --save-script to retry.`;case`NOT_IMPLEMENTED`:return`This command is part of the planned API but is not implemented yet.`;case`COMMAND_FAILED`:return`Retry with --debug and inspect diagnostics log for details.`;case`UNAUTHORIZED`:return`Refresh daemon metadata and retry the command.`;case`UNKNOWN`:return`Unexpected internal error. Retry with --debug and report the diagnostics log if it persists.`;default:return`Retry with --debug and inspect diagnostics log for details.`}}function D(e){return e===`xctest`||e===`android`||e===`macos-helper`||e===`linux-atspi`||e===`web`}function O(e){return e===void 0||e===`xctest`||e===`android`}function k(e){return e.map((e,t)=>({...e,ref:`e${t+1}`}))}const A=/^~s(\d+)$/,j=`Refs look like @e12, optionally pinned to the snapshot generation that minted them: @e12~s3 (the ref, then "~s" and the refsGeneration reported by the issuing snapshot/find response).`;function M(e){let t=e.trim(),n=t.indexOf(`~`);if(n===-1)return{base:t};let r=A.exec(t.slice(n));return!r||n===0?null:{base:t.slice(0,n),generation:Number(r[1])}}function N(e){let t=M(e);if(!t)return null;let n=t.base;return n.startsWith(`@`)?n.slice(1)||null:n.startsWith(`e`)?n:null}function P(e,t){return e.find(e=>e.ref===t)??null}function F(e){return JSON.stringify({interactiveOnly:e?.interactiveOnly===!0,depth:typeof e?.depth==`number`?e.depth:null,scope:e?.scope?.trim()||null,raw:e?.raw===!0})}function I(e){if(e)return{depth:e.snapshotDepth,interactiveOnly:e.snapshotInteractiveOnly,raw:e.snapshotRaw,scope:e.snapshotScope}}function L(e){return{x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)}}const R=[`summary`,`headers`,`body`,`all`],z=[`digest`,`default`,`full`];function B(e){return e!==void 0&&e!=="default"}function V(e){return{parse(t){return e(t,`$`)}}}function H(e,t){throw Error(`${e}: ${t}`)}function U(e,t){return(!e||typeof e!=`object`||Array.isArray(e))&&H(t,`Expected an object`),e}function W(e,t){return typeof e!=`string`&&H(t,`Expected a string`),e}function G(e,t){return Number.isInteger(e)||H(t,`Expected an integer`),e}function K(e,t){return Array.isArray(e)||H(t,`Expected an array`),e}function q(e,t,n){let r=e[t];return r===void 0?void 0:W(r,`${n}.${t}`)}function J(e,t,n){let r=e[t];if(r!==void 0)return K(r,`${n}.${t}`).map((e,r)=>W(e,`${n}.${t}[${String(r)}]`))}function Y(e,t,n){let r=e[t];return r===void 0?void 0:G(r,`${n}.${t}`)}function X(e,t,n){let r=e[t];return r===void 0?void 0:U(r,`${n}.${t}`)}function Z(e,t,n,r){let i=e[t];if(i!==void 0)return(typeof i!=`string`||!n.includes(i))&&H(`${r}.${t}`,`Expected one of: ${n.join(`, `)}`),i}const Q=V((e,t)=>{let n=U(e,t);return{platform:Z(n,`platform`,[`ios`,`android`],t),metroHost:q(n,`metroHost`,t),metroPort:Y(n,`metroPort`,t),bundleUrl:q(n,`bundleUrl`,t),launchUrl:q(n,`launchUrl`,t)}});function $(e,t){let n=e.id;return n==null||typeof n!=`string`&&typeof n!=`number`&&H(`${t}.id`,`Expected a string, number, or null`),n}const ee=V((e,t)=>{let n=U(e,t);return{jsonrpc:q(n,`jsonrpc`,t),id:$(n,t),method:q(n,`method`,t),params:n.params}}),te=V((e,t)=>{let n=U(e,t);return{token:q(n,`token`,t),session:q(n,`session`,t),command:q(n,`command`,t),positionals:J(n,`positionals`,t),input:X(n,`input`,t),flags:X(n,`flags`,t),runtime:X(n,`runtime`,t),meta:X(n,`meta`,t)}});export{T as C,g as S,i as T,f as _,B as a,m as b,k as c,P as d,D as f,O as g,M as h,Q as i,F as l,I as m,z as n,ee as o,N as p,te as r,j as s,R as t,L as u,p as v,d as w,h as x,E as y};
|
package/dist/src/sdk-device.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./sdk-contracts.js";const t=[`ios`,`ipados`,`tvos`,`watchos`,`visionos`,`macos`],n=[`apple`,`android`,`linux`,`web`],r=[`ios`,`macos`,`android`,`linux`,`web`],i=[...n,`ios`,`macos`],a=[`mobile`,`tv`,`desktop`];function o(e){return e===`apple`||e===`ios`||e===`macos`}function s(e){return e.appleOs===`macos`||e.platform===`macos`}function c(e){return o(e.platform)&&!s(e)}function l(e){return e.platform===`android`||o(e.platform)&&!s(e)}function u(e){return o(e.platform)?s(e)?`macos`:`ios`:e.platform}function d(e){return e===`macos`?{platform:`apple`,appleOs:`macos`}:e===`ios`?{platform:`apple`}:{platform:e}}function f(e){return o(e.platform)&&e.target===`tv`}function p(e){return r.includes(e)}function
|
|
1
|
+
import{_ as e}from"./sdk-contracts.js";const t=[`ios`,`ipados`,`tvos`,`watchos`,`visionos`,`macos`],n=[`apple`,`android`,`linux`,`web`],r=[`ios`,`macos`,`android`,`linux`,`web`],i=[...n,`ios`,`macos`],a=[`mobile`,`tv`,`desktop`];function o(e){return e===`apple`||e===`ios`||e===`macos`}function s(e){return e.appleOs===`macos`||e.platform===`macos`}function c(e){return o(e.platform)&&!s(e)}function l(e){return e.platform===`android`||o(e.platform)&&!s(e)}function u(e){return o(e.platform)?s(e)?`macos`:`ios`:e.platform}function d(e){return e===`macos`?{platform:`apple`,appleOs:`macos`}:e===`ios`?{platform:`apple`}:{platform:e}}function f(e){return o(e.platform)&&e.target===`tv`}function p(e){return e.appleOs?e.appleOs:e.platform===`macos`?`macos`:f(e)?`tvos`:`ios`}function m(e){return r.includes(e)}function h(e){return t.includes(e)}function g(e,t){return t?t===`apple`?o(e.platform):t===`ios`?o(e.platform)&&!s(e):t===`macos`?o(e.platform)&&s(e):e.platform===t:!0}function _(e,t){return t?v(t):e===`macos`||e===`desktop`?`macOS`:e===`tv`?`tvOS`:`iOS`}function v(e){switch(e){case`tvos`:return`tvOS`;case`macos`:return`macOS`;case`visionos`:return`visionOS`;default:return`iOS`}}function y(e){let{simulatorSetPath:t,platform:n,target:r}=e;if(t&&!(n===`macos`||r===`desktop`))return t}function b(e){return e.map((e,t)=>({device:e,index:t})).sort((e,t)=>O(e,t)).map(({device:e})=>e)}function x(e){return!e||e===`apple`||e===`ios`}async function S(t,n,r={}){let i=t.filter(e=>w(e,n));if(n.udid){let t=i.find(e=>e.id===n.udid&&o(e.platform));if(!t)throw new e(`DEVICE_NOT_FOUND`,`No Apple device with UDID ${n.udid}`);return t}if(n.serial){let t=i.find(e=>e.id===n.serial&&e.platform===`android`);if(!t)throw new e(`DEVICE_NOT_FOUND`,`No Android device with serial ${n.serial}`);return t}if(r.allowStoppedAndroidAvdPlaceholders!==!0&&(i=i.filter(e=>!C(e))),n.deviceName){let t=D(n.deviceName),r=i.find(e=>D(e.name)===t);if(!r)throw new e(`DEVICE_NOT_FOUND`,`No device named ${n.deviceName}`);return r}j(i)&&(i=b(i));let a=i[0];if(a!==void 0&&i.length===1)return a;i.length===0&&E(n,r);let s=i.filter(e=>e.kind!==`device`),c=s.length>0?s:i,l=c.filter(e=>e.booted),u=l[0];if(u&&l.length===1&&!j(c))return u;let d=j(c)?c[0]:l[0]??c[0];return d||E(n,r),d}function C(e){return e.platform===`android`&&e.kind===`emulator`&&e.booted===!1&&!/^emulator-\d+$/.test(e.id)}function w(e,t,n={}){return g(e,t.platform)&&(!t.target||(e.target??`mobile`)===t.target)&&(!n.includeExplicitSelectors||T(e,t))}function T(e,t){return!(t.udid&&!(e.id===t.udid&&o(e.platform))||t.serial&&!(e.id===t.serial&&e.platform===`android`)||t.deviceName&&D(e.name)!==D(t.deviceName))}function E(t,n){let r=n.simulatorSetPath;throw r&&x(t.platform)?new e(`DEVICE_NOT_FOUND`,`No devices found in the scoped simulator set`,{simulatorSetPath:r,hint:`The simulator set at "${r}" appears to be empty. Create a compatible simulator first with xcrun simctl --set "${r}" create, or remove the scoped simulator set.`,selector:t}):new e(`DEVICE_NOT_FOUND`,`No devices found`,{selector:t})}function D(e){return e.toLowerCase().replace(/_/g,` `).replace(/\s+/g,` `).trim()}function O(e,t){return k(e.device)-k(t.device)||Number(t.device.booted===!0)-Number(e.device.booted===!0)||e.device.name.localeCompare(t.device.name)||e.index-t.index}function k(e){return e.kind===`simulator`?A(e,0,1,2,3):e.kind===`device`&&o(e.platform)&&!s(e)?A(e,10,11,12,13):14}function A(e,t,n,r,i){return{mobile:M(e.name)?n:t,tv:r,desktop:i}[e.target??`mobile`]}function j(e){return e.length>0&&e.every(e=>o(e.platform))}function M(e){return/\bipad\b/i.test(e)}export{S as _,h as a,s as c,f as d,w as f,y as g,_ as h,d as i,l,u as m,i as n,o,g as p,r,c as s,a as t,m as u,p as v,b as y};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/
|
|
1
|
+
import { N as SnapshotNode } from "./sdk-contracts.js";
|
|
2
|
+
//#region src/selectors/parse.d.ts
|
|
3
3
|
type SelectorKey = 'id' | 'role' | 'text' | 'label' | 'value' | 'appname' | 'windowtitle' | 'visible' | 'hidden' | 'editable' | 'selected' | 'focused' | 'enabled' | 'hittable';
|
|
4
4
|
type SelectorTerm = {
|
|
5
5
|
key: SelectorKey;
|
|
@@ -17,7 +17,7 @@ declare function parseSelectorChain(expression: string): SelectorChain;
|
|
|
17
17
|
declare function tryParseSelectorChain(expression: string): SelectorChain | null;
|
|
18
18
|
declare function isSelectorToken(token: string): boolean;
|
|
19
19
|
//#endregion
|
|
20
|
-
//#region src/
|
|
20
|
+
//#region src/selectors/find.d.ts
|
|
21
21
|
declare const FIND_LOCATORS: readonly ['any', 'text', 'label', 'value', 'role', 'id'];
|
|
22
22
|
type FindLocator = (typeof FIND_LOCATORS)[number];
|
|
23
23
|
type FindAction = {
|
package/dist/src/sdk-finders.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as e}from"./sdk-batch.js";function t(t,n,r,i){return e(t,n,r,typeof i==`boolean`?{requireRect:i}:i)}export{t};
|
package/dist/src/sdk-io.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { U as PlatformSelector, V as DeviceTarget, b as SessionIsolationMode, l as DaemonServerMode, m as LeaseBackend, u as DaemonTransportPreference, x as SessionRuntimeHints } from "./sdk-contracts.js";
|
|
2
2
|
//#region src/client/client-companion-tunnel-contract.d.ts
|
|
3
3
|
type CompanionTunnelScope = {
|
|
4
4
|
tenantId: string;
|
|
@@ -75,11 +75,18 @@ type PrepareMetroRuntimeResult = {
|
|
|
75
75
|
androidRuntime: MetroRuntimeHints;
|
|
76
76
|
bridge: MetroBridgeResult | null;
|
|
77
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* `transport` says which channel delivered the reload: `http` for the classic GET /reload route,
|
|
80
|
+
* `message-socket` for the /message websocket broadcast used when the server has no HTTP reload
|
|
81
|
+
* route (Expo). `status`/`body` always describe the HTTP probe; on the websocket path `reloadUrl`
|
|
82
|
+
* is the ws(s) message-socket URL.
|
|
83
|
+
*/
|
|
78
84
|
type ReloadMetroResult = {
|
|
79
85
|
reloaded: true;
|
|
80
86
|
reloadUrl: string;
|
|
81
87
|
status: number;
|
|
82
88
|
body: string;
|
|
89
|
+
transport: 'http' | 'message-socket';
|
|
83
90
|
};
|
|
84
91
|
//#endregion
|
|
85
92
|
//#region src/remote/remote-config-schema.d.ts
|
|
@@ -97,6 +104,7 @@ type RemoteConfigMetroOptions = {
|
|
|
97
104
|
metroRuntimeFile?: string;
|
|
98
105
|
metroNoReuseExisting?: boolean;
|
|
99
106
|
metroNoInstallDeps?: boolean;
|
|
107
|
+
launchUrl?: string;
|
|
100
108
|
};
|
|
101
109
|
type RemoteConnectionProfileFields = {
|
|
102
110
|
stateDir?: string;
|