agent-device 0.18.3 → 0.19.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 (219) hide show
  1. package/README.md +5 -1
  2. package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.18.3.apk → agent-device-android-multitouch-helper-0.19.1.apk} +0 -0
  3. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.1.apk.sha256 +1 -0
  4. package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.18.3.manifest.json → agent-device-android-multitouch-helper-0.19.1.manifest.json} +4 -4
  5. package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.18.3.apk → agent-device-android-snapshot-helper-0.19.1.apk} +0 -0
  6. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.1.apk.sha256 +1 -0
  7. package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.18.3.manifest.json → agent-device-android-snapshot-helper-0.19.1.manifest.json} +6 -6
  8. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +28 -0
  9. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +33 -127
  10. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +630 -177
  11. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +155 -0
  12. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +67 -0
  13. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +173 -122
  14. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +172 -0
  15. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +64 -0
  16. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +76 -182
  17. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +92 -51
  18. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +213 -137
  19. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +142 -0
  20. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +208 -46
  21. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +82 -11
  22. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +74 -0
  23. package/dist/src/agent-browser-tool.js +1 -0
  24. package/dist/src/android-adb.d.ts +63 -234
  25. package/dist/src/android-adb.js +1 -1
  26. package/dist/src/android-input-ownership.js +6 -0
  27. package/dist/src/android.js +1 -5
  28. package/dist/src/app-lifecycle.js +7 -0
  29. package/dist/src/apple-runner-options.js +1 -0
  30. package/dist/src/apps.js +5 -11
  31. package/dist/src/artifacts.d.ts +4 -3
  32. package/dist/src/artifacts.js +1 -1
  33. package/dist/src/audio-probe.js +1 -1
  34. package/dist/src/batch.d.ts +2 -177
  35. package/dist/src/batch.js +1 -1
  36. package/dist/src/cli-help.js +178 -60
  37. package/dist/src/cli-output.js +1 -1
  38. package/dist/src/cli-runner.js +2 -0
  39. package/dist/src/cli.js +12 -41
  40. package/dist/src/client-metro-companion.js +1 -0
  41. package/dist/src/client.js +3 -0
  42. package/dist/src/command-metadata.js +1 -0
  43. package/dist/src/command-schema.js +22 -0
  44. package/dist/src/command-surface.js +1 -1
  45. package/dist/src/contracts.d.ts +2 -213
  46. package/dist/src/contracts.js +1 -1
  47. package/dist/src/debug-symbols.js +5 -3
  48. package/dist/src/device-input-state.js +2 -0
  49. package/dist/src/devices.js +1 -1
  50. package/dist/src/devices2.js +1 -0
  51. package/dist/src/devices3.js +1 -0
  52. package/dist/src/find.js +1 -1
  53. package/dist/src/finders.d.ts +2 -81
  54. package/dist/src/finders.js +1 -1
  55. package/dist/src/generic.js +1 -1
  56. package/dist/src/handler-utils.js +1 -1
  57. package/dist/src/helper.js +2 -0
  58. package/dist/src/host-process.js +2 -0
  59. package/dist/src/index.d.ts +1444 -1786
  60. package/dist/src/index.js +1 -1
  61. package/dist/src/input-actions.js +3 -1
  62. package/dist/src/input-actions2.js +1 -0
  63. package/dist/src/install-source.d.ts +13 -14
  64. package/dist/src/install-source.js +1 -1
  65. package/dist/src/install-source2.js +1 -0
  66. package/dist/src/interaction-snapshot.js +1 -0
  67. package/dist/src/interaction.js +1 -1
  68. package/dist/src/interactor.js +2 -1
  69. package/dist/src/internal/bin.d.ts +1 -1
  70. package/dist/src/internal/bin.js +2 -5
  71. package/dist/src/internal/companion-tunnel.d.ts +1 -1
  72. package/dist/src/internal/companion-tunnel.js +1 -1
  73. package/dist/src/internal/daemon.d.ts +1 -1
  74. package/dist/src/internal/daemon.js +18 -1
  75. package/dist/src/internal/png-worker.d.ts +29 -26
  76. package/dist/src/internal/png-worker.js +1 -1
  77. package/dist/src/internal/update-check-entry.d.ts +1 -1
  78. package/dist/src/internal/update-check-entry.js +1 -1
  79. package/dist/src/io.d.ts +2 -85
  80. package/dist/src/io.js +1 -1
  81. package/dist/src/lease.js +1 -1
  82. package/dist/src/linux.js +1 -1
  83. package/dist/src/manifest.js +1 -0
  84. package/dist/src/metro.d.ts +69 -113
  85. package/dist/src/metro.js +1 -1
  86. package/dist/src/metro2.js +1 -0
  87. package/dist/src/notifications.js +1 -1
  88. package/dist/src/output-path.js +1 -0
  89. package/dist/src/path-resolution.js +1 -0
  90. package/dist/src/png-worker-contract.js +1 -0
  91. package/dist/src/points.js +4 -0
  92. package/dist/src/project-runtime.js +1 -0
  93. package/dist/src/provider.js +1 -1
  94. package/dist/src/providers.js +1 -0
  95. package/dist/src/react-native.js +1 -1
  96. package/dist/src/record-trace-recording.js +2 -5
  97. package/dist/src/record-trace.js +1 -1
  98. package/dist/src/recording-provider.js +1 -1
  99. package/dist/src/registry.js +38 -0
  100. package/dist/src/remote-config.d.ts +2 -83
  101. package/dist/src/reporting.js +9 -0
  102. package/dist/src/rolldown-runtime.js +1 -0
  103. package/dist/src/runner-client.js +1 -0
  104. package/dist/src/runner-provider.js +1 -0
  105. package/dist/src/runner-sequence.js +1 -1
  106. package/dist/src/runtime-transport.js +1 -0
  107. package/dist/src/runtime.js +3 -0
  108. package/dist/src/scoped-provider.js +1 -0
  109. package/dist/src/sdk-android-adb.d.ts +144 -0
  110. package/dist/src/sdk-android-adb.js +4 -0
  111. package/dist/src/sdk-app-inventory.d.ts +4 -0
  112. package/dist/src/sdk-app-inventory.js +1 -0
  113. package/dist/src/sdk-batch-runner.d.ts +39 -0
  114. package/dist/src/sdk-batch-runner.js +2 -0
  115. package/dist/src/sdk-batch.js +2 -0
  116. package/dist/src/sdk-contracts.d.ts +386 -0
  117. package/dist/src/sdk-contracts.js +2 -0
  118. package/dist/src/sdk-finders.d.ts +60 -0
  119. package/dist/src/sdk-finders.js +1 -0
  120. package/dist/src/sdk-io.d.ts +78 -0
  121. package/dist/src/sdk-io.js +1 -0
  122. package/dist/src/sdk-remote-config.d.ts +139 -0
  123. package/dist/src/sdk-remote-config.js +1 -0
  124. package/dist/src/sdk-selectors.js +1 -0
  125. package/dist/src/selector-runtime.js +1 -1
  126. package/dist/src/selectors.d.ts +38 -137
  127. package/dist/src/selectors.js +1 -1
  128. package/dist/src/selectors2.js +1 -0
  129. package/dist/src/server.js +3 -2
  130. package/dist/src/session.js +10 -11
  131. package/dist/src/setting-state.js +1 -0
  132. package/dist/src/simctl.js +1 -0
  133. package/dist/src/simulator.js +1 -2
  134. package/dist/src/snapshot-diagnostics.js +3 -0
  135. package/dist/src/snapshot-helper.js +5 -0
  136. package/dist/src/snapshot-quality.js +1 -0
  137. package/dist/src/snapshot.js +1 -2
  138. package/dist/src/snapshot2.js +2 -0
  139. package/dist/src/{5560.js → timeouts.js} +1 -1
  140. package/dist/src/tool-provider.js +3 -0
  141. package/dist/src/tool-provider2.js +1 -0
  142. package/dist/src/ttl-memo.js +1 -0
  143. package/dist/src/tv-remote.js +14 -0
  144. package/dist/src/update-check.js +1 -0
  145. package/dist/src/url.js +1 -0
  146. package/dist/src/version.js +1 -0
  147. package/dist/src/web.js +1 -1
  148. package/dist/src/xml.js +2 -0
  149. package/package.json +13 -19
  150. package/server.json +2 -2
  151. package/skills/agent-device/SKILL.md +8 -7
  152. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.18.3.apk.sha256 +0 -1
  153. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.18.3.apk.sha256 +0 -1
  154. package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +0 -443
  155. package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +0 -169
  156. package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +0 -220
  157. package/dist/src/1404.js +0 -1
  158. package/dist/src/1986.js +0 -1
  159. package/dist/src/2748.js +0 -1
  160. package/dist/src/2948.js +0 -30
  161. package/dist/src/3006.js +0 -1
  162. package/dist/src/314.js +0 -1
  163. package/dist/src/3340.js +0 -8
  164. package/dist/src/4418.js +0 -1
  165. package/dist/src/4428.js +0 -3
  166. package/dist/src/485.js +0 -1
  167. package/dist/src/4917.js +0 -1
  168. package/dist/src/495.js +0 -5
  169. package/dist/src/5448.js +0 -3
  170. package/dist/src/5484.js +0 -1
  171. package/dist/src/5643.js +0 -1
  172. package/dist/src/587.js +0 -1
  173. package/dist/src/5913.js +0 -4
  174. package/dist/src/6849.js +0 -1
  175. package/dist/src/6918.js +0 -1
  176. package/dist/src/6967.js +0 -1
  177. package/dist/src/760.js +0 -1
  178. package/dist/src/7871.js +0 -1
  179. package/dist/src/8184.js +0 -1
  180. package/dist/src/8225.js +0 -1
  181. package/dist/src/8391.js +0 -1
  182. package/dist/src/8404.js +0 -2
  183. package/dist/src/8414.js +0 -2
  184. package/dist/src/8875.js +0 -4
  185. package/dist/src/893.js +0 -1
  186. package/dist/src/8936.js +0 -1
  187. package/dist/src/9414.js +0 -1
  188. package/dist/src/9581.js +0 -22
  189. package/dist/src/9612.js +0 -1
  190. package/dist/src/9624.js +0 -1
  191. package/dist/src/9722.js +0 -39
  192. package/dist/src/devices~1.js +0 -1
  193. package/dist/src/devices~2.js +0 -1
  194. package/dist/src/input-actions~1.js +0 -1
  195. package/dist/src/rslib-runtime.js +0 -1
  196. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +0 -0
  197. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +0 -0
  198. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  199. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/xcshareddata/xcschemes/AgentDeviceRunner.xcscheme +0 -0
  200. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests-Bridging-Header.h +0 -0
  201. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests.entitlements +0 -0
  202. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +0 -0
  203. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +0 -0
  204. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.h +0 -0
  205. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.m +0 -0
  206. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +0 -0
  207. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +0 -0
  208. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +0 -0
  209. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +0 -0
  210. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +0 -0
  211. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +0 -0
  212. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +0 -0
  213. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +0 -0
  214. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +0 -0
  215. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +0 -0
  216. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests.xctestplan +0 -0
  217. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +0 -0
  218. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-resize.swift +0 -0
  219. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-trim.swift +0 -0
