agent-device 0.21.0 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.0.apk → agent-device-android-ime-helper-0.21.1.apk} +0 -0
  2. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.1.apk.sha256 +1 -0
  3. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.0.manifest.json → agent-device-android-ime-helper-0.21.1.manifest.json} +4 -4
  4. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.0.apk → agent-device-android-snapshot-helper-0.21.1.apk} +0 -0
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.1.apk.sha256 +1 -0
  6. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.0.manifest.json → agent-device-android-snapshot-helper-0.21.1.manifest.json} +6 -6
  7. package/apple/snapshot-bridge/README.md +58 -1
  8. package/apple/snapshot-bridge/SnapshotBridge.m +6 -0
  9. package/apple/snapshot-bridge/SnapshotBridgeCapture.h +25 -0
  10. package/apple/snapshot-bridge/SnapshotBridgeCapture.m +138 -0
  11. package/apple/snapshot-bridge/SnapshotBridgeRuntime.h +1 -0
  12. package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +32 -3
  13. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +12 -0
  14. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +20 -0
  15. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSelectorMatchPolicy.swift +15 -15
  16. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSystemSurfaceHostPolicy.swift +72 -0
  17. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +63 -14
  18. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +668 -82
  19. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +14 -4
  20. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+BlockingSystemModalResolution.swift +39 -4
  21. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +1065 -223
  22. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +290 -0
  23. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +1 -1
  24. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +10 -10
  25. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +249 -61
  26. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +101 -42
  27. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +13 -13
  28. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +51 -43
  29. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +71 -4
  30. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +144 -7
  31. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +13 -1
  32. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +216 -17
  33. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +206 -22
  34. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +289 -42
  35. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +92 -22
  36. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +617 -122
  37. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTiming.swift +79 -4
  38. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedCommitDeadline.swift +71 -71
  39. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +83 -5
  40. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +67 -67
  41. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +4 -4
  42. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +17 -17
  43. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +30 -30
  44. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryReadiness.swift +31 -31
  45. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputCandidatePolicy.swift +28 -0
  46. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputProbe.swift +101 -0
  47. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +19 -19
  48. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +55 -17
  49. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +26 -5
  50. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +125 -75
  51. package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/RecordingExportSupport.swift +9 -9
  52. package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +9 -9
  53. package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-trim.swift +4 -4
  54. package/dist/src/adapter.js +1 -1
  55. package/dist/src/adb-executor.js +1 -1
  56. package/dist/src/adb-failure.js +1 -1
  57. package/dist/src/agent-browser-process-record.js +1 -1
  58. package/dist/src/agent-browser-provider.js +1 -1
  59. package/dist/src/agent-browser-tool.js +1 -1
  60. package/dist/src/agent-device-client.js +2 -2
  61. package/dist/src/ai-sdk.d.ts +1 -1
  62. package/dist/src/ai-sdk.js +1 -1
  63. package/dist/src/alert-runtime.js +1 -1
  64. package/dist/src/android-input-ownership.js +1 -1
  65. package/dist/src/app-catalog.js +1 -1
  66. package/dist/src/app-deployment-resolution.js +1 -1
  67. package/dist/src/app-inventory-contract.js +1 -1
  68. package/dist/src/app-inventory.js +1 -1
  69. package/dist/src/app-launch.js +2 -2
  70. package/dist/src/app-lifecycle.js +3 -3
  71. package/dist/src/app-lifecycle2.js +1 -1
  72. package/dist/src/app-log-files.js +1 -1
  73. package/dist/src/app-log-runtime2.js +3 -3
  74. package/dist/src/app-resolution.js +1 -1
  75. package/dist/src/apple-runner-platform.js +1 -0
  76. package/dist/src/application-lifecycle-interaction.js +1 -1
  77. package/dist/src/archive.js +1 -1
  78. package/dist/src/artifact-download.js +1 -1
  79. package/dist/src/auth-session.js +1 -1
  80. package/dist/src/auth.js +1 -1
  81. package/dist/src/backend-snapshot-options.js +1 -1
  82. package/dist/src/boot-diagnostics.js +1 -1
  83. package/dist/src/capture.js +1 -1
  84. package/dist/src/cli-config.js +1 -1
  85. package/dist/src/cli-help.js +25 -21
  86. package/dist/src/cli-runner.js +1 -1
  87. package/dist/src/cli.js +4 -4
  88. package/dist/src/click-button.js +1 -1
  89. package/dist/src/client-metro-companion.js +1 -1
  90. package/dist/src/client-metro.js +1 -1
  91. package/dist/src/client-types.d.ts +27 -13
  92. package/dist/src/code-signature-cache.js +1 -1
  93. package/dist/src/code-signature.js +1 -1
  94. package/dist/src/command-schema.js +3 -3
  95. package/dist/src/command-tools.js +2 -2
  96. package/dist/src/command.js +1 -1
  97. package/dist/src/connection-runtime.js +1 -1
  98. package/dist/src/connection.js +3 -3
  99. package/dist/src/contracts.d.ts +1 -1
  100. package/dist/src/contracts.js +1 -1
  101. package/dist/src/daemon-client-lifecycle.js +1 -1
  102. package/dist/src/daemon.js +1 -1
  103. package/dist/src/debug-symbols-facade.js +1 -1
  104. package/dist/src/device-claim-rule.js +1 -1
  105. package/dist/src/device-inventory-context.js +1 -1
  106. package/dist/src/device-rotation.js +1 -1
  107. package/dist/src/device-selection-resolver.js +1 -1
  108. package/dist/src/device-session.js +1 -1
  109. package/dist/src/device2.js +1 -1
  110. package/dist/src/diagnostics.js +1 -1
  111. package/dist/src/dispatch-resolve.js +1 -1
  112. package/dist/src/doctor2.js +1 -1
  113. package/dist/src/error.js +1 -1
  114. package/dist/src/exec.js +1 -1
  115. package/dist/src/file.js +1 -1
  116. package/dist/src/find.js +1 -1
  117. package/dist/src/generic-settle.js +1 -1
  118. package/dist/src/gesture-plan.js +1 -1
  119. package/dist/src/gesture-runtime.js +1 -1
  120. package/dist/src/harmonyos.js +1 -1
  121. package/dist/src/hdc.js +1 -1
  122. package/dist/src/helper.js +2 -2
  123. package/dist/src/human-control-contract.js +1 -1
  124. package/dist/src/human-control.js +1 -1
  125. package/dist/src/index.d.ts +1 -1
  126. package/dist/src/index.js +1 -1
  127. package/dist/src/input-actions.js +1 -1
  128. package/dist/src/input-actions2.js +2 -2
  129. package/dist/src/install-artifact-facade.js +1 -1
  130. package/dist/src/install-source-network-transport.js +1 -1
  131. package/dist/src/install-source2.js +1 -1
  132. package/dist/src/interaction-positionals.js +1 -1
  133. package/dist/src/interaction-ref-policy.js +1 -1
  134. package/dist/src/interaction2.js +1 -1
  135. package/dist/src/interactor.js +5 -5
  136. package/dist/src/interactor2.js +1 -1
  137. package/dist/src/interactors.js +1 -1
  138. package/dist/src/internal/bin.js +1 -1
  139. package/dist/src/internal/daemon.js +2 -2
  140. package/dist/src/internal/png-worker.js +1 -1
  141. package/dist/src/internal/run-script-http-child.js +1 -1
  142. package/dist/src/inventory.js +2 -2
  143. package/dist/src/inventory2.js +1 -1
  144. package/dist/src/inventory3.js +1 -1
  145. package/dist/src/inventory5.js +1 -1
  146. package/dist/src/ios-snapshot-runtime.js +1 -1
  147. package/dist/src/ios-system-surface.js +1 -0
  148. package/dist/src/lease-scope.js +1 -1
  149. package/dist/src/lease.js +1 -1
  150. package/dist/src/limrun-runtime-dependencies.js +1 -1
  151. package/dist/src/limrun.d.ts +1 -1
  152. package/dist/src/linux.js +1 -1
  153. package/dist/src/location-coordinates.js +1 -1
  154. package/dist/src/managed-device-scope.js +1 -1
  155. package/dist/src/mechanics.js +16 -16
  156. package/dist/src/multitouch-support.js +1 -1
  157. package/dist/src/observation.js +1 -1
  158. package/dist/src/open-target-resolution.js +1 -0
  159. package/dist/src/owner-identity.js +3 -3
  160. package/dist/src/parameterized-recorded-fill.js +1 -1
  161. package/dist/src/perf-facade.js +2 -2
  162. package/dist/src/perf-process-identity.js +1 -0
  163. package/dist/src/perf-runtime-operation-builder.js +1 -1
  164. package/dist/src/perf-runtime-plan.js +1 -1
  165. package/dist/src/perf.js +1 -1
  166. package/dist/src/physical-device-control.js +1 -1
  167. package/dist/src/platform-runtime-android-adb-host.js +1 -1
  168. package/dist/src/platform-runtime-app-log-process.js +1 -1
  169. package/dist/src/platform-runtime-host.js +1 -1
  170. package/dist/src/platform-runtime-managed-owner.js +1 -1
  171. package/dist/src/platform-runtime-open-target.js +1 -1
  172. package/dist/src/platform-runtime-operation-host.js +2 -2
  173. package/dist/src/platform-runtime-runtime-hints.js +2 -2
  174. package/dist/src/platform-runtime-screen-recording-android-host.js +1 -1
  175. package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
  176. package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
  177. package/dist/src/platform-runtime-unavailable.js +1 -1
  178. package/dist/src/platform-runtime.js +1 -1
  179. package/dist/src/platform-runtime2.js +1 -1
  180. package/dist/src/png-worker-contract.js +1 -1
  181. package/dist/src/prepare-kind.js +1 -1
  182. package/dist/src/provider-device-runtime.js +1 -1
  183. package/dist/src/provider-session-ownership.js +1 -1
  184. package/dist/src/provider-webdriver.js +1 -1
  185. package/dist/src/proxy.js +1 -1
  186. package/dist/src/react-native.js +1 -1
  187. package/dist/src/record-runtime.js +1 -1
  188. package/dist/src/rect-center.js +1 -1
  189. package/dist/src/register-builtins.js +1 -1
  190. package/dist/src/registry.js +37 -36
  191. package/dist/src/remote-config2.js +1 -1
  192. package/dist/src/replay-divergence.js +1 -1
  193. package/dist/src/replay.js +2 -2
  194. package/dist/src/reporting.js +9 -8
  195. package/dist/src/request-admission.js +1 -1
  196. package/dist/src/request-cancel.js +1 -1
  197. package/dist/src/request-runtime-binding.js +1 -1
  198. package/dist/src/retry.js +1 -1
  199. package/dist/src/runner-cache-metadata.js +2 -2
  200. package/dist/src/runner-client.js +1 -1
  201. package/dist/src/runner-disposal.js +1 -1
  202. package/dist/src/runner-operations-facade.js +1 -1
  203. package/dist/src/runner.js +1 -1
  204. package/dist/src/runtime-transport-hints.js +1 -1
  205. package/dist/src/runtime.js +3 -3
  206. package/dist/src/runtime2.js +4 -4
  207. package/dist/src/runtime3.js +1 -1
  208. package/dist/src/runtime4.js +5 -4
  209. package/dist/src/runtime5.js +1 -1
  210. package/dist/src/runtime6.js +1 -1
  211. package/dist/src/runtime7.js +1 -1
  212. package/dist/src/runtime8.js +1 -1
  213. package/dist/src/runtime9.js +1 -1
  214. package/dist/src/screen-recording-live-handle.js +1 -1
  215. package/dist/src/screen-recording-options.js +1 -1
  216. package/dist/src/screen-recording-resource-recovery.js +1 -1
  217. package/dist/src/screenshot-density.js +1 -1
  218. package/dist/src/screenshot-runtime.js +1 -1
  219. package/dist/src/screenshot.js +1 -1
  220. package/dist/src/screenshot3.js +3 -3
  221. package/dist/src/script.js +1 -1
  222. package/dist/src/scroll-command.js +1 -1
  223. package/dist/src/scroll-gesture.js +1 -1
  224. package/dist/src/sdk-batch-runner.js +2 -2
  225. package/dist/src/sdk-batch.js +2 -2
  226. package/dist/src/sdk-contracts.d.ts +44 -1
  227. package/dist/src/sdk-contracts.js +2 -2
  228. package/dist/src/sdk-device.js +1 -1
  229. package/dist/src/sdk-finders.d.ts +1 -1
  230. package/dist/src/sdk-io.js +1 -1
  231. package/dist/src/sdk-remote-config.d.ts +1 -1
  232. package/dist/src/sdk-remote-config.js +1 -1
  233. package/dist/src/sdk-selectors.d.ts +69 -13
  234. package/dist/src/selector-runtime.js +1 -1
  235. package/dist/src/server.js +3 -3
  236. package/dist/src/session-allocation.js +1 -1
  237. package/dist/src/session-observation.js +1 -0
  238. package/dist/src/session-routing.js +1 -1
  239. package/dist/src/session-runtime-admission.js +1 -1
  240. package/dist/src/session-snapshot.js +1 -1
  241. package/dist/src/session-store.js +3 -3
  242. package/dist/src/session-target-evidence.js +1 -1
  243. package/dist/src/session2.js +5 -5
  244. package/dist/src/settings.js +1 -1
  245. package/dist/src/simulator.js +1 -1
  246. package/dist/src/snapshot-quality-backend-capabilities.js +1 -1
  247. package/dist/src/snapshot-quality-verdict.js +1 -1
  248. package/dist/src/snapshot-runtime-binding.js +1 -1
  249. package/dist/src/snapshot-runtime.js +1 -1
  250. package/dist/src/snapshot-state.js +1 -1
  251. package/dist/src/snapshot2.js +1 -1
  252. package/dist/src/snapshot3.js +1 -1
  253. package/dist/src/snapshot4.js +1 -1
  254. package/dist/src/src.js +1 -1
  255. package/dist/src/src7.js +2 -2
  256. package/dist/src/src8.js +2 -2
  257. package/dist/src/string-enum.js +1 -1
  258. package/dist/src/takeover.js +1 -1
  259. package/dist/src/tool-provider.js +2 -2
  260. package/dist/src/tool-provider2.js +1 -1
  261. package/dist/src/tool-provider3.js +1 -1
  262. package/dist/src/toolchain-probe.js +1 -1
  263. package/dist/src/touch-reference-frame.js +1 -0
  264. package/dist/src/touch-runtime.js +1 -1
  265. package/dist/src/transport.js +1 -1
  266. package/dist/src/tv-remote.js +1 -1
  267. package/dist/src/type-text-runtime.js +1 -1
  268. package/dist/src/update-check.js +1 -1
  269. package/dist/src/verified-file.js +1 -1
  270. package/dist/src/video.js +1 -1
  271. package/dist/src/web.js +1 -1
  272. package/dist/src/web2.js +1 -1
  273. package/dist/src/webdriver-source.js +1 -1
  274. package/dist/src/window-state.js +1 -0
  275. package/package.json +3 -2
  276. package/server.json +2 -2
  277. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.0.apk.sha256 +0 -1
  278. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.0.apk.sha256 +0 -1
  279. package/dist/src/back-mode.js +0 -1
  280. package/dist/src/format.js +0 -2
  281. package/dist/src/platform-runtime-apple-resources.js +0 -1
  282. package/dist/src/runner-selector-query.js +0 -1
