agent-device 0.20.6 → 0.20.8
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 +3 -3
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.6.apk → agent-device-android-ime-helper-0.20.8.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.8.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.6.manifest.json → agent-device-android-ime-helper-0.20.8.manifest.json} +4 -4
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.6.apk → agent-device-android-snapshot-helper-0.20.8.apk} +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.8.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.6.manifest.json → agent-device-android-snapshot-helper-0.20.8.manifest.json} +6 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +20 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +67 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +339 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSelectorMatchPolicy.swift +78 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +31 -2
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +34 -8
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CoordinateTextEntryTests.swift +4 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +36 -28
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +7 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+RecordingTests.swift +4 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SelectorMatchPolicyTests.swift +4 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +2 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +100 -12
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +4 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +57 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +1 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +18 -3
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +2 -2
- 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 +7 -7
- package/dist/src/app-lifecycle2.js +2 -0
- package/dist/src/app-log-files.js +1 -0
- package/dist/src/app-log-reconnect.js +1 -0
- package/dist/src/app-log-runtime.js +4 -0
- package/dist/src/app-resolution.js +2 -1
- package/dist/src/apps.js +5 -5
- package/dist/src/audio-probe.js +1 -1
- package/dist/src/auth-session.js +1 -0
- package/dist/src/auth.js +2 -0
- package/dist/src/boot-diagnostics.js +2 -2
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-grammar.js +1 -0
- package/dist/src/cli-help.js +199 -259
- package/dist/src/cli-output.js +1 -0
- package/dist/src/cli-runner.js +1 -2
- package/dist/src/cli.js +6 -16
- package/dist/src/client-metro.js +1 -1
- package/dist/src/cloud-artifacts.d.ts +2 -137
- package/dist/src/command-schema.js +3 -3
- package/dist/src/connection-runtime.js +1 -0
- package/dist/src/connection.js +5 -0
- package/dist/src/daemon-shutdown-report.js +1 -0
- package/dist/src/daemon.js +2 -0
- package/dist/src/debug-symbols.js +1 -1
- package/dist/src/device-claim-inspection.js +1 -0
- package/dist/src/device-input-state.js +2 -2
- package/dist/src/device-ready.js +1 -0
- package/dist/src/device.js +1 -1
- package/dist/src/device2.js +2 -0
- package/dist/src/dispatch.js +1 -0
- 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/handler-utils.js +1 -0
- package/dist/src/harmonyos.js +1 -0
- package/dist/src/hdc.js +1 -0
- package/dist/src/host-process.js +3 -2
- package/dist/src/ime-lifecycle.js +7 -7
- package/dist/src/index.d.ts +52 -21
- package/dist/src/input-actions.js +4 -4
- package/dist/src/input-actions2.js +1 -1
- package/dist/src/input-actions3.js +1 -0
- package/dist/src/install-artifact.js +1 -5
- package/dist/src/install-artifact2.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-runtime.js +1 -1
- package/dist/src/interaction-snapshot.js +1 -1
- package/dist/src/interaction-touch-reference-frame.js +1 -1
- package/dist/src/interaction.js +1 -1
- package/dist/src/interactor.js +2 -2
- package/dist/src/interactor2.js +1 -1
- package/dist/src/internal/bin.js +2 -2
- package/dist/src/internal/daemon.js +7 -36
- package/dist/src/inventory.js +5 -0
- package/dist/src/inventory2.js +1 -0
- package/dist/src/inventory3.js +2 -0
- package/dist/src/inventory4.js +1 -0
- package/dist/src/inventory5.js +1 -0
- package/dist/src/inventory6.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 -0
- package/dist/src/limrun.d.ts +10 -125
- package/dist/src/limrun.js +1 -1
- package/dist/src/linux.js +1 -1
- package/dist/src/logcat.js +1 -1
- package/dist/src/manifest.js +1 -1
- package/dist/src/notifications.js +1 -1
- package/dist/src/output-path.js +1 -0
- package/dist/src/owner-identity.js +1 -0
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/platform-runtime-app-log-android-transport.js +1 -0
- package/dist/src/platform-runtime-app-log-process.js +1 -0
- package/dist/src/platform-runtime-host.js +1 -0
- package/dist/src/platform-runtime-network-web-transport.js +1 -0
- package/dist/src/platform-runtime-operation-host.js +5 -0
- package/dist/src/platform-runtime-screen-recording-android-host.js +1 -0
- package/dist/src/platform-runtime-screen-recording-apple-host.js +1 -0
- package/dist/src/platform-runtime-screen-recording-apple-runner-host.js +1 -0
- package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -0
- package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -0
- package/dist/src/platform-runtime-screen-recording-apple-transport.js +1 -0
- package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -0
- package/dist/src/platform-runtime-screen-recording-harmony-host.js +1 -0
- package/dist/src/platform-runtime-screen-recording-output-host.js +1 -0
- package/dist/src/platform-runtime-screen-recording-web-host.js +1 -0
- package/dist/src/platform-runtime-toolchain-host.js +1 -0
- package/dist/src/platform-runtime.js +1 -0
- package/dist/src/prepare-kind.js +15 -0
- package/dist/src/process-entry.js +1 -0
- package/dist/src/process-lock.js +1 -1
- package/dist/src/provider-webdriver.js +1 -0
- package/dist/src/proxy.js +2 -0
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-runtime.js +1 -0
- package/dist/src/record-trace.js +1 -1
- package/dist/src/recording-telemetry.js +1 -0
- package/dist/src/registry.js +24 -24
- package/dist/src/replay.js +3 -0
- package/dist/src/reporting.js +3 -3
- package/dist/src/runner-disposal.js +1 -1
- package/dist/src/runner-lease.js +1 -1
- package/dist/src/runtime.js +3 -3
- package/dist/src/runtime2.js +4 -0
- package/dist/src/runtime3.js +3 -0
- package/dist/src/runtime4.js +1 -0
- package/dist/src/runtime5.js +1 -0
- package/dist/src/runtime6.js +1 -0
- package/dist/src/runtime7.js +1 -0
- package/dist/src/screenshot-result.js +4 -4
- package/dist/src/screenshot.js +1 -0
- 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 +31 -5
- package/dist/src/sdk-contracts.js +1 -1
- package/dist/src/sdk-device.js +1 -1
- package/dist/src/sdk-finders.js +1 -1
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.d.ts +285 -5
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selector-vocabulary.js +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/server.js +3 -3
- package/dist/src/session-target-evidence.js +1 -1
- package/dist/src/session.js +10 -9
- package/dist/src/shared.js +2 -0
- package/dist/src/shell-quote.js +1 -0
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-runtime.js +1 -0
- package/dist/src/snapshot-session.js +1 -0
- package/dist/src/snapshot2.js +1 -1
- package/dist/src/src.js +1 -1
- package/dist/src/src2.js +2 -0
- package/dist/src/src3.js +1 -0
- package/dist/src/text-surface.js +1 -1
- package/dist/src/timing-safe-equal.js +1 -0
- package/dist/src/tool-provider.js +2 -2
- package/dist/src/update-check.js +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/video.js +23 -0
- package/dist/src/web.js +1 -1
- package/package.json +34 -20
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.6.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.6.apk.sha256 +0 -1
- package/dist/src/app-log-request-scope.js +0 -1
- package/dist/src/context.js +0 -1
- package/dist/src/devices.js +0 -1
- package/dist/src/devices2.js +0 -1
- package/dist/src/devices3.js +0 -1
- package/dist/src/devices4.js +0 -1
- package/dist/src/provider-limrun-runtime.js +0 -1
- package/dist/src/register-builtins.js +0 -1
- package/dist/src/runner-client.js +0 -1
- package/dist/src/runner-provider.js +0 -1
- package/dist/src/screenshot-geometry.js +0 -1
- package/dist/src/viewport-dimension.js +0 -15
- package/skills/agent-device/SKILL.md +0 -45
- package/skills/dogfood/SKILL.md +0 -27
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as e,a as t,i as n,u as r,v as i}from"./sdk-contracts.js";function
|
|
2
|
-
`).map(e=>e.trim()).filter(e=>e.length>0)}function
|
|
3
|
-
`],[`r`,`\r`],[`t`,` `]]);function S(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Selector expression cannot be empty`);let r=Ue(n);if(r.length===0)throw new e(`INVALID_ARGS`,`Selector expression cannot be empty`);return{raw:n,selectors:r.map(e=>Ve(e))}}function C(e){try{return S(e)}catch{return null}}function ze(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 Be(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=Ke(i).trim();return a?{key:r,value:a}:null}function w(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||!ze(t))break;r+=1;let n=e.slice(0,r).join(` `).trim();n&&C(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 Ve(t){let n=t.trim();if(!n)throw new e(`INVALID_ARGS`,`Selector segment cannot be empty`);let r=We(n);if(r.length===0)throw new e(`INVALID_ARGS`,`Invalid selector segment: ${t}`);return{raw:n,terms:r.map(He)}}function He(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(!Pe.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(Pe.has(i)){let t=Ye(a);if(t===null)throw new e(`INVALID_ARGS`,`Invalid boolean value for ${i}: ${a}`);return{key:i,value:t}}return{key:i,value:Ke(a)}}function Ue(t){let n=[],r=``,i=null;for(let a=0;a<t.length;a+=1){let o=t[a];if((o===`"`||o===`'`)&&!Xe(t,a)){i=Ge(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 We(t){let n=[],r=``,i=null;for(let e=0;e<t.length;e+=1){let a=t.charAt(e);if((a===`"`||a===`'`)&&!Xe(t,e)){i=Ge(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 Ge(e,t){return e?e===t?null:e:t}function Ke(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?qe(t.slice(1,-1)):t}function qe(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=Je(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 Je(e){return Re.get(e)??null}function Ye(e){let t=Ke(e).toLowerCase();return t===`true`?!0:t===`false`?!1:null}function Xe(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}const Ze=[`any`,`text`,`label`,`value`,`role`,`id`],Qe=[`text`,`label`,`value`,`role`,`id`];function $e(e){let t=e?.toLowerCase();return t===`press`||t===`tap`?`click`:t}function et(e){return e===`exists`||e===`wait`||e===`get_text`||e===`get_attrs`||e===`list`}function tt(e,t,n,r={}){let i=E(n);if(!i)return{matches:[],score:0};let a=0,o=[];for(let n of e){if(r.requireRect&&!n.rect)continue;let e=nt(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 nt(e,t,n){switch(t){case`role`:return rt(e.type,n);case`label`:return T(e.label,n);case`value`:return T(e.value,n);case`id`:return T(e.identifier,n);default:return Math.max(T(e.label,n),T(e.value,n),T(e.identifier,n))}}function T(e,t){let n=E(e??``);return n?n===t?2:+!!n.includes(t):0}function rt(e,t){let n=it(e??``);return n?n===t?2:+!!n.includes(t):0}function E(e){return e.trim().toLowerCase().replace(/\s+/g,` `)}function it(e){let t=e.trim();return t?(t=(t.split(`.`).pop()??t).replace(/XCUIElementType/gi,``).toLowerCase(),t):``}const at=`find requires a value`,ot=`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 st(e,t){if(e.length===0)return{ok:!1,code:`INVALID_ARGS`,message:`find requires a locator or text`};let n=D([...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:at}}const ct=[`exists`,`list`,`click`,`focus`];function lt(e){return ct.includes(e)}function D(t){let n=`any`,r=0;Qe.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=$e(a[0]);if(lt(o))return{locator:n,query:i,action:o};if(o===`get`)return{locator:n,query:i,action:ut(a[1])};if(o===`wait`){let e=ft(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:ot})}function ut(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 dt(e,t){return e!==`any`||!t.includes(`=`)&&!t.includes(`||`)?null:C(t)?t:null}function ft(e){if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}function O(e,t,n){return t.terms.every(t=>pt(e,t,n))}function pt(e,t,n){switch(t.key){case`id`:return k(e.identifier,String(t.value));case`role`:return k(_(e.type??``),String(t.value));case`label`:return k(e.label,String(t.value));case`value`:return k(e.value,String(t.value));case`text`:return k(v(e),String(t.value));case`appname`:return k(e.appName,String(t.value));case`windowtitle`:return k(e.windowTitle,String(t.value));case`visible`:return b(e)===!!t.value;case`hidden`:return!b(e)==!!t.value;case`editable`:return Me(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 k(e,t){return E(e??``)===E(t)}function A(e,t,n){let r=n.requireRect??!1,i=n.requireUnique??!0,a=[];for(let[o,s]of t.selectors.entries()){let t=vt(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 j(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:O(e,a,n.platform));if(t.length>0)return{selector:a,selectorIndex:i,matchedNodes:t}}return null}function mt(e,t,n){let r=n.requireRect??!1,i=[];for(let[a,o]of t.selectors.entries()){let t=St(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 ht=`Snapshot refs expire when the UI changes. Run snapshot -i and retry with a fresh @ref.`;function gt(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 _t(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 vt(e,t,n,r){let i=0,a=null,o=[],s={best:null,bestVisible:!1,tie:!1},c,l=t=>(c??=m(e),De(t,e,c));for(let c of e)r&&!c.rect||O(c,t,n)&&(i+=1,a??=c,o.push(c),yt(s,c,l));return{count:i,firstNode:a,disambiguated:s.tie?null:s.best,tiebreak:s.tie?null:bt(o,s.best,l),candidates:o}}function yt(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=Ct(t,e.best);i.result>0?(e.best=t,e.tie=!1):i.result===0&&(e.tie=!0)}function bt(e,t,n){if(!t)return null;let r=null;for(let i of e)i!==t&&(!r||xt(i,r,n).result>0)&&(r=i);return r?xt(t,r,n).criterion:null}function xt(e,t,n){let r=n(e);return r===n(t)?Ct(e,t):{result:r?1:-1,criterion:`visible`}}function St(e,t,n,r){let i=0;for(let a of e)r&&!a.rect||O(a,t,n)&&(i+=1);return i}function Ct(e,t){let n=e.depth??0,r=t.depth??0;if(n!==r)return{result:n>r?1:-1,criterion:`deepest`};let i=wt(e),a=wt(t);return i===a?{result:0,criterion:null}:{result:i<a?1:-1,criterion:`smallest-area`}}function wt(e){return e.rect?e.rect.width*e.rect.height:1/0}function Tt(e,t,n,r){let i={...r,requireRect:n.requireRect};if(n.ambiguity===`reject-candidates`){let n=j(e,t,i);return!n||n.matchedNodes.length===0?{kind:`none`}:n.matchedNodes.length>1?{kind:`ambiguous`,selector:n.selector.raw,selectorIndex:n.selectorIndex,matchedNodes:n.matchedNodes}:Et(n)}if(n.ambiguity===`first-match`){let n=j(e,t,i);return!n||n.matchedNodes.length===0?{kind:`none`}:Et(n)}let a=A(e,t,{...i,requireUnique:!0,disambiguateAmbiguous:n.ambiguity===`disambiguate`});if(a)return{kind:`resolved`,resolution:a,matchedNodes:j(e,t,i)?.matchedNodes??[a.node]};let o=j(e,t,i);return!o||o.matchedNodes.length===0?{kind:`none`}:{kind:`ambiguous`,selector:o.selector.raw,selectorIndex:o.selectorIndex,matchedNodes:o.matchedNodes}}function Et(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 M(e,t){return{ok:!1,code:`INVALID_ARGS`,message:e,...t?{hint:t}:{}}}function Dt(e){return[`visible`,`hidden`,`exists`,`editable`,`selected`,`focused`,`text`].includes(e)}function Ot(e){let t=e.toLowerCase();return Dt(t)?{ok:!0,predicate:t}:M(`is requires predicate: visible|hidden|exists|editable|selected|focused|text`,kt)}const kt=`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 At(e){if(Dt((e[0]??``).toLowerCase()))return e;for(let t=1;t<e.length;t+=1){let n=(e[t]??``).toLowerCase();if(Dt(n)&&C(e.slice(0,t).join(` `)))return[n,...e.slice(0,t),...e.slice(t+1)]}return e}function jt(e){let{predicate:t,node:n,nodes:r,expectedText:i,platform:a}=e,o=v(n),s=Me(n,a),c=n.selected===!0,l=n.focused===!0,u=t===`text`?b(n):Mt(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 ee=t===`text`?`expected="${i??``}" actual="${o}"`:`actual=${JSON.stringify({visible:u,editable:s,selected:c,focused:l})}`;return{pass:d,actualText:o,details:ee}}function Mt(e,t,n){if(n===`android`&&e.visibleToUser===!1)return!1;if(h(e.rect))return Nt(e,t);if(e.rect)return!1;if(n!==`android`&&e.hittable===!0)return!0;let r=Pt(e,t,n);return r?h(r.rect)?Nt(r,t):n!==`android`&&r.hittable===!0:!1}function Nt(e,t){return Ee(e,t)}function Pt(e,t,n){return _e(t,e,m(t),e=>je(e,n)?e:null)}function Ft(e){let t=At(e),n=t[0]??``;return{predicate:n,split:w(t.slice(1),{preferTrailingValue:n===`text`})}}const It=`is requires a selector expression`,Lt=`is text requires expected text value`;function Rt(e){let{predicate:t,split:n}=Ft([...e]),r=Ot(t);if(!r.ok)return r;if(!n)return M(It);let i=n.rest.join(` `).trim();return r.predicate===`text`&&!i?M(Lt):r.predicate!==`text`&&n.rest.length>0?M(`is ${r.predicate} does not accept trailing values`):{ok:!0,predicate:r.predicate,selectorExpression:n.selectorExpression,expectedText:i}}function zt(e){return e===`text`||e===`attrs`?{ok:!0,format:e}:M(`get only supports text or attrs`)}function Bt(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}:M(`get requires @ref or selector expression`)}function Vt(e){return e?{ok:!0,text:e}:M(`wait requires text`)}function Ht(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 Ut(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 Wt=/^#\s*agent-device:target-v(\d+)(?:\s+(\S.*))?$/,Gt=/^#\s*agent-device:targets-v(\d+)(?:\s+(\S.*))?$/,Kt=4096;function qt(e){return e.normalize(`NFC`)}function Jt(e){if(e===void 0)return;let t=qt(e);return t.length>0?t:void 0}function Yt(e){return qt(e)}function Xt(e){if(e===void 0)return;let t=qt(e).trim().replace(/\s+/g,` `);return t.length>0?t:void 0}function N(e){return Buffer.byteLength(e,`utf8`)}function Zt(e,t){if(N(e)<=t)return e;let n=e.length;for(;n>0&&N(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 Qt(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($t),t.sibling=e.sibling,t.viewportOrder=e.viewportOrder,e.scrollRegion&&(t.scrollRegion=en(e.scrollRegion)),e.rect&&(t.rect=tn(e.rect)),t.verification=e.verification,t}function $t(e){let t={role:e.role};return e.label!==void 0&&(t.label=e.label),t}function en(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 tn(e){return{x:e.x,y:e.y,width:e.width,height:e.height}}function nn(e){return JSON.stringify(Qt(e))}function rn(e){return`# agent-device:target-v1 ${nn(e)}`}function an(e){return JSON.stringify({source:Qt(e.source),destination:Qt(e.destination)})}function on(e){return`# agent-device:targets-v1 ${an(e)}`}function sn(e){let t=e.trim(),n=Gt.exec(t);return n?Number(n[1])===1?{kind:`v1`,evidence:cn((n[2]??``).trim())}:{kind:`future-version`}:{kind:`none`}}function cn(t){if(N(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:un(JSON.stringify(r.source)),destination:un(JSON.stringify(r.destination))}}function ln(e){let t=e.trim();if(!t.startsWith(`#`))return{kind:`none`};let n=Wt.exec(t);return n?Number(n[1])===1?{kind:`v1`,evidence:un((n[2]??``).trim())}:{kind:`future-version`}:{kind:`none`}}function un(t){if(N(t)>4096)throw new e(`INVALID_ARGS`,`target-v1 annotation exceeds the ${Kt}-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=dn(r.role,`role`),a=fn(r.id,`id`),o=pn(r.label,`label`),s=hn(r.ancestry),c=_n(r.sibling,`sibling`,0),l=_n(r.viewportOrder,`viewportOrder`,0),u=vn(r.scrollRegion),d=yn(r.rect),ee=bn(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:ee}}function dn(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 mn(Yt(t),n)}function fn(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:mn(r,n)}function pn(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=Xt(t);return r===void 0?void 0:mn(r,n)}function mn(t,n){if(N(t)>256)throw new e(`INVALID_ARGS`,`target-v1 "${n}" exceeds the 256-byte field cap.`);return t}function hn(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)=>gn(e,t))}function gn(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=dn(r.role,`ancestry[${n}].role`),a=pn(r.label,`ancestry[${n}].label`);return{role:i,...a===void 0?{}:{label:a}}}function _n(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 vn(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=dn(n.role,`scrollRegion.role`),i=fn(n.id,`id`),a=pn(n.label,`scrollRegion.label`);return{role:r,...i===void 0?{}:{id:i},...a===void 0?{}:{label:a}}}function yn(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:P(n.x,`rect.x`),y:P(n.y,`rect.y`),width:P(n.width,`rect.width`),height:P(n.height,`rect.height`)}}function P(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 bn(t){if(t===`verified`||t===`unverifiable`)return t;throw new e(`INVALID_ARGS`,`target-v1 "verification" must be "verified" or "unverifiable".`)}function xn(e){let t=Yt(_(e.type??``)),n=Jt(e.identifier),r=Xt(e.label);return{...n===void 0?{}:{id:Zt(n,256)},role:Zt(t,256),...r===void 0?{}:{label:Zt(r,256)}}}function Sn(e,t){return e.id===t.id&&e.role===t.role&&e.label===t.label}function Cn(e,t){let n=0;for(let r of e)xn(r).id===t&&(n+=1);return n}function wn(e,t){if(e.id===void 0||Cn(t,e.id)<=1)return e;let{role:n,label:r}=e;return{role:n,...r===void 0?{}:{label:r}}}function Tn(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 En(e,t){return{documentOrder:e.index,sibling:Tn(t,e)}}function Dn(e,t){return e.documentOrder===t.documentOrder&&e.sibling===t.sibling}function On(e){return{...e.id===void 0?{}:{id:e.id},role:e.role,...e.label===void 0?{}:{label:e.label}}}function kn(e,t){return t.id===void 0?e.role===t.role&&e.label===t.label:e.id===t.id}function An(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 jn(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 Nn(e,t){return!t||t.role!==e.role?!0:e.label!==void 0&&t.label!==e.label}function Pn(e,t){for(let[n,r]of e.entries()){let e=t[n];if(Nn(r,e))return[`ancestry[${n}]: recorded=${Mn(r)} observed=${Mn(e)}`]}return[]}function Fn(e,t,n={}){let r=[],i=_(e.type??``),a=In(e,n.nodes),o=I(e.label),s=I(e.value),c=I(v(e)),l=n.action===`fill`;a&&r.push(`id=${F(a)}`),i&&o&&r.push(l?`role=${F(i)} label=${F(o)} editable=true`:`role=${F(i)} label=${F(o)}`),o&&r.push(l?`label=${F(o)} editable=true`:`label=${F(o)}`),s&&r.push(l?`value=${F(s)} editable=true`:`value=${F(s)}`),c&&c!==o&&c!==s&&r.push(l?`text=${F(c)} editable=true`:`text=${F(c)}`),i&&l&&!r.some(e=>e.includes(`editable=true`))&&r.push(`role=${F(i)} editable=true`);let u=Ln(r);return u.length===0&&i&&u.push(l?`role=${F(i)} editable=true`:`role=${F(i)}`),u.length===0&&b(e)&&u.push(`visible=true`),u}function In(e,t){let n=I(e.identifier);if(!n||!t)return n;let r=xn(e).id;return r===void 0?n:Cn(t,r)>1?null:n}function Ln(e){return Array.from(new Set(e))}function F(e){return JSON.stringify(e)}function I(e){return e&&e.trim()||null}function Rn(e,t){let n=e===`is`?Ft([...t]).split:w([...t]);return n?C(n.selectorExpression)?{kind:`expression`,expression:n.selectorExpression,rest:n.rest}:{kind:`invalid`}:{kind:`not-applicable`}}function zn(e,t,n){let r=C(e);if(!r)return{kind:`unresolved`,reason:`parse-invalid`,matchedNodes:[]};let i=A(t,r,{platform:n.platform,requireRect:n.requireRect,requireUnique:!0,disambiguateAmbiguous:n.allowDisambiguation});if(i){let e=t.filter(e=>n.requireRect&&!e.rect?!1:O(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=j(t,r,{platform:n.platform,requireRect:n.requireRect})?.matchedNodes??[];return{kind:`unresolved`,reason:a.length>0?`ambiguous`:`no-match`,matchedNodes:a}}function Bn(e,t,n={}){return Fn(e,t,n)}function Vn(e,t,n){let r=C(e);if(!r)return;let i=A(t,r,{platform:n.platform,requireRect:n.requireRect,requireUnique:!0,disambiguateAmbiguous:n.allowDisambiguation});if(i)return{node:i.node,basis:Un(i.selector)}}function Hn(e){if(!e)return;let t=C(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 Un(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`}const Wn={act:{ambiguity:`disambiguate`,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 Gn(e){return e.ambiguity===`first-match`?{requireRect:e.requireRect,requireUnique:!1}:{requireRect:e.requireRect,requireUnique:!0,disambiguateAmbiguous:e.ambiguity===`disambiguate`}}function Kn(e,t){let n=C(e);if(!n)return e.includes(`=`)||e.includes(`||`)?null:e;let r=new Set(t.textKeys);return n.selectors.length>1?qn(n.selectors,r):Jn(n.selectors[0],r,new Set(t.booleanKeys))}function qn(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 Jn(e,t,n){if(!e)return null;let r={},i=0;for(let a of e.terms){if(Yn(a,t,`string`))i+=1;else if(!Yn(a,n,`boolean`))return null;r[a.key]=a.value}return i<=1&&Object.keys(r).length>0?r:null}function Yn(e,t,n){return t.has(e.key)&&typeof e.value===n}function Xn(e){let t=C(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 Zn(e,t){if(!t)return!1;let n=C(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 Qn(e){return S(e).selectors.map(e=>e.raw)}function $n(e){return C(e)!==null}function er(e,t,n){let r=mt(e,S(t),n);return r?{...r,selector:r.selector.raw}:null}function tr(e,t,n){let r=j(e,S(t),n);return r?{...r,selector:r.selector.raw}:null}function nr(e,t,n){let r=A(e,S(t),n);return r?{...r,selector:r.selector.raw}:null}function rr(e,t,n,r){let i=Tt(e,S(t),n,r);return i.kind===`resolved`?{...i,resolution:{...i.resolution,selector:i.resolution.selector.raw}}:i}function L(e){if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}function ir(e){let t=e[0];if(t===void 0)return null;let n=L(t);if(n!==null)return{kind:`sleep`,durationMs:n};let r=L(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?L(t[1]):null;return{kind:`stable`,quietMs:t.length>0?L(t[0]):null,timeoutMs:n}}if(t.startsWith(`@`))return{kind:`ref`,rawRef:t,timeoutMs:r};let i=w(r===null?e.slice():e.slice(0,-1));return i&&i.rest.length===0&&$n(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 ar(e){let t=ir(e);return t?t.kind===`sleep`?t.durationMs:t.timeoutMs:null}const or=24e4,R={budget:{source:`none`},envelopeMs:9e4,onTimeout:`reset-daemon`},sr={click:`settle-and-verify`,press:`settle-and-verify`,fill:`settle-and-verify`,longpress:`settle`,scroll:`settle`,back:`settle`};function cr(e){if(e!==void 0)return sr[e]}const z={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0},B={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0,selectorValidationExempt:!0},lr=()=>!0,ur=e=>(e.positionals?.[0]??``).toLowerCase()===`start`,dr=e=>e.command===`test`&&(typeof e.flags?.shardAll==`number`||typeof e.flags?.shardSplit==`number`),fr=new Set([`status`,`get`]),pr=e=>yr(e,fr,`status`),mr=new Set([`get`,`wait`]),hr=e=>yr(e,mr,`get`),gr=e=>br(e,fr,`status`),_r=e=>br(e,mr,`get`),vr=e=>{try{return et(D(e.positionals??[]).action)?`observes-app`:`mutates-app`}catch{return`mutates-app`}};function yr(e,t,n){return t.has((e.positionals?.[0]??n).toLowerCase())?`preserve`:`may-invalidate`}function br(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},U={emulator:!0},W={device:!0},G={},K={apple:V,android:H,linux:W},xr={...K,vega:U},Sr={apple:V,android:H,linux:G},Cr={apple:V,android:H,linux:G},q={recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:V,android:H,linux:W},timeoutPolicy:R,batchable:!0},J={...R,onTimeout:`preserve-daemon`},Y={...R,envelopeMs:18e4},wr={...R,budget:{source:`flag`,envelope:`widen`,defaultBudgetMs:1e4},onTimeout:`preserve-daemon`},Tr={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}}},Er={fields:{delayMs:{defaultValue:0}}};function X(e,t){return cr(e)===void 0?t:wr}function Z(e){let t=cr(e);if(t===void 0)throw Error(`Missing post-action observation descriptor support for ${e}`);return t}const Dr=[{name:`lease_allocate`,catalog:{group:`internal`,key:`leaseAllocate`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...z},timeoutPolicy:R,batchable:!1},{name:`lease_heartbeat`,catalog:{group:`internal`,key:`leaseHeartbeat`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...z},timeoutPolicy:R,batchable:!1},{name:`lease_release`,catalog:{group:`internal`,key:`leaseRelease`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...z},timeoutPolicy:R,batchable:!1},{name:`artifacts`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`lease`,refFrameEffect:`preserve`,...z},timeoutPolicy:R,batchable:!1},{name:`session_list`,catalog:{group:`internal`,key:`sessionList`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,...B},timeoutPolicy:R,batchable:!1},{name:`session_save_script`,catalog:{group:`internal`,key:`sessionSaveScript`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`publication`},timeoutPolicy:R,batchable:!1},{name:`devices`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,...B},timeoutPolicy:R,batchable:!0},{name:`capabilities`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0,...B},timeoutPolicy:R,batchable:!0},{name:`doctor`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,allowSessionlessDefaultDevice:lr,...B},timeoutPolicy:R,batchable:!0},{name:`apps`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`inventory`,lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0},capability:Sr,timeoutPolicy:R,batchable:!0},{name:`boot`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`may-invalidate`,sessionKind:`state`},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,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:G},timeoutPolicy:R,batchable:!0},{name:`appstate`,catalog:{group:`public`,key:`appState`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`state`},timeoutPolicy:R,batchable:!0},{name:`perf`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`logs`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`events`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`,allowInvalidRecording:!0,...B},timeoutPolicy:R,batchable:!1},{name:`network`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`audio`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,sessionKind:`observability`},capability:{apple:V,android:{emulator:!0},linux:G},timeoutPolicy:R,batchable:!0},{name:`replay`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`,sessionKind:`replay`,skipSessionlessProviderDevice:dr,saveScriptFlagOwner:!0},timeoutPolicy:{...R,budget:{source:`flag`}},batchable:!1},{name:`test`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`,sessionKind:`replay`,skipSessionlessProviderDevice:dr},timeoutPolicy:{...R,envelopeMs:`unbounded`},batchable:!0},{name:`runtime`,catalog:{group:`internal`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`},timeoutPolicy:R,batchable:!1},{name:`clipboard`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`session`,refFrameEffect:`preserve`},dispatch:{},capability:{apple:V,android:H,linux:W},timeoutPolicy:R,batchable:!0},{name:`keyboard`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:gr,daemon:{route:`session`,refFrameEffect:pr,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`install`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},capability:Cr,timeoutPolicy:Y,batchable:!0},{name:`reinstall`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},capability:Cr,timeoutPolicy:Y,batchable:!0},{name:`install_source`,catalog:{group:`internal`,key:`installSource`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},timeoutPolicy:Y,batchable:!1},{name:`release_materialized_paths`,catalog:{group:`internal`,key:`releaseMaterializedPaths`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`,...B},timeoutPolicy:R,batchable:!1},{name:`push`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:{simulator:!0},android:H,linux:G},timeoutPolicy:R,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:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`open`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`,allowSessionlessDefaultDevice:lr,saveScriptFlagOwner:!0},dispatch:{},capability:xr,timeoutPolicy:R,batchable:!0},{name:`prepare`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`preserve`},capability:{apple:V,android:{},linux:G},timeoutPolicy:{budget:{source:`flag`},envelopeMs:or,onTimeout:`reset-daemon`},batchable:!1,mcpExposed:!1},{name:`batch`,catalog:{group:`public`},recordsSessionAction:!1,daemon:{route:`session`,refFrameEffect:`delegated`},timeoutPolicy:R,batchable:!1},{name:`close`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`session`,refFrameEffect:`may-invalidate`,allowInvalidRecording:!0,saveScriptFlagOwner:!0},dispatch:{},capability:xr,timeoutPolicy:R,batchable:!0},{name:`snapshot`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},dispatch:{},capability:K,timeoutPolicy:{...J,budget:{source:`flag`}},batchable:!0},{name:`diff`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},capability:K,timeoutPolicy:R,batchable:!0},{name:`wait`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,targetIdentityVerification:`post-resolution`,daemon:{route:`snapshot`,refFrameEffect:`preserve`},capability:K,timeoutPolicy:{...J,budget:{source:`positional-parser`,parser:ar}},batchable:!0},{name:`alert`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:_r,daemon:{route:`snapshot`,refFrameEffect:hr},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`settings`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`snapshot`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`react-native`,catalog:{group:`public`,key:`reactNative`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`reactNative`,refFrameEffect:`may-invalidate`},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`record`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`recordTrace`,refFrameEffect:`preserve`,allowInvalidRecording:!0,allowSessionlessDefaultDevice:ur},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`trace`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`recordTrace`,refFrameEffect:`preserve`},timeoutPolicy:R,batchable:!0},{name:`find`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:vr,daemon:{route:`find`,refFrameEffect:`may-invalidate`},capability:K,timeoutPolicy:J,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:V,android:H,linux:W},timeoutPolicy:X(`click`,J),postActionObservation:Z(`click`),responseDataTransform:Tr,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:V,android:H,linux:W},timeoutPolicy:X(`fill`,J),postActionObservation:Z(`fill`),responseDataTransform:Er,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:V,android:H,linux:W},timeoutPolicy:{...wr,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:V,android:H,linux:W},timeoutPolicy:X(`press`,J),postActionObservation:Z(`press`),responseDataTransform:Tr,batchable:!0},{name:`type`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:K,timeoutPolicy:X(`type`,J),batchable:!0},{name:`get`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`interaction`,refFrameEffect:`preserve`},capability:K,timeoutPolicy:X(`get`,J),batchable:!0},{name:`read`,catalog:{group:`dispatch-alias`},recordsSessionAction:!1,dispatch:{},timeoutPolicy:R,batchable:!1},{name:`is`,targetIdentityVerification:`pre-dispatch`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`interaction`,refFrameEffect:`preserve`},capability:K,timeoutPolicy:X(`is`,J),batchable:!0},{name:`back`,catalog:{group:`public`},...q,capability:{...q.capability,vega:U},timeoutPolicy:X(`back`,R),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:K,timeoutPolicy:R,batchable:!0},{name:`home`,catalog:{group:`public`},...q,capability:{...q.capability,vega:U}},{name:`tv-remote`,catalog:{group:`public`,key:`tvRemote`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:V,android:H,vega:U,linux:G},timeoutPolicy:R,batchable:!0},{name:`orientation`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},dispatch:{},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`scroll`,catalog:{group:`public`},...q,timeoutPolicy:X(`scroll`,R),postActionObservation:Z(`scroll`)},{name:`swipe`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`interaction`,refFrameEffect:`may-invalidate`,androidBlockingDialogGuard:!0},capability:{apple:V,android:H,linux:W},timeoutPolicy:R,batchable:!0},{name:`focus`,catalog:{group:`public`},...q},{name:`screenshot`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`observes-app`,daemon:{route:`generic`,refFrameEffect:`preserve`},dispatch:{},capability:K,timeoutPolicy:R,batchable:!0},{name:`viewport`,catalog:{group:`public`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:{},android:{},linux:G},timeoutPolicy:R,batchable:!1},{name:`app-switcher`,catalog:{group:`public`,key:`appSwitcher`},recordsSessionAction:!0,recordingEffect:`mutates-app`,daemon:{route:`generic`,refFrameEffect:`may-invalidate`},dispatch:{},capability:{apple:V,android:H,linux:G},timeoutPolicy:R,batchable:!0},{name:`install-from-source`,catalog:{group:`public`,key:`installFromSource`},recordsSessionAction:!0,recordingEffect:`mutates-app`,capability:Cr,timeoutPolicy:R,batchable:!0},{name:`debug`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1},{name:`daemon`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1},{name:`device`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1},{name:`metro`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1},{name:`session`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1},{name:`cdp`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1},{name:`auth`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1},{name:`connect`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1},{name:`connection`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1},{name:`disconnect`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1},{name:`mcp`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1},{name:`proxy`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1},{name:`react-devtools`,catalog:{group:`local-cli`,key:`reactDevtools`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1},{name:`web`,catalog:{group:`local-cli`},recordsSessionAction:!1,timeoutPolicy:R,batchable:!1,mcpExposed:!1}],Or=new Set([`public`,`local-cli`]),kr=new Set(Dr.filter(e=>Or.has(Fr(e))).map(e=>e.name)),Q=Dr.map(e=>({...e,mcpExposed:Nr(e)}));function Ar(e){return Q.filter(t=>Fr(t)===e).map(e=>[Ir(e),e.name])}function jr(){return Q.filter(e=>Pr(e)).map(e=>e.name).sort()}const $=new Map(Q.map(e=>[e.name,e]));function Mr(e){return kr.has(e)}function Nr(e){return e.mcpExposed??kr.has(e.name)}function Pr(e){return e.mcpExposed&&Mr(e.name)}function Fr(e){return e.catalog.group}function Ir(e){return e.catalog.key??e.name}const Lr=new Map(Q.map(e=>[e.name,e.timeoutPolicy])),Rr=new Map(Array.from($.values()).flatMap(e=>e.responseDataTransform?[[e.name,e.responseDataTransform]]:[]));function zr(e){if(e!==void 0)return $.get(e)?.postActionObservation}function Br(e){return zr(e)!==void 0}function Vr(e){return zr(e)===`settle-and-verify`}function Hr(e){return e===void 0?R:Lr.get(e)??R}function Ur(e){if(e!==void 0)return Rr.get(e)}function Wr(e){return e===void 0?!1:$.get(e)?.recordsSessionAction??!1}function Gr(e){return $.get(e)?.targetIdentityVerification}function Kr(e){let t=$.get(e.command);if(t?.recordsSessionAction)return typeof t.recordingEffect==`function`?t.recordingEffect(e):t.recordingEffect}function qr(){return[...new Set(Array.from(Rr.values()).flatMap(e=>Object.keys(e.fields)))].sort()}function Jr(e){return Number.isInteger(e)&&e>=1&&e<=1e3}function Yr(t,n){if(t>n)throw new e(`INVALID_ARGS`,`batch has ${t} steps; max allowed is ${n}.`)}function Xr(t,n){if(!a(t))throw new e(`INVALID_ARGS`,`Invalid batch step ${n}.`);return t}function Zr(t,n){let r=t.input;if(!a(r))throw new e(`INVALID_ARGS`,`Batch step ${n} input must be an object.`);return r}function Qr(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 $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 ei(e){let t=e.trim().split(`:`)[0]?.toLowerCase();return t===`http`||t===`https`}function ti(e,t){let n=e?.trim();if(n)return n;if(ei(t))return`com.apple.mobilesafari`}function ni(e){let t=[];for(let n of e)n.daemon&&t.push({command:n.name,...n.daemon,replayScopedAction:n.recordsSessionAction});return t}function ri(e){let t={};for(let n of e)n.capability&&(t[n.name]=n.capability);return t}function ii(e){return e.filter(e=>e.batchable).map(e=>e.name)}const ai=ii(Q),oi=new Set([`batch`,`replay`]),si=[`command`,`positionals`,`input`,`flags`,`runtime`],ci=[`platform`,`target`,`device`,`udid`,`serial`,`verbose`,`out`],li=new Set(ai);function ui(e){return li.has(e)}function di(e){return typeof e==`string`?e.trim().toLowerCase():``}function fi(t,n){let r=di(t);if(ui(r))return r;throw new e(`INVALID_ARGS`,`Batch step ${n} command is not available through command batch: ${String(t)}`)}function pi(t,n){if(oi.has(t))throw new e(`INVALID_ARGS`,`Batch step ${n} cannot run ${t}.`)}const mi=new Set(si);async function hi(e,t,n){let r=Si(e.flags),a=r?.batchOnError??`stop`;if(a!==`stop`)return Ci(`INVALID_ARGS`,`Unsupported batch on-error mode: ${a}.`);let o=r?.batchMaxSteps??100;if(!Jr(o))return Ci(`INVALID_ARGS`,`Invalid batch max-steps: ${String(r?.batchMaxSteps)}`);try{let i=gi(r?.batchSteps,o),a=Date.now(),s=[];for(let[r,a]of i.entries()){let o=await xi(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 Ci(t.code,t.message,t.details)}}function gi(t,n){if(!Array.isArray(t)||t.length===0)throw new e(`INVALID_ARGS`,`batch requires a non-empty batchSteps array.`);Yr(t.length,n);let r=[];for(let n=0;n<t.length;n+=1){let i=t[n];if(!p(i))throw new e(`INVALID_ARGS`,`Invalid batch step at index ${n}.`);let a=Object.keys(i).filter(e=>!mi.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=di(i.command);if(!o)throw new e(`INVALID_ARGS`,`Batch step ${n+1} requires command.`);if(pi(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&&!p(i.flags))throw new e(`INVALID_ARGS`,`Batch step ${n+1} flags must be an object.`);if(i.input!==void 0&&!p(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:Qr(i.runtime,n+1)})}return r}function _i(e,t){let{batchSteps:n,batchOnError:r,batchMaxSteps:i,...a}=t??{};return vi(Si(e),a)}function vi(e,t){let n=Si(e)??{},r=t;for(let e of ci)r[e]===void 0&&n[e]!==void 0&&(r[e]=n[e]);return t}function yi(e,n){return t(e)?n?e:`digest`:e}function bi(e,t){let n=e?.responseLevel,r=yi(n,t);return r===n?e:{...e,responseLevel:r}}async function xi(e,t,n,r,i,a){let o=Date.now(),s=_i(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:bi(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 Si(e){return e}function Ci(e,t,n){return{ok:!1,error:{code:e,message:t,...n?{details:n}:{}}}}export{kn as $,Ce as $t,$n as A,st as At,Bn as B,S as Bt,Ur as C,me as Cn,mt as Ct,ir as D,Ze as Dt,or as E,gt as Et,nr as F,dt as Ft,Fn as G,Ae as Gt,Rn as H,C as Ht,rr as I,Fe as It,wn as J,Oe as Jt,I as K,Ee as Kt,Zn as L,Be as Lt,Kn as M,et as Mt,Qn as N,$e as Nt,L as O,at as Ot,Xn as P,D as Pt,An as Q,y as Qt,Wn as R,Le as Rt,Wr as S,l as Sn,ht as St,Gr as T,a as Tn,A as Tt,zn as U,Me as Ut,Hn as V,w as Vt,Vn as W,b as Wt,jn as X,we as Xt,Pn as Y,je as Yt,Sn as Z,ke as Zt,Vr as _,d as _n,Rt as _t,ri as a,ye as an,on as at,jr as b,ee as bn,jt as bt,ei as c,_e as cn,ln as ct,Jr as d,fe as dn,Ht as dt,_ as en,xn as et,Qr as f,de as fn,Ut as ft,Br as g,re as gn,zt as gt,Q as h,ie as hn,Bt as ht,fi as i,g as in,Kt as it,tr as j,tt as jt,er as k,ot as kt,ti as l,ge as ln,nn as lt,Xr as m,ae as mn,It as mt,hi as n,h as nn,Tn as nt,ni as o,ve as on,rn as ot,Zr as p,p as pn,Lt as pt,On as q,De as qt,ai as r,xe as rn,Dn as rt,$r as s,m as sn,sn as st,vi as t,be as tn,En as tt,Yr as u,he as un,N as ut,qr as v,u as vn,Vt as vt,Hr as w,pe as wn,_t as wt,Kr as x,te as xn,At as xt,Ar as y,ne as yn,Ot as yt,Gn as z,ze as zt};
|
|
1
|
+
import{_ as e,a as t,i as n,u as r,v as i}from"./sdk-contracts.js";import{c as a,d as o,l as s,n as c,s as l,x as u}from"./sdk-device.js";function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(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 f(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 f(e,t,fe,`Daemon response is missing numeric "${t}".`)}function oe(e,t){return f(e,t,pe,`Daemon response has invalid "${t}".`)}function se(e,t){return f(e,t,me,`Daemon response has invalid "${t}".`)}function ce(e,t){return ee(e,t,he)??`mobile`}function le(e){if(!m(e))return;let t=p(e,`x`),n=p(e,`y`),r=p(e,`width`),i=p(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(!m(e))return;let t=p(e,`x`),n=p(e,`y`);if(!(t===void 0||n===void 0))return{x:t,y:n}}function p(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(!m(t))throw new e(`COMMAND_FAILED`,`Daemon returned an unexpected response shape.`,{value:t});return t}function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _e(e){return m(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 be(e){let t=`${e??``}`.toLowerCase();return t.includes(`scroll`)||t.includes(`recyclerview`)||t.includes(`listview`)||t.includes(`gridview`)||t.includes(`collectionview`)||t===`table`}function xe(e){return be(e.type)?!0:`${e.role??``} ${e.subrole??``}`.toLowerCase().includes(`scroll`)}function h(e){return new Map(e.map(e=>[e.index,e]))}function Se(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 g(e){return!!(e&&[e.x,e.y,e.width,e.height].every(Number.isFinite)&&e.width>0&&e.height>0)}function Ce(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 we(e){return e.width*e.height}function Te(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Ee(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 De(e,t){return Oe(e.x,e.x+e.width,t.x,t.x+t.width)&&Oe(e.y,e.y+e.height,t.y,t.y+t.height)}function Oe(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function _(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 ke(e,t){let n=_(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 Ae(e){return[e.label,e.value,e.identifier].map(e=>typeof e==`string`?e.trim():``).filter(e=>e.length>0)[0]??``}function je(e){let t=[e.type,e.role,e.subrole].map(e=>_(e??``)).join(` `);return t.includes(`application`)||t.includes(`window`)}function Me(e,t){let n=r(t),i=e.flatMap(e=>Ne(e.rect)?[{node:e,rect:e.rect}]:[]),a=i.filter(e=>je(e.node)).map(e=>e.rect),o=e=>Te(e,n.x,n.y);return Ee(a.filter(o))??Ee(a)??Ee(i.map(e=>e.rect).filter(o))}function Ne(e){return e?Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.width)&&Number.isFinite(e.height):!1}function Pe(e,t,n=h(t)){if(!e.rect)return!0;let r=Le(e,t,n);return r?De(e.rect,r):!0}function Fe(e,t,n=h(t)){if(!e.rect)return!0;if(!Pe(e,t,n))return!1;let r=Me(t,e.rect);return Ie(e.rect,r)}function Ie(e,t){return!t||t.width<=0||t.height<=0?!0:Te(t,e.x+e.width/2,e.y+e.height/2)}function Le(e,t,n=h(t)){return Re(e,n,e=>!!e.rect)?.rect||Me(t,e.rect??{x:0,y:0,width:0,height:0})}function Re(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)&&xe(r))return r;r=typeof r.parentIndex==`number`?t.get(r.parentIndex):void 0}return null}function ze(e,t){if(t===`android`&&e.visibleToUser===!1)return!1;let n=_(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&&g(e.rect):e.hittable===!0||g(e.rect)}function v(e){return e.hittable===!0?!0:e.rect?e.rect.width>0&&e.rect.height>0:!1}function Be(e,t){return ke(e.type??``,t)&&e.enabled!==!1}const Ve=new Set([`id`,`role`,`text`,`label`,`value`,`appname`,`windowtitle`]),He=new Set([`visible`,`hidden`,`editable`,`selected`,`focused`,`enabled`,`hittable`]),y=new Set([...Ve,...He]),Ue=[...y],We=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 Ge(e){return We.has(e.trim().toLowerCase())}const Ke=new Map([[`"`,`"`],[`'`,`'`],[`\\`,`\\`],[`/`,`/`],[`b`,`\b`],[`f`,`\f`],[`n`,`
|
|
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,11 +1,11 @@
|
|
|
1
1
|
//#region packages/kernel/src/device.d.ts
|
|
2
2
|
declare const APPLE_OS_VALUES: readonly ['ios', 'ipados', 'tvos', 'watchos', 'visionos', 'macos'];
|
|
3
3
|
type AppleOS = (typeof APPLE_OS_VALUES)[number];
|
|
4
|
-
declare const PLATFORMS: readonly ['apple', 'android', 'vega', 'linux', 'web'];
|
|
4
|
+
declare const PLATFORMS: readonly ['apple', 'android', 'harmonyos', 'vega', 'linux', 'web'];
|
|
5
5
|
type Platform = (typeof PLATFORMS)[number];
|
|
6
|
-
declare const PUBLIC_PLATFORMS: readonly ['ios', 'macos', 'android', 'vega', 'linux', 'web'];
|
|
6
|
+
declare const PUBLIC_PLATFORMS: readonly ['ios', 'macos', 'android', 'harmonyos', 'vega', 'linux', 'web'];
|
|
7
7
|
type PublicPlatform = (typeof PUBLIC_PLATFORMS)[number];
|
|
8
|
-
declare const PLATFORM_SELECTORS: readonly ["apple", "android", "vega", "linux", "web", "ios", "macos"];
|
|
8
|
+
declare const PLATFORM_SELECTORS: readonly ["apple", "android", "harmonyos", "vega", "linux", "web", "ios", "macos"];
|
|
9
9
|
type PlatformSelector = (typeof PLATFORM_SELECTORS)[number];
|
|
10
10
|
declare const DEVICE_KINDS: readonly ['simulator', 'emulator', 'device'];
|
|
11
11
|
type DeviceKind = (typeof DEVICE_KINDS)[number];
|
|
@@ -44,9 +44,21 @@ type SnapshotQualityVerdict = {
|
|
|
44
44
|
state: 'healthy' | 'recovered' | 'sparse';
|
|
45
45
|
backend: SnapshotCaptureBackend;
|
|
46
46
|
reason?: string;
|
|
47
|
-
reasonCode?: 'ax-rejected' | 'sparse-tree' | 'budget' | 'no-nodes' | 'capture-failed' | 'deferred';
|
|
47
|
+
reasonCode?: 'ax-rejected' | 'sparse-tree' | 'budget' | 'no-nodes' | 'capture-failed' | 'deferred' | 'requested-backend';
|
|
48
48
|
effectiveDepth?: number;
|
|
49
49
|
collapsedLeafIndexes?: number[];
|
|
50
|
+
/**
|
|
51
|
+
* Coverage of an opt-in custom-action pass (`snapshot --actions`): how many
|
|
52
|
+
* merged elements were eligible and how many the bounded pass reached. An
|
|
53
|
+
* unread element is indistinguishable from one with no actions, so a partial
|
|
54
|
+
* pass has to be disclosed rather than left to look complete.
|
|
55
|
+
*/
|
|
56
|
+
customActions?: {
|
|
57
|
+
read: number;
|
|
58
|
+
candidates: number;
|
|
59
|
+
truncated: number;
|
|
60
|
+
blocked: boolean;
|
|
61
|
+
};
|
|
50
62
|
};
|
|
51
63
|
type Rect = {
|
|
52
64
|
x: number;
|
|
@@ -70,6 +82,12 @@ type SnapshotOptions = {
|
|
|
70
82
|
* captured the way its baseline was.
|
|
71
83
|
*/
|
|
72
84
|
preferredBackend?: 'private-ax';
|
|
85
|
+
/**
|
|
86
|
+
* Read accessibility custom actions for elements that merge their children
|
|
87
|
+
* away. Opt-in because each such element costs its own accessibility round
|
|
88
|
+
* trip; see `RawSnapshotNode.actions`.
|
|
89
|
+
*/
|
|
90
|
+
customActions?: boolean;
|
|
73
91
|
};
|
|
74
92
|
type RawSnapshotNode = {
|
|
75
93
|
index: number;
|
|
@@ -96,6 +114,14 @@ type RawSnapshotNode = {
|
|
|
96
114
|
hiddenContentBelow?: boolean;
|
|
97
115
|
interactionBlocked?: 'covered';
|
|
98
116
|
presentationHints?: string[];
|
|
117
|
+
/**
|
|
118
|
+
* Accessibility custom actions the element exposes (iOS
|
|
119
|
+
* `UIAccessibilityCustomAction`, React Native `accessibilityActions`). Merged
|
|
120
|
+
* cards publish their real affordances here instead of as child elements, so
|
|
121
|
+
* this is often the only evidence that a collapsed node has any. Populated by
|
|
122
|
+
* opt-in captures only — see `snapshot --actions`.
|
|
123
|
+
*/
|
|
124
|
+
actions?: string[];
|
|
99
125
|
};
|
|
100
126
|
type SnapshotNode = RawSnapshotNode & {
|
|
101
127
|
ref: string;
|
|
@@ -108,7 +134,7 @@ type SnapshotNode = RawSnapshotNode & {
|
|
|
108
134
|
inheritsLabel?: true;
|
|
109
135
|
inheritsIdentifier?: true;
|
|
110
136
|
};
|
|
111
|
-
type SnapshotBackend = 'xctest' | 'android' | 'macos-helper' | 'linux-atspi' | 'web';
|
|
137
|
+
type SnapshotBackend = 'xctest' | 'android' | 'harmonyos-arkui' | 'macos-helper' | 'linux-atspi' | 'web';
|
|
112
138
|
type SnapshotState = {
|
|
113
139
|
nodes: SnapshotNode[];
|
|
114
140
|
createdAt: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const e=/(token|secret|password|authorization|cookie|api[_-]?key|access[_-]?key|private[_-]?key|user[_-]?code|device[_-]?code|refresh[_-]?credential)/i,t=/\b(?:bearer\s+[a-z0-9._-]+|adc_(?:agent|live|refresh|cli)_[a-z0-9._-]+)\b/gi,n=/\b([a-z0-9_-]*(?:api[_-]?key|token|secret|password|user[_-]?code|device[_-]?code|refresh[_-]?credential)[a-z0-9_-]*)(\s*[=:]\s*)("[^"]*"|'[^']*'|\S+)/gi,r=/https?:\/\/[^\s"'<>]+/gi;function i(e){return a(e,new WeakSet)}function a(t,n,r){if(t==null)return t;if(typeof t==`string`)return o(t,r);if(typeof t!=`object`)return t;if(n.has(t))return`[Circular]`;if(n.add(t),Array.isArray(t))return t.map(e=>a(e,n));let i={};for(let[r,o]of Object.entries(t)){if(e.test(r)){i[r]=`[REDACTED]`;continue}i[r]=a(o,n,r)}return i}function o(r,i){let a=r.trim();if(!a)return r;if(i&&e.test(i))return`[REDACTED]`;let o=s(a);return o=o.replace(t,`[REDACTED]`),o=o.replace(n,(e,t,n,r,i,a)=>l({key:t,separator:n,rawValue:r,offset:i,input:a})||c(r)?e:`${t}${n}[REDACTED]`),o===a?a.length>400?`${a.slice(0,200)}...<truncated>`:a:o}function s(e){return e.replace(r,e=>u(e)??e)}function c(e){return/^adc_(?:agent|live|refresh|cli)_\.\.\.$/i.test(e)}function l(e){if(e.key.toLowerCase()!==`token`||!e.separator.includes(`:`))return!1;try{return new URL(e.rawValue).pathname.replace(/\/+$/,``)===`/api-keys`?/(?:^|\b)(?:service\/)?api\s+$/i.test(e.input.slice(0,e.offset)):!1}catch{return!1}}function u(e){try{let t=new URL(e);return t.search&&=`?REDACTED`,(t.username||t.password)&&(t.username=`REDACTED`,t.password=`REDACTED`),t.toString()}catch{return null}}const d=[`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`];function f(e,t=`COMMAND_FAILED`){return typeof e==`string`&&e.length>0?e:t}var p=class extends Error{code;details;cause;constructor(e,t,n,r){super(t),this.code=e,this.details=n,this.cause=r}};function m(e){throw new p(f(e.code),e.message,{...e.details??{},hint:e.hint,diagnosticId:e.diagnosticId,logPath:e.logPath,retriable:e.retriable,supportedOn:e.supportedOn})}function h(e,t=`UNKNOWN`){return e instanceof p?e:e instanceof Error?new p(t,e.message,void 0,e):new p(t,`Unknown error`,{err:e})}function g(e){return e instanceof p}function _(e,t={}){return v(e,t)}function v(e,t={}){let n=h(e),r=n.details?i(n.details):void 0,a=w(r,`diagnosticId`)??t.diagnosticId,o=w(r,`logPath`)??t.logPath,s=w(r,`hint`)??A(n.code),c=T(r,`retriable`)??k(n.code),l=w(r,`supportedOn`),u=E(r),d=b(n.code,n.message,r);return{code:n.code,message:d,hint:s,diagnosticId:a,logPath:o,...c===void 0?{}:{retriable:c},...l===void 0?{}:{supportedOn:l},details:u}}const y=/^\S+ exited with code -?\d+$/;function b(e,t,n){if(e!==`COMMAND_FAILED`||n?.processExitError!==!0)return t;let r=C(typeof n?.stderr==`string`?n.stderr:``);return r?y.test(t)?r:t.includes(r)?t:`${t}: ${r}`:t}const x=[/^an error was encountered processing the command/i,/^underlying error\b/i,/^simulator device failed to complete the requested operation/i],S=/^(?:(?:adb|xcrun|simctl):\s*)?(?:error:\s*)?/i;function C(e){for(let t of e.split(`
|
|
2
|
-
`)){let e=t.trim();if(!e||x.some(t=>t.test(e)))continue;let n=e.replace(S,``).trim();if(n)return n.length>200?`${n.slice(0,200)}...`:n}return null}function w(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function T(e,t){let n=e?.[t];return typeof n==`boolean`?n:void 0}function E(e){if(!e)return;let t={...e};return delete t.hint,delete t.diagnosticId,delete t.logPath,delete t.retriable,delete t.supportedOn,Object.keys(t).length>0?t:void 0}const D={DEVICE_IN_USE:!0};function O(e){return d.includes(e)}function k(e){return O(e)?D[e]:void 0}function A(e){switch(e){case`INVALID_ARGS`:return`Check command arguments and run --help for usage examples.`;case`SESSION_NOT_FOUND`:return`Run open first or pass an explicit device selector.`;case`TOOL_MISSING`:return`Install required platform tooling and ensure it is available in PATH.`;case`DEVICE_NOT_FOUND`:return`Verify the target device is booted/connected and selectors match.`;case`APP_NOT_INSTALLED`:return`Run apps to discover the exact installed package or bundle id, or install the app before open.`;case`UNSUPPORTED_OPERATION`:return`This command is not available for the selected platform/device.`;case`UNSUPPORTED_PLATFORM`:return`This platform is not supported for the requested operation; run devices to inspect available targets.`;case`AMBIGUOUS_MATCH`:return`Multiple candidates matched. Narrow the query or pass an exact identifier.`;case`DEVICE_IN_USE`:return`The device is busy with another agent-device request; retry once it frees up.`;case`REPLAY_DIVERGENCE`:return`Read details.divergence (screen/suggestions) for repair context, or rerun with --json for the full report.`;case`REPAIR_SESSION_EXPIRED`:return`The --save-script repair session was reaped before it was finalized; re-run replay <script> --save-script from the start.`;case`REPAIR_COMMIT_FAILED`:return`The repair transaction completed, but committing its healed script failed at teardown (no-clobber refusal or a filesystem error); inspect the target path/permissions, then re-run replay <script> --save-script to retry.`;case`NOT_IMPLEMENTED`:return`This command is part of the planned API but is not implemented yet.`;case`COMMAND_FAILED`:return`Retry with --debug and inspect diagnostics log for details.`;case`UNAUTHORIZED`:return`Refresh daemon metadata and retry the command.`;case`UNKNOWN`:return`Unexpected internal error. Retry with --debug and report the diagnostics log if it persists.`;default:return`Retry with --debug and inspect diagnostics log for details.`}}function j(e){return e===`xctest`||e===`android`||e===`macos-helper`||e===`linux-atspi`||e===`web`}function M(e){return e===void 0||e===`xctest`||e===`android`}function N(e){return e.map((e,t)=>({...e,ref:`e${t+1}`}))}const P=/^~s(\d+)$/,F=`Refs look like @e12, optionally pinned to the snapshot generation that minted them: @e12~s3 (the ref, then "~s" and the refsGeneration reported by the issuing snapshot/find response).`;function I(e){let t=e.trim(),n=t.indexOf(`~`);if(n===-1)return{base:t};let r=P.exec(t.slice(n));return!r||n===0?null:{base:t.slice(0,n),generation:Number(r[1])}}function L(e){let t=I(e);if(!t)return null;let n=t.base;return n.startsWith(`@`)?n.slice(1)||null:n.startsWith(`e`)?n:null}function R(e,t){return e.find(e=>e.ref===t)??null}function z(e){return JSON.stringify({interactiveOnly:e?.interactiveOnly===!0,depth:typeof e?.depth==`number`?e.depth:null,scope:e?.scope?.trim()||null,raw:e?.raw===!0})}function B(e){if(e)return{depth:e.snapshotDepth,interactiveOnly:e.snapshotInteractiveOnly,raw:e.snapshotRaw,scope:e.snapshotScope}}function V(e){return{x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)}}const H=[`summary`,`headers`,`body`,`all`],ee=[`digest`,`default`,`full`];function U(e){return e!==void 0&&e!=="default"}function W(e){return{parse(t){return e(t,`$`)}}}function G(e,t){throw Error(`${e}: ${t}`)}function K(e,t){return(!e||typeof e!=`object`||Array.isArray(e))&&G(t,`Expected an object`),e}function q(e,t){return typeof e!=`string`&&G(t,`Expected a string`),e}function J(e,t){return Number.isInteger(e)||G(t,`Expected an integer`),e}function Y(e,t){return Array.isArray(e)||G(t,`Expected an array`),e}function X(e,t,n){let r=e[t];return r===void 0?void 0:q(r,`${n}.${t}`)}function Z(e,t,n){let r=e[t];if(r!==void 0)return Y(r,`${n}.${t}`).map((e,r)=>q(e,`${n}.${t}[${String(r)}]`))}function Q(e,t,n){let r=e[t];return r===void 0?void 0:J(r,`${n}.${t}`)}function $(e,t,n){let r=e[t];return r===void 0?void 0:K(r,`${n}.${t}`)}function te(e,t,n,r){let i=e[t];if(i!==void 0)return(typeof i!=`string`||!n.includes(i))&&G(`${r}.${t}`,`Expected one of: ${n.join(`, `)}`),i}const ne=W((e,t)=>{let n=K(e,t);return{platform:te(n,`platform`,[`ios`,`android`],t),metroHost:X(n,`metroHost`,t),metroPort:Q(n,`metroPort`,t),bundleUrl:X(n,`bundleUrl`,t),launchUrl:X(n,`launchUrl`,t)}});function re(e,t){let n=e.id;return n==null||typeof n!=`string`&&typeof n!=`number`&&G(`${t}.id`,`Expected a string, number, or null`),n}const ie=W((e,t)=>{let n=K(e,t);return{jsonrpc:X(n,`jsonrpc`,t),id:re(n,t),method:X(n,`method`,t),params:n.params}}),ae=W((e,t)=>{let n=K(e,t);return{token:X(n,`token`,t),session:X(n,`session`,t),command:X(n,`command`,t),positionals:Z(n,`positionals`,t),input:$(n,`input`,t),flags:$(n,`flags`,t),runtime:$(n,`runtime`,t),meta:$(n,`meta`,t)}});export{k as C,i as E,v as S,f as T,p as _,U as a,g as b,N as c,R as d,j as f,M as g,I as h,ne as i,z as l,B as m,ee as n,ie as o,L as p,ae as r,F as s,H as t,V as u,h as v,m as w,_ as x,A as y};
|
|
2
|
+
`)){let e=t.trim();if(!e||x.some(t=>t.test(e)))continue;let n=e.replace(S,``).trim();if(n)return n.length>200?`${n.slice(0,200)}...`:n}return null}function w(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function T(e,t){let n=e?.[t];return typeof n==`boolean`?n:void 0}function E(e){if(!e)return;let t={...e};return delete t.hint,delete t.diagnosticId,delete t.logPath,delete t.retriable,delete t.supportedOn,Object.keys(t).length>0?t:void 0}const D={DEVICE_IN_USE:!0};function O(e){return d.includes(e)}function k(e){return O(e)?D[e]:void 0}function A(e){switch(e){case`INVALID_ARGS`:return`Check command arguments and run --help for usage examples.`;case`SESSION_NOT_FOUND`:return`Run open first or pass an explicit device selector.`;case`TOOL_MISSING`:return`Install required platform tooling and ensure it is available in PATH.`;case`DEVICE_NOT_FOUND`:return`Verify the target device is booted/connected and selectors match.`;case`APP_NOT_INSTALLED`:return`Run apps to discover the exact installed package or bundle id, or install the app before open.`;case`UNSUPPORTED_OPERATION`:return`This command is not available for the selected platform/device.`;case`UNSUPPORTED_PLATFORM`:return`This platform is not supported for the requested operation; run devices to inspect available targets.`;case`AMBIGUOUS_MATCH`:return`Multiple candidates matched. Narrow the query or pass an exact identifier.`;case`DEVICE_IN_USE`:return`The device is busy with another agent-device request; retry once it frees up.`;case`REPLAY_DIVERGENCE`:return`Read details.divergence (screen/suggestions) for repair context, or rerun with --json for the full report.`;case`REPAIR_SESSION_EXPIRED`:return`The --save-script repair session was reaped before it was finalized; re-run replay <script> --save-script from the start.`;case`REPAIR_COMMIT_FAILED`:return`The repair transaction completed, but committing its healed script failed at teardown (no-clobber refusal or a filesystem error); inspect the target path/permissions, then re-run replay <script> --save-script to retry.`;case`NOT_IMPLEMENTED`:return`This command is part of the planned API but is not implemented yet.`;case`COMMAND_FAILED`:return`Retry with --debug and inspect diagnostics log for details.`;case`UNAUTHORIZED`:return`Refresh daemon metadata and retry the command.`;case`UNKNOWN`:return`Unexpected internal error. Retry with --debug and report the diagnostics log if it persists.`;default:return`Retry with --debug and inspect diagnostics log for details.`}}function j(e){return e===`xctest`||e===`android`||e===`harmonyos-arkui`||e===`macos-helper`||e===`linux-atspi`||e===`web`}function M(e){return e===void 0||e===`xctest`||e===`android`||e===`harmonyos-arkui`}function N(e){return e.map((e,t)=>({...e,ref:`e${t+1}`}))}const P=/^~s(\d+)$/,F=`Refs look like @e12, optionally pinned to the snapshot generation that minted them: @e12~s3 (the ref, then "~s" and the refsGeneration reported by the issuing snapshot/find response).`;function I(e){let t=e.trim(),n=t.indexOf(`~`);if(n===-1)return{base:t};let r=P.exec(t.slice(n));return!r||n===0?null:{base:t.slice(0,n),generation:Number(r[1])}}function L(e){let t=I(e);if(!t)return null;let n=t.base;return n.startsWith(`@`)?n.slice(1)||null:n.startsWith(`e`)?n:null}function R(e,t){return e.find(e=>e.ref===t)??null}function z(e){return JSON.stringify({interactiveOnly:e?.interactiveOnly===!0,depth:typeof e?.depth==`number`?e.depth:null,scope:e?.scope?.trim()||null,raw:e?.raw===!0,customActions:e?.customActions===!0})}function B(e){if(e)return{depth:e.snapshotDepth,interactiveOnly:e.snapshotInteractiveOnly,raw:e.snapshotRaw,scope:e.snapshotScope,customActions:e.snapshotCustomActions}}function V(e){return{x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)}}const H=[`summary`,`headers`,`body`,`all`],ee=[`digest`,`default`,`full`];function U(e){return e!==void 0&&e!=="default"}function W(e){return{parse(t){return e(t,`$`)}}}function G(e,t){throw Error(`${e}: ${t}`)}function K(e,t){return(!e||typeof e!=`object`||Array.isArray(e))&&G(t,`Expected an object`),e}function q(e,t){return typeof e!=`string`&&G(t,`Expected a string`),e}function J(e,t){return Number.isInteger(e)||G(t,`Expected an integer`),e}function Y(e,t){return Array.isArray(e)||G(t,`Expected an array`),e}function X(e,t,n){let r=e[t];return r===void 0?void 0:q(r,`${n}.${t}`)}function Z(e,t,n){let r=e[t];if(r!==void 0)return Y(r,`${n}.${t}`).map((e,r)=>q(e,`${n}.${t}[${String(r)}]`))}function Q(e,t,n){let r=e[t];return r===void 0?void 0:J(r,`${n}.${t}`)}function $(e,t,n){let r=e[t];return r===void 0?void 0:K(r,`${n}.${t}`)}function te(e,t,n,r){let i=e[t];if(i!==void 0)return(typeof i!=`string`||!n.includes(i))&&G(`${r}.${t}`,`Expected one of: ${n.join(`, `)}`),i}const ne=W((e,t)=>{let n=K(e,t);return{platform:te(n,`platform`,[`ios`,`android`],t),metroHost:X(n,`metroHost`,t),metroPort:Q(n,`metroPort`,t),bundleUrl:X(n,`bundleUrl`,t),launchUrl:X(n,`launchUrl`,t)}});function re(e,t){let n=e.id;return n==null||typeof n!=`string`&&typeof n!=`number`&&G(`${t}.id`,`Expected a string, number, or null`),n}const ie=W((e,t)=>{let n=K(e,t);return{jsonrpc:X(n,`jsonrpc`,t),id:re(n,t),method:X(n,`method`,t),params:n.params}}),ae=W((e,t)=>{let n=K(e,t);return{token:X(n,`token`,t),session:X(n,`session`,t),command:X(n,`command`,t),positionals:Z(n,`positionals`,t),input:$(n,`input`,t),flags:$(n,`flags`,t),runtime:$(n,`runtime`,t),meta:$(n,`meta`,t)}});export{k as C,i as E,v as S,f as T,p as _,U as a,g as b,N as c,R as d,j as f,M as g,I as h,ne as i,z as l,B as m,ee as n,ie as o,L as p,ae as r,F as s,H as t,V as u,h as v,m as w,_ as x,A as y};
|
package/dist/src/sdk-device.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./sdk-contracts.js";const
|
|
1
|
+
import{_ as e}from"./sdk-contracts.js";function t(e){return Object.freeze({family:e.platform,...e.appleOs===void 0?{}:{appleOs:e.appleOs},kind:e.kind,...e.target===void 0?{}:{target:e.target},...e.iosPhysicalDeviceBackend===void 0?{}:{iosPhysicalDeviceBackend:e.iosPhysicalDeviceBackend}})}function n(e){return Object.freeze({id:e.id,...t(e)})}function r(e){return JSON.stringify([e.id,...o(e)])}function i(e,t){return r(e)===r(t)}function a(e,t){return JSON.stringify(o(e))===JSON.stringify(o(t))}function o(e){return[e.family,e.appleOs??null,e.kind,e.target??null,e.iosPhysicalDeviceBackend??null]}const s=[`ios`,`ipados`,`tvos`,`watchos`,`visionos`,`macos`],c=[`apple`,`android`,`harmonyos`,`vega`,`linux`,`web`],l=[`ios`,`macos`,`android`,`harmonyos`,`vega`,`linux`,`web`],u=[...c,`ios`,`macos`],d=[`mobile`,`tv`,`desktop`];function f(e){return e===`apple`||e===`ios`||e===`macos`}function p(e){return e.appleOs===`macos`||e.platform===`macos`}function m(e){return f(e.platform)&&!p(e)}function h(e){return e.platform===`android`||e.platform===`harmonyos`||f(e.platform)&&!p(e)}function g(e){return f(e.platform)?p(e)?`macos`:`ios`:e.platform}function _(e){return e===`macos`?{platform:`apple`,appleOs:`macos`}:e===`ios`?{platform:`apple`}:{platform:e}}function v(e){return f(e.platform)&&e.target===`tv`}function y(e){return e.appleOs?e.appleOs:e.platform===`macos`?`macos`:v(e)?`tvos`:`ios`}function b(e){return c.includes(e)}function x(e){return l.includes(e)}function S(e){return s.includes(e)}function C(e,t){return t?t===`apple`?f(e.platform):t===`ios`?f(e.platform)&&!p(e):t===`macos`?f(e.platform)&&p(e):e.platform===t:!0}function w(e,t){return t?T(t):e===`macos`||e===`desktop`?`macOS`:e===`tv`?`tvOS`:`iOS`}function T(e){switch(e){case`tvos`:return`tvOS`;case`macos`:return`macOS`;case`visionos`:return`visionOS`;default:return`iOS`}}function E(e){let{simulatorSetPath:t,platform:n,target:r}=e;if(t&&!(n===`macos`||r===`desktop`))return t}function D(e){return e.map((e,t)=>({device:e,index:t})).sort((e,t)=>U(e,t)).map(({device:e})=>e)}function O(e){return!e||e===`apple`||e===`ios`}async function k(e,t,n={}){let r=e.filter(e=>L(e,t));return A(r,t)||(n.allowStoppedAndroidAvdPlaceholders!==!0&&(r=r.filter(e=>!I(e))),N(r,t.deviceName)||(K(r)&&(r=D(r)),P(r,t,n)))}function A(e,t){if(t.udid)return j(e,t.udid);if(t.serial)return M(e,t)}function j(t,n){let r=t.find(e=>e.id===n&&f(e.platform));if(!r)throw new e(`DEVICE_NOT_FOUND`,`No Apple device with UDID ${n}`);return r}function M(t,n){let r=t.find(e=>e.id===n.serial&&z(e.platform));if(!r)throw new e(`DEVICE_NOT_FOUND`,B(n));return r}function N(t,n){if(!n)return;let r=H(n),i=t.find(e=>H(e.name)===r);if(!i)throw new e(`DEVICE_NOT_FOUND`,`No device named ${n}`);return i}function P(e,t,n){let r=e[0];if(r!==void 0&&e.length===1)return r;e.length===0&&V(t,n);let i=F(e);return i||V(t,n),i}function F(e){let t=e.filter(e=>e.kind!==`device`),n=t.length>0?t:e;if(K(n))return n[0];let r=n.filter(e=>e.booted),i=r[0];return i&&r.length===1?i:r[0]??n[0]}function I(e){return e.platform===`android`&&e.kind===`emulator`&&e.booted===!1&&!/^emulator-\d+$/.test(e.id)}function L(e,t,n={}){return C(e,t.platform)&&(!t.target||(e.target??`mobile`)===t.target)&&(!n.includeExplicitSelectors||R(e,t))}function R(e,t){return!(t.udid&&!(e.id===t.udid&&f(e.platform))||t.serial&&!(e.id===t.serial&&z(e.platform))||t.deviceName&&H(e.name)!==H(t.deviceName))}function z(e){return e===`android`||e===`harmonyos`||e===`vega`}function B(e){return e.platform===`android`?`No Android device with serial ${e.serial}`:e.platform===`vega`?`No Vega VVD with serial ${e.serial}`:e.platform===`harmonyos`?`No HarmonyOS device with serial ${e.serial}`:`No Android, HarmonyOS device, or Vega VVD with serial ${e.serial}`}function V(t,n){let r=n.simulatorSetPath;throw r&&O(t.platform)?new e(`DEVICE_NOT_FOUND`,`No devices found in the scoped simulator set`,{simulatorSetPath:r,hint:`The simulator set at "${r}" appears to be empty. Create a compatible simulator first with xcrun simctl --set "${r}" create, or remove the scoped simulator set.`,selector:t}):new e(`DEVICE_NOT_FOUND`,`No devices found`,{selector:t})}function H(e){return e.toLowerCase().replace(/_/g,` `).replace(/\s+/g,` `).trim()}function U(e,t){return W(e.device)-W(t.device)||Number(t.device.booted===!0)-Number(e.device.booted===!0)||e.device.name.localeCompare(t.device.name)||e.index-t.index}function W(e){return e.kind===`simulator`?G(e,0,1,2,3):e.kind===`device`&&f(e.platform)&&!p(e)?G(e,10,11,12,13):14}function G(e,t,n,r,i){return{mobile:q(e.name)?n:t,tv:r,desktop:i}[e.target??`mobile`]}function K(e){return e.length>0&&e.every(e=>f(e.platform))}function q(e){return/\bipad\b/i.test(e)}export{n as C,a as D,i as E,D as S,t as T,g as _,_ as a,k as b,m as c,b as d,x as f,C as g,L as h,l as i,p as l,v as m,c as n,S as o,z as p,u as r,f as s,d as t,h as u,w as v,r as w,y as x,E as y};
|
package/dist/src/sdk-finders.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ln as e}from"./sdk-batch-runner.js";function t(t,n,r,i){return e(t,n,r,typeof i==`boolean`?{requireRect:i}:i)}export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{r as e}from"./sdk-device.js";import{E as t}from"./sdk-android-adb.js";const n=[`portrait`,`landscape`],r=[{key:`stateDir`,type:`string`,path:!0},{key:`daemonBaseUrl`,type:`string`},{key:`daemonAuthToken`,type:`string`},{key:`daemonTransport`,type:`enum`,enumValues:[`auto`,`socket`,`http`]},{key:`daemonServerMode`,type:`enum`,enumValues:[`socket`,`http`,`dual`]},{key:`tenant`,type:`string`},{key:`sessionIsolation`,type:`enum`,enumValues:[`none`,`tenant`]},{key:`runId`,type:`string`},{key:`leaseId`,type:`string`},{key:`leaseBackend`,type:`enum`,enumValues:[`ios-simulator`,`ios-instance`,`android-instance`]},{key:`platform`,type:`enum`,enumValues:e},{key:`target`,type:`enum`,enumValues:[`mobile`,`tv`,`desktop`]},{key:`device`,type:`string`},{key:`udid`,type:`string`},{key:`serial`,type:`string`},{key:`iosSimulatorDeviceSet`,type:`string`,path:!0,env:!1},{key:`androidDeviceAllowlist`,type:`string`},{key:`session`,type:`string`},{key:`providerApp`,type:`string`},{key:`providerOsVersion`,type:`string`},{key:`providerProject`,type:`string`},{key:`providerBuild`,type:`string`},{key:`providerSessionName`,type:`string`},{key:`providerDeviceOrientation`,type:`enum`,enumValues:n},{key:`providerGeoLocation`,type:`string`},{key:`providerTimezone`,type:`string`},{key:`providerLanguage`,type:`string`},{key:`providerLocale`,type:`string`},{key:`providerNetworkProfile`,type:`string`},{key:`providerCustomNetwork`,type:`string`},{key:`providerNoResignApp`,type:`boolean`},{key:`awsProjectArn`,type:`string`},{key:`awsDeviceArn`,type:`string`},{key:`awsAppArn`,type:`string`},{key:`awsRegion`,type:`string`},{key:`awsInteractionMode`,type:`enum`,enumValues:[`INTERACTIVE`,`NO_VIDEO`,`VIDEO_ONLY`]},{key:`metroProjectRoot`,type:`string`,path:!0},{key:`metroKind`,type:`enum`,enumValues:[`auto`,`react-native`,`expo`,`repack`]},{key:`metroPublicBaseUrl`,type:`string`},{key:`metroProxyBaseUrl`,type:`string`},{key:`metroBearerToken`,type:`string`},{key:`metroPreparePort`,type:`int`,min:1,max:65535},{key:`metroListenHost`,type:`string`},{key:`metroStatusHost`,type:`string`},{key:`metroStartupTimeoutMs`,type:`int`,min:1},{key:`metroProbeTimeoutMs`,type:`int`,min:1},{key:`metroRuntimeFile`,type:`string`,path:!0},{key:`metroNoReuseExisting`,type:`boolean`},{key:`metroNoInstallDeps`,type:`boolean`},{key:`launchUrl`,type:`string`}],i=[{key:`leaseProvider`,type:`string`,env:!1},{key:`deviceKey`,type:`string`,env:!1},{key:`clientId`,type:`string`,env:!1}],a=[...r,...i],o=new Map(a.map(e=>[e.key,e]));function s(e){return o.get(e)}function c(e){return s(e)?.env===!1?[]:[t(e)]}export{n as a,s as i,a as n,c as r,r as t};
|