@developerz.ai/ui-debugger-mcp 1.9.0 → 1.11.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 (274) hide show
  1. package/README.md +63 -47
  2. package/dist/adapters/android/abortable.d.ts +6 -0
  3. package/dist/adapters/android/abortable.js +22 -0
  4. package/dist/adapters/android/abortable.js.map +1 -0
  5. package/dist/adapters/android/adb.d.ts +19 -7
  6. package/dist/adapters/android/adb.js +50 -13
  7. package/dist/adapters/android/adb.js.map +1 -1
  8. package/dist/adapters/android/android-adapter.d.ts +20 -12
  9. package/dist/adapters/android/android-adapter.js +113 -165
  10. package/dist/adapters/android/android-adapter.js.map +1 -1
  11. package/dist/adapters/android/commands.d.ts +10 -0
  12. package/dist/adapters/android/commands.js +22 -0
  13. package/dist/adapters/android/commands.js.map +1 -1
  14. package/dist/adapters/android/emulator.d.ts +41 -0
  15. package/dist/adapters/android/emulator.js +115 -0
  16. package/dist/adapters/android/emulator.js.map +1 -0
  17. package/dist/adapters/android/logcat.d.ts +87 -0
  18. package/dist/adapters/android/logcat.js +352 -0
  19. package/dist/adapters/android/logcat.js.map +1 -0
  20. package/dist/adapters/android/ports.js.map +1 -1
  21. package/dist/adapters/android/sdk.d.ts +65 -0
  22. package/dist/adapters/android/sdk.js +107 -0
  23. package/dist/adapters/android/sdk.js.map +1 -0
  24. package/dist/adapters/android/uiautomator.d.ts +23 -7
  25. package/dist/adapters/android/uiautomator.js +31 -7
  26. package/dist/adapters/android/uiautomator.js.map +1 -1
  27. package/dist/adapters/availability.d.ts +39 -0
  28. package/dist/adapters/availability.js +62 -0
  29. package/dist/adapters/availability.js.map +1 -0
  30. package/dist/adapters/browser/browser-adapter.d.ts +11 -22
  31. package/dist/adapters/browser/browser-adapter.js +90 -71
  32. package/dist/adapters/browser/browser-adapter.js.map +1 -1
  33. package/dist/adapters/browser/cdp.d.ts +22 -17
  34. package/dist/adapters/browser/cdp.js +118 -72
  35. package/dist/adapters/browser/cdp.js.map +1 -1
  36. package/dist/adapters/browser/exchange-read.d.ts +39 -0
  37. package/dist/adapters/browser/exchange-read.js +102 -0
  38. package/dist/adapters/browser/exchange-read.js.map +1 -0
  39. package/dist/adapters/browser/extractor.js +9 -2
  40. package/dist/adapters/browser/extractor.js.map +1 -1
  41. package/dist/adapters/browser/filters.d.ts +1 -1
  42. package/dist/adapters/browser/filters.js.map +1 -1
  43. package/dist/adapters/browser/geometry.js.map +1 -1
  44. package/dist/adapters/browser/launch.d.ts +14 -5
  45. package/dist/adapters/browser/launch.js +14 -5
  46. package/dist/adapters/browser/launch.js.map +1 -1
  47. package/dist/adapters/browser/lifecycle.d.ts +91 -0
  48. package/dist/adapters/browser/lifecycle.js +141 -0
  49. package/dist/adapters/browser/lifecycle.js.map +1 -0
  50. package/dist/adapters/browser/locate.d.ts +18 -2
  51. package/dist/adapters/browser/locate.js +48 -3
  52. package/dist/adapters/browser/locate.js.map +1 -1
  53. package/dist/adapters/browser/log-filters.d.ts +2 -2
  54. package/dist/adapters/browser/log-filters.js +15 -4
  55. package/dist/adapters/browser/log-filters.js.map +1 -1
  56. package/dist/adapters/browser/log-format.d.ts +23 -20
  57. package/dist/adapters/browser/log-format.js +133 -56
  58. package/dist/adapters/browser/log-format.js.map +1 -1
  59. package/dist/adapters/browser/tab-context.d.ts +30 -0
  60. package/dist/adapters/browser/tab-context.js +41 -0
  61. package/dist/adapters/browser/tab-context.js.map +1 -0
  62. package/dist/adapters/contract.d.ts +113 -10
  63. package/dist/adapters/contract.js +7 -2
  64. package/dist/adapters/contract.js.map +1 -1
  65. package/dist/adapters/desktop/atspi-busctl.d.ts +26 -0
  66. package/dist/adapters/desktop/atspi-busctl.js +332 -0
  67. package/dist/adapters/desktop/atspi-busctl.js.map +1 -0
  68. package/dist/adapters/desktop/atspi-parse.d.ts +39 -0
  69. package/dist/adapters/desktop/atspi-parse.js +155 -0
  70. package/dist/adapters/desktop/atspi-parse.js.map +1 -0
  71. package/dist/adapters/desktop/atspi.d.ts +81 -50
  72. package/dist/adapters/desktop/atspi.js +64 -285
  73. package/dist/adapters/desktop/atspi.js.map +1 -1
  74. package/dist/adapters/desktop/capture.d.ts +11 -20
  75. package/dist/adapters/desktop/capture.js +68 -37
  76. package/dist/adapters/desktop/capture.js.map +1 -1
  77. package/dist/adapters/desktop/desktop-adapter.d.ts +22 -2
  78. package/dist/adapters/desktop/desktop-adapter.js +202 -86
  79. package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
  80. package/dist/adapters/desktop/input.d.ts +19 -5
  81. package/dist/adapters/desktop/input.js +29 -13
  82. package/dist/adapters/desktop/input.js.map +1 -1
  83. package/dist/adapters/desktop/managed-app.d.ts +43 -0
  84. package/dist/adapters/desktop/managed-app.js +114 -0
  85. package/dist/adapters/desktop/managed-app.js.map +1 -0
  86. package/dist/adapters/desktop/proc.d.ts +34 -4
  87. package/dist/adapters/desktop/proc.js +37 -6
  88. package/dist/adapters/desktop/proc.js.map +1 -1
  89. package/dist/adapters/desktop/wait-poll.d.ts +17 -0
  90. package/dist/adapters/desktop/wait-poll.js +38 -0
  91. package/dist/adapters/desktop/wait-poll.js.map +1 -0
  92. package/dist/adapters/factory.d.ts +13 -6
  93. package/dist/adapters/factory.js +30 -4
  94. package/dist/adapters/factory.js.map +1 -1
  95. package/dist/adapters/log-format.d.ts +38 -0
  96. package/dist/adapters/log-format.js +47 -0
  97. package/dist/adapters/log-format.js.map +1 -0
  98. package/dist/agent/belt/act.d.ts +426 -23
  99. package/dist/agent/belt/act.js +44 -64
  100. package/dist/agent/belt/act.js.map +1 -1
  101. package/dist/agent/belt/look.d.ts +479 -16
  102. package/dist/agent/belt/look.js +94 -16
  103. package/dist/agent/belt/look.js.map +1 -1
  104. package/dist/agent/belt/observe.d.ts +652 -65
  105. package/dist/agent/belt/observe.js +119 -231
  106. package/dist/agent/belt/observe.js.map +1 -1
  107. package/dist/agent/belt/redact-output.d.ts +20 -0
  108. package/dist/agent/belt/redact-output.js +70 -0
  109. package/dist/agent/belt/redact-output.js.map +1 -0
  110. package/dist/agent/belt/report.d.ts +754 -48
  111. package/dist/agent/belt/report.js +121 -38
  112. package/dist/agent/belt/report.js.map +1 -1
  113. package/dist/agent/belt/same-origin.d.ts +21 -0
  114. package/dist/agent/belt/same-origin.js +38 -0
  115. package/dist/agent/belt/same-origin.js.map +1 -0
  116. package/dist/agent/belt/target-refs.d.ts +39 -0
  117. package/dist/agent/belt/target-refs.js +60 -0
  118. package/dist/agent/belt/target-refs.js.map +1 -0
  119. package/dist/agent/belt/trail.d.ts +44 -16
  120. package/dist/agent/belt/trail.js +46 -11
  121. package/dist/agent/belt/trail.js.map +1 -1
  122. package/dist/agent/belt/tree-targets.d.ts +79 -0
  123. package/dist/agent/belt/tree-targets.js +242 -0
  124. package/dist/agent/belt/tree-targets.js.map +1 -0
  125. package/dist/agent/capabilities.js.map +1 -1
  126. package/dist/agent/fallback.d.ts +33 -0
  127. package/dist/agent/fallback.js +84 -0
  128. package/dist/agent/fallback.js.map +1 -0
  129. package/dist/agent/loop-frames.d.ts +26 -0
  130. package/dist/agent/loop-frames.js +106 -0
  131. package/dist/agent/loop-frames.js.map +1 -0
  132. package/dist/agent/loop.d.ts +56 -65
  133. package/dist/agent/loop.js +122 -189
  134. package/dist/agent/loop.js.map +1 -1
  135. package/dist/agent/models.d.ts +10 -6
  136. package/dist/agent/models.js +15 -9
  137. package/dist/agent/models.js.map +1 -1
  138. package/dist/agent/prompts/compose.d.ts +1 -1
  139. package/dist/agent/prompts/debug-agent.js +48 -10
  140. package/dist/agent/prompts/debug-agent.js.map +1 -1
  141. package/dist/agent/prompts/web-addendum.d.ts +2 -2
  142. package/dist/agent/prompts/web-addendum.js +26 -25
  143. package/dist/agent/prompts/web-addendum.js.map +1 -1
  144. package/dist/agent/provider.d.ts +41 -1
  145. package/dist/agent/provider.js +59 -5
  146. package/dist/agent/provider.js.map +1 -1
  147. package/dist/boot.d.ts +64 -0
  148. package/dist/boot.js +147 -0
  149. package/dist/boot.js.map +1 -0
  150. package/dist/cli/chromium-libs.d.ts +267 -0
  151. package/dist/cli/chromium-libs.js +546 -0
  152. package/dist/cli/chromium-libs.js.map +1 -0
  153. package/dist/cli/control.js +79 -12
  154. package/dist/cli/control.js.map +1 -1
  155. package/dist/cli/init.d.ts +52 -3
  156. package/dist/cli/init.js +62 -10
  157. package/dist/cli/init.js.map +1 -1
  158. package/dist/config/load.d.ts +25 -8
  159. package/dist/config/load.js +50 -13
  160. package/dist/config/load.js.map +1 -1
  161. package/dist/config/schema.d.ts +18 -6
  162. package/dist/config/schema.js +34 -17
  163. package/dist/config/schema.js.map +1 -1
  164. package/dist/errors.d.ts +30 -15
  165. package/dist/errors.js +49 -30
  166. package/dist/errors.js.map +1 -1
  167. package/dist/findings/schema.d.ts +44 -6
  168. package/dist/findings/schema.js +39 -3
  169. package/dist/findings/schema.js.map +1 -1
  170. package/dist/index.d.ts +1 -1
  171. package/dist/index.js +1 -1
  172. package/dist/index.js.map +1 -1
  173. package/dist/main.js +4 -82
  174. package/dist/main.js.map +1 -1
  175. package/dist/mcp/server.js +10 -1
  176. package/dist/mcp/server.js.map +1 -1
  177. package/dist/mcp/tools/describe.d.ts +5 -4
  178. package/dist/mcp/tools/describe.js +14 -10
  179. package/dist/mcp/tools/describe.js.map +1 -1
  180. package/dist/mcp/tools/end-session.d.ts +3 -1
  181. package/dist/mcp/tools/end-session.js +8 -3
  182. package/dist/mcp/tools/end-session.js.map +1 -1
  183. package/dist/mcp/tools/output.d.ts +12 -4
  184. package/dist/mcp/tools/output.js +15 -2
  185. package/dist/mcp/tools/output.js.map +1 -1
  186. package/dist/mcp/tools/result.d.ts +10 -1
  187. package/dist/mcp/tools/result.js +12 -7
  188. package/dist/mcp/tools/result.js.map +1 -1
  189. package/dist/mcp/tools/start-debug.js +7 -5
  190. package/dist/mcp/tools/start-debug.js.map +1 -1
  191. package/dist/redact.d.ts +44 -0
  192. package/dist/redact.js +166 -0
  193. package/dist/redact.js.map +1 -0
  194. package/dist/services/auth-persona.d.ts +19 -0
  195. package/dist/services/auth-persona.js +32 -0
  196. package/dist/services/auth-persona.js.map +1 -0
  197. package/dist/services/catalog.d.ts +28 -0
  198. package/dist/services/catalog.js +65 -0
  199. package/dist/services/catalog.js.map +1 -0
  200. package/dist/services/debug-api.d.ts +179 -0
  201. package/dist/services/debug-api.js +9 -0
  202. package/dist/services/debug-api.js.map +1 -0
  203. package/dist/services/debug-service.d.ts +26 -174
  204. package/dist/services/debug-service.js +159 -227
  205. package/dist/services/debug-service.js.map +1 -1
  206. package/dist/services/foreign-findings.d.ts +22 -0
  207. package/dist/services/foreign-findings.js +38 -0
  208. package/dist/services/foreign-findings.js.map +1 -0
  209. package/dist/services/login-failure.d.ts +10 -0
  210. package/dist/services/login-failure.js +24 -0
  211. package/dist/services/login-failure.js.map +1 -0
  212. package/dist/services/login-selectors.d.ts +18 -0
  213. package/dist/services/login-selectors.js +44 -0
  214. package/dist/services/login-selectors.js.map +1 -0
  215. package/dist/services/login-session.d.ts +25 -0
  216. package/dist/services/login-session.js +59 -0
  217. package/dist/services/login-session.js.map +1 -0
  218. package/dist/services/login.d.ts +16 -29
  219. package/dist/services/login.js +269 -97
  220. package/dist/services/login.js.map +1 -1
  221. package/dist/services/replay.js +15 -3
  222. package/dist/services/replay.js.map +1 -1
  223. package/dist/services/retained-snapshot.d.ts +36 -0
  224. package/dist/services/retained-snapshot.js +63 -0
  225. package/dist/services/retained-snapshot.js.map +1 -0
  226. package/dist/services/session-builder.d.ts +26 -0
  227. package/dist/services/session-builder.js +63 -21
  228. package/dist/services/session-builder.js.map +1 -1
  229. package/dist/services/shutdown.d.ts +8 -4
  230. package/dist/services/shutdown.js +21 -8
  231. package/dist/services/shutdown.js.map +1 -1
  232. package/dist/services/start-guards.d.ts +37 -0
  233. package/dist/services/start-guards.js +61 -0
  234. package/dist/services/start-guards.js.map +1 -0
  235. package/dist/services/summarize.d.ts +12 -3
  236. package/dist/services/summarize.js +13 -5
  237. package/dist/services/summarize.js.map +1 -1
  238. package/dist/session/cleanup.d.ts +3 -2
  239. package/dist/session/cleanup.js +6 -2
  240. package/dist/session/cleanup.js.map +1 -1
  241. package/dist/session/finalize.d.ts +45 -0
  242. package/dist/session/finalize.js +150 -0
  243. package/dist/session/finalize.js.map +1 -0
  244. package/dist/session/findings-store.d.ts +2 -1
  245. package/dist/session/findings-store.js +30 -2
  246. package/dist/session/findings-store.js.map +1 -1
  247. package/dist/session/flock-backend.d.ts +117 -0
  248. package/dist/session/flock-backend.js +293 -0
  249. package/dist/session/flock-backend.js.map +1 -0
  250. package/dist/session/live-pointer.d.ts +19 -0
  251. package/dist/session/live-pointer.js +41 -0
  252. package/dist/session/live-pointer.js.map +1 -0
  253. package/dist/session/manager.d.ts +11 -1
  254. package/dist/session/manager.js +46 -2
  255. package/dist/session/manager.js.map +1 -1
  256. package/dist/session/owner-lock.d.ts +117 -0
  257. package/dist/session/owner-lock.js +218 -0
  258. package/dist/session/owner-lock.js.map +1 -0
  259. package/dist/session/process-identity.js.map +1 -1
  260. package/dist/session/session.js +40 -109
  261. package/dist/session/session.js.map +1 -1
  262. package/dist/session/state-file.d.ts +74 -14
  263. package/dist/session/state-file.js +211 -21
  264. package/dist/session/state-file.js.map +1 -1
  265. package/dist/session/workspace.d.ts +32 -2
  266. package/dist/session/workspace.js +65 -4
  267. package/dist/session/workspace.js.map +1 -1
  268. package/package.json +11 -11
  269. package/dist/adapters/android/android-adapter.test-helpers.d.ts +0 -52
  270. package/dist/adapters/android/android-adapter.test-helpers.js +0 -115
  271. package/dist/adapters/android/android-adapter.test-helpers.js.map +0 -1
  272. package/dist/mcp/server.test-helpers.d.ts +0 -23
  273. package/dist/mcp/server.test-helpers.js +0 -49
  274. package/dist/mcp/server.test-helpers.js.map +0 -1
