@ulpi/browse 2.3.4 → 2.4.0

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 (276) hide show
  1. package/README.md +8 -2
  2. package/dist/browse.cjs +2889 -1265
  3. package/dist/lib.mjs +29504 -0
  4. package/dist/types/a11y.d.ts +32 -0
  5. package/dist/types/a11y.d.ts.map +1 -0
  6. package/dist/types/app/android/bridge.d.ts +41 -0
  7. package/dist/types/app/android/bridge.d.ts.map +1 -0
  8. package/dist/types/app/android/emulator.d.ts +32 -0
  9. package/dist/types/app/android/emulator.d.ts.map +1 -0
  10. package/dist/types/app/android/manager.d.ts +62 -0
  11. package/dist/types/app/android/manager.d.ts.map +1 -0
  12. package/dist/types/app/android/protocol.d.ts +162 -0
  13. package/dist/types/app/android/protocol.d.ts.map +1 -0
  14. package/dist/types/app/android/sim-service.d.ts +33 -0
  15. package/dist/types/app/android/sim-service.d.ts.map +1 -0
  16. package/dist/types/app/index.d.ts +15 -0
  17. package/dist/types/app/index.d.ts.map +1 -0
  18. package/dist/types/app/ios/bridge.d.ts +53 -0
  19. package/dist/types/app/ios/bridge.d.ts.map +1 -0
  20. package/dist/types/app/ios/controller.d.ts +131 -0
  21. package/dist/types/app/ios/controller.d.ts.map +1 -0
  22. package/dist/types/app/ios/manager.d.ts +96 -0
  23. package/dist/types/app/ios/manager.d.ts.map +1 -0
  24. package/dist/types/app/ios/protocol.d.ts +122 -0
  25. package/dist/types/app/ios/protocol.d.ts.map +1 -0
  26. package/dist/types/app/ios/sim-service.d.ts +37 -0
  27. package/dist/types/app/ios/sim-service.d.ts.map +1 -0
  28. package/dist/types/app/macos/bridge.d.ts +22 -0
  29. package/dist/types/app/macos/bridge.d.ts.map +1 -0
  30. package/dist/types/app/manager.d.ts +50 -0
  31. package/dist/types/app/manager.d.ts.map +1 -0
  32. package/dist/types/app/normalize.d.ts +27 -0
  33. package/dist/types/app/normalize.d.ts.map +1 -0
  34. package/dist/types/app/resolve-app.d.ts +31 -0
  35. package/dist/types/app/resolve-app.d.ts.map +1 -0
  36. package/dist/types/app/types.d.ts +77 -0
  37. package/dist/types/app/types.d.ts.map +1 -0
  38. package/dist/types/automation/action-context.d.ts +110 -0
  39. package/dist/types/automation/action-context.d.ts.map +1 -0
  40. package/dist/types/automation/command.d.ts +138 -0
  41. package/dist/types/automation/command.d.ts.map +1 -0
  42. package/dist/types/automation/events.d.ts +72 -0
  43. package/dist/types/automation/events.d.ts.map +1 -0
  44. package/dist/types/automation/executor.d.ts +39 -0
  45. package/dist/types/automation/executor.d.ts.map +1 -0
  46. package/dist/types/automation/index.d.ts +11 -0
  47. package/dist/types/automation/index.d.ts.map +1 -0
  48. package/dist/types/automation/registry.d.ts +38 -0
  49. package/dist/types/automation/registry.d.ts.map +1 -0
  50. package/dist/types/automation/rules.d.ts +52 -0
  51. package/dist/types/automation/rules.d.ts.map +1 -0
  52. package/dist/types/automation/target.d.ts +76 -0
  53. package/dist/types/automation/target.d.ts.map +1 -0
  54. package/dist/types/browser/consent.d.ts +13 -0
  55. package/dist/types/browser/consent.d.ts.map +1 -0
  56. package/dist/types/browser/cookie-import.d.ts +94 -0
  57. package/dist/types/browser/cookie-import.d.ts.map +1 -0
  58. package/dist/types/browser/detection.d.ts +22 -0
  59. package/dist/types/browser/detection.d.ts.map +1 -0
  60. package/dist/types/browser/emulation.d.ts +30 -0
  61. package/dist/types/browser/emulation.d.ts.map +1 -0
  62. package/dist/types/browser/events.d.ts +19 -0
  63. package/dist/types/browser/events.d.ts.map +1 -0
  64. package/dist/types/browser/index.d.ts +17 -0
  65. package/dist/types/browser/index.d.ts.map +1 -0
  66. package/dist/types/browser/macros.d.ts +9 -0
  67. package/dist/types/browser/macros.d.ts.map +1 -0
  68. package/dist/types/browser/manager.d.ts +272 -0
  69. package/dist/types/browser/manager.d.ts.map +1 -0
  70. package/dist/types/browser/png-compare.d.ts +36 -0
  71. package/dist/types/browser/png-compare.d.ts.map +1 -0
  72. package/dist/types/browser/profiles.d.ts +29 -0
  73. package/dist/types/browser/profiles.d.ts.map +1 -0
  74. package/dist/types/browser/react-devtools.d.ts +75 -0
  75. package/dist/types/browser/react-devtools.d.ts.map +1 -0
  76. package/dist/types/browser/readiness.d.ts +19 -0
  77. package/dist/types/browser/readiness.d.ts.map +1 -0
  78. package/dist/types/browser/refs.d.ts +70 -0
  79. package/dist/types/browser/refs.d.ts.map +1 -0
  80. package/dist/types/browser/serp.d.ts +16 -0
  81. package/dist/types/browser/serp.d.ts.map +1 -0
  82. package/dist/types/browser/snapshot-window.d.ts +31 -0
  83. package/dist/types/browser/snapshot-window.d.ts.map +1 -0
  84. package/dist/types/browser/snapshot.d.ts +41 -0
  85. package/dist/types/browser/snapshot.d.ts.map +1 -0
  86. package/dist/types/browser/tabs.d.ts +67 -0
  87. package/dist/types/browser/tabs.d.ts.map +1 -0
  88. package/dist/types/browser/target.d.ts +106 -0
  89. package/dist/types/browser/target.d.ts.map +1 -0
  90. package/dist/types/browser/youtube.d.ts +26 -0
  91. package/dist/types/browser/youtube.d.ts.map +1 -0
  92. package/dist/types/cli.d.ts +14 -0
  93. package/dist/types/cli.d.ts.map +1 -0
  94. package/dist/types/cloud/auth.d.ts +80 -0
  95. package/dist/types/cloud/auth.d.ts.map +1 -0
  96. package/dist/types/cloud/docker.d.ts +76 -0
  97. package/dist/types/cloud/docker.d.ts.map +1 -0
  98. package/dist/types/cloud/firecracker.d.ts +142 -0
  99. package/dist/types/cloud/firecracker.d.ts.map +1 -0
  100. package/dist/types/cloud/golden-snapshot.d.ts +122 -0
  101. package/dist/types/cloud/golden-snapshot.d.ts.map +1 -0
  102. package/dist/types/cloud/index.d.ts +26 -0
  103. package/dist/types/cloud/index.d.ts.map +1 -0
  104. package/dist/types/cloud/orchestrator-interface.d.ts +63 -0
  105. package/dist/types/cloud/orchestrator-interface.d.ts.map +1 -0
  106. package/dist/types/cloud/orchestrator.d.ts +58 -0
  107. package/dist/types/cloud/orchestrator.d.ts.map +1 -0
  108. package/dist/types/cloud/proxy.d.ts +34 -0
  109. package/dist/types/cloud/proxy.d.ts.map +1 -0
  110. package/dist/types/cloud/reaper.d.ts +49 -0
  111. package/dist/types/cloud/reaper.d.ts.map +1 -0
  112. package/dist/types/cloud/server.d.ts +19 -0
  113. package/dist/types/cloud/server.d.ts.map +1 -0
  114. package/dist/types/cloud/sessions.d.ts +85 -0
  115. package/dist/types/cloud/sessions.d.ts.map +1 -0
  116. package/dist/types/cloud/vm-orchestrator.d.ts +133 -0
  117. package/dist/types/cloud/vm-orchestrator.d.ts.map +1 -0
  118. package/dist/types/cloud/vm-warm-pool.d.ts +104 -0
  119. package/dist/types/cloud/vm-warm-pool.d.ts.map +1 -0
  120. package/dist/types/cloud/warm-pool.d.ts +85 -0
  121. package/dist/types/cloud/warm-pool.d.ts.map +1 -0
  122. package/dist/types/cloud/ws.d.ts +61 -0
  123. package/dist/types/cloud/ws.d.ts.map +1 -0
  124. package/dist/types/commands/meta/auth.d.ts +6 -0
  125. package/dist/types/commands/meta/auth.d.ts.map +1 -0
  126. package/dist/types/commands/meta/flows.d.ts +15 -0
  127. package/dist/types/commands/meta/flows.d.ts.map +1 -0
  128. package/dist/types/commands/meta/index.d.ts +14 -0
  129. package/dist/types/commands/meta/index.d.ts.map +1 -0
  130. package/dist/types/commands/meta/inspection.d.ts +7 -0
  131. package/dist/types/commands/meta/inspection.d.ts.map +1 -0
  132. package/dist/types/commands/meta/profile.d.ts +11 -0
  133. package/dist/types/commands/meta/profile.d.ts.map +1 -0
  134. package/dist/types/commands/meta/recording.d.ts +7 -0
  135. package/dist/types/commands/meta/recording.d.ts.map +1 -0
  136. package/dist/types/commands/meta/screenshots.d.ts +7 -0
  137. package/dist/types/commands/meta/screenshots.d.ts.map +1 -0
  138. package/dist/types/commands/meta/sessions.d.ts +7 -0
  139. package/dist/types/commands/meta/sessions.d.ts.map +1 -0
  140. package/dist/types/commands/meta/sim.d.ts +10 -0
  141. package/dist/types/commands/meta/sim.d.ts.map +1 -0
  142. package/dist/types/commands/meta/system.d.ts +8 -0
  143. package/dist/types/commands/meta/system.d.ts.map +1 -0
  144. package/dist/types/commands/meta/tabs.d.ts +6 -0
  145. package/dist/types/commands/meta/tabs.d.ts.map +1 -0
  146. package/dist/types/commands/meta/youtube.d.ts +7 -0
  147. package/dist/types/commands/meta/youtube.d.ts.map +1 -0
  148. package/dist/types/commands/read.d.ts +16 -0
  149. package/dist/types/commands/read.d.ts.map +1 -0
  150. package/dist/types/commands/write.d.ts +17 -0
  151. package/dist/types/commands/write.d.ts.map +1 -0
  152. package/dist/types/config.d.ts +101 -0
  153. package/dist/types/config.d.ts.map +1 -0
  154. package/dist/types/constants.d.ts +36 -0
  155. package/dist/types/constants.d.ts.map +1 -0
  156. package/dist/types/detection/frameworks.d.ts +27 -0
  157. package/dist/types/detection/frameworks.d.ts.map +1 -0
  158. package/dist/types/detection/index.d.ts +64 -0
  159. package/dist/types/detection/index.d.ts.map +1 -0
  160. package/dist/types/detection/infrastructure.d.ts +82 -0
  161. package/dist/types/detection/infrastructure.d.ts.map +1 -0
  162. package/dist/types/detection/saas.d.ts +39 -0
  163. package/dist/types/detection/saas.d.ts.map +1 -0
  164. package/dist/types/enable.d.ts +10 -0
  165. package/dist/types/enable.d.ts.map +1 -0
  166. package/dist/types/engine/chrome.d.ts +45 -0
  167. package/dist/types/engine/chrome.d.ts.map +1 -0
  168. package/dist/types/engine/index.d.ts +9 -0
  169. package/dist/types/engine/index.d.ts.map +1 -0
  170. package/dist/types/engine/providers.d.ts +36 -0
  171. package/dist/types/engine/providers.d.ts.map +1 -0
  172. package/dist/types/engine/resolver.d.ts +36 -0
  173. package/dist/types/engine/resolver.d.ts.map +1 -0
  174. package/dist/types/expect.d.ts +68 -0
  175. package/dist/types/expect.d.ts.map +1 -0
  176. package/dist/types/export/index.d.ts +8 -0
  177. package/dist/types/export/index.d.ts.map +1 -0
  178. package/dist/types/export/record.d.ts +28 -0
  179. package/dist/types/export/record.d.ts.map +1 -0
  180. package/dist/types/export/replay.d.ts +9 -0
  181. package/dist/types/export/replay.d.ts.map +1 -0
  182. package/dist/types/flow-parser.d.ts +32 -0
  183. package/dist/types/flow-parser.d.ts.map +1 -0
  184. package/dist/types/install-skill.d.ts +8 -0
  185. package/dist/types/install-skill.d.ts.map +1 -0
  186. package/dist/types/lib.d.ts +27 -0
  187. package/dist/types/lib.d.ts.map +1 -0
  188. package/dist/types/mcp/index.d.ts +10 -0
  189. package/dist/types/mcp/index.d.ts.map +1 -0
  190. package/dist/types/mcp/server.d.ts +9 -0
  191. package/dist/types/mcp/server.d.ts.map +1 -0
  192. package/dist/types/mcp/tools/index.d.ts +36 -0
  193. package/dist/types/mcp/tools/index.d.ts.map +1 -0
  194. package/dist/types/network/buffers.d.ts +53 -0
  195. package/dist/types/network/buffers.d.ts.map +1 -0
  196. package/dist/types/network/har.d.ts +10 -0
  197. package/dist/types/network/har.d.ts.map +1 -0
  198. package/dist/types/network/index.d.ts +6 -0
  199. package/dist/types/network/index.d.ts.map +1 -0
  200. package/dist/types/perf-audit/diff.d.ts +43 -0
  201. package/dist/types/perf-audit/diff.d.ts.map +1 -0
  202. package/dist/types/perf-audit/dom-analysis.d.ts +74 -0
  203. package/dist/types/perf-audit/dom-analysis.d.ts.map +1 -0
  204. package/dist/types/perf-audit/formatter.d.ts +34 -0
  205. package/dist/types/perf-audit/formatter.d.ts.map +1 -0
  206. package/dist/types/perf-audit/index.d.ts +128 -0
  207. package/dist/types/perf-audit/index.d.ts.map +1 -0
  208. package/dist/types/perf-audit/persist.d.ts +40 -0
  209. package/dist/types/perf-audit/persist.d.ts.map +1 -0
  210. package/dist/types/perf-audit/recommendations.d.ts +18 -0
  211. package/dist/types/perf-audit/recommendations.d.ts.map +1 -0
  212. package/dist/types/perf-audit/resource-analyzer.d.ts +46 -0
  213. package/dist/types/perf-audit/resource-analyzer.d.ts.map +1 -0
  214. package/dist/types/perf-audit/web-vitals.d.ts +73 -0
  215. package/dist/types/perf-audit/web-vitals.d.ts.map +1 -0
  216. package/dist/types/proxy/index.d.ts +6 -0
  217. package/dist/types/proxy/index.d.ts.map +1 -0
  218. package/dist/types/proxy/pool.d.ts +44 -0
  219. package/dist/types/proxy/pool.d.ts.map +1 -0
  220. package/dist/types/proxy/providers.d.ts +32 -0
  221. package/dist/types/proxy/providers.d.ts.map +1 -0
  222. package/dist/types/sdk/client.d.ts +37 -0
  223. package/dist/types/sdk/client.d.ts.map +1 -0
  224. package/dist/types/sdk/index.d.ts +17 -0
  225. package/dist/types/sdk/index.d.ts.map +1 -0
  226. package/dist/types/sdk/session.d.ts +95 -0
  227. package/dist/types/sdk/session.d.ts.map +1 -0
  228. package/dist/types/sdk/transports/cloud.d.ts +89 -0
  229. package/dist/types/sdk/transports/cloud.d.ts.map +1 -0
  230. package/dist/types/sdk/transports/index.d.ts +3 -0
  231. package/dist/types/sdk/transports/index.d.ts.map +1 -0
  232. package/dist/types/sdk/transports/local.d.ts +56 -0
  233. package/dist/types/sdk/transports/local.d.ts.map +1 -0
  234. package/dist/types/sdk.d.ts +35 -0
  235. package/dist/types/sdk.d.ts.map +1 -0
  236. package/dist/types/security/auth-vault.d.ts +32 -0
  237. package/dist/types/security/auth-vault.d.ts.map +1 -0
  238. package/dist/types/security/domain-filter.d.ts +31 -0
  239. package/dist/types/security/domain-filter.d.ts.map +1 -0
  240. package/dist/types/security/index.d.ts +10 -0
  241. package/dist/types/security/index.d.ts.map +1 -0
  242. package/dist/types/security/policy.d.ts +20 -0
  243. package/dist/types/security/policy.d.ts.map +1 -0
  244. package/dist/types/security/sanitize.d.ts +6 -0
  245. package/dist/types/security/sanitize.d.ts.map +1 -0
  246. package/dist/types/server.d.ts +13 -0
  247. package/dist/types/server.d.ts.map +1 -0
  248. package/dist/types/session/concurrency.d.ts +28 -0
  249. package/dist/types/session/concurrency.d.ts.map +1 -0
  250. package/dist/types/session/encryption.d.ts +8 -0
  251. package/dist/types/session/encryption.d.ts.map +1 -0
  252. package/dist/types/session/index.d.ts +7 -0
  253. package/dist/types/session/index.d.ts.map +1 -0
  254. package/dist/types/session/manager.d.ts +110 -0
  255. package/dist/types/session/manager.d.ts.map +1 -0
  256. package/dist/types/session/persist.d.ts +87 -0
  257. package/dist/types/session/persist.d.ts.map +1 -0
  258. package/dist/types/session/tab-lock.d.ts +26 -0
  259. package/dist/types/session/tab-lock.d.ts.map +1 -0
  260. package/dist/types/session/target-factory.d.ts +88 -0
  261. package/dist/types/session/target-factory.d.ts.map +1 -0
  262. package/dist/types/sim-cli.d.ts +8 -0
  263. package/dist/types/sim-cli.d.ts.map +1 -0
  264. package/dist/types/types.d.ts +45 -0
  265. package/dist/types/types.d.ts.map +1 -0
  266. package/dist/types/visual.d.ts +79 -0
  267. package/dist/types/visual.d.ts.map +1 -0
  268. package/package.json +22 -3
  269. package/skill/browse/SKILL.md +192 -481
  270. package/skill/browse/references/commands.md +203 -18
  271. package/skill/browse-aeo/SKILL.md +148 -0
  272. package/skill/browse-config/SKILL.md +200 -0
  273. package/skill/browse-geo/SKILL.md +225 -0
  274. package/skill/browse-qa/SKILL.md +134 -290
  275. package/skill/browse-seo/SKILL.md +188 -0
  276. package/skill/browse-stealth/SKILL.md +246 -0
