@developerz.ai/ui-debugger-mcp 1.9.0 → 1.10.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 (201) hide show
  1. package/README.md +56 -44
  2. package/dist/adapters/android/adb.d.ts +19 -7
  3. package/dist/adapters/android/adb.js +50 -13
  4. package/dist/adapters/android/adb.js.map +1 -1
  5. package/dist/adapters/android/android-adapter.d.ts +42 -2
  6. package/dist/adapters/android/android-adapter.js +366 -36
  7. package/dist/adapters/android/android-adapter.js.map +1 -1
  8. package/dist/adapters/android/commands.js.map +1 -1
  9. package/dist/adapters/android/ports.js.map +1 -1
  10. package/dist/adapters/android/sdk.d.ts +65 -0
  11. package/dist/adapters/android/sdk.js +107 -0
  12. package/dist/adapters/android/sdk.js.map +1 -0
  13. package/dist/adapters/android/uiautomator.d.ts +23 -7
  14. package/dist/adapters/android/uiautomator.js +31 -7
  15. package/dist/adapters/android/uiautomator.js.map +1 -1
  16. package/dist/adapters/availability.d.ts +39 -0
  17. package/dist/adapters/availability.js +62 -0
  18. package/dist/adapters/availability.js.map +1 -0
  19. package/dist/adapters/browser/browser-adapter.d.ts +11 -22
  20. package/dist/adapters/browser/browser-adapter.js +98 -67
  21. package/dist/adapters/browser/browser-adapter.js.map +1 -1
  22. package/dist/adapters/browser/cdp.d.ts +15 -7
  23. package/dist/adapters/browser/cdp.js +25 -3
  24. package/dist/adapters/browser/cdp.js.map +1 -1
  25. package/dist/adapters/browser/filters.d.ts +1 -1
  26. package/dist/adapters/browser/filters.js.map +1 -1
  27. package/dist/adapters/browser/geometry.js.map +1 -1
  28. package/dist/adapters/browser/launch.d.ts +14 -5
  29. package/dist/adapters/browser/launch.js +14 -5
  30. package/dist/adapters/browser/launch.js.map +1 -1
  31. package/dist/adapters/browser/lifecycle.d.ts +58 -0
  32. package/dist/adapters/browser/lifecycle.js +98 -0
  33. package/dist/adapters/browser/lifecycle.js.map +1 -0
  34. package/dist/adapters/browser/log-filters.d.ts +2 -2
  35. package/dist/adapters/browser/log-filters.js.map +1 -1
  36. package/dist/adapters/browser/log-format.d.ts +14 -23
  37. package/dist/adapters/browser/log-format.js +16 -55
  38. package/dist/adapters/browser/log-format.js.map +1 -1
  39. package/dist/adapters/browser/tab-context.d.ts +30 -0
  40. package/dist/adapters/browser/tab-context.js +41 -0
  41. package/dist/adapters/browser/tab-context.js.map +1 -0
  42. package/dist/adapters/contract.d.ts +91 -5
  43. package/dist/adapters/contract.js +7 -2
  44. package/dist/adapters/contract.js.map +1 -1
  45. package/dist/adapters/desktop/atspi-busctl.d.ts +26 -0
  46. package/dist/adapters/desktop/atspi-busctl.js +330 -0
  47. package/dist/adapters/desktop/atspi-busctl.js.map +1 -0
  48. package/dist/adapters/desktop/atspi-parse.d.ts +39 -0
  49. package/dist/adapters/desktop/atspi-parse.js +155 -0
  50. package/dist/adapters/desktop/atspi-parse.js.map +1 -0
  51. package/dist/adapters/desktop/atspi.d.ts +75 -50
  52. package/dist/adapters/desktop/atspi.js +64 -285
  53. package/dist/adapters/desktop/atspi.js.map +1 -1
  54. package/dist/adapters/desktop/capture.d.ts +11 -20
  55. package/dist/adapters/desktop/capture.js +68 -37
  56. package/dist/adapters/desktop/capture.js.map +1 -1
  57. package/dist/adapters/desktop/desktop-adapter.d.ts +20 -2
  58. package/dist/adapters/desktop/desktop-adapter.js +91 -9
  59. package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
  60. package/dist/adapters/desktop/input.d.ts +18 -4
  61. package/dist/adapters/desktop/input.js +15 -10
  62. package/dist/adapters/desktop/input.js.map +1 -1
  63. package/dist/adapters/desktop/proc.d.ts +32 -4
  64. package/dist/adapters/desktop/proc.js +33 -6
  65. package/dist/adapters/desktop/proc.js.map +1 -1
  66. package/dist/adapters/factory.d.ts +12 -5
  67. package/dist/adapters/factory.js +29 -3
  68. package/dist/adapters/factory.js.map +1 -1
  69. package/dist/adapters/log-format.d.ts +32 -0
  70. package/dist/adapters/log-format.js +39 -0
  71. package/dist/adapters/log-format.js.map +1 -0
  72. package/dist/agent/belt/act.d.ts +421 -21
  73. package/dist/agent/belt/act.js +4 -4
  74. package/dist/agent/belt/act.js.map +1 -1
  75. package/dist/agent/belt/look.d.ts +471 -14
  76. package/dist/agent/belt/look.js +74 -12
  77. package/dist/agent/belt/look.js.map +1 -1
  78. package/dist/agent/belt/observe.d.ts +663 -42
  79. package/dist/agent/belt/observe.js +76 -12
  80. package/dist/agent/belt/observe.js.map +1 -1
  81. package/dist/agent/belt/report.d.ts +754 -48
  82. package/dist/agent/belt/report.js +121 -38
  83. package/dist/agent/belt/report.js.map +1 -1
  84. package/dist/agent/belt/trail.d.ts +44 -16
  85. package/dist/agent/belt/trail.js +46 -11
  86. package/dist/agent/belt/trail.js.map +1 -1
  87. package/dist/agent/capabilities.js.map +1 -1
  88. package/dist/agent/fallback.d.ts +33 -0
  89. package/dist/agent/fallback.js +84 -0
  90. package/dist/agent/fallback.js.map +1 -0
  91. package/dist/agent/loop.d.ts +54 -52
  92. package/dist/agent/loop.js +173 -176
  93. package/dist/agent/loop.js.map +1 -1
  94. package/dist/agent/models.d.ts +10 -6
  95. package/dist/agent/models.js +15 -9
  96. package/dist/agent/models.js.map +1 -1
  97. package/dist/agent/prompts/compose.d.ts +1 -1
  98. package/dist/agent/prompts/debug-agent.js +45 -8
  99. package/dist/agent/prompts/debug-agent.js.map +1 -1
  100. package/dist/agent/prompts/web-addendum.d.ts +1 -1
  101. package/dist/agent/prompts/web-addendum.js +15 -3
  102. package/dist/agent/prompts/web-addendum.js.map +1 -1
  103. package/dist/agent/provider.d.ts +38 -0
  104. package/dist/agent/provider.js +55 -3
  105. package/dist/agent/provider.js.map +1 -1
  106. package/dist/boot.d.ts +64 -0
  107. package/dist/boot.js +145 -0
  108. package/dist/boot.js.map +1 -0
  109. package/dist/cli/chromium-libs.d.ts +262 -0
  110. package/dist/cli/chromium-libs.js +522 -0
  111. package/dist/cli/chromium-libs.js.map +1 -0
  112. package/dist/cli/control.js +51 -9
  113. package/dist/cli/control.js.map +1 -1
  114. package/dist/cli/init.d.ts +52 -3
  115. package/dist/cli/init.js +62 -10
  116. package/dist/cli/init.js.map +1 -1
  117. package/dist/config/load.d.ts +25 -8
  118. package/dist/config/load.js +40 -13
  119. package/dist/config/load.js.map +1 -1
  120. package/dist/config/schema.d.ts +18 -6
  121. package/dist/config/schema.js +22 -7
  122. package/dist/config/schema.js.map +1 -1
  123. package/dist/errors.d.ts +14 -0
  124. package/dist/errors.js +18 -0
  125. package/dist/errors.js.map +1 -1
  126. package/dist/findings/schema.d.ts +44 -6
  127. package/dist/findings/schema.js +39 -3
  128. package/dist/findings/schema.js.map +1 -1
  129. package/dist/index.d.ts +1 -1
  130. package/dist/index.js +1 -1
  131. package/dist/index.js.map +1 -1
  132. package/dist/main.js +4 -82
  133. package/dist/main.js.map +1 -1
  134. package/dist/mcp/server.js.map +1 -1
  135. package/dist/mcp/tools/describe.d.ts +5 -4
  136. package/dist/mcp/tools/describe.js +14 -10
  137. package/dist/mcp/tools/describe.js.map +1 -1
  138. package/dist/mcp/tools/end-session.d.ts +3 -1
  139. package/dist/mcp/tools/end-session.js +7 -3
  140. package/dist/mcp/tools/end-session.js.map +1 -1
  141. package/dist/mcp/tools/output.d.ts +5 -4
  142. package/dist/mcp/tools/output.js +10 -2
  143. package/dist/mcp/tools/output.js.map +1 -1
  144. package/dist/mcp/tools/result.d.ts +10 -1
  145. package/dist/mcp/tools/result.js +8 -6
  146. package/dist/mcp/tools/result.js.map +1 -1
  147. package/dist/mcp/tools/start-debug.js +7 -5
  148. package/dist/mcp/tools/start-debug.js.map +1 -1
  149. package/dist/redact.d.ts +28 -0
  150. package/dist/redact.js +51 -0
  151. package/dist/redact.js.map +1 -0
  152. package/dist/services/catalog.d.ts +28 -0
  153. package/dist/services/catalog.js +65 -0
  154. package/dist/services/catalog.js.map +1 -0
  155. package/dist/services/debug-api.d.ts +172 -0
  156. package/dist/services/debug-api.js +9 -0
  157. package/dist/services/debug-api.js.map +1 -0
  158. package/dist/services/debug-service.d.ts +25 -173
  159. package/dist/services/debug-service.js +108 -175
  160. package/dist/services/debug-service.js.map +1 -1
  161. package/dist/services/login.d.ts +7 -2
  162. package/dist/services/login.js +203 -29
  163. package/dist/services/login.js.map +1 -1
  164. package/dist/services/retained-snapshot.d.ts +36 -0
  165. package/dist/services/retained-snapshot.js +63 -0
  166. package/dist/services/retained-snapshot.js.map +1 -0
  167. package/dist/services/session-builder.d.ts +26 -0
  168. package/dist/services/session-builder.js +46 -19
  169. package/dist/services/session-builder.js.map +1 -1
  170. package/dist/services/start-guards.d.ts +32 -0
  171. package/dist/services/start-guards.js +50 -0
  172. package/dist/services/start-guards.js.map +1 -0
  173. package/dist/services/summarize.d.ts +12 -3
  174. package/dist/services/summarize.js +13 -5
  175. package/dist/services/summarize.js.map +1 -1
  176. package/dist/session/cleanup.js.map +1 -1
  177. package/dist/session/findings-store.d.ts +2 -1
  178. package/dist/session/findings-store.js +30 -2
  179. package/dist/session/findings-store.js.map +1 -1
  180. package/dist/session/live-pointer.d.ts +19 -0
  181. package/dist/session/live-pointer.js +41 -0
  182. package/dist/session/live-pointer.js.map +1 -0
  183. package/dist/session/manager.d.ts +11 -1
  184. package/dist/session/manager.js +46 -2
  185. package/dist/session/manager.js.map +1 -1
  186. package/dist/session/owner-lock.d.ts +208 -0
  187. package/dist/session/owner-lock.js +499 -0
  188. package/dist/session/owner-lock.js.map +1 -0
  189. package/dist/session/process-identity.js.map +1 -1
  190. package/dist/session/session.js +61 -7
  191. package/dist/session/session.js.map +1 -1
  192. package/dist/session/state-file.d.ts +74 -14
  193. package/dist/session/state-file.js +203 -21
  194. package/dist/session/state-file.js.map +1 -1
  195. package/package.json +7 -7
  196. package/dist/adapters/android/android-adapter.test-helpers.d.ts +0 -52
  197. package/dist/adapters/android/android-adapter.test-helpers.js +0 -115
  198. package/dist/adapters/android/android-adapter.test-helpers.js.map +0 -1
  199. package/dist/mcp/server.test-helpers.d.ts +0 -23
  200. package/dist/mcp/server.test-helpers.js +0 -49
  201. 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,13 +215,13 @@ 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`. 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. |
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
227
  default 300s, so a session can never hang forever — it auto-ends and frees the
@@ -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
@@ -370,7 +380,7 @@ rest, so evidence from a run six ago is gone by design.
370
380
  **Run fails instantly: "… is not a valid model ID"**
371
381
  The model string in the project config is not a catalog id. OpenRouter takes
372
382
  `provider/model` with optional `:floor` / `:nitro` routing suffixes — a `#…`