package/README.md CHANGED
@@ -15,7 +15,7 @@ the main bottleneck when an entire product is built by AI.
15
15
  Eliminate the human from the UI-debug loop with an MCP server.
16
16
 
17
17
  - A **smart agent** (Claude Code, Cursor, …) finishes a PR and wants to verify the UI.
18
- - It hands a **story** to this server: *"on web, log in and do X, Y, Z — tell me if it breaks."*
18
+ - It hands a **story** to this server: _"on web, log in and do X, Y, Z — tell me if it breaks."_
19
19
  - A **small fast agent runs inside this server** (via the Vercel AI SDK). It drives
20
20
  the browser or desktop, watches console + network, takes screenshots.
21
21
  - It reports **structured findings** back: pass/fail, what broke, evidence.
@@ -27,12 +27,12 @@ high-level and delegates the whole clicking loop to the small agent.
27
27
 
28
28
  ## How it's different from playwright-mcp
29
29
 
30
- | | playwright-mcp | UI Debugger MCP |
31
- |---|---|---|
32
- | Who clicks | smart model, one action per call | small agent, on its own |
33
- | Tools exposed | many (click, type, snapshot…) | few (give a story, get findings) |
34
- | Smart model cost | high (chatty) | low (high-level) |
35
- | Output | raw page state | structured findings + evidence |
30
+ | | playwright-mcp | UI Debugger MCP |
31
+ | ---------------- | -------------------------------- | -------------------------------- |
32
+ | Who clicks | smart model, one action per call | small agent, on its own |
33
+ | Tools exposed | many (click, type, snapshot…) | few (give a story, get findings) |
34
+ | Smart model cost | high (chatty) | low (high-level) |
35
+ | Output | raw page state | structured findings + evidence |
36
36
 
