agent-device 0.21.12 → 0.21.14

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 (317) hide show
  1. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.12.apk → agent-device-android-ime-helper-0.21.14.apk} +0 -0
  2. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.14.apk.sha256 +1 -0
  3. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.12.manifest.json → agent-device-android-ime-helper-0.21.14.manifest.json} +4 -4
  4. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.14.apk +0 -0
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.14.apk.sha256 +1 -0
  6. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.12.manifest.json → agent-device-android-snapshot-helper-0.21.14.manifest.json} +6 -6
  7. package/apple/macos-helper/Package.swift +4 -0
  8. package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/main.swift +3 -6
  9. package/apple/macos-helper/Tests/AgentDeviceMacOSHelperTests/ScreenshotResponseTests.swift +15 -0
  10. package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +47 -1
  11. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +122 -42
  12. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/Info.plist +23 -0
  13. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +17 -0
  14. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAppScreenCapture.swift +21 -13
  15. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerScrollViewportPolicy.swift +1 -162
  16. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +0 -9
  17. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +0 -56
  18. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSystemSurfaceHostPolicy.swift +0 -48
  19. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +0 -50
  20. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +33 -586
  21. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +40 -24
  22. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift +2 -3
  23. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+BlockingSystemModalResolution.swift +0 -36
  24. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandDispatch.swift +630 -0
  25. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +34 -2256
  26. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +1 -338
  27. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +0 -12
  28. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+GestureExecution.swift +160 -0
  29. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +0 -24
  30. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +0 -142
  31. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +90 -39
  32. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+MainThreadWork.swift +78 -106
  33. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +23 -2
  34. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +162 -113
  35. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +0 -209
  36. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +86 -10
  37. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollDragExecution.swift +271 -0
  38. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +1 -200
  39. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +20 -227
  40. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +78 -295
  41. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotAcquisition.swift +40 -27
  42. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +0 -78
  43. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +85 -581
  44. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCaptureTarget.swift +106 -0
  45. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotExecution.swift +142 -0
  46. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTiming.swift +49 -78
  47. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedCommitDeadline.swift +0 -44
  48. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +73 -114
  49. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedInteraction.swift +1 -12
  50. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +11 -94
  51. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +2 -10
  52. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +1 -1
  53. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +0 -35
  54. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputCandidatePolicy.swift +0 -31
  55. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +2 -18
  56. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +34 -52
  57. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +0 -22
  58. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TypeExecution.swift +135 -0
  59. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +22 -6
  60. package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +140 -20
  61. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotCoordinateSpace.swift +16 -19
  62. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotGeometry.swift +21 -9
  63. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotModels.swift +59 -10
  64. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationInvariant.swift +12 -10
  65. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFold.swift +13 -8
  66. package/dist/src/absence-observation-errors.js +1 -1
  67. package/dist/src/adapter.js +1 -1
  68. package/dist/src/adb-executor.js +1 -1
  69. package/dist/src/adb-failure.js +1 -1
  70. package/dist/src/adb-transport.js +1 -1
  71. package/dist/src/agent-browser-provider.js +1 -1
  72. package/dist/src/agent-browser-tool.js +1 -1
  73. package/dist/src/agent-device-client.js +2 -2
  74. package/dist/src/ai-sdk.js +1 -1
  75. package/dist/src/alert-runtime.js +1 -1
  76. package/dist/src/android-adb.d.ts +1 -1
  77. package/dist/src/app-catalog.js +1 -1
  78. package/dist/src/app-deployment-resolution.js +1 -1
  79. package/dist/src/app-inventory.js +1 -1
  80. package/dist/src/app-launch.js +2 -2
  81. package/dist/src/app-lifecycle.js +1 -1
  82. package/dist/src/app-lifecycle2.js +1 -1
  83. package/dist/src/app-log-files.js +1 -1
  84. package/dist/src/app-log-runtime2.js +3 -3
  85. package/dist/src/app-resolution.js +2 -2
  86. package/dist/src/apple-runner-platform.js +1 -1
  87. package/dist/src/application-lifecycle-interaction.js +1 -1
  88. package/dist/src/archive.js +1 -1
  89. package/dist/src/artifact-download.js +1 -1
  90. package/dist/src/auth-session.js +1 -1
  91. package/dist/src/auth.js +1 -1
  92. package/dist/src/back-mode.js +1 -1
  93. package/dist/src/backend-snapshot-options.js +1 -1
  94. package/dist/src/boot-diagnostics.js +1 -1
  95. package/dist/src/capture-disclosure.js +1 -1
  96. package/dist/src/capture.js +1 -1
  97. package/dist/src/cli-config.js +1 -1
  98. package/dist/src/cli-help.js +8 -7
  99. package/dist/src/cli-runner.js +1 -1
  100. package/dist/src/cli.js +4 -4
  101. package/dist/src/click-button.js +1 -1
  102. package/dist/src/client-metro.js +1 -1
  103. package/dist/src/client-types.d.ts +4 -5
  104. package/dist/src/clipboard-shell-response.js +1 -1
  105. package/dist/src/code-signature.js +1 -1
  106. package/dist/src/command-schema.js +3 -3
  107. package/dist/src/command-tools.js +3 -3
  108. package/dist/src/connection-runtime.js +1 -1
  109. package/dist/src/connection.js +1 -1
  110. package/dist/src/contracts.js +1 -1
  111. package/dist/src/daemon-client-lifecycle.js +1 -1
  112. package/dist/src/daemon-resolution.js +1 -1
  113. package/dist/src/daemon.js +1 -1
  114. package/dist/src/debug-symbols-facade.js +1 -1
  115. package/dist/src/device-claim-rule.js +2 -2
  116. package/dist/src/device-input-state.d.ts +1 -1
  117. package/dist/src/device-inventory-context.js +1 -1
  118. package/dist/src/device-rotation.js +1 -1
  119. package/dist/src/device-selection-resolver.js +1 -1
  120. package/dist/src/device-session.js +1 -1
  121. package/dist/src/device-shell.js +1 -1
  122. package/dist/src/device2.js +1 -1
  123. package/dist/src/devicectl.js +1 -1
  124. package/dist/src/diagnostics.js +1 -1
  125. package/dist/src/dispatch-resolve.js +1 -1
  126. package/dist/src/display-inventory.js +1 -1
  127. package/dist/src/doctor-facade.js +1 -1
  128. package/dist/src/doctor2.js +1 -1
  129. package/dist/src/engine-eval-script.js +1 -1
  130. package/dist/src/error.js +1 -1
  131. package/dist/src/exec.js +1 -1
  132. package/dist/src/file.js +1 -1
  133. package/dist/src/find.js +1 -1
  134. package/dist/src/format.js +1 -1
  135. package/dist/src/gesture-plan-types.d.ts +38 -0
  136. package/dist/src/gesture-plan.js +1 -1
  137. package/dist/src/gesture-runtime.js +1 -1
  138. package/dist/src/harmonyos.js +1 -1
  139. package/dist/src/helper.js +2 -2
  140. package/dist/src/host.js +1 -1
  141. package/dist/src/human-control-contract.js +1 -1
  142. package/dist/src/human-control.js +1 -1
  143. package/dist/src/index.js +1 -1
  144. package/dist/src/input-actions.js +1 -1
  145. package/dist/src/input-actions2.js +1 -1
  146. package/dist/src/install-artifact-facade.js +1 -1
  147. package/dist/src/install-source-network-transport.js +1 -1
  148. package/dist/src/install-source2.js +1 -1
  149. package/dist/src/interaction-positionals.js +1 -1
  150. package/dist/src/interaction-ref-policy.js +1 -1
  151. package/dist/src/interaction2.js +1 -1
  152. package/dist/src/interactor-operation-binding.js +1 -1
  153. package/dist/src/interactor-operation-catalog.js +1 -1
  154. package/dist/src/interactor.js +4 -4
  155. package/dist/src/interactor2.js +1 -1
  156. package/dist/src/interactors.js +1 -1
  157. package/dist/src/internal/bin.js +1 -1
  158. package/dist/src/internal/daemon.js +2 -2
  159. package/dist/src/internal/png-worker.js +1 -1
  160. package/dist/src/internal/run-script-http-child.js +1 -1
  161. package/dist/src/inventory.js +1 -1
  162. package/dist/src/inventory2.js +1 -1
  163. package/dist/src/inventory3.js +1 -1
  164. package/dist/src/inventory5.js +1 -1
  165. package/dist/src/ios-snapshot-acquisition.js +1 -1
  166. package/dist/src/ios-snapshot-runtime.js +1 -1
  167. package/dist/src/lease.js +1 -1
  168. package/dist/src/limrun-download-file.js +1 -1
  169. package/dist/src/limrun-runtime-dependencies.js +1 -1
  170. package/dist/src/limrun.d.ts +435 -4
  171. package/dist/src/linux.js +1 -1
  172. package/dist/src/local-interactor-operation-set.js +1 -1
  173. package/dist/src/location-coordinates.js +1 -1
  174. package/dist/src/managed-device-scope.js +1 -1
  175. package/dist/src/mechanics.js +5 -5
  176. package/dist/src/mobile-snapshot-semantics.js +1 -1
  177. package/dist/src/multitouch-support.js +1 -1
  178. package/dist/src/native-build-cache.js +1 -0
  179. package/dist/src/observation.js +1 -1
  180. package/dist/src/parameterized-recorded-fill.js +1 -1
  181. package/dist/src/perf-facade.js +1 -2
  182. package/dist/src/perf-runtime-operation-builder.js +1 -1
  183. package/dist/src/perf-runtime-plan.js +1 -1
  184. package/dist/src/perf-target.js +2 -0
  185. package/dist/src/perf.js +1 -1
  186. package/dist/src/physical-device-apps.js +1 -0
  187. package/dist/src/physical-device-control.js +1 -1
  188. package/dist/src/platform-request-scope.js +1 -1
  189. package/dist/src/platform-runtime-host.js +1 -1
  190. package/dist/src/platform-runtime-managed-owner.js +1 -1
  191. package/dist/src/platform-runtime-open-target.js +1 -1
  192. package/dist/src/platform-runtime-operation-host.js +2 -2
  193. package/dist/src/platform-runtime-runtime-hints.js +1 -1
  194. package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
  195. package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
  196. package/dist/src/platform-runtime-screen-recording-process-host.js +1 -1
  197. package/dist/src/platform-runtime-unavailable.js +1 -1
  198. package/dist/src/platform-runtime.js +1 -1
  199. package/dist/src/platform-runtime2.js +1 -1
  200. package/dist/src/png-crop-bytes.js +1 -1
  201. package/dist/src/png-size.js +1 -1
  202. package/dist/src/png-worker-client.js +1 -1
  203. package/dist/src/png.js +1 -1
  204. package/dist/src/prepare-kind.js +1 -1
  205. package/dist/src/provider-session-ownership.js +1 -1
  206. package/dist/src/provider-webdriver.js +1 -1
  207. package/dist/src/proxy.js +1 -1
  208. package/dist/src/quality-warnings.js +1 -1
  209. package/dist/src/react-native.js +1 -1
  210. package/dist/src/record-runtime.js +1 -1
  211. package/dist/src/recording.js +1 -1
  212. package/dist/src/register-builtins.js +1 -1
  213. package/dist/src/registry.js +35 -35
  214. package/dist/src/remote-config2.js +1 -1
  215. package/dist/src/replay-divergence.js +1 -1
  216. package/dist/src/replay.js +1 -1
  217. package/dist/src/reporting.js +1 -1
  218. package/dist/src/request-admission.js +1 -1
  219. package/dist/src/request-cancel.js +1 -1
  220. package/dist/src/request-runtime-binding.js +1 -1
  221. package/dist/src/retry.js +1 -1
  222. package/dist/src/runner-cache-metadata.js +1 -1
  223. package/dist/src/runner-client.js +1 -1
  224. package/dist/src/runner-dev-tools-security.js +1 -1
  225. package/dist/src/runner-device-readiness.js +1 -1
  226. package/dist/src/runner-disposal.js +1 -1
  227. package/dist/src/runner-error-classification.js +3 -0
  228. package/dist/src/runner-operations-facade.js +1 -1
  229. package/dist/src/runner-presentation.js +1 -1
  230. package/dist/src/runner.js +1 -1
  231. package/dist/src/runtime-transport-hints.js +1 -1
  232. package/dist/src/runtime.js +3 -3
  233. package/dist/src/runtime10.js +2 -2
  234. package/dist/src/runtime2.js +2 -2
  235. package/dist/src/runtime3.js +1 -1
  236. package/dist/src/runtime4.js +4 -4
  237. package/dist/src/runtime5.js +1 -1
  238. package/dist/src/runtime6.js +1 -1
  239. package/dist/src/runtime7.js +1 -1
  240. package/dist/src/runtime8.js +1 -1
  241. package/dist/src/runtime9.js +1 -1
  242. package/dist/src/screen-recording-admission-ledger.js +1 -1
  243. package/dist/src/screen-recording-completion.js +1 -1
  244. package/dist/src/screen-recording-options.js +1 -1
  245. package/dist/src/screen-recording-resource-recovery.js +1 -1
  246. package/dist/src/screen-recording-transport.js +1 -1
  247. package/dist/src/screenshot-density.js +1 -1
  248. package/dist/src/screenshot-image.js +1 -1
  249. package/dist/src/screenshot-runtime.js +1 -1
  250. package/dist/src/screenshot.js +1 -1
  251. package/dist/src/screenshot3.js +1 -1
  252. package/dist/src/script.js +1 -1
  253. package/dist/src/scroll-command.d.ts +377 -0
  254. package/dist/src/scroll-command.js +1 -1
  255. package/dist/src/scroll-gesture.js +1 -1
  256. package/dist/src/sdk-batch-runner.js +2 -2
  257. package/dist/src/sdk-batch.js +2 -2
  258. package/dist/src/sdk-contracts.d.ts +28 -0
  259. package/dist/src/sdk-contracts.js +1 -1
  260. package/dist/src/sdk-device.js +1 -1
  261. package/dist/src/sdk-io.js +1 -1
  262. package/dist/src/sdk-remote-config.js +1 -1
  263. package/dist/src/sdk-selectors.d.ts +23 -726
  264. package/dist/src/selection.js +0 -0
  265. package/dist/src/selector-runtime.js +1 -1
  266. package/dist/src/semantic-index.js +1 -1
  267. package/dist/src/server.js +1 -1
  268. package/dist/src/session-allocation.js +1 -1
  269. package/dist/src/session-observation.js +1 -1
  270. package/dist/src/session-routing.js +1 -1
  271. package/dist/src/session-runtime-admission.js +1 -1
  272. package/dist/src/session-snapshot.js +1 -1
  273. package/dist/src/session-store.js +2 -2
  274. package/dist/src/session2.js +3 -3
  275. package/dist/src/settings.js +1 -1
  276. package/dist/src/simctl-facade.js +1 -1
  277. package/dist/src/simctl.js +1 -1
  278. package/dist/src/simulator-state.js +1 -1
  279. package/dist/src/simulator.js +1 -1
  280. package/dist/src/snapshot-runtime-binding.js +1 -1
  281. package/dist/src/snapshot-runtime.js +1 -1
  282. package/dist/src/snapshot-state.js +1 -1
  283. package/dist/src/snapshot2.js +1 -1
  284. package/dist/src/snapshot3.js +1 -1
  285. package/dist/src/snapshot4.js +1 -1
  286. package/dist/src/src.js +1 -1
  287. package/dist/src/src7.js +1 -1
  288. package/dist/src/src8.js +2 -2
  289. package/dist/src/string-enum.js +1 -1
  290. package/dist/src/takeover.js +1 -1
  291. package/dist/src/text-entry-focus.js +1 -1
  292. package/dist/src/tool-provider-facade.js +1 -1
  293. package/dist/src/tool-provider.js +2 -2
  294. package/dist/src/tool-provider2.js +1 -1
  295. package/dist/src/touch-runtime.js +1 -1
  296. package/dist/src/transport.js +1 -1
  297. package/dist/src/tree.js +1 -1
  298. package/dist/src/tv-remote.js +1 -1
  299. package/dist/src/type-text-runtime.js +1 -1
  300. package/dist/src/update-check.js +1 -1
  301. package/dist/src/verified-file.js +1 -1
  302. package/dist/src/version.js +1 -1
  303. package/dist/src/video.js +1 -1
  304. package/dist/src/viewport.js +1 -1
  305. package/dist/src/web.js +1 -1
  306. package/dist/src/web2.js +1 -1
  307. package/dist/src/webdriver-source.js +1 -1
  308. package/package.json +3 -2
  309. package/server.json +2 -2
  310. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.12.apk.sha256 +0 -1
  311. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.12.apk +0 -0
  312. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.12.apk.sha256 +0 -1
  313. package/dist/src/app-inventory.d.ts +0 -4
  314. package/dist/src/apps-simctl.js +0 -1
  315. package/dist/src/cloud-artifacts.d.ts +0 -61
  316. package/dist/src/runner-contract.js +0 -3
  317. package/dist/src/snapshot-process.js +0 -1
