agent-device 0.21.34 → 0.21.35

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.
Files changed (174) hide show
  1. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.34.apk → agent-device-android-ime-helper-0.21.35.apk} +0 -0
  2. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.35.apk.sha256 +1 -0
  3. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.34.manifest.json → agent-device-android-ime-helper-0.21.35.manifest.json} +4 -4
  4. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.34.apk → agent-device-android-snapshot-helper-0.21.35.apk} +0 -0
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.35.apk.sha256 +1 -0
  6. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.34.manifest.json → agent-device-android-snapshot-helper-0.21.35.manifest.json} +7 -7
  7. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +27 -18
  8. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputProbe.swift +26 -7
  9. package/dist/src/agent-browser-provider.js +1 -1
  10. package/dist/src/agent-device-client.js +1 -1
  11. package/dist/src/ai-sdk.d.ts +1 -1
  12. package/dist/src/alert.js +1 -1
  13. package/dist/src/android-adb.d.ts +1 -1
  14. package/dist/src/app-backend.js +1 -1
  15. package/dist/src/app-launch.js +1 -1
  16. package/dist/src/app-lifecycle.js +1 -1
  17. package/dist/src/app-log-reconnect.js +1 -1
  18. package/dist/src/app-log-runtime2.js +2 -2
  19. package/dist/src/app-log-session-resource.js +1 -1
  20. package/dist/src/app-resolution.js +2 -2
  21. package/dist/src/app-state-runtime.d.ts +1 -1
  22. package/dist/src/apple-runner-platform.js +1 -1
  23. package/dist/src/application-lifecycle-interaction.js +1 -1
  24. package/dist/src/artifact-download.js +1 -1
  25. package/dist/src/back-mode.js +1 -1
  26. package/dist/src/cli-config.js +1 -1
  27. package/dist/src/cli-help.js +3 -2
  28. package/dist/src/cli.js +2 -2
  29. package/dist/src/client-types.d.ts +17 -4
  30. package/dist/src/cloud-artifacts.d.ts +2 -2
  31. package/dist/src/command-metadata.js +41 -41
  32. package/dist/src/command-schema.js +3 -1
  33. package/dist/src/command-tools.js +1 -1
  34. package/dist/src/composed-inventory-gateways.js +1 -1
  35. package/dist/src/composite-resource-admission.js +1 -1
  36. package/dist/src/connection-runtime.js +1 -1
  37. package/dist/src/connection.js +5 -5
  38. package/dist/src/contract.d.ts +2 -1
  39. package/dist/src/contracts.d.ts +1 -1
  40. package/dist/src/daemon-client-lease-beat.js +1 -1
  41. package/dist/src/daemon-client.js +2 -2
  42. package/dist/src/daemon-command-registry.js +1 -1
  43. package/dist/src/daemon-composition.js +1 -1
  44. package/dist/src/daemon-policy-file.js +1 -1
  45. package/dist/src/debug-symbols-facade.js +1 -1
  46. package/dist/src/destination-tunnel-dialer.js +27 -0
  47. package/dist/src/device-claim-recovery.js +1 -1
  48. package/dist/src/device-claims.js +1 -1
  49. package/dist/src/device-input-state.d.ts +1 -1
  50. package/dist/src/device-readiness-runtime.js +1 -1
  51. package/dist/src/device-selection-resolver.js +1 -1
  52. package/dist/src/device.js +1 -1
  53. package/dist/src/discovery.js +1 -1
  54. package/dist/src/doctor-facade.js +1 -1
  55. package/dist/src/durable-resource.js +1 -1
  56. package/dist/src/explicit-session-resolution.js +1 -1
  57. package/dist/src/find.js +1 -1
  58. package/dist/src/generic.js +1 -1
  59. package/dist/src/gesture-admission.js +1 -1
  60. package/dist/src/gesture-plan-types.d.ts +1 -1
  61. package/dist/src/gesture-runtime.js +1 -1
  62. package/dist/src/human-control.js +1 -1
  63. package/dist/src/index.d.ts +1 -1
  64. package/dist/src/instance-client.js +1 -1
  65. package/dist/src/interaction.js +1 -1
  66. package/dist/src/interaction2.js +1 -1
  67. package/dist/src/interactor.js +5 -5
  68. package/dist/src/interactor4.js +1 -1
  69. package/dist/src/interactors.js +1 -1
  70. package/dist/src/internal/bin.js +1 -1
  71. package/dist/src/inventory2.js +1 -1
  72. package/dist/src/ios-client.js +4 -4
  73. package/dist/src/launch-confirmation.js +1 -1
  74. package/dist/src/lease-context.js +1 -1
  75. package/dist/src/lease-registry-scope.js +1 -1
  76. package/dist/src/lease.js +1 -1
  77. package/dist/src/leased-recording-retention.js +1 -1
  78. package/dist/src/legacy.js +1 -1
  79. package/dist/src/limrun.d.ts +6 -1
  80. package/dist/src/local-interactor-operation-set.js +1 -1
  81. package/dist/src/log-stream.js +2 -28
  82. package/dist/src/mechanics.js +1 -1
  83. package/dist/src/metro.d.ts +1 -1
  84. package/dist/src/network-har.js +2 -0
  85. package/dist/src/open-target-resolution.js +1 -1
  86. package/dist/src/perf-facade.js +1 -1
  87. package/dist/src/perf-target.js +1 -1
  88. package/dist/src/platform-runtime-daemon-services.js +1 -1
  89. package/dist/src/platform-runtime-open-target.js +1 -1
  90. package/dist/src/platform-runtime-operation-host.js +3 -3
  91. package/dist/src/platform-runtime-runtime-hints.js +1 -1
  92. package/dist/src/platform-runtime-unavailable.js +1 -1
  93. package/dist/src/platform-runtime.js +1 -1
  94. package/dist/src/platform-runtime2.js +1 -1
  95. package/dist/src/plugin-inventory.js +1 -1
  96. package/dist/src/provider-device-runtime.d.ts +1 -1
  97. package/dist/src/provider-plugin.d.ts +1 -1
  98. package/dist/src/proxy.js +2 -2
  99. package/dist/src/react-native.js +1 -1
  100. package/dist/src/record-runtime-response.js +1 -1
  101. package/dist/src/record-runtime.js +1 -1
  102. package/dist/src/record-trace.js +1 -1
  103. package/dist/src/registry.js +1 -1
  104. package/dist/src/replay-maestro-backend.js +3 -3
  105. package/dist/src/replay-script-selection.js +1 -1
  106. package/dist/src/replay.d.ts +1 -1
  107. package/dist/src/request-runtime-binding.js +1 -1
  108. package/dist/src/result-serialization.js +2 -1
  109. package/dist/src/runner-client.js +1 -1
  110. package/dist/src/runner-dev-tools-security.js +1 -1
  111. package/dist/src/runner-device-readiness.js +1 -1
  112. package/dist/src/runner-retention.js +1 -1
  113. package/dist/src/runner-selector-query.js +1 -1
  114. package/dist/src/runner-startup-transport.js +1 -1
  115. package/dist/src/runner.js +1 -1
  116. package/dist/src/runtime-admission.js +1 -1
  117. package/dist/src/runtime-deployment.js +1 -1
  118. package/dist/src/runtime-session.js +1 -1
  119. package/dist/src/runtime.js +2 -2
  120. package/dist/src/runtime3.js +4 -4
  121. package/dist/src/runtime4.js +1 -1
  122. package/dist/src/runtime5.js +1 -1
  123. package/dist/src/runtime6.js +1 -1
  124. package/dist/src/runtime7.js +1 -1
  125. package/dist/src/runtime8.js +1 -1
  126. package/dist/src/runtime9.js +1 -1
  127. package/dist/src/screen-recording-resource-recovery.js +1 -1
  128. package/dist/src/screen-recording-session-resource.js +1 -1
  129. package/dist/src/screen-recording-transport.js +1 -1
  130. package/dist/src/screenshot-density.js +1 -1
  131. package/dist/src/screenshot-runtime.js +1 -1
  132. package/dist/src/sdk-batch-runner.js +2 -2
  133. package/dist/src/sdk-batch.js +2 -2
  134. package/dist/src/sdk-contracts.d.ts +4 -1
  135. package/dist/src/sdk-device.js +1 -1
  136. package/dist/src/sdk-finders.d.ts +1 -1
  137. package/dist/src/sdk-remote-config.d.ts +8 -1
  138. package/dist/src/sdk-remote-config.js +1 -1
  139. package/dist/src/sdk-selectors.d.ts +1 -1
  140. package/dist/src/selector-runtime.js +1 -1
  141. package/dist/src/server-startup.js +1 -1
  142. package/dist/src/server.js +1 -1
  143. package/dist/src/session-artifact-paths.js +1 -1
  144. package/dist/src/session-device-resolution.js +1 -1
  145. package/dist/src/session-open.js +1 -1
  146. package/dist/src/session-runtime.js +1 -1
  147. package/dist/src/session-selector.js +1 -1
  148. package/dist/src/session-store.js +1 -1
  149. package/dist/src/session2.js +4 -4
  150. package/dist/src/settle-observation-capture.js +1 -1
  151. package/dist/src/simctl.js +1 -1
  152. package/dist/src/simulator-boot.js +1 -1
  153. package/dist/src/snapshot-diagnostics.js +1 -1
  154. package/dist/src/snapshot-runtime-binding.js +1 -1
  155. package/dist/src/snapshot-runtime-capture-input.js +1 -1
  156. package/dist/src/snapshot-runtime.js +1 -1
  157. package/dist/src/snapshot.js +1 -1
  158. package/dist/src/src.js +1 -1
  159. package/dist/src/src3.js +4 -4
  160. package/dist/src/src4.js +1 -1
  161. package/dist/src/src9.js +1 -1
  162. package/dist/src/store.js +1 -1
  163. package/dist/src/telephony-runtime.js +1 -1
  164. package/dist/src/touch-runtime2.js +1 -1
  165. package/dist/src/transport.js +2 -2
  166. package/dist/src/tv-remote-runtime.js +1 -1
  167. package/dist/src/tv-remote.js +1 -1
  168. package/dist/src/type-text-runtime.js +1 -1
  169. package/package.json +1 -1
  170. package/server.json +2 -2
  171. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.34.apk.sha256 +0 -1
  172. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.34.apk.sha256 +0 -1
  173. package/dist/src/session-capture-binding.js +0 -1
  174. package/dist/src/session-teardown.js +0 -1
