agent-device 0.21.37 → 0.21.38

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 (485) hide show
  1. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.37.apk → agent-device-android-ime-helper-0.21.38.apk} +0 -0
  2. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.38.apk.sha256 +1 -0
  3. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.37.manifest.json → agent-device-android-ime-helper-0.21.38.manifest.json} +4 -4
  4. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.37.apk → agent-device-android-snapshot-helper-0.21.38.apk} +0 -0
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.38.apk.sha256 +1 -0
  6. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.37.manifest.json → agent-device-android-snapshot-helper-0.21.38.manifest.json} +7 -7
  7. package/apple/fold-helper/Fold.m +8 -4
  8. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerKeyboardReturnKey.swift +53 -0
  9. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +42 -4
  10. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +26 -18
  11. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +42 -11
  12. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +123 -22
  13. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +7 -0
  14. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +570 -53
  15. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +41 -0
  16. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.h +7 -0
  17. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.m +17 -1
  18. package/dist/src/THIRD_PARTY_NOTICES.txt +2 -2
  19. package/dist/src/absence-observation-errors.js +1 -1
  20. package/dist/src/absence-observation.js +1 -1
  21. package/dist/src/adapter.js +1 -1
  22. package/dist/src/adb-executor.js +1 -1
  23. package/dist/src/adb-failure.js +2 -2
  24. package/dist/src/adb-transport.js +1 -1
  25. package/dist/src/agent-browser-lifecycle.js +1 -1
  26. package/dist/src/agent-browser-process-record.js +1 -1
  27. package/dist/src/agent-browser-provider.js +1 -1
  28. package/dist/src/agent-browser-tool.js +1 -1
  29. package/dist/src/ai-sdk.d.ts +1 -1
  30. package/dist/src/ai-sdk.js +1 -1
  31. package/dist/src/alert-contract.js +1 -1
  32. package/dist/src/alert-tree-driver.js +1 -1
  33. package/dist/src/alert.js +1 -1
  34. package/dist/src/android-adb.d.ts +1 -1
  35. package/dist/src/android.js +1 -1
  36. package/dist/src/android2.js +1 -1
  37. package/dist/src/app-backend.js +1 -1
  38. package/dist/src/app-catalog.js +1 -1
  39. package/dist/src/app-deployment-resolution.js +1 -1
  40. package/dist/src/app-inventory.js +1 -1
  41. package/dist/src/app-launch.js +1 -1
  42. package/dist/src/app-lifecycle.js +4 -4
  43. package/dist/src/app-lifecycle2.js +2 -2
  44. package/dist/src/app-log-files.js +1 -1
  45. package/dist/src/app-log-runtime2.js +2 -2
  46. package/dist/src/app-log-session-resource.js +1 -1
  47. package/dist/src/app-resolution.js +1 -1
  48. package/dist/src/app-state-read.js +1 -1
  49. package/dist/src/app-state-runtime.d.ts +1 -1
  50. package/dist/src/application-lifecycle-interaction.js +1 -1
  51. package/dist/src/archive.js +1 -1
  52. package/dist/src/args.js +1 -1
  53. package/dist/src/artifact-download.js +1 -1
  54. package/dist/src/artifact-tracking.js +1 -1
  55. package/dist/src/auth-session.js +1 -1
  56. package/dist/src/auth.js +1 -1
  57. package/dist/src/automation-helper-artifact.js +1 -1
  58. package/dist/src/automation-helper.js +1 -1
  59. package/dist/src/await-with-signal.js +1 -1
  60. package/dist/src/backend-snapshot-options.js +1 -1
  61. package/dist/src/boot-diagnostics.js +1 -1
  62. package/dist/src/bridge-source.js +1 -1
  63. package/dist/src/browser-launch.js +1 -1
  64. package/dist/src/browserstack-device-features.js +1 -1
  65. package/dist/src/browserstack.js +1 -1
  66. package/dist/src/cache.js +1 -1
  67. package/dist/src/capture-disclosure.js +1 -1
  68. package/dist/src/capture-lifecycle.js +1 -1
  69. package/dist/src/cli-config.js +1 -1
  70. package/dist/src/cli-help.js +19 -16
  71. package/dist/src/cli-output.js +11 -11
  72. package/dist/src/cli-runner.js +1 -1
  73. package/dist/src/cli.js +2 -2
  74. package/dist/src/click-button.js +1 -1
  75. package/dist/src/client-metro-companion.js +1 -1
  76. package/dist/src/client-metro.js +1 -1
  77. package/dist/src/client-options.js +1 -1
  78. package/dist/src/client-port.d.ts +246 -208
  79. package/dist/src/clipboard-shell-response.js +1 -1
  80. package/dist/src/cloud-artifacts.d.ts +7 -2
  81. package/dist/src/code-signature-cache.js +1 -1
  82. package/dist/src/command-schema.js +6 -4
  83. package/dist/src/command-tools.js +3 -3
  84. package/dist/src/command.js +1 -1
  85. package/dist/src/composed-inventory-gateways.js +1 -1
  86. package/dist/src/composite-resource-admission.js +1 -1
  87. package/dist/src/config.js +1 -1
  88. package/dist/src/connection-lease-transaction.js +1 -1
  89. package/dist/src/connection-metro-runtime.js +1 -1
  90. package/dist/src/connection-runtime.js +1 -1
  91. package/dist/src/connection-verification.js +1 -1
  92. package/dist/src/connection.js +3 -3
  93. package/dist/src/context.js +1 -1
  94. package/dist/src/contract.d.ts +2 -1
  95. package/dist/src/contracts.d.ts +1 -1
  96. package/dist/src/contracts.js +1 -1
  97. package/dist/src/daemon-client-attach.js +1 -1
  98. package/dist/src/daemon-client-dispatch-disclosure.js +1 -1
  99. package/dist/src/daemon-client-ensure.js +1 -1
  100. package/dist/src/daemon-client-ensuring.js +1 -1
  101. package/dist/src/daemon-client-lease-beat.js +1 -1
  102. package/dist/src/daemon-client-lifecycle.js +1 -1
  103. package/dist/src/daemon-client-liveness-probe.js +1 -1
  104. package/dist/src/daemon-client-remote-health-cache.js +1 -0
  105. package/dist/src/daemon-client-remote-health-recovery.js +1 -0
  106. package/dist/src/daemon-client-transport.js +1 -1
  107. package/dist/src/daemon-command-registry.js +1 -1
  108. package/dist/src/daemon-composition.js +1 -1
  109. package/dist/src/daemon-diagnostics-scope.js +1 -1
  110. package/dist/src/daemon-http.js +1 -1
  111. package/dist/src/daemon-launch-spec.js +1 -1
  112. package/dist/src/daemon-lifecycle-errors.js +1 -1
  113. package/dist/src/daemon-policy-file.js +1 -1
  114. package/dist/src/daemon-registration-owner.js +3 -3
  115. package/dist/src/daemon-registration.js +1 -1
  116. package/dist/src/daemon-resolution.js +1 -1
  117. package/dist/src/daemon-startup-diagnostics.js +1 -1
  118. package/dist/src/daemon-stop.js +1 -1
  119. package/dist/src/daemon.js +1 -1
  120. package/dist/src/debug-symbols-facade.js +3 -3
  121. package/dist/src/device-claim-admission.js +1 -0
  122. package/dist/src/device-claim-reconciliation.js +1 -0
  123. package/dist/src/device-claim-recovery.js +1 -1
  124. package/dist/src/device-claim-rule.js +1 -1
  125. package/dist/src/device-claims.js +1 -1
  126. package/dist/src/device-input-state.d.ts +1 -1
  127. package/dist/src/device-inventory-context.js +1 -1
  128. package/dist/src/device-selection-resolver.js +1 -1
  129. package/dist/src/device-session.js +1 -1
  130. package/dist/src/device-shell.js +1 -1
  131. package/dist/src/device.js +1 -1
  132. package/dist/src/device3.js +3 -3
  133. package/dist/src/devicectl.js +1 -1
  134. package/dist/src/diagnostics.js +1 -1
  135. package/dist/src/discovery.js +1 -1
  136. package/dist/src/dispatch-resolve.js +1 -1
  137. package/dist/src/display-inventory.js +1 -1
  138. package/dist/src/doctor-facade.js +1 -1
  139. package/dist/src/doctor2.js +1 -1
  140. package/dist/src/durable-capture-resource.js +1 -1
  141. package/dist/src/durable-capture.js +1 -1
  142. package/dist/src/durable-resource.js +1 -1
  143. package/dist/src/ended-lease.js +1 -1
  144. package/dist/src/engine-eval-script.js +1 -1
  145. package/dist/src/error.js +2 -2
  146. package/dist/src/errors.js +1 -1
  147. package/dist/src/explicit-session-resolution.js +1 -1
  148. package/dist/src/expo-dev-client-launch.js +1 -1
  149. package/dist/src/failure-output.js +1 -1
  150. package/dist/src/file.js +1 -1
  151. package/dist/src/find.js +1 -1
  152. package/dist/src/finders.js +1 -1
  153. package/dist/src/flag-registry.js +1 -1
  154. package/dist/src/focus-runtime.js +1 -1
  155. package/dist/src/fold-helper.js +1 -1
  156. package/dist/src/generic-settle.js +1 -1
  157. package/dist/src/generic.js +1 -1
  158. package/dist/src/gesture-admission.js +1 -1
  159. package/dist/src/gesture-plan-types.d.ts +1 -1
  160. package/dist/src/gesture-plan.js +1 -1
  161. package/dist/src/gesture-runtime.js +1 -1
  162. package/dist/src/hdc.js +1 -1
  163. package/dist/src/helper-artifacts.js +1 -1
  164. package/dist/src/helper.js +2 -2
  165. package/dist/src/host-file.js +1 -1
  166. package/dist/src/host.js +1 -1
  167. package/dist/src/host2.js +1 -1
  168. package/dist/src/host3.js +1 -1
  169. package/dist/src/host4.js +1 -1
  170. package/dist/src/host5.js +1 -1
  171. package/dist/src/host6.js +1 -1
  172. package/dist/src/human-control-contract.js +1 -1
  173. package/dist/src/human-control.js +1 -1
  174. package/dist/src/ime-rebind.js +1 -1
  175. package/dist/src/ime-settings-record.js +1 -1
  176. package/dist/src/ime-state.js +1 -1
  177. package/dist/src/index.d.ts +3 -3
  178. package/dist/src/index.js +1 -1
  179. package/dist/src/input-actions.js +1 -1
  180. package/dist/src/input-actions2.js +1 -1
  181. package/dist/src/install-artifact-facade.js +1 -1
  182. package/dist/src/install-source-network-transport.js +1 -1
  183. package/dist/src/install-source2.js +1 -1
  184. package/dist/src/interaction-error.js +1 -1
  185. package/dist/src/interaction-positionals.js +1 -1
  186. package/dist/src/interaction-ref-policy.js +1 -1
  187. package/dist/src/interaction2.js +1 -1
  188. package/dist/src/interactor-operation-binding.js +1 -1
  189. package/dist/src/interactor.js +5 -5
  190. package/dist/src/interactor2.js +1 -1
  191. package/dist/src/interactor3.js +1 -1
  192. package/dist/src/interactor4.js +1 -1
  193. package/dist/src/interactor5.js +1 -1
  194. package/dist/src/interactors.js +1 -1
  195. package/dist/src/internal/bin.js +1 -1
  196. package/dist/src/internal/companion-tunnel.js +1 -1
  197. package/dist/src/internal/daemon.js +1 -1
  198. package/dist/src/internal/png-worker.js +1 -1
  199. package/dist/src/internal/run-script-child.js +1 -1
  200. package/dist/src/inventory.js +1 -1
  201. package/dist/src/inventory2.js +1 -1
  202. package/dist/src/inventory3.js +1 -1
  203. package/dist/src/inventory5.js +1 -1
  204. package/dist/src/ios-node-interpretation.js +1 -1
  205. package/dist/src/ios-simulator-accessibility.js +1 -1
  206. package/dist/src/ios-snapshot-acquisition.js +1 -1
  207. package/dist/src/ios-snapshot-engine.js +1 -1
  208. package/dist/src/ios-snapshot-runtime.js +1 -1
  209. package/dist/src/launch-confirmation.js +1 -1
  210. package/dist/src/launch-services-registration.js +1 -1
  211. package/dist/src/lease-context.js +1 -1
  212. package/dist/src/lease-registry-scope.js +1 -1
  213. package/dist/src/lease-release2.js +1 -1
  214. package/dist/src/lease-scope.js +1 -1
  215. package/dist/src/lease.js +1 -1
  216. package/dist/src/leased-recording-retention.js +1 -1
  217. package/dist/src/legacy.js +1 -1
  218. package/dist/src/limrun-download-file.js +1 -1
  219. package/dist/src/limrun-ios-files.js +1 -1
  220. package/dist/src/limrun-ios-runner.js +2 -2
  221. package/dist/src/limrun-runtime-dependencies.js +1 -1
  222. package/dist/src/limrun.d.ts +1 -1
  223. package/dist/src/local-interactor-operation-set.js +1 -1
  224. package/dist/src/local-simulator-apps.js +1 -1
  225. package/dist/src/local-simulator-files.js +1 -1
  226. package/dist/src/location-coordinates.js +1 -1
  227. package/dist/src/manifest.js +1 -1
  228. package/dist/src/mechanics.js +12 -12
  229. package/dist/src/merge-flags.js +1 -1
  230. package/dist/src/metro-reload-endpoints.js +1 -1
  231. package/dist/src/metro-session-hints.js +1 -1
  232. package/dist/src/metro.d.ts +1 -1
  233. package/dist/src/mobile-snapshot-semantics.js +1 -1
  234. package/dist/src/network-traffic.js +1 -1
  235. package/dist/src/node-http.js +1 -1
  236. package/dist/src/node-touch-point.js +1 -1
  237. package/dist/src/observation.js +1 -1
  238. package/dist/src/open-script.js +1 -1
  239. package/dist/src/open-target-device-resolution.js +1 -1
  240. package/dist/src/orientation.js +1 -1
  241. package/dist/src/parameterized-recorded-fill.js +1 -1
  242. package/dist/src/perf-facade.js +1 -1
  243. package/dist/src/perf-runtime-operation-builder.js +1 -1
  244. package/dist/src/perf-runtime-plan.js +1 -1
  245. package/dist/src/perf-target.js +2 -2
  246. package/dist/src/perf.js +1 -1
  247. package/dist/src/physical-device-control.js +1 -1
  248. package/dist/src/platform-runtime-android-adb-host.js +1 -1
  249. package/dist/src/platform-runtime-app-log-process.js +1 -1
  250. package/dist/src/platform-runtime-apple-application-tools.js +1 -1
  251. package/dist/src/platform-runtime-claim-recovery.js +1 -1
  252. package/dist/src/platform-runtime-host.js +1 -1
  253. package/dist/src/platform-runtime-open-target.js +1 -1
  254. package/dist/src/platform-runtime-operation-host.js +3 -3
  255. package/dist/src/platform-runtime-runtime-hints.js +1 -1
  256. package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -1
  257. package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
  258. package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
  259. package/dist/src/platform-runtime-screen-recording-process-host.js +1 -1
  260. package/dist/src/platform-runtime-shutdown-error.js +1 -1
  261. package/dist/src/platform-runtime-unavailable.js +1 -1
  262. package/dist/src/platform-runtime.js +1 -1
  263. package/dist/src/platform-runtime2.js +1 -1
  264. package/dist/src/plist.js +1 -1
  265. package/dist/src/plugins2.js +1 -1
  266. package/dist/src/png-crop-bytes.js +1 -1
  267. package/dist/src/png-resize.js +1 -1
  268. package/dist/src/png-size.js +1 -1
  269. package/dist/src/png-worker-client.js +1 -1
  270. package/dist/src/png.js +1 -1
  271. package/dist/src/post-gesture-stability.js +1 -1
  272. package/dist/src/process-executable-path.js +1 -0
  273. package/dist/src/process-exit.js +1 -1
  274. package/dist/src/provider-device-runtime.d.ts +2 -2
  275. package/dist/src/provider-limrun-credentials.js +1 -1
  276. package/dist/src/provider-plugin.d.ts +1 -1
  277. package/dist/src/provider-profile-fields.js +1 -1
  278. package/dist/src/provider-webdriver.js +1 -1
  279. package/dist/src/provider.js +1 -1
  280. package/dist/src/proxy.js +2 -2
  281. package/dist/src/react-devtools-connection.js +1 -1
  282. package/dist/src/react-devtools-inspect-command.js +1 -1
  283. package/dist/src/react-native-overlay2.js +2 -2
  284. package/dist/src/react-native.js +1 -1
  285. package/dist/src/react-profile-command.js +1 -1
  286. package/dist/src/record-runtime.js +1 -1
  287. package/dist/src/record-trace.js +1 -1
  288. package/dist/src/recording-gestures.js +1 -1
  289. package/dist/src/recording.js +1 -1
  290. package/dist/src/rect-center.js +1 -1
  291. package/dist/src/register-builtins.js +1 -1
  292. package/dist/src/registry.js +1 -1
  293. package/dist/src/remote-config-core.js +1 -1
  294. package/dist/src/remote-config-flags.js +1 -1
  295. package/dist/src/remote-connection-state.js +1 -1
  296. package/dist/src/replay-backend-host.js +1 -1
  297. package/dist/src/replay-divergence.js +1 -1
  298. package/dist/src/replay-maestro-backend.js +2 -2
  299. package/dist/src/replay.d.ts +1 -1
  300. package/dist/src/replay2.js +1 -1
  301. package/dist/src/reporting.js +1 -1
  302. package/dist/src/request-dispatch-disclosure.js +1 -1
  303. package/dist/src/request-ended-leases.js +1 -1
  304. package/dist/src/request-providers.js +1 -1
  305. package/dist/src/request-runtime-binding.js +1 -1
  306. package/dist/src/request.js +1 -1
  307. package/dist/src/result-serialization.js +2 -2
  308. package/dist/src/retry.js +1 -1
  309. package/dist/src/run-script-execution.js +6 -8
  310. package/dist/src/run-script-http.js +1 -1
  311. package/dist/src/runner-cache-metadata.js +1 -1
  312. package/dist/src/runner-cache-retention.js +1 -1
  313. package/dist/src/runner-client.js +1 -1
  314. package/dist/src/runner-contract.js +1 -1
  315. package/dist/src/runner-dev-tools-security.js +1 -1
  316. package/dist/src/runner-device-readiness.js +1 -1
  317. package/dist/src/runner-device-set.js +1 -1
  318. package/dist/src/runner-disposal.js +1 -1
  319. package/dist/src/runner-error-classification.js +2 -2
  320. package/dist/src/runner-exchange.js +1 -1
  321. package/dist/src/runner-io.js +1 -1
  322. package/dist/src/runner-launched-session.js +1 -1
  323. package/dist/src/runner-lease.js +1 -1
  324. package/dist/src/runner-lifecycle.js +1 -1
  325. package/dist/src/runner-operations-facade.js +1 -1
  326. package/dist/src/runner-panel.js +1 -1
  327. package/dist/src/runner-retention.js +1 -1
  328. package/dist/src/runner-runtime.js +1 -1
  329. package/dist/src/runner-selector-query.js +1 -1
  330. package/dist/src/runner-sequence.js +1 -1
  331. package/dist/src/runner-start-budget.js +1 -1
  332. package/dist/src/runner-startup-transport.js +1 -1
  333. package/dist/src/runner-toolchain-identity.js +1 -1
  334. package/dist/src/runtime-admission.js +1 -1
  335. package/dist/src/runtime-deployment.js +1 -1
  336. package/dist/src/runtime-factory.js +1 -1
  337. package/dist/src/runtime-session.js +1 -1
  338. package/dist/src/runtime-transport-hints.js +1 -1
  339. package/dist/src/runtime.js +2 -2
  340. package/dist/src/runtime10.js +1 -1
  341. package/dist/src/runtime11.js +1 -1
  342. package/dist/src/runtime12.js +1 -1
  343. package/dist/src/runtime13.js +2 -2
  344. package/dist/src/runtime2.js +2 -2
  345. package/dist/src/runtime4.js +3 -3
  346. package/dist/src/runtime5.js +1 -1
  347. package/dist/src/runtime6.js +1 -1
  348. package/dist/src/runtime7.js +2 -2
  349. package/dist/src/runtime8.js +1 -1
  350. package/dist/src/runtime9.js +1 -1
  351. package/dist/src/screen-recording-admission-ledger.js +1 -0
  352. package/dist/src/screen-recording-completion.js +1 -1
  353. package/dist/src/screen-recording-options.js +1 -1
  354. package/dist/src/screen-recording-resource-recovery.js +1 -1
  355. package/dist/src/screen-recording-stop-recovery.js +1 -1
  356. package/dist/src/screen-recording-transport.js +1 -1
  357. package/dist/src/screenshot-density.js +1 -1
  358. package/dist/src/screenshot-image-size.js +1 -1
  359. package/dist/src/screenshot-image.js +1 -1
  360. package/dist/src/screenshot-runtime.js +1 -1
  361. package/dist/src/screenshot-runtime2.js +1 -1
  362. package/dist/src/screenshot.js +1 -1
  363. package/dist/src/screenshot2.js +1 -1
  364. package/dist/src/screenshot4.js +1 -1
  365. package/dist/src/script-source.js +1 -1
  366. package/dist/src/script.js +1 -1
  367. package/dist/src/scroll-command.js +1 -1
  368. package/dist/src/scroll-gesture.js +1 -1
  369. package/dist/src/sdk-batch-runner.d.ts +1 -1
  370. package/dist/src/sdk-batch-runner.js +2 -2
  371. package/dist/src/sdk-batch.js +2 -2
  372. package/dist/src/sdk-contracts.d.ts +26 -2
  373. package/dist/src/sdk-contracts.js +2 -2
  374. package/dist/src/sdk-device.js +1 -1
  375. package/dist/src/sdk-finders.d.ts +1 -1
  376. package/dist/src/sdk-finders.js +1 -1
  377. package/dist/src/sdk-io.js +5 -5
  378. package/dist/src/sdk-remote-config.d.ts +1 -1
  379. package/dist/src/sdk-remote-config.js +1 -1
  380. package/dist/src/sdk-selectors.d.ts +9 -6
  381. package/dist/src/sdk-selectors.js +1 -1
  382. package/dist/src/selection.js +0 -0
  383. package/dist/src/selector-pipeline-policy.js +1 -1
  384. package/dist/src/selector-runtime.js +1 -1
  385. package/dist/src/selectors.js +1 -1
  386. package/dist/src/server-shutdown.js +1 -1
  387. package/dist/src/server-startup.js +2 -2
  388. package/dist/src/server.js +4 -4
  389. package/dist/src/session-allocation.js +1 -1
  390. package/dist/src/session-artifact-paths.js +1 -1
  391. package/dist/src/session-capture-binding.js +1 -1
  392. package/dist/src/session-device-resolution.js +1 -1
  393. package/dist/src/session-event-action.js +1 -1
  394. package/dist/src/session-open.js +1 -1
  395. package/dist/src/session-repair-tombstone.js +1 -1
  396. package/dist/src/session-replay-vars.js +1 -1
  397. package/dist/src/session-routing.js +1 -1
  398. package/dist/src/session-runtime-admission.js +1 -1
  399. package/dist/src/session-runtime.js +1 -1
  400. package/dist/src/session-script-destination.js +1 -0
  401. package/dist/src/session-selector.js +1 -1
  402. package/dist/src/session-store.js +3 -3
  403. package/dist/src/session-teardown.js +1 -1
  404. package/dist/src/session-tenant-scope.js +1 -1
  405. package/dist/src/session2.js +5 -5
  406. package/dist/src/settings-bluetooth.js +1 -1
  407. package/dist/src/settings-global-toggle.js +1 -1
  408. package/dist/src/settings.js +1 -1
  409. package/dist/src/settings2.js +1 -1
  410. package/dist/src/settle-observation-capture.js +1 -1
  411. package/dist/src/simctl-execution.js +1 -1
  412. package/dist/src/simctl-facade.js +1 -1
  413. package/dist/src/simctl.js +1 -1
  414. package/dist/src/simulator-app-budget.js +1 -1
  415. package/dist/src/simulator-boot.js +1 -1
  416. package/dist/src/simulator-facade.js +1 -1
  417. package/dist/src/simulator-state.js +1 -1
  418. package/dist/src/simulator.js +1 -1
  419. package/dist/src/snapshot-baseline.js +1 -1
  420. package/dist/src/snapshot-chrome.js +1 -1
  421. package/dist/src/snapshot-desktop-projection.js +1 -1
  422. package/dist/src/snapshot-diagnostics.js +1 -1
  423. package/dist/src/snapshot-helper-install.js +3 -3
  424. package/dist/src/snapshot-helper-session.js +1 -1
  425. package/dist/src/snapshot-lines.js +1 -1
  426. package/dist/src/snapshot-node-lookup.js +1 -1
  427. package/dist/src/snapshot-occlusion.js +1 -1
  428. package/dist/src/snapshot-private-evidence.js +1 -1
  429. package/dist/src/snapshot-runtime-binding.js +1 -1
  430. package/dist/src/snapshot-runtime-capture-input.js +1 -1
  431. package/dist/src/snapshot-runtime.js +1 -1
  432. package/dist/src/snapshot-state.js +1 -1
  433. package/dist/src/snapshot.js +1 -1
  434. package/dist/src/snapshot2.js +1 -1
  435. package/dist/src/snapshot3.js +2 -2
  436. package/dist/src/snapshot4.js +1 -1
  437. package/dist/src/source-channel.js +1 -1
  438. package/dist/src/src.js +1 -1
  439. package/dist/src/src10.js +1 -1
  440. package/dist/src/src11.js +1 -1
  441. package/dist/src/src2.js +1 -1
  442. package/dist/src/src3.js +5 -5
  443. package/dist/src/src4.js +2 -2
  444. package/dist/src/src5.js +1 -1
  445. package/dist/src/src6.js +1 -1
  446. package/dist/src/src8.js +1 -1
  447. package/dist/src/store-legacy.js +1 -1
  448. package/dist/src/store.js +1 -1
  449. package/dist/src/string-enum.js +1 -1
  450. package/dist/src/surface-snapshot.js +1 -1
  451. package/dist/src/surface-snapshot2.js +1 -1
  452. package/dist/src/sync-cache.js +1 -1
  453. package/dist/src/system-surface-foreground.js +2 -2
  454. package/dist/src/takeover.js +1 -1
  455. package/dist/src/tap-keyboard-occlusion.js +1 -1
  456. package/dist/src/target-evidence-tree.js +1 -1
  457. package/dist/src/target-evidence.js +1 -1
  458. package/dist/src/telephony-runtime.js +1 -1
  459. package/dist/src/tool-provider-facade.js +1 -1
  460. package/dist/src/tool-provider.js +3 -3
  461. package/dist/src/tool-provider2.js +1 -1
  462. package/dist/src/tool-provider3.js +1 -1
  463. package/dist/src/toolchain-probe.js +1 -1
  464. package/dist/src/touch-runtime.js +1 -1
  465. package/dist/src/touch-runtime2.js +1 -1
  466. package/dist/src/transport.js +2 -2
  467. package/dist/src/tree.js +1 -1
  468. package/dist/src/tv-remote-runtime.js +1 -1
  469. package/dist/src/tv-remote.js +1 -1
  470. package/dist/src/type-text-runtime.js +1 -1
  471. package/dist/src/unsupported-interactor.js +1 -1
  472. package/dist/src/update-check.js +1 -1
  473. package/dist/src/validation.js +1 -1
  474. package/dist/src/vars.js +1 -1
  475. package/dist/src/vega-executable.js +1 -1
  476. package/dist/src/verified-file.js +1 -1
  477. package/dist/src/video.js +2 -2
  478. package/dist/src/viewport.js +1 -1
  479. package/dist/src/web.js +1 -1
  480. package/dist/src/webdriver-source.js +1 -1
  481. package/package.json +2 -2
  482. package/server.json +2 -2
  483. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.37.apk.sha256 +0 -1
  484. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.37.apk.sha256 +0 -1
  485. package/dist/src/capture-output-ownership.js +0 -1
package/dist/src/src3.js CHANGED
@@ -1,7 +1,7 @@
1
- import{r as e}from"./rolldown-runtime.js";import{A as t,P as n,g as r,j as i,n as a,y as o}from"./sdk-contracts.js";import{_ as s,h as c,m as ee,n as te,o as ne,p as re,r as ie,s as ae,t as oe,v as se}from"./screenshot.js";import{M as ce,c as le,d as ue,f as de,g as fe,h as pe,l as me,p as he,u as ge}from"./sdk-batch-runner.js";import{t as _e}from"./viewport.js";import"./capture.js";import{mt as ve}from"./sdk-io.js";import{a as ye,n as be,o as xe,r as l,t as Se}from"./sdk-device.js";import{O as Ce,_ as we,m as Te}from"./lease-scope.js";import{$n as Ee,An as De,Gr as Oe,Li as ke,Lr as Ae,Mr as je,Nr as Me,P as Ne,Pr as Pe,Zn as Fe,i as Ie,m as Le,on as Re,p as ze,rr as Be,s as Ve,v as He,zr as Ue}from"./sdk-batch.js";import{n as We}from"./recording-export-quality.js";import{t as Ge}from"./recording-scope.js";import{a as Ke,n as qe,o as Je,r as Ye,s as Xe}from"./scroll-gesture.js";import{t as Ze}from"./gesture-plan-types.js";import{a as Qe,c as $e,f as et,i as tt,m as nt,p as rt}from"./script.js";import{a as it,o as at,r as ot}from"./vars.js";import{i as st,r as ct,t as lt}from"./format.js";import{n as u,t as ut}from"./catalog.js";import{n as dt,r as ft}from"./flag-registry.js";import{n as pt}from"./session.js";import{a as mt,c as ht,d as gt,f as _t,g as vt,h as yt,i as bt,l as xt,n as St,o as Ct,p as wt,s as Tt,t as Et,u as Dt}from"./observability.js";import{h as Ot,t as kt}from"./alert-contract.js";import{h as At,l as jt,n as Mt,v as Nt,x as Pt,y as Ft}from"./settings.js";import{t as It}from"./location-coordinates.js";import{t as Lt}from"./snapshot-quality-backend-capabilities.js";import{r as Rt}from"./absence-observation.js";import{t as zt}from"./absence-observation-errors.js";import{t as Bt}from"./click-button.js";import{n as Vt}from"./scroll-command.js";import{n as Ht,t as Ut}from"./interaction-positionals.js";import{t as Wt}from"./app-inventory.js";import{C as Gt,D as Kt,E as qt,_ as Jt,a as Yt,d as Xt,f as Zt,g as Qt,h as $t,i as en,m as tn,n as nn,o as rn,p as an,r as on,s as sn,u as cn,w as ln}from"./device.js";import{s as un,u as dn}from"./file.js";import{t as fn}from"./back-mode.js";import{a as pn,n as mn,r as hn,t as gn,u as _n}from"./tv-remote.js";import d from"node:fs";import f from"node:path";function vn(e,t,r){if(Object.hasOwn(e,t))throw new n(`INVALID_ARGS`,r)}function yn(e){return{kind:`operator`,source:e}}function bn(e,t){return`${e} is not accepted as a tool argument. ${xn(e,t)}`}function xn(e,t){if(`operatorPath`in t)return t.operatorPath;let n=`for the process serving these tools.`,r=(t.envFlagKeys??[e]).map(ve).join(` or `);return r===``?`Set ${e} in ~/.agent-device/config.json ${n}`:`Set the ${r} environment variable${t.operatorConfig?` (or ${e} in ~/.agent-device/config.json)`:``} ${n}`}function Sn(e){if(e==null)return{};if(!e||typeof e!=`object`||Array.isArray(e))throw new n(`INVALID_ARGS`,`Expected object arguments.`);return e}function Cn(e,t){let r=e[t];if(!r||typeof r!=`object`||Array.isArray(r))throw new n(`INVALID_ARGS`,`Expected ${t} to be an object.`);return r}function wn(e,t){let r=e[t];if(r!==void 0){if(typeof r!=`string`)throw new n(`INVALID_ARGS`,`Expected ${t} to be a string.`);return r}}function p(e,t){let r=e[t];if(r!==void 0){if(typeof r!=`string`||r.length===0)throw new n(`INVALID_ARGS`,`Expected ${t} to be a non-empty string.`);return r}}function Tn(e,t){let r=e[t];if(typeof r!=`number`||!Number.isFinite(r))throw new n(`INVALID_ARGS`,`Expected ${t} to be a finite number.`);return r}function En(e,t){let r=e[t];if(r!==void 0){if(typeof r!=`boolean`)throw new n(`INVALID_ARGS`,`Expected ${t} to be a boolean.`);return r}}function Dn(e,t,r){let i=e[t];if(i!==void 0){if(typeof i!=`string`||!r.includes(i))throw new n(`INVALID_ARGS`,`Expected ${t} to be one of: ${r.join(`, `)}.`);return i}}function On(e,t){let r=e[t];if(r!==void 0){if(!r||typeof r!=`object`||Array.isArray(r))throw new n(`INVALID_ARGS`,`Expected ${t} to be an object.`);return r}}function kn(e,t){let r=e[t];if(r!==void 0){if(!Array.isArray(r)||r.some(e=>typeof e!=`string`))throw new n(`INVALID_ARGS`,`Expected ${t} to be an array of strings.`);return r}}function An(e,t,r,i){let a=new Set(t),o=Object.keys(e).filter(e=>!a.has(e));if(o.length>0)throw new n(`INVALID_ARGS`,`${r} has unknown field(s): ${o.join(`, `)}.`,i===void 0?void 0:{hint:i})}function m(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}const h=yn({operatorConfig:!0}),jn=`readinessTimeoutMs was removed; add an explicit wait for the target before the interaction.`,Mn={session:{schema:{type:`string`,description:`Session name.`},read:e=>p(e,`session`),flagKey:`session`,flagIn:[`input`]},platform:{schema:{type:`string`,enum:ye,description:`Device platform.`},read:e=>Dn(e,`platform`,ye),flagKey:`platform`,flagIn:[`input`,`selection`]},deviceTarget:{schema:{type:`string`,enum:l,description:`Device form factor.`},read:zn,clientKey:`target`,flagKey:`target`,flagIn:[`input`,`selection`]},target:{schema:{type:`string`,enum:l,description:`Alias for deviceTarget.`}},device:{schema:{type:`string`,description:`Device name; ids go in udid or serial.`},read:e=>p(e,`device`),flagKey:`device`,flagIn:[`input`,`selection`]},udid:{schema:{type:`string`,description:`Apple device or simulator UDID.`},read:e=>p(e,`udid`),flagKey:`udid`,flagIn:[`input`,`selection`]},serial:{schema:{type:`string`,description:`Android, HarmonyOS, or Vega VVD serial.`},read:e=>p(e,`serial`),flagKey:`serial`,flagIn:[`input`,`selection`]},iosSimulatorDeviceSet:{schema:{type:`string`,description:`iOS simulator device-set path used for device resolution.`},read:e=>p(e,`iosSimulatorDeviceSet`),audience:yn({envFlagKeys:[],operatorConfig:!0}),flagKey:`iosSimulatorDeviceSet`,flagIn:[`input`,`selection`]},iosXctestrunFile:{schema:{type:`string`,description:`Externally built iOS XCTest runner .xctestrun artifact path. Build it with the same agent-device version.`},read:e=>p(e,`iosXctestrunFile`),audience:h,flagKey:`iosXctestrunFile`,flagIn:[`input`]},iosXctestDerivedDataPath:{schema:{type:`string`,description:`Derived data path for external iOS XCTest runner execution.`},read:e=>p(e,`iosXctestDerivedDataPath`),audience:h,flagKey:`iosXctestDerivedDataPath`,flagIn:[`input`]},iosXctestEnvDir:{schema:{type:`string`,description:`Writable directory for iOS XCTest runner env overlays.`},read:e=>p(e,`iosXctestEnvDir`),audience:h,flagKey:`iosXctestEnvDir`,flagIn:[`input`]},androidDeviceAllowlist:{schema:{type:`string`,description:`Android serial allowlist used for device resolution.`},read:e=>p(e,`androidDeviceAllowlist`),audience:h,flagKey:`androidDeviceAllowlist`,flagIn:[`input`,`selection`]},noRecord:{read:e=>En(e,`noRecord`),flagKey:`noRecord`,flagIn:[`input`,`selection`]},readinessTimeoutMs:{audience:{kind:`retired`,message:jn},read:e=>vn(e,`readinessTimeoutMs`,jn)},daemonBaseUrl:{schema:{type:`string`,description:`Remote daemon base URL.`},read:e=>p(e,`daemonBaseUrl`),audience:h},daemonAuthToken:{schema:{type:`string`,description:`Remote daemon auth token.`},read:e=>p(e,`daemonAuthToken`),audience:h},tenant:{schema:{type:`string`,description:`Remote tenant identifier.`},read:e=>p(e,`tenant`),audience:h},runId:{schema:{type:`string`,description:`Lease run identifier.`},read:e=>p(e,`runId`),audience:h},leaseId:{schema:{type:`string`,description:`Existing lease identifier.`},read:e=>p(e,`leaseId`),audience:h},cwd:{schema:{type:`string`,description:`Working directory for command execution.`},read:e=>p(e,`cwd`),audience:yn({operatorPath:`Start the process serving these tools in the desired working directory, or pass absolute paths.`})},debug:{schema:{type:`boolean`,description:`Enable debug diagnostics.`},read:e=>En(e,`debug`)}},Nn=Object.entries(Mn),Pn=Object.fromEntries(Nn.flatMap(([e,t])=>t.audience?[[e,t.audience]]:[]));function Fn(e){for(let[t,n]of Object.entries(Pn))n.kind===`retired`&&vn(e,t,n.message)}function In(){return Object.fromEntries(Nn.flatMap(([e,t])=>t.schema?[[e,t.schema]]:[]))}function Ln(e,t={}){let n={};for(let[r,i]of Nn)i.read&&(n[r]=i.read(e,t));return n}function g(e){let t={};for(let[n,r]of Nn)r.read&&(t[r.clientKey??n]=e[n]);return m(t)}function Rn(e,t){let n={};for(let[r,i]of Nn){if(i.flagIn===void 0||!i.flagIn.includes(t))continue;let a=t===`selection`?i.clientKey??r:r;n[a]=e[i.flagKey]}return n}function zn(e,t){let r=Dn(e,`deviceTarget`,l);if(t.readTargetAlias===!1||e.target===void 0)return r;let i=Dn(e,`target`,l);if(r!==void 0&&i!==r)throw new n(`INVALID_ARGS`,`Expected target alias to match deviceTarget when both are set.`);return r??i}function _(e,t){return n=>v(e,t?t(n):[],n)}function v(e,t,n,r){return{command:e,positionals:t,...r?{input:r}:{},options:Bn(n)}}function Bn(e){let t=Vn(e.deviceTarget??e.target);if(t===void 0&&e.target===void 0)return e;let{target:n,...r}=e;return t===void 0?r:{...r,target:t}}function Vn(e){return e===`mobile`||e===`tv`||e===`desktop`?e:void 0}function y(e){return m(Rn(e,`input`))}function Hn(e){return m({record:e.record})}function Un(e){return Rn(e,`selection`)}function Wn(e){return m({depth:e.snapshotDepth,scope:e.snapshotScope,raw:e.snapshotRaw})}function Gn(e){return{depth:e.snapshotDepth,scope:e.snapshotScope,raw:e.snapshotRaw}}function Kn(e){return m({settle:e.settle,settleQuietMs:e.settleQuietMs,timeoutMs:e.timeoutMs})}function qn(e){return m({count:e.count,intervalMs:e.intervalMs,holdMs:e.holdMs,jitterPx:e.jitterPx,doubleTap:e.doubleTap})}function Jn(e){return Ce(e).spec}function Yn(e){let t=e;if(typeof t.ref==`string`)return[t.ref,...Qn(t.label)];if(typeof t.selector==`string`)return[t.selector];if(t.x!==void 0||t.y!==void 0)return[String(Zn(t.x,`x`)),String(Zn(t.y,`y`))];throw new n(`INVALID_ARGS`,`interaction requires @ref, selector, or point target`)}function Xn(e){let t=e;if(typeof t.ref==`string`)return[t.ref,...Qn(t.label)];if(typeof t.selector==`string`)return[t.selector];throw new n(`INVALID_ARGS`,`element command requires @ref or selector target`)}function Zn(e,t){if(typeof e!=`number`||!Number.isFinite(e))throw new n(`INVALID_ARGS`,`point target requires numeric ${t}.`);return e}function Qn(e){return typeof e==`string`&&e.length>0?[e]:[]}function $n(e){let t=Me(e);if(!t.ok)throw new n(t.code,t.message);return`ref`in t?{ref:t.ref,label:rr(e.slice(1))}:{selector:t.selector}}function er(e){let t=Pe(e);if(!t.ok)throw new n(t.code,t.message);return t.format}function tr(e,t={}){let r=Oe(e,t);if(!r)throw new n(`INVALID_ARGS`,je);return r}function nr(e,t){try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}throw new n(`INVALID_ARGS`,`${t} must be a JSON object`)}function rr(e){return e.join(` `).trim()||void 0}function ir(e){return e===void 0||e.trim()===``?!1:Number.isFinite(Number(e))}function ar(e,t){if(e===void 0)return;let r=Number(e);if(Number.isFinite(r))return r;throw new n(`INVALID_ARGS`,`${t} must be a finite number.`)}function or(e){return e===void 0?void 0:Number(e)}function b(e){return e===void 0?[]:[e]}function x(e){return e===void 0?[]:[String(e)]}function S(e,t){if(e===void 0||e===``)throw new n(`INVALID_ARGS`,t);return e}function C(e,t){if(typeof e!=`string`||e.length===0)throw new n(`INVALID_ARGS`,t);return e}const sr=[`path`,`start`,`stop`,`doctor`,`mark`,`clear`],cr=new Set(dt().map(e=>e.key));function lr(e){let n=Te(e);return ce({stateDir:e.stateDir,daemonBaseUrl:e.daemonBaseUrl,daemonTransport:e.daemonTransport,daemonServerMode:e.daemonServerMode,...we(n),provider:e.provider,providerSessionId:e.providerSessionId,providerApp:e.providerApp,providerOsVersion:e.providerOsVersion,providerDeviceType:e.providerDeviceType,providerProject:e.providerProject,providerBuild:e.providerBuild,providerSessionName:e.providerSessionName,providerDeviceOrientation:e.providerDeviceOrientation,providerGeoLocation:e.providerGeoLocation,providerTimezone:e.providerTimezone,providerAppiumVersion:e.providerAppiumVersion,providerLanguage:e.providerLanguage,providerLocale:e.providerLocale,providerNetworkProfile:e.providerNetworkProfile,providerCustomNetwork:e.providerCustomNetwork,providerNoResignApp:e.providerNoResignApp,providerNetworkLogs:e.providerNetworkLogs,providerNetworkHosts:e.providerNetworkHosts,awsProjectArn:e.awsProjectArn,awsDeviceArn:e.awsDeviceArn,awsAppArn:e.awsAppArn,awsRegion:e.awsRegion,awsInteractionMode:e.awsInteractionMode,sessionIsolation:e.sessionIsolation,platform:e.platform,target:e.target,device:e.device,udid:e.udid,serial:e.serial,iosSimulatorDeviceSet:e.iosSimulatorDeviceSet,iosXctestrunFile:e.iosXctestrunFile,iosXctestDerivedDataPath:e.iosXctestDerivedDataPath,iosXctestEnvDir:e.iosXctestEnvDir,androidDeviceAllowlist:e.androidDeviceAllowlist,osVersion:e.osVersion,imageTag:e.imageTag,deviceMode:e.deviceMode,deviceBaseline:e.deviceBaseline,physical:e.physical,surface:e.surface,activity:e.activity,launchConsole:e.launchConsole,launchArgs:e.launchArgs,relaunch:e.relaunch,shutdown:e.shutdown,saveScript:e.saveScript,testIme:e.testIme,noRecord:e.noRecord,recordAs:e.recordAs,record:e.record,backMode:e.backMode,metroHost:e.metroHost,metroPort:e.metroPort,bundleUrl:e.bundleUrl,launchUrl:e.launchUrl,...t(e,o),...re(e),appsFilter:e.appsFilter,kind:e.kind,out:e.out,count:e.count,fps:e.fps,quality:e.quality,hideTouches:e.hideTouches,recordingScope:e.recordingScope,intervalMs:e.intervalMs,delayMs:e.delayMs,durationMs:e.durationMs,holdMs:e.holdMs,jitterPx:e.jitterPx,pixels:e.pixels,until:e.until,maxPasses:e.maxPasses,doubleTap:e.doubleTap,verify:e.verify,settle:e.settle,settleQuietMs:e.settleQuietMs,clickButton:e.clickButton,pauseMs:e.pauseMs,pattern:e.pattern,headless:e.headless,pick:e.pick,restart:e.restart,replayUpdate:e.replayUpdate,replayBackend:e.replayBackend,replayEnv:e.replayEnv,replayShellEnv:e.replayShellEnv,replayScriptSource:e.replayScriptSource,replayScriptSources:e.replayScriptSources,replayFrom:e.replayFrom,replayPlanDigest:e.replayPlanDigest,replayKeepSession:e.replayKeepSession,failFast:e.failFast,timeoutMs:e.timeoutMs,retries:e.retries,recordVideo:e.recordVideo,artifactsDir:e.artifactsDir,shardAll:e.shardAll,shardSplit:e.shardSplit,findFirst:e.findFirst,findLast:e.findLast,networkInclude:e.networkInclude,batchOnError:e.batchOnError,batchMaxSteps:e.batchMaxSteps,batchSteps:e.batchSteps,verbose:e.debug})}function ur(e,t){return{...lr(e),...t}}function dr(e,t){let n=e.inputSchema.properties;if(!n)return{};let r={},i=t;for(let e of Object.keys(n)){if(!cr.has(e))continue;let t=i[e];fr(t)&&(r[e]=t)}return r}function fr(e){return typeof e==`boolean`||typeof e==`number`||typeof e==`string`}function pr(e){return async(t,n)=>v(u.batch,[],{...t,batchSteps:await mr(t.steps,(t,r,i)=>e(t,r,i,n)),batchOnError:t.onError,batchMaxSteps:t.maxSteps})}async function mr(e,t){if(!Array.isArray(e)||e.length===0)throw new n(`INVALID_ARGS`,`batch requires a non-empty steps array.`);let r=[];for(let[n,i]of e.entries())r.push(await hr(i,n+1,t));return r}async function hr(e,t,n){let r=he(e,t),i=_r(r,t),a=de(r,t);gr(i,a,t);let o=ue(r.runtime,t),s=await n(i,a,t);return{command:s.command,positionals:s.positionals,...s.input?{input:s.input}:{},flags:ur(s.options,s.metadataFlags),runtime:o??s.options.runtime}}function gr(e,t,r){if(e===u.fill&&t.textStdin===!0)throw new n(`INVALID_ARGS`,`Batch step ${r}: fill textStdin is not supported because batch steps have no stdin of their own. Run that fill on its own with --text-stdin.`,{reason:`fill_text_stdin_in_batch`})}function _r(e,t){return Ve(e.command,t)}function vr(e){return xr(e.description,e.cliDetail)}function yr(e){return xr(e.description,e.mcpDetail)}function br(e,t){return{...e,description:t}}function xr(e,t){return t?`${e} ${t}`:e}function Sr(e){return e}function Cr(e){return{...wr(e.inputSchema),...e.inputExample}}function wr(e){return Object.fromEntries((e.required??[]).map(t=>[t,Tr(t,e.properties?.[t])]))}function Tr(e,t){if(t===void 0)return`<${e}>`;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.oneOf!==void 0&&t.oneOf.length>0)return Tr(e,t.oneOf[0]);switch(Array.isArray(t.type)?t.type[0]:t.type){case`object`:return wr(t);case`array`:return t.items===void 0?[]:[Tr(e,t.items)];case`number`:case`integer`:return t.minimum??1;case`boolean`:return!0;default:return`<${e}>`}}function Er(e,t=[],n=new Set){let r=Object.entries(In()).filter(([e])=>!n.has(e));return{type:`object`,properties:{...Object.fromEntries(r),...e},...t.length>0?{required:t}:{},additionalProperties:!1}}function w(e,t=[],n){return{type:`object`,...n?{description:n}:{},properties:e,...t.length>0?{required:t}:{}}}function Dr(e){return{type:`object`,description:e,properties:{x:{type:`number`},y:{type:`number`}},required:[`x`,`y`],additionalProperties:!1}}function T(e,t){return{type:`string`,enum:e,...t?{description:t}:{}}}function E(e){return{type:`string`,const:e}}function D(e){return{type:`string`,...e?{description:e}:{}}}function Or(e){return{type:[`string`,`null`],...e?{description:e}:{}}}function O(e,t={}){return{type:`number`,...e?{description:e}:{},...t.min===void 0?{}:{minimum:t.min},...t.max===void 0?{}:{maximum:t.max}}}function kr(e){return{type:`integer`,...e?{description:e}:{}}}function k(e){return{type:`boolean`,...e?{description:e}:{}}}function Ar(e){return{type:`array`,items:{type:`string`},...e?{description:e}:{}}}function A(e){return{type:`object`,additionalProperties:!0,...e?{description:e}:{}}}function j(e){return{...e,required:!0}}function M(e,t={}){return V(D(e),t.allowEmpty===!0?wn:p)}function jr(e){return{schema:{type:`null`},required:!1,audience:{kind:`retired`,message:e},read:(t,n)=>vn(t,n,e)}}function Mr(e,t){return{...e,audience:{kind:`operator`,source:t}}}function N(e,t={}){return V(O(e,t),(e,n)=>fe(e,n,t))}function P(e,t={}){return V(Xr(e,t),(e,n)=>pe(e,n,t))}function F(e){return V(k(e),En)}function I(e){return Pr(Nr(e))}function Nr(e){let[t,...n]=ft(e).filter(e=>e.inputDescription!==void 0);if(!t)throw Error(`Flag ${e} declares no inputDescription; optionField cannot derive a field`);if(n.length>0)throw Error(`Flag ${e} declares inputDescription more than once`);return t}function Pr(e){let t=e.inputDescription,n={min:e.min,max:e.max};switch(e.type){case`boolean`:return F(t);case`int`:return P(t,n);case`number`:return N(t,n);case`string`:return M(t);case`enum`:return L(Fr(e),t);case`booleanOrString`:throw Error(`Flag ${e.key} is booleanOrString; declare its field shape explicitly with jsonSchemaField`)}}function Fr(e){let t=e.enumValues;if(!t)throw Error(`Flag ${e.key} is an enum with no enumValues`);return t}function L(e,t){return V(T(e,t),(t,n)=>Dn(t,n,e))}function Ir(e){return V(A(e),On)}function Lr(e){return V(Ar(e),kn)}function R(e){return V(e,(e,t)=>e[t])}function Rr(e,t){return V(e,t)}function zr(e){return V(Dr(e),(e,t)=>e[t]===void 0?void 0:qr(e,t))}function Br(e,t){return V({type:`array`,description:e,items:Dr(`One contact point.`),minItems:t.min,maxItems:t.max},(e,t)=>e[t]===void 0?void 0:Vr(e,t))}function Vr(e,t){let r=e[t];if(!Array.isArray(r))throw new n(`INVALID_ARGS`,`Expected ${t} to be an array of points.`);return r.map((e,n)=>{let r=`${t}[${n}]`;return qr({[r]:e},r)})}function z(){return{depth:P(`Snapshot traversal depth.`,{min:0}),scope:M(`Snapshot scope selector used before resolution.`),raw:F(`Use raw snapshot data during selector resolution.`)}}function Hr(){return{count:P(`Number of press/click repetitions.`,{min:1}),intervalMs:P(`Delay between repeated press/click actions.`,{min:0}),holdMs:P(`Hold duration for each action.`,{min:0}),jitterPx:P(`Deterministic per-axis coordinate jitter in pixels (each press offsets x and y by up to this amount).`,{min:0}),doubleTap:F(`Request a double-tap action.`)}}function Ur(){return{postGestureStabilization:Mr(I(`postGestureStabilization`),{operatorConfig:!0})}}function Wr(){return{osVersion:Gr(`osVersion`),imageTag:Gr(`imageTag`),deviceMode:Gr(`deviceMode`),deviceBaseline:Gr(`deviceBaseline`),physical:Gr(`physical`)}}function Gr(e){return Rr(I(e).schema,t=>Ce({[e]:t[e]}).spec[e])}function Kr(e){return Er(Zr(e),$r(e),Qr(e))}function B(e,t){let r=Sn(e),i=Object.fromEntries(Object.entries(t).flatMap(([e,t])=>{let i=t.read(r,e);if(t.required&&i===void 0)throw new n(`INVALID_ARGS`,`Expected ${e} to be set.`);return i===void 0?[]:[[e,i]]})),a=Ln(r,{readTargetAlias:!Object.hasOwn(t,`target`)});return m({...a,...g(a),...i})}function qr(e,t){let n=Cn(e,t);return{x:Tn(n,`x`),y:Tn(n,`y`)}}function Jr(e){return{count:e.count,intervalMs:e.intervalMs,holdMs:e.holdMs,jitterPx:e.jitterPx,doubleTap:e.doubleTap}}function Yr(e){return{depth:e.depth,scope:e.scope,raw:e.raw}}function V(e,t){return{schema:e,required:!1,read:t}}function Xr(e,t){return{...kr(e),...t.min===void 0?{}:{minimum:t.min},...t.max===void 0?{}:{maximum:t.max}}}function Zr(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e.audience?.kind!==`retired`).map(([e,t])=>[e,t.schema]))}function Qr(e){return new Set(Object.entries(e).flatMap(([e,t])=>t.audience?.kind===`retired`?[e]:[]))}function $r(e){return Object.entries(e).flatMap(([e,t])=>t.required?[e]:[])}function ei(e){return Object.fromEntries(Object.entries(e).flatMap(([e,t])=>t.audience?[[e,t.audience]]:[]))}const ti={ref:`@e12`},ni=`{"ref":"@e12"}`,ri=String.raw`{"selector":"id=\"submit\""}`,ii=`${ni} or ${ri}`,ai=`${ni}, ${ri}, or {"x":120,"y":340}`;function oi(){return ci(ii,`ref or selector`)}function si(){return{...ci(ai,`ref, selector, or x+y`),x:N(`Screen x coordinate, with y. Pass exactly one of ref, selector, or x+y; use x+y only when no ref or selector is available.`),y:N(`Screen y coordinate, with x. Pass exactly one of ref, selector, or x+y.`)}}function ci(e,t){return{ref:M(`Snapshot element ref such as @e12. Pass exactly one of ${t}.`),label:M(`Optional human label for ref.`),selector:M(`Selector expression such as id="submit" or label="Sign in". Pass exactly one of ${t}.`),target:jr(`target was removed; pass the UI target at the top level: ${e}.`),kind:jr(`kind was removed; the key you pass picks the UI target: ${e}.`)}}function li(e,t){let{ref:r,label:i,selector:a,x:o,y:s,...c}=B(e,t),ee=[r===void 0?[]:[`ref`],a===void 0?[]:[`selector`],o===void 0&&s===void 0?[]:[`x/y`]].flat();if(ee.length!==1){let e=`x`in t?ai:ii;throw new n(`INVALID_ARGS`,ee.length===0?`Expected a UI target.`:`Expected one UI target, got ${ee.join(` and `)}.`,{hint:`Pass exactly one of: ${e}.`})}if(i!==void 0&&r===void 0)throw new n(`INVALID_ARGS`,`label applies only with ref.`,{hint:`Pass label together with ref, for example {"ref":"@e12","label":"Sign in"}.`});if(ee[0]===`x/y`&&(o===void 0||s===void 0))throw new n(`INVALID_ARGS`,`Expected x and y together.`,{hint:`Pass both screen coordinates, for example {"x":120,"y":340}.`});let te=H({ref:r,label:i,selector:a,x:o,y:s});return{...c,...te}}function H(e){return e.ref===void 0?e.selector===void 0?{x:e.x,y:e.y}:{selector:e.selector}:m({ref:e.ref,label:e.label})}function U(e,t,n,r){return Sr({name:e,description:t,inputSchema:Kr(n),readInput:r?.readInput??(e=>B(e,n)),inputAudience:ei(n),...r?.parseableOutput?{parseableOutput:!0}:{},...r?.inputExample?{inputExample:r.inputExample}:{}})}function W(e){let t=br(e.text,e.metadata.description),n=t.mcpDetail?{mcpDetail:t.mcpDetail}:{},r={...e.metadata,...n},i={name:r.name,description:r.description,inputSchema:r.inputSchema,...n,invoke:async(t,n)=>await e.run(t,r.readInput(n))};return{name:e.name,metadata:r,definition:i,cliSchema:{...e.cliSchema,text:t},cliReader:e.cliReader,daemonWriter:e.daemonWriter,text:t}}function ui(e){return W({name:e.name,text:e.text,metadata:U(e.name,e.description,{}),run:e.run,cliSchema:{},cliReader:(e,t)=>y(t),daemonWriter:_(e.name)})}function G(e){let t={},n={},r={};for(let i of e.commands)di(t,`CLI schema`,i.name,i.cliSchema),di(n,`CLI reader`,i.name,i.cliReader),i.daemonWriter&&di(r,`daemon writer`,i.name,i.daemonWriter);return{name:e.name,clientSurface:e.clientSurface,metadata:e.commands.map(e=>e.metadata),definitions:e.commands.map(e=>e.definition),cliSchemas:t,cliReaders:n,daemonWriters:r}}function di(e,t,n,r){if(Object.hasOwn(e,n))throw Error(`Duplicate command family ${t}: ${n}`);e[n]=r}function fi(e=Ie){let t=pi(e);return U(`batch`,`Execute multiple commands in one daemon request.`,t,{readInput:e=>hi(e,t),...e.includes(`snapshot`)?{inputExample:{steps:[{command:`snapshot`,input:{interactiveOnly:!0}}]}}:{}})}function pi(e){return{steps:j(Rr({type:`array`,description:`Structured batch steps. Each step uses a command name and the same input object as that command tool.`,items:mi(e)},(t,n)=>gi(t[n],e))),onError:L([`stop`],`Batch failure policy.`),maxSteps:P(`Maximum number of steps accepted for this batch.`,{min:1,max:1e3}),out:M(`Optional output path for command artifacts.`)}}function mi(e){return{type:`object`,properties:{command:{type:`string`,enum:e,description:`Command name to run with structured input.`},input:{type:`object`,additionalProperties:!0,commandInputFor:`command`,description:`Structured command input for the nested command. Use the matching MCP tool schema for this object.`},runtime:{type:`object`,additionalProperties:!0,description:`Optional per-step runtime payload.`}},required:[`command`,`input`],additionalProperties:!1}}function hi(e,t){let r=B(e,t),i=r.maxSteps??100;if(!ge(i))throw new n(`INVALID_ARGS`,`Invalid batch maxSteps: ${String(r.maxSteps)}`);return me(r.steps.length,i),{...r}}function gi(e,t){if(!Array.isArray(e))throw new n(`INVALID_ARGS`,`Expected steps to be an array.`);return e.map((e,n)=>_i(e,n+1,t))}function _i(e,t,n){let r=he(e,t);return An(r,[`command`,`input`,`runtime`],`Batch step ${t}`,le),{command:vi(r,t,n),input:de(r,t),...yi(r,t)}}function vi(e,t,r){if(r===Ie)return Ve(e.command,t);let i=e.command;if(typeof i!=`string`||!r.includes(i))throw new n(`INVALID_ARGS`,`Expected command to be one of: ${r.join(`, `)}.`);return i}function yi(e,t){let n=ue(e.runtime,t);return n===void 0?{}:{runtime:n}}const bi=fi(),xi={usageOverride:`batch [--steps <json> | --steps-file <path>]`,usageFlags:[],listUsageOverride:`batch --steps <json> | --steps-file <path>`,allowedFlags:[`steps`,`stepsFile`,`batchOnError`,`batchMaxSteps`,`out`]},Si=(e,t)=>({...y(t),steps:t.batchSteps??[],onError:t.batchOnError,maxSteps:t.batchMaxSteps,out:t.out}),Ci=[{command:`snapshot`,input:{interactiveOnly:!0}},{command:`press`,input:{ref:`@e12`,settle:!0}},{command:`fill`,input:{selector:`id="field-email"`,text:`qa@example.com`}}];function wi(){return`${[`Each step is {"command":"<name>","input":{...}}, and input is that command's structured input object rather than its terminal spelling: a CLI positional becomes a named field (for example ref, label, selector, x, y, text, direction) and a CLI flag becomes a camelCase key (--settle -> "settle":true, -i -> "interactiveOnly":true). There is no positional step form; args, argv, positionals, and flags are not step fields. agent-device help <command> lists arguments in CLI spelling only. The examples below carry the structured spelling; over MCP, the command tool schema states it in full.`,`Steps run serially in one daemon request against the same session, in order. Mutating UI verbs are included (press, click, fill, longpress, scroll, back), which is where the round-trip saving is; --on-error stop halts at the first failing step.`,`The whole batch has a 60-second work budget inside a 90-second client timeout. The running step receives ordinary request cancellation at the budget. When it settles, failure returns COMMAND_FAILED with details.reason daemon_request_timeout and preserves executed, partialResults, and dispatch status. The daemon and other sessions stay available if it responds; a close step may already have ended its session. A completed batch returns success even if it settles just after the deadline. Cancellation does not prove native device work stopped. A step that ignores cancellation beyond the 30-second margin may cause a transport timeout; an unresponsive daemon retains the client liveness-based reset. Split longer sequences into separate requests.`,`Available through batch: ${[...Ie].sort().join(`, `)}.`,`Every other command is excluded: batch and replay never nest, and session, daemon, connection, and host tooling commands own lifecycle a batch request cannot carry. Run those on their own.`].join(` `)}\n\nExamples:\n${[` agent-device batch --steps '${JSON.stringify(Ci)}'`,` agent-device batch --steps-file ./steps.json --json`].join(`
2
- `)}`}const Ti=G({name:`batch`,clientSurface:!1,commands:[W({name:`batch`,text:{summary:`Run multiple commands`,cliDetail:wi()},metadata:bi,run:(e,t)=>e.batch.run(Ei(t)),cliSchema:xi,cliReader:Si})]});function Ei(e){return{...g(e),steps:e.steps,onError:e.onError,maxSteps:e.maxSteps,out:e.out}}const Di=`alert`,Oi=W({name:Di,text:{summary:`Inspect, accept, or dismiss a platform alert`},metadata:U(Di,`Inspect, wait for, accept, or dismiss a platform alert. Use get before acting when the alert content matters; accept and dismiss change the active alert state. Each iOS XCTest execution activates once, then only observes. Apple XCTest and Limrun iOS choose recognized English labels by preference (Allow While Using App before Allow Once); on iOS simulators, including Limrun, the runner also recognizes the device's preferred languages' wording of those labels from the OS permission-prompt strings, on any alert; equal-ranked choices and unknown labels refuse, including a lone unknown button. Open, Done, and Confirm… accept; Keep Browsing, Deny, and Skip dismiss. On the Apple XCUITest runner, dismiss taps only a recognized decline label (Cancel, Don't Allow, Ask App Not to Track, and similar) or the close element of a popover whose accessibility marker reads exactly "dismiss popup"; when no button fits the action, accept and dismiss answer ALERT_BUTTON_NOT_FOUND having tapped nothing — read labels with alert get, then press the button by label. Inspect again after an unconfirmed action; never assume a timeout means nothing happened.`,{action:L(kt),timeoutMs:P()}),run:(e,t)=>e.command.alert(t),cliSchema:{usageOverride:`alert [get|accept|dismiss|wait] [timeout]`,positionalArgs:[`action?`,`timeout?`]},cliReader:(e,t)=>({...y(t),...Ai(e)}),daemonWriter:_(u.alert,e=>ki(e))});function ki(e){return[e.action??`get`,...x(e.timeoutMs)]}function Ai(e){if(e.length>2)throw new n(`INVALID_ARGS`,`alert accepts at most action and timeout arguments.`);return m({action:ji(e[0]),timeoutMs:ar(e[1],`alert timeout`)})}function ji(e){if(e===void 0)return;let t=Ot(e);if(t)return t;throw new n(`INVALID_ARGS`,`alert action must be get, accept, dismiss, or wait.`)}function K(...e){return e}const Mi=K(`keyframes`),Ni=K(`snapshotInteractiveOnly`,`snapshotDepth`,`snapshotScope`,`snapshotRaw`),q=K(`snapshotDepth`,`snapshotScope`,`snapshotRaw`),Pi=K(`metroProjectRoot`,`kind`,`metroKind`,`metroPublicBaseUrl`,`metroProxyBaseUrl`,`metroBearerToken`,`metroPreparePort`,`metroListenHost`,`metroStatusHost`,`metroStartupTimeoutMs`,`metroProbeTimeoutMs`,`metroRuntimeFile`,`metroNoReuseExisting`,`metroNoInstallDeps`),Fi=K(`metroHost`,`metroPort`,`bundleUrl`),Ii=K(`osVersion`,`imageTag`,`deviceMode`,`deviceBaseline`,`physical`),Li=K(`count`,`intervalMs`,`holdMs`,`jitterPx`,`doubleTap`),Ri=K(`settle`,`settleQuietMs`,`timeoutMs`),zi=K(`replayUpdate`,`replayEnv`),Bi=K(`remoteConfig`,`stateDir`,`daemonBaseUrl`,`daemonAuthToken`,`daemonTransport`,`daemonServerMode`,`tenant`,`sessionIsolation`,`runId`,`leaseId`,`leaseBackend`,`sessionLock`,`platform`,`target`,`device`,`providerApp`,`providerOsVersion`,`providerDeviceType`,`providerProject`,`providerBuild`,`providerSessionName`,`providerDeviceOrientation`,`providerGeoLocation`,`providerTimezone`,`providerAppiumVersion`,`providerLanguage`,`providerLocale`,`providerNetworkProfile`,`providerCustomNetwork`,`providerNoResignApp`,`providerNetworkLogs`,`providerNetworkHosts`,`awsProjectArn`,`awsDeviceArn`,`awsAppArn`,`awsRegion`,`awsInteractionMode`,`udid`,`serial`,`iosSimulatorDeviceSet`,`iosXctestrunFile`,`iosXctestDerivedDataPath`,`iosXctestEnvDir`,`androidDeviceAllowlist`,`session`,`noRecord`),Vi=new Set([`platform`,`device`,`udid`,`serial`,`session`]),Hi=new Set([`json`,`config`,`help`,`version`,`verbose`,`cost`,`responseLevel`]),Ui=`diff`,Wi={diff:w({mode:E(`snapshot`),baselineInitialized:k(),summary:w({additions:O(),removals:O(),unchanged:O()},[`additions`,`removals`,`unchanged`]),lines:{type:`array`,items:w({kind:T([`added`,`removed`,`unchanged`]),text:D(),ref:D()},[`kind`,`text`])},warnings:Ar()},[`mode`,`baselineInitialized`,`summary`,`lines`])},Gi=W({name:Ui,text:{summary:`Diff snapshot or screenshot`,cliDetail:`Screenshot --threshold is a per-pixel RGB tolerance: 0 requires exact colors and 1 ignores color differences; the current image scales proportionally to the baseline width and aligns top-left. Scaled height rounds to the nearest pixel (minimum 1). Extra or missing bottom rows always count as differences, even at threshold 1. The originals remain unchanged. When dimensions differ, normalization metadata reports original, scaled and compared sizes; region coordinates use comparison pixels. Both screenshot inputs are decoded from their bytes, so a baseline or current image may be PNG or JPEG, and the diff image is always PNG. JPEG is lossy, so keep --threshold above 0 whenever either input is JPEG. Live iOS simulator screenshot diffs normalize status-bar chrome by default; use screenshot --normalize-status-bar when capturing reusable baselines. Use --screen-mask black for a live iOS simulator capture with a black screen outline, and use the same option when creating its baseline. --screen-mask is refused when current.png is supplied; saved images are compared unchanged.`},metadata:U(Ui,`Compare accessibility snapshots or screenshots to identify UI changes. Use snapshot comparisons for semantic tree changes and screenshot comparisons for pixel differences.`,{kind:j(R({type:`string`,const:`snapshot`})),out:M(),interactiveOnly:F(),depth:P(),scope:M(),raw:F()}),run:(e,t)=>e.capture.diff(t),cliSchema:{usageOverride:`diff snapshot | diff screenshot --baseline <path> [current.png] [--out <diff.png>] [--threshold <0-1>] [--overlay-refs] [--screen-mask <black>]`,usageFlags:[],positionalArgs:[`kind`,`current?`],flagsByAction:{snapshot:[],screenshot:[`screenshotScreenMask`]},allowedFlags:[...Ni,`baseline`,`threshold`,`out`,`overlayRefs`,`screenshotScreenMask`]},cliReader:(e,t)=>{if(e[0]!==`snapshot`)throw new n(`INVALID_ARGS`,`Only diff snapshot is available through this parser.`);return{...y(t),kind:`snapshot`,out:t.out,interactiveOnly:t.snapshotInteractiveOnly,depth:t.snapshotDepth,scope:t.snapshotScope,raw:t.snapshotRaw}},daemonWriter:_(u.diff,e=>[C(e.kind,`diff requires kind`)])}),Ki=`screenshot`,qi=W({name:Ki,text:{summary:`Capture a screenshot`,cliDetail:`Web defaults to the viewport; use --fullscreen, --full, or -f for the entire page. iOS simulators default to 1x logical-point output; use --pixel-density to request a different screenshot density. Use --screen-mask black to fill the iOS simulator screen outline, including rounded corners, with black for this capture. It requires simctl: physical devices, tvOS and visionOS simulators, other platforms, provider captures and XCTest runner captures are refused. A masked capture fails if simctl fails instead of falling back to an unmasked runner capture. macOS app sessions default to the app window; use --fullscreen for full desktop, --scale to downscale, --crop-on <selector> to crop the capture to the frame the selector resolves on the same screen (currently iOS simulators, Android emulators, and CoreDevice physical iPhones), --overlay-refs to annotate current refs, --normalize-status-bar for deterministic iOS simulator or Android chrome. Physical iPhone crop verification covers portrait CoreDevice/devicectl captures only. XCTest, runner fallback, and physical iPad crops are refused; landscape iPhone crop is unverified. Android captures immediately by default; --normalize-status-bar also waits for transient UI to fade, and --no-stabilize keeps capture immediate. With the native macOS backend, the front window is the app's frontmost visible, nonempty normal-level (layer-0) window on the current Space: floating palettes and app-modal alerts at window level 8 are skipped, as is the small indicator window macOS adds in front of a window that a screen-sharing stream captures, and a sheet is captured as its own window. On macOS, any --surface other than app (desktop, menubar, frontmost-app) always captures the main display and refuses an explicit --fullscreen. On single-display iOS simulators and Android devices, the result reports displayRotation, the rotation the display rendered the capture in, when the device returns a reading in time; otherwise the field is absent. On iOS simulators a screenshot waits for that simulator's status bar to be free, and a request its caller cancelled while it waits reports the cancellation instead of capturing.`},metadata:U(Ki,`Capture a screenshot of the active app or web session. Choose the capture scope, density, size, or annotations through the corresponding input fields when needed.`,{path:M(`Output path.`),cropOn:M(`Selector expression; the capture is cropped to the frame the selector resolves on the same screen.`),overlayRefs:F(),pixelDensity:P(`Output screenshot pixel density in pixels per logical point.`,{min:1}),screenMask:L(ae,`Fill the iOS simulator screen outline with black for this capture. Requires simctl; omit for the default image.`),fullscreen:F(),scale:N(`Screenshot scale factor.`,ne),maxSize:jr(oe.migration.screenshot),stabilize:F(),normalizeStatusBar:F(),captureBackend:L(te,`Capture through the XCTest runner instead of the platform default, which leaves out the simulator-drawn Dynamic Island. Local Apple targets only; refused on provider sessions and on a macOS surface the helper captures, and with pixelDensity, screenMask or normalizeStatusBar.`),surface:L(pt)}),run:(e,t)=>e.capture.screenshot(t),cliSchema:{positionalArgs:[`path?`],allowedFlags:ie},cliReader:(e,t)=>({...y(t),path:e[0]??t.out,...c(t)}),daemonWriter:e=>(s(`screenshot`,e),se(e),v(u.screenshot,b(e.path),{...e,...ee(e)}))}),Ji=`settings`,Yi=U(Ji,`Read or change supported operating-system settings, animation scales, appearance, or app permissions on the selected target. Platform support varies by setting and action.`,{setting:j(L(Ft)),state:M(),app:M("App the change targets, by bundle id, package name, or app name: the app `clear-app-state` clears, or the app a `permission` change (or an iOS-simulator `location on|off` privacy change) lands on. A name resolves to the installed app as `open` resolves it: an iOS simulator, local or Limrun, matches display names and accepts only an installed bundle id, and Android accepts only an installed package and refuses a name that resolves to an intent with `setting_app_not_package`. One that resolves to nothing is refused with `app_not_installed` before anything changes. The app need not be running. Without it the session app is used; a device-wide change (`location set` on any target, the Android `location on|off` toggle, `mobile-data`, macOS permissions) refuses one with `setting_app_not_consumed`. The CLI reads it only from this invocation, never from `AGENT_DEVICE_TARGET_APP` or config `targetApp`."),latitude:N(),longitude:N(),permission:M(),mode:L([...Nt])}),Xi={usageOverride:Mt,listUsageOverride:`settings [area] [options]`,positionalArgs:[`setting`,`state?`,`target?`,`mode?`],allowedFlags:[`targetApp`],explicitOnlyFlags:[`targetApp`]},Zi=(e,t)=>{let n=Un(t),r=Re(e);if(r.kind===`read`)return{...n,setting:r.setting};let i=jt(e),a=Pt(i.setting)?.app===`positional`?ta(i.setting,i.app,t):t.targetApp;return{...n,setting:i.setting,state:i.state,...i.permission===void 0?{}:{permission:i.permission},...i.mode===void 0?{}:{mode:i.mode},...i.latitude===void 0?{}:{latitude:It(i.latitude,`latitude`),longitude:It(i.longitude,`longitude`)},...a===void 0?{}:{app:a}}},Qi=e=>{let t=e,n=m({app:$i(t)});return v(u.settings,na(t),e,Object.keys(n).length===0?void 0:n)};function $i(e){return Pt(e.setting)?.app===`input`&&`app`in e?e.app:void 0}const ea=W({name:Ji,text:{summary:`Change OS settings and app permissions`,cliDetail:[`A bare readable setting reads the value the target holds. A target that does not serve a setting refuses it with UNSUPPORTED_OPERATION before anything changes.`,``,`On an iOS simulator, settings wifi and settings airplane wait for screenshots and other status bar writes. The request timeout includes this wait (90 seconds for a standalone CLI request). Once the write starts, its status bar command has a separate 10-second timeout. A request or write that times out may already have changed the bar; check the bar before relying on it. Cancelling while still queued guarantees nothing was written.`,``,`Settings:`,...At().map(e=>` ${e}`)].join(`
3
- `)},metadata:Yi,run:(e,t)=>e.settings.update(t),cliSchema:Xi,cliReader:Zi,daemonWriter:Qi});function ta(e,t,r){let i=r.targetApp;if(t!==void 0&&i!==void 0&&t!==i)throw new n(`INVALID_ARGS`,`settings ${e} names two apps: ${t} and ${i}. Name one.`);return t??i}function na(e){return Pt(e.setting)?.app===`positional`?[e.setting,...b(`app`in e?e.app:void 0)]:e.state===void 0?[e.setting]:`latitude`in e?[e.setting,e.state,String(e.latitude),String(e.longitude)]:`permission`in e?[e.setting,e.state,e.permission,...b(e.mode)]:[e.setting,e.state]}const ra=`snapshot`,ia=Object.entries(Lt).map(([e,t])=>{let n=t.knownGaps.map(e=>`known gap ${e}`);return`${e}: hittable=${t.hittable}, regular-depth=${t.regularDepth}, deep-extension=${t.deepExtension}, depth-ladder=${t.depthLadder}${n.length>0?`, ${n.join(`, `)}`:``}`}).join(`; `),aa=U(ra,`Capture the accessibility tree or compare it with the previous session baseline. Use the returned refs for subsequent semantic interactions and the diff option to verify UI changes.`,{interactiveOnly:F(),depth:P(),scope:M(),raw:F(),customActions:I(`snapshotCustomActions`),observeOnly:I(`snapshotObserveOnly`),forceFull:F(),timeoutMs:P(`Maximum wall-clock time for the snapshot command.`),noRecord:F(`Do not record this action.`),record:F(`Force-record this out-of-band observation into a repair-armed heal (mutually exclusive with noRecord). Authored replay steps are recorded automatically and never need this.`)}),oa={allowedFlags:[`snapshotDiff`,...Ni,`snapshotCustomActions`,`snapshotObserveOnly`,`snapshotForceFull`,`timeoutMs`,`record`]},sa=(e,t)=>({...y(t),...Hn(t),...i(t,o),timeoutMs:t.timeoutMs}),ca=_(u.snapshot),la=W({name:ra,text:{summary:`Capture or diff the accessibility tree`,cliDetail:`Scoped output (--scope) renders every returned ref with its ref generation pin (@eN~s<refsGeneration>) and one Refs generation line, so a pasted ref targets the ref frame that issued it; --json keeps plain refs plus the response-level refsGeneration, and --raw keeps byte-for-byte output. Regular Android ADB snapshots clip app rectangles outside measured status and navigation bars, including launcher-owned navigation; fully covered content is omitted and --raw retains reported bounds. Ref and selector taps honor measured visible bounds even for refs from raw snapshots. Regular iOS snapshots clip overflowing elements to their visible area and omit fully outside elements. In a regular (non-raw) snapshot, a listed element whose frame has no area is marked [unmeasured]: nothing confirms it is on screen. If it is inside scrollable content, reach it with scroll <direction> --until <selector> before acting on it. --json reports clipping counts in snapshotQualityNotes with code regular-geometry-clipped; --raw retains reported frames. --observe-only is local iOS snapshot-only: an already-ready compatible runner reads the session app without activation or foreground repair, refuses unavailable observation or a readable system alert over the app, and reports XCUIApplication state rather than verified foreground ownership (#2696). Regular targetActivation disclosure stays unchanged (#2682, #2694). Repeated equivalent unfiltered Android snapshots return a compact unchanged acknowledgement. Use --force-full to re-emit the tree; --json and --raw retain full output. Android Appium JSON snapshots publish a display viewport only when measurements before and after the tree agree, independent of tree extent or keyboard content resizing. On Android, JSON value carries field content rather than static labels; saved selectors and replay scripts using value= for static labels must use label= instead; a reported showing hint means value is empty, and text equal to the placeholder is preserved when hint state is unknown. HarmonyOS reads the on-screen keyboard's own system window and publishes the keyboard field of --json output: the field is visibility-only — visible or hidden per the keyboard window's z-order column; a failed probe, an unreadable or conflicting z-order, or a table without the panel publishes unmeasurable, never a guessed band. When an iOS snapshot reports a screen viewport, inspect rects with snapshot -i --json and press the intended control's center, then verify with diff snapshot -i or snapshot --diff. When a fallback cannot establish the screen origin, viewport is omitted and coordinate-derived element actions refuse with window-origin-unknown before input; the snapshot may warn about the unavailable origin. Use a plain screenshot to choose screen coordinates. An empty text field with no label or value prints its hint as [placeholder:"..."]; label=, text= and find do not match that hint. iOS backend capability contract: ${ia}.`},metadata:aa,run:(e,t)=>e.capture.snapshot(t),cliSchema:oa,cliReader:sa,daemonWriter:ca}),ua=[`duration`,`text`,`ref`,`selector`,`absent`,`stable`],da=`wait`,fa={wait:w({waitedMs:O(),kind:E(`selector`),text:D(),selector:D(),captures:O(),nodeCount:O(),hint:D(),warning:D()},[`waitedMs`])},pa=W({name:da,text:{summary:`Wait for a duration, text, selector, strict absence, or stable UI`},metadata:U(da,`Wait for a duration, text, snapshot ref, selector to appear, selector to be strictly absent, or stable UI. Text matches a label, identifier, or value; an editable field never matches by its current value or by a label that only repeats it, so text you typed does not satisfy it. Use the strict absence target when zero selector matches are required; stable waits until the UI stays quiet for the requested window.`,{kind:L(ua),durationMs:P(),text:M(),ref:M(),selector:M(),absent:M(),stable:F(),quietMs:P(),timeoutMs:P(),depth:P(),scope:M(),raw:F()}),run:(e,t)=>e.command.wait(ma(t)),cliSchema:{usageOverride:`wait <ms>|text <text>|@ref|<selector>|absent <selector> [timeoutMs]|stable [quietMs] [timeoutMs]`,usageFlags:[],positionalArgs:[`durationOrSelector`,`timeoutMs?`],allowsExtraPositionals:!0,allowedFlags:[...q]},cliReader:(e,t)=>ha(e,t),daemonWriter:_(u.wait,e=>va(e))});function ma(e){Dn(e,`kind`,ua);let t={...e};return delete t.kind,t}function ha(e,t){let r=Ne(e);if(!r)throw new n(`INVALID_ARGS`,`wait requires <ms>, text <text>, @ref, <selector> [timeoutMs], absent <selector> [timeoutMs], or stable [quietMs] [timeoutMs].`);let i={...Un(t),...Gn(t)};switch(r.kind){case`absent`:return ga(i,r);case`sleep`:return{...i,durationMs:r.durationMs};case`text`:return _a(i,r);case`ref`:return{...i,ref:r.rawRef,...ya(r.timeoutMs)};case`stable`:return{...i,stable:!0,...ba(r.quietMs),...ya(r.timeoutMs)};case`invalid`:throw new n(`INVALID_ARGS`,r.message);case`selector`:return{...i,selector:r.selectorExpression,...ya(r.timeoutMs)};default:return xa(r)}}function ga(e,t){let n=Rt(e);if(n)throw zt(n,`wait`);return{...e,absent:t.selectorExpression,...ya(t.timeoutMs)}}function _a(e,t){if(!t.text)throw new n(`INVALID_ARGS`,`wait requires text.`);return{...e,text:t.text,...ya(t.timeoutMs)}}function va(e){if([e.durationMs===void 0?void 0:`durationMs`,e.text===void 0?void 0:`text`,e.ref===void 0?void 0:`ref`,e.selector===void 0?void 0:`selector`,e.absent===void 0?void 0:`absent`,e.stable===void 0?void 0:`stable`].filter(Boolean).length!==1)throw new n(`INVALID_ARGS`,`wait command requires exactly one of durationMs, text, ref, selector, absent, or stable.`);if(e.durationMs!==void 0)return[String(e.durationMs)];let t=x(e.timeoutMs);if(e.text!==void 0)return[`text`,e.text,...t];if(e.ref!==void 0)return[e.ref,...t];if(e.absent!==void 0){let r=Rt(e);if(r)throw zt(r,`wait`);if(!De(e.absent))throw new n(`INVALID_ARGS`,`Invalid wait absent selector: ${e.absent}`);return[`absent`,e.absent,...t]}if(e.stable!==void 0){let r=x(e.quietMs);if(r.length===0&&t.length>0)throw new n(`INVALID_ARGS`,`wait stable requires quietMs before timeoutMs.`);return[`stable`,...r,...t]}let r=e.selector;if(!De(r))throw new n(`INVALID_ARGS`,`Invalid wait selector: ${r}`);return[r,...t]}function ya(e){return e===null?{}:{timeoutMs:e}}function ba(e){return e===null?{}:{quietMs:e}}function xa(e){throw Error(`Unsupported wait positional target: ${String(e)}`)}const Sa=G({name:`capture`,commands:[la,qi,Gi,pa,Oi,ea]}),Ca=`debug`,wa=G({name:`debugging`,commands:[W({name:Ca,text:{summary:`Symbolicate Apple crash artifacts`},metadata:U(Ca,`Symbolicate Apple crash artifacts with matching dSYM UUIDs. This debug namespace is intentionally narrow: use logs for app logs, network for HTTP evidence, perf for performance samples, record/trace for media and traces, and react-devtools for React Native components and render profiles.`,{action:j(L([`symbols`])),artifact:j(M(`Apple crash artifact path (.ips, .crash, or .log).`)),dsym:M(`Path to a matching .dSYM bundle.`),searchPath:M(`Directory to scan for matching .dSYM bundles.`),out:M(`Output path for the symbolicated artifact.`)}),run:(e,t)=>e.debug.symbols(t),cliSchema:{usageOverride:`debug symbols --artifact <crash.ips|crash.log> (--dsym <App.dSYM> | --search-path <dir>) [--out <symbolicated>]`,usageFlags:[],listUsageOverride:`debug`,positionalArgs:[`symbols`],allowedFlags:[`artifact`,`dsym`,`searchPath`,`out`]},cliReader:(e,t)=>({...y(t),action:Ta(e[0]),artifact:t.artifact,dsym:t.dsym,searchPath:t.searchPath,out:t.out})})]});function Ta(e){if(e===`symbols`)return e;throw new n(`INVALID_ARGS`,`debug supports only symbols; use logs, network, perf, record, trace, or react-devtools for other diagnostics`)}const Ea=()=>F(`Capture cheap post-action evidence (AX digest, node counts, changedFromBefore) instead of a follow-up snapshot.`),Da=()=>({settle:F(`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.`),settleQuietMs:P(`Settle: quiet window in milliseconds (default 500; 300 on the iOS simulator snapshot bridge). On iOS, a broad replacement of a non-empty screen holds at least 1500ms within timeoutMs.`,{min:0}),timeoutMs:P(`Settle: wait deadline in milliseconds (default 10000).`,{min:1})});function J(e){return{...Le(e)?{verify:Ea()}:{},...ze(e)?Da():{}}}function Y(e){let t=[];return Le(e)&&t.push(`verify`),ze(e)&&t.push(...Ri),t}function Oa(e,t){return ze(e)?Kn(t):{}}const ka=[`click`,`focus`,`exists`,`list`,`getText`,`getAttrs`,`wait`,`fill`,`type`],Aa={click:`Activate a UI target by snapshot ref, selector, or coordinates. Prefer a ref or selector after a snapshot; use coordinates only when semantic targeting is unavailable. This can change app state. Success means the click was dispatched, not that it landed: use settle or verify to confirm the result without a follow-up snapshot, or wait for the expected screen. A ref or selector target is re-checked for motion before dispatch when the session's previous action just animated the screen, and is dispatched at its resting position; one that has not stopped refuses with target_still_moving rather than acting where it was.`,press:`Short-press a UI target by snapshot ref, selector, or coordinates. Use longpress instead when the target requires a context-menu or hold gesture. Success means the press was dispatched, not that it landed: use settle or verify to confirm the result, or wait for the expected screen. A ref or selector target is re-checked for motion before dispatch when the session's previous action just animated the screen, and is dispatched at its resting position; one that has not stopped refuses with target_still_moving rather than acting where it was.`,fill:`Replace text in a UI input selected by snapshot ref, selector, or coordinates. Pass an empty text to clear the field. Inspect unconfirmed evidence and assert the expected value or resulting screen before continuing. Prefer refs or selectors after snapshot; use recordAs to keep sensitive text out of a recorded replay while sending it to the live app.`,longpress:`Hold a UI target by snapshot ref, selector, or coordinates to open a context menu or perform another hold gesture. Set durationMs when the default hold duration is unsuitable.`,hover:`Move the pointer over a UI target by snapshot ref, selector, or coordinates without pressing, to reveal hover-gated UI such as row toolbars or menus. Web only; touch platforms have no hover state. Use settle to observe what the hover revealed without a follow-up snapshot.`,swipe:`Quick coordinate fling with optional repeat pattern.`,focus:`Move input focus to explicit screen coordinates without entering text. Prefer semantic interactions when a snapshot ref or selector is available; use type or fill after focus.`,type:`Append text to the currently focused input. Use fill when the existing field value should be replaced, and focus first when no input is active.`,scroll:`Scroll in a direction, or toward the top/bottom edge of scrollable content. Set until to a selector to reach an off-screen target in one command rather than a scroll-and-check loop. The optional amount is the finger-path fraction of the viewport axis, honored up to 0.8 of it; directional scrolls reduce release momentum, while app scroll physics determine the final content offset. A visible keyboard shortens the swiped band instead of being dismissed; when too little is left, the command refuses with scroll_keyboard_occludes_surface. A directional scroll also reports the movement it observed as movement: moved, at-edge, unchanged, or unobserved when the two reads could not back a claim either way; an unchanged surface inside a container that still hides content in that direction refuses with scroll_no_progress rather than repeating the requested distance. The movement field is absent where a tier verifies per pass (top/bottom, until), where the runtime cannot read a screen, where a settle observation or a replay already owns that observation, or where the operator opted out of it.`,get:`Read text or accessibility attributes from a snapshot ref or selector without changing the app. Use format text for visible content or attrs for the element attribute map.`,is:"Check whether a selector satisfies a UI predicate such as visible, hidden, exists, absent, editable, selected, focused, or text. `absent` passes only when one readable, complete, settled, unscoped, full-depth accessibility capture has zero matches. Use wait when the condition may appear asynchronously.",find:`Find by text/label/value/role/id and run action; the action defaults to click. The role locator matches snapshot kind vocabulary (button, text, text-field, switch, ...); pre-reconciliation leaf spellings (statictext, edittext, textview) stay accepted on the nodes that carried them during a deprecation window. The focus and type actions aim at a text field: the match or the field holding it, even beside other fields, or else the one enabled on-screen field inside the match. Several enabled on-screen fields inside the match refuse with AMBIGUOUS_MATCH and the field candidates, and a disabled target refuses with reason target_disabled. Web text boxes are not recognized as text fields.`,gesture:`Perform a structured pan, fling, swipe, pinch, rotate, transform, tap, or drag gesture. Select the gesture kind, then provide only the inputs that apply to that kind. A tap touches 2 to 5 points at once; repeat it with count and pauseMs.`},ja={...si(),button:L(Bt,`Pointer button for platforms that support mouse buttons.`),...z(),...Hr(),...J(`click`)},Ma={...si(),...z(),...Hr(),...J(`press`)},Na={...si(),text:j(M(`Text to enter into the target. Pass "" to clear it.`,{allowEmpty:!0})),delayMs:P(`Delay between typed characters.`,{min:0}),recordAs:M("When script recording is armed, send text to the live app but publish it as ${VAR}. Use an uppercase replay variable name such as PASSWORD."),textStdin:Mr(F(`Operator-only: text was read from the CLI's stdin, so it is kept out of diagnostics and recorded actions.`),{operatorPath:`Pass --text-stdin on the CLI and pipe the text in; it is not exposed to model-facing tools.`}),...z(),...J(`fill`)},Pa={...si(),durationMs:P(`Long press duration in milliseconds.`,{min:0}),...z(),...J(`longpress`)},Fa={...si(),...z(),...J(`hover`)},Ia={from:j(zr(`Swipe start point.`)),to:j(zr(`Swipe end point.`)),count:P(`Number of swipe repetitions.`,{min:1,max:200}),pauseMs:P(`Pause between repeated swipes.`,{min:0,max:Je}),pattern:L(Ke),...Ur()},La={x:j(N(`X coordinate.`)),y:j(N(`Y coordinate.`))},Ra={text:j(M(`Text to type.`)),delayMs:P(`Delay between typed characters.`,{min:0})},za={direction:j(L(Ye)),amount:N(`Platform scroll amount.`),pixels:P(`Pixel scroll amount.`,{min:0}),until:M(`Repeat scroll passes until this selector is visible on screen, then stop. Not valid with the top/bottom edge directions, which carry their own stop condition.`),maxPasses:P(`Maximum scroll gestures for an until search (default 12). Requires until.`,{min:1,max:200}),durationMs:P(`Scroll duration in milliseconds when the backend supports pacing.`,{min:0,max:Vt}),...J(`scroll`),...Ur()},Ba=()=>({noRecord:F(`Do not record this action.`),record:F(`Force-record this out-of-band observation into a repair-armed heal (mutually exclusive with noRecord). Authored replay steps are recorded automatically and never need this. On find, valid only for a read-only action.`)}),Va={format:j(L([`text`,`attrs`])),...oi(),...z(),...Ba()},Ha={predicate:j(L(ke)),selector:j(M()),value:M(),...z(),...Ba()},Ua={locator:L(Fe),query:j(M()),action:L(ka),value:M(void 0,{allowEmpty:!0}),timeoutMs:P(),first:F(),last:F(),depth:P(),raw:F(),...Ba()},Wa={kind:j(L(rt,`Gesture variant.`)),direction:L(qe,`Fling direction.`),preset:L(Xe,`Swipe preset.`),...Ur(),origin:zr(`Gesture origin point.`),delta:zr(`Movement delta for pan or transform gestures.`),distance:P(`Fling distance.`,{min:0}),scale:N(`Pinch or transform scale.`),degrees:N(`Rotation in degrees.`),durationMs:P(`Pan/transform duration.`,{min:16,max:1e4}),pointerCount:P(`Pan touch pointer count (1 or 2).`,{min:1,max:2}),points:Br(`Tap contact points, held together for holdMs.`,{min:2,max:5}),holdMs:P(`Tap contact hold duration.`,{min:16,max:Ze}),count:P(`Tap repetitions; the same contacts run this many times.`,{min:1,max:200}),pauseMs:P(`Delay between tap repetitions, added to each repetition’s own time.`,{min:0,max:Je}),source:M(`Drag source @ref or selector.`),destination:M(`Drag destination @ref or selector.`),sourceHoldMs:P(`Drag activation hold duration.`,{min:1,max:1e4}),moveMs:P(`Drag movement duration.`,{min:16,max:1e4}),destinationHoldMs:P(`Hold before releasing at the destination.`,{min:0,max:1e4})},Ga=[Ja(`click`,ja),Ja(`press`,Ma),Ja(`fill`,Na),Ja(`longpress`,Pa),Ja(`hover`,Fa),Ya(`swipe`,Ia),Ya(`focus`,La),Ya(`type`,Ra),Ya(`scroll`,za),U(`get`,Aa.get,Va,{readInput:e=>li(e,Va),inputExample:ti,parseableOutput:!0}),Ya(`is`,Ha),Ya(`find`,Ua,{parseableOutput:!0}),U(`gesture`,Aa.gesture,Wa,{readInput:qa,inputExample:{kind:`pan`,origin:{x:200,y:400},delta:{x:0,y:-200}}})];function Ka(e){let t=Sn(e);return{...Ln(t),...nt(t)}}function qa(e){let t=Sn(e),n=Ka(t);return n.kind===`swipe`&&En(t,`postGestureStabilization`)===!1?{...n,postGestureStabilization:!1}:n}function Ja(e,t){return U(e,Aa[e],t,{readInput:e=>li(e,t),inputExample:ti})}function Ya(e,t,n){return U(e,Aa[e],t,n)}const Xa={gesture:Qa},Za={gesture:e=>{let t=Ka(e);return v(u.gesture,[],e,m(t))}};function Qa(e,t){return{...y(t),...$e(e,{pointerCount:t.pointerCount,holdMs:t.holdMs,count:t.count,pauseMs:t.pauseMs}),...e[0]===`swipe`&&t.postGestureStabilization===!1?{postGestureStabilization:!1}:{}}}const X={click:(e,t)=>({...y(t),...Wn(t),...qn(t),...Ht(e),button:t.clickButton,verify:t.verify}),press:(e,t)=>({...y(t),...Wn(t),...qn(t),...Ht(e),verify:t.verify}),longpress:(e,t)=>{let n=eo(e);return{...y(t),...Wn(t),...n}},hover:(e,t)=>({...y(t),...Wn(t),...Ht(e)}),swipe:(e,t)=>({...y(t),...et(e,{count:t.count,pauseMs:t.pauseMs,pattern:t.pattern}),postGestureStabilization:t.postGestureStabilization}),focus:(e,t)=>({...y(t),x:Number(e[0]),y:Number(e[1])}),type:(e,t)=>({...y(t),text:e.join(` `),delayMs:t.delayMs}),fill:(e,t)=>{let n=t.textStdin?$a(e):Ut(e);return{...y(t),...Wn(t),...n.target,text:n.text,delayMs:t.delayMs,recordAs:t.recordAs,textStdin:t.textStdin,verify:t.verify}},scroll:(e,t)=>({...y(t),direction:io(e[0]),amount:or(e[1]),pixels:t.pixels,durationMs:t.durationMs,until:t.until,maxPasses:t.maxPasses,postGestureStabilization:t.postGestureStabilization}),get:(e,t)=>({...y(t),...Hn(t),...Wn(t),format:er(e[0]),...$n(e.slice(1))})},Z={click:e=>v(u.click,Yn(e),{...e,clickButton:e.button}),press:_(u.press,e=>Yn(e)),longpress:_(u.longPress,e=>to(e)),hover:_(u.hover,e=>Yn(e)),swipe:e=>(Qe(e),v(u.swipe,[],e,{from:e.from,to:e.to,count:e.count,pauseMs:e.pauseMs,pattern:e.pattern})),focus:_(u.focus,e=>[String(e.x),String(e.y)]),type:_(u.type,e=>no(e)),fill:_(u.fill,e=>ro(e)),scroll:_(u.scroll,e=>[C(e.direction,`scroll requires direction`),...x(e.amount)]),get:_(u.get,e=>[C(e.format,`get requires format`),...Xn(e)])};function $a(e){let t;try{t=Ut(e)}catch(e){throw e instanceof n?new n(`INVALID_ARGS`,`fill --text-stdin could not read the target.`,{reason:`fill_text_stdin_target_invalid`,hint:`Pass only the target: an @ref, a quoted selector, or x y coordinates. The text itself goes to stdin.`}):e}if(t.text!==void 0)throw new n(`INVALID_ARGS`,`fill --text-stdin reads the text from stdin, so it cannot also take a text argument.`,{reason:`fill_text_source_conflict`,hint:`Pass only the target, for example: printf %s "$PASSWORD" | agent-device fill @e3 --text-stdin. Quote a multi-word selector so no part of it is read as text.`});return t}function eo(e){let t=ao(e);return{...Ht(t.target),...t.durationMs===void 0?{}:{durationMs:t.durationMs}}}function to(e){return[...Yn(e),...x(e.durationMs)]}function no(e){return[e.text]}function ro(e){return[...Yn(e),e.text]}function io(e){if(e===`up`||e===`down`||e===`left`||e===`right`||e===`top`||e===`bottom`)return e;throw new n(`INVALID_ARGS`,`Unknown direction: ${String(e)}`,{hint:`scroll takes a direction first, then an optional amount: scroll <up|down|left|right|top|bottom> [amount]. It takes no @ref or selector — scroll the whole viewport, then retry the target with a selector.`})}function ao(e){if(ir(e[0])&&ir(e[1]))return{target:e.slice(0,2),...e[2]===void 0?{}:{durationMs:Number(e[2])}};let t=e.at(-1);return e.length>1&&ir(t)?{target:e.slice(0,-1),durationMs:Number(t)}:{target:e}}const oo={find:(e,t)=>uo(e,t),is:(e,t)=>fo(e,t)},so={is:_(u.is,e=>co(e)),find:e=>v(u.find,lo(e),{...e,findFirst:e.first,findLast:e.last})};function co(e){return[e.predicate,e.selector,...e.predicate===`text`?[e.value]:[]]}function lo(e){let t=e.locator&&e.locator!==`any`?[e.locator,e.query]:[e.query];switch(e.action){case void 0:case`click`:case`focus`:case`exists`:case`list`:return e.action?[...t,e.action]:t;case`getText`:return[...t,`get`,`text`];case`getAttrs`:return[...t,`get`,`attrs`];case`wait`:return[...t,`wait`,...x(e.timeoutMs)];case`fill`:case`type`:return[...t,e.action,e.value]}}function uo(e,t){let r={...go(t),...Un(t),...Hn(t),first:t.findFirst,last:t.findLast},i=ho(e[0]),a=i!==void 0,o=a?e[1]:e[0],s=a?2:1,c=Be(e[s]);if(c===void 0)return{...r,locator:i,query:_o(o)};if(c===`get`){let t=e[s+1];if(t===`text`)return{...r,locator:i,query:_o(o),action:`getText`};if(t===`attrs`)return{...r,locator:i,query:_o(o),action:`getAttrs`};throw new n(`INVALID_ARGS`,`find get only supports text or attrs`)}if(c===`wait`)return{...r,locator:i,query:_o(o),action:`wait`,timeoutMs:or(e[s+1])};if(c===`fill`||c===`type`){let t=e.slice(s+1);if(t.length===0)throw new n(`INVALID_ARGS`,c===`fill`?`find fill requires text (use "" to clear the field)`:`find type requires text`);return{...r,locator:i,query:_o(o),action:c,value:t.join(` `)}}if(c===`click`||c===`focus`||c===`exists`||c===`list`)return{...r,locator:i,query:_o(o),action:c};throw new n(`INVALID_ARGS`,`Unsupported find action: ${e[s]}`,{hint:Ee})}function fo(e,t){let r={...Gn(t),...Un(t),...Hn(t)},i=Ue(e),a=Ae(i[0]??``);if(!a.ok)throw new n(a.code,a.message,{hint:a.hint});let o=a.predicate;if(o===`absent`){let e=po(r);if(e)throw mo(e)}let s=tr(i.slice(1),{preferTrailingValue:o===`text`});return o===`text`?{...r,predicate:o,selector:s.selectorExpression,value:s.rest.join(` `)}:{...r,predicate:o,selector:s.selectorExpression}}function po(e){if(e.scope!==void 0)return`scope`;if(e.depth!==void 0)return`depth`}function mo(e){return new n(`INVALID_ARGS`,e===`scope`?`is absent does not support --scope; it requires an unscoped capture`:`is absent does not support --depth; it requires a full-depth capture`,{command:`is`,predicate:`absent`,rejectedOption:e})}function ho(e){if(e===`text`||e===`label`||e===`value`||e===`role`||e===`id`)return e}function go(e){return{depth:e.snapshotDepth,raw:e.snapshotRaw}}function _o(e){if(e===void 0||e===``)throw new n(`INVALID_ARGS`,`find requires query`);return e}const vo=w({from:D(`Surface the pre-action baseline described: a host bundle id, or app.`),to:D(`Surface the post-action capture describes: a host bundle id, or app.`),disclosure:D(`Agent-facing sentence explaining the surface transition.`)},[`from`,`to`,`disclosure`],`Present when an in-place system surface (web sign-in or Apple Pay sheet) was presented over the app, or left it.`),yo=w({foregroundApp:D(`Foreground app bundle id or name, when the capture carries it.`),nodeCount:O(`Node count in the post-action interactive-only capture.`),interactiveNodeCount:O(`Subset of nodeCount the platform reports as hittable.`),digest:D(`Order-independent digest of the post-action node multiset.`),changedFromBefore:k(`Whether the post-action digest differs from the pre-action capture digest. false is evidence, not failure. Absent when no pre-action baseline was captured, so no comparison is claimed. With surfaceChange present, no digest comparison is made: it reports that surface transition.`),surfaceChange:vo},[`nodeCount`,`interactiveNodeCount`,`digest`]),bo=w({wallClockMs:O(`Total wall-clock time for the request in milliseconds.`),runnerRoundTrips:O(`Number of real runner round-trips made while serving the request.`),nodeCount:O(`Number of nodes in the original node tree when the response carries one.`)},[`wallClockMs`,`runnerRoundTrips`]),xo=w({diagnosticRef:D(`Opaque non-@ diagnostic token. Never a snapshot ref: not issued via refsGeneration and cannot be pinned or reused as an @ref target. UTF-8 truncated to 256 bytes.`),role:D(`UTF-8 truncated to 256 bytes.`),label:D(`UTF-8 truncated to 256 bytes.`)},[`diagnosticRef`]),So={type:`object`,description:`Pre-action disclosure of how the acting path resolved its target. Absent when resolutionDisclosure is inapplicable for the path.`,oneOf:[w({source:E(`runtime`),phase:E(`pre-action`),kind:E(`unique`)},[`source`,`phase`,`kind`]),w({source:E(`runtime`),phase:E(`pre-action`),kind:E(`disambiguated`),matchCount:O(`Total matches resolveSelectorChain found before disambiguation.`),winnerDiagnostic:xo,tiebreak:T([`visible`,`deepest`,`smallest-area`,`structural-equivalence`],`The comparison that decided the winner.`),alternatives:{type:`array`,description:`At most 5 losing candidates, document order. Present at default/full response levels and omitted in digest. The winner is never included.`,items:xo}},[`source`,`phase`,`kind`,`matchCount`,`winnerDiagnostic`,`tiebreak`]),w({source:E(`ref`),phase:E(`pre-action`),kind:E(`exact`)},[`source`,`phase`,`kind`]),w({source:E(`ref`),phase:E(`pre-action`),kind:E(`label-fallback`)},[`source`,`phase`,`kind`]),w({source:E(`direct-ios`),kind:E(`not-observed`)},[`source`,`kind`])]};function Co(e={}){let t=e.properties??{},n=e.required??[];return w({targetKind:T([`point`,`ref`,`selector`],`Resolved interaction target kind.`),x:O(`Resolved interaction x coordinate when available.`),y:O(`Resolved interaction y coordinate when available.`),referenceWidth:O(`Reference frame width for visualizing the interaction point.`),referenceHeight:O(`Reference frame height for visualizing the interaction point.`),ref:D(`Snapshot ref without the @ prefix when the target was an @ref.`),selector:D(`Selector expression when the target was a selector.`),selectorChain:Ar(),refLabel:D(),targetHittable:k(),hint:D(),warning:D(),message:D(),evidence:yo,resolution:So,cost:bo,maestroNonHittableCoordinateFallbackAllowed:k(`Whether the direct iOS Maestro coordinate fallback was allowed for this selector.`),maestroNonHittableCoordinateFallbackUsed:k(`Whether the direct iOS Maestro coordinate fallback was actually used.`),maestroFallbackReason:E(`non-hittable-coordinate`),...t},[`targetKind`,...n])}const wo=Co({properties:{evidence:yo,button:T([`secondary`,`middle`]),count:O(`Number of press/click repetitions.`),intervalMs:O(`Delay between repeated press/click actions.`),holdMs:O(`Hold duration for each action.`),jitterPx:O(`Deterministic per-axis coordinate jitter in pixels (each press offsets x and y by up to this amount).`),doubleTap:k(`Whether the command requested a double-tap action.`)}}),To={text:D(`Text submitted to the field.`),delayMs:O(`Delay between typed characters in milliseconds.`),evidence:yo},Eo=w({resourceId:Or(`Identifier of the exact field that changed: Android resource id or Apple accessibility identifier.`),className:Or(`Type of the exact field that changed: Android class name or Apple element type.`),packageName:Or(`App that owns the exact field: Android package name or Apple bundle id.`),rect:w({x:O(),y:O(),width:O(),height:O()},[`x`,`y`,`width`,`height`],`Screen-space rectangle of the exact field that changed.`)},[`resourceId`,`className`,`packageName`,`rect`],`Target identity captured before fill and matched after fill.`),Do={press:wo,click:wo,fill:{type:`object`,description:`Fill response. Target-bound unconfirmed evidence reports an observed value different from the requested text. It does not establish that formatting preserved the input; assert the expected value or resulting screen before continuing.`,oneOf:[{...Co({properties:To,required:[`text`]}),not:w({},[`verification`])},Co({properties:{...To,verification:E(`unconfirmed`),requested:D(`Literal text requested by the fill command.`),before:Or(`Raw target text captured before the fill.`),after:Or(`Raw target text captured after the fill.`),target:Eo},required:[`text`,`verification`,`requested`,`before`,`after`,`target`]})]},longpress:Co({properties:{durationMs:O(),gesture:E(`longpress`)}}),hover:Co({properties:{gesture:E(`hover`)}}),find:w({ref:D(`Snapshot ref without the @ prefix when the find action returns one.`),refsGeneration:O(`ADR 0014 ref frame epoch for read-only find actions.`),found:k(`Whether a wait/exists/read-only find satisfied its condition.`),waitedMs:O(`Milliseconds waited for a read-only find condition.`),text:D(`Text value returned by find get_text.`),node:A(`Snapshot node for find get_attrs/get_text.`),matches:{type:`array`,description:`Every match for the read-only find list action (#1625): { ref, node } each.`,items:A(`One listed match with its snapshot ref and node.`)},locator:D(`Locator kind used for the find action.`),query:D(`Query argument used for the find action.`),x:O(`Resolved x coordinate for mutating find actions.`),y:O(`Resolved y coordinate for mutating find actions.`),message:D(`Diagnostic message for mutating find actions.`),cost:bo},[],`Daemon response data for the find command.`)},Oo=tt,ko=[...new Set(Object.values(Oo).flat())],Q={get:{usageOverride:`get text|attrs <@ref|selector>`,usageFlags:[],positionalArgs:[`subcommand`,`target`],allowsExtraPositionals:!0,allowedFlags:[...q,`record`]},find:{usageOverride:`find <locator|text> [action] [value] [--first|--last]`,usageFlags:[],positionalArgs:[`query`,`action?`,`value?`],allowsExtraPositionals:!0,allowedFlags:[`snapshotDepth`,`snapshotRaw`,`findFirst`,`findLast`,`record`]},is:{positionalArgs:[`predicate`,`selector`,`value?`],allowsExtraPositionals:!0,allowedFlags:[...q,`record`]},click:{usageOverride:`click <x y|@ref|selector>`,usageFlags:[],positionalArgs:[`target`],allowsExtraPositionals:!0,allowedFlags:[...Li,`clickButton`,...Y(`click`),...q]},press:{usageOverride:`press <x y|@ref|selector>`,usageFlags:[],positionalArgs:[`targetOrX`,`y?`],allowsExtraPositionals:!0,allowedFlags:[...Li,...Y(`press`),...q]},longpress:{usageOverride:`longpress <x y|@ref|selector> [durationMs]`,usageFlags:[],positionalArgs:[`targetOrX`,`yOrDurationMs?`,`durationMs?`],allowsExtraPositionals:!0,allowedFlags:[...Y(`longpress`),...q]},hover:{usageOverride:`hover <x y|@ref|selector>`,usageFlags:[],positionalArgs:[`targetOrX`,`y?`],allowsExtraPositionals:!0,allowedFlags:[...Y(`hover`),...q]},swipe:{positionalArgs:[`x1`,`y1`,`x2`,`y2`],allowsExtraPositionals:!0,allowedFlags:[`count`,`pauseMs`,`pattern`,`postGestureStabilization`]},gesture:{usageOverride:`gesture <pan|fling|swipe|pinch|rotate|transform|tap|drag> ...`,usageFlags:[],listUsageOverride:`gesture <pan|fling|swipe|pinch|rotate|transform|tap|drag> ...`,positionalArgs:[`pan|fling|swipe|pinch|rotate|transform|tap|drag`,`args?`],allowsExtraPositionals:!0,allowedFlags:ko,flagsByAction:Oo},focus:{positionalArgs:[`x`,`y`]},type:{positionalArgs:[`text`],allowsExtraPositionals:!0,allowedFlags:[`delayMs`]},fill:{usageOverride:`fill <x> <y> <text> | fill <@ref|selector> <text> | fill <x y|@ref|selector> --text-stdin`,usageFlags:[],positionalArgs:[`targetOrX`,`yOrText`,`text?`],allowsExtraPositionals:!0,allowedFlags:[...q,`delayMs`,`recordAs`,`textStdin`,...Y(`fill`)]},scroll:{usageOverride:`scroll <direction|top|bottom> [amount]`,usageFlags:[`until`,`maxPasses`,`pixels`,`durationMs`,`settle`],positionalArgs:[`directionOrEdge`,`amount?`],allowedFlags:[`pixels`,`durationMs`,`until`,`maxPasses`,...Y(`scroll`),`postGestureStabilization`]}},Ao=G({name:`interaction`,clientSurface:!1,commands:[W({name:`click`,text:{summary:`Click or tap a UI target`},metadata:$(`click`),run:(e,t)=>e.interactions.click(jo(t)),cliSchema:Q.click,cliReader:X.click,daemonWriter:Z.click}),W({name:`press`,text:{summary:`Short-press a UI target`,cliDetail:`The hold duration is positional on longpress, not press --hold-ms.`},metadata:$(`press`),run:(e,t)=>e.interactions.press(Mo(t)),cliSchema:Q.press,cliReader:X.press,daemonWriter:Z.press}),W({name:`fill`,text:{summary:`Replace text in a UI input`,cliDetail:`Every positional after an @ref is the replacement text, so fill @e57 good morning enters "good morning"; quote the text when the shell must preserve exact whitespace. Clear a field with an empty text argument: fill @e57 "" (the argument must be present — fill @e57 alone is a missing argument, not a clear). When visible label text also matches a non-input element, constrain the target with editable=true, for example fill 'label="Email" editable=true' "qa@example.com". To keep a secret out of argv, omit the text and pipe it in: printf %s "$PASSWORD" | fill @e57 --text-stdin (max 64 KiB, one trailing newline removed). On web, a coordinate fill selects the clicked field in the page and refuses with COMMAND_FAILED and details.reason text_entry_focus_not_observed, before it sends any text or key, when the click did not reach an editable text field it can reach: a read-only, disabled, date, checkbox, or select control, a field in a cross-origin frame, a sandboxed frame without allow-same-origin, or a closed shadow root, or a click that missed. The click has already landed, so run snapshot -i again and fill the field it reports by ref (fill @e2 text); a selector fill reaches the same coordinate path and hits the same limits.`},metadata:$(`fill`),run:(e,t)=>e.interactions.fill(No(t)),cliSchema:Q.fill,cliReader:X.fill,daemonWriter:Z.fill}),W({name:`longpress`,text:{summary:`Hold a UI target to open a context menu`,cliDetail:`Duration is positional, for example longpress @e12 800 or longpress 300 500 800.`},metadata:$(`longpress`),run:(e,t)=>e.interactions.longPress(Po(t)),cliSchema:Q.longpress,cliReader:X.longpress,daemonWriter:Z.longpress}),W({name:`hover`,text:{summary:`Hover the pointer over a UI target (web only)`,cliDetail:`The pointer stays where hover left it: read the revealed UI (--settle or snapshot -i) and act on it before another click or hover moves the pointer away.`},metadata:$(`hover`),run:(e,t)=>e.interactions.hover(Fo(t)),cliSchema:Q.hover,cliReader:X.hover,daemonWriter:Z.hover}),W({name:`swipe`,text:{summary:`Fling between coordinates`,cliDetail:`The first read after a swipe waits for two captures to agree. --no-post-gesture-stabilization skips that wait for a caller whose own polling verifies the screen.`},metadata:$(`swipe`),run:(e,t)=>e.interactions.swipe(t),cliSchema:Q.swipe,cliReader:X.swipe,daemonWriter:Z.swipe}),W({name:`focus`,text:{summary:`Focus input at screen coordinates`},metadata:$(`focus`),run:(e,t)=>e.interactions.focus(t),cliSchema:Q.focus,cliReader:X.focus,daemonWriter:Z.focus}),W({name:`type`,text:{summary:`Append text to the focused input`},metadata:$(`type`),run:(e,t)=>e.interactions.type(t),cliSchema:Q.type,cliReader:X.type,daemonWriter:Z.type}),W({name:`scroll`,text:{summary:`Scroll in a direction or to an edge`,cliDetail:`A caller that verifies the screen by polling can add --no-post-gesture-stabilization. The scroll then returns right after its gesture, with no movement field and no scroll_no_progress refusal, and the next read skips the stabilization wait. With --settle the settle observation already reports the outcome, and the option removes the same wait from its first capture.`},metadata:$(`scroll`),run:(e,t)=>e.interactions.scroll(t),cliSchema:Q.scroll,cliReader:X.scroll,daemonWriter:Z.scroll}),W({name:`get`,text:{summary:`Read element text or attributes`},metadata:$(`get`),run:(e,t)=>e.interactions.get(Lo(t)),cliSchema:Q.get,cliReader:X.get,daemonWriter:Z.get}),W({name:`is`,text:{summary:`Check a UI predicate on a selector`},metadata:$(`is`),run:(e,t)=>e.interactions.is(t),cliSchema:Q.is,cliReader:oo.is,daemonWriter:so.is}),W({name:`find`,text:{summary:`Find an element and act`},metadata:$(`find`),run:(e,t)=>e.interactions.find(t),cliSchema:Q.find,cliReader:oo.find,daemonWriter:so.find}),W({name:`gesture`,text:{summary:`Run pan, fling, swipe, pinch, rotate, transform, tap, or drag gestures`,cliDetail:`Argument shapes: pan <x> <y> <dx> <dy> [durationMs], fling <up|down|left|right> <x> <y> [distance], swipe <left|right|left-edge|right-edge>, pinch <scale> [x] [y], rotate <degrees> [x] [y], transform <x> <y> <dx> <dy> <scale> <degrees> [durationMs], tap <x1> <y1> <x2> <y2> [... <x5> <y5>] [--hold-ms <ms>] [--count <n>] [--pause-ms <ms>], or drag <source-selector|pinned-ref> <destination-selector|pinned-ref> [sourceHoldMs] [moveMs] [destinationHoldMs]. For command plans, output only command lines. Android transform verification should use all app-observable effects, for example wait text "pan changed yes", wait text "pinch changed yes", and wait text "rotate changed yes", not exact transform values. gesture swipe accepts --no-post-gesture-stabilization to skip the stabilization wait before the next read, for a caller whose own polling verifies the screen.`},metadata:$(`gesture`),run:(e,t)=>e.interactions.gesture({...nt(t),...g(t),...t.postGestureStabilization===!1?{postGestureStabilization:!1}:{}}),cliSchema:Q.gesture,cliReader:Xa.gesture,daemonWriter:Za.gesture})]});function $(e){let t=Ga.find(t=>t.name===e);if(!t)throw Error(`Missing interaction command metadata for ${e}`);return t}function jo(e){return{...Mo(e),button:e.button}}function Mo(e){return{...g(e),...H(e),...Yr(e),...Jr(e),verify:e.verify,...Io(e)}}function No(e){return{...g(e),...H(e),...Yr(e),text:e.text,delayMs:e.delayMs,recordAs:e.recordAs,textStdin:e.textStdin,verify:e.verify,...Io(e)}}function Po(e){return{...g(e),...H(e),...Yr(e),durationMs:e.durationMs,...Io(e)}}function Fo(e){return{...g(e),...H(e),...Yr(e),...Io(e)}}function Io(e){return{settle:e.settle,settleQuietMs:e.settleQuietMs,timeoutMs:e.timeoutMs}}function Lo(e){return{...g(e),...H(e),...Yr(e),format:e.format,record:e.record}}const Ro=W({name:`artifacts`,text:{summary:`List daemon or cloud provider session artifacts`},metadata:U(`artifacts`,`List daemon or cloud provider artifacts for an active or completed session.`,{provider:M(`Cloud provider name, for example browserstack, aws-device-farm, or testmu.`),providerSessionId:M(`Cloud provider session id or ARN.`)}),run:(e,t)=>e.sessions.artifacts(t),cliSchema:{usageOverride:`artifacts [provider-session-id]`,usageFlags:[`provider`],positionalArgs:[`provider-session-id?`],allowedFlags:[`provider`,`providerSessionId`]},cliReader:(e,t)=>({...y(t),provider:t.provider,providerSessionId:e[0]??t.providerSessionId}),daemonWriter:_(u.artifacts)});function zo(e){let{metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i}=e;if(t!==void 0||n!==void 0||r!==void 0||i!==void 0)return{metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i}}function Bo(e){let{metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i,...a}=e,o=zo({metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i});return o?{...a,runtime:o}:a}const Vo=U(`apps`,`List the apps installed on the selected device. Include system or OEM apps only when they are needed as automation targets.`,{appsFilter:L([`user-installed`,`all`],`Restrict the listing to user-installed apps, or include system and OEM apps.`)}),Ho=U(`open`,`Boot the selected device when needed, then open an app, deep link, or URL in a session. Use the app or URL inputs to choose what becomes the foreground automation target. Remote daemons refuse file: URLs in open targets and launch URLs with reason REMOTE_HOST_INPUT_DENIED. Serve local web content over HTTP(S) instead.`,{app:M(`App name, bundle id, package, or URL.`),url:M(`Optional URL passed with an app shell.`),surface:L(pt,`macOS presentation surface to open: the app itself, the frontmost app, the desktop, or the menu bar.`),activity:M(`Android activity name.`),launchConsole:M(`File path on the daemon host for the stdout and stderr of the initial app launch. Local or Limrun iOS simulator direct app launches only; not for URL opens.`),launchArgs:Lr(`Launch arguments forwarded verbatim to the platform launch command.`),relaunch:F(`Force relaunch.`),timeoutMs:P(`Startup budget in milliseconds. Bounds the Simulator boot wait, so a never-booted Simulator can finish its first-boot migration; omit for the default startup behavior.`,{min:1}),waitMs:I(`waitMs`),foreground:I(`foreground`),saveScript:R({oneOf:[k(),D()]}),force:F(`Overwrite an existing --save-script target instead of refusing (alias: --overwrite).`),testIme:F(`Activate the headless Android test IME for deterministic Unicode text entry (default on for emulators; opt-in on real devices).`),noRecord:F(`Do not record this action.`),metroHost:M(`Session-scoped Metro/debug host hint applied to the opened app.`),metroPort:P(`Session-scoped Metro/debug port hint applied to the opened app. Without metroHost, emulators and simulators use the loopback alias; physical devices need metroHost.`,{min:1,max:65535}),bundleUrl:M(`Session-scoped bundle URL hint applied to the opened app.`),launchUrl:M(`Launch URL for the opened app; does not select the server used by metro reload.`),...Wr()}),Uo=U(`close`,`Close the named app, or close the active session app when app is omitted. If the session booted a local simulator or emulator, add shutdown when you finish, unless the user asks to keep it running; close alone never stops the device. Android ADB close fails with android-app-close-timeout if the app stays foreground past 2s, a killed process does not exit within 10s, or a new process runs past 2s. It fails with android-process-probe-unavailable when adb pidof cannot list the app processes; if that happens before the force-stop, the app keeps running. If close cannot confirm its cleanup on a session that holds a device claim, the session and its claim stay; run close again with the same options to retry the cleanup, leaving out save-script once the script is published.`,{app:M(`Optional app to close.`),shutdown:F(`Shutdown the session/device where supported.`),saveScript:R({oneOf:[k(),D()]}),force:F(`Overwrite an existing --save-script target instead of refusing (alias: --overwrite).`)});function Wo(e){return Bo(e)}const Go={allowedFlags:[`appsFilter`]},Ko={positionalArgs:[`appOrUrl?`,`url?`],allowedFlags:[`activity`,`launchConsole`,`launchArgs`,`testIme`,`saveScript`,`force`,`noRecord`,`relaunch`,`foreground`,`timeoutMs`,`waitMs`,`surface`,...Fi,`launchUrl`,...Ii]},qo={positionalArgs:[`app?`],allowedFlags:[`saveScript`,`force`,`shutdown`]},Jo=(e,t)=>({...y(t),appsFilter:Wt(t.appsFilter)}),Yo=(e,t)=>({...y(t),app:e[0],url:e[1],surface:t.surface,activity:t.activity,launchConsole:t.launchConsole,launchArgs:t.launchArgs,relaunch:t.relaunch,foreground:t.foreground,timeoutMs:t.timeoutMs,waitMs:t.waitMs,saveScript:t.saveScript,force:t.force,testIme:t.testIme,noRecord:t.noRecord,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,launchUrl:t.launchUrl,...Jn(t)}),Xo=(e,t)=>({...y(t),app:e[0],shutdown:t.shutdown,saveScript:t.saveScript,force:t.force}),Zo=_(u.apps),Qo=_(u.open,is),$o=_(u.close,e=>b(e.app)),es=W({name:`apps`,text:{summary:`List installed apps or deferred provider app assets`,cliDetail:`Before provider allocation, lists uploaded app assets when the selected provider exposes a catalog. On a live device, defaults to user-installed apps; use --all to include system/OEM apps.`},metadata:Vo,run:(e,t)=>e.apps.list(t),cliSchema:Go,cliReader:Jo,daemonWriter:Zo}),ts=W({name:`open`,text:{summary:`Open an app, deep link or URL, save replays`,cliDetail:`Use --platform to bind URL/deep-link opens to the target platform. For local or Limrun iOS simulator initial stdout/stderr, put --launch-console <path> on this open command, for example agent-device open "Agent Device Tester" --platform ios --launch-console artifacts/launch-console.log. Expo Go/dev-client shells accept host + URL, for example agent-device open "Expo Go" exp://127.0.0.1:8081 --platform ios. macOS also supports --surface app|frontmost-app|desktop|menubar. --metro-host/--metro-port/--bundle-url choose the app's Metro server and save that address for later metro reload calls in the same session. A fresh open without Metro hints clears an older same-name binding; close also clears it. --launch-url supplies the app's launch URL; it does not select the reload server. On an iOS simulator without --launch-url, open connects a detected Expo development client through its expo-development-client URL. The app must declare a single exp+<slug> scheme that no other installed app owns. If detection is inconclusive, the app opens normally. Bare React Native apps receive their server settings before launch. On an iOS simulator, when --launch-url raises an "Open in <App>?" prompt that keeps open from seeing the app, open accepts it if the URL scheme belongs to the session app (data.launchConfirmation: "accepted"); if the scheme belongs to another installed app, the prompt stays on screen and open fails with details.reason launch_confirmation_foreign_app; if the scheme owner cannot be resolved because no single installed app owns it or the lookup failed, the prompt stays on screen and open returns with data.launchConfirmation: "unanswered", launchConfirmationReason url-owner-unresolved, and a warning; a prompt that is seen but not recognized is reported the same way with launchConfirmationReason alert-unrecognized and its own warning; for url-owner-unresolved, answer the prompt with alert accept; for alert-unrecognized, read the alert with alert get first, because it can be the app's own alert (such as a permission prompt) rather than the launch confirmation, and answer with alert accept only when it is the launch confirmation; when agent-device cannot read whether a prompt is up at all (the alert read, the accept, or the runner itself failed, including after a re-hand of the URL), open stays green, reports no launchConfirmation plus data.launchConfirmationProbeFailure naming the failed step (alert-read, alert-accept, or runner), and appends a warning that says to check with alert get. The prompt is read whenever open cannot see the app afterwards, including on a slow host where the app's target discovery fails on its own deadline. When an accept leaves the app provably not running, open hands the same URL over once more and reads again; still not running, it fails with details.reason launch_confirmation_unanswered. When the runner reports its main-thread timeout for the accept and the prompt is still up, open presses Open again, but only when the time the open request has left covers a whole press and the read that checks it. A recognized prompt still visible after a failed accept, or once that time is gone, also fails with this reason, even if the app is running behind it; answer it with alert accept or alert dismiss. A simulator openurl that CoreSimulator never answers fails within 20s with details.reason ios-simulator-openurl-timeout. The prompt is recognized by the OS's own wording of its title and buttons in the Simulator's preferred languages; when the runner cannot read that wording, the prompt stays on screen as alert-unrecognized. A prompt that appears after open has already seen the app is not answered; use alert accept. A device another session is holding refuses at once; add --wait <ms> to block up to that budget for it and only then fail with DEVICE_IN_USE naming the owning session.`,mcpDetail:`metroHost, metroPort, and bundleUrl choose the app's Metro server and save its address for later reloads. launchUrl selects the app's launch URL and does not select the reload server. A fresh open without Metro hints clears an older same-name binding; close also clears it.`},metadata:Ho,run:(e,t)=>e.apps.open(Wo(t)),cliSchema:Ko,cliReader:Yo,daemonWriter:Qo}),ns=W({name:`close`,text:{summary:`Close an app or end the session`},metadata:Uo,run:(e,t)=>t.app?e.apps.close(t):e.sessions.close(rs(t)),cliSchema:qo,cliReader:Xo,daemonWriter:$o});function rs(e){let{app:t,...n}=e;return n}function is(e){return e.app?e.url?[e.app,e.url]:[e.app]:[]}const as={platform:T(xe),target:T(l),device:D(`Human-readable device name.`),id:D(`Stable device id.`),kind:T(be)},os=[`platform`,`target`,`device`,`id`,`kind`],ss=w({success:k(),exitCode:O(),stdout:D(),stderr:D(),error:A(`Normalized error detail when shutdown failed.`)},[`success`,`exitCode`,`stdout`,`stderr`]),cs={boot:w({...as,booted:{type:`boolean`,const:!0},selection:w({reason:D(`Why this device was chosen, such as newest-bootable-local.`),source:D(`Where it came from: session, local, or provider.`),candidateCount:O(),bootOccurred:k()},[`reason`,`source`,`candidateCount`,`bootOccurred`])},[...os,`booted`]),shutdown:w({...as,shutdown:ss},[...os,`shutdown`])},ls=U(`devices`,`List available devices and simulators that can be selected for automation. Use platform, device, udid, or serial inputs on later commands to target one result.`,{}),us=U(`capabilities`,`List the commands supported by the selected device or active session. Use device-selection inputs when checking support before a session is open.`,{}),ds=U(`boot`,`Boot or prepare the selected device or simulator so later commands can target it. The device is chosen through the device-selection inputs, not by naming it here. On Limrun, allocate or reuse an instance. Existing-instance credentials attach without creating one.`,{headless:F(`Boot without showing simulator UI when supported.`),pick:L(Se,`When no device is named and several equally preferred devices match, all shut down, boot one instead of failing: newest picks mobile over TV, then the newest OS version, then the first name in name order (numbers compared by value; not device age), which alone decides for stopped Android AVDs because they report no OS version. Several booted matches still fail.`),timeoutMs:P(`Startup budget in milliseconds. Bounds the boot wait, so a never-booted Simulator can finish its first-boot migration or a cold emulator its boot; omit for the default startup behavior.`,{min:1})}),fs=U(`shutdown`,`Shutdown a selected simulator or emulator. On Limrun, delete a created instance or release an attachment. Apps and data on a deleted instance are lost. A Limrun connection without an instance fails with DEVICE_NOT_FOUND and details.reason provider_instance_unallocated and creates nothing.`,{}),ps={allowedFlags:[`headless`,`pick`,`timeoutMs`]},ms={},hs={},gs={},_s=(e,t)=>y(t),vs=(e,t)=>({...y(t),headless:t.headless,pick:t.pick,timeoutMs:t.timeoutMs}),ys=_(u.devices),bs=_(u.capabilities),xs=_(u.boot),Ss=_(u.shutdown),Cs=[W({name:`devices`,text:{summary:`List available devices and simulators`},metadata:ls,run:(e,t)=>e.devices.list(t),cliSchema:ms,cliReader:_s,daemonWriter:ys}),W({name:`capabilities`,text:{summary:`List supported commands for the selected device`,cliDetail:`Select an explicit target with --platform/--device/--udid/--serial.`},metadata:us,run:(e,t)=>e.devices.capabilities(t),cliSchema:hs,cliReader:_s,daemonWriter:bs}),W({name:`boot`,text:{summary:`Boot target device/simulator`},metadata:ds,run:(e,t)=>e.devices.boot(t),cliSchema:ps,cliReader:vs,daemonWriter:xs}),W({name:`shutdown`,text:{summary:`Shutdown target simulator/emulator`,cliDetail:`For an active session, use close --shutdown.`},metadata:fs,run:(e,t)=>e.devices.shutdown(t),cliSchema:gs,cliReader:_s,daemonWriter:Ss})],ws={doctor:w({status:T([`pass`,`warn`,`fail`,`info`]),summary:D(),kind:T([`auto`,`react-native`,`expo`,`repack`]),platform:D(),target:T(l),targetApp:D(),metro:w({host:D(),port:O()},[`host`,`port`]),checks:{type:`array`,items:w({id:D(),status:T([`pass`,`warn`,`fail`,`info`]),summary:D(),hint:D(),command:D(),evidence:A()},[`id`,`status`,`summary`])}},[`status`,`summary`,`kind`,`checks`])},Ts=W({name:`doctor`,text:{summary:`Diagnose device, app, dev-server, and RN/Expo readiness`,cliDetail:`Metro reachability is inferred from cwd/runtime. On iOS simulators it also warms the XCTest runner build cache in the background when missing. Pass --app to verify a target app on the one matching booted device without opening a session. Use --remote to check remote connection setup without probing local devices. Default output is compact; use --json for full checks and evidence.`,mcpDetail:`On iOS simulators it also warms the XCTest runner build cache in the background when missing, so run it before the first Apple snapshot or interaction of a session.`},metadata:U(`doctor`,`Diagnose device, app, development-server, and React Native or Expo readiness issues. Returns compact evidence for local inventory, sessions, optional app discovery, toolchains, and server reachability.`,{targetApp:M(`Installed app package/bundle id or app name to verify without opening a session.`),remote:F(`Check remote connection setup instead of local device inventory.`)}),run:(e,t)=>e.command.doctor(t),cliSchema:{usageOverride:`doctor [--platform ios|android|harmonyos|vega|macos|linux|web|apple]`,allowedFlags:[`targetApp`,`remote`]},cliReader:(e,t)=>({...y(t),targetApp:t.targetApp,remote:t.remote}),daemonWriter:_(u.doctor)});function Es(e,t=`--github-actions-artifact`){let r=e.indexOf(`:`);if(r<=0||r===e.length-1)throw new n(`INVALID_ARGS`,`${t} must use owner/repo:artifact, for example thymikee/RNCLI83:6635342232`);let{owner:i,repo:a}=ks(e.slice(0,r),t);return Os(i,a,e.slice(r+1),`${t} artifact`)}function Ds(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw new n(`INVALID_ARGS`,`${t} installSource must be an object.`);let r=e;if(js(r.type,`${t} installSource.type`)!==`github-actions-artifact`)throw new n(`INVALID_ARGS`,`${t} installSource.type must be "github-actions-artifact".`);let{owner:i,repo:a}=ks(js(r.repo,`${t} installSource.repo`),`${t} installSource.repo`);return Os(i,a,r.artifact,`${t} installSource.artifact`)}function Os(e,t,n,r){return typeof n==`number`||Ns(n)?{kind:`github-actions-artifact`,owner:e,repo:t,artifactId:Ms(n,r)}:{kind:`github-actions-artifact`,owner:e,repo:t,artifactName:js(n,r)}}function ks(e,t){let r=e.indexOf(`/`);if(r<=0||r===e.length-1||e.indexOf(`/`,r+1)!==-1)throw new n(`INVALID_ARGS`,`${t} must use owner/repo.`);let i={owner:e.slice(0,r).trim(),repo:e.slice(r+1).trim()};if(!i.owner||!i.repo)throw new n(`INVALID_ARGS`,`${t} must use owner/repo.`);return i}function As(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function js(e,t){let r=As(e);if(!r)throw new n(`INVALID_ARGS`,`${t} must be a non-empty string.`);return r}function Ms(e,t){let r=typeof e==`number`?e:typeof e==`string`?Number(e):NaN;if(!Number.isInteger(r))throw new n(`INVALID_ARGS`,`${t} must be an integer.`);return r}function Ns(e){return typeof e==`string`&&/^\d+$/.test(e.trim())}const Ps=U(`install`,`Install an app binary from a local path. Provide an app identifier with the path when the target needs explicit app selection; use reinstall to replace an already installed app. Local Android and iOS install steps time out after 120s; the command allows 480s including device startup.`,{app:M(`Optional app identifier hint.`),appPath:j(M(`Path to app binary.`)),...Wr()}),Fs=U(`reinstall`,`Replace an installed app with a binary from a local path. Use this when preserving the same app identity while installing a new build on the selected device. Local Android and iOS install steps time out after 120s; the command allows 480s including device startup and uninstall.`,{app:j(M()),appPath:j(M(`Path to app binary.`)),...Wr()}),Is=U(`uninstall`,`Remove an installed app from the selected device. A package name or bundle id that is not installed succeeds with wasInstalled: false. The command allows 480s including device startup.`,{app:j(M(`Package name, bundle id, or installed app name.`)),...Wr()}),Ls=U(`install-from-source`,`Install app builds from URLs, remote source specs, or CI artifacts resolved by a remote daemon. The command allows 600s, including up to 120s for the download; local Android and iOS install steps time out after 120s.`,{source:j(R(A(`Install source object.`))),retainPaths:F(),retentionMs:I(`retentionMs`)}),Rs={usageOverride:`install <path> | install <app> <path>`,listUsageOverride:`install <path>`,positionalArgs:[`appOrPath`,`path?`],allowedFlags:Ii},zs={positionalArgs:[`app`,`path`],allowedFlags:Ii},Bs={positionalArgs:[`app`],allowedFlags:Ii},Vs={usageOverride:`install-from-source <url> | install-from-source --github-actions-artifact <owner/repo:artifact>`,usageFlags:[],listUsageOverride:`install-from-source`,positionalArgs:[`url?`],allowedFlags:[`header`,`githubActionsArtifact`,`installSource`,`retainPaths`,`retentionMs`]},Hs=(e,t)=>Xs(e,t),Us=(e,t)=>Zs(e,t),Ws=(e,t)=>({...y(t),app:S(e[0],`uninstall requires app`),...Jn(t)}),Gs=(e,t)=>({...y(t),source:ec(e,t),retainPaths:t.retainPaths,retentionMs:t.retentionMs}),Ks=_(u.install,e=>Qs(e.app,e.appPath)),qs=_(u.reinstall,e=>$s(e.app,e.appPath)),Js=_(u.uninstall,e=>[C(e.app,`missing app`)]),Ys=[W({name:`install`,text:{summary:`Install an app binary from a path`,cliDetail:`A HarmonyOS .hap installs from its path alone, for example agent-device install ./build/entry-default-signed.hap --platform harmonyos.`},metadata:Ps,run:(e,t)=>e.apps.install(t),cliSchema:Rs,cliReader:Hs,daemonWriter:Ks}),W({name:`reinstall`,text:{summary:`Replace an installed app with a new build`},metadata:Fs,run:(e,t)=>e.apps.reinstall(t),cliSchema:zs,cliReader:Us,daemonWriter:qs}),W({name:`uninstall`,text:{summary:`Remove an installed app`},metadata:Is,run:(e,t)=>e.apps.uninstall(t),cliSchema:Bs,cliReader:Ws,daemonWriter:Js}),W({name:`install-from-source`,text:{summary:`Install app builds from URLs or CI artifacts`},metadata:Ls,run:(e,t)=>e.apps.installFromSource(t),cliSchema:Vs,cliReader:Gs,daemonWriter:e=>v(ut.installSource,[],{...e,installSource:e.source,retainMaterializedPaths:e.retainPaths,materializedPathRetentionMs:e.retentionMs})})];function Xs(e,t){let[n,r]=e,i=r!==void 0;return{...y(t),...i?{app:S(n,`install requires app`)}:{},appPath:S(i?r:n,`install requires path`),...Jn(t)}}function Zs(e,t){return{...y(t),app:S(e[0],`reinstall requires app`),appPath:S(e[1],`reinstall requires path`),...Jn(t)}}function Qs(e,t){let n=C(t,`missing app path`);return typeof e==`string`&&e.length>0?[e,n]:[n]}function $s(e,t){return[C(e,`missing first positional`),C(t,`missing second positional`)]}function ec(e,t){let r=e[0]?.trim();if(e.length>1)throw new n(`INVALID_ARGS`,`install-from-source accepts either one <url> positional or --github-actions-artifact`);let i=t.githubActionsArtifact?Es(t.githubActionsArtifact):void 0,a=t.installSource;if(+!!r+ +!!i+ +!!a!=1)throw new n(`INVALID_ARGS`,`install-from-source requires exactly one source: <url>, --github-actions-artifact, or config installSource`);if(!r&&t.header&&t.header.length>0)throw new n(`INVALID_ARGS`,`install-from-source --header is only supported for URL sources`);if(i)return i;if(a)return a;if(!tc(r))throw new n(`INVALID_ARGS`,`install-from-source <url> must be an http(s) URL: ${r}`,{hint:`Install a local build with install <app> <path>.`});return{kind:`url`,url:r,headers:nc(t.header)}}function tc(e){let t=URL.parse(e)?.protocol;return t===`http:`||t===`https:`}function nc(e){if(!e||e.length===0)return;let t={};for(let r of e){let e=r.indexOf(`:`);if(e<=0)throw new n(`INVALID_ARGS`,`Invalid --header value "${r}". Expected "name:value".`);let i=r.slice(0,e).trim(),a=r.slice(e+1).trim();if(!i)throw new n(`INVALID_ARGS`,`Invalid --header value "${r}". Header name cannot be empty.`);t[i]=a}return t}const rc=[`ios-runner`],ic={prepare:w({action:E(`ios-runner`),platform:T(xe),deviceId:D(),deviceName:D(),kind:T(be),durationMs:O(),runner:w({},[]),cache:T([`exact`,`miss`,`external`]),artifact:T([`valid`,`rebuilt`]),buildMs:O(),connectMs:O(),healthCheckMs:O(),xctestrunPath:D(),recoveryReason:D(),failureReason:D(),timing:w({totalMs:O(),additiveParts:w({buildMs:O(),connectAfterBuildMs:O(),healthCheckMs:O()},[`connectAfterBuildMs`,`healthCheckMs`]),containment:w({connectMs:{type:`array`,items:E(`buildMs`)},healthCheckMs:{type:`array`,items:D()}},[`healthCheckMs`]),note:D()},[`totalMs`,`additiveParts`,`containment`,`note`]),message:D()},[`action`,`platform`,`deviceId`,`deviceName`,`kind`,`durationMs`,`runner`,`connectMs`,`healthCheckMs`,`timing`,`message`])},ac=W({name:`prepare`,text:{summary:`Pre-warm platform helpers before automation`},metadata:U(`prepare`,`Prepare platform helper infrastructure. ios-runner builds/reuses, starts, and health-checks the XCTest runner so later Apple snapshots and interactions do not pay first-use startup cost. In JSON output, top-level buildMs/connectMs/healthCheckMs are diagnostic fields and may overlap; use timing.additiveParts for additive wall-clock phase totals. In CI, run it after boot/install and before replay/test; if replay/test starts a separate daemon, stop the prepare daemon before replay/test so it does not keep the prepared runner lease. It is not a recovery step for "runner already owned by another agent-device daemon"; stop the owning daemon on the Mac with simulator access instead. Runner build/start output is written to the session runner.log; daemon.log is for daemon lifecycle/startup issues.`,{action:j(L(rc)),timeoutMs:P(`Maximum wall-clock time for the prepare command.`)}),run:(e,t)=>e.command.prepare(t),cliSchema:{usageOverride:`prepare ios-runner --platform ios|macos`,listUsageOverride:`prepare`,positionalArgs:[`ios-runner`],allowedFlags:[`timeoutMs`]},cliReader:(e,t)=>({...y(t),action:S(e[0],`prepare requires subcommand`),timeoutMs:t.timeoutMs}),daemonWriter:_(u.prepare,e=>[C(e.action,`prepare requires subcommand`)])}),oc={push:{type:`object`,oneOf:[w({platform:E(`ios`),bundleId:D(),message:D()},[`platform`,`bundleId`,`message`]),w({platform:E(`android`),package:D(),action:D(),extrasCount:O(),message:D()},[`platform`,`package`,`action`,`extrasCount`,`message`])]},"trigger-app-event":w({event:D(),eventUrl:D(),transport:E(`deep-link`),message:D()},[`event`,`eventUrl`,`transport`,`message`])},sc=U(`push`,`Deliver push notification payloads to an installed app.`,{app:j(M()),payload:j(R({oneOf:[D(),A()]}))}),cc=U(`trigger-app-event`,`Ask the app to handle an app-defined automation or test event, with an optional structured payload. Call this only for event names and payload shapes the app documents.`,{event:j(M(`Name of an app-defined automation or test event the app documents.`)),payload:vc(`Structured payload passed to the event, in the shape the app documents for it.`)}),lc={listUsageOverride:`push`,positionalArgs:[`bundleOrPackage`,`payloadOrJson`]},uc={usageOverride:`trigger-app-event <event> [payloadJson]`,listUsageOverride:`trigger-app-event`,positionalArgs:[`event`,`payloadJson?`]},dc=(e,t)=>({...y(t),app:S(e[0],`push requires bundleOrPackage`),payload:S(e[1],`push requires payloadOrJson`)}),fc=(e,t)=>({...y(t),event:S(e[0],`trigger-app-event requires event`),payload:e[1]?nr(e[1],`trigger-app-event payload`):void 0}),pc=_(u.push,e=>gc(e)),mc=_(u.triggerAppEvent,e=>_c(e)),hc=[W({name:`push`,text:{summary:`Deliver a push notification payload`},metadata:sc,run:(e,t)=>e.apps.push(t),cliSchema:lc,cliReader:dc,daemonWriter:pc}),W({name:`trigger-app-event`,text:{summary:`Invoke an app-defined automation event`},metadata:cc,run:(e,t)=>e.apps.triggerEvent(t),cliSchema:uc,cliReader:fc,daemonWriter:mc})];function gc(e){return[e.app,typeof e.payload==`string`?e.payload:JSON.stringify(e.payload)]}function _c(e){return[e.event,...e.payload?[JSON.stringify(e.payload)]:[]]}function vc(e){return Ir(e)}const yc=W({name:`session`,text:{summary:`List sessions, show the state dir, or publish a script`},metadata:U(`session`,`List active sessions, print the effective daemon state directory, or publish an armed open-to-destination script without closing its session`,{action:L([`list`,`state-dir`,`save-script`],`list shows active sessions; state-dir prints the daemon state directory; save-script publishes an armed recording without teardown.`),path:M(`Optional .ad output path for save-script.`),force:F(`Atomically replace an existing save-script target.`)}),run:async(e,{action:t,path:n,force:r,...i})=>{let a=t??`list`;return xc(a,n,r),a===`state-dir`?{stateDir:await e.sessions.stateDir(i)}:a===`save-script`?await e.sessions.saveScript({...i,path:n,force:r}):{sessions:await e.sessions.list(i)}},cliSchema:{usageOverride:`session list | session state-dir | session save-script [path] [--force]`,usageFlags:[],listUsageOverride:`session`,positionalArgs:[`list|state-dir|save-script?`,`path?`],allowedFlags:[`force`]},cliReader:(e,t)=>({...y(t),action:bc(e[0]),path:e[1],force:t.force})});function bc(e){let t=e??`list`;if(t===`list`||t===`state-dir`||t===`save-script`)return t;throw new n(`INVALID_ARGS`,`session only supports list, state-dir, or save-script`)}function xc(e,t,r){if(e!==`save-script`&&(t!==void 0||r===!0))throw new n(`INVALID_ARGS`,`session ${e} does not accept a path or --force; use session save-script [path] [--force] to publish a recording.`)}const Sc={viewport:w({width:O(),height:O(),message:D()},[`width`,`height`,`message`])},Cc=W({name:`viewport`,text:{summary:`Resize the active web viewport for the current session`},metadata:U(`viewport`,`Resize the active web viewport before taking snapshots or screenshots. Useful for fixed-layout or 100vh apps where changing the viewport reveals different content.`,{width:j(P(`Viewport width in CSS pixels.`,{min:1})),height:j(P(`Viewport height in CSS pixels.`,{min:1}))}),run:(e,t)=>e.command.viewport(t),cliSchema:{positionalArgs:[`width`,`height`]},cliReader:(e,t)=>({...y(t),..._e(e)}),daemonWriter:_(u.viewport,e=>{let{width:t,height:n}=e;return[String(t),String(n)]})}),wc=G({name:`management`,commands:[...Cs,Ro,Ts,ac,es,yc,ts,ns,Cc,...Ys,...hc]}),Tc=[`auto`,`react-native`,`expo`,`repack`];function Ec(e){if(e!==void 0){if(Tc.includes(e))return e;throw new n(`INVALID_ARGS`,`metro prepare --kind must be auto, react-native, expo, or repack`)}}const Dc=`metro`,Oc=G({name:`metro`,commands:[W({name:Dc,text:{summary:`Prepare the dev server or reload apps`,cliDetail:`reload with no --metro-host/--metro-port/--bundle-url resolves against the dev server this session last bound via metro prepare or open's metro hint flags (falling back to localhost:8081 only when the session never bound one), so it never silently reloads a different project's server on the default port; pass an explicit flag to override the session hint for one call. After prepare, reload uses the local server address independently of the public or proxy address given to the device; a fresh open preserves it only when its client-config runtime points to the prepared device server, while explicit reload flags override it. For open or an explicit bundle URL, reload removes a .bundle/.jsbundle/.js entry filename and keeps the remaining path as the server mount, and when the server has no HTTP /reload route (Expo) the reload is broadcast over its /message websocket instead of trusting the app-page fallback. The binding is cleared when the session closes, and a fresh open without hint flags also clears any leftover binding from a previous same-name session. --kind expo (detected or forced) requests the virtual-entry bundle URL (.expo/.virtual-metro-entry.bundle) instead of index.bundle, since index.bundle 404s/500s against Expo dev servers in monorepos. Dependency install auto-detects the package manager from the nearest yarn.lock/pnpm-lock.yaml/bun.lock/bun.lockb/package-lock.json walking up from --project-root (bounded at the repo root), so Yarn/pnpm workspace monorepos with the lockfile at the repo root do not wrongly fall back to npm install (which fails on workspace: dependency specifiers); if install still fails, pass --no-install-deps when dependencies are already installed (for example via a monorepo root install).`,mcpDetail:`The binding is cleared when the session closes, and a fresh open without runtime hints also clears any leftover binding from a previous same-name session.`},metadata:U(Dc,`Prepare a React Native development server or ask connected apps to reload, using the development server this session is bound to. Provide explicit runtime inputs only to override that binding for one call.`,{action:j(L([`prepare`,`reload`])),projectRoot:M(),kind:R(D()),publicBaseUrl:M(),proxyBaseUrl:Mr(M(),{operatorPath:`Configure the remote proxy in the remote-config profile or operator config for the process serving these tools.`}),bearerToken:Mr(M(),{envFlagKeys:[`metroBearerToken`,`daemonAuthToken`]}),bridgeScope:R({type:`object`,additionalProperties:!0}),launchUrl:M(),port:P(),listenHost:M(),statusHost:M(),startupTimeoutMs:P(),probeTimeoutMs:P(),reuseExisting:F(),installDependenciesIfNeeded:F(),runtimeFilePath:M(),logPath:M(),metroHost:M(),metroPort:P(),bundleUrl:M(),timeoutMs:P()}),run:async(e,t)=>t.action===`prepare`?await e.metro.prepare(kc(t)):await e.metro.reload(jc(t)),cliSchema:{usageOverride:`metro prepare (--public-base-url <url> | --proxy-base-url <url>) [--project-root <path>] [--port <port>] [--kind auto|react-native|expo|repack]
4
- agent-device metro reload [--metro-host <host>] [--metro-port <port>] [--bundle-url <url>]`,usageFlags:[],listUsageOverride:`metro`,positionalArgs:[`prepare|reload`],allowedFlags:[...Fi,...Pi]},cliReader:(e,t)=>{let r=(e[0]??``).toLowerCase();if(r!==`prepare`&&r!==`reload`)throw new n(`INVALID_ARGS`,`metro requires a subcommand: prepare or reload`);if(r===`reload`)return{action:r,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,timeoutMs:t.metroProbeTimeoutMs};if(!t.metroPublicBaseUrl&&!t.metroProxyBaseUrl)throw new n(`INVALID_ARGS`,`metro prepare requires --public-base-url <url> or --proxy-base-url <url>.`);return{action:r,projectRoot:t.metroProjectRoot,kind:Ec(t.kind??t.metroKind),port:t.metroPreparePort,listenHost:t.metroListenHost,statusHost:t.metroStatusHost,publicBaseUrl:t.metroPublicBaseUrl,proxyBaseUrl:t.metroProxyBaseUrl,bearerToken:t.metroBearerToken,bridgeScope:t.tenant&&t.runId&&t.leaseId?{tenantId:t.tenant,runId:t.runId,leaseId:t.leaseId}:void 0,startupTimeoutMs:t.metroStartupTimeoutMs,probeTimeoutMs:t.metroProbeTimeoutMs,reuseExisting:!t.metroNoReuseExisting&&void 0,installDependenciesIfNeeded:!t.metroNoInstallDeps&&void 0,runtimeFilePath:t.metroRuntimeFile}}})]});function kc(e){return{projectRoot:e.projectRoot,kind:e.kind,publicBaseUrl:e.publicBaseUrl,proxyBaseUrl:e.proxyBaseUrl,bearerToken:e.bearerToken,bridgeScope:e.bridgeScope??Ac(e),port:e.port,listenHost:e.listenHost,statusHost:e.statusHost,startupTimeoutMs:e.startupTimeoutMs,probeTimeoutMs:e.probeTimeoutMs,reuseExisting:e.reuseExisting,installDependenciesIfNeeded:e.installDependenciesIfNeeded,runtimeFilePath:e.runtimeFilePath}}function Ac(e){return e.tenant&&e.runId&&e.leaseId?{tenantId:e.tenant,runId:e.runId,leaseId:e.leaseId}:void 0}function jc(e){return{metroHost:e.metroHost,metroPort:e.metroPort,bundleUrl:e.bundleUrl,timeoutMs:e.timeoutMs}}function Mc(e,t){return e.includes(t)}function Nc(e,t,r={}){let i=t===void 0?void 0:r.normalize?.(t)??t;if(i!==void 0&&Mc(e,i))return i;let a=typeof r.message==`function`?r.message(t):r.message;throw new n(`INVALID_ARGS`,a??`Invalid value: ${t}. Use ${e.join(`|`)}.`)}const Pc=`logs`,Fc=`events`,Ic=`network`,Lc=`audio`,Rc=[`dump`,`log`],zc=[`probe`],Bc=[`start`,`status`,`stop`],Vc=U(Pc,`Session app log info, start/stop streaming, diagnostics, and markers`,{action:L(sr),message:M(),restart:F()}),Hc=U(Fc,`Read the daemon-owned session event timeline as paged JSON-friendly entries`,{limit:P(),cursor:M()}),Uc=U(Ic,`Dump recent HTTP(s) traffic parsed from the session app log`,{action:L(Rc),limit:P(),include:L(a)}),Wc=U(Lc,`Measure browser or host-rendered simulator/emulator audio as compact dBFS buckets. Start a probe before requesting its status or stopping it.`,{action:L(zc),probeAction:L(Bc),durationMs:P(`Probe duration in milliseconds.`),bucketMs:P(`Audio level bucket size in milliseconds.`)}),Gc=G({name:`observability`,commands:[W({name:Pc,text:{summary:`Manage session app logs`},metadata:Vc,run:(e,t)=>e.observability.logs(t),cliSchema:{usageOverride:`logs path | logs start | logs stop | logs clear [--restart] | logs doctor | logs mark [message...]`,usageFlags:[],positionalArgs:[`path|start|stop|clear|doctor|mark`,`message?`],allowsExtraPositionals:!0,allowedFlags:[`restart`]},cliReader:(e,t)=>({...y(t),action:Xc(e[0]),message:e.slice(1).join(` `)||void 0,restart:t.restart}),daemonWriter:_(Pc,e=>Kc(e))}),W({name:Fc,text:{summary:`Read session event timeline`},metadata:Hc,run:(e,t)=>e.observability.events(t),cliSchema:{usageOverride:`events [limit] [cursor]`,listUsageOverride:`events`,positionalArgs:[`limit?`,`cursor?`]},cliReader:(e,t)=>({...y(t),limit:e[0]?.trim()?or(e[0]):void 0,cursor:e[1]}),daemonWriter:e=>v(Fc,qc(e),e)}),W({name:Ic,text:{summary:`Inspect HTTP(S) traffic from session logs`},metadata:Uc,run:(e,t)=>e.observability.network(t),cliSchema:{usageOverride:`network dump [limit] [summary|headers|body|all] [--include summary|headers|body|all] | network log [limit] [summary|headers|body|all] [--include summary|headers|body|all]`,usageFlags:[],listUsageOverride:`network`,positionalArgs:[`dump|log`,`limit?`,`include?`],allowedFlags:[`networkInclude`]},cliReader:(e,t)=>({...y(t),action:Zc(e[0]),limit:or(e[1]),include:t.networkInclude??Qc(e[2])}),daemonWriter:e=>v(Ic,Jc(e),{...e,networkInclude:e.include})}),W({name:Lc,text:{summary:`Probe audio levels`},metadata:Wc,run:(e,t)=>e.observability.audio(t),cliSchema:{usageOverride:`audio probe start [durationSeconds] [bucketMs] | audio probe status | audio probe stop`,listUsageOverride:`audio`,positionalArgs:[`probe`,`start|status|stop`,`durationSeconds?`,`bucketMs?`]},cliReader:(e,t)=>({...y(t),action:$c(e[0]),probeAction:el(e[1]),durationMs:tl(e[2]),bucketMs:or(e[3])}),daemonWriter:e=>v(Lc,Yc(e),e)})]});function Kc(e){return[e.action??`path`,...b(e.message)]}function qc(e){return e.cursor===void 0?x(e.limit):[e.limit===void 0?``:String(e.limit),e.cursor]}function Jc(e){return[...e.action?[e.action]:[],...x(e.limit)]}function Yc(e){return[e.action??`probe`,e.probeAction??`status`,...x(e.durationMs),...x(e.bucketMs)]}function Xc(e){if(e!==void 0)return Nc(sr,e,{message:`logs requires path, start, stop, doctor, mark, or clear`})}function Zc(e){if(e!==void 0){if(e===`dump`||e===`log`)return e;throw new n(`INVALID_ARGS`,`network requires dump or log`)}}function Qc(e){if(e!==void 0)return Nc(a,e,{message:`network include must be summary, headers, body, or all`})}function $c(e){if(e!==void 0)return Nc(zc,e,{message:`audio requires probe`})}function el(e){if(e!==void 0)return Nc(Bc,e,{message:`audio probe requires start, status, or stop`})}function tl(e){let t=or(e);return t===void 0?void 0:Math.round(t*1e3)}const nl=`perf`,rl=G({name:`perf`,commands:[W({name:nl,text:{summary:`Check frames, memory, or native profiles`,cliDetail:`Use perf frames for bounded frame-health evidence and perf memory sample for a compact process-memory reading. On iOS simulators and macOS, process sampling and captures target the resolved app executable and exclude other copies with the same name. Apple xctrace and Android Simpleperf/Perfetto captures keep raw artifacts on disk; report produces bounded agent-readable evidence. For React render performance, run agent-device react-devtools profile start before the interaction and react-devtools profile stop after it.`,mcpDetail:`For CPU profiles, start and stop write the raw artifact while report writes a compact summary; request the report when the task needs readable native CPU evidence. Profiling output is evidence only: compact state, artifact path, and size.`},metadata:U(nl,`Collect frame health, memory diagnostics, and platform profiling artifacts with compact agent-readable summaries.`,{area:j(L(Ct)),subject:L(Dt),action:L(St),kind:L(ht),template:M(`xctrace template name, for example Time Profiler.`),out:M(`Output artifact path.`),tracePath:M(`Existing .trace path to report, defaults to the latest session trace.`)}),run:(e,t)=>e.observability.perf(t),cliSchema:{usageOverride:`perf frames --json
1
+ import{r as e}from"./rolldown-runtime.js";import{$r as t,Br as n,Fr as r,Hr as i,Ir as a,Jr as o,Lr as s,Nn as c,P as ee,er as te,i as ne,ln as re,m as ie,nr as ae,or as oe,p as se,s as ce,st as le,v as ue}from"./sdk-batch.js";import{Q as de,_ as l,mt as fe,n as pe,pt as me,tt as he}from"./sdk-contracts.js";import{_ as ge,h as _e,m as ve,n as ye,o as be,p as xe,r as Se,s as Ce,t as we,v as Te}from"./screenshot.js";import{N as Ee,c as De,d as Oe,f as ke,g as Ae,h as je,l as Me,p as Ne,u as Pe}from"./sdk-batch-runner.js";import{t as Fe}from"./viewport.js";import"./capture.js";import{_t as Ie}from"./sdk-io.js";import{a as Le,n as Re,o as ze,r as Be,t as Ve}from"./sdk-device.js";import{O as He,_ as Ue,m as We}from"./lease-scope.js";import{n as Ge}from"./recording-export-quality.js";import{t as Ke}from"./recording-scope.js";import{a as qe,n as Je,o as Ye,r as Xe,s as Ze}from"./scroll-gesture.js";import{t as Qe}from"./gesture-plan-types.js";import{a as $e,c as et,f as tt,i as nt,m as rt,p as it}from"./script.js";import{a as at,o as ot,r as st}from"./vars.js";import{i as ct,r as lt,t as ut}from"./format.js";import{n as u,t as dt}from"./catalog.js";import{n as ft,r as pt}from"./flag-registry.js";import{n as mt}from"./session.js";import{a as ht,c as gt,d as _t,f as vt,g as yt,h as bt,i as xt,l as St,n as Ct,o as wt,p as Tt,s as Et,t as Dt,u as Ot}from"./observability.js";import{_ as kt,t as At}from"./alert-contract.js";import{h as jt,l as Mt,n as Nt,v as Pt,x as Ft,y as It}from"./settings.js";import{t as Lt}from"./location-coordinates.js";import{t as Rt}from"./snapshot-quality-backend-capabilities.js";import{r as zt}from"./absence-observation.js";import{t as Bt}from"./absence-observation-errors.js";import{t as Vt}from"./click-button.js";import{n as Ht}from"./scroll-command.js";import{n as Ut,t as Wt}from"./interaction-positionals.js";import{t as Gt}from"./app-inventory.js";import{C as Kt,D as qt,E as Jt,_ as Yt,a as Xt,d as Zt,f as Qt,g as $t,h as en,i as tn,m as nn,n as rn,o as an,p as on,r as sn,s as cn,u as ln,w as un}from"./device.js";import{s as dn,u as fn}from"./file.js";import{t as pn}from"./back-mode.js";import{a as mn,n as hn,r as gn,t as _n,u as vn}from"./tv-remote.js";import d from"node:fs";import f from"node:path";function yn(e,t,n){if(Object.hasOwn(e,t))throw new l(`INVALID_ARGS`,n)}function bn(e){return{kind:`operator`,source:e}}function xn(e,t){return`${e} is not accepted as a tool argument. Pass ${t}.`}function Sn(e,t){return`${e} is not accepted as a tool argument. ${Cn(e,t)}`}function Cn(e,t){if(`operatorPath`in t)return t.operatorPath;let n=`for the process serving these tools.`,r=(t.envFlagKeys??[e]).map(Ie).join(` or `);return r===``?`Set ${e} in ~/.agent-device/config.json ${n}`:`Set the ${r} environment variable${t.operatorConfig?` (or ${e} in ~/.agent-device/config.json)`:``} ${n}`}function wn(e){if(e==null)return{};if(!e||typeof e!=`object`||Array.isArray(e))throw new l(`INVALID_ARGS`,`Expected object arguments.`);return e}function Tn(e,t){let n=e[t];if(!n||typeof n!=`object`||Array.isArray(n))throw new l(`INVALID_ARGS`,`Expected ${t} to be an object.`);return n}function En(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw new l(`INVALID_ARGS`,`Expected ${t} to be a string.`);return n}}function p(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`||n.length===0)throw new l(`INVALID_ARGS`,`Expected ${t} to be a non-empty string.`);return n}}function Dn(e,t){let n=e[t];if(typeof n!=`number`||!Number.isFinite(n))throw new l(`INVALID_ARGS`,`Expected ${t} to be a finite number.`);return n}function On(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`boolean`)throw new l(`INVALID_ARGS`,`Expected ${t} to be a boolean.`);return n}}function kn(e,t,n){let r=e[t];if(r!==void 0){if(typeof r!=`string`||!n.includes(r))throw new l(`INVALID_ARGS`,`Expected ${t} to be one of: ${n.join(`, `)}.`);return r}}function An(e,t){let n=e[t];if(n!==void 0){if(!n||typeof n!=`object`||Array.isArray(n))throw new l(`INVALID_ARGS`,`Expected ${t} to be an object.`);return n}}function jn(e,t){let n=e[t];if(n!==void 0){if(!Array.isArray(n)||n.some(e=>typeof e!=`string`))throw new l(`INVALID_ARGS`,`Expected ${t} to be an array of strings.`);return n}}function Mn(e,t,n,r){let i=new Set(t),a=Object.keys(e).filter(e=>!i.has(e));if(a.length>0)throw new l(`INVALID_ARGS`,`${n} has unknown field(s): ${a.join(`, `)}.`,r===void 0?void 0:{hint:r})}function m(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}const h=bn({operatorConfig:!0}),Nn=`readinessTimeoutMs was removed; add an explicit wait for the target before the interaction.`,Pn={session:{schema:{type:`string`,description:`Session name.`},read:e=>p(e,`session`),flagKey:`session`,flagIn:[`input`]},platform:{schema:{type:`string`,enum:Le,description:`Device platform.`},read:e=>kn(e,`platform`,Le),flagKey:`platform`,flagIn:[`input`,`selection`]},deviceTarget:{schema:{type:`string`,enum:Be,description:`Device form factor.`},read:Vn,clientKey:`target`,flagKey:`target`,flagIn:[`input`,`selection`]},target:{schema:{type:`string`,enum:Be,description:`Alias for deviceTarget.`},audience:{kind:`alias`,of:`deviceTarget`}},device:{schema:{type:`string`,description:`Device name; ids go in udid or serial.`},read:e=>p(e,`device`),flagKey:`device`,flagIn:[`input`,`selection`]},udid:{schema:{type:`string`,description:`Apple device or simulator UDID.`},read:e=>p(e,`udid`),flagKey:`udid`,flagIn:[`input`,`selection`]},serial:{schema:{type:`string`,description:`Android, HarmonyOS, or Vega VVD serial.`},read:e=>p(e,`serial`),flagKey:`serial`,flagIn:[`input`,`selection`]},iosSimulatorDeviceSet:{schema:{type:`string`,description:`iOS simulator device-set path used for device resolution.`},read:e=>p(e,`iosSimulatorDeviceSet`),audience:bn({envFlagKeys:[],operatorConfig:!0}),flagKey:`iosSimulatorDeviceSet`,flagIn:[`input`,`selection`]},iosXctestrunFile:{schema:{type:`string`,description:`Externally built iOS XCTest runner .xctestrun artifact path. Build it with the same agent-device version.`},read:e=>p(e,`iosXctestrunFile`),audience:h,flagKey:`iosXctestrunFile`,flagIn:[`input`]},iosXctestDerivedDataPath:{schema:{type:`string`,description:`Derived data path for external iOS XCTest runner execution.`},read:e=>p(e,`iosXctestDerivedDataPath`),audience:h,flagKey:`iosXctestDerivedDataPath`,flagIn:[`input`]},iosXctestEnvDir:{schema:{type:`string`,description:`Writable directory for iOS XCTest runner env overlays.`},read:e=>p(e,`iosXctestEnvDir`),audience:h,flagKey:`iosXctestEnvDir`,flagIn:[`input`]},androidDeviceAllowlist:{schema:{type:`string`,description:`Android serial allowlist used for device resolution.`},read:e=>p(e,`androidDeviceAllowlist`),audience:h,flagKey:`androidDeviceAllowlist`,flagIn:[`input`,`selection`]},noRecord:{read:e=>On(e,`noRecord`),flagKey:`noRecord`,flagIn:[`input`,`selection`]},readinessTimeoutMs:{audience:{kind:`retired`,message:Nn},read:e=>yn(e,`readinessTimeoutMs`,Nn)},daemonBaseUrl:{schema:{type:`string`,description:`Remote daemon base URL.`},read:e=>p(e,`daemonBaseUrl`),audience:h},daemonAuthToken:{schema:{type:`string`,description:`Remote daemon auth token.`},read:e=>p(e,`daemonAuthToken`),audience:h},tenant:{schema:{type:`string`,description:`Remote tenant identifier.`},read:e=>p(e,`tenant`),audience:h},runId:{schema:{type:`string`,description:`Lease run identifier.`},read:e=>p(e,`runId`),audience:h},leaseId:{schema:{type:`string`,description:`Existing lease identifier.`},read:e=>p(e,`leaseId`),audience:h},cwd:{schema:{type:`string`,description:`Working directory for command execution.`},read:e=>p(e,`cwd`),audience:bn({operatorPath:`Start the process serving these tools in the desired working directory, or pass absolute paths.`})},debug:{schema:{type:`boolean`,description:`Enable debug diagnostics.`},read:e=>On(e,`debug`),audience:bn({operatorPath:`Run the same command from a terminal with --debug to see diagnostics.`})}},Fn=Object.entries(Pn),In=Object.fromEntries(Fn.flatMap(([e,t])=>t.audience?[[e,t.audience]]:[]));function Ln(e){for(let[t,n]of Object.entries(In))n.kind===`retired`&&yn(e,t,n.message)}function Rn(){return Object.fromEntries(Fn.flatMap(([e,t])=>t.schema?[[e,t.schema]]:[]))}function zn(e,t={}){let n={};for(let[r,i]of Fn)i.read&&(n[r]=i.read(e,t));return n}function g(e){let t={};for(let[n,r]of Fn)r.read&&(t[r.clientKey??n]=e[n]);return m(t)}function Bn(e,t){let n={};for(let[r,i]of Fn){if(i.flagIn===void 0||!i.flagIn.includes(t))continue;let a=t===`selection`?i.clientKey??r:r;n[a]=e[i.flagKey]}return n}function Vn(e,t){let n=kn(e,`deviceTarget`,Be);if(t.readTargetAlias===!1||e.target===void 0)return n;let r=kn(e,`target`,Be);if(n!==void 0&&r!==n)throw new l(`INVALID_ARGS`,`Expected target alias to match deviceTarget when both are set.`);return n??r}function _(e,t){return n=>v(e,t?t(n):[],n)}function v(e,t,n,r){return{command:e,positionals:t,...r?{input:r}:{},options:Hn(n)}}function Hn(e){let t=Un(e.deviceTarget??e.target);if(t===void 0&&e.target===void 0)return e;let{target:n,...r}=e;return t===void 0?r:{...r,target:t}}function Un(e){return e===`mobile`||e===`tv`||e===`desktop`?e:void 0}function y(e){return m(Bn(e,`input`))}function Wn(e){return m({record:e.record})}function Gn(e){return Bn(e,`selection`)}function Kn(e){return m({depth:e.snapshotDepth,scope:e.snapshotScope,raw:e.snapshotRaw})}function qn(e){return{depth:e.snapshotDepth,scope:e.snapshotScope,raw:e.snapshotRaw}}function Jn(e){return m({settle:e.settle,settleQuietMs:e.settleQuietMs,timeoutMs:e.timeoutMs})}function Yn(e){return m({count:e.count,intervalMs:e.intervalMs,holdMs:e.holdMs,jitterPx:e.jitterPx,doubleTap:e.doubleTap})}function Xn(e){return He(e).spec}function Zn(e){let t=e;if(typeof t.ref==`string`)return[t.ref,...er(t.label)];if(typeof t.selector==`string`)return[t.selector];if(t.x!==void 0||t.y!==void 0)return[String($n(t.x,`x`)),String($n(t.y,`y`))];throw new l(`INVALID_ARGS`,`interaction requires @ref, selector, or point target`)}function Qn(e){let t=e;if(typeof t.ref==`string`)return[t.ref,...er(t.label)];if(typeof t.selector==`string`)return[t.selector];throw new l(`INVALID_ARGS`,`element command requires @ref or selector target`)}function $n(e,t){if(typeof e!=`number`||!Number.isFinite(e))throw new l(`INVALID_ARGS`,`point target requires numeric ${t}.`);return e}function er(e){return typeof e==`string`&&e.length>0?[e]:[]}function tr(e){let t=a(e);if(!t.ok)throw new l(t.code,t.message);return`ref`in t?{ref:t.ref,label:ar(e.slice(1))}:{selector:t.selector}}function nr(e){let t=s(e);if(!t.ok)throw new l(t.code,t.message);return t.format}function rr(e,t={}){let n=o(e,t);if(!n)throw new l(`INVALID_ARGS`,r);return n}function ir(e,t){try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}throw new l(`INVALID_ARGS`,`${t} must be a JSON object`)}function ar(e){return e.join(` `).trim()||void 0}function or(e){return e===void 0||e.trim()===``?!1:Number.isFinite(Number(e))}function sr(e,t){if(e===void 0)return;let n=Number(e);if(Number.isFinite(n))return n;throw new l(`INVALID_ARGS`,`${t} must be a finite number.`)}function cr(e){return e===void 0?void 0:Number(e)}function b(e){return e===void 0?[]:[e]}function x(e){return e===void 0?[]:[String(e)]}function S(e,t){if(e===void 0||e===``)throw new l(`INVALID_ARGS`,t);return e}function C(e,t){if(typeof e!=`string`||e.length===0)throw new l(`INVALID_ARGS`,t);return e}const lr=[`path`,`start`,`stop`,`doctor`,`mark`,`clear`],ur=new Set(ft().map(e=>e.key));function dr(e){let t=We(e);return Ee({stateDir:e.stateDir,daemonBaseUrl:e.daemonBaseUrl,daemonTransport:e.daemonTransport,daemonServerMode:e.daemonServerMode,...Ue(t),provider:e.provider,providerSessionId:e.providerSessionId,providerApp:e.providerApp,providerOsVersion:e.providerOsVersion,providerDeviceType:e.providerDeviceType,providerProject:e.providerProject,providerBuild:e.providerBuild,providerSessionName:e.providerSessionName,providerDeviceOrientation:e.providerDeviceOrientation,providerGeoLocation:e.providerGeoLocation,providerTimezone:e.providerTimezone,providerAppiumVersion:e.providerAppiumVersion,providerLanguage:e.providerLanguage,providerLocale:e.providerLocale,providerNetworkProfile:e.providerNetworkProfile,providerCustomNetwork:e.providerCustomNetwork,providerNoResignApp:e.providerNoResignApp,providerNetworkLogs:e.providerNetworkLogs,providerNetworkHosts:e.providerNetworkHosts,awsProjectArn:e.awsProjectArn,awsDeviceArn:e.awsDeviceArn,awsAppArn:e.awsAppArn,awsRegion:e.awsRegion,awsInteractionMode:e.awsInteractionMode,sessionIsolation:e.sessionIsolation,platform:e.platform,target:e.target,device:e.device,udid:e.udid,serial:e.serial,iosSimulatorDeviceSet:e.iosSimulatorDeviceSet,iosXctestrunFile:e.iosXctestrunFile,iosXctestDerivedDataPath:e.iosXctestDerivedDataPath,iosXctestEnvDir:e.iosXctestEnvDir,androidDeviceAllowlist:e.androidDeviceAllowlist,osVersion:e.osVersion,imageTag:e.imageTag,deviceMode:e.deviceMode,deviceBaseline:e.deviceBaseline,physical:e.physical,surface:e.surface,activity:e.activity,launchConsole:e.launchConsole,launchArgs:e.launchArgs,relaunch:e.relaunch,shutdown:e.shutdown,saveScript:e.saveScript,testIme:e.testIme,noRecord:e.noRecord,recordAs:e.recordAs,record:e.record,backMode:e.backMode,metroHost:e.metroHost,metroPort:e.metroPort,bundleUrl:e.bundleUrl,launchUrl:e.launchUrl,...me(e,he),...xe(e),appsFilter:e.appsFilter,kind:e.kind,out:e.out,count:e.count,fps:e.fps,quality:e.quality,hideTouches:e.hideTouches,recordingScope:e.recordingScope,intervalMs:e.intervalMs,delayMs:e.delayMs,durationMs:e.durationMs,holdMs:e.holdMs,jitterPx:e.jitterPx,pixels:e.pixels,until:e.until,maxPasses:e.maxPasses,doubleTap:e.doubleTap,verify:e.verify,settle:e.settle,settleQuietMs:e.settleQuietMs,clickButton:e.clickButton,pauseMs:e.pauseMs,pattern:e.pattern,headless:e.headless,pick:e.pick,restart:e.restart,replayUpdate:e.replayUpdate,replayBackend:e.replayBackend,replayEnv:e.replayEnv,replayShellEnv:e.replayShellEnv,replayScriptSource:e.replayScriptSource,replayScriptSources:e.replayScriptSources,replayFrom:e.replayFrom,replayPlanDigest:e.replayPlanDigest,replayKeepSession:e.replayKeepSession,failFast:e.failFast,timeoutMs:e.timeoutMs,retries:e.retries,recordVideo:e.recordVideo,artifactsDir:e.artifactsDir,shardAll:e.shardAll,shardSplit:e.shardSplit,findFirst:e.findFirst,findLast:e.findLast,networkInclude:e.networkInclude,batchOnError:e.batchOnError,batchMaxSteps:e.batchMaxSteps,batchSteps:e.batchSteps,verbose:e.debug})}function fr(e,t){return{...dr(e),...t}}function pr(e,t){let n=e.inputSchema.properties;if(!n)return{};let r={},i=t;for(let e of Object.keys(n)){if(!ur.has(e))continue;let t=i[e];mr(t)&&(r[e]=t)}return r}function mr(e){return typeof e==`boolean`||typeof e==`number`||typeof e==`string`}function hr(e){return async(t,n)=>v(u.batch,[],{...t,batchSteps:await gr(t.steps,(t,r,i)=>e(t,r,i,n)),batchOnError:t.onError,batchMaxSteps:t.maxSteps})}async function gr(e,t){if(!Array.isArray(e)||e.length===0)throw new l(`INVALID_ARGS`,`batch requires a non-empty steps array.`);let n=[];for(let[r,i]of e.entries())n.push(await _r(i,r+1,t));return n}async function _r(e,t,n){let r=Ne(e,t),i=yr(r,t),a=ke(r,t);vr(i,a,t);let o=Oe(r.runtime,t),s=await n(i,a,t);return{command:s.command,positionals:s.positionals,...s.input?{input:s.input}:{},flags:fr(s.options,s.metadataFlags),runtime:o??s.options.runtime}}function vr(e,t,n){if(e===u.fill&&t.textStdin===!0)throw new l(`INVALID_ARGS`,`Batch step ${n}: fill textStdin is not supported because batch steps have no stdin of their own. Run that fill on its own with --text-stdin.`,{reason:`fill_text_stdin_in_batch`})}function yr(e,t){return ce(e.command,t)}function br(e){return Cr(e.description,e.cliDetail)}function xr(e){return Cr(e.description,e.mcpDetail)}function Sr(e,t){return{...e,description:t}}function Cr(e,t){return t?`${e} ${t}`:e}function wr(e){return e}function Tr(e){return{...Er(e.inputSchema),...e.inputExample}}function Er(e){return Object.fromEntries((e.required??[]).map(t=>[t,Dr(t,e.properties?.[t])]))}function Dr(e,t){if(t===void 0)return`<${e}>`;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.oneOf!==void 0&&t.oneOf.length>0)return Dr(e,t.oneOf[0]);switch(Array.isArray(t.type)?t.type[0]:t.type){case`object`:return Er(t);case`array`:return t.items===void 0?[]:[Dr(e,t.items)];case`number`:case`integer`:return t.minimum??1;case`boolean`:return!0;default:return`<${e}>`}}function Or(e,t=[],n=new Set){let r=Object.entries(Rn()).filter(([e])=>!n.has(e));return{type:`object`,properties:{...Object.fromEntries(r),...e},...t.length>0?{required:t}:{},additionalProperties:!1}}function w(e,t=[],n){return{type:`object`,...n?{description:n}:{},properties:e,...t.length>0?{required:t}:{}}}function kr(e){return{type:`object`,description:e,properties:{x:{type:`number`},y:{type:`number`}},required:[`x`,`y`],additionalProperties:!1}}function T(e,t){return{type:`string`,enum:e,...t?{description:t}:{}}}function E(e){return{type:`string`,const:e}}function D(e){return{type:`string`,...e?{description:e}:{}}}function Ar(e){return{type:[`string`,`null`],...e?{description:e}:{}}}function O(e,t={}){return{type:`number`,...e?{description:e}:{},...t.min===void 0?{}:{minimum:t.min},...t.max===void 0?{}:{maximum:t.max}}}function jr(e){return{type:`integer`,...e?{description:e}:{}}}function k(e){return{type:`boolean`,...e?{description:e}:{}}}function Mr(e){return{type:`array`,items:{type:`string`},...e?{description:e}:{}}}function A(e){return{type:`object`,additionalProperties:!0,...e?{description:e}:{}}}function j(e){return{...e,required:!0}}function M(e,t={}){return V(D(e),t.allowEmpty===!0?En:p)}function Nr(e){return{schema:{type:`null`},required:!1,audience:{kind:`retired`,message:e},read:(t,n)=>yn(t,n,e)}}function Pr(e,t){return{...e,audience:{kind:`operator`,source:t}}}function N(e,t={}){return V(O(e,t),(e,n)=>Ae(e,n,t))}function P(e,t={}){return V(Qr(e,t),(e,n)=>je(e,n,t))}function F(e){return V(k(e),On)}function I(e){return Ir(Fr(e))}function Fr(e){let[t,...n]=pt(e).filter(e=>e.inputDescription!==void 0);if(!t)throw Error(`Flag ${e} declares no inputDescription; optionField cannot derive a field`);if(n.length>0)throw Error(`Flag ${e} declares inputDescription more than once`);return t}function Ir(e){let t=e.inputDescription,n={min:e.min,max:e.max};switch(e.type){case`boolean`:return F(t);case`int`:return P(t,n);case`number`:return N(t,n);case`string`:return M(t);case`enum`:return L(Lr(e),t);case`booleanOrString`:throw Error(`Flag ${e.key} is booleanOrString; declare its field shape explicitly with jsonSchemaField`)}}function Lr(e){let t=e.enumValues;if(!t)throw Error(`Flag ${e.key} is an enum with no enumValues`);return t}function L(e,t){return V(T(e,t),(t,n)=>kn(t,n,e))}function Rr(e){return V(A(e),An)}function zr(e){return V(Mr(e),jn)}function R(e){return V(e,(e,t)=>e[t])}function Br(e,t){return V(e,t)}function Vr(e){return V(kr(e),(e,t)=>e[t]===void 0?void 0:Yr(e,t))}function Hr(e,t){return V({type:`array`,description:e,items:kr(`One contact point.`),minItems:t.min,maxItems:t.max},(e,t)=>e[t]===void 0?void 0:Ur(e,t))}function Ur(e,t){let n=e[t];if(!Array.isArray(n))throw new l(`INVALID_ARGS`,`Expected ${t} to be an array of points.`);return n.map((e,n)=>{let r=`${t}[${n}]`;return Yr({[r]:e},r)})}function z(){return{depth:P(`Snapshot traversal depth.`,{min:0}),scope:M(`Snapshot scope selector used before resolution.`),raw:F(`Use raw snapshot data during selector resolution.`)}}function Wr(){return{count:P(`Number of press/click repetitions.`,{min:1}),intervalMs:P(`Delay between repeated press/click actions.`,{min:0}),holdMs:P(`Hold duration for each action.`,{min:0}),jitterPx:P(`Deterministic per-axis coordinate jitter in pixels (each press offsets x and y by up to this amount).`,{min:0}),doubleTap:F(`Request a double-tap action.`)}}function Gr(){return{postGestureStabilization:Pr(I(`postGestureStabilization`),{operatorConfig:!0})}}function Kr(){return{osVersion:qr(`osVersion`),imageTag:qr(`imageTag`),deviceMode:qr(`deviceMode`),deviceBaseline:qr(`deviceBaseline`),physical:qr(`physical`)}}function qr(e){return Br(I(e).schema,t=>He({[e]:t[e]}).spec[e])}function Jr(e){return Or($r(e),ti(e),ei(e))}function B(e,t){let n=wn(e),r=Object.fromEntries(Object.entries(t).flatMap(([e,t])=>{let r=t.read(n,e);if(t.required&&r===void 0)throw new l(`INVALID_ARGS`,`Expected ${e} to be set.`);return r===void 0?[]:[[e,r]]})),i=zn(n,{readTargetAlias:!Object.hasOwn(t,`target`)});return m({...i,...g(i),...r})}function Yr(e,t){let n=Tn(e,t);return{x:Dn(n,`x`),y:Dn(n,`y`)}}function Xr(e){return{count:e.count,intervalMs:e.intervalMs,holdMs:e.holdMs,jitterPx:e.jitterPx,doubleTap:e.doubleTap}}function Zr(e){return{depth:e.depth,scope:e.scope,raw:e.raw}}function V(e,t){return{schema:e,required:!1,read:t}}function Qr(e,t){return{...jr(e),...t.min===void 0?{}:{minimum:t.min},...t.max===void 0?{}:{maximum:t.max}}}function $r(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e.audience?.kind!==`retired`).map(([e,t])=>[e,t.schema]))}function ei(e){return new Set(Object.entries(e).flatMap(([e,t])=>t.audience?.kind===`retired`?[e]:[]))}function ti(e){return Object.entries(e).flatMap(([e,t])=>t.required?[e]:[])}function ni(e){return Object.fromEntries(Object.entries(e).flatMap(([e,t])=>t.audience?[[e,t.audience]]:[]))}const ri={ref:`@e12`},ii=`{"ref":"@e12"}`,ai=String.raw`{"selector":"id=\"submit\""}`,oi=`${ii} or ${ai}`,si=`${ii}, ${ai}, or {"x":120,"y":340}`;function ci(){return ui(oi,`ref or selector`)}function li(){return{...ui(si,`ref, selector, or x+y`),x:N(`Screen x coordinate, with y. Pass exactly one of ref, selector, or x+y; use x+y only when no ref or selector is available.`),y:N(`Screen y coordinate, with x. Pass exactly one of ref, selector, or x+y.`)}}function ui(e,t){return{ref:M(`Snapshot element ref such as @e12. Pass exactly one of ${t}.`),label:M(`Optional human label for ref.`),selector:M(`Selector expression such as id="submit" or label="Sign in". Pass exactly one of ${t}.`),target:Nr(`target was removed; pass the UI target at the top level: ${e}.`),kind:Nr(`kind was removed; the key you pass picks the UI target: ${e}.`)}}function di(e,t){let{ref:n,label:r,selector:i,x:a,y:o,...s}=B(e,t),c=[n===void 0?[]:[`ref`],i===void 0?[]:[`selector`],a===void 0&&o===void 0?[]:[`x/y`]].flat();if(c.length!==1){let e=`x`in t?si:oi;throw new l(`INVALID_ARGS`,c.length===0?`Expected a UI target.`:`Expected one UI target, got ${c.join(` and `)}.`,{hint:`Pass exactly one of: ${e}.`})}if(r!==void 0&&n===void 0)throw new l(`INVALID_ARGS`,`label applies only with ref.`,{hint:`Pass label together with ref, for example {"ref":"@e12","label":"Sign in"}.`});if(c[0]===`x/y`&&(a===void 0||o===void 0))throw new l(`INVALID_ARGS`,`Expected x and y together.`,{hint:`Pass both screen coordinates, for example {"x":120,"y":340}.`});let ee=H({ref:n,label:r,selector:i,x:a,y:o});return{...s,...ee}}function H(e){return e.ref===void 0?e.selector===void 0?{x:e.x,y:e.y}:{selector:e.selector}:m({ref:e.ref,label:e.label})}function U(e,t,n,r){return wr({name:e,description:t,inputSchema:Jr(n),readInput:r?.readInput??(e=>B(e,n)),inputAudience:ni(n),...r?.parseableOutput?{parseableOutput:!0}:{},...r?.inputExample?{inputExample:r.inputExample}:{}})}function W(e){let t=Sr(e.text,e.metadata.description),n=t.mcpDetail?{mcpDetail:t.mcpDetail}:{},r={...e.metadata,title:t.summary,effect:e.effect,searchHint:t.searchHint,...n},i={name:r.name,description:r.description,inputSchema:r.inputSchema,...n,invoke:async(t,n)=>await e.run(t,r.readInput(n))};return{name:e.name,metadata:r,definition:i,cliSchema:{...e.cliSchema,text:t},cliReader:e.cliReader,daemonWriter:e.daemonWriter,text:t}}function fi(e){return W({name:e.name,effect:e.effect,text:e.text,metadata:U(e.name,e.description,{}),run:e.run,cliSchema:{},cliReader:(e,t)=>y(t),daemonWriter:_(e.name)})}function G(e){let t={},n={},r={};for(let i of e.commands)pi(t,`CLI schema`,i.name,i.cliSchema),pi(n,`CLI reader`,i.name,i.cliReader),i.daemonWriter&&pi(r,`daemon writer`,i.name,i.daemonWriter);return{name:e.name,clientSurface:e.clientSurface,metadata:e.commands.map(e=>e.metadata),definitions:e.commands.map(e=>e.definition),cliSchemas:t,cliReaders:n,daemonWriters:r}}function pi(e,t,n,r){if(Object.hasOwn(e,n))throw Error(`Duplicate command family ${t}: ${n}`);e[n]=r}function mi(e=ne){let t=hi(e);return U(`batch`,`Execute multiple commands in one daemon request.`,t,{readInput:e=>_i(e,t),...e.includes(`snapshot`)?{inputExample:{steps:[{command:`snapshot`,input:{interactiveOnly:!0}}]}}:{}})}function hi(e){return{steps:j(Br({type:`array`,description:`Structured batch steps. Each step uses a command name and the same input object as that command tool.`,items:gi(e)},(t,n)=>vi(t[n],e))),onError:L([`stop`],`Batch failure policy.`),maxSteps:P(`Maximum number of steps accepted for this batch.`,{min:1,max:1e3}),out:M(`Optional output path for command artifacts.`)}}function gi(e){return{type:`object`,properties:{command:{type:`string`,enum:e,description:`Command name to run with structured input.`},input:{type:`object`,additionalProperties:!0,commandInputFor:`command`,description:`Structured command input for the nested command. Use the matching MCP tool schema for this object.`},runtime:{type:`object`,additionalProperties:!0,description:`Optional per-step runtime payload.`}},required:[`command`,`input`],additionalProperties:!1}}function _i(e,t){let n=B(e,t),r=n.maxSteps??100;if(!Pe(r))throw new l(`INVALID_ARGS`,`Invalid batch maxSteps: ${String(n.maxSteps)}`);return Me(n.steps.length,r),{...n}}function vi(e,t){if(!Array.isArray(e))throw new l(`INVALID_ARGS`,`Expected steps to be an array.`);return e.map((e,n)=>yi(e,n+1,t))}function yi(e,t,n){let r=Ne(e,t);return Mn(r,[`command`,`input`,`runtime`],`Batch step ${t}`,De),{command:bi(r,t,n),input:ke(r,t),...xi(r,t)}}function bi(e,t,n){if(n===ne)return ce(e.command,t);let r=e.command;if(typeof r!=`string`||!n.includes(r))throw new l(`INVALID_ARGS`,`Expected command to be one of: ${n.join(`, `)}.`);return r}function xi(e,t){let n=Oe(e.runtime,t);return n===void 0?{}:{runtime:n}}const Si=(le.batch.daemonDeadlineMs??0)/1e3,Ci=mi(),wi={usageOverride:`batch [--steps <json> | --steps-file <path>]`,usageFlags:[],listUsageOverride:`batch --steps <json> | --steps-file <path>`,allowedFlags:[`steps`,`stepsFile`,`batchOnError`,`batchMaxSteps`,`out`]},Ti=(e,t)=>({...y(t),steps:t.batchSteps??[],onError:t.batchOnError,maxSteps:t.batchMaxSteps,out:t.out}),Ei=[{command:`press`,input:{ref:`@e12`,settle:!0}},{command:`press`,input:{selector:`label=Settings`,settle:!0}},{command:`fill`,input:{selector:`id="field-email"`,text:`qa@example.com`}},{command:`scroll`,input:{direction:`down`,until:`label=Privacy`,settle:!0}},{command:`back`,input:{settle:!0}},{command:`wait`,input:{kind:`text`,text:`Saved`}},{command:`snapshot`,input:{interactiveOnly:!0}}],Di=[`Use it for a known multi-step walk, such as press A, press B, back, instead of one tool call per step.`,`steps is an array of {command, input} objects; input takes the same arguments as that command's own tool (ref, selector, or x and y for targets; settle: true for the settled diff).`,`Steps run serially in one session; onError: "stop" halts at the first failing step, and the result reports the steps that ran.`,`The daemon stops the whole batch after ${Si} seconds; split longer walks.`,`Example steps, in order (refs such as @e12 come from the last snapshot or settled diff): ${Ei.map(e=>JSON.stringify(e)).join(`, `)}.`].join(` `);function Oi(){return`${[`Each step is {"command":"<name>","input":{...}}, and input is that command's structured input object rather than its terminal spelling: a CLI positional becomes a named field (for example ref, label, selector, x, y, text, direction) and a CLI flag becomes a camelCase key (--settle -> "settle":true, -i -> "interactiveOnly":true). There is no positional step form; args, argv, positionals, and flags are not step fields. agent-device help <command> lists arguments in CLI spelling only. The examples below carry the structured spelling; over MCP, the command tool schema states it in full.`,`Steps run serially in one daemon request against the same session, in order. Mutating UI verbs are included (press, click, fill, longpress, scroll, back), which is where the round-trip saving is; --on-error stop halts at the first failing step.`,`The whole batch has a 60-second work budget inside a 90-second client timeout. The running step receives ordinary request cancellation at the budget. When it settles, failure returns COMMAND_FAILED with details.reason daemon_request_timeout and preserves executed, partialResults, and dispatch status. The daemon and other sessions stay available if it responds; a close step may already have ended its session. A completed batch returns success even if it settles just after the deadline. Cancellation does not prove native device work stopped. A step that ignores cancellation beyond the 30-second margin may cause a transport timeout; an unresponsive daemon retains the client liveness-based reset. Split longer sequences into separate requests.`,`Available through batch: ${[...ne].sort().join(`, `)}.`,`Every other command is excluded: batch and replay never nest, and session, daemon, connection, and host tooling commands own lifecycle a batch request cannot carry. Run those on their own.`].join(` `)}\n\nExamples:\n${[` agent-device batch --steps '${JSON.stringify(Ei)}'`,` agent-device batch --steps-file ./steps.json --json`].join(`
2
+ `)}`}const ki=G({name:`batch`,clientSurface:!1,commands:[W({name:`batch`,effect:`destructive`,text:{summary:`Run multiple commands`,mcpDetail:Di,searchHint:`sequence chain several taps`,cliDetail:Oi()},metadata:Ci,run:(e,t)=>e.batch.run(Ai(t)),cliSchema:wi,cliReader:Ti})]});function Ai(e){return{...g(e),steps:e.steps,onError:e.onError,maxSteps:e.maxSteps,out:e.out}}const ji=`alert`,Mi=W({name:ji,effect:`destructive`,text:{summary:`Inspect, accept, or dismiss a platform alert`,searchHint:`dialog system`},metadata:U(ji,`Inspect, wait for, accept, or dismiss a platform alert. The get action reads alert content; accept and dismiss change the active alert state. Each iOS XCTest execution activates once, then only observes. Apple XCTest and Limrun iOS choose recognized English labels by preference (Allow While Using App before Allow Once); on iOS simulators, including Limrun, the runner also recognizes the device's preferred languages' wording of those labels from the OS permission-prompt strings, on any alert; equal-ranked choices and unknown labels refuse, including a lone unknown button. Open, Done, and Confirm… accept; Keep Browsing, Deny, and Skip dismiss. On the Apple XCUITest runner, dismiss taps only a recognized decline label (Cancel, Don't Allow, Ask App Not to Track, and similar) or the close element of a popover whose accessibility marker reads exactly "dismiss popup"; when no button fits the action, accept and dismiss answer ALERT_BUTTON_NOT_FOUND having tapped nothing. The get action exposes labels for explicit button targeting. The timeout argument is the poll window only for wait: a wait polls its whole window, accepted up to 2147453647 ms, and a longer one is refused before anything runs with details.reason: alert-wait-window-too-long and details.maxWaitWindowMs, never shortened. On the Apple XCUITest runner, get takes the same argument as the runner's read budget (10 s by default, at least 1.5 s, at most 25 s); other backends' get ignores it. For wait, the first XCTest read uses the requested window capped at 25 s; later reads use the remaining window with the same cap, without the 1.5 s floor. Every backend's accept and dismiss run their own retry window and ignore the argument. A get the runner's watchdog (the same budget) cuts off answers runner_main_thread_timeout with dispatched: unknown, which does not mean no alert; the next get waits out RUNNER_BUSY while abandoned work drains, and still answers RUNNER_BUSY (dispatched: no) if that outlasts the bounded resends. A get result with status none reports no alert. An alert-not-found refusal means no alert was found and no button was pressed. An alert-wait-timeout means no actionable alert resolved within the wait window. A refusal with dispatched: no means no button was activated. After a press, an unconfirmed outcome leaves the resulting alert state unknown.`,{action:L(At),timeoutMs:P()}),run:(e,t)=>e.command.alert(t),cliSchema:{usageOverride:`alert [get|accept|dismiss|wait] [timeout]`,positionalArgs:[`action?`,`timeout?`]},cliReader:(e,t)=>({...y(t),...Pi(e)}),daemonWriter:_(u.alert,e=>Ni(e))});function Ni(e){return[e.action??`get`,...x(e.timeoutMs)]}function Pi(e){if(e.length>2)throw new l(`INVALID_ARGS`,`alert accepts at most action and timeout arguments.`);return m({action:Fi(e[0]),timeoutMs:sr(e[1],`alert timeout`)})}function Fi(e){if(e===void 0)return;let t=kt(e);if(t)return t;throw new l(`INVALID_ARGS`,`alert action must be get, accept, dismiss, or wait.`)}function K(...e){return e}const Ii=K(`keyframes`),Li=K(`snapshotInteractiveOnly`,`snapshotDepth`,`snapshotScope`,`snapshotRaw`),q=K(`snapshotDepth`,`snapshotScope`,`snapshotRaw`),Ri=K(`metroProjectRoot`,`kind`,`metroKind`,`metroPublicBaseUrl`,`metroProxyBaseUrl`,`metroBearerToken`,`metroPreparePort`,`metroListenHost`,`metroStatusHost`,`metroStartupTimeoutMs`,`metroProbeTimeoutMs`,`metroRuntimeFile`,`metroNoReuseExisting`,`metroNoInstallDeps`),zi=K(`metroHost`,`metroPort`,`bundleUrl`),Bi=K(`osVersion`,`imageTag`,`deviceMode`,`deviceBaseline`,`physical`),Vi=K(`count`,`intervalMs`,`holdMs`,`jitterPx`,`doubleTap`),Hi=K(`settle`,`settleQuietMs`,`timeoutMs`),Ui=K(`replayUpdate`,`replayEnv`),Wi=K(`remoteConfig`,`stateDir`,`daemonBaseUrl`,`daemonAuthToken`,`daemonTransport`,`daemonServerMode`,`tenant`,`sessionIsolation`,`runId`,`leaseId`,`leaseBackend`,`sessionLock`,`platform`,`target`,`device`,`providerApp`,`providerOsVersion`,`providerDeviceType`,`providerProject`,`providerBuild`,`providerSessionName`,`providerDeviceOrientation`,`providerGeoLocation`,`providerTimezone`,`providerAppiumVersion`,`providerLanguage`,`providerLocale`,`providerNetworkProfile`,`providerCustomNetwork`,`providerNoResignApp`,`providerNetworkLogs`,`providerNetworkHosts`,`awsProjectArn`,`awsDeviceArn`,`awsAppArn`,`awsRegion`,`awsInteractionMode`,`udid`,`serial`,`iosSimulatorDeviceSet`,`iosXctestrunFile`,`iosXctestDerivedDataPath`,`iosXctestEnvDir`,`androidDeviceAllowlist`,`session`,`noRecord`),Gi=new Set([`platform`,`device`,`udid`,`serial`,`session`]),Ki=new Set([`json`,`config`,`help`,`version`,`verbose`,`cost`,`responseLevel`]),qi=`diff`,Ji={diff:w({mode:E(`snapshot`),baselineInitialized:k(),summary:w({additions:O(),removals:O(),unchanged:O()},[`additions`,`removals`,`unchanged`]),lines:{type:`array`,items:w({kind:T([`added`,`removed`,`unchanged`]),text:D(),ref:D()},[`kind`,`text`])},warnings:Mr()},[`mode`,`baselineInitialized`,`summary`,`lines`])},Yi=W({name:qi,effect:`write`,text:{summary:`Diff snapshot or screenshot`,searchHint:`visual regression baseline`,cliDetail:`Screenshot --threshold is a per-pixel RGB tolerance: 0 requires exact colors and 1 ignores color differences; the current image scales proportionally to the baseline width and aligns top-left. Scaled height rounds to the nearest pixel (minimum 1). Extra or missing bottom rows always count as differences, even at threshold 1. The originals remain unchanged. When dimensions differ, normalization metadata reports original, scaled and compared sizes; region coordinates use comparison pixels. Both screenshot inputs are decoded from their bytes, so a baseline or current image may be PNG or JPEG, and the diff image is always PNG. JPEG is lossy, so keep --threshold above 0 whenever either input is JPEG. Live iOS simulator screenshot diffs normalize status-bar chrome by default; use screenshot --normalize-status-bar when capturing reusable baselines. Use --screen-mask black for a live iOS simulator capture with a black screen outline, and use the same option when creating its baseline. --screen-mask is refused when current.png is supplied; saved images are compared unchanged.`},metadata:U(qi,`Compare accessibility snapshots or screenshots to identify UI changes. Snapshot comparisons report semantic tree changes; screenshot comparisons report pixel differences.`,{kind:j(R({type:`string`,const:`snapshot`})),out:M(),interactiveOnly:F(),depth:P(),scope:M(),raw:F()}),run:(e,t)=>e.capture.diff(t),cliSchema:{usageOverride:`diff snapshot | diff screenshot --baseline <path> [current.png] [--out <diff.png>] [--threshold <0-1>] [--overlay-refs] [--screen-mask <black>]`,usageFlags:[],positionalArgs:[`kind`,`current?`],flagsByAction:{snapshot:[],screenshot:[`screenshotScreenMask`]},allowedFlags:[...Li,`baseline`,`threshold`,`out`,`overlayRefs`,`screenshotScreenMask`]},cliReader:(e,t)=>{if(e[0]!==`snapshot`)throw new l(`INVALID_ARGS`,`Only diff snapshot is available through this parser.`);return{...y(t),kind:`snapshot`,out:t.out,interactiveOnly:t.snapshotInteractiveOnly,depth:t.snapshotDepth,scope:t.snapshotScope,raw:t.snapshotRaw}},daemonWriter:_(u.diff,e=>[C(e.kind,`diff requires kind`)])}),Xi=`screenshot`,Zi=W({name:Xi,effect:`write`,text:{summary:`Capture a screenshot`,searchHint:`picture screen png`,cliDetail:`Web defaults to the viewport; use --fullscreen, --full, or -f for the entire page. iOS simulators default to 1x logical-point output; use --pixel-density to request a different screenshot density. Use --screen-mask black to fill the iOS simulator screen outline, including rounded corners, with black for this capture. It requires simctl: physical devices, tvOS and visionOS simulators, other platforms, provider captures and XCTest runner captures are refused. A masked capture fails if simctl fails instead of falling back to an unmasked runner capture. macOS app sessions default to the app window; use --fullscreen for full desktop, --scale to downscale, --crop-on <selector> to crop the capture to the frame the selector resolves on the same screen (currently iOS simulators, Android emulators, and CoreDevice physical iPhones), --overlay-refs to annotate current refs, --normalize-status-bar for deterministic iOS simulator or Android chrome. Physical iPhone crop verification covers portrait CoreDevice/devicectl captures only. XCTest, runner fallback, and physical iPad crops are refused; landscape iPhone crop is unverified. Android captures immediately by default; --normalize-status-bar also waits for transient UI to fade, and --no-stabilize keeps capture immediate. With the native macOS backend, the front window is the app's frontmost visible, nonempty normal-level (layer-0) window on the current Space: floating palettes and app-modal alerts at window level 8 are skipped, as is the small indicator window macOS adds in front of a window that a screen-sharing stream captures, and a sheet is captured as its own window. On macOS, any --surface other than app (desktop, menubar, frontmost-app) always captures the main display and refuses an explicit --fullscreen. On single-display iOS simulators and Android devices, the result reports displayRotation, the rotation the display rendered the capture in, when the device returns a reading in time; otherwise the field is absent. On iOS simulators a screenshot waits for that simulator's status bar to be free, and a request its caller cancelled while it waits reports the cancellation instead of capturing.`},metadata:U(Xi,`Capture a screenshot of the active app or web session. Input fields control capture scope, density, size, and annotations. Use it for visual evidence, or when a snapshot warns that the accessibility tree is sparse: read the image, then press by coordinates. A screenshot alone does not verify a result.`,{path:M(`Output path.`),cropOn:M(`Selector expression; the capture is cropped to the frame the selector resolves on the same screen.`),overlayRefs:F(),pixelDensity:P(`Output screenshot pixel density in pixels per logical point.`,{min:1}),screenMask:L(Ce,`Fill the iOS simulator screen outline with black for this capture. Requires simctl; omit for the default image.`),fullscreen:F(),scale:N(`Screenshot scale factor.`,be),maxSize:Nr(we.migration.screenshot),stabilize:F(),normalizeStatusBar:F(),captureBackend:L(ye,`Capture through the XCTest runner instead of the platform default, which leaves out the simulator-drawn Dynamic Island. Local Apple targets only; refused on provider sessions and on a macOS surface the helper captures, and with pixelDensity, screenMask or normalizeStatusBar.`),surface:L(mt)}),run:(e,t)=>e.capture.screenshot(t),cliSchema:{positionalArgs:[`path?`],allowedFlags:Se},cliReader:(e,t)=>({...y(t),path:e[0]??t.out,..._e(t)}),daemonWriter:e=>(ge(`screenshot`,e),Te(e),v(u.screenshot,b(e.path),{...e,...ve(e)}))}),Qi=`settings`,$i=U(Qi,`Read or change supported operating-system settings, animation scales, appearance, or app permissions on the selected target. Platform support varies by setting and action.`,{setting:j(L(It)),state:M(),app:M("App the change targets, by bundle id, package name, or app name: the app `clear-app-state` clears, or the app a `permission` change (or an iOS-simulator `location on|off` privacy change) lands on. A name resolves to the installed app as `open` resolves it: an iOS simulator, local or Limrun, matches display names and accepts only an installed bundle id, and Android accepts only an installed package and refuses a name that resolves to an intent with `setting_app_not_package`. One that resolves to nothing is refused with `app_not_installed` before anything changes. The app need not be running. Without it the session app is used; a device-wide change (`location set` on any target, the Android `location on|off` toggle, `mobile-data`, macOS permissions) refuses one with `setting_app_not_consumed`. The CLI reads it only from this invocation, never from `AGENT_DEVICE_TARGET_APP` or config `targetApp`."),latitude:N(),longitude:N(),permission:M(),mode:L([...Pt])}),ea={usageOverride:Nt,listUsageOverride:`settings [area] [options]`,positionalArgs:[`setting`,`state?`,`target?`,`mode?`],allowedFlags:[`targetApp`],explicitOnlyFlags:[`targetApp`]},ta=(e,t)=>{let n=Gn(t),r=re(e);if(r.kind===`read`)return{...n,setting:r.setting};let i=Mt(e),a=Ft(i.setting)?.app===`positional`?aa(i.setting,i.app,t):t.targetApp;return{...n,setting:i.setting,state:i.state,...i.permission===void 0?{}:{permission:i.permission},...i.mode===void 0?{}:{mode:i.mode},...i.latitude===void 0?{}:{latitude:Lt(i.latitude,`latitude`),longitude:Lt(i.longitude,`longitude`)},...a===void 0?{}:{app:a}}},na=e=>{let t=e,n=m({app:ra(t)});return v(u.settings,oa(t),e,Object.keys(n).length===0?void 0:n)};function ra(e){return Ft(e.setting)?.app===`input`&&`app`in e?e.app:void 0}const ia=W({name:Qi,effect:`destructive`,text:{summary:`Change OS settings and app permissions`,searchHint:`wifi airplane location dark mode permission grant revoke`,cliDetail:[`A bare readable setting reads the value the target holds. A target that does not serve a setting refuses it with UNSUPPORTED_OPERATION before anything changes.`,``,`On an iOS simulator, settings wifi and settings airplane wait for screenshots and other status bar writes. The request timeout includes this wait (90 seconds for a standalone CLI request). Once the write starts, its status bar command has a separate 10-second timeout. A request or write that times out may already have changed the bar; check the bar before relying on it. Cancelling while still queued guarantees nothing was written.`,``,`Settings:`,...jt().map(e=>` ${e}`)].join(`
3
+ `)},metadata:$i,run:(e,t)=>e.settings.update(t),cliSchema:ea,cliReader:ta,daemonWriter:na});function aa(e,t,n){let r=n.targetApp;if(t!==void 0&&r!==void 0&&t!==r)throw new l(`INVALID_ARGS`,`settings ${e} names two apps: ${t} and ${r}. Name one.`);return t??r}function oa(e){return Ft(e.setting)?.app===`positional`?[e.setting,...b(`app`in e?e.app:void 0)]:e.state===void 0?[e.setting]:`latitude`in e?[e.setting,e.state,String(e.latitude),String(e.longitude)]:`permission`in e?[e.setting,e.state,e.permission,...b(e.mode)]:[e.setting,e.state]}const sa=`snapshot`,ca=Object.entries(Rt).map(([e,t])=>{let n=t.knownGaps.map(e=>`known gap ${e}`);return`${e}: hittable=${t.hittable}, regular-depth=${t.regularDepth}, deep-extension=${t.deepExtension}, depth-ladder=${t.depthLadder}${n.length>0?`, ${n.join(`, `)}`:``}`}).join(`; `),la=U(sa,`Capture the accessibility tree or compare it with the previous session baseline. The result includes refs for semantic interactions; the diff option reports UI changes. interactiveOnly lists only elements you can act on. After an action with settle, take a snapshot only when its diff lacks the next target or did not settle.`,{interactiveOnly:F(),depth:P(),scope:M(),raw:F(),customActions:I(`snapshotCustomActions`),observeOnly:I(`snapshotObserveOnly`),forceFull:F(),timeoutMs:P(`Maximum wall-clock time for the snapshot command.`),noRecord:F(`Do not record this action.`),record:F(`Force-record this out-of-band observation into a repair-armed heal (mutually exclusive with noRecord). Authored replay steps are recorded automatically and never need this.`)}),ua={allowedFlags:[`snapshotDiff`,...Li,`snapshotCustomActions`,`snapshotObserveOnly`,`snapshotForceFull`,`timeoutMs`,`record`]},da=(e,t)=>({...y(t),...Wn(t),...fe(t,he),timeoutMs:t.timeoutMs}),fa=_(u.snapshot),pa=W({name:sa,effect:`write`,text:{summary:`Capture or diff the accessibility tree`,searchHint:`inspect screen hierarchy`,cliDetail:`Scoped output (--scope) renders every returned ref with its ref generation pin (@eN~s<refsGeneration>) and one Refs generation line, so a pasted ref targets the ref frame that issued it; --json keeps plain refs plus the response-level refsGeneration, and --raw keeps byte-for-byte output. Regular Android ADB snapshots clip app rectangles outside measured status and navigation bars, including launcher-owned navigation; fully covered content is omitted and --raw retains reported bounds. Ref and selector taps honor measured visible bounds even for refs from raw snapshots. Regular iOS snapshots clip overflowing elements to their visible area and omit fully outside elements. In a regular (non-raw) snapshot, a listed element whose frame has no area is marked [unmeasured]: nothing confirms it is on screen. If it is inside scrollable content, reach it with scroll <direction> --until <selector> before acting on it. --json reports clipping counts in snapshotQualityNotes with code regular-geometry-clipped; --raw retains reported frames. --observe-only is local iOS snapshot-only: an already-ready compatible runner reads the session app without activation or foreground repair, refuses unavailable observation or a readable system alert over the app, and reports XCUIApplication state rather than verified foreground ownership (#2696). Regular targetActivation disclosure stays unchanged (#2682, #2694). Repeated equivalent unfiltered Android snapshots return a compact unchanged acknowledgement. Use --force-full to re-emit the tree; --json and --raw retain full output. Android Appium JSON snapshots publish a display viewport only when measurements before and after the tree agree, independent of tree extent or keyboard content resizing. On Android, JSON value carries field content rather than static labels; saved selectors and replay scripts using value= for static labels must use label= instead; a reported showing hint means value is empty, and text equal to the placeholder is preserved when hint state is unknown. HarmonyOS reads the on-screen keyboard's own system window and publishes the keyboard field of --json output: the field is visibility-only — visible or hidden per the keyboard window's z-order column; a failed probe, an unreadable or conflicting z-order, or a table without the panel publishes unmeasurable, never a guessed band. When an iOS snapshot reports a screen viewport, inspect rects with snapshot -i --json and press the intended control's center, then verify with diff snapshot -i or snapshot --diff. When a fallback cannot establish the screen origin, viewport is omitted and coordinate-derived element actions refuse with window-origin-unknown before input; the snapshot may warn about the unavailable origin. Use a plain screenshot to choose screen coordinates. --actions names the affordances an element merged away (iOS UIAccessibilityCustomAction, React Native accessibilityActions), so a card whose reply or options controls are not separate elements still lists them. The names are for planning, not invocation: no API triggers 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. An empty text field with no label or value prints its hint as [placeholder:"..."]; label=, text= and find do not match that hint. iOS backend capability contract: ${ca}.`},metadata:la,run:(e,t)=>e.capture.snapshot(t),cliSchema:ua,cliReader:da,daemonWriter:fa}),ma=[`duration`,`text`,`ref`,`selector`,`absent`,`stable`],ha=`wait`,ga={wait:w({waitedMs:O(),kind:E(`selector`),text:D(),selector:D(),captures:O(),nodeCount:O(),hint:D(),warning:D()},[`waitedMs`])},_a=W({name:ha,effect:`write`,text:{summary:`Wait for a duration, text, selector, strict absence, or stable UI`,searchHint:`disappear sleep assert visible`},metadata:U(ha,`Wait for a duration, text, snapshot ref, selector to appear, selector to be strictly absent, or stable UI. Text matches a label, identifier, or value; an editable field never matches by its current value or by a label that only repeats it, so text you typed does not satisfy it. The strict absence target requires zero selector matches; stable waits until the UI stays quiet for the requested window. Use it to verify an expected result, such as text that appears after a network call, instead of polling with snapshot.`,{kind:L(ma),durationMs:P(),text:M(),ref:M(),selector:M(),absent:M(),stable:F(),quietMs:P(),timeoutMs:P(),depth:P(),scope:M(),raw:F()}),run:(e,t)=>e.command.wait(va(t)),cliSchema:{usageOverride:`wait <ms>|text <text>|@ref|<selector>|absent <selector> [timeoutMs]|stable [quietMs] [timeoutMs]`,usageFlags:[],positionalArgs:[`durationOrSelector`,`timeoutMs?`],allowsExtraPositionals:!0,allowedFlags:[...q]},cliReader:(e,t)=>ya(e,t),daemonWriter:_(u.wait,e=>Sa(e))});function va(e){kn(e,`kind`,ma);let t={...e};return delete t.kind,t}function ya(e,t){let n=ee(e);if(!n)throw new l(`INVALID_ARGS`,`wait requires <ms>, text <text>, @ref, <selector> [timeoutMs], absent <selector> [timeoutMs], or stable [quietMs] [timeoutMs].`);let r={...Gn(t),...qn(t)};switch(n.kind){case`absent`:return ba(r,n);case`sleep`:return{...r,durationMs:n.durationMs};case`text`:return xa(r,n);case`ref`:return{...r,ref:n.rawRef,...Ca(n.timeoutMs)};case`stable`:return{...r,stable:!0,...wa(n.quietMs),...Ca(n.timeoutMs)};case`invalid`:throw new l(`INVALID_ARGS`,n.message);case`selector`:return{...r,selector:n.selectorExpression,...Ca(n.timeoutMs)};default:return Ta(n)}}function ba(e,t){let n=zt(e);if(n)throw Bt(n,`wait`);return{...e,absent:t.selectorExpression,...Ca(t.timeoutMs)}}function xa(e,t){if(!t.text)throw new l(`INVALID_ARGS`,`wait requires text.`);return{...e,text:t.text,...Ca(t.timeoutMs)}}function Sa(e){if([e.durationMs===void 0?void 0:`durationMs`,e.text===void 0?void 0:`text`,e.ref===void 0?void 0:`ref`,e.selector===void 0?void 0:`selector`,e.absent===void 0?void 0:`absent`,e.stable===void 0?void 0:`stable`].filter(Boolean).length!==1)throw new l(`INVALID_ARGS`,`wait command requires exactly one of durationMs, text, ref, selector, absent, or stable.`);if(e.durationMs!==void 0)return[String(e.durationMs)];let t=x(e.timeoutMs);if(e.text!==void 0)return[`text`,e.text,...t];if(e.ref!==void 0)return[e.ref,...t];if(e.absent!==void 0){let n=zt(e);if(n)throw Bt(n,`wait`);if(!c(e.absent))throw new l(`INVALID_ARGS`,`Invalid wait absent selector: ${e.absent}`);return[`absent`,e.absent,...t]}if(e.stable!==void 0){let n=x(e.quietMs);if(n.length===0&&t.length>0)throw new l(`INVALID_ARGS`,`wait stable requires quietMs before timeoutMs.`);return[`stable`,...n,...t]}let n=e.selector;if(!c(n))throw new l(`INVALID_ARGS`,`Invalid wait selector: ${n}`);return[n,...t]}function Ca(e){return e===null?{}:{timeoutMs:e}}function wa(e){return e===null?{}:{quietMs:e}}function Ta(e){throw Error(`Unsupported wait positional target: ${String(e)}`)}const Ea=G({name:`capture`,commands:[pa,Zi,Yi,_a,Mi,ia]}),Da=`debug`,Oa=G({name:`debugging`,commands:[W({name:Da,effect:`write`,text:{summary:`Symbolicate Apple crash artifacts`,searchHint:`report ips`},metadata:U(Da,`Symbolicate Apple crash artifacts with matching dSYM UUIDs. This command handles Apple crash symbolication only.`,{action:j(L([`symbols`])),artifact:j(M(`Apple crash artifact path (.ips, .crash, or .log).`)),dsym:M(`Path to a matching .dSYM bundle.`),searchPath:M(`Directory to scan for matching .dSYM bundles.`),out:M(`Output path for the symbolicated artifact.`)}),run:(e,t)=>e.debug.symbols(t),cliSchema:{usageOverride:`debug symbols --artifact <crash.ips|crash.log> (--dsym <App.dSYM> | --search-path <dir>) [--out <symbolicated>]`,usageFlags:[],listUsageOverride:`debug`,positionalArgs:[`symbols`],allowedFlags:[`artifact`,`dsym`,`searchPath`,`out`]},cliReader:(e,t)=>({...y(t),action:ka(e[0]),artifact:t.artifact,dsym:t.dsym,searchPath:t.searchPath,out:t.out})})]});function ka(e){if(e===`symbols`)return e;throw new l(`INVALID_ARGS`,`debug supports only symbols; use logs, network, perf, record, trace, or react-devtools for other diagnostics`)}const Aa=()=>F(`Capture cheap post-action evidence (AX digest, node counts, changedFromBefore) instead of a follow-up snapshot.`),ja=()=>({settle:F(`Once the UI goes quiet, return the diff vs the pre-action tree. Best-effort; never fails the action.`),settleQuietMs:P(`Settle: quiet window in ms (default 500, 300 on iOS simulator; broad iOS screen swaps hold at least 1500).`,{min:0}),timeoutMs:P(`Settle: wait deadline in milliseconds (default 10000).`,{min:1})});function J(e){return{...ie(e)?{verify:Aa()}:{},...se(e)?ja():{}}}function Y(e){let t=[];return ie(e)&&t.push(`verify`),se(e)&&t.push(...Hi),t}function Ma(e,t){return se(e)?Jn(t):{}}const Na=[`click`,`focus`,`exists`,`list`,`getText`,`getAttrs`,`wait`,`fill`,`type`],Pa={click:`Activate a UI target by snapshot ref, selector, or coordinates. This can change app state. Success reports dispatch only; settle returns the resulting UI diff and verify returns cheap post-action evidence. A ref or selector target is re-checked for motion before dispatch when the session's previous action just animated the screen, and is dispatched at its resting position; one that has not stopped refuses with target_still_moving rather than acting where it was. With settle, continue from the returned diff. Copy refs exactly, including any ~sN suffix.`,press:`Short-press a UI target by snapshot ref, selector, or coordinates. Success reports dispatch only; settle returns the resulting UI diff and verify returns cheap post-action evidence. A ref or selector target is re-checked for motion before dispatch when the session's previous action just animated the screen, and is dispatched at its resting position; one that has not stopped refuses with target_still_moving rather than acting where it was. A comma-separated ref list dispatches 2-16 keys in order as one command, admitted before the first press.`,fill:`Replace text in a UI input selected by snapshot ref, selector, or coordinates. An empty text clears the field. Unconfirmed evidence does not establish the resulting value or screen. The recordAs option keeps sensitive text out of a recorded replay while sending it to the live app. To append instead of replacing, use type.`,longpress:`Hold a UI target by snapshot ref, selector, or coordinates to open a context menu or perform another hold gesture. The durationMs input overrides the default hold duration.`,hover:`Move the pointer over a UI target by snapshot ref, selector, or coordinates without pressing, to reveal hover-gated UI such as row toolbars or menus. Web only; touch platforms have no hover state. The settle option returns the UI diff revealed by the hover.`,swipe:`Quick coordinate fling with optional repeat pattern.`,focus:`Move input focus to explicit screen coordinates without entering text. This command changes focus only and does not enter or replace text.`,type:`Append text to the currently focused input. This requires an active input and preserves its existing text.`,scroll:`Scroll in a direction, or toward the top/bottom edge of scrollable content. The until input scrolls to an off-screen selector in one command. The optional amount is the finger-path fraction of the viewport axis, honored up to 0.8 of it; directional scrolls reduce release momentum, while app scroll physics determine the final content offset. A visible keyboard shortens the swiped band instead of being dismissed; when too little is left, the command refuses with scroll_keyboard_occludes_surface. A directional scroll also reports the movement it observed as movement: moved, at-edge, unchanged, or unobserved when the two reads could not back a claim either way; an unchanged surface inside a container that still hides content in that direction refuses with scroll_no_progress rather than repeating the requested distance. The movement field is absent where a tier verifies per pass (top/bottom, until), where the runtime cannot read a screen, where a settle observation or a replay already owns that observation, or where the operator opted out of it.`,get:`Read text or accessibility attributes from a snapshot ref or selector without changing the app. The text format returns visible content; attrs returns the element attribute map.`,is:"Check whether a selector satisfies a UI predicate such as visible, hidden, exists, absent, editable, selected, focused, or text. `absent` passes only when one readable, complete, settled, unscoped, full-depth accessibility capture has zero matches. This command checks the current condition without polling.",find:`Find by text/label/value/role/id and run action; the action defaults to click. The role locator matches snapshot kind vocabulary (button, text, text-field, switch, ...); pre-reconciliation leaf spellings (statictext, edittext, textview) stay accepted on the nodes that carried them during a deprecation window. The focus and type actions aim at a text field: the match or the field holding it, even beside other fields, or else the one enabled on-screen field inside the match. Several enabled on-screen fields inside the match refuse with AMBIGUOUS_MATCH and the field candidates, and a disabled target refuses with reason target_disabled. Web text boxes are not recognized as text fields.`,gesture:`Perform a structured pan, fling, swipe, pinch, rotate, transform, tap, or drag gesture. Each gesture kind has its own inputs. A tap touches 2 to 5 points at once; count and pauseMs control repetition.`},Fa={...li(),button:L(Vt,`Pointer button for platforms that support mouse buttons.`),...z(),...Wr(),...J(`click`)},Ia={...li(),...z(),...Wr(),...J(`press`)},La={...li(),text:j(M(`Text to enter into the target. Pass "" to clear it.`,{allowEmpty:!0})),delayMs:P(`Delay between typed characters.`,{min:0}),recordAs:M("When script recording is armed, send text to the live app but publish it as ${VAR}. Use an uppercase replay variable name such as PASSWORD."),textStdin:Pr(F(`Operator-only: text was read from the CLI's stdin, so it is kept out of diagnostics and recorded actions.`),{operatorPath:`Pass --text-stdin on the CLI and pipe the text in; it is not exposed to model-facing tools.`}),...z(),...J(`fill`)},Ra={...li(),durationMs:P(`Long press duration in milliseconds.`,{min:0}),...z(),...J(`longpress`)},za={...li(),...z(),...J(`hover`)},Ba={from:j(Vr(`Swipe start point.`)),to:j(Vr(`Swipe end point.`)),count:P(`Number of swipe repetitions.`,{min:1,max:200}),pauseMs:P(`Pause between repeated swipes.`,{min:0,max:Ye}),pattern:L(qe),...Gr()},Va={x:j(N(`X coordinate.`)),y:j(N(`Y coordinate.`))},Ha={text:j(M(`Text to type.`)),delayMs:P(`Delay between typed characters.`,{min:0})},Ua={direction:j(L(Xe)),amount:N(`Platform scroll amount.`),pixels:P(`Pixel scroll amount.`,{min:0}),until:M(`Repeat scroll passes until this selector is visible on screen, then stop. Not valid with the top/bottom edge directions, which carry their own stop condition.`),maxPasses:P(`Maximum scroll gestures for an until search (default 12). Requires until.`,{min:1,max:200}),durationMs:P(`Scroll duration in milliseconds when the backend supports pacing.`,{min:0,max:Ht}),...J(`scroll`),...Gr()},Wa=()=>({noRecord:F(`Do not record this action.`),record:F(`Force-record this out-of-band observation into a repair-armed heal (mutually exclusive with noRecord). Authored replay steps are recorded automatically and never need this. On find, valid only for a read-only action.`)}),Ga={format:j(L([`text`,`attrs`])),...ci(),...z(),...Wa()},Ka={predicate:j(L(t)),selector:j(M()),value:M(),...z(),...Wa()},qa={locator:L(te),query:j(M()),action:L(Na),value:M(void 0,{allowEmpty:!0}),timeoutMs:P(),first:F(),last:F(),depth:P(),raw:F(),...Wa()},Ja={kind:j(L(it,`Gesture variant.`)),direction:L(Je,`Fling direction.`),preset:L(Ze,`Swipe preset.`),...Gr(),origin:Vr(`Gesture origin point.`),delta:Vr(`Movement delta for pan or transform gestures.`),distance:P(`Fling distance.`,{min:0}),scale:N(`Pinch or transform scale.`),degrees:N(`Rotation in degrees.`),durationMs:P(`Pan/transform duration.`,{min:16,max:1e4}),pointerCount:P(`Pan touch pointer count (1 or 2).`,{min:1,max:2}),points:Hr(`Tap contact points, held together for holdMs.`,{min:2,max:5}),holdMs:P(`Tap contact hold duration.`,{min:16,max:Qe}),count:P(`Tap repetitions; the same contacts run this many times.`,{min:1,max:200}),pauseMs:P(`Delay between tap repetitions, added to each repetition’s own time.`,{min:0,max:Ye}),source:M(`Drag source @ref or selector.`),destination:M(`Drag destination @ref or selector.`),sourceHoldMs:P(`Drag activation hold duration.`,{min:1,max:1e4}),moveMs:P(`Drag movement duration.`,{min:16,max:1e4}),destinationHoldMs:P(`Hold before releasing at the destination.`,{min:0,max:1e4})},Ya=[Qa(`click`,Fa),Qa(`press`,Ia),Qa(`fill`,La),Qa(`longpress`,Ra),Qa(`hover`,za),$a(`swipe`,Ba),$a(`focus`,Va),$a(`type`,Ha),$a(`scroll`,Ua),U(`get`,Pa.get,Ga,{readInput:e=>di(e,Ga),inputExample:ri,parseableOutput:!0}),$a(`is`,Ka),$a(`find`,qa,{parseableOutput:!0}),U(`gesture`,Pa.gesture,Ja,{readInput:Za,inputExample:{kind:`pan`,origin:{x:200,y:400},delta:{x:0,y:-200}}})];function Xa(e){let t=wn(e);return{...zn(t),...rt(t)}}function Za(e){let t=wn(e),n=Xa(t);return n.kind===`swipe`&&On(t,`postGestureStabilization`)===!1?{...n,postGestureStabilization:!1}:n}function Qa(e,t){return U(e,Pa[e],t,{readInput:e=>di(e,t),inputExample:ri})}function $a(e,t,n){return U(e,Pa[e],t,n)}const eo={gesture:no},to={gesture:e=>{let t=Xa(e);return v(u.gesture,[],e,m(t))}};function no(e,t){return{...y(t),...et(e,{pointerCount:t.pointerCount,holdMs:t.holdMs,count:t.count,pauseMs:t.pauseMs}),...e[0]===`swipe`&&t.postGestureStabilization===!1?{postGestureStabilization:!1}:{}}}const X={click:(e,t)=>({...y(t),...Kn(t),...Yn(t),...Ut(e),button:t.clickButton,verify:t.verify}),press:(e,t)=>({...y(t),...Kn(t),...Yn(t),...Ut(e),verify:t.verify}),longpress:(e,t)=>{let n=io(e);return{...y(t),...Kn(t),...n}},hover:(e,t)=>({...y(t),...Kn(t),...Ut(e)}),swipe:(e,t)=>({...y(t),...tt(e,{count:t.count,pauseMs:t.pauseMs,pattern:t.pattern}),postGestureStabilization:t.postGestureStabilization}),focus:(e,t)=>({...y(t),x:Number(e[0]),y:Number(e[1])}),type:(e,t)=>({...y(t),text:e.join(` `),delayMs:t.delayMs}),fill:(e,t)=>{let n=t.textStdin?ro(e):Wt(e);return{...y(t),...Kn(t),...n.target,text:n.text,delayMs:t.delayMs,recordAs:t.recordAs,textStdin:t.textStdin,verify:t.verify}},scroll:(e,t)=>({...y(t),direction:co(e[0]),amount:cr(e[1]),pixels:t.pixels,durationMs:t.durationMs,until:t.until,maxPasses:t.maxPasses,postGestureStabilization:t.postGestureStabilization}),get:(e,t)=>({...y(t),...Wn(t),...Kn(t),format:nr(e[0]),...tr(e.slice(1))})},Z={click:e=>v(u.click,Zn(e),{...e,clickButton:e.button}),press:_(u.press,e=>Zn(e)),longpress:_(u.longPress,e=>ao(e)),hover:_(u.hover,e=>Zn(e)),swipe:e=>($e(e),v(u.swipe,[],e,{from:e.from,to:e.to,count:e.count,pauseMs:e.pauseMs,pattern:e.pattern})),focus:_(u.focus,e=>[String(e.x),String(e.y)]),type:_(u.type,e=>oo(e)),fill:_(u.fill,e=>so(e)),scroll:_(u.scroll,e=>[C(e.direction,`scroll requires direction`),...x(e.amount)]),get:_(u.get,e=>[C(e.format,`get requires format`),...Qn(e)])};function ro(e){let t;try{t=Wt(e)}catch(e){throw e instanceof l?new l(`INVALID_ARGS`,`fill --text-stdin could not read the target.`,{reason:`fill_text_stdin_target_invalid`,hint:`Pass only the target: an @ref, a quoted selector, or x y coordinates. The text itself goes to stdin.`}):e}if(t.text!==void 0)throw new l(`INVALID_ARGS`,`fill --text-stdin reads the text from stdin, so it cannot also take a text argument.`,{reason:`fill_text_source_conflict`,hint:`Pass only the target, for example: printf %s "$PASSWORD" | agent-device fill @e3 --text-stdin. Quote a multi-word selector so no part of it is read as text.`});return t}function io(e){let t=lo(e);return{...Ut(t.target),...t.durationMs===void 0?{}:{durationMs:t.durationMs}}}function ao(e){return[...Zn(e),...x(e.durationMs)]}function oo(e){return[e.text]}function so(e){return[...Zn(e),e.text]}function co(e){if(e===`up`||e===`down`||e===`left`||e===`right`||e===`top`||e===`bottom`)return e;throw new l(`INVALID_ARGS`,`Unknown direction: ${String(e)}`,{hint:`scroll takes a direction first, then an optional amount: scroll <up|down|left|right|top|bottom> [amount]. It takes no @ref or selector — scroll the whole viewport, then retry the target with a selector.`})}function lo(e){if(or(e[0])&&or(e[1]))return{target:e.slice(0,2),...e[2]===void 0?{}:{durationMs:Number(e[2])}};let t=e.at(-1);return e.length>1&&or(t)?{target:e.slice(0,-1),durationMs:Number(t)}:{target:e}}const uo={find:(e,t)=>ho(e,t),is:(e,t)=>go(e,t)},fo={is:_(u.is,e=>po(e)),find:e=>v(u.find,mo(e),{...e,findFirst:e.first,findLast:e.last})};function po(e){return[e.predicate,e.selector,...e.predicate===`text`?[e.value]:[]]}function mo(e){let t=e.locator&&e.locator!==`any`?[e.locator,e.query]:[e.query];switch(e.action){case void 0:case`click`:case`focus`:case`exists`:case`list`:return e.action?[...t,e.action]:t;case`getText`:return[...t,`get`,`text`];case`getAttrs`:return[...t,`get`,`attrs`];case`wait`:return[...t,`wait`,...x(e.timeoutMs)];case`fill`:case`type`:return[...t,e.action,e.value]}}function ho(e,t){let n={...bo(t),...Gn(t),...Wn(t),first:t.findFirst,last:t.findLast},r=yo(e[0]),i=r!==void 0,a=i?e[1]:e[0],o=i?2:1,s=oe(e[o]);if(s===void 0)return{...n,locator:r,query:xo(a)};if(s===`get`){let t=e[o+1];if(t===`text`)return{...n,locator:r,query:xo(a),action:`getText`};if(t===`attrs`)return{...n,locator:r,query:xo(a),action:`getAttrs`};throw new l(`INVALID_ARGS`,`find get only supports text or attrs`)}if(s===`wait`)return{...n,locator:r,query:xo(a),action:`wait`,timeoutMs:cr(e[o+1])};if(s===`fill`||s===`type`){let t=e.slice(o+1);if(t.length===0)throw new l(`INVALID_ARGS`,s===`fill`?`find fill requires text (use "" to clear the field)`:`find type requires text`);return{...n,locator:r,query:xo(a),action:s,value:t.join(` `)}}if(s===`click`||s===`focus`||s===`exists`||s===`list`)return{...n,locator:r,query:xo(a),action:s};throw new l(`INVALID_ARGS`,`Unsupported find action: ${e[o]}`,{hint:ae})}function go(e,t){let r={...qn(t),...Gn(t),...Wn(t)},a=i(e),o=n(a[0]??``);if(!o.ok)throw new l(o.code,o.message,{hint:o.hint});let s=o.predicate;if(s===`absent`){let e=_o(r);if(e)throw vo(e)}let c=rr(a.slice(1),{preferTrailingValue:s===`text`});return s===`text`?{...r,predicate:s,selector:c.selectorExpression,value:c.rest.join(` `)}:{...r,predicate:s,selector:c.selectorExpression}}function _o(e){if(e.scope!==void 0)return`scope`;if(e.depth!==void 0)return`depth`}function vo(e){return new l(`INVALID_ARGS`,e===`scope`?`is absent does not support --scope; it requires an unscoped capture`:`is absent does not support --depth; it requires a full-depth capture`,{command:`is`,predicate:`absent`,rejectedOption:e})}function yo(e){if(e===`text`||e===`label`||e===`value`||e===`role`||e===`id`)return e}function bo(e){return{depth:e.snapshotDepth,raw:e.snapshotRaw}}function xo(e){if(e===void 0||e===``)throw new l(`INVALID_ARGS`,`find requires query`);return e}const So=w({from:D(`Surface the pre-action baseline described: a host bundle id, or app.`),to:D(`Surface the post-action capture describes: a host bundle id, or app.`),disclosure:D(`Agent-facing sentence explaining the surface transition.`)},[`from`,`to`,`disclosure`],`Present when an in-place system surface (web sign-in or Apple Pay sheet) was presented over the app, or left it.`),Co=w({foregroundApp:D(`Foreground app bundle id or name, when the capture carries it.`),nodeCount:O(`Node count in the post-action interactive-only capture.`),interactiveNodeCount:O(`Subset of nodeCount the platform reports as hittable.`),digest:D(`Order-independent digest of the post-action node multiset.`),changedFromBefore:k(`Whether the post-action digest differs from the pre-action capture digest. false is evidence, not failure. Absent when no pre-action baseline was captured, so no comparison is claimed. With surfaceChange present, no digest comparison is made: it reports that surface transition.`),surfaceChange:So},[`nodeCount`,`interactiveNodeCount`,`digest`]),wo=w({wallClockMs:O(`Total wall-clock time for the request in milliseconds.`),runnerRoundTrips:O(`Number of real runner round-trips made while serving the request.`),nodeCount:O(`Number of nodes in the original node tree when the response carries one.`)},[`wallClockMs`,`runnerRoundTrips`]),To=w({diagnosticRef:D(`Opaque non-@ diagnostic token. Never a snapshot ref: not issued via refsGeneration and cannot be pinned or reused as an @ref target. UTF-8 truncated to 256 bytes.`),role:D(`UTF-8 truncated to 256 bytes.`),label:D(`UTF-8 truncated to 256 bytes.`)},[`diagnosticRef`]),Eo={type:`object`,description:`Pre-action disclosure of how the acting path resolved its target. Absent when resolutionDisclosure is inapplicable for the path.`,oneOf:[w({source:E(`runtime`),phase:E(`pre-action`),kind:E(`unique`)},[`source`,`phase`,`kind`]),w({source:E(`runtime`),phase:E(`pre-action`),kind:E(`disambiguated`),matchCount:O(`Total matches resolveSelectorChain found before disambiguation.`),winnerDiagnostic:To,tiebreak:T([`visible`,`deepest`,`smallest-area`,`structural-equivalence`],`The comparison that decided the winner.`),alternatives:{type:`array`,description:`At most 5 losing candidates, document order. Present at default/full response levels and omitted in digest. The winner is never included.`,items:To}},[`source`,`phase`,`kind`,`matchCount`,`winnerDiagnostic`,`tiebreak`]),w({source:E(`ref`),phase:E(`pre-action`),kind:E(`exact`)},[`source`,`phase`,`kind`]),w({source:E(`ref`),phase:E(`pre-action`),kind:E(`label-fallback`)},[`source`,`phase`,`kind`]),w({source:E(`direct-ios`),kind:E(`not-observed`)},[`source`,`kind`])]};function Do(e={}){let t=e.properties??{},n=e.required??[];return w({targetKind:T([`point`,`ref`,`selector`],`Resolved interaction target kind.`),x:O(`Resolved interaction x coordinate when available.`),y:O(`Resolved interaction y coordinate when available.`),referenceWidth:O(`Reference frame width for visualizing the interaction point.`),referenceHeight:O(`Reference frame height for visualizing the interaction point.`),ref:D(`Snapshot ref without the @ prefix when the target was an @ref.`),selector:D(`Selector expression when the target was a selector.`),selectorChain:Mr(),refLabel:D(),targetHittable:k(),hint:D(),warning:D(),message:D(),evidence:Co,resolution:Eo,cost:wo,maestroNonHittableCoordinateFallbackAllowed:k(`Whether the direct iOS Maestro coordinate fallback was allowed for this selector.`),maestroNonHittableCoordinateFallbackUsed:k(`Whether the direct iOS Maestro coordinate fallback was actually used.`),maestroFallbackReason:E(`non-hittable-coordinate`),...t},[`targetKind`,...n])}const Oo=Do({properties:{evidence:Co,button:T([`secondary`,`middle`]),count:O(`Number of press/click repetitions.`),intervalMs:O(`Delay between repeated press/click actions, or between the keys of a comma-separated ref sequence.`),holdMs:O(`Hold duration for each action.`),jitterPx:O(`Deterministic per-axis coordinate jitter in pixels (each press offsets x and y by up to this amount).`),doubleTap:k(`Whether the command requested a double-tap action.`),sequence:w({pressed:O(`How many keys of the plan were dispatched.`),refs:Mr(`The planned refs in dispatch order, each with its @ prefix.`),points:{type:`array`,description:`Where each dispatched key landed, in plan order.`,items:w({x:O(),y:O()},[`x`,`y`])}},[`pressed`,`refs`,`points`],`Present when the command ran a multi-ref plan (press @e13,@e14,...): one action per key, in order.`)}}),ko={text:D(`Text submitted to the field.`),delayMs:O(`Delay between typed characters in milliseconds.`),evidence:Co},Ao=w({resourceId:Ar(`Identifier of the exact field that changed: Android resource id or Apple accessibility identifier.`),className:Ar(`Type of the exact field that changed: Android class name or Apple element type.`),packageName:Ar(`App that owns the exact field: Android package name or Apple bundle id.`),rect:w({x:O(),y:O(),width:O(),height:O()},[`x`,`y`,`width`,`height`],`Screen-space rectangle of the exact field that changed.`)},[`resourceId`,`className`,`packageName`,`rect`],`Target identity captured before fill and matched after fill.`),jo={press:Oo,click:Oo,fill:{type:`object`,description:`Fill response. Target-bound unconfirmed evidence reports an observed value different from the requested text. It does not establish that formatting preserved the input; assert the expected value or resulting screen before continuing.`,oneOf:[{...Do({properties:ko,required:[`text`]}),not:w({},[`verification`])},Do({properties:{...ko,verification:E(`unconfirmed`),requested:D(`Literal text requested by the fill command.`),before:Ar(`Raw target text captured before the fill.`),after:Ar(`Raw target text captured after the fill.`),target:Ao},required:[`text`,`verification`,`requested`,`before`,`after`,`target`]})]},longpress:Do({properties:{durationMs:O(),gesture:E(`longpress`)}}),hover:Do({properties:{gesture:E(`hover`)}}),find:w({ref:D(`Snapshot ref without the @ prefix when the find action returns one.`),refsGeneration:O(`ADR 0014 ref frame epoch for read-only find actions.`),found:k(`Whether a wait/exists/read-only find satisfied its condition.`),waitedMs:O(`Milliseconds waited for a read-only find condition.`),text:D(`Text value returned by find get_text.`),node:A(`Snapshot node for find get_attrs/get_text.`),matches:{type:`array`,description:`Every match for the read-only find list action (#1625): { ref, node } each.`,items:A(`One listed match with its snapshot ref and node.`)},locator:D(`Locator kind used for the find action.`),query:D(`Query argument used for the find action.`),x:O(`Resolved x coordinate for mutating find actions.`),y:O(`Resolved y coordinate for mutating find actions.`),message:D(`Diagnostic message for mutating find actions.`),cost:wo},[],`Daemon response data for the find command.`)},Mo=nt,No=[...new Set(Object.values(Mo).flat())],Q={get:{usageOverride:`get text|attrs <@ref|selector>`,usageFlags:[],positionalArgs:[`subcommand`,`target`],allowsExtraPositionals:!0,allowedFlags:[...q,`record`]},find:{usageOverride:`find <locator|text> [action] [value] [--first|--last]`,usageFlags:[],positionalArgs:[`query`,`action?`,`value?`],allowsExtraPositionals:!0,allowedFlags:[`snapshotDepth`,`snapshotRaw`,`findFirst`,`findLast`,`record`]},is:{positionalArgs:[`predicate`,`selector`,`value?`],allowsExtraPositionals:!0,allowedFlags:[...q,`record`]},click:{usageOverride:`click <x y|@ref|@ref,...|selector>`,usageFlags:[],positionalArgs:[`target`],allowsExtraPositionals:!0,allowedFlags:[...Vi,`clickButton`,...Y(`click`),...q]},press:{usageOverride:`press <x y|@ref|@ref,...|selector>`,usageFlags:[],positionalArgs:[`targetOrX`,`y?`],allowsExtraPositionals:!0,allowedFlags:[...Vi,...Y(`press`),...q]},longpress:{usageOverride:`longpress <x y|@ref|selector> [durationMs]`,usageFlags:[],positionalArgs:[`targetOrX`,`yOrDurationMs?`,`durationMs?`],allowsExtraPositionals:!0,allowedFlags:[...Y(`longpress`),...q]},hover:{usageOverride:`hover <x y|@ref|selector>`,usageFlags:[],positionalArgs:[`targetOrX`,`y?`],allowsExtraPositionals:!0,allowedFlags:[...Y(`hover`),...q]},swipe:{positionalArgs:[`x1`,`y1`,`x2`,`y2`],allowsExtraPositionals:!0,allowedFlags:[`count`,`pauseMs`,`pattern`,`postGestureStabilization`]},gesture:{usageOverride:`gesture <pan|fling|swipe|pinch|rotate|transform|tap|drag> ...`,usageFlags:[],listUsageOverride:`gesture <pan|fling|swipe|pinch|rotate|transform|tap|drag> ...`,positionalArgs:[`pan|fling|swipe|pinch|rotate|transform|tap|drag`,`args?`],allowsExtraPositionals:!0,allowedFlags:No,flagsByAction:Mo},focus:{positionalArgs:[`x`,`y`]},type:{positionalArgs:[`text`],allowsExtraPositionals:!0,allowedFlags:[`delayMs`]},fill:{usageOverride:`fill <x> <y> <text> | fill <@ref|selector> <text> | fill <x y|@ref|selector> --text-stdin`,usageFlags:[],positionalArgs:[`targetOrX`,`yOrText`,`text?`],allowsExtraPositionals:!0,allowedFlags:[...q,`delayMs`,`recordAs`,`textStdin`,...Y(`fill`)]},scroll:{usageOverride:`scroll <direction|top|bottom> [amount]`,usageFlags:[`until`,`maxPasses`,`pixels`,`durationMs`,`settle`],positionalArgs:[`directionOrEdge`,`amount?`],allowedFlags:[`pixels`,`durationMs`,`until`,`maxPasses`,...Y(`scroll`),`postGestureStabilization`]}},Po=G({name:`interaction`,clientSurface:!1,commands:[W({name:`click`,effect:`destructive`,text:{summary:`Click or tap a UI target`,searchHint:`press button link web mouse`,cliDetail:`A comma-separated ref sequence follows the press form: click @e13,@e14 clicks each key in order as one command, with press's plan contract. See press for the plan semantics and recovery fields. Script recording refuses the sequence form: record one click per key.`},metadata:$(`click`),run:(e,t)=>e.interactions.click(Fo(t)),cliSchema:Q.click,cliReader:X.click,daemonWriter:Z.click}),W({name:`press`,effect:`destructive`,text:{summary:`Short-press a UI target`,searchHint:`click touch button`,cliDetail:`The hold duration is positional on longpress, not press --hold-ms. A comma-separated ref plan (press @e13,@e14,@e15,@e16; 2 to 16 refs, repeats allowed) resolves and admits every key against the current frame, then dispatches the admitted points: key 1 expires the frame, later keys dispatch where the snapshot showed them; a later refusal carries details.dispatchedSteps, details.refPlanKey, and details.refPlanPending, and sequence.points holds the dispatched points. --interval-ms sleeps between keys; --count, --hold-ms, --jitter-px, and --double-tap apply to every key; the response ref is the first key. Recording refuses the plan.`},metadata:$(`press`),run:(e,t)=>e.interactions.press(Io(t)),cliSchema:Q.press,cliReader:X.press,daemonWriter:Z.press}),W({name:`fill`,effect:`destructive`,text:{summary:`Replace text in a UI input`,searchHint:`enter form textbox`,cliDetail:`Every positional after an @ref is the replacement text, so fill @e57 good morning enters "good morning"; quote the text when the shell must preserve exact whitespace. Clear a field with an empty text argument: fill @e57 "" (the argument must be present — fill @e57 alone is a missing argument, not a clear). When visible label text also matches a non-input element, constrain the target with editable=true, for example fill 'label="Email" editable=true' "qa@example.com". To keep a secret out of argv, omit the text and pipe it in: printf %s "$PASSWORD" | fill @e57 --text-stdin (max 64 KiB, one trailing newline removed). On web, a coordinate fill selects the clicked field in the page and refuses with COMMAND_FAILED and details.reason text_entry_focus_not_observed, before it sends any text or key, when the click did not reach an editable text field it can reach: a read-only, disabled, date, checkbox, or select control, a field in a cross-origin frame, a sandboxed frame without allow-same-origin, or a closed shadow root, or a click that missed. The click has already landed, so run snapshot -i again and fill the field it reports by ref (fill @e2 text); a selector fill reaches the same coordinate path and hits the same limits.`},metadata:$(`fill`),run:(e,t)=>e.interactions.fill(Lo(t)),cliSchema:Q.fill,cliReader:X.fill,daemonWriter:Z.fill}),W({name:`longpress`,effect:`destructive`,text:{summary:`Hold a UI target to open a context menu`,searchHint:`long press`,cliDetail:`Duration is positional, for example longpress @e12 800 or longpress 300 500 800.`},metadata:$(`longpress`),run:(e,t)=>e.interactions.longPress(Ro(t)),cliSchema:Q.longpress,cliReader:X.longpress,daemonWriter:Z.longpress}),W({name:`hover`,effect:`write`,text:{summary:`Hover the pointer over a UI target (web only)`,searchHint:`mouse menu`,cliDetail:`The pointer stays where hover left it: read the revealed UI (--settle or snapshot -i) and act on it before another click or hover moves the pointer away.`},metadata:$(`hover`),run:(e,t)=>e.interactions.hover(zo(t)),cliSchema:Q.hover,cliReader:X.hover,daemonWriter:Z.hover}),W({name:`swipe`,effect:`write`,text:{summary:`Fling between coordinates`,searchHint:`drag gesture`,cliDetail:`The first read after a swipe waits for two captures to agree. --no-post-gesture-stabilization skips that wait for a caller whose own polling verifies the screen.`},metadata:$(`swipe`),run:(e,t)=>e.interactions.swipe(t),cliSchema:Q.swipe,cliReader:X.swipe,daemonWriter:Z.swipe}),W({name:`focus`,effect:`write`,text:{summary:`Focus input at screen coordinates`,searchHint:`field cursor`},metadata:$(`focus`),run:(e,t)=>e.interactions.focus(t),cliSchema:Q.focus,cliReader:X.focus,daemonWriter:Z.focus}),W({name:`type`,effect:`destructive`,text:{summary:`Append text to the focused input`,searchHint:`keys keyboard`},metadata:$(`type`),run:(e,t)=>e.interactions.type(t),cliSchema:Q.type,cliReader:X.type,daemonWriter:Z.type}),W({name:`scroll`,effect:`write`,text:{summary:`Scroll in a direction or to an edge`,searchHint:`swipe down list`,cliDetail:`A caller that verifies the screen by polling can add --no-post-gesture-stabilization. The scroll then returns right after its gesture, with no movement field and no scroll_no_progress refusal, and the next read skips the stabilization wait. With --settle the settle observation already reports the outcome, and the option removes the same wait from its first capture.`},metadata:$(`scroll`),run:(e,t)=>e.interactions.scroll(t),cliSchema:Q.scroll,cliReader:X.scroll,daemonWriter:Z.scroll}),W({name:`get`,effect:`write`,text:{summary:`Read element text or attributes`,searchHint:`value label`},metadata:$(`get`),run:(e,t)=>e.interactions.get(Vo(t)),cliSchema:Q.get,cliReader:X.get,daemonWriter:Z.get}),W({name:`is`,effect:`write`,text:{summary:`Check a UI predicate on a selector`,searchHint:`assert enabled`},metadata:$(`is`),run:(e,t)=>e.interactions.is(t),cliSchema:Q.is,cliReader:uo.is,daemonWriter:fo.is}),W({name:`find`,effect:`destructive`,text:{summary:`Find an element and act`,searchHint:`search locate`},metadata:$(`find`),run:(e,t)=>e.interactions.find(t),cliSchema:Q.find,cliReader:uo.find,daemonWriter:fo.find}),W({name:`gesture`,effect:`destructive`,text:{summary:`Run pan, fling, swipe, pinch, rotate, transform, tap, or drag gestures`,searchHint:`multi-touch zoom`,cliDetail:`Argument shapes: pan <x> <y> <dx> <dy> [durationMs], fling <up|down|left|right> <x> <y> [distance], swipe <left|right|left-edge|right-edge>, pinch <scale> [x] [y], rotate <degrees> [x] [y], transform <x> <y> <dx> <dy> <scale> <degrees> [durationMs], tap <x1> <y1> <x2> <y2> [... <x5> <y5>] [--hold-ms <ms>] [--count <n>] [--pause-ms <ms>], or drag <source-selector|pinned-ref> <destination-selector|pinned-ref> [sourceHoldMs] [moveMs] [destinationHoldMs]. For command plans, output only command lines. Android transform verification should use all app-observable effects, for example wait text "pan changed yes", wait text "pinch changed yes", and wait text "rotate changed yes", not exact transform values. gesture swipe accepts --no-post-gesture-stabilization to skip the stabilization wait before the next read, for a caller whose own polling verifies the screen.`},metadata:$(`gesture`),run:(e,t)=>e.interactions.gesture({...rt(t),...g(t),...t.postGestureStabilization===!1?{postGestureStabilization:!1}:{}}),cliSchema:Q.gesture,cliReader:eo.gesture,daemonWriter:to.gesture})]});function $(e){let t=Ya.find(t=>t.name===e);if(!t)throw Error(`Missing interaction command metadata for ${e}`);return t}function Fo(e){return{...Io(e),button:e.button}}function Io(e){return{...g(e),...H(e),...Zr(e),...Xr(e),verify:e.verify,...Bo(e)}}function Lo(e){return{...g(e),...H(e),...Zr(e),text:e.text,delayMs:e.delayMs,recordAs:e.recordAs,textStdin:e.textStdin,verify:e.verify,...Bo(e)}}function Ro(e){return{...g(e),...H(e),...Zr(e),durationMs:e.durationMs,...Bo(e)}}function zo(e){return{...g(e),...H(e),...Zr(e),...Bo(e)}}function Bo(e){return{settle:e.settle,settleQuietMs:e.settleQuietMs,timeoutMs:e.timeoutMs}}function Vo(e){return{...g(e),...H(e),...Zr(e),format:e.format,record:e.record}}const Ho=W({name:`artifacts`,effect:`read`,text:{summary:`List daemon or cloud provider session artifacts`,searchHint:`files video logs download`},metadata:U(`artifacts`,`List daemon or cloud provider artifacts for an active or completed session.`,{provider:M(`Cloud provider name, for example browserstack, aws-device-farm, or testmu.`),providerSessionId:M(`Cloud provider session id or ARN.`)}),run:(e,t)=>e.sessions.artifacts(t),cliSchema:{usageOverride:`artifacts [provider-session-id]`,usageFlags:[`provider`],positionalArgs:[`provider-session-id?`],allowedFlags:[`provider`,`providerSessionId`]},cliReader:(e,t)=>({...y(t),provider:t.provider,providerSessionId:e[0]??t.providerSessionId}),daemonWriter:_(u.artifacts)});function Uo(e){let{metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i}=e;if(t!==void 0||n!==void 0||r!==void 0||i!==void 0)return{metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i}}function Wo(e){let{metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i,...a}=e,o=Uo({metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i});return o?{...a,runtime:o}:a}const Go=U(`apps`,`List the apps installed on the selected device. The appsFilter input includes or excludes system and OEM apps.`,{appsFilter:L([`user-installed`,`all`],`Restrict the listing to user-installed apps, or include system and OEM apps.`)}),Ko=U(`open`,`Boot the selected device when needed, then open an app, deep link, or URL in a session. With a known app, start with open and foreground: a fresh open returns the initial interactive snapshot with refs (or initialSnapshotError: then run snapshot). Do not probe with devices or apps first; list them only for an unknown app id, and never guess one. The app or URL inputs select the foreground automation target. Remote daemons refuse file: URLs in open targets and launch URLs with reason REMOTE_HOST_INPUT_DENIED. Local web content is supported over HTTP(S).`,{app:M(`App name, bundle id, package, or URL.`),url:M(`Optional URL passed with an app shell.`),surface:L(mt,`macOS presentation surface to open: the app itself, the frontmost app, the desktop, or the menu bar.`),activity:M(`Android activity name.`),launchConsole:M(`File path on the daemon host for the stdout and stderr of the initial app launch. Local or Limrun iOS simulator direct app launches only; not for URL opens.`),launchArgs:zr(`Launch arguments forwarded verbatim to the platform launch command.`),relaunch:F(`Force relaunch.`),timeoutMs:P(`Startup budget in milliseconds. Bounds the Simulator boot wait, so a never-booted Simulator can finish its first-boot migration; omit for the default startup behavior.`,{min:1}),waitMs:I(`waitMs`),foreground:I(`foreground`),saveScript:R({oneOf:[k(),D()]}),force:F(`Overwrite an existing --save-script target instead of refusing (alias: --overwrite).`),testIme:F(`Activate the headless Android test IME for deterministic Unicode text entry (default on for emulators; opt-in on real devices).`),noRecord:F(`Do not record this action.`),metroHost:M(`Session-scoped Metro/debug host hint applied to the opened app.`),metroPort:P(`Session-scoped Metro/debug port hint applied to the opened app. Without metroHost, emulators and simulators use the loopback alias; physical devices need metroHost.`,{min:1,max:65535}),bundleUrl:M(`Session-scoped bundle URL hint applied to the opened app.`),launchUrl:M(`Launch URL for the opened app; does not select the server used by metro reload.`),...Gr(),...Kr()}),qo=U(`close`,`Close the named app, or close the active session app when app is omitted. The shutdown option also stops the session simulator or emulator where supported; close alone never stops the device. Android ADB close fails with android-app-close-timeout if the app stays foreground past 2s, a killed process does not exit within 10s, or a new process runs past 2s; a relaunching open accepts that new process. It fails with android-process-probe-unavailable when adb pidof cannot list the app processes; if that happens before the force-stop, the app keeps running. If close cannot confirm its cleanup on a session that holds a device claim, the session and its claim stay. A repeated close retries cleanup with the same options, except that save-script must be omitted after publication.`,{app:M(`Optional app to close.`),shutdown:F(`Shutdown the session/device where supported.`),saveScript:R({oneOf:[k(),D()]}),force:F(`Overwrite an existing --save-script target instead of refusing (alias: --overwrite).`)});function Jo(e){return Wo(e)}const Yo={allowedFlags:[`appsFilter`]},Xo={positionalArgs:[`appOrUrl?`,`url?`],allowedFlags:[`activity`,`launchConsole`,`launchArgs`,`testIme`,`saveScript`,`force`,`noRecord`,`relaunch`,`foreground`,`timeoutMs`,`waitMs`,`surface`,...zi,`launchUrl`,`postGestureStabilization`,...Bi]},Zo={positionalArgs:[`app?`],allowedFlags:[`saveScript`,`force`,`shutdown`]},Qo=(e,t)=>({...y(t),appsFilter:Gt(t.appsFilter)}),$o=(e,t)=>({...y(t),app:e[0],url:e[1],surface:t.surface,activity:t.activity,launchConsole:t.launchConsole,launchArgs:t.launchArgs,relaunch:t.relaunch,foreground:t.foreground,timeoutMs:t.timeoutMs,waitMs:t.waitMs,saveScript:t.saveScript,force:t.force,testIme:t.testIme,noRecord:t.noRecord,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,launchUrl:t.launchUrl,postGestureStabilization:t.postGestureStabilization,...Xn(t)}),es=(e,t)=>({...y(t),app:e[0],shutdown:t.shutdown,saveScript:t.saveScript,force:t.force}),ts=_(u.apps),ns=_(u.open,cs),rs=_(u.close,e=>b(e.app)),is=W({name:`apps`,effect:`write`,text:{summary:`List installed apps or deferred provider app assets`,searchHint:`bundle id package`,cliDetail:`Before provider allocation, lists uploaded app assets when the selected provider exposes a catalog. On a live device, defaults to user-installed apps; use --all to include system/OEM apps.`},metadata:Go,run:(e,t)=>e.apps.list(t),cliSchema:Yo,cliReader:Qo,daemonWriter:ts}),as=W({name:`open`,effect:`destructive`,text:{summary:`Open an app, deep link or URL, save replays`,searchHint:`relaunch`,cliDetail:`Use --platform to bind URL/deep-link opens to the target platform. For local or Limrun iOS simulator initial stdout/stderr, put --launch-console <path> on this open command, for example agent-device open "Agent Device Tester" --platform ios --launch-console artifacts/launch-console.log. Expo Go/dev-client shells accept host + URL, for example agent-device open "Expo Go" exp://127.0.0.1:8081 --platform ios. macOS also supports --surface app|frontmost-app|desktop|menubar. --metro-host/--metro-port/--bundle-url choose the app's Metro server and save that address for later metro reload calls in the same session. A fresh open without Metro hints clears an older same-name binding; close also clears it. --launch-url supplies the app's launch URL; it does not select the reload server. On an iOS simulator without --launch-url, open connects a detected Expo development client through its expo-development-client URL. The app must declare a single exp+<slug> scheme that no other installed app owns. If detection is inconclusive, the app opens normally. Bare React Native apps receive their server settings before launch. On an iOS simulator, when --launch-url raises an "Open in <App>?" prompt that keeps open from seeing the app, open accepts it if the URL scheme belongs to the session app (data.launchConfirmation: "accepted"); if the scheme belongs to another installed app, the prompt stays on screen and open fails with details.reason launch_confirmation_foreign_app; if the scheme owner cannot be resolved because no single installed app owns it or the lookup failed, the prompt stays on screen and open returns with data.launchConfirmation: "unanswered", launchConfirmationReason url-owner-unresolved, and a warning; a prompt that is seen but not recognized is reported the same way with launchConfirmationReason alert-unrecognized and its own warning; for url-owner-unresolved, answer the prompt with alert accept; for alert-unrecognized, read the alert with alert get first, because it can be the app's own alert (such as a permission prompt) rather than the launch confirmation, and answer with alert accept only when it is the launch confirmation; when agent-device cannot read whether a prompt is up at all (the alert read, the accept, or the runner itself failed, including after a re-hand of the URL), open stays green, reports no launchConfirmation plus data.launchConfirmationProbeFailure naming the failed step (alert-read, alert-accept, or runner), and appends a warning that says to check with alert get. The prompt is read whenever open cannot see the app afterwards, including on a slow host where the app's target discovery fails on its own deadline. When an accept leaves the app provably not running, open hands the same URL over once more and reads again; still not running, it fails with details.reason launch_confirmation_unanswered. When the runner reports its main-thread timeout for the accept and the prompt is still up, open presses Open again, but only when the time the open request has left covers a whole press and the read that checks it. A recognized prompt still visible after a failed accept, or once that time is gone, also fails with this reason, even if the app is running behind it; answer it with alert accept or alert dismiss. A simulator openurl that CoreSimulator never answers fails within 20s with details.reason ios-simulator-openurl-timeout. The prompt is recognized by the OS's own wording of its title and buttons in the Simulator's preferred languages; when the runner cannot read that wording, the prompt stays on screen as alert-unrecognized. A prompt that appears after open has already seen the app is not answered; use alert accept. A device another session is holding refuses at once; add --wait <ms> to block up to that budget for it and only then fail with DEVICE_IN_USE naming the owning session.`,mcpDetail:`metroHost, metroPort, and bundleUrl choose the app's Metro server and save its address for later reloads. launchUrl selects the app's launch URL and does not select the reload server. A fresh open without Metro hints clears an older same-name binding; close also clears it.`},metadata:Ko,run:(e,t)=>e.apps.open(Jo(t)),cliSchema:Xo,cliReader:$o,daemonWriter:ns}),os=W({name:`close`,effect:`destructive`,text:{summary:`Close an app or end the session`,searchHint:`quit`},metadata:qo,run:(e,t)=>t.app?e.apps.close(t):e.sessions.close(ss(t)),cliSchema:Zo,cliReader:es,daemonWriter:rs});function ss(e){let{app:t,...n}=e;return n}function cs(e){return e.app?e.url?[e.app,e.url]:[e.app]:[]}const ls={platform:T(ze),target:T(Be),device:D(`Human-readable device name.`),id:D(`Stable device id.`),kind:T(Re)},us=[`platform`,`target`,`device`,`id`,`kind`],ds=w({success:k(),exitCode:O(),stdout:D(),stderr:D(),error:A(`Normalized error detail when shutdown failed.`)},[`success`,`exitCode`,`stdout`,`stderr`]),fs={boot:w({...ls,booted:{type:`boolean`,const:!0},selection:w({reason:D(`Why this device was chosen, such as newest-bootable-local.`),source:D(`Where it came from: session, local, or provider.`),candidateCount:O(),bootOccurred:k()},[`reason`,`source`,`candidateCount`,`bootOccurred`])},[...us,`booted`]),shutdown:w({...ls,shutdown:ds},[...us,`shutdown`])},ps=U(`devices`,`List available devices and simulators that can be selected for automation. Results include the platform, device name, and available platform-specific identifiers for selection.`,{}),ms=U(`capabilities`,`List the commands supported by the selected device or active session. Device-selection inputs support capability checks without an open session.`,{}),hs=U(`boot`,`Boot or prepare the selected device or simulator so later commands can target it. The device is chosen through the device-selection inputs, not by naming it here. On Limrun, allocate or reuse an instance. Existing-instance credentials attach without creating one.`,{headless:F(`Boot without showing simulator UI when supported.`),pick:L(Ve,`When no device is named and several equally preferred devices match, all shut down, boot one instead of failing: newest picks mobile over TV, then the newest OS version, then the first name in name order (numbers compared by value; not device age), which alone decides for stopped Android AVDs because they report no OS version. Several booted matches still fail.`),timeoutMs:P(`Startup budget in milliseconds. Bounds the boot wait, so a never-booted Simulator can finish its first-boot migration or a cold emulator its boot; omit for the default startup behavior.`,{min:1})}),gs=U(`shutdown`,`Shutdown a selected simulator or emulator. On Limrun, delete a created instance or release an attachment. Apps and data on a deleted instance are lost. A Limrun connection without an instance fails with DEVICE_NOT_FOUND and details.reason provider_instance_unallocated and creates nothing.`,{}),_s={allowedFlags:[`headless`,`pick`,`timeoutMs`]},vs={},ys={},bs={},xs=(e,t)=>y(t),Ss=(e,t)=>({...y(t),headless:t.headless,pick:t.pick,timeoutMs:t.timeoutMs}),Cs=_(u.devices),ws=_(u.capabilities),Ts=_(u.boot),Es=_(u.shutdown),Ds=[W({name:`devices`,effect:`read`,text:{summary:`List available devices and simulators`,searchHint:`emulators udid serial`},metadata:ps,run:(e,t)=>e.devices.list(t),cliSchema:vs,cliReader:xs,daemonWriter:Cs}),W({name:`capabilities`,effect:`read`,text:{summary:`List supported commands for the selected device`,searchHint:`features`,cliDetail:`Select an explicit target with --platform/--device/--udid/--serial.`},metadata:ms,run:(e,t)=>e.devices.capabilities(t),cliSchema:ys,cliReader:xs,daemonWriter:ws}),W({name:`boot`,effect:`write`,text:{summary:`Boot target device/simulator`,searchHint:`start emulator`},metadata:hs,run:(e,t)=>e.devices.boot(t),cliSchema:_s,cliReader:Ss,daemonWriter:Ts}),W({name:`shutdown`,effect:`destructive`,text:{summary:`Shutdown target simulator/emulator`,searchHint:`stop`,cliDetail:`For an active session, use close --shutdown.`},metadata:gs,run:(e,t)=>e.devices.shutdown(t),cliSchema:bs,cliReader:xs,daemonWriter:Es})],Os={doctor:w({status:T([`pass`,`warn`,`fail`,`info`]),summary:D(),kind:T([`auto`,`react-native`,`expo`,`repack`]),platform:D(),target:T(Be),targetApp:D(),metro:w({host:D(),port:O()},[`host`,`port`]),checks:{type:`array`,items:w({id:D(),status:T([`pass`,`warn`,`fail`,`info`]),summary:D(),hint:D(),command:D(),evidence:A()},[`id`,`status`,`summary`])}},[`status`,`summary`,`kind`,`checks`])},ks=W({name:`doctor`,effect:`write`,text:{summary:`Diagnose device, app, dev-server, and RN/Expo readiness`,searchHint:`health check setup troubleshoot`,cliDetail:`Metro reachability is inferred from cwd/runtime. On iOS simulators it also warms the XCTest runner build cache in the background when missing. Pass --app to verify a target app on the one matching booted device without opening a session. Use --remote to check remote connection setup without probing local devices. Default output is compact; use --json for full checks and evidence.`,mcpDetail:`On iOS simulators it also warms the XCTest runner build cache in the background when missing.`},metadata:U(`doctor`,`Diagnose device, app, development-server, and React Native or Expo readiness issues. Returns compact evidence for local inventory, sessions, optional app discovery, toolchains, and server reachability.`,{targetApp:M(`Installed app package/bundle id or app name to verify without opening a session.`),remote:F(`Check remote connection setup instead of local device inventory.`)}),run:(e,t)=>e.command.doctor(t),cliSchema:{usageOverride:`doctor [--platform ios|android|harmonyos|vega|macos|linux|web|apple]`,allowedFlags:[`targetApp`,`remote`]},cliReader:(e,t)=>({...y(t),targetApp:t.targetApp,remote:t.remote}),daemonWriter:_(u.doctor)});function As(e,t=`--github-actions-artifact`){let n=e.indexOf(`:`);if(n<=0||n===e.length-1)throw new l(`INVALID_ARGS`,`${t} must use owner/repo:artifact, for example thymikee/RNCLI83:6635342232`);let{owner:r,repo:i}=Ns(e.slice(0,n),t);return Ms(r,i,e.slice(n+1),`${t} artifact`)}function js(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw new l(`INVALID_ARGS`,`${t} installSource must be an object.`);let n=e;if(Fs(n.type,`${t} installSource.type`)!==`github-actions-artifact`)throw new l(`INVALID_ARGS`,`${t} installSource.type must be "github-actions-artifact".`);let{owner:r,repo:i}=Ns(Fs(n.repo,`${t} installSource.repo`),`${t} installSource.repo`);return Ms(r,i,n.artifact,`${t} installSource.artifact`)}function Ms(e,t,n,r){return typeof n==`number`||Ls(n)?{kind:`github-actions-artifact`,owner:e,repo:t,artifactId:Is(n,r)}:{kind:`github-actions-artifact`,owner:e,repo:t,artifactName:Fs(n,r)}}function Ns(e,t){let n=e.indexOf(`/`);if(n<=0||n===e.length-1||e.indexOf(`/`,n+1)!==-1)throw new l(`INVALID_ARGS`,`${t} must use owner/repo.`);let r={owner:e.slice(0,n).trim(),repo:e.slice(n+1).trim()};if(!r.owner||!r.repo)throw new l(`INVALID_ARGS`,`${t} must use owner/repo.`);return r}function Ps(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function Fs(e,t){let n=Ps(e);if(!n)throw new l(`INVALID_ARGS`,`${t} must be a non-empty string.`);return n}function Is(e,t){let n=typeof e==`number`?e:typeof e==`string`?Number(e):NaN;if(!Number.isInteger(n))throw new l(`INVALID_ARGS`,`${t} must be an integer.`);return n}function Ls(e){return typeof e==`string`&&/^\d+$/.test(e.trim())}const Rs=U(`install`,`Install an app binary from a local path. An app identifier alongside the path selects the app explicitly when required by the target. Local Android and iOS install steps time out after 120s; the command allows 480s including device startup.`,{app:M(`Optional app identifier hint.`),appPath:j(M(`Path to app binary.`)),...Kr()}),zs=U(`reinstall`,`Replace an installed app with a binary from a local path. This preserves the app identity while installing a new build on the selected device. Local Android and iOS install steps time out after 120s; the command allows 480s including device startup and uninstall. On iOS, a corrupt .ipa that cannot be unpacked leaves the installed app in place. On Android, an archive that cannot be unpacked or contains no .apk or .aab also leaves it in place. An invalid app bundle, corrupt APK or another install failure after uninstall can still leave the app removed.`,{app:j(M()),appPath:j(M(`Path to app binary.`)),...Kr()}),Bs=U(`uninstall`,`Remove an installed app from the selected device. A package name or bundle id that is not installed succeeds with wasInstalled: false. The command allows 480s including device startup.`,{app:j(M(`Package name, bundle id, or installed app name.`)),...Kr()}),Vs=U(`install-from-source`,`Install app builds from URLs, remote source specs, or CI artifacts resolved by a remote daemon. The command allows 600s, including up to 120s for the download; local Android and iOS install steps time out after 120s.`,{source:j(R(A(`Install source object.`))),retainPaths:F(),retentionMs:I(`retentionMs`)}),Hs={usageOverride:`install <path> | install <app> <path>`,listUsageOverride:`install <path>`,positionalArgs:[`appOrPath`,`path?`],allowedFlags:Bi},Us={positionalArgs:[`app`,`path`],allowedFlags:Bi},Ws={positionalArgs:[`app`],allowedFlags:Bi},Gs={usageOverride:`install-from-source <url> | install-from-source --github-actions-artifact <owner/repo:artifact>`,usageFlags:[],listUsageOverride:`install-from-source`,positionalArgs:[`url?`],allowedFlags:[`header`,`githubActionsArtifact`,`installSource`,`retainPaths`,`retentionMs`]},Ks=(e,t)=>ec(e,t),qs=(e,t)=>tc(e,t),Js=(e,t)=>({...y(t),app:S(e[0],`uninstall requires app`),...Xn(t)}),Ys=(e,t)=>({...y(t),source:ic(e,t),retainPaths:t.retainPaths,retentionMs:t.retentionMs}),Xs=_(u.install,e=>nc(e.app,e.appPath)),Zs=_(u.reinstall,e=>rc(e.app,e.appPath)),Qs=_(u.uninstall,e=>[C(e.app,`missing app`)]),$s=[W({name:`install`,effect:`destructive`,text:{summary:`Install an app binary from a path`,searchHint:`apk ipa`,cliDetail:`A HarmonyOS .hap installs from its path alone, for example agent-device install ./build/entry-default-signed.hap --platform harmonyos.`},metadata:Rs,run:(e,t)=>e.apps.install(t),cliSchema:Hs,cliReader:Ks,daemonWriter:Xs}),W({name:`reinstall`,effect:`destructive`,text:{summary:`Replace an installed app with a new build`,searchHint:`update`},metadata:zs,run:(e,t)=>e.apps.reinstall(t),cliSchema:Us,cliReader:qs,daemonWriter:Zs}),W({name:`uninstall`,effect:`destructive`,text:{summary:`Remove an installed app`,searchHint:`delete`},metadata:Bs,run:(e,t)=>e.apps.uninstall(t),cliSchema:Ws,cliReader:Js,daemonWriter:Qs}),W({name:`install-from-source`,effect:`destructive`,text:{summary:`Install app builds from URLs or CI artifacts`,searchHint:`fetch link hosted`},metadata:Vs,run:(e,t)=>e.apps.installFromSource(t),cliSchema:Gs,cliReader:Ys,daemonWriter:e=>v(dt.installSource,[],{...e,installSource:e.source,retainMaterializedPaths:e.retainPaths,materializedPathRetentionMs:e.retentionMs})})];function ec(e,t){let[n,r]=e,i=r!==void 0;return{...y(t),...i?{app:S(n,`install requires app`)}:{},appPath:S(i?r:n,`install requires path`),...Xn(t)}}function tc(e,t){return{...y(t),app:S(e[0],`reinstall requires app`),appPath:S(e[1],`reinstall requires path`),...Xn(t)}}function nc(e,t){let n=C(t,`missing app path`);return typeof e==`string`&&e.length>0?[e,n]:[n]}function rc(e,t){return[C(e,`missing first positional`),C(t,`missing second positional`)]}function ic(e,t){let n=e[0]?.trim();if(e.length>1)throw new l(`INVALID_ARGS`,`install-from-source accepts either one <url> positional or --github-actions-artifact`);let r=t.githubActionsArtifact?As(t.githubActionsArtifact):void 0,i=t.installSource;if(+!!n+ +!!r+ +!!i!=1)throw new l(`INVALID_ARGS`,`install-from-source requires exactly one source: <url>, --github-actions-artifact, or config installSource`);if(!n&&t.header&&t.header.length>0)throw new l(`INVALID_ARGS`,`install-from-source --header is only supported for URL sources`);if(r)return r;if(i)return i;if(!ac(n))throw new l(`INVALID_ARGS`,`install-from-source <url> must be an http(s) URL: ${n}`,{hint:`Install a local build with install <app> <path>.`});return{kind:`url`,url:n,headers:oc(t.header)}}function ac(e){let t=URL.parse(e)?.protocol;return t===`http:`||t===`https:`}function oc(e){if(!e||e.length===0)return;let t={};for(let n of e){let e=n.indexOf(`:`);if(e<=0)throw new l(`INVALID_ARGS`,`Invalid --header value "${n}". Expected "name:value".`);let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();if(!r)throw new l(`INVALID_ARGS`,`Invalid --header value "${n}". Header name cannot be empty.`);t[r]=i}return t}const sc=[`ios-runner`],cc={prepare:w({action:E(`ios-runner`),platform:T(ze),deviceId:D(),deviceName:D(),kind:T(Re),durationMs:O(),runner:w({},[]),cache:T([`exact`,`miss`,`external`]),artifact:T([`valid`,`rebuilt`]),buildMs:O(),connectMs:O(),healthCheckMs:O(),xctestrunPath:D(),recoveryReason:D(),failureReason:D(),timing:w({totalMs:O(),additiveParts:w({buildMs:O(),connectAfterBuildMs:O(),healthCheckMs:O()},[`connectAfterBuildMs`,`healthCheckMs`]),containment:w({connectMs:{type:`array`,items:E(`buildMs`)},healthCheckMs:{type:`array`,items:D()}},[`healthCheckMs`]),note:D()},[`totalMs`,`additiveParts`,`containment`,`note`]),message:D()},[`action`,`platform`,`deviceId`,`deviceName`,`kind`,`durationMs`,`runner`,`connectMs`,`healthCheckMs`,`timing`,`message`])},lc=W({name:`prepare`,effect:`destructive`,text:{summary:`Pre-warm platform helpers before automation`,searchHint:`prepare warm up runner helpers`},metadata:U(`prepare`,`Prepare platform helper infrastructure. ios-runner builds/reuses, starts, and health-checks the XCTest runner so later Apple snapshots and interactions do not pay first-use startup cost. In JSON output, top-level buildMs/connectMs/healthCheckMs are diagnostic fields and may overlap; use timing.additiveParts for additive wall-clock phase totals. In CI, run it after boot/install and before replay/test; if replay/test starts a separate daemon, stop the prepare daemon before replay/test so it does not keep the prepared runner lease. It is not a recovery step for "runner already owned by another agent-device daemon"; stop the owning daemon on the Mac with simulator access instead. Runner build/start output is written to the session runner.log; daemon.log is for daemon lifecycle/startup issues.`,{action:j(L(sc)),timeoutMs:P(`Maximum wall-clock time for the prepare command.`)}),run:(e,t)=>e.command.prepare(t),cliSchema:{usageOverride:`prepare ios-runner --platform ios|macos`,listUsageOverride:`prepare`,positionalArgs:[`ios-runner`],allowedFlags:[`timeoutMs`]},cliReader:(e,t)=>({...y(t),action:S(e[0],`prepare requires subcommand`),timeoutMs:t.timeoutMs}),daemonWriter:_(u.prepare,e=>[C(e.action,`prepare requires subcommand`)])}),uc={push:{type:`object`,oneOf:[w({platform:E(`ios`),bundleId:D(),message:D()},[`platform`,`bundleId`,`message`]),w({platform:E(`android`),package:D(),action:D(),extrasCount:O(),message:D()},[`platform`,`package`,`action`,`extrasCount`,`message`])]},"trigger-app-event":w({event:D(),eventUrl:D(),transport:E(`deep-link`),message:D()},[`event`,`eventUrl`,`transport`,`message`])},dc=U(`push`,`Deliver push notification payloads to an installed app.`,{app:j(M()),payload:j(R({oneOf:[D(),A()]}))}),fc=U(`trigger-app-event`,`Ask the app to handle an app-defined automation or test event, with an optional structured payload. Supported event names and payload shapes are defined by the app.`,{event:j(M(`Name of an app-defined automation or test event the app documents.`)),payload:Sc(`Structured payload passed to the event, in the shape the app documents for it.`)}),pc={listUsageOverride:`push`,positionalArgs:[`bundleOrPackage`,`payloadOrJson`]},mc={usageOverride:`trigger-app-event <event> [payloadJson]`,listUsageOverride:`trigger-app-event`,positionalArgs:[`event`,`payloadJson?`]},hc=(e,t)=>({...y(t),app:S(e[0],`push requires bundleOrPackage`),payload:S(e[1],`push requires payloadOrJson`)}),gc=(e,t)=>({...y(t),event:S(e[0],`trigger-app-event requires event`),payload:e[1]?ir(e[1],`trigger-app-event payload`):void 0}),_c=_(u.push,e=>bc(e)),vc=_(u.triggerAppEvent,e=>xc(e)),yc=[W({name:`push`,effect:`destructive`,text:{summary:`Deliver a push notification payload`,searchHint:`apns fcm`},metadata:dc,run:(e,t)=>e.apps.push(t),cliSchema:pc,cliReader:hc,daemonWriter:_c}),W({name:`trigger-app-event`,effect:`destructive`,text:{summary:`Invoke an app-defined automation event`,searchHint:`hook`},metadata:fc,run:(e,t)=>e.apps.triggerEvent(t),cliSchema:mc,cliReader:gc,daemonWriter:vc})];function bc(e){return[e.app,typeof e.payload==`string`?e.payload:JSON.stringify(e.payload)]}function xc(e){return[e.event,...e.payload?[JSON.stringify(e.payload)]:[]]}function Sc(e){return Rr(e)}const Cc=W({name:`session`,effect:`destructive`,text:{summary:`List sessions, show the state dir, or publish a script`,searchHint:`current running inspect`},metadata:U(`session`,`List active sessions, print the effective daemon state directory, or publish an armed open-to-destination script without closing its session`,{action:L([`list`,`state-dir`,`save-script`],`list shows active sessions; state-dir prints the daemon state directory; save-script publishes an armed recording without teardown.`),path:M(`Optional .ad output path for save-script.`),force:F(`Atomically replace an existing save-script target.`)}),run:async(e,{action:t,path:n,force:r,...i})=>{let a=t??`list`;return Tc(a,n,r),a===`state-dir`?{stateDir:await e.sessions.stateDir(i)}:a===`save-script`?await e.sessions.saveScript({...i,path:n,force:r}):{sessions:await e.sessions.list(i)}},cliSchema:{usageOverride:`session list | session state-dir | session save-script [path] [--force]`,usageFlags:[],listUsageOverride:`session`,positionalArgs:[`list|state-dir|save-script?`,`path?`],allowedFlags:[`force`]},cliReader:(e,t)=>({...y(t),action:wc(e[0]),path:e[1],force:t.force})});function wc(e){let t=e??`list`;if(t===`list`||t===`state-dir`||t===`save-script`)return t;throw new l(`INVALID_ARGS`,`session only supports list, state-dir, or save-script`)}function Tc(e,t,n){if(e!==`save-script`&&(t!==void 0||n===!0))throw new l(`INVALID_ARGS`,`session ${e} does not accept a path or --force; use session save-script [path] [--force] to publish a recording.`)}const Ec={viewport:w({width:O(),height:O(),message:D()},[`width`,`height`,`message`])},Dc=W({name:`viewport`,effect:`write`,text:{summary:`Resize the active web viewport for the current session`,searchHint:`browser window size`},metadata:U(`viewport`,`Resize the active web viewport before taking snapshots or screenshots. Resizing can reveal different content in fixed-layout or 100vh apps.`,{width:j(P(`Viewport width in CSS pixels.`,{min:1})),height:j(P(`Viewport height in CSS pixels.`,{min:1}))}),run:(e,t)=>e.command.viewport(t),cliSchema:{positionalArgs:[`width`,`height`]},cliReader:(e,t)=>({...y(t),...Fe(e)}),daemonWriter:_(u.viewport,e=>{let{width:t,height:n}=e;return[String(t),String(n)]})}),Oc=G({name:`management`,commands:[...Ds,Ho,ks,lc,is,Cc,as,os,Dc,...$s,...yc]}),kc=[`auto`,`react-native`,`expo`,`repack`];function Ac(e){if(e!==void 0){if(kc.includes(e))return e;throw new l(`INVALID_ARGS`,`metro prepare --kind must be auto, react-native, expo, or repack`)}}const jc=`metro`,Mc=G({name:`metro`,commands:[W({name:jc,effect:`destructive`,text:{summary:`Prepare the dev server or reload apps`,searchHint:`bundler`,cliDetail:`reload with no --metro-host/--metro-port/--bundle-url resolves against the dev server this session last bound via metro prepare or open's metro hint flags (falling back to localhost:8081 only when the session never bound one), so it never silently reloads a different project's server on the default port; pass an explicit flag to override the session hint for one call. After prepare, reload uses the local server address independently of the public or proxy address given to the device; a fresh open preserves it only when its client-config runtime points to the prepared device server, while explicit reload flags override it. For open or an explicit bundle URL, reload removes a .bundle/.jsbundle/.js entry filename and keeps the remaining path as the server mount, and when the server has no HTTP /reload route (Expo) the reload is broadcast over its /message websocket instead of trusting the app-page fallback. The binding is cleared when the session closes, and a fresh open without hint flags also clears any leftover binding from a previous same-name session. --kind expo (detected or forced) requests the virtual-entry bundle URL (.expo/.virtual-metro-entry.bundle) instead of index.bundle, since index.bundle 404s/500s against Expo dev servers in monorepos. Dependency install auto-detects the package manager from the nearest yarn.lock/pnpm-lock.yaml/bun.lock/bun.lockb/package-lock.json walking up from --project-root (bounded at the repo root), so Yarn/pnpm workspace monorepos with the lockfile at the repo root do not wrongly fall back to npm install (which fails on workspace: dependency specifiers); if install still fails, pass --no-install-deps when dependencies are already installed (for example via a monorepo root install).`,mcpDetail:`The binding is cleared when the session closes, and a fresh open without runtime hints also clears any leftover binding from a previous same-name session.`},metadata:U(jc,`Prepare a React Native development server or ask connected apps to reload, using the development server this session is bound to. Explicit runtime inputs override that binding for one call.`,{action:j(L([`prepare`,`reload`])),projectRoot:M(),kind:R(D()),publicBaseUrl:M(),proxyBaseUrl:Pr(M(),{operatorPath:`Configure the remote proxy in the remote-config profile or operator config for the process serving these tools.`}),bearerToken:Pr(M(),{envFlagKeys:[`metroBearerToken`,`daemonAuthToken`]}),bridgeScope:R({type:`object`,additionalProperties:!0}),launchUrl:M(),port:P(),listenHost:M(),statusHost:M(),startupTimeoutMs:P(),probeTimeoutMs:P(),reuseExisting:F(),installDependenciesIfNeeded:F(),runtimeFilePath:M(),logPath:M(),metroHost:M(),metroPort:P(),bundleUrl:M(),timeoutMs:P()}),run:async(e,t)=>t.action===`prepare`?await e.metro.prepare(Nc(t)):await e.metro.reload(Fc(t)),cliSchema:{usageOverride:`metro prepare (--public-base-url <url> | --proxy-base-url <url>) [--project-root <path>] [--port <port>] [--kind auto|react-native|expo|repack]
4
+ agent-device metro reload [--metro-host <host>] [--metro-port <port>] [--bundle-url <url>]`,usageFlags:[],listUsageOverride:`metro`,positionalArgs:[`prepare|reload`],allowedFlags:[...zi,...Ri]},cliReader:(e,t)=>{let n=(e[0]??``).toLowerCase();if(n!==`prepare`&&n!==`reload`)throw new l(`INVALID_ARGS`,`metro requires a subcommand: prepare or reload`);if(n===`reload`)return{action:n,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,timeoutMs:t.metroProbeTimeoutMs};if(!t.metroPublicBaseUrl&&!t.metroProxyBaseUrl)throw new l(`INVALID_ARGS`,`metro prepare requires --public-base-url <url> or --proxy-base-url <url>.`);return{action:n,projectRoot:t.metroProjectRoot,kind:Ac(t.kind??t.metroKind),port:t.metroPreparePort,listenHost:t.metroListenHost,statusHost:t.metroStatusHost,publicBaseUrl:t.metroPublicBaseUrl,proxyBaseUrl:t.metroProxyBaseUrl,bearerToken:t.metroBearerToken,bridgeScope:t.tenant&&t.runId&&t.leaseId?{tenantId:t.tenant,runId:t.runId,leaseId:t.leaseId}:void 0,startupTimeoutMs:t.metroStartupTimeoutMs,probeTimeoutMs:t.metroProbeTimeoutMs,reuseExisting:!t.metroNoReuseExisting&&void 0,installDependenciesIfNeeded:!t.metroNoInstallDeps&&void 0,runtimeFilePath:t.metroRuntimeFile}}})]});function Nc(e){return{projectRoot:e.projectRoot,kind:e.kind,publicBaseUrl:e.publicBaseUrl,proxyBaseUrl:e.proxyBaseUrl,bearerToken:e.bearerToken,bridgeScope:e.bridgeScope??Pc(e),port:e.port,listenHost:e.listenHost,statusHost:e.statusHost,startupTimeoutMs:e.startupTimeoutMs,probeTimeoutMs:e.probeTimeoutMs,reuseExisting:e.reuseExisting,installDependenciesIfNeeded:e.installDependenciesIfNeeded,runtimeFilePath:e.runtimeFilePath}}function Pc(e){return e.tenant&&e.runId&&e.leaseId?{tenantId:e.tenant,runId:e.runId,leaseId:e.leaseId}:void 0}function Fc(e){return{metroHost:e.metroHost,metroPort:e.metroPort,bundleUrl:e.bundleUrl,timeoutMs:e.timeoutMs}}function Ic(e,t){return e.includes(t)}function Lc(e,t,n={}){let r=t===void 0?void 0:n.normalize?.(t)??t;if(r!==void 0&&Ic(e,r))return r;let i=typeof n.message==`function`?n.message(t):n.message;throw new l(`INVALID_ARGS`,i??`Invalid value: ${t}. Use ${e.join(`|`)}.`)}const Rc=`logs`,zc=`events`,Bc=`network`,Vc=`audio`,Hc=[`dump`,`log`],Uc=[`probe`],Wc=[`start`,`status`,`stop`],Gc=U(Rc,`Session app log info, start/stop streaming, diagnostics, and markers`,{action:L(lr),message:M(),restart:F()}),Kc=U(zc,`Read the daemon-owned session event timeline as paged JSON-friendly entries`,{limit:P(),cursor:M()}),qc=U(Bc,`Dump recent HTTP(s) traffic parsed from the session app log`,{action:L(Hc),limit:P(),include:L(pe)}),Jc=U(Vc,`Measure browser or host-rendered simulator/emulator audio as compact dBFS buckets. Probe actions start sampling, report its status, or stop sampling.`,{action:L(Uc),probeAction:L(Wc),durationMs:P(`Probe duration in milliseconds.`),bucketMs:P(`Audio level bucket size in milliseconds.`)}),Yc=G({name:`observability`,commands:[W({name:Rc,effect:`destructive`,text:{summary:`Manage session app logs`,searchHint:`console output device`},metadata:Gc,run:(e,t)=>e.observability.logs(t),cliSchema:{usageOverride:`logs path | logs start | logs stop | logs clear [--restart] | logs doctor | logs mark [message...]`,usageFlags:[],positionalArgs:[`path|start|stop|clear|doctor|mark`,`message?`],allowsExtraPositionals:!0,allowedFlags:[`restart`]},cliReader:(e,t)=>({...y(t),action:el(e[0]),message:e.slice(1).join(` `)||void 0,restart:t.restart}),daemonWriter:_(Rc,e=>Xc(e))}),W({name:zc,effect:`read`,text:{summary:`Read session event timeline`,searchHint:`history log`},metadata:Kc,run:(e,t)=>e.observability.events(t),cliSchema:{usageOverride:`events [limit] [cursor]`,listUsageOverride:`events`,positionalArgs:[`limit?`,`cursor?`]},cliReader:(e,t)=>({...y(t),limit:e[0]?.trim()?cr(e[0]):void 0,cursor:e[1]}),daemonWriter:e=>v(zc,Zc(e),e)}),W({name:Bc,effect:`write`,text:{summary:`Inspect HTTP(S) traffic from session logs`,searchHint:`requests api calls`},metadata:qc,run:(e,t)=>e.observability.network(t),cliSchema:{usageOverride:`network dump [limit] [summary|headers|body|all] [--include summary|headers|body|all] | network log [limit] [summary|headers|body|all] [--include summary|headers|body|all]`,usageFlags:[],listUsageOverride:`network`,positionalArgs:[`dump|log`,`limit?`,`include?`],allowedFlags:[`networkInclude`]},cliReader:(e,t)=>({...y(t),action:tl(e[0]),limit:cr(e[1]),include:t.networkInclude??nl(e[2])}),daemonWriter:e=>v(Bc,Qc(e),{...e,networkInclude:e.include})}),W({name:Vc,effect:`write`,text:{summary:`Probe audio levels`,searchHint:`sound volume level`},metadata:Jc,run:(e,t)=>e.observability.audio(t),cliSchema:{usageOverride:`audio probe start [durationSeconds] [bucketMs] | audio probe status | audio probe stop`,listUsageOverride:`audio`,positionalArgs:[`probe`,`start|status|stop`,`durationSeconds?`,`bucketMs?`]},cliReader:(e,t)=>({...y(t),action:rl(e[0]),probeAction:il(e[1]),durationMs:al(e[2]),bucketMs:cr(e[3])}),daemonWriter:e=>v(Vc,$c(e),e)})]});function Xc(e){return[e.action??`path`,...b(e.message)]}function Zc(e){return e.cursor===void 0?x(e.limit):[e.limit===void 0?``:String(e.limit),e.cursor]}function Qc(e){return[...e.action?[e.action]:[],...x(e.limit)]}function $c(e){return[e.action??`probe`,e.probeAction??`status`,...x(e.durationMs),...x(e.bucketMs)]}function el(e){if(e!==void 0)return Lc(lr,e,{message:`logs requires path, start, stop, doctor, mark, or clear`})}function tl(e){if(e!==void 0){if(e===`dump`||e===`log`)return e;throw new l(`INVALID_ARGS`,`network requires dump or log`)}}function nl(e){if(e!==void 0)return Lc(pe,e,{message:`network include must be summary, headers, body, or all`})}function rl(e){if(e!==void 0)return Lc(Uc,e,{message:`audio requires probe`})}function il(e){if(e!==void 0)return Lc(Wc,e,{message:`audio probe requires start, status, or stop`})}function al(e){let t=cr(e);return t===void 0?void 0:Math.round(t*1e3)}const ol=`perf`,sl=G({name:`perf`,commands:[W({name:ol,effect:`write`,text:{summary:`Check frames, memory, or native profiles`,searchHint:`performance fps profile`,cliDetail:`Use perf frames for bounded frame-health evidence and perf memory sample for a compact process-memory reading. On iOS simulators and macOS, process sampling and captures target the resolved app executable and exclude other copies with the same name. Apple xctrace and Android Simpleperf/Perfetto captures keep raw artifacts on disk; report produces bounded agent-readable evidence. For React render performance, run agent-device react-devtools profile start before the interaction and react-devtools profile stop after it.`,mcpDetail:`For CPU profiles, start and stop write the raw artifact while report writes a compact summary for readable native CPU evidence. Profiling output is evidence only: compact state, artifact path, and size.`},metadata:U(ol,`Collect frame health, memory diagnostics, and platform profiling artifacts with compact agent-readable summaries.`,{area:j(L(wt)),subject:L(Ot),action:L(Ct),kind:L(gt),template:M(`xctrace template name, for example Time Profiler.`),out:M(`Output artifact path.`),tracePath:M(`Existing .trace path to report, defaults to the latest session trace.`)}),run:(e,t)=>e.observability.perf(t),cliSchema:{usageOverride:`perf frames --json
5
5
  agent-device perf memory sample --json
6
6
  agent-device perf memory snapshot [--kind android-hprof|memgraph] [--out <path>]
7
7
  agent-device perf cpu profile start --kind xctrace [--template <name>] --out <profile.trace>
@@ -13,4 +13,4 @@ import{r as e}from"./rolldown-runtime.js";import{A as t,P as n,g as r,j as i,n a
13
13
  agent-device perf cpu profile report --kind simpleperf --out <cpu-report.json>
14
14
  agent-device perf trace start|stop --kind perfetto [--out <path>]
15
15
 
16
- Aggregate perf was removed in 0.21. Use one of the explicit forms above.`,usageFlags:[],listUsageOverride:`perf`,positionalArgs:[`area`,`subjectOrAction?`,`action?`],allowedFlags:[`kind`,`perfTemplate`,`out`]},cliReader:(e,t)=>({...y(t),...ol(e,{kind:fl(t.kind),template:t.perfTemplate,out:t.out})}),daemonWriter:_(nl,e=>il(e))})]});function il(e){let t=e.area;return t===`cpu`?al([...b(t),...b(e.subject),...b(e.action),...b(e.kind)],e):t===`trace`?al([...b(t),...b(e.action),...b(e.kind)],e):[...b(t),...b(e.action)]}function al(e,t){let n=[...e];return(t.template||t.out||t.tracePath)&&n.push(t.template??``),(t.out||t.tracePath)&&n.push(t.out??``),t.tracePath&&n.push(t.tracePath),n}function ol(e,t={}){let n=cl(e[0]);if(n===`cpu`)return{area:n,subject:ul(e[1]),action:ll(e[2]),kind:dl(t.kind),template:t.template,out:t.out};if(n===`trace`)return{area:n,action:ll(e[1]),kind:dl(t.kind),template:t.template,out:t.out};let r=ll(e[1]),i=dl(t.kind);return sl(n,r,i,t.out),{area:n,action:r,kind:i,out:t.out}}function sl(e,t,r,i){if(e===`frames`){if(r!==void 0)throw new n(`INVALID_ARGS`,`--kind is only supported with perf memory snapshot`);if(i!==void 0)throw new n(`INVALID_ARGS`,`--out is only supported with perf memory snapshot, perf cpu profile, or perf trace`)}if(e===`memory`){if(t!==`snapshot`&&r!==void 0)throw new n(`INVALID_ARGS`,`--kind is only supported with perf memory snapshot`);if(t!==`snapshot`&&i!==void 0)throw new n(`INVALID_ARGS`,`--out is only supported with perf memory snapshot`)}}function cl(e){let t=e?.toLowerCase();if(vt(t))throw new n(`INVALID_ARGS`,bt);if(_t(t))return t;throw new n(`INVALID_ARGS`,mt)}function ll(e){if(e===void 0)return;let t=e.toLowerCase();if(gt(t))return t;throw new n(`INVALID_ARGS`,Et)}function ul(e){let t=e?.toLowerCase();if(t!==void 0&&yt(t))return t;throw new n(`INVALID_ARGS`,xt)}function dl(e){if(e===void 0)return;let t=e.toLowerCase();if(wt(t))return t;throw new n(`INVALID_ARGS`,Tt)}function fl(e){return typeof e==`string`?dl(e):void 0}const pl=`react-native`,ml=G({name:`react-native`,commands:[W({name:pl,text:{summary:`Run React Native automation helpers`},metadata:U(pl,`Run supported React Native automation helpers. Use dismiss-overlay to close a visible development error overlay before continuing normal UI automation.`,{action:j(L([`dismiss-overlay`]))}),run:(e,t)=>e.command.reactNative(t),cliSchema:{usageOverride:`react-native dismiss-overlay`,listUsageOverride:`react-native dismiss-overlay`,positionalArgs:[`dismiss-overlay`]},cliReader:(e,t)=>({...y(t),action:hl(e[0])}),daemonWriter:_(pl,e=>[C(e.action,`react-native requires action`)])})]});function hl(e){if(e===`dismiss-overlay`)return e;throw new n(`INVALID_ARGS`,`react-native supports only: dismiss-overlay`)}const gl=`record`,_l=`trace`,vl=[`start`,`stop`],yl=U(gl,`Start or stop a screen recording for the active app session or, where supported, the selected device, or build a contact-sheet PNG from a recording already exported. Long Android recordings can return multiple video artifacts; HarmonyOS supports whole-screen recording on physical devices.`,{action:j(L(vl)),path:M(),fps:P(),maxSize:jr(oe.migration.record),quality:L(We),hideTouches:F(),recordingScope:L(Ge)},{parseableOutput:!0}),bl=U(_l,`Start or stop trace-log capture and return the resulting artifact when capture ends. Without a path, start writes a timestamped trace log named after the session in the sessions directory of the daemon state; a path on stop moves the finished trace there.`,{action:j(L(vl)),path:M()}),xl={start:[`recordingScope`,`fps`,`quality`,`hideTouches`],stop:[],"contact-sheet":[`out`]},Sl={usageOverride:`record start [path] [--scope <app|device|system>] [--fps <n>] [--quality <medium|high>] [--hide-touches] | record stop | record contact-sheet <video.mp4> [--out <sheet.png>]`,usageFlags:[],listUsageOverride:`record start [path] | record stop | record contact-sheet <video>`,positionalArgs:[`start|stop|contact-sheet`,`path?`],allowedFlags:[...new Set(Object.values(xl).flat())],flagsByAction:xl},Cl={usageOverride:`trace start [path] | trace stop [path]`,listUsageOverride:`trace start [path] | trace stop [path]`,positionalArgs:[`start|stop`,`path?`]},wl=(e,t)=>({...y(t),action:jl(e[0],gl),path:e[1],fps:t.fps,quality:t.quality,hideTouches:t.hideTouches,recordingScope:t.recordingScope}),Tl=(e,t)=>({...y(t),action:jl(e[0],_l),path:e[1]}),El=_(gl,e=>Al(e)),Dl=e=>(s(`record`,e),El(e)),Ol=_(_l,e=>Al(e)),kl=G({name:`recording`,commands:[W({name:gl,text:{summary:`Start or stop screen recording`,cliDetail:`MP4 verification setup starts in the background before recording output preparation, without delaying capture. If setup exceeds the stop budget, details.reason is video_validator_compile_timeout (retriable); run record stop again while setup continues. Hosts without xcrun keep container-only MP4 completion. Other compilation failures, or an unavailable validator executable or AVFoundation during verification, return video_validator_unavailable. Repair the reported failure and retry record stop; a failed compile is retried on the next start or stop. The default --scope app requires an active app session from open <app>; use --scope device/system to explicitly request whole-screen recording where the selected backend supports it. Android record start publishes a durable device manifest, recordings longer than the 180s adb screenrecord limit are returned as multiple MP4 chunks while the daemon stays alive, and daemon-restart recovery uses only manifest-owned chunks. Android screenrecord encodes a frame only when the screen changes, so a clip can end at the last frame the recorder encoded instead of at record stop; durationMs is host wall clock from record start until the export finished, and capturedDurationMs reports the video timeline when it can be measured, with a warning naming how much of the window that video covers. An Android manifest left by an unreachable recording is retired on the next start once its recorders are proven gone; one still owned refuses with non-retriable DEVICE_IN_USE and reason native_recovery_evidence_open naming the session to run record stop for, and a recorder that is still writing an artifact refuses with DEVICE_IN_USE and reason native_recording_artifact_claimed, which clears itself once that recorder ends at the 180s limit. HarmonyOS supports whole-screen recording on physical devices only: use --scope device/system; --fps, --quality, and --hide-touches are unsupported. Use --quality to choose medium or high export quality on supported backends. The touch overlay renders at most 30 frames a second, or at --fps when lower; a lower --fps makes record stop faster on a long recording, and an overlay export that runs past its budget returns the raw video with an overlayWarning. An iOS simulator host recording lock returns non-retriable DEVICE_IN_USE with reason apple_simulator_recording_busy. Stop the recording in its owning session; if a dead recorder left the host locked, ask the host operator to restart the CoreSimulator stream service. On any backend, record start first settles the open recording records on its device that it would refuse on and whose session this daemon no longer holds: it finishes each one as its own record stop would, so the export lands at the output path of that recording and a later record stop in that session returns it, and runs the exact-owner recovery a daemon restart runs, which discards what that recording left, only for a record that cannot finish. A record it cannot confirm cleaned, or one whose session is still held, refuses the start with reason cleanup-unconfirmed and names that session: stop or close it, then retry. A record that another device left under the same session name is never settled from this device: the start refuses and names that device, so stop it in that session or record under another session name. A record stop that cannot produce its export keeps what a retry reads back — on Android the device-side artifact and the native manifest — leaves the recording manifest of that session open, and returns its own error, so retry record stop in that session; while this daemon holds that session, only closing it disposes them, and once it does not, the next record start on that device settles them as described above. Every stopped recording also reports what became of its recorder and of the file that recorder writes to: recorder is confirmed, or lost when the session holding it died, and nativePathDisposition is retirable while that file still owes a removal or retired once its removal was verified. Both are optional disclosures, not failures; ADR 0024 declares further states (unconfirmed, pending) for the steps that gain those probes, and no stop reports them yet. record contact-sheet <video.mp4> [--out <sheet.png>] is a local report over a file you already exported: it decodes frames out of that MP4 and writes one PNG holding the cells where the screen visibly changed, each labeled with its elapsed time on the clip timeline. It needs no session and no device, rebuilds any past recording, and works for every backend that exports MP4; a WebM recording is refused with reason contact_sheet_container_unsupported. The sample grid is bounded and spread across the whole clip, so it reports coverage rather than a review: a flash that opens and closes entirely between two sample times is not in the sheet, which is why the result also reports how many times it sampled and how many frames came back. Frame decoding is Apple AVFoundation tooling, so the command runs only on macOS hosts and refuses elsewhere with reason contact_sheet_unsupported_host.`},metadata:yl,run:(e,t)=>e.recording.record(t),cliSchema:Sl,cliReader:wl,daemonWriter:Dl}),W({name:_l,text:{summary:`Start or stop trace capture`},metadata:bl,run:(e,t)=>e.recording.trace(t),cliSchema:Cl,cliReader:Tl,daemonWriter:Ol})]});function Al(e){return[e.action,...b(e.path)]}function jl(e,t){if(e===`start`||e===`stop`)return e;throw new n(`INVALID_ARGS`,`${t} requires start|stop`)}const Ml=2097152;async function Nl(e){let t=dn(e.inputPath,{cwd:e.cwd}),n=Fl(t,e.inputPath),r=st(t,e.replayBackend);return r===`ad`?Pl(t,{[t]:n},e.inputPath):Pl(t,(await(await import(`./replay-backend-registry.js`).then(e=>e.n)).getReplayBackend(r)).collectSourceFiles({entryPath:t,entrySource:n,env:e.env,readSource:Il}),e.inputPath)}function Pl(e,t,n){return Ll(t,n),{entry:e,files:t}}function Fl(e,t){try{return d.readFileSync(e,`utf8`)}catch(r){throw new n(`INVALID_ARGS`,`replay script not found on this machine: ${t}`,{path:e,hint:`Replay scripts are read by the client and sent to the daemon, so the path must resolve where you ran the command.`},r instanceof Error?r:void 0)}}function Il(e){try{return d.readFileSync(e,`utf8`)}catch{return}}function Ll(e,t){let r=Object.values(e).reduce((e,t)=>e+Buffer.byteLength(t,`utf8`),0);if(!(r<=2097152))throw new n(`INVALID_ARGS`,`replay script sources for ${t} total ${r} bytes, over the ${Ml}-byte limit; split the flow or drop unused runFlow includes.`,{limitBytes:Ml,totalBytes:r})}const Rl=/[*?[\]{}]/;function zl(e){let t=e.replayBackend===`maestro`?new Set([`.yaml`,`.yml`,`.ad`]):new Set([`.ad`]),n=[],r=[];for(let i of e.inputs){let a=Bl(i,e.cwd,t);if(a.source===`file`){n.push(...a.paths);continue}r.push(a.source===`directory`?Gl(a.paths):Ul(a.paths))}return Gl([...n,...r.flat()])}function Bl(e,t,r){let i=dn(e,{cwd:t});if(d.existsSync(i)){let t=d.statSync(i);return t.isDirectory()?{paths:Hl(i,r),source:`directory`}:t.isFile()?(Vl(e,i,r),{paths:[i],source:`file`}):{paths:[],source:`file`}}if(!Kl(e))throw new n(`INVALID_ARGS`,`test input not found: ${e}`);return{source:`glob`,paths:d.globSync(un(e),{cwd:t}).map(e=>f.isAbsolute(e)?e:f.resolve(t,e)).filter(e=>r.has(f.extname(e).toLowerCase())&&ql(e))}}function Vl(e,t,r){if(!r.has(f.extname(t).toLowerCase()))throw lt(t)&&!r.has(`.yaml`)?new n(`INVALID_ARGS`,ct(`test`,e)):new n(`INVALID_ARGS`,`test does not support this file type: ${e}`)}function Hl(e,t){let n=[],r=d.opendirSync(e);try{let i;for(;(i=r.readSync())!==null;){let r=f.join(e,i.name);i.isDirectory()?n.push(...Hl(r,t)):i.isFile()&&t.has(f.extname(i.name).toLowerCase())&&n.push(r)}}finally{r.closeSync()}return n}function Ul(e){return e.map(e=>f.normalize(e)).sort((e,t)=>{let n=Wl(e)-Wl(t);return n===0?e.localeCompare(t):n})}function Wl(e){return+(f.extname(e).toLowerCase()===`.ad`)}function Gl(e){return[...new Set(e.map(e=>f.normalize(e)))]}function Kl(e){return Rl.test(e)}function ql(e){try{return d.statSync(e).isFile()}catch{return!1}}const Jl=`replay`,Yl=`test`,Xl=U(Jl,`Run a recorded automation script, including compatible Maestro YAML flows. A script without a terminal close leaves its session active for subsequent automation.`,{path:j(M()),update:F(),backend:M(),maestro:F(),env:Lr(),metroHost:M(`Metro/debug host hint inherited by replay-opened sessions.`),metroPort:P(`Metro/debug port hint inherited by replay-opened sessions.`),bundleUrl:M(`Bundle URL hint inherited by replay-opened sessions.`),resumeFrom:P(),resumePlanDigest:M(),keepSession:F(`Leave the session active by suppressing exactly an authored terminal close in native .ad.`),timeoutMs:P(`Operation wall-clock budget in milliseconds (default 60000). The client allows another 30000 milliseconds for the daemon result.`),saveScript:R({oneOf:[k(),D()]}),force:F(),testIme:F(`Activate the headless Android test IME for the sessions this replay opens (default on for emulators; opt-in on real devices).`)}),Zl=U(Yl,`Run one or more replay scripts as a serial test suite`,{paths:j(Lr()),update:F(),backend:M(),maestro:F(),env:Lr(),metroHost:M(`Metro/debug host hint inherited by each test session.`),metroPort:P(`Metro/debug port hint inherited by each test session.`),bundleUrl:M(`Bundle URL hint inherited by each test session.`),failFast:F(),timeoutMs:P(),retries:P(),recordVideo:F(),artifactsDir:M(),shardAll:P(),shardSplit:P(),testIme:F(`Activate the headless Android test IME for the sessions each suite attempt opens (default on for emulators; opt-in on real devices).`)}),Ql={replay:w({replayed:O(),healed:O(),session:D(),sessionActive:k(`True iff the session is still active — the script had no terminal close.`),artifactPaths:Ar(),snapshotDiagnostics:A(),message:D()},[`replayed`,`healed`,`session`,`sessionActive`,`artifactPaths`,`message`]),test:w({total:O(),executed:O(),passed:O(),failed:O(),skipped:O(),notRun:O(),durationMs:O(),failures:{type:`array`,items:A()},tests:{type:`array`,items:A()},snapshotDiagnostics:A()},[`total`,`executed`,`passed`,`failed`,`skipped`,`notRun`,`durationMs`,`failures`,`tests`])},$l={usageOverride:`replay <path> | replay export <file.ad> [--out <path>]`,usageFlags:[],positionalArgs:[`path`],allowsExtraPositionals:!0,allowedFlags:[`replayMaestro`,...zi,...Fi,`replayFrom`,`replayPlanDigest`,`replayKeepSession`,`timeoutMs`,`out`,`saveScript`,`force`,`testIme`],flagDescriptionOverrides:{saveScript:`Arm a repair transaction from this replay (ADR 0012): recording starts at step 1, and the healed script commits when the repair-armed session tears down (close, close --save-script, or idle-reap). Independent of the open/close authoring arm-on-open. Optional custom output path.`}},eu={usageOverride:`test <path-or-glob>...`,usageFlags:[],listUsageOverride:`test <path-or-glob>...`,positionalArgs:[`pathOrGlob`],allowsExtraPositionals:!0,allowedFlags:[`replayMaestro`,...zi,...Fi,`failFast`,`timeoutMs`,`retries`,`recordVideo`,`artifactsDir`,`reporter`,`reportJunit`,`shardAll`,`shardSplit`,`testIme`]},tu=G({name:`replay`,commands:[W({name:Jl,text:{summary:`Replay a recorded session or Maestro flow`,cliDetail:`Replay has a 60-second work budget inside a 90-second client timeout; --timeout <ms> sets a work budget of X and client timeout of X + 30000 ms. The running step receives ordinary request cancellation at the budget. When it settles, failure returns details.reason daemon_request_timeout and details.timeoutMs, preserving the failing script path and line. The daemon and other sessions stay available if it responds; an authored close may already have ended its session. A completed replay returns success even if it settles just after the deadline. Cancellation does not prove native device work stopped. A step that ignores cancellation beyond the 30-second margin may cause a transport timeout; an unresponsive daemon retains the client liveness-based reset. Direct test keeps its own timeout behavior. For Maestro YAML compatibility flows, use replay <flow.yaml> --maestro and keep the target binding such as --platform ios on the replay command. A script with no terminal close leaves its session (and daemon) running until you close it or it idle-reaps — no different from a session opened interactively. For native .ad scripts, --keep-session suppresses exactly an authored terminal close so you can continue interactively. replay export <file.ad> converts compatible actions to Maestro YAML locally, including app switches with explicit launchApp.appId targets, deep links (including tel: and mailto:) as openLink, and home as pressKey: Home.`},metadata:Xl,run:(e,t)=>e.replay.run(Bo(t)),cliSchema:$l,cliReader:(e,t)=>({...y(t),path:S(e[0],`replay requires path`),update:t.replayUpdate,backend:t.replayMaestro?`maestro`:void 0,env:t.replayEnv,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,resumeFrom:t.replayFrom,resumePlanDigest:t.replayPlanDigest,keepSession:t.replayKeepSession,timeoutMs:t.timeoutMs,saveScript:t.saveScript,force:t.force,testIme:t.testIme}),daemonWriter:async(e,t)=>{let n=C(e.path,`replay requires path`),r=iu(e),i=ou(t.env);return v(Jl,[n],{...e,replayUpdate:e.update,replayBackend:r,replayEnv:e.env,replayShellEnv:i,replayScriptSource:await Nl({inputPath:n,cwd:ru(e,t.cwd),replayBackend:r,env:nu(e,i,st(n,r))}),replayFrom:e.resumeFrom,replayPlanDigest:e.resumePlanDigest,replayKeepSession:e.keepSession,saveScript:e.saveScript})}}),W({name:Yl,text:{summary:`Run replay test suites`,cliDetail:`Relative globs are expanded on the caller from its working directory, whose name is treated literally. Quote glob inputs to defer expansion to test. Copied diagnostic artifacts receive numbered filenames when needed to preserve other artifacts, replay sources, timing traces, and attempt manifests. JUnit reports (--reporter junit:<path>) replace characters forbidden by XML 1.0 with U+FFFD and preserve legal Unicode and whitespace. JSON and other reporters retain the original suite values. Custom reporter getExitCode hooks must return an integer from 0 to 255 or undefined; the highest valid code wins and cannot lower a failing suite's exit code. A nested test stops after a bounded resource refusal even with --retries; other failures keep their configured retries.`},metadata:Zl,run:(e,t)=>e.replay.test(Bo(t)),cliSchema:eu,cliReader:(e,t)=>({...y(t),paths:e,update:t.replayUpdate,backend:t.replayMaestro?`maestro`:void 0,env:t.replayEnv,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,failFast:t.failFast,timeoutMs:t.timeoutMs,retries:t.retries,recordVideo:t.recordVideo,artifactsDir:t.artifactsDir,shardAll:t.shardAll,shardSplit:t.shardSplit,testIme:t.testIme}),daemonWriter:async(e,t)=>{let n=e.paths??[],r=iu(e),i=ru(e,t.cwd),a=ou(t.env);return v(Yl,n,{...au(e),replayUpdate:e.update,replayBackend:r,replayEnv:e.env,replayShellEnv:a,replayScriptSources:await Promise.all(zl({inputs:n,cwd:i,replayBackend:r}).map(async t=>await Nl({inputPath:t,cwd:i,replayBackend:r,env:nu(e,a,st(t,r))})))})}})]});function nu(e,t,n){return{...ot(t,n),...it(at(e.env),n)}}function ru(e,t){return typeof e.cwd==`string`&&e.cwd.length>0?e.cwd:t}function iu(e){return e.backend??(e.maestro===!0?`maestro`:void 0)}function au(e){let t={...e};return delete t.reporter,delete t.reportJunit,t}function ou(e){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&n.startsWith(`AD_VAR_`)&&(t[n]=r);return t}const su=`back`,cu=`orientation`,lu=`fold`,uu=`hardware-button`,du=`keyboard`,fu=`clipboard`,pu=`tv-remote`,mu=`telephony`,hu=[`read`,`write`],gu=[`status`,`dismiss`,`enter`,`return`],_u={description:`TV remote button. Android TV also accepts android-keycode:<n> with n from 1 to 2147483647.`,oneOf:[T(mn),{type:`string`,pattern:gn.source}]},vu={back:w({action:E(`back`),mode:T(fn),message:D()},[`action`,`mode`,`message`]),home:w({action:E(`home`),message:D()},[`action`,`message`]),orientation:w({action:E(`orientation`),orientation:T(Jt),message:D(),confirmed:k(),warning:D()},[`action`,`orientation`,`message`]),"app-switcher":w({action:E(`app-switcher`),message:D()},[`action`,`message`]),fold:w({action:E(`fold`),pose:T(cn),hingeAngleDegrees:O(`Hinge angle read back after the pose settled: from CoreMotion inside the simulator on iOS, from the emulator hinge sensor on Android.`),screen:w({display:D(`CoreDevice name of the panel the device now lights.`),coordinateSpace:E(Zt),widthPt:O(`Panel width in native panel points (pixels divided by point scale), NOT snapshot coordinates; take a fresh snapshot to place a tap.`),heightPt:O(`Panel height in native panel points (pixels divided by point scale), NOT snapshot coordinates; take a fresh snapshot to place a tap.`)},[`display`,`coordinateSpace`,`widthPt`,`heightPt`]),message:D()},[`action`,`pose`,`hingeAngleDegrees`,`message`]),"action-button":w({action:E(`action-button`),message:D()},[`action`,`message`]),"tv-remote":w({action:E(`tv-remote`),button:_u,durationMs:O(),message:D()},[`action`,`button`,`message`]),"hardware-button":w({action:E(`hardware-button`),button:T(an),message:D()},[`action`,`button`,`message`]),telephony:{type:`object`,oneOf:[w({action:T(on),number:D(),message:D()},[`action`,`number`,`message`]),w({action:E(`sms`),number:D(),textLength:O(`Length of the delivered message text.`),message:D()},[`action`,`number`,`textLength`,`message`])]},clipboard:{type:`object`,oneOf:[w({action:E(`read`),text:D()},[`action`,`text`]),w({action:E(`write`),textLength:O(),message:D()},[`action`,`textLength`,`message`])]},appstate:{type:`object`,oneOf:[w({platform:T([`ios`,`macos`]),appName:D(),appBundleId:D(),source:T([`session`,`runner`],`runner when a live runner read the session app state; session when the record alone answered.`),state:T(r,`The session app XCUIApplication state as a live runner reads it; absent with source session.`),surface:T(pt),device_udid:D(`iOS only — the session device UDID.`),ios_simulator_device_set:{type:[`string`,`null`],description:`iOS only — the simulator set path, or null when unknown.`}},[`platform`,`appName`,`source`,`surface`]),w({platform:T([`android`,`harmonyos`]),package:D(),activity:D()},[`platform`,`package`,`activity`])]},keyboard:w({platform:T([`android`,`ios`]),action:T([`status`,`dismiss`,`enter`]),visible:k(),wasVisible:k(),dismissed:k(),attempts:O(),inputType:D(),type:T([`text`,`number`,`email`,`phone`,`password`,`datetime`,`unknown`]),inputMethodPackage:D(),focusedPackage:D(),focusedResourceId:D(),inputOwner:T([`app`,`ime`,`unknown`]),message:D()},[`platform`,`action`])},yu={hingeEvent:`simulator HID hinge event`,permissions:`Device Hub and host Accessibility permission are not required.`},bu=`Fold or unfold a foldable iPhone simulator (iPhone Duo) or a foldable Android emulator into the closed, half-open, or open pose. iOS sends a ${yu.hingeEvent}, then reads the hinge angle back inside the simulator to confirm it, and can follow timestamped angle keyframes; Android sets the emulator console posture, then confirms the device state the guest commits and reports the angle read from the hinge sensor, which can differ from the AVD profile's per-posture angles, and dismisses the lock screen a fold to the cover display can raise. On iOS a pose change moves the app to a different panel with a different point size; on Android a fold to or from closed moves the app between the cover and inner displays, and any pose change can reshape the app window, whose size the next snapshot reports. Either way every ref and coordinate from before it is stale: re-snapshot after this command. Taps, long presses, and scrolling target the app window on its current panel in closed, half-open, and open poses. Simulator and emulator only; iOS requires the iOS simulator SDK; ${yu.permissions} An iOS simulator in a scoped simulator set folds the same way as one in the default set.`,xu=U(su,`Navigate back in the app or through system navigation. Use in-app for the app navigation stack and system when the platform back behavior is required. On iOS both modes swipe from the left edge and succeed only when the app screen changes. Reason back_swipe_no_change: the swipe was sent and the screen did not change; press the visible back or close control. Reason back_swipe_unverified: the swipe may or may not have navigated, because the screen kept changing before it or could not be sampled after it; check with snapshot. Reason back_swipe_not_dispatched, or a screen that cannot be sampled before the swipe, means nothing was sent. An app with a left-edge drawer may open the drawer instead. Press a visible back or close control by its ref directly.`,{mode:L(fn),...J(su)}),Su=U(cu,`Set device orientation on iOS and Android. auto hands rotation back to the sensor on ADB-backed Android (local and Limrun); other backends refuse it. A foldable iPhone simulator (iPhone Duo) refuses portrait-upside-down, and refuses every rotation in a scoped simulator set.`,{orientation:j(L(Jt))}),Cu={pose:L(cn,`Instant preset; mutually exclusive with keyframes.`),keyframes:R({type:`array`,minItems:2,maxItems:64,description:`Piecewise-linear hinge motion. Start at 0ms; strictly increasing timestamps, up to 60000ms. Repeated angles create holds. Mutually exclusive with pose.`,items:{type:`object`,required:[`atMs`,`angle`],additionalProperties:!1,properties:{atMs:{type:`integer`,minimum:0,maximum:Qt},angle:{type:`number`,minimum:0,maximum:180}}}})},wu=U(lu,bu,Cu,{readInput:e=>{let{pose:t,keyframes:n,...r}=B(e,Cu);return{...r,...Gt({pose:t,keyframes:n})}},inputExample:{pose:`half-open`}}),Tu={...wu,inputSchema:{...wu.inputSchema,oneOf:[{required:[`pose`],not:{required:[`keyframes`]}},{required:[`keyframes`],not:{required:[`pose`]}}]}},Eu=U(du,`Inspect Android keyboard visibility/type or press/dismiss the device keyboard. To hide the keyboard, use keyboard dismiss. It taps the keyboard dismiss/hide key when one is exposed, verifies the keyboard closed, and reports UNSUPPORTED_OPERATION when no dismiss key exists — background taps are never attempted.`,{action:L(gu)}),Du={action:j(L(hu)),text:M(`Text for write; required for write ("" clears the clipboard), refused for read.`,{allowEmpty:!0})},Ou=U(fu,`Read the current device clipboard text, or replace its contents with the given text. Android runs both through the clipboard service shell command, and a build that implements none (Android 16 does not) refuses with UNSUPPORTED_OPERATION rather than reporting an empty clipboard.`,Du,{parseableOutput:!0,readInput:e=>{let{action:t,text:r,...i}=B(e,Du);if(t===`read`){if(r!==void 0)throw new n(`INVALID_ARGS`,`clipboard read does not accept text.`);return{...i,action:t}}if(r===void 0)throw new n(`INVALID_ARGS`,`clipboard write requires text (use "" to clear).`);return{...i,action:t,text:r}}}),ku={...Ou,inputSchema:{...Ou.inputSchema,oneOf:[{properties:{action:E(`write`)},required:[`text`]},{properties:{action:E(`read`)},not:{required:[`text`]}}]}},Au=U(pu,`Press or long-press a TV remote button on Android TV, tvOS, or Vega OS. Android TV also supports volume, power, media, channel, guide, captions, input, color keys, and android-keycode:N. tvOS and Vega OS support up, down, left, right, select, menu, home, and back. Phones and WebDriver sessions are unsupported. The aliases ok, center, and enter map to select.`,{button:j(Rr(_u,(e,t)=>pn(typeof e[t]==`string`?e[t]:void 0))),durationMs:P(`Press duration in milliseconds. tvOS and Vega OS use the exact hold duration; Android TV maps any positive value to an ADB longpress (${_n(`android`)}).`,{min:0})}),ju=U(uu,`Press a phone hardware button once: volume-up, volume-down, power, mute, sleep, wake, media-play-pause, media-next, media-previous, media-rewind, or media-fast-forward. The press is dispatched without activating the session app and nothing is re-observed afterwards, so the OS decides what the key does — which audio stream a volume press moves, which media session a media key reaches, and whether the HUD shows, is device behavior this command does not claim. Power toggles the Android screen; sleep and wake are the explicit Android events that turn it off or on without toggling, and after a press that turns it off, later commands may hit a locked screen. Android (ADB-backed and Appium) presses all eleven on phones and tablets; a physical iPhone or iPad presses volume only through the local runner or Appium, never power, mute, sleep, wake, or media. iOS Simulators, Android TV and tvOS targets refuse: on TV targets use tv-remote.`,{button:j(L(an,`One press each. volume-up and volume-down move the system volume stream the OS selects; power toggles the screen on Android; sleep and wake are the explicit Android events that turn the screen off or on without toggling; mute, media-play-pause, media-next, media-previous, media-rewind, and media-fast-forward are Android keys the OS routes to its own streams and media sessions. All of these except volume are refused on every Apple leaf.`))}),Mu={action:j(L(nn,`call starts an incoming call, accept answers it, cancel ends it, sms delivers a text message.`)),number:j(M(`Caller or sender phone number: digits with an optional leading +.`)),text:M(`Message text for sms; required for sms and refused for the call actions. The emulator drops characters outside the Basic Multilingual Plane, such as emoji.`)},Nu=U(mu,`Simulate an incoming phone call or SMS on an Android emulator through its console over adb: call rings from the number, accept answers, cancel ends the call, and sms delivers a text message. The call screen or notification can cover the app, so re-snapshot afterwards.`,Mu,{readInput:e=>{let{action:t,number:n,text:r,...i}=B(e,Mu);return{...i,...Yt({action:t,number:n,text:r})}},inputExample:{action:`call`,number:`+15555550100`}}),Pu={...Nu,inputSchema:{...Nu.inputSchema,oneOf:[{properties:{action:E(`sms`)},required:[`text`]},{properties:{action:T(on)},not:{required:[`text`]}}]}},Fu={usageOverride:`back [--in-app|--system] [--settle]`,usageFlags:[],allowedFlags:[`backMode`,...Y(su)]},Iu={usageOverride:`orientation <${Jt.join(`|`)}>`,positionalArgs:[`orientation`]},Lu={usageOverride:`fold [${Xt}]`,positionalArgs:[`pose?`],allowedFlags:Mi},Ru={usageOverride:`keyboard [status|get|dismiss|enter|return]`,positionalArgs:[`action?`]},zu={usageOverride:`clipboard read | clipboard write <text>`,listUsageOverride:`clipboard read | clipboard write <text>`,positionalArgs:[`read|write`,`text?`],allowsExtraPositionals:!0},Bu={usageOverride:`tv-remote [press|longpress] ${hn}`,listUsageOverride:`tv-remote press|longpress <button> [--duration-ms <ms>]`,positionalArgs:[`press|longpress?`,`button`],allowedFlags:[`durationMs`]},Vu={usageOverride:`hardware-button ${$t}`,positionalArgs:[`button`]},Hu={usageOverride:en,listUsageOverride:`telephony call|accept|cancel|sms <number> [text]`,positionalArgs:[`call|accept|cancel|sms`,`number`,`text?`],allowsExtraPositionals:!0},Uu=(e,t)=>({...y(t),mode:t.backMode}),Wu=(e,t)=>({...y(t),orientation:Kt(e[0])}),Gu=(e,t)=>({...y(t),...Gt({pose:e[0],keyframes:t.keyframes===void 0?void 0:ln(t.keyframes)})}),Ku=(e,t)=>({...y(t),...gd(e)}),qu=(e,t)=>({...y(t),..._d(e)}),Ju=(e,t)=>({...y(t),...vd(e,t.durationMs)}),Yu=(e,t)=>({...y(t),...yd(e)}),Xu=(e,t)=>({...y(t),...rn(e)}),Zu=e=>v(su,[],{...e,backMode:md(e.mode)}),Qu=_(cu,e=>[C(e.orientation,`orientation requires orientation`)]),$u=e=>{let t=Gt(e);return v(lu,t.pose?[t.pose]:[],{...e,keyframes:t.keyframes?JSON.stringify(t.keyframes):void 0})},ed=_(du,e=>b(e.action)),td=_(fu,e=>hd(e)),nd=_(pu,e=>[C(e.button,`tv-remote requires button`)]),rd=_(uu,e=>[C(e.button,`hardware-button requires button`)]),id=_(mu,e=>sn(Yt(e))),ad=ui({name:`appstate`,description:`Show foreground app/activity (Android and HarmonyOS; iOS and macOS answer per session)`,text:{summary:`Show the foreground app and activity`},run:(e,t)=>e.command.appState(t)}),od=W({name:su,text:{summary:`Navigate back in the app or system`},metadata:xu,run:(e,t)=>e.command.back(t),cliSchema:Fu,cliReader:Uu,daemonWriter:Zu}),sd=ui({name:`home`,description:`Send the selected device to its home screen. This leaves the app session open but moves the foreground away from the app.`,text:{summary:`Go to the device home screen`},run:(e,t)=>e.command.home(t)}),cd=W({name:cu,text:{summary:`Set device orientation`},metadata:Su,run:(e,t)=>e.command.orientation(t),cliSchema:Iu,cliReader:Wu,daemonWriter:Qu}),ld=W({name:lu,text:{summary:`Fold or unfold a foldable iPhone simulator or Android emulator`,cliDetail:`iPhone Duo simulators and foldable Android emulators. iOS sends a ${yu.hingeEvent} and confirms the hinge angle inside the simulator; Android sets the emulator console posture and confirms the device state. Refs and coordinates do not survive a pose change.`},metadata:Tu,run:(e,t)=>e.command.fold(t),cliSchema:Lu,cliReader:Gu,daemonWriter:$u}),ud=ui({name:`app-switcher`,description:`Open the device app switcher to inspect or change foreground apps. This changes the visible system UI and may move focus away from the current app.`,text:{summary:`Open the device app switcher`},run:(e,t)=>e.command.appSwitcher(t)}),dd=W({name:du,text:{summary:`Inspect, press, or dismiss the device keyboard`},metadata:Eu,run:(e,t)=>e.command.keyboard(t),cliSchema:Ru,cliReader:Ku,daemonWriter:ed}),fd=W({name:fu,text:{summary:`Read or write device clipboard text`},metadata:ku,run:(e,t)=>e.command.clipboard(t),cliSchema:zu,cliReader:qu,daemonWriter:td}),pd=G({name:`system`,commands:[ad,od,sd,cd,ld,ud,ui({name:`action-button`,description:`Press the iPhone or iPad Action Button once. The press is dispatched without activating the session app and nothing is re-observed afterwards, so the app keeps the state the press found. What the system does with the press is not observed by this command: Simulators run no Shortcuts or App Intents, so delivery to an assigned Shortcut is verifiable only on a physical iPhone.`,text:{summary:`Press the iPhone or iPad Action Button`,cliDetail:`iPhone and iPad only. The runner asks the device for the button and reports unsupported when that model has none.`},run:(e,t)=>e.command.actionButton(t)}),dd,fd,W({name:pu,text:{summary:`Press a TV remote navigation, media, or hardware button`,cliDetail:`longpress selects the 500ms preset; --duration-ms overrides it. Android TV uses the system long-press duration.`},metadata:Au,run:(e,t)=>e.command.tvRemote(t),cliSchema:Bu,cliReader:Ju,daemonWriter:nd}),W({name:uu,text:{summary:`Press a phone hardware button once`,cliDetail:`Single press; no hold. Android presses all eleven named keys on phones and tablets: volume-up, volume-down, power, mute, sleep, wake, and the five media keys. A physical iPhone or iPad presses volume only; the other keys are never supported on Apple targets. iOS Simulators, Android TV, and tvOS refuse — use tv-remote on TV targets.`},metadata:ju,run:(e,t)=>e.command.hardwareButton(t),cliSchema:Vu,cliReader:Yu,daemonWriter:rd}),W({name:mu,text:{summary:`Simulate an incoming call or SMS on an Android emulator over adb`,cliDetail:`Android emulators through the local adb executor; WebDriver (Appium) and Limrun sessions refuse it. Quote the SMS text, or pass it as the remaining words. Re-snapshot after the event: the call screen or notification can cover the app.`},metadata:Pu,run:(e,t)=>e.command.telephony(t),cliSchema:Hu,cliReader:Xu,daemonWriter:id})]});function md(e){return e===`in-app`||e===`system`?e:void 0}function hd(e){return e.action===`read`?[`read`]:[`write`,e.text]}function gd(e){if(e.length>1)throw new n(`INVALID_ARGS`,`keyboard accepts at most one action argument.`);return m({action:bd(e[0])})}function _d(e){let t=e[0]?.toLowerCase();if(t!==`read`&&t!==`write`)throw new n(`INVALID_ARGS`,`clipboard requires a subcommand: read or write.`);if(t===`read`){if(e.length!==1)throw new n(`INVALID_ARGS`,`clipboard read does not accept additional arguments.`);return{action:t}}if(e.length<2)throw new n(`INVALID_ARGS`,`clipboard write requires text.`);return{action:t,text:e.slice(1).join(` `)}}function vd(e,t){let r=e[0]?.toLowerCase(),i=r===`press`||r===`longpress`?e.slice(1):e;if(i.length!==1)throw new n(`INVALID_ARGS`,`tv-remote requires exactly one button: ${mn.join(`, `)}, or android-keycode:<n>.`);let a=t??(r===`longpress`?500:void 0);return m({button:pn(i[0]),durationMs:a})}function yd(e){return{button:tn[qt(e)]}}function bd(e){let t=e?.toLowerCase();if(t===`get`)return`status`;if(t===void 0||t===`status`||t===`dismiss`||t===`enter`||t===`return`)return t;throw new n(`INVALID_ARGS`,`keyboard action must be status, get, dismiss, enter, or return.`)}const xd=[Ao,wc,Sa,pd,ml,tu,Gc,rl,wa,kl,Oc,Ti];function Sd(){return xd.flatMap(e=>[...e.metadata])}function Cd(){return xd.flatMap(e=>[...e.definitions])}function wd(){return Dd(`cliSchemas`)}function Td(){return Dd(`cliReaders`)}function Ed(){return Dd(`daemonWriters`)}function Dd(e){let t={};for(let n of xd){let r=n[e];if(r)for(let[n,i]of Object.entries(r)){if(Object.hasOwn(t,n))throw Error(`Duplicate ${String(e)} command family entry: ${n}`);t[n]=i}}return t}const Od=Sd(),kd=new Map(Od.map(e=>[e.name,e]));function Ad(){return[...Od]}function jd(){return He().map(e=>{let t=Nd(e);if(!t)throw Error(`Missing command metadata for MCP-exposed command: ${e}`);return t})}function Md(e){return kd.has(e)}function Nd(e){return kd.get(e)}const Pd=Cd(),Fd=new Map(Pd.map(e=>[e.name,e]));async function Id(e,t,n){return await Ld(t).invoke(e,n)}function Ld(e){return Fd.get(e)}var Rd=e({prepareDaemonCommandRequest:()=>Vd,runCommand:()=>Id});const zd={...Ed(),batch:pr(Bd)};async function Bd(e,t,r,i){let a=zd[e];if(!a)throw Error(`Missing daemon writer for batch command: ${e}`);let o=Nd(e);if(!o)throw Error(`Missing command metadata for batch command: ${e}`);try{return await Hd(a,o,o.readInput(t),i)}catch(t){let i=t instanceof Error?t.message:String(t);throw new n(`INVALID_ARGS`,`Batch step ${r} ${e} input is invalid: ${i}`,void 0,t)}}async function Vd(e,t,n){let r=zd[e];if(!r)throw Error(`Missing daemon writer for command: ${e}`);return Fn(t),await Hd(r,Nd(e),t,n)}async function Hd(e,t,n,r){let i=await e(n,r);return{...i,...t?{metadataFlags:dr(t,i.options)}:{}}}export{E as A,Pn as B,Wi as C,Ii as D,Hi as E,D as F,yn as H,Cr as I,vr as L,A as M,O as N,Pi as O,w as P,yr as R,fa as S,Vi as T,bn as U,An as V,ws as _,Md as a,vo as b,Td as c,Ql as d,Ec as f,Ds as g,ic as h,Nd as i,T as j,k,wd as l,oc as m,Rd as n,Ad as o,Sc as p,Id as r,jd as s,Vd as t,vu as u,cs as v,Bi as w,Oa as x,Do as y,ur as z};
16
+ Aggregate perf was removed in 0.21. Use one of the explicit forms above.`,usageFlags:[],listUsageOverride:`perf`,positionalArgs:[`area`,`subjectOrAction?`,`action?`],allowedFlags:[`kind`,`perfTemplate`,`out`]},cliReader:(e,t)=>({...y(t),...ul(e,{kind:gl(t.kind),template:t.perfTemplate,out:t.out})}),daemonWriter:_(ol,e=>cl(e))})]});function cl(e){let t=e.area;return t===`cpu`?ll([...b(t),...b(e.subject),...b(e.action),...b(e.kind)],e):t===`trace`?ll([...b(t),...b(e.action),...b(e.kind)],e):[...b(t),...b(e.action)]}function ll(e,t){let n=[...e];return(t.template||t.out||t.tracePath)&&n.push(t.template??``),(t.out||t.tracePath)&&n.push(t.out??``),t.tracePath&&n.push(t.tracePath),n}function ul(e,t={}){let n=fl(e[0]);if(n===`cpu`)return{area:n,subject:ml(e[1]),action:pl(e[2]),kind:hl(t.kind),template:t.template,out:t.out};if(n===`trace`)return{area:n,action:pl(e[1]),kind:hl(t.kind),template:t.template,out:t.out};let r=pl(e[1]),i=hl(t.kind);return dl(n,r,i,t.out),{area:n,action:r,kind:i,out:t.out}}function dl(e,t,n,r){if(e===`frames`){if(n!==void 0)throw new l(`INVALID_ARGS`,`--kind is only supported with perf memory snapshot`);if(r!==void 0)throw new l(`INVALID_ARGS`,`--out is only supported with perf memory snapshot, perf cpu profile, or perf trace`)}if(e===`memory`){if(t!==`snapshot`&&n!==void 0)throw new l(`INVALID_ARGS`,`--kind is only supported with perf memory snapshot`);if(t!==`snapshot`&&r!==void 0)throw new l(`INVALID_ARGS`,`--out is only supported with perf memory snapshot`)}}function fl(e){let t=e?.toLowerCase();if(yt(t))throw new l(`INVALID_ARGS`,xt);if(vt(t))return t;throw new l(`INVALID_ARGS`,ht)}function pl(e){if(e===void 0)return;let t=e.toLowerCase();if(_t(t))return t;throw new l(`INVALID_ARGS`,Dt)}function ml(e){let t=e?.toLowerCase();if(t!==void 0&&bt(t))return t;throw new l(`INVALID_ARGS`,St)}function hl(e){if(e===void 0)return;let t=e.toLowerCase();if(Tt(t))return t;throw new l(`INVALID_ARGS`,Et)}function gl(e){return typeof e==`string`?hl(e):void 0}const _l=`react-native`,vl=G({name:`react-native`,commands:[W({name:_l,effect:`write`,text:{summary:`Run React Native automation helpers`,searchHint:`rn expo`},metadata:U(_l,`Run supported React Native automation helpers. The dismiss-overlay action closes a visible React Native warning or error overlay.`,{action:j(L([`dismiss-overlay`]))}),run:(e,t)=>e.command.reactNative(t),cliSchema:{usageOverride:`react-native dismiss-overlay`,listUsageOverride:`react-native dismiss-overlay`,positionalArgs:[`dismiss-overlay`]},cliReader:(e,t)=>({...y(t),action:yl(e[0])}),daemonWriter:_(_l,e=>[C(e.action,`react-native requires action`)])})]});function yl(e){if(e===`dismiss-overlay`)return e;throw new l(`INVALID_ARGS`,`react-native supports only: dismiss-overlay`)}const bl=`record`,xl=`trace`,Sl=[`start`,`stop`],Cl=U(bl,`Start or stop a screen recording for the active app session or, where supported, the selected device, or build a contact-sheet PNG from a recording already exported. Long Android recordings can return multiple video artifacts; HarmonyOS supports whole-screen recording on physical devices.`,{action:j(L(Sl)),path:M(),fps:P(),maxSize:Nr(we.migration.record),quality:L(Ge),hideTouches:F(),recordingScope:L(Ke)},{parseableOutput:!0}),wl=U(xl,`Start or stop trace-log capture and return the resulting artifact when capture ends. Without a path, start writes a timestamped trace log named after the session in the sessions directory of the daemon state; a path on stop moves the finished trace there.`,{action:j(L(Sl)),path:M()}),Tl={start:[`recordingScope`,`fps`,`quality`,`hideTouches`],stop:[],"contact-sheet":[`out`]},El={usageOverride:`record start [path] [--scope <app|device|system>] [--fps <n>] [--quality <medium|high>] [--hide-touches] | record stop | record contact-sheet <video.mp4> [--out <sheet.png>]`,usageFlags:[],listUsageOverride:`record start [path] | record stop | record contact-sheet <video>`,positionalArgs:[`start|stop|contact-sheet`,`path?`],allowedFlags:[...new Set(Object.values(Tl).flat())],flagsByAction:Tl},Dl={usageOverride:`trace start [path] | trace stop [path]`,listUsageOverride:`trace start [path] | trace stop [path]`,positionalArgs:[`start|stop`,`path?`]},Ol=(e,t)=>({...y(t),action:Fl(e[0],bl),path:e[1],fps:t.fps,quality:t.quality,hideTouches:t.hideTouches,recordingScope:t.recordingScope}),kl=(e,t)=>({...y(t),action:Fl(e[0],xl),path:e[1]}),Al=_(bl,e=>Pl(e)),jl=e=>(ge(`record`,e),Al(e)),Ml=_(xl,e=>Pl(e)),Nl=G({name:`recording`,commands:[W({name:bl,effect:`write`,text:{summary:`Start or stop screen recording`,searchHint:`mp4`,cliDetail:`MP4 verification setup starts in the background before recording output preparation, without delaying capture. If setup exceeds the stop budget, details.reason is video_validator_compile_timeout (retriable); run record stop again while setup continues. Hosts without xcrun keep container-only MP4 completion. Other compilation failures, or an unavailable validator executable or AVFoundation during verification, return video_validator_unavailable. Repair the reported failure and retry record stop; a failed compile is retried on the next start or stop. The default --scope app requires an active app session from open <app>; use --scope device/system to explicitly request whole-screen recording where the selected backend supports it. Android record start publishes a durable device manifest, recordings longer than the 180s adb screenrecord limit are returned as multiple MP4 chunks while the daemon stays alive, and daemon-restart recovery uses only manifest-owned chunks. Android screenrecord encodes a frame only when the screen changes, so a clip can end at the last frame the recorder encoded instead of at record stop; durationMs is host wall clock from record start until the export finished, and capturedDurationMs reports the video timeline when it can be measured, with a warning naming how much of the window that video covers. An Android manifest left by an unreachable recording is retired on the next start once its recorders are proven gone; one still owned refuses with non-retriable DEVICE_IN_USE and reason native_recovery_evidence_open naming the session to run record stop for, and a recorder that is still writing an artifact refuses with DEVICE_IN_USE and reason native_recording_artifact_claimed, which clears itself once that recorder ends at the 180s limit. HarmonyOS supports whole-screen recording on physical devices only: use --scope device/system; --fps, --quality, and --hide-touches are unsupported. Use --quality to choose medium or high export quality on supported backends. The touch overlay renders at most 30 frames a second, or at --fps when lower; a lower --fps makes record stop faster on a long recording, and an overlay export that runs past its budget returns the raw video with an overlayWarning. An iOS simulator host recording lock returns non-retriable DEVICE_IN_USE with reason apple_simulator_recording_busy. Stop the recording in its owning session; if a dead recorder left the host locked, ask the host operator to restart the CoreSimulator stream service. On any backend, record start first settles the open recording records on its device that it would refuse on and whose session this daemon no longer holds: it finishes each one as its own record stop would, so the export lands at the output path of that recording and a later record stop in that session returns it, and runs the exact-owner recovery a daemon restart runs, which discards what that recording left, only for a record that cannot finish. A record it cannot confirm cleaned, or one whose session is still held, refuses the start with reason cleanup-unconfirmed and names that session: stop or close it, then retry. A record that another device left under the same session name is never settled from this device: the start refuses and names that device, so stop it in that session or record under another session name. A record stop that cannot produce its export keeps what a retry reads back — on Android the device-side artifact and the native manifest — leaves the recording manifest of that session open, and returns its own error, so retry record stop in that session; while this daemon holds that session, only closing it disposes them, and once it does not, the next record start on that device settles them as described above. Every stopped recording also reports what became of its recorder and of the file that recorder writes to: recorder is confirmed, or lost when the session holding it died, and nativePathDisposition is retirable while that file still owes a removal or retired once its removal was verified. Both are optional disclosures, not failures; ADR 0024 declares further states (unconfirmed, pending) for the steps that gain those probes, and no stop reports them yet. record contact-sheet <video.mp4> [--out <sheet.png>] is a local report over a file you already exported: it decodes frames out of that MP4 and writes one PNG holding the cells where the screen visibly changed, each labeled with its elapsed time on the clip timeline. It needs no session and no device, rebuilds any past recording, and works for every backend that exports MP4; a WebM recording is refused with reason contact_sheet_container_unsupported. The sample grid is bounded and spread across the whole clip, so it reports coverage rather than a review: a flash that opens and closes entirely between two sample times is not in the sheet, which is why the result also reports how many times it sampled and how many frames came back. Frame decoding is Apple AVFoundation tooling, so the command runs only on macOS hosts and refuses elsewhere with reason contact_sheet_unsupported_host.`},metadata:Cl,run:(e,t)=>e.recording.record(t),cliSchema:El,cliReader:Ol,daemonWriter:jl}),W({name:xl,effect:`write`,text:{summary:`Start or stop trace capture`,searchHint:`tracing profile`},metadata:wl,run:(e,t)=>e.recording.trace(t),cliSchema:Dl,cliReader:kl,daemonWriter:Ml})]});function Pl(e){return[e.action,...b(e.path)]}function Fl(e,t){if(e===`start`||e===`stop`)return e;throw new l(`INVALID_ARGS`,`${t} requires start|stop`)}const Il=2097152;async function Ll(e){let t=fn(e.inputPath,{cwd:e.cwd}),n=zl(t,e.inputPath),r=ct(t,e.replayBackend);return r===`ad`?Rl(t,{[t]:n},e.inputPath):Rl(t,(await(await import(`./replay-backend-registry.js`).then(e=>e.n)).getReplayBackend(r)).collectSourceFiles({entryPath:t,entrySource:n,env:e.env,readSource:Bl}),e.inputPath)}function Rl(e,t,n){return Vl(t,n),{entry:e,files:t}}function zl(e,t){try{return d.readFileSync(e,`utf8`)}catch(n){throw new l(`INVALID_ARGS`,`replay script not found on this machine: ${t}`,{path:e,hint:`Replay scripts are read by the client and sent to the daemon, so the path must resolve where you ran the command.`},n instanceof Error?n:void 0)}}function Bl(e){try{return d.readFileSync(e,`utf8`)}catch{return}}function Vl(e,t){let n=Object.values(e).reduce((e,t)=>e+Buffer.byteLength(t,`utf8`),0);if(!(n<=2097152))throw new l(`INVALID_ARGS`,`replay script sources for ${t} total ${n} bytes, over the ${Il}-byte limit; split the flow or drop unused runFlow includes.`,{limitBytes:Il,totalBytes:n})}const Hl=/[*?[\]{}]/;function Ul(e){let t=e.replayBackend===`maestro`?new Set([`.yaml`,`.yml`,`.ad`]):new Set([`.ad`]),n=[],r=[];for(let i of e.inputs){let a=Wl(i,e.cwd,t);if(a.source===`file`){n.push(...a.paths);continue}r.push(a.source===`directory`?Yl(a.paths):ql(a.paths))}return Yl([...n,...r.flat()])}function Wl(e,t,n){let r=fn(e,{cwd:t});if(d.existsSync(r)){let t=d.statSync(r);return t.isDirectory()?{paths:Kl(r,n),source:`directory`}:t.isFile()?(Gl(e,r,n),{paths:[r],source:`file`}):{paths:[],source:`file`}}if(!Xl(e))throw new l(`INVALID_ARGS`,`test input not found: ${e}`);return{source:`glob`,paths:d.globSync(dn(e),{cwd:t}).map(e=>f.isAbsolute(e)?e:f.resolve(t,e)).filter(e=>n.has(f.extname(e).toLowerCase())&&Zl(e))}}function Gl(e,t,n){if(!n.has(f.extname(t).toLowerCase()))throw ut(t)&&!n.has(`.yaml`)?new l(`INVALID_ARGS`,lt(`test`,e)):new l(`INVALID_ARGS`,`test does not support this file type: ${e}`)}function Kl(e,t){let n=[],r=d.opendirSync(e);try{let i;for(;(i=r.readSync())!==null;){let r=f.join(e,i.name);i.isDirectory()?n.push(...Kl(r,t)):i.isFile()&&t.has(f.extname(i.name).toLowerCase())&&n.push(r)}}finally{r.closeSync()}return n}function ql(e){return e.map(e=>f.normalize(e)).sort((e,t)=>{let n=Jl(e)-Jl(t);return n===0?e.localeCompare(t):n})}function Jl(e){return+(f.extname(e).toLowerCase()===`.ad`)}function Yl(e){return[...new Set(e.map(e=>f.normalize(e)))]}function Xl(e){return Hl.test(e)}function Zl(e){try{return d.statSync(e).isFile()}catch{return!1}}const Ql=`replay`,$l=`test`,eu=U(Ql,`Run a recorded automation script, including compatible Maestro YAML flows. A script without a terminal close leaves its session active for subsequent automation.`,{path:j(M()),update:F(),backend:M(),maestro:F(),env:zr(),metroHost:M(`Metro/debug host hint inherited by replay-opened sessions.`),metroPort:P(`Metro/debug port hint inherited by replay-opened sessions.`),bundleUrl:M(`Bundle URL hint inherited by replay-opened sessions.`),resumeFrom:P(),resumePlanDigest:M(),keepSession:F(`Leave the session active by suppressing exactly an authored terminal close in native .ad.`),timeoutMs:P(`Operation wall-clock budget in milliseconds (default 60000). The client allows another 30000 milliseconds for the daemon result.`),saveScript:R({oneOf:[k(),D()]}),force:F(),testIme:F(`Activate the headless Android test IME for the sessions this replay opens (default on for emulators; opt-in on real devices).`)}),tu=U($l,`Run one or more replay scripts as a serial test suite`,{paths:j(zr()),update:F(),backend:M(),maestro:F(),env:zr(),metroHost:M(`Metro/debug host hint inherited by each test session.`),metroPort:P(`Metro/debug port hint inherited by each test session.`),bundleUrl:M(`Bundle URL hint inherited by each test session.`),failFast:F(),timeoutMs:P(),retries:P(),recordVideo:F(),artifactsDir:M(),shardAll:P(),shardSplit:P(),testIme:F(`Activate the headless Android test IME for the sessions each suite attempt opens (default on for emulators; opt-in on real devices).`)}),nu={replay:w({replayed:O(),healed:O(),session:D(),sessionActive:k(`True iff the session is still active — the script had no terminal close.`),artifactPaths:Mr(),snapshotDiagnostics:A(),message:D()},[`replayed`,`healed`,`session`,`sessionActive`,`artifactPaths`,`message`]),test:w({total:O(),executed:O(),passed:O(),failed:O(),skipped:O(),notRun:O(),durationMs:O(),failures:{type:`array`,items:A()},tests:{type:`array`,items:A()},snapshotDiagnostics:A()},[`total`,`executed`,`passed`,`failed`,`skipped`,`notRun`,`durationMs`,`failures`,`tests`])},ru={usageOverride:`replay <path> | replay export <file.ad> [--out <path>]`,usageFlags:[],positionalArgs:[`path`],allowsExtraPositionals:!0,allowedFlags:[`replayMaestro`,...Ui,...zi,`replayFrom`,`replayPlanDigest`,`replayKeepSession`,`timeoutMs`,`out`,`saveScript`,`force`,`testIme`],flagDescriptionOverrides:{saveScript:`Arm a repair transaction from this replay (ADR 0012): recording starts at step 1, and the healed script commits when the repair-armed session tears down (close, close --save-script, or idle-reap). Independent of the open/close authoring arm-on-open. Optional custom output path.`}},iu={usageOverride:`test <path-or-glob>...`,usageFlags:[],listUsageOverride:`test <path-or-glob>...`,positionalArgs:[`pathOrGlob`],allowsExtraPositionals:!0,allowedFlags:[`replayMaestro`,...Ui,...zi,`failFast`,`timeoutMs`,`retries`,`recordVideo`,`artifactsDir`,`reporter`,`reportJunit`,`shardAll`,`shardSplit`,`testIme`]},au=G({name:`replay`,commands:[W({name:Ql,effect:`destructive`,text:{summary:`Replay a recorded session or Maestro flow`,searchHint:`rerun`,cliDetail:`Replay has a 60-second work budget inside a 90-second client timeout; --timeout <ms> sets a work budget of X and client timeout of X + 30000 ms. The running step receives ordinary request cancellation at the budget. When it settles, failure returns details.reason daemon_request_timeout and details.timeoutMs, preserving the failing script path and line. The daemon and other sessions stay available if it responds; an authored close may already have ended its session. A completed replay returns success even if it settles just after the deadline. Cancellation does not prove native device work stopped. A step that ignores cancellation beyond the 30-second margin may cause a transport timeout; an unresponsive daemon retains the client liveness-based reset. Direct test keeps its own timeout behavior. For Maestro YAML compatibility flows, use replay <flow.yaml> --maestro and keep the target binding such as --platform ios on the replay command. A script with no terminal close leaves its session (and daemon) running until you close it or it idle-reaps — no different from a session opened interactively. For native .ad scripts, --keep-session suppresses exactly an authored terminal close so you can continue interactively. replay export <file.ad> converts compatible actions to Maestro YAML locally, including app switches with explicit launchApp.appId targets, deep links (including tel: and mailto:) as openLink, and home as pressKey: Home.`},metadata:eu,run:(e,t)=>e.replay.run(Wo(t)),cliSchema:ru,cliReader:(e,t)=>({...y(t),path:S(e[0],`replay requires path`),update:t.replayUpdate,backend:t.replayMaestro?`maestro`:void 0,env:t.replayEnv,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,resumeFrom:t.replayFrom,resumePlanDigest:t.replayPlanDigest,keepSession:t.replayKeepSession,timeoutMs:t.timeoutMs,saveScript:t.saveScript,force:t.force,testIme:t.testIme}),daemonWriter:async(e,t)=>{let n=C(e.path,`replay requires path`),r=cu(e),i=uu(t.env);return v(Ql,[n],{...e,replayUpdate:e.update,replayBackend:r,replayEnv:e.env,replayShellEnv:i,replayScriptSource:await Ll({inputPath:n,cwd:su(e,t.cwd),replayBackend:r,env:ou(e,i,ct(n,r))}),replayFrom:e.resumeFrom,replayPlanDigest:e.resumePlanDigest,replayKeepSession:e.keepSession,saveScript:e.saveScript})}}),W({name:$l,effect:`destructive`,text:{summary:`Run replay test suites`,searchHint:`tests ad`,cliDetail:`Relative globs are expanded on the caller from its working directory, whose name is treated literally. Quote glob inputs to defer expansion to test. Copied diagnostic artifacts receive numbered filenames when needed to preserve other artifacts, replay sources, timing traces, and attempt manifests. JUnit reports (--reporter junit:<path>) replace characters forbidden by XML 1.0 with U+FFFD and preserve legal Unicode and whitespace. JSON and other reporters retain the original suite values. Custom reporter getExitCode hooks must return an integer from 0 to 255 or undefined; the highest valid code wins and cannot lower a failing suite's exit code. A nested test stops after a bounded resource refusal even with --retries; other failures keep their configured retries.`},metadata:tu,run:(e,t)=>e.replay.test(Wo(t)),cliSchema:iu,cliReader:(e,t)=>({...y(t),paths:e,update:t.replayUpdate,backend:t.replayMaestro?`maestro`:void 0,env:t.replayEnv,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,failFast:t.failFast,timeoutMs:t.timeoutMs,retries:t.retries,recordVideo:t.recordVideo,artifactsDir:t.artifactsDir,shardAll:t.shardAll,shardSplit:t.shardSplit,testIme:t.testIme}),daemonWriter:async(e,t)=>{let n=e.paths??[],r=cu(e),i=su(e,t.cwd),a=uu(t.env);return v($l,n,{...lu(e),replayUpdate:e.update,replayBackend:r,replayEnv:e.env,replayShellEnv:a,replayScriptSources:await Promise.all(Ul({inputs:n,cwd:i,replayBackend:r}).map(async t=>await Ll({inputPath:t,cwd:i,replayBackend:r,env:ou(e,a,ct(t,r))})))})}})]});function ou(e,t,n){return{...st(t,n),...at(ot(e.env),n)}}function su(e,t){return typeof e.cwd==`string`&&e.cwd.length>0?e.cwd:t}function cu(e){return e.backend??(e.maestro===!0?`maestro`:void 0)}function lu(e){let t={...e};return delete t.reporter,delete t.reportJunit,t}function uu(e){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&n.startsWith(`AD_VAR_`)&&(t[n]=r);return t}const du=`back`,fu=`orientation`,pu=`fold`,mu=`hardware-button`,hu=`keyboard`,gu=`clipboard`,_u=`tv-remote`,vu=`telephony`,yu=[`read`,`write`],bu=[`status`,`dismiss`,`enter`,`return`],xu={description:`TV remote button. Android TV also accepts android-keycode:<n> with n from 1 to 2147483647.`,oneOf:[T(hn),{type:`string`,pattern:_n.source}]},Su={back:w({action:E(`back`),mode:T(pn),message:D()},[`action`,`mode`,`message`]),home:w({action:E(`home`),message:D()},[`action`,`message`]),orientation:w({action:E(`orientation`),orientation:T(Yt),message:D(),confirmed:k(),warning:D()},[`action`,`orientation`,`message`]),"app-switcher":w({action:E(`app-switcher`),message:D()},[`action`,`message`]),fold:w({action:E(`fold`),pose:T(ln),hingeAngleDegrees:O(`Hinge angle read back after the pose settled: from CoreMotion inside the simulator on iOS, from the emulator hinge sensor on Android.`),screen:w({display:D(`CoreDevice name of the panel the device now lights.`),coordinateSpace:E(Qt),widthPt:O(`Panel width in native panel points (pixels divided by point scale), NOT snapshot coordinates; take a fresh snapshot to place a tap.`),heightPt:O(`Panel height in native panel points (pixels divided by point scale), NOT snapshot coordinates; take a fresh snapshot to place a tap.`)},[`display`,`coordinateSpace`,`widthPt`,`heightPt`]),message:D()},[`action`,`pose`,`hingeAngleDegrees`,`message`]),"action-button":w({action:E(`action-button`),message:D()},[`action`,`message`]),"tv-remote":w({action:E(`tv-remote`),button:xu,durationMs:O(),message:D()},[`action`,`button`,`message`]),"hardware-button":w({action:E(`hardware-button`),button:T(on),message:D()},[`action`,`button`,`message`]),telephony:{type:`object`,oneOf:[w({action:T(sn),number:D(),message:D()},[`action`,`number`,`message`]),w({action:E(`sms`),number:D(),textLength:O(`Length of the delivered message text.`),message:D()},[`action`,`number`,`textLength`,`message`])]},clipboard:{type:`object`,oneOf:[w({action:E(`read`),text:D()},[`action`,`text`]),w({action:E(`write`),textLength:O(),message:D()},[`action`,`textLength`,`message`])]},appstate:{type:`object`,oneOf:[w({platform:T([`ios`,`macos`]),appName:D(),appBundleId:D(),source:T([`session`,`runner`],`runner when a live runner read the session app state; session when the record alone answered.`),state:T(de,`The session app XCUIApplication state as a live runner reads it; absent with source session.`),surface:T(mt),device_udid:D(`iOS only — the session device UDID.`),ios_simulator_device_set:{type:[`string`,`null`],description:`iOS only — the simulator set path, or null when unknown.`}},[`platform`,`appName`,`source`,`surface`]),w({platform:T([`android`,`harmonyos`]),package:D(),activity:D()},[`platform`,`package`,`activity`])]},keyboard:w({platform:T([`android`,`ios`]),action:T([`status`,`dismiss`,`enter`]),visible:k(),wasVisible:k(),dismissed:k(),attempts:O(),inputType:D(),type:T([`text`,`number`,`email`,`phone`,`password`,`datetime`,`unknown`]),inputMethodPackage:D(),focusedPackage:D(),focusedResourceId:D(),inputOwner:T([`app`,`ime`,`unknown`]),message:D()},[`platform`,`action`])},Cu={hingeEvent:`simulator HID hinge event`,permissions:`Device Hub and host Accessibility permission are not required.`},wu=`Fold or unfold a foldable iPhone simulator (iPhone Duo) or a foldable Android emulator into the closed, half-open, or open pose. iOS sends a ${Cu.hingeEvent}, then reads the hinge angle back inside the simulator to confirm it, and can follow timestamped angle keyframes; Android sets the emulator console posture, then confirms the device state the guest commits and reports the angle read from the hinge sensor, which can differ from the AVD profile's per-posture angles, and dismisses the lock screen a fold to the cover display can raise. On iOS a pose change moves the app to a different panel with a different point size; on Android a fold to or from closed moves the app between the cover and inner displays, and any pose change can reshape the app window, whose size the next snapshot reports. Either way every ref and coordinate from before it is stale. Taps, long presses, and scrolling target the app window on its current panel in closed, half-open, and open poses. Simulator and emulator only; iOS requires the iOS simulator SDK; ${Cu.permissions} An iOS simulator in a scoped simulator set folds the same way as one in the default set.`,Tu=U(du,`Navigate back in the app or through system navigation. The in-app mode targets the app navigation stack; system targets platform back behavior. On iOS both modes press the navigation bar system back button (identifier BackButton) only when exactly one hittable one is found in a readable accessibility tree, and succeed only when the number of navigation bars, the number of back buttons, or a back button title then changes (for a back button with a title, a bar title or a moved back button alone never counts, so a pop that keeps the same back button title and bar count reports back_swipe_unverified; a back button with no title, such as the iPhone Duo's floating one, is confirmed by its navigation bar's title instead, which must also hold still before the tap, and a bar that retitles itself can still be misread as a pop; when no bar has a title or a title keeps changing, that button is not pressed); with no such button, two candidates, or an unreadable tree, they swipe from the left edge instead (on an iPad whose app window cannot be resolved, only while the app fills the screen) and succeed only when the app screen changes. Reason back_swipe_no_change: the swipe was sent and the screen did not change; a visible back or close control is an alternative. Reason back_swipe_unverified: the button was pressed but the navigation bar's back buttons did not change within 1 s or on one more read after it, or the swipe may or may not have navigated, because the screen kept changing before it or could not be sampled after it; the resulting screen is unconfirmed. Reason back_swipe_not_dispatched, or a screen that cannot be sampled before the swipe, means nothing was sent. An app with a left-edge drawer may open the drawer instead. A visible back or close control can be targeted directly by its ref.`,{mode:L(pn),...J(du)}),Eu=U(fu,`Set device orientation on iOS and Android. auto hands rotation back to the sensor on ADB-backed Android (local and Limrun); other backends refuse it. In both default and scoped simulator sets, an iPhone Duo classified with more than one integrated panel refuses portrait-upside-down and rotates through the fold helper; it succeeds only when the lit panel shows the requested orientation, otherwise it fails with orientation-unverified, or orientation-panel-table-unavailable when the final guest panel table cannot be read. A simulator classified with one panel, or whose first classification read is unresolved, uses the standard runner rotation.`,{orientation:j(L(Yt))}),Du={pose:L(ln,`Instant preset; mutually exclusive with keyframes.`),keyframes:R({type:`array`,minItems:2,maxItems:64,description:`Piecewise-linear hinge motion. Start at 0ms; strictly increasing timestamps, up to 60000ms. Repeated angles create holds. Mutually exclusive with pose.`,items:{type:`object`,required:[`atMs`,`angle`],additionalProperties:!1,properties:{atMs:{type:`integer`,minimum:0,maximum:$t},angle:{type:`number`,minimum:0,maximum:180}}}})},Ou=U(pu,wu,Du,{readInput:e=>{let{pose:t,keyframes:n,...r}=B(e,Du);return{...r,...Kt({pose:t,keyframes:n})}},inputExample:{pose:`half-open`}}),ku={...Ou,inputSchema:{...Ou.inputSchema,oneOf:[{required:[`pose`],not:{required:[`keyframes`]}},{required:[`keyframes`],not:{required:[`pose`]}}]}},Au=U(hu,`Inspect Android keyboard visibility/type or press/dismiss the device keyboard. The dismiss action hides the keyboard. It taps the keyboard dismiss/hide key when one is exposed, verifies the keyboard closed, and reports UNSUPPORTED_OPERATION when the keyboard stays up — background taps are never attempted. On iOS a keyboard with no dismiss key adds error.details.reason keyboard_dismiss_unavailable with dispatched: no; one whose key was tapped and stayed visible has no reason and dispatched: unknown. Android reports keyboard_dismiss_unavailable with dispatched: unknown, since its own dismiss keyevents were already sent.`,{action:L(bu)}),ju={action:j(L(yu)),text:M(`Text for write; required for write ("" clears the clipboard), refused for read.`,{allowEmpty:!0})},Mu=U(gu,`Read the current device clipboard text, or replace its contents with the given text. Android runs both through the clipboard service shell command, and a build that implements none (Android 16 does not) refuses with UNSUPPORTED_OPERATION rather than reporting an empty clipboard.`,ju,{parseableOutput:!0,readInput:e=>{let{action:t,text:n,...r}=B(e,ju);if(t===`read`){if(n!==void 0)throw new l(`INVALID_ARGS`,`clipboard read does not accept text.`);return{...r,action:t}}if(n===void 0)throw new l(`INVALID_ARGS`,`clipboard write requires text (use "" to clear).`);return{...r,action:t,text:n}}}),Nu={...Mu,inputSchema:{...Mu.inputSchema,oneOf:[{properties:{action:E(`write`)},required:[`text`]},{properties:{action:E(`read`)},not:{required:[`text`]}}]}},Pu=U(_u,`Press or long-press a TV remote button on Android TV, tvOS, or Vega OS. Android TV also supports volume, power, media, channel, guide, captions, input, color keys, and android-keycode:N. tvOS and Vega OS support up, down, left, right, select, menu, home, and back. Phones and WebDriver sessions are unsupported. The aliases ok, center, and enter map to select.`,{button:j(Br(xu,(e,t)=>mn(typeof e[t]==`string`?e[t]:void 0))),durationMs:P(`Press duration in milliseconds. tvOS and Vega OS use the exact hold duration; Android TV maps any positive value to an ADB longpress (${vn(`android`)}).`,{min:0})}),Fu=U(mu,`Press a phone hardware button once: volume-up, volume-down, power, mute, sleep, wake, media-play-pause, media-next, media-previous, media-rewind, or media-fast-forward. The press is dispatched without activating the session app and nothing is re-observed afterwards, so the OS decides what the key does — which audio stream a volume press moves, which media session a media key reaches, and whether the HUD shows, is device behavior this command does not claim. Power toggles the Android screen; sleep and wake are the explicit Android events that turn it off or on without toggling, and after a press that turns it off, later commands may hit a locked screen. Android (ADB-backed and Appium) presses all eleven on phones and tablets; a physical iPhone or iPad presses volume only through the local runner or Appium, never power, mute, sleep, wake, or media. iOS Simulators, Android TV and tvOS targets refuse this command.`,{button:j(L(on,`One press each. volume-up and volume-down move the system volume stream the OS selects; power toggles the screen on Android; sleep and wake are the explicit Android events that turn the screen off or on without toggling; mute, media-play-pause, media-next, media-previous, media-rewind, and media-fast-forward are Android keys the OS routes to its own streams and media sessions. All of these except volume are refused on every Apple leaf.`))}),Iu={action:j(L(rn,`call starts an incoming call, accept answers it, cancel ends it, sms delivers a text message.`)),number:j(M(`Caller or sender phone number: digits with an optional leading +.`)),text:M(`Message text for sms; required for sms and refused for the call actions. The emulator drops characters outside the Basic Multilingual Plane, such as emoji.`)},Lu=U(vu,`Simulate an incoming phone call or SMS on an Android emulator through its console over adb: call rings from the number, accept answers, cancel ends the call, and sms delivers a text message. The call screen or notification can cover the app and invalidate earlier UI observations.`,Iu,{readInput:e=>{let{action:t,number:n,text:r,...i}=B(e,Iu);return{...i,...Xt({action:t,number:n,text:r})}},inputExample:{action:`call`,number:`+15555550100`}}),Ru={...Lu,inputSchema:{...Lu.inputSchema,oneOf:[{properties:{action:E(`sms`)},required:[`text`]},{properties:{action:T(sn)},not:{required:[`text`]}}]}},zu={usageOverride:`back [--in-app|--system] [--settle]`,usageFlags:[],allowedFlags:[`backMode`,...Y(du)]},Bu={usageOverride:`orientation <${Yt.join(`|`)}>`,positionalArgs:[`orientation`]},Vu={usageOverride:`fold [${Zt}]`,positionalArgs:[`pose?`],allowedFlags:Ii},Hu={usageOverride:`keyboard [status|get|dismiss|enter|return]`,positionalArgs:[`action?`]},Uu={usageOverride:`clipboard read | clipboard write <text>`,listUsageOverride:`clipboard read | clipboard write <text>`,positionalArgs:[`read|write`,`text?`],allowsExtraPositionals:!0},Wu={usageOverride:`tv-remote [press|longpress] ${gn}`,listUsageOverride:`tv-remote press|longpress <button> [--duration-ms <ms>]`,positionalArgs:[`press|longpress?`,`button`],allowedFlags:[`durationMs`]},Gu={usageOverride:`hardware-button ${en}`,positionalArgs:[`button`]},Ku={usageOverride:tn,listUsageOverride:`telephony call|accept|cancel|sms <number> [text]`,positionalArgs:[`call|accept|cancel|sms`,`number`,`text?`],allowsExtraPositionals:!0},qu=(e,t)=>({...y(t),mode:t.backMode}),Ju=(e,t)=>({...y(t),orientation:qt(e[0])}),Yu=(e,t)=>({...y(t),...Kt({pose:e[0],keyframes:t.keyframes===void 0?void 0:un(t.keyframes)})}),Xu=(e,t)=>({...y(t),...bd(e)}),Zu=(e,t)=>({...y(t),...xd(e)}),Qu=(e,t)=>({...y(t),...Sd(e,t.durationMs)}),$u=(e,t)=>({...y(t),...Cd(e)}),ed=(e,t)=>({...y(t),...an(e)}),td=e=>v(du,[],{...e,backMode:vd(e.mode)}),nd=_(fu,e=>[C(e.orientation,`orientation requires orientation`)]),rd=e=>{let t=Kt(e);return v(pu,t.pose?[t.pose]:[],{...e,keyframes:t.keyframes?JSON.stringify(t.keyframes):void 0})},id=_(hu,e=>b(e.action)),ad=_(gu,e=>yd(e)),od=_(_u,e=>[C(e.button,`tv-remote requires button`)]),sd=_(mu,e=>[C(e.button,`hardware-button requires button`)]),cd=_(vu,e=>cn(Xt(e))),ld=fi({name:`appstate`,effect:`write`,description:`Show foreground app/activity (Android and HarmonyOS; iOS and macOS answer per session)`,text:{summary:`Show the foreground app and activity`,searchHint:`current state`},run:(e,t)=>e.command.appState(t)}),ud=W({name:du,effect:`write`,text:{summary:`Navigate back in the app or system`,searchHint:`previous return dismiss`},metadata:Tu,run:(e,t)=>e.command.back(t),cliSchema:zu,cliReader:qu,daemonWriter:td}),dd=fi({name:`home`,effect:`write`,description:`Send the selected device to its home screen. This leaves the app session open but moves the foreground away from the app.`,text:{summary:`Go to the device home screen`,searchHint:`springboard launcher`},run:(e,t)=>e.command.home(t)}),fd=W({name:fu,effect:`write`,text:{summary:`Set device orientation`,searchHint:`rotate landscape`},metadata:Eu,run:(e,t)=>e.command.orientation(t),cliSchema:Bu,cliReader:Ju,daemonWriter:nd}),pd=W({name:pu,effect:`write`,text:{summary:`Fold or unfold a foldable iPhone simulator or Android emulator`,searchHint:`flip book clamshell`,cliDetail:`iPhone Duo simulators and foldable Android emulators. iOS sends a ${Cu.hingeEvent} and confirms the hinge angle inside the simulator; Android sets the emulator console posture and confirms the device state. Refs and coordinates do not survive a pose change.`},metadata:ku,run:(e,t)=>e.command.fold(t),cliSchema:Vu,cliReader:Yu,daemonWriter:rd}),md=fi({name:`app-switcher`,effect:`write`,description:`Open the device app switcher to inspect or change foreground apps. This changes the visible system UI and may move focus away from the current app.`,text:{summary:`Open the device app switcher`,searchHint:`recents multitasking`},run:(e,t)=>e.command.appSwitcher(t)}),hd=W({name:hu,effect:`destructive`,text:{summary:`Inspect, press, or dismiss the device keyboard`,searchHint:`return`},metadata:Au,run:(e,t)=>e.command.keyboard(t),cliSchema:Hu,cliReader:Xu,daemonWriter:id}),gd=W({name:gu,effect:`destructive`,text:{summary:`Read or write device clipboard text`,searchHint:`copy paste pasteboard`},metadata:Nu,run:(e,t)=>e.command.clipboard(t),cliSchema:Uu,cliReader:Zu,daemonWriter:ad}),_d=G({name:`system`,commands:[ld,ud,dd,fd,pd,md,fi({name:`action-button`,effect:`destructive`,description:`Press the iPhone or iPad Action Button once. The press is dispatched without activating the session app and nothing is re-observed afterwards, so the app keeps the state the press found. What the system does with the press is not observed by this command: Simulators run no Shortcuts or App Intents, so delivery to an assigned Shortcut is verifiable only on a physical iPhone. A model with no Action Button refuses with UNSUPPORTED_OPERATION, error.details.reason hardware_control_unavailable and dispatched: no.`,text:{summary:`Press the iPhone or iPad Action Button`,searchHint:`side switch`,cliDetail:`iPhone and iPad only. The runner asks the device for the button and reports unsupported when that model has none.`},run:(e,t)=>e.command.actionButton(t)}),hd,gd,W({name:_u,effect:`destructive`,text:{summary:`Press a TV remote navigation, media, or hardware button`,searchHint:`dpad play`,cliDetail:`longpress selects the 500ms preset; --duration-ms overrides it. Android TV uses the system long-press duration.`},metadata:Pu,run:(e,t)=>e.command.tvRemote(t),cliSchema:Wu,cliReader:Qu,daemonWriter:od}),W({name:mu,effect:`write`,text:{summary:`Press a phone hardware button once`,searchHint:`lock`,cliDetail:`Single press; no hold. Android presses all eleven named keys on phones and tablets: volume-up, volume-down, power, mute, sleep, wake, and the five media keys. A physical iPhone or iPad presses volume only; the other keys are never supported on Apple targets. iOS Simulators, Android TV, and tvOS refuse — use tv-remote on TV targets.`},metadata:Fu,run:(e,t)=>e.command.hardwareButton(t),cliSchema:Gu,cliReader:$u,daemonWriter:sd}),W({name:vu,effect:`destructive`,text:{summary:`Simulate an incoming call or SMS on an Android emulator over adb`,searchHint:`voice gsm cellular`,cliDetail:`Android emulators through the local adb executor; WebDriver (Appium) and Limrun sessions refuse it. Quote the SMS text, or pass it as the remaining words. Re-snapshot after the event: the call screen or notification can cover the app.`},metadata:Ru,run:(e,t)=>e.command.telephony(t),cliSchema:Ku,cliReader:ed,daemonWriter:cd})]});function vd(e){return e===`in-app`||e===`system`?e:void 0}function yd(e){return e.action===`read`?[`read`]:[`write`,e.text]}function bd(e){if(e.length>1)throw new l(`INVALID_ARGS`,`keyboard accepts at most one action argument.`);return m({action:wd(e[0])})}function xd(e){let t=e[0]?.toLowerCase();if(t!==`read`&&t!==`write`)throw new l(`INVALID_ARGS`,`clipboard requires a subcommand: read or write.`);if(t===`read`){if(e.length!==1)throw new l(`INVALID_ARGS`,`clipboard read does not accept additional arguments.`);return{action:t}}if(e.length<2)throw new l(`INVALID_ARGS`,`clipboard write requires text.`);return{action:t,text:e.slice(1).join(` `)}}function Sd(e,t){let n=e[0]?.toLowerCase(),r=n===`press`||n===`longpress`?e.slice(1):e;if(r.length!==1)throw new l(`INVALID_ARGS`,`tv-remote requires exactly one button: ${hn.join(`, `)}, or android-keycode:<n>.`);let i=t??(n===`longpress`?500:void 0);return m({button:mn(r[0]),durationMs:i})}function Cd(e){return{button:nn[Jt(e)]}}function wd(e){let t=e?.toLowerCase();if(t===`get`)return`status`;if(t===void 0||t===`status`||t===`dismiss`||t===`enter`||t===`return`)return t;throw new l(`INVALID_ARGS`,`keyboard action must be status, get, dismiss, enter, or return.`)}const Td=[Po,Oc,Ea,_d,vl,au,Yc,sl,Oa,Nl,Mc,ki];function Ed(){return Td.flatMap(e=>[...e.metadata])}function Dd(){return Td.flatMap(e=>[...e.definitions])}function Od(){return jd(`cliSchemas`)}function kd(){return jd(`cliReaders`)}function Ad(){return jd(`daemonWriters`)}function jd(e){let t={};for(let n of Td){let r=n[e];if(r)for(let[n,i]of Object.entries(r)){if(Object.hasOwn(t,n))throw Error(`Duplicate ${String(e)} command family entry: ${n}`);t[n]=i}}return t}const Md=Ed(),Nd=new Map(Md.map(e=>[e.name,e]));function Pd(){return[...Md]}function Fd(){return ue().map(e=>{let t=Ld(e);if(!t)throw Error(`Missing command metadata for MCP-exposed command: ${e}`);return t})}function Id(e){return Nd.has(e)}function Ld(e){return Nd.get(e)}const Rd=Dd(),zd=new Map(Rd.map(e=>[e.name,e]));async function Bd(e,t,n){return await Vd(t).invoke(e,n)}function Vd(e){return zd.get(e)}var Hd=e({prepareDaemonCommandRequest:()=>Gd,runCommand:()=>Bd});const Ud={...Ad(),batch:hr(Wd)};async function Wd(e,t,n,r){let i=Ud[e];if(!i)throw Error(`Missing daemon writer for batch command: ${e}`);let a=Ld(e);if(!a)throw Error(`Missing command metadata for batch command: ${e}`);try{return await Kd(i,a,a.readInput(t),r)}catch(t){let r=t instanceof Error?t.message:String(t);throw new l(`INVALID_ARGS`,`Batch step ${n} ${e} input is invalid: ${r}`,void 0,t)}}async function Gd(e,t,n){let r=Ud[e];if(!r)throw Error(`Missing daemon writer for command: ${e}`);return Ln(t),await Kd(r,Ld(e),t,n)}async function Kd(e,t,n,r){let i=await e(n,r);return{...i,...t?{metadataFlags:pr(t,i.options)}:{}}}export{E as A,In as B,Ji as C,Bi as D,Ki as E,D as F,xn as H,Tr as I,br as L,A as M,O as N,Ri as O,w as P,xr as R,ga as S,Gi as T,bn as U,Mn as V,Sn as W,Os as _,Id as a,So as b,kd as c,nu as d,Ac as f,js as g,cc as h,Ld as i,T as j,k,Od as l,uc as m,Hd as n,Pd as o,Ec as p,Bd as r,Fd as s,Gd as t,Su as u,fs as v,Wi as w,Ma as x,jo as y,fr as z};