373
- suffix is rejected outright. Use plain ids (`deepseek/deepseek-v4-flash`).
383
+ suffix is rejected outright. Use catalog ids (`particle-ai/particle-1:free`).
374
384
 
375
385
  **Still running an old version after upgrading**
376
386
  `npx -y <pkg>` REUSES a cached install when one exists, so a bare
@@ -413,7 +423,9 @@ still land without it.
413
423
  - **Bun** + **TypeScript** (ships as npm, runs via `npx`/`bunx`)
414
424
  - **Vercel AI SDK** — the agent loop (fast driver + vision describer)
415
425
  - **Any OpenAI-compatible router** (OpenRouter default) — swap models per role.
416
- Defaults: **deepseek** (text) drives, **glm** (image) sees.
426
+ Defaults (all free): `particle-ai/particle-1:free` drives, `nvidia/nemotron-3.5-super-vl:free` sees,
427
+ `baidu/ernie-5.5-flash-preview:free` summarises; `deepseek/deepseek-v4.1-flash:floor` is the paid fallback
428
+ behind every role when a free model is rate-limited or down.
417
429
  - **CDP** for web, **X11/Wayland** for desktop, **ADB** for Android
418
430
  - stdio MCP transport
419
431
 
@@ -421,11 +433,11 @@ still land without it.
421
433
 
