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,at as t,s as n}from"./sdk-contracts.js";import{c as r}from"./back-mode.js";import{ht as i}from"./sdk-io.js";import"./diagnostics.js";import{p as a,v as o}from"./sdk-device.js";import{Gt as s,Vt as c,Wr as l,Wt as u,br as d,et as f,fn as p,nt as m,pn as h,rt as g,tt as _}from"./sdk-batch.js";import{o as v}from"./session-store.js";import{i as y,r as b}from"./success-text.js";import{u as x}from"./alert-contract.js";import{i as S,l as ee,m as C,p as w,r as te,x as ne}from"./settings.js";import{t as T}from"./location-coordinates.js";import{t as re}from"./absence-observation-errors.js";import{n as E,o as D,r as O,t as ie}from"./snapshot-runtime-capture-input.js";import{d as ae}from"./daemon-command-registry.js";import{n as k}from"./runtime-admission.js";import{r as oe,u as se}from"./runtime-session.js";import{n as ce,t as A}from"./capture-disclosure.js";import{a as j,o as M}from"./snapshot-runtime-binding.js";import{a as N,c as P,d as F,f as I,h as L,l as R,o as z,p as B,s as V,t as H}from"./selector-runtime.js";import{n as U,t as W}from"./snapshot-runtime.js";import{t as G}from"./wait.js";async function le(e){let{device:t,action:n,inspectFacts:r,bindDevice:i,platformServices:a}=e,o={command:`alert`,device:t,inspectFacts:r,bindDevice:i,platformServices:a,readiness:!e.session};if(n===`wait`){let e=await k({...o,use:g});if(e.type===`response`)return{ok:!1,response:e.response};let t=e.runtime;return{ok:!0,execute:e=>de(t,e)}}if(n===`accept`){let e=await k({...o,use:f});if(e.type===`response`)return{ok:!1,response:e.response};let t=e.runtime;return{ok:!0,execute:e=>fe(t,e)}}if(n===`dismiss`){let e=await k({...o,use:_});if(e.type===`response`)return{ok:!1,response:e.response};let t=e.runtime;return{ok:!0,execute:e=>pe(t,e)}}let s=await k({...o,use:m});if(s.type===`response`)return{ok:!1,response:s.response};let c=s.runtime;return{ok:!0,execute:e=>ue(c,e)}}async function ue(e,t){return await e.operations.readAlert(t)}async function de(e,t){return await e.operations.awaitAlert(t)}async function fe(e,t){return await e.operations.acceptAlert(t)}async function pe(e,t){return await e.operations.dismissAlert(t)}async function me(e){let{req:t,logPath:n,sessionStore:r,ref:i,device:a,inspectFacts:o,bindDevice:s,platformServices:c}=e,l=i?r.requireCurrent(i):void 0,u=ge(t.positionals?.[0]),d=await le({device:a,action:u,session:l,inspectFacts:o,bindDevice:s,platformServices:c});if(!d.ok)return d.response;l=i?r.requireCurrent(i):void 0,l&&ae(t)===`may-invalidate`&&D(l);let f=O(n,t.flags,l?.appBundleId,l?.trace?.outPath),p=await d.execute({timeoutMs:_e(u,t.positionals?.[1]),...he(l),execution:E(f)});return v(r,i,t,t.command,p),{ok:!0,data:p}}function he(e){return{...e?.appBundleId===void 0?{}:{appBundleId:e.appBundleId},...e?.surface===void 0?{}:{surface:e.surface}}}function ge(e){return e===`accept`||e===`dismiss`||e===`wait`?e:`get`}function _e(t,n){let r=h(n)??1e4;if(t===`wait`&&r>2147483647)throw new e(`INVALID_ARGS`,`alert wait timeoutMs exceeds the maximum of ${x} ms`,{hint:`Pass a shorter timeout, or run repeated alert waits.`});return r}function ve(t){let r=t.positionals??[],i=c(r);if(i.kind===`read`)return{ok:!0,parsed:{leg:`read`,setting:i.setting}};try{return{ok:!0,parsed:{leg:`write`,args:ee(r)}}}catch(t){if(!(t instanceof e))throw t;return n(t.code,t.message)}}function ye(e){if(e.permission!==void 0)return{permissionTarget:e.permission,permissionMode:e.mode};if(e.latitude!==void 0)return{latitude:T(e.latitude,`latitude`),longitude:T(e.longitude,`longitude`)}}function be(e,t,n){return{setting:e.setting,state:e.state,...e.permission===void 0?{}:{permissionTarget:e.permission,permissionMode:e.mode},...e.latitude===void 0?{appBundleId:t}:{latitude:e.latitude,longitude:e.longitude},platform:n}}async function xe(e,t,n){let{setting:r,state:i}=t,a=await e.operations.setSetting(t);return a&&typeof a==`object`?y({setting:r,state:i,...a},typeof a.message==`string`&&a.message.length>0?a.message:n):{setting:r,state:i,...b(n)}}async function K(e){return e.parsed.leg===`read`?await Se(e,e.parsed.setting):await Ce(e,e.parsed.args)}async function Se(e,t){let{req:n,logPath:r,sessionStore:a,ref:o,device:s,inspectFacts:c,bindDevice:l,platformServices:d}=e,f=o?a.requireCurrent(o):void 0,p=await k({command:`settings ${t}`,subject:t,device:s,use:u,inspectFacts:c,bindDevice:l,platformServices:d,readiness:!f});if(p.type===`response`)return p.response;f=o?a.requireCurrent(o):void 0,i({level:`debug`,phase:`settings_read`,data:{setting:t,platform:s.platform}});let m=O(r,n.flags,f?.appBundleId,f?.trace?.outPath),h=await p.runtime.operations.readSetting({setting:t,execution:E(m)}),g={...h,...b(te(h))};return v(a,o,n,n.command,g),{ok:!0,data:g}}async function Ce(e,t){let{req:n,logPath:r,sessionStore:a,ref:o,device:c,inspectFacts:l,bindDevice:u,platformServices:d}=e,f=o?a.requireCurrent(o):void 0,{setting:p,state:m}=t,h=we(c,n,p,m);if(h!==void 0)return h;let g=await k({command:`settings ${p}`,subject:p,device:c,use:s,inspectFacts:l,bindDevice:u,platformServices:d,readiness:!f});if(g.type===`response`)return g.response;f=o?a.requireCurrent(o):void 0;let _=Te(n,t,f,c),y=Ee(t,_);if(y!==void 0)return y;f&&D(f),i({level:`debug`,phase:`settings_apply`,data:be(t,_,c.platform)});let b=await xe(g.runtime,De(t,_,O(r,n.flags,_,f?.trace?.outPath)),S(p,m,_));return v(a,o,n,n.command,b),{ok:!0,data:b}}function q(e){let t=e.input?.app;if(typeof t!=`string`)return;let n=t.trim();return n.length>0?n:void 0}function J(e){return o(e)?`macos-host`:a(e.platform)?`apple`:`mobile`}function we(e,t,r,i){let a=q(t);if(a===void 0||C(J(e),r,i)!==`device-level`)return;let o=w(r,i,a);return n(o.code,o.message,o.details,{hint:o.hint})}function Te(e,t,n,r){let i=C(J(r),t.setting,t.state)===`app-scoped`?q(e):void 0;return t.app??i??e.internal?.settingsAppBundleId??n?.appBundleId}function Ee(e,r){if(ne(e.setting)?.appRequired&&!r)return n(`INVALID_ARGS`,`settings ${e.setting} requires an app id when no app is bound to the session`,t())}function De(e,t,n){let r=ye(e);return{setting:e.setting,state:e.state,...t===void 0?{}:{appBundleId:t},...r===void 0?{}:{options:r},execution:E(n)}}async function Oe(e){return await U({...e,command:`diff`,execute:async({runtime:e,sessionName:t,req:n,snapshotScope:r})=>{let i=await e.capture.diffSnapshot({session:t,interactiveOnly:n.flags?.snapshotInteractiveOnly,depth:n.flags?.snapshotDepth,scope:r,raw:n.flags?.snapshotRaw});return{data:i,record:{kind:`diff`,mode:`snapshot`,baselineInitialized:i.baselineInitialized,summary:i.summary}}}})}function ke(e){return e!==`sleep`}const Ae=[`application`,`window`,`tabbar`,`scrollbar`,`image`],je=new Set([`tab bar`]);async function Me(e,t){if(t.ok||!Ne(t.error.details?.reason)||t.error.details?.captureStalled===!0||t.error.details?.captureTruncated===!0)return t;let r=await Pe(e).catch(()=>null);return r?n(t.error.code,`${t.error.message}. Current surface: ${r.summary}.`,{...t.error.details??{},currentSurface:r.details}):t}function Ne(e){return e===G.targetAbsent||e===G.stableTimeout}async function Pe(e){let t={...e.req.flags,snapshotInteractiveOnly:!0},n=await oe({device:e.device,session:e.session,flags:t,logPath:e.logPath??``,captureData:async()=>await e.capture(ie({flags:t,logPath:e.logPath??``,meta:e.req.meta,session:e.session,snapshotScope:void 0}))});A(e.captureProof,n.snapshot);let r=[...n.snapshot.nodes].sort(Fe),i=Y(r,6,{includeIdentifiers:!0});if(i.length===0)return null;let a=Y(r.filter(e=>!Q(e)),4,{includeIdentifiers:!1}),o=Y(r.filter(Le),4,{includeIdentifiers:!0});return{summary:(a.length>0?a:i.slice(0,4)).join(`, `),details:{labels:i,...o.length>0?{buttons:o}:{}}}}function Y(e,t,n){let r=new Set,i=[];for(let a of e){let e=Z(a,n);if(!(!e||r.has(e))&&(r.add(e),i.push(e),i.length>=t))break}return i}function Fe(e,t){return X(e)-X(t)||Ie(e,t)}function X(e){let t=!!Z(e,{includeIdentifiers:!1});return(Q(e)?2:0)+ +!t}function Ie(e,t){return e.rect&&t.rect?e.rect.y-t.rect.y||e.rect.x-t.rect.x:e.rect?-1:t.rect?1:(e.depth??0)-(t.depth??0)||e.index-t.index}function Z(e,t){let n=(t.includeIdentifiers?[e.label,e.value,e.identifier]:[e.label,e.value]).map(e=>typeof e==`string`?e.trim():``).find(e=>e.length>0);return n?n.replaceAll(/\s+/g,` `).slice(0,80):``}function Q(e){let t=l(`${e.type??``} ${e.role??``} ${e.subrole??``}`),n=`${e.label??``} ${e.value??``}`.trim().toLowerCase();return Ae.some(e=>t.includes(e))||je.has(n)||n.endsWith(`.fill`)}function Le(e){let t=`${e.type??``} ${e.role??``} ${e.subrole??``}`;return l(t).includes(`button`)}async function Re(e){let{req:t,sessionName:n,sessionStore:r}=e,i=ze(t);if(`ok`in i)return i;let a=i,{ref:o,session:s,device:c}=await j(r,n,t),l=await Be(e,a,s,c);if(l&&`ok`in l)return l;let u=l,d=t.internal?.replayLandmarkGuard,f=Ve(a,s);if(`ok`in f)return f;let{waitParsed:p,staleRefsWarning:m}=f;return e.consumedSnapshot??={},e.captureProof??={},a.kind===`sleep`?await $({...e,ref:o},p,s,c,u,m,d):ce({response:await M(s,c,()=>$({...e,ref:o},p,s,c,u,m,d),e.platformResourceCleanup),consumedTree:H(e),captureProof:e.captureProof})}function ze(e){let t=p(e.positionals??[]);if(!t)return n(`INVALID_ARGS`,`wait requires a duration or text`);if(t.kind===`invalid`)return n(`INVALID_ARGS`,t.message);if(t.kind!==`absent`)return t;let i=r({depth:e.flags?.snapshotDepth,scope:e.flags?.snapshotScope});if(!i)return t;let a=re(i,`wait`);return n(a.code,a.message,a.details)}async function Be(e,t,n,r){if(!ke(t.kind))return;let i=await R({command:`wait`,device:r,session:n,inspectFacts:e.inspectFacts,platformServices:e.platformServices,bindDevice:e.bindDevice});return i.ok?i.operations:i.response}function Ve(e,t){if(e.kind!==`ref`)return{waitParsed:e};let n=L(e.rawRef);return n.ok?{waitParsed:{...e,rawRef:n.ref},staleRefsWarning:se({session:t,ref:n.ref,mintedGeneration:n.generation})}:n.response}async function $(e,t,n,r,i,a,o){let{req:s,sessionName:c,sessionStore:l}=e,u=await P({...e,ref:e.ref,session:n,device:r,bound:i}),d=await V(async()=>{let r=await u.selectors.wait({session:c,requestId:s.meta?.requestId,target:He(t,n,o)}),i=z(r);F(l,e.ref,s,I(r),i,`landmark`);let d=B(r);return a?{...d,warning:a}:d}),f=i?await Me({req:s,logPath:e.logPath,session:n,device:r,capture:i.capture,captureProof:e.captureProof},d):d;return await N(e,f,`wait`)}function He(e,t,n){switch(e.kind){case`sleep`:return{kind:`sleep`,durationMs:e.durationMs};case`selector`:return{kind:`selector`,selector:e.selectorExpression,timeoutMs:e.timeoutMs,...n?{recordedLandmark:n}:{}};case`absent`:return{kind:`absent`,selector:e.selectorExpression,timeoutMs:e.timeoutMs};case`ref`:return We(e,t);case`stable`:return{kind:`stable`,quietMs:e.quietMs,timeoutMs:e.timeoutMs};case`text`:return Ge(e);default:return Ue(e)}}function Ue(e){throw Error(`Unsupported wait positional target: ${String(e)}`)}function We(t,n){if(!n?.snapshot)throw new e(`INVALID_ARGS`,`Ref wait requires an existing snapshot in session.`);return{kind:`ref`,ref:t.rawRef,timeoutMs:t.timeoutMs}}function Ge(t){let n=d(t.text);if(!n.ok)throw new e(n.code,n.message);return{kind:`text`,text:n.text,timeoutMs:t.timeoutMs}}const Ke={snapshot:async({req:e,createCommandSurface:t,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c})=>await W({createCommandSurface:t,req:e,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c}),diff:async({req:e,createCommandSurface:t,sessionName:r,logPath:i,sessionStore:a,inspectFacts:o,bindDevice:s,platformServices:c,platformResourceCleanup:l})=>e.positionals?.[0]===`snapshot`?await Oe({createCommandSurface:t,req:e,sessionName:r,logPath:i,sessionStore:a,inspectFacts:o,bindDevice:s,platformServices:c,platformResourceCleanup:l}):n(`INVALID_ARGS`,`diff currently supports only: diff snapshot`),wait:async({req:e,createCommandSurface:t,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c})=>await Re({createCommandSurface:t,req:e,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c}),alert:async({req:e,sessionName:t,logPath:n,sessionStore:r,inspectFacts:i,bindDevice:a,platformServices:o,platformResourceCleanup:s})=>{let{ref:c,session:l,device:u}=await j(r,t,e);return await M(l,u,async()=>await me({req:e,logPath:n,sessionStore:r,ref:c,device:u,inspectFacts:i,bindDevice:a,platformServices:o}),s)},settings:async({req:e,sessionName:t,logPath:n,sessionStore:r,inspectFacts:i,bindDevice:a,platformServices:o,platformResourceCleanup:s})=>{let c=ve(e);if(!c.ok)return c;let{ref:l,session:u,device:d}=await j(r,t,e);return await M(u,d,async()=>await K({req:e,logPath:n,sessionStore:r,ref:l,device:d,parsed:c.parsed,inspectFacts:i,bindDevice:a,platformServices:o}),s)}};async function qe(e){let t=e.req.command,n=Ke[t];return n?await n(e):null}export{qe as handleSnapshotCommands};
1
+ import{R as e,ot as t,s as n}from"./sdk-contracts.js";import{c as r}from"./back-mode.js";import{_t as i}from"./sdk-io.js";import"./diagnostics.js";import{T as a,b as o}from"./sdk-device.js";import{Ar as s,Cn as c,Qt as l,Sn as u,at as d,ct as f,ei as p,nn as m,ot as h,st as g,tn as _}from"./sdk-batch.js";import{o as v}from"./session-store.js";import{i as y,r as b}from"./success-text.js";import{u as x}from"./alert-contract.js";import{i as S,l as ee,m as C,p as w,r as te,x as ne}from"./settings.js";import{t as T}from"./location-coordinates.js";import{t as re}from"./absence-observation-errors.js";import{n as E,o as D,r as O,t as ie}from"./snapshot-runtime-capture-input.js";import{f as ae}from"./daemon-command-registry.js";import{n as k}from"./runtime-admission.js";import{r as oe,u as se}from"./runtime-session.js";import{n as ce,t as A}from"./capture-disclosure.js";import{a as j,o as M}from"./snapshot-runtime-binding.js";import{a as N,c as P,d as F,f as I,h as L,l as R,o as z,p as B,s as V,t as H}from"./selector-runtime.js";import{n as U,t as W}from"./snapshot-runtime.js";import{t as G}from"./wait.js";async function le(e){let{device:t,action:n,inspectFacts:r,bindDevice:i,platformServices:a}=e,o={command:`alert`,device:t,inspectFacts:r,bindDevice:i,platformServices:a,readiness:!e.session};if(n===`wait`){let e=await k({...o,use:f});if(e.type===`response`)return{ok:!1,response:e.response};let t=e.runtime;return{ok:!0,execute:e=>de(t,e)}}if(n===`accept`){let e=await k({...o,use:d});if(e.type===`response`)return{ok:!1,response:e.response};let t=e.runtime;return{ok:!0,execute:e=>fe(t,e)}}if(n===`dismiss`){let e=await k({...o,use:h});if(e.type===`response`)return{ok:!1,response:e.response};let t=e.runtime;return{ok:!0,execute:e=>pe(t,e)}}let s=await k({...o,use:g});if(s.type===`response`)return{ok:!1,response:s.response};let c=s.runtime;return{ok:!0,execute:e=>ue(c,e)}}async function ue(e,t){return await e.operations.readAlert(t)}async function de(e,t){return await e.operations.awaitAlert(t)}async function fe(e,t){return await e.operations.acceptAlert(t)}async function pe(e,t){return await e.operations.dismissAlert(t)}async function me(e){let{req:t,logPath:n,sessionStore:r,ref:i,device:a,inspectFacts:o,bindDevice:s,platformServices:c}=e,l=i?r.requireCurrent(i):void 0,u=ge(t.positionals?.[0]),d=await le({device:a,action:u,session:l,inspectFacts:o,bindDevice:s,platformServices:c});if(!d.ok)return d.response;l=i?r.requireCurrent(i):void 0,l&&ae(t)===`may-invalidate`&&D(l);let f=O(n,t.flags,l?.appBundleId,l?.trace?.outPath),p=await d.execute({timeoutMs:_e(u,t.positionals?.[1]),...he(l),execution:E(f)});return v(r,i,t,t.command,p),{ok:!0,data:p}}function he(e){return{...e?.appBundleId===void 0?{}:{appBundleId:e.appBundleId},...e?.surface===void 0?{}:{surface:e.surface}}}function ge(e){return e===`accept`||e===`dismiss`||e===`wait`?e:`get`}function _e(t,n){let r=c(n)??1e4;if(t===`wait`&&r>2147483647)throw new e(`INVALID_ARGS`,`alert wait timeoutMs exceeds the maximum of ${x} ms`,{hint:`Pass a shorter timeout, or run repeated alert waits.`});return r}function ve(t){let r=t.positionals??[],i=l(r);if(i.kind===`read`)return{ok:!0,parsed:{leg:`read`,setting:i.setting}};try{return{ok:!0,parsed:{leg:`write`,args:ee(r)}}}catch(t){if(!(t instanceof e))throw t;return n(t.code,t.message)}}function ye(e){if(e.permission!==void 0)return{permissionTarget:e.permission,permissionMode:e.mode};if(e.latitude!==void 0)return{latitude:T(e.latitude,`latitude`),longitude:T(e.longitude,`longitude`)}}function be(e,t,n){return{setting:e.setting,state:e.state,...e.permission===void 0?{}:{permissionTarget:e.permission,permissionMode:e.mode},...e.latitude===void 0?{appBundleId:t}:{latitude:e.latitude,longitude:e.longitude},platform:n}}async function xe(e,t,n){let{setting:r,state:i}=t,a=await e.operations.setSetting(t);return a&&typeof a==`object`?y({setting:r,state:i,...a},typeof a.message==`string`&&a.message.length>0?a.message:n):{setting:r,state:i,...b(n)}}async function K(e){return e.parsed.leg===`read`?await Se(e,e.parsed.setting):await Ce(e,e.parsed.args)}async function Se(e,t){let{req:n,logPath:r,sessionStore:a,ref:o,device:s,inspectFacts:c,bindDevice:l,platformServices:u}=e,d=o?a.requireCurrent(o):void 0,f=await k({command:`settings ${t}`,subject:t,device:s,use:_,inspectFacts:c,bindDevice:l,platformServices:u,readiness:!d});if(f.type===`response`)return f.response;d=o?a.requireCurrent(o):void 0,i({level:`debug`,phase:`settings_read`,data:{setting:t,platform:s.platform}});let p=O(r,n.flags,d?.appBundleId,d?.trace?.outPath),m=await f.runtime.operations.readSetting({setting:t,execution:E(p)}),h={...m,...b(te(m))};return v(a,o,n,n.command,h),{ok:!0,data:h}}async function Ce(e,t){let{req:n,logPath:r,sessionStore:a,ref:o,device:s,inspectFacts:c,bindDevice:l,platformServices:u}=e,d=o?a.requireCurrent(o):void 0,{setting:f,state:p}=t,h=we(s,n,f,p);if(h!==void 0)return h;let g=await k({command:`settings ${f}`,subject:f,device:s,use:m,inspectFacts:c,bindDevice:l,platformServices:u,readiness:!d});if(g.type===`response`)return g.response;d=o?a.requireCurrent(o):void 0;let _=Te(n,t,d,s),y=Ee(t,_);if(y!==void 0)return y;d&&D(d),i({level:`debug`,phase:`settings_apply`,data:be(t,_,s.platform)});let b=await xe(g.runtime,De(t,_,O(r,n.flags,_,d?.trace?.outPath)),S(f,p,_));return v(a,o,n,n.command,b),{ok:!0,data:b}}function q(e){let t=e.input?.app;if(typeof t!=`string`)return;let n=t.trim();return n.length>0?n:void 0}function J(e){return a(e)?`macos-host`:o(e.platform)?`apple`:`mobile`}function we(e,t,r,i){let a=q(t);if(a===void 0||C(J(e),r,i)!==`device-level`)return;let o=w(r,i,a);return n(o.code,o.message,o.details,{hint:o.hint})}function Te(e,t,n,r){let i=C(J(r),t.setting,t.state)===`app-scoped`?q(e):void 0;return t.app??i??e.internal?.settingsAppBundleId??n?.appBundleId}function Ee(e,r){if(ne(e.setting)?.appRequired&&!r)return n(`INVALID_ARGS`,`settings ${e.setting} requires an app id when no app is bound to the session`,t())}function De(e,t,n){let r=ye(e);return{setting:e.setting,state:e.state,...t===void 0?{}:{appBundleId:t},...r===void 0?{}:{options:r},execution:E(n)}}async function Oe(e){return await U({...e,command:`diff`,execute:async({runtime:e,sessionName:t,req:n,snapshotScope:r})=>{let i=await e.capture.diffSnapshot({session:t,interactiveOnly:n.flags?.snapshotInteractiveOnly,depth:n.flags?.snapshotDepth,scope:r,raw:n.flags?.snapshotRaw});return{data:i,record:{kind:`diff`,mode:`snapshot`,baselineInitialized:i.baselineInitialized,summary:i.summary}}}})}function ke(e){return e!==`sleep`}const Ae=[`application`,`window`,`tabbar`,`scrollbar`,`image`],je=new Set([`tab bar`]);async function Me(e,t){if(t.ok||!Ne(t.error.details?.reason)||t.error.details?.captureStalled===!0||t.error.details?.captureTruncated===!0)return t;let r=await Pe(e).catch(()=>null);return r?n(t.error.code,`${t.error.message}. Current surface: ${r.summary}.`,{...t.error.details??{},currentSurface:r.details}):t}function Ne(e){return e===G.targetAbsent||e===G.stableTimeout}async function Pe(e){let t={...e.req.flags,snapshotInteractiveOnly:!0},n=await oe({device:e.device,session:e.session,flags:t,logPath:e.logPath??``,captureData:async()=>await e.capture(ie({flags:t,logPath:e.logPath??``,meta:e.req.meta,session:e.session,snapshotScope:void 0}))});A(e.captureProof,n.snapshot);let r=[...n.snapshot.nodes].sort(Fe),i=Y(r,6,{includeIdentifiers:!0});if(i.length===0)return null;let a=Y(r.filter(e=>!Q(e)),4,{includeIdentifiers:!1}),o=Y(r.filter(Le),4,{includeIdentifiers:!0});return{summary:(a.length>0?a:i.slice(0,4)).join(`, `),details:{labels:i,...o.length>0?{buttons:o}:{}}}}function Y(e,t,n){let r=new Set,i=[];for(let a of e){let e=Z(a,n);if(!(!e||r.has(e))&&(r.add(e),i.push(e),i.length>=t))break}return i}function Fe(e,t){return X(e)-X(t)||Ie(e,t)}function X(e){let t=!!Z(e,{includeIdentifiers:!1});return(Q(e)?2:0)+ +!t}function Ie(e,t){return e.rect&&t.rect?e.rect.y-t.rect.y||e.rect.x-t.rect.x:e.rect?-1:t.rect?1:(e.depth??0)-(t.depth??0)||e.index-t.index}function Z(e,t){let n=(t.includeIdentifiers?[e.label,e.value,e.identifier]:[e.label,e.value]).map(e=>typeof e==`string`?e.trim():``).find(e=>e.length>0);return n?n.replaceAll(/\s+/g,` `).slice(0,80):``}function Q(e){let t=p(`${e.type??``} ${e.role??``} ${e.subrole??``}`),n=`${e.label??``} ${e.value??``}`.trim().toLowerCase();return Ae.some(e=>t.includes(e))||je.has(n)||n.endsWith(`.fill`)}function Le(e){let t=`${e.type??``} ${e.role??``} ${e.subrole??``}`;return p(t).includes(`button`)}async function Re(e){let{req:t,sessionName:n,sessionStore:r}=e,i=ze(t);if(`ok`in i)return i;let a=i,{ref:o,session:s,device:c}=await j(r,n,t),l=await Be(e,a,s,c);if(l&&`ok`in l)return l;let u=l,d=t.internal?.replayLandmarkGuard,f=Ve(a,s);if(`ok`in f)return f;let{waitParsed:p,staleRefsWarning:m}=f;return e.consumedSnapshot??={},e.captureProof??={},a.kind===`sleep`?await $({...e,ref:o},p,s,c,u,m,d):ce({response:await M(s,c,()=>$({...e,ref:o},p,s,c,u,m,d),e.platformResourceCleanup),consumedTree:H(e),captureProof:e.captureProof})}function ze(e){let t=u(e.positionals??[]);if(!t)return n(`INVALID_ARGS`,`wait requires a duration or text`);if(t.kind===`invalid`)return n(`INVALID_ARGS`,t.message);if(t.kind!==`absent`)return t;let i=r({depth:e.flags?.snapshotDepth,scope:e.flags?.snapshotScope});if(!i)return t;let a=re(i,`wait`);return n(a.code,a.message,a.details)}async function Be(e,t,n,r){if(!ke(t.kind))return;let i=await R({command:`wait`,device:r,session:n,inspectFacts:e.inspectFacts,platformServices:e.platformServices,bindDevice:e.bindDevice});return i.ok?i.operations:i.response}function Ve(e,t){if(e.kind!==`ref`)return{waitParsed:e};let n=L(e.rawRef);return n.ok?{waitParsed:{...e,rawRef:n.ref},staleRefsWarning:se({session:t,ref:n.ref,mintedGeneration:n.generation})}:n.response}async function $(e,t,n,r,i,a,o){let{req:s,sessionName:c,sessionStore:l}=e,u=await P({...e,ref:e.ref,session:n,device:r,bound:i}),d=await V(async()=>{let r=await u.selectors.wait({session:c,requestId:s.meta?.requestId,target:He(t,n,o)}),i=z(r);F(l,e.ref,s,I(r),i,`landmark`);let d=B(r);return a?{...d,warning:a}:d}),f=i?await Me({req:s,logPath:e.logPath,session:n,device:r,capture:i.capture,captureProof:e.captureProof},d):d;return await N(e,f,`wait`)}function He(e,t,n){switch(e.kind){case`sleep`:return{kind:`sleep`,durationMs:e.durationMs};case`selector`:return{kind:`selector`,selector:e.selectorExpression,timeoutMs:e.timeoutMs,...n?{recordedLandmark:n}:{}};case`absent`:return{kind:`absent`,selector:e.selectorExpression,timeoutMs:e.timeoutMs};case`ref`:return We(e,t);case`stable`:return{kind:`stable`,quietMs:e.quietMs,timeoutMs:e.timeoutMs};case`text`:return Ge(e);default:return Ue(e)}}function Ue(e){throw Error(`Unsupported wait positional target: ${String(e)}`)}function We(t,n){if(!n?.snapshot)throw new e(`INVALID_ARGS`,`Ref wait requires an existing snapshot in session.`);return{kind:`ref`,ref:t.rawRef,timeoutMs:t.timeoutMs}}function Ge(t){let n=s(t.text);if(!n.ok)throw new e(n.code,n.message);return{kind:`text`,text:n.text,timeoutMs:t.timeoutMs}}const Ke={snapshot:async({req:e,createCommandSurface:t,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c})=>await W({createCommandSurface:t,req:e,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c}),diff:async({req:e,createCommandSurface:t,sessionName:r,logPath:i,sessionStore:a,inspectFacts:o,bindDevice:s,platformServices:c,platformResourceCleanup:l})=>e.positionals?.[0]===`snapshot`?await Oe({createCommandSurface:t,req:e,sessionName:r,logPath:i,sessionStore:a,inspectFacts:o,bindDevice:s,platformServices:c,platformResourceCleanup:l}):n(`INVALID_ARGS`,`diff currently supports only: diff snapshot`),wait:async({req:e,createCommandSurface:t,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c})=>await Re({createCommandSurface:t,req:e,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c}),alert:async({req:e,sessionName:t,logPath:n,sessionStore:r,inspectFacts:i,bindDevice:a,platformServices:o,platformResourceCleanup:s})=>{let{ref:c,session:l,device:u}=await j(r,t,e);return await M(l,u,async()=>await me({req:e,logPath:n,sessionStore:r,ref:c,device:u,inspectFacts:i,bindDevice:a,platformServices:o}),s)},settings:async({req:e,sessionName:t,logPath:n,sessionStore:r,inspectFacts:i,bindDevice:a,platformServices:o,platformResourceCleanup:s})=>{let c=ve(e);if(!c.ok)return c;let{ref:l,session:u,device:d}=await j(r,t,e);return await M(u,d,async()=>await K({req:e,logPath:n,sessionStore:r,ref:l,device:d,parsed:c.parsed,inspectFacts:i,bindDevice:a,platformServices:o}),s)}};async function qe(e){let t=e.req.command,n=Ke[t];return n?await n(e):null}export{qe as handleSnapshotCommands};
@@ -1 +1 @@
1
- import{R as e}from"./sdk-contracts.js";import{ht as t,v as n}from"./sdk-io.js";import"./diagnostics.js";import{c as r}from"./host-file.js";import{i,r as a}from"./tool-provider2.js";import o from"node:path";import{fileURLToPath as s}from"node:url";const c={"push button":`Button`,"toggle button":`Button`,"push button menu":`Button`,label:`StaticText`,static:`StaticText`,caption:`StaticText`,text:`TextField`,entry:`TextField`,"password text":`TextField`,"spin button":`TextField`,terminal:`TextArea`,"document text":`TextArea`,paragraph:`TextArea`,frame:`Window`,window:`Window`,dialog:`Dialog`,alert:`Alert`,"file chooser":`Dialog`,"color chooser":`Dialog`,"font chooser":`Dialog`,panel:`Group`,filler:`Group`,section:`Group`,form:`Group`,grouping:`Group`,"layered pane":`Group`,"glass pane":`Group`,"root pane":`Group`,"option pane":`Group`,"internal frame":`Group`,"desktop frame":`Group`,"block quote":`Group`,article:`Group`,comment:`Group`,landmark:`Group`,log:`Group`,marquee:`Group`,math:`Group`,notification:`Group`,"content deletion":`Group`,"content insertion":`Group`,mark:`Group`,suggestion:`Group`,"scroll pane":`ScrollArea`,"scroll bar":`ScrollBar`,"menu bar":`MenuBar`,menu:`Menu`,"popup menu":`Menu`,"menu item":`MenuItem`,"check menu item":`MenuItem`,"radio menu item":`MenuItem`,"tearoff menu item":`MenuItem`,"check box":`CheckBox`,"radio button":`RadioButton`,switch:`Switch`,"combo box":`ComboBox`,"page tab":`Tab`,"page tab list":`TabList`,table:`Table`,"tree table":`Table`,"table cell":`Cell`,"table row":`Row`,"table column header":`Cell`,"table row header":`Cell`,"column header":`Cell`,"row header":`Cell`,list:`List`,"list item":`ListItem`,"list box":`List`,tree:`Tree`,"tree item":`TreeItem`,"description list":`List`,"description term":`ListItem`,"description value":`ListItem`,"tool bar":`Toolbar`,"status bar":`StatusBar`,"info bar":`StatusBar`,slider:`Slider`,"progress bar":`ProgressBar`,"level bar":`ProgressBar`,image:`Image`,icon:`Image`,animation:`Image`,canvas:`Image`,"drawing area":`Image`,video:`Video`,audio:`Audio`,link:`Link`,hyperlink:`Link`,separator:`Separator`,application:`Application`,"tool tip":`Tooltip`,timer:`Timer`,heading:`Heading`,footnote:`Footnote`,"title bar":`TitleBar`,"date editor":`DateEditor`,rating:`Slider`};function l(e){let t=e.toLowerCase().trim();return c[t]||t.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}const u=`atspi-dump.py`;let d=null;function f(){if(d)return d;let t=o.dirname(s(import.meta.url));for(let e=0;e<6;e++){let e=o.join(t,`linux`,u);if(r(e))return d=e,e;t=o.dirname(t)}throw new e(`TOOL_MISSING`,`Cannot find ${u}. Ensure the agent-device package is installed correctly.`)}async function p(t,r={}){let o=a().accessibility;if(o)return await o.captureTree(t,r);if(n()!==`linux`)throw new e(`UNSUPPORTED_PLATFORM`,`AT-SPI2 bridge is only available on Linux`);if(!await a().whichCommand(`python3`))throw new e(`TOOL_MISSING`,`python3 is required for AT-SPI2 accessibility snapshots on Linux.`);let s=r.maxNodes??1500,c=r.maxDepth??12,u=r.maxApps??24,d=[f(),`--surface`,t,`--max-nodes`,String(s),`--max-depth`,String(c),`--max-apps`,String(u)],p=await i(`python3`,d,{allowFailure:!0,timeoutMs:3e4,signal:r.signal});if(p.exitCode!==0){let t=p.stderr.trim();throw t.includes(`No module named`)||t.includes(`gi.require_version`)?new e(`TOOL_MISSING`,`AT-SPI2 Python bindings not found. Install python3-gi and gir1.2-atspi-2.0.`,{cause:t}):new e(`COMMAND_FAILED`,`AT-SPI2 snapshot failed (exit ${p.exitCode}): ${t||p.stdout}`)}let m;try{m=JSON.parse(p.stdout)}catch{throw new e(`COMMAND_FAILED`,`AT-SPI2 snapshot returned invalid JSON: ${p.stdout.slice(0,200)}`)}if(m.error)throw new e(`COMMAND_FAILED`,`AT-SPI2: ${m.error}`);return{nodes:(m.nodes??[]).map(e=>({index:e.index,type:l(e.role),role:e.role,label:e.label??void 0,value:e.value??void 0,rect:e.rect??void 0,enabled:e.enabled??void 0,selected:e.selected??void 0,hittable:e.hittable??void 0,depth:e.depth,parentIndex:e.parentIndex??void 0,pid:e.pid??void 0,appName:e.appName??void 0,windowTitle:e.windowTitle??void 0})),truncated:m.truncated,surface:t}}function m(e){return e===`desktop`?`desktop`:e===`frontmost-app`||e===`app`?`frontmost-app`:(e===`menubar`&&t({level:`warn`,phase:`linux_snapshot`,data:{message:`menubar surface is not supported on Linux, falling back to desktop`}}),`desktop`)}async function h(e,t){let n=await p(m(e),{signal:t});return{nodes:n.nodes,truncated:n.truncated}}async function g(e,t,n){let{nodes:r}=await h(n),i=r.filter(n=>{let r=n.rect;return r?e>=r.x&&t>=r.y&&e<=r.x+r.width&&t<=r.y+r.height:!1}).sort((e,t)=>{let n=e.depth??0,r=t.depth??0;return n===r?_(e.rect)-_(t.rect):r-n});for(let e of i){let t=v(e);if(t.trim())return t}return``}function _(e){return(e?.width??0)*(e?.height??0)}function v(e){for(let t of[e.value,e.label,e.identifier])if(typeof t==`string`&&t.length>0)return t;return``}export{g as readLinuxTextAtPoint,h as snapshotLinux};
1
+ import{R as e}from"./sdk-contracts.js";import{_t as t,v as n}from"./sdk-io.js";import"./diagnostics.js";import{c as r}from"./host-file.js";import{i,r as a}from"./tool-provider2.js";import o from"node:path";import{fileURLToPath as s}from"node:url";const c={"push button":`Button`,"toggle button":`Button`,"push button menu":`Button`,label:`StaticText`,static:`StaticText`,caption:`StaticText`,text:`TextField`,entry:`TextField`,"password text":`TextField`,"spin button":`TextField`,terminal:`TextArea`,"document text":`TextArea`,paragraph:`TextArea`,frame:`Window`,window:`Window`,dialog:`Dialog`,alert:`Alert`,"file chooser":`Dialog`,"color chooser":`Dialog`,"font chooser":`Dialog`,panel:`Group`,filler:`Group`,section:`Group`,form:`Group`,grouping:`Group`,"layered pane":`Group`,"glass pane":`Group`,"root pane":`Group`,"option pane":`Group`,"internal frame":`Group`,"desktop frame":`Group`,"block quote":`Group`,article:`Group`,comment:`Group`,landmark:`Group`,log:`Group`,marquee:`Group`,math:`Group`,notification:`Group`,"content deletion":`Group`,"content insertion":`Group`,mark:`Group`,suggestion:`Group`,"scroll pane":`ScrollArea`,"scroll bar":`ScrollBar`,"menu bar":`MenuBar`,menu:`Menu`,"popup menu":`Menu`,"menu item":`MenuItem`,"check menu item":`MenuItem`,"radio menu item":`MenuItem`,"tearoff menu item":`MenuItem`,"check box":`CheckBox`,"radio button":`RadioButton`,switch:`Switch`,"combo box":`ComboBox`,"page tab":`Tab`,"page tab list":`TabList`,table:`Table`,"tree table":`Table`,"table cell":`Cell`,"table row":`Row`,"table column header":`Cell`,"table row header":`Cell`,"column header":`Cell`,"row header":`Cell`,list:`List`,"list item":`ListItem`,"list box":`List`,tree:`Tree`,"tree item":`TreeItem`,"description list":`List`,"description term":`ListItem`,"description value":`ListItem`,"tool bar":`Toolbar`,"status bar":`StatusBar`,"info bar":`StatusBar`,slider:`Slider`,"progress bar":`ProgressBar`,"level bar":`ProgressBar`,image:`Image`,icon:`Image`,animation:`Image`,canvas:`Image`,"drawing area":`Image`,video:`Video`,audio:`Audio`,link:`Link`,hyperlink:`Link`,separator:`Separator`,application:`Application`,"tool tip":`Tooltip`,timer:`Timer`,heading:`Heading`,footnote:`Footnote`,"title bar":`TitleBar`,"date editor":`DateEditor`,rating:`Slider`};function l(e){let t=e.toLowerCase().trim();return c[t]||t.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}const u=`atspi-dump.py`;let d=null;function f(){if(d)return d;let t=o.dirname(s(import.meta.url));for(let e=0;e<6;e++){let e=o.join(t,`linux`,u);if(r(e))return d=e,e;t=o.dirname(t)}throw new e(`TOOL_MISSING`,`Cannot find ${u}. Ensure the agent-device package is installed correctly.`)}async function p(t,r={}){let o=a().accessibility;if(o)return await o.captureTree(t,r);if(n()!==`linux`)throw new e(`UNSUPPORTED_PLATFORM`,`AT-SPI2 bridge is only available on Linux`);if(!await a().whichCommand(`python3`))throw new e(`TOOL_MISSING`,`python3 is required for AT-SPI2 accessibility snapshots on Linux.`);let s=r.maxNodes??1500,c=r.maxDepth??12,u=r.maxApps??24,d=[f(),`--surface`,t,`--max-nodes`,String(s),`--max-depth`,String(c),`--max-apps`,String(u)],p=await i(`python3`,d,{allowFailure:!0,timeoutMs:3e4,signal:r.signal});if(p.exitCode!==0){let t=p.stderr.trim();throw t.includes(`No module named`)||t.includes(`gi.require_version`)?new e(`TOOL_MISSING`,`AT-SPI2 Python bindings not found. Install python3-gi and gir1.2-atspi-2.0.`,{cause:t}):new e(`COMMAND_FAILED`,`AT-SPI2 snapshot failed (exit ${p.exitCode}): ${t||p.stdout}`)}let m;try{m=JSON.parse(p.stdout)}catch{throw new e(`COMMAND_FAILED`,`AT-SPI2 snapshot returned invalid JSON: ${p.stdout.slice(0,200)}`)}if(m.error)throw new e(`COMMAND_FAILED`,`AT-SPI2: ${m.error}`);return{nodes:(m.nodes??[]).map(e=>({index:e.index,type:l(e.role),role:e.role,label:e.label??void 0,value:e.value??void 0,rect:e.rect??void 0,enabled:e.enabled??void 0,selected:e.selected??void 0,hittable:e.hittable??void 0,depth:e.depth,parentIndex:e.parentIndex??void 0,pid:e.pid??void 0,appName:e.appName??void 0,windowTitle:e.windowTitle??void 0})),truncated:m.truncated,surface:t}}function m(e){return e===`desktop`?`desktop`:e===`frontmost-app`||e===`app`?`frontmost-app`:(e===`menubar`&&t({level:`warn`,phase:`linux_snapshot`,data:{message:`menubar surface is not supported on Linux, falling back to desktop`}}),`desktop`)}async function h(e,t){let n=await p(m(e),{signal:t});return{nodes:n.nodes,truncated:n.truncated}}async function g(e,t,n){let{nodes:r}=await h(n),i=r.filter(n=>{let r=n.rect;return r?e>=r.x&&t>=r.y&&e<=r.x+r.width&&t<=r.y+r.height:!1}).sort((e,t)=>{let n=e.depth??0,r=t.depth??0;return n===r?_(e.rect)-_(t.rect):r-n});for(let e of i){let t=v(e);if(t.trim())return t}return``}function _(e){return(e?.width??0)*(e?.height??0)}function v(e){for(let t of[e.value,e.label,e.identifier])if(typeof t==`string`&&t.length>0)return t;return``}export{g as readLinuxTextAtPoint,h as snapshotLinux};