@@ -5,12 +5,12 @@ extension RunnerTests {
5
5
  static let axSnapshotErrorCode = "IOS_AX_SNAPSHOT_FAILED"
6
6
  static let axSnapshotFailureMessage =
7
7
  "iOS XCTest snapshot failed while serializing the accessibility tree."
8
- private static let axSnapshotUnavailableReason = "ax_snapshot_unavailable"
8
+ static let axSnapshotUnavailableReason = "ax_snapshot_unavailable"
9
9
  static let axSnapshotHint =
10
10
  "Snapshot state is unavailable because XCTest could not serialize this iOS accessibility tree. This can be specific to the current screen. Use plain screenshot, not screenshot --overlay-refs, as visual truth; navigate with coordinate commands if needed; then retry snapshot -i after reaching another screen. If you own the app and need full-tree inspection, simplify this screen's accessibility tree and expose stable ids on actionable controls."
11
- private static let rawSnapshotTooLargeCode = "IOS_RAW_SNAPSHOT_TOO_LARGE"
12
- private static let rawSnapshotMaxNodes = 5_000
13
- private static let rawSnapshotTooLargeHint =
11
+ static let rawSnapshotTooLargeCode = "IOS_RAW_SNAPSHOT_TOO_LARGE"
12
+ static let rawSnapshotMaxNodes = 5_000
13
+ static let rawSnapshotTooLargeHint =
14
14
  "Raw iOS snapshot exceeded the runner payload guard. Use regular snapshot for visible UI, or scope/depth-limit raw snapshot when inspecting a large accessibility tree."
15
15
 
16
16
 
@@ -21,9 +21,8 @@ extension RunnerTests {
21
21
  struct SnapshotTraversalContext {
22
22
  let queryRoot: XCUIElement
23
23
  let rootSnapshot: XCUIElementSnapshot
24
- let viewport: CGRect
25
24
 
26
- let interfaceOrientation: Int
25
+ let viewport: SnapshotViewport
27
26
 
28
27
 
29
28
 
@@ -134,6 +133,20 @@ extension RunnerTests {
134
133
  static let flatInteractiveFallbackBudget: TimeInterval = 1.0
135
134
 
136
135
 
136
+ static let flatInteractiveQueryBudget: TimeInterval = 0.1
137
+
138
+
139
+
140
+ static func querySweepSliceDeadline(startedAt: Date, planDeadline: Date) -> Date {
141
+ min(startedAt.addingTimeInterval(flatInteractiveFallbackBudget), planDeadline)
142
+ }
143
+
144
+
145
+ static func querySweepCanStartQuery(deadline: Date, now: Date) -> Bool {
146
+ deadline.timeIntervalSince(now) >= flatInteractiveQueryBudget
147
+ }
148
+
149
+
137
150
 
138
151
 
139
152
 
@@ -145,14 +158,17 @@ extension RunnerTests {
145
158
 
146
159
 
147
160
 
148
- func snapshotFast(app: XCUIApplication, options: PresentationOptions) throws -> DataPayload {
161
+ func snapshotFast(target: SnapshotCaptureTarget, options: PresentationOptions) throws -> DataPayload {
149
162
  let deadline = Date().addingTimeInterval(Self.snapshotPlanBudget)
150
- if let blocking = boundedBlockingSystemAlertSnapshot(deadline: deadline) {
163
+ if let blocking = boundedBlockingSystemAlertSnapshot(
164
+ deadline: deadline,
165
+ penaltyTarget: .prepared(bundleId: target.bundleId)
166
+ ) {
151
167
  return blocking
152
168
  }
153
169
  return try runSnapshotCapturePlan(
154
170
  Self.regularVisiblePlan,
155
- app: app,
171
+ target: target,
156
172
  options: options,
157
173
  terminal: .sparseWithFatalOnAXFailure,
158
174
  deadline: deadline
@@ -261,20 +277,22 @@ extension RunnerTests {
261
277
  nodes: nodes,
262
278
  truncated: false,
263
279
  effectiveDepth: nil,
264
- viewport: context.viewport,
265
- interfaceOrientation: context.interfaceOrientation
280
+ viewport: context.viewport
266
281
  )
267
282
  }
268
283
 
269
284
 
270
- func snapshotRaw(app: XCUIApplication, options: PresentationOptions) throws -> DataPayload {
285
+ func snapshotRaw(target: SnapshotCaptureTarget, options: PresentationOptions) throws -> DataPayload {
271
286
  let deadline = Date().addingTimeInterval(Self.snapshotPlanBudget)
272
- if let blocking = boundedBlockingSystemAlertSnapshot(deadline: deadline) {
287
+ if let blocking = boundedBlockingSystemAlertSnapshot(
288
+ deadline: deadline,
289
+ penaltyTarget: .prepared(bundleId: target.bundleId)
290
+ ) {
273
291
  return blocking
274
292
  }
275
293
  return try runSnapshotCapturePlan(
276
294
  Self.rawDiagnosticPlan,
277
- app: app,
295
+ target: target,
278
296
  options: options,
279
297
  terminal: .throwOnAXFailure,
280
298
  deadline: deadline
@@ -283,8 +301,15 @@ extension RunnerTests {
283
301
 
284
302
 
285
303
 
286
- func boundedBlockingSystemAlertSnapshot(deadline: Date) -> DataPayload? {
287
- boundedBlockingSystemAlertSnapshotBody(deadline: deadline) { probeDeadline in
304
+
305
+ func boundedBlockingSystemAlertSnapshot(
306
+ deadline: Date,
307
+ penaltyTarget: SnapshotProbePenaltyTarget
308
+ ) -> DataPayload? {
309
+ boundedBlockingSystemAlertSnapshotBody(
310
+ deadline: deadline,
311
+ penaltyTarget: penaltyTarget
312
+ ) { probeDeadline in
288
313
 
289
314
 
290
315
 
@@ -301,6 +326,7 @@ extension RunnerTests {
301
326
 
302
327
  private func boundedBlockingSystemAlertSnapshotBody(
303
328
  deadline: Date,
329
+ penaltyTarget: SnapshotProbePenaltyTarget,
304
330
  probe: @escaping (Date) -> DataPayload?
305
331
  ) -> DataPayload? {
306
332
  #if os(macOS)
@@ -316,6 +342,7 @@ extension RunnerTests {
316
342
  }
317
343
  let probeDeadline = Date().addingTimeInterval(slice)
318
344
  let startedAt = Date()
345
+ let penaltyIdentity = SnapshotProbePenaltyIdentity(penaltyTarget)
319
346
  do {
320
347
  return try runMainThreadWork(
321
348
  "system_modal_probe",
@@ -329,12 +356,13 @@ extension RunnerTests {
329
356
  },
330
357
  onAbandoned: {
331
358
  self.penalizeSnapshotXCTestChannel(
332
- bundleId: self.currentBundleId,
359
+ bundleId: penaltyIdentity.penalizedBundleId,
333
360
  reason: "system_modal_probe_timeout"
334
361
  )
335
362
  }
336
363
  ) {
337
- probe(probeDeadline)
364
+ penaltyIdentity.captureFromMain(bundleId: self.currentBundleId)
365
+ return probe(probeDeadline)
338
366
  }
339
367
  } catch {
340
368
  NSLog(
@@ -405,45 +433,40 @@ extension RunnerTests {
405
433
  nodes: nodes,
406
434
  truncated: false,
407
435
  effectiveDepth: nil,
408
- viewport: context.viewport,
409
- interfaceOrientation: context.interfaceOrientation
436
+ viewport: context.viewport
410
437
  )
411
438
  }
412
439
 
413
440
  func querySweepSnapshotAcquisition(
414
441
  app: XCUIApplication,
415
442
  hint: CaptureHint,
416
- planDeadline: Date = .distantFuture
417
- ) -> SnapshotAcquisition {
443
+ sliceDeadline deadline: Date
444
+ ) -> (acquisition: SnapshotAcquisition, outcome: SnapshotTierOutcome) {
418
445
  var nodes: [RawAXNode] = [
419
446
  interactiveRootNode(rect: .zero)
420
447
  ]
421
448
  if hint.rawTraversalDepth == 0 || hint.regularPresentedDepth == 0 {
422
- return SnapshotAcquisition(
423
- hint: hint,
424
- nodes: nodes,
425
- truncated: false,
426
- effectiveDepth: nil,
427
- viewport: .infinite,
428
- interfaceOrientation: RunnerInterfaceOrientation.unknown
449
+ return (
450
+ SnapshotAcquisition(
451
+ hint: hint,
452
+ nodes: nodes,
453
+ truncated: false,
454
+ effectiveDepth: nil,
455
+ viewport: .missing(reason: .notProvided)
456
+ ),
457
+ .completed
429
458
  )
430
459
  }
431
460
 
432
-
433
-
434
- let sweepDeadline = hint.interactiveOnly
435
- ? Date().addingTimeInterval(Self.flatInteractiveFallbackBudget)
436
- : Date.distantFuture
437
- let deadline = min(sweepDeadline, planDeadline)
438
- let viewport = safeSnapshotViewport(app: app)
461
+ let viewport = safeSnapshotViewport(app: app, readingOrientation: false)
439
462
  var seen = Set<String>()
440
463
  var candidates: [RawAXNode] = []
441
464
  let flatElements = flatInteractiveElements(app: app, deadline: deadline)
442
- var truncated = flatElements.truncated
465
+ var outcome = flatElements.outcome
443
466
  for element in flatElements.elements {
444
- if Date() >= deadline {
467
+ if !Self.querySweepCanStartQuery(deadline: deadline, now: Date()) {
445
468
  NSLog("AGENT_DEVICE_RUNNER_SNAPSHOT_FLAT_FALLBACK_DEADLINE")
446
- truncated = true
469
+ outcome = .deadlineExhausted
447
470
  break
448
471
  }
449
472
  guard let node = flatSnapshotNode(element: element, index: 0, parentIndex: 0) else {
@@ -467,9 +490,7 @@ extension RunnerTests {
467
490
 
468
491
 
469
492
 
470
- let rootRect = viewport.isInfinite || viewport.isNull || viewport.isEmpty
471
- ? interactiveRootFrame(for: candidates)
472
- : viewport
493
+ let rootRect = viewport.rect ?? interactiveRootFrame(for: candidates)
473
494
  nodes[0] = interactiveRootNode(rect: rootRect)
474
495
  for candidate in candidates {
475
496
  nodes.append(
@@ -491,20 +512,24 @@ extension RunnerTests {
491
512
  )
492
513
  )
493
514
  }
494
- return SnapshotAcquisition(
495
- hint: hint,
496
- nodes: nodes,
497
- truncated: truncated,
498
- effectiveDepth: nil,
499
- viewport: viewport,
500
- interfaceOrientation: RunnerInterfaceOrientation.unknown
515
+ return (
516
+ SnapshotAcquisition(
517
+ hint: hint,
518
+ nodes: nodes,
519
+ truncated: outcome == .deadlineExhausted,
520
+ effectiveDepth: nil,
521
+ viewport: viewport
522
+ ),
523
+ outcome
501
524
  )
502
525
  }
503
526
 
504
527
  func snapshotAccessibilityUnavailable(failure: SnapshotCaptureFailure) -> DataPayload {
505
528
  NSLog("AGENT_DEVICE_RUNNER_SNAPSHOT_AX_UNAVAILABLE=%@", failure.message)
506
- runnerAccessibilityHealth = .unavailable
507
- invalidateCachedTarget(reason: Self.axSnapshotUnavailableReason)
529
+ applyMainOwnedSnapshotState("ax_unavailable_invalidation") {
530
+ self.runnerAccessibilityHealth = .unavailable
531
+ self.invalidateCachedTarget(reason: Self.axSnapshotUnavailableReason)
532
+ }
508
533
 
509
534
 
510
535
  return sparseTruncatedSnapshotPayload(
@@ -523,11 +548,11 @@ extension RunnerTests {
523
548
  )
524
549
  }
525
550
 
526
- private func recoveredSnapshotMessage(_ failure: SnapshotCaptureFailure) -> String {
551
+ func recoveredSnapshotMessage(_ failure: SnapshotCaptureFailure) -> String {
527
552
  return "\(failure.message) Hint: \(failure.hint)"
528
553
  }
529
554
 
530
- private func rawSnapshotTooLargeFailure(nodeCount: Int) -> SnapshotCaptureFailure {
555
+ func rawSnapshotTooLargeFailure(nodeCount: Int) -> SnapshotCaptureFailure {
531
556
  SnapshotCaptureFailure(
532
557
  code: Self.rawSnapshotTooLargeCode,
533
558
  message: "iOS raw snapshot exceeded \(Self.rawSnapshotMaxNodes) nodes while walking node \(nodeCount).",
@@ -558,246 +583,4 @@ extension RunnerTests {
558
583
  runnerFatalReason: runnerFatalReason
559
584
  )
560
585
  }
561
-
562
-
563
-
564
-
565
-
566
-
567
-
568
-
569
-
570
-
571
-
572
-
573
-
574
-
575
-
576
-
577
-
578
-
579
-
580
-
581
-
582
-
583
-
584
-
585
-
586
-
587
-
588
-
589
-
590
-
591
-
592
-
593
-
594
-
595
-
596
-
597
-
598
-
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
-
607
-
608
-
609
-
610
-
611
-
612
-
613
-
614
-
615
-
616
-
617
-
618
-
619
-
620
-
621
-
622
-
623
-
624
-
625
-
626
-
627
-
628
-
629
-
630
-
631
-
632
-
633
-
634
-
635
-
636
-
637
-
638
-
639
-
640
-
641
-
642
-
643
-
644
-
645
-
646
-
647
-
648
-
649
-
650
-
651
-
652
-
653
-
654
-
655
-
656
-
657
-
658
-
659
-
660
-
661
-
662
-
663
-
664
-
665
-
666
-
667
-
668
-
669
-
670
-
671
-
672
-
673
-
674
-
675
-
676
-
677
-
678
-
679
-
680
-
681
-
682
-
683
-
684
-
685
-
686
-
687
-
688
-
689
-
690
-
691
-
692
-
693
-
694
-
695
-
696
-
697
-
698
-
699
-
700
-
701
-
702
-
703
-
704
-
705
-
706
-
707
-
708
-
709
-
710
-
711
-
712
-
713
-
714
-
715
-
716
-
717
-
718
-
719
-
720
-
721
-
722
-
723
-
724
-
725
-
726
-
727
-
728
-
729
-
730
-
731
-
732
-
733
-
734
-
735
-
736
-
737
-
738
-
739
-
740
-
741
-
742
-
743
-
744
-
745
-
746
-
747
-
748
-
749
-
750
-
751
-
752
-
753
-
754
-
755
-
756
-
757
-
758
-
759
-
760
-
761
-
762
-
763
-
764
-
765
-
766
-
767
-
768
-
769
-
770
-
771
-
772
-
773
-
774
-
775
-
776
-
777
-
778
-
779
-
780
-
781
-
782
-
783
-
784
-
785
-
786
-
787
-
788
-
789
-
790
-
791
-
792
-
793
-
794
-
795
-
796
-
797
-
798
-
799
-
800
-
801
-
802
-
803
586
  }
@@ -41,18 +41,13 @@ extension RunnerTests {
41
41
 
42
42
 
43
43
 
44
- let geometry = try runMainThreadWork(
44
+ let viewport = try runMainThreadWork(
45
45
  "snapshot_viewport",
46
46
  timeout: min(1.0, max(0.1, captureDeadline.timeIntervalSinceNow)),
47
47
  timeoutError: snapshotMainThreadTimeoutError("preparing tree snapshot")
48
48
  ) {
49
- (
50
- viewport: self.safeSnapshotViewport(app: app),
51
- interfaceOrientation: self.capturedInterfaceOrientation(app: app)
52
- )
49
+ self.safeSnapshotViewport(app: app, readingOrientation: true)
53
50
  }
54
- let viewport = geometry.viewport
55
- let interfaceOrientation = geometry.interfaceOrientation
56
51
  let treeSliceBudget = treeCaptureSliceBudgetOverride ?? treeCaptureSliceBudget
57
52
  let slice = min(treeSliceBudget, max(0.5, captureDeadline.timeIntervalSinceNow))
58
53
  guard let rootSnapshot = try captureSnapshotRootBounded(app, sliceSeconds: slice) else {
@@ -70,7 +65,6 @@ extension RunnerTests {
70
65
  queryRoot: app,
71
66
  rootSnapshot: rootSnapshot,
72
67
  viewport: viewport,
73
- interfaceOrientation: interfaceOrientation,
74
68
  keyboardBand: keyboardBand
75
69
  )
76
70
  }
@@ -140,8 +134,18 @@ extension RunnerTests {
140
134
  return nil
141
135
  }
142
136
 
143
- func safeSnapshotViewport(app: XCUIApplication) -> CGRect {
144
- safely("SNAPSHOT_VIEWPORT", CGRect.infinite) { snapshotViewport(app: app) }
137
+
138
+
139
+
140
+ func safeSnapshotViewport(app: XCUIApplication, readingOrientation: Bool) -> SnapshotViewport {
141
+ safely("SNAPSHOT_VIEWPORT", .missing(reason: .notProvided)) {
142
+ .reported(
143
+ box: snapshotAppFrame(app: app),
144
+ interfaceOrientation: readingOrientation
145
+ ? capturedInterfaceOrientation(app: app)
146
+ : RunnerInterfaceOrientation.unknown
147
+ )
148
+ }
145
149
  }
146
150
 
147
151
  private func describeSnapshotError(_ error: Error) -> String {
@@ -231,16 +235,12 @@ extension RunnerTests {
231
235
  return text.isEmpty ? nil : text
232
236
  }
233
237
 
234
- private func snapshotViewport(app: XCUIApplication) -> CGRect {
238
+ private func snapshotAppFrame(app: XCUIApplication) -> CGRect {
235
239
  #if os(iOS)
236
- let appFrame = onScreenWindowFrame(app: app)
240
+ return onScreenWindowFrame(app: app)
237
241
  #else
238
- let appFrame = app.frame
242
+ return app.frame
239
243
  #endif
240
- if !appFrame.isNull && !appFrame.isEmpty {
241
- return appFrame
242
- }
243
- return .infinite
244
244
  }
245
245
 
246
246
  static func snapshotTraversalIdentity(
@@ -464,7 +464,7 @@ extension RunnerTests {
464
464
  func flatInteractiveElements(
465
465
  app: XCUIApplication,
466
466
  deadline: Date
467
- ) -> (elements: [XCUIElement], truncated: Bool) {
467
+ ) -> (elements: [XCUIElement], outcome: SnapshotTierOutcome) {
468
468
  let queries: [XCUIElementQuery] = [
469
469
  app.buttons,
470
470
  app.links,
@@ -487,23 +487,36 @@ extension RunnerTests {
487
487
  app.images
488
488
  ]
489
489
 
490
- var elements: [XCUIElement] = []
491
- var truncated = false
490
+ return Self.runFlatInteractiveQueries(queries, deadline: deadline) { query in
491
+ self.snapshotElementsQuery {
492
+ query.allElementsBoundByIndex
493
+ }
494
+ }
495
+ }
496
+
497
+
498
+
499
+
500
+
501
+ static func runFlatInteractiveQueries<Query, Element>(
502
+ _ queries: [Query],
503
+ deadline: Date,
504
+ now: () -> Date = { Date() },
505
+ run: (Query) -> (elements: [Element], axUnavailable: Bool)
506
+ ) -> (elements: [Element], outcome: SnapshotTierOutcome) {
507
+ var elements: [Element] = []
492
508
  for query in queries {
493
- if Date() >= deadline {
509
+ if !querySweepCanStartQuery(deadline: deadline, now: now()) {
494
510
  NSLog("AGENT_DEVICE_RUNNER_SNAPSHOT_FLAT_FALLBACK_DEADLINE")
495
- truncated = true
496
- break
497
- }
498
- let result = snapshotElementsQuery {
499
- query.allElementsBoundByIndex
511
+ return (elements, .deadlineExhausted)
500
512
  }
513
+ let result = run(query)
501
514
  elements.append(contentsOf: result.elements)
502
515
  if result.axUnavailable {
503
516
  break
504
517
  }
505
518
  }
506
- return (elements, truncated)
519
+ return (elements, .completed)
507
520
  }
508
521
 
509
522
  func snapshotElementsQuery(