agent-device 0.20.10 → 0.21.1

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 (510) hide show
  1. package/README.md +2 -2
  2. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.10.apk → agent-device-android-ime-helper-0.21.1.apk} +0 -0
  3. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.1.apk.sha256 +1 -0
  4. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.10.manifest.json → agent-device-android-ime-helper-0.21.1.manifest.json} +4 -4
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.1.apk +0 -0
  6. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.1.apk.sha256 +1 -0
  7. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.10.manifest.json → agent-device-android-snapshot-helper-0.21.1.manifest.json} +6 -6
  8. package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/AudioProbe.swift +35 -33
  9. package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/main.swift +6 -1
  10. package/apple/snapshot-bridge/LICENSE.idb +23 -0
  11. package/apple/snapshot-bridge/README.md +106 -0
  12. package/apple/snapshot-bridge/SnapshotBridge.m +286 -0
  13. package/apple/snapshot-bridge/SnapshotBridgeCapture.h +25 -0
  14. package/apple/snapshot-bridge/SnapshotBridgeCapture.m +138 -0
  15. package/apple/snapshot-bridge/SnapshotBridgeRuntime.h +34 -0
  16. package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +411 -0
  17. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +58 -0
  18. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +19 -0
  19. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +12 -0
  20. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +20 -0
  21. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAlertVerification.swift +36 -0
  22. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSelectorMatchPolicy.swift +15 -15
  23. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerStringNormalization.swift +8 -0
  24. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +12 -1
  25. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +100 -6
  26. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSystemSurfaceHostPolicy.swift +72 -0
  27. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +63 -14
  28. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +677 -83
  29. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +35 -92
  30. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift +124 -0
  31. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+BlockingSystemModalResolution.swift +39 -4
  32. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +1058 -213
  33. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +296 -14
  34. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +1 -1
  35. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +10 -10
  36. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +309 -149
  37. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +101 -42
  38. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +24 -17
  39. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +124 -199
  40. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +71 -4
  41. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXElementTypes.swift +12 -0
  42. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +211 -78
  43. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +30 -10
  44. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +254 -24
  45. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +206 -22
  46. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +465 -494
  47. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +168 -0
  48. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +802 -247
  49. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotPresentationInvariant.swift +19 -0
  50. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTiming.swift +185 -0
  51. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedCommitDeadline.swift +206 -0
  52. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +83 -5
  53. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +156 -34
  54. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +5 -4
  55. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +35 -318
  56. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +206 -0
  57. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryReadiness.swift +158 -0
  58. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputCandidatePolicy.swift +28 -0
  59. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputProbe.swift +101 -0
  60. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +56 -23
  61. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +56 -27
  62. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +30 -24
  63. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +126 -80
  64. package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/RecordingExportSupport.swift +111 -0
  65. package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +47 -86
  66. package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-trim.swift +32 -79
  67. package/dist/apple/snapshot-presentation/Package.swift +21 -0
  68. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotGeometry.swift +56 -0
  69. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotModels.swift +259 -0
  70. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentation.swift +153 -0
  71. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationFailure.swift +27 -0
  72. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationInvariant.swift +91 -0
  73. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationProjection.swift +161 -0
  74. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotScopePolicy.swift +53 -0
  75. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFold.swift +242 -0
  76. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFoldProjection.swift +97 -0
  77. package/dist/src/adapter.js +1 -0
  78. package/dist/src/adb-executor.js +2 -0
  79. package/dist/src/adb-failure.js +1 -0
  80. package/dist/src/adb-host.js +1 -0
  81. package/dist/src/adb.js +1 -0
  82. package/dist/src/agent-browser-lifecycle.js +1 -0
  83. package/dist/src/agent-browser-process-record.js +1 -0
  84. package/dist/src/agent-browser-provider.js +1 -0
  85. package/dist/src/agent-browser-tool.js +1 -1
  86. package/dist/src/agent-device-client.js +2 -2
  87. package/dist/src/ai-sdk.d.ts +2 -2
  88. package/dist/src/ai-sdk.js +1 -1
  89. package/dist/src/alert-contract.js +1 -0
  90. package/dist/src/alert-runtime.js +1 -0
  91. package/dist/src/android-adb.d.ts +27 -19
  92. package/dist/src/android-adb.js +1 -1
  93. package/dist/src/android-input-ownership.js +1 -0
  94. package/dist/src/android-system-chrome.js +1 -0
  95. package/dist/src/android.js +1 -1
  96. package/dist/src/api.js +11 -0
  97. package/dist/src/app-catalog.js +1 -0
  98. package/dist/src/app-deployment-resolution.js +2 -0
  99. package/dist/src/app-helpers.js +1 -1
  100. package/dist/src/app-inventory-contract.js +1 -0
  101. package/dist/src/app-inventory.js +1 -0
  102. package/dist/src/app-launch.js +2 -0
  103. package/dist/src/app-lifecycle-facade.js +1 -0
  104. package/dist/src/app-lifecycle.js +3 -6
  105. package/dist/src/app-lifecycle2.js +2 -2
  106. package/dist/src/app-lifecycle3.js +1 -0
  107. package/dist/src/app-log-files.js +1 -1
  108. package/dist/src/app-log-reconnect.js +1 -1
  109. package/dist/src/app-log-runtime.js +1 -4
  110. package/dist/src/app-log-runtime2.js +4 -0
  111. package/dist/src/app-parsers.js +4 -0
  112. package/dist/src/app-resolution-cache.js +1 -0
  113. package/dist/src/app-resolution-facade.js +1 -0
  114. package/dist/src/app-resolution.js +2 -2
  115. package/dist/src/app-state.js +1 -2
  116. package/dist/src/apple-runner-platform.js +1 -0
  117. package/dist/src/application-lifecycle-interaction.js +1 -0
  118. package/dist/src/application-lifecycle-runtime.js +1 -0
  119. package/dist/src/apps-simctl.js +1 -0
  120. package/dist/src/archive.js +4 -0
  121. package/dist/src/artifact-download.js +1 -0
  122. package/dist/src/artifacts.d.ts +6 -2
  123. package/dist/src/artifacts.js +1 -1
  124. package/dist/src/async-lifecycle.js +1 -0
  125. package/dist/src/audio-probe-result.js +1 -0
  126. package/dist/src/audio-probe-runtime.js +1 -0
  127. package/dist/src/audio-probe-support.js +1 -0
  128. package/dist/src/auth-session.js +1 -1
  129. package/dist/src/auth.js +1 -1
  130. package/dist/src/backend-snapshot-options.js +1 -1
  131. package/dist/src/{url.js → base-url.js} +1 -1
  132. package/dist/src/boot-diagnostics.js +2 -2
  133. package/dist/src/byte-limit-stream.js +1 -1
  134. package/dist/src/capabilities.js +1 -0
  135. package/dist/src/capture.js +1 -0
  136. package/dist/src/catalog.js +1 -0
  137. package/dist/src/cli-command-aliases.js +1 -0
  138. package/dist/src/cli-config.js +1 -1
  139. package/dist/src/cli-help.js +74 -51
  140. package/dist/src/cli-output.js +1 -1
  141. package/dist/src/cli-runner.js +1 -1
  142. package/dist/src/cli.js +4 -6
  143. package/dist/src/click-button.js +1 -0
  144. package/dist/src/client-metro-companion.js +1 -0
  145. package/dist/src/client-metro.js +1 -1
  146. package/dist/src/client-types.d.ts +280 -242
  147. package/dist/src/clipboard.js +1 -0
  148. package/dist/src/code-signature-cache.js +1 -0
  149. package/dist/src/code-signature.js +1 -0
  150. package/dist/src/color.js +1 -0
  151. package/dist/src/command-metadata.js +1 -1
  152. package/dist/src/command-schema.js +3 -3
  153. package/dist/src/command-surface.js +1 -1
  154. package/dist/src/command-tools.js +2 -2
  155. package/dist/src/command.js +1 -0
  156. package/dist/src/compatibility-policy.js +1 -0
  157. package/dist/src/config.js +1 -1
  158. package/dist/src/config2.js +1 -0
  159. package/dist/src/connection-runtime.js +1 -1
  160. package/dist/src/connection.js +5 -5
  161. package/dist/src/contracts.d.ts +1 -1
  162. package/dist/src/contracts.js +1 -1
  163. package/dist/src/daemon-client-lifecycle.js +1 -0
  164. package/dist/src/daemon-process.js +1 -0
  165. package/dist/src/daemon-registration.js +1 -0
  166. package/dist/src/daemon-shutdown-report.js +1 -1
  167. package/dist/src/daemon.js +2 -2
  168. package/dist/src/debug-symbols-facade.js +5 -0
  169. package/dist/src/deploy-result-target.js +1 -0
  170. package/dist/src/device-claim-inspection.js +1 -1
  171. package/dist/src/device-claim-rule.js +1 -0
  172. package/dist/src/device-input-state.d.ts +190 -3
  173. package/dist/src/device-inventory-context.js +1 -0
  174. package/dist/src/device-isolation.js +1 -0
  175. package/dist/src/device-release.js +1 -0
  176. package/dist/src/device-rotation.js +1 -0
  177. package/dist/src/device-selection-resolver.js +1 -0
  178. package/dist/src/device-session.js +1 -0
  179. package/dist/src/device.js +1 -1
  180. package/dist/src/device2.js +3 -2
  181. package/dist/src/diagnostics.js +3 -0
  182. package/dist/src/diagnostics2.js +1 -0
  183. package/dist/src/dispatch-resolve.js +1 -0
  184. package/dist/src/doctor-facade.js +1 -0
  185. package/dist/src/doctor-output.js +1 -0
  186. package/dist/src/doctor.js +1 -0
  187. package/dist/src/doctor2.js +1 -0
  188. package/dist/src/doctor3.js +1 -0
  189. package/dist/src/durable-resource.js +1 -0
  190. package/dist/src/entities.js +1 -1
  191. package/dist/src/error.js +2 -0
  192. package/dist/src/exec.js +1 -0
  193. package/dist/src/file.js +1 -0
  194. package/dist/src/find.js +1 -1
  195. package/dist/src/finders.js +1 -1
  196. package/dist/src/generic-settle.js +1 -1
  197. package/dist/src/generic.js +1 -1
  198. package/dist/src/gesture-admission.js +1 -0
  199. package/dist/src/gesture-plan-types.js +1 -0
  200. package/dist/src/gesture-plan.js +1 -0
  201. package/dist/src/gesture-runtime.js +1 -0
  202. package/dist/src/harmonyos.js +1 -1
  203. package/dist/src/hdc.js +1 -1
  204. package/dist/src/helper.js +2 -2
  205. package/dist/src/host-file.js +1 -0
  206. package/dist/src/human-control-contract.js +1 -0
  207. package/dist/src/human-control.js +1 -0
  208. package/dist/src/index.d.ts +1 -1
  209. package/dist/src/index.js +1 -1
  210. package/dist/src/input-actions.js +1 -4
  211. package/dist/src/input-actions2.js +2 -1
  212. package/dist/src/install-artifact-facade.js +1 -0
  213. package/dist/src/install-source-network-transport.js +1 -0
  214. package/dist/src/install-source.d.ts +3 -10
  215. package/dist/src/install-source2.js +1 -1
  216. package/dist/src/interaction-positionals.js +1 -0
  217. package/dist/src/interaction-ref-policy.js +1 -0
  218. package/dist/src/interaction.js +1 -1
  219. package/dist/src/interaction2.js +1 -1
  220. package/dist/src/interactor-operation-catalog.js +1 -0
  221. package/dist/src/interactor-types.js +1 -0
  222. package/dist/src/interactor.js +6 -2
  223. package/dist/src/interactor2.js +1 -1
  224. package/dist/src/interactors.js +1 -1
  225. package/dist/src/internal/bin.d.ts +1 -1
  226. package/dist/src/internal/bin.js +1 -2
  227. package/dist/src/internal/companion-tunnel.d.ts +1 -1
  228. package/dist/src/internal/companion-tunnel.js +1 -1
  229. package/dist/src/internal/daemon.d.ts +1 -1
  230. package/dist/src/internal/daemon.js +2 -4
  231. package/dist/src/internal/png-worker.d.ts +4 -4
  232. package/dist/src/internal/png-worker.js +1 -1
  233. package/dist/src/internal/run-script-http-child.d.ts +4 -0
  234. package/dist/src/internal/run-script-http-child.js +1 -0
  235. package/dist/src/internal/update-check-entry.d.ts +1 -1
  236. package/dist/src/inventory.js +4 -4
  237. package/dist/src/inventory2.js +1 -1
  238. package/dist/src/inventory3.js +1 -1
  239. package/dist/src/inventory5.js +1 -1
  240. package/dist/src/inventory6.js +1 -1
  241. package/dist/src/ios-client.js +16 -0
  242. package/dist/src/ios-snapshot-acquisition.js +1 -0
  243. package/dist/src/ios-snapshot-adapter.js +1 -0
  244. package/dist/src/ios-snapshot-planning.js +1 -0
  245. package/dist/src/ios-snapshot-runtime.js +1 -0
  246. package/dist/src/ios-system-surface.js +1 -0
  247. package/dist/src/json.js +1 -0
  248. package/dist/src/keyboard-actions.js +1 -0
  249. package/dist/src/launch-console.js +1 -0
  250. package/dist/src/lease-context.js +1 -1
  251. package/dist/src/lease-scope.js +1 -0
  252. package/dist/src/lease.js +1 -1
  253. package/dist/src/limrun-runtime-dependencies.js +1 -1
  254. package/dist/src/limrun.d.ts +1610 -7
  255. package/dist/src/limrun.js +1 -1
  256. package/dist/src/linux.js +1 -1
  257. package/dist/src/local-interactor-operation-set.js +1 -0
  258. package/dist/src/location-coordinates.js +1 -1
  259. package/dist/src/logcat.js +1 -1
  260. package/dist/src/macos-facade.js +1 -0
  261. package/dist/src/managed-device-scope.js +1 -0
  262. package/dist/src/mechanics.js +19 -0
  263. package/dist/src/metro.d.ts +4 -2
  264. package/dist/src/metro.js +1 -1
  265. package/dist/src/metro2.js +1 -1
  266. package/dist/src/mobile-snapshot-semantics.js +1 -1
  267. package/dist/src/multitouch-support.js +1 -0
  268. package/dist/src/numeric.js +1 -0
  269. package/dist/src/observability.js +1 -1
  270. package/dist/src/observation.js +2 -0
  271. package/dist/src/open-target-resolution.js +1 -0
  272. package/dist/src/output-path.js +1 -1
  273. package/dist/src/owner-identity.js +3 -1
  274. package/dist/src/parameterized-recorded-fill.js +1 -0
  275. package/dist/src/parser.js +1 -1
  276. package/dist/src/perf-facade.js +2 -0
  277. package/dist/src/perf-process-identity.js +1 -0
  278. package/dist/src/perf-runtime-operation-builder.js +1 -0
  279. package/dist/src/perf-runtime-plan.js +1 -0
  280. package/dist/src/perf-runtime.js +1 -0
  281. package/dist/src/perf.js +1 -4
  282. package/dist/src/physical-device-control.js +1 -1
  283. package/dist/src/physical-device-facade.js +1 -0
  284. package/dist/src/platform-request-scope.js +1 -0
  285. package/dist/src/platform-runtime-android-adb-host.js +1 -0
  286. package/dist/src/platform-runtime-android-mechanics.js +1 -0
  287. package/dist/src/platform-runtime-app-log-android-transport.js +1 -1
  288. package/dist/src/platform-runtime-app-log-process.js +1 -1
  289. package/dist/src/platform-runtime-host.js +1 -1
  290. package/dist/src/platform-runtime-managed-owner.js +1 -0
  291. package/dist/src/platform-runtime-network-web-transport.js +1 -1
  292. package/dist/src/platform-runtime-open-target.js +1 -1
  293. package/dist/src/platform-runtime-operation-host.js +4 -4
  294. package/dist/src/platform-runtime-runtime-hints.js +2 -2
  295. package/dist/src/platform-runtime-screen-recording-android-host.js +1 -1
  296. package/dist/src/platform-runtime-screen-recording-apple-runner-host.js +1 -1
  297. package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -1
  298. package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
  299. package/dist/src/platform-runtime-screen-recording-apple-transport.js +1 -1
  300. package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
  301. package/dist/src/platform-runtime-screen-recording-harmony-host.js +1 -1
  302. package/dist/src/platform-runtime-screen-recording-process-host.js +1 -0
  303. package/dist/src/platform-runtime-screen-recording-web-host.js +1 -1
  304. package/dist/src/platform-runtime-unavailable.js +1 -0
  305. package/dist/src/platform-runtime.js +1 -1
  306. package/dist/src/platform-runtime2.js +1 -1
  307. package/dist/src/plist.js +1 -1
  308. package/dist/src/png-worker-contract.js +1 -1
  309. package/dist/src/prepare-kind.js +1 -0
  310. package/dist/src/process-exit.js +1 -1
  311. package/dist/src/process.js +1 -0
  312. package/dist/src/provider-device-runtime.js +1 -0
  313. package/dist/src/provider-session-ownership.js +2 -0
  314. package/dist/src/provider-webdriver.js +1 -1
  315. package/dist/src/provider.js +1 -1
  316. package/dist/src/providers.js +1 -0
  317. package/dist/src/proxy.js +2 -2
  318. package/dist/src/react-native-overlay.js +1 -0
  319. package/dist/src/react-native.js +1 -1
  320. package/dist/src/record-runtime.js +1 -1
  321. package/dist/src/record-trace.js +1 -1
  322. package/dist/src/rect-center.js +1 -0
  323. package/dist/src/register-builtins.js +1 -0
  324. package/dist/src/registry.js +40 -28
  325. package/dist/src/remote-config2.js +1 -1
  326. package/dist/src/replay-divergence.js +2 -0
  327. package/dist/src/replay.js +2 -2
  328. package/dist/src/reporting.js +8 -7
  329. package/dist/src/request-admission.js +1 -0
  330. package/dist/src/request-cancel.js +1 -0
  331. package/dist/src/request-cancellation.js +1 -0
  332. package/dist/src/request-progress-protocol.js +1 -0
  333. package/dist/src/request-providers.js +1 -0
  334. package/dist/src/request-runtime-binding.js +1 -0
  335. package/dist/src/request.js +1 -0
  336. package/dist/src/result-serialization.js +1 -0
  337. package/dist/src/retry.js +1 -0
  338. package/dist/src/rolldown-runtime.js +1 -1
  339. package/dist/src/runner-cache-metadata.js +2 -0
  340. package/dist/src/runner-client.js +1 -1
  341. package/dist/src/runner-disposal.js +1 -1
  342. package/dist/src/runner-operations-facade.js +1 -0
  343. package/dist/src/runner-owner-facade.js +1 -0
  344. package/dist/src/runner-owner-state.js +1 -0
  345. package/dist/src/runner-presentation.js +1 -0
  346. package/dist/src/runner.js +1 -0
  347. package/dist/src/{runtime-transport.js → runtime-transport-hints.js} +1 -1
  348. package/dist/src/runtime.js +3 -3
  349. package/dist/src/runtime2.js +4 -4
  350. package/dist/src/runtime3.js +1 -1
  351. package/dist/src/runtime4.js +5 -3
  352. package/dist/src/runtime5.js +1 -1
  353. package/dist/src/runtime6.js +1 -1
  354. package/dist/src/runtime7.js +1 -1
  355. package/dist/src/runtime8.js +1 -1
  356. package/dist/src/runtime9.js +1 -1
  357. package/dist/src/scoped-provider.js +1 -1
  358. package/dist/src/screen-recording-completion.js +1 -0
  359. package/dist/src/screen-recording-live-handle.js +1 -0
  360. package/dist/src/screen-recording-options.js +1 -0
  361. package/dist/src/screen-recording-resource-recovery.js +1 -0
  362. package/dist/src/screen-recording-runtime.js +1 -0
  363. package/dist/src/screenshot-density.js +1 -1
  364. package/dist/src/screenshot-result.js +1 -6
  365. package/dist/src/screenshot-runtime.js +1 -0
  366. package/dist/src/screenshot.js +1 -1
  367. package/dist/src/screenshot2.js +1 -0
  368. package/dist/src/screenshot3.js +5 -0
  369. package/dist/src/script.js +1 -0
  370. package/dist/src/scroll-command.js +1 -0
  371. package/dist/src/scroll-gesture.js +1 -0
  372. package/dist/src/scroll-indicator.js +1 -0
  373. package/dist/src/sdk-batch-runner.d.ts +23 -6
  374. package/dist/src/sdk-batch-runner.js +2 -3
  375. package/dist/src/sdk-batch.js +2 -0
  376. package/dist/src/sdk-contracts.d.ts +170 -41
  377. package/dist/src/sdk-contracts.js +2 -2
  378. package/dist/src/sdk-device.js +1 -1
  379. package/dist/src/sdk-finders.d.ts +1 -1
  380. package/dist/src/sdk-finders.js +1 -1
  381. package/dist/src/sdk-io.js +1 -1
  382. package/dist/src/sdk-remote-config.d.ts +1 -1
  383. package/dist/src/sdk-remote-config.js +1 -1
  384. package/dist/src/sdk-selectors.d.ts +524 -140
  385. package/dist/src/sdk-selectors.js +1 -1
  386. package/dist/src/selection.js +1 -0
  387. package/dist/src/selector-runtime.js +1 -1
  388. package/dist/src/selectors.js +1 -1
  389. package/dist/src/semantic-index.js +1 -0
  390. package/dist/src/server.js +4 -4
  391. package/dist/src/session-allocation.js +1 -0
  392. package/dist/src/session-artifact-paths.js +1 -0
  393. package/dist/src/session-observation.js +1 -0
  394. package/dist/src/session-paths.js +1 -0
  395. package/dist/src/session-repair-tombstone.js +1 -0
  396. package/dist/src/session-routing.js +1 -0
  397. package/dist/src/session-runtime-admission.js +1 -0
  398. package/dist/src/session-snapshot.js +1 -0
  399. package/dist/src/session-store.js +4 -0
  400. package/dist/src/session-target-evidence.js +1 -1
  401. package/dist/src/session2.js +5 -27
  402. package/dist/src/settings.js +1 -0
  403. package/dist/src/shared.js +2 -2
  404. package/dist/src/simctl-facade.js +1 -0
  405. package/dist/src/simctl.js +1 -1
  406. package/dist/src/simulator-facade.js +1 -0
  407. package/dist/src/simulator.js +1 -1
  408. package/dist/src/snapshot-capture-annotations.js +1 -0
  409. package/dist/src/snapshot-desktop-projection.js +1 -0
  410. package/dist/src/snapshot-diagnostics.js +1 -0
  411. package/dist/src/snapshot-process.js +1 -0
  412. package/dist/src/snapshot-quality-backend-capabilities.js +1 -0
  413. package/dist/src/snapshot-quality-verdict.js +1 -0
  414. package/dist/src/snapshot-runtime-binding.js +1 -0
  415. package/dist/src/snapshot-runtime.js +1 -1
  416. package/dist/src/snapshot-scope.js +1 -1
  417. package/dist/src/snapshot-state.js +1 -0
  418. package/dist/src/snapshot.js +1 -8
  419. package/dist/src/snapshot2.js +1 -1
  420. package/dist/src/snapshot3.js +1 -1
  421. package/dist/src/snapshot4.js +1 -0
  422. package/dist/src/src.js +1 -1
  423. package/dist/src/src2.js +1 -1
  424. package/dist/src/src3.js +1 -2
  425. package/dist/src/src4.js +1 -1
  426. package/dist/src/src5.js +1 -0
  427. package/dist/src/src6.js +1 -0
  428. package/dist/src/src7.js +2 -0
  429. package/dist/src/src8.js +115 -0
  430. package/dist/src/startup-recovery-fence.js +1 -0
  431. package/dist/src/status-markers.js +1 -0
  432. package/dist/src/string-enum.js +1 -1
  433. package/dist/src/success-text.js +1 -0
  434. package/dist/src/surface-snapshot.js +1 -0
  435. package/dist/src/surface-snapshot2.js +1 -0
  436. package/dist/src/takeover.js +5 -0
  437. package/dist/src/tool-provider-facade.js +1 -0
  438. package/dist/src/tool-provider.js +4 -3
  439. package/dist/src/tool-provider2.js +1 -1
  440. package/dist/src/tool-provider3.js +1 -1
  441. package/dist/src/toolchain-probe.js +2 -0
  442. package/dist/src/touch-reference-frame.js +1 -0
  443. package/dist/src/touch-runtime.js +1 -0
  444. package/dist/src/transport.js +3 -0
  445. package/dist/src/tree.js +1 -0
  446. package/dist/src/ttl-memo.js +1 -0
  447. package/dist/src/tv-remote.js +1 -0
  448. package/dist/src/type-text-runtime.js +1 -0
  449. package/dist/src/undici.js +99 -0
  450. package/dist/src/update-check.js +1 -1
  451. package/dist/src/verified-file.js +1 -1
  452. package/dist/src/version.js +1 -1
  453. package/dist/src/video.js +2 -2
  454. package/dist/src/web.js +2 -1
  455. package/dist/src/web2.js +1 -0
  456. package/dist/src/webdriver-ios-snapshot.js +1 -0
  457. package/dist/src/webdriver-source.js +1 -0
  458. package/dist/src/window-state.js +1 -0
  459. package/linux/atspi-dump.py +54 -9
  460. package/package.json +58 -35
  461. package/server.json +9 -3
  462. package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.10.apk.sha256 +0 -1
  463. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.10.apk +0 -0
  464. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.10.apk.sha256 +0 -1
  465. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CoordinateTextEntryTests.swift +0 -4
  466. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +0 -168
  467. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+LifecycleCacheTests.swift +0 -6
  468. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+RecordingTests.swift +0 -4
  469. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SelectorMatchPolicyTests.swift +0 -4
  470. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotPresentation.swift +0 -183
  471. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotPresentationTests.swift +0 -0
  472. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTraversalIdentityTests.swift +0 -4
  473. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryPolicyTests.swift +0 -4
  474. package/dist/src/appearance.js +0 -1
  475. package/dist/src/apps.js +0 -5
  476. package/dist/src/audio-probe.js +0 -1
  477. package/dist/src/cli-grammar.js +0 -1
  478. package/dist/src/command-catalog.js +0 -1
  479. package/dist/src/debug-symbols.js +0 -5
  480. package/dist/src/device-input-state.js +0 -2
  481. package/dist/src/device-ready.js +0 -1
  482. package/dist/src/dispatch.js +0 -1
  483. package/dist/src/handler-utils.js +0 -1
  484. package/dist/src/helper-package-install.js +0 -1
  485. package/dist/src/host-process.js +0 -3
  486. package/dist/src/ime-lifecycle.js +0 -2
  487. package/dist/src/ime-recovery-marker.js +0 -1
  488. package/dist/src/input-actions3.js +0 -1
  489. package/dist/src/install-artifact.js +0 -1
  490. package/dist/src/install-artifact2.js +0 -1
  491. package/dist/src/interaction-common.js +0 -1
  492. package/dist/src/interaction-runtime.js +0 -1
  493. package/dist/src/interaction-snapshot.js +0 -1
  494. package/dist/src/manifest.js +0 -1
  495. package/dist/src/method-scope.js +0 -1
  496. package/dist/src/png-resize.js +0 -1
  497. package/dist/src/process-lock.js +0 -1
  498. package/dist/src/runner-lease.js +0 -1
  499. package/dist/src/runner-sequence.js +0 -1
  500. package/dist/src/script-source-bundle.js +0 -16
  501. package/dist/src/sdk-android-adb.d.ts +0 -245
  502. package/dist/src/sdk-android-adb.js +0 -4
  503. package/dist/src/sdk.js +0 -1
  504. package/dist/src/setting-state.js +0 -1
  505. package/dist/src/shell-quote.js +0 -1
  506. package/dist/src/snapshot-session.js +0 -1
  507. package/dist/src/timing-safe-equal.js +0 -1
  508. package/dist/src/unsupported-interactor.js +0 -1
  509. package/dist/src/verdict.js +0 -1
  510. /package/dist/src/{recording-telemetry.js → telemetry.js} +0 -0