@@ -48,9 +48,9 @@ extension RunnerTests {
48
48
  }
49
49
  }
50
50
 
51
- // MARK: - Snapshot Entry
52
51
 
53
- /// One raw-value table covers public XCTest cases and the SDK-hidden Keyboard/Key values.
52
+
53
+
54
54
  static let elementTypeNamesByRawValue = [
55
55
  XCUIElement.ElementType.application.rawValue: "Application",
56
56
  XCUIElement.ElementType.window.rawValue: "Window",
@@ -111,11 +111,11 @@ extension RunnerTests {
111
111
 
112
112
  static let flatInteractiveFallbackBudget: TimeInterval = 1.0
113
113
 
114
- // The single production entry point -- always compiled, no unit-test overload. A unit test
115
- // exercises this exact function; the only injectable seam lives inside
116
- // `boundedBlockingSystemAlertSnapshot`'s probe closure (see `systemModalProbeOverrideForTesting`
117
- // in RunnerTests.swift), so reverting this entry point to bypass the bounded probe fails the
118
- // regression test.
114
+
115
+
116
+
117
+
118
+
119
119
  func snapshotFast(app: XCUIApplication, options: PresentationOptions) throws -> DataPayload {
120
120
  let deadline = Date().addingTimeInterval(Self.snapshotPlanBudget)
121
121
  if let blocking = boundedBlockingSystemAlertSnapshot(deadline: deadline) {
@@ -146,11 +146,11 @@ extension RunnerTests {
146
146
  return result.elements
147
147
  }
148
148
 
149
- // Acquisition serializes facts: every traversed node is emitted at raw traversal depth, and
150
- // the regular projection's clip fold runs once inside `SnapshotPresentation` (#1797). The two
151
- // walks this backend keeps are the raw budget or regular presented-depth frontier, plus
152
- // collapsed-tab augmentation which needs live element handles; neither walk publishes a
153
- // presentation node.
149
+
150
+
151
+
152
+
153
+
154
154
  var nodes: [RawAXNode] = []
155
155
  let rootEvaluation = evaluateSnapshot(context.rootSnapshot)
156
156
  nodes.append(
@@ -269,7 +269,7 @@ extension RunnerTests {
269
269
  )
270
270
  }
271
271
 
272
- // See `snapshotFast` above: the single production entry point, no unit-test overload.
272
+
273
273
  func snapshotRaw(app: XCUIApplication, options: PresentationOptions) throws -> DataPayload {
274
274
  let deadline = Date().addingTimeInterval(Self.snapshotPlanBudget)
275
275
  if let blocking = boundedBlockingSystemAlertSnapshot(deadline: deadline) {
@@ -284,19 +284,24 @@ extension RunnerTests {
284
284
  )
285
285
  }
286
286
 
287
- /// Runs the pre-plan SpringBoard system-modal probe as a bounded capture tier sharing the plan
288
- /// deadline, so a slow alert enumeration cannot bypass the snapshot timeout and stall (#1244).
287
+
288
+
289
289
  func boundedBlockingSystemAlertSnapshot(deadline: Date) -> DataPayload? {
290
290
  boundedBlockingSystemAlertSnapshotBody(deadline: deadline) { probeDeadline in
291
+
292
+
293
+
294
+
295
+
291
296
  return self.blockingSystemAlertSnapshot(deadline: probeDeadline)
292
297
  }
293
298
  }
294
299
 
295
- /// The real bounding/hook machinery used by `boundedBlockingSystemAlertSnapshot` above: the
296
- /// probe closure it's given always calls `self.blockingSystemAlertSnapshot` in production, and
297
- /// in unit-test builds may first consult `systemModalProbeOverrideForTesting`. Keeping this in
298
- /// one place means the `runMainThreadWork` wrap and the `onAbandoned`/`onDrained` hooks can
299
- /// never drift between what production runs and what the unit tests exercise.
300
+
301
+
302
+
303
+
304
+
300
305
  private func boundedBlockingSystemAlertSnapshotBody(
301
306
  deadline: Date,
302
307
  probe: @escaping (Date) -> DataPayload?
@@ -350,8 +355,8 @@ extension RunnerTests {
350
355
  #endif
351
356
  }
352
357
 
353
- /// The probe gets its own budget, clamped by whatever remains of the shared plan deadline, and
354
- /// 0 (skip entirely) once that deadline is already spent.
358
+
359
+
355
360
  static func systemModalProbeSlice(
356
361
  budget: TimeInterval,
357
362
  deadlineRemaining: TimeInterval
@@ -419,8 +424,8 @@ extension RunnerTests {
419
424
  )
420
425
  }
421
426
 
422
- // Bounded by both its own sweep budget and the umbrella capture-plan deadline, so a
423
- // chained recovery tier can never push the plan past the main-thread watchdog (#1105).
427
+
428
+
424
429
  let sweepDeadline = hint.interactiveOnly
425
430
  ? Date().addingTimeInterval(Self.flatInteractiveFallbackBudget)
426
431
  : Date.distantFuture
@@ -459,9 +464,9 @@ extension RunnerTests {
459
464
  return left.type < right.type
460
465
  }
461
466
 
462
- // The synthetic root doubles as the daemon's viewport (find.ts prefers on-screen matches
463
- // inside nodes[0].rect): use the real screen viewport when capture produced a finite one,
464
- // so off-screen candidates can never inflate the root and masquerade as on-screen.
467
+
468
+
469
+
465
470
  let rootRect = viewport.isInfinite || viewport.isNull || viewport.isEmpty
466
471
  ? interactiveRootFrame(for: candidates)
467
472
  : viewport
@@ -499,8 +504,8 @@ extension RunnerTests {
499
504
  NSLog("AGENT_DEVICE_RUNNER_SNAPSHOT_AX_UNAVAILABLE=%@", failure.message)
500
505
  runnerAccessibilityHealth = .unavailable
501
506
  invalidateCachedTarget(reason: Self.axSnapshotUnavailableReason)
502
- // This is a planned terminal result, so it carries the structured verdict like every other
503
- // planned snapshot — downstream sparse handling keys off the verdict, not node shapes.
507
+
508
+
504
509
  return sparseTruncatedSnapshotPayload(
505
510
  message: recoveredSnapshotMessage(failure),
506
511
  snapshotQuality: SnapshotQuality(
@@ -546,6 +551,248 @@ extension RunnerTests {
546
551
  }
547
552
 
548
553
 
554
+
555
+
556
+
557
+
558
+
559
+
560
+
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
+
549
796
  private func interactiveRootNode(rect: CGRect) -> RawAXNode {
550
797
  RawAXNode(
551
798
  index: 0,
@@ -583,7 +830,7 @@ extension RunnerTests {
583
830
  )
584
831
  }
585
832
 
586
- // MARK: - Snapshot Filtering
833
+
587
834
 
588
835
  func makeSnapshotTraversalContext(
589
836
  app: XCUIApplication,
@@ -619,8 +866,8 @@ extension RunnerTests {
619
866
  return abandonedTreeCaptureCount > 0
620
867
  }
621
868
 
622
- /// The watchdog abandoned one unit of XCTest main-thread capture work that is still draining on
623
- /// main; XCTest-backed snapshot tiers skip (`hasAbandonedTreeCapture`) until a matching release.
869
+
870
+
624
871
  func retainAbandonedXCTestChannelWork() {
625
872
  treeCaptureLock.lock()
626
873
  abandonedTreeCaptureCount += 1
@@ -633,11 +880,11 @@ extension RunnerTests {
633
880
  treeCaptureLock.unlock()
634
881
  }
635
882
 
636
- /// Runs the blocking tree-snapshot XPC on the main thread bounded by `sliceSeconds`. On
637
- /// timeout the XPC keeps running on main (it cannot be cancelled); the capture is marked
638
- /// abandoned so plans avoid XCTest-backed tiers until it drains, the tree backend is penalized
639
- /// for this bundle, and the plan moves to the platform's independent recovery tier when one
640
- /// exists (#1105/#1122).
883
+
884
+
885
+
886
+
887
+
641
888
  private func captureSnapshotRootBounded(
642
889
  _ element: XCUIElement,
643
890
  sliceSeconds: TimeInterval
@@ -858,8 +1105,8 @@ extension RunnerTests {
858
1105
  let containerFrame = containerSnapshot.frame
859
1106
  if containerFrame.isNull || containerFrame.isEmpty { return [] }
860
1107
 
861
- // Collapsed tab containers should be rare, so a full descendant scan is acceptable once per
862
- // snapshot as a fallback for XCTest omitting the tab children from the snapshot tree.
1108
+
1109
+
863
1110
  let elements = resolveElements()
864
1111
  let candidates = elements.compactMap { element in
865
1112
  collapsedTabCandidateNode(
@@ -879,7 +1126,7 @@ extension RunnerTests {
879
1126
  if candidates.count < 2 { return [] }
880
1127
  let rowMidpoints = candidates.map { $0.rect.y + ($0.rect.height / 2) }
881
1128
  let rowSpread = (rowMidpoints.max() ?? 0) - (rowMidpoints.min() ?? 0)
882
- // Allow modest vertical jitter and short two-row wraps while still rejecting unrelated controls.
1129
+
883
1130
  if rowSpread > max(24.0, Double(containerFrame.height) * 0.6) { return [] }
884
1131
 
885
1132
  var seen = Set<String>()
@@ -1090,8 +1337,8 @@ extension RunnerTests {
1090
1337
  var node: RawAXNode?
1091
1338
  let exceptionMessage = RunnerObjCExceptionCatcher.catchException({
1092
1339
  if !element.exists { return }
1093
- // Declared residue: a flat element query has no hierarchy for geometryless semantics to
1094
- // attach to, so frameless elements are dropped at acquisition rather than presented.
1340
+
1341
+
1095
1342
  let frame = element.frame
1096
1343
  if frame.isNull || frame.isEmpty { return }
1097
1344
  let label = element.label.trimmingCharacters(in: .whitespacesAndNewlines)
@@ -5,14 +5,19 @@ enum SnapshotBackendEnvironment {
5
5
  case physicalDevice
6
6
  }
7
7
 
8
+
9
+
10
+
11
+
8
12
  enum SnapshotRegularDepthCapability: String {
9
- /// The backend can stop acquisition at the requested regular presented-depth frontier.
13
+
10
14
  case presentedFrontier = "presented-frontier"
11
- /// The backend is flat; it can answer the root and one presented level, but has no hierarchy
12
- /// from which to prove deeper regular depth.
15
+
16
+
13
17
  case flat
14
- /// The backend can return raw traversal depth, but cannot prove regular presented depth.
15
- case rawOnly = "raw-only"
18
+
19
+
20
+ case presentationCut = "presentation-cut"
16
21
  }
17
22
 
18
23
  enum SnapshotBackendKind: String, CaseIterable {
@@ -42,10 +47,10 @@ enum SnapshotBackendKind: String, CaseIterable {
42
47
  }
43
48
  }
44
49
 
45
- /// The raw projection is the acquired tree, so only a backend that enumerates a hierarchy can
46
- /// serve it. The query sweep answers an interactive element query: it has no hierarchy to
47
- /// return, and planning it for `--raw` is exactly how a raw request gets answered with regular
48
- /// membership.
50
+
51
+
52
+
53
+
49
54
  var supportsRawProjection: Bool {
50
55
  switch self {
51
56
  case .recursiveTree, .privateAX:
@@ -62,19 +67,7 @@ enum SnapshotBackendKind: String, CaseIterable {
62
67
  case .querySweep:
63
68
  return .flat
64
69
  case .privateAX:
65
- return .rawOnly
66
- }
67
- }
68
-
69
- func canServeRegularPresentedDepth(_ requestedDepth: Int?) -> Bool {
70
- guard let requestedDepth else { return true }
71
- switch regularDepthCapability {
72
- case .presentedFrontier:
73
- return true
74
- case .flat:
75
- return requestedDepth <= 1
76
- case .rawOnly:
77
- return false
70
+ return .presentationCut
78
71
  }
79
72
  }
80
73
 
@@ -96,3 +89,80 @@ enum SnapshotBackendKind: String, CaseIterable {
96
89
  }
97
90
  }
98
91
 
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+