agent-device 0.20.9 → 0.21.0

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 (492) hide show
  1. package/README.md +2 -2
  2. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.9.apk → agent-device-android-ime-helper-0.21.0.apk} +0 -0
  3. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.0.apk.sha256 +1 -0
  4. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.9.manifest.json → agent-device-android-ime-helper-0.21.0.manifest.json} +4 -4
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.0.apk +0 -0
  6. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.0.apk.sha256 +1 -0
  7. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.9.manifest.json → agent-device-android-snapshot-helper-0.21.0.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 +49 -0
  12. package/apple/snapshot-bridge/SnapshotBridge.m +280 -0
  13. package/apple/snapshot-bridge/SnapshotBridgeRuntime.h +33 -0
  14. package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +382 -0
  15. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +58 -0
  16. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +19 -0
  17. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAlertVerification.swift +36 -0
  18. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerStringNormalization.swift +8 -0
  19. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +12 -1
  20. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +100 -6
  21. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +2 -2
  22. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +21 -12
  23. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +21 -88
  24. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift +124 -0
  25. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +110 -107
  26. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +6 -14
  27. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +85 -114
  28. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +13 -6
  29. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +72 -175
  30. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +10 -11
  31. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXElementTypes.swift +12 -0
  32. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +78 -64
  33. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +17 -9
  34. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +47 -13
  35. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +232 -438
  36. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +98 -0
  37. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +229 -168
  38. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotPresentationInvariant.swift +19 -0
  39. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTiming.swift +110 -0
  40. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedCommitDeadline.swift +206 -0
  41. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +147 -25
  42. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +21 -18
  43. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +24 -307
  44. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +206 -0
  45. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryReadiness.swift +158 -0
  46. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputCandidatePolicy.swift +19 -0
  47. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +49 -16
  48. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +2 -11
  49. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +4 -19
  50. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +16 -20
  51. package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/RecordingExportSupport.swift +111 -0
  52. package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +42 -81
  53. package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-trim.swift +35 -82
  54. package/dist/apple/snapshot-presentation/Package.swift +21 -0
  55. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotGeometry.swift +56 -0
  56. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotModels.swift +259 -0
  57. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentation.swift +153 -0
  58. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationFailure.swift +27 -0
  59. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationInvariant.swift +91 -0
  60. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationProjection.swift +161 -0
  61. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotScopePolicy.swift +53 -0
  62. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFold.swift +242 -0
  63. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFoldProjection.swift +97 -0
  64. package/dist/src/adapter.js +1 -0
  65. package/dist/src/adb-executor.js +2 -0
  66. package/dist/src/adb-failure.js +1 -0
  67. package/dist/src/adb-host.js +1 -0
  68. package/dist/src/adb.js +1 -0
  69. package/dist/src/agent-browser-lifecycle.js +1 -0
  70. package/dist/src/agent-browser-process-record.js +1 -0
  71. package/dist/src/agent-browser-provider.js +1 -0
  72. package/dist/src/agent-browser-tool.js +1 -1
  73. package/dist/src/agent-device-client.js +2 -2
  74. package/dist/src/ai-sdk.d.ts +61 -0
  75. package/dist/src/ai-sdk.js +1 -0
  76. package/dist/src/alert-contract.js +1 -0
  77. package/dist/src/alert-runtime.js +1 -0
  78. package/dist/src/android-adb.d.ts +27 -19
  79. package/dist/src/android-adb.js +1 -1
  80. package/dist/src/android-input-ownership.js +1 -0
  81. package/dist/src/android-system-chrome.js +1 -0
  82. package/dist/src/android.js +1 -1
  83. package/dist/src/api.js +11 -0
  84. package/dist/src/app-catalog.js +1 -0
  85. package/dist/src/app-deployment-resolution.js +2 -0
  86. package/dist/src/app-helpers.js +1 -1
  87. package/dist/src/app-inventory-contract.js +1 -0
  88. package/dist/src/app-inventory.js +1 -0
  89. package/dist/src/app-launch.js +2 -0
  90. package/dist/src/app-lifecycle-facade.js +1 -0
  91. package/dist/src/app-lifecycle.js +3 -6
  92. package/dist/src/app-lifecycle2.js +2 -2
  93. package/dist/src/app-lifecycle3.js +1 -0
  94. package/dist/src/app-log-files.js +1 -1
  95. package/dist/src/app-log-reconnect.js +1 -1
  96. package/dist/src/app-log-runtime.js +1 -4
  97. package/dist/src/app-log-runtime2.js +4 -0
  98. package/dist/src/app-parsers.js +4 -0
  99. package/dist/src/app-resolution-cache.js +1 -0
  100. package/dist/src/app-resolution-facade.js +1 -0
  101. package/dist/src/app-resolution.js +2 -2
  102. package/dist/src/app-state.js +1 -2
  103. package/dist/src/application-lifecycle-interaction.js +1 -0
  104. package/dist/src/application-lifecycle-runtime.js +1 -0
  105. package/dist/src/apps-simctl.js +1 -0
  106. package/dist/src/archive.js +4 -0
  107. package/dist/src/artifact-download.js +1 -0
  108. package/dist/src/artifacts.d.ts +6 -2
  109. package/dist/src/artifacts.js +1 -1
  110. package/dist/src/async-lifecycle.js +1 -0
  111. package/dist/src/audio-probe-result.js +1 -0
  112. package/dist/src/audio-probe-runtime.js +1 -0
  113. package/dist/src/audio-probe-support.js +1 -0
  114. package/dist/src/auth-session.js +1 -1
  115. package/dist/src/auth.js +1 -1
  116. package/dist/src/back-mode.js +1 -0
  117. package/dist/src/{url.js → base-url.js} +1 -1
  118. package/dist/src/boot-diagnostics.js +2 -2
  119. package/dist/src/byte-limit-stream.js +1 -1
  120. package/dist/src/capabilities.js +1 -0
  121. package/dist/src/capture.js +1 -0
  122. package/dist/src/catalog.js +1 -0
  123. package/dist/src/cli-command-aliases.js +1 -0
  124. package/dist/src/cli-config.js +1 -1
  125. package/dist/src/cli-help.js +77 -51
  126. package/dist/src/cli-output.js +1 -1
  127. package/dist/src/cli-runner.js +1 -1
  128. package/dist/src/cli.js +5 -7
  129. package/dist/src/click-button.js +1 -0
  130. package/dist/src/client-metro-companion.js +1 -0
  131. package/dist/src/client-metro.js +1 -1
  132. package/dist/src/client-types.d.ts +1606 -0
  133. package/dist/src/clipboard.js +1 -0
  134. package/dist/src/code-signature-cache.js +1 -0
  135. package/dist/src/code-signature.js +1 -0
  136. package/dist/src/color.js +1 -0
  137. package/dist/src/command-metadata.js +1 -1
  138. package/dist/src/command-schema.js +3 -3
  139. package/dist/src/command-surface.js +1 -1
  140. package/dist/src/command-tools.js +2 -0
  141. package/dist/src/command.js +1 -0
  142. package/dist/src/{selector-vocabulary.js → compatibility-policy.js} +1 -1
  143. package/dist/src/config.js +1 -1
  144. package/dist/src/config2.js +1 -0
  145. package/dist/src/connection-runtime.js +1 -1
  146. package/dist/src/connection.js +5 -5
  147. package/dist/src/contracts.d.ts +1 -1
  148. package/dist/src/contracts.js +1 -1
  149. package/dist/src/daemon-client-lifecycle.js +1 -0
  150. package/dist/src/daemon-process.js +1 -0
  151. package/dist/src/daemon-registration.js +1 -0
  152. package/dist/src/daemon-shutdown-report.js +1 -1
  153. package/dist/src/daemon.js +2 -2
  154. package/dist/src/debug-symbols-facade.js +5 -0
  155. package/dist/src/deploy-result-target.js +1 -0
  156. package/dist/src/device-claim-inspection.js +1 -1
  157. package/dist/src/device-claim-rule.js +1 -0
  158. package/dist/src/device-input-state.d.ts +190 -3
  159. package/dist/src/device-inventory-context.js +1 -0
  160. package/dist/src/device-isolation.js +1 -0
  161. package/dist/src/device-release.js +1 -0
  162. package/dist/src/device-rotation.js +1 -0
  163. package/dist/src/device-selection-resolver.js +1 -0
  164. package/dist/src/device-session.js +1 -0
  165. package/dist/src/device.js +1 -1
  166. package/dist/src/device2.js +3 -2
  167. package/dist/src/diagnostics.js +3 -0
  168. package/dist/src/diagnostics2.js +1 -0
  169. package/dist/src/dispatch-resolve.js +1 -0
  170. package/dist/src/doctor-facade.js +1 -0
  171. package/dist/src/doctor-output.js +1 -0
  172. package/dist/src/doctor.js +1 -0
  173. package/dist/src/doctor2.js +1 -0
  174. package/dist/src/doctor3.js +1 -0
  175. package/dist/src/durable-resource.js +1 -0
  176. package/dist/src/entities.js +1 -1
  177. package/dist/src/error.js +2 -0
  178. package/dist/src/exec.js +1 -0
  179. package/dist/src/file.js +1 -0
  180. package/dist/src/find.js +1 -1
  181. package/dist/src/finders.js +1 -1
  182. package/dist/src/format.js +2 -0
  183. package/dist/src/generic-settle.js +1 -1
  184. package/dist/src/generic.js +1 -1
  185. package/dist/src/gesture-admission.js +1 -0
  186. package/dist/src/gesture-plan-types.js +1 -0
  187. package/dist/src/gesture-plan.js +1 -0
  188. package/dist/src/gesture-runtime.js +1 -0
  189. package/dist/src/harmonyos.js +1 -1
  190. package/dist/src/hdc.js +1 -1
  191. package/dist/src/helper.js +2 -2
  192. package/dist/src/host-file.js +1 -0
  193. package/dist/src/human-control-contract.js +1 -0
  194. package/dist/src/human-control.js +1 -0
  195. package/dist/src/index.d.ts +2 -1578
  196. package/dist/src/index.js +1 -1
  197. package/dist/src/input-actions.js +1 -4
  198. package/dist/src/input-actions2.js +2 -1
  199. package/dist/src/install-artifact-facade.js +1 -0
  200. package/dist/src/install-source-network-transport.js +1 -0
  201. package/dist/src/install-source.d.ts +3 -10
  202. package/dist/src/install-source2.js +1 -1
  203. package/dist/src/interaction-positionals.js +1 -0
  204. package/dist/src/interaction-ref-policy.js +1 -0
  205. package/dist/src/interaction.js +1 -1
  206. package/dist/src/interaction2.js +1 -1
  207. package/dist/src/interactor-operation-catalog.js +1 -0
  208. package/dist/src/interactor-types.js +1 -0
  209. package/dist/src/interactor.js +6 -2
  210. package/dist/src/interactor2.js +1 -1
  211. package/dist/src/interactors.js +1 -1
  212. package/dist/src/internal/bin.d.ts +1 -1
  213. package/dist/src/internal/bin.js +1 -2
  214. package/dist/src/internal/companion-tunnel.d.ts +1 -1
  215. package/dist/src/internal/companion-tunnel.js +1 -1
  216. package/dist/src/internal/daemon.d.ts +1 -1
  217. package/dist/src/internal/daemon.js +2 -4
  218. package/dist/src/internal/png-worker.d.ts +4 -4
  219. package/dist/src/internal/png-worker.js +1 -1
  220. package/dist/src/internal/run-script-http-child.d.ts +4 -0
  221. package/dist/src/internal/run-script-http-child.js +1 -0
  222. package/dist/src/internal/update-check-entry.d.ts +1 -1
  223. package/dist/src/inventory.js +4 -4
  224. package/dist/src/inventory2.js +1 -1
  225. package/dist/src/inventory3.js +1 -1
  226. package/dist/src/inventory5.js +1 -1
  227. package/dist/src/inventory6.js +1 -1
  228. package/dist/src/ios-client.js +16 -0
  229. package/dist/src/ios-snapshot-acquisition.js +1 -0
  230. package/dist/src/ios-snapshot-adapter.js +1 -0
  231. package/dist/src/ios-snapshot-planning.js +1 -0
  232. package/dist/src/ios-snapshot-runtime.js +1 -0
  233. package/dist/src/json.js +1 -0
  234. package/dist/src/keyboard-actions.js +1 -0
  235. package/dist/src/launch-console.js +1 -0
  236. package/dist/src/lease-context.js +1 -1
  237. package/dist/src/lease-scope.js +1 -0
  238. package/dist/src/lease.js +1 -1
  239. package/dist/src/limrun-runtime-dependencies.js +1 -1
  240. package/dist/src/limrun.d.ts +1618 -7
  241. package/dist/src/limrun.js +1 -1
  242. package/dist/src/linux.js +1 -1
  243. package/dist/src/local-interactor-operation-set.js +1 -0
  244. package/dist/src/location-coordinates.js +1 -1
  245. package/dist/src/logcat.js +1 -1
  246. package/dist/src/macos-facade.js +1 -0
  247. package/dist/src/managed-device-scope.js +1 -0
  248. package/dist/src/mechanics.js +19 -0
  249. package/dist/src/metro.d.ts +4 -2
  250. package/dist/src/metro.js +1 -1
  251. package/dist/src/metro2.js +1 -1
  252. package/dist/src/mobile-snapshot-semantics.js +1 -0
  253. package/dist/src/multitouch-support.js +1 -0
  254. package/dist/src/numeric.js +1 -0
  255. package/dist/src/observability.js +1 -1
  256. package/dist/src/observation.js +2 -0
  257. package/dist/src/output-path.js +1 -1
  258. package/dist/src/owner-identity.js +3 -1
  259. package/dist/src/parameterized-recorded-fill.js +1 -0
  260. package/dist/src/parser.js +1 -1
  261. package/dist/src/perf-facade.js +2 -0
  262. package/dist/src/perf-runtime-operation-builder.js +1 -0
  263. package/dist/src/perf-runtime-plan.js +1 -0
  264. package/dist/src/perf-runtime.js +1 -0
  265. package/dist/src/perf.js +1 -4
  266. package/dist/src/physical-device-control.js +1 -1
  267. package/dist/src/physical-device-facade.js +1 -0
  268. package/dist/src/platform-request-scope.js +1 -0
  269. package/dist/src/platform-runtime-android-adb-host.js +1 -0
  270. package/dist/src/platform-runtime-android-mechanics.js +1 -0
  271. package/dist/src/platform-runtime-app-log-android-transport.js +1 -1
  272. package/dist/src/platform-runtime-app-log-process.js +1 -1
  273. package/dist/src/platform-runtime-apple-resources.js +1 -0
  274. package/dist/src/platform-runtime-host.js +1 -1
  275. package/dist/src/platform-runtime-managed-owner.js +1 -0
  276. package/dist/src/platform-runtime-network-web-transport.js +1 -1
  277. package/dist/src/platform-runtime-open-target.js +1 -1
  278. package/dist/src/platform-runtime-operation-host.js +4 -4
  279. package/dist/src/platform-runtime-runtime-hints.js +2 -2
  280. package/dist/src/platform-runtime-screen-recording-android-host.js +1 -1
  281. package/dist/src/platform-runtime-screen-recording-apple-runner-host.js +1 -1
  282. package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -1
  283. package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
  284. package/dist/src/platform-runtime-screen-recording-apple-transport.js +1 -1
  285. package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
  286. package/dist/src/platform-runtime-screen-recording-harmony-host.js +1 -1
  287. package/dist/src/platform-runtime-screen-recording-process-host.js +1 -0
  288. package/dist/src/platform-runtime-screen-recording-web-host.js +1 -1
  289. package/dist/src/platform-runtime-unavailable.js +1 -0
  290. package/dist/src/platform-runtime.js +1 -1
  291. package/dist/src/platform-runtime2.js +1 -1
  292. package/dist/src/plist.js +1 -1
  293. package/dist/src/png-worker-contract.js +1 -1
  294. package/dist/src/prepare-kind.js +1 -15
  295. package/dist/src/process-exit.js +1 -1
  296. package/dist/src/process.js +1 -0
  297. package/dist/src/provider-device-runtime.js +1 -0
  298. package/dist/src/provider-session-ownership.js +2 -0
  299. package/dist/src/provider-webdriver.js +1 -1
  300. package/dist/src/provider.js +1 -1
  301. package/dist/src/providers.js +1 -0
  302. package/dist/src/proxy.js +2 -2
  303. package/dist/src/react-native-overlay.js +1 -0
  304. package/dist/src/react-native.js +1 -1
  305. package/dist/src/record-runtime.js +1 -1
  306. package/dist/src/record-trace.js +1 -1
  307. package/dist/src/rect-center.js +1 -0
  308. package/dist/src/register-builtins.js +1 -0
  309. package/dist/src/registry.js +39 -28
  310. package/dist/src/remote-config2.js +1 -1
  311. package/dist/src/replay-divergence.js +2 -0
  312. package/dist/src/replay.js +2 -2
  313. package/dist/src/reporting.js +8 -8
  314. package/dist/src/request-admission.js +1 -0
  315. package/dist/src/request-cancel.js +1 -0
  316. package/dist/src/request-cancellation.js +1 -0
  317. package/dist/src/request-progress-protocol.js +1 -0
  318. package/dist/src/request-providers.js +1 -0
  319. package/dist/src/request-runtime-binding.js +1 -0
  320. package/dist/src/request.js +1 -0
  321. package/dist/src/result-serialization.js +1 -0
  322. package/dist/src/retry.js +1 -0
  323. package/dist/src/rolldown-runtime.js +1 -1
  324. package/dist/src/runner-cache-metadata.js +2 -0
  325. package/dist/src/runner-client.js +1 -1
  326. package/dist/src/runner-disposal.js +1 -1
  327. package/dist/src/runner-operations-facade.js +1 -0
  328. package/dist/src/runner-owner-facade.js +1 -0
  329. package/dist/src/runner-owner-state.js +1 -0
  330. package/dist/src/runner-presentation.js +1 -0
  331. package/dist/src/runner-selector-query.js +1 -0
  332. package/dist/src/runner.js +1 -0
  333. package/dist/src/{runtime-transport.js → runtime-transport-hints.js} +1 -1
  334. package/dist/src/runtime.js +3 -3
  335. package/dist/src/runtime2.js +4 -4
  336. package/dist/src/runtime3.js +1 -1
  337. package/dist/src/runtime4.js +4 -3
  338. package/dist/src/runtime5.js +1 -1
  339. package/dist/src/runtime6.js +1 -1
  340. package/dist/src/runtime7.js +1 -1
  341. package/dist/src/runtime8.js +1 -1
  342. package/dist/src/runtime9.js +1 -1
  343. package/dist/src/scoped-provider.js +1 -1
  344. package/dist/src/screen-recording-completion.js +1 -0
  345. package/dist/src/screen-recording-live-handle.js +1 -0
  346. package/dist/src/screen-recording-options.js +1 -0
  347. package/dist/src/screen-recording-resource-recovery.js +1 -0
  348. package/dist/src/screen-recording-runtime.js +1 -0
  349. package/dist/src/screenshot-density.js +1 -1
  350. package/dist/src/screenshot-result.js +1 -6
  351. package/dist/src/screenshot-runtime.js +1 -0
  352. package/dist/src/screenshot.js +1 -1
  353. package/dist/src/screenshot2.js +1 -0
  354. package/dist/src/screenshot3.js +5 -0
  355. package/dist/src/script.js +1 -0
  356. package/dist/src/scroll-command.js +1 -0
  357. package/dist/src/scroll-gesture.js +1 -0
  358. package/dist/src/scroll-indicator.js +1 -0
  359. package/dist/src/sdk-batch-runner.d.ts +23 -6
  360. package/dist/src/sdk-batch-runner.js +2 -3
  361. package/dist/src/sdk-batch.js +2 -0
  362. package/dist/src/sdk-contracts.d.ts +222 -99
  363. package/dist/src/sdk-contracts.js +2 -2
  364. package/dist/src/sdk-device.js +1 -1
  365. package/dist/src/sdk-finders.d.ts +1 -1
  366. package/dist/src/sdk-finders.js +1 -1
  367. package/dist/src/sdk-io.js +1 -1
  368. package/dist/src/sdk-remote-config.d.ts +1 -1
  369. package/dist/src/sdk-remote-config.js +1 -1
  370. package/dist/src/sdk-selectors.d.ts +539 -199
  371. package/dist/src/sdk-selectors.js +1 -1
  372. package/dist/src/selection.js +1 -0
  373. package/dist/src/selector-runtime.js +1 -1
  374. package/dist/src/selectors.js +1 -1
  375. package/dist/src/semantic-index.js +1 -0
  376. package/dist/src/server.js +10 -3
  377. package/dist/src/session-allocation.js +1 -0
  378. package/dist/src/session-artifact-paths.js +1 -0
  379. package/dist/src/session-paths.js +1 -0
  380. package/dist/src/session-repair-tombstone.js +1 -0
  381. package/dist/src/session-routing.js +1 -0
  382. package/dist/src/session-runtime-admission.js +1 -0
  383. package/dist/src/session-snapshot.js +1 -0
  384. package/dist/src/session-store.js +4 -0
  385. package/dist/src/session-target-evidence.js +1 -1
  386. package/dist/src/session2.js +5 -28
  387. package/dist/src/settings.js +1 -0
  388. package/dist/src/shared.js +2 -2
  389. package/dist/src/simctl-facade.js +1 -0
  390. package/dist/src/simctl.js +1 -1
  391. package/dist/src/simulator-facade.js +1 -0
  392. package/dist/src/simulator.js +1 -1
  393. package/dist/src/snapshot-capture-annotations.js +1 -0
  394. package/dist/src/snapshot-desktop-projection.js +1 -0
  395. package/dist/src/snapshot-diagnostics.js +1 -0
  396. package/dist/src/snapshot-process.js +1 -0
  397. package/dist/src/snapshot-quality-backend-capabilities.js +1 -0
  398. package/dist/src/snapshot-quality-verdict.js +1 -0
  399. package/dist/src/snapshot-runtime-binding.js +1 -0
  400. package/dist/src/snapshot-runtime.js +1 -1
  401. package/dist/src/snapshot-scope.js +1 -0
  402. package/dist/src/snapshot-state.js +1 -0
  403. package/dist/src/snapshot.js +1 -8
  404. package/dist/src/snapshot2.js +1 -1
  405. package/dist/src/snapshot3.js +1 -1
  406. package/dist/src/snapshot4.js +1 -0
  407. package/dist/src/src.js +1 -1
  408. package/dist/src/src2.js +1 -1
  409. package/dist/src/src3.js +1 -2
  410. package/dist/src/src4.js +1 -0
  411. package/dist/src/src5.js +1 -0
  412. package/dist/src/src6.js +1 -0
  413. package/dist/src/src7.js +2 -0
  414. package/dist/src/src8.js +115 -0
  415. package/dist/src/startup-recovery-fence.js +1 -0
  416. package/dist/src/status-markers.js +1 -0
  417. package/dist/src/string-enum.js +1 -1
  418. package/dist/src/success-text.js +1 -0
  419. package/dist/src/surface-snapshot.js +1 -0
  420. package/dist/src/surface-snapshot2.js +1 -0
  421. package/dist/src/takeover.js +5 -0
  422. package/dist/src/tool-provider-facade.js +1 -0
  423. package/dist/src/tool-provider.js +4 -3
  424. package/dist/src/tool-provider2.js +1 -1
  425. package/dist/src/tool-provider3.js +1 -0
  426. package/dist/src/toolchain-probe.js +2 -0
  427. package/dist/src/touch-runtime.js +1 -0
  428. package/dist/src/transport.js +3 -0
  429. package/dist/src/tree.js +1 -0
  430. package/dist/src/ttl-memo.js +1 -0
  431. package/dist/src/tv-remote.js +1 -0
  432. package/dist/src/type-text-runtime.js +1 -0
  433. package/dist/src/undici.js +99 -0
  434. package/dist/src/update-check.js +1 -1
  435. package/dist/src/verified-file.js +1 -1
  436. package/dist/src/version.js +1 -1
  437. package/dist/src/video.js +2 -2
  438. package/dist/src/web.js +2 -1
  439. package/dist/src/web2.js +1 -0
  440. package/dist/src/webdriver-ios-snapshot.js +1 -0
  441. package/dist/src/webdriver-source.js +1 -0
  442. package/linux/atspi-dump.py +54 -9
  443. package/package.json +73 -38
  444. package/server.json +9 -3
  445. package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.9.apk.sha256 +0 -1
  446. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.9.apk +0 -0
  447. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.9.apk.sha256 +0 -1
  448. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CoordinateTextEntryTests.swift +0 -4
  449. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +0 -75
  450. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+LifecycleCacheTests.swift +0 -6
  451. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+RecordingTests.swift +0 -4
  452. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SelectorMatchPolicyTests.swift +0 -4
  453. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTraversalIdentityTests.swift +0 -4
  454. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryPolicyTests.swift +0 -4
  455. package/dist/src/appearance.js +0 -1
  456. package/dist/src/apps.js +0 -5
  457. package/dist/src/audio-probe.js +0 -1
  458. package/dist/src/cancel.js +0 -1
  459. package/dist/src/cli-grammar.js +0 -1
  460. package/dist/src/command-catalog.js +0 -1
  461. package/dist/src/debug-symbols.js +0 -5
  462. package/dist/src/device-input-state.js +0 -2
  463. package/dist/src/device-ready.js +0 -1
  464. package/dist/src/dispatch.js +0 -1
  465. package/dist/src/handler-utils.js +0 -1
  466. package/dist/src/helper-package-install.js +0 -1
  467. package/dist/src/host-process.js +0 -3
  468. package/dist/src/ime-lifecycle.js +0 -2
  469. package/dist/src/ime-recovery-marker.js +0 -1
  470. package/dist/src/input-actions3.js +0 -1
  471. package/dist/src/install-artifact.js +0 -1
  472. package/dist/src/install-artifact2.js +0 -1
  473. package/dist/src/interaction-common.js +0 -1
  474. package/dist/src/interaction-runtime.js +0 -1
  475. package/dist/src/interaction-snapshot.js +0 -1
  476. package/dist/src/manifest.js +0 -1
  477. package/dist/src/method-scope.js +0 -1
  478. package/dist/src/png-resize.js +0 -1
  479. package/dist/src/process-lock.js +0 -1
  480. package/dist/src/runner-lease.js +0 -1
  481. package/dist/src/runner-sequence.js +0 -1
  482. package/dist/src/screenshot-geometry.js +0 -1
  483. package/dist/src/sdk-android-adb.d.ts +0 -245
  484. package/dist/src/sdk-android-adb.js +0 -4
  485. package/dist/src/sdk.js +0 -1
  486. package/dist/src/setting-state.js +0 -1
  487. package/dist/src/shell-quote.js +0 -1
  488. package/dist/src/snapshot-session.js +0 -1
  489. package/dist/src/timing-safe-equal.js +0 -1
  490. package/dist/src/unsupported-interactor.js +0 -1
  491. package/dist/src/verdict.js +0 -1
  492. /package/dist/src/{recording-telemetry.js → telemetry.js} +0 -0