@@ -1,28 +1,3 @@
1
- //#region packages/kernel/src/device.d.ts
2
- declare const APPLE_OS_VALUES: readonly ['ios', 'ipados', 'tvos', 'watchos', 'visionos', 'macos'];
3
- type AppleOS = (typeof APPLE_OS_VALUES)[number];
4
- declare const PLATFORMS: readonly ['apple', 'android', 'harmonyos', 'vega', 'linux', 'web'];
5
- type Platform = (typeof PLATFORMS)[number];
6
- declare const PUBLIC_PLATFORMS: readonly ['ios', 'macos', 'android', 'harmonyos', 'vega', 'linux', 'web'];
7
- type PublicPlatform = (typeof PUBLIC_PLATFORMS)[number];
8
- declare const PLATFORM_SELECTORS: readonly ["apple", "android", "harmonyos", "vega", "linux", "web", "ios", "macos"];
9
- type PlatformSelector = (typeof PLATFORM_SELECTORS)[number];
10
- declare const DEVICE_KINDS: readonly ['simulator', 'emulator', 'device'];
11
- type DeviceKind = (typeof DEVICE_KINDS)[number];
12
- declare const DEVICE_TARGETS: readonly ['mobile', 'tv', 'desktop'];
13
- type DeviceTarget = (typeof DEVICE_TARGETS)[number];
14
- type DeviceInfo = {
15
- platform: Platform;
16
- id: string;
17
- name: string;
18
- kind: DeviceKind;
19
- target?: DeviceTarget;
20
- appleOs?: AppleOS;
21
- booted?: boolean;
22
- simulatorSetPath?: string;
23
- iosPhysicalDeviceBackend?: 'coredevice' | 'xctest';
24
- };
25
- //#endregion
26
1
  //#region packages/kernel/src/errors.d.ts