422
434
  All three adapters ship in v1:
423
435
 
424
- | Target | State |
425
- |---------|-------|
426
- | web | ✅ shipped (CDP, headless + attach) |
436
+ | Target | State |
437
+ | ------- | ------------------------------------------ |
438
+ | web | ✅ shipped (CDP, headless + attach) |
427
439
  | desktop | ✅ shipped (X11/Wayland, AT-SPI + xdotool) |
428
- | android | ✅ shipped (ADB, uiautomator) |
440
+ | android | ✅ shipped (ADB, uiautomator) |
429
441
 
430
442
  Replay video (`replay.mp4`, captioned stills → mp4 via ffmpeg) ships with the web adapter.
431
443
  ffmpeg is optional — absent gracefully, findings still land.
@@ -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;A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CAAC;IAED,0FAA0F;IAC1F,qBAAqB,CAAC,IAAc,EAAE,QAAiB;QACrD,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,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"}
@@ -20,9 +20,28 @@
20
20
  */
21
21
  import { type ChildProcess } from 'node:child_process';
22
22
  import type { AndroidTarget } from '../../config/schema.js';
23
- import type { Adapter, ConsoleEntry, Filters, LogQuery, NetworkEntry, Node, NodeRef, Query, ScrollOptions, WaitOptions } from '../contract.js';
23
+ import type { Adapter, CaptureSink, ConsoleEntry, Filters, LogQuery, NetworkEntry, Node, NodeRef, Query, ScrollOptions, SelectorDialect, WaitOptions } from '../contract.js';
24
24
  import { type Adb } from './adb.js';