@@ -1,3 +1,130 @@
1
+ //#region packages/kernel/src/errors.d.ts
2
+ /**
3
+ * The known error codes as a value, so gates can enumerate them: every code
4
+ * here must resolve a hint through `defaultHintForCode`, and every code
5
+ * `retriableForErrorCode` classifies must have a recovery quiz in the help
6
+ * benchmark (scripts/__tests__/help-conformance-error-recovery-coverage.test.ts).
7
+ * `KnownAppErrorCode` is derived from this array, so a new code cannot be added
8
+ * to the type without entering the enumeration.
9
+ */
10
+ declare const KNOWN_APP_ERROR_CODES: readonly ['INVALID_ARGS', 'DEVICE_NOT_FOUND', 'DEVICE_IN_USE', 'TOOL_MISSING', 'APP_NOT_INSTALLED', 'UNSUPPORTED_PLATFORM', 'UNSUPPORTED_OPERATION', 'NOT_IMPLEMENTED', 'COMMAND_FAILED', 'SESSION_NOT_FOUND', 'UNAUTHORIZED', 'AMBIGUOUS_MATCH', 'REPLAY_DIVERGENCE', 'REPAIR_SESSION_EXPIRED', 'REPAIR_COMMIT_FAILED', 'UNKNOWN'];
11
+ type KnownAppErrorCode = (typeof KNOWN_APP_ERROR_CODES)[number];
12
+ type AppErrorCode = KnownAppErrorCode | (string & {});
13
+ /**
14
+ * Locator for one request's diagnostics record on the daemon host, in the
15
+ * daemon's own vocabulary rather than as a filesystem path: `logPath` names
16
+ * that same record as a path, which only a caller on the daemon host can read.
17
+ * A remote caller fetches the record by this locator instead
18
+ * (`GET /sessions/<session>/requests/<requestId>/diagnostics`).
19
+ */
20
+ type DiagnosticsRecordRef = {
21
+ session: string;
22
+ requestId: string;
23
+ };
24
+ type ErrorCause = {
25
+ message: string;
26
+ code?: string;
27
+ };
28
+ /**
29
+ * Details bag for AppError. Free-form context is allowed, but these keys carry
30
+ * meaning at normalize/render time and must keep their types:
31
+ * - `hint` — overrides `defaultHintForCode`; re-wraps preserve an existing hint.
32
+ * - `diagnosticId` / `logPath` / `logPathUnavailable` / `diagnosticsRecord` —
33
+ * lifted onto the normalized error, stripped from details.
34
+ * - `processExitError` + `stdout`/`stderr`/`exitCode` — marks a wrap of a real
35
+ * process exit so normalizeError can surface the first meaningful stderr line;
36
+ * build these via `execFailureDetails`/`requireExecSuccess` in @agent-device/host-kit/command
37
+ * rather than by hand.
38
+ * - `retriable` — typed retry signal hoisted to the wire error shape.
39
+ * - `reason` — machine-dispatchable sub-classification within a code.
40
+ */
41
+ type AppErrorDetails = Record<string, unknown> & {
42
+ hint?: string;
43
+ diagnosticId?: string;
44
+ logPath?: string;
45
+ logPathUnavailable?: string;
46
+ diagnosticsRecord?: DiagnosticsRecordRef;
47
+ retriable?: boolean;
48
+ supportedOn?: string;
49
+ processExitError?: boolean;
50
+ stdout?: string;
51
+ stderr?: string;
52
+ exitCode?: number | null;
53
+ reason?: string;
54
+ };
55
+ type NormalizedError = {
56
+ code: string;
57
+ message: string;
58
+ cause?: ErrorCause;
59
+ hint?: string;
60
+ diagnosticId?: string;
61
+ /**
62
+ * Diagnostics record path **the reader of this error can open**. A daemon
63
+ * renders its own host path here; a client talking to a REMOTE daemon
64
+ * replaces it with the caller-local copy it fetched, or drops it and sets
65
+ * `logPathUnavailable` (see `localizeRemoteDaemonError`). A path the reader
66
+ * cannot open never belongs in this field (#1801).
67
+ */
68
+ logPath?: string;
69
+ /**
70
+ * Why no readable `logPath` could be produced, e.g.
71
+ * `remote daemon https://host, request 8f2c: 404`. Set only in place of
72
+ * `logPath`, and never carries a daemon-host path.
73
+ */
74
+ logPathUnavailable?: string;
75
+ /** Locator the record can be fetched by when it lives on a remote daemon. */
76
+ diagnosticsRecord?: DiagnosticsRecordRef;
77
+ /**
78
+ * Lifted from `details.retriable` when a throw site classified the failure as
79
+ * clearly transient (or clearly not). Included only when set, so the default
80
+ * error wire shape is unchanged.
81
+ */
82
+ retriable?: boolean;
83
+ supportedOn?: string;
84
+ details?: Record<string, unknown>;
85
+ };
86
+ /**
87
+ * Error payload returned by the daemon transport. It is kept beside the local
88
+ * error representation because clients immediately rehydrate this wire shape
89
+ * into `AppError` before rendering or handling it.
90
+ */
91
+ type DaemonError = {
92
+ code: string;
93
+ message: string;
94
+ cause?: ErrorCause;
95
+ hint?: string;
96
+ diagnosticId?: string;
97
+ /** Path on the DAEMON host. Meaningful to a local caller only (#1801). */
98
+ logPath?: string;
99
+ /** Why no readable path is named; set by the client, never by the daemon. */
100
+ logPathUnavailable?: string;
101
+ /**
102
+ * Additive locator (#1801) for the request diagnostics record `logPath`
103
+ * names, so a remote caller can fetch it over the daemon API instead of
104
+ * being handed a path on a filesystem it cannot read.
105
+ */
106
+ diagnosticsRecord?: DiagnosticsRecordRef;
107
+ details?: Record<string, unknown>;
108
+ /** Additive retry and platform-support signals; absent when not derivable. */
109
+ retriable?: boolean;
110
+ supportedOn?: string;
111
+ };
112
+ declare class AppError extends Error {
113
+ code: AppErrorCode;
114
+ details?: AppErrorDetails;
115
+ cause?: unknown;
116
+ constructor(code: AppErrorCode, message: string, details?: AppErrorDetails, cause?: unknown);
117
+ }
118
+ declare function isAgentDeviceError(err: unknown): err is AppError;
119
+ type NormalizeErrorContext = {
120
+ diagnosticId?: string;
121
+ logPath?: string;
122
+ diagnosticsRecord?: DiagnosticsRecordRef;
123
+ };
124
+ declare function normalizeAgentDeviceError(err: unknown, context?: NormalizeErrorContext): NormalizedError;
125
+ declare function normalizeError(err: unknown, context?: NormalizeErrorContext): NormalizedError;
126
+ declare function defaultHintForCode(code: string): string | undefined;
127
+ //#endregion
1
128
  //#region packages/kernel/src/device.d.ts