27
2
  /**
28
3
  * The known error codes as a value, so gates can enumerate them: every code
@@ -46,6 +21,10 @@ type DiagnosticsRecordRef = {
46
21
  session: string;
47
22
  requestId: string;
48
23
  };
24
+ type ErrorCause = {
25
+ message: string;
26
+ code?: string;
27
+ };
49
28
  /**
50
29
  * Details bag for AppError. Free-form context is allowed, but these keys carry
51
30
  * meaning at normalize/render time and must keep their types:
@@ -54,7 +33,7 @@ type DiagnosticsRecordRef = {
54
33
  * lifted onto the normalized error, stripped from details.
55
34
  * - `processExitError` + `stdout`/`stderr`/`exitCode` — marks a wrap of a real
56
35
  * process exit so normalizeError can surface the first meaningful stderr line;
57
- * build these via `execFailureDetails`/`requireExecSuccess` in src/utils/exec.ts
36
+ * build these via `execFailureDetails`/`requireExecSuccess` in @agent-device/host-kit/command
58
37
  * rather than by hand.
59
38
  * - `retriable` — typed retry signal hoisted to the wire error shape.
60
39
  * - `reason` — machine-dispatchable sub-classification within a code.
@@ -76,6 +55,7 @@ type AppErrorDetails = Record<string, unknown> & {
76
55
  type NormalizedError = {
77
56
  code: string;
78
57
  message: string;
58
+ cause?: ErrorCause;
79
59
  hint?: string;
80
60
  diagnosticId?: string;
81
61
  /**
@@ -111,6 +91,7 @@ type NormalizedError = {
111
91
  type DaemonError = {
112
92
  code: string;
113
93
  message: string;
94
+ cause?: ErrorCause;
114
95
  hint?: string;
115
96
  diagnosticId?: string;
116
97
  /** Path on the DAEMON host. Meaningful to a local caller only (#1801). */
