@developerz.ai/ui-debugger-mcp 1.1.0 → 1.3.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 (163) hide show
  1. package/README.md +45 -10
  2. package/dist/adapters/android/adb.d.ts +34 -5
  3. package/dist/adapters/android/adb.js +74 -20
  4. package/dist/adapters/android/adb.js.map +1 -1
  5. package/dist/adapters/android/android-adapter.d.ts +23 -7
  6. package/dist/adapters/android/android-adapter.js +106 -36
  7. package/dist/adapters/android/android-adapter.js.map +1 -1
  8. package/dist/adapters/android/android-adapter.test-helpers.d.ts +52 -0
  9. package/dist/adapters/android/android-adapter.test-helpers.js +115 -0
  10. package/dist/adapters/android/android-adapter.test-helpers.js.map +1 -0
  11. package/dist/adapters/android/commands.d.ts +27 -4
  12. package/dist/adapters/android/commands.js +66 -4
  13. package/dist/adapters/android/commands.js.map +1 -1
  14. package/dist/adapters/android/ports.d.ts +32 -0
  15. package/dist/adapters/android/ports.js +47 -0
  16. package/dist/adapters/android/ports.js.map +1 -0
  17. package/dist/adapters/android/uiautomator.d.ts +10 -2
  18. package/dist/adapters/android/uiautomator.js +36 -4
  19. package/dist/adapters/android/uiautomator.js.map +1 -1
  20. package/dist/adapters/browser/browser-adapter.d.ts +16 -13
  21. package/dist/adapters/browser/browser-adapter.js +196 -313
  22. package/dist/adapters/browser/browser-adapter.js.map +1 -1
  23. package/dist/adapters/browser/cdp.d.ts +40 -2
  24. package/dist/adapters/browser/cdp.js +223 -19
  25. package/dist/adapters/browser/cdp.js.map +1 -1
  26. package/dist/adapters/browser/extractor.d.ts +53 -0
  27. package/dist/adapters/browser/extractor.js +224 -0
  28. package/dist/adapters/browser/extractor.js.map +1 -0
  29. package/dist/adapters/browser/filters.d.ts +15 -0
  30. package/dist/adapters/browser/filters.js +93 -0
  31. package/dist/adapters/browser/filters.js.map +1 -0
  32. package/dist/adapters/browser/launch.d.ts +41 -0
  33. package/dist/adapters/browser/launch.js +61 -0
  34. package/dist/adapters/browser/launch.js.map +1 -0
  35. package/dist/adapters/budget.d.ts +16 -0
  36. package/dist/adapters/budget.js +25 -0
  37. package/dist/adapters/budget.js.map +1 -0
  38. package/dist/adapters/contract.d.ts +82 -6
  39. package/dist/adapters/desktop/atspi.d.ts +15 -0
  40. package/dist/adapters/desktop/atspi.js +37 -17
  41. package/dist/adapters/desktop/atspi.js.map +1 -1
  42. package/dist/adapters/desktop/capture.js +8 -1
  43. package/dist/adapters/desktop/capture.js.map +1 -1
  44. package/dist/adapters/desktop/desktop-adapter.d.ts +9 -2
  45. package/dist/adapters/desktop/desktop-adapter.js +84 -32
  46. package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
  47. package/dist/adapters/desktop/input.d.ts +16 -1
  48. package/dist/adapters/desktop/input.js +30 -0
  49. package/dist/adapters/desktop/input.js.map +1 -1
  50. package/dist/adapters/desktop/proc.d.ts +18 -3
  51. package/dist/adapters/desktop/proc.js +48 -5
  52. package/dist/adapters/desktop/proc.js.map +1 -1
  53. package/dist/adapters/factory.d.ts +3 -1
  54. package/dist/adapters/factory.js +6 -2
  55. package/dist/adapters/factory.js.map +1 -1
  56. package/dist/adapters/limit.d.ts +10 -0
  57. package/dist/adapters/limit.js +19 -0
  58. package/dist/adapters/limit.js.map +1 -0
  59. package/dist/agent/belt/act.d.ts +44 -9
  60. package/dist/agent/belt/act.js +176 -21
  61. package/dist/agent/belt/act.js.map +1 -1
  62. package/dist/agent/belt/look.d.ts +1 -1
  63. package/dist/agent/belt/look.js +31 -2
  64. package/dist/agent/belt/look.js.map +1 -1
  65. package/dist/agent/belt/observe.d.ts +42 -16
  66. package/dist/agent/belt/observe.js +134 -22
  67. package/dist/agent/belt/observe.js.map +1 -1
  68. package/dist/agent/belt/report.d.ts +29 -9
  69. package/dist/agent/belt/report.js +77 -10
  70. package/dist/agent/belt/report.js.map +1 -1
  71. package/dist/agent/belt/trail.d.ts +34 -0
  72. package/dist/agent/belt/trail.js +64 -0
  73. package/dist/agent/belt/trail.js.map +1 -0
  74. package/dist/agent/capabilities.d.ts +4 -4
  75. package/dist/agent/capabilities.js +41 -13
  76. package/dist/agent/capabilities.js.map +1 -1
  77. package/dist/agent/loop.d.ts +70 -21
  78. package/dist/agent/loop.js +146 -48
  79. package/dist/agent/loop.js.map +1 -1
  80. package/dist/agent/prompts/compose.d.ts +9 -1
  81. package/dist/agent/prompts/compose.js +5 -4
  82. package/dist/agent/prompts/compose.js.map +1 -1
  83. package/dist/agent/prompts/debug-agent.d.ts +13 -1
  84. package/dist/agent/prompts/debug-agent.js +98 -14
  85. package/dist/agent/prompts/debug-agent.js.map +1 -1
  86. package/dist/agent/prompts/desktop-addendum.d.ts +1 -1
  87. package/dist/agent/prompts/desktop-addendum.js +1 -1
  88. package/dist/agent/prompts/web-addendum.d.ts +1 -1
  89. package/dist/agent/prompts/web-addendum.js +84 -16
  90. package/dist/agent/prompts/web-addendum.js.map +1 -1
  91. package/dist/cli/control.d.ts +3 -1
  92. package/dist/cli/control.js +26 -40
  93. package/dist/cli/control.js.map +1 -1
  94. package/dist/cli/help.d.ts +3 -1
  95. package/dist/cli/help.js +6 -2
  96. package/dist/cli/help.js.map +1 -1
  97. package/dist/cli/init.d.ts +3 -6
  98. package/dist/cli/init.js +64 -16
  99. package/dist/cli/init.js.map +1 -1
  100. package/dist/config/fingerprint.d.ts +32 -0
  101. package/dist/config/fingerprint.js +47 -0
  102. package/dist/config/fingerprint.js.map +1 -0
  103. package/dist/config/load.d.ts +7 -1
  104. package/dist/config/load.js +17 -4
  105. package/dist/config/load.js.map +1 -1
  106. package/dist/config/schema.d.ts +12 -5
  107. package/dist/config/schema.js +17 -7
  108. package/dist/config/schema.js.map +1 -1
  109. package/dist/errors.d.ts +14 -2
  110. package/dist/errors.js +24 -4
  111. package/dist/errors.js.map +1 -1
  112. package/dist/index.d.ts +1 -1
  113. package/dist/index.js +1 -1
  114. package/dist/main.js +26 -8
  115. package/dist/main.js.map +1 -1
  116. package/dist/mcp/server.d.ts +16 -1
  117. package/dist/mcp/server.js +23 -2
  118. package/dist/mcp/server.js.map +1 -1
  119. package/dist/mcp/server.test-helpers.d.ts +23 -0
  120. package/dist/mcp/server.test-helpers.js +49 -0
  121. package/dist/mcp/server.test-helpers.js.map +1 -0
  122. package/dist/mcp/tools/describe.js +5 -0
  123. package/dist/mcp/tools/describe.js.map +1 -1
  124. package/dist/mcp/tools/end-session.js +5 -0
  125. package/dist/mcp/tools/end-session.js.map +1 -1
  126. package/dist/mcp/tools/get-findings.js +23 -3
  127. package/dist/mcp/tools/get-findings.js.map +1 -1
  128. package/dist/mcp/tools/output.d.ts +50 -0
  129. package/dist/mcp/tools/output.js +55 -0
  130. package/dist/mcp/tools/output.js.map +1 -0
  131. package/dist/mcp/tools/result.d.ts +24 -1
  132. package/dist/mcp/tools/result.js +106 -5
  133. package/dist/mcp/tools/result.js.map +1 -1
  134. package/dist/mcp/tools/send-message.js +5 -0
  135. package/dist/mcp/tools/send-message.js.map +1 -1
  136. package/dist/mcp/tools/start-debug.js +7 -1
  137. package/dist/mcp/tools/start-debug.js.map +1 -1
  138. package/dist/services/debug-service.d.ts +47 -8
  139. package/dist/services/debug-service.js +185 -14
  140. package/dist/services/debug-service.js.map +1 -1
  141. package/dist/services/session-builder.d.ts +20 -3
  142. package/dist/services/session-builder.js +43 -13
  143. package/dist/services/session-builder.js.map +1 -1
  144. package/dist/services/summarize.d.ts +1 -1
  145. package/dist/services/summarize.js +8 -1
  146. package/dist/services/summarize.js.map +1 -1
  147. package/dist/session/atomic-write.d.ts +24 -0
  148. package/dist/session/atomic-write.js +39 -0
  149. package/dist/session/atomic-write.js.map +1 -0
  150. package/dist/session/findings-store.js +3 -4
  151. package/dist/session/findings-store.js.map +1 -1
  152. package/dist/session/process-identity.d.ts +16 -0
  153. package/dist/session/process-identity.js +29 -0
  154. package/dist/session/process-identity.js.map +1 -1
  155. package/dist/session/session.js +36 -4
  156. package/dist/session/session.js.map +1 -1
  157. package/dist/session/state-file.d.ts +64 -5
  158. package/dist/session/state-file.js +76 -9
  159. package/dist/session/state-file.js.map +1 -1
  160. package/dist/session/workspace.d.ts +11 -0
  161. package/dist/session/workspace.js +14 -1
  162. package/dist/session/workspace.js.map +1 -1
  163. package/package.json +4 -1