2
129
  declare const APPLE_OS_VALUES: readonly ['ios', 'ipados', 'tvos', 'watchos', 'visionos', 'macos'];
3
130
  type AppleOS = (typeof APPLE_OS_VALUES)[number];
@@ -25,7 +152,7 @@ type DeviceInfo = {
25
152
  //#endregion
26
153
  //#region packages/kernel/src/snapshot.d.ts
27
154
  /**
28
- * 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.
29
156
  * The daemon renders it; it never re-derives degradation from node shapes.
30
157
  *
31
158
  * Defined here (the foundational snapshot type module) rather than in
@@ -35,16 +162,22 @@ type DeviceInfo = {
35
162
  /**
36
163
  * Which capture STRATEGY produced a snapshot, within one platform's plan —
37
164
  * distinct from `SnapshotBackend`, which names the platform channel
38
- * (`xctest`/`android`/…). The iOS plan walks these in order, so one session can
39
- * change strategy mid-sequence, and two strategies do not return comparable
40
- * 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.
41
168
  */
42
- 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
+ };
43
176
  type SnapshotQualityVerdict = {
44
177
  state: 'healthy' | 'recovered' | 'sparse';
45
178
  backend: SnapshotCaptureBackend;
46
179
  reason?: string;
47
- 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';
48
181
  effectiveDepth?: number;
49
182
  collapsedLeafIndexes?: number[];
50
183
  /**
@@ -59,6 +192,8 @@ type SnapshotQualityVerdict = {
59
192
  truncated: number;
60
193
  blocked: boolean;
61
194
  };
195
+ /** Response-level phase timing for the backend named by `backend`. */
196
+ timing?: SnapshotQualityTiming;
62
197
  };
