agent-device 0.21.6 → 0.21.7

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 (302) hide show
  1. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.6.apk → agent-device-android-ime-helper-0.21.7.apk} +0 -0
  2. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.7.apk.sha256 +1 -0
  3. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.6.manifest.json → agent-device-android-ime-helper-0.21.7.manifest.json} +4 -4
  4. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.6.apk → agent-device-android-snapshot-helper-0.21.7.apk} +0 -0
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.7.apk.sha256 +1 -0
  6. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.6.manifest.json → agent-device-android-snapshot-helper-0.21.7.manifest.json} +6 -6
  7. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +4 -0
  8. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +20 -0
  9. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerScrollViewportPolicy.swift +1 -2
  10. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +25 -12
  11. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +56 -1
  12. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +1 -1
  13. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +36 -108
  14. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +241 -0
  15. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +29 -0
  16. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +46 -0
  17. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +85 -26
  18. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +134 -117
  19. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +1 -3
  20. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +25 -4
  21. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +1 -1
  22. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +3 -0
  23. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotCoordinateSpace.swift +197 -0
  24. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotModels.swift +30 -4
  25. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentation.swift +0 -81
  26. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationInvariant.swift +1 -9
  27. package/dist/src/absence-observation-errors.js +1 -1
  28. package/dist/src/adapter.js +1 -1
  29. package/dist/src/adb-executor.js +2 -2
  30. package/dist/src/adb-failure.js +1 -1
  31. package/dist/src/adb-transport.js +1 -1
  32. package/dist/src/adb.js +1 -1
  33. package/dist/src/agent-browser-lifecycle.js +1 -1
  34. package/dist/src/agent-browser-process-record.js +1 -1
  35. package/dist/src/agent-browser-provider.js +1 -1
  36. package/dist/src/agent-browser-tool.js +1 -1
  37. package/dist/src/agent-device-client.js +2 -2
  38. package/dist/src/ai-sdk.js +1 -1
  39. package/dist/src/alert-runtime.js +1 -1
  40. package/dist/src/android-adb.d.ts +29 -2
  41. package/dist/src/android-adb.js +1 -1
  42. package/dist/src/android-input-ownership.js +1 -1
  43. package/dist/src/android.js +1 -1
  44. package/dist/src/app-catalog.js +1 -1
  45. package/dist/src/app-deployment-resolution.js +1 -1
  46. package/dist/src/app-helpers.js +1 -1
  47. package/dist/src/app-inventory.js +1 -1
  48. package/dist/src/app-launch.js +2 -2
  49. package/dist/src/app-lifecycle.js +2 -2
  50. package/dist/src/app-lifecycle2.js +2 -2
  51. package/dist/src/app-log-files.js +1 -1
  52. package/dist/src/app-log-runtime2.js +3 -3
  53. package/dist/src/app-resolution.js +2 -2
  54. package/dist/src/app-state.js +1 -1
  55. package/dist/src/apple-runner-platform.js +1 -1
  56. package/dist/src/application-lifecycle-interaction.js +1 -1
  57. package/dist/src/archive.js +1 -1
  58. package/dist/src/artifact-download.js +1 -1
  59. package/dist/src/auth-session.js +1 -1
  60. package/dist/src/auth.js +1 -1
  61. package/dist/src/back-mode.js +1 -1
  62. package/dist/src/backend-snapshot-options.js +1 -1
  63. package/dist/src/boot-diagnostics.js +1 -1
  64. package/dist/src/capture-disclosure.js +1 -0
  65. package/dist/src/capture.js +1 -1
  66. package/dist/src/cli-config.js +1 -1
  67. package/dist/src/cli-help.js +15 -2
  68. package/dist/src/cli-output.js +1 -1
  69. package/dist/src/cli.js +4 -4
  70. package/dist/src/click-button.js +1 -1
  71. package/dist/src/client-metro.js +1 -1
  72. package/dist/src/client-types.d.ts +32 -2
  73. package/dist/src/clipboard-shell-response.js +1 -0
  74. package/dist/src/command-schema.js +1 -1
  75. package/dist/src/command-tools.js +4 -2
  76. package/dist/src/command.js +1 -1
  77. package/dist/src/config.js +1 -1
  78. package/dist/src/connection-runtime.js +1 -1
  79. package/dist/src/connection.js +1 -1
  80. package/dist/src/contracts.d.ts +1 -1
  81. package/dist/src/contracts.js +1 -1
  82. package/dist/src/daemon-client-lifecycle.js +1 -1
  83. package/dist/src/daemon.js +1 -1
  84. package/dist/src/debug-symbols-facade.js +1 -1
  85. package/dist/src/device-boot.js +1 -1
  86. package/dist/src/device-claim-inspection.js +1 -1
  87. package/dist/src/device-claim-rule.js +2 -1
  88. package/dist/src/device-input-state.d.ts +4 -4
  89. package/dist/src/device-inventory-context.js +1 -1
  90. package/dist/src/device-rotation.js +1 -1
  91. package/dist/src/device-selection-resolver.js +1 -1
  92. package/dist/src/device-session.js +1 -1
  93. package/dist/src/device-shell.js +1 -0
  94. package/dist/src/device.js +1 -1
  95. package/dist/src/device2.js +1 -1
  96. package/dist/src/devicectl.js +1 -0
  97. package/dist/src/diagnostics.js +1 -1
  98. package/dist/src/dispatch-resolve.js +1 -1
  99. package/dist/src/display-inventory.js +1 -0
  100. package/dist/src/doctor-facade.js +1 -1
  101. package/dist/src/doctor2.js +1 -1
  102. package/dist/src/durable-resource.js +1 -1
  103. package/dist/src/engine-eval-script.js +1 -1
  104. package/dist/src/error.js +1 -1
  105. package/dist/src/exec.js +1 -1
  106. package/dist/src/file.js +1 -1
  107. package/dist/src/find.js +1 -1
  108. package/dist/src/finders.js +1 -1
  109. package/dist/src/format.js +2 -1
  110. package/dist/src/generic.js +1 -1
  111. package/dist/src/gesture-admission.js +1 -1
  112. package/dist/src/gesture-plan.js +1 -1
  113. package/dist/src/gesture-runtime.js +1 -1
  114. package/dist/src/harmonyos.js +1 -1
  115. package/dist/src/hdc.js +1 -1
  116. package/dist/src/helper.js +1 -1
  117. package/dist/src/human-control-contract.js +1 -1
  118. package/dist/src/human-control.js +1 -1
  119. package/dist/src/index.d.ts +1 -1
  120. package/dist/src/index.js +1 -1
  121. package/dist/src/input-actions.js +1 -1
  122. package/dist/src/input-actions2.js +1 -1
  123. package/dist/src/install-artifact-facade.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-ref-policy.js +1 -1
  128. package/dist/src/interaction.js +1 -1
  129. package/dist/src/interaction2.js +1 -1
  130. package/dist/src/interactor-operation-catalog.js +1 -1
  131. package/dist/src/interactor.js +5 -5
  132. package/dist/src/interactor2.js +1 -1
  133. package/dist/src/interactors.js +1 -1
  134. package/dist/src/internal/bin.js +1 -1
  135. package/dist/src/internal/daemon.js +2 -2
  136. package/dist/src/internal/png-worker.d.ts +4 -1
  137. package/dist/src/internal/png-worker.js +1 -1
  138. package/dist/src/internal/run-script-http-child.js +1 -1
  139. package/dist/src/inventory.js +4 -4
  140. package/dist/src/inventory2.js +1 -1
  141. package/dist/src/inventory3.js +2 -2
  142. package/dist/src/inventory5.js +1 -1
  143. package/dist/src/ios-snapshot-acquisition.js +1 -1
  144. package/dist/src/ios-snapshot-runtime.js +1 -1
  145. package/dist/src/ios-target-activation.js +1 -0
  146. package/dist/src/lease-context.js +1 -1
  147. package/dist/src/lease-scope.js +1 -1
  148. package/dist/src/lease.js +1 -1
  149. package/dist/src/limrun-download-file.js +1 -0
  150. package/dist/src/limrun-runtime-dependencies.js +1 -1
  151. package/dist/src/limrun.d.ts +10 -4
  152. package/dist/src/linux.js +1 -1
  153. package/dist/src/local-interactor-operation-set.js +1 -1
  154. package/dist/src/location-coordinates.js +1 -1
  155. package/dist/src/managed-device-scope.js +1 -1
  156. package/dist/src/mechanics.js +16 -16
  157. package/dist/src/mobile-snapshot-semantics.js +1 -1
  158. package/dist/src/multitouch-support.js +1 -1
  159. package/dist/src/observation.js +2 -2
  160. package/dist/src/output-common.js +5 -2
  161. package/dist/src/parameterized-recorded-fill.js +1 -1
  162. package/dist/src/perf-facade.js +2 -2
  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-request-scope.js +1 -1
  168. package/dist/src/platform-runtime-android-adb-host.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 +4 -4
  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-runner-transport.js +1 -1
  176. package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
  177. package/dist/src/platform-runtime-screen-recording-apple-transport.js +1 -1
  178. package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
  179. package/dist/src/platform-runtime-screen-recording-harmony-host.js +1 -1
  180. package/dist/src/platform-runtime-screen-recording-process-host.js +1 -1
  181. package/dist/src/platform-runtime-unavailable.js +1 -1
  182. package/dist/src/platform-runtime.js +1 -1
  183. package/dist/src/platform-runtime2.js +1 -1
  184. package/dist/src/png-crop-bytes.js +1 -1
  185. package/dist/src/png-transcode.js +1 -0
  186. package/dist/src/png-worker-client.js +1 -0
  187. package/dist/src/png.js +1 -1
  188. package/dist/src/prepare-kind.js +1 -1
  189. package/dist/src/provider-session-ownership.js +1 -1
  190. package/dist/src/provider-webdriver.js +1 -1
  191. package/dist/src/proxy.js +1 -1
  192. package/dist/src/quality-warnings.js +1 -1
  193. package/dist/src/react-native.js +1 -1
  194. package/dist/src/record-runtime.js +1 -1
  195. package/dist/src/record-trace.js +1 -1
  196. package/dist/src/rect-center.js +1 -1
  197. package/dist/src/register-builtins.js +1 -1
  198. package/dist/src/registry.js +35 -35
  199. package/dist/src/remote-config2.js +1 -1
  200. package/dist/src/replay-divergence.js +1 -1
  201. package/dist/src/replay.js +2 -2
  202. package/dist/src/reporting.js +1 -1
  203. package/dist/src/request-admission.js +1 -1
  204. package/dist/src/request-cancel.js +1 -1
  205. package/dist/src/request-runtime-binding.js +1 -1
  206. package/dist/src/result-serialization.js +1 -1
  207. package/dist/src/retry.js +1 -1
  208. package/dist/src/runner-cache-metadata.js +2 -2
  209. package/dist/src/runner-client.js +1 -1
  210. package/dist/src/runner-disposal.js +1 -1
  211. package/dist/src/runner-operations-facade.js +1 -1
  212. package/dist/src/runner-presentation.js +1 -1
  213. package/dist/src/runner.js +1 -1
  214. package/dist/src/runtime-transport-hints.js +1 -1
  215. package/dist/src/runtime.js +3 -3
  216. package/dist/src/runtime10.js +1 -1
  217. package/dist/src/runtime2.js +4 -4
  218. package/dist/src/runtime3.js +1 -1
  219. package/dist/src/runtime4.js +5 -5
  220. package/dist/src/runtime5.js +1 -1
  221. package/dist/src/runtime6.js +1 -1
  222. package/dist/src/runtime7.js +1 -1
  223. package/dist/src/runtime8.js +1 -1
  224. package/dist/src/runtime9.js +1 -1
  225. package/dist/src/screen-recording-admission-ledger.js +1 -0
  226. package/dist/src/screen-recording-completion.js +1 -1
  227. package/dist/src/screen-recording-options.js +1 -1
  228. package/dist/src/screen-recording-resource-recovery.js +1 -1
  229. package/dist/src/screen-recording-transport.js +1 -0
  230. package/dist/src/screenshot-density.js +1 -1
  231. package/dist/src/screenshot-runtime.js +1 -1
  232. package/dist/src/screenshot.js +1 -1
  233. package/dist/src/screenshot3.js +1 -1
  234. package/dist/src/script.js +1 -1
  235. package/dist/src/scroll-command.js +1 -1
  236. package/dist/src/scroll-gesture.js +1 -1
  237. package/dist/src/sdk-batch-runner.js +2 -2
  238. package/dist/src/sdk-batch.js +2 -2
  239. package/dist/src/sdk-contracts.d.ts +76 -1
  240. package/dist/src/sdk-contracts.js +1 -1
  241. package/dist/src/sdk-device.js +1 -1
  242. package/dist/src/sdk-finders.d.ts +1 -1
  243. package/dist/src/sdk-finders.js +1 -1
  244. package/dist/src/sdk-io.js +1 -1
  245. package/dist/src/sdk-remote-config.js +1 -1
  246. package/dist/src/sdk-selectors.d.ts +18 -1
  247. package/dist/src/sdk-selectors.js +1 -1
  248. package/dist/src/selection.js +0 -0
  249. package/dist/src/selector-runtime.js +1 -1
  250. package/dist/src/selectors.js +1 -1
  251. package/dist/src/semantic-index.js +1 -1
  252. package/dist/src/server.js +1 -1
  253. package/dist/src/session-allocation.js +1 -1
  254. package/dist/src/session-observation.js +1 -1
  255. package/dist/src/session-routing.js +1 -1
  256. package/dist/src/session-runtime-admission.js +1 -1
  257. package/dist/src/session-snapshot.js +1 -1
  258. package/dist/src/session-store.js +3 -3
  259. package/dist/src/session2.js +4 -5
  260. package/dist/src/settings.js +1 -1
  261. package/dist/src/simctl-facade.js +1 -1
  262. package/dist/src/simctl.js +1 -1
  263. package/dist/src/simulator-boot.js +1 -1
  264. package/dist/src/simulator.js +1 -1
  265. package/dist/src/snapshot-capture-annotations.js +1 -1
  266. package/dist/src/snapshot-diagnostics.js +1 -1
  267. package/dist/src/snapshot-quality-backend-capabilities.js +1 -1
  268. package/dist/src/snapshot-runtime-binding.js +1 -1
  269. package/dist/src/snapshot-runtime.js +1 -1
  270. package/dist/src/snapshot-state.js +1 -1
  271. package/dist/src/snapshot.js +1 -1
  272. package/dist/src/snapshot2.js +1 -1
  273. package/dist/src/snapshot3.js +1 -1
  274. package/dist/src/snapshot4.js +1 -1
  275. package/dist/src/src.js +1 -1
  276. package/dist/src/src4.js +1 -1
  277. package/dist/src/src7.js +1 -1
  278. package/dist/src/src8.js +1 -1
  279. package/dist/src/stop-sequence.js +1 -1
  280. package/dist/src/string-enum.js +1 -1
  281. package/dist/src/takeover.js +1 -1
  282. package/dist/src/text-entry-focus.js +1 -1
  283. package/dist/src/tool-provider.js +1 -1
  284. package/dist/src/tool-provider2.js +1 -1
  285. package/dist/src/touch-runtime.js +1 -1
  286. package/dist/src/transport.js +1 -1
  287. package/dist/src/tree.js +1 -1
  288. package/dist/src/tv-remote.js +1 -1
  289. package/dist/src/type-text-runtime.js +1 -1
  290. package/dist/src/verified-file.js +1 -1
  291. package/dist/src/video.js +1 -1
  292. package/dist/src/viewport.js +1 -1
  293. package/dist/src/web.js +1 -1
  294. package/dist/src/web2.js +1 -1
  295. package/dist/src/webdriver-source.js +1 -1
  296. package/dist/src/window-state.js +1 -1
  297. package/package.json +2 -1
  298. package/server.json +2 -2
  299. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.6.apk.sha256 +0 -1
  300. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.6.apk.sha256 +0 -1
  301. package/dist/src/session-target-evidence.js +0 -1
  302. package/dist/src/vars.js +0 -2