@@ -8,16 +8,43 @@
8
8
  * seam — so the orchestration here unit-tests with no browser or network. The MCP
9
9
  * handlers stay thin: validate input, call straight through to a method here.
10
10
  *
11
+ * One run per project holds *across processes* too: the manager only knows this
12
+ * server's memory, so `start` also consults the `state.json` breadcrumb and
13
+ * refuses when another live server already owns a run here (a dead owner's stale
14
+ * breadcrumb never blocks).
15
+ *
11
16
  * Sessions are keyed by cwd, but the tools speak `session_id`. Every id-bearing
12
17
  * call resolves the active session for the cwd and fails loud
13
18
  * ({@link SessionNotFoundError}) when the id does not match, so a stale id never
14
19
  * silently drives the wrong run.
20
+ *
21
+ * A run that ends *without* the caller asking (wall-clock timeout, SIGTERM, the
22
+ * MCP client dying) leaves the manager, but its findings must not vanish with it:
23
+ * the settled session is retained so `get_findings` keeps serving its terminal
24
+ * snapshot. `end_session` is the explicit forget; the next `start_debug`
25
+ * supersedes it. The retained snapshot holds no target resources (the adapter is
26
+ * already closed) and never participates in the one-run gate.
15
27
  */
16
- import { SessionBusyError, SessionNotFoundError, SessionSettledError, TargetNotFoundError, } from '../errors.js';
28
+ import { CONFIG_FILENAME } from '../config/load.js';
29
+ import { ConfigError, SessionBusyError, SessionNotFoundError, SessionSettledError, TargetNotFoundError, } from '../errors.js';
30
+ import { FindingsSchema } from '../findings/schema.js';
17
31
  import { noopStatePort } from '../session/state-file.js';
