@developerz.ai/ui-debugger-mcp 1.8.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 (205) hide show
  1. package/README.md +70 -52
  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 +12 -22
  20. package/dist/adapters/browser/browser-adapter.js +133 -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 +111 -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 +440 -21
  73. package/dist/agent/belt/act.js +43 -6
  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/help.js +1 -1
  115. package/dist/cli/init.d.ts +54 -3
  116. package/dist/cli/init.js +89 -24
  117. package/dist/cli/init.js.map +1 -1
  118. package/dist/config/fingerprint.d.ts +6 -1
  119. package/dist/config/fingerprint.js +8 -4
  120. package/dist/config/fingerprint.js.map +1 -1
  121. package/dist/config/load.d.ts +50 -10
  122. package/dist/config/load.js +93 -27
  123. package/dist/config/load.js.map +1 -1
  124. package/dist/config/schema.d.ts +18 -6
  125. package/dist/config/schema.js +22 -7
  126. package/dist/config/schema.js.map +1 -1
  127. package/dist/errors.d.ts +14 -0
  128. package/dist/errors.js +18 -0
  129. package/dist/errors.js.map +1 -1
  130. package/dist/findings/schema.d.ts +44 -6
  131. package/dist/findings/schema.js +39 -3
  132. package/dist/findings/schema.js.map +1 -1
  133. package/dist/index.d.ts +1 -1
  134. package/dist/index.js +1 -1
  135. package/dist/index.js.map +1 -1
  136. package/dist/main.js +4 -76
  137. package/dist/main.js.map +1 -1
  138. package/dist/mcp/server.js.map +1 -1
  139. package/dist/mcp/tools/describe.d.ts +5 -4
  140. package/dist/mcp/tools/describe.js +14 -10
  141. package/dist/mcp/tools/describe.js.map +1 -1
  142. package/dist/mcp/tools/end-session.d.ts +3 -1
  143. package/dist/mcp/tools/end-session.js +7 -3
  144. package/dist/mcp/tools/end-session.js.map +1 -1
  145. package/dist/mcp/tools/output.d.ts +5 -4
  146. package/dist/mcp/tools/output.js +10 -2
  147. package/dist/mcp/tools/output.js.map +1 -1
  148. package/dist/mcp/tools/result.d.ts +10 -1
  149. package/dist/mcp/tools/result.js +8 -6
  150. package/dist/mcp/tools/result.js.map +1 -1
  151. package/dist/mcp/tools/start-debug.js +7 -5
  152. package/dist/mcp/tools/start-debug.js.map +1 -1
  153. package/dist/redact.d.ts +28 -0
  154. package/dist/redact.js +51 -0
  155. package/dist/redact.js.map +1 -0
  156. package/dist/services/catalog.d.ts +28 -0
  157. package/dist/services/catalog.js +65 -0
  158. package/dist/services/catalog.js.map +1 -0
  159. package/dist/services/debug-api.d.ts +172 -0
  160. package/dist/services/debug-api.js +9 -0
  161. package/dist/services/debug-api.js.map +1 -0
  162. package/dist/services/debug-service.d.ts +25 -173
  163. package/dist/services/debug-service.js +108 -175
  164. package/dist/services/debug-service.js.map +1 -1
  165. package/dist/services/login.d.ts +7 -2
  166. package/dist/services/login.js +210 -10
  167. package/dist/services/login.js.map +1 -1
  168. package/dist/services/retained-snapshot.d.ts +36 -0
  169. package/dist/services/retained-snapshot.js +63 -0
  170. package/dist/services/retained-snapshot.js.map +1 -0
  171. package/dist/services/session-builder.d.ts +26 -0
  172. package/dist/services/session-builder.js +46 -19
  173. package/dist/services/session-builder.js.map +1 -1
  174. package/dist/services/start-guards.d.ts +32 -0
  175. package/dist/services/start-guards.js +50 -0
  176. package/dist/services/start-guards.js.map +1 -0
  177. package/dist/services/summarize.d.ts +12 -3
  178. package/dist/services/summarize.js +13 -5
  179. package/dist/services/summarize.js.map +1 -1
  180. package/dist/session/cleanup.js.map +1 -1
  181. package/dist/session/findings-store.d.ts +2 -1
  182. package/dist/session/findings-store.js +30 -2
  183. package/dist/session/findings-store.js.map +1 -1
  184. package/dist/session/live-pointer.d.ts +19 -0
  185. package/dist/session/live-pointer.js +41 -0
  186. package/dist/session/live-pointer.js.map +1 -0
  187. package/dist/session/manager.d.ts +11 -1
  188. package/dist/session/manager.js +46 -2
  189. package/dist/session/manager.js.map +1 -1
  190. package/dist/session/owner-lock.d.ts +208 -0
  191. package/dist/session/owner-lock.js +499 -0
  192. package/dist/session/owner-lock.js.map +1 -0
  193. package/dist/session/process-identity.js.map +1 -1
  194. package/dist/session/session.js +61 -7
  195. package/dist/session/session.js.map +1 -1
  196. package/dist/session/state-file.d.ts +74 -14
  197. package/dist/session/state-file.js +203 -21
  198. package/dist/session/state-file.js.map +1 -1
  199. package/package.json +7 -7
  200. package/dist/adapters/android/android-adapter.test-helpers.d.ts +0 -52
  201. package/dist/adapters/android/android-adapter.test-helpers.js +0 -115
  202. package/dist/adapters/android/android-adapter.test-helpers.js.map +0 -1
  203. package/dist/mcp/server.test-helpers.d.ts +0 -23
  204. package/dist/mcp/server.test-helpers.js +0 -49
  205. 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`).
@@ -126,8 +133,10 @@ It's also published in the official [MCP Registry](https://modelcontextprotocol.
126
133
  `io.github.developerz-ai/ui-debugger-mcp` — any client that browses the registry (instead of a
127
134
  hand-written `.mcp.json` entry) can find and install it by that name.
128
135
 
129
- Then add a per-project `.ui-debugger-mcp.json` describing the app to debug
130
- (models, targets, urls). The fastest way is the `init` command:
136
+ Then add a per-project config describing the app to debug (models, targets,
137
+ urls) — `.dz/ui-debugger/ui-debugger-mcp.json` if your repo keeps agent config
138
+ under `.dz/` (checked first), else the root `.ui-debugger-mcp.json` (legacy).
139
+ The fastest way is the `init` command:
131
140
 
132
141
  ```bash