@@ -144,9 +125,34 @@ declare function normalizeAgentDeviceError(err: unknown, context?: NormalizeErro
144
125
  declare function normalizeError(err: unknown, context?: NormalizeErrorContext): NormalizedError;
145
126
  declare function defaultHintForCode(code: string): string | undefined;
146
127
  //#endregion
128
+ //#region packages/kernel/src/device.d.ts
129
+ declare const APPLE_OS_VALUES: readonly ['ios', 'ipados', 'tvos', 'watchos', 'visionos', 'macos'];
130
+ type AppleOS = (typeof APPLE_OS_VALUES)[number];
131
+ declare const PLATFORMS: readonly ['apple', 'android', 'harmonyos', 'vega', 'linux', 'web'];
132
+ type Platform = (typeof PLATFORMS)[number];
133
+ declare const PUBLIC_PLATFORMS: readonly ['ios', 'macos', 'android', 'harmonyos', 'vega', 'linux', 'web'];
134
+ type PublicPlatform = (typeof PUBLIC_PLATFORMS)[number];
135
+ declare const PLATFORM_SELECTORS: readonly ["apple", "android", "harmonyos", "vega", "linux", "web", "ios", "macos"];
136
+ type PlatformSelector = (typeof PLATFORM_SELECTORS)[number];
137
+ declare const DEVICE_KINDS: readonly ['simulator', 'emulator', 'device'];
138
+ type DeviceKind = (typeof DEVICE_KINDS)[number];
139
+ declare const DEVICE_TARGETS: readonly ['mobile', 'tv', 'desktop'];
140
+ type DeviceTarget = (typeof DEVICE_TARGETS)[number];
141
+ type DeviceInfo = {
142
+ platform: Platform;
143
+ id: string;
144
+ name: string;
145
+ kind: DeviceKind;
146
+ target?: DeviceTarget;
147
+ appleOs?: AppleOS;
148
+ booted?: boolean;
149
+ simulatorSetPath?: string;
150
+ iosPhysicalDeviceBackend?: 'coredevice' | 'xctest';
151
+ };
152
+ //#endregion
147
153
  //#region packages/kernel/src/snapshot.d.ts
148
154
  /**
149
- * Structured quality verdict computed once by the iOS runner's snapshot capture plan.
155
+ * Structured quality verdict computed once by a platform snapshot capture/presentation plan.
150
156
  * The daemon renders it; it never re-derives degradation from node shapes.
151
157
  *
152
158
  * Defined here (the foundational snapshot type module) rather than in
@@ -156,16 +162,22 @@ declare function defaultHintForCode(code: string): string | undefined;
156
162
  /**
157
163
  * Which capture STRATEGY produced a snapshot, within one platform's plan —
158
164
  * distinct from `SnapshotBackend`, which names the platform channel
159
- * (`xctest`/`android`/…). The iOS plan walks these in order, so one session can
160
- * change strategy mid-sequence, and two strategies do not return comparable
161
- * views of one screen (#1569).
165
+ * (`xctest`/`android`/…). A platform plan may change strategy mid-sequence, and two strategies do
166
+ * not return comparable views of one screen (#1569). Android's helper presentation is included
167
+ * here so its quality verdict uses the same typed contract as the iOS strategy chain.
162
168
  */
163
- type SnapshotCaptureBackend = 'tree' | 'queries' | 'private-ax';
169
+ type SnapshotCaptureBackend = 'tree' | 'queries' | 'private-ax' | 'android-helper';
170
+ /** Internal backends that evidence probes may select explicitly. */
171
+ type SnapshotPreferredBackend = 'tree' | 'private-ax';
172
+ type SnapshotQualityTiming = {
173
+ acquisitionMs: number;
174
+ presentationMs: number;
175
+ };
164
176
  type SnapshotQualityVerdict = {
165
177
  state: 'healthy' | 'recovered' | 'sparse';
166
178
  backend: SnapshotCaptureBackend;
167
179
  reason?: string;
168
- reasonCode?: 'ax-rejected' | 'sparse-tree' | 'budget' | 'no-nodes' | 'capture-failed' | 'deferred' | 'requested-backend';
180
+ reasonCode?: 'ax-rejected' | 'sparse-tree' | 'budget' | 'no-nodes' | 'capture-failed' | 'presentation-failed' | 'deferred' | 'requested-backend';
169
181
  effectiveDepth?: number;
170
182
  collapsedLeafIndexes?: number[];
171
183
  /**
@@ -180,6 +192,8 @@ type SnapshotQualityVerdict = {
180
192
  truncated: number;
181
193
  blocked: boolean;
182
194
  };
195
+ /** Response-level phase timing for the backend named by `backend`. */
196
+ timing?: SnapshotQualityTiming;
183
197
  };
184
198
  type Rect = {
185
199
  x: number;
@@ -202,7 +216,7 @@ type SnapshotOptions = {
202
216
  * are not comparable views of a screen), so a corroboration probe must be
203
217
  * captured the way its baseline was.
204
218
  */
205
- preferredBackend?: 'private-ax';
219
+ preferredBackend?: SnapshotPreferredBackend;
206
220
  /**
207
221
  * Read accessibility custom actions for elements that merge their children
208
222
  * away. Opt-in because each such element costs its own accessibility round
@@ -210,6 +224,43 @@ type SnapshotOptions = {
210
224
  */
211
225
  customActions?: boolean;
212
226
  };
227
+ /** The CLI/daemon flag key for each snapshot capture option, by option name. */
228
+ declare const SNAPSHOT_OPTION_FLAGS: {
229
+ readonly interactiveOnly: 'snapshotInteractiveOnly';
230
+ readonly depth: 'snapshotDepth';
231
+ readonly scope: 'snapshotScope';
232
+ readonly raw: 'snapshotRaw';
233
+ readonly customActions: 'snapshotCustomActions';
234
+ readonly forceFull: 'snapshotForceFull';
235
+ readonly includeHiddenContentHints: 'snapshotIncludeHiddenContentHints';
236
+ readonly preferredBackend: 'snapshotPreferredBackend';
237
+ };
238
+ type SnapshotOptionKey = keyof typeof SNAPSHOT_OPTION_FLAGS;
239
+ type SnapshotOptionValues = {
240
+ interactiveOnly: boolean;
241
+ depth: number;
242
+ scope: string;
243
+ raw: boolean;
244
+ customActions: boolean;
245
+ forceFull: boolean;
246
+ includeHiddenContentHints: boolean;
247
+ preferredBackend: SnapshotPreferredBackend;
248
+ };
249
+ /** The option-vocabulary view of the declared pairs, narrowed to `TKeys`. */
250
+ type SnapshotOptionFields<TKeys extends SnapshotOptionKey = SnapshotOptionKey> = { [TKey in TKeys]?: SnapshotOptionValues[TKey]; };
251
+ /**
252
+ * Option keys a `snapshot`/`diff` command request carries end to end. `scope` is
253
+ * resolved against the session before capture, so seams that resolve it spread
254
+ * this projection and then override that one key.
255
+ */
256
+ declare const SNAPSHOT_COMMAND_OPTION_KEYS: readonly ['interactiveOnly', 'depth', 'scope', 'raw', 'customActions', 'forceFull'];
257
+ /**
258
+ * The snapshot capture options a `snapshot`/`diff` request is stated in, in
259
+ * every vocabulary that names them: the public SDK type, the internal request
260
+ * bag and the command runtime options each reference THIS type instead of
261
+ * re-listing the same six keys.
262
+ */
263
+ type SnapshotCommandOptionFields = SnapshotOptionFields<(typeof SNAPSHOT_COMMAND_OPTION_KEYS)[number]>;
213
264
  type RawSnapshotNode = {
214
265
  index: number;
215
266
  type?: string;
@@ -222,6 +273,13 @@ type RawSnapshotNode = {
222
273
  enabled?: boolean;
223
274
  selected?: boolean;
224
275
  focused?: boolean;
276
+ /** Native accessibility facts; absent means unavailable, not false. */
277
+ editable?: boolean;
278
+ password?: boolean;
279
+ hintShowing?: boolean;
280
+ /** Accessibility selection offsets, never a character count or proof of value equality. */
281
+ selectionStart?: number;
282
+ selectionEnd?: number;
225
283
  visibleToUser?: boolean;
226
284
  hittable?: boolean;
227
285
  depth?: number;
@@ -235,6 +293,15 @@ type RawSnapshotNode = {
235
293
  hiddenContentBelow?: boolean;
236
294
  interactionBlocked?: 'covered';
237
295
  presentationHints?: string[];
296
+ /**
297
+ * Backend-minted ref for this node, when the capture backend already assigns a
298
+ * stable, actionable ref (e.g. the web/agent-browser backend resolves actions
299
+ * against its own `@eN` refs). `attachRefs` preserves this instead of re-minting
300
+ * a dense positional ref, so the ref an agent sees in the snapshot is the same
301
+ * ref the backend can resolve on the next action. Absent for backends that do
302
+ * not mint refs — those fall back to dense `e${index}` numbering.
303
+ */
304
+ ref?: string;
238
305
  /**
239
306
  * Accessibility custom actions the element exposes (iOS
240
307
  * `UIAccessibilityCustomAction`, React Native `accessibilityActions`). Merged
@@ -255,22 +322,78 @@ type SnapshotNode = RawSnapshotNode & {
255
322
  inheritsLabel?: true;
256
323
  inheritsIdentifier?: true;
257
324
  };
258
- type SnapshotBackend = 'xctest' | 'android' | 'harmonyos-arkui' | 'macos-helper' | 'linux-atspi' | 'web';
325
+ /**
326
+ * The channel↔producer pairs that can actually occur. One channel is fed by several producers
327
+ * with different guarantees: `xctest` trees come from the local Apple runner, Appium
328
+ * page-source XML, or a limrun element tree, and only the runner's output has been through the
329
+ * runner's presentation (clip fold, effective geometry, scope). Logic that assumes
330
+ * presentation, scope, or geometry guarantees must key on the producer, never on the channel
331
+ * alone.
332
+ *
333
+ * This table is the single owner of both vocabularies: the platform channel
334
+ * (`SnapshotBackend` is its `backend` projection) and the acquisition producer (the third
335
+ * axis beside the channel and the in-plan capture strategy `SnapshotCaptureBackend`). Every
336
+ * carrier embeds the pair atomically — a cross-channel pair does not compile (pinned by
337
+ * snapshot-provenance.test.ts).
338
+ */
339
+ type SnapshotProvenance = {
340
+ backend: 'xctest';
341
+ producer: 'apple-runner' | 'simulator-ax-bridge' | 'appium-source' | 'limrun-ios-tree';
342
+ } | {
343
+ backend: 'android';
344
+ producer: 'android-uiautomator' | 'appium-source';
345
+ } | {
346
+ backend: 'harmonyos-arkui';
347
+ producer: 'harmonyos-uitest';
348
+ } | {
349
+ backend: 'macos-helper';
350
+ producer: 'macos-helper';
351
+ } | {
352
+ backend: 'linux-atspi';
353
+ producer: 'linux-atspi';
354
+ } | {
355
+ backend: 'web';
356
+ producer: 'agent-browser';
357
+ };
358
+ type OptionalProducerProvenance<Pair> = Pair extends {
359
+ backend: infer Backend;
360
+ producer: infer Producer;
361
+ } ? {
362
+ backend: Backend;
363
+ producer?: Producer;
364
+ } : never;
365
+ /**
366
+ * The provenance carrier for {@link SnapshotState}: the producer may be absent (a client-side
367
+ * fallback that rebuilds a state from a bare backend result knows the channel and nothing more),
368
+ * but a present pair still has to come from the {@link SnapshotProvenance} table — the channel
369
+ * may not carry a foreign producer.
370
+ */
371
+ type SnapshotStateProvenance = OptionalProducerProvenance<SnapshotProvenance> | {
372
+ backend?: undefined;
373
+ producer?: undefined;
374
+ };
259
375
  type SnapshotState = {
260
376
  nodes: SnapshotNode[];
261
377
  createdAt: number;
262
378
  truncated?: boolean;
263
- backend?: SnapshotBackend;
264
379
  snapshotQuality?: SnapshotQualityVerdict;
265
380
  comparisonSafe?: boolean;
266
381
  presentationKey?: string;
382
+ /** Opaque equality key for iOS acquisition and presentation lineage. */
383
+ comparisonKey?: string;
267
384
  /**
268
385
  * Android: the capture is an occluding system surface (notification shade, quick settings)
269
386
  * rather than app content. Consumers that surface this tree to the agent must disclose the
270
- * occlusion (see core/android-system-surface-disclosure.ts).
387
+ * occlusion (see `@agent-device/contracts/android-system-surface-disclosure`).
271
388
  */
272
389
  systemSurfaceOnly?: boolean;
273
- };
390
+ /**
391
+ * iOS: the bundle id of the in-place system surface this capture describes (a web sign-in sheet
392
+ * presented over the app, #2438). Two captures that disagree here describe different surfaces and
393
+ * must never be compared as the same presentation; consumers that surface the tree disclose it.
394
+ */
395
+ iosSystemSurfaceBundleId?: string;
396
+ } & SnapshotStateProvenance;
274
397
  type SnapshotUnchanged = {
275
398
  ageMs: number;
276
399
  nodeCount: number;
@@ -294,8 +417,10 @@ type ScreenshotOverlayRef = {
294
417
  declare function centerOfRect(rect: Rect): Point;
295
418
  //#endregion
296
419
  //#region packages/kernel/src/contracts.d.ts
420
+ declare const SESSION_RUNTIME_PLATFORMS: readonly ['ios', 'android', 'harmonyos'];
421
+ type SessionRuntimePlatform = (typeof SESSION_RUNTIME_PLATFORMS)[number];
297
422
  type SessionRuntimeHints = {
298
- platform?: 'ios' | 'android';
423
+ platform?: SessionRuntimePlatform;
299
424
  metroHost?: string;
300
425
  metroPort?: number;
301
426
  bundleUrl?: string;
@@ -320,9 +445,13 @@ type DaemonInstallSource = {
320
445
  } | {
321
446
  artifactName: string;
322
447
  }));
448
+ /** Install sources that can be materialized by a local daemon. */
449
+ type LocalInstallSource = Extract<DaemonInstallSource, {
450
+ kind: 'url' | 'path';
451
+ }>;
323
452
  declare const DAEMON_LOCK_POLICIES: readonly ['reject', 'strip'];
324
453
  type DaemonLockPolicy = (typeof DAEMON_LOCK_POLICIES)[number];
325
- declare const LEASE_BACKENDS: readonly ['ios-simulator', 'ios-instance', 'android-instance'];
454
+ declare const LEASE_BACKENDS: readonly ['ios-simulator', 'ios-instance', 'android-instance', 'harmonyos-instance'];
326
455
  type LeaseBackend = (typeof LEASE_BACKENDS)[number];
327
456
  declare const DAEMON_SERVER_MODES: readonly ['socket', 'http', 'dual'];
328
457
  type DaemonServerMode = (typeof DAEMON_SERVER_MODES)[number];
@@ -370,7 +499,7 @@ type DaemonRequest = {
370
499
  runtime?: SessionRuntimeHints;
371
500
  meta?: DaemonRequestMeta;
372
501
  };
373
- type DaemonArtifactKnownType = 'screenshot' | 'screenshot-diff' | 'screen-recording' | 'screen-recording-chunk' | 'screen-recording-telemetry' | 'trace-log';
502
+ type DaemonArtifactKnownType = 'screenshot' | 'screenshot-diff' | 'screen-recording' | 'screen-recording-chunk' | 'screen-recording-telemetry' | 'trace-log' | 'test-artifacts';
374
503
  type DaemonArtifactType = DaemonArtifactKnownType | (string & {});
375
504
  type DaemonArtifact = {
376
505
  field: string;
@@ -404,4 +533,4 @@ type JsonRpcRequestEnvelope<TParams = unknown> = {
404
533
  params?: TParams;
405
534
  };
406
535
  //#endregion
407
- export { AppError as A, DeviceTarget as B, SnapshotNode as C, SnapshotUnchanged as D, SnapshotState as E, normalizeAgentDeviceError as F, PlatformSelector as H, normalizeError as I, AppleOS as L, NormalizedError as M, defaultHintForCode as N, SnapshotVisibility as O, isAgentDeviceError as P, DeviceInfo as R, SnapshotBackend as S, SnapshotQualityVerdict as T, PublicPlatform as U, Platform as V, SessionRuntimeHints as _, DaemonRequest as a, Rect as b, DaemonServerMode as c, JsonRpcRequestEnvelope as d, LeaseBackend as f, SessionIsolationMode as g, ResponseLevel as h, DaemonLockPolicy as i, DaemonError as j, centerOfRect as k, DaemonTransportPreference as l, ResponseCost as m, DaemonArtifactType as n, DaemonResponse as o, NetworkIncludeMode as p, DaemonInstallSource as r, DaemonResponseData as s, DaemonArtifact as t, JsonRpcId as u, Point as v, SnapshotOptions as w, ScreenshotOverlayRef as x, RawSnapshotNode as y, DeviceKind as z };
536
+ export { SnapshotVisibility as A, DaemonError as B, SnapshotCommandOptionFields as C, SnapshotQualityVerdict as D, SnapshotProvenance as E, DeviceTarget as F, normalizeError as G, defaultHintForCode as H, Platform as I, PlatformSelector as L, AppleOS as M, DeviceInfo as N, SnapshotState as O, DeviceKind as P, PublicPlatform as R, ScreenshotOverlayRef as S, SnapshotOptions as T, isAgentDeviceError as U, NormalizedError as V, normalizeAgentDeviceError as W, SessionIsolationMode as _, DaemonRequest as a, RawSnapshotNode as b, DaemonServerMode as c, JsonRpcRequestEnvelope as d, LeaseBackend as f, ResponseLevel as g, ResponseCost as h, DaemonLockPolicy as i, centerOfRect as j, SnapshotUnchanged as k, DaemonTransportPreference as l, NetworkIncludeMode as m, DaemonArtifactType as n, DaemonResponse as o, LocalInstallSource as p, DaemonInstallSource as r, DaemonResponseData as s, DaemonArtifact as t, JsonRpcId as u, SessionRuntimeHints as v, SnapshotNode as w, Rect as x, Point as y, AppError as z };
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime.js";const t=/(token|secret|password|authorization|cookie|api[_-]?key|access[_-]?key|private[_-]?key|user[_-]?code|device[_-]?code|refresh[_-]?credential)/i,n=/\b(?:bearer\s+[a-z0-9._-]+|adc_(?:agent|live|refresh|cli)_[a-z0-9._-]+)\b/gi,r=/\b([a-z0-9_-]*(?:api[_-]?key|token|secret|password|user[_-]?code|device[_-]?code|refresh[_-]?credential)[a-z0-9_-]*)(\s*[=:]\s*)("[^"]*"|'[^']*'|\S+)/gi,i=/https?:\/\/[^\s"'<>]+/gi;function a(e){return o(e,new WeakSet)}function o(e,n,r){if(e==null)return e;if(typeof e==`string`)return s(e,r);if(typeof e!=`object`)return e;if(n.has(e))return`[Circular]`;if(n.add(e),Array.isArray(e))return e.map(e=>o(e,n));let i={};for(let[r,a]of Object.entries(e)){if(t.test(r)){i[r]=`[REDACTED]`;continue}i[r]=o(a,n,r)}return i}function s(e,i){let a=e.trim();if(!a)return e;if(i&&t.test(i))return`[REDACTED]`;let o=c(a);return o=o.replace(n,`[REDACTED]`),o=o.replace(r,(e,t,n,r,i,a)=>u({key:t,separator:n,rawValue:r,offset:i,input:a})||l(r)?e:`${t}${n}[REDACTED]`),o===a?a.length>400?`${a.slice(0,200)}...<truncated>`:a:o}function c(e){return e.replace(i,e=>d(e)??e)}function l(e){return/^adc_(?:agent|live|refresh|cli)_\.\.\.$/i.test(e)}function u(e){if(e.key.toLowerCase()!==`token`||!e.separator.includes(`:`))return!1;try{return new URL(e.rawValue).pathname.replace(/\/+$/,``)===`/api-keys`?/(?:^|\b)(?:service\/)?api\s+$/i.test(e.input.slice(0,e.offset)):!1}catch{return!1}}function d(e){try{let t=new URL(e);return t.search&&=`?REDACTED`,(t.username||t.password)&&(t.username=`REDACTED`,t.password=`REDACTED`),t.toString()}catch{return null}}var f=e({AppError:()=>h,KNOWN_APP_ERROR_CODES:()=>p,asAppError:()=>S,createRequestCanceledError:()=>y,defaultHintForCode:()=>M,errorMessage:()=>x,isAgentDeviceError:()=>C,isRequestCanceledError:()=>b,normalizeAgentDeviceError:()=>w,normalizeError:()=>T,readDiagnosticsRecordRef:()=>A,retriableForErrorCode:()=>j,throwDaemonError:()=>g,toAppErrorCode:()=>m});const p=[`INVALID_ARGS`,`DEVICE_NOT_FOUND`,`DEVICE_IN_USE`,`TOOL_MISSING`,`APP_NOT_INSTALLED`,`UNSUPPORTED_PLATFORM`,`UNSUPPORTED_OPERATION`,`NOT_IMPLEMENTED`,`COMMAND_FAILED`,`SESSION_NOT_FOUND`,`UNAUTHORIZED`,`AMBIGUOUS_MATCH`,`REPLAY_DIVERGENCE`,`REPAIR_SESSION_EXPIRED`,`REPAIR_COMMIT_FAILED`,`UNKNOWN`];function m(e,t=`COMMAND_FAILED`){return typeof e==`string`&&e.length>0?e:t}var h=class extends Error{code;details;cause;constructor(e,t,n,r){super(t),this.code=e,this.details=n,this.cause=r}};function g(e){throw new h(m(e.code),e.message,{...e.details??{},hint:e.hint,diagnosticId:e.diagnosticId,logPath:e.logPath,logPathUnavailable:e.logPathUnavailable,diagnosticsRecord:e.diagnosticsRecord,retriable:e.retriable,supportedOn:e.supportedOn})}const _=`request_canceled`,v=`request canceled`;function y(e,t){return new h(`COMMAND_FAILED`,v,{hint:`The request was canceled intentionally (explicit cancel or client disconnect) — no retry is needed unless the cancellation was unintended.`,...e,reason:_},t)}function b(e){return!(e instanceof h)||e.code!==`COMMAND_FAILED`?!1:e.details?.reason===_?!0:e.message===v}function x(e){return e instanceof Error?e.message:String(e)}function S(e,t=`UNKNOWN`){return e instanceof h?e:e instanceof Error?new h(t,e.message,void 0,e):new h(t,`Unknown error`,{err:e})}function C(e){return e instanceof h}function w(e,t={}){return T(e,t)}function T(e,t={}){let n=S(e),r=n.details?a(n.details):void 0,i=k(r,`diagnosticId`)??t.diagnosticId,o=k(r,`logPath`)??t.logPath,s=k(r,`logPathUnavailable`),c=A(r?.diagnosticsRecord)??t.diagnosticsRecord,l=k(r,`hint`)??M(n.code),u=ne(r,`retriable`)??j(n.code),d=k(r,`supportedOn`),f=re(r),p=ee(n.code,n.message,r);return{code:n.code,message:p,hint:l,diagnosticId:i,logPath:o,...s===void 0?{}:{logPathUnavailable:s},...c===void 0?{}:{diagnosticsRecord:c},...u===void 0?{}:{retriable:u},...d===void 0?{}:{supportedOn:d},details:f}}const E=/^\S+ exited with code -?\d+$/;function ee(e,t,n){if(e!==`COMMAND_FAILED`||n?.processExitError!==!0)return t;let r=O(typeof n?.stderr==`string`?n.stderr:``);return r?E.test(t)?r:t.includes(r)?t:`${t}: ${r}`:t}const te=[/^an error was encountered processing the command/i,/^underlying error\b/i,/^simulator device failed to complete the requested operation/i],D=/^(?:(?:adb|xcrun|simctl):\s*)?(?:error:\s*)?/i;function O(e){for(let t of e.split(`
2
- `)){let e=t.trim();if(!e||te.some(t=>t.test(e)))continue;let n=e.replace(D,``).trim();if(n)return n.length>200?`${n.slice(0,200)}...`:n}return null}function k(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function A(e){if(!e||typeof e!=`object`)return;let{session:t,requestId:n}=e;if(!(typeof t!=`string`||typeof n!=`string`)&&!(t.length===0||n.length===0))return{session:t,requestId:n}}function ne(e,t){let n=e?.[t];return typeof n==`boolean`?n:void 0}function re(e){if(!e)return;let t={...e};return delete t.hint,delete t.diagnosticId,delete t.logPath,delete t.logPathUnavailable,delete t.diagnosticsRecord,delete t.retriable,delete t.supportedOn,Object.keys(t).length>0?t:void 0}const ie={DEVICE_IN_USE:!0};function ae(e){return p.includes(e)}function j(e){return ae(e)?ie[e]:void 0}function M(e){switch(e){case`INVALID_ARGS`:return`Check command arguments and run --help for usage examples.`;case`SESSION_NOT_FOUND`:return`Run open first or pass an explicit device selector.`;case`TOOL_MISSING`:return`Install required platform tooling and ensure it is available in PATH.`;case`DEVICE_NOT_FOUND`:return`Verify the target device is booted/connected and selectors match.`;case`APP_NOT_INSTALLED`:return`Run apps to discover the exact installed package or bundle id, or install the app before open.`;case`UNSUPPORTED_OPERATION`:return`This command is not available for the selected platform/device.`;case`UNSUPPORTED_PLATFORM`:return`This platform is not supported for the requested operation; run devices to inspect available targets.`;case`AMBIGUOUS_MATCH`:return`Multiple candidates matched. Narrow the query or pass an exact identifier.`;case`DEVICE_IN_USE`:return`The device is busy with another agent-device request; retry once it frees up.`;case`REPLAY_DIVERGENCE`:return`Read details.divergence (screen/suggestions) for repair context, or rerun with --json for the full report.`;case`REPAIR_SESSION_EXPIRED`:return`The --save-script repair session was reaped before it was finalized; re-run replay <script> --save-script from the start.`;case`REPAIR_COMMIT_FAILED`:return`The repair transaction completed, but committing its healed script failed at teardown (no-clobber refusal or a filesystem error); inspect the target path/permissions, then re-run replay <script> --save-script to retry.`;case`NOT_IMPLEMENTED`:return`This command is part of the planned API but is not implemented yet.`;case`COMMAND_FAILED`:return`Retry with --debug and inspect diagnostics log for details.`;case`UNAUTHORIZED`:return`Refresh daemon metadata and retry the command.`;case`UNKNOWN`:return`Unexpected internal error. Retry with --debug and report the diagnostics log if it persists.`;default:return`Retry with --debug and inspect diagnostics log for details.`}}function N(e){return e===`xctest`||e===`android`||e===`harmonyos-arkui`||e===`macos-helper`||e===`linux-atspi`||e===`web`}function P(e){return e===void 0||e===`xctest`||e===`android`||e===`harmonyos-arkui`}function F(e){return e.map((e,t)=>({...e,ref:`e${t+1}`}))}const I=/^~s(\d+)$/,L=`Refs look like @e12, optionally pinned to the snapshot generation that minted them: @e12~s3 (the ref, then "~s" and the refsGeneration reported by the issuing snapshot/find response).`;function R(e){let t=e.trim(),n=t.indexOf(`~`);if(n===-1)return{base:t};let r=I.exec(t.slice(n));return!r||n===0?null:{base:t.slice(0,n),generation:Number(r[1])}}function z(e){let t=R(e);if(!t)return null;let n=t.base;return n.startsWith(`@`)?n.slice(1)||null:n.startsWith(`e`)?n:null}function B(e,t){return e.find(e=>e.ref===t)??null}function V(e){return JSON.stringify({interactiveOnly:e?.interactiveOnly===!0,depth:typeof e?.depth==`number`?e.depth:null,scope:e?.scope?.trim()||null,raw:e?.raw===!0,customActions:e?.customActions===!0})}function H(e){if(e)return{depth:e.snapshotDepth,interactiveOnly:e.snapshotInteractiveOnly,raw:e.snapshotRaw,scope:e.snapshotScope,customActions:e.snapshotCustomActions}}function U(e){return{x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)}}const W=[`summary`,`headers`,`body`,`all`],G=[`digest`,`default`,`full`];function K(e){return e!==void 0&&e!=="default"}function q(e){return{parse(t){return e(t,`$`)}}}function J(e,t){throw Error(`${e}: ${t}`)}function Y(e,t){return(!e||typeof e!=`object`||Array.isArray(e))&&J(t,`Expected an object`),e}function X(e,t){return typeof e!=`string`&&J(t,`Expected a string`),e}function oe(e,t){return Number.isInteger(e)||J(t,`Expected an integer`),e}function se(e,t){return Array.isArray(e)||J(t,`Expected an array`),e}function Z(e,t,n){let r=e[t];return r===void 0?void 0:X(r,`${n}.${t}`)}function ce(e,t,n){let r=e[t];if(r!==void 0)return se(r,`${n}.${t}`).map((e,r)=>X(e,`${n}.${t}[${String(r)}]`))}function le(e,t,n){let r=e[t];return r===void 0?void 0:oe(r,`${n}.${t}`)}function Q(e,t,n){let r=e[t];return r===void 0?void 0:Y(r,`${n}.${t}`)}function $(e,t,n,r){let i=e[t];if(i!==void 0)return(typeof i!=`string`||!n.includes(i))&&J(`${r}.${t}`,`Expected one of: ${n.join(`, `)}`),i}const ue=q((e,t)=>{let n=Y(e,t);return{platform:$(n,`platform`,[`ios`,`android`],t),metroHost:Z(n,`metroHost`,t),metroPort:le(n,`metroPort`,t),bundleUrl:Z(n,`bundleUrl`,t),launchUrl:Z(n,`launchUrl`,t)}});function de(e,t){let n=e.id;return n==null||typeof n!=`string`&&typeof n!=`number`&&J(`${t}.id`,`Expected a string, number, or null`),n}const fe=q((e,t)=>{let n=Y(e,t);return{jsonrpc:Z(n,`jsonrpc`,t),id:de(n,t),method:Z(n,`method`,t),params:n.params}}),pe=q((e,t)=>{let n=Y(e,t);return{token:Z(n,`token`,t),session:Z(n,`session`,t),command:Z(n,`command`,t),positionals:ce(n,`positionals`,t),input:Q(n,`input`,t),flags:Q(n,`flags`,t),runtime:Q(n,`runtime`,t),meta:Q(n,`meta`,t)}});export{m as A,C,A as D,T as E,j as O,f as S,w as T,h as _,K as a,M as b,F as c,B as d,N as f,P as g,R as h,ue as i,a as j,g as k,V as l,H as m,G as n,fe as o,z as p,pe as r,L as s,W as t,U as u,S as v,b as w,x,y};
1
+ import{r as e}from"./rolldown-runtime.js";const t=/(token|secret|password|authorization|cookie|api[_-]?key|access[_-]?key|private[_-]?key|user[_-]?code|device[_-]?code|refresh[_-]?credential)/i,n=/\b(?:bearer\s+[a-z0-9._-]+|adc_(?:agent|live|refresh|cli)_[a-z0-9._-]+)\b/gi,r=/\b([a-z0-9_-]*(?:api[_-]?key|token|secret|password|user[_-]?code|device[_-]?code|refresh[_-]?credential)[a-z0-9_-]*)(\s*[=:]\s*)("[^"]*"|'[^']*'|\S+)/gi,i=/https?:\/\/[^\s"'<>]+/gi;function a(e){return s(e,new WeakSet)}function o(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.message==`string`&&t.message.length!==0)return a({message:t.message,...typeof t.code==`string`&&t.code.length>0?{code:t.code}:{}})}function s(e,n,r){if(e==null)return e;if(typeof e==`string`)return c(e,r);if(typeof e!=`object`)return e;if(n.has(e))return`[Circular]`;if(n.add(e),Array.isArray(e))return e.map(e=>s(e,n));let i={};for(let[r,a]of Object.entries(e)){if(t.test(r)){i[r]=`[REDACTED]`;continue}i[r]=s(a,n,r)}return i}function c(e,i){let a=e.trim();if(!a)return l(e);if(i&&t.test(i))return`[REDACTED]`;let o=u(a);return o=o.replace(n,`[REDACTED]`),o=o.replace(r,(e,t,n,r,i,a)=>f({key:t,separator:n,rawValue:r,offset:i,input:a})||d(r)?e:`${t}${n}[REDACTED]`),l(o)}function l(e){return e.length<=400?e:`${e.slice(0,386)}...<truncated>`}function u(e){return e.replace(i,e=>p(e)??e)}function d(e){return/^adc_(?:agent|live|refresh|cli)_\.\.\.$/i.test(e)}function f(e){if(e.key.toLowerCase()!==`token`||!e.separator.includes(`:`))return!1;try{return new URL(e.rawValue).pathname.replace(/\/+$/,``)===`/api-keys`&&/(?:^|\b)(?:service\/)?api\s+$/i.test(e.input.slice(0,e.offset))}catch{return!1}}function p(e){try{let t=new URL(e);return t.search&&=`?REDACTED`,(t.username||t.password)&&(t.username=`REDACTED`,t.password=`REDACTED`),t.toString()}catch{return null}}var m=e({AppError:()=>b,KNOWN_APP_ERROR_CODES:()=>h,asAppError:()=>D,createRequestCanceledError:()=>w,defaultHintForCode:()=>F,errorMessage:()=>E,isAgentDeviceError:()=>O,isRequestCanceledError:()=>T,normalizeAgentDeviceError:()=>k,normalizeError:()=>A,readDiagnosticsRecordRef:()=>N,readElementMatchCandidateRefs:()=>v,readErrorCandidateViews:()=>_,retriableForErrorCode:()=>P,throwDaemonError:()=>x,toAppErrorCode:()=>g});const h=[`INVALID_ARGS`,`DEVICE_NOT_FOUND`,`DEVICE_IN_USE`,`TOOL_MISSING`,`APP_NOT_INSTALLED`,`UNSUPPORTED_PLATFORM`,`UNSUPPORTED_OPERATION`,`NOT_IMPLEMENTED`,`COMMAND_FAILED`,`SESSION_NOT_FOUND`,`UNAUTHORIZED`,`AMBIGUOUS_MATCH`,`REPLAY_DIVERGENCE`,`REPAIR_SESSION_EXPIRED`,`REPAIR_COMMIT_FAILED`,`UNKNOWN`];function g(e,t=`COMMAND_FAILED`){return typeof e==`string`&&e.length>0?e:t}function _(e){let t=y(e?.candidates),n=[];if(t.length>0){let r=typeof e?.matches==`number`?e.matches:t.length,i=typeof e?.refsGeneration==`number`?e.refsGeneration:void 0;n.push({kind:`element-match`,candidates:t,matches:r,...i===void 0?{}:{refsGeneration:i}})}let r=ee(e?.devices);return r.length>0&&n.push({kind:`device`,devices:r}),n}function v(e){return y(e?.candidates).flatMap(e=>{let t=/^@(e\d+)(?:~s\d+)?(?:\s|$)/.exec(e);return t?.[1]?[t[1]]:[]})}function y(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function ee(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`&&typeof e.name==`string`):[]}var b=class extends Error{code;details;cause;constructor(e,t,n,r){super(t),this.code=e,this.details=n,this.cause=r}};function x(e){throw new b(g(e.code),e.message,{...e.details??{},hint:e.hint,diagnosticId:e.diagnosticId,logPath:e.logPath,logPathUnavailable:e.logPathUnavailable,diagnosticsRecord:e.diagnosticsRecord,retriable:e.retriable,supportedOn:e.supportedOn},e.cause)}const S=`request_canceled`,C=`request canceled`;function w(e,t){return new b(`COMMAND_FAILED`,C,{hint:`The request was canceled intentionally (explicit cancel or client disconnect) — no retry is needed unless the cancellation was unintended.`,...e,reason:S},t)}function T(e){return!(e instanceof b)||e.code!==`COMMAND_FAILED`?!1:e.details?.reason===S||e.message===C}function E(e){return e instanceof Error?e.message:String(e)}function D(e,t=`UNKNOWN`){return e instanceof b?e:e instanceof Error?new b(t,e.message,void 0,e):new b(t,`Unknown error`,{err:e})}function O(e){return e instanceof b}function k(e,t={}){return A(e,t)}function A(e,t={}){let n=D(e),r=n.details?a(n.details):void 0,i=M(r,`diagnosticId`)??t.diagnosticId,s=M(r,`logPath`)??t.logPath,c=M(r,`logPathUnavailable`),l=N(r?.diagnosticsRecord)??t.diagnosticsRecord,u=M(r,`hint`)??F(n.code),d=ae(r,`retriable`)??P(n.code),f=M(r,`supportedOn`),p=oe(r),m=ne(n.code,n.message,r),h=o(n.cause);return{code:n.code,message:m,...h===void 0?{}:{cause:h},hint:u,diagnosticId:i,logPath:s,...c===void 0?{}:{logPathUnavailable:c},...l===void 0?{}:{diagnosticsRecord:l},...d===void 0?{}:{retriable:d},...f===void 0?{}:{supportedOn:f},details:p}}const te=/^\S+ exited with code -?\d+$/;function ne(e,t,n){if(e!==`COMMAND_FAILED`||n?.processExitError!==!0)return t;let r=j(typeof n?.stderr==`string`?n.stderr:``);return r?te.test(t)?r:t.includes(r)?t:`${t}: ${r}`:t}const re=[/^an error was encountered processing the command/i,/^underlying error\b/i,/^simulator device failed to complete the requested operation/i],ie=/^(?:(?:adb|xcrun|simctl):\s*)?(?:error:\s*)?/i;function j(e){for(let t of e.split(`
2
+ `)){let e=t.trim();if(!e||re.some(t=>t.test(e)))continue;let n=e.replace(ie,``).trim();if(n)return n.length>200?`${n.slice(0,200)}...`:n}return null}function M(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function N(e){if(!e||typeof e!=`object`)return;let{session:t,requestId:n}=e;if(typeof t==`string`&&typeof n==`string`&&t.length!==0&&n.length!==0)return{session:t,requestId:n}}function ae(e,t){let n=e?.[t];return typeof n==`boolean`?n:void 0}function oe(e){if(!e)return;let t={...e};return delete t.hint,delete t.diagnosticId,delete t.logPath,delete t.logPathUnavailable,delete t.diagnosticsRecord,delete t.retriable,delete t.supportedOn,Object.keys(t).length>0?t:void 0}const se={DEVICE_IN_USE:!0};function ce(e){return h.includes(e)}function P(e){return ce(e)?se[e]:void 0}function F(e){switch(e){case`INVALID_ARGS`:return`Check command arguments and run --help for usage examples.`;case`SESSION_NOT_FOUND`:return`Run open first or pass an explicit device selector.`;case`TOOL_MISSING`:return`Install required platform tooling and ensure it is available in PATH.`;case`DEVICE_NOT_FOUND`:return`Verify the target device is booted/connected and selectors match.`;case`APP_NOT_INSTALLED`:return`Run apps to discover the exact installed package or bundle id, or install the app before open.`;case`UNSUPPORTED_OPERATION`:return`This command is not available for the selected platform/device.`;case`UNSUPPORTED_PLATFORM`:return`This platform is not supported for the requested operation; run devices to inspect available targets.`;case`AMBIGUOUS_MATCH`:return`Multiple candidates matched. Narrow the query or pass an exact identifier.`;case`DEVICE_IN_USE`:return`The device is busy with another agent-device request; retry once it frees up.`;case`REPLAY_DIVERGENCE`:return`Read details.divergence (screen/suggestions) for repair context, or rerun with --json for the full report.`;case`REPAIR_SESSION_EXPIRED`:return`The --save-script repair session was reaped before it was finalized; re-run replay <script> --save-script from the start.`;case`REPAIR_COMMIT_FAILED`:return`The repair transaction completed, but committing its healed script failed at teardown (no-clobber refusal or a filesystem error); inspect the target path/permissions, then re-run replay <script> --save-script to retry.`;case`NOT_IMPLEMENTED`:return`This command is part of the planned API but is not implemented yet.`;case`COMMAND_FAILED`:return`Retry with --debug and inspect diagnostics log for details.`;case`UNAUTHORIZED`:return`Refresh daemon metadata and retry the command.`;case`UNKNOWN`:return`Unexpected internal error. Retry with --debug and report the diagnostics log if it persists.`;default:return`Retry with --debug and inspect diagnostics log for details.`}}const I={interactiveOnly:`snapshotInteractiveOnly`,depth:`snapshotDepth`,scope:`snapshotScope`,raw:`snapshotRaw`,customActions:`snapshotCustomActions`,forceFull:`snapshotForceFull`,includeHiddenContentHints:`snapshotIncludeHiddenContentHints`,preferredBackend:`snapshotPreferredBackend`},le=[`interactiveOnly`,`depth`,`scope`,`raw`,`customActions`,`forceFull`],L=[`interactiveOnly`,`preferredBackend`,`depth`,`scope`,`raw`,`customActions`,`includeHiddenContentHints`],R=[`depth`,`interactiveOnly`,`raw`,`scope`,`customActions`];function z(e,t){return Object.fromEntries(t.map(t=>[t,e?.[I[t]]]))}function B(e,t){return Object.fromEntries(t.flatMap(t=>{let n=e?.[t];return n===void 0?[]:[[I[t],n]]}))}function V(e){if(e===void 0||e.backend===void 0)return{};switch(e.backend){case`xctest`:return{backend:e.backend,producer:e.producer};case`android`:return{backend:e.backend,producer:e.producer};case`harmonyos-arkui`:return{backend:e.backend,producer:e.producer};case`macos-helper`:return{backend:e.backend,producer:e.producer};case`linux-atspi`:return{backend:e.backend,producer:e.producer};case`web`:return{backend:e.backend,producer:e.producer}}}function H(e){return e===`xctest`||e===`android`||e===`harmonyos-arkui`||e===`macos-helper`||e===`linux-atspi`||e===`web`}function U(e){return e===void 0||e===`xctest`||e===`android`||e===`harmonyos-arkui`}function W(e){return e.map((e,t)=>({...e,ref:e.ref??`e${t+1}`}))}const ue=/^~s(\d+)$/,de=`Refs look like @e12, optionally pinned to the snapshot generation that minted them: @e12~s3 (the ref, then "~s" and the refsGeneration reported by the issuing snapshot/find response).`;function G(e){let t=e.trim(),n=t.indexOf(`~`);if(n===-1)return{base:t};let r=ue.exec(t.slice(n));return!r||n===0?null:{base:t.slice(0,n),generation:Number(r[1])}}function fe(e){let t=G(e);if(!t)return null;let n=t.base;return n.startsWith(`@`)?n.slice(1)||null:n.startsWith(`e`)?n:null}function pe(e,t){return e.find(e=>e.ref===t)??null}function me(e){return JSON.stringify({interactiveOnly:e?.interactiveOnly===!0,depth:typeof e?.depth==`number`?e.depth:null,scope:e?.scope?.trim()||null,raw:e?.raw===!0,customActions:e?.customActions===!0})}function he(e){if(e)return z(e,R)}function ge(e){return{x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)}}const K=[`ios`,`android`,`harmonyos`];function _e(e){return K.some(t=>t===e)}const ve=[`summary`,`headers`,`body`,`all`],ye=[`digest`,`default`,`full`];function be(e){return e!==void 0&&e!=="default"}function q(e){return{parse(t){return e(t,`$`)}}}function J(e,t){throw Error(`${e}: ${t}`)}function Y(e,t){return(!e||typeof e!=`object`||Array.isArray(e))&&J(t,`Expected an object`),e}function X(e,t){return typeof e!=`string`&&J(t,`Expected a string`),e}function xe(e,t){return Number.isInteger(e)||J(t,`Expected an integer`),e}function Se(e,t){return Array.isArray(e)||J(t,`Expected an array`),e}function Z(e,t,n){let r=e[t];return r===void 0?void 0:X(r,`${n}.${t}`)}function Q(e,t,n){let r=e[t];if(r!==void 0)return Se(r,`${n}.${t}`).map((e,r)=>X(e,`${n}.${t}[${String(r)}]`))}function Ce(e,t,n){let r=e[t];return r===void 0?void 0:xe(r,`${n}.${t}`)}function $(e,t,n){let r=e[t];return r===void 0?void 0:Y(r,`${n}.${t}`)}function we(e,t,n,r){let i=e[t];if(i!==void 0)return(typeof i!=`string`||!n.includes(i))&&J(`${r}.${t}`,`Expected one of: ${n.join(`, `)}`),i}const Te=q((e,t)=>{let n=Y(e,t);return{platform:we(n,`platform`,K,t),metroHost:Z(n,`metroHost`,t),metroPort:Ce(n,`metroPort`,t),bundleUrl:Z(n,`bundleUrl`,t),launchUrl:Z(n,`launchUrl`,t)}});function Ee(e,t){let n=e.id;return n==null||typeof n!=`string`&&typeof n!=`number`&&J(`${t}.id`,`Expected a string, number, or null`),n}const De=q((e,t)=>{let n=Y(e,t);return{jsonrpc:Z(n,`jsonrpc`,t),id:Ee(n,t),method:Z(n,`method`,t),params:n.params}}),Oe=q((e,t)=>{let n=Y(e,t);return{token:Z(n,`token`,t),session:Z(n,`session`,t),command:Z(n,`command`,t),positionals:Q(n,`positionals`,t),input:$(n,`input`,t),flags:$(n,`flags`,t),runtime:$(n,`runtime`,t),meta:$(n,`meta`,t)}});export{T as A,o as B,b as C,E as D,F as E,_ as F,P as I,x as L,A as M,N,m as O,v as P,g as R,U as S,w as T,B as _,be as a,V as b,de as c,W as d,me as f,fe as g,H as h,Te as i,k as j,O as k,L as l,pe as m,ye as n,_e as o,ge as p,Oe as r,De as s,ve as t,le as u,z as v,D as w,G as x,he as y,a as z};
@@ -1 +1 @@
1
- import{_ as e}from"./sdk-contracts.js";function t(e){return Object.freeze({family:e.platform,...e.appleOs===void 0?{}:{appleOs:e.appleOs},kind:e.kind,...e.target===void 0?{}:{target:e.target},...e.iosPhysicalDeviceBackend===void 0?{}:{iosPhysicalDeviceBackend:e.iosPhysicalDeviceBackend}})}function n(e){return Object.freeze({id:e.id,...t(e)})}function r(e){return JSON.stringify([e.id,...o(e)])}function i(e,t){return r(e)===r(t)}function a(e,t){return JSON.stringify(o(e))===JSON.stringify(o(t))}function o(e){return[e.family,e.appleOs??null,e.kind,e.target??null,e.iosPhysicalDeviceBackend??null]}const s=[`ios`,`ipados`,`tvos`,`watchos`,`visionos`,`macos`],c=[`apple`,`android`,`harmonyos`,`vega`,`linux`,`web`],l=[`ios`,`macos`,`android`,`harmonyos`,`vega`,`linux`,`web`],u=[...c,`ios`,`macos`],d=[`mobile`,`tv`,`desktop`];function f(e){return e===`apple`||e===`ios`||e===`macos`}function p(e){return e.appleOs===`macos`||e.platform===`macos`}function m(e){return f(e.platform)&&!p(e)}function h(e){return e.platform===`android`||e.platform===`harmonyos`||f(e.platform)&&!p(e)}function g(e){return f(e.platform)?p(e)?`macos`:`ios`:e.platform}function _(e){return e===`macos`?{platform:`apple`,appleOs:`macos`}:e===`ios`?{platform:`apple`}:{platform:e}}function v(e){return f(e.platform)&&e.target===`tv`}function y(e){return e.appleOs?e.appleOs:e.platform===`macos`?`macos`:v(e)?`tvos`:`ios`}function b(e){return c.includes(e)}function x(e){return l.includes(e)}function S(e){return s.includes(e)}function C(e,t){return t?t===`apple`?f(e.platform):t===`ios`?f(e.platform)&&!p(e):t===`macos`?f(e.platform)&&p(e):e.platform===t:!0}function w(e,t){return t?T(t):e===`macos`||e===`desktop`?`macOS`:e===`tv`?`tvOS`:`iOS`}function T(e){switch(e){case`tvos`:return`tvOS`;case`macos`:return`macOS`;case`visionos`:return`visionOS`;default:return`iOS`}}function E(e){let{simulatorSetPath:t,platform:n,target:r}=e;if(t&&!(n===`macos`||r===`desktop`))return t}function D(e){return e.map((e,t)=>({device:e,index:t})).sort((e,t)=>H(e,t)).map(({device:e})=>e)}function O(e){return!e||e===`apple`||e===`ios`}async function k(e,t,n={}){let r=e.filter(e=>I(e,t));return A(r,t)||N(r,t.deviceName)||(G(r)&&(r=D(r)),P(r,t,n))}function A(e,t){if(t.udid)return j(e,t.udid);if(t.serial)return M(e,t)}function j(t,n){let r=t.find(e=>e.id===n&&f(e.platform));if(!r)throw new e(`DEVICE_NOT_FOUND`,`No Apple device with UDID ${n}`);return r}function M(t,n){let r=t.find(e=>e.id===n.serial&&R(e.platform));if(!r)throw new e(`DEVICE_NOT_FOUND`,z(n));return r}function N(t,n){if(!n)return;let r=V(n),i=t.find(e=>V(e.name)===r);if(!i)throw new e(`DEVICE_NOT_FOUND`,`No device named ${n}`);return i}function P(e,t,n){let r=e[0];if(r!==void 0&&e.length===1)return r;e.length===0&&B(t,n);let i=F(e);return i||B(t,n),i}function F(e){let t=e.filter(e=>e.kind!==`device`),n=t.length>0?t:e;if(G(n))return n[0];let r=n.filter(e=>e.booted),i=r[0];return i&&r.length===1?i:r[0]??n[0]}function I(e,t,n={}){return C(e,t.platform)&&(!t.target||(e.target??`mobile`)===t.target)&&(!n.includeExplicitSelectors||L(e,t))}function L(e,t){return!(t.udid&&!(e.id===t.udid&&f(e.platform))||t.serial&&!(e.id===t.serial&&R(e.platform))||t.deviceName&&V(e.name)!==V(t.deviceName))}function R(e){return e===`android`||e===`harmonyos`||e===`vega`}function z(e){return e.platform===`android`?`No Android device with serial ${e.serial}`:e.platform===`vega`?`No Vega VVD with serial ${e.serial}`:e.platform===`harmonyos`?`No HarmonyOS device with serial ${e.serial}`:`No Android, HarmonyOS device, or Vega VVD with serial ${e.serial}`}function B(t,n){let r=n.simulatorSetPath;throw r&&O(t.platform)?new e(`DEVICE_NOT_FOUND`,`No devices found in the scoped simulator set`,{simulatorSetPath:r,hint:`The simulator set at "${r}" appears to be empty. Create a compatible simulator first with xcrun simctl --set "${r}" create, or remove the scoped simulator set.`,selector:t}):new e(`DEVICE_NOT_FOUND`,`No devices found`,{selector:t})}function V(e){return e.toLowerCase().replace(/_/g,` `).replace(/\s+/g,` `).trim()}function H(e,t){return U(e.device)-U(t.device)||Number(t.device.booted===!0)-Number(e.device.booted===!0)||e.device.name.localeCompare(t.device.name)||e.index-t.index}function U(e){return e.kind===`simulator`?W(e,0,1,2,3):e.kind===`device`&&f(e.platform)&&!p(e)?W(e,10,11,12,13):14}function W(e,t,n,r,i){return{mobile:K(e.name)?n:t,tv:r,desktop:i}[e.target??`mobile`]}function G(e){return e.length>0&&e.every(e=>f(e.platform))}function K(e){return/\bipad\b/i.test(e)}export{n as C,a as D,i as E,D as S,t as T,g as _,_ as a,k as b,m as c,b as d,x as f,C as g,I as h,l as i,p as l,v as m,c as n,S as o,R as p,u as r,f as s,d as t,h as u,w as v,r as w,y as x,E as y};
1
+ import{C as e}from"./sdk-contracts.js";function t(e){return Object.freeze({family:e.platform,...e.appleOs===void 0?{}:{appleOs:e.appleOs},kind:e.kind,...e.target===void 0?{}:{target:e.target},...e.iosPhysicalDeviceBackend===void 0?{}:{iosPhysicalDeviceBackend:e.iosPhysicalDeviceBackend}})}function n(e){return Object.freeze({id:e.id,...t(e)})}function r(e){return JSON.stringify([e.id,...o(e)])}function i(e,t){return r(e)===r(t)}function a(e,t){return JSON.stringify(o(e))===JSON.stringify(o(t))}function o(e){return[e.family,e.appleOs??null,e.kind,e.target??null,e.iosPhysicalDeviceBackend??null]}const s=[`ios`,`ipados`,`tvos`,`watchos`,`visionos`,`macos`],c=[`apple`,`android`,`harmonyos`,`vega`,`linux`,`web`],l=[`ios`,`macos`,`android`,`harmonyos`,`vega`,`linux`,`web`],u=[...c,`ios`,`macos`],d=[`mobile`,`tv`,`desktop`];function f(e){return[e.deviceName,e.udid,e.serial].some(e=>typeof e==`string`&&e.trim().length>0)}function p(e){return e===`apple`||e===`ios`||e===`macos`}function m(e){return e.appleOs===`macos`||e.platform===`macos`}function h(e){return p(e.platform)&&!m(e)}function g(e){return e.platform===`android`||e.platform===`harmonyos`||p(e.platform)&&!m(e)}function _(e){return p(e.platform)?m(e)?`macos`:`ios`:e.platform}function v(e){return e===`macos`?{platform:`apple`,appleOs:`macos`}:e===`ios`?{platform:`apple`}:{platform:e}}function y(e){return p(e.platform)&&e.target===`tv`}function b(e){return e.appleOs?e.appleOs:e.platform===`macos`?`macos`:y(e)?`tvos`:`ios`}function x(e){return c.includes(e)}function S(e){return l.includes(e)}function C(e){return s.includes(e)}function w(e,t){return t?t===`apple`?p(e.platform):t===`ios`?p(e.platform)&&!m(e):t===`macos`?p(e.platform)&&m(e):e.platform===t:!0}function T(e,t){return t?E(t):e===`macos`||e===`desktop`?`macOS`:e===`tv`?`tvOS`:`iOS`}function E(e){switch(e){case`tvos`:return`tvOS`;case`macos`:return`macOS`;case`visionos`:return`visionOS`;default:return`iOS`}}function D(e){let{simulatorSetPath:t,platform:n,target:r}=e;if(t&&n!==`macos`&&r!==`desktop`)return t}function O(e){return e.map((e,t)=>({device:e,index:t})).sort((e,t)=>Y(e,t)).map(({device:e})=>e)}function k(e){return!e||e===`apple`||e===`ios`}async function A(e,t,n={}){let r=e.filter(e=>U(e,t));return j(r,t)||F(r,t.deviceName)||(Q(r)&&(r=O(r)),ee(r,t,n))}function j(e,t){if(M(t),t.udid)return N(e,t.udid);if(t.serial)return P(e,t)}function M(t){let n=t.platform;if(n){if(t.udid&&G(n))throw new e(`INVALID_ARGS`,`--udid selects Apple devices, but this request selected --platform ${n}.`,{hint:`Use --serial ${t.udid} for ${n} devices.`});if(t.serial&&p(n))throw new e(`INVALID_ARGS`,`--serial selects Android and HarmonyOS devices, but this request selected --platform ${n}.`,{hint:`Use --udid ${t.serial} for Apple devices.`})}}function N(t,n){let r=t.find(e=>e.id===n&&p(e.platform));if(!r)throw new e(`DEVICE_NOT_FOUND`,`No Apple device with UDID ${n}`);return r}function P(t,n){let r=t.find(e=>e.id===n.serial&&G(e.platform));if(!r)throw new e(`DEVICE_NOT_FOUND`,K(n));return r}function F(t,n){if(!n)return;let r=J(n),i=t.find(e=>J(e.name)===r);if(!i){let r=I(t,n);throw new e(`DEVICE_NOT_FOUND`,`No device named ${n}`,r===void 0?void 0:{hint:r})}return i}function I(e,t){let n=e.find(e=>e.id===t);if(!n)return;let r=L(n.platform);if(r)return`${t} is the id of ${JSON.stringify(n.name)}, not its name. Did you mean ${r} ${t}?`}function L(e){if(p(e))return`--udid`;if(G(e))return`--serial`}function ee(e,t,n){let r=e[0];if(r!==void 0&&e.length===1)return r;e.length===0&&q(t,n);let i=B(e);i.length>1&&R(i);let a=i[0];return a||q(t,n),a}function R(t){let n=t.slice(0,10);throw new e(`AMBIGUOUS_MATCH`,`${t.length} devices match this request equally; select one explicitly.`,{devices:n.map(e=>({id:e.id,name:e.name})),matches:t.length,hint:z(n)})}function z(e){let t=e[0];return`Select the intended device explicitly, for example ${t&&G(t.platform)?`--serial ${t.id}`:`--udid ${t?.id??`<id>`}`} or --device ${JSON.stringify(t?.name??`<name>`)}. Run agent-device devices to list them.`}function B(e){let t=Q(e)?H(e):V(e),n=t.filter(e=>e.booted);return n.length>0?n:t}function V(e){let t=e.filter(e=>e.kind!==`device`);return t.length>0?t:e}function H(e){let t=Math.min(...e.map(e=>X(e)));return e.filter(e=>X(e)===t)}function U(e,t,n={}){return w(e,t.platform)&&(!t.target||(e.target??`mobile`)===t.target)&&(!n.includeExplicitSelectors||W(e,t))}function W(e,t){return!(t.udid&&!(e.id===t.udid&&p(e.platform))||t.serial&&!(e.id===t.serial&&G(e.platform))||t.deviceName&&J(e.name)!==J(t.deviceName))}function G(e){return e===`android`||e===`harmonyos`||e===`vega`}function K(e){return e.platform===`android`?`No Android device with serial ${e.serial}`:e.platform===`vega`?`No Vega VVD with serial ${e.serial}`:e.platform===`harmonyos`?`No HarmonyOS device with serial ${e.serial}`:`No Android, HarmonyOS device, or Vega VVD with serial ${e.serial}`}function q(t,n){let r=n.simulatorSetPath;throw r&&k(t.platform)?new e(`DEVICE_NOT_FOUND`,`No devices found in the scoped simulator set`,{simulatorSetPath:r,hint:`The simulator set at "${r}" appears to be empty. Create a compatible simulator first with xcrun simctl --set "${r}" create, or remove the scoped simulator set.`,selector:t}):new e(`DEVICE_NOT_FOUND`,`No devices found`,{selector:t})}function J(e){return e.toLowerCase().replaceAll(`_`,` `).replaceAll(/\s+/g,` `).trim()}function Y(e,t){return X(e.device)-X(t.device)||Number(t.device.booted===!0)-Number(e.device.booted===!0)||e.device.name.localeCompare(t.device.name)||e.index-t.index}function X(e){return e.kind===`simulator`?Z(e,0,1,2,3):e.kind===`device`&&p(e.platform)&&!m(e)?Z(e,10,11,12,13):14}function Z(e,t,n,r,i){return{mobile:$(e.name)?n:t,tv:r,desktop:i}[e.target??`mobile`]}function Q(e){return e.length>0&&e.every(e=>p(e.platform))}function $(e){return/\bipad\b/i.test(e)}export{O as C,i as D,t as E,a as O,b as S,r as T,w as _,v as a,D as b,p as c,g as d,x as f,U as g,y as h,l as i,h as l,G as m,c as n,f as o,S as p,u as r,C as s,d as t,m as u,_ as v,n as w,A as x,T as y};
@@ -1,4 +1,4 @@
1
- import { C as SnapshotNode } from "./sdk-contracts.js";
1
+ import { w as SnapshotNode } from "./sdk-contracts.js";
2
2
  //#region packages/selectors/src/internal/find.d.ts
3
3
  declare const FIND_LOCATORS: readonly ['any', 'text', 'label', 'value', 'role', 'id'];
4
4
  type FindLocator = (typeof FIND_LOCATORS)[number];
@@ -1 +1 @@
1
- import{xn as e}from"./sdk-batch-runner.js";function t(t,n,r,i){return e(t,n,r,typeof i==`boolean`?{requireRect:i}:i)}export{t};
1
+ import{On as e}from"./sdk-batch.js";function t(t,n,r,i){return e(t,n,r,typeof i==`boolean`?{requireRect:i}:i)}export{t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime.js";import{_ as t}from"./sdk-contracts.js";import n from"node:path";import{promises as r}from"node:fs";import i from"node:os";var a=e({createLocalArtifactAdapter:()=>o});function o(e={}){let a=e.cwd??process.cwd(),o=e.tempDir??i.tmpdir(),c=e.rootDir?s(e.rootDir,a):void 0;return{resolveInput:async e=>{if(e.kind===`uploadedArtifact`)throw new t(`UNSUPPORTED_OPERATION`,`Uploaded artifact inputs require a custom artifact adapter`);return{path:s(e.path,a,c)}},reserveOutput:async(e,t)=>{let i,l=t.visibility??`client-visible`,u=e?.kind===`path`?s(e.path,a,c):n.join(i=await r.mkdtemp(n.join(o,`agent-device-${t.field}-`)),`${t.field}${t.ext}`);return await r.mkdir(n.dirname(u),{recursive:!0}),{path:u,visibility:l,...i?{cleanup:async()=>{await r.rm(i,{recursive:!0,force:!0})}}:{},publish:async()=>e?.kind===`downloadableArtifact`?{kind:`localPath`,field:t.field,artifactType:t.artifactType,path:u,fileName:e.fileName??n.basename(e.clientPath??u)}:void 0}},createTempFile:async e=>{let t=await r.mkdtemp(n.join(o,`${e.prefix}-`));return{path:n.join(t,`file${e.ext}`),visibility:`internal`,cleanup:async()=>{await r.rm(t,{recursive:!0,force:!0})}}}}}function s(e,r,i){let a=n.isAbsolute(e)?e:n.resolve(r,e);if(i&&!c(a,i))throw new t(`INVALID_ARGS`,`Local path is outside the artifact adapter root`,{path:a,rootDir:i});return a}function c(e,t){let r=n.relative(t,e);return r===``||!r.startsWith(`..`)&&!n.isAbsolute(r)}export{a as n,o as t};
1
+ import{r as e}from"./rolldown-runtime.js";import{C as t}from"./sdk-contracts.js";import n from"node:path";import{promises as r}from"node:fs";import i from"node:os";var a=e({createLocalArtifactAdapter:()=>o});function o(e={}){let a=e.cwd??process.cwd(),o=e.tempDir??i.tmpdir(),c=e.rootDir?s(e.rootDir,a):void 0;return{resolveInput:async e=>{if(e.kind===`uploadedArtifact`)throw new t(`UNSUPPORTED_OPERATION`,`Uploaded artifact inputs require a custom artifact adapter`);return{path:s(e.path,a,c)}},reserveOutput:async(e,t)=>{let i,l=t.visibility??`client-visible`,u=e?.kind===`path`?s(e.path,a,c):n.join(i=await r.mkdtemp(n.join(o,`agent-device-${t.field}-`)),`${t.field}${t.ext}`);return await r.mkdir(n.dirname(u),{recursive:!0}),{path:u,visibility:l,...i?{cleanup:async()=>{await r.rm(i,{recursive:!0,force:!0})}}:{},publish:async()=>e?.kind===`downloadableArtifact`?{kind:`localPath`,field:t.field,artifactType:t.artifactType,path:u,fileName:e.fileName??n.basename(e.clientPath??u)}:void 0}},createTempFile:async e=>{let t=await r.mkdtemp(n.join(o,`${e.prefix}-`));return{path:n.join(t,`file${e.ext}`),visibility:`internal`,cleanup:async()=>{await r.rm(t,{recursive:!0,force:!0})}}}}}function s(e,r,i){let a=n.isAbsolute(e)?e:n.resolve(r,e);if(i&&!c(a,i))throw new t(`INVALID_ARGS`,`Local path is outside the artifact adapter root`,{path:a,rootDir:i});return a}function c(e,t){let r=n.relative(t,e);return r===``||!r.startsWith(`..`)&&!n.isAbsolute(r)}export{a as n,o as t};
@@ -1,4 +1,4 @@
1
- import { B as DeviceTarget, H as PlatformSelector, _ as SessionRuntimeHints, c as DaemonServerMode, f as LeaseBackend, g as SessionIsolationMode, l as DaemonTransportPreference } from "./sdk-contracts.js";
1
+ import { F as DeviceTarget, L as PlatformSelector, _ as SessionIsolationMode, c as DaemonServerMode, f as LeaseBackend, l as DaemonTransportPreference, v as SessionRuntimeHints } from "./sdk-contracts.js";
2
2
  //#region packages/contracts/src/companion-tunnel-scope.d.ts
3
3
  /**
4
4
  * The identity a companion tunnel is scoped to.
@@ -1 +1 @@
1
- import{r as e}from"./sdk-device.js";import{T as t}from"./sdk-android-adb.js";const n=[`portrait`,`landscape`],r=[{key:`stateDir`,type:`string`,path:!0},{key:`daemonBaseUrl`,type:`string`},{key:`daemonAuthToken`,type:`string`},{key:`daemonTransport`,type:`enum`,enumValues:[`auto`,`socket`,`http`]},{key:`daemonServerMode`,type:`enum`,enumValues:[`socket`,`http`,`dual`]},{key:`tenant`,type:`string`},{key:`sessionIsolation`,type:`enum`,enumValues:[`none`,`tenant`]},{key:`runId`,type:`string`},{key:`leaseId`,type:`string`},{key:`leaseBackend`,type:`enum`,enumValues:[`ios-simulator`,`ios-instance`,`android-instance`]},{key:`platform`,type:`enum`,enumValues:e},{key:`target`,type:`enum`,enumValues:[`mobile`,`tv`,`desktop`]},{key:`device`,type:`string`},{key:`udid`,type:`string`},{key:`serial`,type:`string`},{key:`iosSimulatorDeviceSet`,type:`string`,path:!0,env:!1},{key:`androidDeviceAllowlist`,type:`string`},{key:`session`,type:`string`},{key:`providerApp`,type:`string`},{key:`providerOsVersion`,type:`string`},{key:`providerProject`,type:`string`},{key:`providerBuild`,type:`string`},{key:`providerSessionName`,type:`string`},{key:`providerDeviceOrientation`,type:`enum`,enumValues:n},{key:`providerGeoLocation`,type:`string`},{key:`providerTimezone`,type:`string`},{key:`providerLanguage`,type:`string`},{key:`providerLocale`,type:`string`},{key:`providerNetworkProfile`,type:`string`},{key:`providerCustomNetwork`,type:`string`},{key:`providerNoResignApp`,type:`boolean`},{key:`awsProjectArn`,type:`string`},{key:`awsDeviceArn`,type:`string`},{key:`awsAppArn`,type:`string`},{key:`awsRegion`,type:`string`},{key:`awsInteractionMode`,type:`enum`,enumValues:[`INTERACTIVE`,`NO_VIDEO`,`VIDEO_ONLY`]},{key:`metroProjectRoot`,type:`string`,path:!0},{key:`metroKind`,type:`enum`,enumValues:[`auto`,`react-native`,`expo`,`repack`]},{key:`metroPublicBaseUrl`,type:`string`},{key:`metroProxyBaseUrl`,type:`string`},{key:`metroBearerToken`,type:`string`},{key:`metroPreparePort`,type:`int`,min:1,max:65535},{key:`metroListenHost`,type:`string`},{key:`metroStatusHost`,type:`string`},{key:`metroStartupTimeoutMs`,type:`int`,min:1},{key:`metroProbeTimeoutMs`,type:`int`,min:1},{key:`metroRuntimeFile`,type:`string`,path:!0},{key:`metroNoReuseExisting`,type:`boolean`},{key:`metroNoInstallDeps`,type:`boolean`},{key:`launchUrl`,type:`string`}],i=[{key:`leaseProvider`,type:`string`,env:!1},{key:`deviceKey`,type:`string`,env:!1},{key:`clientId`,type:`string`,env:!1}],a=[...r,...i],o=new Map(a.map(e=>[e.key,e]));function s(e){return o.get(e)}function c(e){return s(e)?.env===!1?[]:[t(e)]}export{n as a,s as i,a as n,c as r,r as t};
1
+ import{C as e}from"./sdk-contracts.js";import{r as t}from"./sdk-device.js";const n=[`portrait`,`landscape`],r=new Set([`1`,`true`,`yes`,`on`]),i=new Set([`0`,`false`,`no`,`off`]);function a(e){return`AGENT_DEVICE_${e.replaceAll(/([A-Z])/g,`_$1`).replaceAll(/[^A-Za-z0-9_]/g,`_`).toUpperCase()}`}function o(t,n,r,i){if(t.multiple)return(Array.isArray(n)?n:[n]).map(e=>o({...t,multiple:!1},e,r,i));if(t.type===`boolean`)return s(n,r,i);if(t.type===`booleanOrString`){if(typeof n==`boolean`)return n;if(typeof n==`string`&&c(n)!==void 0)return c(n);if(typeof n==`string`&&n.trim().length>0)return n;throw new e(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected boolean or non-empty string.`)}if(t.type===`string`){if(typeof n==`string`&&n.trim().length>0)return n;throw new e(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected non-empty string.`)}if(t.type===`enum`){if(t.setValue!==void 0)return l(t,n,r,i);if(typeof n!=`string`||!t.enumValues?.includes(n))throw new e(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected one of: ${t.enumValues?.join(`, `)}.`);return n}let a=typeof n==`number`?n:typeof n==`string`?Number(n):NaN;if(!Number.isFinite(a)||t.type===`int`&&!Number.isInteger(a))throw new e(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected ${t.type===`int`?`integer`:`number`}.`);if(typeof t.min==`number`&&a<t.min)throw new e(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Must be >= ${t.min}.`);if(typeof t.max==`number`&&a>t.max)throw new e(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Must be <= ${t.max}.`);return a}function s(t,n,r){if(typeof t==`boolean`)return t;if(typeof t==`string`){let e=c(t);if(e!==void 0)return e}throw new e(`INVALID_ARGS`,`Invalid value for "${r}" in ${n}. Expected boolean.`)}function c(e){let t=e.trim().toLowerCase();if(r.has(t))return!0;if(i.has(t))return!1}function l(t,n,r,i){let a=t.setValue;if(n===a)return a;if(typeof n==`string`){let e=n.trim();if(e===``||e===`true`||e===`1`)return a;if(e===`false`||e===`0`)return}if(n===!0)return a;if(n!==!1)throw new e(`INVALID_ARGS`,`Invalid value for "${i}" in ${r}. Expected boolean-like value for enum flag.`)}const u=[{key:`stateDir`,type:`string`,path:!0},{key:`daemonBaseUrl`,type:`string`},{key:`daemonAuthToken`,type:`string`},{key:`daemonTransport`,type:`enum`,enumValues:[`auto`,`socket`,`http`]},{key:`daemonServerMode`,type:`enum`,enumValues:[`socket`,`http`,`dual`]},{key:`tenant`,type:`string`},{key:`sessionIsolation`,type:`enum`,enumValues:[`none`,`tenant`]},{key:`runId`,type:`string`},{key:`leaseId`,type:`string`},{key:`leaseBackend`,type:`enum`,enumValues:[`ios-simulator`,`ios-instance`,`android-instance`,`harmonyos-instance`]},{key:`platform`,type:`enum`,enumValues:t},{key:`target`,type:`enum`,enumValues:[`mobile`,`tv`,`desktop`]},{key:`device`,type:`string`},{key:`udid`,type:`string`},{key:`serial`,type:`string`},{key:`iosSimulatorDeviceSet`,type:`string`,path:!0,env:!1},{key:`androidDeviceAllowlist`,type:`string`},{key:`session`,type:`string`},{key:`providerApp`,type:`string`},{key:`providerOsVersion`,type:`string`},{key:`providerProject`,type:`string`},{key:`providerBuild`,type:`string`},{key:`providerSessionName`,type:`string`},{key:`providerDeviceOrientation`,type:`enum`,enumValues:n},{key:`providerGeoLocation`,type:`string`},{key:`providerTimezone`,type:`string`},{key:`providerLanguage`,type:`string`},{key:`providerLocale`,type:`string`},{key:`providerNetworkProfile`,type:`string`},{key:`providerCustomNetwork`,type:`string`},{key:`providerNoResignApp`,type:`boolean`},{key:`awsProjectArn`,type:`string`},{key:`awsDeviceArn`,type:`string`},{key:`awsAppArn`,type:`string`},{key:`awsRegion`,type:`string`},{key:`awsInteractionMode`,type:`enum`,enumValues:[`INTERACTIVE`,`NO_VIDEO`,`VIDEO_ONLY`]},{key:`metroProjectRoot`,type:`string`,path:!0},{key:`metroKind`,type:`enum`,enumValues:[`auto`,`react-native`,`expo`,`repack`]},{key:`metroPublicBaseUrl`,type:`string`},{key:`metroProxyBaseUrl`,type:`string`},{key:`metroBearerToken`,type:`string`},{key:`metroPreparePort`,type:`int`,min:1,max:65535},{key:`metroListenHost`,type:`string`},{key:`metroStatusHost`,type:`string`},{key:`metroStartupTimeoutMs`,type:`int`,min:1},{key:`metroProbeTimeoutMs`,type:`int`,min:1},{key:`metroRuntimeFile`,type:`string`,path:!0},{key:`metroNoReuseExisting`,type:`boolean`},{key:`metroNoInstallDeps`,type:`boolean`},{key:`launchUrl`,type:`string`}],d=[{key:`leaseProvider`,type:`string`,env:!1},{key:`deviceKey`,type:`string`,env:!1},{key:`clientId`,type:`string`,env:!1}],f=[...u,...d],p=new Map(f.map(e=>[e.key,e]));function m(e){return p.get(e)}function h(e){return m(e)?.env===!1?[]:[a(e)]}export{a,n as c,m as i,f as n,c as o,h as r,o as s,u as t};