agent-device 0.21.30 → 0.21.31

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 (304) hide show
  1. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.30.apk → agent-device-android-ime-helper-0.21.31.apk} +0 -0
  2. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.31.apk.sha256 +1 -0
  3. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.30.manifest.json → agent-device-android-ime-helper-0.21.31.manifest.json} +4 -4
  4. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.31.apk +0 -0
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.31.apk.sha256 +1 -0
  6. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.30.manifest.json → agent-device-android-snapshot-helper-0.21.31.manifest.json} +7 -7
  7. package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/BackgroundInteraction.swift +20 -6
  8. package/apple/snapshot-bridge/README.md +16 -3
  9. package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +33 -1
  10. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +110 -8
  11. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAppScreenCapture.swift +20 -0
  12. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +4 -4
  13. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +1 -1
  14. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +30 -4
  15. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +14 -4
  16. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +81 -41
  17. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +40 -6
  18. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotAcquisition.swift +5 -0
  19. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +74 -10
  20. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTiming.swift +33 -4
  21. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedCommitDeadline.swift +2 -2
  22. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +23 -2
  23. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedInteraction.swift +158 -6
  24. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +165 -70
  25. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryConfirmation.swift +2 -3
  26. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +49 -27
  27. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryReadiness.swift +17 -9
  28. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputProbe.swift +30 -28
  29. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +87 -87
  30. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +4 -3
  31. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.h +13 -0
  32. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.m +45 -0
  33. package/dist/src/absence-observation-errors.js +1 -1
  34. package/dist/src/adapter.js +1 -1
  35. package/dist/src/adb-executor.js +1 -1
  36. package/dist/src/adb-failure.js +2 -2
  37. package/dist/src/agent-browser-lifecycle.js +1 -1
  38. package/dist/src/agent-browser-process-record.js +1 -1
  39. package/dist/src/agent-browser-provider.js +1 -1
  40. package/dist/src/agent-browser-tool.js +1 -1
  41. package/dist/src/agent-device-client.js +1 -1
  42. package/dist/src/alert-tree-driver.js +1 -1
  43. package/dist/src/alert.js +1 -1
  44. package/dist/src/alert2.js +1 -1
  45. package/dist/src/android.js +1 -1
  46. package/dist/src/app-backend.js +1 -1
  47. package/dist/src/app-launch.js +1 -1
  48. package/dist/src/app-lifecycle.js +4 -4
  49. package/dist/src/app-log-runtime2.js +3 -3
  50. package/dist/src/app-log-session-resource.js +1 -1
  51. package/dist/src/app-resolution-facade.js +1 -1
  52. package/dist/src/app-resolution.js +2 -2
  53. package/dist/src/apple-runner-platform.js +1 -1
  54. package/dist/src/application-lifecycle-interaction.js +1 -1
  55. package/dist/src/artifact-tracking.js +1 -1
  56. package/dist/src/automation-helper-artifact.js +1 -1
  57. package/dist/src/automation-helper.js +1 -1
  58. package/dist/src/back-mode.js +1 -1
  59. package/dist/src/boot-diagnostics.js +1 -1
  60. package/dist/src/browser-launch.js +1 -1
  61. package/dist/src/cli-config.js +1 -1
  62. package/dist/src/cli-help.js +35 -29
  63. package/dist/src/cli-runner.js +1 -1
  64. package/dist/src/cli.js +3 -3
  65. package/dist/src/client-metro-companion.js +1 -1
  66. package/dist/src/client-metro.js +1 -1
  67. package/dist/src/client-types.d.ts +3 -3
  68. package/dist/src/cloud-artifacts.d.ts +5 -4
  69. package/dist/src/code-signature-cache.js +1 -1
  70. package/dist/src/command-metadata.js +10 -10
  71. package/dist/src/command-tools.js +2 -2
  72. package/dist/src/command.js +1 -1
  73. package/dist/src/composed-inventory-gateways.js +1 -1
  74. package/dist/src/connection-runtime.js +1 -1
  75. package/dist/src/connection.js +5 -5
  76. package/dist/src/contracts.js +1 -1
  77. package/dist/src/daemon-client-ensure.js +1 -1
  78. package/dist/src/daemon-client-lease-beat.js +1 -1
  79. package/dist/src/daemon-client-lifecycle.js +1 -1
  80. package/dist/src/daemon-client-liveness-probe.js +1 -1
  81. package/dist/src/daemon-client.js +1 -1
  82. package/dist/src/daemon-command-registry.js +1 -1
  83. package/dist/src/daemon-composition.js +1 -1
  84. package/dist/src/daemon-policy-file.js +1 -1
  85. package/dist/src/daemon-registration-owner.js +3 -3
  86. package/dist/src/daemon-resolution.js +1 -1
  87. package/dist/src/daemon-startup-diagnostics.js +1 -1
  88. package/dist/src/debug-symbols-facade.js +3 -3
  89. package/dist/src/device-claim-recovery.js +1 -1
  90. package/dist/src/device-claims.js +1 -1
  91. package/dist/src/device-inventory-context.js +1 -1
  92. package/dist/src/device-readiness-runtime.js +1 -1
  93. package/dist/src/device-selection-resolver.js +1 -1
  94. package/dist/src/device.js +1 -1
  95. package/dist/src/devicectl.js +1 -1
  96. package/dist/src/diagnostics.js +1 -1
  97. package/dist/src/display-inventory.js +1 -1
  98. package/dist/src/doctor-facade.js +1 -1
  99. package/dist/src/durable-capture-resource.js +1 -1
  100. package/dist/src/durable-resource.js +1 -1
  101. package/dist/src/engine-eval-script.js +1 -1
  102. package/dist/src/error.js +1 -1
  103. package/dist/src/explicit-session-resolution.js +1 -1
  104. package/dist/src/expo-dev-client-launch.js +1 -1
  105. package/dist/src/file.js +1 -1
  106. package/dist/src/find.js +1 -1
  107. package/dist/src/finders.js +1 -1
  108. package/dist/src/gesture-admission.js +1 -1
  109. package/dist/src/gesture-plan.js +1 -1
  110. package/dist/src/gesture-runtime.js +1 -1
  111. package/dist/src/hdc.js +1 -1
  112. package/dist/src/helper.js +2 -2
  113. package/dist/src/host.js +1 -1
  114. package/dist/src/host2.js +1 -1
  115. package/dist/src/host3.js +1 -1
  116. package/dist/src/host4.js +1 -1
  117. package/dist/src/host5.js +1 -0
  118. package/dist/src/human-control.js +1 -1
  119. package/dist/src/ime-rebind.js +1 -1
  120. package/dist/src/ime-state.js +1 -1
  121. package/dist/src/index.js +1 -1
  122. package/dist/src/input-actions.js +1 -1
  123. package/dist/src/input-actions2.js +1 -1
  124. package/dist/src/install-source-network-transport.js +1 -1
  125. package/dist/src/install-source2.js +1 -1
  126. package/dist/src/interaction-positionals.js +1 -1
  127. package/dist/src/interaction.js +1 -1
  128. package/dist/src/interaction2.js +1 -1
  129. package/dist/src/interactor-operation-catalog.js +1 -1
  130. package/dist/src/interactor.js +5 -5
  131. package/dist/src/interactor2.js +1 -1
  132. package/dist/src/interactor3.js +1 -1
  133. package/dist/src/interactor4.js +1 -1
  134. package/dist/src/interactor5.js +1 -1
  135. package/dist/src/interactors.js +1 -1
  136. package/dist/src/internal/bin.js +1 -1
  137. package/dist/src/internal/daemon.js +1 -1
  138. package/dist/src/internal/png-worker.js +1 -1
  139. package/dist/src/inventory.js +1 -1
  140. package/dist/src/inventory2.js +1 -1
  141. package/dist/src/inventory6.js +1 -1
  142. package/dist/src/ios-node-interpretation.js +1 -1
  143. package/dist/src/ios-settings.js +1 -1
  144. package/dist/src/ios-snapshot-acquisition.js +1 -1
  145. package/dist/src/ios-snapshot-engine.js +1 -1
  146. package/dist/src/ios-snapshot-runtime.js +1 -1
  147. package/dist/src/keyboard-occlusion.js +1 -1
  148. package/dist/src/keyed-lock.js +1 -1
  149. package/dist/src/launch-confirmation.js +1 -1
  150. package/dist/src/launch-services-registration.js +4 -4
  151. package/dist/src/lease.js +1 -1
  152. package/dist/src/legacy.js +1 -1
  153. package/dist/src/limrun-runtime-dependencies.js +1 -1
  154. package/dist/src/local-interactor-operation-set.js +1 -1
  155. package/dist/src/mechanics.js +12 -12
  156. package/dist/src/mobile-snapshot-semantics.js +1 -1
  157. package/dist/src/observability.js +1 -1
  158. package/dist/src/output-path.js +1 -1
  159. package/dist/src/parameterized-recorded-fill.js +1 -1
  160. package/dist/src/perf-facade.js +1 -1
  161. package/dist/src/perf-runtime-operation-builder.js +1 -1
  162. package/dist/src/perf-target.js +1 -1
  163. package/dist/src/physical-device-control.js +1 -1
  164. package/dist/src/platform-runtime-android-adb-host.js +1 -1
  165. package/dist/src/platform-runtime-claim-recovery.js +1 -1
  166. package/dist/src/platform-runtime-daemon-services.js +1 -1
  167. package/dist/src/platform-runtime-host.js +1 -1
  168. package/dist/src/platform-runtime-open-target.js +1 -1
  169. package/dist/src/platform-runtime-operation-host.js +5 -5
  170. package/dist/src/platform-runtime-runtime-hints.js +2 -2
  171. package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
  172. package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
  173. package/dist/src/platform-runtime-unavailable.js +1 -1
  174. package/dist/src/platform-runtime.js +1 -1
  175. package/dist/src/platform-runtime2.js +1 -1
  176. package/dist/src/png-resize.js +1 -1
  177. package/dist/src/png-worker-client.js +1 -1
  178. package/dist/src/process-exit.js +1 -1
  179. package/dist/src/provider-device-runtime.d.ts +28 -0
  180. package/dist/src/provider-plugin-catalog.js +2 -0
  181. package/dist/src/provider-plugin.d.ts +1 -1
  182. package/dist/src/provider-webdriver.js +1 -1
  183. package/dist/src/proxy.js +1 -1
  184. package/dist/src/react-native-overlay2.js +1 -1
  185. package/dist/src/react-native.js +1 -1
  186. package/dist/src/react-profile-command.js +1 -1
  187. package/dist/src/record-runtime.js +1 -1
  188. package/dist/src/record-trace.js +1 -1
  189. package/dist/src/recording-scope.js +1 -1
  190. package/dist/src/recording.js +1 -1
  191. package/dist/src/registry.js +1 -1
  192. package/dist/src/remote-config-core.js +1 -1
  193. package/dist/src/replay-backend-host.js +1 -1
  194. package/dist/src/replay-divergence.js +1 -1
  195. package/dist/src/replay-maestro-backend.js +3 -3
  196. package/dist/src/replay-script-selection.js +1 -1
  197. package/dist/src/replay2.js +1 -1
  198. package/dist/src/request-runtime-binding.js +1 -1
  199. package/dist/src/request.js +1 -1
  200. package/dist/src/result-serialization.js +1 -1
  201. package/dist/src/retry.js +1 -1
  202. package/dist/src/runner-cache-retention.js +1 -1
  203. package/dist/src/runner-client.js +1 -1
  204. package/dist/src/runner-dev-tools-security.js +1 -1
  205. package/dist/src/runner-device-readiness.js +1 -1
  206. package/dist/src/runner-device-set.js +1 -1
  207. package/dist/src/runner-error-classification.js +2 -2
  208. package/dist/src/runner-exchange.js +1 -1
  209. package/dist/src/runner-lease.js +1 -1
  210. package/dist/src/runner-operations-facade.js +1 -1
  211. package/dist/src/runner-retention.js +1 -1
  212. package/dist/src/runner-selector-query.js +1 -1
  213. package/dist/src/runner-start-budget.js +1 -1
  214. package/dist/src/runner-startup-transport.js +1 -1
  215. package/dist/src/runner-toolchain-probe.js +1 -1
  216. package/dist/src/runner.js +2 -2
  217. package/dist/src/runtime-admission.js +1 -1
  218. package/dist/src/runtime-deployment.js +1 -1
  219. package/dist/src/runtime-factory.js +1 -1
  220. package/dist/src/runtime-session.js +1 -1
  221. package/dist/src/runtime.js +4 -4
  222. package/dist/src/runtime10.js +2 -2
  223. package/dist/src/runtime2.js +1 -1
  224. package/dist/src/runtime3.js +5 -5
  225. package/dist/src/runtime4.js +1 -1
  226. package/dist/src/runtime5.js +1 -1
  227. package/dist/src/runtime6.js +1 -1
  228. package/dist/src/runtime7.js +1 -1
  229. package/dist/src/runtime8.js +1 -1
  230. package/dist/src/runtime9.js +2 -2
  231. package/dist/src/screen-recording-transport.js +1 -1
  232. package/dist/src/screenshot-density.js +1 -1
  233. package/dist/src/screenshot-runtime.js +1 -1
  234. package/dist/src/screenshot3.js +1 -1
  235. package/dist/src/sdk-batch-runner.js +2 -2
  236. package/dist/src/sdk-batch.js +2 -2
  237. package/dist/src/sdk-contracts.d.ts +9 -0
  238. package/dist/src/sdk-contracts.js +2 -2
  239. package/dist/src/sdk-device.js +1 -1
  240. package/dist/src/sdk-finders.js +1 -1
  241. package/dist/src/sdk-io.js +5 -5
  242. package/dist/src/sdk-remote-config.js +1 -1
  243. package/dist/src/sdk-selectors.js +1 -1
  244. package/dist/src/selection.js +0 -0
  245. package/dist/src/selector-pipeline-policy.js +1 -1
  246. package/dist/src/selector-runtime.js +1 -1
  247. package/dist/src/selectors.js +1 -1
  248. package/dist/src/server-startup.js +1 -1
  249. package/dist/src/session-paths.js +1 -1
  250. package/dist/src/session-replay-vars.js +1 -1
  251. package/dist/src/session-runtime.js +1 -1
  252. package/dist/src/session-store.js +3 -3
  253. package/dist/src/session.js +1 -1
  254. package/dist/src/session2.js +5 -5
  255. package/dist/src/settings-bluetooth.js +1 -1
  256. package/dist/src/settings.js +1 -1
  257. package/dist/src/settings2.js +1 -1
  258. package/dist/src/settle-observation-capture.js +1 -1
  259. package/dist/src/simctl-settings.js +1 -1
  260. package/dist/src/simctl.js +1 -1
  261. package/dist/src/simulator-boot.js +1 -1
  262. package/dist/src/simulator-state.js +1 -1
  263. package/dist/src/simulator.js +1 -1
  264. package/dist/src/snapshot-chrome.js +1 -1
  265. package/dist/src/snapshot-desktop-projection.js +1 -1
  266. package/dist/src/snapshot-helper-install.js +6 -6
  267. package/dist/src/snapshot-node-lookup.js +1 -1
  268. package/dist/src/snapshot-occlusion.js +1 -1
  269. package/dist/src/snapshot-runtime-binding.js +1 -1
  270. package/dist/src/snapshot-runtime-capture-input.js +1 -1
  271. package/dist/src/snapshot-runtime.js +1 -1
  272. package/dist/src/snapshot-state.js +1 -1
  273. package/dist/src/snapshot.js +1 -1
  274. package/dist/src/snapshot3.js +1 -1
  275. package/dist/src/src.js +1 -1
  276. package/dist/src/src3.js +1 -1
  277. package/dist/src/src4.js +1 -1
  278. package/dist/src/store.js +1 -1
  279. package/dist/src/tap-keyboard-occlusion.js +1 -1
  280. package/dist/src/target-evidence-tree.js +1 -1
  281. package/dist/src/target-evidence.js +1 -1
  282. package/dist/src/telephony-runtime.js +1 -1
  283. package/dist/src/text-entry-focus.js +1 -1
  284. package/dist/src/tool-provider.js +3 -3
  285. package/dist/src/tool-provider2.js +1 -1
  286. package/dist/src/tool-provider3.js +1 -1
  287. package/dist/src/toolchain-probe.js +1 -1
  288. package/dist/src/touch-reference-frame.js +1 -1
  289. package/dist/src/touch-runtime.js +1 -1
  290. package/dist/src/touch-runtime2.js +1 -1
  291. package/dist/src/tree.js +1 -1
  292. package/dist/src/tv-remote-runtime.js +1 -1
  293. package/dist/src/tv-remote.js +2 -2
  294. package/dist/src/type-text-runtime.js +1 -1
  295. package/dist/src/update-check.js +1 -1
  296. package/dist/src/vega-executable.js +1 -1
  297. package/dist/src/video.js +1 -1
  298. package/dist/src/webdriver-source.js +1 -1
  299. package/package.json +7 -6
  300. package/server.json +2 -2
  301. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.30.apk.sha256 +0 -1
  302. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.30.apk +0 -0
  303. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.30.apk.sha256 +0 -1
  304. package/dist/src/physical-device-apps.js +0 -1