133
142
  npx @developerz.ai/ui-debugger-mcp@latest init # in your project root
@@ -137,15 +146,18 @@ npx @developerz.ai/ui-debugger-mcp@latest init # in your project root
137
146
  [`docs/idea/config.md`](docs/idea/config.md)):
138
147
 
139
148
  - creates the workspace dir `./tmp/ui-debugger-mcp/`
140
- - writes a starter `.ui-debugger-mcp.json` (default deepseek/glm models, a `web`
141
- target stub) if one doesn't already exist
149
+ - writes a starter config (default free models, a `web` target stub) if
150
+ one doesn't already exist — at `.dz/ui-debugger/ui-debugger-mcp.json` when the
151
+ repo already has a `.dz/` dir, else at the root `.ui-debugger-mcp.json`
142
152
  - adds `tmp/` to `.gitignore`
143
153
  - prints the `.mcp.json` snippet to paste (it never writes your API key)
144
154
 
145
155
  Config files:
146
156
 
147
157
  - `.mcp.json` → **how to launch** the server (command + secret key). Gitignored.
148
- - `.ui-debugger-mcp.json` → **how to debug this app** (models, targets). Committed.
158
+ - `.dz/ui-debugger/ui-debugger-mcp.json` (or root `.ui-debugger-mcp.json`) →
159
+ **how to debug this app** (models, targets). Committed. When both exist the
160
+ `.dz/` copy wins and the tool prints a notice naming the ignored root file.
149
161
 