@@ -0,0 +1,96 @@
1
+ /**
2
+ * iOS app manager — extends the shared AppManager with iOS-specific lifecycle.
3
+ *
4
+ * Provides the same command surface as macOS/Android managers while wrapping
5
+ * iOS Simulator lifecycle (boot, install, launch) and runner communication.
6
+ *
7
+ * The AppManager base class handles:
8
+ * - Ref assignment via assignRefs()
9
+ * - Text extraction via extractText()
10
+ * - Snapshot formatting
11
+ * - Action dispatch through AppBridgeProtocol
12
+ *
13
+ * This manager adds:
14
+ * - Simulator boot + runner launch on connect()
15
+ * - Deep link navigation via simctl openurl
16
+ * - Permission management
17
+ * - Clean teardown (terminate runner, optionally shutdown simulator)
18
+ */
19
+ import type { AppState } from '../types';
20
+ import type { AutomationTarget, TargetCapabilities } from '../../automation/target';
21
+ import { type SimulatorPermission } from './controller';
22
+ export declare class IOSAppManager implements AutomationTarget {
23
+ readonly targetType = "app";
24
+ private bridge;
25
+ private refMap;
26
+ private lastSnapshot;
27
+ private udid;
28
+ private bundleId;
29
+ private port;
30
+ private connected;
31
+ constructor(udid: string, bundleId: string, port: number);
32
+ getCapabilities(): TargetCapabilities;
33
+ getCurrentLocation(): string;
34
+ isReady(): boolean;
35
+ close(): Promise<void>;
36
+ /**
37
+ * Connect to the iOS Simulator and start the runner.
38
+ * Call this before any bridge operations.
39
+ */
40
+ connect(): Promise<void>;
41
+ /** Get the app tree and assign refs. */
42
+ snapshot(interactive?: boolean): Promise<string>;
43
+ /** Extract visible text from the app. */
44
+ text(): Promise<string>;
45
+ /** Resolve a @ref to a node path. */
46
+ resolveRef(ref: string): {
47
+ path: number[];
48
+ role: string;
49
+ label: string;
50
+ };
51
+ /** Tap (press) an element by ref. */
52
+ tap(ref: string): Promise<string>;
53
+ /** Fill a text field by ref. */
54
+ fill(ref: string, value: string): Promise<string>;
55
+ /** Type text using the focused element. */
56
+ typeText(text: string): Promise<string>;
57
+ /** Swipe on an element or screen in a direction. */
58
+ swipe(direction: string, ref?: string): Promise<string>;
59
+ /** Press a key. */
60
+ pressKey(key: string): Promise<string>;
61
+ /** Take a screenshot. */
62
+ screenshot(outputPath: string): Promise<string>;
63
+ /** Get lightweight state for action-context. */
64
+ getState(): Promise<AppState>;
65
+ /** Get the last snapshot text. */
66
+ getLastSnapshot(): string | null;
67
+ /** Get the bundle ID. */
68
+ getBundleId(): string;
69
+ /** Get the simulator UDID. */
70
+ getUDID(): string;
71
+ /**
72
+ * Reconfigure this manager to target a different app without restarting the runner.
73
+ * Called by the server when --app changes within the shared iOS session.
74
+ */
75
+ reconfigureTarget(newBundleId: string): void;
76
+ /**
77
+ * Open a deep link URL in the simulator.
78
+ * The target app must be registered to handle the URL scheme.
79
+ */
80
+ openDeepLink(url: string): Promise<string>;
81
+ /**
82
+ * Grant a permission to the target app.
83
+ */
84
+ grantPermission(permission: SimulatorPermission): Promise<string>;
85
+ /**
86
+ * Revoke a permission from the target app.
87
+ */
88
+ revokePermission(permission: SimulatorPermission): Promise<string>;
89
+ private requireBridge;
90
+ }
91
+ /**
92
+ * Factory function to create and connect an IOSAppManager.
93
+ * Handles the full lifecycle: resolve simulator, boot, launch runner, create bridge.
94
+ */
95
+ export declare function createIOSAppManager(bundleId: string, udid?: string): Promise<IOSAppManager>;
96
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/app/ios/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAqB,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGpF,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAKtB,qBAAa,aAAc,YAAW,gBAAgB;IACpD,QAAQ,CAAC,UAAU,SAAS;IAC5B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,SAAS,CAAS;gBAEd,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAQxD,eAAe,IAAI,kBAAkB;IAYrC,kBAAkB,IAAI,MAAM;IAI5B,OAAO,IAAI,OAAO;IAIZ,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAe5B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAc9B,wCAAwC;IAClC,QAAQ,CAAC,WAAW,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IASpD,yCAAyC;IACnC,IA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AAC,MAAM,CAAC;IAOxE,OAAO,CAAC,aAAa;CAKtB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,aAAa,CAAC,CAKxB"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * iOS runner RPC protocol — TypeScript types matching the Swift runner's JSON API.
3
+ *
4
+ * The browse-ios-runner is a tiny SwiftUI app that runs inside the iOS Simulator,
5
+ * hosts an HTTP server, and exposes the accessibility tree + actions via JSON RPC.
6
+ * This file defines the wire format between the host-side Node.js bridge and the
7
+ * in-simulator runner.
8
+ *
9
+ * Design:
10
+ * - Runner listens on a fixed port inside the simulator (forwarded via simctl).
11
+ * - Requests are JSON POST to /<endpoint>.
12
+ * - Responses are JSON with a consistent { success, data?, error? } envelope.
13
+ * - The raw tree format maps 1:1 to XCUIElement attributes.
14
+ */
15
+ /** A single node in the iOS accessibility tree as returned by the runner. */
16
+ export interface RawIOSNode {
17
+ /** XCUIElement.elementType raw value (e.g. "button", "textField", "staticText") */
18
+ elementType: string;
19
+ /** XCUIElement.identifier (accessibilityIdentifier) */
20
+ identifier: string;
21
+ /** XCUIElement.label (accessibilityLabel) */
22
+ label: string;
23
+ /** XCUIElement.value as string (accessibilityValue) */
24
+ value: string;
25
+ /** XCUIElement.placeholderValue */
26
+ placeholderValue: string;
27
+ /** Bounding frame in screen coordinates */
28
+ frame: {
29
+ x: number;
30
+ y: number;
31
+ width: number;
32
+ height: number;
33
+ };
34
+ /** Whether the element is enabled */
35
+ isEnabled: boolean;
36
+ /** Whether the element is selected */
37
+ isSelected: boolean;
38
+ /** Whether the element has keyboard focus */
39
+ hasFocus: boolean;
40
+ /** Available trait names (e.g. ["button", "staticText", "header"]) */
41
+ traits: string[];
42
+ /** Child elements */
43
+ children: RawIOSNode[];
44
+ }
45
+ /** Lightweight state snapshot from the runner. */
46
+ export interface IOSState {
47
+ /** Bundle identifier of the target app under test */
48
+ bundleId: string;
49
+ /** Currently visible view controller title or navigation bar title */
50
+ screenTitle: string;
51
+ /** Total element count in the tree */
52
+ elementCount: number;
53
+ /** Whether an alert/sheet is currently presented */
54
+ alertPresent: boolean;
55
+ /** Whether the keyboard is visible */
56
+ keyboardVisible: boolean;
57
+ /** Device orientation */
58
+ orientation: 'portrait' | 'landscape';
59
+ /** Status bar time string (for screenshot context) */
60
+ statusBarTime: string;
61
+ }
62
+ /** Standard JSON response from the runner's HTTP server. */
63
+ export interface RunnerResponse<T = unknown> {
64
+ success: boolean;
65
+ data?: T;
66
+ error?: string;
67
+ }
68
+ /**
69
+ * The RPC contract exposed by the browse-ios-runner HTTP server.
70
+ *
71
+ * Each method maps to a POST endpoint:
72
+ * tree() -> POST /tree
73
+ * action() -> POST /action { path, actionName }
74
+ * setValue() -> POST /set-value { path, value }
75
+ * type() -> POST /type { text }
76
+ * press() -> POST /press { key }
77
+ * screenshot() -> POST /screenshot { outputPath }
78
+ * state() -> POST /state
79
+ */
80
+ export interface IOSRunnerProtocol {
81
+ /** Get the full accessibility tree of the target app. */
82
+ tree(): Promise<RawIOSNode>;
83
+ /** Perform an action on a node at the given tree path. */
84
+ action(path: number[], actionName: string): Promise<{
85
+ success: boolean;
86
+ error?: string;
87
+ }>;
88
+ /** Set the value of an editable element at the given tree path. */
89
+ setValue(path: number[], value: string): Promise<{
90
+ success: boolean;
91
+ error?: string;
92
+ }>;
93
+ /** Type text using the software keyboard (element must have focus). */
94
+ type(text: string): Promise<{
95
+ success: boolean;
96
+ error?: string;
97
+ }>;
98
+ /** Press a hardware key (e.g. "home", "volumeUp", "return"). */
99
+ press(key: string): Promise<{
100
+ success: boolean;
101
+ error?: string;
102
+ }>;
103
+ /** Capture a screenshot and save it to the specified output path on the host. */
104
+ screenshot(outputPath: string): Promise<{
105
+ success: boolean;
106
+ error?: string;
107
+ }>;
108
+ /** Get lightweight state for action-context probes. */
109
+ state(): Promise<IOSState>;
110
+ }
111
+ /**
112
+ * Map iOS elementType strings to browse-normalized AX role names.
113
+ * This bridges the gap between XCUIElement.ElementType and the
114
+ * macOS-style AX roles used in the shared AppNode contract.
115
+ */
116
+ export declare const IOS_ROLE_MAP: Record<string, string>;
117
+ /**
118
+ * Convert a RawIOSNode elementType to the normalized AX role used by browse.
119
+ * Falls back to "AXGroup" for unrecognized types.
120
+ */
121
+ export declare function normalizeIOSRole(elementType: string): string;
122
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../src/app/ios/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IACzB,mFAAmF;IACnF,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,gBAAgB,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,qBAAqB;IACrB,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAID,kDAAkD;AAClD,MAAM,WAAW,QAAQ;IACvB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,Y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,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE9E,uDAAuD;IACvD,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC5B;AAID;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA0C/C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE5D"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * iOS Simulator lifecycle service — shared between CLI and command layer.
3
+ *
4
+ * All simulator lifecycle logic lives here. Both the CLI fast path
5
+ * and the meta command handler call this service, never reimplementing
6
+ * simulator resolution, runner bootstrap, or health checking.
7
+ */
8
+ export interface SimServiceState {
9
+ platform: string;
10
+ device: string;
11
+ udid: string;
12
+ app: string;
13
+ port: number;
14
+ pid?: number;
15
+ startedAt: string;
16
+ }
17
+ export declare function readState(): SimServiceState | null;
18
+ export declare function writeState(state: SimServiceState): void;
19
+ export declare function clearState(): void;
20
+ export declare function checkHealth(port?: number): Promise<boolean>;
21
+ export declare function configureTarget(port: number, bundleId: string, udid?: string): Promise<void>;
22
+ export declare function status(): Promise<{
23
+ running: boolean;
24
+ state: SimServiceState | null;
25
+ healthy: boolean;
26
+ }>;
27
+ export declare function stop(): Promise<string>;
28
+ export interface StartOptions {
29
+ device?: string;
30
+ app?: string;
31
+ /** Open the Simulator window so the user can see it (default: headless) */
32
+ visible?: boolean;
33
+ /** Callback for progress messages (default: stderr) */
34
+ log?: (msg: string) => void;
35
+ }
36
+ export declare function startIOS(opts?: StartOptions): Promise<SimServiceState>;
37
+ //# sourceMappingURL=sim-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-service.d.ts","sourceRoot":"","sources":["../../../../src/app/ios/sim-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH,MAAM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The bridge is a thin adapter: it spawns the Swift binary, sends commands,
5
+ * and parses JSON responses. browse owns all semantics above this layer.
6
+ */
7
+ import type { AppBridgeProtocol } from '../types';
8
+ /**
9
+ * Resolve the browse-ax binary path.
10
+ * Checks: local build, installed binary, lazy download location.
11
+ */
12
+ export declare function resolveBridgePath(): string;
13
+ /**
14
+ * Ensure the macOS AX bridge binary is available.
15
+ * Returns the path to the binary.
16
+ */
17
+ export declare function ensureMacOSBridge(): Promise<string>;
18
+ /**
19
+ * Create a macOS AX bridge protocol implementation for a given PID.
20
+ */
21
+ export declare function createMacOSBridge(bridgePath: string, pid: number): AppBridgeProtocol;
22
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../../src/app/macos/bridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAmC,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAKnF;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CA0B1C;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAKzD;AAwCD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB,CA0BpF"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * App automation manager — implements AutomationTarget for native app targets.
3
+ *
4
+ * Spawns a platform bridge (macOS AX, future Android/iOS), normalizes the tree,
5
+ * assigns refs host-side, and provides the same command surface as BrowserManager.
6
+ */
7
+ import type { AutomationTarget, TargetCapabilities } from '../automation/target';
8
+ import type { AppBridgeProtocol, AppState } from './types';
9
+ export declare class AppManager implements AutomationTarget {
10
+ readonly targetType = "app";
11
+ private bridge;
12
+ private refMap;
13
+ private lastSnapshot;
14
+ private lastTree;
15
+ private appName;
16
+ constructor(bridge: AppBridgeProtocol, appName: string);
17
+ getCapabilities(): TargetCapabilities;
18
+ getCurrentLocation(): string;
19
+ isReady(): boolean;
20
+ close(): Promise<void>;
21
+ /** Get the app tree and assign refs */
22
+ snapshot(interactive?: boolean): Promise<string>;
23
+ /** Extract visible text from the app */
24
+ text(): Promise<string>;
25
+ /** Resolve a @ref to a node path */
26
+ resolveRef(ref: string): {
27
+ path: number[];
28
+ role: string;
29
+ label: string;
30
+ };
31
+ /** Tap (press) an element by ref */
32
+ tap(ref: string): Promise<string>;
33
+ /** Fill a text field by ref */
34
+ fill(ref: string, value: string): Promise<string>;
35
+ /** Type text using the focused element */
36
+ typeText(text: string): Promise<string>;
37
+ /** Swipe on an element or the window in a direction */
38
+ swipe(direction: string, ref?: string): Promise<string>;
39
+ /** Press a key */
40
+ pressKey(key: string): Promise<string>;
41
+ /** Take a screenshot */
42
+ screenshot(outputPath: string): Promise<string>;
43
+ /** Get lightweight state for action-context */
44
+ getState(): Promise<AppState>;
45
+ /** Get the last snapshot text */
46
+ getLastSnapshot(): string | null;
47
+ /** Get the app name */
48
+ getAppName(): string;
49
+ }
50
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/app/manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAW,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGpE,qBAAa,UAAW,YAAW,gBAAgB;IACjD,QAAQ,CAAC,UAAU,SAAS;IAC5B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM;IAKtD,eAAe,IAAI,kBAAkB;IAYrC,kBAAkB,IAAI,MAAM;IAI5B,OAAO,IAAI,OAAO;IAIZ,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAS5B,uCAAuC;IACjC,QAAQ,CAAC,WAAW,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAQpD,wCAAwC;IAClC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAK7B,oCAAoC;IACpC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAQxE,oCAAoC;IAC9B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOvC,+BAA+B;IACzB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOvD,0CAA0C;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM7C,uDAAuD;IACjD,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAsB7D,kBAAkB;IACZ,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM5C,wBAAwB;IAClB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMrD,+CAA+C;IACzC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IAInC,iCAAiC;IACjC,eAAe,IAAI,MAAM,GAAG,IAAI;IAIhC,uBAAuB;IACvB,UAAU,IAAI,MAAM;CAGrB"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * App tree normalization — converts raw bridge output to browse-owned structures.
3
+ *
4
+ * Assigns @refs host-side, extracts visible text, and prepares snapshot output.
5
+ * The bridge provides raw tree data; browse owns refs, formatting, and semantics.
6
+ */
7
+ import type { AppNode } from './types';
8
+ /** Ref entry for app nodes */
9
+ export interface AppRef {
10
+ path: number[];
11
+ role: string;
12
+ label: string;
13
+ }
14
+ /**
15
+ * Assign @refs to interactive nodes in the app tree.
16
+ * Returns a Map<refId, AppRef> and the formatted snapshot text.
17
+ */
18
+ export declare function assignRefs(root: AppNode, interactive?: boolean): {
19
+ refMap: Map<string, AppRef>;
20
+ text: string;
21
+ };
22
+ /**
23
+ * Extract visible text from the app tree.
24
+ * Concatenates labels and values of text-bearing nodes.
25
+ */
26
+ export declare function extractText(root: AppNode): string;
27
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/app/normalize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,8BAA8B;AAC9B,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,OAAO,EACb,WAAW,UAAQ,GAClB;IAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA6C/C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAoBjD"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * App resolution — detects file paths vs identifiers and handles installation.
3
+ *
4
+ * When --app receives a file path (.app, .ipa, .apk), this module:
5
+ * 1. Installs the app into the simulator/emulator
6
+ * 2. Extracts the bundle ID / package name
7
+ * 3. Returns the resolved identifier for the rest of the pipeline
8
+ *
9
+ * When --app receives an identifier (com.example.app), it passes through unchanged.
10
+ */
11
+ type Log = (msg: string) => void;
12
+ /**
13
+ * Check if a value looks like a file path to an app bundle.
14
+ * .ipa and .apk are unambiguous. .app only triggers if the path exists on disk
15
+ * (avoids clash with bundle IDs like com.foo.app).
16
+ */
17
+ export declare function isAppFilePath(value: string): boolean;
18
+ /**
19
+ * Resolve an iOS --app argument.
20
+ * If it's a file path (.app or .ipa), install it and return the bundle ID.
21
+ * If it's already a bundle ID, return as-is.
22
+ */
23
+ export declare function resolveIOSApp(appArg: string, udid: string, log: Log): Promise<string>;
24
+ /**
25
+ * Resolve an Android --app argument.
26
+ * If it's a file path (.apk), install it and return the package name.
27
+ * If it's already a package name, return as-is.
28
+ */
29
+ export declare function resolveAndroidApp(appArg: string, serial: string, log: Log): Promise<string>;
30
+ export {};
31
+ //# sourceMappingURL=resolve-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-app.d.ts","sourceRoot":"","sources":["../../../src/app/resolve-app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAIjC;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAKpD;AAID;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,GAAG,GACP,OAAO,CAAC,MAAM,CAAC,CAqBjB;AAsED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,GACP,OAAO,CAAC,MAAM,CAAC,CAuBjB"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * App automation contract types — normalized node/state structures owned by browse.
3
+ *
4
+ * These types define the boundary between browse (host-side Node.js) and
5
+ * platform-specific bridges (macOS AX, future Android/iOS).
6
+ *
7
+ * Design: browse owns ref assignment, snapshot formatting, and command semantics.
8
+ * Bridges provide raw tree data in this normalized format.
9
+ */
10
+ /** A single node in the app accessibility/UI tree */
11
+ export interface AppNode {
12
+ /** Stable path within the tree (array of child indices) */
13
+ path: number[];
14
+ /** Accessibility role (e.g. "AXButton", "AXTextField", "AXStaticText") */
15
+ role: string;
16
+ /** Primary label/title */
17
+ label: string;
18
+ /** Current value (for text fields, sliders, etc.) */
19
+ value?: string;
20
+ /** Bounding frame in window coordinates */
21
+ frame: {
22
+ x: number;
23
+ y: number;
24
+ width: number;
25
+ height: number;
26
+ };
27
+ /** Whether the element is enabled for interaction */
28
+ enabled: boolean;
29
+ /** Whether the element has keyboard focus */
30
+ focused: boolean;
31
+ /** Whether the element is selected */
32
+ selected: boolean;
33
+ /** Whether the element accepts text input */
34
+ editable: boolean;
35
+ /** Available actions (e.g. ["AXPress", "AXShowMenu"]) */
36
+ actions: string[];
37
+ /** Child nodes */
38
+ children: AppNode[];
39
+ }
40
+ /** Lightweight app state for action-context probes */
41
+ export interface AppState {
42
+ /** Title of the target window */
43
+ windowTitle: string;
44
+ /** Path of the currently focused element */
45
+ focusedPath: number[] | null;
46
+ /** Total element count in the tree */
47
+ elementCount: number;
48
+ /** Number of windows for the target app */
49
+ windowCount: number;
50
+ /** App name */
51
+ appName: string;
52
+ /** Optional settled/screen-stable hint */
53
+ settled?: boolean;
54
+ }
55
+ /** Result of a bridge action */
56
+ export interface BridgeResult {
57
+ success: boolean;
58
+ error?: string;
59
+ }
60
+ /** Raw bridge protocol — what platform bridges must implement */
61
+ export interface AppBridgeProtocol {
62
+ /** Get the accessibility tree for the target app/window */
63
+ tree(): Promise<AppNode>;
64
+ /** Perform an action on a node (e.g. AXPress) */
65
+ action(path: number[], actionName: string): Promise<BridgeResult>;
66
+ /** Set value on an editable node */
67
+ setValue(path: number[], value: string): Promise<BridgeResult>;
68
+ /** Type text using the focused element */
69
+ type(text: string): Promise<BridgeResult>;
70
+ /** Press a key using the focused element */
71
+ press(key: string): Promise<BridgeResult>;
72
+ /** Capture screenshot of the target window */
73
+ screenshot(outputPath: string): Promise<BridgeResult>;
74
+ /** Get lightweight state for action-context */
75
+ state(): Promise<AppState>;
76
+ }
77
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/app/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,qDAAqD;AACrD,MAAM,WAAW,OAAO;IACtB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,kBAAkB;IAClB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,sDAAsD;AACtD,MAAM,WAAW,QAAQ;IACvB,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC7B,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,gCAAgC;AAChC,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACzB,iDAAiD;IACjD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAClE,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/D,0CAA0C;IAC1C,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1C,4CAA4C;IAC5C,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1C,8CAA8C;IAC9C,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACtD,+CAA+C;IAC/C,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC5B"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Action context — captures page state before/after write commands
3
+ * and produces a compact delta showing what changed.
4
+ *
5
+ * Pure functions, no side effects, no logging.
6
+ * prepareWriteContext / finalizeWriteContext orchestrate the full
7
+ * before/after lifecycle for write commands at any context level.
8
+ */
9
+ import type { Page } from 'playwright';
10
+ import type { PageState, ContextDelta, ContextLevel, WriteContextCapture } from '../types';
11
+ import type { BrowserTarget } from '../browser/target';
12
+ import type { SessionBuffers } from '../network/buffers';
13
+ /**
14
+ * Capture a snapshot of the current page state.
15
+ * Called before and after each write command to detect changes.
16
+ */
17
+ export declare function capturePageState(page: Page, bm: BrowserTarget, buffers: SessionBuffers): Promise<PageState>;
18
+ /**
19
+ * Compare before/after page state and return only what changed.
20
+ * Returns null if nothing changed.
21
+ */
22
+ export declare function buildContextDelta(before: PageState, after: PageState): ContextDelta | null;
23
+ /**
24
+ * Format a context delta as a single-line human-readable string.
25
+ * Appended to command output so the caller sees what changed.
26
+ *
27
+ * Example: `[context] -> /checkout | title: "Order Summary" | errors: +2 | settled:true`
28
+ *
29
+ * @param delta What changed between before and after page states.
30
+ * @param _command The write command name (reserved for future per-command logic).
31
+ * @param afterState Optional after-state; when provided, the settled signal is appended.
32
+ */
33
+ export declare function formatContextLine(delta: ContextDelta, _command: string, afterState?: PageState): string;
34
+ /**
35
+ * Compare two ARIA snapshot outputs and produce a compact delta.
36
+ *
37
+ * Both `baseline` and `current` may contain @refs like `@e1`, `@e2`.
38
+ * The comparison is done on ref-stripped text (so renumbered refs don't
39
+ * cause false diffs). Added lines preserve @refs from `current`;
40
+ * removed lines are shown without refs (the element is gone).
41
+ *
42
+ * Returns a summary line + diff lines, or empty string if identical.
43
+ *
44
+ * Example output:
45
+ * ```
46
+ * [snapshot-delta] +2 -1 =12
47
+ * + @e14 [button] "Place Order"
48
+ * + @e15 [textbox] "Promo Code"
49
+ * - [button] "Add to Cart"
50
+ * ```
51
+ */
52
+ export declare function formatAriaDelta(baseline: string | null | undefined, current: string): string;
53
+ /**
54
+ * Capture page state before a write command executes.
55
+ *
56
+ * The returned `WriteContextCapture` is passed to `finalizeWriteContext`
57
+ * after the write command completes.
58
+ *
59
+ * - `'off'`: no capture, no overhead
60
+ * - `'state'`: capture PageState only (URL, title, dialog, etc.)
61
+ * - `'delta'`: capture PageState + store baseline snapshot text
62
+ * - `'full'`: capture PageState (snapshot taken in finalize phase)
63
+ */
64
+ export declare function prepareWriteContext(level: ContextLevel, bm: BrowserTarget, buffers: SessionBuffers): Promise<WriteContextCapture>;
65
+ /**
66
+ * Enrich write command result with context based on the capture level.
67
+ *
68
+ * - `'off'`: return result unchanged
69
+ * - `'state'`: append `[context]` line with state delta (URL, title, etc.)
70
+ * - `'delta'`: append state context line + ARIA snapshot delta with refs
71
+ * - `'full'`: append state context line + full ARIA snapshot with refs
72
+ *
73
+ * **Error safety:** All snapshot/delta work is wrapped in try/catch.
74
+ * Context capture failures never break the write command response.
75
+ * If anything fails, the original result is returned unchanged.
76
+ */
77
+ export declare function finalizeWriteContext(capture: WriteContextCapture, bm: BrowserTarget, buffers: SessionBuffers, result: string, command: string): Promise<string>;
78
+ import type { AutomationTarget } from './target';
79
+ import type { AppState } from '../app/types';
80
+ /** App-specific state captured before/after write commands */
81
+ export interface AppContextDelta {
82
+ windowTitleChanged?: string;
83
+ focusChanged?: boolean;
84
+ elementCountChanged?: number;
85
+ windowCountChanged?: number;
86
+ }
87
+ /**
88
+ * Capture the state of a native app before a write command.
89
+ * Uses the AppManager.getState() lightweight probe.
90
+ */
91
+ export declare function captureAppState(target: AutomationTarget): Promise<AppState | null>;
92
+ /**
93
+ * Compare before/after app state and return only what changed.
94
+ * Returns null if nothing changed.
95
+ */
96
+ export declare function buildAppContextDelta(before: AppState, after: AppState): AppContextDelta | null;
97
+ /**
98
+ * Format an app context delta as a single-line human-readable string.
99
+ */
100
+ export declare function formatAppContextLine(delta: AppContextDelta, _command: string): string;
101
+ /**
102
+ * Prepare write context capture for app targets.
103
+ */
104
+ export declare function prepareAppWriteContext(level: ContextLevel, target: AutomationTarget): Promise<WriteContextCapture>;
105
+ /**
106
+ * Finalize write context for app targets.
107
+ * Appends context delta and optional snapshot info to the command result.
108
+ */
109
+ export declare function finalizeAppWriteContext(capture: WriteContextCapture, target: AutomationTarget, result: string, command: string): Promise<string>;
110
+ //# sourceMappingURL=action-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-context.d.ts","sourceRoot":"","sources":["../../../src/automation/action-context.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,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