63
198
  type Rect = {
64
199
  x: number;
@@ -81,7 +216,7 @@ type SnapshotOptions = {
81
216
  * are not comparable views of a screen), so a corroboration probe must be
82
217
  * captured the way its baseline was.
83
218
  */
84
- preferredBackend?: 'private-ax';
219
+ preferredBackend?: SnapshotPreferredBackend;
85
220
  /**
86
221
  * Read accessibility custom actions for elements that merge their children
87
222
  * away. Opt-in because each such element costs its own accessibility round
@@ -101,6 +236,13 @@ type RawSnapshotNode = {
101
236
  enabled?: boolean;
102
237
  selected?: boolean;
103
238
  focused?: boolean;
239
+ /** Native accessibility facts; absent means unavailable, not false. */
240
+ editable?: boolean;
241
+ password?: boolean;
242
+ hintShowing?: boolean;
243
+ /** Accessibility selection offsets, never a character count or proof of value equality. */
244
+ selectionStart?: number;
245
+ selectionEnd?: number;
104
246
  visibleToUser?: boolean;
105
247
  hittable?: boolean;
106
248
  depth?: number;
@@ -114,6 +256,15 @@ type RawSnapshotNode = {
114
256
  hiddenContentBelow?: boolean;
115
257
  interactionBlocked?: 'covered';
116
258
  presentationHints?: string[];
259
+ /**
260
+ * Backend-minted ref for this node, when the capture backend already assigns a
261
+ * stable, actionable ref (e.g. the web/agent-browser backend resolves actions
262
+ * against its own `@eN` refs). `attachRefs` preserves this instead of re-minting
263
+ * a dense positional ref, so the ref an agent sees in the snapshot is the same
264
+ * ref the backend can resolve on the next action. Absent for backends that do
265
+ * not mint refs — those fall back to dense `e${index}` numbering.
266
+ */
267
+ ref?: string;
117
268
  /**
118
269
  * Accessibility custom actions the element exposes (iOS
119
270
  * `UIAccessibilityCustomAction`, React Native `accessibilityActions`). Merged
@@ -134,22 +285,72 @@ type SnapshotNode = RawSnapshotNode & {
134
285
  inheritsLabel?: true;
135
286
  inheritsIdentifier?: true;
136
287
  };
137
- type SnapshotBackend = 'xctest' | 'android' | 'harmonyos-arkui' | 'macos-helper' | 'linux-atspi' | 'web';
288
+ /**
289
+ * The channel↔producer pairs that can actually occur. One channel is fed by several producers
290
+ * with different guarantees: `xctest` trees come from the local Apple runner, Appium
291
+ * page-source XML, or a limrun element tree, and only the runner's output has been through the
292
+ * runner's presentation (clip fold, effective geometry, scope). Logic that assumes
293
+ * presentation, scope, or geometry guarantees must key on the producer, never on the channel
294
+ * alone.
295
+ *
296
+ * This table is the single owner of both vocabularies: the platform channel
297
+ * (`SnapshotBackend` is its `backend` projection) and the acquisition producer (the third
298
+ * axis beside the channel and the in-plan capture strategy `SnapshotCaptureBackend`). Every
299
+ * carrier embeds the pair atomically — a cross-channel pair does not compile (pinned by
300
+ * snapshot-provenance.test.ts).
301
+ */
302
+ type SnapshotProvenance = {
303
+ backend: 'xctest';
304
+ producer: 'apple-runner' | 'simulator-ax-bridge' | 'appium-source' | 'limrun-ios-tree';
305
+ } | {
306
+ backend: 'android';
307
+ producer: 'android-uiautomator' | 'appium-source';
308
+ } | {
309
+ backend: 'harmonyos-arkui';
310
+ producer: 'harmonyos-uitest';
311
+ } | {
312
+ backend: 'macos-helper';
313
+ producer: 'macos-helper';
314
+ } | {
315
+ backend: 'linux-atspi';
316
+ producer: 'linux-atspi';
317
+ } | {
318
+ backend: 'web';
319
+ producer: 'agent-browser';
320
+ };
321
+ type OptionalProducerProvenance<Pair> = Pair extends {
322
+ backend: infer Backend;
323
+ producer: infer Producer;
324
+ } ? {
325
+ backend: Backend;
326
+ producer?: Producer;
327
+ } : never;
328
+ /**
329
+ * The provenance carrier for {@link SnapshotState}: the producer may be absent (a client-side
330
+ * fallback that rebuilds a state from a bare backend result knows the channel and nothing more),
331
+ * but a present pair still has to come from the {@link SnapshotProvenance} table — the channel
332
+ * may not carry a foreign producer.
333
+ */
334
+ type SnapshotStateProvenance = OptionalProducerProvenance<SnapshotProvenance> | {
335
+ backend?: undefined;
336
+ producer?: undefined;
337
+ };
138
338
  type SnapshotState = {
139
339
  nodes: SnapshotNode[];
140
340
  createdAt: number;
141
341
  truncated?: boolean;
142
- backend?: SnapshotBackend;
143
342
  snapshotQuality?: SnapshotQualityVerdict;
144
343
  comparisonSafe?: boolean;
145
344
  presentationKey?: string;
345
+ /** Opaque equality key for iOS acquisition and presentation lineage. */
346
+ comparisonKey?: string;
146
347
  /**
147
348
  * Android: the capture is an occluding system surface (notification shade, quick settings)
148
349
  * rather than app content. Consumers that surface this tree to the agent must disclose the
149
- * occlusion (see core/android-system-surface-disclosure.ts).
350
+ * occlusion (see `@agent-device/contracts/android-system-surface-disclosure`).
150
351
  */
151
352
  systemSurfaceOnly?: boolean;
152
- };
353
+ } & SnapshotStateProvenance;
153
354
  type SnapshotUnchanged = {
154
355
  ageMs: number;
155
356
  nodeCount: number;
@@ -172,93 +373,11 @@ type ScreenshotOverlayRef = {
172
373
  };
173
374
  declare function centerOfRect(rect: Rect): Point;
174
375
  //#endregion
175
- //#region packages/kernel/src/errors.d.ts
176
- /**
177
- * The known error codes as a value, so gates can enumerate them: every code
178
- * here must resolve a hint through `defaultHintForCode`, and every code
179
- * `retriableForErrorCode` classifies must have a recovery quiz in the help
180
- * benchmark (scripts/__tests__/help-conformance-error-recovery-coverage.test.ts).
181
- * `KnownAppErrorCode` is derived from this array, so a new code cannot be added
182
- * to the type without entering the enumeration.
183
- */
184
- declare const KNOWN_APP_ERROR_CODES: readonly ['INVALID_ARGS', 'DEVICE_NOT_FOUND', 'DEVICE_IN_USE', 'TOOL_MISSING', 'APP_NOT_INSTALLED', 'UNSUPPORTED_PLATFORM', 'UNSUPPORTED_OPERATION', 'NOT_IMPLEMENTED', 'COMMAND_FAILED', 'SESSION_NOT_FOUND', 'UNAUTHORIZED', 'AMBIGUOUS_MATCH', 'REPLAY_DIVERGENCE', 'REPAIR_SESSION_EXPIRED', 'REPAIR_COMMIT_FAILED', 'UNKNOWN'];
185
- type KnownAppErrorCode = (typeof KNOWN_APP_ERROR_CODES)[number];
186
- type AppErrorCode = KnownAppErrorCode | (string & {});
187
- /**
188
- * Details bag for AppError. Free-form context is allowed, but these keys carry
189
- * meaning at normalize/render time and must keep their types:
190
- * - `hint` — overrides `defaultHintForCode`; re-wraps preserve an existing hint.
191
- * - `diagnosticId` / `logPath` — lifted onto the normalized error, stripped from details.
192
- * - `processExitError` + `stdout`/`stderr`/`exitCode` — marks a wrap of a real
193
- * process exit so normalizeError can surface the first meaningful stderr line;
194
- * build these via `execFailureDetails`/`requireExecSuccess` in src/utils/exec.ts
195
- * rather than by hand.
196
- * - `retriable` — typed retry signal hoisted to the wire error shape.
197
- * - `reason` — machine-dispatchable sub-classification within a code.
198
- */
199
- type AppErrorDetails = Record<string, unknown> & {
200
- hint?: string;
201
- diagnosticId?: string;
202
- logPath?: string;
203
- retriable?: boolean;
204
- supportedOn?: string;
205
- processExitError?: boolean;
206
- stdout?: string;
207
- stderr?: string;
208
- exitCode?: number | null;
209
- reason?: string;
210
- };
211
- type NormalizedError = {
212
- code: string;
213
- message: string;
214
- hint?: string;
215
- diagnosticId?: string;
216
- logPath?: string;
217
- /**
218
- * Lifted from `details.retriable` when a throw site classified the failure as
219
- * clearly transient (or clearly not). Included only when set, so the default
220
- * error wire shape is unchanged.
221
- */
222
- retriable?: boolean;
223
- supportedOn?: string;
224
- details?: Record<string, unknown>;
225
- };
226
- /**
227
- * Error payload returned by the daemon transport. It is kept beside the local
228
- * error representation because clients immediately rehydrate this wire shape
229
- * into `AppError` before rendering or handling it.
230
- */
231
- type DaemonError = {
232
- code: string;
233
- message: string;
234
- hint?: string;
235
- diagnosticId?: string;
236
- logPath?: string;
237
- details?: Record<string, unknown>;
238
- /** Additive retry and platform-support signals; absent when not derivable. */
239
- retriable?: boolean;
240
- supportedOn?: string;
241
- };
242
- declare class AppError extends Error {
243
- code: AppErrorCode;
244
- details?: AppErrorDetails;
245
- cause?: unknown;
246
- constructor(code: AppErrorCode, message: string, details?: AppErrorDetails, cause?: unknown);
247
- }
248
- declare function isAgentDeviceError(err: unknown): err is AppError;
249
- declare function normalizeAgentDeviceError(err: unknown, context?: {
250
- diagnosticId?: string;
251
- logPath?: string;
252
- }): NormalizedError;
253
- declare function normalizeError(err: unknown, context?: {
254
- diagnosticId?: string;
255
- logPath?: string;
256
- }): NormalizedError;
257
- declare function defaultHintForCode(code: string): string | undefined;
258
- //#endregion
259
376
  //#region packages/kernel/src/contracts.d.ts
377
+ declare const SESSION_RUNTIME_PLATFORMS: readonly ['ios', 'android', 'harmonyos'];
378
+ type SessionRuntimePlatform = (typeof SESSION_RUNTIME_PLATFORMS)[number];
260
379
  type SessionRuntimeHints = {
261
- platform?: 'ios' | 'android';
380
+ platform?: SessionRuntimePlatform;
262
381
  metroHost?: string;
263
382
  metroPort?: number;
264
383
  bundleUrl?: string;
@@ -283,9 +402,13 @@ type DaemonInstallSource = {
283
402
  } | {
284
403
  artifactName: string;
285
404
  }));
405
+ /** Install sources that can be materialized by a local daemon. */
406
+ type LocalInstallSource = Extract<DaemonInstallSource, {
407
+ kind: 'url' | 'path';
408
+ }>;
286
409
  declare const DAEMON_LOCK_POLICIES: readonly ['reject', 'strip'];
287
410
  type DaemonLockPolicy = (typeof DAEMON_LOCK_POLICIES)[number];
288
- declare const LEASE_BACKENDS: readonly ['ios-simulator', 'ios-instance', 'android-instance'];
411
+ declare const LEASE_BACKENDS: readonly ['ios-simulator', 'ios-instance', 'android-instance', 'harmonyos-instance'];
289
412
  type LeaseBackend = (typeof LEASE_BACKENDS)[number];
290
413
  declare const DAEMON_SERVER_MODES: readonly ['socket', 'http', 'dual'];
291
414
  type DaemonServerMode = (typeof DAEMON_SERVER_MODES)[number];
@@ -333,7 +456,7 @@ type DaemonRequest = {
333
456
  runtime?: SessionRuntimeHints;
334
457
  meta?: DaemonRequestMeta;
335
458
  };
336
- type DaemonArtifactKnownType = 'screenshot' | 'screenshot-diff' | 'screen-recording' | 'screen-recording-chunk' | 'screen-recording-telemetry' | 'trace-log';
459
+ type DaemonArtifactKnownType = 'screenshot' | 'screenshot-diff' | 'screen-recording' | 'screen-recording-chunk' | 'screen-recording-telemetry' | 'trace-log' | 'test-artifacts';
337
460
  type DaemonArtifactType = DaemonArtifactKnownType | (string & {});
338
461
  type DaemonArtifact = {
339
462
  field: string;
@@ -367,4 +490,4 @@ type JsonRpcRequestEnvelope<TParams = unknown> = {
367
490
  params?: TParams;
368
491
  };
369
492
  //#endregion
370
- export { SnapshotNode as A, DeviceTarget as B, normalizeAgentDeviceError as C, Rect as D, RawSnapshotNode as E, SnapshotVisibility as F, PlatformSelector as H, centerOfRect as I, AppleOS as L, SnapshotQualityVerdict as M, SnapshotState as N, ScreenshotOverlayRef as O, SnapshotUnchanged as P, DeviceInfo as R, isAgentDeviceError as S, Point as T, PublicPlatform as U, Platform as V, SessionRuntimeHints as _, DaemonRequest as a, NormalizedError as b, DaemonServerMode as c, JsonRpcRequestEnvelope as d, LeaseBackend as f, SessionIsolationMode as g, ResponseLevel as h, DaemonLockPolicy as i, SnapshotOptions as j, SnapshotBackend 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, AppError as v, normalizeError as w, defaultHintForCode as x, DaemonError as y, DeviceKind as z };
493
+ export { centerOfRect as A, NormalizedError as B, SnapshotNode as C, SnapshotState as D, SnapshotQualityVerdict as E, Platform as F, isAgentDeviceError as H, PlatformSelector as I, PublicPlatform as L, DeviceInfo as M, DeviceKind as N, SnapshotUnchanged as O, DeviceTarget as P, AppError as R, ScreenshotOverlayRef as S, SnapshotProvenance as T, normalizeAgentDeviceError as U, defaultHintForCode as V, normalizeError 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, AppleOS as j, SnapshotVisibility 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, SnapshotOptions as w, Rect as x, Point as y, DaemonError 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:()=>_,defaultHintForCode:()=>j,isAgentDeviceError:()=>v,normalizeAgentDeviceError:()=>y,normalizeError:()=>b,retriableForErrorCode:()=>A,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,retriable:e.retriable,supportedOn:e.supportedOn})}function _(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 v(e){return e instanceof h}function y(e,t={}){return b(e,t)}function b(e,t={}){let n=_(e),r=n.details?a(n.details):void 0,i=T(r,`diagnosticId`)??t.diagnosticId,o=T(r,`logPath`)??t.logPath,s=T(r,`hint`)??j(n.code),c=E(r,`retriable`)??A(n.code),l=T(r,`supportedOn`),u=D(r),d=ee(n.code,n.message,r);return{code:n.code,message:d,hint:s,diagnosticId:i,logPath:o,...c===void 0?{}:{retriable:c},...l===void 0?{}:{supportedOn:l},details:u}}const x=/^\S+ exited with code -?\d+$/;function ee(e,t,n){if(e!==`COMMAND_FAILED`||n?.processExitError!==!0)return t;let r=w(typeof n?.stderr==`string`?n.stderr:``);return r?x.test(t)?r:t.includes(r)?t:`${t}: ${r}`:t}const S=[/^an error was encountered processing the command/i,/^underlying error\b/i,/^simulator device failed to complete the requested operation/i],C=/^(?:(?:adb|xcrun|simctl):\s*)?(?:error:\s*)?/i;function w(e){for(let t of e.split(`
2
- `)){let e=t.trim();if(!e||S.some(t=>t.test(e)))continue;let n=e.replace(C,``).trim();if(n)return n.length>200?`${n.slice(0,200)}...`:n}return null}function T(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function E(e,t){let n=e?.[t];return typeof n==`boolean`?n:void 0}function D(e){if(!e)return;let t={...e};return delete t.hint,delete t.diagnosticId,delete t.logPath,delete t.retriable,delete t.supportedOn,Object.keys(t).length>0?t:void 0}const O={DEVICE_IN_USE:!0};function k(e){return p.includes(e)}function A(e){return k(e)?O[e]:void 0}function j(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 M(e){return e===`xctest`||e===`android`||e===`harmonyos-arkui`||e===`macos-helper`||e===`linux-atspi`||e===`web`}function N(e){return e===void 0||e===`xctest`||e===`android`||e===`harmonyos-arkui`}function P(e){return e.map((e,t)=>({...e,ref:`e${t+1}`}))}const F=/^~s(\d+)$/,I=`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 L(e){let t=e.trim(),n=t.indexOf(`~`);if(n===-1)return{base:t};let r=F.exec(t.slice(n));return!r||n===0?null:{base:t.slice(0,n),generation:Number(r[1])}}function R(e){let t=L(e);if(!t)return null;let n=t.base;return n.startsWith(`@`)?n.slice(1)||null:n.startsWith(`e`)?n:null}function z(e,t){return e.find(e=>e.ref===t)??null}function B(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 V(e){if(e)return{depth:e.snapshotDepth,interactiveOnly:e.snapshotInteractiveOnly,raw:e.snapshotRaw,scope:e.snapshotScope,customActions:e.snapshotCustomActions}}function H(e){return{x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)}}const U=[`summary`,`headers`,`body`,`all`],W=[`digest`,`default`,`full`];function G(e){return e!==void 0&&e!=="default"}function K(e){return{parse(t){return e(t,`$`)}}}function q(e,t){throw Error(`${e}: ${t}`)}function J(e,t){return(!e||typeof e!=`object`||Array.isArray(e))&&q(t,`Expected an object`),e}function Y(e,t){return typeof e!=`string`&&q(t,`Expected a string`),e}function X(e,t){return Number.isInteger(e)||q(t,`Expected an integer`),e}function Z(e,t){return Array.isArray(e)||q(t,`Expected an array`),e}function Q(e,t,n){let r=e[t];return r===void 0?void 0:Y(r,`${n}.${t}`)}function te(e,t,n){let r=e[t];if(r!==void 0)return Z(r,`${n}.${t}`).map((e,r)=>Y(e,`${n}.${t}[${String(r)}]`))}function ne(e,t,n){let r=e[t];return r===void 0?void 0:X(r,`${n}.${t}`)}function $(e,t,n){let r=e[t];return r===void 0?void 0:J(r,`${n}.${t}`)}function re(e,t,n,r){let i=e[t];if(i!==void 0)return(typeof i!=`string`||!n.includes(i))&&q(`${r}.${t}`,`Expected one of: ${n.join(`, `)}`),i}const ie=K((e,t)=>{let n=J(e,t);return{platform:re(n,`platform`,[`ios`,`android`],t),metroHost:Q(n,`metroHost`,t),metroPort:ne(n,`metroPort`,t),bundleUrl:Q(n,`bundleUrl`,t),launchUrl:Q(n,`launchUrl`,t)}});function ae(e,t){let n=e.id;return n==null||typeof n!=`string`&&typeof n!=`number`&&q(`${t}.id`,`Expected a string, number, or null`),n}const oe=K((e,t)=>{let n=J(e,t);return{jsonrpc:Q(n,`jsonrpc`,t),id:ae(n,t),method:Q(n,`method`,t),params:n.params}}),se=K((e,t)=>{let n=J(e,t);return{token:Q(n,`token`,t),session:Q(n,`session`,t),command:Q(n,`command`,t),positionals:te(n,`positionals`,t),input:$(n,`input`,t),flags:$(n,`flags`,t),runtime:$(n,`runtime`,t),meta:$(n,`meta`,t)}});export{b as C,a as D,m as E,y as S,g as T,h as _,G as a,f as b,P as c,z as d,M as f,N as g,L as h,ie as i,B as l,V as m,W as n,oe as o,R as p,se as r,I as s,U as t,H as u,_ as v,A as w,v as x,j as 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=ie(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],j=/^(?:(?:adb|xcrun|simctl):\s*)?(?:error:\s*)?/i;function ie(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(j,``).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.`}}function I(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 L(e){return e===`xctest`||e===`android`||e===`harmonyos-arkui`||e===`macos-helper`||e===`linux-atspi`||e===`web`}function R(e){return e===void 0||e===`xctest`||e===`android`||e===`harmonyos-arkui`}function z(e){return e.map((e,t)=>({...e,ref:e.ref??`e${t+1}`}))}const B=/^~s(\d+)$/,V=`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 H(e){let t=e.trim(),n=t.indexOf(`~`);if(n===-1)return{base:t};let r=B.exec(t.slice(n));return!r||n===0?null:{base:t.slice(0,n),generation:Number(r[1])}}function U(e){let t=H(e);if(!t)return null;let n=t.base;return n.startsWith(`@`)?n.slice(1)||null:n.startsWith(`e`)?n:null}function W(e,t){return e.find(e=>e.ref===t)??null}function G(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 le(e){if(e)return{depth:e.snapshotDepth,interactiveOnly:e.snapshotInteractiveOnly,raw:e.snapshotRaw,scope:e.snapshotScope,customActions:e.snapshotCustomActions}}function ue(e){return{x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)}}const K=[`ios`,`android`,`harmonyos`];function de(e){return K.some(t=>t===e)}const fe=[`summary`,`headers`,`body`,`all`],pe=[`digest`,`default`,`full`];function me(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 he(e,t){return Number.isInteger(e)||J(t,`Expected an integer`),e}function ge(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 _e(e,t,n){let r=e[t];if(r!==void 0)return ge(r,`${n}.${t}`).map((e,r)=>X(e,`${n}.${t}[${String(r)}]`))}function Q(e,t,n){let r=e[t];return r===void 0?void 0:he(r,`${n}.${t}`)}function $(e,t,n){let r=e[t];return r===void 0?void 0:Y(r,`${n}.${t}`)}function ve(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 ye=q((e,t)=>{let n=Y(e,t);return{platform:ve(n,`platform`,K,t),metroHost:Z(n,`metroHost`,t),metroPort:Q(n,`metroPort`,t),bundleUrl:Z(n,`bundleUrl`,t),launchUrl:Z(n,`launchUrl`,t)}});function be(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 xe=q((e,t)=>{let n=Y(e,t);return{jsonrpc:Z(n,`jsonrpc`,t),id:be(n,t),method:Z(n,`method`,t),params:n.params}}),Se=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:_e(n,`positionals`,t),input:$(n,`input`,t),flags:$(n,`flags`,t),runtime:$(n,`runtime`,t),meta:$(n,`meta`,t)}});export{v as A,E as C,k as D,T as E,a as F,o as I,P as M,x as N,A as O,g as P,F as S,O as T,H as _,me as a,D as b,V as c,ue as d,W as f,I as g,le as h,ye as i,_ as j,N as k,z as l,U as m,pe as n,de as o,L as p,Se as r,xe as s,fe as t,G as u,R as v,m as w,w as x,b as y};
@@ -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{y 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 { A as SnapshotNode } from "./sdk-contracts.js";
1
+ import { C 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{pn 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{y 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 { I as PlatformSelector, P as DeviceTarget, _ 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{y 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};