25
+ import { type EmulatorBin } from './sdk.js';
25
26
  import { type UiAutomatorSource } from './uiautomator.js';
27
+ /**
28
+ * One raw logcat row — the record exactly as logcat emitted it, before
29
+ * normalization. This is the row's dedup identity: keying the NORMALIZED entry
30
+ * instead would merge distinct rows (the timestamp rounds to whole milliseconds,
31
+ * `F` and `E` fold into one level, and PID/TID are dropped entirely).
32
+ */
33
+ interface RawLogcatRow {
34
+ /** Raw `sec.frac` text — the full precision logcat emitted, never rounded. */
35
+ time: string;
36
+ pid: string;
37
+ tid: string;
38
+ /** Raw priority letter — `F` and `E` normalize alike but are distinct rows. */
39
+ priority: string;
40
+ tag: string;
41
+ text: string;
42
+ }
43
+ /** Parse `logcat -v epoch` output into raw rows (oldest first, as emitted). */
44
+ export declare function parseRawLogcat(raw: string): RawLogcatRow[];
26
45
  /**
27
46
  * Parse `logcat -v epoch` output into {@link ConsoleEntry}s (oldest first, as emitted).
28
47
  * Line shape: `1546300800.000 1000 1000 I Tag: message` — unmatched lines are skipped.
@@ -49,6 +68,19 @@ export interface AndroidAdapterInit {
49
68
  bootWaitMs?: number;
50
69
  /** Override the managed console-port pick (defaults to {@link pickEmulatorPort}); a test seam. */