37
37
  ## Architecture — the three actors
38
38
 
@@ -45,7 +45,7 @@ Picture a **boss**, a **fast blind driver**, and a **describer with eyes**:
45
45
  │ │ ◀─────── get_findings │ ┌────────────┐ ┌────────────┐ │
46
46
  │ sets goals │ │ │ fast guy │ look│ vision guy │ │
47
47
  │ fixes code │ │ │ (driver) │────▶│ (eyes) │ │
48
- │ loops │ │ │ deepseek │◀────│ glm 5v │ │
48
+ │ loops │ │ │ particle │◀────│ nemotron │ │
49
49
  └─────────────┘ │ │ text·blind │ desc│ image │ │
50
50
  ▲ │ └─────┬──────┘ └────────────┘ │
51
51
  │ "works + looks nice" │ observe / act (SQL-like) │
@@ -62,12 +62,12 @@ Picture a **boss**, a **fast blind driver**, and a **describer with eyes**:
62
62
  - **smart agent** — the boss (Claude/caller). Sends a goal, reads findings, **fixes
63
63
  the code**, loops. Stays high-level — never clicks.
64
64
  - **fast guy** — the driver. Fast, cheap, **text-only and blind**. Runs the
65
- click loop on structure (DOM / a11y tree / view hierarchy). Default: deepseek.
65
+ click loop on structure (DOM / a11y tree / view hierarchy). Default: particle-ai.
66
66
  - **vision guy** — the eyes. **Multimodal**. The driver calls `look` to ask
