@developerz.ai/ui-debugger-mcp 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -47
- package/dist/adapters/android/abortable.d.ts +6 -0
- package/dist/adapters/android/abortable.js +22 -0
- package/dist/adapters/android/abortable.js.map +1 -0
- package/dist/adapters/android/adb.d.ts +19 -7
- package/dist/adapters/android/adb.js +50 -13
- package/dist/adapters/android/adb.js.map +1 -1
- package/dist/adapters/android/android-adapter.d.ts +20 -12
- package/dist/adapters/android/android-adapter.js +113 -165
- package/dist/adapters/android/android-adapter.js.map +1 -1
- package/dist/adapters/android/commands.d.ts +10 -0
- package/dist/adapters/android/commands.js +22 -0
- package/dist/adapters/android/commands.js.map +1 -1
- package/dist/adapters/android/emulator.d.ts +41 -0
- package/dist/adapters/android/emulator.js +115 -0
- package/dist/adapters/android/emulator.js.map +1 -0
- package/dist/adapters/android/logcat.d.ts +87 -0
- package/dist/adapters/android/logcat.js +352 -0
- package/dist/adapters/android/logcat.js.map +1 -0
- package/dist/adapters/android/ports.js.map +1 -1
- package/dist/adapters/android/sdk.d.ts +65 -0
- package/dist/adapters/android/sdk.js +107 -0
- package/dist/adapters/android/sdk.js.map +1 -0
- package/dist/adapters/android/uiautomator.d.ts +23 -7
- package/dist/adapters/android/uiautomator.js +31 -7
- package/dist/adapters/android/uiautomator.js.map +1 -1
- package/dist/adapters/availability.d.ts +39 -0
- package/dist/adapters/availability.js +62 -0
- package/dist/adapters/availability.js.map +1 -0
- package/dist/adapters/browser/browser-adapter.d.ts +11 -22
- package/dist/adapters/browser/browser-adapter.js +90 -71
- package/dist/adapters/browser/browser-adapter.js.map +1 -1
- package/dist/adapters/browser/cdp.d.ts +22 -17
- package/dist/adapters/browser/cdp.js +118 -72
- package/dist/adapters/browser/cdp.js.map +1 -1
- package/dist/adapters/browser/exchange-read.d.ts +39 -0
- package/dist/adapters/browser/exchange-read.js +102 -0
- package/dist/adapters/browser/exchange-read.js.map +1 -0
- package/dist/adapters/browser/extractor.js +9 -2
- package/dist/adapters/browser/extractor.js.map +1 -1
- package/dist/adapters/browser/filters.d.ts +1 -1
- package/dist/adapters/browser/filters.js.map +1 -1
- package/dist/adapters/browser/geometry.js.map +1 -1
- package/dist/adapters/browser/launch.d.ts +14 -5
- package/dist/adapters/browser/launch.js +14 -5
- package/dist/adapters/browser/launch.js.map +1 -1
- package/dist/adapters/browser/lifecycle.d.ts +91 -0
- package/dist/adapters/browser/lifecycle.js +141 -0
- package/dist/adapters/browser/lifecycle.js.map +1 -0
- package/dist/adapters/browser/locate.d.ts +18 -2
- package/dist/adapters/browser/locate.js +48 -3
- package/dist/adapters/browser/locate.js.map +1 -1
- package/dist/adapters/browser/log-filters.d.ts +2 -2
- package/dist/adapters/browser/log-filters.js +15 -4
- package/dist/adapters/browser/log-filters.js.map +1 -1
- package/dist/adapters/browser/log-format.d.ts +23 -20
- package/dist/adapters/browser/log-format.js +133 -56
- package/dist/adapters/browser/log-format.js.map +1 -1
- package/dist/adapters/browser/tab-context.d.ts +30 -0
- package/dist/adapters/browser/tab-context.js +41 -0
- package/dist/adapters/browser/tab-context.js.map +1 -0
- package/dist/adapters/contract.d.ts +113 -10
- package/dist/adapters/contract.js +7 -2
- package/dist/adapters/contract.js.map +1 -1
- package/dist/adapters/desktop/atspi-busctl.d.ts +26 -0
- package/dist/adapters/desktop/atspi-busctl.js +332 -0
- package/dist/adapters/desktop/atspi-busctl.js.map +1 -0
- package/dist/adapters/desktop/atspi-parse.d.ts +39 -0
- package/dist/adapters/desktop/atspi-parse.js +155 -0
- package/dist/adapters/desktop/atspi-parse.js.map +1 -0
- package/dist/adapters/desktop/atspi.d.ts +81 -50
- package/dist/adapters/desktop/atspi.js +64 -285
- package/dist/adapters/desktop/atspi.js.map +1 -1
- package/dist/adapters/desktop/capture.d.ts +11 -20
- package/dist/adapters/desktop/capture.js +68 -37
- package/dist/adapters/desktop/capture.js.map +1 -1
- package/dist/adapters/desktop/desktop-adapter.d.ts +22 -2
- package/dist/adapters/desktop/desktop-adapter.js +202 -86
- package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
- package/dist/adapters/desktop/input.d.ts +19 -5
- package/dist/adapters/desktop/input.js +29 -13
- package/dist/adapters/desktop/input.js.map +1 -1
- package/dist/adapters/desktop/managed-app.d.ts +43 -0
- package/dist/adapters/desktop/managed-app.js +114 -0
- package/dist/adapters/desktop/managed-app.js.map +1 -0
- package/dist/adapters/desktop/proc.d.ts +34 -4
- package/dist/adapters/desktop/proc.js +37 -6
- package/dist/adapters/desktop/proc.js.map +1 -1
- package/dist/adapters/desktop/wait-poll.d.ts +17 -0
- package/dist/adapters/desktop/wait-poll.js +38 -0
- package/dist/adapters/desktop/wait-poll.js.map +1 -0
- package/dist/adapters/factory.d.ts +13 -6
- package/dist/adapters/factory.js +30 -4
- package/dist/adapters/factory.js.map +1 -1
- package/dist/adapters/log-format.d.ts +38 -0
- package/dist/adapters/log-format.js +47 -0
- package/dist/adapters/log-format.js.map +1 -0
- package/dist/agent/belt/act.d.ts +426 -23
- package/dist/agent/belt/act.js +44 -64
- package/dist/agent/belt/act.js.map +1 -1
- package/dist/agent/belt/look.d.ts +479 -16
- package/dist/agent/belt/look.js +94 -16
- package/dist/agent/belt/look.js.map +1 -1
- package/dist/agent/belt/observe.d.ts +652 -65
- package/dist/agent/belt/observe.js +119 -231
- package/dist/agent/belt/observe.js.map +1 -1
- package/dist/agent/belt/redact-output.d.ts +20 -0
- package/dist/agent/belt/redact-output.js +70 -0
- package/dist/agent/belt/redact-output.js.map +1 -0
- package/dist/agent/belt/report.d.ts +754 -48
- package/dist/agent/belt/report.js +121 -38
- package/dist/agent/belt/report.js.map +1 -1
- package/dist/agent/belt/same-origin.d.ts +21 -0
- package/dist/agent/belt/same-origin.js +38 -0
- package/dist/agent/belt/same-origin.js.map +1 -0
- package/dist/agent/belt/target-refs.d.ts +39 -0
- package/dist/agent/belt/target-refs.js +60 -0
- package/dist/agent/belt/target-refs.js.map +1 -0
- package/dist/agent/belt/trail.d.ts +44 -16
- package/dist/agent/belt/trail.js +46 -11
- package/dist/agent/belt/trail.js.map +1 -1
- package/dist/agent/belt/tree-targets.d.ts +79 -0
- package/dist/agent/belt/tree-targets.js +242 -0
- package/dist/agent/belt/tree-targets.js.map +1 -0
- package/dist/agent/capabilities.js.map +1 -1
- package/dist/agent/fallback.d.ts +33 -0
- package/dist/agent/fallback.js +84 -0
- package/dist/agent/fallback.js.map +1 -0
- package/dist/agent/loop-frames.d.ts +26 -0
- package/dist/agent/loop-frames.js +106 -0
- package/dist/agent/loop-frames.js.map +1 -0
- package/dist/agent/loop.d.ts +56 -65
- package/dist/agent/loop.js +122 -189
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/models.d.ts +10 -6
- package/dist/agent/models.js +15 -9
- package/dist/agent/models.js.map +1 -1
- package/dist/agent/prompts/compose.d.ts +1 -1
- package/dist/agent/prompts/debug-agent.js +48 -10
- package/dist/agent/prompts/debug-agent.js.map +1 -1
- package/dist/agent/prompts/web-addendum.d.ts +2 -2
- package/dist/agent/prompts/web-addendum.js +26 -25
- package/dist/agent/prompts/web-addendum.js.map +1 -1
- package/dist/agent/provider.d.ts +41 -1
- package/dist/agent/provider.js +59 -5
- package/dist/agent/provider.js.map +1 -1
- package/dist/boot.d.ts +64 -0
- package/dist/boot.js +147 -0
- package/dist/boot.js.map +1 -0
- package/dist/cli/chromium-libs.d.ts +267 -0
- package/dist/cli/chromium-libs.js +546 -0
- package/dist/cli/chromium-libs.js.map +1 -0
- package/dist/cli/control.js +79 -12
- package/dist/cli/control.js.map +1 -1
- package/dist/cli/init.d.ts +52 -3
- package/dist/cli/init.js +62 -10
- package/dist/cli/init.js.map +1 -1
- package/dist/config/load.d.ts +25 -8
- package/dist/config/load.js +50 -13
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +18 -6
- package/dist/config/schema.js +34 -17
- package/dist/config/schema.js.map +1 -1
- package/dist/errors.d.ts +30 -15
- package/dist/errors.js +49 -30
- package/dist/errors.js.map +1 -1
- package/dist/findings/schema.d.ts +44 -6
- package/dist/findings/schema.js +39 -3
- package/dist/findings/schema.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +4 -82
- package/dist/main.js.map +1 -1
- package/dist/mcp/server.js +10 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/describe.d.ts +5 -4
- package/dist/mcp/tools/describe.js +14 -10
- package/dist/mcp/tools/describe.js.map +1 -1
- package/dist/mcp/tools/end-session.d.ts +3 -1
- package/dist/mcp/tools/end-session.js +8 -3
- package/dist/mcp/tools/end-session.js.map +1 -1
- package/dist/mcp/tools/output.d.ts +12 -4
- package/dist/mcp/tools/output.js +15 -2
- package/dist/mcp/tools/output.js.map +1 -1
- package/dist/mcp/tools/result.d.ts +10 -1
- package/dist/mcp/tools/result.js +12 -7
- package/dist/mcp/tools/result.js.map +1 -1
- package/dist/mcp/tools/start-debug.js +7 -5
- package/dist/mcp/tools/start-debug.js.map +1 -1
- package/dist/redact.d.ts +44 -0
- package/dist/redact.js +166 -0
- package/dist/redact.js.map +1 -0
- package/dist/services/auth-persona.d.ts +19 -0
- package/dist/services/auth-persona.js +32 -0
- package/dist/services/auth-persona.js.map +1 -0
- package/dist/services/catalog.d.ts +28 -0
- package/dist/services/catalog.js +65 -0
- package/dist/services/catalog.js.map +1 -0
- package/dist/services/debug-api.d.ts +179 -0
- package/dist/services/debug-api.js +9 -0
- package/dist/services/debug-api.js.map +1 -0
- package/dist/services/debug-service.d.ts +26 -174
- package/dist/services/debug-service.js +159 -227
- package/dist/services/debug-service.js.map +1 -1
- package/dist/services/foreign-findings.d.ts +22 -0
- package/dist/services/foreign-findings.js +38 -0
- package/dist/services/foreign-findings.js.map +1 -0
- package/dist/services/login-failure.d.ts +10 -0
- package/dist/services/login-failure.js +24 -0
- package/dist/services/login-failure.js.map +1 -0
- package/dist/services/login-selectors.d.ts +18 -0
- package/dist/services/login-selectors.js +44 -0
- package/dist/services/login-selectors.js.map +1 -0
- package/dist/services/login-session.d.ts +25 -0
- package/dist/services/login-session.js +59 -0
- package/dist/services/login-session.js.map +1 -0
- package/dist/services/login.d.ts +16 -29
- package/dist/services/login.js +269 -97
- package/dist/services/login.js.map +1 -1
- package/dist/services/replay.js +15 -3
- package/dist/services/replay.js.map +1 -1
- package/dist/services/retained-snapshot.d.ts +36 -0
- package/dist/services/retained-snapshot.js +63 -0
- package/dist/services/retained-snapshot.js.map +1 -0
- package/dist/services/session-builder.d.ts +26 -0
- package/dist/services/session-builder.js +63 -21
- package/dist/services/session-builder.js.map +1 -1
- package/dist/services/shutdown.d.ts +8 -4
- package/dist/services/shutdown.js +21 -8
- package/dist/services/shutdown.js.map +1 -1
- package/dist/services/start-guards.d.ts +37 -0
- package/dist/services/start-guards.js +61 -0
- package/dist/services/start-guards.js.map +1 -0
- package/dist/services/summarize.d.ts +12 -3
- package/dist/services/summarize.js +13 -5
- package/dist/services/summarize.js.map +1 -1
- package/dist/session/cleanup.d.ts +3 -2
- package/dist/session/cleanup.js +6 -2
- package/dist/session/cleanup.js.map +1 -1
- package/dist/session/finalize.d.ts +45 -0
- package/dist/session/finalize.js +150 -0
- package/dist/session/finalize.js.map +1 -0
- package/dist/session/findings-store.d.ts +2 -1
- package/dist/session/findings-store.js +30 -2
- package/dist/session/findings-store.js.map +1 -1
- package/dist/session/flock-backend.d.ts +117 -0
- package/dist/session/flock-backend.js +293 -0
- package/dist/session/flock-backend.js.map +1 -0
- package/dist/session/live-pointer.d.ts +19 -0
- package/dist/session/live-pointer.js +41 -0
- package/dist/session/live-pointer.js.map +1 -0
- package/dist/session/manager.d.ts +11 -1
- package/dist/session/manager.js +46 -2
- package/dist/session/manager.js.map +1 -1
- package/dist/session/owner-lock.d.ts +117 -0
- package/dist/session/owner-lock.js +218 -0
- package/dist/session/owner-lock.js.map +1 -0
- package/dist/session/process-identity.js.map +1 -1
- package/dist/session/session.js +40 -109
- package/dist/session/session.js.map +1 -1
- package/dist/session/state-file.d.ts +74 -14
- package/dist/session/state-file.js +211 -21
- package/dist/session/state-file.js.map +1 -1
- package/dist/session/workspace.d.ts +32 -2
- package/dist/session/workspace.js +65 -4
- package/dist/session/workspace.js.map +1 -1
- package/package.json +11 -11
- package/dist/adapters/android/android-adapter.test-helpers.d.ts +0 -52
- package/dist/adapters/android/android-adapter.test-helpers.js +0 -115
- package/dist/adapters/android/android-adapter.test-helpers.js.map +0 -1
- package/dist/mcp/server.test-helpers.d.ts +0 -23
- package/dist/mcp/server.test-helpers.js +0 -49
- package/dist/mcp/server.test-helpers.js.map +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The retained snapshot — the last run that ended WITHOUT the caller asking.
|
|
3
|
+
*
|
|
4
|
+
* A run that auto-ends (wall-clock timeout, SIGTERM, the MCP client dying) is
|
|
5
|
+
* torn down, but its findings must not vanish with it: the settled session is
|
|
6
|
+
* kept so `get_findings` still serves its terminal snapshot and `describe` can
|
|
7
|
+
* still name it. `end_session` is the explicit forget; the next `start_debug`
|
|
8
|
+
* supersedes it.
|
|
9
|
+
*
|
|
10
|
+
* Split out of `debug-service.ts` to keep that file under the 500-LOC cap. The
|
|
11
|
+
* slot is deliberately NOT a gate: a retained snapshot never blocks a start and
|
|
12
|
+
* never takes new work — the one-run rule stays with the manager.
|
|
13
|
+
*/
|
|
14
|
+
import { SessionNotFoundError } from '../errors.js';
|
|
15
|
+
/** The retained slot: one settled run, kept readable until it is forgotten. */
|
|
16
|
+
export class RetainedSnapshot {
|
|
17
|
+
/**
|
|
18
|
+
* The last run that auto-ended (timeout / SIGTERM / client death), kept settled
|
|
19
|
+
* and closed so `get_findings` can still read its partial findings + evidence.
|
|
20
|
+
* Dropped by `end_session` (the explicit forget) and superseded by the next run.
|
|
21
|
+
*/
|
|
22
|
+
#session;
|
|
23
|
+
/** Keep `session` as the retained snapshot — the run that auto-ended. */
|
|
24
|
+
retain(session) {
|
|
25
|
+
this.#session = session;
|
|
26
|
+
}
|
|
27
|
+
/** Forget the retained snapshot (the explicit `end_session` forget, or a superseding run). */
|
|
28
|
+
clear() {
|
|
29
|
+
this.#session = undefined;
|
|
30
|
+
}
|
|
31
|
+
/** The retained snapshot, or `undefined` when there is none. */
|
|
32
|
+
peek() {
|
|
33
|
+
return this.#session;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Forget the snapshot when `sessionId` names it — the run is already torn down,
|
|
37
|
+
* so there is nothing left to close. Returns whether the id WAS the retained one
|
|
38
|
+
* (and it is now forgotten).
|
|
39
|
+
*/
|
|
40
|
+
forget(sessionId) {
|
|
41
|
+
if (this.#session?.id !== sessionId)
|
|
42
|
+
return false;
|
|
43
|
+
this.#session = undefined;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The session a read names among the retained ones: the retained run itself, or
|
|
48
|
+
* a loud miss that names the run that IS readable — a caller holding a stale id
|
|
49
|
+
* must not be told the findings are gone when they are one id away.
|
|
50
|
+
*/
|
|
51
|
+
requireRetained(sessionId, cwd) {
|
|
52
|
+
const retained = this.#session;
|
|
53
|
+
if (retained === undefined) {
|
|
54
|
+
throw new SessionNotFoundError(`No active debug session '${sessionId}' for '${cwd}'.`);
|
|
55
|
+
}
|
|
56
|
+
if (retained.id !== sessionId) {
|
|
57
|
+
throw new SessionNotFoundError(`No active debug session '${sessionId}' for '${cwd}' (the last run '${retained.id}' ` +
|
|
58
|
+
'has ended; its findings are still readable under that id).');
|
|
59
|
+
}
|
|
60
|
+
return retained;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=retained-snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retained-snapshot.js","sourceRoot":"","sources":["../../src/services/retained-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGpD,+EAA+E;AAC/E,MAAM,OAAO,gBAAgB;IAC3B;;;;OAIG;IACH,QAAQ,CAAsB;IAE9B,yEAAyE;IACzE,MAAM,CAAC,OAAgB;QACrB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,8FAA8F;IAC9F,KAAK;QACH,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED,gEAAgE;IAChE,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAiB;QACtB,IAAI,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,SAAiB,EAAE,GAAW;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,oBAAoB,CAAC,4BAA4B,SAAS,UAAU,GAAG,IAAI,CAAC,CAAC;QACzF,CAAC;QACD,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,oBAAoB,CAC5B,4BAA4B,SAAS,UAAU,GAAG,oBAAoB,QAAQ,CAAC,EAAE,IAAI;gBACnF,4DAA4D,CAC/D,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
* seam; swapping the driver model or the target never touches the service.
|
|
15
15
|
*/
|
|
16
16
|
import type { LanguageModel, Tool } from 'ai';
|
|
17
|
+
import type { CaptureSink } from '../adapters/browser/cdp.js';
|
|
18
|
+
import { createAdapter } from '../adapters/factory.js';
|
|
17
19
|
import type { ResolvedConfig } from '../config/load.js';
|
|
18
20
|
import type { Target } from '../config/schema.js';
|
|
21
|
+
import { FindingsStore } from '../session/findings-store.js';
|
|
19
22
|
import { type LoopRunner, Session } from '../session/session.js';
|
|
20
23
|
import { type WorkspacePaths } from '../session/workspace.js';
|
|
21
24
|
/** The three actors the belt + loop + post-verdict step bind to, resolved once and shared across runs. */
|
|
@@ -38,6 +41,16 @@ export interface SessionBuilderDeps {
|
|
|
38
41
|
config: ResolvedConfig;
|
|
39
42
|
models: BuilderModels;
|
|
40
43
|
workspace: WorkspacePaths;
|
|
44
|
+
/**
|
|
45
|
+
* Adapter factory seam — the default is the real one ({@link createAdapter}),
|
|
46
|
+
* so every production caller is unchanged.
|
|
47
|
+
*
|
|
48
|
+
* A test injects a fake here to build a WEB target's session without a
|
|
49
|
+
* browser: `createAdapter` for a browser target LAUNCHES a headless Chromium,
|
|
50
|
+
* so asserting on what the builder wrote to disk used to need a browser
|
|
51
|
+
* binary on the machine.
|
|
52
|
+
*/
|
|
53
|
+
createAdapter?: typeof createAdapter;
|
|
41
54
|
}
|
|
42
55
|
/** The per-run inputs `start_debug` hands over. */
|
|
43
56
|
export interface BuildSessionParams {
|
|
@@ -85,6 +98,19 @@ export declare function makeSessionBuilder(deps: SessionBuilderDeps): SessionBui
|
|
|
85
98
|
* input/output, it only observes.
|
|
86
99
|
*/
|
|
87
100
|
export declare function withToolLog(name: string, t: Tool, log: (line: string) => void): Tool;
|
|
101
|
+
/**
|
|
102
|
+
* The run's durable capture sink: redact, THEN append to the session's log channel.
|
|
103
|
+
*
|
|
104
|
+
* One writer for every captured row, whoever produced it — the browser's CDP
|
|
105
|
+
* capture (console + network) and the android logcat drain alike. The adapters
|
|
106
|
+
* never touch disk; they hand lines to this seam and the session decides what
|
|
107
|
+
* lands in `logs/*.log`. Redaction happens HERE, on the way in, so no second
|
|
108
|
+
* (unredacted) path to the trail can exist.
|
|
109
|
+
*
|
|
110
|
+
* Fire-and-forget by design: a capture burst must never block the adapter that
|
|
111
|
+
* produced it, and a failed write must never fail the read that produced it.
|
|
112
|
+
*/
|
|
113
|
+
export declare function createCaptureSink(store: FindingsStore, redact: (line: string) => string): CaptureSink;
|
|
88
114
|
/**
|
|
89
115
|
* Apply the caller's per-run `url` over the configured target (web only), and
|
|
90
116
|
* require that a web target ends up with *some* URL. Lets the boss point the
|
|
@@ -15,21 +15,23 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
17
17
|
import { resolveTargetUrl } from '../adapters/browser/launch.js';
|
|
18
|
-
import { createSecretRedactor } from '../adapters/browser/log-format.js';
|
|
19
18
|
import { createAdapter } from '../adapters/factory.js';
|
|
20
19
|
import { createActTool } from '../agent/belt/act.js';
|
|
21
20
|
import { createLookTool, createSelfLookTool } from '../agent/belt/look.js';
|
|
22
21
|
import { createObserveTool } from '../agent/belt/observe.js';
|
|
22
|
+
import { withRedactedOutput } from '../agent/belt/redact-output.js';
|
|
23
23
|
import { createReportTool } from '../agent/belt/report.js';
|
|
24
24
|
import { createActTrail } from '../agent/belt/trail.js';
|
|
25
25
|
import { createDebugAgent, runDebugLoop } from '../agent/loop.js';
|
|
26
26
|
import { composeSystemPrompt } from '../agent/prompts/compose.js';
|
|
27
27
|
import { ConfigError, TargetNotFoundError } from '../errors.js';
|
|
28
|
+
import { createSecretRedactor } from '../redact.js';
|
|
28
29
|
import { pruneSessions, SESSION_RETENTION } from '../session/cleanup.js';
|
|
29
30
|
import { FindingsStore } from '../session/findings-store.js';
|
|
30
31
|
import { Session } from '../session/session.js';
|
|
31
32
|
import { ensureSession, resolveProfileDir, sessionPaths, } from '../session/workspace.js';
|
|
32
33
|
import { performLogin, resolveAuth } from './login.js';
|
|
34
|
+
import { redactFailure } from './login-failure.js';
|
|
33
35
|
import { createReplayStep } from './replay.js';
|
|
34
36
|
import { createSummarize } from './summarize.js';
|
|
35
37
|
/** Bind {@link buildSession} to its shared deps, yielding the per-run {@link SessionBuilder}. */
|
|
@@ -71,6 +73,23 @@ export function withToolLog(name, t, log) {
|
|
|
71
73
|
},
|
|
72
74
|
};
|
|
73
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The run's durable capture sink: redact, THEN append to the session's log channel.
|
|
78
|
+
*
|
|
79
|
+
* One writer for every captured row, whoever produced it — the browser's CDP
|
|
80
|
+
* capture (console + network) and the android logcat drain alike. The adapters
|
|
81
|
+
* never touch disk; they hand lines to this seam and the session decides what
|
|
82
|
+
* lands in `logs/*.log`. Redaction happens HERE, on the way in, so no second
|
|
83
|
+
* (unredacted) path to the trail can exist.
|
|
84
|
+
*
|
|
85
|
+
* Fire-and-forget by design: a capture burst must never block the adapter that
|
|
86
|
+
* produced it, and a failed write must never fail the read that produced it.
|
|
87
|
+
*/
|
|
88
|
+
export function createCaptureSink(store, redact) {
|
|
89
|
+
return (channel, line) => {
|
|
90
|
+
void store.appendLog(channel, redact(line)).catch(() => undefined);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
74
93
|
/** Map a config adapter kind to its prompt addendum target — one per shipped adapter. */
|
|
75
94
|
function addendumTarget(adapter) {
|
|
76
95
|
if (adapter === 'browser')
|
|
@@ -191,18 +210,21 @@ export async function buildSession(deps, params) {
|
|
|
191
210
|
// run's dir even if the clock moved backwards since the previous one.
|
|
192
211
|
await pruneSessions(workspace, { keep: SESSION_RETENTION, protect: id });
|
|
193
212
|
const criteriaLines = splitLines(criteria);
|
|
213
|
+
const notes = splitLines(targetConfig.notes);
|
|
194
214
|
const address = openAddress(targetConfig);
|
|
195
215
|
const origin = runOrigin(targetConfig);
|
|
196
216
|
await writeFile(paths.storyMd, renderStoryMd(target, address, goal, criteriaLines), 'utf8');
|
|
197
|
-
|
|
198
|
-
// Bound once, applied to EVERY durable log line this run writes. A persona's
|
|
217
|
+
// Bound once, applied to findings text and EVERY durable log line. A persona's
|
|
199
218
|
// values are typed into the app, so they come back at us through the form POST
|
|
200
219
|
// in `network.log` and through anything an adapter error quotes — the same
|
|
201
220
|
// posture `log-format.ts` already holds for credential headers and `?token=`.
|
|
202
221
|
const redact = createSecretRedactor(auth ? Object.values(auth.persona.fields) : []);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
222
|
+
// The store redacts findings TEXT on write; the sink redacts every captured
|
|
223
|
+
// row on its way in — one writer, one redaction gate.
|
|
224
|
+
const store = new FindingsStore(paths, redact);
|
|
225
|
+
// The run's ONE capture sink — the browser's CDP capture and the android logcat
|
|
226
|
+
// drain both stream into it, so every captured row is redacted on its way to disk.
|
|
227
|
+
const onLog = createCaptureSink(store, redact);
|
|
206
228
|
// `profile` is a browser-target key — no other adapter has a profile dir. A managed
|
|
207
229
|
// launch lives in it; attach ignores it (that browser keeps its own state).
|
|
208
230
|
// `ensureWorkspace` pre-creates only the default dir, so a custom one is made here.
|
|
@@ -210,7 +232,11 @@ export async function buildSession(deps, params) {
|
|
|
210
232
|
const profileDir = resolveProfileDir(workspace, profile);
|
|
211
233
|
if (profile)
|
|
212
234
|
await mkdir(profileDir, { recursive: true });
|
|
213
|
-
|
|
235
|
+
// The adapter factory seam: the real factory by default, a fake in tests that
|
|
236
|
+
// only care about what the builder WROTE (a web target's story.md) and not
|
|
237
|
+
// about the browser that would drive it.
|
|
238
|
+
const factory = deps.createAdapter ?? createAdapter;
|
|
239
|
+
const adapter = await factory(target, effectiveConfig, profileDir, onLog, params.timeoutMs);
|
|
214
240
|
// The prompt's eye mode MUST match the `look` tool bound below — self-look tells
|
|
215
241
|
// the driver to judge the attached frame itself; the vision variant tells it to ask
|
|
216
242
|
// the vision guy (and how to cope when that model turns out to be text-only).
|
|
@@ -226,7 +252,7 @@ export async function buildSession(deps, params) {
|
|
|
226
252
|
// The target's standing preconditions: config-level, so they are stated once
|
|
227
253
|
// here instead of re-pasted into every `goal`. Length is capped at the config
|
|
228
254
|
// boundary — this section rides along on every step.
|
|
229
|
-
notes
|
|
255
|
+
notes,
|
|
230
256
|
});
|
|
231
257
|
const appendAgentLog = (line) => store.appendLog('agent', redact(`${new Date().toISOString()} ${line}`));
|
|
232
258
|
// High-frequency, fire-and-forget: the agent's own log sink + per-step tool logs.
|
|
@@ -244,12 +270,14 @@ export async function buildSession(deps, params) {
|
|
|
244
270
|
// best-effort: logging must never break or mask the run
|
|
245
271
|
}
|
|
246
272
|
};
|
|
247
|
-
// One trail per run, shared between the
|
|
248
|
-
// it
|
|
249
|
-
//
|
|
250
|
-
//
|
|
251
|
-
//
|
|
252
|
-
// the
|
|
273
|
+
// One evidence trail per run, shared between the belt's tools (which record
|
|
274
|
+
// into it as they run: `act` records every step, `look` each flagged visual
|
|
275
|
+
// issue, `observe` each error-level console row — deduped, at tool time), the
|
|
276
|
+
// loop (which snapshots all three streams into each running flush) and the
|
|
277
|
+
// `report` tool (which merges all three with the driver's verdict), so the
|
|
278
|
+
// persisted findings and the returned counts derive from the same object.
|
|
279
|
+
// `report` reads it through `settled()`, so evidence gathered in the SAME step
|
|
280
|
+
// still makes the verdict.
|
|
253
281
|
//
|
|
254
282
|
// Built HERE rather than inside `run` because the pre-run login (`open`, below)
|
|
255
283
|
// happens first and has to land on the same trail: the driver did not do it, but
|
|
@@ -259,18 +287,18 @@ export async function buildSession(deps, params) {
|
|
|
259
287
|
const agent = createDebugAgent({
|
|
260
288
|
model: models.driver,
|
|
261
289
|
tools: {
|
|
262
|
-
observe: withToolLog('observe', createObserveTool(adapter, store), logAgent),
|
|
263
|
-
act: withToolLog('act', createActTool(adapter, store, trail, origin), logAgent),
|
|
290
|
+
observe: withToolLog('observe', createObserveTool(adapter, store, trail, redact), logAgent),
|
|
291
|
+
act: withToolLog('act', createActTool(adapter, store, trail, origin, redact), logAgent),
|
|
264
292
|
look: withToolLog('look', selfLook
|
|
265
293
|
? createSelfLookTool(adapter, store)
|
|
266
|
-
: createLookTool(adapter, models.vision, store), logAgent),
|
|
294
|
+
: withRedactedOutput(createLookTool(adapter, models.vision, store, trail, notes), redact), logAgent),
|
|
267
295
|
report: withToolLog('report', createReportTool(store, () => trail.settled()), logAgent),
|
|
268
296
|
},
|
|
269
297
|
instructions,
|
|
270
298
|
inbox,
|
|
271
299
|
progress,
|
|
272
300
|
log: logAgent,
|
|
273
|
-
trail
|
|
301
|
+
trail,
|
|
274
302
|
});
|
|
275
303
|
await flushAgentLog(`run start: target=${target} goal=${JSON.stringify(goal)}`);
|
|
276
304
|
try {
|
|
@@ -297,7 +325,7 @@ export async function buildSession(deps, params) {
|
|
|
297
325
|
findingsStore: store,
|
|
298
326
|
// Post-verdict seam: fills `findings.summary` over the summary model when the
|
|
299
327
|
// driver left it empty (best-effort; the session wraps it fail-soft).
|
|
300
|
-
summarize: createSummarize(models.summary),
|
|
328
|
+
summarize: createSummarize(models.summary, redact),
|
|
301
329
|
// Post-verdict seam: stitches the ordered screenshots into a captioned
|
|
302
330
|
// `replay.mp4` (ffmpeg) and records its path in `findings.evidence` for the PR.
|
|
303
331
|
// `log` surfaces an absent ffmpeg loud in `agent.log`; the step skips, never crashes.
|
|
@@ -306,13 +334,25 @@ export async function buildSession(deps, params) {
|
|
|
306
334
|
return {
|
|
307
335
|
session,
|
|
308
336
|
open: async (timeoutMs) => {
|
|
337
|
+
const opened = Date.now();
|
|
309
338
|
await adapter.open(openAddress(targetConfig), timeoutMs);
|
|
310
339
|
if (!auth)
|
|
311
340
|
return;
|
|
341
|
+
// The login gets what the first navigation LEFT of the budget, not the budget again.
|
|
342
|
+
const left = timeoutMs === undefined ? undefined : Math.max(0, timeoutMs - (Date.now() - opened));
|
|
312
343
|
// Out-of-band and BEFORE the loop: the driver never sees the credentials, and
|
|
313
344
|
// a login that cannot complete fails `start_debug` outright instead of handing
|
|
314
345
|
// back a run that will report every screen behind it as empty. See `login.ts`.
|
|
315
|
-
|
|
346
|
+
// Login awaits this sink so open() returns with its auth trail durable.
|
|
347
|
+
let steps;
|
|
348
|
+
try {
|
|
349
|
+
steps = await signIn(adapter, auth, targetConfig, flushAgentLog, left);
|
|
350
|
+
}
|
|
351
|
+
catch (err) {
|
|
352
|
+
// This failure IS the `start_debug` result, past every log sink — and it quotes
|
|
353
|
+
// the page it is stuck on, whose URL holds the password after a GET submit.
|
|
354
|
+
throw redactFailure(err, redact);
|
|
355
|
+
}
|
|
316
356
|
for (const step of steps)
|
|
317
357
|
trail.record(step);
|
|
318
358
|
},
|
|
@@ -321,9 +361,11 @@ export async function buildSession(deps, params) {
|
|
|
321
361
|
}
|
|
322
362
|
/** Run the persona's login against the opened target, anchoring `path` to the run's url. */
|
|
323
363
|
function signIn(adapter, auth, target, log, timeoutMs) {
|
|
324
|
-
const
|
|
364
|
+
const web = target.adapter === 'browser' ? target : undefined;
|
|
365
|
+
const base = web?.url;
|
|
325
366
|
return performLogin(adapter, {
|
|
326
367
|
...auth,
|
|
368
|
+
solePersona: Object.keys(web?.auth ?? {}).length === 1,
|
|
327
369
|
loginUrl: resolveTargetUrl(auth.persona.path, base),
|
|
328
370
|
timeoutMs,
|
|
329
371
|
log,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-builder.js","sourceRoot":"","sources":["../../src/services/session-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,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,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACx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AAc,EACd,GAA2B,EAC3B,SAAkB;IAElB,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9D,MAAM,IAAI,GAAG,GAAG,EAAE,GAAG,CAAC;IACtB,OAAO,YAAY,CAAC,OAAO,EAAE;QAC3B,GAAG,IAAI;QACP,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;QACtD,QAAQ,EAAE,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;QACnD,SAAS;QACT,GAAG;KACJ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -25,13 +25,17 @@ export interface ShutdownDeps {
|
|
|
25
25
|
exit: (code: number) => void;
|
|
26
26
|
/** Cap on the graceful wait; defaults to {@link SHUTDOWN_TIMEOUT_MS}. */
|
|
27
27
|
timeoutMs?: number;
|
|
28
|
-
/** Sink for the "gave up waiting"
|
|
28
|
+
/** Sink for the "gave up waiting" / "teardown failed" lines; defaults to `console.error`. */
|
|
29
29
|
warn?: (line: string) => void;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Build the shutdown handler: tear the run down, then exit with `code` — after
|
|
33
|
-
* `timeoutMs` at the very latest. Fire-and-forget (signal handlers are sync)
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* `timeoutMs` at the very latest. Fire-and-forget (signal handlers are sync).
|
|
34
|
+
*
|
|
35
|
+
* Single-flight: the FIRST invocation owns the teardown and its exit code; every
|
|
36
|
+
* later one is a no-op. A dying client closes stdin AND signals, so two triggers
|
|
37
|
+
* are the normal case — and `endActive` answers the second at once (the manager
|
|
38
|
+
* frees the slot before the close), which used to exit the process while the
|
|
39
|
+
* first teardown was still closing the browser and writing the verdict.
|
|
36
40
|
*/
|
|
37
41
|
export declare function createShutdown(deps: ShutdownDeps): (code: number) => void;
|
|
@@ -19,32 +19,45 @@
|
|
|
19
19
|
export const SHUTDOWN_TIMEOUT_MS = 10_000;
|
|
20
20
|
/**
|
|
21
21
|
* Build the shutdown handler: tear the run down, then exit with `code` — after
|
|
22
|
-
* `timeoutMs` at the very latest. Fire-and-forget (signal handlers are sync)
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* `timeoutMs` at the very latest. Fire-and-forget (signal handlers are sync).
|
|
23
|
+
*
|
|
24
|
+
* Single-flight: the FIRST invocation owns the teardown and its exit code; every
|
|
25
|
+
* later one is a no-op. A dying client closes stdin AND signals, so two triggers
|
|
26
|
+
* are the normal case — and `endActive` answers the second at once (the manager
|
|
27
|
+
* frees the slot before the close), which used to exit the process while the
|
|
28
|
+
* first teardown was still closing the browser and writing the verdict.
|
|
25
29
|
*/
|
|
26
30
|
export function createShutdown(deps) {
|
|
27
31
|
const timeoutMs = deps.timeoutMs ?? SHUTDOWN_TIMEOUT_MS;
|
|
28
32
|
const warn = deps.warn ?? ((line) => console.error(line));
|
|
33
|
+
let started = false;
|
|
29
34
|
return (code) => {
|
|
35
|
+
if (started)
|
|
36
|
+
return;
|
|
37
|
+
started = true;
|
|
30
38
|
let done = false;
|
|
31
|
-
const finish = (
|
|
39
|
+
const finish = () => {
|
|
32
40
|
if (done)
|
|
33
41
|
return;
|
|
34
42
|
done = true;
|
|
35
|
-
deps.exit(
|
|
43
|
+
deps.exit(code);
|
|
36
44
|
};
|
|
37
45
|
const timer = setTimeout(() => {
|
|
38
46
|
warn(`ui-debugger-mcp: graceful shutdown did not finish within ${timeoutMs}ms — exiting anyway. ` +
|
|
39
47
|
'The debug run may not have closed its target cleanly.');
|
|
40
|
-
finish(
|
|
48
|
+
finish();
|
|
41
49
|
}, timeoutMs);
|
|
42
50
|
deps
|
|
43
51
|
.endActive()
|
|
44
|
-
|
|
52
|
+
// Still exits — but a teardown that failed may have left its target up, and
|
|
53
|
+
// this process is about to be the last witness: say so before it goes.
|
|
54
|
+
.catch((error) => {
|
|
55
|
+
warn(`ui-debugger-mcp: teardown failed during shutdown — ${error instanceof Error ? error.message : String(error)}. ` +
|
|
56
|
+
'The debug run may not have closed its target cleanly.');
|
|
57
|
+
})
|
|
45
58
|
.finally(() => {
|
|
46
59
|
clearTimeout(timer);
|
|
47
|
-
finish(
|
|
60
|
+
finish();
|
|
48
61
|
});
|
|
49
62
|
};
|
|
50
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../../src/services/shutdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAc1C
|
|
1
|
+
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../../src/services/shutdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAc1C;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,IAAkB;IAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,mBAAmB,CAAC;IACxD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,OAAO,CAAC,IAAY,EAAE,EAAE;QACtB,IAAI,OAAO;YAAE,OAAO;QACpB,OAAO,GAAG,IAAI,CAAC;QACf,IAAI,IAAI,GAAG,KAAK,CAAC;QACjB,MAAM,MAAM,GAAG,GAAG,EAAE;YAClB,IAAI,IAAI;gBAAE,OAAO;YACjB,IAAI,GAAG,IAAI,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,IAAI,CACF,4DAA4D,SAAS,uBAAuB;gBAC1F,uDAAuD,CAC1D,CAAC;YACF,MAAM,EAAE,CAAC;QACX,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,IAAI;aACD,SAAS,EAAE;YACZ,4EAA4E;YAC5E,uEAAuE;aACtE,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACxB,IAAI,CACF,sDAAsD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI;gBAC9G,uDAAuD,CAC1D,CAAC;QACJ,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,EAAE,CAAC;QACX,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The start-time refusals — the checks that run BEFORE a browser is
|
|
3
|
+
* launched, so a run never starts on terms its caller cannot honour.
|
|
4
|
+
*
|
|
5
|
+
* Split out of `debug-service.ts` to keep that file under the 500-LOC cap. Both
|
|
6
|
+
* keep their message text verbatim: the messages ARE the contract — they name
|
|
7
|
+
* the pid, the session and the exact command that unblocks the caller.
|
|
8
|
+
*/
|
|
9
|
+
import type { StatePort } from '../session/state-file.js';
|
|
10
|
+
/**
|
|
11
|
+
* Refuse to start on config this server can no longer honour.
|
|
12
|
+
*
|
|
13
|
+
* The message names the one action that works. Without it the caller edits the
|
|
14
|
+
* file, sees the identical failure, and has no way to tell a bad fix from an
|
|
15
|
+
* unread one — which is exactly how a real session burned two runs.
|
|
16
|
+
*/
|
|
17
|
+
export declare function assertConfigFresh(configChanged: () => boolean): void;
|
|
18
|
+
/**
|
|
19
|
+
* The other half of the one-run gate: another *live* server process holding a
|
|
20
|
+
* run on this project. The manager only sees this process's memory, so without
|
|
21
|
+
* this a second MCP client on the same cwd would launch a second run onto the
|
|
22
|
+
* same profile/emulator and overwrite the live breadcrumb (leaving the CLI
|
|
23
|
+
* pointing at the wrong pid). A dead or PID-recycled owner does not count — a
|
|
24
|
+
* crashed server's stale `running` file must never wedge the project shut.
|
|
25
|
+
*
|
|
26
|
+
* This is the FRIENDLY early refusal, not the authority: it reads the
|
|
27
|
+
* breadcrumb, so two servers starting in the same window can both pass it.
|
|
28
|
+
* The authoritative admission is the workspace's exclusive ownership claim,
|
|
29
|
+
* taken atomically by the breadcrumb write in the service's launch — a refused
|
|
30
|
+
* claim surfaces as {@link SessionBusyError} from there.
|
|
31
|
+
*/
|
|
32
|
+
export declare function assertNoForeignRun(state: StatePort, cwd: string): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Stop a start that the shutdown path has cancelled (SIGTERM, a CLI `stop`, the
|
|
35
|
+
* MCP client dying). The caller tears down whatever it had already built.
|
|
36
|
+
*/
|
|
37
|
+
export declare function assertStartNotAborted(signal: AbortSignal, id: string): void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The start-time refusals — the checks that run BEFORE a browser is
|
|
3
|
+
* launched, so a run never starts on terms its caller cannot honour.
|
|
4
|
+
*
|
|
5
|
+
* Split out of `debug-service.ts` to keep that file under the 500-LOC cap. Both
|
|
6
|
+
* keep their message text verbatim: the messages ARE the contract — they name
|
|
7
|
+
* the pid, the session and the exact command that unblocks the caller.
|
|
8
|
+
*/
|
|
9
|
+
import { CONFIG_FILENAME } from '../config/load.js';
|
|
10
|
+
import { ConfigError, SessionBusyError, SessionSettledError } from '../errors.js';
|
|
11
|
+
/**
|
|
12
|
+
* Refuse to start on config this server can no longer honour.
|
|
13
|
+
*
|
|
14
|
+
* The message names the one action that works. Without it the caller edits the
|
|
15
|
+
* file, sees the identical failure, and has no way to tell a bad fix from an
|
|
16
|
+
* unread one — which is exactly how a real session burned two runs.
|
|
17
|
+
*/
|
|
18
|
+
export function assertConfigFresh(configChanged) {
|
|
19
|
+
if (!configChanged())
|
|
20
|
+
return;
|
|
21
|
+
throw new ConfigError(`${CONFIG_FILENAME} changed on disk after this ui-debugger-mcp server started, so a run now ` +
|
|
22
|
+
'would still use the OLD settings (models, targets, urls are read once at boot). ' +
|
|
23
|
+
'Restart the MCP server to pick the new config up — in Claude Code, /mcp → reconnect ' +
|
|
24
|
+
'ui-debugger, or restart the session.');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The other half of the one-run gate: another *live* server process holding a
|
|
28
|
+
* run on this project. The manager only sees this process's memory, so without
|
|
29
|
+
* this a second MCP client on the same cwd would launch a second run onto the
|
|
30
|
+
* same profile/emulator and overwrite the live breadcrumb (leaving the CLI
|
|
31
|
+
* pointing at the wrong pid). A dead or PID-recycled owner does not count — a
|
|
32
|
+
* crashed server's stale `running` file must never wedge the project shut.
|
|
33
|
+
*
|
|
34
|
+
* This is the FRIENDLY early refusal, not the authority: it reads the
|
|
35
|
+
* breadcrumb, so two servers starting in the same window can both pass it.
|
|
36
|
+
* The authoritative admission is the workspace's exclusive ownership claim,
|
|
37
|
+
* taken atomically by the breadcrumb write in the service's launch — a refused
|
|
38
|
+
* claim surfaces as {@link SessionBusyError} from there.
|
|
39
|
+
*/
|
|
40
|
+
export async function assertNoForeignRun(state, cwd) {
|
|
41
|
+
const foreign = await state.foreignRun();
|
|
42
|
+
if (foreign === null)
|
|
43
|
+
return;
|
|
44
|
+
throw new SessionBusyError(`Another ui-debugger-mcp server (pid ${foreign.pid}) already has a debug session ` +
|
|
45
|
+
`('${foreign.sessionId}') active for '${cwd}'. One run per project at a time. ` +
|
|
46
|
+
`Read what it is doing with get_findings({session_id:'${foreign.sessionId}'}) — a run ` +
|
|
47
|
+
'that has already settled is just waiting to be closed by its own client. To take the ' +
|
|
48
|
+
"project over, run 'ui-debugger-mcp stop' in this directory, then start again.");
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Stop a start that the shutdown path has cancelled (SIGTERM, a CLI `stop`, the
|
|
52
|
+
* MCP client dying). The caller tears down whatever it had already built.
|
|
53
|
+
*/
|
|
54
|
+
export function assertStartNotAborted(signal, id) {
|
|
55
|
+
if (!signal.aborted)
|
|
56
|
+
return;
|
|
57
|
+
throw new SessionSettledError(`Debug run '${id}' was torn down while it was still starting — this ui-debugger-mcp server ` +
|
|
58
|
+
'is shutting down (SIGTERM, `ui-debugger-mcp stop`, or the MCP client disconnected). ' +
|
|
59
|
+
'Nothing was left running; start again once the server is back.');
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=start-guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-guards.js","sourceRoot":"","sources":["../../src/services/start-guards.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGlF;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,aAA4B;IAC5D,IAAI,CAAC,aAAa,EAAE;QAAE,OAAO;IAC7B,MAAM,IAAI,WAAW,CACnB,GAAG,eAAe,2EAA2E;QAC3F,kFAAkF;QAClF,sFAAsF;QACtF,sCAAsC,CACzC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAgB,EAAE,GAAW;IACpE,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC;IACzC,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO;IAC7B,MAAM,IAAI,gBAAgB,CACxB,uCAAuC,OAAO,CAAC,GAAG,gCAAgC;QAChF,KAAK,OAAO,CAAC,SAAS,kBAAkB,GAAG,oCAAoC;QAC/E,wDAAwD,OAAO,CAAC,SAAS,cAAc;QACvF,uFAAuF;QACvF,+EAA+E,CAClF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAmB,EAAE,EAAU;IACnE,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO;IAC5B,MAAM,IAAI,mBAAmB,CAC3B,cAAc,EAAE,4EAA4E;QAC1F,sFAAsF;QACtF,gEAAgE,CACnE,CAAC;AACJ,CAAC"}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import type { LanguageModel } from 'ai';
|
|
23
23
|
import type { Findings } from '../findings/schema.js';
|
|
24
|
+
import type { Redactor } from '../redact.js';
|
|
24
25
|
import type { SummarizeStep } from '../session/session.js';
|
|
25
26
|
/** What `summarize` asks the summary model: our system prompt + the findings digest. */
|
|
26
27
|
export interface SummaryRequest {
|
|
@@ -50,12 +51,20 @@ export declare function findingsDigest(findings: Findings): string;
|
|
|
50
51
|
/**
|
|
51
52
|
* Condense findings into one actionable paragraph. Pure over the
|
|
52
53
|
* {@link SummaryGenerate} seam, so it unit-tests against a fake with no network.
|
|
54
|
+
*
|
|
55
|
+
* `redact` is the run's secret redactor (`createSecretRedactor`, bound per run to
|
|
56
|
+
* the auth persona's values); identity when omitted. The digest is persona text's
|
|
57
|
+
* last stop before a provider: bug details and evidence locations quote console
|
|
58
|
+
* rows, so the prompt is passed through the redactor even if an upstream source
|
|
59
|
+
* has already regressed.
|
|
53
60
|
* @throws {AgentError} if the summary model returns a blank reply.
|
|
54
61
|
*/
|
|
55
|
-
export declare function summarize(generate: SummaryGenerate, findings: Findings, signal?: AbortSignal): Promise<string>;
|
|
62
|
+
export declare function summarize(generate: SummaryGenerate, findings: Findings, signal?: AbortSignal, redact?: Redactor): Promise<string>;
|
|
56
63
|
/**
|
|
57
64
|
* Bind {@link summarize} to the summary model, yielding the {@link SummarizeStep} the
|
|
58
65
|
* session calls after the verdict settles. The model is the only thing that varies
|
|
59
|
-
* between deployments; everything else (prompt, digest) is owned in-repo.
|
|
66
|
+
* between deployments; everything else (prompt, digest) is owned in-repo. `redact`
|
|
67
|
+
* (the run's secret redactor, identity when omitted) is forwarded so the digest
|
|
68
|
+
* sent to the provider carries no raw persona value.
|
|
60
69
|
*/
|
|
61
|
-
export declare function createSummarize(model: LanguageModel): SummarizeStep;
|
|
70
|
+
export declare function createSummarize(model: LanguageModel, redact?: Redactor): SummarizeStep;
|
|
@@ -72,12 +72,18 @@ export function findingsDigest(findings) {
|
|
|
72
72
|
/**
|
|
73
73
|
* Condense findings into one actionable paragraph. Pure over the
|
|
74
74
|
* {@link SummaryGenerate} seam, so it unit-tests against a fake with no network.
|
|
75
|
+
*
|
|
76
|
+
* `redact` is the run's secret redactor (`createSecretRedactor`, bound per run to
|
|
77
|
+
* the auth persona's values); identity when omitted. The digest is persona text's
|
|
78
|
+
* last stop before a provider: bug details and evidence locations quote console
|
|
79
|
+
* rows, so the prompt is passed through the redactor even if an upstream source
|
|
80
|
+
* has already regressed.
|
|
75
81
|
* @throws {AgentError} if the summary model returns a blank reply.
|
|
76
82
|
*/
|
|
77
|
-
export async function summarize(generate, findings, signal) {
|
|
83
|
+
export async function summarize(generate, findings, signal, redact) {
|
|
78
84
|
const { text } = await generate({
|
|
79
85
|
system: SUMMARY_SYSTEM_PROMPT,
|
|
80
|
-
prompt: findingsDigest(findings),
|
|
86
|
+
prompt: redact ? redact(findingsDigest(findings)) : findingsDigest(findings),
|
|
81
87
|
abortSignal: signal,
|
|
82
88
|
});
|
|
83
89
|
const paragraph = text.trim();
|
|
@@ -89,15 +95,17 @@ export async function summarize(generate, findings, signal) {
|
|
|
89
95
|
/**
|
|
90
96
|
* Bind {@link summarize} to the summary model, yielding the {@link SummarizeStep} the
|
|
91
97
|
* session calls after the verdict settles. The model is the only thing that varies
|
|
92
|
-
* between deployments; everything else (prompt, digest) is owned in-repo.
|
|
98
|
+
* between deployments; everything else (prompt, digest) is owned in-repo. `redact`
|
|
99
|
+
* (the run's secret redactor, identity when omitted) is forwarded so the digest
|
|
100
|
+
* sent to the provider carries no raw persona value.
|
|
93
101
|
*/
|
|
94
|
-
export function createSummarize(model) {
|
|
102
|
+
export function createSummarize(model, redact) {
|
|
95
103
|
// Forward the session's teardown signal so an aborted close cancels the in-flight
|
|
96
104
|
// summary call instead of leaving a stalled model request dangling.
|
|
97
105
|
const generate = async ({ system, prompt, abortSignal }) => {
|
|
98
106
|
const { text } = await generateText({ model, system, prompt, abortSignal });
|
|
99
107
|
return { text };
|
|
100
108
|
};
|
|
101
|
-
return (findings, signal) => summarize(generate, findings, signal);
|
|
109
|
+
return (findings, signal) => summarize(generate, findings, signal, redact);
|
|
102
110
|
}
|
|
103
111
|
//# sourceMappingURL=summarize.js.map
|