51
70
  pickPort?: () => Promise<number>;
71
+ /**
72
+ * Override managed-boot emulator-binary resolution (defaults to
73
+ * {@link resolveEmulatorBin}: a configured `emulatorPath` verbatim, else the
74
+ * Android SDK install, else PATH); a seam for tests. Managed boot only — attach
75
+ * never resolves.
76
+ */
77
+ resolveBin?: (explicit: string | null | undefined) => EmulatorBin;
78
+ /**
79
+ * Optional sink for streaming captured logcat rows to the run's durable console
80
+ * trail — the same seam the browser adapter writes to (the session layer binds
81
+ * it, redacting, to `logs/console.log`).
82
+ */
83
+ onLog?: CaptureSink;
52
84
  }
53
85
  /**
54
86
  * The android {@link Adapter}: an ADB + uiautomator pair behind one contract.
@@ -56,6 +88,13 @@ export interface AndroidAdapterInit {
56
88
  */
57
89
  export declare class AndroidAdapter implements Adapter {
58
90
  #private;
91
+ /**
92
+ * The native selector grammar — the uiautomator parser this adapter's
93
+ * `find`/`click`/`type` accept: `role "name"` or a bare `resource-id`/name
94
+ * substring, and nothing else. Declared here, not derived from the absence of
95
+ * `tabs`: the dialect is the grammar, and the grammar is the adapter's own.
96
+ */
97
+ readonly selectorDialect: SelectorDialect;
59
98
  private constructor();
60
99
  /**
61
100
  * Wire the adapter from config. Both modes talk to **one explicit serial**
@@ -73,7 +112,7 @@ export declare class AndroidAdapter implements Adapter {
73
112
  scroll(opts: ScrollOptions): Promise<void>;
74
113
  screenshot(): Promise<Uint8Array>;
75
114
  waitFor(opts: WaitOptions): Promise<void>;
76
- /** Drain recent logcat as normalized console entries (newest first), narrowed by {@link LogQuery}. */
115
+ /** Read recent logcat as normalized console entries (newest first), narrowed by {@link LogQuery}. Reads are non-destructive — the log is not cleared. */
77
116
  console(opts?: LogQuery): Promise<ConsoleEntry[]>;
78
117
  /** Android exposes no network channel over ADB — unsupported, surfaced loud. */
79
118
  network(): Promise<NetworkEntry[]>;
@@ -84,3 +123,4 @@ export declare class AndroidAdapter implements Adapter {
84
123
  */
85
124
  close(): Promise<void>;
86
125
  }
126
+ export {};