@@ -1,4 +1,5 @@
1
1
  import XCTest
2
+ import AgentDeviceSnapshotPresentation
2
3
 
3
4
  private enum KeyboardDismissObservationTiming {
4
5
  static let timeout: TimeInterval = 2
@@ -30,6 +31,164 @@ enum RunnerKeyboardDismissMechanism: String {
30
31
  case dismissKey
31
32
  }
32
33
 
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+ enum RunnerKeyboardBandFact: Equatable {
42
+ case visible(CGRect)
43
+ case absent
44
+ case unmeasurable(String)
45
+
46
+ var payload: KeyboardBandFactPayload {
47
+ switch self {
48
+ case .visible(let frame):
49
+ return KeyboardBandFactPayload(
50
+ kind: "visible",
51
+ frame: SnapshotRect(
52
+ x: Double(frame.origin.x),
53
+ y: Double(frame.origin.y),
54
+ width: Double(frame.size.width),
55
+ height: Double(frame.size.height)
56
+ ),
57
+ reason: nil
58
+ )
59
+ case .absent:
60
+ return KeyboardBandFactPayload(kind: "absent", frame: nil, reason: nil)
61
+ case .unmeasurable(let reason):
62
+ return KeyboardBandFactPayload(kind: "unmeasurable", frame: nil, reason: reason)
63
+ }
64
+ }
65
+
66
+ var logKind: String {
67
+ switch self {
68
+ case .visible: return "visible"
69
+ case .absent: return "absent"
70
+ case .unmeasurable: return "unmeasurable"
71
+ }
72
+ }
73
+
74
+ var logReason: String {
75
+ switch self {
76
+ case .visible, .absent: return "-"
77
+ case .unmeasurable(let reason): return reason
78
+ }
79
+ }
80
+ }
81
+
82
+
83
+
84
+
85
+ enum RunnerKeyboardBandReason {
86
+
87
+ static let queryFailed = "keyboard-frame-query-failed"
88
+
89
+
90
+ static let unusableFrame = "keyboard-frame-unusable"
91
+
92
+
93
+
94
+ static let queryTimeout = "keyboard-frame-query-timeout"
95
+
96
+ static let budgetExhausted = "capture-plan-budget-exhausted"
97
+ }
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+ func runnerKeyboardFrameIsUsable(_ frame: CGRect) -> Bool {
107
+ let size = frame.size
108
+ let origin = frame.origin
109
+ return [origin.x, origin.y, size.width, size.height].allSatisfy(\.isFinite)
110
+ && size.width > 0 && size.height > 0
111
+ }
112
+
113
+
114
+
115
+
116
+
117
+
118
+ func runnerKeyboardBandFact(
119
+ readSucceeded: Bool,
120
+ exists: Bool,
121
+ frame: CGRect
122
+ ) -> RunnerKeyboardBandFact {
123
+ guard readSucceeded else { return .unmeasurable(RunnerKeyboardBandReason.queryFailed) }
124
+ guard exists else { return .absent }
125
+ guard runnerKeyboardFrameIsUsable(frame) else {
126
+ return .unmeasurable(RunnerKeyboardBandReason.unusableFrame)
127
+ }
128
+ return .visible(frame)
129
+ }
130
+
131
+ private struct KeyboardBandProbeTimeout: Error {}
132
+
133
+ extension RunnerTests {
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+ func captureKeyboardBandFact(app: XCUIApplication, deadline: Date) -> RunnerKeyboardBandFact? {
146
+ #if os(iOS)
147
+ let slice = min(Self.keyboardBandProbeBudget, max(0, deadline.timeIntervalSinceNow))
148
+ guard slice > 0 else {
149
+ NSLog(
150
+ "AGENT_DEVICE_RUNNER_KEYBOARD_BAND_FACT kind=unmeasurable reason=%@ elapsedMs=0",
151
+ RunnerKeyboardBandReason.budgetExhausted
152
+ )
153
+ return .unmeasurable(RunnerKeyboardBandReason.budgetExhausted)
154
+ }
155
+ let startedAt = Date()
156
+ let fact: RunnerKeyboardBandFact
157
+ do {
158
+ fact = try runMainThreadWork(
159
+ "keyboard_band",
160
+ timeout: slice,
161
+ timeoutError: { KeyboardBandProbeTimeout() }
162
+ ) {
163
+ self.keyboardBandFact(app: app)
164
+ }
165
+ } catch {
166
+ fact = .unmeasurable(RunnerKeyboardBandReason.queryTimeout)
167
+ }
168
+ NSLog(
169
+ "AGENT_DEVICE_RUNNER_KEYBOARD_BAND_FACT kind=%@ reason=%@ elapsedMs=%d",
170
+ fact.logKind,
171
+ fact.logReason,
172
+ Int(Date().timeIntervalSince(startedAt) * 1000)
173
+ )
174
+ return fact
175
+ #else
176
+ return nil
177
+ #endif
178
+ }
179
+
180
+ private func keyboardBandFact(app: XCUIApplication) -> RunnerKeyboardBandFact {
181
+ let read = safely("KEYBOARD_BAND_FACT") { () -> RunnerKeyboardBandFact? in
182
+ let keyboard = app.keyboards.firstMatch
183
+ guard keyboard.exists else {
184
+ return runnerKeyboardBandFact(readSucceeded: true, exists: false, frame: .zero)
185
+ }
186
+ return runnerKeyboardBandFact(readSucceeded: true, exists: true, frame: keyboard.frame)
187
+ }
188
+ return read ?? .unmeasurable(RunnerKeyboardBandReason.queryFailed)
189
+ }
190
+ }
191
+
33
192
  extension RunnerTests {
34
193
  func isKeyboardVisible(app: XCUIApplication) -> Bool {
35
194
  return visibleKeyboardFrame(app: app) != nil
@@ -312,6 +471,88 @@ func runnerScreenshotStabilitySettled(
312
471
 
313
472
 
314
473
 
474
+
475
+
476
+
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+
501
+
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+
512
+
513
+
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+
522
+
523
+
524
+
525
+
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+
534
+
535
+
536
+
537
+
538
+
539
+
540
+
541
+
542
+
543
+
544
+
545
+
546
+
547
+
548
+
549
+
550
+
551
+
552
+
553
+
554
+
555
+
315
556
 
316
557
 
317
558
 
@@ -200,6 +200,20 @@ extension RunnerTests {
200
200
  return true
201
201
  }
202
202
 
203
+
204
+
205
+
206
+
207
+
208
+
209
+ func soleOtherActiveApplicationPid(excluding sessionPid: Int?) -> Int? {
210
+ let pids = RunnerAXSnapshotBridge.activeApplicationProcessIdentifiers().compactMap {
211
+ ($0 as? NSNumber)?.intValue
212
+ }
213
+ let foreign = Set(pids.filter { $0 > 0 && $0 != sessionPid })
214
+ return foreign.count == 1 ? foreign.first : nil
215
+ }
216
+
203
217
  func activateTarget(bundleId: String, reason: String) -> XCUIApplication {
204
218
  let target = XCUIApplication(bundleIdentifier: bundleId)
205
219
  let initialState = target.state
@@ -216,7 +230,22 @@ extension RunnerTests {
216
230
  bundleId
217
231
  )
218
232
  } else {
233
+
234
+
235
+ let otherActiveApplicationPid = soleOtherActiveApplicationPid(excluding: Self.processIdentifier(of: target))
219
236
  target.activate()
237
+ pendingTargetActivation = TargetActivationFactPayload(
238
+ reason: reason,
239
+ priorState: Int(initialState.rawValue),
240
+ otherActiveApplicationPid: otherActiveApplicationPid
241
+ )
242
+ NSLog(
243
+ "AGENT_DEVICE_RUNNER_ACTIVATE_FACT bundle=%@ reason=%@ priorState=%d otherActiveApplicationPid=%@",
244
+ bundleId,
245
+ reason,
246
+ initialState.rawValue,
247
+ otherActiveApplicationPid.map(String.init) ?? "-"
248
+ )
220
249
  }
221
250
  currentApp = target
222
251
  currentBundleId = bundleId
@@ -23,6 +23,7 @@ enum CommandType: String, Codable {
23
23
  case home
24
24
  case rotate
25
25
  case appSwitcher
26
+ case actionButton
26
27
  case keyboardDismiss
27
28
  case keyboardReturn
28
29
  case alert
@@ -97,6 +98,14 @@ extension CommandType {
97
98
  case .recordStop, .uptime, .terminate, .targetReset, .shutdown:
98
99
  return CommandTraits(isInteraction: false, readOnly: .never, isLifecycle: true)
99
100
 
101
+
102
+
103
+
104
+
105
+
106
+ case .actionButton:
107
+ return CommandTraits(isInteraction: false, readOnly: .never, isLifecycle: false)
108
+
100
109
  case .status:
101
110
  return CommandTraits(isInteraction: false, readOnly: .always, isLifecycle: true)
102
111
 
@@ -239,6 +248,28 @@ extension Response {
239
248
  payload.runnerMainThreadBusy = value
240
249
  return Response(ok: ok, data: payload, error: error)
241
250
  }
251
+
252
+
253
+
254
+
255
+ func stampingTargetActivation(_ value: TargetActivationFactPayload) -> Response {
256
+ guard ok else { return self }
257
+ var payload = data ?? DataPayload()
258
+ payload.targetActivation = value
259
+ return Response(ok: ok, data: payload, error: error)
260
+ }
261
+ }
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+ struct TargetActivationFactPayload: Codable {
270
+ let reason: String
271
+ let priorState: Int
272
+ let otherActiveApplicationPid: Int?
242
273
  }
243
274
 
244
275
  struct DataPayload: Codable {
@@ -253,6 +284,10 @@ struct DataPayload: Codable {
253
284
  var snapshotQuality: SnapshotQuality?
254
285
 
255
286
  var systemSurface: SystemSurfaceProvenancePayload?
287
+
288
+
289
+
290
+ var keyboard: KeyboardBandFactPayload?
256
291
  var gestureStartUptimeMs: Double?
257
292
  var gestureEndUptimeMs: Double?
258
293
  var x: Double?
@@ -294,6 +329,17 @@ struct DataPayload: Codable {
294
329
  var completedSteps: Int?
295
330
  var failedStepIndex: Int?
296
331
  var sequenceResults: [SequenceStepResult]?
332
+ var targetActivation: TargetActivationFactPayload?
333
+ }
334
+
335
+
336
+
337
+
338
+
339
+ struct KeyboardBandFactPayload: Codable, Equatable {
340
+ let kind: String
341
+ let frame: SnapshotRect?
342
+ let reason: String?
297
343
  }
298
344
 
299
345
 
@@ -23,33 +23,25 @@ extension RunnerTests {
23
23
 
24
24
 
25
25
 
26
- func privateAXAcquisition(rawRoot: [String: Any], hint: CaptureHint, viewport: CGRect)
27
- -> [RawAXNode]
28
- {
26
+
27
+ func privateAXAcquisition(
28
+ rawRoot: [String: Any],
29
+ hint: CaptureHint
30
+ ) -> [RawAXNode] {
29
31
  var nodes: [RawAXNode] = []
30
- appendPrivateAXNode(rawRoot, to: &nodes, hint: hint, viewport: viewport,
31
- depth: 0, parentIndex: nil)
32
+ appendPrivateAXNode(rawRoot, to: &nodes, hint: hint, depth: 0, parentIndex: nil)
32
33
  return nodes
33
34
  }
34
35
 
35
36
  private func appendPrivateAXNode(_ raw: [String: Any], to nodes: inout [RawAXNode],
36
- hint: CaptureHint, viewport: CGRect, depth: Int, parentIndex: Int?)
37
+ hint: CaptureHint, depth: Int, parentIndex: Int?)
37
38
  {
38
39
  if let limit = hint.rawTraversalDepth, depth > limit { return }
39
40
  let fields = privateAXFields(raw)
40
41
  let index = nodes.count
41
- nodes.append(
42
- privateAXNode(
43
- fields,
44
- index: index,
45
- depth: depth,
46
- parentIndex: parentIndex,
47
- viewport: viewport
48
- )
49
- )
42
+ nodes.append(privateAXNode(fields, index: index, depth: depth, parentIndex: parentIndex))
50
43
  for child in fields.children {
51
- appendPrivateAXNode(child, to: &nodes, hint: hint, viewport: viewport,
52
- depth: depth + 1, parentIndex: index)
44
+ appendPrivateAXNode(child, to: &nodes, hint: hint, depth: depth + 1, parentIndex: index)
53
45
  }
54
46
  }
55
47
 
@@ -70,21 +62,17 @@ extension RunnerTests {
70
62
  )
71
63
  }
72
64
 
73
- private func privateAXNode(_ fields: PrivateAXFields, index: Int, depth: Int, parentIndex: Int?,
74
- viewport: CGRect) -> RawAXNode
65
+ private func privateAXNode(_ fields: PrivateAXFields, index: Int, depth: Int,
66
+ parentIndex: Int?) -> RawAXNode
75
67
  {
76
- RawAXNode(index: index,
68
+ return RawAXNode(index: index,
77
69
  type: fields.elementType.map(elementTypeName) ?? "Element(\(fields.rawType))",
78
70
  label: fields.label.isEmpty ? nil : fields.label,
79
71
  identifier: fields.identifier.isEmpty ? nil : fields.identifier,
80
72
  value: fields.value.isEmpty ? nil : fields.value,
81
- rect: snapshotRect(from: fields.rect), enabled: fields.enabled,
73
+ rect: SnapshotRect(fields.rect), enabled: fields.enabled,
82
74
  focused: fields.focused, selected: fields.selected,
83
- hittable: parentIndex != nil && SnapshotGeometry.isGeometricallyActionable(
84
- enabled: fields.enabled,
85
- frame: fields.rect,
86
- viewport: viewport
87
- ),
75
+ hittable: false,
88
76
  depth: depth, parentIndex: parentIndex, hiddenContentAbove: nil, hiddenContentBelow: nil,
89
77
  actions: fields.actions)
90
78
  }
@@ -219,6 +207,77 @@ extension RunnerTests {
219
207
 
220
208
 
221
209
 
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
222
281
 
223
282
 
224
283