@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
package/dist/redact.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret redaction — the value-keyed redactor a run binds to its auth persona.
|
|
3
|
+
*
|
|
4
|
+
* Neutral home (a sibling of `errors.ts`): the redactor is not a browser
|
|
5
|
+
* concern — the belt, the summary service and the findings store all apply it —
|
|
6
|
+
* so it lives here, with no adapter dependency.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Values a CONFIGURED auth persona types into the app (`targets.<t>.auth.<p>.fields`).
|
|
10
|
+
*
|
|
11
|
+
* The name-keyed redactors in `adapters/browser/log-format.ts` key off a NAME
|
|
12
|
+
* they recognize (`authorization`, `?password=`). A persona's values have no such
|
|
13
|
+
* tell: they land in a form POST body, in a `type` tool input on the agent
|
|
14
|
+
* trail, in whatever an adapter error echoes back. So this one keys off the
|
|
15
|
+
* VALUE — the only thing all three share — and is bound per run to the persona
|
|
16
|
+
* the caller named.
|
|
17
|
+
*
|
|
18
|
+
* Same posture as the other two: presence stays diagnostic (`<redacted, N chars>`
|
|
19
|
+
* still tells you a password of the right length was typed), the secret itself
|
|
20
|
+
* never reaches the durable trail.
|
|
21
|
+
*
|
|
22
|
+
* Encoded spellings are matched as a CLASS, not as a list of encoders (every
|
|
23
|
+
* encoder escapes a different subset: System.Text.Json writes `&` as `&`,
|
|
24
|
+
* Python escapes all non-ASCII, PHP writes `\/`). Per secret, three patterns:
|
|
25
|
+
* - plain — the exact text;
|
|
26
|
+
* - JSON family — each character as itself, its short escape (`\"` `\\` `\/`
|
|
27
|
+
* `\b` `\f` `\n` `\r` `\t`), or `\u` + its UTF-16 code unit in hex;
|
|
28
|
+
* - percent family — each character as itself, or its UTF-8 bytes as `%XX`
|
|
29
|
+
* (a space also as `+`).
|
|
30
|
+
* Escape hex digits match in either case; literal characters stay
|
|
31
|
+
* case-sensitive. A literal `\` (JSON) or `%` (percent) is NOT an alternative
|
|
32
|
+
* there — encoded text never carries one bare, and dropping it makes every
|
|
33
|
+
* alternation decidable from its first two characters, so matching is linear
|
|
34
|
+
* (no backtracking blow-up). The plain pattern still matches them bare.
|
|
35
|
+
*
|
|
36
|
+
* One pass over the ORIGINAL line: every match is located in offset order,
|
|
37
|
+
* overlapping spans are merged, and each merged span is replaced once.
|
|
38
|
+
* Replacing value by value instead leaked the tail of a secret that overlapped
|
|
39
|
+
* an already-blanked one, and let a short secret re-match inside an earlier
|
|
40
|
+
* `<redacted, N chars>` label.
|
|
41
|
+
*/
|
|
42
|
+
export function createSecretRedactor(secrets) {
|
|
43
|
+
const sources = new Set();
|
|
44
|
+
for (const secret of secrets) {
|
|
45
|
+
if (secret.length === 0)
|
|
46
|
+
continue;
|
|
47
|
+
// A lone surrogate reaches the app as U+FFFD (the browser replaces it), so
|
|
48
|
+
// echoes of THAT value are the same secret. The Set drops the duplicate.
|
|
49
|
+
for (const value of [secret, secret.replace(/\p{Cs}/gu, '\ufffd')]) {
|
|
50
|
+
sources.add(literal(value));
|
|
51
|
+
sources.add(jsonPattern(value));
|
|
52
|
+
}
|
|
53
|
+
sources.add(percentPattern(secret)); // already encodes a lone surrogate as U+FFFD
|
|
54
|
+
}
|
|
55
|
+
if (sources.size === 0)
|
|
56
|
+
return (line) => line;
|
|
57
|
+
const regexes = [...sources].map((source) => new RegExp(source, 'g'));
|
|
58
|
+
return (line) => {
|
|
59
|
+
// A k-way merge over each pattern's NEXT match, in offset order — no
|
|
60
|
+
// per-match allocation. `end` of a match comes from the match itself:
|
|
61
|
+
// escaped and bare characters differ in length.
|
|
62
|
+
const find = (j, from) => {
|
|
63
|
+
const re = regexes[j];
|
|
64
|
+
re.lastIndex = from;
|
|
65
|
+
const m = re.exec(line);
|
|
66
|
+
return m ? [m.index, m.index + m[0].length] : [-1, -1];
|
|
67
|
+
};
|
|
68
|
+
const next = regexes.map((_, j) => find(j, 0));
|
|
69
|
+
let out = '';
|
|
70
|
+
let cursor = 0;
|
|
71
|
+
let start = -1;
|
|
72
|
+
let end = -1;
|
|
73
|
+
for (;;) {
|
|
74
|
+
let k = -1;
|
|
75
|
+
for (let j = 0; j < next.length; j++) {
|
|
76
|
+
const at = next[j][0];
|
|
77
|
+
if (at !== -1 && (k === -1 || at < next[k][0]))
|
|
78
|
+
k = j;
|
|
79
|
+
}
|
|
80
|
+
if (k === -1)
|
|
81
|
+
break;
|
|
82
|
+
const [at, to] = next[k];
|
|
83
|
+
if (at < end) {
|
|
84
|
+
end = Math.max(end, to);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
if (start !== -1) {
|
|
88
|
+
out += `${line.slice(cursor, start)}<redacted, ${end - start} chars>`;
|
|
89
|
+
cursor = end;
|
|
90
|
+
}
|
|
91
|
+
start = at;
|
|
92
|
+
end = to;
|
|
93
|
+
}
|
|
94
|
+
next[k] = find(k, at + 1);
|
|
95
|
+
}
|
|
96
|
+
if (start === -1)
|
|
97
|
+
return line;
|
|
98
|
+
return `${out}${line.slice(cursor, start)}<redacted, ${end - start} chars>${line.slice(end)}`;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** JSON's two-character escapes. */
|
|
102
|
+
const JSON_SHORT = {
|
|
103
|
+
'"': '\\"',
|
|
104
|
+
'\\': '\\\\',
|
|
105
|
+
'/': '\\/',
|
|
106
|
+
'\b': '\\b',
|
|
107
|
+
'\f': '\\f',
|
|
108
|
+
'\n': '\\n',
|
|
109
|
+
'\r': '\\r',
|
|
110
|
+
'\t': '\\t',
|
|
111
|
+
};
|
|
112
|
+
/** Regex source for one UTF-16 code unit, literally — never a metacharacter. */
|
|
113
|
+
function unit(c) {
|
|
114
|
+
return /[0-9A-Za-z]/.test(c) ? c : `\\u${hex4(c.charCodeAt(0))}`;
|
|
115
|
+
}
|
|
116
|
+
/** Regex source matching `text` exactly, code unit by code unit. */
|
|
117
|
+
function literal(text) {
|
|
118
|
+
let out = '';
|
|
119
|
+
for (let i = 0; i < text.length; i++)
|
|
120
|
+
out += unit(text.charAt(i)); // code units, not points
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
/** A code unit as four hex digits. */
|
|
124
|
+
function hex4(code) {
|
|
125
|
+
return code.toString(16).padStart(4, '0');
|
|
126
|
+
}
|
|
127
|
+
/** Hex digits of an escape, either case. */
|
|
128
|
+
function hexDigits(hex) {
|
|
129
|
+
return [...hex]
|
|
130
|
+
.map((d) => (/[0-9]/.test(d) ? d : `[${d.toLowerCase()}${d.toUpperCase()}]`))
|
|
131
|
+
.join('');
|
|
132
|
+
}
|
|
133
|
+
/** Each code unit: bare (not `\`), its short escape, or `\uXXXX` in either case. */
|
|
134
|
+
function jsonPattern(secret) {
|
|
135
|
+
let out = '';
|
|
136
|
+
for (let i = 0; i < secret.length; i++) {
|
|
137
|
+
const c = secret.charAt(i);
|
|
138
|
+
const alts = [`${literal('\\u')}${hexDigits(hex4(c.charCodeAt(0)))}`];
|
|
139
|
+
const short = JSON_SHORT[c];
|
|
140
|
+
if (short !== undefined)
|
|
141
|
+
alts.push(literal(short));
|
|
142
|
+
if (c !== '\\')
|
|
143
|
+
alts.push(unit(c));
|
|
144
|
+
out += `(?:${alts.join('|')})`;
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Each code point: bare (not `%`), or its UTF-8 bytes as `%XX` in either case; a
|
|
150
|
+
* space also as `+`. A lone surrogate has no UTF-8 form — a browser sends U+FFFD.
|
|
151
|
+
*/
|
|
152
|
+
function percentPattern(secret) {
|
|
153
|
+
const encoder = new TextEncoder();
|
|
154
|
+
let out = '';
|
|
155
|
+
for (const c of secret) {
|
|
156
|
+
const bytes = encoder.encode(c); // a lone surrogate encodes as U+FFFD's bytes
|
|
157
|
+
const alts = [[...bytes].map((b) => `%${hexDigits(b.toString(16).padStart(2, '0'))}`).join('')];
|
|
158
|
+
if (c === ' ')
|
|
159
|
+
alts.push('\\+');
|
|
160
|
+
if (c !== '%')
|
|
161
|
+
alts.push(literal(c));
|
|
162
|
+
out += `(?:${alts.join('|')})`;
|
|
163
|
+
}
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=redact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA0B;IAC7D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAClC,2EAA2E;QAC3E,yEAAyE;QACzE,KAAK,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;YACnE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CA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AC;QAChG,IAAI,CAAC,KAAK,GAAG;YAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACrC,GAAG,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACjC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolving `start_debug({as})` to a configured persona — the config half of the
|
|
3
|
+
* pre-run login (`login.ts` performs it). Split out for the 500-LOC cap.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthPersona, Target } from '../config/schema.js';
|
|
6
|
+
/** What `start_debug({as})` resolved to — the persona plus the key that named it. */
|
|
7
|
+
export interface ResolvedAuth {
|
|
8
|
+
/** The `as` key, as the caller typed it — every failure names it. */
|
|
9
|
+
name: string;
|
|
10
|
+
persona: AuthPersona;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolve `start_debug({as})` against the target's configured personas.
|
|
14
|
+
*
|
|
15
|
+
* Fails loud ({@link ConfigError}) on an unknown key, listing the valid ones — an
|
|
16
|
+
* `as` typo must NEVER fall through to a signed-out run, because every screen
|
|
17
|
+
* behind the login then reads as a broken UI.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveAuth(target: Target, targetName: string, as: string | undefined): ResolvedAuth | undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolving `start_debug({as})` to a configured persona — the config half of the
|
|
3
|
+
* pre-run login (`login.ts` performs it). Split out for the 500-LOC cap.
|
|
4
|
+
*/
|
|
5
|
+
import { ConfigError } from '../errors.js';
|
|
6
|
+
/**
|
|
7
|
+
* Resolve `start_debug({as})` against the target's configured personas.
|
|
8
|
+
*
|
|
9
|
+
* Fails loud ({@link ConfigError}) on an unknown key, listing the valid ones — an
|
|
10
|
+
* `as` typo must NEVER fall through to a signed-out run, because every screen
|
|
11
|
+
* behind the login then reads as a broken UI.
|
|
12
|
+
*/
|
|
13
|
+
export function resolveAuth(target, targetName, as) {
|
|
14
|
+
if (as === undefined)
|
|
15
|
+
return undefined;
|
|
16
|
+
if (target.adapter !== 'browser') {
|
|
17
|
+
throw new ConfigError(`'as' (auth persona) only applies to web targets, but '${targetName}' is '${target.adapter}'`);
|
|
18
|
+
}
|
|
19
|
+
const auth = target.auth;
|
|
20
|
+
// `hasOwn`, never a plain index read — `auth['constructor']` walks the prototype
|
|
21
|
+
// chain and answers truthy, and the run would die deeper with a persona of `{}`.
|
|
22
|
+
const persona = auth && Object.hasOwn(auth, as) ? auth[as] : undefined;
|
|
23
|
+
if (persona)
|
|
24
|
+
return { name: as, persona };
|
|
25
|
+
const configured = Object.keys(auth ?? {});
|
|
26
|
+
const known = configured.length > 0
|
|
27
|
+
? `configured personas: ${configured.map((k) => `'${k}'`).join(', ')}`
|
|
28
|
+
: `target '${targetName}' has no 'auth' block`;
|
|
29
|
+
throw new ConfigError(`unknown auth persona '${as}' for target '${targetName}' — ${known}. ` +
|
|
30
|
+
`Add it under targets.${targetName}.auth in .ui-debugger-mcp.json, or omit 'as' to run signed out.`);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=auth-persona.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-persona.js","sourceRoot":"","sources":["../../src/services/auth-persona.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAS3C;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,UAAkB,EAClB,EAAsB;IAEtB,IAAI,EAAE,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACvC,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,WAAW,CACnB,yDAAyD,UAAU,SAAS,MAAM,CAAC,OAAO,GAAG,CAC9F,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,iFAAiF;IACjF,iFAAiF;IACjF,MAAM,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,IAAI,OAAO;QAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;IAE1C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAC3C,MAAM,KAAK,GACT,UAAU,CAAC,MAAM,GAAG,CAAC;QACnB,CAAC,CAAC,wBAAwB,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACtE,CAAC,CAAC,WAAW,UAAU,uBAAuB,CAAC;IACnD,MAAM,IAAI,WAAW,CACnB,yBAAyB,EAAE,iBAAiB,UAAU,OAAO,KAAK,IAAI;QACpE,wBAAwB,UAAU,iEAAiE,CACtG,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The target catalog behind `describe` — the projection of configured targets
|
|
3
|
+
* onto their public, secret-free shape.
|
|
4
|
+
*
|
|
5
|
+
* Split out of `debug-service.ts` to keep that file under the 500-LOC cap. This
|
|
6
|
+
* half is PURE: no session, no manager, no fs — a target's config in, its
|
|
7
|
+
* public entry out. `managed` vs `attach` is DERIVED from the target itself (a
|
|
8
|
+
* `cdpUrl` / `adbSerial` means "connect to a running one", never start/stop it),
|
|
9
|
+
* `operational` from the host platform, and the persona NAMES are the only half
|
|
10
|
+
* of the auth block that ever leaves the config.
|
|
11
|
+
*/
|
|
12
|
+
import type { Target } from '../config/schema.js';
|
|
13
|
+
import type { TargetInfo } from './debug-api.js';
|
|
14
|
+
/** Whether a target is in attach mode (connects to a running instance, never start/stop). */
|
|
15
|
+
export declare function isAttach(target: Target): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Project one configured target onto its public {@link TargetInfo} (no secrets).
|
|
18
|
+
*
|
|
19
|
+
* `operational` is DERIVED, never hardcoded: the adapter kind must be wired in
|
|
20
|
+
* this build AND supported on the host platform (see `adapters/availability.ts`).
|
|
21
|
+
*/
|
|
22
|
+
export declare function describeTarget(name: string, target: Target, platform: NodeJS.Platform): TargetInfo;
|
|
23
|
+
/**
|
|
24
|
+
* The catalog `describe` reports — every configured target, or just the one
|
|
25
|
+
* named. An unknown name fails loud: a silently empty list would read as "this
|
|
26
|
+
* project has no targets" and send the caller looking for the wrong bug.
|
|
27
|
+
*/
|
|
28
|
+
export declare function selectTargets(targets: Record<string, Target>, named: string | undefined, platform: NodeJS.Platform): TargetInfo[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The target catalog behind `describe` — the projection of configured targets
|
|
3
|
+
* onto their public, secret-free shape.
|
|
4
|
+
*
|
|
5
|
+
* Split out of `debug-service.ts` to keep that file under the 500-LOC cap. This
|
|
6
|
+
* half is PURE: no session, no manager, no fs — a target's config in, its
|
|
7
|
+
* public entry out. `managed` vs `attach` is DERIVED from the target itself (a
|
|
8
|
+
* `cdpUrl` / `adbSerial` means "connect to a running one", never start/stop it),
|
|
9
|
+
* `operational` from the host platform, and the persona NAMES are the only half
|
|
10
|
+
* of the auth block that ever leaves the config.
|
|
11
|
+
*/
|
|
12
|
+
import { isAdapterOperational } from '../adapters/availability.js';
|
|
13
|
+
import { TargetNotFoundError } from '../errors.js';
|
|
14
|
+
/** Whether a target is in attach mode (connects to a running instance, never start/stop). */
|
|
15
|
+
export function isAttach(target) {
|
|
16
|
+
if (target.adapter === 'browser')
|
|
17
|
+
return target.cdpUrl != null;
|
|
18
|
+
if (target.adapter === 'android')
|
|
19
|
+
return target.adbSerial != null;
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Project one configured target onto its public {@link TargetInfo} (no secrets).
|
|
24
|
+
*
|
|
25
|
+
* `operational` is DERIVED, never hardcoded: the adapter kind must be wired in
|
|
26
|
+
* this build AND supported on the host platform (see `adapters/availability.ts`).
|
|
27
|
+
*/
|
|
28
|
+
export function describeTarget(name, target, platform) {
|
|
29
|
+
const base = {
|
|
30
|
+
name,
|
|
31
|
+
adapter: target.adapter,
|
|
32
|
+
mode: isAttach(target) ? 'attach' : 'managed',
|
|
33
|
+
operational: isAdapterOperational(target.adapter, platform),
|
|
34
|
+
// What the project declares is EXPECTED of this app — the driver already gets
|
|
35
|
+
// it in its prompt; the caller sees it here so "the table is empty" coming back
|
|
36
|
+
// as a non-finding is explainable without opening the config file.
|
|
37
|
+
...(target.notes !== undefined && { notes: target.notes }),
|
|
38
|
+
};
|
|
39
|
+
if (target.adapter === 'browser') {
|
|
40
|
+
// Persona NAMES are the discoverable half — a caller can pick a valid `as`
|
|
41
|
+
// without opening the config file, and never sees the values.
|
|
42
|
+
const personas = Object.keys(target.auth ?? {});
|
|
43
|
+
return {
|
|
44
|
+
...base,
|
|
45
|
+
url: target.url,
|
|
46
|
+
headless: target.headless,
|
|
47
|
+
...(personas.length > 0 && { personas }),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return base;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The catalog `describe` reports — every configured target, or just the one
|
|
54
|
+
* named. An unknown name fails loud: a silently empty list would read as "this
|
|
55
|
+
* project has no targets" and send the caller looking for the wrong bug.
|
|
56
|
+
*/
|
|
57
|
+
export function selectTargets(targets, named, platform) {
|
|
58
|
+
const entries = Object.entries(targets);
|
|
59
|
+
const selected = named === undefined ? entries : entries.filter(([name]) => name === named);
|
|
60
|
+
if (named !== undefined && selected.length === 0) {
|
|
61
|
+
throw new TargetNotFoundError(`target '${named}' not found in config.targets`);
|
|
62
|
+
}
|
|
63
|
+
return selected.map(([name, config]) => describeTarget(name, config, platform));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/services/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,6FAA6F;AAC7F,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC;IAC/D,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC;IAClE,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,MAAc,EACd,QAAyB;IAEzB,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,oBAAoB,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC3D,8EAA8E;QAC9E,gFAAgF;QAChF,mEAAmE;QACnE,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;KAC3D,CAAC;IACF,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,2EAA2E;QAC3E,8DAA8D;QAC9D,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QAChD,OAAO;YACL,GAAG,IAAI;YACP,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC;SACzC,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,OAA+B,EAC/B,KAAyB,EACzB,QAAyB;IAEzB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IAC5F,IAAI,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,mBAAmB,CAAC,WAAW,KAAK,+BAA+B,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The debug service's public contract — the types the outer MCP tools speak.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `debug-service.ts` to keep that file under the 500-LOC cap: this
|
|
5
|
+
* is a dozen TYPE declarations with no runtime behaviour of their own. The
|
|
6
|
+
* service re-exports every name it exports today, so no importer changes.
|
|
7
|
+
*/
|
|
8
|
+
import type { ResolvedConfig } from '../config/load.js';
|
|
9
|
+
import type { Target } from '../config/schema.js';
|
|
10
|
+
import type { Findings } from '../findings/schema.js';
|
|
11
|
+
import type { SessionManager } from '../session/manager.js';
|
|
12
|
+
import type { Session, SessionStatus, SnapshotField } from '../session/session.js';
|
|
13
|
+
import type { StatePort } from '../session/state-file.js';
|
|
14
|
+
import type { SessionBuilder } from './session-builder.js';
|
|
15
|
+
/** `start_debug` input — open a run for a configured target. */
|
|
16
|
+
export interface StartInput {
|
|
17
|
+
target: string;
|
|
18
|
+
goal: string;
|
|
19
|
+
criteria?: string;
|
|
20
|
+
/** Per-run URL the caller points the driver at (web); overrides the target's configured url. */
|
|
21
|
+
url?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Named auth persona to open the run as — a key in the target's `auth` map. The
|
|
24
|
+
* run signs in out-of-band before the driver's first step; an unknown key fails
|
|
25
|
+
* loud rather than running the goal signed out.
|
|
26
|
+
*/
|
|
27
|
+
as?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Take the project over instead of being refused when a run is already active
|
|
30
|
+
* here: end that run first (through the `end_session` path), then start.
|
|
31
|
+
*
|
|
32
|
+
* OFF by default, and it must stay off by default — a silent takeover kills a
|
|
33
|
+
* healthy run its own caller is still watching. Opt in when the active run is
|
|
34
|
+
* yours and you lost its id (a compacted context, a crashed client) or it is
|
|
35
|
+
* stuck. Only ever replaces a run THIS server owns; one held by another live
|
|
36
|
+
* server is still refused ({@link SessionBusyError}), since its browser is not
|
|
37
|
+
* ours to close.
|
|
38
|
+
*/
|
|
39
|
+
replace?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Wall-clock cap (ms) before the run auto-ends, counted from THIS call — assembly,
|
|
42
|
+
* launch and the first navigation spend it too. Defaults to
|
|
43
|
+
* {@link DEFAULT_SESSION_TIMEOUT_MS}.
|
|
44
|
+
*/
|
|
45
|
+
timeoutMs?: number;
|
|
46
|
+
}
|
|
47
|
+
/** `start_debug` output — the id to poll/redirect/end the run by. */
|
|
48
|
+
export interface StartResult {
|
|
49
|
+
session_id: string;
|
|
50
|
+
}
|
|
51
|
+
/** `send_message` input — inject a mid-run instruction. */
|
|
52
|
+
export interface SendInput {
|
|
53
|
+
session_id: string;
|
|
54
|
+
message: string;
|
|
55
|
+
}
|
|
56
|
+
/** `send_message` / `end_session` acknowledgement. */
|
|
57
|
+
export interface Ack {
|
|
58
|
+
ok: true;
|
|
59
|
+
session_id: string;
|
|
60
|
+
/**
|
|
61
|
+
* Only on a REPEAT `end_session` for the run the previous one closed: nothing
|
|
62
|
+
* was done this time, and this is the status that run ended on.
|
|
63
|
+
*/
|
|
64
|
+
already_ended?: {
|
|
65
|
+
status: SessionStatus;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** `get_findings` input — snapshot (optionally long-poll / project a subset). */
|
|
69
|
+
export interface GetFindingsInput {
|
|
70
|
+
session_id: string;
|
|
71
|
+
wait?: number;
|
|
72
|
+
fields?: SnapshotField[];
|
|
73
|
+
}
|
|
74
|
+
/** `describe` input — the whole catalog, or one target when named. */
|
|
75
|
+
export interface DescribeInput {
|
|
76
|
+
target?: string;
|
|
77
|
+
}
|
|
78
|
+
/** One target's public shape in the catalog (secrets stay out). */
|
|
79
|
+
export interface TargetInfo {
|
|
80
|
+
name: string;
|
|
81
|
+
adapter: Target['adapter'];
|
|
82
|
+
/** `managed` = the server launches/owns it; `attach` = it connects to a running one. */
|
|
83
|
+
mode: 'managed' | 'attach';
|
|
84
|
+
/**
|
|
85
|
+
* Whether this adapter kind is available HERE: wired in this build AND
|
|
86
|
+
* supported on the host platform. It is NOT a launch promise — the target may
|
|
87
|
+
* be down, or its browser/emulator/device missing or disconnected; that fails
|
|
88
|
+
* loud at launch.
|
|
89
|
+
*/
|
|
90
|
+
operational: boolean;
|
|
91
|
+
/** Web target entry url, when applicable. */
|
|
92
|
+
url?: string;
|
|
93
|
+
/** Web headless flag, when applicable. */
|
|
94
|
+
headless?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Named auth personas configured for this target — the valid `start_debug({as})`
|
|
97
|
+
* values. NAMES ONLY; the credentials never leave `.ui-debugger-mcp.json`.
|
|
98
|
+
* Absent when the target has no `auth` block.
|
|
99
|
+
*/
|
|
100
|
+
personas?: string[];
|
|
101
|
+
/**
|
|
102
|
+
* The target's standing `notes` — what is EXPECTED of this app (seeded data,
|
|
103
|
+
* onboarding modals, dark mode), verbatim from config. Also composed into the
|
|
104
|
+
* driver's prompt; surfaced here so a caller can see what the run was told.
|
|
105
|
+
*/
|
|
106
|
+
notes?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The run this server holds for the project, as `describe` reports it — the way
|
|
110
|
+
* back in-band for a caller that lost its `session_id` (a compacted context, a
|
|
111
|
+
* client restart). Without it the only recovery was the out-of-band CLI.
|
|
112
|
+
*/
|
|
113
|
+
export interface RunInfo {
|
|
114
|
+
/** Pass to `get_findings` / `send_message` / `end_session`. */
|
|
115
|
+
id: string;
|
|
116
|
+
/** `running`, or the verdict it settled on (still readable, still holding the slot). */
|
|
117
|
+
status: SessionStatus;
|
|
118
|
+
/** The goal this run was started with — enough to tell whose run it is. */
|
|
119
|
+
goal: string;
|
|
120
|
+
}
|
|
121
|
+
/** `describe` output — configured targets plus the resolved models + workspace. */
|
|
122
|
+
export interface DescribeResult {
|
|
123
|
+
targets: TargetInfo[];
|
|
124
|
+
models: {
|
|
125
|
+
driver: string;
|
|
126
|
+
vision: string;
|
|
127
|
+
summary: string;
|
|
128
|
+
};
|
|
129
|
+
/** Resolved per-project workspace root (`<base>/<project>`) — where evidence lands. */
|
|
130
|
+
workspace: string;
|
|
131
|
+
/**
|
|
132
|
+
* The active run for this project (or the retained snapshot of the last one that
|
|
133
|
+
* auto-ended). Absent when this server holds no run. A run another live server
|
|
134
|
+
* owns is NOT reported here — `start_debug` names that one in its refusal.
|
|
135
|
+
*/
|
|
136
|
+
session?: RunInfo;
|
|
137
|
+
}
|
|
138
|
+
/** The surface the outer MCP tools call. Implemented by {@link DebugService}. */
|
|
139
|
+
export interface DebugApi {
|
|
140
|
+
start(input: StartInput): Promise<StartResult>;
|
|
141
|
+
send(input: SendInput): Ack;
|
|
142
|
+
getFindings(input: GetFindingsInput): Promise<Findings | Partial<Findings>>;
|
|
143
|
+
describe(input: DescribeInput): DescribeResult;
|
|
144
|
+
end(input: EndInput): Promise<Ack>;
|
|
145
|
+
}
|
|
146
|
+
/** `end_session` input. */
|
|
147
|
+
export interface EndInput {
|
|
148
|
+
session_id: string;
|
|
149
|
+
}
|
|
150
|
+
/** Everything the service needs, wired at boot. */
|
|
151
|
+
export interface DebugServiceDeps {
|
|
152
|
+
/** The cwd-keyed registry (one run per project). */
|
|
153
|
+
manager: SessionManager<Session>;
|
|
154
|
+
/** Resolved project config — backs `describe` + target validation. */
|
|
155
|
+
config: ResolvedConfig;
|
|
156
|
+
/** This project's session key (one project = one cwd = one session). */
|
|
157
|
+
cwd: string;
|
|
158
|
+
/** Seam to the heavy session assembly; injected so `start` stays testable. */
|
|
159
|
+
build: SessionBuilder;
|
|
160
|
+
/** Cross-process run breadcrumb (`state.json`) for the CLI; defaults to a no-op. */
|
|
161
|
+
state?: StatePort;
|
|
162
|
+
/** Default wall-clock cap (ms) for a run; defaults to {@link DEFAULT_SESSION_TIMEOUT_MS}. */
|
|
163
|
+
defaultTimeoutMs?: number;
|
|
164
|
+
/** Injected clock (epoch ms) for session ids + the run deadline; defaults to `Date.now`. */
|
|
165
|
+
now?: () => number;
|
|
166
|
+
/**
|
|
167
|
+
* The host platform the adapter-availability rule is evaluated against;
|
|
168
|
+
* defaults to `process.platform`. Injected so `describe` reports the same
|
|
169
|
+
* fact on every host (the tests pin it).
|
|
170
|
+
*/
|
|
171
|
+
platform?: NodeJS.Platform;
|
|
172
|
+
/**
|
|
173
|
+
* Has `.ui-debugger-mcp.json` changed since boot? Config is resolved once and
|
|
174
|
+
* wired into long-lived objects, so a changed file means every later run would
|
|
175
|
+
* silently use the OLD settings — see `config/fingerprint.ts`. Defaults to
|
|
176
|
+
* "never changed" (unit tests hold no file).
|
|
177
|
+
*/
|
|
178
|
+
configChanged?: () => boolean;
|
|
179
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The debug service's public contract — the types the outer MCP tools speak.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `debug-service.ts` to keep that file under the 500-LOC cap: this
|
|
5
|
+
* is a dozen TYPE declarations with no runtime behaviour of their own. The
|
|
6
|
+
* service re-exports every name it exports today, so no importer changes.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=debug-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-api.js","sourceRoot":"","sources":["../../src/services/debug-api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|