@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,32 @@
1
+ /**
2
+ * Accessibility audit — WCAG 2.1 AA automated checks.
3
+ *
4
+ * Runs inside page.evaluate() for a single-pass audit.
5
+ * Returns score (0-100) + findings with severity and element references.
6
+ */
7
+ import type { Page } from 'playwright';
8
+ export interface A11yFinding {
9
+ type: string;
10
+ severity: 'critical' | 'warning' | 'info';
11
+ element: string;
12
+ details: string;
13
+ y: number;
14
+ }
15
+ export interface A11yReport {
16
+ score: number;
17
+ findings: A11yFinding[];
18
+ summary: {
19
+ critical: number;
20
+ warning: number;
21
+ info: number;
22
+ };
23
+ }
24
+ /**
25
+ * Run a WCAG 2.1 AA accessibility audit on the current page.
26
+ */
27
+ export declare function runA11yAudit(page: Page): Promise<A11yReport>;
28
+ /**
29
+ * Format a11y report as human-readable text.
30
+ */
31
+ export declare function formatA11yReport(report: A11yReport, jsonMode?: boolean): string;
32
+ //# sourceMappingURL=a11y.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a11y.d.ts","sourceRoot":"","sources":["../../src/a11y.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,CAiIlE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,UAAQ,GAAG,MAAM,CAmB7E"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Android host bridge — spawns the on-device driver and communicates via HTTP.
3
+ *
4
+ * Flow:
5
+ * 1. ensureAndroidBridge() — checks adb, finds a booted emulator/device
6
+ * 2. createAndroidBridge(serial, packageName) — installs APK (if needed),
7
+ * starts instrumentation via `adb shell am instrument`, forwards port
8
+ * 3. AndroidDriverProtocol methods — thin HTTP wrappers to the on-device service
9
+ *
10
+ * The driver APK exposes a JSON-over-HTTP API on port 7779 (device-side).
11
+ * The bridge forwards that port to localhost via `adb forward`.
12
+ */
13
+ import type { AndroidDriverProtocol } from './protocol';
14
+ /**
15
+ * Check for adb availability and a booted device/emulator.
16
+ * Returns the device serial to use.
17
+ */
18
+ export declare function ensureAndroidBridge(serial?: string): Promise<string>;
19
+ /**
20
+ * Attempt to install Android platform-tools automatically.
21
+ * On macOS, uses Homebrew. Returns true if install succeeded.
22
+ */
23
+ export declare function installAdb(log?: (msg: string) => void): Promise<boolean>;
24
+ /** Sentinel error so sim-service can catch it and offer install */
25
+ export declare class AdbNotFoundError extends Error {
26
+ constructor();
27
+ }
28
+ /**
29
+ * Create an Android bridge protocol for a target package.
30
+ *
31
+ * Steps:
32
+ * 1. Verify target app is installed on device
33
+ * 2. Install the driver APK (if not already installed)
34
+ * 3. Kill any stale driver instrumentation
35
+ * 4. Start the instrumentation service on-device
36
+ * 5. Forward port 7779 to localhost
37
+ * 6. Wait for /health to respond
38
+ * 7. Return the AndroidDriverProtocol implementation
39
+ */
40
+ export declare function createAndroidBridge(serial: string, packageName: string): Promise<AndroidDriverProtocol>;
41
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../../src/app/android/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,KAAK,EACV,qBAAqB,EAStB,MAAM,YAAY,CAAC;AA4EpB;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAU1E;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAmC9E;AAED,mEAAmE;AACnE,qBAAa,gBAAiB,SAAQ,KAAK;;CAQ1C;AAyDD;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,qBAAqB,CAAC,CAkChC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Android emulator management — find SDK, create AVDs, start emulators.
3
+ *
4
+ * Handles the full bootstrap chain:
5
+ * 1. Find or install Android SDK command-line tools
6
+ * 2. Install a system image if none exists
7
+ * 3. Create an AVD if none exists
8
+ * 4. Start the emulator
9
+ * 5. Wait for boot
10
+ */
11
+ /** Ensure JAVA_HOME is set for child processes. Prefers JDK 21 (Android-compatible). */
12
+ export declare function ensureJavaHome(): void;
13
+ type Log = (msg: string) => void;
14
+ /** Find the Android SDK root directory, or null if not found */
15
+ export declare function findSdkRoot(): string | null;
16
+ /** Install Android SDK cmdline-tools via Homebrew (macOS) */
17
+ export declare function installSdk(log: Log): Promise<string | null>;
18
+ /** Install the default system image using sdkmanager */
19
+ export declare function installSystemImage(sdkManager: string, log: Log): boolean;
20
+ /** Create the default AVD */
21
+ export declare function createAvd(sdkRoot: string, avdManager: string, log: Log): boolean;
22
+ /** Start an emulator with the given AVD name */
23
+ export declare function startEmulator(emulatorBin: string, avdName: string, log: Log, visible?: boolean): void;
24
+ /** Wait for emulator to boot and appear in adb devices */
25
+ export declare function waitForBoot(log: Log, timeoutMs?: number): Promise<string>;
26
+ /**
27
+ * Ensure an Android emulator is running and return its serial.
28
+ * Handles the full chain: SDK → system image → AVD → emulator → boot.
29
+ */
30
+ export declare function ensureEmulator(log: Log, visible?: boolean): Promise<string>;
31
+ export {};
32
+ //# sourceMappingURL=emulator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emulator.d.ts","sourceRoot":"","sources":["../../../../src/app/android/emulator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,wFAAwF;AACxF,wBAAgB,cAAc,IAAI,IAAI,CAgBrC;AAID,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAuBjC,gEAAgE;AAChE,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAU3C;AAiDD,6DAA6D;AAC7D,wBAAsB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAqCjE;AAUD,wDAAwD;AACxD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAexE;AAcD,6BAA6B;AAC7B,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAYhF;AAID,gDAAgD;AAChD,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,UAAQ,GAAG,IAAI,CASnG;AAED,0DAA0D;AAC1D,wBAAsB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,SAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBhF;AAID;;;GAGG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CA6G/E"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Android app automation manager — wraps the Android bridge with the shared
3
+ * app normalization layer and exposes the same command surface as macOS AppManager.
4
+ *
5
+ * Converts RawAndroidNode trees to AppNode (browse-owned format), assigns @refs
6
+ * host-side, and delegates commands to the on-device driver via AndroidDriverProtocol.
7
+ */
8
+ import type { AutomationTarget, TargetCapabilities } from '../../automation/target';
9
+ import type { AndroidDriverProtocol } from './protocol';
10
+ import type { AppState } from '../types';
11
+ /**
12
+ * Android app automation manager.
13
+ *
14
+ * Implements the same public surface as macOS AppManager so that commands.ts
15
+ * and the server can treat both platforms identically.
16
+ */
17
+ export declare class AndroidAppManager implements AutomationTarget {
18
+ readonly targetType = "app";
19
+ private bridge;
20
+ private packageName;
21
+ private refMap;
22
+ private lastSnapshot;
23
+ private lastTree;
24
+ constructor(bridge: AndroidDriverProtocol, packageName: string);
25
+ getCapabilities(): TargetCapabilities;
26
+ getCurrentLocation(): string;
27
+ isReady(): boolean;
28
+ close(): Promise<void>;
29
+ /** Get the app tree and assign @refs */
30
+ snapshot(interactive?: boolean): Promise<string>;
31
+ /** Extract visible text from the app */
32
+ text(): Promise<string>;
33
+ /** Resolve a @ref to a node path */
34
+ resolveRef(ref: string): {
35
+ path: number[];
36
+ role: string;
37
+ label: string;
38
+ };
39
+ /** Tap (click) an element by ref */
40
+ tap(ref: string): Promise<string>;
41
+ /** Fill a text field by ref */
42
+ fill(ref: string, value: string): Promise<string>;
43
+ /** Type text into the currently focused element */
44
+ typeText(text: string): Promise<string>;
45
+ /** Swipe/scroll on an element or the screen in a direction */
46
+ swipe(direction: string, ref?: string): Promise<string>;
47
+ /** Return a friendly message when swipe hits the boundary */
48
+ private swipeBoundaryMessage;
49
+ /** Find the best scrollable node in the last tree (prefers deepest/largest) */
50
+ private findScrollable;
51
+ /** Press a named key */
52
+ pressKey(key: string): Promise<string>;
53
+ /** Take a screenshot and save it to the host filesystem */
54
+ screenshot(outputPath: string): Promise<string>;
55
+ /** Get lightweight state for action-context probes */
56
+ getState(): Promise<AppState>;
57
+ /** Get the last snapshot text */
58
+ getLastSnapshot(): string | null;
59
+ /** Get the package name */
60
+ getPackageName(): string;
61
+ }
62
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/app/android/manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAgC,MAAM,YAAY,CAAC;AACtF,OAAO,KAAK,EAAW,QAAQ,EAAE,MAAM,UAAU,CAAC;AA6FlD;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,gBAAgB;IACxD,QAAQ,CAAC,UAAU,SAAS;IAE5B,OAAO,CAA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AO,CAAC,MAAM,CAAC;IAMrD,sDAAsD;IAChD,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IAYnC,iCAAiC;IACjC,eAAe,IAAI,MAAM,GAAG,IAAI;IAIhC,2BAA2B;IAC3B,cAAc,IAAI,MAAM;CAGzB"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Android driver RPC protocol — matches the on-device instrumentation service.
3
+ *
4
+ * The driver is an Android instrumentation test that exposes a JSON-over-HTTP
5
+ * API on port 7779 (device-side, forwarded via `adb forward`).
6
+ *
7
+ * Design: browse owns all semantics above this layer. The driver just exposes
8
+ * raw AccessibilityNodeInfo trees and performs UiAutomator actions.
9
+ */
10
+ /**
11
+ * A single accessibility node as serialised by the on-device driver.
12
+ * Mirrors android.view.accessibility.AccessibilityNodeInfo fields.
13
+ */
14
+ export interface RawAndroidNode {
15
+ /** Child-index path from root — stable within a single tree snapshot */
16
+ path: number[];
17
+ /** View class name (e.g. "android.widget.Button", "android.widget.EditText") */
18
+ className: string;
19
+ /** Content description or text content */
20
+ text: string | null;
21
+ /** Hint text for editable fields */
22
+ hint: string | null;
23
+ /** Resource ID (e.g. "com.example.app:id/submit_button") */
24
+ resourceId: string | null;
25
+ /** Bounding rectangle in screen coordinates */
26
+ bounds: {
27
+ left: number;
28
+ top: number;
29
+ right: number;
30
+ bottom: number;
31
+ };
32
+ /** Whether the node is clickable */
33
+ clickable: boolean;
34
+ /** Whether the node is long-clickable */
35
+ longClickable: boolean;
36
+ /** Whether the node is enabled */
37
+ enabled: boolean;
38
+ /** Whether the node is focused */
39
+ focused: boolean;
40
+ /** Whether the node is selected */
41
+ selected: boolean;
42
+ /** Whether the node is checked (for checkboxes/radio buttons/toggles) */
43
+ checked: boolean;
44
+ /** Whether the node is checkable */
45
+ checkable: boolean;
46
+ /** Whether the node accepts text input */
47
+ editable: boolean;
48
+ /** Whether the node is scrollable */
49
+ scrollable: boolean;
50
+ /** Whether the node is visible on screen */
51
+ visibleToUser: boolean;
52
+ /** Child nodes */
53
+ children: RawAndroidNode[];
54
+ }
55
+ /**
56
+ * Lightweight Android app state for action-context probes.
57
+ * Returned by the /state endpoint — fast, no full tree traversal.
58
+ */
59
+ export interface AndroidState {
60
+ /** Package name of the foreground app */
61
+ packageName: string;
62
+ /** Activity class name currently in the foreground */
63
+ activityName: string;
64
+ /** Content description or title of the focused window */
65
+ windowTitle: string | null;
66
+ /** Total node count in the accessibility tree */
67
+ nodeCount: number;
68
+ /** Whether the screen is on and interactive */
69
+ interactive: boolean;
70
+ }
71
+ /**
72
+ * Android driver RPC protocol — matches the on-device instrumentation service.
73
+ *
74
+ * Implemented by `AndroidBridge` in `bridge.ts`. Each method maps to one
75
+ * HTTP call to the on-device driver (via `adb forward` + localhost).
76
+ */
77
+ export interface AndroidDriverProtocol {
78
+ /**
79
+ * Retrieve the full accessibility tree for the target package.
80
+ * The driver scopes the tree to windows owned by `targetPackage`.
81
+ */
82
+ tree(): Promise<RawAndroidNode>;
83
+ /**
84
+ * Perform an accessibility action on a node identified by its path.
85
+ * Supported actions: "click", "longClick", "focus", "clearFocus",
86
+ * "select", "clearSelection", "scrollForward", "scrollBackward",
87
+ * "expand", "collapse".
88
+ */
89
+ action(path: number[], actionName: string): Promise<{
90
+ success: boolean;
91
+ error?: string;
92
+ }>;
93
+ /**
94
+ * Set the text value of an editable node (EditText).
95
+ * Uses AccessibilityNodeInfo.ACTION_SET_TEXT.
96
+ */
97
+ setValue(path: number[], value: string): Promise<{
98
+ success: boolean;
99
+ error?: string;
100
+ }>;
101
+ /**
102
+ * Type text into the currently focused element via UiAutomator keyboard injection.
103
+ * Equivalent to UiDevice.getInstance().typeText(text).
104
+ */
105
+ type(text: string): Promise<{
106
+ success: boolean;
107
+ error?: string;
108
+ }>;
109
+ /**
110
+ * Press a named key via UiDevice.pressKeyCode().
111
+ * Supported keys: ENTER, RETURN, BACK, HOME, DPAD_UP, DPAD_DOWN, DPAD_LEFT,
112
+ * DPAD_RIGHT, TAB, SPACE, DEL, BACKSPACE, FORWARD_DEL, DELETE, ESCAPE, ESC,
113
+ * MENU, SEARCH, VOLUME_UP, VOLUME_DOWN, CAMERA, POWER.
114
+ */
115
+ press(key: string): Promise<{
116
+ success: boolean;
117
+ error?: string;
118
+ }>;
119
+ /**
120
+ * Capture a screenshot and save it to `outputPath` on the host filesystem.
121
+ * The driver saves a PNG to a temp file on-device, then the bridge pulls it
122
+ * via `adb pull` to `outputPath`.
123
+ */
124
+ screenshot(outputPath: string): Promise<{
125
+ success: boolean;
126
+ error?: string;
127
+ }>;
128
+ /**
129
+ * Return lightweight app state for action-context probes.
130
+ * Fast path — no full tree traversal.
131
+ */
132
+ state(): Promise<AndroidState>;
133
+ }
134
+ /** Body sent to POST /action */
135
+ export interface ActionRequest {
136
+ path: number[];
137
+ action: string;
138
+ }
139
+ /** Body sent to POST /setValue */
140
+ export interface SetValueRequest {
141
+ path: number[];
142
+ value: string;
143
+ }
144
+ /** Body sent to POST /type */
145
+ export interface TypeRequest {
146
+ text: string;
147
+ }
148
+ /** Body sent to POST /press */
149
+ export interface PressRequest {
150
+ key: string;
151
+ }
152
+ /** Body sent to POST /screenshot */
153
+ export interface ScreenshotRequest {
154
+ /** On-device temp path — bridge pulls this file via adb pull */
155
+ outputPath: string;
156
+ }
157
+ /** Generic driver response for action/setValue/type/press/screenshot */
158
+ export interface DriverResult {
159
+ success: boolean;
160
+ error?: string;
161
+ }
162
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../src/app/android/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,oCAAoC;IACpC,IA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AgE;IAChE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Android device/emulator lifecycle service — shared between CLI and command layer.
3
+ *
4
+ * Mirrors the iOS sim-service pattern: state persistence, health checking,
5
+ * start/stop lifecycle, and target app management.
6
+ */
7
+ export interface AndroidServiceState {
8
+ platform: string;
9
+ device: string;
10
+ serial: string;
11
+ app: string;
12
+ port: number;
13
+ startedAt: string;
14
+ }
15
+ export declare function readState(): AndroidServiceState | null;
16
+ export declare function checkHealth(port?: number): Promise<boolean>;
17
+ export declare function status(): Promise<{
18
+ running: boolean;
19
+ state: AndroidServiceState | null;
20
+ healthy: boolean;
21
+ }>;
22
+ /** Stop just the driver (for app switching). Keeps the emulator running. */
23
+ export declare function stopDriver(): Promise<void>;
24
+ /** Full stop — kill driver and emulator. */
25
+ export declare function stop(): Promise<string>;
26
+ export interface StartOptions {
27
+ device?: string;
28
+ app?: string;
29
+ visible?: boolean;
30
+ log?: (msg: string) => void;
31
+ }
32
+ export declare function startAndroid(opts?: StartOptions): Promise<AndroidServiceState>;
33
+ //# sourceMappingURL=sim-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-service.d.ts","sourceRoot":"","sources":["../../../../src/app/android/sim-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAwBD,wBAAgB,SAAS,IAAI,mBAAmB,GAAG,IAAI,CAEtD;AAgBD,wBAAsB,WAAW,CAAC,IAAI,GAAE,MAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAK9E;AAID,wBAAsB,MAAM,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAMjH;AAID,4EAA4E;AAC5E,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAShD;AAED,4CAA4C;AAC5C,wBAAsB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAe5C;AAID,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,wBAAsB,YAAY,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA+IxF"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * App automation domain — normalized app tree, ref assignment, and command dispatch.
3
+ *
4
+ * Public API for the app automation layer. Consumers import from here.
5
+ */
6
+ export type { AppNode, AppState, BridgeResult, AppBridgeProtocol } from './types';
7
+ export type { RawAndroidNode, AndroidState, AndroidDriverProtocol, ActionRequest, SetValueRequest, TypeRequest, PressRequest, ScreenshotRequest, DriverResult, } from './android/protocol';
8
+ export { AndroidAppManager } from './android/manager';
9
+ export { ensureAndroidBridge, createAndroidBridge } from './android/bridge';
10
+ export type { RawIOSNode, IOSState, IOSRunnerProtocol, RunnerResponse, } from './ios/protocol';
11
+ export { normalizeIOSRole, IOS_ROLE_MAP } from './ios/protocol';
12
+ export { IOSAppManager, createIOSAppManager } from './ios/manager';
13
+ export { ensureIOSBridge, ensureRunnerApp, createIOSBridge } from './ios/bridge';
14
+ export { listSimulators, resolveSimulator, bootSimulator, shutdownSimulator, installApp, uninstallApp, launchApp, terminateApp, isAppInstalled, grantPermission, revokePermission, resetPermissions, screenshotSimulator, getAppContainer, openURL, addMedia, setStatusBar, clearStatusBar, checkXcodeTools, type SimulatorInfo, type SimulatorPermission, } from './ios/controller';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAClF,YAAY,EACV,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,YAAY,EACV,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * iOS bridge — communicates with the browse-ios-runner app via HTTP.
3
+ *
4
+ * The runner is a SwiftUI app installed in the iOS Simulator that:
5
+ * 1. Hosts an HTTP server on a fixed port (BROWSE_RUNNER_PORT, default 9820)
6
+ * 2. Uses XCTest/Accessibility APIs to traverse the UI tree
7
+ * 3. Performs actions (tap, type, swipe) via XCUIElement
8
+ * 4. Returns JSON responses matching the protocol.ts types
9
+ *
10
+ * The bridge on the host side:
11
+ * - Ensures Xcode CLI tools are available
12
+ * - Boots the simulator if needed
13
+ * - Installs and launches the runner app
14
+ * - Creates an AppBridgeProtocol that translates runner responses
15
+ * to the normalized AppNode/AppState format used by browse
16
+ *
17
+ * Port forwarding: simctl's networking stack makes localhost ports inside
18
+ * the simulator accessible on the host's localhost (no explicit forwarding needed).
19
+ */
20
+ import type { AppBridgeProtocol } from '../types';
21
+ /**
22
+ * Ensure the iOS bridge prerequisites are met:
23
+ * 1. macOS host (simulators only run on macOS)
24
+ * 2. Xcode CLI tools installed
25
+ * 3. At least one simulator available
26
+ *
27
+ * Returns the resolved simulator UDID.
28
+ */
29
+ export declare function ensureIOSBridge(udid?: string): Promise<{
30
+ udid: string;
31
+ name: string;
32
+ port: number;
33
+ }>;
34
+ /**
35
+ * Ensure the runner is available — delegates to the shared sim-service.
36
+ * This is the single entry point for runner lifecycle, whether called from
37
+ * sim start, target factory, or direct bridge usage.
38
+ */
39
+ export declare function ensureRunnerApp(udid: string, targetBundleId: string, port: number): Promise<void>;
40
+ /**
41
+ * Create an iOS bridge that implements AppBridgeProtocol.
42
+ *
43
+ * @param udid - Simulator UDID (for screenshot fallback via simctl)
44
+ * @param bundleId - Target app bundle identifier
45
+ * @param port - Runner HTTP port (default 9820)
46
+ */
47
+ export declare function createIOSBridge(udid: string, bundleId: string, port?: number): AppBridgeProtocol;
48
+ /**
49
+ * Reconfigure a running runner's target app at runtime.
50
+ * Used by sim-service when switching targets without restarting the runner.
51
+ */
52
+ export declare function configureRunnerTarget(port: number, bundleId: string): Promise<void>;
53
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../../src/app/ios/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAmC,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAkBnF;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAoBD;AAID;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAWf;AAkGD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,MAA4B,GACjC,iBAAiB,CA2CnB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzF"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * iOS Simulator lifecycle controller — boot, install, launch, permissions.
3
+ *
4
+ * Wraps `xcrun simctl` for simulator management. This module handles the
5
+ * simulator side of things (boot, app lifecycle) while the bridge handles
6
+ * communication with the in-simulator runner via HTTP.
7
+ *
8
+ * Separation of concerns:
9
+ * controller.ts — simulator lifecycle (boot, install, launch, permissions)
10
+ * bridge.ts — HTTP communication with the runner app
11
+ * manager.ts — AppManager integration (commands, refs, snapshot)
12
+ */
13
+ export interface SimulatorInfo {
14
+ /** Simulator UDID */
15
+ udid: string;
16
+ /** Simulator name (e.g. "iPhone 16 Pro") */
17
+ name: string;
18
+ /** Current state: "Shutdown", "Booted", etc. */
19
+ state: string;
20
+ /** iOS runtime version (e.g. "com.apple.CoreSimulator.SimRuntime.iOS-18-0") */
21
+ runtime: string;
22
+ /** Whether this simulator is available */
23
+ isAvailable: boolean;
24
+ }
25
+ export interface SimulatorDeviceList {
26
+ [runtime: string]: Array<{
27
+ udid: string;
28
+ name: string;
29
+ state: string;
30
+ isAvailable: boolean;
31
+ }>;
32
+ }
33
+ /**
34
+ * List all available iOS simulators.
35
+ * Optionally filter by name or runtime substring.
36
+ */
37
+ export declare function listSimulators(filter?: string): Promise<SimulatorInfo[]>;
38
+ /**
39
+ * Find a booted simulator, or the first available one.
40
+ * If udid is provided, returns that specific simulator.
41
+ */
42
+ export declare function resolveSimulator(identifier?: string): Promise<SimulatorInfo>;
43
+ /**
44
+ * Boot a simulator if not already booted.
45
+ * No-op if the simulator is already in "Booted" state.
46
+ */
47
+ export declare function bootSimulator(udid: string): Promise<void>;
48
+ /**
49
+ * Shutdown a simulator.
50
+ */
51
+ export declare function shutdownSimulator(udid: string): Promise<void>;
52
+ /**
53
+ * Install an app bundle into the simulator.
54
+ * @param udid - Simulator UDID
55
+ * @param appPath - Path to the .app bundle
56
+ */
57
+ export declare function installApp(udid: string, appPath: string): Promise<void>;
58
+ /**
59
+ * Uninstall an app from the simulator.
60
+ * @param udid - Simulator UDID
61
+ * @param bundleId - App bundle identifier
62
+ */
63
+ export declare function uninstallApp(udid: string, bundleId: string): Promise<void>;
64
+ /**
65
+ * Launch an app in the simulator.
66
+ * @param udid - Simulator UDID
67
+ * @param bundleId - App bundle identifier
68
+ * @param env - Optional environment variables to set
69
+ */
70
+ export declare function launchApp(udid: string, bundleId: string, env?: Record<string, string>): Promise<void>;
71
+ /**
72
+ * Terminate a running app in the simulator.
73
+ */
74
+ export declare function terminateApp(udid: string, bundleId: string): Promise<void>;
75
+ /**
76
+ * Check if an app is installed in the simulator.
77
+ */
78
+ export declare function isAppInstalled(udid: string, bundleId: string): Promise<boolean>;
79
+ /** Supported permission types for simctl privacy. */
80
+ export type SimulatorPermission = 'all' | 'calendar' | 'contacts-limited' | 'contacts' | 'location' | 'location-always' | 'photos-add' | 'photos' | 'media-library' | 'microphone' | 'motion' | 'reminders' | 'siri';
81
+ /**
82
+ * Grant a permission to an app in the simulator.
83
+ * Uses `xcrun simctl privacy <udid> grant <permission> <bundleId>`.
84
+ */
85
+ export declare function grantPermission(udid: string, bundleId: string, permission: SimulatorPermission): Promise<void>;
86
+ /**
87
+ * Revoke a permission from an app in the simulator.
88
+ */
89
+ export declare function revokePermission(udid: string, bundleId: string, permission: SimulatorPermission): Promise<void>;
90
+ /**
91
+ * Reset all permissions for an app in the simulator.
92
+ */
93
+ export declare function resetPermissions(udid: string, bundleId: string): Promise<void>;
94
+ /**
95
+ * Take a screenshot of the simulator screen using simctl.
96
+ * This is the host-side screenshot (captures the entire simulator screen).
97
+ */
98
+ export declare function screenshotSimulator(udid: string, outputPath: string): Promise<void>;
99
+ /**
100
+ * Get the data directory for an app in the simulator.
101
+ */
102
+ export declare function getAppContainer(udid: string, bundleId: string, container?: 'app' | 'data' | 'groups'): Promise<string>;
103
+ /**
104
+ * Open a URL in the simulator (for deep links).
105
+ */
106
+ export declare function openURL(udid: string, url: string): Promise<void>;
107
+ /**
108
+ * Add media files (photos, videos) to the simulator.
109
+ */
110
+ export declare function addMedia(udid: string, ...paths: string[]): Promise<void>;
111
+ /**
112
+ * Set the simulator status bar overrides (for clean screenshots).
113
+ */
114
+ export declare function setStatusBar(udid: string, overrides: {
115
+ time?: string;
116
+ batteryLevel?: number;
117
+ batteryState?: 'charging' | 'charged' | 'discharging';
118
+ cellularBars?: number;
119
+ wifiBars?: number;
120
+ operatorName?: string;
121
+ }): Promise<void>;
122
+ /**
123
+ * Clear status bar overrides.
124
+ */
125
+ export declare function clearStatusBar(udid: string): Promise<void>;
126
+ /**
127
+ * Check that Xcode CLI tools are installed and simctl is available.
128
+ * Throws with a helpful message if not.
129
+ */
130
+ export declare function checkXcodeTools(): Promise<void>;
131
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../../src/app/ios/controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,OAAO,CAAC;KACtB,CAAC,CAAC;CACJ;AAwBD;;;GAGG;AACH,wBAAsB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAuB9E;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAmClF;AAID;;;GAGG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB/D;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE;AAID;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7E;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAA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