@@ -1,169 +0,0 @@
1
- import XCTest
2
-
3
- struct FlatSnapshotFilterNode {
4
- let isRoot: Bool
5
- let label: String
6
- let identifier: String
7
- let valueText: String?
8
- let visible: Bool
9
-
10
- func matchesScope(_ scope: String) -> Bool {
11
- let haystack = [label, identifier, valueText ?? ""].joined(separator: "\n")
12
- return haystack.localizedCaseInsensitiveContains(scope)
13
- }
14
- }
15
-
16
- struct FlatSnapshotFilterDecision {
17
- let include: Bool
18
- let insideMatchedScope: Bool
19
- }
20
-
21
- extension RunnerTests {
22
- func flatSnapshotFilterDecision(
23
- _ node: FlatSnapshotFilterNode,
24
- options: SnapshotOptions,
25
- insideMatchedScope: Bool
26
- ) -> FlatSnapshotFilterDecision {
27
- let scope = options.scope?.trimmingCharacters(in: .whitespacesAndNewlines)
28
- let scopeActive = scope?.isEmpty == false
29
- let matchesScope: Bool
30
- if scopeActive, let scope {
31
- matchesScope = node.matchesScope(scope)
32
- } else {
33
- matchesScope = false
34
- }
35
- let nowInsideScope = insideMatchedScope || matchesScope
36
-
37
- let include: Bool
38
- if node.isRoot {
39
- include = true
40
- } else if scopeActive && !nowInsideScope {
41
- include = false
42
- } else if options.interactiveOnly && !node.visible {
43
- include = false
44
- } else {
45
- include = true
46
- }
47
-
48
- return FlatSnapshotFilterDecision(include: include, insideMatchedScope: nowInsideScope)
49
- }
50
-
51
- func privateAXInteractiveCandidate(rawElementType: Int) -> Bool {
52
- guard let type = flatSnapshotElementType(rawElementType: rawElementType) else {
53
- return false
54
- }
55
- return interactiveTypes.contains(type) || Self.scrollContainerTypes.contains(type)
56
- }
57
-
58
- func flatSnapshotElementType(rawElementType: Int) -> XCUIElement.ElementType? {
59
- guard let raw = UInt(exactly: rawElementType),
60
- let type = XCUIElement.ElementType(rawValue: raw)
61
- else {
62
- return nil
63
- }
64
- return type
65
- }
66
-
67
- #if AGENT_DEVICE_RUNNER_UNIT_TESTS
68
- func testFlatSnapshotFilterDecisionMatrixCoversOptions() {
69
- let visibleContent = FlatSnapshotFilterNode(
70
- isRoot: false,
71
- label: "Welcome back",
72
- identifier: "",
73
- valueText: nil,
74
- visible: true
75
- )
76
- let hiddenInteractive = FlatSnapshotFilterNode(
77
- isRoot: false,
78
- label: "Hidden menu",
79
- identifier: "",
80
- valueText: nil,
81
- visible: false
82
- )
83
- let decorative = FlatSnapshotFilterNode(
84
- isRoot: false,
85
- label: "",
86
- identifier: "",
87
- valueText: nil,
88
- visible: true
89
- )
90
-
91
- XCTAssertTrue(
92
- flatSnapshotFilterDecision(
93
- visibleContent,
94
- options: SnapshotOptions(interactiveOnly: false, depth: nil, scope: nil, raw: false),
95
- insideMatchedScope: false
96
- ).include
97
- )
98
- XCTAssertFalse(
99
- flatSnapshotFilterDecision(
100
- hiddenInteractive,
101
- options: SnapshotOptions(interactiveOnly: true, depth: nil, scope: nil, raw: false),
102
- insideMatchedScope: false
103
- ).include
104
- )
105
- XCTAssertTrue(
106
- flatSnapshotFilterDecision(
107
- decorative,
108
- options: SnapshotOptions(interactiveOnly: false, depth: nil, scope: nil, raw: false),
109
- insideMatchedScope: false
110
- ).include
111
- )
112
- XCTAssertTrue(
113
- flatSnapshotFilterDecision(
114
- decorative,
115
- options: SnapshotOptions(interactiveOnly: false, depth: nil, scope: nil, raw: false),
116
- insideMatchedScope: false
117
- ).include
118
- )
119
- }
120
-
121
- func testFlatSnapshotFilterDecisionCarriesSubtreeScopeState() {
122
- let scopeRoot = FlatSnapshotFilterNode(
123
- isRoot: false,
124
- label: "",
125
- identifier: "homeScreen",
126
- valueText: nil,
127
- visible: true
128
- )
129
- let unmatchedDescendant = FlatSnapshotFilterNode(
130
- isRoot: false,
131
- label: "Post body without the scope text",
132
- identifier: "",
133
- valueText: nil,
134
- visible: true
135
- )
136
- let options = SnapshotOptions(interactiveOnly: false, depth: nil, scope: "homeScreen", raw: false)
137
-
138
- let rootDecision = flatSnapshotFilterDecision(
139
- scopeRoot,
140
- options: options,
141
- insideMatchedScope: false
142
- )
143
- XCTAssertTrue(rootDecision.include)
144
- XCTAssertTrue(rootDecision.insideMatchedScope)
145
-
146
- XCTAssertTrue(
147
- flatSnapshotFilterDecision(
148
- unmatchedDescendant,
149
- options: options,
150
- insideMatchedScope: rootDecision.insideMatchedScope
151
- ).include
152
- )
153
- XCTAssertFalse(
154
- flatSnapshotFilterDecision(
155
- unmatchedDescendant,
156
- options: options,
157
- insideMatchedScope: false
158
- ).include
159
- )
160
- }
161
-
162
- func testPrivateAXInteractiveCandidatesPreserveBackendInputs() {
163
- XCTAssertTrue(
164
- privateAXInteractiveCandidate(rawElementType: Int(XCUIElement.ElementType.scrollView.rawValue)),
165
- "private AX marks scroll containers as interactive candidates"
166
- )
167
- }
168
- #endif
169
- }
@@ -1,220 +0,0 @@
1
- import XCTest
2
-
3
- // Swift port of buildScrollGesturePlan from src/core/scroll-gesture.ts.
4
- //
5
- // This is a deliberate two-place invariant: the daemon keeps the TS implementation (for Android,
6
- // recording, and reported-pixels), and the runner places the gesture with this Swift copy. The
7
- // parity test vectors at the bottom of this file mirror src/core/__tests__/scroll-gesture.test.ts —
8
- // if you change the math in either language, update the other and both vector sets.
9
- //
10
- // All inputs here are positive (reference dims, travel, center), so Swift's `.rounded()`
11
- // (half away from zero) matches JS `Math.round` (half up) on every value computed below.
12
-
13
- struct RunnerScrollGesturePlan {
14
- let x1: Double
15
- let y1: Double
16
- let x2: Double
17
- let y2: Double
18
- let travelPixels: Double
19
- }
20
-
21
- private let runnerDefaultScrollAmount = 0.6
22
- private let runnerDefaultEdgePaddingFraction = 0.05
23
-
24
- func runnerScrollGesturePlan(
25
- direction: String,
26
- amount: Double?,
27
- pixels: Double?,
28
- referenceWidth: Double,
29
- referenceHeight: Double
30
- ) -> RunnerScrollGesturePlan? {
31
- // Mirror the TS INVALID_ARGS contract: non-positive or non-finite amount/pixels are rejected
32
- // rather than clamped into a journaled 1px scroll. The daemon validates before sending, so
33
- // this only triggers for non-daemon wire clients.
34
- if let amount, !(amount.isFinite && amount > 0) { return nil }
35
- if let pixels, !(pixels.isFinite && pixels > 0) { return nil }
36
- let axisLength = (direction == "up" || direction == "down") ? referenceHeight : referenceWidth
37
- let requestedAmount = amount ?? runnerDefaultScrollAmount
38
- let requestedPixels: Double =
39
- pixels.map { max(1, $0.rounded()) } ?? (axisLength * requestedAmount).rounded()
40
- let edgePadding = max(1, (axisLength * runnerDefaultEdgePaddingFraction).rounded())
41
- let maxTravelPixels = max(1, axisLength - edgePadding * 2)
42
- let travelPixels = max(1, min(requestedPixels, maxTravelPixels))
43
- let halfTravel = (travelPixels / 2).rounded()
44
- let centerX = (referenceWidth / 2).rounded()
45
- let centerY = (referenceHeight / 2).rounded()
46
-
47
- func plan(_ x1: Double, _ y1: Double, _ x2: Double, _ y2: Double) -> RunnerScrollGesturePlan {
48
- RunnerScrollGesturePlan(x1: x1, y1: y1, x2: x2, y2: y2, travelPixels: travelPixels)
49
- }
50
-
51
- switch direction {
52
- case "up":
53
- return plan(centerX, centerY - halfTravel, centerX, centerY + halfTravel)
54
- case "down":
55
- return plan(centerX, centerY + halfTravel, centerX, centerY - halfTravel)
56
- case "left":
57
- return plan(centerX - halfTravel, centerY, centerX + halfTravel, centerY)
58
- case "right":
59
- return plan(centerX + halfTravel, centerY, centerX - halfTravel, centerY)
60
- default:
61
- return nil
62
- }
63
- }
64
-
65
- #if AGENT_DEVICE_RUNNER_UNIT_TESTS
66
- extension RunnerTests {
67
- // Cross-language parity vectors mirroring src/core/__tests__/scroll-gesture.test.ts. Keep these
68
- // in sync with the vitest vectors so the two buildScrollGesturePlan implementations cannot drift.
69
-
70
- func testRunnerScrollGesturePlanMapsRelativeAmount() throws {
71
- let plan = try XCTUnwrap(
72
- runnerScrollGesturePlan(
73
- direction: "down",
74
- amount: 0.5,
75
- pixels: nil,
76
- referenceWidth: 400,
77
- referenceHeight: 800
78
- )
79
- )
80
- XCTAssertEqual(plan.x1, 200)
81
- XCTAssertEqual(plan.y1, 600)
82
- XCTAssertEqual(plan.x2, 200)
83
- XCTAssertEqual(plan.y2, 200)
84
- XCTAssertEqual(plan.travelPixels, 400)
85
- }
86
-
87
- func testRunnerScrollGesturePlanPixelsDown() throws {
88
- // 300x600, down, pixels 120 -> (150,360)->(150,240), travel 120.
89
- let plan = try XCTUnwrap(
90
- runnerScrollGesturePlan(
91
- direction: "down",
92
- amount: nil,
93
- pixels: 120,
94
- referenceWidth: 300,
95
- referenceHeight: 600
96
- )
97
- )
98
- XCTAssertEqual(plan.x1, 150)
99
- XCTAssertEqual(plan.y1, 360)
100
- XCTAssertEqual(plan.x2, 150)
101
- XCTAssertEqual(plan.y2, 240)
102
- XCTAssertEqual(plan.travelPixels, 120)
103
- }
104
-
105
- func testRunnerScrollGesturePlanClampsAmountAboveOne() throws {
106
- // 400x800, down, amount 2 -> requested 1600 clamps to the safe band (720): (200,760)->(200,40).
107
- let plan = try XCTUnwrap(
108
- runnerScrollGesturePlan(
109
- direction: "down",
110
- amount: 2,
111
- pixels: nil,
112
- referenceWidth: 400,
113
- referenceHeight: 800
114
- )
115
- )
116
- XCTAssertEqual(plan.x1, 200)
117
- XCTAssertEqual(plan.y1, 760)
118
- XCTAssertEqual(plan.x2, 200)
119
- XCTAssertEqual(plan.y2, 40)
120
- XCTAssertEqual(plan.travelPixels, 720)
121
- }
122
-
123
- func testRunnerScrollGesturePlanClampsExplicitPixelsVertically() throws {
124
- // 400x800, down, pixels 1000 clamps travel to the safe band (720): (200,760)->(200,40).
125
- let plan = try XCTUnwrap(
126
- runnerScrollGesturePlan(
127
- direction: "down",
128
- amount: nil,
129
- pixels: 1000,
130
- referenceWidth: 400,
131
- referenceHeight: 800
132
- )
133
- )
134
- XCTAssertEqual(plan.x1, 200)
135
- XCTAssertEqual(plan.y1, 760)
136
- XCTAssertEqual(plan.x2, 200)
137
- XCTAssertEqual(plan.y2, 40)
138
- XCTAssertEqual(plan.travelPixels, 720)
139
- }
140
-
141
- func testRunnerScrollGesturePlanFloorsTinyFrames() throws {
142
- // 2x2, down, pixels 10 engages every max(1, ...) floor and the .5 rounding cases the two
143
- // ports must agree on (halfTravel 0.5 -> 1, center 1 from 2/2): (1,2)->(1,0), travel 1.
144
- let plan = try XCTUnwrap(
145
- runnerScrollGesturePlan(
146
- direction: "down",
147
- amount: nil,
148
- pixels: 10,
149
- referenceWidth: 2,
150
- referenceHeight: 2
151
- )
152
- )
153
- XCTAssertEqual(plan.x1, 1)
154
- XCTAssertEqual(plan.y1, 2)
155
- XCTAssertEqual(plan.x2, 1)
156
- XCTAssertEqual(plan.y2, 0)
157
- XCTAssertEqual(plan.travelPixels, 1)
158
- }
159
-
160
- func testRunnerScrollGesturePlanClampsToSafeBand() throws {
161
- // 300x600, right, pixels 500 clamps travel to the safe band (270).
162
- let plan = try XCTUnwrap(
163
- runnerScrollGesturePlan(
164
- direction: "right",
165
- amount: nil,
166
- pixels: 500,
167
- referenceWidth: 300,
168
- referenceHeight: 600
169
- )
170
- )
171
- XCTAssertEqual(plan.x1, 285)
172
- XCTAssertEqual(plan.x2, 15)
173
- XCTAssertEqual(plan.y1, 300)
174
- XCTAssertEqual(plan.y2, 300)
175
- XCTAssertEqual(plan.travelPixels, 270)
176
- }
177
-
178
- func testRunnerScrollGesturePlanRejectsUnknownDirection() {
179
- XCTAssertNil(
180
- runnerScrollGesturePlan(
181
- direction: "sideways",
182
- amount: nil,
183
- pixels: 100,
184
- referenceWidth: 300,
185
- referenceHeight: 600
186
- )
187
- )
188
- }
189
-
190
- func testRunnerScrollGesturePlanRejectsInvalidAmountAndPixels() {
191
- XCTAssertNil(
192
- runnerScrollGesturePlan(
193
- direction: "down",
194
- amount: 0,
195
- pixels: nil,
196
- referenceWidth: 300,
197
- referenceHeight: 600
198
- )
199
- )
200
- XCTAssertNil(
201
- runnerScrollGesturePlan(
202
- direction: "down",
203
- amount: nil,
204
- pixels: -10,
205
- referenceWidth: 300,
206
- referenceHeight: 600
207
- )
208
- )
209
- XCTAssertNil(
210
- runnerScrollGesturePlan(
211
- direction: "down",
212
- amount: .infinity,
213
- pixels: nil,
214
- referenceWidth: 300,
215
- referenceHeight: 600
216
- )
217
- )
218
- }
219
- }
220
- #endif
package/dist/src/1404.js DELETED
@@ -1 +0,0 @@
1
- import r from"node:fs";import e from"node:path";import{fileURLToPath as o}from"node:url";function t(){try{let o=n();return JSON.parse(r.readFileSync(e.join(o,"package.json"),"utf8")).version??"0.0.0"}catch{return"0.0.0"}}function n(){let t=e.dirname(o(import.meta.url)),n=t;for(let o=0;o<6;o+=1){let o=e.join(n,"package.json");if(r.existsSync(o))return n;n=e.dirname(n)}return t}export{n as findProjectRoot,t as readVersion};
package/dist/src/1986.js DELETED
@@ -1 +0,0 @@
1
- import{AppError as e}from"./485.js";import{daemonRuntimeSchema as a}from"./6849.js";let n={alert:"alert",audio:"audio",appState:"appstate",appSwitcher:"app-switcher",artifacts:"artifacts",apps:"apps",back:"back",batch:"batch",boot:"boot",click:"click",close:"close",clipboard:"clipboard",devices:"devices",doctor:"doctor",diff:"diff",fill:"fill",find:"find",focus:"focus",gesture:"gesture",get:"get",home:"home",install:"install",installFromSource:"install-from-source",is:"is",keyboard:"keyboard",logs:"logs",longPress:"longpress",network:"network",open:"open",perf:"perf",prepare:"prepare",press:"press",push:"push",record:"record",reactNative:"react-native",reinstall:"reinstall",replay:"replay",rotate:"rotate",scroll:"scroll",screenshot:"screenshot",settings:"settings",shutdown:"shutdown",snapshot:"snapshot",swipe:"swipe",test:"test",trace:"trace",triggerAppEvent:"trigger-app-event",type:"type",viewport:"viewport",wait:"wait"},i={installSource:"install_source",leaseAllocate:"lease_allocate",leaseHeartbeat:"lease_heartbeat",leaseRelease:"lease_release",releaseMaterializedPaths:"release_materialized_paths",runtime:"runtime",sessionList:"session_list"},t={cdp:"cdp",auth:"auth",connect:"connect",connection:"connection",debug:"debug",disconnect:"disconnect",mcp:"mcp",metro:"metro",proxy:"proxy",reactDevtools:"react-devtools",session:"session",web:"web"},o=["pan","fling","swipe","pinch","rotate","transform"],r=`gesture requires one of: ${o.join(", ")}`,l=s(t.auth,t.cdp,t.connect,t.connection,t.disconnect,t.mcp,t.proxy,t.reactDevtools,t.web,n.prepare);function s(...e){return new Set(e)}function c(){return[...Object.values(n),...Object.values(t)].sort()}function d(e){return Object.values(n).includes(e)||e===t.debug||e===t.metro||e===t.session}function p(){return c().filter(e=>!l.has(e))}function u(a,n,i,t){let o=i(a[n]);if(void 0===o)throw new e("COMMAND_FAILED",t,{response:a});return o}function m(e,a){return u(e,a,D,`Daemon response is missing "${a}".`)}function b(e,a){return D(e[a])}function h(e,a){var n;let i;return n=D,null===(i=e[a])?null:n(i)}function y(e,a){return u(e,a,w,`Daemon response is missing numeric "${a}".`)}function f(e,a){return u(e,a,k,`Daemon response has invalid "${a}".`)}function g(e,a){return u(e,a,_,`Daemon response has invalid "${a}".`)}function S(e,a){return function(e){return"tv"===e||"mobile"===e||"desktop"===e?e:void 0}(e[a])??"mobile"}function v(e){if(!E(e))return;let a=x(e,"x"),n=x(e,"y"),i=x(e,"width"),t=x(e,"height");if(void 0!==a&&void 0!==n&&void 0!==i&&void 0!==t)return{x:a,y:n,width:i,height:t}}function A(e){if(!E(e))return;let a=x(e,"x"),n=x(e,"y");if(void 0!==a&&void 0!==n)return{x:a,y:n}}function x(e,a){let n=e[a];return"number"==typeof n?n:void 0}function D(e){return"string"==typeof e&&e.length>0?e:void 0}function w(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function k(e){return"apple"===e?"ios":"ios"===e||"macos"===e||"android"===e||"linux"===e||"web"===e?e:void 0}function _(e){return"simulator"===e||"emulator"===e||"device"===e?e:void 0}s(t.auth,t.cdp,t.connect,t.connection,t.debug,t.disconnect,t.mcp,t.metro,t.proxy,t.reactDevtools,t.session,t.web,n.artifacts,n.appState,n.prepare,n.batch,n.devices,n.doctor,n.gesture,n.replay,n.test,n.trace);function B(a){if(!E(a))throw new e("COMMAND_FAILED","Daemon returned an unexpected response shape.",{value:a});return a}function E(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function N(e){let a={};for(let[n,i]of Object.entries(e))void 0!==i&&(a[n]=i);return a}function R(e){return e.split("\n").map(e=>e.trim()).filter(e=>e.length>0)}let C=a=>new e("INVALID_ARGS",a);function G(e){return Number.isInteger(e)&&e>=1&&e<=1e3}function K(e,a,n=C){if(e>a)throw n(`batch has ${e} steps; max allowed is ${a}.`)}function M(e,a,n=C){if(!E(e))throw n(`Invalid batch step ${a}.`);return e}function I(e,a,n=C){let i=e.input;if(!E(i))throw n(`Batch step ${a} input must be an object.`);return i}function O(e,n,i=C){if(void 0!==e)try{return a.parse(e)}catch(e){throw i(`Batch step ${n} runtime is invalid: ${e instanceof Error?e.message:String(e)}`)}}function P(e){let a=[];for(let n of e)n.daemon&&a.push({command:n.name,...n.daemon});return a}function L(e){let a={};for(let n of e)n.capability&&(a[n.name]=n.capability);return a}let $={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0},T={leaseAdmissionExempt:!0,sessionExecutionLockExempt:!0,selectorValidationExempt:!0},U=()=>!0,j=e=>e.command===n.test&&("number"==typeof e.flags?.shardAll||"number"==typeof e.flags?.shardSplit),H={simulator:!0,device:!0},F={emulator:!0,device:!0,unknown:!0},q={device:!0},V={},z={apple:H,android:F,linux:q},Y={apple:H,android:F,linux:V},J=[{name:i.leaseAllocate,daemon:{route:"lease",...$},batchable:!1},{name:i.leaseHeartbeat,daemon:{route:"lease",...$},batchable:!1},{name:i.leaseRelease,daemon:{route:"lease",...$},batchable:!1},{name:n.artifacts,daemon:{route:"lease",...$},batchable:!1},{name:i.sessionList,daemon:{route:"session",sessionKind:"inventory",...T},batchable:!1},{name:n.devices,daemon:{route:"session",sessionKind:"inventory",lockPolicySelectorOverride:!0,...T},batchable:!0},{name:n.doctor,daemon:{route:"session",sessionKind:"inventory",lockPolicySelectorOverride:!0,allowSessionlessDefaultDevice:U,...T},batchable:!0},{name:n.apps,daemon:{route:"session",sessionKind:"inventory",lockPolicySelectorOverride:!0,preferExplicitDeviceOverExistingSession:!0},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.boot,daemon:{route:"session",sessionKind:"state"},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.shutdown,daemon:{route:"session",sessionKind:"state"},capability:{apple:{simulator:!0},android:{emulator:!0},linux:V},batchable:!0},{name:n.appState,daemon:{route:"session",sessionKind:"state"},batchable:!0},{name:n.perf,daemon:{route:"session",sessionKind:"observability"},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.logs,daemon:{route:"session",sessionKind:"observability"},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.network,daemon:{route:"session",sessionKind:"observability"},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.audio,daemon:{route:"session",sessionKind:"observability"},capability:{apple:H,android:{emulator:!0},linux:V},batchable:!0},{name:n.replay,daemon:{route:"session",sessionKind:"replay",skipSessionlessProviderDevice:j},batchable:!1},{name:n.test,daemon:{route:"session",sessionKind:"replay",skipSessionlessProviderDevice:j},batchable:!0},{name:i.runtime,daemon:{route:"session"},batchable:!1},{name:n.clipboard,daemon:{route:"session",replayScopedAction:!0},capability:{apple:H,android:F,linux:q},batchable:!0},{name:n.keyboard,daemon:{route:"session",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.install,daemon:{route:"session"},capability:Y,batchable:!0},{name:n.reinstall,daemon:{route:"session"},capability:Y,batchable:!0},{name:i.installSource,daemon:{route:"session"},batchable:!1},{name:i.releaseMaterializedPaths,daemon:{route:"session",...T},batchable:!1},{name:n.push,daemon:{route:"session"},capability:{apple:{simulator:!0},android:F,linux:V},batchable:!0},{name:n.triggerAppEvent,daemon:{route:"session"},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.open,daemon:{route:"session",allowSessionlessDefaultDevice:U},capability:z,batchable:!0},{name:n.prepare,daemon:{route:"session"},batchable:!1},{name:n.batch,daemon:{route:"session"},batchable:!1},{name:n.close,daemon:{route:"session",allowInvalidRecording:!0},capability:z,batchable:!0},{name:n.snapshot,daemon:{route:"snapshot",replayScopedAction:!0},capability:z,batchable:!0},{name:n.diff,daemon:{route:"snapshot",replayScopedAction:!0},capability:z,batchable:!0},{name:n.wait,daemon:{route:"snapshot",replayScopedAction:!0},capability:z,batchable:!0},{name:n.alert,daemon:{route:"snapshot",replayScopedAction:!0},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.settings,daemon:{route:"snapshot",replayScopedAction:!0},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.reactNative,daemon:{route:"reactNative",replayScopedAction:!0},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.record,daemon:{route:"recordTrace",replayScopedAction:!0,allowInvalidRecording:!0,allowSessionlessDefaultDevice:e=>"start"===(e.positionals?.[0]??"").toLowerCase()},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.trace,daemon:{route:"recordTrace"},batchable:!0},{name:n.find,daemon:{route:"find",replayScopedAction:!0},capability:z,batchable:!0},{name:n.click,daemon:{route:"interaction",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:q},batchable:!0},{name:n.fill,daemon:{route:"interaction",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:q},batchable:!0},{name:n.longPress,daemon:{route:"interaction",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:q},batchable:!0},{name:n.press,daemon:{route:"interaction",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:q},batchable:!0},{name:n.type,daemon:{route:"interaction",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:z,batchable:!0},{name:n.get,daemon:{route:"interaction",replayScopedAction:!0},capability:z,batchable:!0},{name:n.is,daemon:{route:"interaction",replayScopedAction:!0},capability:z,batchable:!0},{name:n.back,daemon:{route:"generic",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:q},batchable:!0},{name:n.gesture,daemon:{route:"generic",replayScopedAction:!0,androidBlockingDialogGuard:!0},batchable:!0},{name:n.home,daemon:{route:"generic",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:q},batchable:!0},{name:n.rotate,daemon:{route:"generic",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.scroll,daemon:{route:"generic",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:q},batchable:!0},{name:n.swipe,daemon:{route:"generic",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:q},batchable:!0},{name:"pinch",daemon:{route:"generic",replayScopedAction:!0,androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:V},batchable:!1},{name:n.focus,daemon:{route:"generic",androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:q},batchable:!0},{name:n.screenshot,daemon:{route:"generic",replayScopedAction:!0},capability:z,batchable:!0},{name:n.viewport,daemon:{route:"generic",replayScopedAction:!0},capability:{apple:H,android:F,linux:V},batchable:!1},{name:"pan",daemon:{route:"generic",androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:q},batchable:!1},{name:"fling",daemon:{route:"generic",androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:V},batchable:!1},{name:"rotate-gesture",daemon:{route:"generic",androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:V},batchable:!1},{name:"transform-gesture",daemon:{route:"generic",androidBlockingDialogGuard:!0},capability:{apple:H,android:F,linux:V},batchable:!1},{name:n.appSwitcher,capability:{apple:H,android:F,linux:V},batchable:!0},{name:n.installFromSource,capability:Y,batchable:!0}],Q=new Set(p()),W=J.map(e=>({...e,mcpExposed:Q.has(e.name)})),X=W.filter(e=>e.batchable).map(e=>e.name),Z=new Set(["batch","replay"]),ee=["command","positionals","flags","runtime"],ea=["platform","target","device","udid","serial","verbose","out"],en=new Set(X);function ei(e){return"string"==typeof e?e.trim().toLowerCase():""}function et(a,n){let i=ei(a);if(en.has(i))return i;throw new e("INVALID_ARGS",`Batch step ${n} command is not available through command batch: ${String(a)}`)}function eo(a,n){if(Z.has(a))throw new e("INVALID_ARGS",`Batch step ${n} cannot run ${a}.`)}export{ee as BATCH_DAEMON_STEP_KEYS,o as GESTURE_KINDS,r as GESTURE_SUBCOMMAND_ERROR,ea as INHERITED_PARENT_FLAG_KEYS,i as INTERNAL_COMMANDS,n as PUBLIC_COMMANDS,X as STRUCTURED_BATCH_COMMAND_NAMES,B as asRecord,eo as assertBatchRuntimeCommandAllowed,K as assertBatchStepCount,W as commandDescriptors,L as deriveCapabilityMatrix,P as deriveDaemonCommandDescriptors,d as isClientBackedCliCommandName,E as isRecord,G as isValidBatchMaxSteps,c as listCliCommandNames,p as listMcpExposedCommandNames,ei as normalizeBatchCommandName,O as parseBatchStepRuntime,A as parsePoint,v as parseRect,I as readBatchStepInputObject,M as readBatchStepRecord,S as readDeviceTarget,h as readNullableString,b as readOptionalString,g as readRequiredDeviceKind,y as readRequiredNumber,f as readRequiredPlatform,m as readRequiredString,et as readStructuredBatchCommandName,R as splitNonEmptyTrimmedLines,N as stripUndefined};
package/dist/src/2748.js DELETED
@@ -1 +0,0 @@
1
- import{AppError as e}from"./485.js";let r="user-installed";function t(e){return e??r}function o(r){if(void 0===r)throw new e("INVALID_ARGS","appsFilter must be resolved before executing the apps command");return r}export{r as DEFAULT_APPS_FILTER,o as assertResolvedAppsFilter,t as resolveAppsFilter};