@@ -1 +1 @@
1
- import{R as e,et as t}from"./sdk-contracts.js";import{v as n}from"./sdk-batch-runner.js";import{t as r}from"./plugin-inventory.js";import{c as i,o as a,s as o}from"./store.js";import{isProviderId as s}from"./discovery.js";import{t as c}from"./host3.js";function l(e){let n=t(e),r=n.details?.reason;return{code:n.code,message:n.message,...typeof r==`string`?{reason:r}:{},...n.hint?{hint:n.hint}:{}}}function u(t){if(!n(t))throw h(`Plugin factory must return a plugin object`);if(t.apiVersion!==2)throw new e(`INVALID_ARGS`,`Plugin does not declare a compatible provider contract`,{reason:`incompatible_plugin`,apiVersion:2,hint:`Install a plugin release supporting provider plugin apiVersion 2.`});if(!s(t.provider))throw h(`Plugin provider must be a lowercase id such as "example"`);if(a.includes(t.provider))throw new e(`INVALID_ARGS`,`Provider id is reserved for routing: ${t.provider}`,{reason:`reserved_provider`,provider:t.provider});if(d(t.credentials),t.connection!==void 0&&f(t.connection),typeof t.setup!=`function`)throw h(`Plugin must provide setup(host)`);return t}function d(e){if(!n(e)||!Array.isArray(e.variables))throw h(`Plugin credentials must declare variables`);if(o(e.variables),e.byBackend!==void 0){if(!n(e.byBackend))throw h(`Plugin credentials byBackend must map a lease backend to variables`);for(let t of Object.values(e.byBackend)){if(!Array.isArray(t))throw h(`Plugin credentials byBackend must map a lease backend to variables`);o(t)}}}function f(e){if(!n(e)||e.capabilities===void 0||typeof e.resolve!=`function`||typeof e.verify!=`function`)throw h(`Plugin connection must provide capabilities, resolve and verify`);i(e.capabilities)}function p(e,t,n){let r=n?.owner;if(t?.provider!==e||typeof t.shutdown!=`function`||!m(t)||r?.kind!==`provider-runtime`||r.provider!==e||typeof r.instance!=`string`||r.instance.trim().length===0||typeof n?.loadRuntime!=`function`)throw h(`Plugin runtime owner does not match its provider: ${e}`)}function m(e){return e.leaseLifecycle!==null&&typeof e.leaseLifecycle==`object`&&[`ownsDevice`,`getInteractor`,`deviceInventoryProvider`].every(t=>typeof e[t]==`function`)}function h(t){return new e(`INVALID_ARGS`,t,{reason:`invalid_plugin`})}function g(e){return e.map(e=>({source:`builtin`,provider:e,dormant:!0,load:()=>void 0}))}async function _(t){let n=[],r=new Set;for(let i of t){let t={candidate:i,provider:i.provider};if(n.push(t),i.dormant){i.provider!==void 0&&r.add(i.provider);continue}try{let e=await i.load();t.provider=E(e)??i.provider,t.plugin=u(e)}catch(e){t.failure=w(e,`plugin_load_failed`)}t.provider===void 0||a.includes(t.provider)||(r.has(t.provider)?(t.plugin=void 0,t.failure??=new e(`INVALID_ARGS`,`Duplicate provider plugin: ${t.provider}`,{reason:`duplicate_provider`,provider:t.provider})):r.add(t.provider))}return Object.freeze({connections:new Map(n.flatMap(({plugin:e,candidate:t})=>e?.connection?[[e.provider,y(e.connection,t.hostOptions)]]:[])),claimedProviders:[...r],inventory:()=>n.flatMap(T),slots:n})}async function v(e,t,n){for(let r of e.slots)if(!(!r.plugin||r.failure!==void 0))try{await b(r,r.plugin,t,n)}catch(e){r.failure=w(e,`plugin_setup_failed`),r.registration=void 0}let r=e.slots.flatMap(({registration:e})=>e?[e]:[]);return Object.freeze({registrations:r,claimedProviders:e.claimedProviders,inventory:e.inventory(),close:k(async()=>await Promise.all(r.map(D)))})}function y(e,t){return{capabilities:e.capabilities,resolve:n=>e.resolve({...n,host:c(n.env,t)}),verify:n=>e.verify({...n,host:c(n.env,t)})}}async function b(e,t,n,r){let i=c(n,e.candidate.hostOptions),a=await t.setup(i);try{let{runtime:n,platformModule:o}=await x(t,a,i.clientVersion,r),s=a.dispose?.bind(a);e.registration={provider:t.provider,source:e.candidate.source,runtime:n,platformModule:o,...s?{dispose:s}:{}}}catch(e){throw await C(a),e}}async function x(e,t,r,i){if(!n(t))throw h(`Plugin setup must return a runtime: ${e.provider}`);if(S(t)){if(t.webDriver?.provider!==e.provider)throw h(`WebDriver plugin provider does not match its declaration: ${e.provider}`);return await i.adaptWebDriver(t.webDriver,{clientVersion:r})}let{runtime:a,platformModule:o}=t;return p(e.provider,a,o),{runtime:a,platformModule:o}}function S(e){return`webDriver`in e}async function C(e){if(!n(e))return;let t=e.runtime;try{typeof t?.shutdown==`function`&&await t.shutdown()}catch{}try{typeof e.dispose==`function`&&await e.dispose()}catch{}}function w(t,n){return t instanceof e?typeof t.details?.reason==`string`?t:new e(t.code,t.message,{...t.details,reason:n},t):new e(`COMMAND_FAILED`,t instanceof Error?t.message:String(t),{reason:n},t)}function T(e){let{candidate:t,plugin:n}=e;if(t.dormant)return[];let i={...e.provider===void 0?{}:{provider:e.provider},source:t.source,...t.package===void 0?{}:{package:t.package},...t.version===void 0?{}:{version:t.version}};return e.failure!==void 0||!n?[{...i,state:`failed`,error:l(e.failure),credentials:r}]:[{...i,state:`active`,credentials:{variables:[...n.credentials.variables],byBackend:Object.fromEntries(Object.entries(n.credentials.byBackend??{}).map(([e,t])=>[e,[...t]]))}}]}function E(e){return n(e)&&s(e.provider)?e.provider:void 0}async function D({provider:e,source:t,runtime:n,dispose:r}){return{provider:e,source:t,shutdown:await O(async()=>await n.shutdown()),dispose:await O(async()=>await r?.())}}async function O(e){try{return await e(),{status:`ok`}}catch(e){return{status:`failed`,error:l(e)}}}function k(e){let t;return()=>t??=e()}export{g as claimProviderIds,_ as resolveProviderPlugins,v as startProviderRegistry};
1
+ import{R as e,tt as t}from"./sdk-contracts.js";import{v as n}from"./sdk-batch-runner.js";import{t as r}from"./plugin-inventory.js";import{c as i,o as a,s as o}from"./store.js";import{isProviderId as s}from"./discovery.js";import{t as c}from"./host4.js";function l(e){let n=t(e),r=n.details?.reason;return{code:n.code,message:n.message,...typeof r==`string`?{reason:r}:{},...n.hint?{hint:n.hint}:{}}}function u(t){if(!n(t))throw h(`Plugin factory must return a plugin object`);if(t.apiVersion!==2)throw new e(`INVALID_ARGS`,`Plugin does not declare a compatible provider contract`,{reason:`incompatible_plugin`,apiVersion:2,hint:`Install a plugin release supporting provider plugin apiVersion 2.`});if(!s(t.provider))throw h(`Plugin provider must be a lowercase id such as "example"`);if(a.includes(t.provider))throw new e(`INVALID_ARGS`,`Provider id is reserved for routing: ${t.provider}`,{reason:`reserved_provider`,provider:t.provider});if(d(t.credentials),t.connection!==void 0&&f(t.connection),typeof t.setup!=`function`)throw h(`Plugin must provide setup(host)`);return t}function d(e){if(!n(e)||!Array.isArray(e.variables))throw h(`Plugin credentials must declare variables`);if(o(e.variables),e.byBackend!==void 0){if(!n(e.byBackend))throw h(`Plugin credentials byBackend must map a lease backend to variables`);for(let t of Object.values(e.byBackend)){if(!Array.isArray(t))throw h(`Plugin credentials byBackend must map a lease backend to variables`);o(t)}}}function f(e){if(!n(e)||e.capabilities===void 0||typeof e.resolve!=`function`||typeof e.verify!=`function`)throw h(`Plugin connection must provide capabilities, resolve and verify`);i(e.capabilities)}function p(e,t,n){let r=n?.owner;if(t?.provider!==e||typeof t.shutdown!=`function`||!m(t)||r?.kind!==`provider-runtime`||r.provider!==e||typeof r.instance!=`string`||r.instance.trim().length===0||typeof n?.loadRuntime!=`function`)throw h(`Plugin runtime owner does not match its provider: ${e}`)}function m(e){return e.leaseLifecycle!==null&&typeof e.leaseLifecycle==`object`&&[`ownsDevice`,`getInteractor`,`deviceInventoryProvider`].every(t=>typeof e[t]==`function`)}function h(t){return new e(`INVALID_ARGS`,t,{reason:`invalid_plugin`})}function g(e){return e.map(e=>({source:`builtin`,provider:e,dormant:!0,load:()=>void 0}))}async function _(t){let n=[],r=new Set;for(let i of t){let t={candidate:i,provider:i.provider};if(n.push(t),i.dormant){i.provider!==void 0&&r.add(i.provider);continue}try{let e=await i.load();t.provider=E(e)??i.provider,t.plugin=u(e)}catch(e){t.failure=w(e,`plugin_load_failed`)}t.provider===void 0||a.includes(t.provider)||(r.has(t.provider)?(t.plugin=void 0,t.failure??=new e(`INVALID_ARGS`,`Duplicate provider plugin: ${t.provider}`,{reason:`duplicate_provider`,provider:t.provider})):r.add(t.provider))}return Object.freeze({connections:new Map(n.flatMap(({plugin:e,candidate:t})=>e?.connection?[[e.provider,y(e.connection,t.hostOptions)]]:[])),claimedProviders:[...r],inventory:()=>n.flatMap(T),slots:n})}async function v(e,t,n){for(let r of e.slots)if(!(!r.plugin||r.failure!==void 0))try{await b(r,r.plugin,t,n)}catch(e){r.failure=w(e,`plugin_setup_failed`),r.registration=void 0}let r=e.slots.flatMap(({registration:e})=>e?[e]:[]);return Object.freeze({registrations:r,claimedProviders:e.claimedProviders,inventory:e.inventory(),close:k(async()=>await Promise.all(r.map(D)))})}function y(e,t){return{capabilities:e.capabilities,resolve:n=>e.resolve({...n,host:c(n.env,t)}),verify:n=>e.verify({...n,host:c(n.env,t)})}}async function b(e,t,n,r){let i=c(n,e.candidate.hostOptions),a=await t.setup(i);try{let{runtime:n,platformModule:o}=await x(t,a,i.clientVersion,r),s=a.dispose?.bind(a);e.registration={provider:t.provider,source:e.candidate.source,runtime:n,platformModule:o,...s?{dispose:s}:{}}}catch(e){throw await C(a),e}}async function x(e,t,r,i){if(!n(t))throw h(`Plugin setup must return a runtime: ${e.provider}`);if(S(t)){if(t.webDriver?.provider!==e.provider)throw h(`WebDriver plugin provider does not match its declaration: ${e.provider}`);return await i.adaptWebDriver(t.webDriver,{clientVersion:r})}let{runtime:a,platformModule:o}=t;return p(e.provider,a,o),{runtime:a,platformModule:o}}function S(e){return`webDriver`in e}async function C(e){if(!n(e))return;let t=e.runtime;try{typeof t?.shutdown==`function`&&await t.shutdown()}catch{}try{typeof e.dispose==`function`&&await e.dispose()}catch{}}function w(t,n){return t instanceof e?typeof t.details?.reason==`string`?t:new e(t.code,t.message,{...t.details,reason:n},t):new e(`COMMAND_FAILED`,t instanceof Error?t.message:String(t),{reason:n},t)}function T(e){let{candidate:t,plugin:n}=e;if(t.dormant)return[];let i={...e.provider===void 0?{}:{provider:e.provider},source:t.source,...t.package===void 0?{}:{package:t.package},...t.version===void 0?{}:{version:t.version}};return e.failure!==void 0||!n?[{...i,state:`failed`,error:l(e.failure),credentials:r}]:[{...i,state:`active`,credentials:{variables:[...n.credentials.variables],byBackend:Object.fromEntries(Object.entries(n.credentials.byBackend??{}).map(([e,t])=>[e,[...t]]))}}]}function E(e){return n(e)&&s(e.provider)?e.provider:void 0}async function D({provider:e,source:t,runtime:n,dispose:r}){return{provider:e,source:t,shutdown:await O(async()=>await n.shutdown()),dispose:await O(async()=>await r?.())}}async function O(e){try{return await e(),{status:`ok`}}catch(e){return{status:`failed`,error:l(e)}}}function k(e){let t;return()=>t??=e()}export{g as claimProviderIds,_ as resolveProviderPlugins,v as startProviderRegistry};
@@ -1 +1 @@
1
- import{R as e}from"./sdk-contracts.js";import{ft as t}from"./sdk-io.js";import{i as n,n as r,r as i}from"./sdk-remote-config.js";import{c as a}from"./file.js";import o from"node:fs";import s from"node:path";function c(r){let{env:i}=r,c=d(r);if(!o.existsSync(c))throw new e(`INVALID_ARGS`,`Remote config file not found: ${c}`);let l;try{l=o.readFileSync(c,`utf8`)}catch(t){throw new e(`INVALID_ARGS`,`Failed to read remote config file: ${c}`,{cause:t instanceof Error?t.message:String(t)})}let u;try{u=JSON.parse(l)}catch(t){throw new e(`INVALID_ARGS`,`Invalid JSON in remote config file: ${c}`,{cause:t instanceof Error?t.message:String(t)})}if(!u||typeof u!=`object`||Array.isArray(u))throw new e(`INVALID_ARGS`,`Remote config file must contain a JSON object: ${c}`);let f={},p=u,m=s.dirname(c);for(let[r,o]of Object.entries(p)){let s=n(r);if(!s)throw new e(`INVALID_ARGS`,`Unsupported remote config key "${r}" in remote config file ${c}.`);let l=t(s,o,`remote config file ${c}`,r);f[s.key]=typeof l==`string`&&`path`in s&&s.path?a(l,{cwd:m,env:i}):l}return{resolvedPath:c,profile:f}}function l(e){let n={};for(let a of r){let r=i(a.key).map(t=>({name:t,value:e[t]})).find(e=>typeof e.value==`string`&&e.value.trim().length>0);r&&(n[a.key]=t(a,r.value,`environment variable ${r.name}`,r.name))}return n}function u(...e){let t={};for(let n of e)if(n)for(let e of r){let r=n[e.key];r!==void 0&&(t[e.key]=r)}return t}function d(e){let{env:t}=e;return a(e.configPath,{cwd:e.cwd,env:t})}function f(e){let t=c(e);return{resolvedPath:t.resolvedPath,profile:u(l(e.env),t.profile)}}export{d as n,f as r,c as t};
1
+ import{R as e}from"./sdk-contracts.js";import{mt as t}from"./sdk-io.js";import{i as n,n as r,r as i}from"./sdk-remote-config.js";import{u as a}from"./file.js";import o from"node:fs";import s from"node:path";function c(r){let{env:i}=r,c=d(r);if(!o.existsSync(c))throw new e(`INVALID_ARGS`,`Remote config file not found: ${c}`);let l;try{l=o.readFileSync(c,`utf8`)}catch(t){throw new e(`INVALID_ARGS`,`Failed to read remote config file: ${c}`,{cause:t instanceof Error?t.message:String(t)})}let u;try{u=JSON.parse(l)}catch(t){throw new e(`INVALID_ARGS`,`Invalid JSON in remote config file: ${c}`,{cause:t instanceof Error?t.message:String(t)})}if(!u||typeof u!=`object`||Array.isArray(u))throw new e(`INVALID_ARGS`,`Remote config file must contain a JSON object: ${c}`);let f={},p=u,m=s.dirname(c);for(let[r,o]of Object.entries(p)){let s=n(r);if(!s)throw new e(`INVALID_ARGS`,`Unsupported remote config key "${r}" in remote config file ${c}.`);let l=t(s,o,`remote config file ${c}`,r);f[s.key]=typeof l==`string`&&`path`in s&&s.path?a(l,{cwd:m,env:i}):l}return{resolvedPath:c,profile:f}}function l(e){let n={};for(let a of r){let r=i(a.key).map(t=>({name:t,value:e[t]})).find(e=>typeof e.value==`string`&&e.value.trim().length>0);r&&(n[a.key]=t(a,r.value,`environment variable ${r.name}`,r.name))}return n}function u(...e){let t={};for(let n of e)if(n)for(let e of r){let r=n[e.key];r!==void 0&&(t[e.key]=r)}return t}function d(e){let{env:t}=e;return a(e.configPath,{cwd:e.cwd,env:t})}function f(e){let t=c(e);return{resolvedPath:t.resolvedPath,profile:u(l(e.env),t.profile)}}export{d as n,f as r,c as t};
@@ -1 +1 @@
1
- import{n as e}from"./replay-divergence.js";import{a as t,n,o as r,u as i}from"./replay-script-selection.js";import{o as a}from"./request.js";import{a as o,d as s,f as c,i as l,l as u,m as d,n as f,o as p,p as m,s as h,t as g}from"./session-replay-vars.js";async function _(t){let{req:n,sessionStore:r,observationStore:i,logPath:f,captureAction:g}=t,_=a(n.meta?.requestId),v=o(t.error),y=[...t.redactions],b=e(y),x={...v,message:b(v.message),...v.hint?{hint:b(v.hint)}:{}},S=i.get(),C=S?await u({session:S,observationStore:i,logPath:f,action:g}):{state:`unavailable`,reason:`no-session`,hint:`The session closed before a post-failure screen could be captured.`},w=S&&C.state===`available`&&!t.isControl?c(t.suggestNodes({createdAt:Date.now(),nodes:C.nodes}).map(({node:e,basis:t})=>({node:e,nodeIndex:e.index,basis:t}))).map(({node:e,basis:t})=>h({node:e,nodes:C.nodes,session:S,action:g,basis:t,sanitize:b})):[],T={version:1,kind:`action-failure`,step:{index:t.stepIndex,source:{path:b(t.source.path??t.replayPath),line:t.source.line}},action:b(t.actionLabel),cause:{code:x.code,message:x.message,...x.hint?{hint:x.hint}:{}},screen:p(C,b),suggestions:w.slice(0,5),suggestionCount:w.length,resume:t.resume,repairHint:d({kind:`action-failure`,targetEvidence:void 0,capture:s(C)})},E=m({sessionStore:r,observationStore:i,divergence:T,responseLevel:n.meta?.responseLevel,evidence:C.state===`available`?C.evidence:void 0,..._?{signal:_}:{}});return l({error:x,actionLabel:t.actionLabel,action:t.action,positionals:[...g.positionals],step:t.stepIndex,replayPath:t.replayPath,artifactPaths:[...t.artifactPaths],snapshotDiagnostics:t.snapshotDiagnostics,divergence:E,scrubVars:y,warnings:t.warnings})}function v(){return{appendTraceEvent:f,buildBuiltinVars:e=>g({...e,metadata:{}}),readScriptSourceFile:r,scriptSourceRequiredMessage:t,requestSignal:a,resolveTargetDevice:async(e,t,r)=>await i(e,n(t.appTarget,t.platform,r)),buildActionFailureResponse:_}}export{v as createReplayBackendHost};
1
+ import{n as e}from"./replay-divergence.js";import{a as t,n,o as r,u as i}from"./replay-script-selection.js";import{o as a}from"./request.js";import{a as o,d as s,f as c,i as l,l as u,m as d,n as f,o as p,p as m,s as h,t as g}from"./session-replay-vars.js";async function _(t){let{req:n,sessionStore:r,observationStore:i,logPath:f,captureAction:g}=t,_=a(n.meta?.requestId),v=o(t.error),y=[...t.redactions],b=e(y),x={...v,message:b(v.message),...v.hint?{hint:b(v.hint)}:{}},S=i.get(),C=S?await u({session:S,observationStore:i,logPath:f,action:g,signal:_}):{state:`unavailable`,reason:`no-session`,hint:`The session closed before a post-failure screen could be captured.`},w=S&&C.state===`available`&&!t.isControl?c(t.suggestNodes({createdAt:Date.now(),nodes:C.nodes}).map(({node:e,basis:t})=>({node:e,nodeIndex:e.index,basis:t}))).map(({node:e,basis:t})=>h({node:e,nodes:C.nodes,session:S,action:g,basis:t,sanitize:b})):[],T={version:1,kind:`action-failure`,step:{index:t.stepIndex,source:{path:b(t.source.path??t.replayPath),line:t.source.line}},action:b(t.actionLabel),cause:{code:x.code,message:x.message,...x.hint?{hint:x.hint}:{}},screen:p(C,b),suggestions:w.slice(0,5),suggestionCount:w.length,resume:t.resume,repairHint:d({kind:`action-failure`,targetEvidence:void 0,capture:s(C)})},E=m({sessionStore:r,observationStore:i,divergence:T,responseLevel:n.meta?.responseLevel,evidence:C.state===`available`?C.evidence:void 0,..._?{signal:_}:{}});return l({error:x,actionLabel:t.actionLabel,action:t.action,positionals:[...g.positionals],step:t.stepIndex,replayPath:t.replayPath,artifactPaths:[...t.artifactPaths],snapshotDiagnostics:t.snapshotDiagnostics,divergence:E,scrubVars:y,warnings:t.warnings})}function v(){return{appendTraceEvent:f,buildBuiltinVars:e=>g({...e,metadata:{}}),readScriptSourceFile:r,scriptSourceRequiredMessage:t,requestSignal:a,resolveTargetDevice:async(e,t,r)=>await i(e,n(t.appTarget,t.platform,r)),buildActionFailureResponse:_}}export{v as createReplayBackendHost};
@@ -1,2 +1,2 @@
1
- import{ut as e}from"./sdk-contracts.js";function t(e){let t=e?.resume;if(typeof t?.allowed==`boolean`&&!(!Number.isInteger(t.from)||typeof t.planDigest!=`string`)&&!(!t.allowed&&typeof t.reason!=`string`)&&(t.repairSessionHeld===void 0||t.repairSessionHeld===!0)&&!(t.alternateFrom!==void 0&&!Number.isInteger(t.alternateFrom)))return t}const n={digest:8192,default:24576,full:65536};function r(e){return e===`digest`||e===`full`?e:`default`}function i(e,t=256){let n=Buffer.from(e,`utf8`);if(n.length<=t)return e;let r=`…<truncated>`,i=Buffer.byteLength(r,`utf8`),a=Math.max(0,t-i);for(;a>0&&(n[a]&192)==128;)--a;return`${n.subarray(0,a).toString(`utf8`)}${r}`}function a(t,n=256){return i(e(t),n)}function o(e,t){let n=e;for(let e of t)e.value&&(n=n.split(e.value).join(`<var:${e.name}>`));return n}function s(e){return(t,n)=>a(o(t,e),n)}function c(e,t){return e.state!==`available`||e.refs.length<=t?e:{...e,refs:e.refs.slice(0,t),truncated:!0}}function l(e,t){let n=r(t),i=n===`digest`?8:20,a=c(e.screen,i),o=n===`digest`?[]:e.suggestions.slice(0,5);return{...e,screen:a,suggestions:o}}function u(e){return Buffer.byteLength(JSON.stringify(e),`utf8`)}function d(e){let{divergence:t,level:i,writeOverflowArtifact:a}=e,o=r(i),s=n[o],c=l(t,i),d=u(c);if(d<=s)return c;let p=d-s,m=a(l(t,`full`)),h=f(c);return`artifactPath`in m?{...h,overflow:{omittedBytes:p,artifactPath:m.artifactPath}}:{...h,artifactUnavailable:!0}}function f(e){return{version:e.version,kind:e.kind,step:{index:e.step.index,source:{path:a(e.step.source.path),line:e.step.source.line}},action:a(e.action),cause:{code:e.cause.code,message:a(e.cause.message),...e.cause.hint?{hint:a(e.cause.hint)}:{}},screen:{state:`unavailable`,reason:`omitted-for-size`,hint:`The screen digest and suggestions were omitted to stay within the response byte budget. See overflow.artifactPath (or retry at --level full) for the complete report.`},suggestions:[],suggestionCount:e.suggestionCount,resume:e.resume,repairHint:e.repairHint,...e.targetBinding?{targetBinding:e.targetBinding}:{}}}function p(e){let t=e?.divergence;if(!t||typeof t!=`object`)return null;let n=t,r=[...E(n.step),...S(n.kind,n.targetBinding),...m(n.repairHint,n.resume),...D(n.screen),...j(n.suggestions,n.suggestionCount),...N(n.overflow,n.artifactUnavailable)];return r.length>0?r.join(`
1
+ import{dt as e}from"./sdk-contracts.js";function t(e){let t=e?.resume;if(typeof t?.allowed==`boolean`&&!(!Number.isInteger(t.from)||typeof t.planDigest!=`string`)&&!(!t.allowed&&typeof t.reason!=`string`)&&(t.repairSessionHeld===void 0||t.repairSessionHeld===!0)&&!(t.alternateFrom!==void 0&&!Number.isInteger(t.alternateFrom)))return t}const n={digest:8192,default:24576,full:65536};function r(e){return e===`digest`||e===`full`?e:`default`}function i(e,t=256){let n=Buffer.from(e,`utf8`);if(n.length<=t)return e;let r=`…<truncated>`,i=Buffer.byteLength(r,`utf8`),a=Math.max(0,t-i);for(;a>0&&(n[a]&192)==128;)--a;return`${n.subarray(0,a).toString(`utf8`)}${r}`}function a(t,n=256){return i(e(t),n)}function o(e,t){let n=e;for(let e of t)e.value&&(n=n.split(e.value).join(`<var:${e.name}>`));return n}function s(e){return(t,n)=>a(o(t,e),n)}function c(e,t){return e.state!==`available`||e.refs.length<=t?e:{...e,refs:e.refs.slice(0,t),truncated:!0}}function l(e,t){let n=r(t),i=n===`digest`?8:20,a=c(e.screen,i),o=n===`digest`?[]:e.suggestions.slice(0,5);return{...e,screen:a,suggestions:o}}function u(e){return Buffer.byteLength(JSON.stringify(e),`utf8`)}function d(e){let{divergence:t,level:i,writeOverflowArtifact:a}=e,o=r(i),s=n[o],c=l(t,i),d=u(c);if(d<=s)return c;let p=d-s,m=a(l(t,`full`)),h=f(c);return`artifactPath`in m?{...h,overflow:{omittedBytes:p,artifactPath:m.artifactPath}}:{...h,artifactUnavailable:!0}}function f(e){return{version:e.version,kind:e.kind,step:{index:e.step.index,source:{path:a(e.step.source.path),line:e.step.source.line}},action:a(e.action),cause:{code:e.cause.code,message:a(e.cause.message),...e.cause.hint?{hint:a(e.cause.hint)}:{}},screen:{state:`unavailable`,reason:`omitted-for-size`,hint:`The screen digest and suggestions were omitted to stay within the response byte budget. See overflow.artifactPath (or retry at --level full) for the complete report.`},suggestions:[],suggestionCount:e.suggestionCount,resume:e.resume,repairHint:e.repairHint,...e.targetBinding?{targetBinding:e.targetBinding}:{}}}function p(e){let t=e?.divergence;if(!t||typeof t!=`object`)return null;let n=t,r=[...E(n.step),...S(n.kind,n.targetBinding),...m(n.repairHint,n.resume),...D(n.screen),...j(n.suggestions,n.suggestionCount),...N(n.overflow,n.artifactUnavailable)];return r.length>0?r.join(`
2
2
  `):null}function m(e,t){if(typeof e!=`string`)return[];let n=v(e,t);return[`Repair hint: ${e}${n?` — ${n}`:``}`]}function h(e){let t=e;if(!t||typeof t.allowed!=`boolean`)return;if(!t.allowed)return{allowed:!1,reason:typeof t.reason==`string`?t.reason:void 0};let{from:n,planDigest:r,alternateFrom:i}=t;if(typeof n==`number`&&typeof r==`string`&&r.length!==0)return{allowed:!0,from:n,planDigest:r,alternateFrom:typeof i==`number`?i:void 0}}function g(e,t){return`replay --from ${e} --plan-digest ${t}`}function _(e){return e?.repairSessionHeld===!0}function v(e,t){let n=y(e,h(t));if(n!==void 0)return _(t)?`${n} Read-only inspection while armed (snapshot -i, get attrs, find, is) is excluded from the healed script by default — no --no-record needed. If the step you are repairing is itself a read, add --record to that command so it lands in the heal.`:n}function y(e,t){switch(e){case`record-and-heal`:return t?.allowed?`press the correct control via a blessed @ref from screen.refs (recorded), then ${g(t.from,t.planDigest)}.`:`press the correct control via a blessed @ref from screen.refs (recorded). ${x(t)}`;case`state-repair`:return t?.allowed?`fix app state with --no-record actions, then ${g(t.from,t.planDigest)} to re-run it.`:`fix app state with --no-record actions. ${x(t)}`;case`caution`:return b({lead:`something already matches the recorded selector; a blind re-press may repeat the mistake.`,guidance:t});case`manual`:return b({lead:`no safe automated repair could be proven; inspect the screen and repair by hand.`,guidance:t});default:return}}function b(e){let{lead:t,guidance:n}=e;if(!n?.allowed)return`${t} ${x(n)}`;let r=`if you fixed app state with --no-record actions: ${g(n.from,n.planDigest)}`;return n.alternateFrom===void 0?`${t} ${r}.`:`${t} ${r}; ${`if you performed the step's intent as a recorded action: ${g(n.alternateFrom,n.planDigest)}`}.`}function x(e){return e&&!e.allowed&&e.reason?`This step cannot currently be resumed automatically (${e.reason}) — run a fresh full replay instead.`:`This step cannot currently be resumed automatically — run a fresh full replay instead.`}function S(e,t){if(typeof e!=`string`||e===`action-failure`)return[];let n=t;return n?[C(e,n.matchCount),...w(n.mismatches),...T(n.candidates)]:[]}function C(e,t){return`Target binding: ${e}${typeof t==`number`?` (matchCount ${t})`:``} — recorded target evidence did not verify.`}function w(e){return!Array.isArray(e)||e.length===0?[]:[` mismatches: ${e.slice(0,5).join(`; `)}`]}function T(e){return!Array.isArray(e)||e.length===0?[]:[` ${e.length} candidate(s) shared the recorded identity:`,...e.slice(0,5).map(e=>` ${A(e)}`)]}function E(e){let t=e;if(typeof t?.index!=`number`)return[];let n=t.source,r=typeof n?.path==`string`&&typeof n.line==`number`?` (${n.path}:${n.line})`:``;return[`Divergence at step ${t.index}${r}`]}function D(e){let t=e;return t?.state===`available`&&Array.isArray(t.refs)?O(t.refs,t.refsGeneration):t?.state===`unavailable`?[k(t)]:[]}function O(e,t){let n=e.slice(0,8).map(A),r=e.length-n.length;return[`Screen: ${e.length} actionable ref(s) captured (refsGeneration ${t}).`,...n,...r>0?[` ... ${r} more`]:[]]}function k(e){let t=typeof e.hint==`string`&&e.hint.length>0?` ${e.hint}`:``;return`Screen: unavailable (${String(e.reason??`unknown`)}).${t}`}function A(e){let t=e,n=typeof t.label==`string`?` "${t.label}"`:``;return` @${String(t.ref)} [${String(t.role)}]${n}`}function j(e,t){return Array.isArray(e)&&e.length>0?[`Suggestions:`,...e.slice(0,5).map(M)]:typeof t==`number`&&t>0?[`Suggestions: ${t} available (omitted at this response level; rerun with --json for the full report).`]:[]}function M(e){let t=e,n=typeof t.label==`string`?` "${t.label}"`:``;return` - [${String(t.basis)}]${n} ${String(t.selector)}`}function N(e,t){return e&&typeof e==`object`?[`Full report written to ${String(e.artifactPath)}.`]:t===!0?[`Full report exceeded the response budget and the overflow artifact could not be written.`]:[]}export{o as a,t as i,s as n,p as r,d as t};