150
162
  Every key of both files is documented in [`docs/idea/config.md`](docs/idea/config.md);
151
163
  every tool's exact input/output shape is in [`docs/idea/mcp-tools.md`](docs/idea/mcp-tools.md).
@@ -160,7 +172,7 @@ in your repo and it debugs that repo.
160
172
  npx @developerz.ai/ui-debugger-mcp@latest init
161
173
  ```
162
174
 
163
- This creates `./tmp/ui-debugger-mcp/`, writes a starter `.ui-debugger-mcp.json`,
175
+ This creates `./tmp/ui-debugger-mcp/`, writes a starter config (`.dz/…` or root),
164
176
  and prints the `.mcp.json` snippet to paste.
165
177
 
166
178
  ```jsonc
@@ -180,7 +192,8 @@ and prints the `.mcp.json` snippet to paste.
180
192
  ```
181
193
 
182
194
  ```jsonc
183
- // 3. Edit .ui-debugger-mcp.json — set your app's URL
195
+ // 3. Edit the project config (.dz/ui-debugger/ui-debugger-mcp.json or root
196
+ // .ui-debugger-mcp.json) — set your app's URL
184
197
  {
185
198
  "targets": {
186
199
  "web": { "adapter": "browser", "url": "http://localhost:3000" }
@@ -202,13 +215,13 @@ get_findings { session_id: "...", wait: 30000 }
202
215
 
203
216
  It's a **conversation**, not a remote control — five fat tools, not one-per-click:
204
217
 
205
- | Tool | What it does |
206
- |------|--------------|
207
- | `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 }`. |
208
- | `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. |
209
- | `send_message` | Talk to the running agent mid-flight — add work, redirect, or answer a question. |
210
- | `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. |
211
- | `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. |
212
225
 
213
226
  A run is **always time-capped**: `start_debug`'s `timeout` (seconds) overrides the
214
227
  default 300s, so a session can never hang forever — it auto-ends and frees the
@@ -239,7 +252,7 @@ start_debug { target: "dashboard", as: "admin", goal: "open Audit and check the
239
252
 
240
253
  The run signs in **out-of-band**, before the driver's first step: it costs zero
241
254
  driver steps, and the credentials never enter the model's context — the prompt
242
- 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
243
256
  every log the run writes; `describe` reports persona **names** only. A typo'd `as`
244
257
  fails loud listing the valid names, and a login that does not take fails the run
245
258
  rather than handing back a session that will report every page behind it as empty.
@@ -249,7 +262,7 @@ Use dev/seed credentials — this file is committed. Details in
249
262
  ### Telling it what's expected — `notes`
250
263
 
251
264
  A freshly-migrated app with no seed data renders empty states everywhere, and the
252
- 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
253
266
  it is useless. Say what's expected once, in the target:
254
267
 
255
268
  ```jsonc
@@ -264,8 +277,11 @@ it is useless. Say what's expected once, in the target:
264
277
 
265
278
  One fact per line, on any target (web, desktop, android). Unlike the per-run
266
279
  `goal`, `notes` is config: it is composed into the driver's prompt once, as its
267
- 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
268
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.
269
285
  Capped at 1000 characters, enforced when the config loads (the prompt carrying it
270
286
  is resent to the model on every step, so an essay here is paid for per step).
271
287
 
@@ -283,8 +299,8 @@ Every tool result carries **both** a pretty-printed text block and a typed
283
299
  `structuredContent` payload validated against a declared `outputSchema` — parse
284
300
  the structured half, don't scrape the text. Tools also declare MCP annotations
285
301
  (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) so clients
286
- can render/gate them correctly, and evidence paths (screenshots, `replay.mp4`,
287
- 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
288
304
  [`docs/reference.md`](docs/reference.md).
289
305
 
290
306
  Typical loop from a smart agent:
@@ -303,14 +319,14 @@ allowed tools, output formats).
303
319
 
304
320
  You get findings, but the agent's evidence is what makes them actionable:
305
321
 
306
- | | |
307
- |---|---|
308
- | **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. |
309
- | **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. |
310
- | **iframes** | Embedded documents are read too. Nodes carry `frame`, and their bounds are page coordinates, so clicking works the same as anywhere else. |
311
- | **Tabs** | A `target="_blank"` click is noticed and followable, instead of reading as "nothing happened". |
312
- | **Console** | Errors and uncaught exceptions, with source locations. |
313
- | **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`. |
314
330
 
315
331
  Static assets are held back from a default network read — on a Vite dev server
316
332
  they outnumber real API calls ~15:1 — with a count of what was hidden and the
@@ -330,7 +346,7 @@ ui-debugger-mcp stop # gracefully end the run (frees the browser + profile)
330
346
 
331
347
  **Chrome not found**
332
348
  The web adapter launches Chrome via the system PATH. Install Chrome/Chromium, or
333
- set `executablePath` in `.ui-debugger-mcp.json`:
349
+ set `executablePath` in the project config (`.dz/…` or root):
334
350
  ```jsonc
335
351
  "web": { "adapter": "browser", "url": "...", "executablePath": "/usr/bin/chromium-browser" }
336
352
  ```
@@ -362,9 +378,9 @@ sorts last. Only the **5 most recent** sessions are kept — each new run prunes
362
378
  rest, so evidence from a run six ago is gone by design.
363
379
 
364
380
  **Run fails instantly: "… is not a valid model ID"**
365
- The model string in `.ui-debugger-mcp.json` is not a catalog id. OpenRouter takes
381
+ The model string in the project config is not a catalog id. OpenRouter takes
366
382
  `provider/model` with optional `:floor` / `:nitro` routing suffixes — a `#…`
367
- suffix is rejected outright. Use plain ids (`deepseek/deepseek-v4-flash`).
383
+ suffix is rejected outright. Use catalog ids (`particle-ai/particle-1:free`).
368
384
 
369
385
  **Still running an old version after upgrading**
370
386
  `npx -y <pkg>` REUSES a cached install when one exists, so a bare
@@ -407,7 +423,9 @@ still land without it.
407
423
  - **Bun** + **TypeScript** (ships as npm, runs via `npx`/`bunx`)
408
424
  - **Vercel AI SDK** — the agent loop (fast driver + vision describer)
409
425
  - **Any OpenAI-compatible router** (OpenRouter default) — swap models per role.
410
- 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.
411
429
  - **CDP** for web, **X11/Wayland** for desktop, **ADB** for Android
412
430
  - stdio MCP transport
413
431
 
@@ -415,11 +433,11 @@ still land without it.
415
433
 
416
434
  All three adapters ship in v1:
417
435
 
418
- | Target | State |
419
- |---------|-------|
420
- | web | ✅ shipped (CDP, headless + attach) |
436
+ | Target | State |
437
+ | ------- | ------------------------------------------ |
438
+ | web | ✅ shipped (CDP, headless + attach) |
421
439
  | desktop | ✅ shipped (X11/Wayland, AT-SPI + xdotool) |
422
- | android | ✅ shipped (ADB, uiautomator) |
440
+ | android | ✅ shipped (ADB, uiautomator) |
423
441
 
424
442
  Replay video (`replay.mp4`, captioned stills → mp4 via ffmpeg) ships with the web adapter.
425
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;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,MAAM,GAAG,GAAG,KAAK,CAAC;AAElB,oGAAoG;AACpG,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;;;GAIG;AACH,MAAM,WAAW,GAAG,SAAS,CAAC;AAE9B,wEAAwE;AACxE,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC;;;;GAIG;AACH,MAAM,cAAc,GAClB,4GAA4G,CAAC;AAE/G;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,YAAY,QAAQ,IAAI,cAAc,CAAC,IAAI,CAAC,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B,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 {};