18
32
  import { generateSessionId } from '../session/workspace.js';
19
33
  /** Default wall-clock cap on a debug run before it auto-ends (overridable per run). */
20
34
  export const DEFAULT_SESSION_TIMEOUT_MS = 300_000;
35
+ /**
36
+ * Narrow a findings object to the requested keys — the `fields` projection for a
37
+ * snapshot read off disk (a live {@link Session} projects its own).
38
+ */
39
+ function projectFindings(findings, fields) {
40
+ const out = {};
41
+ for (const field of fields) {
42
+ // Assigning key-by-key off a validated object; the index signature is what
43
+ // makes this need the cast, not any doubt about the value's type.
44
+ out[field] = findings[field];
45
+ }
46
+ return out;
47
+ }
21
48
  export class DebugService {
22
49
  #manager;
23
50
  #config;
@@ -26,8 +53,16 @@ export class DebugService {
26
53
  #state;
27
54
  #defaultTimeoutMs;
28
55
  #now;
56
+ #configChanged;
29
57
  /** Live wall-clock timer for the active run; cleared when the run ends. */
30
58
  #timer;
59
+ /**
60
+ * The last run that auto-ended (timeout / SIGTERM / client death), kept settled
61
+ * and closed so `get_findings` can still read its partial findings + evidence.
62
+ * Dropped by `end_session` (the explicit forget) and superseded by the next run.
63
+ * Never consulted by the one-run gate — a retained snapshot cannot block a start.
64
+ */
65
+ #retained;
31
66
  /**
32
67
  * A `start()` is in flight (building/launching, slot not yet in the manager).
33
68
  * Set synchronously before the first await so a concurrent `start_debug` fails
@@ -43,12 +78,19 @@ export class DebugService {
43
78
  this.#state = deps.state ?? noopStatePort;
44
79
  this.#defaultTimeoutMs = deps.defaultTimeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS;
45
80
  this.#now = deps.now ?? (() => Date.now());
81
+ this.#configChanged = deps.configChanged ?? (() => false);
46
82
  }
47
83
  /**
48
84
  * Open a run: assemble the session, take the profile lock, point the adapter at
49
85
  * the target, and kick the loop off in the background. Fails loud if a run is
50
- * already active for this cwd ({@link SessionBusyError}); never leaks a launched
51
- * browser — a lost lock race or a failed `open` tears the session back down.
86
+ * already active for this cwd ({@link SessionBusyError}) — whether it belongs to
87
+ * this server (the manager / in-flight guard) or to another live one (the
88
+ * `state.json` breadcrumb); never leaks a launched browser — a lost lock race or
89
+ * a failed `open` tears the session back down.
90
+ *
91
+ * `timeout` is wall-clock from HERE: the deadline is fixed on entry and the
92
+ * remaining budget is threaded into the build and the first navigation, so a slow
93
+ * Chrome launch spends the caller's cap instead of sitting outside it.
52
94
  */
53
95
  async start({ target, goal, criteria, url, timeoutMs }) {
54
96
  const cwd = this.#cwd;
@@ -62,10 +104,17 @@ export class DebugService {
62
104
  throw new SessionBusyError(`A debug session is already starting for '${cwd}'. ` +
63
105
  'Wait for it to open (or end it) before starting another — one run per project at a time.');
64
106
  }
107
+ // Before anything is launched: a run built from config the caller has already
108
+ // replaced is worse than no run — it reproduces the very failure they just fixed.
109
+ this.#assertConfigFresh();
65
110
  this.#starting = true;
111
+ const deadline = this.#now() + (timeoutMs ?? this.#defaultTimeoutMs);
112
+ /** Budget left on the caller's cap; never negative — a blown budget is simply spent. */
113
+ const remaining = () => Math.max(0, deadline - this.#now());
66
114
  try {
115
+ await this.#assertNoForeignRun(cwd);
67
116
  const id = generateSessionId(this.#now());
68
- const built = await this.#build({ id, target, goal, criteria, url });
117
+ const built = await this.#build({ id, target, goal, criteria, url, timeoutMs: remaining() });
69
118
  try {
70
119
  this.#manager.start(cwd, built.session);
71
120
  }
@@ -73,23 +122,76 @@ export class DebugService {
73
122
  await built.session.close().catch(() => undefined);
74
123
  throw err;
75
124
  }
125
+ // This run owns the slot now — the previous run's retained snapshot is
126
+ // superseded (its findings.json stays on disk for the CLI / a human).
127
+ this.#retained = undefined;
76
128
  try {
77
- await built.open();
129
+ await built.open(remaining());
78
130
  built.session.start(built.run);
79
131
  }
80
132
  catch (err) {
81
133
  await this.#manager.end(cwd).catch(() => undefined);
82
134
  throw err;
83
135
  }
84
- await this.#state.record({ sessionId: id, target, goal });
85
- this.#armTimeout(timeoutMs ?? this.#defaultTimeoutMs);
136
+ // Armed BEFORE the breadcrumb write, on what is LEFT of the cap: a throwing
137
+ // StatePort must never leave a live run with no timer on it, and the launch
138
+ // already spent part of the budget.
139
+ this.#armTimeout(remaining());
140
+ try {
141
+ await this.#state.record({ sessionId: id, target, goal });
142
+ }
143
+ catch (err) {
144
+ // The caller gets no session_id back, so nothing could ever end this run —
145
+ // tear it down here (and drop any half-written breadcrumb) and fail loud.
146
+ this.#clearTimeout();
147
+ await this.#manager.end(cwd).catch(() => undefined);
148
+ await this.#state.clear().catch(() => undefined);
149
+ throw err;
150
+ }
86
151
  return { session_id: id };
87
152
  }
88
153
  finally {
89
154
  this.#starting = false;
90
155
  }
91
156
  }
92
- /** Arm the wall-clock cap: auto-end the run when it fires (replaces any prior timer). */
157
+ /**
158
+ * Refuse to start on config this server can no longer honour.
159
+ *
160
+ * The message names the one action that works. Without it the caller edits the
161
+ * file, sees the identical failure, and has no way to tell a bad fix from an
162
+ * unread one — which is exactly how a real session burned two runs.
163
+ */
164
+ #assertConfigFresh() {
165
+ if (!this.#configChanged())
166
+ return;
167
+ throw new ConfigError(`${CONFIG_FILENAME} changed on disk after this ui-debugger-mcp server started, so a run now ` +
168
+ 'would still use the OLD settings (models, targets, urls are read once at boot). ' +
169
+ 'Restart the MCP server to pick the new config up — in Claude Code, /mcp → reconnect ' +
170
+ 'ui-debugger, or restart the session.');
171
+ }
172
+ /**
173
+ * The other half of the one-run gate: another *live* server process holding a
174
+ * run on this project. The manager only sees this process's memory, so without
175
+ * this a second MCP client on the same cwd would launch a second run onto the
176
+ * same profile/emulator and overwrite the live breadcrumb (leaving the CLI
177
+ * pointing at the wrong pid). A dead or PID-recycled owner does not count — a
178
+ * crashed server's stale `running` file must never wedge the project shut.
179
+ */
180
+ async #assertNoForeignRun(cwd) {
181
+ const foreign = await this.#state.foreignRun();
182
+ if (foreign === null)
183
+ return;
184
+ throw new SessionBusyError(`Another ui-debugger-mcp server (pid ${foreign.pid}) already has a debug session ` +
185
+ `('${foreign.sessionId}') active for '${cwd}'. One run per project at a time. ` +
186
+ `Read what it is doing with get_findings({session_id:'${foreign.sessionId}'}) — a run ` +
187
+ 'that has already settled is just waiting to be closed by its own client. To take the ' +
188
+ "project over, run 'ui-debugger-mcp stop' in this directory, then start again.");
189
+ }
190
+ /**
191
+ * Arm the wall-clock cap on what is LEFT of the run's budget: auto-end the run when
192
+ * it fires (replaces any prior timer). `0` — the launch outlived the whole cap —
193
+ * ends the run on the next tick rather than granting it a fresh one.
194
+ */
93
195
  #armTimeout(ms) {
94
196
  this.#clearTimeout();
95
197
  this.#timer = setTimeout(() => {
@@ -118,12 +220,40 @@ export class DebugService {
118
220
  session.pushMessage(message);
119
221
  return { ok: true, session_id };
120
222
  }
121
- /** Snapshot the run's findings — optionally long-poll (`wait`) and/or project a subset (`fields`). */
223
+ /**
224
+ * Snapshot the run's findings — optionally long-poll (`wait`) and/or project a
225
+ * subset (`fields`). Serves the retained terminal snapshot once the run has
226
+ * auto-ended, so a timed-out run's partial findings stay reachable (the
227
+ * long-poll returns at once: a settled run has nothing left to wait for).
228
+ */
122
229
  async getFindings({ session_id, wait, fields, }) {
123
- const session = this.#require(session_id);
124
- return fields && fields.length > 0
125
- ? session.snapshot(fields, wait)
126
- : session.snapshot(undefined, wait);
230
+ let session;
231
+ try {
232
+ session = this.#requireReadable(session_id);
233
+ }
234
+ catch (error) {
235
+ // Our own memory has no such run — but another live server on this project
236
+ // might, and `start_debug` has already named that session to this caller.
237
+ // Answering "no such session" there is a contradiction that sends the
238
+ // caller into a retry loop; serve what that run has flushed instead.
239
+ const foreign = await this.#foreignSnapshot(session_id);
240
+ if (foreign)
241
+ return fields ? projectFindings(foreign, fields) : foreign;
242
+ throw error;
243
+ }
244
+ return fields ? session.snapshot(fields, wait) : session.snapshot(undefined, wait);
245
+ }
246
+ /**
247
+ * A foreign run's findings as last flushed to disk, or `null` if this id names
248
+ * no such run. Read-only and point-in-time: we do not own that run, so there is
249
+ * nothing to long-poll — the owning server is the one advancing it.
250
+ */
251
+ async #foreignSnapshot(session_id) {
252
+ const raw = await this.#state.foreignFindings(session_id);
253
+ if (raw === null)
254
+ return null;
255
+ const parsed = FindingsSchema.safeParse(raw);
256
+ return parsed.success ? parsed.data : null;
127
257
  }
128
258
  /** List configured targets (the whole catalog, or one when named) plus resolved models/workspace. */
129
259
  describe({ target }) {
@@ -138,8 +268,15 @@ export class DebugService {
138
268
  workspace: this.#config.workspace,
139
269
  };
140
270
  }
141
- /** End the active run: abort the loop, close the adapter, free the profile lock. */
271
+ /**
272
+ * End the active run: abort the loop, close the adapter, free the profile lock.
273
+ * Ending a run that already auto-ended (timeout / client death) is not an error
274
+ * — it just forgets the retained snapshot, so `end_session` reads the same
275
+ * either way and stays the one explicit forget.
276
+ */
142
277
  async end({ session_id }) {
278
+ if (this.#forgetRetained(session_id))
279
+ return { ok: true, session_id };
143
280
  this.#require(session_id);
144
281
  this.#clearTimeout();
145
282
  // Clear the breadcrumb even when the close throws: the manager frees the slot
@@ -162,6 +299,10 @@ export class DebugService {
162
299
  this.#clearTimeout();
163
300
  if (!this.#manager.has(this.#cwd))
164
301
  return;
302
+ // Nobody asked for this end, so nobody has read the results yet: retain the
303
+ // session (settled + closed) so `get_findings` still serves them. Captured
304
+ // before the close, so even a failing teardown leaves the findings reachable.
305
+ this.#retained = this.#manager.get(this.#cwd);
165
306
  // Same contract as `end()`: the breadcrumb clears even when the close throws.
166
307
  try {
167
308
  await this.#manager.end(this.#cwd);
@@ -170,6 +311,36 @@ export class DebugService {
170
311
  await this.#state.clear();
171
312
  }
172
313
  }
314
+ /**
315
+ * Resolve the session a read names: the active run, or — once the manager is
316
+ * empty — the retained snapshot of the last auto-ended run, so a timed-out run's
317
+ * partial findings stay readable by their id until `end_session` or the next
318
+ * `start_debug`. A different id still fails loud.
319
+ */
320
+ #requireReadable(session_id) {
321
+ const retained = this.#retained;
322
+ if (retained === undefined || this.#manager.has(this.#cwd)) {
323
+ return this.#require(session_id);
324
+ }
325
+ if (retained.id !== session_id) {
326
+ throw new SessionNotFoundError(`No active debug session '${session_id}' for '${this.#cwd}' (the last run '${retained.id}' ` +
327
+ 'has ended; its findings are still readable under that id).');
328
+ }
329
+ return retained;
330
+ }
331
+ /**
332
+ * Forget the retained snapshot when the caller's `end_session` names it — the
333
+ * run is already torn down, so there is nothing left to close. Returns whether
334
+ * the id was the retained one (and it is now forgotten).
335
+ */
336
+ #forgetRetained(session_id) {
337
+ if (this.#manager.has(this.#cwd))
338
+ return false;
339
+ if (this.#retained?.id !== session_id)
340
+ return false;
341
+ this.#retained = undefined;
342
+ return true;
343
+ }
173
344
  /** Resolve the active session for this cwd, asserting its id matches the caller's. */
174
345
  #require(session_id) {
175
346
  const session = this.#manager.get(this.#cwd);
@@ -1 +1 @@
1
- {"version":3,"file":"debug-service.js","sourceRoot":"","sources":["../../src/services/debug-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,aAAa,EAAkB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,uFAAuF;AACvF,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC;AA+FlD,MAAM,OAAO,YAAY;IACd,QAAQ,CAA0B;IAClC,OAAO,CAAiB;IACxB,IAAI,CAAS;IACb,MAAM,CAAiB;IACvB,MAAM,CAAY;IAClB,iBAAiB,CAAS;IAC1B,IAAI,CAAe;IAC5B,2EAA2E;IAC3E,MAAM,CAA4C;IAClD;;;;;OAKG;IACH,SAAS,GAAG,KAAK,CAAC;IAElB,YAAY,IAAsB;QAChC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,IAAI,aAAa,CAAC;QAC1C,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,IAAI,0BAA0B,CAAC;QAC7E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GA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c,CAAC,IAAY,EAAE,MAAc;IAClD,MAAM,IAAI,GAAe;QACvB,IAAI;QACJ,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;QAC7C,WAAW,EAAE,IAAI;KAClB,CAAC;IACF,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;IACjE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -13,7 +13,7 @@
13
13
  * leaks a launched browser. The builder stays adapter- and model-blind past this
14
14
  * seam; swapping the driver model or the target never touches the service.
15
15
  */
16
- import type { LanguageModel } from 'ai';
16
+ import type { LanguageModel, Tool } from 'ai';
17
17
  import type { ResolvedConfig } from '../config/load.js';
18
18
  import type { Target } from '../config/schema.js';
19
19
  import { type LoopRunner, Session } from '../session/session.js';
@@ -51,13 +51,22 @@ export interface BuildSessionParams {
51
51
  criteria?: string;
52
52
  /** Per-run URL the caller points the driver at (web); overrides the target's configured url. */
53
53
  url?: string;
54
+ /**
55
+ * The run's remaining wall-clock budget (ms) at build time. Assembly happens inside
56
+ * the caller's `timeout`, so the launch/connect wait shortens to fit it.
57
+ */
58
+ timeoutMs?: number;
54
59
  }
55
60
  /** A built-but-unregistered session plus the seams the service fires post-lock. */
56
61
  export interface BuiltSession {
57
62
  /** Ready to register with the manager; not yet opened or started. */
58
63
  session: Session;
59
- /** Navigate the adapter to the target (launches/attaches the browser page). */
60
- open(): Promise<void>;
64
+ /**
65
+ * Navigate the adapter to the target (launches/attaches the browser page).
66
+ * `timeoutMs` is the run's budget left AFTER the build — the first navigation
67
+ * spends the caller's cap, never a fresh one of its own.
68
+ */
69
+ open(timeoutMs?: number): Promise<void>;
61
70
  /** The background loop runner handed to `session.start()`. */
62
71
  run: LoopRunner;
63
72
  }
@@ -65,6 +74,14 @@ export interface BuiltSession {
65
74
  export type SessionBuilder = (params: BuildSessionParams) => Promise<BuiltSession>;
66
75
  /** Bind {@link buildSession} to its shared deps, yielding the per-run {@link SessionBuilder}. */
67
76
  export declare function makeSessionBuilder(deps: SessionBuilderDeps): SessionBuilder;
77
+ /**
78
+ * Wrap a belt tool so every call records its input to `logs/agent.log`, and any
79
+ * thrown error is logged before it propagates — otherwise a belt failure (e.g. a
80
+ * selector that resolves nothing) is invisible: the SDK feeds it back to the model
81
+ * as a tool-error and the run just churns. The wrapper is transparent: same
82
+ * input/output, it only observes.
83
+ */
84
+ export declare function withToolLog(name: string, t: Tool, log: (line: string) => void): Tool;
68
85
  /**
69
86
  * Apply the caller's per-run `url` over the configured target (web only), and
70
87
  * require that a web target ends up with *some* URL. Lets the boss point the
@@ -13,17 +13,19 @@
13
13
  * leaks a launched browser. The builder stays adapter- and model-blind past this
14
14
  * seam; swapping the driver model or the target never touches the service.
15
15
  */
16
+ import { mkdir, writeFile } from 'node:fs/promises';
16
17
  import { createAdapter } from '../adapters/factory.js';
17
18
  import { createActTool } from '../agent/belt/act.js';
18
19
  import { createLookTool, createSelfLookTool } from '../agent/belt/look.js';
19
20
  import { createObserveTool } from '../agent/belt/observe.js';
20
21
  import { createReportTool } from '../agent/belt/report.js';
22
+ import { createActTrail } from '../agent/belt/trail.js';
21
23
  import { createDebugAgent, runDebugLoop } from '../agent/loop.js';
22
24
  import { composeSystemPrompt } from '../agent/prompts/compose.js';
23
25
  import { ConfigError, TargetNotFoundError } from '../errors.js';
24
26
  import { FindingsStore } from '../session/findings-store.js';
25
27
  import { Session } from '../session/session.js';
26
- import { ensureSession, sessionPaths } from '../session/workspace.js';
28
+ import { ensureSession, resolveProfileDir, sessionPaths, } from '../session/workspace.js';
27
29
  import { createReplayStep } from './replay.js';
28
30
  import { createSummarize } from './summarize.js';
29
31
  /** Bind {@link buildSession} to its shared deps, yielding the per-run {@link SessionBuilder}. */
@@ -47,7 +49,7 @@ function compactInput(input) {
47
49
  * as a tool-error and the run just churns. The wrapper is transparent: same
48
50
  * input/output, it only observes.
49
51
  */
50
- function withToolLog(name, t, log) {
52
+ export function withToolLog(name, t, log) {
51
53
  const original = t.execute;
52
54
  if (!original)
53
55
  return t;
@@ -115,6 +117,17 @@ function splitCriteria(criteria) {
115
117
  .filter((line) => line.length > 0);
116
118
  return lines.length > 0 ? lines : undefined;
117
119
  }
120
+ /**
121
+ * Render `sessions/<id>/story.md` — the human-readable record of what this run was
122
+ * asked to do, so a person poking through the workspace after the fact doesn't have
123
+ * to reconstruct the goal from `findings.json` alone.
124
+ */
125
+ function renderStoryMd(target, goal, criteriaLines) {
126
+ const criteriaBlock = criteriaLines
127
+ ? criteriaLines.map((line) => `- ${line}`).join('\n')
128
+ : '(none)';
129
+ return `# Story\n\n**Target:** ${target}\n\n## Goal\n\n${goal}\n\n## Criteria\n\n${criteriaBlock}\n`;
130
+ }
118
131
  /**
119
132
  * Assemble a debug run: adapter + belt + composed prompt + loop runner, all bound
120
133
  * to a fresh {@link FindingsStore}. Throws {@link TargetNotFoundError} if `target`
@@ -137,15 +150,29 @@ export async function buildSession(deps, params) {
137
150
  const addendum = addendumTarget(targetConfig.adapter);
138
151
  const paths = sessionPaths(workspace, id);
139
152
  await ensureSession(paths);
153
+ const criteriaLines = splitCriteria(criteria);
154
+ await writeFile(paths.storyMd, renderStoryMd(target, goal, criteriaLines), 'utf8');
140
155
  const store = new FindingsStore(paths);
141
156
  const onLog = (channel, line) => {
142
157
  void store.appendLog(channel, line).catch(() => undefined);
143
158
  };
144
- const adapter = await createAdapter(target, effectiveConfig, workspace.chromeUserData, onLog);
159
+ // `profile` is a browser-target key — no other adapter has a profile dir. A managed
160
+ // launch lives in it; attach ignores it (that browser keeps its own state).
161
+ // `ensureWorkspace` pre-creates only the default dir, so a custom one is made here.
162
+ const profile = targetConfig.adapter === 'browser' ? targetConfig.profile : undefined;
163
+ const profileDir = resolveProfileDir(workspace, profile);
164
+ if (profile)
165
+ await mkdir(profileDir, { recursive: true });
166
+ const adapter = await createAdapter(target, effectiveConfig, profileDir, onLog, params.timeoutMs);
167
+ // The prompt's eye mode MUST match the `look` tool bound below — self-look tells
168
+ // the driver to judge the attached frame itself; the vision variant tells it to ask
169
+ // the vision guy (and how to cope when that model turns out to be text-only).
170
+ const selfLook = models.selfLook === true;
145
171
  const instructions = composeSystemPrompt({
146
172
  target: addendum,
147
173
  story: goal,
148
- criteria: splitCriteria(criteria),
174
+ criteria: criteriaLines,
175
+ selfLook,
149
176
  });
150
177
  const appendAgentLog = (line) => store.appendLog('agent', `${new Date().toISOString()} ${line}`);
151
178
  // High-frequency, fire-and-forget: the agent's own log sink + per-step tool logs.
@@ -164,25 +191,28 @@ export async function buildSession(deps, params) {
164
191
  }
165
192
  };
166
193
  const run = async ({ inbox, progress, signal }) => {
167
- // One trail per run, shared between the loop (which appends each act step) and
168
- // the `report` tool (which overlays it as the verdict's authoritative steps), so
169
- // the persisted findings and the returned counts derive from the same object.
170
- const trail = [];
194
+ // One trail per run, shared between the `act` tool (which records every step as
195
+ // it finishes, `ok: false` included), the loop (which snapshots it into each
196
+ // running flush) and the `report` tool (which merges it with the driver's
197
+ // reported steps), so the persisted findings and the returned counts derive from
198
+ // the same object. `report` reads it through `settled()`, so an act racing it in
199
+ // the SAME step still makes the verdict.
200
+ const trail = createActTrail();
171
201
  const agent = createDebugAgent({
172
202
  model: models.driver,
173
203
  tools: {
174
204
  observe: withToolLog('observe', createObserveTool(adapter, store), logAgent),
175
- act: withToolLog('act', createActTool(adapter, store), logAgent),
176
- look: withToolLog('look', models.selfLook
205
+ act: withToolLog('act', createActTool(adapter, store, trail), logAgent),
206
+ look: withToolLog('look', selfLook
177
207
  ? createSelfLookTool(adapter, store)
178
208
  : createLookTool(adapter, models.vision, store), logAgent),
179
- report: withToolLog('report', createReportTool(store, () => trail), logAgent),
209
+ report: withToolLog('report', createReportTool(store, () => trail.settled()), logAgent),
180
210
  },
181
211
  instructions,
182
212
  inbox,
183
213
  progress,
184
214
  log: logAgent,
185
- trail,
215
+ trail: trail.steps,
186
216
  });
187
217
  await flushAgentLog(`run start: target=${target} goal=${JSON.stringify(goal)}`);
188
218
  try {
@@ -217,7 +247,7 @@ export async function buildSession(deps, params) {
217
247
  });
218
248
  return {
219
249
  session,
220
- open: () => adapter.open(openAddress(targetConfig)),
250
+ open: (timeoutMs) => adapter.open(openAddress(targetConfig), timeoutMs),
221
251
  run,
222
252
  };
223
253
  }
@@ -1 +1 @@
1
- {"version":3,"file":"session-builder.js","sourceRoot":"","sources":["../../src/services/session-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAmB,MAAM,6BAA6B,CAAC;AAGnF,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAmB,OAAO,EAAuB,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAuB,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAoDjD,iGAAiG;AACjG,MAAM,UAAU,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CAAC;YACb,+EAA+E;YAC/E,iFAAiF;YACjF,mEAAmE;YACnE,MAAM,aAAa,CACjB,cAAc,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACnF,CAAC;YACF,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;gBACtC,MAAM,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACpE,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,IAAI,OAAO,CAAiB;QAC1C,EAAE;QACF,KAAK,EAAE,IAAI;QACX,QAAQ;QACR,OAAO;QACP,aAAa,EAAE,KAAK;QACpB,8EAA8E;QAC9E,sEAAsE;QACtE,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC;QAC1C,uEAAuE;QACvE,gFAAgF;QAChF,sFAAsF;QACtF,MAAM,EAAE,gBAAgB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;KACzF,CAAC,CAAC;IAEH,OAAO;QACL,OAAO;QACP,IAAI,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC;QACvE,GAAG;KACJ,CAAC;AACJ,CAAC"}
@@ -41,7 +41,7 @@ export type SummaryGenerate = (req: SummaryRequest) => Promise<{
41
41
  * reply to one tight, actionable paragraph so any competent text model behaves the
42
42
  * same (never relies on a 3rd-party default).
43
43
  */
44
- export declare const SUMMARY_SYSTEM_PROMPT = "You are the summary guy \u2014 you condense a UI debug run into one paragraph for the\nsmart agent that will fix the code.\nYou are given the run's verdict plus every functional bug and visual issue it found.\nWrite ONE plain-text paragraph (no markdown, no lists, no headings, no preamble) that\nstates the verdict, then what broke, where, and what to fix \u2014 concrete and ordered by\nseverity. If nothing broke, say so plainly. Output only the paragraph.";
44
+ export declare const SUMMARY_SYSTEM_PROMPT = "You are the summary guy \u2014 you condense a UI debug run into one paragraph for the\nsmart agent that will fix the code.\nYou are given the run's verdict plus every functional bug and visual issue it found.\nWrite ONE plain-text paragraph (no markdown, no lists, no headings, no preamble) that\nstates the verdict, then what broke, where, and what to fix \u2014 concrete and ordered by\nseverity. If nothing broke, say so plainly. Output only the paragraph.\n\nReport ONLY what the findings below contain. Never infer or invent a cause that is not\nthere: no crashes, exceptions, missing dependencies or build problems unless a bug or\nconsole error in the input actually says so. A \"failed\" verdict with no bugs listed\nmeans the run did not reach a conclusion \u2014 say exactly that, and do not diagnose it.\nSpeculation here is worse than silence: it sends the smart agent chasing a bug that\ndoes not exist.";
45
45
  /**
46
46
  * Render the findings into the compact, plain-text digest the summary model reasons
47
47
  * over: the verdict, then the functional bugs and visual issues (or "none").
@@ -32,7 +32,14 @@ smart agent that will fix the code.
32
32
  You are given the run's verdict plus every functional bug and visual issue it found.
33
33
  Write ONE plain-text paragraph (no markdown, no lists, no headings, no preamble) that
34
34
  states the verdict, then what broke, where, and what to fix — concrete and ordered by
35
- severity. If nothing broke, say so plainly. Output only the paragraph.`;
35
+ severity. If nothing broke, say so plainly. Output only the paragraph.
36
+
37
+ Report ONLY what the findings below contain. Never infer or invent a cause that is not
38
+ there: no crashes, exceptions, missing dependencies or build problems unless a bug or
39
+ console error in the input actually says so. A "failed" verdict with no bugs listed
40
+ means the run did not reach a conclusion — say exactly that, and do not diagnose it.
41
+ Speculation here is worse than silence: it sends the smart agent chasing a bug that
42
+ does not exist.`;
36
43
  /** One functional bug, rendered for the digest. */
37
44
  function bugLine(bug) {
38
45
  const evidence = bug.evidence ? ` (evidence: ${bug.evidence})` : '';
@@ -1 +1 @@
1
- {"version":3,"file":"summarize.js","sourceRoot":"","sources":["../../src/services/summarize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAkB1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;uEAMkC,CAAC;AAExE,mDAAmD;AACnD,SAAS,OAAO,CAAC,GAA6B;IAC5C,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACpE,OAAO,MAAM,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;AACpD,CAAC;AAED,iDAAiD;AACjD,SAAS,UAAU,CAAC,KAAiC;IACnD,OAAO,MAAM,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,KAAK,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,QAAkB;IAC/C,MAAM,KAAK,GAAa,CAAC,YAAY,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAEzD,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,oBAAoB,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1F,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,CAAC,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AAM,CAAC,CAAC;AACrE,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Atomic file replace — how every cross-process file in the workspace is written.
3
+ *
4
+ * `state.json` and `findings.json` are read by processes other than the writer:
5
+ * `ui-debugger-mcp status` / `stop` run out-of-band, and a second server checks
6
+ * the breadcrumb through {@link FileStatePort.foreignRun}. A plain `writeFile`
7
+ * truncates first, so a reader that lands mid-write sees an empty or half-written
8
+ * file — and both readers treat that as "no run" / "corrupt findings". Writing a
9
+ * temp file and `rename(2)`-ing it into place is atomic on the same filesystem:
10
+ * a reader sees either the old bytes or the new ones, never a torn mix.
11
+ *
12
+ * The temp name carries the writer's pid plus a per-process counter, because the
13
+ * same target can have several writers at once (the server and a CLI invocation,
14
+ * or two {@link FindingsStore} instances on one session dir). A shared `.tmp`
15
+ * suffix would let one writer rename another's half-written bytes into place.
16
+ */
17
+ /**
18
+ * Replace `path` with `contents` atomically (temp file + rename).
19
+ *
20
+ * The parent directory must already exist — callers own that (they create more
21
+ * than just this file's dir). A failed write leaves no temp file behind and
22
+ * rethrows: the original file is untouched, so the failure is never silent.
23
+ */
24
+ export declare function writeFileAtomic(path: string, contents: string): Promise<void>;