67
- *"does this look right? is the button centred?"* and gets a description back.
68
- Default: glm. Spent only when visual judgment is needed.
67
+ _"does this look right? is the button centred?"_ and gets a description back.
68
+ Default: nvidia. Spent only when visual judgment is needed.
69
69
 
70
- One goal: **the UI works *and* looks nice.** Full design in [`docs/idea/`](docs/idea/).
70
+ One goal: **the UI works _and_ looks nice.** Full design in [`docs/idea/`](docs/idea/).
71
71
 
72
72
  Every run keeps its screenshots and stitches them into a short **captioned
73
73
  replay video** — Claude attaches it to the PR so a reviewer sees the flow working
@@ -77,11 +77,18 @@ in ~10 seconds ([`docs/idea/workspace.md`](docs/idea/workspace.md#pr-replay-vide
77
77
 
78
78
  One project can expose several debug targets. A large app can have all three:
79
79
 
80
- | Target | Protocol / how it's driven | Reads |
81
- |---------|--------------------------------------------------|-------|
82
- | web | **CDP** (Chrome DevTools Protocol), headless by default | DOM |
83
- | desktop | **X11 / Wayland** input + AT-SPI | a11y tree / vision |
84
- | mobile | **ADB** (uiautomator + screencap), Android, headless by default | view hierarchy / vision |
80
+ | Target | Protocol / how it's driven | Reads |
81
+ | ------- | --------------------------------------------------------------- | -------------- |
82
+ | web | **CDP** (Chrome DevTools Protocol), headless by default | DOM |
83
+ | desktop | **X11 / Wayland** input + AT-SPI | a11y tree |
84
+ | mobile | **ADB** (uiautomator + screencap), Android, headless by default | view hierarchy |
85
+
86
+ The desktop and android adapters read **structure only** — there is
87
+ no automatic vision/OCR fallback: the adapter never switches to pixels. A
88
+ custom-drawn surface (canvas, game, custom widget) exposes no nodes, so it is
89
+ unreachable there; Chromium/Electron need `--force-renderer-accessibility`. The
90
+ only vision is the agent-level `look` the driver calls when it needs a visual
91
+ judgment.
85
92
 
86
93
  Three adapters, one shared contract. Each runs **managed** (server launches the
87
94
  target) or **attach** (connect to a running one via `cdpUrl` / `adbSerial`).
@@ -139,7 +146,7 @@ npx @developerz.ai/ui-debugger-mcp@latest init # in your project root
139
146
  [`docs/idea/config.md`](docs/idea/config.md)):
140
147
 
141
148
  - creates the workspace dir `./tmp/ui-debugger-mcp/`
142
- - writes a starter config (default deepseek/glm models, a `web` target stub) if
149
+ - writes a starter config (default free models, a `web` target stub) if
143
150
  one doesn't already exist — at `.dz/ui-debugger/ui-debugger-mcp.json` when the
144
151
  repo already has a `.dz/` dir, else at the root `.ui-debugger-mcp.json`
145
152
  - adds `tmp/` to `.gitignore`
@@ -208,16 +215,16 @@ get_findings { session_id: "...", wait: 30000 }
208
215
 
209
216
  It's a **conversation**, not a remote control — five fat tools, not one-per-click:
210
217
 
211
- | Tool | What it does |
212
- |------|--------------|
213
- | `start_debug` | Open a run: `{ target, goal, url?, as?, replace?, criteria?, timeout? }`. `url` is required when the target has no configured url; `as` names a login persona; `replace: true` takes over a project that already has a run. The small agent drives autonomously. Returns `{ session_id }`. |
214
- | `get_findings` | Poll status + structured findings (functional bugs + visual issues) + evidence. Long-poll with `wait`. A whole-object read caps each list at 20 and says so in `truncated` (`{returned, total}` per field) — pass `fields` for the full lists. |
215
- | `send_message` | Talk to the running agent mid-flight — add work, redirect, or answer a question. |
216
- | `describe` | List the configured targets + models for this project — including each target's auth `personas[]` and `notes` — plus `session`: the run this project currently holds. |
217
- | `end_session` | Close the run, free the browser/profile. |
218
+ | Tool | What it does |
219
+ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
220
+ | `start_debug` | Open a run: `{ target, goal, url?, as?, replace?, criteria?, timeout? }`. `url` is required when the target has no configured url; `as` names a login persona; `replace: true` takes over a project with a run already open. The small agent drives autonomously. Returns the session id. |
221
+ | `get_findings` | Poll status + structured findings (functional bugs + visual issues) + evidence. Long-poll with `wait` (ms, max 120000). A whole-object read caps each list at 20 and says so in `truncated` (`{returned, total}` per field) — pass `fields` for the full lists. |
222
+ | `send_message` | Talk to the running agent mid-flight — add work, redirect, or answer a question. |
223
+ | `describe` | List the configured targets + models for this project — including each target's auth `personas[]` and `notes` — plus `session`: the run this project currently holds. `target` narrows to one entry; an unknown name fails loud. |
224
+ | `end_session` | Close the run, free the browser/profile. |
218
225
 
219
226
  A run is **always time-capped**: `start_debug`'s `timeout` (seconds) overrides the
220
- default 300s, so a session can never hang forever — it auto-ends and frees the
227
+ default 300s (max 2147483s), so a session can never hang forever — it auto-ends and frees the
221
228
  profile lock when the cap fires.
222
229
 
223
230
  ### Logging in — named personas
@@ -245,7 +252,7 @@ start_debug { target: "dashboard", as: "admin", goal: "open Audit and check the
245
252
 
246
253
  The run signs in **out-of-band**, before the driver's first step: it costs zero
247
254
  driver steps, and the credentials never enter the model's context — the prompt
248
- only learns *"you are already signed in as `admin`"*. Values are redacted out of
255
+ only learns _"you are already signed in as `admin`"_. Values are redacted out of
249
256
  every log the run writes; `describe` reports persona **names** only. A typo'd `as`
250
257
  fails loud listing the valid names, and a login that does not take fails the run
251
258
  rather than handing back a session that will report every page behind it as empty.
@@ -255,7 +262,7 @@ Use dev/seed credentials — this file is committed. Details in
255
262
  ### Telling it what's expected — `notes`
256
263
 
257
264
  A freshly-migrated app with no seed data renders empty states everywhere, and the
258
- driver reports *"the table is empty"* as the run's headline bug. It is right, and
265
+ driver reports _"the table is empty"_ as the run's headline bug. It is right, and
259
266
  it is useless. Say what's expected once, in the target:
260
267
 
261
268
  ```jsonc
@@ -270,8 +277,11 @@ it is useless. Say what's expected once, in the target:
270
277
 
271
278
  One fact per line, on any target (web, desktop, android). Unlike the per-run
272
279
  `goal`, `notes` is config: it is composed into the driver's prompt once, as its
273
- own *"Known about this app"* section — treat these as expected, never report one
280
+ own _"Known about this app"_ section — treat these as expected, never report one
274
281
  as a defect, and a screen that **contradicts** one is still worth reporting.
282
+ The same preconditions also reach the separate vision model that judges
283
+ screenshots, so a configured expected empty state stops being filed as a visual
284
+ defect — and a screen that contradicts one is still worth reporting.
275
285
  Capped at 1000 characters, enforced when the config loads (the prompt carrying it
276
286
  is resent to the model on every step, so an essay here is paid for per step).
277
287
 
@@ -289,8 +299,8 @@ Every tool result carries **both** a pretty-printed text block and a typed
289
299
  `structuredContent` payload validated against a declared `outputSchema` — parse
290
300
  the structured half, don't scrape the text. Tools also declare MCP annotations
291
301
  (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) so clients
292
- can render/gate them correctly, and evidence paths (screenshots, `replay.mp4`,
293
- logs) ride as `resource_link` content items, not inline strings. Full shapes in
302
+ can render/gate them correctly, and evidence paths (screenshots, `replay.mp4`)
303
+ ride as `resource_link` content items, not inline strings. Full shapes in
294
304
  [`docs/reference.md`](docs/reference.md).
295
305
 
296
306
  Typical loop from a smart agent:
@@ -309,14 +319,14 @@ allowed tools, output formats).
309
319
 
310
320
  You get findings, but the agent's evidence is what makes them actionable:
311
321
 
312
- | | |
313
- |---|---|
314
- | **HTTP** | Whole exchanges — method, url, status, `durationMs`, and for `fetch`/`xhr` the request **and response bodies** plus headers. A `4xx` carries the server's own reason (`{"error":"password too short"}`), not just a status. Credential header values are redacted to `<redacted, N chars>`: presence stays diagnostic, the secret never reaches the model, the logs, or your transcript. |
315
- | **DOM** | Roles, names, bounds, live `value`/`checked` on form controls, `data-testid`, and WCAG contrast per text node — so "is the box ticked?" and "is this text readable?" are answered structurally, without spending vision. |
316
- | **iframes** | Embedded documents are read too. Nodes carry `frame`, and their bounds are page coordinates, so clicking works the same as anywhere else. |
317
- | **Tabs** | A `target="_blank"` click is noticed and followable, instead of reading as "nothing happened". |
318
- | **Console** | Errors and uncaught exceptions, with source locations. |
319
- | **Frames** | An ordered screenshot per action, stitched into `replay.mp4`. |
322
+ | | |
323
+ | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
324
+ | **HTTP** | Whole exchanges — method, url, status, `durationMs`, and for `fetch`/`xhr` the request **and response bodies** plus headers. A `4xx` carries the server's own reason (`{"error":"password too short"}`), not just a status. Credential header values are redacted to `<redacted, N chars>`: presence stays diagnostic, the secret never reaches the model, the logs, or your transcript. |
325
+ | **DOM** | Roles, names, bounds, live `value`/`checked` on form controls, `data-testid`, and WCAG contrast per text node — so "is the box ticked?" and "is this text readable?" are answered structurally, without spending vision. |
326
+ | **iframes** | Embedded documents are read too. Nodes carry `frame`, and their bounds are page coordinates, so clicking works the same as anywhere else. |
327
+ | **Tabs** | A `target="_blank"` click is noticed and followable, instead of reading as "nothing happened". |
328
+ | **Console** | Errors and uncaught exceptions, with source locations. |
329
+ | **Frames** | An ordered screenshot per action, stitched into `replay.mp4`. |
320
330
 
321
331
  Static assets are held back from a default network read — on a Vite dev server
322
332
  they outnumber real API calls ~15:1 — with a count of what was hidden and the
@@ -335,14 +345,16 @@ ui-debugger-mcp stop # gracefully end the run (frees the browser + profile)
335
345
  ## Troubleshooting
336
346
 
337
347
  **Chrome not found**
338
- The web adapter launches Chrome via the system PATH. Install Chrome/Chromium, or
339
- set `executablePath` in the project config (`.dz/…` or root):
348
+ The web adapter uses `executablePath`, else the Playwright-managed Chromium
349
+ (`bin/setup` installs it), else system Google Chrome. Install one, or set `executablePath` in the project config (`.dz/…` or root):
350
+
340
351
  ```jsonc
341
352
  "web": { "adapter": "browser", "url": "...", "executablePath": "/usr/bin/chromium-browser" }
342
353
  ```
343
354
 
344
355
  **Session locked — "another run is active"**
345
356
  One Chrome profile = one run. If a previous run crashed without cleaning up:
357
+
346
358
  ```bash
347
359
  npx @developerz.ai/ui-debugger-mcp@latest stop # graceful teardown
348
360
  ```
@@ -350,6 +362,7 @@ Or delete `./tmp/ui-debugger-mcp/<project>/state.json` and restart the MCP serve
350
362
 
351
363
  **Run times out with no findings**
352
364
  Default cap is 300 s. Raise it per-call:
365
+
353
366
  ```text
354
367
  start_debug { target: "web", goal: "...", timeout: 600 }
355
368
  ```
@@ -359,6 +372,7 @@ pattern.
359
372
 
360
373
  **`get_findings` returns empty `bugs[]` / `visual[]`**
361
374
  The run may still be in progress — use `wait` (ms) to long-poll:
375
+
362
376
  ```text
363
377
  get_findings { session_id: "...", wait: 30000 }
364
378
  ```
@@ -370,7 +384,7 @@ rest, so evidence from a run six ago is gone by design.
370
384
  **Run fails instantly: "… is not a valid model ID"**
371
385
  The model string in the project config is not a catalog id. OpenRouter takes
372
386
  `provider/model` with optional `:floor` / `:nitro` routing suffixes — a `#…`
373
- suffix is rejected outright. Use plain ids (`deepseek/deepseek-v4-flash`).
387
+ suffix is rejected outright. Use catalog ids (`particle-ai/particle-1:free`).
374
388
 
375
389
  **Still running an old version after upgrading**
376
390
  `npx -y <pkg>` REUSES a cached install when one exists, so a bare
@@ -413,7 +427,9 @@ still land without it.
413
427
  - **Bun** + **TypeScript** (ships as npm, runs via `npx`/`bunx`)
414
428
  - **Vercel AI SDK** — the agent loop (fast driver + vision describer)
415
429
  - **Any OpenAI-compatible router** (OpenRouter default) — swap models per role.
416
- Defaults: **deepseek** (text) drives, **glm** (image) sees.
430
+ Defaults (all free): `particle-ai/particle-1:free` drives, `nvidia/nemotron-3.5-super-vl:free` sees,
431
+ `baidu/ernie-5.5-flash-preview:free` summarises; `deepseek/deepseek-v4.1-flash:floor` is the paid fallback
432
+ behind every role when a free model is rate-limited or down.
417
433
  - **CDP** for web, **X11/Wayland** for desktop, **ADB** for Android
418
434
  - stdio MCP transport
419
435
 
@@ -421,11 +437,11 @@ still land without it.
421
437
 
422
438
  All three adapters ship in v1:
423
439
 
424
- | Target | State |
425
- |---------|-------|
426
- | web | ✅ shipped (CDP, headless + attach) |
440
+ | Target | State |
441
+ | ------- | ------------------------------------------ |
442
+ | web | ✅ shipped (CDP, headless + attach) |
427
443
  | desktop | ✅ shipped (X11/Wayland, AT-SPI + xdotool) |
428
- | android | ✅ shipped (ADB, uiautomator) |
444
+ | android | ✅ shipped (ADB, uiautomator) |
429
445
 
430
446
  Replay video (`replay.mp4`, captioned stills → mp4 via ffmpeg) ships with the web adapter.
431
447
  ffmpeg is optional — absent gracefully, findings still land.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Make a wait abortable — raced against an `AbortSignal`, rejecting with an
3
+ * `AbortError`-named {@link DOMException} (the contract's `WaitOptions.signal` shape).
4
+ * The listener is removed on every path.
5
+ */
6
+ export declare function abortable<T>(signal: AbortSignal | undefined, message: string, work: () => Promise<T>): Promise<T>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Make a wait abortable — raced against an `AbortSignal`, rejecting with an
3
+ * `AbortError`-named {@link DOMException} (the contract's `WaitOptions.signal` shape).
4
+ * The listener is removed on every path.
5
+ */
6
+ export async function abortable(signal, message, work) {
7
+ if (signal?.aborted)
8
+ throw new DOMException(message, 'AbortError');
9
+ let onAbort;
10
+ const aborted = new Promise((_, reject) => {
11
+ onAbort = () => reject(new DOMException(message, 'AbortError'));
12
+ signal?.addEventListener('abort', onAbort, { once: true });
13
+ });
14
+ try {
15
+ return await Promise.race([work(), aborted]);
16
+ }
17
+ finally {
18
+ if (onAbort)
19
+ signal?.removeEventListener('abort', onAbort);
20
+ }
21
+ }
22
+ //# sourceMappingURL=abortable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abortable.js","sourceRoot":"","sources":["../../../src/adapters/android/abortable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAA+B,EAC/B,OAAe,EACf,IAAsB;IAEtB,IAAI,MAAM,EAAE,OAAO;QAAE,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACnE,IAAI,OAAiC,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QAC/C,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;QAChE,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IACH,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC;YAAS,CAAC;QACT,IAAI,OAAO;YAAE,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
@@ -20,6 +20,12 @@
20
20
  * the emulator a managed run started (never the ambiguous `-e`). Fails loud — a non-zero
21
21
  * exit, a timeout or a missing binary rejects as an {@link AdbError}, never a silent
22
22
  * fallback; {@link pendingStateOrThrow} is the one narrow exception a boot poll may retry.
23
+ *
24
+ * **Deadlines.** Every call may carry an absolute deadline (epoch ms) — the wall-clock
25
+ * instant the enclosing budget runs out. It bounds the subprocess itself (the per-call
26
+ * cap becomes the time left until the deadline, never more) AND the result: a call that
27
+ * *resolves* after the deadline is a failure, not a late success. Without that second
28
+ * check a slow `adb` would report success minutes past the caller's deadline.
23
29
  */
24
30
  /**
25
31
  * Triage a `get-state` rejection during a boot poll: return `''` (poll again) only when
@@ -45,14 +51,20 @@ export interface AdbCliOptions {
45
51
  /** Subprocess runner (default {@link execFileBytes}). */
46
52
  exec?: AdbExec;
47
53
  }
48
- /** The ADB transport the adapter depends on — implemented by {@link AdbCli}, faked in tests. */
54
+ /**
55
+ * The ADB transport the adapter depends on — implemented by {@link AdbCli}, faked in tests.
56
+ *
57
+ * `deadline` is an ABSOLUTE wall-clock instant (epoch ms) the call must not outlive —
58
+ * the same shape as `AtspiReadOptions.deadline`. Omit it for the transport's own
59
+ * per-call cap.
60
+ */
49
61
  export interface Adb {
50
62
  /** `adb <target> shell <command…>` → stdout text. */
51
- shell(command: string[]): Promise<string>;
63
+ shell(command: string[], deadline?: number): Promise<string>;
52
64
  /** `adb <target> exec-out <command…>` → raw stdout bytes (binary-safe, e.g. `screencap -p`). */
53
- execOut(command: string[]): Promise<Uint8Array>;
65
+ execOut(command: string[], deadline?: number): Promise<Uint8Array>;
54
66
  /** `adb <target> <args…>` → stdout text (top-level: `wait-for-device`, `emu kill`, …). */
55
- adb(args: string[]): Promise<string>;
67
+ adb(args: string[], deadline?: number): Promise<string>;
56
68
  }
57
69
  /**
58
70
  * `execFile`-backed {@link Adb}. Construct with the device-selection `flags`
@@ -61,7 +73,7 @@ export interface Adb {
61
73
  export declare class AdbCli implements Adb {
62
74
  #private;
63
75
  constructor(flags: string[], options?: AdbCliOptions);
64
- shell(command: string[]): Promise<string>;
65
- adb(args: string[]): Promise<string>;
66
- execOut(command: string[]): Promise<Uint8Array>;
76
+ shell(command: string[], deadline?: number): Promise<string>;
77
+ adb(args: string[], deadline?: number): Promise<string>;
78
+ execOut(command: string[], deadline?: number): Promise<Uint8Array>;
67
79
  }
@@ -20,10 +20,17 @@
20
20
  * the emulator a managed run started (never the ambiguous `-e`). Fails loud — a non-zero
21
21
  * exit, a timeout or a missing binary rejects as an {@link AdbError}, never a silent
22
22
  * fallback; {@link pendingStateOrThrow} is the one narrow exception a boot poll may retry.
23
+ *
24
+ * **Deadlines.** Every call may carry an absolute deadline (epoch ms) — the wall-clock
25
+ * instant the enclosing budget runs out. It bounds the subprocess itself (the per-call
26
+ * cap becomes the time left until the deadline, never more) AND the result: a call that
27
+ * *resolves* after the deadline is a failure, not a late success. Without that second
28
+ * check a slow `adb` would report success minutes past the caller's deadline.
23
29
  */
24
30
  import { execFile } from 'node:child_process';
25
31
  import { promisify } from 'node:util';
26
32
  import { AdbError } from '../../errors.js';
33
+ import { capWait } from '../budget.js';
27
34
  const pExecFile = promisify(execFile);
28
35
  const ADB = 'adb';
29
36
  /** 64 MiB stdout cap — `screencap -p` PNGs run a few MB on hi-dpi panels; text replies are tiny. */
@@ -87,39 +94,69 @@ export class AdbCli {
87
94
  this.#bin = options.bin ?? ADB;
88
95
  this.#exec = options.exec ?? execFileBytes;
89
96
  }
90
- shell(command) {
91
- return this.#text(['shell', ...command]);
97
+ shell(command, deadline) {
98
+ return this.#text(['shell', ...command], deadline);
92
99
  }
93
- adb(args) {
94
- return this.#text(args);
100
+ adb(args, deadline) {
101
+ return this.#text(args, deadline);
95
102
  }
96
- execOut(command) {
97
- return this.#bytes(['exec-out', ...command]);
103
+ execOut(command, deadline) {
104
+ return this.#bytes(['exec-out', ...command], deadline);
98
105
  }
99
106
  /** UTF-8 view of the byte read — `adb`'s text channels (`am`, `getprop`, `logcat`) are UTF-8. */
100
- async #text(args) {
101
- return DECODER.decode(await this.#bytes(args));
107
+ async #text(args, deadline) {
108
+ return DECODER.decode(await this.#bytes(args, deadline));
102
109
  }
103
- async #bytes(args) {
110
+ async #bytes(args, deadline) {
111
+ const timeoutMs = this.#timeoutFor(deadline);
112
+ let bytes;
104
113
  try {
105
- return await this.#exec(this.#bin, [...this.#flags, ...args], this.#timeoutMs);
114
+ bytes = await this.#exec(this.#bin, [...this.#flags, ...args], timeoutMs);
106
115
  }
107
116
  catch (error) {
108
- throw this.#wrap(args, error);
117
+ throw this.#wrap(args, error, timeoutMs);
118
+ }
119
+ // The subprocess cap bounds the CHILD, not the answer: a child that exits just
120
+ // after the deadline still resolves here. Reporting that as success would let a
121
+ // wedged adb answer minutes past the caller's budget — reject instead. Keep this
122
+ // outside the subprocess catch: a late answer is not a subprocess failure and
123
+ // must not be re-wrapped as one.
124
+ this.#assertBeforeDeadline(args, deadline);
125
+ return bytes;
126
+ }
127
+ /**
128
+ * The effective per-call cap: the transport's own default, shortened to the time
129
+ * left until `deadline` when one is given. `capWait` floors a spent budget at 1ms
130
+ * (never 0 — a 0ms timeout would mean "no timeout" to some runners) and rejects a
131
+ * non-finite/negative budget, so the clamp stays in one place.
132
+ */
133
+ #timeoutFor(deadline) {
134
+ if (deadline === undefined)
135
+ return this.#timeoutMs;
136
+ return capWait(this.#timeoutMs, Math.max(0, deadline - Date.now()));
137
+ }
138
+ /** Fail loud when a call resolved after its deadline — a late answer is not an answer. */
139
+ #assertBeforeDeadline(args, deadline) {
140
+ if (deadline === undefined)
141
+ return;
142
+ const now = Date.now();
143
+ if (now > deadline) {
144
+ throw new AdbError(`adb ${args[0] ?? ''} resolved ${now - deadline}ms after its deadline ` +
145
+ `(deadline ${deadline}ms — the enclosing budget had already run out)`);
109
146
  }
110
147
  }
111
148
  /**
112
149
  * Wrap any subprocess failure as a loud {@link AdbError}: ENOENT → a clear install
113
150
  * hint, expiry (the child was killed by our `timeout`) → a wedge report naming the cap.
114
151
  */
115
- #wrap(args, error) {
152
+ #wrap(args, error, timeoutMs) {
116
153
  if (error instanceof Error && error.code === 'ENOENT') {
117
154
  return new AdbError('android: `adb` not found on PATH (install Android platform-tools)');
118
155
  }
119
156
  if (error instanceof Error &&
120
157
  error.killed === true &&
121
158
  error.code !== 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER') {
122
- return new AdbError(`adb ${args[0] ?? ''} timed out after ${this.#timeoutMs}ms (${KILL_SIGNAL}ed — adb or the emulator is wedged)`);
159
+ return new AdbError(`adb ${args[0] ?? ''} timed out after ${timeoutMs}ms (${KILL_SIGNAL}ed — adb or the emulator is wedged)`);
123
160
  }
124
161
  const message = error instanceof Error ? error.message : String(error);
125
162
  return new AdbError(`adb ${args[0] ?? ''} failed: ${message}`);
@@ -1 +1 @@
1
- {"version":3,"file":"adb.js","sourceRoot":"","sources":["../../../src/adapters/android/adb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEtC,MAA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I,GAAG,GAAG,QAAQ,EAAE,CAAC;YACnB,MAAM,IAAI,QAAQ,CAChB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,aAAa,GAAG,GAAG,QAAQ,wBAAwB;gBACrE,aAAa,QAAQ,gDAAgD,CACxE,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAc,EAAE,KAAc,EAAE,SAAiB;QACrD,IAAI,KAAK,YAAY,KAAK,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACjF,OAAO,IAAI,QAAQ,CAAC,mEAAmE,CAAC,CAAC;QAC3F,CAAC;QACD,IACE,KAAK,YAAY,KAAK;YACrB,KAA8B,CAAC,MAAM,KAAK,IAAI;YAC9C,KAA+B,CAAC,IAAI,KAAK,mCAAmC,EAC7E,CAAC;YACD,OAAO,IAAI,QAAQ,CACjB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,oBAAoB,SAAS,OAAO,WAAW,qCAAqC,CACzG,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,IAAI,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACF"}
@@ -18,20 +18,14 @@
18
18
  * and throws loud ({@link AdapterError}). Every backend failure surfaces as an
19
19
  * {@link AdapterError}; our own loud errors pass through un-rewrapped.
20
20
  */
21
- import { type ChildProcess } from 'node:child_process';
22
21
  import type { AndroidTarget } from '../../config/schema.js';
23
- import type { Adapter, ConsoleEntry, Filters, LogQuery, NetworkEntry, Node, NodeRef, Query, ScrollOptions, WaitOptions } from '../contract.js';
22
+ import type { Adapter, CaptureSink, ConsoleEntry, LogQuery, NetworkEntry, Node, NodeRef, Query, ScrollOptions, SelectorDialect, WaitOptions } from '../contract.js';
24
23
  import { type Adb } from './adb.js';
24
+ import { type SpawnEmulator } from './emulator.js';
25
+ import { type EmulatorBin } from './sdk.js';
25
26
  import { type UiAutomatorSource } from './uiautomator.js';
26
- /**
27
- * Parse `logcat -v epoch` output into {@link ConsoleEntry}s (oldest first, as emitted).
28
- * Line shape: `1546300800.000 1000 1000 I Tag: message` — unmatched lines are skipped.
29
- */
30
- export declare function parseLogcat(raw: string): ConsoleEntry[];
31
- /** Apply the whitelisted console `filters` (logcat). Loud on an unknown key or wrong type. */
32
- export declare function applyLogFilters(entries: ConsoleEntry[], filters?: Filters): ConsoleEntry[];
33
- /** Launch the emulator process — the spawn seam tests replace with a fake child. */
34
- export type SpawnEmulator = (bin: string, args: string[]) => ChildProcess;
27
+ export { applyLogFilters, parseLogcat, parseRawLogcat } from './logcat.js';
28
+ export type { SpawnEmulator };
35
29
  export interface AndroidAdapterInit {
36
30
  /** Resolved android-target config (avd, emulatorPath, adbSerial). */
37
31
  config: AndroidTarget;
@@ -49,6 +43,18 @@ export interface AndroidAdapterInit {
49
43
  bootWaitMs?: number;
50
44
  /** Override the managed console-port pick (defaults to {@link pickEmulatorPort}); a test seam. */
51
45
  pickPort?: () => Promise<number>;
46
+ /**
47
+ * Override managed-boot emulator-binary resolution (defaults to
48
+ * {@link resolveEmulatorBin}: a configured `emulatorPath` verbatim, else the
49
+ * Android SDK install, else PATH); a seam for tests. Managed boot only — attach
50
+ * never resolves.
51
+ */
52
+ resolveBin?: (explicit: string | null | undefined) => EmulatorBin;
53
+ /**
54
+ * Sink streaming captured logcat rows to the run's durable console trail (the
55
+ * session layer binds it, redacting, to `logs/console.log`).
56
+ */
57
+ onLog?: CaptureSink;
52
58
  }
53
59
  /**
54
60
  * The android {@link Adapter}: an ADB + uiautomator pair behind one contract.
@@ -56,6 +62,8 @@ export interface AndroidAdapterInit {
56
62
  */
57
63
  export declare class AndroidAdapter implements Adapter {
58
64
  #private;
65
+ /** The native grammar `find`/`click`/`type` accept: `role "name"` or a bare id/name substring. */
66
+ readonly selectorDialect: SelectorDialect;
59
67
  private constructor();
60
68
  /**
61
69
  * Wire the adapter from config. Both modes talk to **one explicit serial**
@@ -73,7 +81,7 @@ export declare class AndroidAdapter implements Adapter {
73
81
  scroll(opts: ScrollOptions): Promise<void>;
74
82
  screenshot(): Promise<Uint8Array>;
75
83
  waitFor(opts: WaitOptions): Promise<void>;
76
- /** Drain recent logcat as normalized console entries (newest first), narrowed by {@link LogQuery}. */
84
+ /** Read recent logcat as normalized console entries (newest first), narrowed by {@link LogQuery}. Reads are non-destructive — the log is not cleared. */
77
85
  console(opts?: LogQuery): Promise<ConsoleEntry[]>;
78
86
  /** Android exposes no network channel over ADB — unsupported, surfaced loud. */
79
87
  network(): Promise<NetworkEntry[]>;