agent-device 0.20.8 → 0.20.10
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 +94 -31
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.8.apk → agent-device-android-ime-helper-0.20.10.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.10.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.8.manifest.json → agent-device-android-ime-helper-0.20.10.manifest.json} +4 -4
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.8.apk → agent-device-android-snapshot-helper-0.20.10.apk} +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.10.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.8.manifest.json → agent-device-android-snapshot-helper-0.20.10.manifest.json} +6 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +3 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +13 -7
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +10 -117
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +4 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +103 -2
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +22 -23
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +3 -23
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +10 -11
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +108 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +8 -5
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +179 -73
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +13 -12
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotPresentation.swift +183 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotPresentationTests.swift +0 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +20 -18
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputCandidatePolicy.swift +19 -0
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +2 -2
- package/dist/src/ai-sdk.d.ts +61 -0
- package/dist/src/ai-sdk.js +1 -0
- package/dist/src/android-adb.d.ts +6 -6
- package/dist/src/android-adb.js +1 -1
- package/dist/src/android.js +1 -1
- package/dist/src/app-helpers.js +1 -1
- package/dist/src/app-lifecycle.js +6 -7
- package/dist/src/app-lifecycle2.js +2 -2
- package/dist/src/app-log-reconnect.js +1 -1
- package/dist/src/app-log-runtime.js +3 -3
- package/dist/src/app-resolution.js +2 -2
- package/dist/src/app-state.js +2 -0
- package/dist/src/appearance.js +1 -0
- package/dist/src/apps.js +5 -5
- package/dist/src/artifacts.d.ts +1 -1
- package/dist/src/audio-probe.js +1 -1
- package/dist/src/auth-session.js +1 -1
- package/dist/src/backend-snapshot-options.js +1 -0
- package/dist/src/boot-diagnostics.js +2 -2
- package/dist/src/bounds.js +1 -0
- package/dist/src/byte-limit-stream.js +1 -0
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +42 -30
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +7 -7
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-types.d.ts +1582 -0
- package/dist/src/command-catalog.js +1 -0
- package/dist/src/command-metadata.js +1 -1
- package/dist/src/command-schema.js +1 -1
- package/dist/src/command-surface.js +1 -1
- package/dist/src/command-tools.js +2 -0
- package/dist/src/config.js +1 -0
- package/dist/src/connection-runtime.js +1 -1
- package/dist/src/connection.js +3 -3
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/contracts.js +1 -1
- package/dist/src/daemon-shutdown-report.js +1 -1
- package/dist/src/daemon.js +1 -1
- package/dist/src/debug-symbols.js +3 -3
- package/dist/src/device-claim-inspection.js +1 -1
- package/dist/src/device-input-state.js +1 -1
- package/dist/src/device-ready.js +1 -1
- package/dist/src/device2.js +2 -2
- package/dist/src/dispatch.js +1 -1
- package/dist/src/entities.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/finders.js +1 -1
- package/dist/src/generic-settle.js +1 -1
- package/dist/src/generic.js +1 -1
- package/dist/src/harmonyos.js +1 -1
- package/dist/src/hdc.js +1 -1
- package/dist/src/helper-package-install.js +1 -0
- package/dist/src/helper.js +2 -2
- package/dist/src/host-process.js +1 -1
- package/dist/src/ime-lifecycle.js +2 -9
- package/dist/src/ime-recovery-marker.js +1 -0
- package/dist/src/index.d.ts +2 -1569
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +4 -4
- package/dist/src/input-actions2.js +1 -1
- package/dist/src/install-artifact.js +1 -1
- package/dist/src/install-artifact2.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-common.js +1 -0
- package/dist/src/interaction-runtime.js +1 -1
- package/dist/src/interaction-snapshot.js +1 -1
- package/dist/src/interaction.js +1 -1
- package/dist/src/interaction2.js +1 -0
- package/dist/src/interactor.js +2 -2
- package/dist/src/interactor2.js +1 -1
- package/dist/src/interactors.js +1 -0
- package/dist/src/internal/bin.js +2 -2
- package/dist/src/internal/daemon.js +4 -7
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/inventory.js +1 -1
- package/dist/src/keyed-lock.js +1 -0
- package/dist/src/lease-context.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun-runtime-dependencies.js +1 -1
- package/dist/src/limrun.d.ts +13 -3
- package/dist/src/limrun.js +1 -1
- package/dist/src/linux.js +1 -1
- package/dist/src/location-coordinates.js +1 -0
- package/dist/src/logcat.js +1 -1
- package/dist/src/manifest.js +1 -1
- package/dist/src/mobile-snapshot-semantics.js +1 -0
- package/dist/src/observability.js +1 -0
- package/dist/src/owner-identity.js +1 -1
- package/dist/src/perf.js +4 -0
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/platform-runtime-app-log-process.js +1 -1
- package/dist/src/platform-runtime-host.js +1 -1
- package/dist/src/platform-runtime-network-web-transport.js +1 -1
- package/dist/src/platform-runtime-open-target.js +1 -0
- package/dist/src/platform-runtime-operation-host.js +4 -4
- package/dist/src/platform-runtime-runtime-hints.js +2 -0
- package/dist/src/platform-runtime-screen-recording-apple-runner-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-transport.js +1 -1
- package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-web-host.js +1 -1
- package/dist/src/platform-runtime.js +1 -1
- package/dist/src/platform-runtime2.js +1 -0
- package/dist/src/plist.js +1 -1
- package/dist/src/png-resize.js +1 -0
- package/dist/src/png-worker-contract.js +1 -1
- package/dist/src/process-lock.js +1 -1
- package/dist/src/project-runtime.js +1 -0
- package/dist/src/provider-webdriver.js +1 -1
- package/dist/src/provider.js +1 -0
- package/dist/src/proxy.js +1 -1
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-runtime.js +1 -1
- package/dist/src/record-trace.js +1 -1
- package/dist/src/recording-export-quality.js +1 -0
- package/dist/src/registry.js +29 -26
- package/dist/src/remote-config2.js +1 -1
- package/dist/src/replay.js +2 -2
- package/dist/src/reporting.js +5 -5
- package/dist/src/rolldown-runtime.js +1 -0
- package/dist/src/runner-client.js +1 -0
- package/dist/src/runner-disposal.js +1 -1
- package/dist/src/runner-lease.js +1 -1
- package/dist/src/runner-sequence.js +1 -1
- package/dist/src/runtime-transport.js +1 -1
- package/dist/src/runtime.js +3 -3
- package/dist/src/runtime2.js +4 -3
- package/dist/src/runtime3.js +1 -3
- package/dist/src/runtime4.js +3 -1
- package/dist/src/runtime5.js +1 -1
- package/dist/src/runtime6.js +1 -1
- package/dist/src/runtime7.js +1 -1
- package/dist/src/runtime8.js +1 -0
- package/dist/src/runtime9.js +1 -0
- package/dist/src/scoped-provider.js +1 -0
- package/dist/src/screenshot-density.js +1 -0
- package/dist/src/screenshot-result.js +4 -4
- package/dist/src/screenshot.js +1 -1
- package/dist/src/script-source-bundle.js +16 -0
- package/dist/src/sdk-android-adb.d.ts +44 -26
- package/dist/src/sdk-android-adb.js +4 -4
- package/dist/src/sdk-batch-runner.js +3 -3
- package/dist/src/sdk-contracts.d.ts +125 -88
- package/dist/src/sdk-contracts.js +2 -2
- package/dist/src/sdk-device.js +1 -1
- package/dist/src/sdk-finders.d.ts +1 -1
- package/dist/src/sdk-finders.js +1 -1
- package/dist/src/sdk-io.js +1 -1
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.d.ts +107 -95
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/sdk.js +1 -0
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.d.ts +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/server.js +10 -3
- package/dist/src/session-target-evidence.js +1 -1
- package/dist/src/session.js +1 -30
- package/dist/src/session2.js +27 -0
- package/dist/src/setting-state.js +1 -1
- package/dist/src/shared.js +1 -1
- package/dist/src/simctl.js +1 -0
- package/dist/src/simulator-state.js +1 -0
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-runtime.js +1 -1
- package/dist/src/snapshot-scope.js +1 -0
- package/dist/src/snapshot-session.js +1 -1
- package/dist/src/snapshot.js +8 -1
- package/dist/src/snapshot2.js +1 -1
- package/dist/src/snapshot3.js +1 -0
- package/dist/src/src.js +1 -1
- package/dist/src/src2.js +1 -2
- package/dist/src/src3.js +2 -1
- package/dist/src/src4.js +1 -0
- package/dist/src/string-enum.js +1 -0
- package/dist/src/tool-provider.js +3 -3
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/tool-provider3.js +1 -1
- package/dist/src/update-check.js +1 -1
- package/dist/src/verdict.js +1 -0
- package/dist/src/verified-file.js +1 -0
- package/dist/src/version.js +1 -1
- package/dist/src/video.js +1 -1
- package/dist/src/web.js +1 -1
- package/package.json +27 -10
- package/server.json +3 -3
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.8.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.8.apk.sha256 +0 -1
- package/dist/src/interaction-touch-reference-frame.js +0 -1
- package/dist/src/notifications.js +0 -1
- package/dist/src/platform-runtime-toolchain-host.js +0 -1
- package/dist/src/prepare-kind.js +0 -15
- package/dist/src/selector-vocabulary.js +0 -1
- package/dist/src/text-surface.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as e,a as t,i as n,u as r,v as i}from"./sdk-contracts.js";import{
|
|
2
|
-
`).map(e=>e.trim()).filter(e=>e.length>0)}function
|
|
3
|
-
`],[`r`,`\r`],[`t`,` `]]);function b(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Selector expression cannot be empty`);let r=Ze(n);if(r.length===0)throw new e(`INVALID_ARGS`,`Selector expression cannot be empty`);return{raw:n,selectors:r.map(e=>Ye(e))}}function x(e){try{return b(e)}catch{return null}}function qe(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 y.has(e)}return y.has(t.toLowerCase())}function Je(e){let t=e.trim(),n=t.indexOf(`=`);if(n===-1)return null;let r=t.slice(0,n).trim().toLowerCase();if(!r||y.has(r))return null;let i=t.slice(n+1).trim();if(!i)return null;let a=et(i).trim();return a?{key:r,value:a}:null}function S(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||!qe(t))break;r+=1;let n=e.slice(0,r).join(` `).trim();n&&x(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 Ye(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Selector segment cannot be empty`);let r=Qe(n);if(r.length===0)throw new e(`INVALID_ARGS`,`Invalid selector segment: ${t}`);return{raw:n,terms:r.map(Xe)}}function Xe(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Empty selector term`);let r=n.indexOf(`=`);if(r===-1){let r=n.toLowerCase();if(!He.has(r))throw new e(`INVALID_ARGS`,`Invalid selector term "${t}", expected key=value`);return{key:r,value:!0}}let i=n.slice(0,r).trim().toLowerCase(),a=n.slice(r+1).trim();if(!y.has(i))throw new e(`INVALID_ARGS`,`Unknown selector key: ${i}`);if(!a)throw new e(`INVALID_ARGS`,`Missing selector value for key: ${i}`);if(He.has(i)){let t=rt(a);if(t===null)throw new e(`INVALID_ARGS`,`Invalid boolean value for ${i}: ${a}`);return{key:i,value:t}}return{key:i,value:et(a)}}function Ze(t){let n=[],r=``,i=null;for(let a=0;a<t.length;a+=1){let o=t[a];if((o===`"`||o===`'`)&&!it(t,a)){i=$e(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 Qe(t){let n=[],r=``,i=null;for(let e=0;e<t.length;e+=1){let a=t.charAt(e);if((a===`"`||a===`'`)&&!it(t,e)){i=$e(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 $e(e,t){return e?e===t?null:e:t}function et(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?tt(t.slice(1,-1)):t}function tt(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=nt(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 nt(e){return Ke.get(e)??null}function rt(e){let t=et(e).toLowerCase();return t===`true`?!0:t===`false`?!1:null}function it(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}const at=[`any`,`text`,`label`,`value`,`role`,`id`],ot=[`text`,`label`,`value`,`role`,`id`];function st(e){let t=e?.toLowerCase();return t===`press`||t===`tap`?`click`:t}function ct(e){return e===`exists`||e===`wait`||e===`get_text`||e===`get_attrs`||e===`list`}function lt(e,t,n,r={}){let i=w(n);if(!i)return{matches:[],score:0};let a=0,o=[];for(let n of e){if(r.requireRect&&!n.rect)continue;let e=ut(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 ut(e,t,n){switch(t){case`role`:return dt(e.type,n);case`label`:return C(e.label,n);case`value`:return C(e.value,n);case`id`:return C(e.identifier,n);default:return Math.max(C(e.label,n),C(e.value,n),C(e.identifier,n))}}function C(e,t){let n=w(e??``);return n?n===t?2:+!!n.includes(t):0}function dt(e,t){let n=ft(e??``);return n?n===t?2:+!!n.includes(t):0}function w(e){return e.trim().toLowerCase().replace(/\s+/g,` `)}function ft(e){let t=e.trim();return t?(t=(t.split(`.`).pop()??t).replace(/XCUIElementType/gi,``).toLowerCase(),t):``}const pt=`find requires a value`,mt=`find actions: click (default; press/tap are aliases), list, focus, fill, type, exists, wait, get text, get attrs — there is no longpress/swipe find action. Run find "<text>" list to inspect every match with its @ref without acting, then dispatch the gesture on the chosen ref, e.g. longpress @eNN.`;function ht(e,t){if(e.length===0)return{ok:!1,code:`INVALID_ARGS`,message:`find requires a locator or text`};let n=vt([...e]);return n.query?t?.findFirst&&t?.findLast?{ok:!1,code:`INVALID_ARGS`,message:`find accepts only one of --first or --last`}:{ok:!0,parsed:n}:{ok:!1,code:`INVALID_ARGS`,message:pt}}const gt=[`exists`,`list`,`click`,`focus`];function _t(e){return gt.includes(e)}function vt(t){let n=`any`,r=0;ot.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=st(a[0]);if(_t(o))return{locator:n,query:i,action:o};if(o===`get`)return{locator:n,query:i,action:yt(a[1])};if(o===`wait`){let e=xt(a[1]);return{locator:n,query:i,action:`wait`,timeoutMs:e??void 0}}if(o===`fill`||o===`type`)return{locator:n,query:i,action:o,value:a.slice(1).join(` `)};throw new e(`INVALID_ARGS`,`Unsupported find action: ${a[0]}`,{hint:mt})}function yt(t){let n=t?.toLowerCase();if(n===`text`)return`get_text`;if(n===`attrs`)return`get_attrs`;throw new e(`INVALID_ARGS`,`find get only supports text or attrs`)}function bt(e,t){return e!==`any`||!t.includes(`=`)&&!t.includes(`||`)?null:x(t)?t:null}function xt(e){if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}function T(e,t,n){return t.terms.every(t=>St(e,t,n))}function St(e,t,n){switch(t.key){case`id`:return E(e.identifier,String(t.value));case`role`:return E(_(e.type??``),String(t.value));case`label`:return E(e.label,String(t.value));case`value`:return E(e.value,String(t.value));case`text`:return E(Ae(e),String(t.value));case`appname`:return E(e.appName,String(t.value));case`windowtitle`:return E(e.windowTitle,String(t.value));case`visible`:return v(e)===!!t.value;case`hidden`:return!v(e)==!!t.value;case`editable`:return Be(e,n)===!!t.value;case`selected`:return e.selected===!0==!!t.value;case`focused`:return e.focused===!0==!!t.value;case`enabled`:return e.enabled!==!1==!!t.value;case`hittable`:return e.hittable===!0==!!t.value;default:return!1}}function E(e,t){return w(e??``)===w(t)}function D(e,t,n){let r=n.requireRect??!1,i=n.requireUnique??!0,a=[];for(let[o,s]of t.selectors.entries()){let t=Ot(e,s,n.platform,r);if(a.push({selector:s.raw,matches:t.count}),!(t.count===0||!t.firstNode)){if(i&&t.count!==1){if(!n.disambiguateAmbiguous||!t.disambiguated||!t.tiebreak)continue;return{node:t.disambiguated,selector:s,selectorIndex:o,matches:t.count,diagnostics:a,disambiguation:{matchCount:t.count,tiebreak:t.tiebreak,alternatives:t.candidates.filter(e=>e!==t.disambiguated)}}}return{node:t.firstNode,selector:s,selectorIndex:o,matches:t.count,diagnostics:a}}}return null}function Ct(e,t,n){let r=n.requireRect??!1;for(let[i,a]of t.selectors.entries()){let t=e.filter(e=>r&&!e.rect?!1:T(e,a,n.platform));if(t.length>0)return{selector:a,selectorIndex:i,matchedNodes:t}}return null}function wt(e,t,n){let r=n.requireRect??!1,i=[];for(let[a,o]of t.selectors.entries()){let t=Mt(e,o,n.platform,r);if(i.push({selector:o.raw,matches:t}),t>0)return{selectorIndex:a,selector:o,matches:t,diagnostics:i}}return null}const Tt=`Snapshot refs expire when the UI changes. Run snapshot -i and retry with a fresh @ref.`;function Et(e){return e.some(e=>e.matches>1)?`Add more terms to disambiguate (e.g. role=button text="Sign in"), use an @ref from snapshot -i, or use find <text> --first/--last.`:`Selector text/label values match exactly (quote multi-word values: text="Sign in"). Run snapshot -i to see current elements and refs, or use find <text> for contains matching.`}function Dt(e,t,n){if(t.length===0)return`Selector did not match: ${e}`;let r=t.map(e=>`${e.selector} -> ${e.matches}`).join(`, `);return n.unique??!0?`Selector did not resolve uniquely (${r})`:`Selector did not match (${r})`}function Ot(e,t,n,r){let i=0,a=null,o=[],s={best:null,bestVisible:!1,tie:!1},c,l=t=>(c??=h(e),Fe(t,e,c));for(let c of e)r&&!c.rect||T(c,t,n)&&(i+=1,a??=c,o.push(c),kt(s,c,l));return{count:i,firstNode:a,disambiguated:s.tie?null:s.best,tiebreak:s.tie?null:At(o,s.best,l),candidates:o}}function kt(e,t,n){if(!e.best){e.best=t;return}e.bestVisible||=n(e.best);let r=n(t);if(r!==e.bestVisible){r&&(e.best=t,e.bestVisible=!0,e.tie=!1);return}let i=Nt(t,e.best);i.result>0?(e.best=t,e.tie=!1):i.result===0&&(e.tie=!0)}function At(e,t,n){if(!t)return null;let r=null;for(let i of e)i!==t&&(!r||jt(i,r,n).result>0)&&(r=i);return r?jt(t,r,n).criterion:null}function jt(e,t,n){let r=n(e);return r===n(t)?Nt(e,t):{result:r?1:-1,criterion:`visible`}}function Mt(e,t,n,r){let i=0;for(let a of e)r&&!a.rect||T(a,t,n)&&(i+=1);return i}function Nt(e,t){let n=e.depth??0,r=t.depth??0;if(n!==r)return{result:n>r?1:-1,criterion:`deepest`};let i=Pt(e),a=Pt(t);return i===a?{result:0,criterion:null}:{result:i<a?1:-1,criterion:`smallest-area`}}function Pt(e){return e.rect?e.rect.width*e.rect.height:1/0}const Ft={act:{ambiguity:`reject-candidates`,requireRect:!0},actCoveredDiagnosis:{ambiguity:`first-match`,requireRect:!0},readText:{ambiguity:`disambiguate`,requireRect:!1},readUnique:{ambiguity:`fail-closed`,requireRect:!1},readAny:{ambiguity:`first-match`,requireRect:!1},wait:{ambiguity:`first-match`,requireRect:!1},findAct:{ambiguity:`reject-candidates`,requireRect:!0}};function It(e){return e.ambiguity===`first-match`?{requireRect:e.requireRect,requireUnique:!1}:{requireRect:e.requireRect,requireUnique:!0,disambiguateAmbiguous:e.ambiguity===`disambiguate`}}function Lt(e,t,n,r){let i=n.ambiguity,a=Ct(e,t,{...r,requireRect:n.requireRect});if(!a||a.matchedNodes.length===0)return{kind:`none`};if(i===`first-match`)return zt(a);if(i===`reject-candidates`)return a.matchedNodes.length>1?Rt(a):zt(a);let o=D(e,t,{...r,...It({ambiguity:i,requireRect:n.requireRect})});return o?{kind:`resolved`,resolution:o,matchedNodes:a.matchedNodes}:Rt(a)}function Rt(e){return{kind:`ambiguous`,selector:e.selector.raw,selectorIndex:e.selectorIndex,matchedNodes:e.matchedNodes}}function zt(e){let t=e.matchedNodes[0];return t?{kind:`resolved`,matchedNodes:e.matchedNodes,resolution:{node:t,selector:e.selector,selectorIndex:e.selectorIndex,matches:e.matchedNodes.length,diagnostics:[{selector:e.selector.raw,matches:e.matchedNodes.length}]}}:{kind:`none`}}function O(e,t){return{ok:!1,code:`INVALID_ARGS`,message:e,...t?{hint:t}:{}}}function Bt(e){return[`visible`,`hidden`,`exists`,`editable`,`selected`,`focused`,`text`].includes(e)}function Vt(e){let t=e.toLowerCase();return Bt(t)?{ok:!0,predicate:t}:O(`is requires predicate: visible|hidden|exists|editable|selected|focused|text`,Ht)}const Ht=`Use "is <predicate> <selector>" or "is <selector> <predicate>". visible|hidden|editable|selected|focused double as selector keys: a bare predicate token after the selector is read as the predicate, so write key=true (e.g. visible=true) inside the selector to use it as a filter instead.`;function Ut(e){if(Bt((e[0]??``).toLowerCase()))return e;for(let t=1;t<e.length;t+=1){let n=(e[t]??``).toLowerCase();if(Bt(n)&&x(e.slice(0,t).join(` `)))return[n,...e.slice(0,t),...e.slice(t+1)]}return e}function Wt(e){let{predicate:t,node:n,nodes:r,expectedText:i,platform:a}=e,o=Ae(n),s=Be(n,a),c=n.selected===!0,l=n.focused===!0,u=t===`text`?v(n):Gt(n,r,a),d=!1;switch(t){case`visible`:d=u;break;case`hidden`:d=!u;break;case`editable`:d=s;break;case`selected`:d=c;break;case`focused`:d=l;break;case`text`:d=o===(i??``);break}let f=t===`text`?`expected="${i??``}" actual="${o}"`:`actual=${JSON.stringify({visible:u,editable:s,selected:c,focused:l})}`;return{pass:d,actualText:o,details:f}}function Gt(e,t,n){if(n===`android`&&e.visibleToUser===!1)return!1;if(g(e.rect))return Kt(e,t);if(e.rect)return!1;if(n!==`android`&&e.hittable===!0)return!0;let r=qt(e,t,n);return r?g(r.rect)?Kt(r,t):n!==`android`&&r.hittable===!0:!1}function Kt(e,t){return Pe(e,t)}function qt(e,t,n){return Se(t,e,h(t),e=>ze(e,n)?e:null)}function Jt(e){let t=Ut(e),n=t[0]??``;return{predicate:n,split:S(t.slice(1),{preferTrailingValue:n===`text`})}}const Yt=`is requires a selector expression`,Xt=`is text requires expected text value`;function Zt(e){let{predicate:t,split:n}=Jt([...e]),r=Vt(t);if(!r.ok)return r;if(!n)return O(Yt);let i=n.rest.join(` `).trim();return r.predicate===`text`&&!i?O(Xt):r.predicate!==`text`&&n.rest.length>0?O(`is ${r.predicate} does not accept trailing values`):{ok:!0,predicate:r.predicate,selectorExpression:n.selectorExpression,expectedText:i}}function Qt(e){return e===`text`||e===`attrs`?{ok:!0,format:e}:O(`get only supports text or attrs`)}function $t(e){let t=e[0];if(t?.startsWith(`@`)){let n=e.slice(1).join(` `).trim();return{ok:!0,ref:t,...n?{label:n}:{}}}let n=e.join(` `).trim();return n?{ok:!0,selector:n}:O(`get requires @ref or selector expression`)}function en(e){return e?{ok:!0,text:e}:O(`wait requires text`)}function tn(t,n,r={}){let i=t[n];if(i===void 0)return;if(!Number.isInteger(i))throw new e(`INVALID_ARGS`,`Expected ${n} to be an integer.`);let a=i;if(r.min!==void 0&&a<r.min)throw new e(`INVALID_ARGS`,`Expected ${n} to be at least ${r.min}.`);if(r.max!==void 0&&a>r.max)throw new e(`INVALID_ARGS`,`Expected ${n} to be at most ${r.max}.`);return a}function nn(t,n,r={}){let i=t[n];if(i!==void 0){if(typeof i!=`number`||!Number.isFinite(i))throw new e(`INVALID_ARGS`,`Expected ${n} to be a finite number.`);if(r.min!==void 0&&i<r.min)throw new e(`INVALID_ARGS`,`Expected ${n} to be at least ${r.min}.`);if(r.max!==void 0&&i>r.max)throw new e(`INVALID_ARGS`,`Expected ${n} to be at most ${r.max}.`);return i}}const rn=/^#\s*agent-device:target-v(\d+)(?:\s+(\S.*))?$/,an=/^#\s*agent-device:targets-v(\d+)(?:\s+(\S.*))?$/,on=4096;function sn(e){return e.normalize(`NFC`)}function cn(e){if(e===void 0)return;let t=sn(e);return t.length>0?t:void 0}function ln(e){return sn(e)}function un(e){if(e===void 0)return;let t=sn(e).trim().replace(/\s+/g,` `);return t.length>0?t:void 0}function k(e){return Buffer.byteLength(e,`utf8`)}function dn(e,t){if(k(e)<=t)return e;let n=e.length;for(;n>0&&k(e.slice(0,n))>t;)--n;if(n>0){let t=e.charCodeAt(n-1);t>=55296&&t<=56319&&--n}return e.slice(0,n)}function fn(e){let t={};return e.id!==void 0&&(t.id=e.id),t.role=e.role,e.label!==void 0&&(t.label=e.label),t.ancestry=e.ancestry.map(pn),t.sibling=e.sibling,t.viewportOrder=e.viewportOrder,e.scrollRegion&&(t.scrollRegion=mn(e.scrollRegion)),e.rect&&(t.rect=hn(e.rect)),t.verification=e.verification,t}function pn(e){let t={role:e.role};return e.label!==void 0&&(t.label=e.label),t}function mn(e){let t={role:e.role};return e.id!==void 0&&(t.id=e.id),e.label!==void 0&&(t.label=e.label),t}function hn(e){return{x:e.x,y:e.y,width:e.width,height:e.height}}function gn(e){return JSON.stringify(fn(e))}function _n(e){return`# agent-device:target-v1 ${gn(e)}`}function vn(e){return JSON.stringify({source:fn(e.source),destination:fn(e.destination)})}function yn(e){return`# agent-device:targets-v1 ${vn(e)}`}function bn(e){let t=e.trim(),n=an.exec(t);return n?Number(n[1])===1?{kind:`v1`,evidence:xn((n[2]??``).trim())}:{kind:`future-version`}:{kind:`none`}}function xn(t){if(k(t)>8320)throw new e(`INVALID_ARGS`,`targets-v1 annotation exceeds the 8320-byte payload cap.`);let n;try{n=JSON.parse(t)}catch{throw new e(`INVALID_ARGS`,`targets-v1 annotation is not valid JSON.`)}if(typeof n!=`object`||!n||Array.isArray(n))throw new e(`INVALID_ARGS`,`targets-v1 annotation must be a JSON object.`);let r=n;if(r.source===void 0||r.destination===void 0)throw new e(`INVALID_ARGS`,`targets-v1 annotation requires source and destination evidence.`);return{source:Cn(JSON.stringify(r.source)),destination:Cn(JSON.stringify(r.destination))}}function Sn(e){let t=e.trim();if(!t.startsWith(`#`))return{kind:`none`};let n=rn.exec(t);return n?Number(n[1])===1?{kind:`v1`,evidence:Cn((n[2]??``).trim())}:{kind:`future-version`}:{kind:`none`}}function Cn(t){if(k(t)>4096)throw new e(`INVALID_ARGS`,`target-v1 annotation exceeds the ${on}-byte payload cap.`);let n;try{n=JSON.parse(t)}catch{throw new e(`INVALID_ARGS`,`target-v1 annotation is not valid JSON.`)}if(typeof n!=`object`||!n||Array.isArray(n))throw new e(`INVALID_ARGS`,`target-v1 annotation must be a JSON object.`);let r=n,i=wn(r.role,`role`),a=Tn(r.id,`id`),o=En(r.label,`label`),s=On(r.ancestry),c=An(r.sibling,`sibling`,0),l=An(r.viewportOrder,`viewportOrder`,0),u=jn(r.scrollRegion),d=Mn(r.rect),f=Nn(r.verification);return{...a===void 0?{}:{id:a},role:i,...o===void 0?{}:{label:o},ancestry:s,sibling:c,viewportOrder:l,...u?{scrollRegion:u}:{},...d?{rect:d}:{},verification:f}}function wn(t,n){if(t===void 0)throw new e(`INVALID_ARGS`,`target-v1 "${n}" is required.`);if(typeof t!=`string`)throw new e(`INVALID_ARGS`,`target-v1 "${n}" must be a string.`);return Dn(ln(t),n)}function Tn(t,n){if(t===void 0)return;if(typeof t!=`string`)throw new e(`INVALID_ARGS`,`target-v1 "${n}" must be a string.`);let r=cn(t);return r===void 0?void 0:Dn(r,n)}function En(t,n){if(t===void 0)return;if(typeof t!=`string`)throw new e(`INVALID_ARGS`,`target-v1 "${n}" must be a string.`);let r=un(t);return r===void 0?void 0:Dn(r,n)}function Dn(t,n){if(k(t)>256)throw new e(`INVALID_ARGS`,`target-v1 "${n}" exceeds the 256-byte field cap.`);return t}function On(t){if(t===void 0)return[];if(!Array.isArray(t))throw new e(`INVALID_ARGS`,`target-v1 "ancestry" must be an array.`);if(t.length>8)throw new e(`INVALID_ARGS`,`target-v1 "ancestry" exceeds the 8-entry cap.`);return t.map((e,t)=>kn(e,t))}function kn(t,n){if(typeof t!=`object`||!t||Array.isArray(t))throw new e(`INVALID_ARGS`,`target-v1 "ancestry[${n}]" must be an object.`);let r=t,i=wn(r.role,`ancestry[${n}].role`),a=En(r.label,`ancestry[${n}].label`);return{role:i,...a===void 0?{}:{label:a}}}function An(t,n,r){if(t===void 0)return r;if(typeof t!=`number`||!Number.isSafeInteger(t)||t<0)throw new e(`INVALID_ARGS`,`target-v1 "${n}" must be a non-negative integer.`);return t}function jn(t){if(t===void 0)return;if(typeof t!=`object`||!t||Array.isArray(t))throw new e(`INVALID_ARGS`,`target-v1 "scrollRegion" must be an object.`);let n=t,r=wn(n.role,`scrollRegion.role`),i=Tn(n.id,`id`),a=En(n.label,`scrollRegion.label`);return{role:r,...i===void 0?{}:{id:i},...a===void 0?{}:{label:a}}}function Mn(t){if(t===void 0)return;if(typeof t!=`object`||!t||Array.isArray(t))throw new e(`INVALID_ARGS`,`target-v1 "rect" must be an object.`);let n=t;return{x:A(n.x,`rect.x`),y:A(n.y,`rect.y`),width:A(n.width,`rect.width`),height:A(n.height,`rect.height`)}}function A(t,n){if(typeof t!=`number`||!Number.isFinite(t))throw new e(`INVALID_ARGS`,`target-v1 "${n}" must be a finite number.`);return t}function Nn(t){if(t===`verified`||t===`unverifiable`)return t;throw new e(`INVALID_ARGS`,`target-v1 "verification" must be "verified" or "unverifiable".`)}function Pn(e){let t=ln(_(e.type??``)),n=cn(e.identifier),r=un(e.label);return{...n===void 0?{}:{id:dn(n,256)},role:dn(t,256),...r===void 0?{}:{label:dn(r,256)}}}function Fn(e,t){return e.id===t.id&&e.role===t.role&&e.label===t.label}function In(e,t){let n=0;for(let r of e)Pn(r).id===t&&(n+=1);return n}function Ln(e,t){if(e.id===void 0||In(t,e.id)<=1)return e;let{role:n,label:r}=e;return{role:n,...r===void 0?{}:{label:r}}}function Rn(e,t){let n=0;for(let r of e)if(r.parentIndex===t.parentIndex){if(r.index===t.index)return n;n+=1}return 0}function zn(e,t){return{documentOrder:e.index,sibling:Rn(t,e)}}function Bn(e,t){return e.documentOrder===t.documentOrder&&e.sibling===t.sibling}function Vn(e){return{...e.id===void 0?{}:{id:e.id},role:e.role,...e.label===void 0?{}:{label:e.label}}}function Hn(e,t){return t.id===void 0?e.role===t.role&&e.label===t.label:e.id===t.id}function Un(e,t){if(e.length<t.length)return!1;for(let[n,r]of t.entries()){let t=e[n];if(!t||t.role!==r.role||r.label!==void 0&&t.label!==r.label)return!1}return!0}function Wn(e,t){let n=[];return e.id!==t.id&&n.push(`id: recorded=${e.id??`(none)`} observed=${t.id??`(none)`}`),e.role!==t.role&&n.push(`role: recorded=${e.role} observed=${t.role}`),e.label!==t.label&&n.push(`label: recorded=${e.label??`(none)`} observed=${t.label??`(none)`}`),n}function Gn(e){return e?`${e.role}${e.label?`/${e.label}`:``}`:`(missing)`}function Kn(e,t){return!t||t.role!==e.role?!0:e.label!==void 0&&t.label!==e.label}function qn(e,t){for(let[n,r]of e.entries()){let e=t[n];if(Kn(r,e))return[`ancestry[${n}]: recorded=${Gn(r)} observed=${Gn(e)}`]}return[]}function Jn(e,t,n={}){let r=[],i=_(e.type??``),a=Yn(e,n.nodes),o=M(e.label),s=M(e.value),c=M(Ae(e)),l=n.action===`fill`;a&&r.push(`id=${j(a)}`),i&&o&&r.push(l?`role=${j(i)} label=${j(o)} editable=true`:`role=${j(i)} label=${j(o)}`),o&&r.push(l?`label=${j(o)} editable=true`:`label=${j(o)}`),s&&r.push(l?`value=${j(s)} editable=true`:`value=${j(s)}`),c&&c!==o&&c!==s&&r.push(l?`text=${j(c)} editable=true`:`text=${j(c)}`),i&&l&&!r.some(e=>e.includes(`editable=true`))&&r.push(`role=${j(i)} editable=true`);let u=Xn(r);return u.length===0&&i&&u.push(l?`role=${j(i)} editable=true`:`role=${j(i)}`),u.length===0&&v(e)&&u.push(`visible=true`),u}function Yn(e,t){let n=M(e.identifier);if(!n||!t)return n;let r=Pn(e).id;return r===void 0?n:In(t,r)>1?null:n}function Xn(e){return Array.from(new Set(e))}function j(e){return JSON.stringify(e)}function M(e){return e&&e.trim()||null}function Zn(e,t){let n=e===`is`?Jt([...t]).split:S([...t]);return n?x(n.selectorExpression)?{kind:`expression`,expression:n.selectorExpression,rest:n.rest}:{kind:`invalid`}:{kind:`not-applicable`}}function Qn(e){return{platform:e.platform,...It({ambiguity:e.allowDisambiguation?`disambiguate`:`fail-closed`,requireRect:e.requireRect})}}function $n(e,t,n){let r=x(e);if(!r)return{kind:`unresolved`,reason:`parse-invalid`,matchedNodes:[]};let i=D(t,r,Qn(n));if(i){let e=t.filter(e=>n.requireRect&&!e.rect?!1:T(e,i.selector,n.platform));return{kind:`resolved`,winner:i.node,matchedNodes:e,matchCount:e.length,...i.disambiguation?{disambiguation:{tiebreak:i.disambiguation.tiebreak,matchCount:i.disambiguation.matchCount,alternatives:i.disambiguation.alternatives}}:{}}}let a=Ct(t,r,{platform:n.platform,requireRect:n.requireRect})?.matchedNodes??[];return{kind:`unresolved`,reason:a.length>0?`ambiguous`:`no-match`,matchedNodes:a}}function er(e,t,n={}){return Jn(e,t,n)}function tr(e,t,n){let r=x(e);if(!r)return;let i=D(t,r,Qn(n));if(i)return{node:i.node,basis:rr(i.selector)}}function nr(e){if(!e)return;let t=x(e);if(!t)return;let n=t.selectors.flatMap(e=>e.terms.flatMap(e=>(e.key===`label`||e.key===`text`||e.key===`id`)&&typeof e.value==`string`?[e.value]:[]));if(n.length===0)return;let r=n[0];return r&&n.every(e=>e===r)?r:void 0}function rr(e){let t=new Set(e.terms.map(e=>e.key));if(t.has(`id`))return`id`;let n=t.has(`role`),r=t.has(`label`)||t.has(`text`);return n&&r?`role-label`:r||t.has(`value`)?`label`:`other`}function ir(e,t){let n=x(e);if(!n)return e.includes(`=`)||e.includes(`||`)?null:e;let r=new Set(t.textKeys);return n.selectors.length>1?ar(n.selectors,r):or(n.selectors[0],r,new Set(t.booleanKeys))}function ar(e,t){let n=e.map(e=>{let n=e.terms.length===1?e.terms[0]:void 0;return n&&t.has(n.key)&&typeof n.value==`string`?n.value:void 0}),r=n[0];return r!==void 0&&n.every(e=>e===r)?r:null}function or(e,t,n){if(!e)return null;let r={},i=0;for(let a of e.terms){if(sr(a,t,`string`))i+=1;else if(!sr(a,n,`boolean`))return null;r[a.key]=a.value}return i<=1&&Object.keys(r).length>0?r:null}function sr(e,t,n){return t.has(e.key)&&typeof e.value===n}function cr(e){let t=x(e);if(!t||t.selectors.length!==1)return null;let n=t.selectors[0];if(!n||n.terms.length!==1)return null;let r=n.terms[0];return!r||typeof r.value!=`string`||r.key!==`id`&&r.key!==`label`&&r.key!==`text`&&r.key!==`value`?null:{key:r.key,value:r.value,raw:n.raw}}function lr(e,t){if(!t)return!1;let n=x(e);return n?n.selectors.some(e=>e.terms.some(e=>(e.key===`text`||e.key===`label`||e.key===`value`)&&typeof e.value==`string`&&e.value.includes(t))):!1}function ur(e){return b(e).selectors.map(e=>e.raw)}function dr(e){return x(e)!==null}function fr(e,t,n){let r=Ct(e,b(t),n);return r?{...r,selector:r.selector.raw}:null}function pr(e,t,n,r){let i=Lt(e,b(t),n,r);return i.kind===`resolved`?{...i,resolution:{...i.resolution,selector:i.resolution.selector.raw}}:i}function N(e){if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}function mr(e){let t=e[0];if(t===void 0)return null;let n=N(t);if(n!==null)return{kind:`sleep`,durationMs:n};let r=N(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?N(t[1]):null;return{kind:`stable`,quietMs:t.length>0?N(t[0]):null,timeoutMs:n}}if(t.startsWith(`@`))return{kind:`ref`,rawRef:t,timeoutMs:r};let i=S(r===null?e.slice():e.slice(0,-1));return i&&i.rest.length===0&&dr(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 hr(e){let t=mr(e);return t?t.kind===`sleep`?t.durationMs:t.timeoutMs:null}const gr=24e4,P={budget:{source:`none`},envelopeMs:9e4,onTimeout:`reset-daemon`},_r={click:`settle-and-verify`,press:`settle-and-verify`,fill:`settle-and-verify`,longpress:`settle`,scroll:`settle`,back:`settle`};function vr(e){if(e!==void 0)return _r[e]}const F=new Set([`com.google.android.inputmethod.latin`,`com.samsung.android.honeyboard`,`com.touchtype.swiftkey`,`com.microsoft.swiftkey`]);function yr(e){let t=I(e.packageName),n=(e.resourceId??``).toLowerCase(),r=I(e.activeInputMethodPackage);if(t&&r&&t===r)return{inputMethodOwned:!0,source:`active-input-method`};if(r&&n.startsWith(`${r}:id/`))return{inputMethodOwned:!0,source:`active-input-method-resource`};if(t&&F.has(t))return{inputMethodOwned:!0,source:`known-ime-package`};for(let e of F)if(n.startsWith(`${e}:id/`))return{inputMethodOwned:!0,source:`known-ime-resource`};return{inputMethodOwned:!1,source:`app`}}function br(e,t,n){return yr({packageName:e,resourceId:t,activeInputMethodPackage:n}).inputMethodOwned}function xr(e){return yr(e).inputMethodOwned}function Sr(e){let t=I(e);return!!(t&&F.has(t))}function Cr(e){let t=(e??``).toLowerCase();for(let e of F)if(t.startsWith(`${e}:id/`))return!0;return!1}function wr(e,t,n){return!e&&!t?`unknown`:br(e,t,n)?`ime`:`app`}function Tr(e){for(let t of[/\bmCurMethodId=([^\s]+)/i,/\bmCurId=([^\s]+)/i,/\bmCurrentInputMethodId=([^\s]+)/i,/\bcurMethodId=([^\s]+)/i]){let n=Er(e.match(t)?.[1]);if(n)return n}}function Er(e){let t=(e??``).trim();if(t)return I((t.split(`/`)[0]??``).match(/[a-zA-Z0-9_.]+/)?.[0])}function I(e){return(e??``).trim().toLowerCase()||void 0}const Dr=`com.android.systemui`;function Or(e){let t=e??``;if(!t.startsWith(`com.android.systemui:id/`))return!1;let n=t.slice(`${Dr}:id/`.length);return/(^|_)(status_bar|navigation_bar)(_|$)/.test(n)}function kr(e){return`systemChrome`in e&&e.systemChrome===!0}function Ar(e){if(!kr(e))return e;let{systemChrome:t,...n}=e;return n}function jr(e){return e.some(kr)?e.map(Ar):e}const Mr={ios:`iOS`,ipados:`iPadOS`,tvos:`tvOS`,watchos:`watchOS`,visionos:`visionOS`,macos:`macOS`},Nr={visionos:`visionOS uses spatial input and does not support two-finger touch synthesis.`,tvos:`tvOS has no touch input — this gesture is supported on Android and the iOS simulator only.`,macos:`macOS automation has no multi-touch input — this gesture is supported on Android and the iOS simulator only.`};function Pr(t,n){if(!l(t.platform))throw Fr(n,t.platform);let r=u(t);if(!((r===`ios`||r===`ipados`)&&t.kind===`simulator`))throw r===`ios`||r===`ipados`?new e(`UNSUPPORTED_OPERATION`,`gesture ${n} is not supported on physical iOS devices`,{hint:`Two-finger gesture synthesis is iOS-simulator only — not available on physical iOS devices.`}):Fr(n,Mr[r],Nr[r])}function Fr(t,n,r){return new e(`UNSUPPORTED_OPERATION`,`gesture ${t} is not supported on ${n}`,r===void 0?void 0:{hint:r})}function Ir(e){let t=e.state??`stopped`;return{audio:`probe`,state:t,active:t===`running`,heard:!1,source:e.source,backend:e.backend,durationMs:e.durationMs,elapsedMs:e.elapsedMs??0,bucketMs:e.bucketMs,sampleCount:0,mediaElementCount:e.mediaElementCount,sourceCount:e.sourceCount??0,rmsDbfs:[],peakDbfs:[],reason:e.reason,notes:e.notes}}function Lr(e,t){let n=Vr(e),r=Rr(n),i=zr(n.rmsDbfs),a=zr(n.peakDbfs),o=[...Br(n.notes)??[],...t.notes??[]];return{audio:`probe`,state:r,active:r===`running`&&Hr(n.active,t.activeFallback??!0),heard:n.heard===!0,source:t.source,backend:R(n.backend)??t.backend,durationMs:L(n.durationMs,t.durationMs),elapsedMs:L(n.elapsedMs,t.elapsedMs),bucketMs:L(n.bucketMs,t.bucketMs),sampleCount:L(n.sampleCount,i.length),mediaElementCount:t.mediaElementCount===void 0?Ur(n.mediaElementCount):L(n.mediaElementCount,t.mediaElementCount),sourceCount:L(n.sourceCount,t.sourceCount??0),rmsDbfs:i,peakDbfs:a,startedAt:R(n.startedAt),stoppedAt:R(n.stoppedAt),reason:R(n.reason),notes:o.length>0?o:void 0}}function Rr(e){return e.state===`running`?`running`:`stopped`}function L(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function zr(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)typeof n==`number`&&Number.isFinite(n)&&t.push(n);return t}function Br(e){if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}function Vr(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Hr(e,t){return typeof e==`boolean`?e:t}function R(e){return typeof e==`string`?e:void 0}function Ur(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Wr(e){return process.platform===`darwin`&&(s(e)||a(e)&&e.kind===`simulator`||e.platform===`android`&&e.kind===`emulator`)}function Gr(e){return e.platform===`web`||Wr(e)}function Kr(e){if(typeof e!=`object`||!e)throw ei();let t=e,n=Object.keys(t).sort();if(!(t.kind===`legacy`&&z(n,[`kind`]))&&!(t.kind===`inventory`&&z(n,[`kind`,`use`])&&Yr(t.use))&&!(t.kind===`device-runtime`&&z(n,[`kind`,`use`])&&Xr(t.use))&&!(t.kind===`device-runtime`&&z(n,[`kind`,`uses`])&&qr(t.uses)))throw ei()}function qr(e){if(!Array.isArray(e)||e.length===0||!e.every(Xr))return!1;let t=e.map(Jr);return new Set(t).size===t.length}function Jr(e){return JSON.stringify({required:[...e.required].sort(),preferred:[...e.preferred].sort()})}function Yr(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.kind===`device-inventory`&&z(Object.keys(t).sort(),[`kind`])}function Xr(e){if(typeof e!=`object`||!e)return!1;let t=e,n=Zr(t.required),r=Zr(t.preferred);return!n||!r||!Qr(n)||!Qr(r)||!$r(n,r)?!1:z(Object.keys(t).sort(),[`preferred`,`required`])}function Zr(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:null}function Qr(e){return new Set(e).size===e.length}function $r(e,t){let n=new Set(e);return t.every(e=>!n.has(e))}function z(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function ei(){return TypeError(`Command platform execution must declare exactly one of legacy, inventory, or device-runtime`)}var ti=class{#e=[];#t=`open`;get disposed(){return this.#t===`disposed`}defer(e){this.#n(),this.#e.push(e)}use(e){return this.defer(async()=>await e[Symbol.asyncDispose]()),e}async[Symbol.asyncDispose](){if(this.#t===`disposed`)return;if(this.#t===`disposing`)throw TypeError(`Async cleanup stack disposal is already in progress`);this.#t=`disposing`;let e=[];for(;this.#e.length>0;){let t=this.#e.pop();if(t)try{await t()}catch(t){e.push(t)}}if(this.#t=`disposed`,e.length===1)throw e[0];if(e.length>1)throw AggregateError(e,`Multiple asynchronous cleanups failed`)}#n(){if(this.#t!==`open`)throw TypeError(`Cannot register cleanup after disposal has begun`)}},ni=class{#e;#t=`pending`;constructor(e){this.#e=e}get pending(){return this.#t===`pending`}transfer(){if(this.#t!==`pending`)throw TypeError(`Cannot transfer handle in ${this.#t} state`);return this.#t=`transferred`,this.#e}async[Symbol.asyncDispose](){this.#t===`pending`&&(this.#t=`disposed`,await this.#e[Symbol.asyncDispose]())}};function B(){return e=>{let t=ri(e.required,`required`),n=ri(e.preferred??[],`preferred`),r=n.find(e=>t.includes(e));if(r!==void 0)throw TypeError(`Runtime operation cannot be both required and preferred: ${r}`);return Object.freeze({required:t,preferred:n})}}function ri(e,t){let n=[...e];if(new Set(n).size!==n.length)throw TypeError(`Runtime use contains duplicate ${t} operations`);return Object.freeze(n)}function ii(e){if(!o(e))throw TypeError(`Unknown local runtime family: ${String(e)}`);return Object.freeze({kind:`local-family`,family:e})}function ai(e,t){let n=e.trim(),r=t.trim();if(n.length===0||r.length===0)throw TypeError(`Provider runtime owner requires non-empty provider and instance identities`);return Object.freeze({kind:`provider-runtime`,provider:n,instance:r})}function oi(e){return e.kind===`local-family`?`local:${e.family}`:`provider:${JSON.stringify([e.provider,e.instance])}`}function si(e,t){return oi(e)===oi(t)}function ci(e,t){let n={},r={};for(let i of t.required){let t=li(e.facts.operations,i);if(n[i]=t,!t.available)throw mi(i,t);r[i]=fi(e.operations,i)}for(let i of t.preferred){let t=li(e.facts.operations,i);n[i]=t,t.available&&(r[i]=fi(e.operations,i))}return Object.freeze({device:e.device,owner:e.owner,facts:Object.freeze(n),operations:Object.freeze(r)})}function li(e,t){let n=e[t];if(!ui(n))throw hi(`Runtime owner omitted the ${t} fact`);let r=di(n);if(r)return r;throw hi(`Runtime owner returned an invalid ${t} fact`)}function ui(e){return typeof e==`object`&&!!e&&`available`in e}function di(e){if(e.available===!0)return Object.freeze({available:!0});if(e.available===!1&&pi(e.reason)&&!(e.hint!==void 0&&typeof e.hint!=`string`))return Object.freeze({available:!1,reason:e.reason,...e.hint===void 0?{}:{hint:e.hint}})}function fi(e,t){let n=e[t];if(typeof n!=`function`)throw hi(`Runtime owner advertised ${t} without an implementation`);return n}function pi(e){return e===`unsupported-platform-leaf`||e===`unsupported-device-kind`||e===`unsupported-device-backend`||e===`unsupported-provider-mode`||e===`owner-capability-missing`}function mi(t,n){return new e(`UNSUPPORTED_OPERATION`,`Runtime operation ${t} is unavailable`,{reason:n.reason,hint:n.hint})}function hi(t){return new e(`COMMAND_FAILED`,t,{reason:`runtime-contract-invalid`,hint:`This is an agent-device runtime contract bug; report the selected device and command.`})}function gi(e){return e.status===`cleaned`||e.status===`already-missing`}const _i=`app-log`,vi=`screen-recording`,yi=B(),bi=yi({required:[`screenRecordingStart`]}),xi=yi({required:[`screenRecordingReattach`,`screenRecordingCleanup`]}),Si=yi({required:[]}),Ci=yi({required:[],preferred:[`screenRecordingStart`]}),wi=Object.freeze([bi,xi]);function Ti(t){switch((t.action??``).toLowerCase()){case`start`:if(!Ei(t.scope??`app`))throw new e(`INVALID_ARGS`,`record scope must be app, device, or system`);return Object.freeze({kind:`start`,use:bi});case`stop`:return t.hasLiveHandle===!0?Object.freeze({kind:`stop-live`,use:Si}):Object.freeze({kind:`stop-recovery`,use:xi});default:throw new e(`INVALID_ARGS`,`record requires start or stop`)}}function Ei(e){return e===`app`||e===`device`||e===`system`}function Di(e){if(Kr(e),e.kind!==`device-runtime`||!(`uses`in e))throw ki();let t=e.uses.map(Oi),n=wi.map(Oi),r=new Set(t),i=new Set(n);if(t.length!==n.length||r.size!==t.length||[...r].some(e=>!i.has(e)))throw ki()}function Oi(e){return JSON.stringify({required:[...e.required].sort(),preferred:[...e.preferred].sort()})}function ki(){return TypeError(`Record runtime execution must declare exactly the uses selected by its two runtime-bearing plans`)}const Ai=B(),ji=Ai({required:[`networkDump`]}),Mi=Ai({required:[],preferred:[`networkDump`]}),Ni=[`dump`,`log`],Pi=[`summary`,`headers`,`body`,`all`];function Fi(t){let n=(t.action??`dump`).toLowerCase(),r=(t.include??`summary`).toLowerCase();if(!Ii(n))throw new e(`INVALID_ARGS`,`network requires dump or log`);if(!Li(r))throw new e(`INVALID_ARGS`,`network --include must be summary, headers, body, or all`);return Object.freeze({action:n,include:r,use:ji})}function Ii(e){return Ni.some(t=>t===e)}function Li(e){return Pi.some(t=>t===e)}const Ri=B(),V=Ri({required:[`appLogInspect`]}),zi=Ri({required:[`appLogInspect`,`appLogDoctor`]}),Bi=Ri({required:[`appLogInspect`,`appLogStart`]}),Vi=Ri({required:[],preferred:[`appLogInspect`]}),Hi=Object.freeze([V,zi,Bi]);function Ui(t){let n=(t.action??`path`).toLowerCase();if(t.restart&&n!==`clear`)throw new e(`INVALID_ARGS`,`logs --restart is only supported with logs clear`);switch(n){case`path`:return Object.freeze({kind:`path`,requiresAppSession:!1,use:V});case`start`:return Object.freeze({kind:`start`,requiresAppSession:!0,use:Bi});case`stop`:return Object.freeze({kind:`stop`,requiresAppSession:!1,use:V});case`doctor`:return Object.freeze({kind:`doctor`,requiresAppSession:!1,use:zi});case`mark`:return Object.freeze({kind:`mark`,marker:t.marker??``,requiresAppSession:!1,use:V});case`clear`:return t.restart?Object.freeze({kind:`clear-restart`,requiresAppSession:!0,use:Bi}):Object.freeze({kind:`clear`,requiresAppSession:!1,use:V});default:throw new e(`INVALID_ARGS`,`logs requires path, start, stop, doctor, mark, or clear`)}}function Wi(e){let t=new Map;for(let n of e){if(!o(n.family))throw TypeError(`Unknown platform family registration: ${String(n.family)}`);if(t.has(n.family))throw TypeError(`Duplicate platform family registration: ${n.family}`);t.set(n.family,Gi(n))}let n=c.filter(e=>!t.has(e));if(n.length>0)throw TypeError(`Missing platform family registrations: ${n.join(`, `)}`);let r=Object.freeze([...c]),i=Object.freeze(r.map(e=>Ki(t,e)));return Object.freeze({families:r,modules:i,get:e=>Ki(t,e)})}function Gi(e){return Object.freeze({...e})}function Ki(e,t){let n=e.get(t);if(!n)throw TypeError(`Missing platform family registration: ${t}`);return n}const qi=Object.freeze({kind:`device-inventory`}),Ji={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0},H={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0,selectorValidationExempt:!0},Yi=()=>!0,Xi=e=>(e.positionals?.[0]??``).toLowerCase()===`start`,Zi=e=>e.command===`test`&&(typeof e.flags?.shardAll==`number`||typeof e.flags?.shardSplit==`number`),Qi=new Set([`status`,`get`]),$i=e=>aa(e,Qi,`status`),ea=new Set([`get`,`wait`]),ta=e=>aa(e,ea,`get`),na=e=>oa(e,Qi,`status`),ra=e=>oa(e,ea,`get`),ia=e=>{try{return ct(vt(e.positionals??[]).action)?`observes-app`:`mutates-app`}catch{return`mutates-app`}};function aa(e,t,n){return t.has((e.positionals?.[0]??n).toLowerCase())?`preserve`:`may-invalidate`}function oa(e,t,n){return t.has((e.positionals?.[0]??n).toLowerCase())?`observes-app`:`mutates-app`}const U={simulator:!0,device:!0},W={emulator:!0,device:!0,unknown:!0},sa={emulator:!0},G={device:!0},K={},q={apple:U,android:W,linux:G},ca={...q,vega:sa},la={apple:U,android:W,linux:K},ua={apple:U,android:W,linux:K},J={recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:U,android:W,linux:G},timeoutPolicy:P,batchable:!0},Y={...P,onTimeout:`preserve-daemon`},da={...P,envelopeMs:18e4},fa={...P,budget:{source:`flag`,envelope:`widen`,defaultBudgetMs:1e4},onTimeout:`preserve-daemon`},pa={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}}},ma={fields:{delayMs:{defaultValue:0}}};function X(e,t){return vr(e)===void 0?t:fa}function Z(e){let t=vr(e);if(t===void 0)throw Error(`Missing post-action observation descriptor support for ${e}`);return t}const ha=[{name:`lease_allocate`,catalog:{group:`internal`,key:`leaseAllocate`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...Ji},timeoutPolicy:P,batchable:!1},{name:`lease_heartbeat`,catalog:{group:`internal`,key:`leaseHeartbeat`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...Ji},timeoutPolicy:P,batchable:!1},{name:`lease_release`,catalog:{group:`internal`,key:`leaseRelease`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...Ji},timeoutPolicy:P,batchable:!1},{name:`artifacts`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...Ji},timeoutPolicy:P,batchable:!1},{name:`session_list`,catalog:{group:`internal`,key:`sessionList`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,...H},timeoutPolicy:P,batchable:!1},{name:`session_save_script`,catalog:{group:`internal`,key:`sessionSaveScript`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`publication`},timeoutPolicy:P,batchable:!1},{name:`devices`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,...H},timeoutPolicy:P,batchable:!0,platformExecution:{kind:`inventory`,use:qi}},{name:`capabilities`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0,...H},timeoutPolicy:P,batchable:!0},{name:`doctor`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,allowSessionlessDefaultDevice:Yi,...H},timeoutPolicy:P,batchable:!0},{name:`apps`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0},capability:la,timeoutPolicy:P,batchable:!0},{name:`boot`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`may-invalidate`,sessionKind:`state`},capability:{apple:U,android:W,linux:K},timeoutPolicy:P,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:K},timeoutPolicy:P,batchable:!0},{name:`appstate`,catalog:{group:`public`,key:`appState`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`state`},capability:{apple:U,android:W,linux:K},timeoutPolicy:P,batchable:!0},{name:`perf`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:U,android:W,linux:K},timeoutPolicy:P,batchable:!0},{name:`logs`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},platformExecution:{kind:`device-runtime`,uses:Hi},timeoutPolicy:P,batchable:!0},{name:`events`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`,allowInvalidRecording:!0,...H},timeoutPolicy:P,batchable:!1},{name:`network`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},platformExecution:{kind:`device-runtime`,use:ji},timeoutPolicy:P,batchable:!0},{name:`audio`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:U,android:{emulator:!0},linux:K},timeoutPolicy:P,batchable:!0},{name:`replay`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`,sessionKind:`replay`,skipSessionlessProviderDevice:Zi,saveScriptFlagOwner:!0},timeoutPolicy:{...P,budget:{source:`flag`}},batchable:!1},{name:`test`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`,sessionKind:`replay`,skipSessionlessProviderDevice:Zi},timeoutPolicy:{...P,envelopeMs:`unbounded`},batchable:!0},{name:`runtime`,catalog:{group:`internal`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`},timeoutPolicy:P,batchable:!1},{name:`clipboard`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`session`,refFrameEffect:`preserve`},dispatch:{},capability:{apple:U,android:W,linux:G},timeoutPolicy:P,batchable:!0},{name:`keyboard`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:na,daemon:{route:`session`,refFrameEffect:$i,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:U,android:W,linux:K},timeoutPolicy:P,batchable:!0},{name:`install`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},capability:ua,timeoutPolicy:da,batchable:!0},{name:`reinstall`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},capability:ua,timeoutPolicy:da,batchable:!0},{name:`install_source`,catalog:{group:`internal`,key:`installSource`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},timeoutPolicy:da,batchable:!1},{name:`release_materialized_paths`,catalog:{group:`internal`,key:`releaseMaterializedPaths`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,...H},timeoutPolicy:P,batchable:!1},{name:`push`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:{simulator:!0},android:W,linux:K},timeoutPolicy:P,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:U,android:W,linux:K},timeoutPolicy:P,batchable:!0},{name:`open`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`,allowSessionlessDefaultDevice:Yi,saveScriptFlagOwner:!0},dispatch:{},capability:ca,timeoutPolicy:P,batchable:!0},{name:`prepare`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`},capability:{apple:U,android:{},linux:K},timeoutPolicy:{budget:{source:`flag`},envelopeMs:gr,onTimeout:`reset-daemon`},batchable:!1,mcpExposed:!1},{name:`batch`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`},timeoutPolicy:P,batchable:!1},{name:`close`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`,allowInvalidRecording:!0,saveScriptFlagOwner:!0},dispatch:{},capability:ca,timeoutPolicy:P,batchable:!0},{name:`snapshot`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},dispatch:{},capability:q,timeoutPolicy:{...Y,budget:{source:`flag`}},batchable:!0},{name:`diff`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},capability:q,timeoutPolicy:P,batchable:!0},{name:`wait`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,targetIdentityVerification:`post-resolution`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},capability:q,timeoutPolicy:{...Y,budget:{source:`positional-parser`,parser:hr}},batchable:!0},{name:`alert`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:ra,daemon:{route:`snapshot`,refFrameEffect:ta},capability:{apple:U,android:W,linux:K},timeoutPolicy:P,batchable:!0},{name:`settings`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`snapshot`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:U,android:W,linux:K},timeoutPolicy:P,batchable:!0},{name:`react-native`,catalog:{group:`public`,key:`reactNative`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`reactNative`,refFrameEffect:`may-invalidate`},capability:{apple:U,android:W,linux:K},timeoutPolicy:P,batchable:!0},{name:`record`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`recordTrace`,refFrameEffect:`preserve`,allowInvalidRecording:!0,allowSessionlessDefaultDevice:Xi},platformExecution:{kind:`device-runtime`,uses:wi},timeoutPolicy:P,batchable:!0},{name:`trace`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`recordTrace`,refFrameEffect:`preserve`},timeoutPolicy:P,batchable:!0},{name:`find`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:ia,daemon:{route:`find`,refFrameEffect:`may-invalidate`},capability:q,timeoutPolicy:Y,batchable:!0},{name:`click`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},capability:{apple:U,android:W,linux:G},timeoutPolicy:X(`click`,Y),postActionObservation:Z(`click`),responseDataTransform:pa,batchable:!0},{name:`fill`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:U,android:W,linux:G},timeoutPolicy:X(`fill`,Y),postActionObservation:Z(`fill`),responseDataTransform:ma,batchable:!0},{name:`longpress`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`,key:`longPress`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:U,android:W,linux:G},timeoutPolicy:{...fa,envelopeMs:21e4},postActionObservation:Z(`longpress`),batchable:!0},{name:`press`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:U,android:W,linux:G},timeoutPolicy:X(`press`,Y),postActionObservation:Z(`press`),responseDataTransform:pa,batchable:!0},{name:`type`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:q,timeoutPolicy:X(`type`,Y),batchable:!0},{name:`get`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`interaction`,refFrameEffect:`preserve`},capability:q,timeoutPolicy:X(`get`,Y),batchable:!0},{name:`read`,catalog:{group:`dispatch-alias`},recordsSessionAction:!1,dispatch:{},timeoutPolicy:P,batchable:!1},{name:`is`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`interaction`,refFrameEffect:`preserve`},capability:q,timeoutPolicy:X(`is`,Y),batchable:!0},{name:`back`,catalog:{group:`public`},...J,capability:{...J.capability,vega:sa},timeoutPolicy:X(`back`,P),postActionObservation:Z(`back`)},{name:`gesture`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,targetIdentityVerification:`pre-dispatch`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},capability:q,timeoutPolicy:P,batchable:!0},{name:`home`,catalog:{group:`public`},...J,capability:{...J.capability,vega:sa}},{name:`tv-remote`,catalog:{group:`public`,key:`tvRemote`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:U,android:W,vega:sa,linux:K},timeoutPolicy:P,batchable:!0},{name:`orientation`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:U,android:W,linux:K},timeoutPolicy:P,batchable:!0},{name:`scroll`,catalog:{group:`public`},...J,timeoutPolicy:X(`scroll`,P),postActionObservation:Z(`scroll`)},{name:`swipe`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},capability:{apple:U,android:W,linux:G},timeoutPolicy:P,batchable:!0},{name:`focus`,catalog:{group:`public`},...J},{name:`screenshot`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`generic`,refFrameEffect:`preserve`},dispatch:{},capability:q,timeoutPolicy:P,batchable:!0},{name:`viewport`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:{},android:{},linux:K},timeoutPolicy:P,batchable:!1},{name:`app-switcher`,catalog:{group:`public`,key:`appSwitcher`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:U,android:W,linux:K},timeoutPolicy:P,batchable:!0},{name:`install-from-source`,catalog:{group:`public`,key:`installFromSource`},recordsSessionAction:!0,recordingEffect:`mutates-app`,capability:ua,timeoutPolicy:P,batchable:!0},{name:`debug`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1},{name:`daemon`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1},{name:`device`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1},{name:`metro`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1},{name:`session`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1},{name:`cdp`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1},{name:`auth`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1},{name:`connect`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1},{name:`connection`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1},{name:`disconnect`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1},{name:`mcp`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1},{name:`proxy`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1},{name:`react-devtools`,catalog:{group:`local-cli`,key:`reactDevtools`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1},{name:`web`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:P,batchable:!1,mcpExposed:!1}],ga=new Set([`public`,`local-cli`]),_a=new Set(ha.filter(e=>ga.has(Ca(e))).map(e=>e.name)),Q=ha.map(e=>{let t=`platformExecution`in e?e.platformExecution:{kind:`legacy`};return Kr(t),e.name===`record`&&Di(t),{...e,mcpExposed:xa(e),platformExecution:t}});function va(e){return Q.filter(t=>Ca(t)===e).map(e=>[wa(e),e.name])}function ya(){return Q.filter(e=>Sa(e)).map(e=>e.name).sort()}const $=new Map(Q.map(e=>[e.name,e]));function ba(e){return _a.has(e)}function xa(e){return e.mcpExposed??_a.has(e.name)}function Sa(e){return e.mcpExposed&&ba(e.name)}function Ca(e){return e.catalog.group}function wa(e){return e.catalog.key??e.name}const Ta=new Map(Q.map(e=>[e.name,e.timeoutPolicy])),Ea=new Map(Array.from($.values()).flatMap(e=>e.responseDataTransform?[[e.name,e.responseDataTransform]]:[]));function Da(e){if(e!==void 0)return $.get(e)?.postActionObservation}function Oa(e){return Da(e)!==void 0}function ka(e){return Da(e)===`settle-and-verify`}function Aa(e){return e===void 0?P:Ta.get(e)??P}function ja(e){if(e!==void 0)return Ea.get(e)}function Ma(e){return e===void 0?!1:$.get(e)?.recordsSessionAction??!1}function Na(e){return $.get(e)?.targetIdentityVerification}function Pa(e){let t=$.get(e.command);if(t?.recordsSessionAction)return typeof t.recordingEffect==`function`?t.recordingEffect(e):t.recordingEffect}function Fa(){return[...new Set(Array.from(Ea.values()).flatMap(e=>Object.keys(e.fields)))].sort()}function Ia(e){return Number.isInteger(e)&&e>=1&&e<=1e3}function La(t,n){if(t>n)throw new e(`INVALID_ARGS`,`batch has ${t} steps; max allowed is ${n}.`)}function Ra(t,n){if(!d(t))throw new e(`INVALID_ARGS`,`Invalid batch step ${n}.`);return t}function za(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 Ba(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)}`)}}function Va(e){let t=e.trim();if(!t||/\s/.test(t))return!1;let n=/^([A-Za-z][A-Za-z0-9+.-]*):(.+)$/.exec(t);if(!n)return!1;let r=n[1]?.toLowerCase(),i=n[2]??``;return r===`http`||r===`https`||r===`ws`||r===`wss`||r===`ftp`||r===`ftps`?i.startsWith(`//`):!0}function Ha(e){let t=e.trim().split(`:`)[0]?.toLowerCase();return t===`http`||t===`https`}function Ua(e,t){let n=e?.trim();if(n)return n;if(Ha(t))return`com.apple.mobilesafari`}function Wa(e){let t=[];for(let n of e)n.daemon&&t.push({command:n.name,...n.daemon,replayScopedAction:n.recordsSessionAction});return t}function Ga(e){let t={};for(let n of e)n.capability&&(t[n.name]=n.capability);return t}function Ka(e){return e.filter(e=>e.batchable).map(e=>e.name)}const qa=Ka(Q),Ja=new Set([`batch`,`replay`]),Ya=[`command`,`positionals`,`input`,`flags`,`runtime`],Xa=[`platform`,`target`,`device`,`udid`,`serial`,`verbose`,`out`],Za=new Set(qa);function Qa(e){return Za.has(e)}function $a(e){return typeof e==`string`?e.trim().toLowerCase():``}function eo(t,n){let r=$a(t);if(Qa(r))return r;throw new e(`INVALID_ARGS`,`Batch step ${n} command is not available through command batch: ${String(t)}`)}function to(t,n){if(Ja.has(t))throw new e(`INVALID_ARGS`,`Batch step ${n} cannot run ${t}.`)}const no=new Set(Ya);async function ro(e,t,n){let r=uo(e.flags),a=r?.batchOnError??`stop`;if(a!==`stop`)return fo(`INVALID_ARGS`,`Unsupported batch on-error mode: ${a}.`);let o=r?.batchMaxSteps??100;if(!Ia(o))return fo(`INVALID_ARGS`,`Invalid batch max-steps: ${String(r?.batchMaxSteps)}`);try{let i=io(r?.batchSteps,o),a=Date.now(),s=[];for(let[r,a]of i.entries()){let o=await lo(e,t,a,n,r+1,r===i.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:r,total:i.length,partialResults:s}}};s.push(o.result)}return{ok:!0,data:{total:i.length,executed:i.length,totalDurationMs:Date.now()-a,results:s}}}catch(e){let t=i(e);return fo(t.code,t.message,t.details)}}function io(t,n){if(!Array.isArray(t)||t.length===0)throw new e(`INVALID_ARGS`,`batch requires a non-empty batchSteps array.`);La(t.length,n);let r=[];for(let n=0;n<t.length;n+=1){let i=t[n];if(!m(i))throw new e(`INVALID_ARGS`,`Invalid batch step at index ${n}.`);let a=Object.keys(i).filter(e=>!no.has(e));if(a.length>0){let t=a.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 o=$a(i.command);if(!o)throw new e(`INVALID_ARGS`,`Batch step ${n+1} requires command.`);if(to(o,n+1),i.positionals!==void 0&&!Array.isArray(i.positionals))throw new e(`INVALID_ARGS`,`Batch step ${n+1} positionals must be an array.`);let s=i.positionals??[];if(s.some(e=>typeof e!=`string`))throw new e(`INVALID_ARGS`,`Batch step ${n+1} positionals must contain only strings.`);if(i.flags!==void 0&&!m(i.flags))throw new e(`INVALID_ARGS`,`Batch step ${n+1} flags must be an object.`);if(i.input!==void 0&&!m(i.input))throw new e(`INVALID_ARGS`,`Batch step ${n+1} input must be an object.`);r.push({command:o,positionals:s,input:i.input,flags:i.flags??{},runtime:Ba(i.runtime,n+1)})}return r}function ao(e,t){let{batchSteps:n,batchOnError:r,batchMaxSteps:i,...a}=t??{};return oo(uo(e),a)}function oo(e,t){let n=uo(e)??{},r=t;for(let e of Xa)r[e]===void 0&&n[e]!==void 0&&(r[e]=n[e]);return t}function so(e,n){return t(e)?n?e:`digest`:e}function co(e,t){let n=e?.responseLevel,r=so(n,t);return r===n?e:{...e,responseLevel:r}}async function lo(e,t,n,r,i,a){let o=Date.now(),s=ao(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:co(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 uo(e){return e}function fo(e,t,n){return{ok:!1,error:{code:e,message:t,...n?{details:n}:{}}}}export{jr as $,oe as $n,Ft as $t,Fi as A,Me as An,Hn as At,oi as B,Se as Bn,gn as Bt,ja as C,Re as Cn,M as Ct,Vi as D,ze as Dn,Wn as Dt,Wi as E,Ie as En,qn as Et,_i as F,De as Fn,on as Ft,Gr as G,m as Gn,Yt as Gt,si as H,be as Hn,tn as Ht,gi as I,Ee as In,yn as It,Lr as J,ce as Jn,Zt as Jt,Wr as K,ue as Kn,$t as Kt,ii as L,we as Ln,_n as Lt,Ci as M,_ as Mn,zn as Mt,xi as N,Te as Nn,Rn as Nt,Ui as O,je as On,Fn as Ot,vi as P,g as Pn,Bn as Pt,Or as Q,ae as Qn,Ut as Qt,ci as R,Ce as Rn,bn as Rt,Ma as S,v as Sn,Jn as St,Na as T,Fe as Tn,Ln as Tt,ti as U,_e as Un,nn as Ut,B as V,xe as Vn,k as Vt,ni as W,ge as Wn,Xt as Wt,Dr as X,re as Xn,Vt as Xt,Pr as Y,ie as Yn,en as Yt,kr as Z,se as Zn,Wt as Zt,ka as _,qe as _n,er as _t,Ga as a,at as an,Cr as at,ya as b,x as bn,$n as bt,Ha as c,ht as cn,mr as ct,Ia as d,st as dn,fr as dt,Tt as en,ne as er,Ar as et,Ba as f,vt as fn,ir as ft,Oa as g,Ge as gn,lr as gt,Q as h,Je as hn,pr as ht,eo as i,Et as in,Sr as it,Ti as j,ke as jn,Pn as jt,Mi as k,Le as kn,Un as kt,Ua as l,lt as ln,N as lt,Ra as m,Ue as mn,cr as mt,ro as n,Dt as nn,ve as nr,yr as nt,Wa as o,pt as on,Tr as ot,za as p,bt as pn,ur as pt,Ir as q,le as qn,Qt as qt,qa as r,D as rn,d as rr,xr as rt,Va as s,mt as sn,gr as st,oo as t,wt as tn,ye as tr,wr as tt,La as u,ct as un,dr as ut,Fa as v,b as vn,nr as vt,Aa as w,Pe as wn,Vn as wt,Pa as x,Be as xn,tr as xt,va as y,S as yn,Zn as yt,ai as z,h as zn,Sn as zt};
|
|
1
|
+
import{_ as e,a as t,i as n,u as r,v as i}from"./sdk-contracts.js";import{T as a,c as o,d as s,l as c,n as l,s as u,x as d}from"./sdk-device.js";function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(t,n,r,i){let a=r(t[n]);if(a===void 0)throw new e(`COMMAND_FAILED`,i,{response:t});return a}function ee(e,t,n){return n(e[t])}function te(e,t,n){let r=e[t];return r===null?null:n(r)}function ne(e,t){return p(e,t,de,`Daemon response is missing "${t}".`)}function re(e,t){return ee(e,t,de)}function ie(e,t){return te(e,t,de)}function ae(e,t){return p(e,t,fe,`Daemon response is missing numeric "${t}".`)}function oe(e,t){return p(e,t,pe,`Daemon response has invalid "${t}".`)}function se(e,t){return p(e,t,me,`Daemon response has invalid "${t}".`)}function ce(e,t){return ee(e,t,he)??`mobile`}function le(e){if(!h(e))return;let t=m(e,`x`),n=m(e,`y`),r=m(e,`width`),i=m(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 ue(e){if(!h(e))return;let t=m(e,`x`),n=m(e,`y`);if(!(t===void 0||n===void 0))return{x:t,y:n}}function m(e,t){let n=e[t];return typeof n==`number`?n:void 0}function de(e){return typeof e==`string`&&e.length>0?e:void 0}function fe(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function pe(e){return e===`apple`?`ios`:e===`ios`||e===`macos`||e===`android`||e===`harmonyos`||e===`vega`||e===`linux`||e===`web`?e:void 0}function me(e){return e===`simulator`||e===`emulator`||e===`device`?e:void 0}function he(e){return e===`tv`||e===`mobile`||e===`desktop`?e:void 0}function ge(t){if(!h(t))throw new e(`COMMAND_FAILED`,`Daemon returned an unexpected response shape.`,{value:t});return t}function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _e(e){return h(e)?e:void 0}function ve(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function ye(e){return e.split(`
|
|
2
|
+
`).map(e=>e.trim()).filter(e=>e.length>0)}function g(e,t){return{ok:!1,code:`INVALID_ARGS`,message:e,...t?{hint:t}:{}}}function _(e){return!!(e&&[e.x,e.y,e.width,e.height].every(Number.isFinite)&&e.width>0&&e.height>0)}function be(e,t){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function xe(e){return e.width*e.height}function Se(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Ce(e){let t=null,n=-1;for(let r of e){let e=r.width*r.height;e>n&&(t=r,n=e)}return t}function we(e,t){return Te(e.x,e.x+e.width,t.x,t.x+t.width)&&Te(e.y,e.y+e.height,t.y,t.y+t.height)}function Te(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function Ee(e){let t=`${e??``}`.toLowerCase();return t.includes(`scroll`)||t.includes(`recyclerview`)||t.includes(`listview`)||t.includes(`gridview`)||t.includes(`collectionview`)||t===`table`}function De(e){return Ee(e.type)?!0:`${e.role??``} ${e.subrole??``}`.toLowerCase().includes(`scroll`)}function v(e){return new Map(e.map(e=>[e.index,e]))}function Oe(e,t,n,r){let i=t,a=new Set;for(;typeof i.parentIndex==`number`&&!a.has(i.index);){if(a.add(i.index),i=n.get(i.parentIndex)??e[i.parentIndex],!i)return null;let t=r(i);if(t!==null)return t}return null}function ke(e,t,n){return Oe(e,t,v(e),e=>n(e)?e:null)}function y(e){let t=e.trim().replace(/XCUIElementType/gi,``).replace(/^AX/,``).toLowerCase(),n=Math.max(t.lastIndexOf(`.`),t.lastIndexOf(`/`));return n!==-1&&(t=t.slice(n+1)),t}function Ae(e,t){let n=y(e);return n?t===`android`?n.includes(`edittext`)||n.includes(`autocompletetextview`):n.includes(`textfield`)||n.includes(`securetextfield`)||n.includes(`searchfield`)||n.includes(`textview`)||n.includes(`textarea`)||n===`search`:!0}function je(e){let t=e.trim();return!(!t||/^(true|false)$/i.test(t)||/^\d+$/.test(t))}function Me(e){return[e.label,e.value,e.identifier].map(e=>typeof e==`string`?e.trim():``).filter(e=>e.length>0)[0]??``}function Ne(e){let t=[e.type,e.role,e.subrole].map(e=>y(e??``)).join(` `);return t.includes(`application`)||t.includes(`window`)}function Pe(e,t,n){let i=r(t),a=n??e.flatMap(e=>Ne(e)&&Fe(e.rect)?[e.rect]:[]),o=e=>Se(e,i.x,i.y);return(Ce(a.filter(o))??Ce(a))||Ce(e.flatMap(e=>Fe(e.rect)&&o(e.rect)?[e.rect]:[]))}function Fe(e){return e?Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.width)&&Number.isFinite(e.height):!1}function Ie(e,t,n=v(t),r){if(!e.rect)return!0;let i=ze(e,t,n,r);return i?we(e.rect,i):!0}function Le(e,t,n=v(t),r){if(!e.rect)return!0;if(!Ie(e,t,n,r))return!1;let i=Pe(t,e.rect,r);return Re(e.rect,i)}function Re(e,t){return!t||t.width<=0||t.height<=0?!0:Se(t,e.x+e.width/2,e.y+e.height/2)}function ze(e,t,n=v(t),r){return Be(e,n,e=>!!e.rect)?.rect||Pe(t,e.rect??{x:0,y:0,width:0,height:0},r)}function Be(e,t,n=()=>!0){let r=typeof e.parentIndex==`number`?t.get(e.parentIndex):void 0,i=new Set;for(;r&&!i.has(r.index);){if(i.add(r.index),n(r)&&De(r))return r;r=typeof r.parentIndex==`number`?t.get(r.parentIndex):void 0}return null}function Ve(e,t){if(t===`android`&&e.visibleToUser===!1)return!1;let n=y(e.type??``);return n.includes(`application`)||n.includes(`window`)||n.includes(`scrollview`)||n.includes(`tableview`)||n.includes(`collectionview`)||n===`table`||n===`list`||n===`listview`?!1:t===`android`?e.hittable===!0&&_(e.rect):e.hittable===!0||_(e.rect)}function b(e){return e.hittable===!0?!0:e.rect?e.rect.width>0&&e.rect.height>0:!1}function He(e,t){return Ae(e.type??``,t)&&e.enabled!==!1}const Ue=new Set([`id`,`role`,`text`,`label`,`value`,`appname`,`windowtitle`]),We=new Set([`visible`,`hidden`,`editable`,`selected`,`focused`,`enabled`,`hittable`]),x=new Set([...Ue,...We]),Ge=[...x],Ke=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 qe(e){return Ke.has(e.trim().toLowerCase())}const Je=new Map([[`"`,`"`],[`'`,`'`],[`\\`,`\\`],[`/`,`/`],[`b`,`\b`],[`f`,`\f`],[`n`,`
|
|
3
|
+
`],[`r`,`\r`],[`t`,` `]]);function Ye(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Selector expression cannot be empty`);let r=et(n);if(r.length===0)throw new e(`INVALID_ARGS`,`Selector expression cannot be empty`);return{raw:n,selectors:r.map(e=>Qe(e))}}function S(e){try{return Ye(e)}catch{return null}}function C(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 x.has(e)}return x.has(t.toLowerCase())}function Xe(e){let t=e.trim(),n=t.indexOf(`=`);if(n===-1)return null;let r=t.slice(0,n).trim().toLowerCase();if(!r||x.has(r))return null;let i=t.slice(n+1).trim();if(!i)return null;let a=rt(i).trim();return a?{key:r,value:a}:null}function Ze(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||!C(t))break;r+=1;let n=e.slice(0,r).join(` `).trim();n&&S(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 Qe(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Selector segment cannot be empty`);let r=tt(n);if(r.length===0)throw new e(`INVALID_ARGS`,`Invalid selector segment: ${t}`);return{raw:n,terms:r.map($e)}}function $e(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Empty selector term`);let r=n.indexOf(`=`);if(r===-1){let r=n.toLowerCase();if(!We.has(r))throw new e(`INVALID_ARGS`,`Invalid selector term "${t}", expected key=value`);return{key:r,value:!0}}let i=n.slice(0,r).trim().toLowerCase(),a=n.slice(r+1).trim();if(!x.has(i))throw new e(`INVALID_ARGS`,`Unknown selector key: ${i}`);if(!a)throw new e(`INVALID_ARGS`,`Missing selector value for key: ${i}`);if(We.has(i)){let t=ot(a);if(t===null)throw new e(`INVALID_ARGS`,`Invalid boolean value for ${i}: ${a}`);return{key:i,value:t}}return{key:i,value:rt(a)}}function et(t){let n=[],r=``,i=null;for(let a=0;a<t.length;a+=1){let o=t[a];if((o===`"`||o===`'`)&&!st(t,a)){i=nt(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 tt(t){let n=[],r=``,i=null;for(let e=0;e<t.length;e+=1){let a=t.charAt(e);if((a===`"`||a===`'`)&&!st(t,e)){i=nt(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 nt(e,t){return e?e===t?null:e:t}function rt(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?it(t.slice(1,-1)):t}function it(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=at(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 at(e){return Je.get(e)??null}function ot(e){let t=rt(e).toLowerCase();return t===`true`?!0:t===`false`?!1:null}function st(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function ct(e){return[`visible`,`hidden`,`exists`,`editable`,`selected`,`focused`,`text`].includes(e)}function lt(e){let t=e.toLowerCase();return ct(t)?{ok:!0,predicate:t}:g(`is requires predicate: visible|hidden|exists|editable|selected|focused|text`,ut)}const ut=`Use "is <predicate> <selector>" or "is <selector> <predicate>". visible|hidden|editable|selected|focused double as selector keys: a bare predicate token after the selector is read as the predicate, so write key=true (e.g. visible=true) inside the selector to use it as a filter instead.`;function dt(e){if(ct((e[0]??``).toLowerCase()))return e;for(let t=1;t<e.length;t+=1){let n=(e[t]??``).toLowerCase();if(ct(n)&&S(e.slice(0,t).join(` `)))return[n,...e.slice(0,t),...e.slice(t+1)]}return e}function ft(e){let{predicate:t,node:n,nodes:r,expectedText:i,platform:a}=e,o=Me(n),s=He(n,a),c=n.selected===!0,l=n.focused===!0,u=t===`text`?b(n):pt(n,r,a),d=!1;switch(t){case`visible`:d=u;break;case`hidden`:d=!u;break;case`editable`:d=s;break;case`selected`:d=c;break;case`focused`:d=l;break;case`text`:d=o===(i??``);break}let f=t===`text`?`expected="${i??``}" actual="${o}"`:`actual=${JSON.stringify({visible:u,editable:s,selected:c,focused:l})}`;return{pass:d,actualText:o,details:f}}function pt(e,t,n){if(n===`android`&&e.visibleToUser===!1)return!1;if(_(e.rect))return mt(e,t);if(e.rect)return!1;if(n!==`android`&&e.hittable===!0)return!0;let r=ht(e,t,n);return r?_(r.rect)?mt(r,t):n!==`android`&&r.hittable===!0:!1}function mt(e,t){return Ie(e,t)}function ht(e,t,n){return Oe(t,e,v(t),e=>Ve(e,n)?e:null)}function gt(e){let t=dt(e),n=t[0]??``;return{predicate:n,split:Ze(t.slice(1),{preferTrailingValue:n===`text`})}}const _t=`is requires a selector expression`,vt=`is text requires expected text value`;function yt(e){let{predicate:t,split:n}=gt([...e]),r=lt(t);if(!r.ok)return r;if(!n)return g(_t);let i=n.rest.join(` `).trim();return r.predicate===`text`&&!i?g(vt):r.predicate!==`text`&&n.rest.length>0?g(`is ${r.predicate} does not accept trailing values`):{ok:!0,predicate:r.predicate,selectorExpression:n.selectorExpression,expectedText:i}}function bt(e){return e===`text`||e===`attrs`?{ok:!0,format:e}:g(`get only supports text or attrs`)}function xt(e){let t=e[0];if(t?.startsWith(`@`)){let n=e.slice(1).join(` `).trim();return{ok:!0,ref:t,...n?{label:n}:{}}}let n=e.join(` `).trim();return n?{ok:!0,selector:n}:g(`get requires @ref or selector expression`)}function St(e){return e?{ok:!0,text:e}:g(`wait requires text`)}function Ct(t,n,r={}){let i=t[n];if(i===void 0)return;if(!Number.isInteger(i))throw new e(`INVALID_ARGS`,`Expected ${n} to be an integer.`);let a=i;if(r.min!==void 0&&a<r.min)throw new e(`INVALID_ARGS`,`Expected ${n} to be at least ${r.min}.`);if(r.max!==void 0&&a>r.max)throw new e(`INVALID_ARGS`,`Expected ${n} to be at most ${r.max}.`);return a}function wt(t,n,r={}){let i=t[n];if(i!==void 0){if(typeof i!=`number`||!Number.isFinite(i))throw new e(`INVALID_ARGS`,`Expected ${n} to be a finite number.`);if(r.min!==void 0&&i<r.min)throw new e(`INVALID_ARGS`,`Expected ${n} to be at least ${r.min}.`);if(r.max!==void 0&&i>r.max)throw new e(`INVALID_ARGS`,`Expected ${n} to be at most ${r.max}.`);return i}}const Tt=/^#\s*agent-device:target-v(\d+)(?:\s+(\S.*))?$/,Et=/^#\s*agent-device:targets-v(\d+)(?:\s+(\S.*))?$/,Dt=4096;function Ot(e){return e.normalize(`NFC`)}function kt(e){if(e===void 0)return;let t=Ot(e);return t.length>0?t:void 0}function At(e){return Ot(e)}function jt(e){if(e===void 0)return;let t=Ot(e).trim().replace(/\s+/g,` `);return t.length>0?t:void 0}function w(e){return Buffer.byteLength(e,`utf8`)}function Mt(e,t){if(w(e)<=t)return e;let n=e.length;for(;n>0&&w(e.slice(0,n))>t;)--n;if(n>0){let t=e.charCodeAt(n-1);t>=55296&&t<=56319&&--n}return e.slice(0,n)}function Nt(e){let t={};return e.id!==void 0&&(t.id=e.id),t.role=e.role,e.label!==void 0&&(t.label=e.label),t.ancestry=e.ancestry.map(Pt),t.sibling=e.sibling,t.viewportOrder=e.viewportOrder,e.scrollRegion&&(t.scrollRegion=Ft(e.scrollRegion)),e.rect&&(t.rect=It(e.rect)),t.verification=e.verification,t}function Pt(e){let t={role:e.role};return e.label!==void 0&&(t.label=e.label),t}function Ft(e){let t={role:e.role};return e.id!==void 0&&(t.id=e.id),e.label!==void 0&&(t.label=e.label),t}function It(e){return{x:e.x,y:e.y,width:e.width,height:e.height}}function Lt(e){return JSON.stringify(Nt(e))}function Rt(e){return`# agent-device:target-v1 ${Lt(e)}`}function zt(e){return JSON.stringify({source:Nt(e.source),destination:Nt(e.destination)})}function Bt(e){return`# agent-device:targets-v1 ${zt(e)}`}function Vt(e){let t=e.trim(),n=Et.exec(t);return n?Number(n[1])===1?{kind:`v1`,evidence:Ht((n[2]??``).trim())}:{kind:`future-version`}:{kind:`none`}}function Ht(t){if(w(t)>8320)throw new e(`INVALID_ARGS`,`targets-v1 annotation exceeds the 8320-byte payload cap.`);let n;try{n=JSON.parse(t)}catch{throw new e(`INVALID_ARGS`,`targets-v1 annotation is not valid JSON.`)}if(typeof n!=`object`||!n||Array.isArray(n))throw new e(`INVALID_ARGS`,`targets-v1 annotation must be a JSON object.`);let r=n;if(r.source===void 0||r.destination===void 0)throw new e(`INVALID_ARGS`,`targets-v1 annotation requires source and destination evidence.`);return{source:Wt(JSON.stringify(r.source)),destination:Wt(JSON.stringify(r.destination))}}function Ut(e){let t=e.trim();if(!t.startsWith(`#`))return{kind:`none`};let n=Tt.exec(t);return n?Number(n[1])===1?{kind:`v1`,evidence:Wt((n[2]??``).trim())}:{kind:`future-version`}:{kind:`none`}}function Wt(t){if(w(t)>4096)throw new e(`INVALID_ARGS`,`target-v1 annotation exceeds the ${Dt}-byte payload cap.`);let n;try{n=JSON.parse(t)}catch{throw new e(`INVALID_ARGS`,`target-v1 annotation is not valid JSON.`)}if(typeof n!=`object`||!n||Array.isArray(n))throw new e(`INVALID_ARGS`,`target-v1 annotation must be a JSON object.`);let r=n,i=Gt(r.role,`role`),a=Kt(r.id,`id`),o=qt(r.label,`label`),s=Yt(r.ancestry),c=Zt(r.sibling,`sibling`,0),l=Zt(r.viewportOrder,`viewportOrder`,0),u=Qt(r.scrollRegion),d=$t(r.rect),f=tn(r.verification);return{...a===void 0?{}:{id:a},role:i,...o===void 0?{}:{label:o},ancestry:s,sibling:c,viewportOrder:l,...u?{scrollRegion:u}:{},...d?{rect:d}:{},verification:f}}function Gt(t,n){if(t===void 0)throw new e(`INVALID_ARGS`,`target-v1 "${n}" is required.`);if(typeof t!=`string`)throw new e(`INVALID_ARGS`,`target-v1 "${n}" must be a string.`);return Jt(At(t),n)}function Kt(t,n){if(t===void 0)return;if(typeof t!=`string`)throw new e(`INVALID_ARGS`,`target-v1 "${n}" must be a string.`);let r=kt(t);return r===void 0?void 0:Jt(r,n)}function qt(t,n){if(t===void 0)return;if(typeof t!=`string`)throw new e(`INVALID_ARGS`,`target-v1 "${n}" must be a string.`);let r=jt(t);return r===void 0?void 0:Jt(r,n)}function Jt(t,n){if(w(t)>256)throw new e(`INVALID_ARGS`,`target-v1 "${n}" exceeds the 256-byte field cap.`);return t}function Yt(t){if(t===void 0)return[];if(!Array.isArray(t))throw new e(`INVALID_ARGS`,`target-v1 "ancestry" must be an array.`);if(t.length>8)throw new e(`INVALID_ARGS`,`target-v1 "ancestry" exceeds the 8-entry cap.`);return t.map((e,t)=>Xt(e,t))}function Xt(t,n){if(typeof t!=`object`||!t||Array.isArray(t))throw new e(`INVALID_ARGS`,`target-v1 "ancestry[${n}]" must be an object.`);let r=t,i=Gt(r.role,`ancestry[${n}].role`),a=qt(r.label,`ancestry[${n}].label`);return{role:i,...a===void 0?{}:{label:a}}}function Zt(t,n,r){if(t===void 0)return r;if(typeof t!=`number`||!Number.isSafeInteger(t)||t<0)throw new e(`INVALID_ARGS`,`target-v1 "${n}" must be a non-negative integer.`);return t}function Qt(t){if(t===void 0)return;if(typeof t!=`object`||!t||Array.isArray(t))throw new e(`INVALID_ARGS`,`target-v1 "scrollRegion" must be an object.`);let n=t,r=Gt(n.role,`scrollRegion.role`),i=Kt(n.id,`id`),a=qt(n.label,`scrollRegion.label`);return{role:r,...i===void 0?{}:{id:i},...a===void 0?{}:{label:a}}}function $t(t){if(t===void 0)return;if(typeof t!=`object`||!t||Array.isArray(t))throw new e(`INVALID_ARGS`,`target-v1 "rect" must be an object.`);let n=t;return{x:en(n.x,`rect.x`),y:en(n.y,`rect.y`),width:en(n.width,`rect.width`),height:en(n.height,`rect.height`)}}function en(t,n){if(typeof t!=`number`||!Number.isFinite(t))throw new e(`INVALID_ARGS`,`target-v1 "${n}" must be a finite number.`);return t}function tn(t){if(t===`verified`||t===`unverifiable`)return t;throw new e(`INVALID_ARGS`,`target-v1 "verification" must be "verified" or "unverifiable".`)}function nn(e){let t=At(y(e.type??``)),n=kt(e.identifier),r=jt(e.label);return{...n===void 0?{}:{id:Mt(n,256)},role:Mt(t,256),...r===void 0?{}:{label:Mt(r,256)}}}function rn(e,t){return e.id===t.id&&e.role===t.role&&e.label===t.label}function an(e,t){let n=0;for(let r of e)nn(r).id===t&&(n+=1);return n}function on(e,t){if(e.id===void 0||an(t,e.id)<=1)return e;let{role:n,label:r}=e;return{role:n,...r===void 0?{}:{label:r}}}function sn(e,t){let n=0;for(let r of e)if(r.parentIndex===t.parentIndex){if(r.index===t.index)return n;n+=1}return 0}function cn(e,t){return{documentOrder:e.index,sibling:sn(t,e)}}function ln(e,t){return e.documentOrder===t.documentOrder&&e.sibling===t.sibling}function un(e){return{...e.id===void 0?{}:{id:e.id},role:e.role,...e.label===void 0?{}:{label:e.label}}}function dn(e,t){return t.id===void 0?e.role===t.role&&e.label===t.label:e.id===t.id}function fn(e,t){if(e.length<t.length)return!1;for(let[n,r]of t.entries()){let t=e[n];if(!t||t.role!==r.role||r.label!==void 0&&t.label!==r.label)return!1}return!0}function pn(e,t){let n=[];return e.id!==t.id&&n.push(`id: recorded=${e.id??`(none)`} observed=${t.id??`(none)`}`),e.role!==t.role&&n.push(`role: recorded=${e.role} observed=${t.role}`),e.label!==t.label&&n.push(`label: recorded=${e.label??`(none)`} observed=${t.label??`(none)`}`),n}function mn(e){return e?`${e.role}${e.label?`/${e.label}`:``}`:`(missing)`}function hn(e,t){return!t||t.role!==e.role?!0:e.label!==void 0&&t.label!==e.label}function gn(e,t){for(let[n,r]of e.entries()){let e=t[n];if(hn(r,e))return[`ancestry[${n}]: recorded=${mn(r)} observed=${mn(e)}`]}return[]}function _n(e,t,n={}){let r=[],i=y(e.type??``),a=vn(e,n.nodes),o=E(e.label),s=E(e.value),c=E(Me(e)),l=n.action===`fill`;a&&r.push(`id=${T(a)}`),i&&o&&r.push(l?`role=${T(i)} label=${T(o)} editable=true`:`role=${T(i)} label=${T(o)}`),o&&r.push(l?`label=${T(o)} editable=true`:`label=${T(o)}`),s&&r.push(l?`value=${T(s)} editable=true`:`value=${T(s)}`),c&&c!==o&&c!==s&&r.push(l?`text=${T(c)} editable=true`:`text=${T(c)}`),i&&l&&!r.some(e=>e.includes(`editable=true`))&&r.push(`role=${T(i)} editable=true`);let u=yn(r);return u.length===0&&i&&u.push(l?`role=${T(i)} editable=true`:`role=${T(i)}`),u.length===0&&b(e)&&u.push(`visible=true`),u}function vn(e,t){let n=E(e.identifier);if(!n||!t)return n;let r=nn(e).id;return r===void 0?n:an(t,r)>1?null:n}function yn(e){return Array.from(new Set(e))}function T(e){return JSON.stringify(e)}function E(e){return e&&e.trim()||null}const bn=[`any`,`text`,`label`,`value`,`role`,`id`],xn=[`text`,`label`,`value`,`role`,`id`];function Sn(e){let t=e?.toLowerCase();return t===`press`||t===`tap`?`click`:t}function Cn(e){return e===`exists`||e===`wait`||e===`get_text`||e===`get_attrs`||e===`list`}function wn(e,t,n,r={}){let i=O(n);if(!i)return{matches:[],score:0};let a=0,o=[];for(let n of e){if(r.requireRect&&!n.rect)continue;let e=Tn(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 Tn(e,t,n){switch(t){case`role`:return En(e.type,n);case`label`:return D(e.label,n);case`value`:return D(e.value,n);case`id`:return D(e.identifier,n);default:return Math.max(D(e.label,n),D(e.value,n),D(e.identifier,n))}}function D(e,t){let n=O(e??``);return n?n===t?2:+!!n.includes(t):0}function En(e,t){let n=Dn(e??``);return n?n===t?2:+!!n.includes(t):0}function O(e){return e.trim().toLowerCase().replace(/\s+/g,` `)}function Dn(e){let t=e.trim();return t?(t=(t.split(`.`).pop()??t).replace(/XCUIElementType/gi,``).toLowerCase(),t):``}const On=`find requires a value`,kn=`find actions: click (default; press/tap are aliases), list, focus, fill, type, exists, wait, get text, get attrs — there is no longpress/swipe find action. Run find "<text>" list to inspect every match with its @ref without acting, then dispatch the gesture on the chosen ref, e.g. longpress @eNN.`;function An(e,t){if(e.length===0)return{ok:!1,code:`INVALID_ARGS`,message:`find requires a locator or text`};let n=Nn([...e]);return n.query?t?.findFirst&&t?.findLast?{ok:!1,code:`INVALID_ARGS`,message:`find accepts only one of --first or --last`}:{ok:!0,parsed:n}:{ok:!1,code:`INVALID_ARGS`,message:On}}const jn=[`exists`,`list`,`click`,`focus`];function Mn(e){return jn.includes(e)}function Nn(t){let n=`any`,r=0;xn.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=Sn(a[0]);if(Mn(o))return{locator:n,query:i,action:o};if(o===`get`)return{locator:n,query:i,action:Pn(a[1])};if(o===`wait`){let e=In(a[1]);return{locator:n,query:i,action:`wait`,timeoutMs:e??void 0}}if(o===`fill`||o===`type`)return{locator:n,query:i,action:o,value:a.slice(1).join(` `)};throw new e(`INVALID_ARGS`,`Unsupported find action: ${a[0]}`,{hint:kn})}function Pn(t){let n=t?.toLowerCase();if(n===`text`)return`get_text`;if(n===`attrs`)return`get_attrs`;throw new e(`INVALID_ARGS`,`find get only supports text or attrs`)}function Fn(e,t){return e!==`any`||!t.includes(`=`)&&!t.includes(`||`)?null:S(t)?t:null}function In(e){if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}function k(e,t,n){return t.terms.every(t=>Ln(e,t,n))}function Ln(e,t,n){switch(t.key){case`id`:return A(e.identifier,String(t.value));case`role`:return A(y(e.type??``),String(t.value));case`label`:return A(e.label,String(t.value));case`value`:return A(e.value,String(t.value));case`text`:return A(Me(e),String(t.value));case`appname`:return A(e.appName,String(t.value));case`windowtitle`:return A(e.windowTitle,String(t.value));case`visible`:return b(e)===!!t.value;case`hidden`:return!b(e)==!!t.value;case`editable`:return He(e,n)===!!t.value;case`selected`:return e.selected===!0==!!t.value;case`focused`:return e.focused===!0==!!t.value;case`enabled`:return e.enabled!==!1==!!t.value;case`hittable`:return e.hittable===!0==!!t.value;default:return!1}}function A(e,t){return O(e??``)===O(t)}function Rn(e,t,n){let r=n.requireRect??!1,i=n.requireUnique??!0,a=[];for(let[o,s]of t.selectors.entries()){let t=Wn(e,s,n.platform,r);if(a.push({selector:s.raw,matches:t.count}),!(t.count===0||!t.firstNode)){if(i&&t.count!==1){if(!n.disambiguateAmbiguous||!t.disambiguated||!t.tiebreak)continue;return{node:t.disambiguated,selector:s,selectorIndex:o,matches:t.count,diagnostics:a,disambiguation:{matchCount:t.count,tiebreak:t.tiebreak,alternatives:t.candidates.filter(e=>e!==t.disambiguated)}}}return{node:t.firstNode,selector:s,selectorIndex:o,matches:t.count,diagnostics:a}}}return null}function zn(e,t,n){let r=n.requireRect??!1;for(let[i,a]of t.selectors.entries()){let t=e.filter(e=>r&&!e.rect?!1:k(e,a,n.platform));if(t.length>0)return{selector:a,selectorIndex:i,matchedNodes:t}}return null}function Bn(e,t,n){let r=n.requireRect??!1,i=[];for(let[a,o]of t.selectors.entries()){let t=Jn(e,o,n.platform,r);if(i.push({selector:o.raw,matches:t}),t>0)return{selectorIndex:a,selector:o,matches:t,diagnostics:i}}return null}const Vn=`Snapshot refs expire when the UI changes. Run snapshot -i and retry with a fresh @ref.`;function Hn(e){return e.some(e=>e.matches>1)?`Add more terms to disambiguate (e.g. role=button text="Sign in"), use an @ref from snapshot -i, or use find <text> --first/--last.`:`Selector text/label values match exactly (quote multi-word values: text="Sign in"). Run snapshot -i to see current elements and refs, or use find <text> for contains matching.`}function Un(e,t,n){if(t.length===0)return`Selector did not match: ${e}`;let r=t.map(e=>`${e.selector} -> ${e.matches}`).join(`, `);return n.unique??!0?`Selector did not resolve uniquely (${r})`:`Selector did not match (${r})`}function Wn(e,t,n,r){let i=0,a=null,o=[],s={best:null,bestVisible:!1,tie:!1},c,l=t=>(c??=v(e),Le(t,e,c));for(let c of e)r&&!c.rect||k(c,t,n)&&(i+=1,a??=c,o.push(c),Gn(s,c,l));return{count:i,firstNode:a,disambiguated:s.tie?null:s.best,tiebreak:s.tie?null:Kn(o,s.best,l),candidates:o}}function Gn(e,t,n){if(!e.best){e.best=t;return}e.bestVisible||=n(e.best);let r=n(t);if(r!==e.bestVisible){r&&(e.best=t,e.bestVisible=!0,e.tie=!1);return}let i=Yn(t,e.best);i.result>0?(e.best=t,e.tie=!1):i.result===0&&(e.tie=!0)}function Kn(e,t,n){if(!t)return null;let r=null;for(let i of e)i!==t&&(!r||qn(i,r,n).result>0)&&(r=i);return r?qn(t,r,n).criterion:null}function qn(e,t,n){let r=n(e);return r===n(t)?Yn(e,t):{result:r?1:-1,criterion:`visible`}}function Jn(e,t,n,r){let i=0;for(let a of e)r&&!a.rect||k(a,t,n)&&(i+=1);return i}function Yn(e,t){let n=e.depth??0,r=t.depth??0;if(n!==r)return{result:n>r?1:-1,criterion:`deepest`};let i=Xn(e),a=Xn(t);return i===a?{result:0,criterion:null}:{result:i<a?1:-1,criterion:`smallest-area`}}function Xn(e){return e.rect?e.rect.width*e.rect.height:1/0}const Zn={act:{ambiguity:`reject-candidates`,requireRect:!0},actCoveredDiagnosis:{ambiguity:`first-match`,requireRect:!0},readText:{ambiguity:`disambiguate`,requireRect:!1},readUnique:{ambiguity:`fail-closed`,requireRect:!1},readAny:{ambiguity:`first-match`,requireRect:!1},wait:{ambiguity:`first-match`,requireRect:!1},findAct:{ambiguity:`reject-candidates`,requireRect:!0},readList:{ambiguity:`reject-candidates`,requireRect:!1}};function Qn(e){return e.ambiguity===`first-match`?{requireRect:e.requireRect,requireUnique:!1}:{requireRect:e.requireRect,requireUnique:!0,disambiguateAmbiguous:e.ambiguity===`disambiguate`}}function $n(e,t){let n=e===`is`?gt([...t]).split:Ze([...t]);return n?S(n.selectorExpression)?{kind:`expression`,expression:n.selectorExpression,rest:n.rest}:{kind:`invalid`}:{kind:`not-applicable`}}function er(e){return{platform:e.platform,...Qn({ambiguity:e.allowDisambiguation?`disambiguate`:`fail-closed`,requireRect:e.requireRect})}}function tr(e,t,n){let r=S(e);if(!r)return{kind:`unresolved`,reason:`parse-invalid`,matchedNodes:[]};let i=Rn(t,r,er(n));if(i){let e=t.filter(e=>n.requireRect&&!e.rect?!1:k(e,i.selector,n.platform));return{kind:`resolved`,winner:i.node,matchedNodes:e,matchCount:e.length,...i.disambiguation?{disambiguation:{tiebreak:i.disambiguation.tiebreak,matchCount:i.disambiguation.matchCount,alternatives:i.disambiguation.alternatives}}:{}}}let a=zn(t,r,{platform:n.platform,requireRect:n.requireRect})?.matchedNodes??[];return{kind:`unresolved`,reason:a.length>0?`ambiguous`:`no-match`,matchedNodes:a}}function nr(e,t,n={}){return _n(e,t,n)}function rr(e,t,n){let r=S(e);if(!r)return;let i=Rn(t,r,er(n));if(i)return{node:i.node,basis:ar(i.selector)}}function ir(e){if(!e)return;let t=S(e);if(!t)return;let n=t.selectors.flatMap(e=>e.terms.flatMap(e=>(e.key===`label`||e.key===`text`||e.key===`id`)&&typeof e.value==`string`?[e.value]:[]));if(n.length===0)return;let r=n[0];return r&&n.every(e=>e===r)?r:void 0}function ar(e){let t=new Set(e.terms.map(e=>e.key));if(t.has(`id`))return`id`;let n=t.has(`role`),r=t.has(`label`)||t.has(`text`);return n&&r?`role-label`:r||t.has(`value`)?`label`:`other`}function or(e,t){let n=S(e);if(!n)return e.includes(`=`)||e.includes(`||`)?null:e;let r=new Set(t.textKeys);return n.selectors.length>1?sr(n.selectors,r):cr(n.selectors[0],r,new Set(t.booleanKeys))}function sr(e,t){let n=e.map(e=>{let n=e.terms.length===1?e.terms[0]:void 0;return n&&t.has(n.key)&&typeof n.value==`string`?n.value:void 0}),r=n[0];return r!==void 0&&n.every(e=>e===r)?r:null}function cr(e,t,n){if(!e)return null;let r={},i=0;for(let a of e.terms){if(lr(a,t,`string`))i+=1;else if(!lr(a,n,`boolean`))return null;r[a.key]=a.value}return i<=1&&Object.keys(r).length>0?r:null}function lr(e,t,n){return t.has(e.key)&&typeof e.value===n}function ur(e){let t=S(e);if(!t||t.selectors.length!==1)return null;let n=t.selectors[0];if(!n||n.terms.length!==1)return null;let r=n.terms[0];return!r||typeof r.value!=`string`||r.key!==`id`&&r.key!==`label`&&r.key!==`text`&&r.key!==`value`?null:{key:r.key,value:r.value,raw:n.raw}}function dr(e,t){if(!t)return!1;let n=S(e);return n?n.selectors.some(e=>e.terms.some(e=>(e.key===`text`||e.key===`label`||e.key===`value`)&&typeof e.value==`string`&&e.value.includes(t))):!1}function fr(e){return Ye(e).selectors.map(e=>e.raw)}function pr(e){return S(e)!==null}function j(e){if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}const mr=new Set([`exists`,`present`,`appears`,`gone`,`disappears`]);function hr(e){let t=e[0];if(t===void 0)return null;let n=j(t);if(n!==null)return{kind:`sleep`,durationMs:n};let r=j(e[e.length-1]);return t===`text`?gr(e,r):t===`stable`?_r(e):t.startsWith(`@`)?{kind:`ref`,rawRef:t,timeoutMs:r}:vr(e,r)}function gr(e,t){return{kind:`text`,text:(t===null?e.slice(1).join(` `):e.slice(1,-1).join(` `)).trim(),timeoutMs:t}}function _r(e){let t=e.slice(1),n=t.length>1?j(t[1]):null;return{kind:`stable`,quietMs:t.length>0?j(t[0]):null,timeoutMs:n}}function vr(e,t){let n=t===null?e.slice():e.slice(0,-1),r=Ze(n);return r&&r.rest.length===0&&pr(r.selectorExpression)?{kind:`selector`,selectorExpression:r.selectorExpression,timeoutMs:t}:yr(n,r)||{kind:`text`,text:(t===null?e.join(` `):e.slice(0,-1).join(` `)).trim(),timeoutMs:t}}function yr(e,t){for(let t of e){let n=Xe(t);if(n)return{kind:`invalid`,reason:`unknown-selector-key`,message:br(n,e)}}return t&&t.rest.length>0?{kind:`invalid`,reason:`selector-shaped-text`,message:xr(t,e)}:e.some(e=>C(e))?{kind:`invalid`,reason:`selector-shaped-text`,message:Sr(e)}:null}function br(e,t){let n=t.join(` `),r=qe(e.key)?`role=${e.key} label="${e.value}"`:`label="${e.value}"`;return`Unknown selector key "${e.key}" in "${n}". Supported: ${Ge.join(`, `)}. Use wait '${r}' [timeoutMs] to wait for the selector, or wait text '${n}' [timeoutMs] to wait for the literal text "${n}".`}function xr(e,t){let n=t.join(` `);return`Selector ${e.selectorExpression} is followed by unexpected extra arguments: "${e.rest.join(` `)}". Selector values with spaces need quotes, e.g. label="Sign in". Use wait '<selector>' [timeoutMs], or wait text '${n}' [timeoutMs] to wait for the literal text "${n}".`}function Sr(e){let t=e.join(` `),n=e.filter(e=>!C(e)),r=e.filter(e=>C(e));if(n.length>0){let e=n[0],i=mr.has(e.toLowerCase())?` "${e}" describes a condition, not a selector key. Use the selector form: wait 'visible ${r.join(` `)}' [timeoutMs] to wait for it to appear, or wait 'hidden ${r.join(` `)}' [timeoutMs] to wait for it to disappear.`:` "${e}" is not a recognized selector key (${Ge.join(`, `)}).`;return`"${t}" mixes plain word "${e}" with selector-shaped "${r.join(` `)}", so it is neither a valid selector nor safe as literal text.${i} Use wait '<selector>' [timeoutMs] for a selector, or wait text '${t}' [timeoutMs] to wait for the literal text "${t}".`}return`"${t}" looks like a selector key but is not a valid selector expression. Use wait '<selector>' [timeoutMs], e.g. wait '${e[0]}="value"' [timeoutMs], or wait text '${t}' [timeoutMs] to wait for the literal text "${t}".`}function Cr(e){let t=hr(e);return t?t.kind===`sleep`?t.durationMs:t.kind===`invalid`?null:t.timeoutMs:null}const wr=24e4,Tr=3e4,Er=3e5,M={budget:{source:`none`},envelopeMs:9e4,onTimeout:`reset-daemon`},Dr={click:`settle-and-verify`,press:`settle-and-verify`,fill:`settle-and-verify`,longpress:`settle`,hover:`settle`,scroll:`settle`,back:`settle`};function Or(e){if(e!==void 0)return Dr[e]}const N=new Set([`com.google.android.inputmethod.latin`,`com.samsung.android.honeyboard`,`com.touchtype.swiftkey`,`com.microsoft.swiftkey`]);function kr(e){let t=Rr(e.packageName),n=(e.resourceId??``).toLowerCase(),r=Rr(e.activeInputMethodPackage);if(t&&r&&t===r)return{inputMethodOwned:!0,source:`active-input-method`};if(r&&n.startsWith(`${r}:id/`))return{inputMethodOwned:!0,source:`active-input-method-resource`};if(t&&N.has(t))return{inputMethodOwned:!0,source:`known-ime-package`};for(let e of N)if(n.startsWith(`${e}:id/`))return{inputMethodOwned:!0,source:`known-ime-resource`};return{inputMethodOwned:!1,source:`app`}}function Ar(e,t,n){return kr({packageName:e,resourceId:t,activeInputMethodPackage:n}).inputMethodOwned}function jr(e){return kr(e).inputMethodOwned}function Mr(e){return jr({packageName:e.bundleId,resourceId:e.identifier})}function Nr(e){let t=Rr(e);return!!(t&&N.has(t))}function Pr(e){let t=(e??``).toLowerCase();for(let e of N)if(t.startsWith(`${e}:id/`))return!0;return!1}function Fr(e,t,n){return!e&&!t?`unknown`:Ar(e,t,n)?`ime`:`app`}function Ir(e){for(let t of[/\bmCurMethodId=([^\s]+)/i,/\bmCurId=([^\s]+)/i,/\bmCurrentInputMethodId=([^\s]+)/i,/\bcurMethodId=([^\s]+)/i]){let n=Lr(e.match(t)?.[1]);if(n)return n}}function Lr(e){let t=(e??``).trim();if(t)return Rr((t.split(`/`)[0]??``).match(/[a-zA-Z0-9_.]+/)?.[0])}function Rr(e){return(e??``).trim().toLowerCase()||void 0}const zr=new Set([`empty-helper-output`,`system-window-only`,`content-poor-app-window`]);function Br(e){return typeof e==`string`&&zr.has(e)}function Vr(e){if(!e||typeof e!=`object`)return!1;let t=e.details?.androidSnapshotHelperFailureReason;return Br(t)}const Hr=`com.android.systemui`;function Ur(e){let t=e??``;if(!t.startsWith(`com.android.systemui:id/`))return!1;let n=t.slice(`${Hr}:id/`.length);return/(^|_)(status_bar|navigation_bar)(_|$)/.test(n)}function Wr(e){return`systemChrome`in e&&e.systemChrome===!0}function Gr(e){if(!Wr(e))return e;let{systemChrome:t,...n}=e;return n}function Kr(e){return e.some(Wr)?e.map(Gr):e}const qr={ios:`iOS`,ipados:`iPadOS`,tvos:`tvOS`,watchos:`watchOS`,visionos:`visionOS`,macos:`macOS`},Jr={visionos:`visionOS uses spatial input and does not support two-finger touch synthesis.`,tvos:`tvOS has no touch input — this gesture is supported on Android and the iOS simulator only.`,macos:`macOS automation has no multi-touch input — this gesture is supported on Android and the iOS simulator only.`};function Yr(t,n){if(!u(t.platform))throw Xr(n,t.platform);let r=d(t);if(!((r===`ios`||r===`ipados`)&&t.kind===`simulator`))throw r===`ios`||r===`ipados`?new e(`UNSUPPORTED_OPERATION`,`gesture ${n} is not supported on physical iOS devices`,{hint:`Two-finger gesture synthesis is iOS-simulator only — not available on physical iOS devices.`}):Xr(n,qr[r],Jr[r])}function Xr(t,n,r){return new e(`UNSUPPORTED_OPERATION`,`gesture ${t} is not supported on ${n}`,r===void 0?void 0:{hint:r})}function Zr(e){let t=e.state??`stopped`;return{audio:`probe`,state:t,active:t===`running`,heard:!1,source:e.source,backend:e.backend,durationMs:e.durationMs,elapsedMs:e.elapsedMs??0,bucketMs:e.bucketMs,sampleCount:0,mediaElementCount:e.mediaElementCount,sourceCount:e.sourceCount??0,rmsDbfs:[],peakDbfs:[],reason:e.reason,notes:e.notes}}function Qr(e,t){let n=ni(e),r=$r(n),i=ei(n.rmsDbfs),a=ei(n.peakDbfs),o=[...ti(n.notes)??[],...t.notes??[]];return{audio:`probe`,state:r,active:r===`running`&&ri(n.active,t.activeFallback??!0),heard:n.heard===!0,source:t.source,backend:ii(n.backend)??t.backend,durationMs:P(n.durationMs,t.durationMs),elapsedMs:P(n.elapsedMs,t.elapsedMs),bucketMs:P(n.bucketMs,t.bucketMs),sampleCount:P(n.sampleCount,i.length),mediaElementCount:t.mediaElementCount===void 0?ai(n.mediaElementCount):P(n.mediaElementCount,t.mediaElementCount),sourceCount:P(n.sourceCount,t.sourceCount??0),rmsDbfs:i,peakDbfs:a,startedAt:ii(n.startedAt),stoppedAt:ii(n.stoppedAt),reason:ii(n.reason),notes:o.length>0?o:void 0}}function $r(e){return e.state===`running`?`running`:`stopped`}function P(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function ei(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)typeof n==`number`&&Number.isFinite(n)&&t.push(n);return t}function ti(e){if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}function ni(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function ri(e,t){return typeof e==`boolean`?e:t}function ii(e){return typeof e==`string`?e:void 0}function ai(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function oi(e){return process.platform===`darwin`&&(c(e)||o(e)&&e.kind===`simulator`||e.platform===`android`&&e.kind===`emulator`)}function si(e){return e.platform===`web`||oi(e)}function ci(e){if(!s(e))throw TypeError(`Unknown local runtime family: ${String(e)}`);return Object.freeze({kind:`local-family`,family:e})}function li(e,t){let n=e.trim(),r=t.trim();if(n.length===0||r.length===0)throw TypeError(`Provider runtime owner requires non-empty provider and instance identities`);return Object.freeze({kind:`provider-runtime`,provider:n,instance:r})}function ui(e){return e.kind===`local-family`?`local:${e.family}`:`provider:${JSON.stringify([e.provider,e.instance])}`}function di(e,t){return ui(e)===ui(t)}function fi(e,t){let n={},r={};for(let i of t.required){let t=pi(e.facts.operations,i);if(n[i]=t,!t.available)throw vi(i,t);r[i]=gi(e.operations,i)}for(let i of t.preferred){let t=pi(e.facts.operations,i);n[i]=t,t.available&&(r[i]=gi(e.operations,i))}return Object.freeze({device:e.device,owner:e.owner,facts:Object.freeze(n),operations:Object.freeze(r)})}function pi(e,t){let n=e[t];if(!mi(n))throw yi(`Runtime owner omitted the ${t} fact`);let r=hi(n);if(r)return r;throw yi(`Runtime owner returned an invalid ${t} fact`)}function mi(e){return typeof e==`object`&&!!e&&`available`in e}function hi(e){if(e.available===!0)return Object.freeze({available:!0});if(e.available===!1&&_i(e.reason)&&!(e.hint!==void 0&&typeof e.hint!=`string`))return Object.freeze({available:!1,reason:e.reason,...e.hint===void 0?{}:{hint:e.hint}})}function gi(e,t){let n=e[t];if(typeof n!=`function`)throw yi(`Runtime owner advertised ${t} without an implementation`);return n}function _i(e){return e===`unsupported-platform-leaf`||e===`unsupported-device-kind`||e===`unsupported-device-backend`||e===`unsupported-provider-mode`||e===`owner-capability-missing`}function vi(t,n){return new e(`UNSUPPORTED_OPERATION`,`Runtime operation ${t} is unavailable`,{reason:n.reason,hint:n.hint})}function yi(t){return new e(`COMMAND_FAILED`,t,{reason:`runtime-contract-invalid`,hint:`This is an agent-device runtime contract bug; report the selected device and command.`})}function bi(){return e=>{let t=xi(e.required,`required`),n=xi(e.preferred??[],`preferred`),r=n.find(e=>t.includes(e));if(r!==void 0)throw TypeError(`Runtime operation cannot be both required and preferred: ${r}`);return Object.freeze({required:t,preferred:n})}}function xi(e,t){let n=[...e];if(new Set(n).size!==n.length)throw TypeError(`Runtime use contains duplicate ${t} operations`);return Object.freeze(n)}const F=bi(),Si=F({required:[`bootTarget`]}),Ci=F({required:[`bootTargetHeadless`]}),wi=F({required:[`ensureReady`,`listApps`]}),Ti=F({required:[`captureSnapshot`]}),Ei=F({required:[`captureSnapshot`,`captureSnapshotWithCustomActions`]}),Di=F({required:[`captureSnapshot`,`captureSnapshotWithoutActiveApp`]}),Oi=F({required:[`captureSnapshot`,`captureSnapshotWithCustomActions`,`captureSnapshotWithoutActiveApp`]}),ki=Object.freeze([Ti,Ei,Di,Oi]);function Ai(e){return e.customActions?e.hasActiveApp?Object.freeze({kind:`custom-actions-active-app`,operation:`captureSnapshotWithCustomActions`,use:Ei}):Object.freeze({kind:`custom-actions-without-active-app`,operation:`captureSnapshotWithCustomActions`,use:Oi}):e.hasActiveApp?Object.freeze({kind:`active-app`,operation:`captureSnapshot`,use:Ti}):Object.freeze({kind:`without-active-app`,operation:`captureSnapshotWithoutActiveApp`,use:Di})}const ji=Object.freeze([Si,Ci]),Mi=Object.freeze({kind:`boot-target`,operation:`bootTarget`,use:Si}),Ni=Object.freeze({kind:`boot-target-headless`,operation:`bootTargetHeadless`,use:Ci});function Pi(e){return e.headless?Ni:Mi}const Fi=F({required:[`ensureReady`,`appState`]}),Ii=Object.freeze([Fi]),Li=F({required:[`shutdownTarget`]}),Ri=F({required:[`deployApp`]}),zi=F({required:[`ensureReady`,`materializeAppSource`,`deployMaterializedApp`]}),Bi=F({required:[`ensureReady`,`sendPushNotification`]});function Vi(e){if(typeof e!=`object`||!e)throw Yi();let t=e,n=Object.keys(t).sort();if(!(t.kind===`none`&&I(n,[`kind`]))&&!(t.kind===`legacy`&&I(n,[`kind`]))&&!(t.kind===`inventory`&&I(n,[`kind`,`use`])&&Wi(t.use))&&!(t.kind===`device-runtime`&&I(n,[`kind`,`use`])&&Gi(t.use))&&!(t.kind===`device-runtime`&&I(n,[`kind`,`uses`])&&Hi(t.uses)))throw Yi()}function Hi(e){if(!Array.isArray(e)||e.length===0||!e.every(Gi))return!1;let t=e.map(Ui);return new Set(t).size===t.length}function Ui(e){return JSON.stringify({required:[...e.required].sort(),preferred:[...e.preferred].sort()})}function Wi(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.kind===`device-inventory`&&I(Object.keys(t).sort(),[`kind`])}function Gi(e){if(typeof e!=`object`||!e)return!1;let t=e,n=Ki(t.required),r=Ki(t.preferred);return!n||!r||!qi(n)||!qi(r)||!Ji(n,r)?!1:I(Object.keys(t).sort(),[`preferred`,`required`])}function Ki(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:null}function qi(e){return new Set(e).size===e.length}function Ji(e,t){let n=new Set(e);return t.every(e=>!n.has(e))}function I(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Yi(){return TypeError(`Command platform execution must declare exactly one of none, legacy, inventory, or device-runtime`)}var Xi=class{#e=[];#t=`open`;get disposed(){return this.#t===`disposed`}defer(e){this.#n(),this.#e.push(e)}use(e){return this.defer(async()=>await e[Symbol.asyncDispose]()),e}async[Symbol.asyncDispose](){if(this.#t===`disposed`)return;if(this.#t===`disposing`)throw TypeError(`Async cleanup stack disposal is already in progress`);this.#t=`disposing`;let e=[];for(;this.#e.length>0;){let t=this.#e.pop();if(t)try{await t()}catch(t){e.push(t)}}if(this.#t=`disposed`,e.length===1)throw e[0];if(e.length>1)throw AggregateError(e,`Multiple asynchronous cleanups failed`)}#n(){if(this.#t!==`open`)throw TypeError(`Cannot register cleanup after disposal has begun`)}},Zi=class{#e;#t=`pending`;constructor(e){this.#e=e}get pending(){return this.#t===`pending`}transfer(){if(this.#t!==`pending`)throw TypeError(`Cannot transfer handle in ${this.#t} state`);return this.#t=`transferred`,this.#e}async[Symbol.asyncDispose](){this.#t===`pending`&&(this.#t=`disposed`,await this.#e[Symbol.asyncDispose]())}};const L=new Map;async function Qi(e,t){let n=L.get(e);if(n){await n;return}let r,i=new Promise(e=>{r=e});L.set(e,i);try{await t()}finally{L.get(e)===i&&L.delete(e),r()}}async function $i(e){await L.get(e)}const ea=[`metroHost`,`metroPort`,`bundleUrl`];function ta(e){return ea.some(t=>e[t]!==void 0)}const na=[`resolveOpenTarget`,`prepareApplicationOpen`,`openApplication`,`applyRuntimeHints`,`clearRuntimeHints`,`closeApplication`,`finalizeApplicationClose`,`prepareAppleRunner`,`configureProviderPortReverse`];function ra(e){return Object.freeze({resolveOpenTarget:e.resolveOpenTarget,prepareApplicationOpen:e.prepareApplicationOpen,openApplication:e.openApplication,applyRuntimeHints:e.applyRuntimeHints,clearRuntimeHints:e.clearRuntimeHints,closeApplication:e.closeApplication,finalizeApplicationClose:e.finalizeApplicationClose,prepareAppleRunner:e.prepareAppleRunner,configureProviderPortReverse:e.configureProviderPortReverse})}function ia(e,t){return Object.freeze(Object.fromEntries(na.flatMap(n=>t[n].available?[[n,e[n]]]:[])))}function aa(e){return Object.freeze({captureSnapshot:e.capture,captureSnapshotWithCustomActions:e.customActions,captureSnapshotWithoutActiveApp:e.withoutActiveApp})}function oa(t){let n=async n=>{let r={...n.execution,appBundleId:n.options?.appBundleId,signal:t.signal},i=t.ownership===`local`?await t.resolveInteractor(t.device,r):t.resolveInteractor(r);if(!i)throw new e(`UNSUPPORTED_OPERATION`,`Provider-owned snapshot operation has no bound provider interactor.`,{reason:`provider-runtime-interactor-missing`,deviceId:t.device.id});return await i.snapshot({...n.options,signal:t.signal})};return Object.freeze({captureSnapshot:n,captureSnapshotWithCustomActions:n,captureSnapshotWithoutActiveApp:n})}function sa(e){return oa({...e,ownership:`local`})}function ca(e){return oa({...e,ownership:`provider`})}function la(e,t,n){return Object.freeze({device:e,owner:t,facts:ua(e,t,n),operations:Object.freeze({}),[Symbol.asyncDispose]:async()=>void 0})}function ua(e,t,n){let{appLog:r,apps:i,appDeployment:o,appState:s,network:c,screenRecording:l,snapshot:u,readiness:d,shutdown:f,lifecycle:p}=da(n);return Object.freeze({device:{...a(e),providerMode:t.kind===`local-family`?`local`:`provider-runtime`},operations:{appLogInspect:r,appLogDoctor:r,appLogStart:r,appLogReattach:r,appLogCleanup:r,listApps:i,deployApp:o,materializeAppSource:o,deployMaterializedApp:o,sendPushNotification:o,appState:s,networkDump:c,screenRecordingStart:l,screenRecordingReattach:l,screenRecordingCleanup:l,...aa({capture:u,customActions:u,withoutActiveApp:u}),ensureReady:d,bootTarget:d,bootTargetHeadless:d,shutdownTarget:f,...p}})}function da(e){return Object.freeze({appLog:Object.freeze({...e.appLog}),apps:Object.freeze({...e.apps??e.network}),appDeployment:Object.freeze({...e.appDeployment??e.network}),appState:Object.freeze({...e.appState??e.network}),network:Object.freeze({...e.network}),screenRecording:Object.freeze({...e.screenRecording??e.network}),snapshot:Object.freeze({...e.snapshot??e.network}),readiness:Object.freeze({...e.readiness??e.network}),shutdown:Object.freeze({...e.shutdown??e.network}),lifecycle:ra(e.lifecycle)})}function fa(e){return e.status===`cleaned`||e.status===`already-missing`}const pa=`app-log`,ma=`screen-recording`,ha=F({required:[`screenRecordingStart`]}),ga=F({required:[`screenRecordingReattach`,`screenRecordingCleanup`]}),_a=F({required:[]}),va=F({required:[],preferred:[`screenRecordingStart`]}),ya=Object.freeze([ha,ga]);function ba(t){switch((t.action??``).toLowerCase()){case`start`:if(!xa(t.scope??`app`))throw new e(`INVALID_ARGS`,`record scope must be app, device, or system`);return Object.freeze({kind:`start`,use:ha});case`stop`:return t.hasLiveHandle===!0?Object.freeze({kind:`stop-live`,use:_a}):Object.freeze({kind:`stop-recovery`,use:ga});default:throw new e(`INVALID_ARGS`,`record requires start or stop`)}}function xa(e){return e===`app`||e===`device`||e===`system`}function Sa(e){if(Vi(e),e.kind!==`device-runtime`||!(`uses`in e))throw wa();let t=e.uses.map(Ca),n=ya.map(Ca),r=new Set(t),i=new Set(n);if(t.length!==n.length||r.size!==t.length||[...r].some(e=>!i.has(e)))throw wa()}function Ca(e){return JSON.stringify({required:[...e.required].sort(),preferred:[...e.preferred].sort()})}function wa(){return TypeError(`Record runtime execution must declare exactly the uses selected by its two runtime-bearing plans`)}const Ta=F({required:[`networkDump`]}),Ea=F({required:[],preferred:[`networkDump`]}),Da=[`dump`,`log`],Oa=[`summary`,`headers`,`body`,`all`];function ka(t){let n=(t.action??`dump`).toLowerCase(),r=(t.include??`summary`).toLowerCase();if(!Aa(n))throw new e(`INVALID_ARGS`,`network requires dump or log`);if(!ja(r))throw new e(`INVALID_ARGS`,`network --include must be summary, headers, body, or all`);return Object.freeze({action:n,include:r,use:Ta})}function Aa(e){return Da.some(t=>t===e)}function ja(e){return Oa.some(t=>t===e)}function R(e){let t=e.trim();if(!t||/\s/.test(t))return!1;let n=/^([A-Za-z][A-Za-z0-9+.-]*):(.+)$/.exec(t);if(!n)return!1;let r=n[1]?.toLowerCase(),i=n[2]??``;return r===`http`||r===`https`||r===`ws`||r===`wss`||r===`ftp`||r===`ftps`?i.startsWith(`//`):!0}function Ma(e){let t=e.trim().split(`:`)[0]?.toLowerCase();return t===`http`||t===`https`}function Na(e,t){let n=e?.trim();if(n)return n;if(Ma(t))return`com.apple.mobilesafari`}const Pa=`--launch-console is supported only for iOS simulator app launches`,Fa=`--launch-console requires a direct app launch and cannot be used with URL opens`;function Ia(e,t,n){return{requestId:e.requestId,signal:n,appBundleId:t,verbose:e.verbose,logPath:e.logPath,traceLogPath:e.traceLogPath,iosXctestrunFile:e.iosXctestrunFile,iosXctestDerivedDataPath:e.iosXctestDerivedDataPath,iosXctestEnvDir:e.iosXctestEnvDir,runnerLeaseContext:e.runnerLeaseContext}}function La(t){let{device:n,signal:r,ownership:i}=t;return Object.freeze({device:n,signal:r,resolveInteractor:async(a,o)=>{let s=Ia(a,o,r);if(i===`local`)return await t.resolveLocalInteractor(n,s);let c=i.resolveInteractor(s);if(c)return c;throw new e(`UNSUPPORTED_OPERATION`,`Provider-owned application lifecycle operation has no bound provider interactor.`,{reason:`provider-runtime-interactor-missing`,deviceId:n.id})}})}function Ra(e){return La({device:e.device,signal:e.signal,resolveLocalInteractor:e.resolveInteractor,ownership:`local`})}function za(e){return La({device:e.device,signal:e.signal,ownership:{kind:`provider`,resolveInteractor:e.resolveInteractor}})}async function Ba(e){let{device:t,positionals:n,execution:r}=e;Va(n);let i=n[0],a=n[1];if(!i){await Ha(e);return}if(Ua(t,r),a!==void 0){await Wa(e,i,a);return}await Ga(e,i)}function Va(t){if(t.length>2)throw new e(`INVALID_ARGS`,`open accepts at most two arguments: <app|url> [url]`)}async function Ha(t){if(t.execution.launchConsole)throw new e(`INVALID_ARGS`,`--launch-console requires an app target`);if(t.execution.launchArgs&&t.execution.launchArgs.length>0)throw new e(`INVALID_ARGS`,`--launch-args requires an app target`);await t.interactor.openDevice()}function Ua(t,n){if(n.launchConsole&&(!o(t)||t.kind!==`simulator`))throw new e(`UNSUPPORTED_OPERATION`,Pa);if(t.platform===`linux`&&n.launchArgs&&n.launchArgs.length>0)throw new e(`UNSUPPORTED_OPERATION`,`--launch-args is not supported on Linux.`)}async function Wa(t,n,r){if(R(n))throw new e(`INVALID_ARGS`,`open <app> <url> requires an app target as the first argument`);if(!R(r))throw new e(`INVALID_ARGS`,`open <app> <url> requires a valid URL target`);if(t.execution.launchConsole)throw new e(`INVALID_ARGS`,Fa);await t.interactor.open(n,{activity:t.execution.activity,appBundleId:t.appBundleId,launchArgs:t.execution.launchArgs?[...t.execution.launchArgs]:void 0,terminateRunningApp:t.terminateRunningApp,url:r})}async function Ga(t,n){let{execution:r,interactor:i}=t;if(r.launchConsole&&R(n))throw new e(`INVALID_ARGS`,Fa);if(r.clearAppState){if(R(n))throw new e(`INVALID_ARGS`,`Clearing app state requires an app target, not a deep link.`);await i.setSetting(`clear-app-state`,`clear`,n)}await i.open(n,{activity:r.activity,appBundleId:t.appBundleId,launchConsole:r.launchConsole,launchArgs:r.launchArgs?[...r.launchArgs]:void 0,terminateRunningApp:t.terminateRunningApp})}function Ka(t){let{binding:n}=t,r=async()=>{throw new e(`UNSUPPORTED_OPERATION`,`This lifecycle operation is unavailable for ${t.owner}.`)};return Object.freeze({resolveOpenTarget:async e=>Ya(t.openTargetIdentity,e),prepareApplicationOpen:async()=>void 0,openApplication:async e=>await qa(t,e),applyRuntimeHints:r,clearRuntimeHints:r,closeApplication:async e=>{await Xa({device:n.device,interactor:await n.resolveInteractor(e.execution,e.appBundleId),positionals:e.positionals})},finalizeApplicationClose:async()=>({}),prepareAppleRunner:r,configureProviderPortReverse:t.configureProviderPortReverse??r})}async function qa(e,t){let{binding:n}=e,r=await n.resolveInteractor(t.execution,t.appBundleId);e.closeBeforeRelaunch&&t.relaunch&&t.target!==void 0&&await Xa({device:n.device,interactor:r,positionals:[t.appBundleId??t.target]}),await Ba({device:n.device,interactor:r,positionals:t.positionals,appBundleId:t.appBundleId,execution:t.execution});let i=Ja(t);return i&&await Ba({device:n.device,interactor:r,positionals:[i],appBundleId:t.appBundleId,execution:{...t.execution,clearAppState:void 0,launchConsole:void 0,launchArgs:void 0}}),{appBundleId:t.appBundleId,timing:{}}}function Ja(e){let t=e.runtimeLaunchUrl?.trim(),n=e.positionals.length===1?e.positionals[0]?.trim():void 0;if(!(!t||!n||R(n)))return t}function Ya(e,t){let n=t.target;if(e===`app-name`)return Object.freeze(n===void 0?{}:{appName:n});let r=n?.trim(),i=r&&r.includes(`.`)&&!R(r)?r:t.currentAppBundleId;return Object.freeze({...i===void 0?{}:{appBundleId:i},...n===void 0?{}:{appName:n}})}async function Xa(e){let{device:t,interactor:n,positionals:r}=e,i=r[0];if(!i){t.platform===`web`&&await n.close(``);return}await n.close(i)}const Za=F({required:[`resolveOpenTarget`,`prepareApplicationOpen`,`openApplication`]}),Qa=F({required:[`resolveOpenTarget`,`prepareApplicationOpen`,`openApplication`,`applyRuntimeHints`]}),$a=F({required:[`resolveOpenTarget`,`prepareApplicationOpen`,`openApplication`,`clearRuntimeHints`]}),eo=F({required:[`resolveOpenTarget`,`prepareApplicationOpen`,`openApplication`,`applyRuntimeHints`,`clearRuntimeHints`]});function to(e){return e.applyRuntimeHints&&e.clearRemovedRuntimeHints?Object.freeze({kind:`open-apply-and-clear-runtime-hints`,use:eo}):e.applyRuntimeHints?Object.freeze({kind:`open-apply-runtime-hints`,use:Qa}):e.clearRemovedRuntimeHints?Object.freeze({kind:`open-clear-runtime-hints`,use:$a}):Object.freeze({kind:`open`,use:Za})}const no=Object.freeze([Za,Qa,$a,eo]),ro=F({required:[`closeApplication`,`finalizeApplicationClose`]}),io=F({required:[`closeApplication`,`finalizeApplicationClose`,`clearRuntimeHints`]}),ao=Object.freeze([ro,io]),oo=F({required:[`finalizeApplicationClose`]}),so=F({required:[`finalizeApplicationClose`,`clearRuntimeHints`]}),co=F({required:[`prepareAppleRunner`]}),lo=F({required:[`clearRuntimeHints`]}),uo=F({required:[`configureProviderPortReverse`]}),fo=Object.freeze([lo,uo]),z=F({required:[`appLogInspect`]}),po=F({required:[`appLogInspect`,`appLogDoctor`]}),mo=F({required:[`appLogInspect`,`appLogStart`]}),ho=F({required:[],preferred:[`appLogInspect`]}),go=Object.freeze([z,po,mo]);function _o(t){let n=(t.action??`path`).toLowerCase();if(t.restart&&n!==`clear`)throw new e(`INVALID_ARGS`,`logs --restart is only supported with logs clear`);switch(n){case`path`:return Object.freeze({kind:`path`,requiresAppSession:!1,use:z});case`start`:return Object.freeze({kind:`start`,requiresAppSession:!0,use:mo});case`stop`:return Object.freeze({kind:`stop`,requiresAppSession:!1,use:z});case`doctor`:return Object.freeze({kind:`doctor`,requiresAppSession:!1,use:po});case`mark`:return Object.freeze({kind:`mark`,marker:t.marker??``,requiresAppSession:!1,use:z});case`clear`:return t.restart?Object.freeze({kind:`clear-restart`,requiresAppSession:!0,use:mo}):Object.freeze({kind:`clear`,requiresAppSession:!1,use:z});default:throw new e(`INVALID_ARGS`,`logs requires path, start, stop, doctor, mark, or clear`)}}function vo(e){let t=new Map;for(let n of e){if(!s(n.family))throw TypeError(`Unknown platform family registration: ${String(n.family)}`);if(t.has(n.family))throw TypeError(`Duplicate platform family registration: ${n.family}`);t.set(n.family,yo(n))}let n=l.filter(e=>!t.has(e));if(n.length>0)throw TypeError(`Missing platform family registrations: ${n.join(`, `)}`);let r=Object.freeze([...l]),i=Object.freeze(r.map(e=>bo(t,e)));return Object.freeze({families:r,modules:i,get:e=>bo(t,e)})}function yo(e){return Object.freeze({...e})}function bo(e,t){let n=e.get(t);if(!n)throw TypeError(`Missing platform family registration: ${t}`);return n}const xo=Object.freeze({kind:`device-inventory`});function So(e){let t=e.platformExecution;if(t===void 0)throw TypeError(`Command descriptor "${e.name}" must declare platformExecution (none, legacy, inventory, or device-runtime); there is no registry-entry default`);if(Vi(t),t.kind===`none`&&e.capability!==void 0)throw TypeError(`Command descriptor "${e.name}" declares platformExecution none but keeps a capability bucket; a command with platform admission is not platform-free`);return t}const Co={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0},B={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0,selectorValidationExempt:!0},wo=()=>!0,To=e=>(e.positionals?.[0]??``).toLowerCase()===`start`,Eo=e=>e.command===`test`&&(typeof e.flags?.shardAll==`number`||typeof e.flags?.shardSplit==`number`),Do=new Set([`status`,`get`]),Oo=e=>Po(e,Do,`status`),ko=new Set([`get`,`wait`]),Ao=e=>Po(e,ko,`get`),jo=e=>Fo(e,Do,`status`),Mo=e=>Fo(e,ko,`get`),No=e=>{try{return Cn(Nn(e.positionals??[]).action)?`observes-app`:`mutates-app`}catch{return`mutates-app`}};function Po(e,t,n){return t.has((e.positionals?.[0]??n).toLowerCase())?`preserve`:`may-invalidate`}function Fo(e,t,n){return t.has((e.positionals?.[0]??n).toLowerCase())?`observes-app`:`mutates-app`}const V={simulator:!0,device:!0},H={emulator:!0,device:!0,unknown:!0},Io={emulator:!0},U={device:!0},W={},G={apple:V,android:H,linux:U},K={kind:`none`},q={kind:`legacy`},J={recordsSessionAction:!0,recordingEffect:`mutates-app`,deviceClaimPolicy:`require-owner`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:V,android:H,linux:U},timeoutPolicy:M,batchable:!0},Lo={targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,deviceClaimPolicy:`require-owner`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:V,android:H,linux:U}},Y={...M,onTimeout:`preserve-daemon`},Ro={...M,envelopeMs:18e4},zo={...M,onTimeout:`preserve-daemon`},Bo={...zo,envelopeMs:33e4},Vo={...M,budget:{source:`flag`,envelope:`widen`,defaultBudgetMs:1e4},onTimeout:`preserve-daemon`},Ho={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}}},Uo={fields:{delayMs:{defaultValue:0}}};function X(e,t){return Or(e)===void 0?t:Vo}function Z(e){let t=Or(e);if(t===void 0)throw Error(`Missing post-action observation descriptor support for ${e}`);return t}const Wo=[{name:`lease_allocate`,deviceClaimPolicy:`none`,catalog:{group:`internal`,key:`leaseAllocate`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...Co},timeoutPolicy:Bo,batchable:!1,platformExecution:K},{name:`lease_heartbeat`,deviceClaimPolicy:`none`,catalog:{group:`internal`,key:`leaseHeartbeat`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...Co},timeoutPolicy:zo,batchable:!1,platformExecution:K},{name:`lease_release`,deviceClaimPolicy:`none`,catalog:{group:`internal`,key:`leaseRelease`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...Co},timeoutPolicy:zo,batchable:!1,platformExecution:K},{name:`artifacts`,deviceClaimPolicy:`none`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...Co},timeoutPolicy:M,batchable:!1,platformExecution:K},{name:`session_list`,deviceClaimPolicy:`none`,catalog:{group:`internal`,key:`sessionList`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,...B},timeoutPolicy:M,batchable:!1,platformExecution:K},{name:`session_save_script`,deviceClaimPolicy:`none`,catalog:{group:`internal`,key:`sessionSaveScript`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`publication`},timeoutPolicy:M,batchable:!1,platformExecution:K},{name:`devices`,deviceClaimPolicy:`observe`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,...B},timeoutPolicy:M,batchable:!0,platformExecution:{kind:`inventory`,use:xo}},{name:`capabilities`,deviceClaimPolicy:`observe`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0,...B},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`doctor`,deviceClaimPolicy:`observe`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,allowSessionlessDefaultDevice:wo,...B},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`apps`,deviceClaimPolicy:`observe`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0},platformExecution:{kind:`device-runtime`,uses:[wi]},timeoutPolicy:M,batchable:!0},{name:`boot`,deviceClaimPolicy:`transient-exclusive`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`may-invalidate`,sessionKind:`state`},platformExecution:{kind:`device-runtime`,uses:ji},timeoutPolicy:M,batchable:!0},{name:`shutdown`,deviceClaimPolicy:`transient-exclusive`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`may-invalidate`,sessionKind:`state`},platformExecution:{kind:`device-runtime`,use:Li},timeoutPolicy:M,batchable:!0},{name:`appstate`,deviceClaimPolicy:`observe`,catalog:{group:`public`,key:`appState`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`state`},platformExecution:{kind:`device-runtime`,uses:Ii},timeoutPolicy:M,batchable:!0},{name:`perf`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:V,android:H,linux:W},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`logs`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},platformExecution:{kind:`device-runtime`,uses:go},timeoutPolicy:M,batchable:!0},{name:`events`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`,allowInvalidRecording:!0,...B},timeoutPolicy:M,batchable:!1,platformExecution:q},{name:`network`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},platformExecution:{kind:`device-runtime`,use:Ta},timeoutPolicy:M,batchable:!0},{name:`audio`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:V,android:{emulator:!0},linux:W},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`replay`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`,sessionKind:`replay`,skipSessionlessProviderDevice:Eo,saveScriptFlagOwner:!0},timeoutPolicy:{...M,budget:{source:`flag`}},batchable:!1,platformExecution:q},{name:`test`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`,sessionKind:`replay`,skipSessionlessProviderDevice:Eo},timeoutPolicy:{...M,envelopeMs:`unbounded`},batchable:!0,platformExecution:q},{name:`runtime`,deviceClaimPolicy:`require-owner`,catalog:{group:`internal`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`},timeoutPolicy:M,batchable:!1,platformExecution:{kind:`device-runtime`,uses:fo}},{name:`clipboard`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`session`,refFrameEffect:`preserve`},dispatch:{},capability:{apple:V,android:H,linux:U},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`keyboard`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:jo,daemon:{route:`session`,refFrameEffect:Oo,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:V,android:H,linux:W},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`install`,deviceClaimPolicy:`transient-exclusive`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},platformExecution:{kind:`device-runtime`,use:Ri},timeoutPolicy:Ro,batchable:!0},{name:`reinstall`,deviceClaimPolicy:`transient-exclusive`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},platformExecution:{kind:`device-runtime`,use:Ri},timeoutPolicy:Ro,batchable:!0},{name:`install_source`,deviceClaimPolicy:`transient-exclusive`,catalog:{group:`internal`,key:`installSource`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},platformExecution:{kind:`device-runtime`,use:zi},timeoutPolicy:Ro,batchable:!1},{name:`release_materialized_paths`,deviceClaimPolicy:`none`,catalog:{group:`internal`,key:`releaseMaterializedPaths`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,...B},timeoutPolicy:M,batchable:!1,platformExecution:K},{name:`push`,deviceClaimPolicy:`transient-exclusive`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},platformExecution:{kind:`device-runtime`,use:Bi},timeoutPolicy:M,batchable:!0},{name:`trigger-app-event`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`,key:`triggerAppEvent`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:V,android:H,linux:W},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`open`,deviceClaimPolicy:`acquire-session`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`,allowSessionlessDefaultDevice:wo,saveScriptFlagOwner:!0},timeoutPolicy:M,batchable:!0,platformExecution:{kind:`device-runtime`,uses:no}},{name:`prepare`,deviceClaimPolicy:`transient-exclusive`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`},timeoutPolicy:{budget:{source:`flag`},envelopeMs:wr,onTimeout:`reset-daemon`},batchable:!1,mcpExposed:!1,platformExecution:{kind:`device-runtime`,use:co}},{name:`batch`,deviceClaimPolicy:`none`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`},timeoutPolicy:M,batchable:!1,platformExecution:q},{name:`close`,deviceClaimPolicy:`release-session`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`,allowInvalidRecording:!0,saveScriptFlagOwner:!0},timeoutPolicy:M,batchable:!0,platformExecution:{kind:`device-runtime`,uses:ao}},{name:`snapshot`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},timeoutPolicy:{...Y,budget:{source:`flag`}},batchable:!0,platformExecution:{kind:`device-runtime`,uses:ki}},{name:`diff`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},timeoutPolicy:M,batchable:!0,platformExecution:{kind:`device-runtime`,uses:ki}},{name:`wait`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:`observes-app`,targetIdentityVerification:`post-resolution`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},capability:G,timeoutPolicy:{...Y,budget:{source:`positional-parser`,parser:Cr}},batchable:!0,platformExecution:q},{name:`alert`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:Mo,daemon:{route:`snapshot`,refFrameEffect:Ao},capability:{apple:V,android:H,linux:W},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`settings`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`snapshot`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:V,android:H,linux:W},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`react-native`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`,key:`reactNative`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`reactNative`,refFrameEffect:`may-invalidate`},capability:{apple:V,android:H,linux:W},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`record`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`recordTrace`,refFrameEffect:`preserve`,allowInvalidRecording:!0,allowSessionlessDefaultDevice:To},platformExecution:{kind:`device-runtime`,uses:ya},timeoutPolicy:M,batchable:!0},{name:`trace`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`recordTrace`,refFrameEffect:`preserve`},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`find`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:No,daemon:{route:`find`,refFrameEffect:`may-invalidate`},capability:G,timeoutPolicy:Y,batchable:!0,platformExecution:q},{name:`click`,deviceClaimPolicy:`require-owner`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},capability:{apple:V,android:H,linux:U},timeoutPolicy:X(`click`,Y),postActionObservation:Z(`click`),responseDataTransform:Ho,batchable:!0,platformExecution:q},{name:`fill`,...Lo,frameworkTier:`core`,timeoutPolicy:X(`fill`,Y),postActionObservation:Z(`fill`),responseDataTransform:Uo,batchable:!0,platformExecution:q},{name:`longpress`,...Lo,catalog:{group:`public`,key:`longPress`},frameworkTier:`extended`,timeoutPolicy:{...Vo,envelopeMs:21e4},postActionObservation:Z(`longpress`),batchable:!0,platformExecution:q},{name:`hover`,deviceClaimPolicy:`require-owner`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:{},android:{},linux:W},timeoutPolicy:X(`hover`,Y),postActionObservation:Z(`hover`),batchable:!0,platformExecution:q},{name:`press`,...Lo,frameworkTier:`core`,timeoutPolicy:X(`press`,Y),postActionObservation:Z(`press`),responseDataTransform:Ho,batchable:!0,platformExecution:q},{name:`type`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:G,timeoutPolicy:X(`type`,Y),batchable:!0,platformExecution:q},{name:`get`,deviceClaimPolicy:`require-owner`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`interaction`,refFrameEffect:`preserve`},capability:G,timeoutPolicy:X(`get`,Y),batchable:!0,platformExecution:q},{name:`read`,deviceClaimPolicy:`require-owner`,catalog:{group:`dispatch-alias`},recordsSessionAction:!1,dispatch:{},timeoutPolicy:M,batchable:!1,platformExecution:q},{name:`is`,deviceClaimPolicy:`require-owner`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`interaction`,refFrameEffect:`preserve`},capability:G,timeoutPolicy:X(`is`,Y),batchable:!0,platformExecution:q},{name:`back`,catalog:{group:`public`},frameworkTier:`core`,...J,capability:{...J.capability,vega:Io},timeoutPolicy:X(`back`,M),postActionObservation:Z(`back`),platformExecution:q},{name:`gesture`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,targetIdentityVerification:`pre-dispatch`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},capability:G,timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`home`,catalog:{group:`public`},frameworkTier:`extended`,...J,capability:{...J.capability,vega:Io},platformExecution:q},{name:`tv-remote`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`,key:`tvRemote`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:V,android:H,vega:Io,linux:W},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`orientation`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:V,android:H,linux:W},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`scroll`,catalog:{group:`public`},frameworkTier:`core`,...J,timeoutPolicy:X(`scroll`,M),postActionObservation:Z(`scroll`),platformExecution:q},{name:`swipe`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},capability:{apple:V,android:H,linux:U},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`focus`,catalog:{group:`public`},frameworkTier:`extended`,...J,platformExecution:q},{name:`screenshot`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`core`,recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`generic`,refFrameEffect:`preserve`},dispatch:{},capability:G,timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`viewport`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:{},android:{},linux:W},timeoutPolicy:M,batchable:!1,platformExecution:q},{name:`app-switcher`,deviceClaimPolicy:`require-owner`,catalog:{group:`public`,key:`appSwitcher`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:V,android:H,linux:W},timeoutPolicy:M,batchable:!0,platformExecution:q},{name:`install-from-source`,deviceClaimPolicy:`none`,catalog:{group:`public`,key:`installFromSource`},frameworkTier:`extended`,recordsSessionAction:!0,recordingEffect:`mutates-app`,platformExecution:{kind:`device-runtime`,use:zi},timeoutPolicy:M,batchable:!0},{name:`debug`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,platformExecution:q},{name:`daemon`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:q},{name:`device`,deviceClaimPolicy:`observe`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:K},{name:`metro`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,platformExecution:K},{name:`session`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,platformExecution:K},{name:`cdp`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:K},{name:`auth`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:K},{name:`connect`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:K},{name:`connection`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:K},{name:`disconnect`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:K},{name:`mcp`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:K},{name:`proxy`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:K},{name:`react-devtools`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`,key:`reactDevtools`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:q},{name:`web`,deviceClaimPolicy:`none`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:M,batchable:!1,mcpExposed:!1,platformExecution:q}],Go=new Set([`public`,`local-cli`]),Ko=new Set(Wo.filter(e=>Go.has(Qo(e))).map(e=>e.name)),Q=Wo.map(e=>{let t=So(e);return e.name===`record`&&Sa(t),{...e,mcpExposed:Xo(e),platformExecution:t}});function qo(e){return Q.filter(t=>Qo(t)===e).map(e=>[$o(e),e.name])}function Jo(){return Q.filter(e=>Zo(e)).map(e=>e.name).sort()}const $=new Map(Q.map(e=>[e.name,e]));function Yo(e){return Ko.has(e)}function Xo(e){return e.mcpExposed??Ko.has(e.name)}function Zo(e){return e.mcpExposed&&Yo(e.name)}function Qo(e){return e.catalog.group}function $o(e){return e.catalog.key??e.name}const es=new Map(Q.map(e=>[e.name,e.timeoutPolicy])),ts=new Map(Q.map(e=>[e.name,e.deviceClaimPolicy])),ns=new Map(Array.from($.values()).flatMap(e=>e.responseDataTransform?[[e.name,e.responseDataTransform]]:[]));function rs(e){if(e!==void 0)return $.get(e)?.postActionObservation}function is(e){return rs(e)!==void 0}function as(e){return rs(e)===`settle-and-verify`}function os(e){return e===void 0?M:es.get(e)??M}function ss(e){return e===void 0?`require-owner`:ts.get(e)??`require-owner`}function cs(e){if(e!==void 0)return ns.get(e)}function ls(e){return e===void 0?!1:$.get(e)?.recordsSessionAction??!1}function us(e){if(e!==void 0)return $.get(e)?.frameworkTier}function ds(e){return $.get(e)?.targetIdentityVerification}function fs(e){let t=$.get(e.command);if(t?.recordsSessionAction)return typeof t.recordingEffect==`function`?t.recordingEffect(e):t.recordingEffect}function ps(){return[...new Set(Array.from(ns.values()).flatMap(e=>Object.keys(e.fields)))].sort()}function ms(e){return Number.isInteger(e)&&e>=1&&e<=1e3}function hs(t,n){if(t>n)throw new e(`INVALID_ARGS`,`batch has ${t} steps; max allowed is ${n}.`)}function gs(t,n){if(!f(t))throw new e(`INVALID_ARGS`,`Invalid batch step ${n}.`);return t}function _s(t,n){let r=t.input;if(!f(r))throw new e(`INVALID_ARGS`,`Batch step ${n} input must be an object.`);return r}function vs(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)}`)}}function ys(e){let t=[];for(let n of e)n.daemon&&t.push({command:n.name,...n.daemon,replayScopedAction:n.recordsSessionAction});return t}function bs(e){let t={};for(let n of e)n.capability&&(t[n.name]=n.capability);return t}function xs(e){return e.filter(e=>e.batchable).map(e=>e.name)}const Ss=xs(Q),Cs=new Set([`batch`,`replay`]),ws=[`command`,`positionals`,`input`,`flags`,`runtime`],Ts=[`platform`,`target`,`device`,`udid`,`serial`,`verbose`,`out`],Es=new Set(Ss);function Ds(e){return Es.has(e)}function Os(e){return typeof e==`string`?e.trim().toLowerCase():``}function ks(t,n){let r=Os(t);if(Ds(r))return r;throw new e(`INVALID_ARGS`,`Batch step ${n} command is not available through command batch: ${String(t)}`)}function As(t,n){if(Cs.has(t))throw new e(`INVALID_ARGS`,`Batch step ${n} cannot run ${t}.`)}const js=new Set(ws);async function Ms(e,t,n){let r=zs(e.flags),a=r?.batchOnError??`stop`;if(a!==`stop`)return Bs(`INVALID_ARGS`,`Unsupported batch on-error mode: ${a}.`);let o=r?.batchMaxSteps??100;if(!ms(o))return Bs(`INVALID_ARGS`,`Invalid batch max-steps: ${String(r?.batchMaxSteps)}`);try{let i=Ns(r?.batchSteps,o),a=Date.now(),s=[];for(let[r,a]of i.entries()){let o=await Rs(e,t,a,n,r+1,r===i.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,...o.error.retriable===void 0?{}:{retriable:o.error.retriable},...o.error.supportedOn===void 0?{}:{supportedOn:o.error.supportedOn},details:{...o.error.details??{},step:o.step,command:a.command,positionals:a.positionals,executed:r,total:i.length,partialResults:s}}};s.push(o.result)}return{ok:!0,data:{total:i.length,executed:i.length,totalDurationMs:Date.now()-a,results:s}}}catch(e){let t=i(e);return Bs(t.code,t.message,t.details)}}function Ns(t,n){if(!Array.isArray(t)||t.length===0)throw new e(`INVALID_ARGS`,`batch requires a non-empty batchSteps array.`);hs(t.length,n);let r=[];for(let n=0;n<t.length;n+=1){let i=t[n];if(!h(i))throw new e(`INVALID_ARGS`,`Invalid batch step at index ${n}.`);let a=Object.keys(i).filter(e=>!js.has(e));if(a.length>0){let t=a.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 o=Os(i.command);if(!o)throw new e(`INVALID_ARGS`,`Batch step ${n+1} requires command.`);if(As(o,n+1),i.positionals!==void 0&&!Array.isArray(i.positionals))throw new e(`INVALID_ARGS`,`Batch step ${n+1} positionals must be an array.`);let s=i.positionals??[];if(s.some(e=>typeof e!=`string`))throw new e(`INVALID_ARGS`,`Batch step ${n+1} positionals must contain only strings.`);if(i.flags!==void 0&&!h(i.flags))throw new e(`INVALID_ARGS`,`Batch step ${n+1} flags must be an object.`);if(i.input!==void 0&&!h(i.input))throw new e(`INVALID_ARGS`,`Batch step ${n+1} input must be an object.`);r.push({command:o,positionals:s,input:i.input,flags:i.flags??{},runtime:vs(i.runtime,n+1)})}return r}function Ps(e,t){let{batchSteps:n,batchOnError:r,batchMaxSteps:i,...a}=t??{};return Fs(zs(e),a)}function Fs(e,t){let n=zs(e)??{},r=t;for(let e of Ts)r[e]===void 0&&n[e]!==void 0&&(r[e]=n[e]);return t}function Is(e,n){return t(e)?n?e:`digest`:e}function Ls(e,t){let n=e?.responseLevel,r=Is(n,t);return r===n?e:{...e,responseLevel:r}}async function Rs(e,t,n,r,i,a){let o=Date.now(),s=Ps(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:Ls(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 zs(e){return e}function Bs(e,t,n){return{ok:!1,error:{code:e,message:t,...n?{details:n}:{}}}}export{ba as $,St as $n,pr as $t,io as A,gn as An,_ as Ar,di as At,Ka as B,Bt as Bn,ce as Br,Gr as Bt,os as C,Sn as Cn,y as Cr,Pi as Ct,_o as D,E as Dn,De as Dr,fi as Dt,ho as E,_n as En,Oe as Er,ci as Et,eo as F,nn as Fn,_e as Fr,Yr as Ft,Ba as G,w as Gn,oe as Gr,Nr as Gt,za as H,Vt as Hn,re as Hr,Fr as Ht,Qa as I,cn as In,ge as Ir,Hr as It,R as J,vt as Jn,ve as Jr,Er as Jt,Fa as K,Ct as Kn,ne as Kr,Pr as Kt,$a as L,sn as Ln,h as Lr,Wr as Lt,oo as M,rn as Mn,Ce as Mr,oi as Mt,so as N,fn as Nn,xe as Nr,Zr as Nt,lo as O,un as On,Ee as Or,li as Ot,Za as P,dn as Pn,be as Pr,Qr as Pt,ka as Q,yt as Qn,j as Qt,co as R,ln as Rn,ue as Rr,Ur as Rt,cs as S,Cn as Sn,je as Sr,F as St,vo as T,Fn as Tn,ke as Tr,Li as Tt,Ja as U,Ut as Un,se as Ur,Mr as Ut,Ra as V,Rt as Vn,ie as Vr,Vr as Vt,Xa as W,Lt as Wn,ae as Wr,jr as Wt,Na as X,xt as Xn,Tr as Xt,Ma as Y,_t as Yn,f as Yr,wr as Yt,Ea as Z,bt as Zn,hr as Zt,Jo as _,bn as _n,Ne as _r,Ri as _t,bs as a,ir as an,qe as ar,la as at,fs as b,An as bn,Me as br,Fi as bt,ms as c,rr as cn,Ze as cr,ca as ct,gs as d,Vn as dn,b as dr,ia as dt,or as en,lt as er,va as et,Q as f,Bn as fn,Be as fr,ta as ft,qo as g,Hn as gn,Ve as gr,Zi as gt,ps as h,Rn as hn,Re as hr,Xi as ht,ks as i,nr as in,Xe as ir,fa as it,uo as j,pn as jn,we as jr,si as jt,ro as k,on as kn,Se as kr,ui as kt,vs as l,Zn as ln,S as lr,aa as lt,as as m,zn as mn,Le as mr,$i as mt,Ms as n,ur as nn,dt as nr,ma as nt,ys as o,$n as on,C as or,ua as ot,is as p,Un as pn,Ie as pr,Qi as pt,Pa as q,wt as qn,ye as qr,Ir as qt,Ss as r,dr as rn,Ge as rr,pa as rt,hs as s,tr as sn,Ye as sr,sa as st,Fs as t,fr as tn,ft as tr,ga as tt,_s as u,Qn as un,He as ur,ra as ut,ss as v,On as vn,ze as vr,zi as vt,ds as w,Nn as wn,v as wr,Ai as wt,ls as x,wn as xn,Ae as xr,wi as xt,us as y,kn as yn,Pe as yr,Bi as yt,to as z,Dt as zn,le as zr,Kr as zt};
|
|
@@ -23,14 +23,135 @@ type DeviceInfo = {
|
|
|
23
23
|
iosPhysicalDeviceBackend?: 'coredevice' | 'xctest';
|
|
24
24
|
};
|
|
25
25
|
//#endregion
|
|
26
|
+
//#region packages/kernel/src/errors.d.ts
|
|
27
|
+
/**
|
|
28
|
+
* The known error codes as a value, so gates can enumerate them: every code
|
|
29
|
+
* here must resolve a hint through `defaultHintForCode`, and every code
|
|
30
|
+
* `retriableForErrorCode` classifies must have a recovery quiz in the help
|
|
31
|
+
* benchmark (scripts/__tests__/help-conformance-error-recovery-coverage.test.ts).
|
|
32
|
+
* `KnownAppErrorCode` is derived from this array, so a new code cannot be added
|
|
33
|
+
* to the type without entering the enumeration.
|
|
34
|
+
*/
|
|
35
|
+
declare const KNOWN_APP_ERROR_CODES: readonly ['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'];
|
|
36
|
+
type KnownAppErrorCode = (typeof KNOWN_APP_ERROR_CODES)[number];
|
|
37
|
+
type AppErrorCode = KnownAppErrorCode | (string & {});
|
|
38
|
+
/**
|
|
39
|
+
* Locator for one request's diagnostics record on the daemon host, in the
|
|
40
|
+
* daemon's own vocabulary rather than as a filesystem path: `logPath` names
|
|
41
|
+
* that same record as a path, which only a caller on the daemon host can read.
|
|
42
|
+
* A remote caller fetches the record by this locator instead
|
|
43
|
+
* (`GET /sessions/<session>/requests/<requestId>/diagnostics`).
|
|
44
|
+
*/
|
|
45
|
+
type DiagnosticsRecordRef = {
|
|
46
|
+
session: string;
|
|
47
|
+
requestId: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Details bag for AppError. Free-form context is allowed, but these keys carry
|
|
51
|
+
* meaning at normalize/render time and must keep their types:
|
|
52
|
+
* - `hint` — overrides `defaultHintForCode`; re-wraps preserve an existing hint.
|
|
53
|
+
* - `diagnosticId` / `logPath` / `logPathUnavailable` / `diagnosticsRecord` —
|
|
54
|
+
* lifted onto the normalized error, stripped from details.
|
|
55
|
+
* - `processExitError` + `stdout`/`stderr`/`exitCode` — marks a wrap of a real
|
|
56
|
+
* process exit so normalizeError can surface the first meaningful stderr line;
|
|
57
|
+
* build these via `execFailureDetails`/`requireExecSuccess` in src/utils/exec.ts
|
|
58
|
+
* rather than by hand.
|
|
59
|
+
* - `retriable` — typed retry signal hoisted to the wire error shape.
|
|
60
|
+
* - `reason` — machine-dispatchable sub-classification within a code.
|
|
61
|
+
*/
|
|
62
|
+
type AppErrorDetails = Record<string, unknown> & {
|
|
63
|
+
hint?: string;
|
|
64
|
+
diagnosticId?: string;
|
|
65
|
+
logPath?: string;
|
|
66
|
+
logPathUnavailable?: string;
|
|
67
|
+
diagnosticsRecord?: DiagnosticsRecordRef;
|
|
68
|
+
retriable?: boolean;
|
|
69
|
+
supportedOn?: string;
|
|
70
|
+
processExitError?: boolean;
|
|
71
|
+
stdout?: string;
|
|
72
|
+
stderr?: string;
|
|
73
|
+
exitCode?: number | null;
|
|
74
|
+
reason?: string;
|
|
75
|
+
};
|
|
76
|
+
type NormalizedError = {
|
|
77
|
+
code: string;
|
|
78
|
+
message: string;
|
|
79
|
+
hint?: string;
|
|
80
|
+
diagnosticId?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Diagnostics record path **the reader of this error can open**. A daemon
|
|
83
|
+
* renders its own host path here; a client talking to a REMOTE daemon
|
|
84
|
+
* replaces it with the caller-local copy it fetched, or drops it and sets
|
|
85
|
+
* `logPathUnavailable` (see `localizeRemoteDaemonError`). A path the reader
|
|
86
|
+
* cannot open never belongs in this field (#1801).
|
|
87
|
+
*/
|
|
88
|
+
logPath?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Why no readable `logPath` could be produced, e.g.
|
|
91
|
+
* `remote daemon https://host, request 8f2c: 404`. Set only in place of
|
|
92
|
+
* `logPath`, and never carries a daemon-host path.
|
|
93
|
+
*/
|
|
94
|
+
logPathUnavailable?: string;
|
|
95
|
+
/** Locator the record can be fetched by when it lives on a remote daemon. */
|
|
96
|
+
diagnosticsRecord?: DiagnosticsRecordRef;
|
|
97
|
+
/**
|
|
98
|
+
* Lifted from `details.retriable` when a throw site classified the failure as
|
|
99
|
+
* clearly transient (or clearly not). Included only when set, so the default
|
|
100
|
+
* error wire shape is unchanged.
|
|
101
|
+
*/
|
|
102
|
+
retriable?: boolean;
|
|
103
|
+
supportedOn?: string;
|
|
104
|
+
details?: Record<string, unknown>;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Error payload returned by the daemon transport. It is kept beside the local
|
|
108
|
+
* error representation because clients immediately rehydrate this wire shape
|
|
109
|
+
* into `AppError` before rendering or handling it.
|
|
110
|
+
*/
|
|
111
|
+
type DaemonError = {
|
|
112
|
+
code: string;
|
|
113
|
+
message: string;
|
|
114
|
+
hint?: string;
|
|
115
|
+
diagnosticId?: string;
|
|
116
|
+
/** Path on the DAEMON host. Meaningful to a local caller only (#1801). */
|
|
117
|
+
logPath?: string;
|
|
118
|
+
/** Why no readable path is named; set by the client, never by the daemon. */
|
|
119
|
+
logPathUnavailable?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Additive locator (#1801) for the request diagnostics record `logPath`
|
|
122
|
+
* names, so a remote caller can fetch it over the daemon API instead of
|
|
123
|
+
* being handed a path on a filesystem it cannot read.
|
|
124
|
+
*/
|
|
125
|
+
diagnosticsRecord?: DiagnosticsRecordRef;
|
|
126
|
+
details?: Record<string, unknown>;
|
|
127
|
+
/** Additive retry and platform-support signals; absent when not derivable. */
|
|
128
|
+
retriable?: boolean;
|
|
129
|
+
supportedOn?: string;
|
|
130
|
+
};
|
|
131
|
+
declare class AppError extends Error {
|
|
132
|
+
code: AppErrorCode;
|
|
133
|
+
details?: AppErrorDetails;
|
|
134
|
+
cause?: unknown;
|
|
135
|
+
constructor(code: AppErrorCode, message: string, details?: AppErrorDetails, cause?: unknown);
|
|
136
|
+
}
|
|
137
|
+
declare function isAgentDeviceError(err: unknown): err is AppError;
|
|
138
|
+
type NormalizeErrorContext = {
|
|
139
|
+
diagnosticId?: string;
|
|
140
|
+
logPath?: string;
|
|
141
|
+
diagnosticsRecord?: DiagnosticsRecordRef;
|
|
142
|
+
};
|
|
143
|
+
declare function normalizeAgentDeviceError(err: unknown, context?: NormalizeErrorContext): NormalizedError;
|
|
144
|
+
declare function normalizeError(err: unknown, context?: NormalizeErrorContext): NormalizedError;
|
|
145
|
+
declare function defaultHintForCode(code: string): string | undefined;
|
|
146
|
+
//#endregion
|
|
26
147
|
//#region packages/kernel/src/snapshot.d.ts
|
|
27
148
|
/**
|
|
28
149
|
* Structured quality verdict computed once by the iOS runner's snapshot capture plan.
|
|
29
150
|
* The daemon renders it; it never re-derives degradation from node shapes.
|
|
30
151
|
*
|
|
31
152
|
* Defined here (the foundational snapshot type module) rather than in
|
|
32
|
-
* snapshot-quality.ts so SnapshotNode can reference it without a cyclic import;
|
|
33
|
-
* snapshot-quality.ts
|
|
153
|
+
* snapshot-quality/verdict.ts so SnapshotNode can reference it without a cyclic import;
|
|
154
|
+
* snapshot-quality/verdict.ts owns the validation logic.
|
|
34
155
|
*/
|
|
35
156
|
/**
|
|
36
157
|
* Which capture STRATEGY produced a snapshot, within one platform's plan —
|
|
@@ -146,7 +267,7 @@ type SnapshotState = {
|
|
|
146
267
|
/**
|
|
147
268
|
* Android: the capture is an occluding system surface (notification shade, quick settings)
|
|
148
269
|
* rather than app content. Consumers that surface this tree to the agent must disclose the
|
|
149
|
-
* occlusion (see
|
|
270
|
+
* occlusion (see core/android-system-surface-disclosure.ts).
|
|
150
271
|
*/
|
|
151
272
|
systemSurfaceOnly?: boolean;
|
|
152
273
|
};
|
|
@@ -172,90 +293,6 @@ type ScreenshotOverlayRef = {
|
|
|
172
293
|
};
|
|
173
294
|
declare function centerOfRect(rect: Rect): Point;
|
|
174
295
|
//#endregion
|
|
175
|
-
//#region packages/kernel/src/errors.d.ts
|
|
176
|
-
/**
|
|
177
|
-
* The known error codes as a value, so gates can enumerate them: every code
|
|
178
|
-
* here must resolve a hint through `defaultHintForCode`, and every code
|
|
179
|
-
* `retriableForErrorCode` classifies must have a recovery quiz in the help
|
|
180
|
-
* benchmark (scripts/__tests__/help-conformance-error-recovery-coverage.test.ts).
|
|
181
|
-
* `KnownAppErrorCode` is derived from this array, so a new code cannot be added
|
|
182
|
-
* to the type without entering the enumeration.
|
|
183
|
-
*/
|
|
184
|
-
declare const KNOWN_APP_ERROR_CODES: readonly ['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'];
|
|
185
|
-
type KnownAppErrorCode = (typeof KNOWN_APP_ERROR_CODES)[number];
|
|
186
|
-
type AppErrorCode = KnownAppErrorCode | (string & {});
|
|
187
|
-
/**
|
|
188
|
-
* Details bag for AppError. Free-form context is allowed, but these keys carry
|
|
189
|
-
* meaning at normalize/render time and must keep their types:
|
|
190
|
-
* - `hint` — overrides `defaultHintForCode`; re-wraps preserve an existing hint.
|
|
191
|
-
* - `diagnosticId` / `logPath` — lifted onto the normalized error, stripped from details.
|
|
192
|
-
* - `processExitError` + `stdout`/`stderr`/`exitCode` — marks a wrap of a real
|
|
193
|
-
* process exit so normalizeError can surface the first meaningful stderr line;
|
|
194
|
-
* build these via `execFailureDetails`/`requireExecSuccess` in src/utils/exec.ts
|
|
195
|
-
* rather than by hand.
|
|
196
|
-
* - `retriable` — typed retry signal hoisted to the wire error shape.
|
|
197
|
-
* - `reason` — machine-dispatchable sub-classification within a code.
|
|
198
|
-
*/
|
|
199
|
-
type AppErrorDetails = Record<string, unknown> & {
|
|
200
|
-
hint?: string;
|
|
201
|
-
diagnosticId?: string;
|
|
202
|
-
logPath?: string;
|
|
203
|
-
retriable?: boolean;
|
|
204
|
-
supportedOn?: string;
|
|
205
|
-
processExitError?: boolean;
|
|
206
|
-
stdout?: string;
|
|
207
|
-
stderr?: string;
|
|
208
|
-
exitCode?: number | null;
|
|
209
|
-
reason?: string;
|
|
210
|
-
};
|
|
211
|
-
type NormalizedError = {
|
|
212
|
-
code: string;
|
|
213
|
-
message: string;
|
|
214
|
-
hint?: string;
|
|
215
|
-
diagnosticId?: string;
|
|
216
|
-
logPath?: string;
|
|
217
|
-
/**
|
|
218
|
-
* Lifted from `details.retriable` when a throw site classified the failure as
|
|
219
|
-
* clearly transient (or clearly not). Included only when set, so the default
|
|
220
|
-
* error wire shape is unchanged.
|
|
221
|
-
*/
|
|
222
|
-
retriable?: boolean;
|
|
223
|
-
supportedOn?: string;
|
|
224
|
-
details?: Record<string, unknown>;
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* Error payload returned by the daemon transport. It is kept beside the local
|
|
228
|
-
* error representation because clients immediately rehydrate this wire shape
|
|
229
|
-
* into `AppError` before rendering or handling it.
|
|
230
|
-
*/
|
|
231
|
-
type DaemonError = {
|
|
232
|
-
code: string;
|
|
233
|
-
message: string;
|
|
234
|
-
hint?: string;
|
|
235
|
-
diagnosticId?: string;
|
|
236
|
-
logPath?: string;
|
|
237
|
-
details?: Record<string, unknown>;
|
|
238
|
-
/** Additive retry and platform-support signals; absent when not derivable. */
|
|
239
|
-
retriable?: boolean;
|
|
240
|
-
supportedOn?: string;
|
|
241
|
-
};
|
|
242
|
-
declare class AppError extends Error {
|
|
243
|
-
code: AppErrorCode;
|
|
244
|
-
details?: AppErrorDetails;
|
|
245
|
-
cause?: unknown;
|
|
246
|
-
constructor(code: AppErrorCode, message: string, details?: AppErrorDetails, cause?: unknown);
|
|
247
|
-
}
|
|
248
|
-
declare function isAgentDeviceError(err: unknown): err is AppError;
|
|
249
|
-
declare function normalizeAgentDeviceError(err: unknown, context?: {
|
|
250
|
-
diagnosticId?: string;
|
|
251
|
-
logPath?: string;
|
|
252
|
-
}): NormalizedError;
|
|
253
|
-
declare function normalizeError(err: unknown, context?: {
|
|
254
|
-
diagnosticId?: string;
|
|
255
|
-
logPath?: string;
|
|
256
|
-
}): NormalizedError;
|
|
257
|
-
declare function defaultHintForCode(code: string): string | undefined;
|
|
258
|
-
//#endregion
|
|
259
296
|
//#region packages/kernel/src/contracts.d.ts
|
|
260
297
|
type SessionRuntimeHints = {
|
|
261
298
|
platform?: 'ios' | 'android';
|
|
@@ -367,4 +404,4 @@ type JsonRpcRequestEnvelope<TParams = unknown> = {
|
|
|
367
404
|
params?: TParams;
|
|
368
405
|
};
|
|
369
406
|
//#endregion
|
|
370
|
-
export {
|
|
407
|
+
export { AppError as A, DeviceTarget as B, SnapshotNode as C, SnapshotUnchanged as D, SnapshotState as E, normalizeAgentDeviceError as F, PlatformSelector as H, normalizeError as I, AppleOS as L, NormalizedError as M, defaultHintForCode as N, SnapshotVisibility as O, isAgentDeviceError as P, DeviceInfo as R, SnapshotBackend as S, SnapshotQualityVerdict as T, PublicPlatform as U, Platform as V, SessionRuntimeHints as _, DaemonRequest as a, Rect as b, DaemonServerMode as c, JsonRpcRequestEnvelope as d, LeaseBackend as f, SessionIsolationMode as g, ResponseLevel as h, DaemonLockPolicy as i, DaemonError as j, centerOfRect as k, DaemonTransportPreference as l, ResponseCost as m, DaemonArtifactType as n, DaemonResponse as o, NetworkIncludeMode as p, DaemonInstallSource as r, DaemonResponseData as s, DaemonArtifact as t, JsonRpcId as u, Point as v, SnapshotOptions as w, ScreenshotOverlayRef as x, RawSnapshotNode as y, DeviceKind as z };
|