@@ -1 +1 @@
1
- import{I as e,R as t,i as n,t as r,w as i}from"./sdk-contracts.js";import{$ as a,Et as o,Q as s,Tt as c,ct as l,nt as u,ot as d,st as f,wt as ee,yt as p}from"./tv-remote.js";import{j as m,m as h}from"./sdk-batch-runner.js";import{i as g}from"./sdk-device.js";import{$r as te,Cr as ne,br as re,g as ie,pr as ae,ri as _,xr as oe}from"./sdk-batch.js";import{i as se}from"./recording-export-quality.js";import{t as ce}from"./recording-scope.js";import{a as le,o as ue}from"./sdk-remote-config.js";import{n as de}from"./session.js";import{c as fe}from"./observability.js";import pe from"node:path";function me(e,n){let r=e===void 0?NaN:Number(e);if(!Number.isInteger(r)||r<1)throw new t(`INVALID_ARGS`,`viewport ${n} must be a positive integer`);return r}function he(e){if(e.length!==2)throw new t(`INVALID_ARGS`,`viewport requires exactly two arguments: <width> <height>`);return{width:me(e[0],`width`),height:me(e[1],`height`)}}const v=`proxy`,ge=`cloud`,_e=new Set([v,ge]),ve=[`leaseId`,`tenantId`,`runId`,`clientId`,`deviceKey`];function ye(e){return m({tenantId:e.meta?.tenantId??S(e.flags,`tenant`),runId:e.meta?.runId??S(e.flags,`runId`),leaseId:e.meta?.leaseId??S(e.flags,`leaseId`),leaseTtlMs:e.meta?.leaseTtlMs,leaseRetainOnClose:e.meta?.leaseRetainOnClose,leaseBackend:e.meta?.leaseBackend,leaseProvider:e.meta?.leaseProvider??S(e.flags,`leaseProvider`)??S(e.flags,`provider`),deviceKey:e.meta?.deviceKey??S(e.flags,`deviceKey`),clientId:e.meta?.clientId??S(e.flags,`clientId`)})}function be(e){return m({tenantId:e.tenant,runId:e.runId,leaseId:e.leaseId,leaseTtlMs:e.leaseTtlMs??e.ttlMs,leaseRetainOnClose:e.retainOnClose,leaseBackend:e.leaseBackend,leaseProvider:e.leaseProvider??e.provider,deviceKey:e.deviceKey,clientId:e.clientId})}function xe(e){return m({tenantId:e.tenantId,runId:e.runId,leaseId:e.leaseId,leaseTtlMs:e.leaseTtlMs,leaseRetainOnClose:e.leaseRetainOnClose,leaseBackend:e.leaseBackend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId})}function Se(e){return m({tenant:e.tenantId,runId:e.runId,leaseId:e.leaseId,leaseBackend:e.leaseBackend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId})}function Ce(e){return m({tenantId:e.tenantId??``,runId:e.runId??``,leaseId:e.leaseId,leaseBackend:e.leaseBackend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId,ttlMs:e.leaseTtlMs,retainOnClose:e.leaseRetainOnClose})}function we(e){return Ue(e)}function Te(e){let{ttlMs:t,...n}=Ue(e);return n}function Ee(e,t,n){let r=m({...n.includeTokenParam?{token:n.token}:{},session:n.session,tenantId:e.tenantId,runId:e.runId,leaseProvider:e.leaseProvider,clientId:e.clientId,deviceKey:e.deviceKey});switch(t){case`lease_allocate`:return{...r,...m({leaseId:e.leaseId,ttlMs:e.leaseTtlMs,retainOnClose:e.leaseRetainOnClose,backend:e.leaseBackend})};case`lease_heartbeat`:return{...r,...m({leaseId:e.leaseId,ttlMs:e.leaseTtlMs})};case`lease_release`:return{...r,...m({leaseId:e.leaseId})}}}const De=`platform.target.device.udid.serial.iosSimulatorDeviceSet.androidDeviceAllowlist.providerApp.providerOsVersion.providerDeviceType.providerProject.providerBuild.providerSessionName.providerDeviceOrientation.providerGeoLocation.providerTimezone.providerAppiumVersion.providerLanguage.providerLocale.providerNetworkProfile.providerCustomNetwork.providerNoResignApp.awsProjectArn.awsDeviceArn.awsAppArn.awsRegion.awsInteractionMode`.split(`.`),Oe=[`osVersion`,`imageTag`,`physical`];function ke(e){let t={};for(let n of De){let r=e?.[n];(typeof r==`string`||typeof r==`boolean`)&&(t[n]=r)}let{spec:n,invalidKeys:r}=y(e);Object.assign(t,n);for(let n of r)t[n]=e?.[n];return t}function y(e){let t={},n=[];for(let r of Oe){let i=e?.[r];i!==void 0&&(typeof i==(r===`physical`?`boolean`:`string`)?i===!0?t[r]=!0:typeof i==`string`&&i.trim()&&(t[r]=i):n.push(r))}return{spec:t,keys:Oe.filter(e=>e in t),invalidKeys:n}}function Ae(e){let{spec:t,keys:n,invalidKeys:r}=y(e);if(r.length>0)throw b(r);return{spec:t,keys:n}}function je(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=x(t.model),r=x(t.osVersion);if(!n||!r||typeof t.physical!=`boolean`)return;let i=x(t.imageTag);return{model:n,osVersion:r,...i?{imageTag:i}:{},physical:t.physical}}function Me(e,n=`This daemon cannot pick a device by OS version, image tag, or physical/virtual class.`,r={}){return new t(`UNSUPPORTED_OPERATION`,n,{...r,reason:`device-spec-unsupported`,keys:[...e],hint:`Drop --os, --image-tag and --physical, or connect through a proxy whose backend picks devices by spec.`})}function b(e){return new t(`INVALID_ARGS`,`osVersion and imageTag take a string, and physical takes a boolean.`,{reason:`device-spec-invalid`,keys:[...e]})}function x(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function Ne(e){let t=m({leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId});return Object.keys(t).length>0?t:void 0}function Pe(e){return`${e.platform}:${e.target??`mobile`}:${e.id}`}function Fe(e){let t=/^([^:]+):([^:]+):(.+)$/.exec(e??``);if(!t)return;let[,n,r,i]=t;return{platform:n,target:r,id:i}}function Ie(e){return e.leaseProvider===v}function Le(e){let{leaseProvider:t}=e;return t===void 0||_e.has(t)?void 0:t}function Re(e){return Ie(e)?ve.filter(t=>!e[t]):[]}const ze=5e3,Be=new Set([`LEASE_NOT_FOUND`,`LEASE_EXPIRED`,`LEASE_REVOKED`]);function Ve(e){return typeof e==`object`&&!!e&&e.code===`UNAUTHORIZED`&&Be.has(e.details?.reason)}function He(e){let t=(e.ok?e.data:e.error.details)?.endedLeases;return Array.isArray(t)?t.flatMap(e=>{if(typeof e!=`object`||!e)return[];let{leaseId:t,outcome:n}=e;return typeof t==`string`&&n===`released`?[{leaseId:t,outcome:n}]:[]}):[]}function Ue(e){return m({leaseId:e.leaseId??``,tenantId:e.tenantId,runId:e.runId,leaseBackend:e.leaseBackend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId,ttlMs:e.leaseTtlMs})}function S(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}const C=[`pan`,`fling`,`swipe`,`pinch`,`rotate`,`transform`,`tap`,`drag`],We=[`points`,`holdMs`,`count`,`pauseMs`];function w(e){let n=E(e),r=k(n,`kind`,C);if(r===`tap`)return Ge(n);if(Je(r,n),r===`pan`)return{kind:r,origin:D(n,`origin`),delta:D(n,`delta`),pointerCount:h(n,`pointerCount`,{min:1,max:2}),durationMs:T(n)};if(r===`drag`)return Ye(n);if(n.pointerCount!==void 0)throw new t(`INVALID_ARGS`,`pointerCount is supported only for gesture pan`);if(r===`fling`){if(n.durationMs!==void 0)throw new t(`INVALID_ARGS`,`gesture fling does not accept durationMs; use gesture pan for timed movement`);return{kind:r,direction:k(n,`direction`,u),origin:D(n,`origin`),distance:h(n,`distance`,{min:0})}}if(r===`swipe`){if(n.durationMs!==void 0)throw new t(`INVALID_ARGS`,`gesture swipe does not accept durationMs; use gesture pan for timed movement`);return{kind:r,preset:k(n,`preset`,f)}}if(r===`pinch`)return{kind:r,scale:O(n,`scale`),origin:Xe(n,`origin`)};if(r===`rotate`){if(n.velocity!==void 0)throw new t(`INVALID_ARGS`,`gesture rotate does not accept velocity; rotation pacing derives from degrees`);return{kind:r,degrees:O(n,`degrees`),origin:Xe(n,`origin`)}}return{kind:r,origin:D(n,`origin`),delta:D(n,`delta`),scale:O(n,`scale`),degrees:O(n,`degrees`),durationMs:T(n)}}function Ge(e){if(e.pointerCount!==void 0)throw new t(`INVALID_ARGS`,`pointerCount is supported only for gesture pan`,{hint:`gesture tap takes one contact per point.`});if(e.durationMs!==void 0)throw new t(`INVALID_ARGS`,`gesture tap does not accept durationMs; use holdMs`);let n={kind:`tap`,points:Ke(e),holdMs:h(e,`holdMs`,{min:16,max:a}),count:h(e,`count`,{min:1,max:200}),pauseMs:h(e,`pauseMs`,{min:0,max:d})};return qe(n),n}function Ke(e){let n=e.points;if(!Array.isArray(n)||n.length<2||n.length>5)throw new t(`INVALID_ARGS`,`gesture tap requires 2 to 5 points`,{hint:`Use press for a single contact.`});return n.map((e,n)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw new t(`INVALID_ARGS`,`Expected points[${n}] to be a point.`);let r=e;return{x:O(r,`x`),y:O(r,`y`)}})}function qe(e){let n=e.count??1,r=e.pauseMs??0,i=e.holdMs??50,a=n*(i+500)+Math.max(0,n-1)*r;if(!(a<=6e4))throw new t(`INVALID_ARGS`,`gesture tap series must fit within ${l}ms.`,{count:n,pauseMs:r,holdMs:i,overheadAllowanceMs:500,scheduledDurationMs:a,hint:`Reduce --count, --pause-ms or --hold-ms.`})}function Je(e,n){let r=We.find(e=>n[e]!==void 0);if(r!==void 0)throw new t(`INVALID_ARGS`,`${r} is supported only for gesture tap`,{hint:`gesture ${e} does not read ${r}.`})}function Ye(e){let n=h(e,`sourceHoldMs`,{min:1,max:1e4}),r=h(e,`moveMs`,{min:16,max:1e4}),i=h(e,`destinationHoldMs`,{min:0,max:1e4});if((n??800)+(r??500)+(i??0)>1e4)throw new t(`INVALID_ARGS`,`gesture drag total duration must be at most ${a}`);return{kind:`drag`,source:Ze(e,`source`),destination:Ze(e,`destination`),sourceHoldMs:n,moveMs:r,destinationHoldMs:i}}function T(e){let n=h(e,`durationMs`);if(n!==void 0){if(n<16||n>1e4)throw new t(`INVALID_ARGS`,`Expected durationMs to be an integer between 16 and ${a}.`);return n}}function E(e){if(!e||typeof e!=`object`||Array.isArray(e))throw new t(`INVALID_ARGS`,`gesture requires structured object input`);return e}function D(e,t){let n=E(e[t]);return{x:O(n,`x`),y:O(n,`y`)}}function Xe(e,t){return e[t]===void 0?void 0:D(e,t)}function O(e,n){let r=e[n];if(typeof r!=`number`||!Number.isFinite(r))throw new t(`INVALID_ARGS`,`Expected ${n} to be a finite number.`);return r}function Ze(e,n){let r=e[n];if(typeof r!=`string`||r.trim().length===0)throw new t(`INVALID_ARGS`,`Expected ${n} to be a non-empty string.`);return r.trim()}function k(e,n,r){let i=e[n];if(typeof i!=`string`||!r.includes(i))throw new t(`INVALID_ARGS`,`Expected ${n} to be one of: ${r.join(`, `)}.`);return i}const Qe={pointerCount:`--pointer-count`,holdMs:`--hold-ms`,count:`--count`,pauseMs:`--pause-ms`},A={pan:[`pointerCount`],tap:[`holdMs`,`count`,`pauseMs`],fling:[],swipe:[],pinch:[],rotate:[],transform:[],drag:[]};function $e(e,t,n,r){if(e!==`gesture`)return;let i=t[0];if(i===void 0||!Object.hasOwn(A,i))return;let a=A[i],o=Object.keys(Qe).filter(e=>n[e]!==void 0&&!a.includes(e));if(o.length!==0)return`gesture ${i} does not read ${o.map(e=>Qe[e]).join(`, `)} (${r}).`}const et={swipe:{max:4,usage:`swipe accepts 4 arguments: x1 y1 x2 y2`,retired:{positional:`durationMs`,migrate:tt}},"gesture pan":{max:5,usage:`gesture pan accepts at most 5 arguments: x y dx dy [durationMs]`},"gesture fling":{max:4,usage:`gesture fling accepts at most 4 arguments: direction x y [distance]`,retired:{positional:`durationMs`,migrate:(e,t)=>`use "${t}", or gesture pan for timed movement.`}},"gesture swipe":{max:1,usage:`gesture swipe accepts 1 argument: preset`,retired:{positional:`durationMs`,migrate:(e,t)=>`use "${t}", or gesture pan for timed movement.`}},"gesture pinch":{max:3,usage:`gesture pinch accepts at most 3 arguments: scale [x] [y]`},"gesture rotate":{max:3,usage:`gesture rotate accepts at most 3 arguments: degrees [x] [y]`,retired:{positional:`velocity`,migrate:(e,t)=>`use "${t}"; rotation pacing derives from degrees.`}},"gesture transform":{max:7,usage:`gesture transform accepts at most 7 arguments: x y dx dy scale degrees [durationMs]`},"gesture tap":{min:4,max:10,pairs:!0,usage:`gesture tap accepts 4 to 10 arguments: x1 y1 x2 y2 [x3 y3 [x4 y4 [x5 y5]]]`},"gesture drag":{max:5,usage:`gesture drag accepts at most 5 arguments: source destination [sourceHoldMs] [moveMs] [destinationHoldMs]`}};function tt(e,t){let[n,r,i,a,o]=e,s=nt(n,i),c=nt(r,a);return s===void 0||c===void 0?`use "gesture pan x1 y1 dx dy durationMs" for the same timed drag, or "${t}" for a default-duration swipe.`:`use "gesture pan ${n} ${r} ${s} ${c} ${o}" for the same timed drag, or "${t}" for a default-duration swipe.`}function nt(e,t){let n=Number(t)-Number(e);return Number.isFinite(n)?n:void 0}function j(e,t){let n=et[e];if(n.min!==void 0&&t.length<n.min||n.pairs&&t.length%2!=0)return{usage:n.usage};if(t.length<=n.max)return;let r=n.retired;if(!r||t.length!==n.max+1||!rt(t[n.max]))return{usage:n.usage};let i=`${e} ${t.slice(0,n.max).join(` `)}`;return{usage:n.usage,migration:`The trailing ${r.positional} positional was removed: ${r.migrate(t,i)}`}}function rt(e){return e===void 0||e.trim().length===0?!1:e.startsWith("${")||Number.isFinite(Number(e))}function it(e){if(!(!e||typeof e!=`object`||Array.isArray(e))&&e.durationMs!==void 0)throw new t(`INVALID_ARGS`,`swipe does not accept durationMs; use gesture pan for timed movement`)}function at(e,t){let n=t?`${e.usage} (${t})`:e.usage;return e.migration?`${n}. ${e.migration}`:`${n}.`}function M(e,n){let r=j(e,n);if(r)throw new t(`INVALID_ARGS`,at(r))}function ot(e,t,n){let r=st(e,t);return r?at(r,n):void 0}function st(e,t){if(e===`swipe`)return j(`swipe`,t);if(e!==`gesture`)return;let n=`gesture ${t[0]}`;if(Object.hasOwn(et,n))return j(n,t.slice(1))}function ct(e){return{origin:{x:Number(e[0]),y:Number(e[1])},delta:{x:Number(e[2]),y:Number(e[3])}}}function N(e,t={}){let{pointerCount:n}=t,r=e[0],i=e.slice(1);switch(r){case`pan`:{M(`gesture pan`,i);let{origin:e,delta:t}=ct(i);return w({kind:r,origin:e,delta:t,pointerCount:n,durationMs:P(i[4])})}case`fling`:return M(`gesture fling`,i),w({kind:r,direction:i[0],origin:{x:Number(i[1]),y:Number(i[2])},distance:P(i[3])});case`swipe`:return M(`gesture swipe`,i),w({kind:r,preset:i[0]});case`pinch`:return M(`gesture pinch`,i),w({kind:r,scale:Number(i[0]),origin:F(i[1],i[2])});case`rotate`:return M(`gesture rotate`,i),w({kind:r,degrees:Number(i[0]),origin:F(i[1],i[2])});case`transform`:{M(`gesture transform`,i);let{origin:e,delta:t}=ct(i);return w({kind:r,origin:e,delta:t,scale:Number(i[4]),degrees:Number(i[5]),durationMs:P(i[6])})}case`tap`:return M(`gesture tap`,i),w({kind:r,points:ht(i),holdMs:t.holdMs,count:t.count,pauseMs:t.pauseMs});case`drag`:return M(`gesture drag`,i),w({kind:r,source:i[0],destination:i[1],sourceHoldMs:P(i[2]),moveMs:P(i[3]),destinationHoldMs:P(i[4])});default:return w({kind:r})}}function lt(e){if(e[0]!==`drag`)return;let t=N(e);return t.kind===`drag`?t:void 0}function ut(e){switch(e.kind){case`pan`:return I([e.kind,e.origin.x,e.origin.y,e.delta.x,e.delta.y,e.durationMs]);case`fling`:return I([e.kind,e.direction,e.origin.x,e.origin.y,e.distance]);case`swipe`:return[e.kind,e.preset];case`pinch`:return I([e.kind,e.scale,e.origin?.x,e.origin?.y]);case`rotate`:return e.origin?I([e.kind,e.degrees,e.origin.x,e.origin.y]):[e.kind,String(e.degrees)];case`transform`:return I([e.kind,e.origin.x,e.origin.y,e.delta.x,e.delta.y,e.scale,e.degrees,e.durationMs]);case`tap`:return[e.kind,...e.points.flatMap(e=>[String(e.x),String(e.y)])];case`drag`:return[e.kind,e.source,e.destination,String(e.sourceHoldMs??800),String(e.moveMs??500),String(e.destinationHoldMs??0)]}}function dt(e,t={}){return M(`swipe`,e),{from:{x:Number(e[0]),y:Number(e[1])},to:{x:Number(e[2]),y:Number(e[3])},...t.count===void 0?{}:{count:t.count},...t.pauseMs===void 0?{}:{pauseMs:t.pauseMs},...t.pattern===void 0?{}:{pattern:t.pattern}}}function ft(e){switch(e.kind){case`pan`:return{gesture:{intent:`pan`,origin:e.origin,delta:e.delta,pointerCount:e.pointerCount,durationMs:e.durationMs}};case`fling`:return{gesture:{intent:`fling`,direction:e.direction,origin:e.origin,distance:e.distance}};case`swipe`:return{gesture:{intent:`fling`,preset:e.preset}};case`pinch`:return{gesture:{intent:`pinch`,origin:e.origin,scale:e.scale}};case`rotate`:return{gesture:{intent:`rotate`,origin:e.origin,degrees:e.degrees}};case`transform`:return{gesture:{intent:`transform`,origin:e.origin,delta:e.delta,scale:e.scale,degrees:e.degrees,durationMs:e.durationMs}};case`tap`:return{gesture:{intent:`tap`,points:e.points,holdMs:e.holdMs}};case`drag`:throw new t(`INVALID_ARGS`,`gesture drag targets must be resolved before coordinate normalization`)}}function pt(e){return e.kind===`drag`?{intent:`drag`,source:e.source,destination:e.destination,sourceHoldMs:e.sourceHoldMs,moveMs:e.moveMs,destinationHoldMs:e.destinationHoldMs}:ft(e).gesture}function mt(e){return{gesture:{intent:`fling`,from:e.from,to:e.to}}}function ht(e){let t=[];for(let n=0;n+1<e.length;n+=2)t.push({x:Number(e[n]),y:Number(e[n+1])});return t}function P(e){return e===void 0?void 0:Number(e)}function F(e,n){if(e===void 0!=(n===void 0))throw new t(`INVALID_ARGS`,`gesture origin requires both x and y coordinates`);return e===void 0?void 0:{x:Number(e),y:Number(n)}}function I(e){return e.filter(e=>e!==void 0).map(String)}const gt={ios:!0,android:!0,harmonyos:!0};function L(e){return typeof e==`string`&&Object.hasOwn(gt,e)}function R(t){return t.startsWith(`@`)?e(t)?.base??t:t}const z=/^-?\d+(\.\d+)?$/,_t=/^[^\s"'\\][^\s"\\]*$/,vt=new Map([[`--count`,`count`],[`--interval-ms`,`intervalMs`],[`--hold-ms`,`holdMs`],[`--jitter-px`,`jitterPx`]]),yt=new Map([[`--count`,`count`],[`--pause-ms`,`pauseMs`]]),bt=new Map([[`--pointer-count`,`pointerCount`],[`--hold-ms`,`holdMs`],[`--count`,`count`],[`--pause-ms`,`pauseMs`]]),xt=new Map([[`--delay-ms`,`delayMs`]]),B={scroll:new Map([[`--until`,{key:`until`,kind:`string`}],[`--max-passes`,{key:`maxPasses`,kind:`int`}]]),wait:new Map([[`--raw`,{key:`snapshotRaw`,kind:`boolean`}],[`--depth`,{key:`snapshotDepth`,kind:`int`}],[`--scope`,{key:`snapshotScope`,kind:`string`}]])};Object.keys(B);function St(e,t){let n=[],r={},i=B[e];for(let e=0;e<t.length;e+=1){let a=t[e],o=i.get(a),s=t[e+1];if(o===void 0||o.kind!==`boolean`&&s===void 0){n.push(a);continue}if(o.kind===`boolean`){Object.assign(r,{[o.key]:!0});continue}if(o.kind===`int`){let e=G(s);if(e===null){n.push(a);continue}Object.assign(r,{[o.key]:e})}else Object.assign(r,{[o.key]:s});e+=1}return{positionals:n,flags:r}}function V(e){return e===`click`||e===`press`}function Ct(e){return V(e)||e===`longpress`||e===`hover`}function wt(e){return e===`type`||e===`fill`}function H(e){return Et(e,Dt)}function Tt(e){return JSON.stringify(e)}function U(e){return Et(e,Ot)}function Et(e,t){return t(e)?e:Tt(e)}function Dt(e){return Ot(e)&&e.startsWith(`@`)||z.test(e)}function Ot(e){return _t.test(e)}const kt=new Set([`fill`,`type`]);function At(e){if(!kt.has(e.command)){let t=(e.positionals??[]).map(e=>H(e));return[e.command,...t].join(` `)}let t=jt(e).map(e=>H(e)).join(` `);return[e.command,t,`<text>`].filter(e=>e.length>0).join(` `)}function jt(e){if(e.command===`type`)return[];let t=e.positionals??[],n=t[0];return n===void 0?[]:n.startsWith(`@`)?[n]:t.length>=3&&z.test(n)&&z.test(t[1]??``)?[n,t[1]]:[n]}function Mt(e,t){let n=t.flags??{};if(V(t.command)){typeof n.count==`number`&&e.push(`--count`,String(n.count)),typeof n.intervalMs==`number`&&e.push(`--interval-ms`,String(n.intervalMs)),typeof n.holdMs==`number`&&e.push(`--hold-ms`,String(n.holdMs)),typeof n.jitterPx==`number`&&e.push(`--jitter-px`,String(n.jitterPx)),n.doubleTap===!0&&e.push(`--double-tap`);let t=n.clickButton;t&&t!==`primary`&&e.push(`--button`,t);return}if(t.command===`swipe`){typeof n.count==`number`&&e.push(`--count`,String(n.count)),typeof n.pauseMs==`number`&&e.push(`--pause-ms`,String(n.pauseMs)),(n.pattern===`one-way`||n.pattern===`ping-pong`)&&e.push(`--pattern`,n.pattern);return}if(t.command===`gesture`){typeof n.pointerCount==`number`&&e.push(`--pointer-count`,String(n.pointerCount)),typeof n.holdMs==`number`&&e.push(`--hold-ms`,String(n.holdMs)),typeof n.count==`number`&&e.push(`--count`,String(n.count)),typeof n.pauseMs==`number`&&e.push(`--pause-ms`,String(n.pauseMs));return}wt(t.command)&&typeof n.delayMs==`number`&&e.push(`--delay-ms`,String(n.delayMs))}function Nt(e,t){t&&(L(t.platform)&&e.push(`--platform`,t.platform),typeof t.metroHost==`string`&&t.metroHost.length>0&&e.push(`--metro-host`,U(t.metroHost)),typeof t.metroPort==`number`&&e.push(`--metro-port`,String(t.metroPort)),typeof t.bundleUrl==`string`&&t.bundleUrl.length>0&&e.push(`--bundle-url`,U(t.bundleUrl)),typeof t.launchUrl==`string`&&t.launchUrl.length>0&&e.push(`--launch-url`,U(t.launchUrl)))}function Pt(e,t){let[n,...r]=t.positionals??[];n&&e.push(U(n));for(let t of r)e.push(H(t));typeof t.flags?.fps==`number`&&e.push(`--fps`,String(t.flags.fps)),(typeof t.flags?.quality==`number`||typeof t.flags?.quality==`string`)&&e.push(`--quality`,String(t.flags.quality)),t.flags?.hideTouches&&e.push(`--hide-touches`)}function Ft(e,t){t.flags?.snapshotInteractiveOnly&&e.push(`-i`),typeof t.flags?.snapshotDepth==`number`&&e.push(`-d`,String(t.flags.snapshotDepth)),t.flags?.snapshotScope&&e.push(`-s`,H(t.flags.snapshotScope)),t.flags?.snapshotRaw&&e.push(`--raw`)}function It(e,t){for(let n of t.positionals??[])e.push(H(n));let n=t.flags?.screenshotCropOn;typeof n==`string`&&n.length>0&&e.push(`--crop-on`,U(n)),c(e,t.flags)}function Lt(e,t,n={}){let r=t.positionals??[],i=n.includeAllPositionals?r:r.slice(0,1);for(let t of i)e.push(U(t));Nt(e,t.flags)}function Rt(e,t){for(let n of t.positionals??[])e.push(H(t.command===`wait`?R(n):n));t.command===`fold`&&t.flags?.keyframes!==void 0&&e.push(`--keyframes`,H(t.flags.keyframes)),t.command===`scroll`&&typeof t.flags?.until==`string`&&e.push(`--until`,H(t.flags.until)),t.command===`scroll`&&typeof t.flags?.maxPasses==`number`&&e.push(`--max-passes`,String(t.flags.maxPasses)),t.command===`wait`&&zt(e,t.flags),Mt(e,t)}function zt(e,t){t&&(t.snapshotRaw===!0&&e.push(`--raw`),typeof t.snapshotDepth==`number`&&e.push(`--depth`,String(t.snapshotDepth)),typeof t.snapshotScope==`string`&&e.push(`--scope`,H(t.snapshotScope)))}function W(e,t){let n=[],r={},i=V(e)?vt:e===`swipe`?yt:e===`gesture`?bt:wt(e)?xt:void 0;for(let a=0;a<t.length;a+=1){let o=t[a];if(V(e)&&o===`--double-tap`){r.doubleTap=!0;continue}let s=t[a+1];if(e===`fold`&&o===`--keyframes`&&s!==void 0){r.keyframes=s,a+=1;continue}if(V(e)&&o===`--button`&&s!==void 0){let e=s;(e===`primary`||e===`secondary`||e===`middle`)&&(r.clickButton=e),a+=1;continue}let c=i?.get(o);if(c&&s!==void 0){let e=G(s);if(e!==null){r[c]=e,a+=1;continue}}if(e===`swipe`&&o===`--pattern`&&s!==void 0){let e=s;(e===`one-way`||e===`ping-pong`)&&(r.pattern=e),a+=1;continue}n.push(o)}return{positionals:n,flags:r}}function Bt(e){let t=[],n={};for(let r=0;r<e.length;r+=1){let i=e[r],a=e[r+1];if(i===`--platform`&&a!==void 0){let e=a;L(e)&&(n.platform=e),r+=1;continue}if(i===`--metro-host`&&a!==void 0){n.metroHost=a,r+=1;continue}if(i===`--metro-port`&&a!==void 0){let e=G(a);e!==null&&(n.metroPort=e),r+=1;continue}if(i===`--bundle-url`&&a!==void 0){n.bundleUrl=a,r+=1;continue}if(i===`--launch-url`&&a!==void 0){n.launchUrl=a,r+=1;continue}t.push(i)}return{positionals:t,flags:n}}function G(e){if(!e)return null;let t=Number(e);return!Number.isFinite(t)||t<0?null:Math.floor(t)}function Vt(e){let t;for(let n of e){if(n.command===`runtime`&&typeof n.flags.platform==`string`){t=n.flags.platform;continue}if(n.command===`open`)return n.runtime?.platform??t}return t}function Ht(e,t){for(let n of t.positionals??[])e.push(H(n));t.flags?.relaunch&&e.push(`--relaunch`),t.flags?.surface!==void 0&&e.push(`--surface`,t.flags.surface),t.flags?.testIme===!0?e.push(`--test-ime`):t.flags?.testIme===!1&&e.push(`--no-test-ime`),Nt(e,t.runtime)}function Ut(e){let t=[],n={};for(let r=0;r<e.length;r+=1){let i=e[r];if(i===`--surface`){n.surface=Kt(e[r+1]),r+=1;continue}if(i===`--relaunch`){n.relaunch=!0;continue}if(i===`--test-ime`){n.testIme=!0;continue}if(i===`--no-test-ime`){n.testIme=!1;continue}t.push(i)}let r=Bt(t);return{positionals:r.positionals,flags:n,runtime:qt(r.flags)?r.flags:void 0}}const Wt={app:!0,"frontmost-app":!0,desktop:!0,menubar:!0};function Gt(e){return Object.hasOwn(Wt,e)}function Kt(e){let n=e?.trim().toLowerCase();if(n!==void 0&&Gt(n))return n;throw new t(`INVALID_ARGS`,`Invalid surface: ${e}. Use ${Object.keys(Wt).join(`|`)}.`)}function qt(e){return!!(e.platform||e.metroHost||e.metroPort!==void 0||e.bundleUrl||e.launchUrl)}const Jt=/^[A-Z_][A-Z0-9_]*$/,Yt=new Set(g.filter(e=>e!==`web`)),Xt=new Set([`mobile`,`tv`,`desktop`]);function Zt(e){let n=[],r=[],i=e.split(/\r?\n/),a=!1,o,s=(e,n,r)=>{let i=e.kind===`multiple`?`targets-v1`:`target-v1`;throw new t(`INVALID_ARGS`,`${i} annotation on line ${e.line} must be immediately followed by its action line (line ${n+1} ${r}).`)};for(let[e,c]of i.entries()){let i=c.trim();if(i.length===0){o&&s(o,e,`is blank`);continue}if(i.startsWith(`#`)){let t=re(i);if(t.kind===`v1`){o&&s(o,e,`is another target annotation`),o={kind:`multiple`,evidence:t.evidence,line:e+1};continue}let n=oe(i);if(n.kind===`v1`){o&&s(o,e,`is another target annotation`),o={kind:`single`,evidence:n.evidence,line:e+1};continue}o&&s(o,e,`is a comment`);continue}if($t(i)){if(o&&s(o,e,`is an env directive`),a)throw new t(`INVALID_ARGS`,`env directives must precede all actions (line ${e+1}).`);continue}let l=rn(c);if(!l){o&&s(o,e,`did not parse as an action`);continue}let u=ot(l.command,l.positionals??[],`line ${e+1}`);if(u)throw new t(`INVALID_ARGS`,u);let d=$e(l.command,l.positionals??[],l.flags??{},`line ${e+1}`);if(d)throw new t(`INVALID_ARGS`,d);o&&=(o.kind===`single`?l.targetEvidence=o.evidence:l.targetEvidences=o.evidence,void 0),n.push(l),r.push(e+1),a=!0}if(o){let e=o.kind===`multiple`?`targets-v1`:`target-v1`;throw new t(`INVALID_ARGS`,`${e} annotation on line ${o.line} must be immediately followed by its action line (end of script reached).`)}return{actions:n,actionLines:r}}function Qt(e){let t=e.split(/\r?\n/),n={};for(let[e,r]of t.entries()){let t=r.trim();if(t.length===0||t.startsWith(`#`))continue;if($t(t)){nn(n,t,e+1);continue}if(!t.startsWith(`context `))break;let i=t.match(/(?:^|\s)platform=([^\s]+)/);if(i){let e=i[1];e&&Yt.has(e)&&K(n,`platform`,e)}let a=t.match(/(?:^|\s)target=([^\s]+)/);if(a){let e=a[1];e&&Xt.has(e)&&K(n,`target`,e)}let o=t.match(/(?:^|\s)timeout=(\d+)/);if(o){let e=Number(o[1]);Number.isFinite(e)&&e>=1&&K(n,`timeoutMs`,Math.floor(e))}let s=t.match(/(?:^|\s)retries=(\d+)/);if(s){let e=Number(s[1]);Number.isFinite(e)&&e>=0&&K(n,`retries`,Math.floor(e))}}return n}function $t(e){return e===`env`||e.startsWith(`env `)||e.startsWith(`env `)}function en(e,n){let r=e.slice(3).replace(/^[\s]+/,``),i=r.indexOf(`=`);if(i<=0)throw new t(`INVALID_ARGS`,`Invalid env directive on line ${n}: expected "env KEY=VALUE".`);let a=r.slice(0,i);if(!Jt.test(a))throw new t(`INVALID_ARGS`,`Invalid env key "${a}" on line ${n}: keys must be uppercase letters, digits, and underscores (e.g. APP_ID).`);if(a.startsWith(`AD_`))throw new t(`INVALID_ARGS`,`Invalid env key "${a}" on line ${n}: the AD_* namespace is reserved for built-in variables. Rename ${a} to avoid the AD_ prefix.`);return{key:a,value:tn(r.slice(i+1),n)}}function tn(e,n){if(e.length===0)return``;if(e.startsWith(`"`))try{let t=JSON.parse(e);if(typeof t!=`string`)throw Error(`not a string literal`);return t}catch{throw new t(`INVALID_ARGS`,`Invalid quoted env value on line ${n}.`)}return e}function nn(e,n,r){let{key:i,value:a}=en(n,r),o=e.env??{};if(Object.prototype.hasOwnProperty.call(o,i))throw new t(`INVALID_ARGS`,`Duplicate env directive "${i}" on line ${r}.`);o[i]=a,e.env=o}function K(e,n,r){let i=e[n];if(i!==void 0){let e=i===r?`Duplicate replay test metadata "${n}" in context header.`:`Conflicting replay test metadata "${n}" in context header: ${String(i)} vs ${String(r)}.`;throw new t(`INVALID_ARGS`,e)}e[n]=r}function rn(e){let n=e.trim();if(n.length===0||n.startsWith(`#`))return null;let[r,...i]=on(n);if(r===void 0||r===`context`)return null;let a={ts:Date.now(),command:r,positionals:[],flags:{}};if(r===`snapshot`){a.positionals=[];for(let e=0;e<i.length;e+=1){let t=i[e];if(t===`-i`){a.flags.snapshotInteractiveOnly=!0;continue}if(t!==`-c`){if(t===`--raw`){a.flags.snapshotRaw=!0;continue}if(t===`--force-full`){a.flags.snapshotForceFull=!0;continue}if((t===`-d`||t===`--depth`)&&e+1<i.length){let t=Number(i[e+1]);Number.isFinite(t)&&t>=0&&(a.flags.snapshotDepth=Math.floor(t)),e+=1;continue}if((t===`-s`||t===`--scope`)&&e+1<i.length){a.flags.snapshotScope=i[e+1],e+=1;continue}if(t===`--backend`&&e+1<i.length){e+=1;continue}}}return a}if(r===`open`){let e=Ut(i);return a.positionals=e.positionals,Object.assign(a.flags,e.flags),a.runtime=e.runtime,a}if(r===`runtime`){let e=Bt(i);return a.positionals=e.positionals,Object.assign(a.flags,e.flags),a}if(V(r)){let e=W(r,i);Object.assign(a.flags,e.flags);let t=e.positionals[0];if(t===void 0)return a;if(t.startsWith(`@`))return a.positionals=[R(t)],e.positionals[1]&&(a.result={refLabel:e.positionals[1]}),a;let n=e.positionals[0],o=e.positionals[1];return q(n)&&q(o)&&e.positionals.length>=2?(a.positionals=[n,o],a):(a.positionals=[e.positionals.join(` `)],a)}if(r===`fill`){let e=W(r,i);if(Object.assign(a.flags,e.flags),!an(e.positionals))return a.positionals=e.positionals,a;let[t,n,...o]=e.positionals;if(q(t)&&q(n))return a.positionals=[t,n,o.join(` `)],a;let[s,c,...l]=e.positionals;if(s.startsWith(`@`)){let e=R(s);return l.length>0?(a.positionals=[e,l.join(` `)],a.result={refLabel:c},a):(a.positionals=[e,c],a)}return a.positionals=[s,[c,...l].join(` `)],a}if(r===`get`){let e=i[0],t=i[1];return e===void 0||t===void 0?(a.positionals=i,a):t.startsWith(`@`)?(a.positionals=[e,R(t)],i[2]&&(a.result={refLabel:i[2]}),a):(a.positionals=[e,i.slice(1).join(` `)],a)}if(r===`swipe`||r===`type`||r===`gesture`||r===`fold`){let e=W(r,i);return Object.assign(a.flags,e.flags),a.positionals=e.positionals,a}if(r===`record`){let e=[];for(let n=0;n<i.length;n+=1){let r=i[n];if(r===p.cliToken)throw new t(`INVALID_ARGS`,p.migration.record);if(r===`--hide-touches`){a.flags.hideTouches=!0;continue}if(r===`--fps`&&n+1<i.length){let e=Number(i[n+1]);Number.isFinite(e)&&(a.flags.fps=Math.floor(e)),n+=1;continue}if(r===`--quality`&&n+1<i.length){let e=i[n+1],t=se(e);t!==void 0&&(a.flags.quality=t),n+=1;continue}e.push(r)}return a.positionals=e,a}if(r===`screenshot`){let e=[];for(let t=0;t<i.length;t+=1){let n=i[t],r=o({args:i,index:t,flags:a.flags});if(r.handled){t=r.nextIndex;continue}e.push(n)}return a.positionals=e,a}if(r===`scroll`||r===`wait`){let e=St(r,i);return Object.assign(a.flags,e.flags),a.positionals=e.positionals.map(e=>R(e)),a}return a.positionals=r===`longpress`||r===`hover`?i.map(e=>R(e)):i,a}function an(e){return e.length>=2}function q(e){return e?!Number.isNaN(Number(e)):!1}function on(e){let t=[],n=0;for(;n<e.length&&(n=sn(e,n),!(n>=e.length));){let r=e[n]===`"`?cn(e,n):ln(e,n)??mn(e,n);t.push(r.value),n=r.nextCursor}return t}function sn(e,t){let n=t;for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n}function cn(e,n){let r=n+1,i=!1,a=r;for(;a<e.length;a+=1){let t=e.charAt(a);if(t===`"`&&!i)break;if(i){i=!1;continue}i=t===`\\`}if(a>=e.length)throw new t(`INVALID_ARGS`,`Invalid replay script line: ${e}`);let o=e.slice(n,a+1),s;try{s=JSON.parse(o)}catch{throw new t(`INVALID_ARGS`,`Invalid quoted value ${o} in replay script line: ${e}`,{hint:`Quoted replay values are JSON strings: escape backslashes, quotes, tabs, and newlines (\\\\, \\", \\t, \\n).`})}return{value:s,nextCursor:a+1}}function ln(e,t){if(e[t]!==`'`)return null;let n=un(e,t+1);return n===-1||!fn(e,n+1)?null:{value:pn(e.slice(t+1,n)),nextCursor:n+1}}function un(e,t){let n=t;for(;n<e.length;){let t=e.indexOf(`'`,n);if(t===-1)return-1;if(!dn(e,t))return t;n=t+1}return-1}function dn(e,t){let n=0;for(;t>0&&e.charAt(t-1)===`\\`;)n+=1,--t;return n%2==1}function fn(e,t){return t>=e.length||/\s/.test(e.charAt(t))}function pn(e){return e.replaceAll(String.raw`\'`,`'`)}function mn(e,t){let n=t;for(;n<e.length&&!/\s/.test(e.charAt(n));)n+=1;return{value:e.slice(t,n),nextCursor:n}}function hn(e){let t=pe.extname(e).toLowerCase();return t===`.yaml`||t===`.yml`}function gn(e,t){return`Maestro YAML requires explicit --maestro routing: ${e} ${t} --maestro`}function _n(e){return`Unsupported replay backend "${e}".`}function vn(e){return e===`maestro`}function yn(e,t){return t===`maestro`&&hn(e)?`maestro`:`ad`}const bn=J(`public`),xn=J(`internal`),Sn=J(`local-cli`),Cn={help:`help`};function wn(){return[...Object.values(bn),...Object.values(Sn)].sort()}function Tn(e){return Object.values(Cn).includes(e)||Object.values(xn).includes(e)?!0:wn().includes(e)}function J(e){let t={};for(let[n,r]of ie(e))t[n]=r;return t}const En=[{key:`keyframes`,names:[`--keyframes`],type:`string`,usageLabel:`--keyframes <json>`,usageDescription:`Fold: timed {atMs, angle} keyframes; final atMs is motion duration (up to 60000ms)`,projectConfig:!1,recorded:!0},{key:`count`,names:[`--count`],type:`int`,min:1,max:200,usageLabel:`--count <n>`,usageDescription:`Repeat count for press, swipe and gesture tap series`,projectConfig:!0,recorded:!0},{key:`pointerCount`,names:[`--pointer-count`],type:`int`,min:1,max:2,usageLabel:`--pointer-count <1|2>`,usageDescription:`Gesture pan: number of touch pointers (default 1)`,projectConfig:!0,recorded:!0},{key:`fps`,names:[`--fps`],type:`int`,min:1,max:120,usageLabel:`--fps <n>`,usageDescription:`Record: target frames per second (iOS physical device runner); also lowers the touch-overlay rate, which never exceeds 30`,projectConfig:!0,recorded:!0},{key:`quality`,names:[`--quality`],type:`string`,usageLabel:`--quality <medium|high>`,usageDescription:`Record: output quality preset; Android maps this to screenrecord bitrate, Limrun sessions map medium to recorder quality 5 and high to 8; Apple export always preserves the captured resolution, so it has no effect there. Legacy numeric values 5-7 map to medium; 8-10 map to high`,projectConfig:!0,recorded:!0},{key:`hideTouches`,names:[`--hide-touches`],type:`boolean`,usageLabel:`--hide-touches`,usageDescription:`Record: skip touch-overlay post-processing for faster raw benchmark videos`,projectConfig:!0,recorded:!0},{key:`recordingScope`,names:[`--scope`],type:`enum`,enumValues:ce,usageLabel:`--scope <app|device|system>`,usageDescription:`Record: app requires an active app session; device/system records the whole screen`,projectConfig:!0,recorded:!1},{key:`intervalMs`,names:[`--interval-ms`],type:`int`,min:0,max:1e4,usageLabel:`--interval-ms <ms>`,usageDescription:`Delay between press iterations`,projectConfig:!0,recorded:!0},{key:`delayMs`,names:[`--delay-ms`],type:`int`,min:0,max:1e4,usageLabel:`--delay-ms <ms>`,usageDescription:`Delay between typed characters`,projectConfig:!0,recorded:!0},{key:`recordAs`,names:[`--record-as`],type:`string`,usageLabel:`--record-as <VAR>`,usageDescription:"Fill: send the live text but publish ${VAR} in an armed .ad recording",projectConfig:!0,recorded:!1},{key:`textStdin`,names:[`--text-stdin`],type:`boolean`,usageLabel:`--text-stdin`,usageDescription:`Fill: read the text from stdin (max 64 KiB, one trailing newline removed) instead of argv`,projectConfig:!1,recorded:!1},{key:`durationMs`,names:[`--duration-ms`],type:`int`,min:0,max:1e4,usageLabel:`--duration-ms <ms>`,usageDescription:`Scroll: pace the gesture over this duration when supported`,projectConfig:!0,recorded:!1},{key:`holdMs`,names:[`--hold-ms`],type:`int`,min:0,max:1e4,usageLabel:`--hold-ms <ms>`,usageDescription:`Press or gesture tap hold duration for each iteration`,projectConfig:!0,recorded:!0},{key:`jitterPx`,names:[`--jitter-px`],type:`int`,min:0,max:100,usageLabel:`--jitter-px <n>`,usageDescription:`Deterministic per-axis coordinate jitter in pixels`,projectConfig:!0,recorded:!0},{key:`pixels`,names:[`--pixels`],type:`int`,min:1,max:1e5,usageLabel:`--pixels <n>`,usageDescription:`Scroll: explicit gesture distance in pixels`,projectConfig:!0,recorded:!1},{key:`until`,names:[`--until`],type:`string`,usageLabel:`--until <selector>`,usageDescription:`Scroll: repeat passes until the selector is visible on screen`,projectConfig:!0,recorded:!0},{key:`maxPasses`,names:[`--max-passes`],type:`int`,min:1,max:200,usageLabel:`--max-passes <n>`,usageDescription:`Scroll --until: maximum gestures`,projectConfig:!1,recorded:!0},{key:`doubleTap`,names:[`--double-tap`],type:`boolean`,usageLabel:`--double-tap`,usageDescription:`Use double-tap gesture per press iteration`,projectConfig:!0,recorded:!0},{key:`verify`,names:[`--verify`],type:`boolean`,usageLabel:`--verify`,usageDescription:`Capture cheap post-action evidence (AX digest, node counts, changedFromBefore) instead of a follow-up snapshot`,projectConfig:!0,recorded:!1},{key:`settle`,names:[`--settle`],type:`boolean`,usageLabel:`--settle`,usageDescription:`After the action, wait for the UI to go quiet and return the settled diff vs the pre-action tree in the same response (best-effort; never fails the action)`,projectConfig:!0,recorded:!1},{key:`settleQuietMs`,names:[`--settle-quiet`],type:`int`,min:0,usageLabel:`--settle-quiet <ms>`,usageDescription:`Settle: quiet window the UI must hold to count as settled (default 500ms; 300ms when the settled tree comes from the iOS simulator snapshot bridge). On iOS, a broad screen replacement such as a modal dismissal is confirmed for at least 1500ms whatever window is asked for, within the --timeout settle deadline; a replacement from a screen the pre-action capture read as presenting nothing, such as a tab switch, gets no 1500ms confirmation and keeps the asked window`,projectConfig:!0,recorded:!1},{key:`clickButton`,names:[`--button`],type:`enum`,enumValues:[`primary`,`secondary`,`middle`],usageLabel:`--button primary|secondary|middle`,usageDescription:`Click: choose mouse button (middle reserved for future macOS support)`,projectConfig:!0,recorded:!0},{key:`backMode`,names:[`--in-app`],type:`enum`,enumValues:[`in-app`,`system`],setValue:`in-app`,usageLabel:`--in-app`,usageDescription:`Back: use app-provided back UI when available`,projectConfig:!0,recorded:!1},{key:`backMode`,names:[`--system`],type:`enum`,enumValues:[`in-app`,`system`],setValue:`system`,usageLabel:`--system`,usageDescription:`Back: use system back input or gesture when available`,projectConfig:!0,recorded:!1},{key:`pauseMs`,names:[`--pause-ms`],type:`int`,min:0,max:1e4,usageLabel:`--pause-ms <ms>`,usageDescription:`Delay between swipe or gesture tap iterations`,projectConfig:!0,recorded:!0},{key:`pattern`,names:[`--pattern`],type:`enum`,enumValues:[`one-way`,`ping-pong`],usageLabel:`--pattern one-way|ping-pong`,usageDescription:`Swipe repeat pattern`,projectConfig:!0,recorded:!0},{key:`verbose`,names:[`--debug`,`--verbose`,`-v`],type:`boolean`,usageLabel:`--debug, --verbose, -v`,usageDescription:`Enable debug diagnostics; test --verbose prints per-test step timings without debug logs`,projectConfig:!0,recorded:!0},{key:`cost`,names:[`--cost`],type:`boolean`,usageLabel:`--cost`,usageDescription:`Include per-command wall-clock latency (cost.wallClockMs) in the response`,projectConfig:!0,recorded:!1},{key:`responseLevel`,names:[`--level`],type:`enum`,enumValues:n,usageLabel:`--level digest|default|full`,usageDescription:`Response detail level: digest (token-cheap), default (today), or full. Default keeps the wire shape unchanged.`,projectConfig:!0,recorded:!1},{key:`json`,names:[`--json`],type:`boolean`,usageLabel:`--json`,usageDescription:`JSON output`,projectConfig:!0,recorded:!1},{key:`help`,names:[`--help`,`-h`],type:`boolean`,usageLabel:`--help, -h`,usageDescription:`Print help and exit`,projectConfig:!1,recorded:!1},{key:`version`,names:[`--version`,`-V`],type:`boolean`,usageLabel:`--version, -V`,usageDescription:`Print version and exit`,projectConfig:!1,recorded:!1},{key:`snapshotDiff`,names:[`--diff`],type:`boolean`,usageLabel:`--diff`,usageDescription:`Snapshot: show structural diff against the previous session baseline`,projectConfig:!0,recorded:!1},{key:`saveScript`,names:[`--save-script`],type:`booleanOrString`,usageLabel:`--save-script [path]`,usageDescription:`Arm evidence capture on open, publish the armed recording on close; close --save-script alone (without an armed open) is rejected — start with open --save-script, or use session save-script mid-session. Optional custom output path.`,projectConfig:!1,recorded:!0},{key:`networkInclude`,names:[`--include`],type:`enum`,enumValues:[`summary`,`headers`,`body`,`all`],usageLabel:`--include summary|headers|body|all`,usageDescription:`Network: include headers, bodies, or both in output`,projectConfig:!0,recorded:!1},{key:`shutdown`,names:[`--shutdown`],type:`boolean`,usageLabel:`--shutdown`,usageDescription:`close: shutdown associated simulator/emulator after ending session`,projectConfig:!0,recorded:!1},{key:`relaunch`,names:[`--relaunch`],type:`boolean`,usageLabel:`--relaunch`,usageDescription:`open: terminate app process before launching it`,projectConfig:!0,recorded:!0},{key:`foreground`,names:[`--foreground`],type:`boolean`,usageLabel:`--foreground`,usageDescription:`open: keep normal app/device selection and return an initial snapshot; without an app, resolve the sole running app on the sole booted iOS simulator`,inputDescription:`Include an initial interactive snapshot in a fresh open response. With no app argument, discover the sole running app on the sole booted iOS simulator; ambiguous environments fail closed.`,projectConfig:!1,recorded:!1},{key:`restart`,names:[`--restart`],type:`boolean`,usageLabel:`--restart`,usageDescription:`logs clear: stop active stream, clear logs, then start streaming again`,projectConfig:!0,recorded:!1},{key:`retainPaths`,names:[`--retain-paths`],type:`boolean`,usageLabel:`--retain-paths`,usageDescription:`install-from-source: keep materialized artifact paths after install`,projectConfig:!0,recorded:!1},{key:`retentionMs`,names:[`--retention-ms`],type:`int`,min:1,usageLabel:`--retention-ms <ms>`,usageDescription:`install-from-source: retention TTL for materialized artifact paths`,projectConfig:!0,recorded:!1},{key:`noRecord`,names:[`--no-record`],type:`boolean`,usageLabel:`--no-record`,usageDescription:`Do not record this action`,projectConfig:!0,recorded:!0},{key:`record`,names:[`--record`],type:`boolean`,usageLabel:`--record`,usageHidden:!0,usageDescription:`Force-record this action into a repair-armed heal; per-invocation only, the retired config key "record" no longer opts in (mutually exclusive with --no-record)`,projectConfig:!1,recorded:!0}],Dn=[{key:`config`,names:[`--config`],type:`string`,usageLabel:`--config <path>`,usageDescription:`Load CLI defaults from a specific config file (required for connection/provider defaults outside user config)`,projectConfig:!1,recorded:!1},{key:`remoteConfig`,names:[`--remote-config`],type:`string`,usageLabel:`--remote-config <path>`,usageDescription:`Load remote host + Metro workflow settings from a specific profile file`,projectConfig:!1,recorded:!1},{key:`stateDir`,names:[`--state-dir`],type:`string`,usageLabel:`--state-dir <path>`,usageDescription:`Daemon state directory (defaults to ~/.agent-device for packages, or a worktree-scoped dev dir from source)`,projectConfig:!1,recorded:!1},{key:`daemonBaseUrl`,names:[`--daemon-base-url`],type:`string`,usageLabel:`--daemon-base-url <url>`,usageDescription:`Explicit remote HTTP daemon base URL (skip local daemon discovery/startup)`,projectConfig:!1,recorded:!1},{key:`daemonAuthToken`,names:[`--daemon-auth-token`],type:`string`,usageLabel:`--daemon-auth-token <token>`,usageDescription:`Remote HTTP daemon or proxy auth token (sent as request token and bearer header)`,projectConfig:!1,recorded:!1},{key:`daemonTransport`,names:[`--daemon-transport`],type:`enum`,enumValues:[`auto`,`socket`,`http`],usageLabel:`--daemon-transport auto|socket|http`,usageDescription:`Daemon client transport preference`,projectConfig:!1,recorded:!1},{key:`daemonServerMode`,names:[`--daemon-server-mode`],type:`enum`,enumValues:[`socket`,`http`,`dual`],usageLabel:`--daemon-server-mode socket|http|dual`,usageDescription:`Daemon server mode used when spawning daemon`,projectConfig:!1,recorded:!1},{key:`proxyHost`,names:[`--host`],type:`string`,usageLabel:`--host <host>`,usageDescription:`Proxy: host interface to bind (default: 127.0.0.1)`,projectConfig:!1,recorded:!1},{key:`proxyPort`,names:[`--port`],type:`int`,min:1,max:65535,usageLabel:`--port <port>`,usageDescription:`Proxy: TCP port to bind (default: 0, choose a free port)`,projectConfig:!1,recorded:!1},{key:`tenant`,names:[`--tenant`],type:`string`,usageLabel:`--tenant <id>`,usageDescription:`Tenant scope identifier for isolated daemon sessions`,projectConfig:!1,recorded:!1},{key:`sessionIsolation`,names:[`--session-isolation`],type:`enum`,enumValues:[`none`,`tenant`],usageLabel:`--session-isolation none|tenant`,usageDescription:`Session isolation strategy (tenant prefixes session namespace)`,projectConfig:!1,recorded:!1},{key:`runId`,names:[`--run-id`],type:`string`,usageLabel:`--run-id <id>`,usageDescription:`Run identifier used for tenant lease admission checks`,projectConfig:!1,recorded:!1},{key:`leaseId`,names:[`--lease-id`],type:`string`,usageLabel:`--lease-id <id>`,usageDescription:`Lease identifier bound to tenant/run admission scope`,projectConfig:!1,recorded:!1},{key:`leaseBackend`,names:[`--lease-backend`],type:`enum`,enumValues:r,usageLabel:`--lease-backend ${r.join(`|`)}`,usageDescription:`Lease backend for remote tenant connection admission`,projectConfig:!1,recorded:!1},{key:`provider`,names:[`--provider`],type:`string`,usageLabel:`--provider <name>`,usageDescription:`Cloud provider name for provider-scoped commands`,projectConfig:!1,recorded:!1},{key:`providerSessionId`,names:[`--provider-session`],type:`string`,usageLabel:`--provider-session <id>`,usageDescription:`Cloud provider session id or ARN`,projectConfig:!1,recorded:!1},{key:`providerApp`,names:[`--provider-app`],type:`string`,usageLabel:`--provider-app <ref-or-path>`,usageDescription:`Cloud provider app reference or local app path used when creating hosted WebDriver sessions`,projectConfig:!1,recorded:!1},{key:`providerOsVersion`,names:[`--provider-os-version`,`--os-version`],type:`string`,usageLabel:`--provider-os-version <version>`,usageDescription:`Hosted cloud provider OS version, for example 17 or 14.0`,projectConfig:!1,recorded:!1},{key:`providerDeviceType`,names:[`--provider-device-type`],type:`enum`,enumValues:ue,usageLabel:`--provider-device-type real|virtual`,usageDescription:`TestMu AI device pool: real devices or virtual devices (emulators and simulators). Defaults to virtual`,projectConfig:!1,recorded:!1},{key:`providerProject`,names:[`--provider-project`],type:`string`,usageLabel:`--provider-project <name>`,usageDescription:`Hosted cloud provider project label`,projectConfig:!1,recorded:!1},{key:`providerBuild`,names:[`--provider-build`],type:`string`,usageLabel:`--provider-build <name>`,usageDescription:`Hosted cloud provider build label`,projectConfig:!1,recorded:!1},{key:`providerSessionName`,names:[`--provider-session-name`],type:`string`,usageLabel:`--provider-session-name <name>`,usageDescription:`Hosted cloud provider session label`,projectConfig:!1,recorded:!1},{key:`providerDeviceOrientation`,names:[`--provider-device-orientation`,`--device-orientation`],type:`enum`,enumValues:le,usageLabel:`--provider-device-orientation portrait|landscape`,usageDescription:`Screen orientation a hosted cloud provider session starts in. Set this rather than rotating after launch: a session that boots landscape renders login webviews landscape`,projectConfig:!1,recorded:!1},{key:`providerGeoLocation`,names:[`--provider-geo-location`,`--geo-location`],type:`string`,usageLabel:`--provider-geo-location <country>`,usageDescription:`Hosted cloud provider IP geolocation country code, for example US`,projectConfig:!1,recorded:!1},{key:`providerTimezone`,names:[`--provider-timezone`,`--timezone`],type:`string`,usageLabel:`--provider-timezone <zone>`,usageDescription:`Hosted cloud provider device time zone, for example New_York`,projectConfig:!1,recorded:!1},{key:`providerAppiumVersion`,names:[`--provider-appium-version`,`--appium-version`],type:`string`,usageLabel:`--provider-appium-version <version>`,usageDescription:`Hosted cloud provider Appium server version, for example 3.2.0. Without it each provider starts its own default (Appium 1.x on BrowserStack)`,projectConfig:!1,recorded:!1},{key:`providerLanguage`,names:[`--provider-language`,`--language`],type:`string`,usageLabel:`--provider-language <language>`,usageDescription:`Hosted cloud provider app language, for example Fr`,projectConfig:!1,recorded:!1},{key:`providerLocale`,names:[`--provider-locale`,`--locale`],type:`string`,usageLabel:`--provider-locale <locale>`,usageDescription:`Hosted cloud provider device locale, for example Fr`,projectConfig:!1,recorded:!1},{key:`providerNetworkProfile`,names:[`--provider-network-profile`,`--network-profile`],type:`string`,usageLabel:`--provider-network-profile <profile>`,usageDescription:`Hosted cloud provider named network condition profile, for example 4g-lte-advanced-good. Mutually exclusive with --provider-custom-network`,projectConfig:!1,recorded:!1},{key:`providerCustomNetwork`,names:[`--provider-custom-network`,`--custom-network`],type:`string`,usageLabel:`--provider-custom-network <shape>`,usageDescription:`Hosted cloud provider custom network shape. Mutually exclusive with --provider-network-profile`,projectConfig:!1,recorded:!1},{key:`providerNoResignApp`,names:[`--provider-no-resign-app`],type:`boolean`,usageLabel:`--provider-no-resign-app`,usageDescription:`iOS only: keep an Enterprise-signed app as uploaded instead of letting the provider re-sign it, which strips entitlements such as push notifications`,projectConfig:!1,recorded:!1},{key:`awsProjectArn`,names:[`--aws-project-arn`],type:`string`,usageLabel:`--aws-project-arn <arn>`,usageDescription:`AWS Device Farm project ARN for hosted WebDriver sessions`,projectConfig:!1,recorded:!1},{key:`awsDeviceArn`,names:[`--aws-device-arn`],type:`string`,usageLabel:`--aws-device-arn <arn>`,usageDescription:`AWS Device Farm device ARN for hosted WebDriver sessions`,projectConfig:!1,recorded:!1},{key:`awsAppArn`,names:[`--aws-app-arn`],type:`string`,usageLabel:`--aws-app-arn <arn>`,usageDescription:`AWS Device Farm app ARN attached to hosted remote access sessions`,projectConfig:!1,recorded:!1},{key:`awsRegion`,names:[`--aws-region`],type:`string`,usageLabel:`--aws-region <region>`,usageDescription:`AWS region for Device Farm API calls`,projectConfig:!1,recorded:!1},{key:`awsInteractionMode`,names:[`--aws-interaction-mode`],type:`enum`,enumValues:[`INTERACTIVE`,`NO_VIDEO`,`VIDEO_ONLY`],usageLabel:`--aws-interaction-mode INTERACTIVE|NO_VIDEO|VIDEO_ONLY`,usageDescription:`AWS Device Farm remote access interaction mode`,projectConfig:!1,recorded:!1},{key:`force`,names:[`--force`,`--overwrite`],type:`boolean`,usageLabel:`--force, --overwrite`,usageDescription:`Force replacement of existing state (connect: replace an active connection; --save-script: overwrite an existing target instead of refusing)`,projectConfig:!0,recorded:!0},{key:`clean`,names:[`--clean`],type:`boolean`,usageLabel:`--clean`,usageDescription:`Daemon stop: remove retained runner processes and leases after stopping`,projectConfig:!0,recorded:!1},{key:`noLogin`,names:[`--no-login`],type:`boolean`,usageLabel:`--no-login`,usageDescription:`Connect: fail instead of starting implicit cloud login`,projectConfig:!0,recorded:!1},{key:`sessionLock`,names:[`--session-lock`],type:`enum`,enumValues:[`reject`,`strip`],usageLabel:`--session-lock reject|strip`,usageDescription:`Lock bound-session device routing for this CLI invocation and nested batch steps; strip drops conflicting platform/scope selectors only, and a selector naming a different device always fails`,projectConfig:!0,recorded:!1}],On=[{key:`platform`,names:[`--platform`],type:`enum`,enumValues:g,usageLabel:`--platform ${g.join(`|`)}`,usageDescription:"Platform to target (`apple` aliases the Apple automation backend)",projectConfig:!0,recorded:!0},{key:`target`,names:[`--target`],type:`enum`,enumValues:[`mobile`,`tv`,`desktop`],usageLabel:`--target mobile|tv|desktop`,usageDescription:`Device target class to match`,projectConfig:!0,recorded:!1},{key:`device`,names:[`--device`],type:`string`,usageLabel:`--device <name>`,usageDescription:`Device name to target (a UDID belongs in --udid, a serial in --serial)`,projectConfig:!0,recorded:!0},{key:`udid`,names:[`--udid`],type:`string`,usageLabel:`--udid <udid>`,usageDescription:`Apple device or simulator UDID; the only selector that pins one device when several share a --device name`,projectConfig:!0,recorded:!0},{key:`serial`,names:[`--serial`],type:`string`,usageLabel:`--serial <serial>`,usageDescription:`Android, HarmonyOS, or Vega VVD serial`,projectConfig:!0,recorded:!0},{key:`osVersion`,names:[`--os`],type:`string`,usageLabel:`--os <version|range>`,usageDescription:`Proxy lease: OS version or range the backend picks the device by (Android: API level); refused without such a backend`,inputDescription:`OS version or range for the device a proxy backend leases, for example 18.6.2 or ">=26" (Android: API level), sent as given. A blank string names nothing; a non-string fails with INVALID_ARGS, reason device-spec-invalid. Only the CLI allocating a lease through connect proxy sends it to that backend; a daemon refuses every other request that names it, with reason device-spec-unsupported.`,projectConfig:!1,recorded:!1},{key:`imageTag`,names:[`--image-tag`],type:`string`,usageLabel:`--image-tag <tag>`,usageDescription:`Proxy lease: Android system image tag the backend picks the device by; refused without such a backend`,inputDescription:`Android system image tag for the device a proxy backend leases, for example google_apis_playstore, sent as given. A blank string names nothing; a non-string fails with INVALID_ARGS, reason device-spec-invalid. Only the CLI allocating a lease through connect proxy sends it to that backend; a daemon refuses every other request that names it, with reason device-spec-unsupported.`,projectConfig:!1,recorded:!1},{key:`physical`,names:[`--physical`],type:`boolean`,usageLabel:`--physical`,usageDescription:`Proxy lease: ask the backend for a physical device instead of a simulator or emulator; refused without such a backend`,inputDescription:`Ask a proxy backend to lease a physical device instead of a simulator or emulator. false names nothing; a non-boolean fails with INVALID_ARGS, reason device-spec-invalid. Only the CLI allocating a lease through connect proxy sends true to that backend; a daemon refuses every other request that names it, with reason device-spec-unsupported.`,projectConfig:!1,recorded:!1},{key:`stale`,names:[`--stale`],type:`boolean`,usageLabel:`--stale`,usageDescription:`Device status: show only claims with a provably stale owner`,projectConfig:!0,recorded:!1},{key:`surface`,names:[`--surface`],type:`enum`,enumValues:de,usageLabel:`--surface app|frontmost-app|desktop|menubar`,usageDescription:`macOS session surface for open (defaults to app)`,projectConfig:!0,recorded:!0},{key:`headless`,names:[`--headless`],type:`boolean`,usageLabel:`--headless`,usageDescription:`Boot: launch Android emulator without a GUI window`,projectConfig:!0,recorded:!1},{key:`targetApp`,names:[`--app`,`--target-app`],type:`string`,usageLabel:`--app <id-or-name>`,usageDescription:`Target an app without opening it: doctor verifies an installed app by id or name; settings applies an app-scoped change (permission, iOS location) to a bundle id or package`,projectConfig:!1,recorded:!1},{key:`metroHost`,names:[`--metro-host`],type:`string`,usageLabel:`--metro-host <host>`,usageDescription:`Session-scoped Metro/debug host hint`,projectConfig:!1,recorded:!0},{key:`metroPort`,names:[`--metro-port`],type:`int`,min:1,max:65535,usageLabel:`--metro-port <port>`,usageDescription:`Session-scoped Metro/debug port hint; on an emulator/simulator the host defaults to the loopback alias, physical devices still need --metro-host`,projectConfig:!1,recorded:!0},{key:`metroProjectRoot`,names:[`--project-root`],type:`string`,usageLabel:`--project-root <path>`,usageDescription:`metro prepare: React Native project root (default: cwd)`,projectConfig:!1,recorded:!1},{key:`kind`,names:[`--kind`],type:`enum`,enumValues:[`auto`,`react-native`,`expo`,`repack`,...fe],usageLabel:`--kind <kind>`,usageDescription:`Kind selector for commands that support it, such as metro prepare or perf artifact collectors`,projectConfig:!0,recorded:!1},{key:`perfTemplate`,names:[`--template`],type:`string`,usageLabel:`--template <name>`,usageDescription:`Perf xctrace template name, for example Time Profiler`,projectConfig:!0,recorded:!1},{key:`metroKind`,names:[`--metro-kind`],type:`enum`,enumValues:[`auto`,`react-native`,`expo`,`repack`],usageLabel:`--metro-kind auto|react-native|expo|repack`,usageDescription:`metro prepare: detect or force the React Native dev-server launcher kind`,projectConfig:!1,recorded:!1},{key:`metroPublicBaseUrl`,names:[`--public-base-url`],type:`string`,usageLabel:`--public-base-url <url>`,usageDescription:`metro prepare: public base URL used for direct dev-server bundle hints`,projectConfig:!1,recorded:!1},{key:`metroProxyBaseUrl`,names:[`--proxy-base-url`],type:`string`,usageLabel:`--proxy-base-url <url>`,usageDescription:`metro prepare: optional bridge origin for remote dev-server access`,projectConfig:!1,recorded:!1},{key:`metroBearerToken`,names:[`--bearer-token`],type:`string`,usageLabel:`--bearer-token <token>`,usageDescription:`metro prepare: host bridge bearer token (or AGENT_DEVICE_METRO_BEARER_TOKEN; falls back to AGENT_DEVICE_DAEMON_AUTH_TOKEN)`,projectConfig:!1,recorded:!1},{key:`metroPreparePort`,names:[`--port`],type:`int`,min:1,max:65535,usageLabel:`--port <port>`,usageDescription:`metro prepare: local dev-server port (default: 8081)`,projectConfig:!1,recorded:!1},{key:`metroListenHost`,names:[`--listen-host`],type:`string`,usageLabel:`--listen-host <host>`,usageDescription:`metro prepare: host dev server listens on (default: 0.0.0.0)`,projectConfig:!1,recorded:!1},{key:`metroStatusHost`,names:[`--status-host`],type:`string`,usageLabel:`--status-host <host>`,usageDescription:`metro prepare: host used for local dev-server /status polling (default: 127.0.0.1)`,projectConfig:!1,recorded:!1},{key:`metroStartupTimeoutMs`,names:[`--startup-timeout-ms`],type:`int`,min:1,usageLabel:`--startup-timeout-ms <ms>`,usageDescription:`metro prepare: timeout while waiting for the dev server to become ready`,projectConfig:!1,recorded:!1},{key:`metroProbeTimeoutMs`,names:[`--probe-timeout-ms`],type:`int`,min:1,usageLabel:`--probe-timeout-ms <ms>`,usageDescription:`metro prepare: timeout for /status and proxy bridge calls`,projectConfig:!1,recorded:!1},{key:`metroRuntimeFile`,names:[`--runtime-file`],type:`string`,usageLabel:`--runtime-file <path>`,usageDescription:`metro prepare: optional file path to persist the JSON result`,projectConfig:!1,recorded:!1},{key:`metroNoReuseExisting`,names:[`--no-reuse-existing`],type:`boolean`,usageLabel:`--no-reuse-existing`,usageDescription:`metro prepare: always start a fresh Metro process`,projectConfig:!1,recorded:!1},{key:`metroNoInstallDeps`,names:[`--no-install-deps`],type:`boolean`,usageLabel:`--no-install-deps`,usageDescription:`metro prepare: skip package-manager install when node_modules is missing`,projectConfig:!1,recorded:!1},{key:`bundleUrl`,names:[`--bundle-url`],type:`string`,usageLabel:`--bundle-url <url>`,usageDescription:`Session-scoped bundle URL hint`,projectConfig:!1,recorded:!0},{key:`launchUrl`,names:[`--launch-url`],type:`string`,usageLabel:`--launch-url <url>`,usageDescription:`Session-scoped deep link / launch URL hint`,projectConfig:!0,recorded:!0},{key:`iosSimulatorDeviceSet`,names:[`--ios-simulator-device-set`],type:`string`,usageLabel:`--ios-simulator-device-set <path>`,usageDescription:`Scope iOS simulator discovery/commands to this simulator device set`,projectConfig:!1,recorded:!1},{key:`iosXctestrunFile`,names:[`--ios-xctestrun-file`],type:`string`,usageLabel:`--ios-xctestrun-file <path>`,usageDescription:`Use an externally built iOS XCTest runner .xctestrun artifact`,projectConfig:!1,recorded:!1},{key:`iosXctestDerivedDataPath`,names:[`--ios-xctest-derived-data-path`],type:`string`,usageLabel:`--ios-xctest-derived-data-path <path>`,usageDescription:`Derived data path for external iOS XCTest runner execution`,projectConfig:!1,recorded:!1},{key:`iosXctestEnvDir`,names:[`--ios-xctest-env-dir`],type:`string`,usageLabel:`--ios-xctest-env-dir <path>`,usageDescription:`Writable directory for per-session iOS XCTest runner env overlays`,projectConfig:!1,recorded:!1},{key:`testIme`,names:[`--test-ime`],type:`boolean`,usageLabel:`--test-ime`,usageDescription:`open/test/replay: activate the headless Android test IME for deterministic Unicode text entry (default on for emulators; opt-in on real devices; on test/replay it applies to the sessions the flow opens)`,projectConfig:!0,recorded:!1},{key:`testIme`,names:[`--no-test-ime`],type:`boolean`,setValue:!1,usageLabel:`--no-test-ime`,usageDescription:`open/test/replay: keep the real Android keyboard even on emulators (opt out of the headless test IME; on test/replay it applies to the sessions the flow opens)`,projectConfig:!0,recorded:!1},{key:`androidDeviceAllowlist`,names:[`--android-device-allowlist`],type:`string`,usageLabel:`--android-device-allowlist <serials>`,usageDescription:`Comma/space separated Android serial allowlist for discovery/selection`,projectConfig:!1,recorded:!1},{key:`remote`,names:[`--remote`],type:`boolean`,usageLabel:`--remote`,usageDescription:`Doctor: check remote connection setup instead of local device inventory`,projectConfig:!0,recorded:!1},{key:`activity`,names:[`--activity`],type:`string`,usageLabel:`--activity <component>`,usageDescription:`Android launch activity (package/Class, .Class, or Class) or HarmonyOS ability name; not for URL opens`,projectConfig:!0,recorded:!1},{key:`launchConsole`,names:[`--launch-console`],type:`string`,usageLabel:`--launch-console <path>`,usageDescription:`open: capture the initial local iOS simulator launch console window to a file`,projectConfig:!1,recorded:!1},{key:`launchArgs`,names:[`--launch-args`],type:`string`,multiple:!0,usageLabel:`--launch-args <arg>`,usageDescription:`open: repeatable launch argument forwarded verbatim to the platform launch command (iOS app process args; Android adb shell am start args). Linux and macOS reject the flag.`,projectConfig:!0,recorded:!1},{key:`header`,names:[`--header`],type:`string`,multiple:!0,usageLabel:`--header <name:value>`,usageDescription:`install-from-source: repeatable HTTP header for URL downloads`,projectConfig:!1,recorded:!1},{key:`githubActionsArtifact`,names:[`--github-actions-artifact`],type:`string`,usageLabel:`--github-actions-artifact <owner/repo:artifact>`,usageDescription:`install-from-source: GitHub Actions artifact resolved by a remote daemon`,projectConfig:!1,recorded:!1},{key:`installSource`,names:[],type:`string`,projectConfig:!1,recorded:!1},{key:`session`,names:[`--session`],type:`string`,usageLabel:`--session <name>`,usageDescription:`Named session (implicit default is scoped to this workspace + platform)`,projectConfig:!0,recorded:!1}],kn=[{key:`replayUpdate`,names:[`--update`,`-u`],type:`boolean`,usageLabel:`--update, -u`,usageDescription:`Replay: retired as a rewrite (ADR 0012) — never edits the .ad file; every divergence already carries ranked selector suggestions, --update or not`,projectConfig:!0,recorded:!1},{key:`replayFrom`,names:[`--from`],type:`int`,min:1,usageLabel:`--from <n>`,usageDescription:`Replay: resume at 1-based plan step n, skipping 1..n-1 without executing them (requires --plan-digest; see a divergence report's resume field). replay only, not test`,projectConfig:!0,recorded:!1},{key:`replayPlanDigest`,names:[`--plan-digest`],type:`string`,usageLabel:`--plan-digest <sha256>`,usageDescription:`Replay: the plan digest a --from resume must match (from a prior divergence report); mismatch, edits, or include/platform-expansion changes fail INVALID_ARGS before any action`,projectConfig:!0,recorded:!1},{key:`replayKeepSession`,names:[`--keep-session`],type:`boolean`,usageLabel:`--keep-session`,usageDescription:`Replay: leave the session active by suppressing exactly an authored terminal close in a native .ad script; replay only, not test or Maestro YAML`,projectConfig:!0,recorded:!1},{key:`replayMaestro`,names:[`--maestro`],type:`boolean`,usageLabel:`--maestro`,usageDescription:`Replay: treat input as a supported Maestro YAML subset; unsupported syntax fails loudly. See agent-device help maestro for commands and boundaries`,projectConfig:!0,recorded:!1},{key:`replayEnv`,names:[`-e`,`--env`],type:`string`,multiple:!0,usageLabel:`-e KEY=VALUE, --env KEY=VALUE`,usageDescription:"Replay/Test: inject or override a ${KEY} variable for the script (repeatable)",projectConfig:!1,recorded:!1},{key:`failFast`,names:[`--fail-fast`],type:`boolean`,usageLabel:`--fail-fast`,usageDescription:`Test: stop the suite after the first failing script; with sharding, each shard stops independently`,projectConfig:!0,recorded:!1},{key:`timeoutMs`,names:[`--timeout`],type:`int`,min:1,usageLabel:`--timeout <ms>`,usageDescription:`Boot/Open/Prepare: startup budget covering the device boot (and runner preparation for prepare). Replay/Snapshot/Test: maximum wall-clock time for the command or attempt. With --settle: the settle-wait deadline (default 10s)`,projectConfig:!0,recorded:!1},{key:`waitMs`,names:[`--wait`],type:`int`,min:100,max:12e4,usageLabel:`--wait <ms>`,usageDescription:`Open: wait up to n ms for a device another session is holding before failing with DEVICE_IN_USE`,inputDescription:`Block this open for up to n milliseconds (100-120000) while another session holds the device, then fail with DEVICE_IN_USE naming that session. Only session contention is waited for: a device claim held by another workspace is refused at once with its recovery command. A device that never frees, or is taken again while this open waits, costs the full budget, which extends this command's timeout envelope rather than eating into it.`,projectConfig:!1,recorded:!1},{key:`retries`,names:[`--retries`],type:`int`,min:0,max:3,usageLabel:`--retries <n>`,usageDescription:`Test: retry each failed script up to n additional times`,projectConfig:!0,recorded:!1},{key:`recordVideo`,names:[`--record-video`],type:`boolean`,usageLabel:`--record-video`,usageDescription:`Test: record each replay attempt to recording.mp4 in its attempt artifacts`,projectConfig:!0,recorded:!1},{key:`artifactsDir`,names:[`--artifacts-dir`],type:`string`,usageLabel:`--artifacts-dir <path>`,usageDescription:`Test: root directory for suite artifacts`,projectConfig:!1,recorded:!1},{key:`reporter`,names:[`--reporter`],type:`string`,multiple:!0,usageLabel:`--reporter <name-or-path>`,usageDescription:`Test: add a replay suite reporter; use default, junit:<path>, or a custom reporter path (repeatable)`,projectConfig:!1,recorded:!1},{key:`reportJunit`,names:[`--report-junit`],type:`string`,usageLabel:`--report-junit <path>`,usageDescription:`Test: compatibility alias for --reporter junit:<path>`,projectConfig:!1,recorded:!1},{key:`shardAll`,names:[`--shard-all`],type:`int`,min:1,usageLabel:`--shard-all <n>`,usageDescription:`Test: run the full suite on each of n devices; combine with --device id1,id2 for explicit connected devices; AD_SHARD_INDEX is zero-based`,projectConfig:!0,recorded:!1},{key:`shardSplit`,names:[`--shard-split`],type:`int`,min:1,usageLabel:`--shard-split <n>`,usageDescription:`Test: split runnable suite entries across n devices; AD_SHARD_INDEX is zero-based`,projectConfig:!0,recorded:!1},{key:`steps`,names:[`--steps`],type:`string`,usageLabel:`--steps <json>`,usageDescription:`Batch: JSON array of {"command","input"} steps`,projectConfig:!1,recorded:!1},{key:`stepsFile`,names:[`--steps-file`],type:`string`,usageLabel:`--steps-file <path>`,usageDescription:`Batch: read steps JSON from file`,projectConfig:!1,recorded:!1},{key:`batchOnError`,names:[`--on-error`],type:`enum`,enumValues:[`stop`],usageLabel:`--on-error stop`,usageDescription:`Batch: stop when a step fails`,projectConfig:!0,recorded:!1},{key:`batchMaxSteps`,names:[`--max-steps`],type:`int`,min:1,max:1e3,usageLabel:`--max-steps <n>`,usageDescription:`Batch: maximum number of allowed steps`,projectConfig:!0,recorded:!1},{key:`appsFilter`,names:[`--all`],type:`enum`,enumValues:[`user-installed`,`all`],setValue:`all`,usageLabel:`--all`,usageDescription:`Apps: include system/OEM apps`,projectConfig:!0,recorded:!1},{key:`snapshotInteractiveOnly`,names:[`-i`],type:`boolean`,usageLabel:`-i`,usageDescription:`Snapshot: interactive elements only`,projectConfig:!0,recorded:!0},{key:`snapshotDepth`,names:[`--depth`,`-d`],type:`int`,min:0,usageLabel:`--depth, -d <depth>`,usageDescription:`Snapshot: limit snapshot depth`,projectConfig:!0,recorded:!0},{key:`snapshotScope`,names:[`--scope`,`-s`],type:`string`,usageLabel:`--scope, -s <scope>`,usageDescription:`Snapshot: scope snapshot to label/identifier`,projectConfig:!0,recorded:!0},{key:`snapshotRaw`,names:[`--raw`],type:`boolean`,usageLabel:`--raw`,usageDescription:`Snapshot: raw node output`,projectConfig:!0,recorded:!0},{key:`snapshotCustomActions`,names:[`--actions`],type:`boolean`,usageLabel:`--actions`,usageDescription:`Snapshot: name the affordances merged inside an element (iOS sim); not directly invokable — reach them via the detail screen, labeled children, or coordinates`,inputDescription:`Name the affordances an element merged away (iOS UIAccessibilityCustomAction, React Native accessibilityActions) — a card whose reply/options controls are not separate elements still lists them here. The names are for PLANNING, not invocation: there is no API to trigger them, so reach the affordance through the element detail screen, through the same control exposed as a labeled element elsewhere, or by coordinates from its rect. iOS simulator only; costs one accessibility round trip per merged element.`,projectConfig:!0,recorded:!0},{key:`snapshotObserveOnly`,names:[`--observe-only`],type:`boolean`,usageLabel:`--observe-only`,usageDescription:`Snapshot: observe the iOS session app without activation or foreground repair`,inputDescription:`iOS only. Refuse instead of activating or repairing the session app. Reports XCUIApplication state, which does not prove screen ownership (#2696).`,projectConfig:!1,recorded:!1},{key:`snapshotForceFull`,names:[`--force-full`],type:`boolean`,usageLabel:`--force-full`,usageDescription:`Snapshot: re-emit the full tree even when unchanged`,projectConfig:!0,recorded:!1},{key:`findFirst`,names:[`--first`],type:`boolean`,usageLabel:`--first`,usageDescription:`Find: pick the first match when ambiguous`,projectConfig:!0,recorded:!1},{key:`findLast`,names:[`--last`],type:`boolean`,usageLabel:`--last`,usageDescription:`Find: pick the last match when ambiguous`,projectConfig:!0,recorded:!1},{key:`out`,names:[`--out`],type:`string`,usageLabel:`--out <path>`,usageDescription:`Output path`,projectConfig:!1,recorded:!0},{key:`artifact`,names:[`--artifact`],type:`string`,usageLabel:`--artifact <path>`,usageDescription:`Debug symbols: Apple crash artifact path (.ips, .crash, or .log)`,projectConfig:!1,recorded:!1},{key:`dsym`,names:[`--dsym`],type:`string`,usageLabel:`--dsym <path>`,usageDescription:`Debug symbols: matching .dSYM bundle path`,projectConfig:!1,recorded:!1},{key:`searchPath`,names:[`--search-path`],type:`string`,usageLabel:`--search-path <dir>`,usageDescription:`Debug symbols: directory to scan for matching .dSYM bundles`,projectConfig:!1,recorded:!1},{key:`overlayRefs`,names:[`--overlay-refs`],type:`boolean`,usageLabel:`--overlay-refs`,usageDescription:`Screenshot: draw current snapshot refs and target rectangles onto the saved PNG; diff screenshot: also write a separate current-screen overlay guide`,projectConfig:!0,recorded:!1},...ee,{key:`baseline`,names:[`--baseline`,`-b`],type:`string`,usageLabel:`--baseline, -b <path>`,usageDescription:`Diff screenshot: path to baseline image file`,projectConfig:!0,recorded:!1},{key:`threshold`,names:[`--threshold`],type:`string`,usageLabel:`--threshold <0-1>`,usageDescription:`Diff screenshot: color distance threshold (default 0.1)`,projectConfig:!0,recorded:!1}],Y=[...Dn,...On,...En,...kn],An=new Map;for(let e of Y)for(let t of e.names)An.set(t,e);function jn(e){return An.get(e)}function Mn(){return Y}function Nn(e){return Y.filter(t=>t.key===e)}function Pn(){return new Set(Y.filter(e=>e.projectConfig).map(e=>e.key))}function Fn(){return new Set(Y.filter(e=>e.recorded).map(e=>e.key))}function In(e){let t=X(e.label),n=X(e.value),r=X(e.identifier),i=Hn(r)?r:``;return Vn(e.type??``)?n||t||i:t||n||i}function Ln(e,t){if(t===`text-view`||t===`text-field`||t===`search`)return!0;let n=_(e.type??``),r=`${e.role??``} ${e.subrole??``}`.toLowerCase();return n.includes(`textview`)||n.includes(`textarea`)||n.includes(`textfield`)||n.includes(`securetextfield`)||n.includes(`searchfield`)||n.includes(`edittext`)||r.includes(`text area`)||r.includes(`text field`)}function Rn(e){let t=e.replaceAll(/\s+/g,` `).trim();return t.length<=48?t:`${t.slice(0,45)}...`}function zn(e,t){let n=In(e),r=Ln(e,t);return{text:n,isLargeSurface:r,shouldSummarize:r&&Bn(n)}}function Bn(e){return e?e.length>80||/[\r\n]/.test(e):!1}function X(e){return typeof e==`string`?e.trim():``}function Vn(e){let t=_(e);return t.includes(`textfield`)||t.includes(`securetextfield`)||t.includes(`searchfield`)||t.includes(`edittext`)||t.includes(`textview`)||t.includes(`textarea`)}function Hn(e){return e?!/^[\w.]+:id\/[\w.-]+$/i.test(e)&&!/^_?NS:\d+$/i.test(e):!1}function Un(e,t={}){let n=[],r=[];for(let a of e){let e=a.depth??0,o=a.label?.trim()||a.value?.trim()||a.identifier?.trim()||``,s=i(a.type??`Element`),c=a.inheritsLabel===!0||a.inheritsIdentifier===!0;if(s===`group`&&!o&&!c)continue;for(;n.length>0&&e<=n.at(-1);)n.pop();let l=n.length;n.push(e),r.push({node:a,depth:l,type:s,text:Z(a,l,!1,s,t)})}return r}function Z(e,t,n,r,a={}){let o=r??i(e.type??`Element`),s=zn(e,o),c=Xn(e,o,a,s),l=` `.repeat(t),u=e.ref?`@${e.ref}`:``,d=Zn(e,o,a,s);!c&&(e.inheritsLabel===!0||e.inheritsIdentifier===!0)&&d.push(`same label as parent`);let f=d.map(e=>` [${e}]`).join(``),ee=c?` "${c}"`:``,p=Gn(e);return n?`${l}${u} [${o}]${f}${p}`.trimEnd():`${l}${u} [${o}]${ee}${f}${p}`.trimEnd()}function Wn(e){return{matches:e.length,candidates:e.slice(0,5).map(e=>Z(e,0,!1))}}function Gn(e){let t=e.actions?.filter(e=>e.trim().length>0);return!t||t.length===0?``:` actions: [${t.map(e=>`"${er(Kn(e))}"`).join(`, `)}]`}function Kn(e){return e.replaceAll(/\s+/g,` `).replaceAll(/[\u0000-\u001f\u007f-\u009f]/g,``).trim()}function Q(e,t){let n=e.label?.trim();if(n&&Jn(t,n))return``;let r=e.value?.trim();if($(t)){if(r)return r;if(n)return n}else if(n)return n;if(r)return r;let i=e.identifier?.trim();return!i||Yn(i)&&(t===`group`||t===`image`||t===`list`||t===`collection`)?``:i}function qn(e){let t=[];return e.enabled===!1&&t.push(`disabled`),e.selected===!0&&t.push(`selected`),e.checked!==void 0&&t.push(e.checked?`checked`:`unchecked`),t}function $(e){return e===`text-field`||e===`text-view`||e===`search`}function Jn(e,t){return e!==`scroll-area`&&e!==`list`&&e!==`collection`&&e!==`table`?!1:s(t)}function Yn(e){return/^[\w.]+:id\/[\w.-]+$/i.test(e)}function Xn(e,t,n,r){return!n.summarizeTextSurfaces||!r.shouldSummarize?Q(e,t):Qn(e,t,r.text)||Q(e,t)}function Zn(e,t,n,r){let i=[...qn(e),...e.presentationHints??[]];return!n.summarizeTextSurfaces||(e.focused===!0&&i.push(`focused`),$(t)&&i.push(`editable`),$n(e,t)&&i.push(`scrollable`),!r.shouldSummarize)?tr(i):(i.push(`preview:"${er(Rn(r.text))}"`),i.push(`truncated`),tr(i))}function Qn(e,t,n){let r=X(e.label);if(r&&r!==n)return r;let i=X(e.identifier);if(i&&!Yn(i)&&i!==n)return i;switch(t){case`text`:case`text-view`:return`Text view`;case`text-field`:return`Text field`;case`search`:return`Search field`;default:return``}}function $n(e,t){if(t===`scroll-area`)return!0;let n=(e.type??``).toLowerCase(),r=`${e.role??``} ${e.subrole??``}`.toLowerCase();return n.includes(`scroll`)||r.includes(`scroll`)}function er(e){return e.replaceAll(`\\`,String.raw`\\`).replaceAll(`"`,String.raw`\"`)}function tr(e){return[...new Set(e)]}const nr={state:`sparse`,backend:`tree`,reason:`legacy iOS capture exposed only the application root`,reasonCode:`sparse-tree`},rr={sparse:`capture was sparse`,truncated:`capture was truncated`,unsettled:`the surface was still changing after a gesture`};function ir(e){return typeof e==`string`&&Object.hasOwn(rr,e)}function ar(e){if(e.scope!==void 0)return`scope`;if(e.depth!==void 0)return`depth`}function or(e,t=`is`){let n=`${t} absent`;return e===`scope`?`${n} does not support --scope; it requires an unscoped capture`:`${n} does not support --depth; it requires a full-depth capture`}function sr(e,t){let n=t[0]?ur(t[0]):void 0,r=t.length;if(e.truncated===!0)return{kind:`truncated`,matches:r,...n?{firstMatch:n}:{}};let i=cr(e);return i?{kind:`sparse`,matches:r,...n?{firstMatch:n}:{},quality:{state:i.state,backend:i.backend,...i.reason?{reason:i.reason}:{},...i.reasonCode?{reasonCode:i.reasonCode}:{}}}:r===0?{kind:e.postGestureOutcome?.kind===`unsettled`?`unsettled`:`absent`,matches:0}:{kind:`present`,matches:r,firstMatch:n}}function cr(e){let t=e.snapshotQuality;return t?.state===`sparse`?{state:t.state,backend:t.backend,...t.reason?{reason:t.reason}:{},...t.reasonCode?{reasonCode:t.reasonCode}:{}}:lr(e)?nr:void 0}function lr(e){return e.snapshotQuality||e.backend!==`xctest`||e.nodes.length!==1?!1:_(e.nodes[0]?.type??``)===`application`}function ur(e){let t=ae(e),n=ne(te(e),256);return{...t,...n&&n!==t.label?{text:n}:{}}}const dr=[`primary`,`secondary`,`middle`];function fr(e){return e?.clickButton??`primary`}function pr(e){return e.button===`primary`?null:e.commandLabel===`click`?e.platform!==`macos`&&e.platform!==`linux`?new t(`UNSUPPORTED_OPERATION`,`click --button ${e.button} is supported only on macOS and Linux`):e.platform===`macos`&&e.button===`middle`?new t(`UNSUPPORTED_OPERATION`,`click --button middle is not supported by the macOS runner yet`):typeof e.count==`number`||typeof e.intervalMs==`number`||typeof e.holdMs==`number`||typeof e.jitterPx==`number`||e.doubleTap===!0?new t(`INVALID_ARGS`,`click --button ${e.button} does not support repeat or gesture modifier flags`):null:new t(`INVALID_ARGS`,`--button is supported only for click`)}function mr(e){return e===`primary`?{}:{button:e}}const hr=[`in-app`,`system`];export{$e as $,vn as A,y as At,Pt as B,Pn as C,Ee as Ct,Tn as D,He as Dt,bn as E,Fe as Et,Zt as F,At as G,It as H,Qt as I,V as J,H as K,Ht as L,yn as M,he as Mt,_n as N,wn as O,ke as Ot,Jt as P,it as Q,Vt as R,Nn as S,we as St,xn as T,xe as Tt,Mt as U,Lt as V,Ft as W,R as X,Ct as Y,A as Z,qn as _,be as _t,fr as a,dt as at,jn as b,Se as bt,ar as c,ge as ct,ir as d,Me as dt,lt as et,cr as f,Re as ft,Z as g,Le as gt,Wn as h,Pe as ht,pr as i,mt as it,gn as j,Ae as jt,hn as k,je as kt,sr as l,ze as lt,Q as m,Ie as mt,dr as n,ut as nt,rr as o,C as ot,Un as p,Ve as pt,Tt as q,mr as r,pt as rt,or as s,w as st,hr as t,N as tt,lr as u,b as ut,In as v,ye as vt,Fn as w,Te as wt,Mn as x,Ne as xt,Vn as y,Ce as yt,Rt as z};
1
+ import{I as e,R as t,i as n,t as r,w as i}from"./sdk-contracts.js";import{$ as a,Et as o,Q as s,Tt as c,ct as l,nt as u,ot as d,st as f,wt as ee,yt as p}from"./tv-remote.js";import{M as m,h}from"./sdk-batch-runner.js";import{a as g,t as _}from"./sdk-device.js";import{$r as te,Cr as ne,br as re,g as ie,pr as ae,ri as v,xr as oe}from"./sdk-batch.js";import{i as se}from"./recording-export-quality.js";import{t as ce}from"./recording-scope.js";import{a as le,o as ue}from"./sdk-remote-config.js";import{n as de}from"./session.js";import{c as fe}from"./observability.js";import pe from"node:path";function me(e,n){let r=e===void 0?NaN:Number(e);if(!Number.isInteger(r)||r<1)throw new t(`INVALID_ARGS`,`viewport ${n} must be a positive integer`);return r}function he(e){if(e.length!==2)throw new t(`INVALID_ARGS`,`viewport requires exactly two arguments: <width> <height>`);return{width:me(e[0],`width`),height:me(e[1],`height`)}}const ge=`proxy`,_e=`cloud`,ve=new Set([ge,_e]),ye=[`leaseId`,`tenantId`,`runId`,`clientId`,`deviceKey`];function be(e){return m({tenantId:e.meta?.tenantId??T(e.flags,`tenant`),runId:e.meta?.runId??T(e.flags,`runId`),leaseId:e.meta?.leaseId??T(e.flags,`leaseId`),leaseTtlMs:e.meta?.leaseTtlMs,leaseRetainOnClose:e.meta?.leaseRetainOnClose,leaseBackend:e.meta?.leaseBackend,leaseProvider:e.meta?.leaseProvider??T(e.flags,`leaseProvider`)??T(e.flags,`provider`),deviceKey:e.meta?.deviceKey??T(e.flags,`deviceKey`),clientId:e.meta?.clientId??T(e.flags,`clientId`)})}function xe(e){return m({tenantId:e.tenant,runId:e.runId,leaseId:e.leaseId,leaseTtlMs:e.leaseTtlMs??e.ttlMs,leaseRetainOnClose:e.retainOnClose,leaseBackend:e.leaseBackend,leaseProvider:e.leaseProvider??e.provider,deviceKey:e.deviceKey,clientId:e.clientId})}function Se(e){return m({tenantId:e.tenantId,runId:e.runId,leaseId:e.leaseId,leaseTtlMs:e.leaseTtlMs,leaseRetainOnClose:e.leaseRetainOnClose,leaseBackend:e.leaseBackend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId})}function Ce(e){return m({tenant:e.tenantId,runId:e.runId,leaseId:e.leaseId,leaseBackend:e.leaseBackend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId})}function we(e){return m({tenantId:e.tenantId??``,runId:e.runId??``,leaseId:e.leaseId,leaseBackend:e.leaseBackend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId,ttlMs:e.leaseTtlMs,retainOnClose:e.leaseRetainOnClose})}function Te(e){return w(e)}function Ee(e){let{ttlMs:t,...n}=w(e);return n}function De(e,t,n){let r=m({...n.includeTokenParam?{token:n.token}:{},session:n.session,tenantId:e.tenantId,runId:e.runId,leaseProvider:e.leaseProvider,clientId:e.clientId,deviceKey:e.deviceKey});switch(t){case`lease_allocate`:return{...r,...m({leaseId:e.leaseId,ttlMs:e.leaseTtlMs,retainOnClose:e.leaseRetainOnClose,backend:e.leaseBackend})};case`lease_heartbeat`:return{...r,...m({leaseId:e.leaseId,ttlMs:e.leaseTtlMs})};case`lease_release`:return{...r,...m({leaseId:e.leaseId})}}}const Oe=`platform.target.device.udid.serial.iosSimulatorDeviceSet.androidDeviceAllowlist.providerApp.providerOsVersion.providerDeviceType.providerProject.providerBuild.providerSessionName.providerDeviceOrientation.providerGeoLocation.providerTimezone.providerAppiumVersion.providerLanguage.providerLocale.providerNetworkProfile.providerCustomNetwork.providerNoResignApp.providerNetworkLogs.providerNetworkHosts.awsProjectArn.awsDeviceArn.awsAppArn.awsRegion.awsInteractionMode`.split(`.`),y=[`osVersion`,`imageTag`,`physical`];function ke(e){let t={};for(let n of Oe){let r=e?.[n];(typeof r==`string`||typeof r==`boolean`)&&(t[n]=r)}let{spec:n,invalidKeys:r}=b(e);Object.assign(t,n);for(let n of r)t[n]=e?.[n];return t}function b(e){let t={},n=[];for(let r of y){let i=e?.[r];i!==void 0&&(typeof i==(r===`physical`?`boolean`:`string`)?i===!0?t[r]=!0:typeof i==`string`&&i.trim()&&(t[r]=i):n.push(r))}return{spec:t,keys:y.filter(e=>e in t),invalidKeys:n}}function Ae(e){let{spec:t,keys:n,invalidKeys:r}=b(e);if(r.length>0)throw x(r);return{spec:t,keys:n}}function je(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=S(t.model),r=S(t.osVersion);if(!n||!r||typeof t.physical!=`boolean`)return;let i=S(t.imageTag);return{model:n,osVersion:r,...i?{imageTag:i}:{},physical:t.physical}}function Me(e,n=`This daemon cannot pick a device by OS version, image tag, or physical/virtual class.`,r={}){return new t(`UNSUPPORTED_OPERATION`,n,{...r,reason:`device-spec-unsupported`,keys:[...e],hint:`Drop --os, --image-tag and --physical, or connect through a proxy whose backend picks devices by spec.`})}function x(e){return new t(`INVALID_ARGS`,`osVersion and imageTag take a string, and physical takes a boolean.`,{reason:`device-spec-invalid`,keys:[...e]})}function S(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function Ne(e){let t=m({leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId});return Object.keys(t).length>0?t:void 0}function Pe(e){return`${e.platform}:${e.target??`mobile`}:${e.id}`}function Fe(e){let t=/^([^:]+):([^:]+):(.+)$/.exec(e??``);if(!t)return;let[,n,r,i]=t;return{platform:n,target:r,id:i}}function C(e){return e.leaseProvider===ge}function Ie(e){let{leaseProvider:t}=e;return t===void 0||ve.has(t)?void 0:t}function Le(e){return C(e)?ye.filter(t=>!e[t]):[]}const Re=5e3,ze=new Set([`LEASE_NOT_FOUND`,`LEASE_EXPIRED`,`LEASE_REVOKED`]);function Be(e){return typeof e==`object`&&!!e&&e.code===`UNAUTHORIZED`&&ze.has(e.details?.reason)}function Ve(e){let t=(e.ok?e.data:e.error.details)?.endedLeases;return Array.isArray(t)?t.flatMap(e=>{if(typeof e!=`object`||!e)return[];let{leaseId:t,outcome:n}=e;return typeof t==`string`&&n===`released`?[{leaseId:t,outcome:n}]:[]}):[]}function w(e){return m({leaseId:e.leaseId??``,tenantId:e.tenantId,runId:e.runId,leaseBackend:e.leaseBackend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId,ttlMs:e.leaseTtlMs})}function T(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}const E=[`pan`,`fling`,`swipe`,`pinch`,`rotate`,`transform`,`tap`,`drag`],He=[`points`,`holdMs`,`count`,`pauseMs`];function D(e){let n=k(e),r=N(n,`kind`,E);if(r===`tap`)return Ue(n);if(Ke(r,n),r===`pan`)return{kind:r,origin:A(n,`origin`),delta:A(n,`delta`),pointerCount:h(n,`pointerCount`,{min:1,max:2}),durationMs:O(n)};if(r===`drag`)return qe(n);if(n.pointerCount!==void 0)throw new t(`INVALID_ARGS`,`pointerCount is supported only for gesture pan`);if(r===`fling`){if(n.durationMs!==void 0)throw new t(`INVALID_ARGS`,`gesture fling does not accept durationMs; use gesture pan for timed movement`);return{kind:r,direction:N(n,`direction`,u),origin:A(n,`origin`),distance:h(n,`distance`,{min:0})}}if(r===`swipe`){if(n.durationMs!==void 0)throw new t(`INVALID_ARGS`,`gesture swipe does not accept durationMs; use gesture pan for timed movement`);return{kind:r,preset:N(n,`preset`,f)}}if(r===`pinch`)return{kind:r,scale:M(n,`scale`),origin:j(n,`origin`)};if(r===`rotate`){if(n.velocity!==void 0)throw new t(`INVALID_ARGS`,`gesture rotate does not accept velocity; rotation pacing derives from degrees`);return{kind:r,degrees:M(n,`degrees`),origin:j(n,`origin`)}}return{kind:r,origin:A(n,`origin`),delta:A(n,`delta`),scale:M(n,`scale`),degrees:M(n,`degrees`),durationMs:O(n)}}function Ue(e){if(e.pointerCount!==void 0)throw new t(`INVALID_ARGS`,`pointerCount is supported only for gesture pan`,{hint:`gesture tap takes one contact per point.`});if(e.durationMs!==void 0)throw new t(`INVALID_ARGS`,`gesture tap does not accept durationMs; use holdMs`);let n={kind:`tap`,points:We(e),holdMs:h(e,`holdMs`,{min:16,max:a}),count:h(e,`count`,{min:1,max:200}),pauseMs:h(e,`pauseMs`,{min:0,max:d})};return Ge(n),n}function We(e){let n=e.points;if(!Array.isArray(n)||n.length<2||n.length>5)throw new t(`INVALID_ARGS`,`gesture tap requires 2 to 5 points`,{hint:`Use press for a single contact.`});return n.map((e,n)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw new t(`INVALID_ARGS`,`Expected points[${n}] to be a point.`);let r=e;return{x:M(r,`x`),y:M(r,`y`)}})}function Ge(e){let n=e.count??1,r=e.pauseMs??0,i=e.holdMs??50,a=n*(i+500)+Math.max(0,n-1)*r;if(!(a<=6e4))throw new t(`INVALID_ARGS`,`gesture tap series must fit within ${l}ms.`,{count:n,pauseMs:r,holdMs:i,overheadAllowanceMs:500,scheduledDurationMs:a,hint:`Reduce --count, --pause-ms or --hold-ms.`})}function Ke(e,n){let r=He.find(e=>n[e]!==void 0);if(r!==void 0)throw new t(`INVALID_ARGS`,`${r} is supported only for gesture tap`,{hint:`gesture ${e} does not read ${r}.`})}function qe(e){let n=h(e,`sourceHoldMs`,{min:1,max:1e4}),r=h(e,`moveMs`,{min:16,max:1e4}),i=h(e,`destinationHoldMs`,{min:0,max:1e4});if((n??800)+(r??500)+(i??0)>1e4)throw new t(`INVALID_ARGS`,`gesture drag total duration must be at most ${a}`);return{kind:`drag`,source:Je(e,`source`),destination:Je(e,`destination`),sourceHoldMs:n,moveMs:r,destinationHoldMs:i}}function O(e){let n=h(e,`durationMs`);if(n!==void 0){if(n<16||n>1e4)throw new t(`INVALID_ARGS`,`Expected durationMs to be an integer between 16 and ${a}.`);return n}}function k(e){if(!e||typeof e!=`object`||Array.isArray(e))throw new t(`INVALID_ARGS`,`gesture requires structured object input`);return e}function A(e,t){let n=k(e[t]);return{x:M(n,`x`),y:M(n,`y`)}}function j(e,t){return e[t]===void 0?void 0:A(e,t)}function M(e,n){let r=e[n];if(typeof r!=`number`||!Number.isFinite(r))throw new t(`INVALID_ARGS`,`Expected ${n} to be a finite number.`);return r}function Je(e,n){let r=e[n];if(typeof r!=`string`||r.trim().length===0)throw new t(`INVALID_ARGS`,`Expected ${n} to be a non-empty string.`);return r.trim()}function N(e,n,r){let i=e[n];if(typeof i!=`string`||!r.includes(i))throw new t(`INVALID_ARGS`,`Expected ${n} to be one of: ${r.join(`, `)}.`);return i}const Ye={pointerCount:`--pointer-count`,holdMs:`--hold-ms`,count:`--count`,pauseMs:`--pause-ms`},P={pan:[`pointerCount`],tap:[`holdMs`,`count`,`pauseMs`],fling:[],swipe:[],pinch:[],rotate:[],transform:[],drag:[]};function Xe(e,t,n,r){if(e!==`gesture`)return;let i=t[0];if(i===void 0||!Object.hasOwn(P,i))return;let a=P[i],o=Object.keys(Ye).filter(e=>n[e]!==void 0&&!a.includes(e));if(o.length!==0)return`gesture ${i} does not read ${o.map(e=>Ye[e]).join(`, `)} (${r}).`}const Ze={swipe:{max:4,usage:`swipe accepts 4 arguments: x1 y1 x2 y2`,retired:{positional:`durationMs`,migrate:Qe}},"gesture pan":{max:5,usage:`gesture pan accepts at most 5 arguments: x y dx dy [durationMs]`},"gesture fling":{max:4,usage:`gesture fling accepts at most 4 arguments: direction x y [distance]`,retired:{positional:`durationMs`,migrate:(e,t)=>`use "${t}", or gesture pan for timed movement.`}},"gesture swipe":{max:1,usage:`gesture swipe accepts 1 argument: preset`,retired:{positional:`durationMs`,migrate:(e,t)=>`use "${t}", or gesture pan for timed movement.`}},"gesture pinch":{max:3,usage:`gesture pinch accepts at most 3 arguments: scale [x] [y]`},"gesture rotate":{max:3,usage:`gesture rotate accepts at most 3 arguments: degrees [x] [y]`,retired:{positional:`velocity`,migrate:(e,t)=>`use "${t}"; rotation pacing derives from degrees.`}},"gesture transform":{max:7,usage:`gesture transform accepts at most 7 arguments: x y dx dy scale degrees [durationMs]`},"gesture tap":{min:4,max:10,pairs:!0,usage:`gesture tap accepts 4 to 10 arguments: x1 y1 x2 y2 [x3 y3 [x4 y4 [x5 y5]]]`},"gesture drag":{max:5,usage:`gesture drag accepts at most 5 arguments: source destination [sourceHoldMs] [moveMs] [destinationHoldMs]`}};function Qe(e,t){let[n,r,i,a,o]=e,s=$e(n,i),c=$e(r,a);return s===void 0||c===void 0?`use "gesture pan x1 y1 dx dy durationMs" for the same timed drag, or "${t}" for a default-duration swipe.`:`use "gesture pan ${n} ${r} ${s} ${c} ${o}" for the same timed drag, or "${t}" for a default-duration swipe.`}function $e(e,t){let n=Number(t)-Number(e);return Number.isFinite(n)?n:void 0}function F(e,t){let n=Ze[e];if(n.min!==void 0&&t.length<n.min||n.pairs&&t.length%2!=0)return{usage:n.usage};if(t.length<=n.max)return;let r=n.retired;if(!r||t.length!==n.max+1||!et(t[n.max]))return{usage:n.usage};let i=`${e} ${t.slice(0,n.max).join(` `)}`;return{usage:n.usage,migration:`The trailing ${r.positional} positional was removed: ${r.migrate(t,i)}`}}function et(e){return e===void 0||e.trim().length===0?!1:e.startsWith("${")||Number.isFinite(Number(e))}function tt(e){if(!(!e||typeof e!=`object`||Array.isArray(e))&&e.durationMs!==void 0)throw new t(`INVALID_ARGS`,`swipe does not accept durationMs; use gesture pan for timed movement`)}function nt(e,t){let n=t?`${e.usage} (${t})`:e.usage;return e.migration?`${n}. ${e.migration}`:`${n}.`}function I(e,n){let r=F(e,n);if(r)throw new t(`INVALID_ARGS`,nt(r))}function rt(e,t,n){let r=it(e,t);return r?nt(r,n):void 0}function it(e,t){if(e===`swipe`)return F(`swipe`,t);if(e!==`gesture`)return;let n=`gesture ${t[0]}`;if(Object.hasOwn(Ze,n))return F(n,t.slice(1))}function at(e){return{origin:{x:Number(e[0]),y:Number(e[1])},delta:{x:Number(e[2]),y:Number(e[3])}}}function ot(e,t={}){let{pointerCount:n}=t,r=e[0],i=e.slice(1);switch(r){case`pan`:{I(`gesture pan`,i);let{origin:e,delta:t}=at(i);return D({kind:r,origin:e,delta:t,pointerCount:n,durationMs:L(i[4])})}case`fling`:return I(`gesture fling`,i),D({kind:r,direction:i[0],origin:{x:Number(i[1]),y:Number(i[2])},distance:L(i[3])});case`swipe`:return I(`gesture swipe`,i),D({kind:r,preset:i[0]});case`pinch`:return I(`gesture pinch`,i),D({kind:r,scale:Number(i[0]),origin:mt(i[1],i[2])});case`rotate`:return I(`gesture rotate`,i),D({kind:r,degrees:Number(i[0]),origin:mt(i[1],i[2])});case`transform`:{I(`gesture transform`,i);let{origin:e,delta:t}=at(i);return D({kind:r,origin:e,delta:t,scale:Number(i[4]),degrees:Number(i[5]),durationMs:L(i[6])})}case`tap`:return I(`gesture tap`,i),D({kind:r,points:pt(i),holdMs:t.holdMs,count:t.count,pauseMs:t.pauseMs});case`drag`:return I(`gesture drag`,i),D({kind:r,source:i[0],destination:i[1],sourceHoldMs:L(i[2]),moveMs:L(i[3]),destinationHoldMs:L(i[4])});default:return D({kind:r})}}function st(e){if(e[0]!==`drag`)return;let t=ot(e);return t.kind===`drag`?t:void 0}function ct(e){switch(e.kind){case`pan`:return R([e.kind,e.origin.x,e.origin.y,e.delta.x,e.delta.y,e.durationMs]);case`fling`:return R([e.kind,e.direction,e.origin.x,e.origin.y,e.distance]);case`swipe`:return[e.kind,e.preset];case`pinch`:return R([e.kind,e.scale,e.origin?.x,e.origin?.y]);case`rotate`:return e.origin?R([e.kind,e.degrees,e.origin.x,e.origin.y]):[e.kind,String(e.degrees)];case`transform`:return R([e.kind,e.origin.x,e.origin.y,e.delta.x,e.delta.y,e.scale,e.degrees,e.durationMs]);case`tap`:return[e.kind,...e.points.flatMap(e=>[String(e.x),String(e.y)])];case`drag`:return[e.kind,e.source,e.destination,String(e.sourceHoldMs??800),String(e.moveMs??500),String(e.destinationHoldMs??0)]}}function lt(e,t={}){return I(`swipe`,e),{from:{x:Number(e[0]),y:Number(e[1])},to:{x:Number(e[2]),y:Number(e[3])},...t.count===void 0?{}:{count:t.count},...t.pauseMs===void 0?{}:{pauseMs:t.pauseMs},...t.pattern===void 0?{}:{pattern:t.pattern}}}function ut(e){switch(e.kind){case`pan`:return{gesture:{intent:`pan`,origin:e.origin,delta:e.delta,pointerCount:e.pointerCount,durationMs:e.durationMs}};case`fling`:return{gesture:{intent:`fling`,direction:e.direction,origin:e.origin,distance:e.distance}};case`swipe`:return{gesture:{intent:`fling`,preset:e.preset}};case`pinch`:return{gesture:{intent:`pinch`,origin:e.origin,scale:e.scale}};case`rotate`:return{gesture:{intent:`rotate`,origin:e.origin,degrees:e.degrees}};case`transform`:return{gesture:{intent:`transform`,origin:e.origin,delta:e.delta,scale:e.scale,degrees:e.degrees,durationMs:e.durationMs}};case`tap`:return{gesture:{intent:`tap`,points:e.points,holdMs:e.holdMs}};case`drag`:throw new t(`INVALID_ARGS`,`gesture drag targets must be resolved before coordinate normalization`)}}function dt(e){return e.kind===`drag`?{intent:`drag`,source:e.source,destination:e.destination,sourceHoldMs:e.sourceHoldMs,moveMs:e.moveMs,destinationHoldMs:e.destinationHoldMs}:ut(e).gesture}function ft(e){return{gesture:{intent:`fling`,from:e.from,to:e.to}}}function pt(e){let t=[];for(let n=0;n+1<e.length;n+=2)t.push({x:Number(e[n]),y:Number(e[n+1])});return t}function L(e){return e===void 0?void 0:Number(e)}function mt(e,n){if(e===void 0!=(n===void 0))throw new t(`INVALID_ARGS`,`gesture origin requires both x and y coordinates`);return e===void 0?void 0:{x:Number(e),y:Number(n)}}function R(e){return e.filter(e=>e!==void 0).map(String)}const ht={ios:!0,android:!0,harmonyos:!0};function gt(e){return typeof e==`string`&&Object.hasOwn(ht,e)}function z(t){return t.startsWith(`@`)?e(t)?.base??t:t}const B=/^-?\d+(\.\d+)?$/,_t=/^[^\s"'\\][^\s"\\]*$/,vt=new Map([[`--count`,`count`],[`--interval-ms`,`intervalMs`],[`--hold-ms`,`holdMs`],[`--jitter-px`,`jitterPx`]]),yt=new Map([[`--count`,`count`],[`--pause-ms`,`pauseMs`]]),bt=new Map([[`--pointer-count`,`pointerCount`],[`--hold-ms`,`holdMs`],[`--count`,`count`],[`--pause-ms`,`pauseMs`]]),xt=new Map([[`--delay-ms`,`delayMs`]]),St={scroll:new Map([[`--until`,{key:`until`,kind:`string`}],[`--max-passes`,{key:`maxPasses`,kind:`int`}]]),wait:new Map([[`--raw`,{key:`snapshotRaw`,kind:`boolean`}],[`--depth`,{key:`snapshotDepth`,kind:`int`}],[`--scope`,{key:`snapshotScope`,kind:`string`}]])};Object.keys(St);function Ct(e,t){let n=[],r={},i=St[e];for(let e=0;e<t.length;e+=1){let a=t[e],o=i.get(a),s=t[e+1];if(o===void 0||o.kind!==`boolean`&&s===void 0){n.push(a);continue}if(o.kind===`boolean`){Object.assign(r,{[o.key]:!0});continue}if(o.kind===`int`){let e=G(s);if(e===null){n.push(a);continue}Object.assign(r,{[o.key]:e})}else Object.assign(r,{[o.key]:s});e+=1}return{positionals:n,flags:r}}function V(e){return e===`click`||e===`press`}function wt(e){return V(e)||e===`longpress`||e===`hover`}function Tt(e){return e===`type`||e===`fill`}function H(e){return Dt(e,Ot)}function Et(e){return JSON.stringify(e)}function U(e){return Dt(e,kt)}function Dt(e,t){return t(e)?e:Et(e)}function Ot(e){return kt(e)&&e.startsWith(`@`)||B.test(e)}function kt(e){return _t.test(e)}const At=new Set([`fill`,`type`]);function jt(e){if(!At.has(e.command)){let t=(e.positionals??[]).map(e=>H(e));return[e.command,...t].join(` `)}let t=Mt(e).map(e=>H(e)).join(` `);return[e.command,t,`<text>`].filter(e=>e.length>0).join(` `)}function Mt(e){if(e.command===`type`)return[];let t=e.positionals??[],n=t[0];return n===void 0?[]:n.startsWith(`@`)?[n]:t.length>=3&&B.test(n)&&B.test(t[1]??``)?[n,t[1]]:[n]}function Nt(e,t){let n=t.flags??{};if(V(t.command)){typeof n.count==`number`&&e.push(`--count`,String(n.count)),typeof n.intervalMs==`number`&&e.push(`--interval-ms`,String(n.intervalMs)),typeof n.holdMs==`number`&&e.push(`--hold-ms`,String(n.holdMs)),typeof n.jitterPx==`number`&&e.push(`--jitter-px`,String(n.jitterPx)),n.doubleTap===!0&&e.push(`--double-tap`);let t=n.clickButton;t&&t!==`primary`&&e.push(`--button`,t);return}if(t.command===`swipe`){typeof n.count==`number`&&e.push(`--count`,String(n.count)),typeof n.pauseMs==`number`&&e.push(`--pause-ms`,String(n.pauseMs)),(n.pattern===`one-way`||n.pattern===`ping-pong`)&&e.push(`--pattern`,n.pattern);return}if(t.command===`gesture`){typeof n.pointerCount==`number`&&e.push(`--pointer-count`,String(n.pointerCount)),typeof n.holdMs==`number`&&e.push(`--hold-ms`,String(n.holdMs)),typeof n.count==`number`&&e.push(`--count`,String(n.count)),typeof n.pauseMs==`number`&&e.push(`--pause-ms`,String(n.pauseMs));return}Tt(t.command)&&typeof n.delayMs==`number`&&e.push(`--delay-ms`,String(n.delayMs))}function Pt(e,t){t&&(gt(t.platform)&&e.push(`--platform`,t.platform),typeof t.metroHost==`string`&&t.metroHost.length>0&&e.push(`--metro-host`,U(t.metroHost)),typeof t.metroPort==`number`&&e.push(`--metro-port`,String(t.metroPort)),typeof t.bundleUrl==`string`&&t.bundleUrl.length>0&&e.push(`--bundle-url`,U(t.bundleUrl)),typeof t.launchUrl==`string`&&t.launchUrl.length>0&&e.push(`--launch-url`,U(t.launchUrl)))}function Ft(e,t){let[n,...r]=t.positionals??[];n&&e.push(U(n));for(let t of r)e.push(H(t));typeof t.flags?.fps==`number`&&e.push(`--fps`,String(t.flags.fps)),(typeof t.flags?.quality==`number`||typeof t.flags?.quality==`string`)&&e.push(`--quality`,String(t.flags.quality)),t.flags?.hideTouches&&e.push(`--hide-touches`)}function It(e,t){t.flags?.snapshotInteractiveOnly&&e.push(`-i`),typeof t.flags?.snapshotDepth==`number`&&e.push(`-d`,String(t.flags.snapshotDepth)),t.flags?.snapshotScope&&e.push(`-s`,H(t.flags.snapshotScope)),t.flags?.snapshotRaw&&e.push(`--raw`)}function Lt(e,t){for(let n of t.positionals??[])e.push(H(n));let n=t.flags?.screenshotCropOn;typeof n==`string`&&n.length>0&&e.push(`--crop-on`,U(n)),c(e,t.flags)}function Rt(e,t,n={}){let r=t.positionals??[],i=n.includeAllPositionals?r:r.slice(0,1);for(let t of i)e.push(U(t));Pt(e,t.flags)}function zt(e,t){for(let n of t.positionals??[])e.push(H(t.command===`wait`?z(n):n));t.command===`fold`&&t.flags?.keyframes!==void 0&&e.push(`--keyframes`,H(t.flags.keyframes)),t.command===`scroll`&&typeof t.flags?.until==`string`&&e.push(`--until`,H(t.flags.until)),t.command===`scroll`&&typeof t.flags?.maxPasses==`number`&&e.push(`--max-passes`,String(t.flags.maxPasses)),t.command===`wait`&&Bt(e,t.flags),Nt(e,t)}function Bt(e,t){t&&(t.snapshotRaw===!0&&e.push(`--raw`),typeof t.snapshotDepth==`number`&&e.push(`--depth`,String(t.snapshotDepth)),typeof t.snapshotScope==`string`&&e.push(`--scope`,H(t.snapshotScope)))}function W(e,t){let n=[],r={},i=V(e)?vt:e===`swipe`?yt:e===`gesture`?bt:Tt(e)?xt:void 0;for(let a=0;a<t.length;a+=1){let o=t[a];if(V(e)&&o===`--double-tap`){r.doubleTap=!0;continue}let s=t[a+1];if(e===`fold`&&o===`--keyframes`&&s!==void 0){r.keyframes=s,a+=1;continue}if(V(e)&&o===`--button`&&s!==void 0){let e=s;(e===`primary`||e===`secondary`||e===`middle`)&&(r.clickButton=e),a+=1;continue}let c=i?.get(o);if(c&&s!==void 0){let e=G(s);if(e!==null){r[c]=e,a+=1;continue}}if(e===`swipe`&&o===`--pattern`&&s!==void 0){let e=s;(e===`one-way`||e===`ping-pong`)&&(r.pattern=e),a+=1;continue}n.push(o)}return{positionals:n,flags:r}}function Vt(e){let t=[],n={};for(let r=0;r<e.length;r+=1){let i=e[r],a=e[r+1];if(i===`--platform`&&a!==void 0){let e=a;gt(e)&&(n.platform=e),r+=1;continue}if(i===`--metro-host`&&a!==void 0){n.metroHost=a,r+=1;continue}if(i===`--metro-port`&&a!==void 0){let e=G(a);e!==null&&(n.metroPort=e),r+=1;continue}if(i===`--bundle-url`&&a!==void 0){n.bundleUrl=a,r+=1;continue}if(i===`--launch-url`&&a!==void 0){n.launchUrl=a,r+=1;continue}t.push(i)}return{positionals:t,flags:n}}function G(e){if(!e)return null;let t=Number(e);return!Number.isFinite(t)||t<0?null:Math.floor(t)}function Ht(e){let t;for(let n of e){if(n.command===`runtime`&&typeof n.flags.platform==`string`){t=n.flags.platform;continue}if(n.command===`open`)return n.runtime?.platform??t}return t}function Ut(e,t){for(let n of t.positionals??[])e.push(H(n));t.flags?.relaunch&&e.push(`--relaunch`),t.flags?.surface!==void 0&&e.push(`--surface`,t.flags.surface),t.flags?.testIme===!0?e.push(`--test-ime`):t.flags?.testIme===!1&&e.push(`--no-test-ime`),Pt(e,t.runtime)}function Wt(e){let t=[],n={};for(let r=0;r<e.length;r+=1){let i=e[r];if(i===`--surface`){n.surface=qt(e[r+1]),r+=1;continue}if(i===`--relaunch`){n.relaunch=!0;continue}if(i===`--test-ime`){n.testIme=!0;continue}if(i===`--no-test-ime`){n.testIme=!1;continue}t.push(i)}let r=Vt(t);return{positionals:r.positionals,flags:n,runtime:Jt(r.flags)?r.flags:void 0}}const Gt={app:!0,"frontmost-app":!0,desktop:!0,menubar:!0};function Kt(e){return Object.hasOwn(Gt,e)}function qt(e){let n=e?.trim().toLowerCase();if(n!==void 0&&Kt(n))return n;throw new t(`INVALID_ARGS`,`Invalid surface: ${e}. Use ${Object.keys(Gt).join(`|`)}.`)}function Jt(e){return!!(e.platform||e.metroHost||e.metroPort!==void 0||e.bundleUrl||e.launchUrl)}const Yt=/^[A-Z_][A-Z0-9_]*$/,Xt=new Set(g.filter(e=>e!==`web`)),Zt=new Set([`mobile`,`tv`,`desktop`]);function Qt(e){let n=[],r=[],i=e.split(/\r?\n/),a=!1,o,s=(e,n,r)=>{let i=e.kind===`multiple`?`targets-v1`:`target-v1`;throw new t(`INVALID_ARGS`,`${i} annotation on line ${e.line} must be immediately followed by its action line (line ${n+1} ${r}).`)};for(let[e,c]of i.entries()){let i=c.trim();if(i.length===0){o&&s(o,e,`is blank`);continue}if(i.startsWith(`#`)){let t=re(i);if(t.kind===`v1`){o&&s(o,e,`is another target annotation`),o={kind:`multiple`,evidence:t.evidence,line:e+1};continue}let n=oe(i);if(n.kind===`v1`){o&&s(o,e,`is another target annotation`),o={kind:`single`,evidence:n.evidence,line:e+1};continue}o&&s(o,e,`is a comment`);continue}if(en(i)){if(o&&s(o,e,`is an env directive`),a)throw new t(`INVALID_ARGS`,`env directives must precede all actions (line ${e+1}).`);continue}let l=an(c);if(!l){o&&s(o,e,`did not parse as an action`);continue}let u=rt(l.command,l.positionals??[],`line ${e+1}`);if(u)throw new t(`INVALID_ARGS`,u);let d=Xe(l.command,l.positionals??[],l.flags??{},`line ${e+1}`);if(d)throw new t(`INVALID_ARGS`,d);o&&=(o.kind===`single`?l.targetEvidence=o.evidence:l.targetEvidences=o.evidence,void 0),n.push(l),r.push(e+1),a=!0}if(o){let e=o.kind===`multiple`?`targets-v1`:`target-v1`;throw new t(`INVALID_ARGS`,`${e} annotation on line ${o.line} must be immediately followed by its action line (end of script reached).`)}return{actions:n,actionLines:r}}function $t(e){let t=e.split(/\r?\n/),n={};for(let[e,r]of t.entries()){let t=r.trim();if(t.length===0||t.startsWith(`#`))continue;if(en(t)){rn(n,t,e+1);continue}if(!t.startsWith(`context `))break;let i=t.match(/(?:^|\s)platform=([^\s]+)/);if(i){let e=i[1];e&&Xt.has(e)&&K(n,`platform`,e)}let a=t.match(/(?:^|\s)target=([^\s]+)/);if(a){let e=a[1];e&&Zt.has(e)&&K(n,`target`,e)}let o=t.match(/(?:^|\s)timeout=(\d+)/);if(o){let e=Number(o[1]);Number.isFinite(e)&&e>=1&&K(n,`timeoutMs`,Math.floor(e))}let s=t.match(/(?:^|\s)retries=(\d+)/);if(s){let e=Number(s[1]);Number.isFinite(e)&&e>=0&&K(n,`retries`,Math.floor(e))}}return n}function en(e){return e===`env`||e.startsWith(`env `)||e.startsWith(`env `)}function tn(e,n){let r=e.slice(3).replace(/^[\s]+/,``),i=r.indexOf(`=`);if(i<=0)throw new t(`INVALID_ARGS`,`Invalid env directive on line ${n}: expected "env KEY=VALUE".`);let a=r.slice(0,i);if(!Yt.test(a))throw new t(`INVALID_ARGS`,`Invalid env key "${a}" on line ${n}: keys must be uppercase letters, digits, and underscores (e.g. APP_ID).`);if(a.startsWith(`AD_`))throw new t(`INVALID_ARGS`,`Invalid env key "${a}" on line ${n}: the AD_* namespace is reserved for built-in variables. Rename ${a} to avoid the AD_ prefix.`);return{key:a,value:nn(r.slice(i+1),n)}}function nn(e,n){if(e.length===0)return``;if(e.startsWith(`"`))try{let t=JSON.parse(e);if(typeof t!=`string`)throw Error(`not a string literal`);return t}catch{throw new t(`INVALID_ARGS`,`Invalid quoted env value on line ${n}.`)}return e}function rn(e,n,r){let{key:i,value:a}=tn(n,r),o=e.env??{};if(Object.prototype.hasOwnProperty.call(o,i))throw new t(`INVALID_ARGS`,`Duplicate env directive "${i}" on line ${r}.`);o[i]=a,e.env=o}function K(e,n,r){let i=e[n];if(i!==void 0){let e=i===r?`Duplicate replay test metadata "${n}" in context header.`:`Conflicting replay test metadata "${n}" in context header: ${String(i)} vs ${String(r)}.`;throw new t(`INVALID_ARGS`,e)}e[n]=r}function an(e){let n=e.trim();if(n.length===0||n.startsWith(`#`))return null;let[r,...i]=sn(n);if(r===void 0||r===`context`)return null;let a={ts:Date.now(),command:r,positionals:[],flags:{}};if(r===`snapshot`){a.positionals=[];for(let e=0;e<i.length;e+=1){let t=i[e];if(t===`-i`){a.flags.snapshotInteractiveOnly=!0;continue}if(t!==`-c`){if(t===`--raw`){a.flags.snapshotRaw=!0;continue}if(t===`--force-full`){a.flags.snapshotForceFull=!0;continue}if((t===`-d`||t===`--depth`)&&e+1<i.length){let t=Number(i[e+1]);Number.isFinite(t)&&t>=0&&(a.flags.snapshotDepth=Math.floor(t)),e+=1;continue}if((t===`-s`||t===`--scope`)&&e+1<i.length){a.flags.snapshotScope=i[e+1],e+=1;continue}if(t===`--backend`&&e+1<i.length){e+=1;continue}}}return a}if(r===`open`){let e=Wt(i);return a.positionals=e.positionals,Object.assign(a.flags,e.flags),a.runtime=e.runtime,a}if(r===`runtime`){let e=Vt(i);return a.positionals=e.positionals,Object.assign(a.flags,e.flags),a}if(V(r)){let e=W(r,i);Object.assign(a.flags,e.flags);let t=e.positionals[0];if(t===void 0)return a;if(t.startsWith(`@`))return a.positionals=[z(t)],e.positionals[1]&&(a.result={refLabel:e.positionals[1]}),a;let n=e.positionals[0],o=e.positionals[1];return q(n)&&q(o)&&e.positionals.length>=2?(a.positionals=[n,o],a):(a.positionals=[e.positionals.join(` `)],a)}if(r===`fill`){let e=W(r,i);if(Object.assign(a.flags,e.flags),!on(e.positionals))return a.positionals=e.positionals,a;let[t,n,...o]=e.positionals;if(q(t)&&q(n))return a.positionals=[t,n,o.join(` `)],a;let[s,c,...l]=e.positionals;if(s.startsWith(`@`)){let e=z(s);return l.length>0?(a.positionals=[e,l.join(` `)],a.result={refLabel:c},a):(a.positionals=[e,c],a)}return a.positionals=[s,[c,...l].join(` `)],a}if(r===`get`){let e=i[0],t=i[1];return e===void 0||t===void 0?(a.positionals=i,a):t.startsWith(`@`)?(a.positionals=[e,z(t)],i[2]&&(a.result={refLabel:i[2]}),a):(a.positionals=[e,i.slice(1).join(` `)],a)}if(r===`swipe`||r===`type`||r===`gesture`||r===`fold`){let e=W(r,i);return Object.assign(a.flags,e.flags),a.positionals=e.positionals,a}if(r===`record`){let e=[];for(let n=0;n<i.length;n+=1){let r=i[n];if(r===p.cliToken)throw new t(`INVALID_ARGS`,p.migration.record);if(r===`--hide-touches`){a.flags.hideTouches=!0;continue}if(r===`--fps`&&n+1<i.length){let e=Number(i[n+1]);Number.isFinite(e)&&(a.flags.fps=Math.floor(e)),n+=1;continue}if(r===`--quality`&&n+1<i.length){let e=i[n+1],t=se(e);t!==void 0&&(a.flags.quality=t),n+=1;continue}e.push(r)}return a.positionals=e,a}if(r===`screenshot`){let e=[];for(let t=0;t<i.length;t+=1){let n=i[t],r=o({args:i,index:t,flags:a.flags});if(r.handled){t=r.nextIndex;continue}e.push(n)}return a.positionals=e,a}if(r===`scroll`||r===`wait`){let e=Ct(r,i);return Object.assign(a.flags,e.flags),a.positionals=e.positionals.map(e=>z(e)),a}return a.positionals=r===`longpress`||r===`hover`?i.map(e=>z(e)):i,a}function on(e){return e.length>=2}function q(e){return e?!Number.isNaN(Number(e)):!1}function sn(e){let t=[],n=0;for(;n<e.length&&(n=cn(e,n),!(n>=e.length));){let r=e[n]===`"`?ln(e,n):un(e,n)??hn(e,n);t.push(r.value),n=r.nextCursor}return t}function cn(e,t){let n=t;for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n}function ln(e,n){let r=n+1,i=!1,a=r;for(;a<e.length;a+=1){let t=e.charAt(a);if(t===`"`&&!i)break;if(i){i=!1;continue}i=t===`\\`}if(a>=e.length)throw new t(`INVALID_ARGS`,`Invalid replay script line: ${e}`);let o=e.slice(n,a+1),s;try{s=JSON.parse(o)}catch{throw new t(`INVALID_ARGS`,`Invalid quoted value ${o} in replay script line: ${e}`,{hint:`Quoted replay values are JSON strings: escape backslashes, quotes, tabs, and newlines (\\\\, \\", \\t, \\n).`})}return{value:s,nextCursor:a+1}}function un(e,t){if(e[t]!==`'`)return null;let n=dn(e,t+1);return n===-1||!pn(e,n+1)?null:{value:mn(e.slice(t+1,n)),nextCursor:n+1}}function dn(e,t){let n=t;for(;n<e.length;){let t=e.indexOf(`'`,n);if(t===-1)return-1;if(!fn(e,t))return t;n=t+1}return-1}function fn(e,t){let n=0;for(;t>0&&e.charAt(t-1)===`\\`;)n+=1,--t;return n%2==1}function pn(e,t){return t>=e.length||/\s/.test(e.charAt(t))}function mn(e){return e.replaceAll(String.raw`\'`,`'`)}function hn(e,t){let n=t;for(;n<e.length&&!/\s/.test(e.charAt(n));)n+=1;return{value:e.slice(t,n),nextCursor:n}}function gn(e){let t=pe.extname(e).toLowerCase();return t===`.yaml`||t===`.yml`}function _n(e,t){return`Maestro YAML requires explicit --maestro routing: ${e} ${t} --maestro`}function vn(e){return`Unsupported replay backend "${e}".`}function yn(e){return e===`maestro`}function bn(e,t){return t===`maestro`&&gn(e)?`maestro`:`ad`}const xn=J(`public`),Sn=J(`internal`),Cn=J(`local-cli`),wn={help:`help`};function Tn(){return[...Object.values(xn),...Object.values(Cn)].sort()}function En(e){return Object.values(wn).includes(e)||Object.values(Sn).includes(e)?!0:Tn().includes(e)}function J(e){let t={};for(let[n,r]of ie(e))t[n]=r;return t}const Dn=[{key:`keyframes`,names:[`--keyframes`],type:`string`,usageLabel:`--keyframes <json>`,usageDescription:`Fold: timed {atMs, angle} keyframes; final atMs is motion duration (up to 60000ms)`,projectConfig:!1,recorded:!0},{key:`count`,names:[`--count`],type:`int`,min:1,max:200,usageLabel:`--count <n>`,usageDescription:`Repeat count for press, swipe and gesture tap series`,projectConfig:!0,recorded:!0},{key:`pointerCount`,names:[`--pointer-count`],type:`int`,min:1,max:2,usageLabel:`--pointer-count <1|2>`,usageDescription:`Gesture pan: number of touch pointers (default 1)`,projectConfig:!0,recorded:!0},{key:`fps`,names:[`--fps`],type:`int`,min:1,max:120,usageLabel:`--fps <n>`,usageDescription:`Record: target frames per second (iOS physical device runner); also lowers the touch-overlay rate, which never exceeds 30`,projectConfig:!0,recorded:!0},{key:`quality`,names:[`--quality`],type:`string`,usageLabel:`--quality <medium|high>`,usageDescription:`Record: output quality preset; Android maps this to screenrecord bitrate, Limrun sessions map medium to recorder quality 5 and high to 8; Apple export always preserves the captured resolution, so it has no effect there. Legacy numeric values 5-7 map to medium; 8-10 map to high`,projectConfig:!0,recorded:!0},{key:`hideTouches`,names:[`--hide-touches`],type:`boolean`,usageLabel:`--hide-touches`,usageDescription:`Record: skip touch-overlay post-processing for faster raw benchmark videos`,projectConfig:!0,recorded:!0},{key:`recordingScope`,names:[`--scope`],type:`enum`,enumValues:ce,usageLabel:`--scope <app|device|system>`,usageDescription:`Record: app requires an active app session; device/system records the whole screen`,projectConfig:!0,recorded:!1},{key:`intervalMs`,names:[`--interval-ms`],type:`int`,min:0,max:1e4,usageLabel:`--interval-ms <ms>`,usageDescription:`Delay between press iterations`,projectConfig:!0,recorded:!0},{key:`delayMs`,names:[`--delay-ms`],type:`int`,min:0,max:1e4,usageLabel:`--delay-ms <ms>`,usageDescription:`Delay between typed characters`,projectConfig:!0,recorded:!0},{key:`recordAs`,names:[`--record-as`],type:`string`,usageLabel:`--record-as <VAR>`,usageDescription:"Fill: send the live text but publish ${VAR} in an armed .ad recording",projectConfig:!0,recorded:!1},{key:`textStdin`,names:[`--text-stdin`],type:`boolean`,usageLabel:`--text-stdin`,usageDescription:`Fill: read the text from stdin (max 64 KiB, one trailing newline removed) instead of argv`,projectConfig:!1,recorded:!1},{key:`durationMs`,names:[`--duration-ms`],type:`int`,min:0,max:1e4,usageLabel:`--duration-ms <ms>`,usageDescription:`Scroll: pace the gesture over this duration when supported`,projectConfig:!0,recorded:!1},{key:`holdMs`,names:[`--hold-ms`],type:`int`,min:0,max:1e4,usageLabel:`--hold-ms <ms>`,usageDescription:`Press or gesture tap hold duration for each iteration`,projectConfig:!0,recorded:!0},{key:`jitterPx`,names:[`--jitter-px`],type:`int`,min:0,max:100,usageLabel:`--jitter-px <n>`,usageDescription:`Deterministic per-axis coordinate jitter in pixels`,projectConfig:!0,recorded:!0},{key:`pixels`,names:[`--pixels`],type:`int`,min:1,max:1e5,usageLabel:`--pixels <n>`,usageDescription:`Scroll: explicit gesture distance in pixels`,projectConfig:!0,recorded:!1},{key:`until`,names:[`--until`],type:`string`,usageLabel:`--until <selector>`,usageDescription:`Scroll: repeat passes until the selector is visible on screen`,projectConfig:!0,recorded:!0},{key:`maxPasses`,names:[`--max-passes`],type:`int`,min:1,max:200,usageLabel:`--max-passes <n>`,usageDescription:`Scroll --until: maximum gestures`,projectConfig:!1,recorded:!0},{key:`doubleTap`,names:[`--double-tap`],type:`boolean`,usageLabel:`--double-tap`,usageDescription:`Use double-tap gesture per press iteration`,projectConfig:!0,recorded:!0},{key:`verify`,names:[`--verify`],type:`boolean`,usageLabel:`--verify`,usageDescription:`Capture cheap post-action evidence (AX digest, node counts, changedFromBefore) instead of a follow-up snapshot`,projectConfig:!0,recorded:!1},{key:`settle`,names:[`--settle`],type:`boolean`,usageLabel:`--settle`,usageDescription:`After the action, wait for the UI to go quiet and return the settled diff vs the pre-action tree in the same response (best-effort; never fails the action)`,projectConfig:!0,recorded:!1},{key:`settleQuietMs`,names:[`--settle-quiet`],type:`int`,min:0,usageLabel:`--settle-quiet <ms>`,usageDescription:`Settle: quiet window the UI must hold to count as settled (default 500ms; 300ms when the settled tree comes from the iOS simulator snapshot bridge). On iOS, a broad screen replacement such as a modal dismissal is confirmed for at least 1500ms whatever window is asked for, within the --timeout settle deadline; a replacement from a screen the pre-action capture read as presenting nothing, such as a tab switch, gets no 1500ms confirmation and keeps the asked window`,projectConfig:!0,recorded:!1},{key:`clickButton`,names:[`--button`],type:`enum`,enumValues:[`primary`,`secondary`,`middle`],usageLabel:`--button primary|secondary|middle`,usageDescription:`Click: choose mouse button (middle reserved for future macOS support)`,projectConfig:!0,recorded:!0},{key:`backMode`,names:[`--in-app`],type:`enum`,enumValues:[`in-app`,`system`],setValue:`in-app`,usageLabel:`--in-app`,usageDescription:`Back: use app-provided back UI when available`,projectConfig:!0,recorded:!1},{key:`backMode`,names:[`--system`],type:`enum`,enumValues:[`in-app`,`system`],setValue:`system`,usageLabel:`--system`,usageDescription:`Back: use system back input or gesture when available`,projectConfig:!0,recorded:!1},{key:`pauseMs`,names:[`--pause-ms`],type:`int`,min:0,max:1e4,usageLabel:`--pause-ms <ms>`,usageDescription:`Delay between swipe or gesture tap iterations`,projectConfig:!0,recorded:!0},{key:`pattern`,names:[`--pattern`],type:`enum`,enumValues:[`one-way`,`ping-pong`],usageLabel:`--pattern one-way|ping-pong`,usageDescription:`Swipe repeat pattern`,projectConfig:!0,recorded:!0},{key:`verbose`,names:[`--debug`,`--verbose`,`-v`],type:`boolean`,usageLabel:`--debug, --verbose, -v`,usageDescription:`Enable debug diagnostics; test --verbose prints per-test step timings without debug logs`,projectConfig:!0,recorded:!0},{key:`cost`,names:[`--cost`],type:`boolean`,usageLabel:`--cost`,usageDescription:`Include per-command wall-clock latency (cost.wallClockMs) in the response`,projectConfig:!0,recorded:!1},{key:`responseLevel`,names:[`--level`],type:`enum`,enumValues:n,usageLabel:`--level digest|default|full`,usageDescription:`Response detail level: digest (token-cheap), default (today), or full. Default keeps the wire shape unchanged.`,projectConfig:!0,recorded:!1},{key:`json`,names:[`--json`],type:`boolean`,usageLabel:`--json`,usageDescription:`JSON output`,projectConfig:!0,recorded:!1},{key:`help`,names:[`--help`,`-h`],type:`boolean`,usageLabel:`--help, -h`,usageDescription:`Print help and exit`,projectConfig:!1,recorded:!1},{key:`version`,names:[`--version`,`-V`],type:`boolean`,usageLabel:`--version, -V`,usageDescription:`Print version and exit`,projectConfig:!1,recorded:!1},{key:`snapshotDiff`,names:[`--diff`],type:`boolean`,usageLabel:`--diff`,usageDescription:`Snapshot: show structural diff against the previous session baseline`,projectConfig:!0,recorded:!1},{key:`saveScript`,names:[`--save-script`],type:`booleanOrString`,usageLabel:`--save-script [path]`,usageDescription:`Arm evidence capture on open, publish the armed recording on close; close --save-script alone (without an armed open) is rejected — start with open --save-script, or use session save-script mid-session. Optional custom output path.`,projectConfig:!1,recorded:!0},{key:`networkInclude`,names:[`--include`],type:`enum`,enumValues:[`summary`,`headers`,`body`,`all`],usageLabel:`--include summary|headers|body|all`,usageDescription:`Network: include headers, bodies, or both in output`,projectConfig:!0,recorded:!1},{key:`shutdown`,names:[`--shutdown`],type:`boolean`,usageLabel:`--shutdown`,usageDescription:`close: shutdown associated simulator/emulator after ending session`,projectConfig:!0,recorded:!1},{key:`relaunch`,names:[`--relaunch`],type:`boolean`,usageLabel:`--relaunch`,usageDescription:`open: terminate app process before launching it`,projectConfig:!0,recorded:!0},{key:`foreground`,names:[`--foreground`],type:`boolean`,usageLabel:`--foreground`,usageDescription:`open: keep normal app/device selection and return an initial snapshot; without an app, resolve the sole running app on the sole booted iOS simulator`,inputDescription:`Include an initial interactive snapshot in a fresh open response. With no app argument, discover the sole running app on the sole booted iOS simulator; ambiguous environments fail closed.`,projectConfig:!1,recorded:!1},{key:`restart`,names:[`--restart`],type:`boolean`,usageLabel:`--restart`,usageDescription:`logs clear: stop active stream, clear logs, then start streaming again`,projectConfig:!0,recorded:!1},{key:`retainPaths`,names:[`--retain-paths`],type:`boolean`,usageLabel:`--retain-paths`,usageDescription:`install-from-source: keep materialized artifact paths after install`,projectConfig:!0,recorded:!1},{key:`retentionMs`,names:[`--retention-ms`],type:`int`,min:1,usageLabel:`--retention-ms <ms>`,usageDescription:`install-from-source: retention TTL for materialized artifact paths`,projectConfig:!0,recorded:!1},{key:`noRecord`,names:[`--no-record`],type:`boolean`,usageLabel:`--no-record`,usageDescription:`Do not record this action`,projectConfig:!0,recorded:!0},{key:`record`,names:[`--record`],type:`boolean`,usageLabel:`--record`,usageHidden:!0,usageDescription:`Force-record this action into a repair-armed heal; per-invocation only, the retired config key "record" no longer opts in (mutually exclusive with --no-record)`,projectConfig:!1,recorded:!0}],On=[{key:`config`,names:[`--config`],type:`string`,usageLabel:`--config <path>`,usageDescription:`Load CLI defaults from a specific config file (required for connection/provider defaults outside user config)`,projectConfig:!1,recorded:!1},{key:`remoteConfig`,names:[`--remote-config`],type:`string`,usageLabel:`--remote-config <path>`,usageDescription:`Load remote host + Metro workflow settings from a specific profile file`,projectConfig:!1,recorded:!1},{key:`stateDir`,names:[`--state-dir`],type:`string`,usageLabel:`--state-dir <path>`,usageDescription:`Daemon state directory (defaults to ~/.agent-device for packages, or a worktree-scoped dev dir from source)`,projectConfig:!1,recorded:!1},{key:`daemonBaseUrl`,names:[`--daemon-base-url`],type:`string`,usageLabel:`--daemon-base-url <url>`,usageDescription:`Explicit remote HTTP daemon base URL (skip local daemon discovery/startup)`,projectConfig:!1,recorded:!1},{key:`daemonAuthToken`,names:[`--daemon-auth-token`],type:`string`,usageLabel:`--daemon-auth-token <token>`,usageDescription:`Remote HTTP daemon or proxy auth token (sent as request token and bearer header)`,projectConfig:!1,recorded:!1},{key:`daemonTransport`,names:[`--daemon-transport`],type:`enum`,enumValues:[`auto`,`socket`,`http`],usageLabel:`--daemon-transport auto|socket|http`,usageDescription:`Daemon client transport preference`,projectConfig:!1,recorded:!1},{key:`daemonServerMode`,names:[`--daemon-server-mode`],type:`enum`,enumValues:[`socket`,`http`,`dual`],usageLabel:`--daemon-server-mode socket|http|dual`,usageDescription:`Daemon server mode used when spawning daemon`,projectConfig:!1,recorded:!1},{key:`proxyHost`,names:[`--host`],type:`string`,usageLabel:`--host <host>`,usageDescription:`Proxy: host interface to bind (default: 127.0.0.1)`,projectConfig:!1,recorded:!1},{key:`proxyPort`,names:[`--port`],type:`int`,min:1,max:65535,usageLabel:`--port <port>`,usageDescription:`Proxy: TCP port to bind (default: 0, choose a free port)`,projectConfig:!1,recorded:!1},{key:`tenant`,names:[`--tenant`],type:`string`,usageLabel:`--tenant <id>`,usageDescription:`Tenant scope identifier for isolated daemon sessions`,projectConfig:!1,recorded:!1},{key:`sessionIsolation`,names:[`--session-isolation`],type:`enum`,enumValues:[`none`,`tenant`],usageLabel:`--session-isolation none|tenant`,usageDescription:`Session isolation strategy (tenant prefixes session namespace)`,projectConfig:!1,recorded:!1},{key:`runId`,names:[`--run-id`],type:`string`,usageLabel:`--run-id <id>`,usageDescription:`Run identifier used for tenant lease admission checks`,projectConfig:!1,recorded:!1},{key:`leaseId`,names:[`--lease-id`],type:`string`,usageLabel:`--lease-id <id>`,usageDescription:`Lease identifier bound to tenant/run admission scope`,projectConfig:!1,recorded:!1},{key:`leaseBackend`,names:[`--lease-backend`],type:`enum`,enumValues:r,usageLabel:`--lease-backend ${r.join(`|`)}`,usageDescription:`Lease backend for remote tenant connection admission`,projectConfig:!1,recorded:!1},{key:`provider`,names:[`--provider`],type:`string`,usageLabel:`--provider <name>`,usageDescription:`Cloud provider name for provider-scoped commands`,projectConfig:!1,recorded:!1},{key:`providerSessionId`,names:[`--provider-session`],type:`string`,usageLabel:`--provider-session <id>`,usageDescription:`Cloud provider session id or ARN`,projectConfig:!1,recorded:!1},{key:`providerApp`,names:[`--provider-app`],type:`string`,usageLabel:`--provider-app <ref-or-path>`,usageDescription:`Cloud provider app reference or local app path used when creating hosted WebDriver sessions`,projectConfig:!1,recorded:!1},{key:`providerOsVersion`,names:[`--provider-os-version`,`--os-version`],type:`string`,usageLabel:`--provider-os-version <version>`,usageDescription:`Hosted cloud provider OS version, for example 17 or 14.0`,projectConfig:!1,recorded:!1},{key:`providerDeviceType`,names:[`--provider-device-type`],type:`enum`,enumValues:ue,usageLabel:`--provider-device-type real|virtual`,usageDescription:`TestMu AI device pool: real devices or virtual devices (emulators and simulators). Defaults to virtual`,projectConfig:!1,recorded:!1},{key:`providerProject`,names:[`--provider-project`],type:`string`,usageLabel:`--provider-project <name>`,usageDescription:`Hosted cloud provider project label`,projectConfig:!1,recorded:!1},{key:`providerBuild`,names:[`--provider-build`],type:`string`,usageLabel:`--provider-build <name>`,usageDescription:`Hosted cloud provider build label`,projectConfig:!1,recorded:!1},{key:`providerSessionName`,names:[`--provider-session-name`],type:`string`,usageLabel:`--provider-session-name <name>`,usageDescription:`Hosted cloud provider session label`,projectConfig:!1,recorded:!1},{key:`providerDeviceOrientation`,names:[`--provider-device-orientation`,`--device-orientation`],type:`enum`,enumValues:le,usageLabel:`--provider-device-orientation portrait|landscape`,usageDescription:`Screen orientation a hosted cloud provider session starts in. Set this rather than rotating after launch: a session that boots landscape renders login webviews landscape`,projectConfig:!1,recorded:!1},{key:`providerGeoLocation`,names:[`--provider-geo-location`,`--geo-location`],type:`string`,usageLabel:`--provider-geo-location <country>`,usageDescription:`Hosted cloud provider IP geolocation country code, for example US`,projectConfig:!1,recorded:!1},{key:`providerTimezone`,names:[`--provider-timezone`,`--timezone`],type:`string`,usageLabel:`--provider-timezone <zone>`,usageDescription:`Hosted cloud provider device time zone, for example New_York`,projectConfig:!1,recorded:!1},{key:`providerAppiumVersion`,names:[`--provider-appium-version`,`--appium-version`],type:`string`,usageLabel:`--provider-appium-version <version>`,usageDescription:`Hosted cloud provider Appium server version, for example 3.2.0. Without it each provider starts its own default (Appium 1.x on BrowserStack)`,projectConfig:!1,recorded:!1},{key:`providerLanguage`,names:[`--provider-language`,`--language`],type:`string`,usageLabel:`--provider-language <language>`,usageDescription:`Hosted cloud provider app language, for example Fr`,projectConfig:!1,recorded:!1},{key:`providerLocale`,names:[`--provider-locale`,`--locale`],type:`string`,usageLabel:`--provider-locale <locale>`,usageDescription:`Hosted cloud provider device locale, for example Fr`,projectConfig:!1,recorded:!1},{key:`providerNetworkProfile`,names:[`--provider-network-profile`,`--network-profile`],type:`string`,usageLabel:`--provider-network-profile <profile>`,usageDescription:`Hosted cloud provider named network condition profile, for example 4g-lte-advanced-good. Mutually exclusive with --provider-custom-network`,projectConfig:!1,recorded:!1},{key:`providerCustomNetwork`,names:[`--provider-custom-network`,`--custom-network`],type:`string`,usageLabel:`--provider-custom-network <shape>`,usageDescription:`Hosted cloud provider custom network shape. Mutually exclusive with --provider-network-profile`,projectConfig:!1,recorded:!1},{key:`providerNoResignApp`,names:[`--provider-no-resign-app`],type:`boolean`,usageLabel:`--provider-no-resign-app`,usageDescription:`iOS only: keep an Enterprise-signed app as uploaded instead of letting the provider re-sign it, which strips entitlements such as push notifications`,projectConfig:!1,recorded:!1},{key:`providerNetworkLogs`,names:[`--provider-network-logs`],type:`boolean`,usageLabel:`--provider-network-logs`,usageDescription:`Limrun: capture session network traffic into a live HAR file on the daemon host; artifacts and close print its path and any tunnel failures. Pass --provider-network-hosts with your app API hosts. Captured traffic exits through the daemon host, the HAR holds raw headers and bodies, certificate-pinned hosts fail, and DNS-over-HTTPS bypasses the capture`,projectConfig:!1,recorded:!1},{key:`providerNetworkHosts`,names:[`--provider-network-hosts`],type:`string`,usageLabel:`--provider-network-hosts <list>`,usageDescription:`With --provider-network-logs: comma-separated hosts to capture, such as your app API hosts (exact hosts, wildcards like *.example.com, or localhost:<port> routes). Replaces the noisy default of common public domains plus localhost:8081`,projectConfig:!1,recorded:!1},{key:`awsProjectArn`,names:[`--aws-project-arn`],type:`string`,usageLabel:`--aws-project-arn <arn>`,usageDescription:`AWS Device Farm project ARN for hosted WebDriver sessions`,projectConfig:!1,recorded:!1},{key:`awsDeviceArn`,names:[`--aws-device-arn`],type:`string`,usageLabel:`--aws-device-arn <arn>`,usageDescription:`AWS Device Farm device ARN for hosted WebDriver sessions`,projectConfig:!1,recorded:!1},{key:`awsAppArn`,names:[`--aws-app-arn`],type:`string`,usageLabel:`--aws-app-arn <arn>`,usageDescription:`AWS Device Farm app ARN attached to hosted remote access sessions`,projectConfig:!1,recorded:!1},{key:`awsRegion`,names:[`--aws-region`],type:`string`,usageLabel:`--aws-region <region>`,usageDescription:`AWS region for Device Farm API calls`,projectConfig:!1,recorded:!1},{key:`awsInteractionMode`,names:[`--aws-interaction-mode`],type:`enum`,enumValues:[`INTERACTIVE`,`NO_VIDEO`,`VIDEO_ONLY`],usageLabel:`--aws-interaction-mode INTERACTIVE|NO_VIDEO|VIDEO_ONLY`,usageDescription:`AWS Device Farm remote access interaction mode`,projectConfig:!1,recorded:!1},{key:`force`,names:[`--force`,`--overwrite`],type:`boolean`,usageLabel:`--force, --overwrite`,usageDescription:`Force replacement of existing state (connect: replace an active connection; --save-script: overwrite an existing target instead of refusing)`,projectConfig:!0,recorded:!0},{key:`clean`,names:[`--clean`],type:`boolean`,usageLabel:`--clean`,usageDescription:`Daemon stop: remove retained runner processes and leases after stopping`,projectConfig:!0,recorded:!1},{key:`noLogin`,names:[`--no-login`],type:`boolean`,usageLabel:`--no-login`,usageDescription:`Connect: fail instead of starting implicit cloud login`,projectConfig:!0,recorded:!1},{key:`sessionLock`,names:[`--session-lock`],type:`enum`,enumValues:[`reject`,`strip`],usageLabel:`--session-lock reject|strip`,usageDescription:`Lock bound-session device routing for this CLI invocation and nested batch steps; strip drops conflicting platform/scope selectors only, and a selector naming a different device always fails`,projectConfig:!0,recorded:!1}],kn=[{key:`platform`,names:[`--platform`],type:`enum`,enumValues:g,usageLabel:`--platform ${g.join(`|`)}`,usageDescription:"Platform to target (`apple` aliases the Apple automation backend)",projectConfig:!0,recorded:!0},{key:`target`,names:[`--target`],type:`enum`,enumValues:[`mobile`,`tv`,`desktop`],usageLabel:`--target mobile|tv|desktop`,usageDescription:`Device target class to match`,projectConfig:!0,recorded:!1},{key:`device`,names:[`--device`],type:`string`,usageLabel:`--device <name>`,usageDescription:`Device name to target (a UDID belongs in --udid, a serial in --serial)`,projectConfig:!0,recorded:!0},{key:`udid`,names:[`--udid`],type:`string`,usageLabel:`--udid <udid>`,usageDescription:`Apple device or simulator UDID; the only selector that pins one device when several share a --device name`,projectConfig:!0,recorded:!0},{key:`serial`,names:[`--serial`],type:`string`,usageLabel:`--serial <serial>`,usageDescription:`Android, HarmonyOS, or Vega VVD serial`,projectConfig:!0,recorded:!0},{key:`osVersion`,names:[`--os`],type:`string`,usageLabel:`--os <version|range>`,usageDescription:`Proxy lease: OS version or range the backend picks the device by (Android: API level); refused without such a backend`,inputDescription:`OS version or range for the device a proxy backend leases, for example 18.6.2 or ">=26" (Android: API level), sent as given. A blank string names nothing; a non-string fails with INVALID_ARGS, reason device-spec-invalid. Only the CLI allocating a lease through connect proxy sends it to that backend; a daemon refuses every other request that names it, with reason device-spec-unsupported.`,projectConfig:!1,recorded:!1},{key:`imageTag`,names:[`--image-tag`],type:`string`,usageLabel:`--image-tag <tag>`,usageDescription:`Proxy lease: Android system image tag the backend picks the device by; refused without such a backend`,inputDescription:`Android system image tag for the device a proxy backend leases, for example google_apis_playstore, sent as given. A blank string names nothing; a non-string fails with INVALID_ARGS, reason device-spec-invalid. Only the CLI allocating a lease through connect proxy sends it to that backend; a daemon refuses every other request that names it, with reason device-spec-unsupported.`,projectConfig:!1,recorded:!1},{key:`physical`,names:[`--physical`],type:`boolean`,usageLabel:`--physical`,usageDescription:`Proxy lease: ask the backend for a physical device instead of a simulator or emulator; refused without such a backend`,inputDescription:`Ask a proxy backend to lease a physical device instead of a simulator or emulator. false names nothing; a non-boolean fails with INVALID_ARGS, reason device-spec-invalid. Only the CLI allocating a lease through connect proxy sends true to that backend; a daemon refuses every other request that names it, with reason device-spec-unsupported.`,projectConfig:!1,recorded:!1},{key:`stale`,names:[`--stale`],type:`boolean`,usageLabel:`--stale`,usageDescription:`Device status: show only claims with a provably stale owner`,projectConfig:!0,recorded:!1},{key:`surface`,names:[`--surface`],type:`enum`,enumValues:de,usageLabel:`--surface app|frontmost-app|desktop|menubar`,usageDescription:`macOS session surface for open (defaults to app)`,projectConfig:!0,recorded:!0},{key:`headless`,names:[`--headless`],type:`boolean`,usageLabel:`--headless`,usageDescription:`Boot: launch Android emulator without a GUI window`,projectConfig:!0,recorded:!1},{key:`pick`,names:[`--pick`],type:`enum`,enumValues:_,usageLabel:`--pick ${_.join(`|`)}`,usageDescription:`Boot: when several equally preferred matches are all shut down, boot one (mobile over TV, newest OS, then name) instead of failing; booted ties still fail`,projectConfig:!1,recorded:!1},{key:`targetApp`,names:[`--app`,`--target-app`],type:`string`,usageLabel:`--app <id-or-name>`,usageDescription:`Target an app without opening it: doctor verifies an installed app by id or name; settings applies an app-scoped change (permission, iOS location) to a bundle id or package`,projectConfig:!1,recorded:!1},{key:`metroHost`,names:[`--metro-host`],type:`string`,usageLabel:`--metro-host <host>`,usageDescription:`Session-scoped Metro/debug host hint`,projectConfig:!1,recorded:!0},{key:`metroPort`,names:[`--metro-port`],type:`int`,min:1,max:65535,usageLabel:`--metro-port <port>`,usageDescription:`Session-scoped Metro/debug port hint; on an emulator/simulator the host defaults to the loopback alias, physical devices still need --metro-host`,projectConfig:!1,recorded:!0},{key:`metroProjectRoot`,names:[`--project-root`],type:`string`,usageLabel:`--project-root <path>`,usageDescription:`metro prepare: React Native project root (default: cwd)`,projectConfig:!1,recorded:!1},{key:`kind`,names:[`--kind`],type:`enum`,enumValues:[`auto`,`react-native`,`expo`,`repack`,...fe],usageLabel:`--kind <kind>`,usageDescription:`Kind selector for commands that support it, such as metro prepare or perf artifact collectors`,projectConfig:!0,recorded:!1},{key:`perfTemplate`,names:[`--template`],type:`string`,usageLabel:`--template <name>`,usageDescription:`Perf xctrace template name, for example Time Profiler`,projectConfig:!0,recorded:!1},{key:`metroKind`,names:[`--metro-kind`],type:`enum`,enumValues:[`auto`,`react-native`,`expo`,`repack`],usageLabel:`--metro-kind auto|react-native|expo|repack`,usageDescription:`metro prepare: detect or force the React Native dev-server launcher kind`,projectConfig:!1,recorded:!1},{key:`metroPublicBaseUrl`,names:[`--public-base-url`],type:`string`,usageLabel:`--public-base-url <url>`,usageDescription:`metro prepare: public base URL used for direct dev-server bundle hints`,projectConfig:!1,recorded:!1},{key:`metroProxyBaseUrl`,names:[`--proxy-base-url`],type:`string`,usageLabel:`--proxy-base-url <url>`,usageDescription:`metro prepare: optional bridge origin for remote dev-server access`,projectConfig:!1,recorded:!1},{key:`metroBearerToken`,names:[`--bearer-token`],type:`string`,usageLabel:`--bearer-token <token>`,usageDescription:`metro prepare: host bridge bearer token (or AGENT_DEVICE_METRO_BEARER_TOKEN; falls back to AGENT_DEVICE_DAEMON_AUTH_TOKEN)`,projectConfig:!1,recorded:!1},{key:`metroPreparePort`,names:[`--port`],type:`int`,min:1,max:65535,usageLabel:`--port <port>`,usageDescription:`metro prepare: local dev-server port (default: 8081)`,projectConfig:!1,recorded:!1},{key:`metroListenHost`,names:[`--listen-host`],type:`string`,usageLabel:`--listen-host <host>`,usageDescription:`metro prepare: host dev server listens on (default: 0.0.0.0)`,projectConfig:!1,recorded:!1},{key:`metroStatusHost`,names:[`--status-host`],type:`string`,usageLabel:`--status-host <host>`,usageDescription:`metro prepare: host used for local dev-server /status polling (default: 127.0.0.1)`,projectConfig:!1,recorded:!1},{key:`metroStartupTimeoutMs`,names:[`--startup-timeout-ms`],type:`int`,min:1,usageLabel:`--startup-timeout-ms <ms>`,usageDescription:`metro prepare: timeout while waiting for the dev server to become ready`,projectConfig:!1,recorded:!1},{key:`metroProbeTimeoutMs`,names:[`--probe-timeout-ms`],type:`int`,min:1,usageLabel:`--probe-timeout-ms <ms>`,usageDescription:`metro prepare: timeout for /status and proxy bridge calls`,projectConfig:!1,recorded:!1},{key:`metroRuntimeFile`,names:[`--runtime-file`],type:`string`,usageLabel:`--runtime-file <path>`,usageDescription:`metro prepare: optional file path to persist the JSON result`,projectConfig:!1,recorded:!1},{key:`metroNoReuseExisting`,names:[`--no-reuse-existing`],type:`boolean`,usageLabel:`--no-reuse-existing`,usageDescription:`metro prepare: always start a fresh Metro process`,projectConfig:!1,recorded:!1},{key:`metroNoInstallDeps`,names:[`--no-install-deps`],type:`boolean`,usageLabel:`--no-install-deps`,usageDescription:`metro prepare: skip package-manager install when node_modules is missing`,projectConfig:!1,recorded:!1},{key:`bundleUrl`,names:[`--bundle-url`],type:`string`,usageLabel:`--bundle-url <url>`,usageDescription:`Session-scoped bundle URL hint`,projectConfig:!1,recorded:!0},{key:`launchUrl`,names:[`--launch-url`],type:`string`,usageLabel:`--launch-url <url>`,usageDescription:`Session-scoped deep link / launch URL hint`,projectConfig:!0,recorded:!0},{key:`iosSimulatorDeviceSet`,names:[`--ios-simulator-device-set`],type:`string`,usageLabel:`--ios-simulator-device-set <path>`,usageDescription:`Scope iOS simulator discovery/commands to this simulator device set`,projectConfig:!1,recorded:!1},{key:`iosXctestrunFile`,names:[`--ios-xctestrun-file`],type:`string`,usageLabel:`--ios-xctestrun-file <path>`,usageDescription:`Use an externally built iOS XCTest runner .xctestrun artifact`,projectConfig:!1,recorded:!1},{key:`iosXctestDerivedDataPath`,names:[`--ios-xctest-derived-data-path`],type:`string`,usageLabel:`--ios-xctest-derived-data-path <path>`,usageDescription:`Derived data path for external iOS XCTest runner execution`,projectConfig:!1,recorded:!1},{key:`iosXctestEnvDir`,names:[`--ios-xctest-env-dir`],type:`string`,usageLabel:`--ios-xctest-env-dir <path>`,usageDescription:`Writable directory for per-session iOS XCTest runner env overlays`,projectConfig:!1,recorded:!1},{key:`testIme`,names:[`--test-ime`],type:`boolean`,usageLabel:`--test-ime`,usageDescription:`open/test/replay: activate the headless Android test IME for deterministic Unicode text entry (default on for emulators; opt-in on real devices; on test/replay it applies to the sessions the flow opens)`,projectConfig:!0,recorded:!1},{key:`testIme`,names:[`--no-test-ime`],type:`boolean`,setValue:!1,usageLabel:`--no-test-ime`,usageDescription:`open/test/replay: keep the real Android keyboard even on emulators (opt out of the headless test IME; on test/replay it applies to the sessions the flow opens)`,projectConfig:!0,recorded:!1},{key:`androidDeviceAllowlist`,names:[`--android-device-allowlist`],type:`string`,usageLabel:`--android-device-allowlist <serials>`,usageDescription:`Comma/space separated Android serial allowlist for discovery/selection`,projectConfig:!1,recorded:!1},{key:`remote`,names:[`--remote`],type:`boolean`,usageLabel:`--remote`,usageDescription:`Doctor: check remote connection setup instead of local device inventory`,projectConfig:!0,recorded:!1},{key:`activity`,names:[`--activity`],type:`string`,usageLabel:`--activity <component>`,usageDescription:`Android launch activity (package/Class, .Class, or Class) or HarmonyOS ability name; not for URL opens`,projectConfig:!0,recorded:!1},{key:`launchConsole`,names:[`--launch-console`],type:`string`,usageLabel:`--launch-console <path>`,usageDescription:`open: capture the initial local iOS simulator launch console window to a file`,projectConfig:!1,recorded:!1},{key:`launchArgs`,names:[`--launch-args`],type:`string`,multiple:!0,usageLabel:`--launch-args <arg>`,usageDescription:`open: repeatable launch argument forwarded verbatim to the platform launch command (iOS app process args; Android adb shell am start args). Linux and macOS reject the flag.`,projectConfig:!0,recorded:!1},{key:`header`,names:[`--header`],type:`string`,multiple:!0,usageLabel:`--header <name:value>`,usageDescription:`install-from-source: repeatable HTTP header for URL downloads`,projectConfig:!1,recorded:!1},{key:`githubActionsArtifact`,names:[`--github-actions-artifact`],type:`string`,usageLabel:`--github-actions-artifact <owner/repo:artifact>`,usageDescription:`install-from-source: GitHub Actions artifact resolved by a remote daemon`,projectConfig:!1,recorded:!1},{key:`installSource`,names:[],type:`string`,projectConfig:!1,recorded:!1},{key:`session`,names:[`--session`],type:`string`,usageLabel:`--session <name>`,usageDescription:`Named session (implicit default is scoped to this workspace + platform)`,projectConfig:!0,recorded:!1}],An=[{key:`replayUpdate`,names:[`--update`,`-u`],type:`boolean`,usageLabel:`--update, -u`,usageDescription:`Replay: retired as a rewrite (ADR 0012) — never edits the .ad file; every divergence already carries ranked selector suggestions, --update or not`,projectConfig:!0,recorded:!1},{key:`replayFrom`,names:[`--from`],type:`int`,min:1,usageLabel:`--from <n>`,usageDescription:`Replay: resume at 1-based plan step n, skipping 1..n-1 without executing them (requires --plan-digest; see a divergence report's resume field). replay only, not test`,projectConfig:!0,recorded:!1},{key:`replayPlanDigest`,names:[`--plan-digest`],type:`string`,usageLabel:`--plan-digest <sha256>`,usageDescription:`Replay: the plan digest a --from resume must match (from a prior divergence report); mismatch, edits, or include/platform-expansion changes fail INVALID_ARGS before any action`,projectConfig:!0,recorded:!1},{key:`replayKeepSession`,names:[`--keep-session`],type:`boolean`,usageLabel:`--keep-session`,usageDescription:`Replay: leave the session active by suppressing exactly an authored terminal close in a native .ad script; replay only, not test or Maestro YAML`,projectConfig:!0,recorded:!1},{key:`replayMaestro`,names:[`--maestro`],type:`boolean`,usageLabel:`--maestro`,usageDescription:`Replay: treat input as a supported Maestro YAML subset; unsupported syntax fails loudly. See agent-device help maestro for commands and boundaries`,projectConfig:!0,recorded:!1},{key:`replayEnv`,names:[`-e`,`--env`],type:`string`,multiple:!0,usageLabel:`-e KEY=VALUE, --env KEY=VALUE`,usageDescription:"Replay/Test: inject or override a ${KEY} variable for the script (repeatable)",projectConfig:!1,recorded:!1},{key:`failFast`,names:[`--fail-fast`],type:`boolean`,usageLabel:`--fail-fast`,usageDescription:`Test: stop the suite after the first failing script; with sharding, each shard stops independently`,projectConfig:!0,recorded:!1},{key:`timeoutMs`,names:[`--timeout`],type:`int`,min:1,usageLabel:`--timeout <ms>`,usageDescription:`Boot/Open/Prepare: startup budget covering the device boot (and runner preparation for prepare). Replay/Snapshot/Test: maximum wall-clock time for the command or attempt. With --settle: the settle-wait deadline (default 10s)`,projectConfig:!0,recorded:!1},{key:`waitMs`,names:[`--wait`],type:`int`,min:100,max:12e4,usageLabel:`--wait <ms>`,usageDescription:`Open: wait up to n ms for a device another session is holding before failing with DEVICE_IN_USE`,inputDescription:`Block this open for up to n milliseconds (100-120000) while another session holds the device, then fail with DEVICE_IN_USE naming that session. Only session contention is waited for: a device claim held by another workspace is refused at once with its recovery command. A device that never frees, or is taken again while this open waits, costs the full budget, which extends this command's timeout envelope rather than eating into it.`,projectConfig:!1,recorded:!1},{key:`retries`,names:[`--retries`],type:`int`,min:0,max:3,usageLabel:`--retries <n>`,usageDescription:`Test: retry each failed script up to n additional times`,projectConfig:!0,recorded:!1},{key:`recordVideo`,names:[`--record-video`],type:`boolean`,usageLabel:`--record-video`,usageDescription:`Test: record each replay attempt to recording.mp4 in its attempt artifacts`,projectConfig:!0,recorded:!1},{key:`artifactsDir`,names:[`--artifacts-dir`],type:`string`,usageLabel:`--artifacts-dir <path>`,usageDescription:`Test: root directory for suite artifacts`,projectConfig:!1,recorded:!1},{key:`reporter`,names:[`--reporter`],type:`string`,multiple:!0,usageLabel:`--reporter <name-or-path>`,usageDescription:`Test: add a replay suite reporter; use default, junit:<path>, or a custom reporter path (repeatable)`,projectConfig:!1,recorded:!1},{key:`reportJunit`,names:[`--report-junit`],type:`string`,usageLabel:`--report-junit <path>`,usageDescription:`Test: compatibility alias for --reporter junit:<path>`,projectConfig:!1,recorded:!1},{key:`shardAll`,names:[`--shard-all`],type:`int`,min:1,usageLabel:`--shard-all <n>`,usageDescription:`Test: run the full suite on each of n devices; combine with --device id1,id2 for explicit connected devices; AD_SHARD_INDEX is zero-based`,projectConfig:!0,recorded:!1},{key:`shardSplit`,names:[`--shard-split`],type:`int`,min:1,usageLabel:`--shard-split <n>`,usageDescription:`Test: split runnable suite entries across n devices; AD_SHARD_INDEX is zero-based`,projectConfig:!0,recorded:!1},{key:`steps`,names:[`--steps`],type:`string`,usageLabel:`--steps <json>`,usageDescription:`Batch: JSON array of {"command","input"} steps`,projectConfig:!1,recorded:!1},{key:`stepsFile`,names:[`--steps-file`],type:`string`,usageLabel:`--steps-file <path>`,usageDescription:`Batch: read steps JSON from file`,projectConfig:!1,recorded:!1},{key:`batchOnError`,names:[`--on-error`],type:`enum`,enumValues:[`stop`],usageLabel:`--on-error stop`,usageDescription:`Batch: stop when a step fails`,projectConfig:!0,recorded:!1},{key:`batchMaxSteps`,names:[`--max-steps`],type:`int`,min:1,max:1e3,usageLabel:`--max-steps <n>`,usageDescription:`Batch: maximum number of allowed steps`,projectConfig:!0,recorded:!1},{key:`appsFilter`,names:[`--all`],type:`enum`,enumValues:[`user-installed`,`all`],setValue:`all`,usageLabel:`--all`,usageDescription:`Apps: include system/OEM apps`,projectConfig:!0,recorded:!1},{key:`snapshotInteractiveOnly`,names:[`-i`],type:`boolean`,usageLabel:`-i`,usageDescription:`Snapshot: interactive elements only`,projectConfig:!0,recorded:!0},{key:`snapshotDepth`,names:[`--depth`,`-d`],type:`int`,min:0,usageLabel:`--depth, -d <depth>`,usageDescription:`Snapshot: limit snapshot depth`,projectConfig:!0,recorded:!0},{key:`snapshotScope`,names:[`--scope`,`-s`],type:`string`,usageLabel:`--scope, -s <scope>`,usageDescription:`Snapshot: scope snapshot to label/identifier`,projectConfig:!0,recorded:!0},{key:`snapshotRaw`,names:[`--raw`],type:`boolean`,usageLabel:`--raw`,usageDescription:`Snapshot: raw node output`,projectConfig:!0,recorded:!0},{key:`snapshotCustomActions`,names:[`--actions`],type:`boolean`,usageLabel:`--actions`,usageDescription:`Snapshot: name the affordances merged inside an element (iOS sim); not directly invokable — reach them via the detail screen, labeled children, or coordinates`,inputDescription:`Name the affordances an element merged away (iOS UIAccessibilityCustomAction, React Native accessibilityActions) — a card whose reply/options controls are not separate elements still lists them here. The names are for PLANNING, not invocation: there is no API to trigger them, so reach the affordance through the element detail screen, through the same control exposed as a labeled element elsewhere, or by coordinates from its rect. iOS simulator only; costs one accessibility round trip per merged element.`,projectConfig:!0,recorded:!0},{key:`snapshotObserveOnly`,names:[`--observe-only`],type:`boolean`,usageLabel:`--observe-only`,usageDescription:`Snapshot: observe the iOS session app without activation or foreground repair`,inputDescription:`iOS only. Refuse instead of activating or repairing the session app. Reports XCUIApplication state, which does not prove screen ownership (#2696).`,projectConfig:!1,recorded:!1},{key:`snapshotForceFull`,names:[`--force-full`],type:`boolean`,usageLabel:`--force-full`,usageDescription:`Snapshot: re-emit the full tree even when unchanged`,projectConfig:!0,recorded:!1},{key:`findFirst`,names:[`--first`],type:`boolean`,usageLabel:`--first`,usageDescription:`Find: pick the first match when ambiguous`,projectConfig:!0,recorded:!1},{key:`findLast`,names:[`--last`],type:`boolean`,usageLabel:`--last`,usageDescription:`Find: pick the last match when ambiguous`,projectConfig:!0,recorded:!1},{key:`out`,names:[`--out`],type:`string`,usageLabel:`--out <path>`,usageDescription:`Output path`,projectConfig:!1,recorded:!0},{key:`artifact`,names:[`--artifact`],type:`string`,usageLabel:`--artifact <path>`,usageDescription:`Debug symbols: Apple crash artifact path (.ips, .crash, or .log)`,projectConfig:!1,recorded:!1},{key:`dsym`,names:[`--dsym`],type:`string`,usageLabel:`--dsym <path>`,usageDescription:`Debug symbols: matching .dSYM bundle path`,projectConfig:!1,recorded:!1},{key:`searchPath`,names:[`--search-path`],type:`string`,usageLabel:`--search-path <dir>`,usageDescription:`Debug symbols: directory to scan for matching .dSYM bundles`,projectConfig:!1,recorded:!1},{key:`overlayRefs`,names:[`--overlay-refs`],type:`boolean`,usageLabel:`--overlay-refs`,usageDescription:`Screenshot: draw current snapshot refs and target rectangles onto the saved PNG; diff screenshot: also write a separate current-screen overlay guide`,projectConfig:!0,recorded:!1},...ee,{key:`baseline`,names:[`--baseline`,`-b`],type:`string`,usageLabel:`--baseline, -b <path>`,usageDescription:`Diff screenshot: path to baseline image file`,projectConfig:!0,recorded:!1},{key:`threshold`,names:[`--threshold`],type:`string`,usageLabel:`--threshold <0-1>`,usageDescription:`Diff screenshot: color distance threshold (default 0.1)`,projectConfig:!0,recorded:!1}],Y=[...On,...kn,...Dn,...An],jn=new Map;for(let e of Y)for(let t of e.names)jn.set(t,e);function Mn(e){return jn.get(e)}function Nn(){return Y}function Pn(e){return Y.filter(t=>t.key===e)}function Fn(){return new Set(Y.filter(e=>e.projectConfig).map(e=>e.key))}function In(){return new Set(Y.filter(e=>e.recorded).map(e=>e.key))}function Ln(e){let t=X(e.label),n=X(e.value),r=X(e.identifier),i=Un(r)?r:``;return Hn(e.type??``)?n||t||i:t||n||i}function Rn(e,t){if(t===`text-view`||t===`text-field`||t===`search`)return!0;let n=v(e.type??``),r=`${e.role??``} ${e.subrole??``}`.toLowerCase();return n.includes(`textview`)||n.includes(`textarea`)||n.includes(`textfield`)||n.includes(`securetextfield`)||n.includes(`searchfield`)||n.includes(`edittext`)||r.includes(`text area`)||r.includes(`text field`)}function zn(e){let t=e.replaceAll(/\s+/g,` `).trim();return t.length<=48?t:`${t.slice(0,45)}...`}function Bn(e,t){let n=Ln(e),r=Rn(e,t);return{text:n,isLargeSurface:r,shouldSummarize:r&&Vn(n)}}function Vn(e){return e?e.length>80||/[\r\n]/.test(e):!1}function X(e){return typeof e==`string`?e.trim():``}function Hn(e){let t=v(e);return t.includes(`textfield`)||t.includes(`securetextfield`)||t.includes(`searchfield`)||t.includes(`edittext`)||t.includes(`textview`)||t.includes(`textarea`)}function Un(e){return e?!/^[\w.]+:id\/[\w.-]+$/i.test(e)&&!/^_?NS:\d+$/i.test(e):!1}function Wn(e,t={}){let n=[],r=[];for(let a of e){let e=a.depth??0,o=a.label?.trim()||a.value?.trim()||a.identifier?.trim()||``,s=i(a.type??`Element`),c=a.inheritsLabel===!0||a.inheritsIdentifier===!0;if(s===`group`&&!o&&!c)continue;for(;n.length>0&&e<=n.at(-1);)n.pop();let l=n.length;n.push(e),r.push({node:a,depth:l,type:s,text:Z(a,l,!1,s,t)})}return r}function Z(e,t,n,r,a={}){let o=r??i(e.type??`Element`),s=Bn(e,o),c=Qn(e,o,a,s),l=` `.repeat(t),u=e.ref?`@${e.ref}`:``,d=$n(e,o,a,s);!c&&(e.inheritsLabel===!0||e.inheritsIdentifier===!0)&&d.push(`same label as parent`);let f=d.map(e=>` [${e}]`).join(``),ee=c?` "${c}"`:``,p=Kn(e);return n?`${l}${u} [${o}]${f}${p}`.trimEnd():`${l}${u} [${o}]${ee}${f}${p}`.trimEnd()}function Gn(e){return{matches:e.length,candidates:e.slice(0,5).map(e=>Z(e,0,!1))}}function Kn(e){let t=e.actions?.filter(e=>e.trim().length>0);return!t||t.length===0?``:` actions: [${t.map(e=>`"${nr(qn(e))}"`).join(`, `)}]`}function qn(e){return e.replaceAll(/\s+/g,` `).replaceAll(/[\u0000-\u001f\u007f-\u009f]/g,``).trim()}function Q(e,t){let n=e.label?.trim();if(n&&Xn(t,n))return``;let r=e.value?.trim();if(Yn(t)){if(r)return r;if(n)return n}else if(n)return n;if(r)return r;let i=e.identifier?.trim();return!i||Zn(i)&&(t===`group`||t===`image`||t===`list`||t===`collection`)?``:i}function Jn(e){let t=[];return e.enabled===!1&&t.push(`disabled`),e.selected===!0&&t.push(`selected`),e.checked!==void 0&&t.push(e.checked?`checked`:`unchecked`),t}function Yn(e){return e===`text-field`||e===`text-view`||e===`search`}function Xn(e,t){return e!==`scroll-area`&&e!==`list`&&e!==`collection`&&e!==`table`?!1:s(t)}function Zn(e){return/^[\w.]+:id\/[\w.-]+$/i.test(e)}function Qn(e,t,n,r){return!n.summarizeTextSurfaces||!r.shouldSummarize?Q(e,t):er(e,t,r.text)||Q(e,t)}function $n(e,t,n,r){let i=[...Jn(e),...e.presentationHints??[]];return!n.summarizeTextSurfaces||(e.focused===!0&&i.push(`focused`),Yn(t)&&i.push(`editable`),tr(e,t)&&i.push(`scrollable`),!r.shouldSummarize)?rr(i):(i.push(`preview:"${nr(zn(r.text))}"`),i.push(`truncated`),rr(i))}function er(e,t,n){let r=X(e.label);if(r&&r!==n)return r;let i=X(e.identifier);if(i&&!Zn(i)&&i!==n)return i;switch(t){case`text`:case`text-view`:return`Text view`;case`text-field`:return`Text field`;case`search`:return`Search field`;default:return``}}function tr(e,t){if(t===`scroll-area`)return!0;let n=(e.type??``).toLowerCase(),r=`${e.role??``} ${e.subrole??``}`.toLowerCase();return n.includes(`scroll`)||r.includes(`scroll`)}function nr(e){return e.replaceAll(`\\`,String.raw`\\`).replaceAll(`"`,String.raw`\"`)}function rr(e){return[...new Set(e)]}const ir={state:`sparse`,backend:`tree`,reason:`legacy iOS capture exposed only the application root`,reasonCode:`sparse-tree`},ar={sparse:`capture was sparse`,truncated:`capture was truncated`,unsettled:`the surface was still changing after a gesture`};function or(e){return typeof e==`string`&&Object.hasOwn(ar,e)}function sr(e){if(e.scope!==void 0)return`scope`;if(e.depth!==void 0)return`depth`}function cr(e,t=`is`){let n=`${t} absent`;return e===`scope`?`${n} does not support --scope; it requires an unscoped capture`:`${n} does not support --depth; it requires a full-depth capture`}function lr(e,t){let n=t[0]?dr(t[0]):void 0,r=t.length;if(e.truncated===!0)return{kind:`truncated`,matches:r,...n?{firstMatch:n}:{}};let i=$(e);return i?{kind:`sparse`,matches:r,...n?{firstMatch:n}:{},quality:{state:i.state,backend:i.backend,...i.reason?{reason:i.reason}:{},...i.reasonCode?{reasonCode:i.reasonCode}:{}}}:r===0?{kind:e.postGestureOutcome?.kind===`unsettled`?`unsettled`:`absent`,matches:0}:{kind:`present`,matches:r,firstMatch:n}}function $(e){let t=e.snapshotQuality;return t?.state===`sparse`?{state:t.state,backend:t.backend,...t.reason?{reason:t.reason}:{},...t.reasonCode?{reasonCode:t.reasonCode}:{}}:ur(e)?ir:void 0}function ur(e){return e.snapshotQuality||e.backend!==`xctest`||e.nodes.length!==1?!1:v(e.nodes[0]?.type??``)===`application`}function dr(e){let t=ae(e),n=ne(te(e),256);return{...t,...n&&n!==t.label?{text:n}:{}}}const fr=[`primary`,`secondary`,`middle`];function pr(e){return e?.clickButton??`primary`}function mr(e){return e.button===`primary`?null:e.commandLabel===`click`?e.platform!==`macos`&&e.platform!==`linux`?new t(`UNSUPPORTED_OPERATION`,`click --button ${e.button} is supported only on macOS and Linux`):e.platform===`macos`&&e.button===`middle`?new t(`UNSUPPORTED_OPERATION`,`click --button middle is not supported by the macOS runner yet`):typeof e.count==`number`||typeof e.intervalMs==`number`||typeof e.holdMs==`number`||typeof e.jitterPx==`number`||e.doubleTap===!0?new t(`INVALID_ARGS`,`click --button ${e.button} does not support repeat or gesture modifier flags`):null:new t(`INVALID_ARGS`,`--button is supported only for click`)}function hr(e){return e===`primary`?{}:{button:e}}const gr=[`in-app`,`system`];export{Xe as $,yn as A,b as At,Ft as B,Fn as C,De as Ct,En as D,Ve as Dt,xn as E,Fe as Et,Qt as F,jt as G,Lt as H,$t as I,V as J,H as K,Ut as L,bn as M,he as Mt,vn as N,Tn as O,ke as Ot,Yt as P,tt as Q,Ht as R,Pn as S,Te as St,Sn as T,Se as Tt,Nt as U,Rt as V,It as W,z as X,wt as Y,P as Z,Jn as _,xe as _t,pr as a,lt as at,Mn as b,Ce as bt,sr as c,_e as ct,or as d,Me as dt,st as et,$ as f,Le as ft,Z as g,Ie as gt,Gn as h,Pe as ht,mr as i,ft as it,_n as j,Ae as jt,gn as k,je as kt,lr as l,Re as lt,Q as m,C as mt,fr as n,ct as nt,ar as o,E as ot,Wn as p,Be as pt,Et as q,hr as r,dt as rt,cr as s,D as st,gr as t,ot as tt,ur as u,x as ut,Ln as v,be as vt,In as w,Ee as wt,Nn as x,Ne as xt,Hn as y,we as yt,zt as z};
@@ -1 +1 @@
1
- import{R as e}from"./sdk-contracts.js";import{yt as t}from"./tv-remote.js";import{v as n}from"./sdk-batch-runner.js";import{C as r,O as i,x as a}from"./back-mode.js";import{ft as o,mt as s}from"./sdk-io.js";import{k as c,v as l}from"./command-metadata.js";import{l as u,u as d}from"./file.js";import{n as f}from"./command-schema.js";import p from"node:fs";import m from"node:path";const h=new Set([`config`,`remoteConfig`,`help`,`version`,`batchSteps`,`githubActionsArtifact`,`textStdin`]),g=new Set([`appsFilter`,`iosSimulatorDeviceSet`,`textStdin`,`osVersion`,`imageTag`,`physical`]),_=C(),v=new Map(_.map(e=>[e.key,e]));function y(e){return v.get(e)}function b(e){return _.filter(t=>t.configurable&&t.supportsCommand(e))}function x(e,t){return y(e)?.supportsCommand(t)??!1}function S(e,t,n,r){return s(E(e),t,n,r)}function C(){let e=new Map;for(let t of a()){let n=e.get(t.key);n?n.push(t):e.set(t.key,[t])}let t=new Map;for(let e of c)t.set(e,new Set([`*`]));for(let e of i()){let n=f(e);for(let r of[...n.allowedFlags??[],...n.supportedFlags??[]]){let n=t.get(r);n&&n.has(`*`)||(n?n.add(e):t.set(r,new Set([e])))}}return[...e.entries()].map(([e,n])=>({key:e,flagDefinitions:n,configurable:!h.has(e),env:{names:g.has(e)?[]:[o(e)]},supportsCommand(n){let r=t.get(e);return r?r.has(`*`)?!0:n?r.has(n):!1:!1}})).sort((e,t)=>w(e.key,t.key))}function w(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r?e<t?-1:+(e>t):n<r?-1:1}function T(e){let t=e.flagDefinitions[0];if(!t)throw Error(`Missing flag definition for option ${e.key}`);return t}function E(e){let t=e.flagDefinitions.find(e=>e.setValue===void 0);if(t)return t;let n=T(e);if(n.type===`enum`){let t=n.enumValues??e.flagDefinitions.map(e=>e.setValue).filter(e=>e!==void 0);return{...n,setValue:void 0,enumValues:t}}return n}function D(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&(e[n]=r);return e}function O(e){let t=e.env;return D(D({},M(A(e.cwd,e.cliFlags.config,t))),L(t,e.command))}const k=r();function A(e,t,n){let r=t??n.AGENT_DEVICE_CONFIG;return r?[{path:j(r,e,n),required:!0,source:`explicit`}]:[{path:u(n),required:!1,source:`user`},{path:m.resolve(e,`agent-device.json`),required:!1,source:`project`}]}function j(e,t,n){return d(e,{cwd:t,env:n})}function M(e){let t={};for(let n of e)D(t,N(n));return t}function N(t){let{path:r,required:i}=t;if(!p.existsSync(r)){if(i)throw new e(`INVALID_ARGS`,`Config file not found: ${r}`);return{}}let a;try{a=p.readFileSync(r,`utf8`)}catch(t){throw new e(`INVALID_ARGS`,`Failed to read config file: ${r}`,{cause:t instanceof Error?t.message:String(t)})}let o;try{o=JSON.parse(a)}catch(t){throw new e(`INVALID_ARGS`,`Invalid JSON in config file: ${r}`,{cause:t instanceof Error?t.message:String(t)})}if(!n(o))throw new e(`INVALID_ARGS`,`Config file must contain a JSON object: ${r}`);return F(o,{source:t.source,label:`${t.source===`project`?`project `:``}config file ${r}`})}const P={flagKey:`record`,envVar:`AGENT_DEVICE_RECORD`,migration:`--record is per-invocation only: pass --record on the command, or record: true in the SDK/MCP call, to keep a corrective read in a healed script`};function F(n,r){let i={},a=Object.entries(n).filter(([e])=>e!==`plugins`||r.source!==`user`);for(let[n,o]of a){if(n===P.flagKey)throw new e(`INVALID_ARGS`,`Config key "${n}" in ${r.label} was removed; ${P.migration}.`);let a=n,s=y(a);if(!s)throw n===t.flagKey?new e(`INVALID_ARGS`,`Config key "${n}" in ${r.label} was removed; use "screenshotScale" (0.01-1) to downscale screenshots. Recordings capture at native resolution.`):new e(`INVALID_ARGS`,`Unknown config key "${n}" in ${r.label}.`);if(!s.configurable)throw new e(`INVALID_ARGS`,`Config key "${n}" is not allowed in ${r.label}. This key is not supported in config files.`);if(r.source===`project`&&!k.has(a))throw new e(`INVALID_ARGS`,`Config key "${n}" is not allowed in ${r.label}. Move it to ~/.agent-device/config.json, pass it with --config or AGENT_DEVICE_CONFIG, or provide it through CLI flags/environment variables.`);if(a===`installSource`){i.installSource=l(o,r.label);continue}i[a]=S(s,o,r.label,n)}return i}const I=new Set([`screenshot`,`record`]);function L(n,r){if(r!==null&&y(P.flagKey)?.supportsCommand(r)===!0&&typeof n[P.envVar]==`string`&&n[P.envVar].trim().length>0)throw new e(`INVALID_ARGS`,`${P.envVar} was removed; ${P.migration}.`);let i=n[t.envVar];if(r!==null&&I.has(r)&&typeof i==`string`&&i.trim().length>0)throw new e(`INVALID_ARGS`,`${t.envVar} was removed. ${t.migration[r===`record`?`record`:`screenshot`]}`);let a={};for(let e of b(r)){if(e.key===`installSource`)continue;let t=e.env.names.map(e=>({name:e,value:n[e]})).find(e=>typeof e.value==`string`&&e.value.trim().length>0);t&&(a[e.key]=S(e,t.value,`environment variable ${t.name}`,t.name))}return a}export{D as n,x as r,O as t};
1
+ import{R as e}from"./sdk-contracts.js";import{yt as t}from"./tv-remote.js";import{y as n}from"./sdk-batch-runner.js";import{C as r,O as i,x as a}from"./back-mode.js";import{ft as o,mt as s}from"./sdk-io.js";import{k as c,v as l}from"./command-metadata.js";import{l as u,u as d}from"./file.js";import{n as f}from"./command-schema.js";import p from"node:fs";import m from"node:path";const h=new Set([`config`,`remoteConfig`,`help`,`version`,`batchSteps`,`githubActionsArtifact`,`textStdin`]),g=new Set([`appsFilter`,`iosSimulatorDeviceSet`,`textStdin`,`osVersion`,`imageTag`,`physical`]),_=C(),v=new Map(_.map(e=>[e.key,e]));function y(e){return v.get(e)}function b(e){return _.filter(t=>t.configurable&&t.supportsCommand(e))}function x(e,t){return y(e)?.supportsCommand(t)??!1}function S(e,t,n,r){return s(E(e),t,n,r)}function C(){let e=new Map;for(let t of a()){let n=e.get(t.key);n?n.push(t):e.set(t.key,[t])}let t=new Map;for(let e of c)t.set(e,new Set([`*`]));for(let e of i()){let n=f(e);for(let r of[...n.allowedFlags??[],...n.supportedFlags??[]]){let n=t.get(r);n&&n.has(`*`)||(n?n.add(e):t.set(r,new Set([e])))}}return[...e.entries()].map(([e,n])=>({key:e,flagDefinitions:n,configurable:!h.has(e),env:{names:g.has(e)?[]:[o(e)]},supportsCommand(n){let r=t.get(e);return r?r.has(`*`)?!0:n?r.has(n):!1:!1}})).sort((e,t)=>w(e.key,t.key))}function w(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r?e<t?-1:+(e>t):n<r?-1:1}function T(e){let t=e.flagDefinitions[0];if(!t)throw Error(`Missing flag definition for option ${e.key}`);return t}function E(e){let t=e.flagDefinitions.find(e=>e.setValue===void 0);if(t)return t;let n=T(e);if(n.type===`enum`){let t=n.enumValues??e.flagDefinitions.map(e=>e.setValue).filter(e=>e!==void 0);return{...n,setValue:void 0,enumValues:t}}return n}function D(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&(e[n]=r);return e}function O(e){let t=e.env;return D(D({},M(A(e.cwd,e.cliFlags.config,t))),L(t,e.command))}const k=r();function A(e,t,n){let r=t??n.AGENT_DEVICE_CONFIG;return r?[{path:j(r,e,n),required:!0,source:`explicit`}]:[{path:u(n),required:!1,source:`user`},{path:m.resolve(e,`agent-device.json`),required:!1,source:`project`}]}function j(e,t,n){return d(e,{cwd:t,env:n})}function M(e){let t={};for(let n of e)D(t,N(n));return t}function N(t){let{path:r,required:i}=t;if(!p.existsSync(r)){if(i)throw new e(`INVALID_ARGS`,`Config file not found: ${r}`);return{}}let a;try{a=p.readFileSync(r,`utf8`)}catch(t){throw new e(`INVALID_ARGS`,`Failed to read config file: ${r}`,{cause:t instanceof Error?t.message:String(t)})}let o;try{o=JSON.parse(a)}catch(t){throw new e(`INVALID_ARGS`,`Invalid JSON in config file: ${r}`,{cause:t instanceof Error?t.message:String(t)})}if(!n(o))throw new e(`INVALID_ARGS`,`Config file must contain a JSON object: ${r}`);return F(o,{source:t.source,label:`${t.source===`project`?`project `:``}config file ${r}`})}const P={flagKey:`record`,envVar:`AGENT_DEVICE_RECORD`,migration:`--record is per-invocation only: pass --record on the command, or record: true in the SDK/MCP call, to keep a corrective read in a healed script`};function F(n,r){let i={},a=Object.entries(n).filter(([e])=>e!==`plugins`||r.source!==`user`);for(let[n,o]of a){if(n===P.flagKey)throw new e(`INVALID_ARGS`,`Config key "${n}" in ${r.label} was removed; ${P.migration}.`);let a=n,s=y(a);if(!s)throw n===t.flagKey?new e(`INVALID_ARGS`,`Config key "${n}" in ${r.label} was removed; use "screenshotScale" (0.01-1) to downscale screenshots. Recordings capture at native resolution.`):new e(`INVALID_ARGS`,`Unknown config key "${n}" in ${r.label}.`);if(!s.configurable)throw new e(`INVALID_ARGS`,`Config key "${n}" is not allowed in ${r.label}. This key is not supported in config files.`);if(r.source===`project`&&!k.has(a))throw new e(`INVALID_ARGS`,`Config key "${n}" is not allowed in ${r.label}. Move it to ~/.agent-device/config.json, pass it with --config or AGENT_DEVICE_CONFIG, or provide it through CLI flags/environment variables.`);if(a===`installSource`){i.installSource=l(o,r.label);continue}i[a]=S(s,o,r.label,n)}return i}const I=new Set([`screenshot`,`record`]);function L(n,r){if(r!==null&&y(P.flagKey)?.supportsCommand(r)===!0&&typeof n[P.envVar]==`string`&&n[P.envVar].trim().length>0)throw new e(`INVALID_ARGS`,`${P.envVar} was removed; ${P.migration}.`);let i=n[t.envVar];if(r!==null&&I.has(r)&&typeof i==`string`&&i.trim().length>0)throw new e(`INVALID_ARGS`,`${t.envVar} was removed. ${t.migration[r===`record`?`record`:`screenshot`]}`);let a={};for(let e of b(r)){if(e.key===`installSource`)continue;let t=e.env.names.map(e=>({name:e,value:n[e]})).find(e=>typeof e.value==`string`&&e.value.trim().length>0);t&&(a[e.key]=S(e,t.value,`environment variable ${t.name}`,t.name))}return a}export{D as n,x as r,O as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime.js";import{O as t,x as n}from"./back-mode.js";import{Lr as r}from"./sdk-batch.js";import{H as i,O as a,f as o,k as s}from"./command-metadata.js";import{a as c}from"./version.js";import{n as l,r as u}from"./command-schema.js";import{n as d}from"./cli-command-aliases.js";import{n as f}from"./provider-plugin-catalog.js";const p=[`Flows: launchApp (with clearState, permissions, and Apple-only launch arguments; permissions apply after state clearing but before launch, and a launchApp without permissions touches nothing — there is no silent all: allow default); setPermissions (mid-flow permission grants, denials, and resets; all resolves in the backend — one simctl call on iOS, the declared permissions on Android — with specific entries overriding after it); runFlow file/inline; runFlow.when and repeat.while conditions (platform, visible, notVisible, and true, all re-evaluated before every repeat iteration); onFlowStart/onFlowComplete; repeat with times, while, or both; and retry.`,`Interactions: tapOn, doubleTapOn, longPressOn, inputText on the focused element, eraseText, openLink, hideKeyboard, basic pressKey, and back; selector targets poll until available and support recursive index, childOf, above, below, leftOf, rightOf, containsChild, containsDescendants, points, and optional; outer command labels are metadata, not target selectors.`,'Assertions and navigation: assertVisible, assertNotVisible, assertTrue (literal values and ${VAR} lookups only; "", "false", "0", "null", and "undefined" are falsy, everything else is truthy), extendedWaitUntil, scroll, scrollUntilVisible, absolute/percentage/target swipe, takeScreenshot, waitForAnimationToEnd, clearState, stopApp, and killApp (system-initiated process death: am kill on ADB-backed Android devices, which refuse a foreground target with android-kill-requires-background-app — background the app first, for example pressKey: Home — and fail a target whose process survives with android-kill-process-survived; iOS, Limrun, and WebDriver-provider backends run it as stopApp).',`Scripts: ordered runScript file/env scripts with http.post, json, and output variables; evalScript inline expressions run flow-scoped JavaScript and write output.* leaves for later steps.`],m=[`Permissions: every entry is one settings permission call, applied in order with all first; the step stops at the first entry the selected platform refuses, earlier entries stay applied, and the error names what landed. Android’s only allow level is while-in-use, so location: inuse and location: never mean allow and deny there, while location: always and photos: limited are Apple-only and fail. On iOS, which service a runtime changes is simctl privacy’s own verdict: current runtimes refuse a targeted notifications change and leave notifications untouched under all.`,`Runtime: iOS and Android only; launchApp.clearState and standalone clearState support Android and iOS simulators, launch arguments are Apple-only, and other standalone device utility/state commands are unsupported.`,"Expressions: evalScript and condition true: fields (runFlow.when and repeat.while share one evaluator) are evaluated as JavaScript (flow env and prior output leaves are string-typed); a true: field that is a boolean, a maestro.platform comparison, or plain literal text after ${VAR} lookups is decided without JavaScript, with the assertTrue falsy table for literal text. Other fields stay literal or ${VAR} lookup-only — assertTrue supports literals and bare lookups, and other expression-shaped payloads fail loud.",`Environment: flow env is the default, AD_VAR_* overrides it, and CLI -e KEY=VALUE wins over both.`,`Failure diagnostics: resolved targets and runFlow paths are rendered, while inputText payloads remain hidden; do not place secrets in diagnostic identifiers.`,`Trust: runScript, evalScript, and JavaScript condition true: fields execute flow scripts in-process via node:vm, which is not a security sandbox; runScript may make http.post network requests and its output keys cannot contain a dot. evalScript and true: fields that need JavaScript are refused outright for a flow accepted over the daemon’s remote HTTP surface, since that context can escape to the host.`,`Errors and tracking: unsupported commands and fields fail with source context when available; open a focused issue only when implementation work is planned.`];function h(){return[`Supported subset:`,...p.map(e=>` - ${e}`),``,`Boundaries:`,...m.map(e=>` - ${e}`)].join(`
1
+ import{r as e}from"./rolldown-runtime.js";import{O as t,x as n}from"./back-mode.js";import{Lr as r}from"./sdk-batch.js";import{H as i,O as a,f as o,k as s}from"./command-metadata.js";import{a as c}from"./version.js";import{n as l,r as u}from"./command-schema.js";import{n as d}from"./cli-command-aliases.js";import{n as f}from"./provider-plugin-catalog.js";const p=[`Flows: launchApp (with clearState, permissions, and Apple-only launch arguments; permissions apply after state clearing but before launch, and a launchApp without permissions touches nothing — there is no silent all: allow default); setPermissions (mid-flow permission grants, denials, and resets; all resolves in the backend — one simctl call on iOS, the declared permissions on Android — with specific entries overriding after it); runFlow file/inline; runFlow.when and repeat.while conditions (platform, visible, notVisible, and true, all re-evaluated before every repeat iteration); onFlowStart/onFlowComplete; repeat with times, while, or both; and retry.`,`Interactions: tapOn, doubleTapOn, longPressOn, inputText on the focused element, eraseText, openLink, hideKeyboard, basic pressKey, and back; selector targets poll until available and support recursive index, childOf, above, below, leftOf, rightOf, containsChild, containsDescendants, points, and optional; outer command labels are metadata, not target selectors.`,'Assertions and navigation: assertVisible, assertNotVisible, assertTrue (literal values and ${VAR} lookups only; "", "false", "0", "null", and "undefined" are falsy, everything else is truthy), extendedWaitUntil, scroll, scrollUntilVisible, absolute/percentage/target swipe, takeScreenshot, waitForAnimationToEnd, clearState, stopApp, and killApp (system-initiated process death: am kill on ADB-backed Android devices, which refuse a foreground target with android-kill-requires-background-app — background the app first, for example pressKey: Home — and fail a target whose process survives with android-kill-process-survived; iOS, Limrun, and WebDriver-provider backends run it as stopApp).',`Scripts: ordered runScript file/env scripts with http.post, json, and output variables; evalScript inline expressions run flow-scoped JavaScript and write output.* leaves for later steps.`],m=[`Permissions: every entry is one settings permission call, applied in order with all first; the step stops at the first entry the selected platform refuses, earlier entries stay applied, and the error names what landed. Android’s only allow level is while-in-use, so location: inuse and location: never mean allow and deny there, while location: always and photos: limited are Apple-only and fail. On iOS, which service a runtime changes is simctl privacy’s own verdict: current runtimes refuse a targeted notifications change and leave notifications untouched under all.`,`Runtime: iOS and Android only; launchApp.clearState and standalone clearState support Android and iOS simulators, launch arguments are Apple-only, and other standalone device utility/state commands are unsupported.`,"Expressions: evalScript and condition true: fields (runFlow.when and repeat.while share one evaluator) are evaluated as JavaScript (flow env and prior output leaves are string-typed); a true: field that is a boolean, a maestro.platform comparison, or plain literal text after ${VAR} lookups is decided without JavaScript, with the assertTrue falsy table for literal text. Other fields stay literal or ${VAR} lookup-only — assertTrue supports literals and bare lookups, and other expression-shaped payloads fail loud.",`Environment: flow env is the default, AD_VAR_* overrides it, and CLI -e KEY=VALUE wins over both.`,`Failure diagnostics: resolved targets and runFlow paths are rendered, while inputText payloads remain hidden; do not place secrets in diagnostic identifiers.`,`Trust: runScript, evalScript, and JavaScript condition true: fields execute flow scripts in-process via node:vm, which is not a security sandbox; runScript may make http.post network requests and its output keys cannot contain a dot. Remote flows refuse runScript before reading its file, including files supplied in the replay bundle, and refuse evalScript and true: fields that need JavaScript. Run these scripts only in trusted local flows. Local runScript paths refer to the daemon filesystem: relative paths resolve from the containing flow, and absolute paths and symlinks are allowed.`,`Remote screenshots: takeScreenshot uses a daemon-generated path and reports that path in artifactPaths. The flow cannot choose a file destination on the daemon host. Animation waits and tap retry comparisons use temporary screenshots that are removed after comparison.`,`Errors and tracking: unsupported commands and fields fail with source context when available; open a focused issue only when implementation work is planned.`];function h(){return[`Supported subset:`,...p.map(e=>` - ${e}`),``,`Boundaries:`,...m.map(e=>` - ${e}`)].join(`
2
2
  `)}const g={summary:`Full multi-touch gesture shapes and platform quirks`,body:`agent-device help gestures
3
3
 
4
4
  Full command shapes and platform quirks for touch/pointer gestures beyond scroll/swipe. Read this when a task needs multi-touch, a repeated gesture series, or exact per-platform verification.
@@ -879,6 +879,7 @@ Limrun direct-device flow:
879
879
  Limrun creates remote iOS simulators and Android emulators only. Do not pass local device selectors such as --udid, --serial, or --device.
880
880
  To drive an existing instance without the API key, set LIM_IOS_INSTANCE_URL and LIM_IOS_INSTANCE_TOKEN, or LIM_ANDROID_INSTANCE_URL, LIM_ANDROID_INSTANCE_TOKEN, and LIM_ANDROID_INSTANCE_ADB_URL, from the instance status before connect. agent-device then never creates or deletes that instance; install, and apps before the first open, still need LIMRUN_API_KEY.
881
881
  Set LIMRUN_KEEP_ALIVE=1 to ping the instance every 30 seconds while a session is open, so an idle session does not hit the Limrun inactivity timeout. It is off by default.
882
+ To capture network traffic, connect with --provider-network-logs --provider-network-hosts <app API hosts>. artifacts and close print the HAR path and any tunnel failures; the HAR holds raw headers and bodies, and captured traffic exits through the daemon host.
882
883
  agent-device apps
883
884
  agent-device open Example.apk
884
885
  agent-device snapshot -i
@@ -916,7 +917,7 @@ Rules:
916
917
  disconnect releases local connection state; close releases the active session and device lease.
917
918
  A busy direct-proxy device error means another agent owns the device until it closes or its inactivity lease expires.
918
919
  Keep the proxy token secret. Anyone with the token can control the proxied daemon.
919
- A daemon with AGENT_DEVICE_HTTP_AUTH_HOOK configured treats HTTP requests as remote: host-path install sources are rejected, uploaded artifacts remain supported, and Maestro runScript HTTP helpers allow only public network destinations. No-hook local HTTP and socket flows retain their local behavior.
920
+ A daemon with AGENT_DEVICE_HTTP_AUTH_HOOK configured treats HTTP requests as remote: host-path install sources are rejected, uploaded artifacts remain supported, and Maestro runScript, evalScript, and JavaScript conditions are rejected. No-hook local HTTP and socket flows retain their local behavior.
920
921
  A daemon started with AGENT_DEVICE_DAEMON_POLICY=<policy.json> enforces that policy for every request, including batch steps and replay actions: it can limit which devices are visible and bindable, allow or deny commands (Maestro flows reach the daemon as the runtime command), and deny device-shutdown. A denial is UNAUTHORIZED with details.reason DAEMON_POLICY_DENIED; do not retry it. Use an allowed command or device, or ask the daemon operator to change the policy; a denied capability such as device-shutdown has no allowed alternative.
921
922
  If local/proxy iOS reports that the runner is already owned by another agent-device daemon after lease admission, retry after the owning session closes or after lease expiry. If the conflict repeats, clean stale daemon state on the machine with simulator access.
922
923
  Do not use --config as a remote profile flag. --config loads CLI defaults; --remote-config selects remote daemon/profile settings.