@developerz.ai/ui-debugger-mcp 1.2.0 → 1.3.1
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 +40 -0
- package/dist/adapters/browser/browser-adapter.d.ts +3 -1
- package/dist/adapters/browser/browser-adapter.js +127 -7
- package/dist/adapters/browser/browser-adapter.js.map +1 -1
- package/dist/adapters/browser/cdp.d.ts +40 -2
- package/dist/adapters/browser/cdp.js +205 -8
- package/dist/adapters/browser/cdp.js.map +1 -1
- package/dist/adapters/browser/extractor.d.ts +4 -0
- package/dist/adapters/browser/extractor.js +16 -0
- package/dist/adapters/browser/extractor.js.map +1 -1
- package/dist/adapters/contract.d.ts +72 -3
- package/dist/agent/belt/act.d.ts +17 -4
- package/dist/agent/belt/act.js +104 -7
- package/dist/agent/belt/act.js.map +1 -1
- package/dist/agent/belt/look.d.ts +1 -1
- package/dist/agent/belt/look.js +31 -2
- package/dist/agent/belt/look.js.map +1 -1
- package/dist/agent/belt/observe.d.ts +17 -5
- package/dist/agent/belt/observe.js +62 -5
- package/dist/agent/belt/observe.js.map +1 -1
- package/dist/agent/capabilities.js +7 -4
- package/dist/agent/capabilities.js.map +1 -1
- package/dist/agent/loop.d.ts +12 -2
- package/dist/agent/loop.js +12 -2
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/prompts/debug-agent.js +54 -4
- package/dist/agent/prompts/debug-agent.js.map +1 -1
- package/dist/agent/prompts/web-addendum.d.ts +1 -1
- package/dist/agent/prompts/web-addendum.js +70 -0
- package/dist/agent/prompts/web-addendum.js.map +1 -1
- package/dist/config/fingerprint.d.ts +32 -0
- package/dist/config/fingerprint.js +47 -0
- package/dist/config/fingerprint.js.map +1 -0
- package/dist/config/load.d.ts +7 -1
- package/dist/config/load.js +9 -3
- package/dist/config/load.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/services/debug-service.d.ts +9 -2
- package/dist/services/debug-service.js +66 -4
- package/dist/services/debug-service.js.map +1 -1
- package/dist/services/summarize.d.ts +1 -1
- package/dist/services/summarize.js +8 -1
- package/dist/services/summarize.js.map +1 -1
- package/dist/session/session.js +26 -2
- package/dist/session/session.js.map +1 -1
- package/dist/session/state-file.d.ts +13 -0
- package/dist/session/state-file.js +17 -2
- package/dist/session/state-file.js.map +1 -1
- package/package.json +1 -1
package/dist/agent/loop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/agent/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,WAAW,EAGX,WAAW,EAEX,aAAa,GACd,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB
|
|
1
|
+
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/agent/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,WAAW,EAGX,WAAW,EAEX,aAAa,GACd,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,kGAAkG;AAClG,MAAM,CAAC,MAAM,cAAc,GACzB,qGAAqG,CAAC;AAsCxG;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,MAAM,EAAE,CAAC;SACN,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,QAAQ,EAAE,C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E,4EAA4E;YAC5E,oEAAoE;YACpE,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ;gBAAE,MAAM,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACvD,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAA4B;IACvD,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,cAAc,EAAE,GAAG,OAAO,CAAC;IAChE,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -47,8 +47,8 @@ ${mode.eyes}
|
|
|
47
47
|
|
|
48
48
|
## Your tool belt
|
|
49
49
|
|
|
50
|
-
- \`observe\` — read state: DOM tree, screenshot path, console logs, network requests.
|
|
51
|
-
- \`act\` — take action: click, type, key, scroll, navigate, wait.
|
|
50
|
+
- \`observe\` — read state: DOM tree, screenshot path, console logs, network requests, open tabs.
|
|
51
|
+
- \`act\` — take action: click, type, key, scroll, navigate, wait, switch_tab.
|
|
52
52
|
${mode.belt}
|
|
53
53
|
- \`report\` — emit the final structured findings and STOP. Call once; it ends your run.
|
|
54
54
|
|
|
@@ -68,12 +68,47 @@ Never screenshot for information you can read from the tree or logs.
|
|
|
68
68
|
|
|
69
69
|
- Start with \`observe\` to understand the current state.
|
|
70
70
|
- \`act\` to advance: navigate, click interactive elements, fill inputs.
|
|
71
|
-
-
|
|
71
|
+
- Verify NARROWLY, not with a full re-read. After an act, check the one thing that
|
|
72
|
+
changed — \`observe({kind:"tree", query:"<the element>", fields:["name","value"]})\` — not the
|
|
73
|
+
whole tree. A full tree read after every act is the single biggest waste of your
|
|
74
|
+
budget, and you re-read every earlier result on every step.
|
|
75
|
+
- Some acts need no verification at all (typing into a field you just read as empty,
|
|
76
|
+
scrolling). Chain those and check once at the end of the group.
|
|
72
77
|
- If a step requires visual confirmation (looks good? aligned?), call \`look\`.
|
|
73
78
|
- Record a visual finding any time a \`look\` turns up an issue; attach the screenshot path.
|
|
74
79
|
- Repeated elements (e.g. several "Add to cart" buttons): test EACH instance and
|
|
75
80
|
report exactly which work and which fail. Never generalize one instance's
|
|
76
|
-
behavior to all of them
|
|
81
|
+
behavior to all of them. If there are more than ~5, test the first, the last and
|
|
82
|
+
one in the middle, and say in your report that you sampled rather than swept.${mode.extraRule}
|
|
83
|
+
|
|
84
|
+
## Budget discipline — an unreported run produces NOTHING
|
|
85
|
+
|
|
86
|
+
You have a limited number of steps. If you spend them all without calling
|
|
87
|
+
\`report\`, the entire run is discarded: no findings, no verdict, nothing for the
|
|
88
|
+
smart agent. That is the worst outcome available to you — worse than a partial
|
|
89
|
+
report, far worse than a failed verdict.
|
|
90
|
+
|
|
91
|
+
- Plan for the goal to take longer than you expect. Do the load-bearing checks first.
|
|
92
|
+
- The moment you are warned the budget is nearly spent, STOP exploring and call
|
|
93
|
+
\`report\` with what you have. Partial findings are valuable; nothing is not.
|
|
94
|
+
- If you find yourself repeating a check, or asking the same question a second way,
|
|
95
|
+
you are stuck. Record what you know and move on.
|
|
96
|
+
|
|
97
|
+
## Is it the app — or is it you?
|
|
98
|
+
|
|
99
|
+
Before recording a bug, rule yourself out. These are YOUR errors, not the app's:
|
|
100
|
+
|
|
101
|
+
- Text that came out doubled or scrambled because you typed into a field that was
|
|
102
|
+
not empty, or typed twice — re-read the field, use \`clear\`, and retry before
|
|
103
|
+
blaming the app.
|
|
104
|
+
- A selector you invented that matched nothing, or matched the wrong element.
|
|
105
|
+
- A URL you guessed rather than reached by clicking.
|
|
106
|
+
- An element you could not find because it was below the fold, inside a closed
|
|
107
|
+
menu, in another tab, or in an iframe.
|
|
108
|
+
|
|
109
|
+
Retry once, differently, before you record the bug. When you cannot tell whether
|
|
110
|
+
it was you or the app, say so in the \`detail\` — an honest "could not confirm"
|
|
111
|
+
is worth more to the smart agent than a confident wrong diagnosis.
|
|
77
112
|
|
|
78
113
|
## Mid-run instructions
|
|
79
114
|
|
|
@@ -102,6 +137,21 @@ Collect bugs as you go. Three kinds:
|
|
|
102
137
|
|
|
103
138
|
Each bug: \`{ kind, detail: "concise description", evidence?: "screenshot or log path" }\`
|
|
104
139
|
|
|
140
|
+
### The bar: a bug is something a user would call broken
|
|
141
|
+
|
|
142
|
+
Do NOT record normal application behaviour as a bug. Common false positives:
|
|
143
|
+
|
|
144
|
+
- A \`401\`/\`403\` from an auth probe while logged OUT (e.g. \`GET /api/auth/me\` on
|
|
145
|
+
first load). That is the app checking for a session and correctly finding none.
|
|
146
|
+
- A request cancelled or aborted because the page navigated away.
|
|
147
|
+
- A \`404\` on an optional resource the app handles (favicon, source map).
|
|
148
|
+
- A validation error the app showed you on purpose after you submitted bad input —
|
|
149
|
+
that is the feature working.
|
|
150
|
+
|
|
151
|
+
If you catch yourself writing "expected" or "no impact" in a bug's \`detail\`, it
|
|
152
|
+
does not belong in \`bugs\` — leave it out, or put it in the summary as context.
|
|
153
|
+
A short list of real bugs is far more useful than a long list padded with noise.
|
|
154
|
+
|
|
105
155
|
## Visual findings
|
|
106
156
|
|
|
107
157
|
Collect visual issues discovered via \`look\`. Each:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-agent.js","sourceRoot":"","sources":["../../../src/agent/prompts/debug-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAcH,+FAA+F;AAC/F,MAAM,WAAW,GAAa;IAC5B,IAAI,EAAE,4FAA4F;IAClG,IAAI,EAAE,yFAAyF;IAC/F,IAAI,EAAE,8BAA8B;IACpC,iFAAiF;IACjF,iFAAiF;IACjF,SAAS,EAAE;;;6CAGgC;CAC5C,CAAC;AAEF,sFAAsF;AACtF,MAAM,cAAc,GAAa;IAC/B,IAAI,EAAE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;;;;;;;;;;;;;;;;;;;;;;CA4G9F,CAAC;AACF,CAAC"}
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Provider-agnostic — no vendor tricks; any competent model drives the same loop.
|
|
8
8
|
*/
|
|
9
|
-
export declare const WEB_ADDENDUM_PROMPT = "## Web target \u2014 CDP reach\n\nYour browser connection uses the Chrome DevTools Protocol (CDP).\nIt reaches the current page: DOM, console, network, input, and screenshots.\nUse it deliberately.\n\n### CDP domains and when to reach for each\n\n| Domain | What it gives you | Use via |\n|-------------|-------------------|---------|\n| `Page` | navigate, wait for load, capture screenshot | `act({action:\"navigate\"})`, `observe({kind:\"screenshot\"})` |\n| `DOM` | read/query the element tree, attributes, text | `observe({kind:\"tree\"})` |\n| `Network` | request/response status, failed requests, timing | `observe({kind:\"network\"})` |\n| `Log` | browser console messages, JS errors | `observe({kind:\"console\"})` |\n\n### DOM-first rule\n\nAlways try the structured path before asking for vision:\n1. `observe({kind:\"tree\"})` \u2014 read element roles, names, bounds, enabled state.\n2. If an element is not visible in the tree, try scrolling or waiting, then re-observe.\n3. Use `observe({kind:\"console\"})` and `observe({kind:\"network\"})` (filtered \u2014 see\n below) after actions that plausibly trigger errors \u2014 errors land there before\n they surface visually.\n4. Only after the tree gives you no answer: call `look` for pixels.\n\n### Composing tree queries\n\n- `query` accepts: a bare HTML tag (`span`, `img`), CSS (`.cart span`),\n `role \"name\"` (`button \"Add to cart\"`), an explicit engine\n (`data-testid=cart-count`, `text=Subscribe`), or plain visible text.\n- Elements with a `data-testid` always appear in the default (no-query) tree with\n their `testid` \u2014 to read a counter/value, find its node and read `name` (the\n text content). Re-observe the same node after acting to verify a change.\n- `within` scopes the read: pass a selector string or a node OBJECT exactly as a\n previous observe returned it \u2014 never a JSON-stringified node.\n\n### Invisible text & contrast \u2014 no vision needed\n\nText-bearing nodes carry a `style` column = `{ color, backgroundColor, contrast }`\n(WCAG ratio 1\u201321). It is omitted by default \u2014 request it via `fields:[\"role\",\"name\",\"style\"]`\nor sweep all text in ONE call:\n`observe({kind:\"tree\", query:\"p, span, div, a, li\", filters:{contrast_lt: 4.5}})`\n(returns only hard-to-read text; empty = contrast is fine). Flag `contrast < 4.5`\nas a `medium` visual finding and `contrast < 1.5` as `high` (the text is\neffectively invisible). Always run one contrast sweep when the goal mentions\nreadability, contrast, or visual polish.\n\n### Follow links by CLICKING them \u2014 never invent URLs\n\nThe tree does not expose `href`s. To follow a link, `act({action:\"click\"})` its\nnode. Do NOT fabricate a URL from a link's label (e.g. label \"Help Center\" \u2192\nnavigating to `/help-center`): a guessed URL that 404s is YOUR error, not a site\nbug. Only `navigate` to URLs given in the goal or seen in network entries. If a\nlink's click target is hidden (e.g. inside a closed menu), click the parent menu\nitem first, then re-observe.\n\n### Login bypass\n\nIf the target has `?debug-ai=true` support (the app's captcha bypass gate),\nappend it to the login URL before navigating. This skips captcha only \u2014 not auth.\nThe app must have `ALLOW_AI_DEBUG_LOGIN=true` set in its environment.\n\n### Selectors \u2014 use the node's `target`, don't invent one\n\nMost actionable nodes from `observe({kind:\"tree\"})` carry a ready-to-use `target`\nstring (e.g. `data-testid=\"cart-count\"` when the element has a test id, else\n`role=button[name=\"Add to cart\" i]`, with `>> nth=N` when names repeat).\nWhen a node has a `target`, COPY it verbatim into `act({action, target})`.\nDo NOT hand-craft a selector \u2014 guessed CSS like `button[name=\"...\"]` will not resolve.\n\nIf a node has no `target` (unnamed/non-semantic, or a scoped `within`/`filters`\nread), you may pass its visible text as `target` (plain text resolves), or\n`role \"name\"`. Avoid XPath and positional CSS.\n\n### Console + network \u2014 filter, don't dump\n\nBoth channels support `filters` and `limit` \u2014 use them instead of reading\neverything every time:\n- `observe({kind:\"console\", filters:{level_eq:\"error\"}})` \u2014 just JS errors.\n- `observe({kind:\"network\", filters:{status_gte:400}})` \u2014 just failed requests.\n- `limit` caps rows returned when you only need the latest few.\n\nCheck both after actions that plausibly trigger errors (submits, navigations,\nAPI calls) \u2014 not mechanically after every single `act`.\n\nRecord any errors as `console` or `network` bugs with the request URL / error\nmessage as `detail` and the screenshot path as `evidence` when relevant.\n";
|
|
9
|
+
export declare const WEB_ADDENDUM_PROMPT = "## Web target \u2014 CDP reach\n\nYour browser connection uses the Chrome DevTools Protocol (CDP).\nIt reaches the current page: DOM, console, network, input, and screenshots.\nUse it deliberately.\n\n### CDP domains and when to reach for each\n\n| Domain | What it gives you | Use via |\n|-------------|-------------------|---------|\n| `Page` | navigate, wait for load, capture screenshot | `act({action:\"navigate\"})`, `observe({kind:\"screenshot\"})` |\n| `DOM` | read/query the element tree, attributes, text | `observe({kind:\"tree\"})` |\n| `Network` | request/response status, failed requests, timing | `observe({kind:\"network\"})` |\n| `Log` | browser console messages, JS errors | `observe({kind:\"console\"})` |\n\n### DOM-first rule\n\nAlways try the structured path before asking for vision:\n1. `observe({kind:\"tree\"})` \u2014 read element roles, names, bounds, enabled state.\n2. If an element is not visible in the tree, try scrolling or waiting, then re-observe.\n3. Use `observe({kind:\"console\"})` and `observe({kind:\"network\"})` (filtered \u2014 see\n below) after actions that plausibly trigger errors \u2014 errors land there before\n they surface visually.\n4. Only after the tree gives you no answer: call `look` for pixels.\n\n### Composing tree queries\n\n- `query` accepts: a bare HTML tag (`span`, `img`), CSS (`.cart span`),\n `role \"name\"` (`button \"Add to cart\"`), an explicit engine\n (`data-testid=cart-count`, `text=Subscribe`), or plain visible text.\n- Elements with a `data-testid` always appear in the default (no-query) tree with\n their `testid` \u2014 to read a counter/value, find its node and read `name` (the\n text content). Re-observe the same node after acting to verify a change.\n- `within` scopes the read: pass a selector string or a node OBJECT exactly as a\n previous observe returned it \u2014 never a JSON-stringified node.\n\n### Invisible text & contrast \u2014 no vision needed\n\nText-bearing nodes carry a `style` column = `{ color, backgroundColor, contrast }`\n(WCAG ratio 1\u201321). It is omitted by default \u2014 request it via `fields:[\"role\",\"name\",\"style\"]`\nor sweep all text in ONE call:\n`observe({kind:\"tree\", query:\"p, span, div, a, li\", filters:{contrast_lt: 4.5}})`\n(returns only hard-to-read text; empty = contrast is fine). Flag `contrast < 4.5`\nas a `medium` visual finding and `contrast < 1.5` as `high` (the text is\neffectively invisible). Always run one contrast sweep when the goal mentions\nreadability, contrast, or visual polish.\n\n### Follow links by CLICKING them \u2014 never invent URLs\n\nThe tree does not expose `href`s. To follow a link, `act({action:\"click\"})` its\nnode. Do NOT fabricate a URL from a link's label (e.g. label \"Help Center\" \u2192\nnavigating to `/help-center`): a guessed URL that 404s is YOUR error, not a site\nbug. Only `navigate` to URLs given in the goal or seen in network entries. If a\nlink's click target is hidden (e.g. inside a closed menu), click the parent menu\nitem first, then re-observe.\n\n### Verify input from the TREE, never from vision\n\nForm controls carry their LIVE state in the tree: `value` (what an\ninput/textarea/select currently holds) and `checked` (checkbox/radio). `name`\nstays the label, so you can still target the field by it.\n\nAfter typing or toggling, confirm with one `observe`:\n`observe({kind:\"tree\", query:\"input\", fields:[\"name\",\"value\",\"checked\"]})`\n\nNEVER spend a `look` asking \"did my text land?\" or \"is the box checked now?\" \u2014\nthe tree answers exactly, instantly, and for free. Vision is for how things LOOK,\nnot for reading back your own input.\n\n### Typing replaces nothing unless you say so\n\n`act({action:\"type\"})` APPENDS to whatever the field already holds. Re-typing a\nfield you have used before yields `old textnew text` \u2014 and that doubled value is\nYOUR bug, not the app's. Pass `clear: true` to replace the contents instead:\n`act({action:\"type\", target:\"...\", text:\"...\", clear:true})`.\n\nUse `clear` whenever the field may be non-empty: a retry, a second item through\nthe same form, or any field you have not just seen empty in the tree.\n\n### Login bypass\n\nIf the target has `?debug-ai=true` support (the app's captcha bypass gate),\nappend it to the login URL before navigating. This skips captcha only \u2014 not auth.\nThe app must have `ALLOW_AI_DEBUG_LOGIN=true` set in its environment.\n\n### Selectors \u2014 use the node's `target`, don't invent one\n\nMost actionable nodes from `observe({kind:\"tree\"})` carry a ready-to-use `target`\nstring (e.g. `data-testid=\"cart-count\"` when the element has a test id, else\n`role=button[name=\"Add to cart\" i]`, with `>> nth=N` when names repeat).\nWhen a node has a `target`, COPY it verbatim into `act({action, target})`.\nDo NOT hand-craft a selector \u2014 guessed CSS like `button[name=\"...\"]` will not resolve.\n\nIf a node has no `target` (unnamed/non-semantic, or a scoped `within`/`filters`\nread), you may pass its visible text as `target` (plain text resolves), or\n`role \"name\"`. Avoid XPath and positional CSS.\n\n### Console + network \u2014 filter, don't dump\n\nBoth channels support `filters` and `limit` \u2014 use them instead of reading\neverything every time:\n- `observe({kind:\"console\", filters:{level_eq:\"error\"}})` \u2014 just JS errors.\n- `observe({kind:\"network\", filters:{status_gte:400}})` \u2014 just failed requests.\n- `limit` caps rows returned when you only need the latest few.\n\nCheck both after actions that plausibly trigger errors (submits, navigations,\nAPI calls) \u2014 not mechanically after every single `act`.\n\nRecord any errors as `console` or `network` bugs with the request URL / error\nmessage as `detail` and the screenshot path as `evidence` when relevant.\n\n### Network entries carry the WHY, not just the status\n\nEach row is a full exchange: `method`, `url`, `status`, `ok`, `durationMs`,\nand for API calls (`fetch`/`xhr`) the `requestBody`, `responseBody`, and\nredacted `requestHeaders`/`responseHeaders`.\n\n**A failing request is only half-reported without its `responseBody`.** When a\nsubmit fails, do NOT stop at \"POST /api/x returned 400\" \u2014 read the row and quote\nwhat the server actually said (`{\"error\":\"password too short\"}`); that string is\nwhat turns a finding into a fix. Same for the `requestBody`: it shows whether the\nUI even sent what you typed.\n\nCredential header values arrive as `<redacted, N chars>`. That is deliberate \u2014\npresence is what you need (a missing `cookie` explains a 401), never the secret.\n\nOther reads that pay off:\n- `filters:{duration_gte:1000}` \u2014 requests slow enough to be a UX bug.\n- `filters:{body_contains:\"error\"}` \u2014 failures that still returned HTTP 200.\n\nA default `network` read hides successful static assets (scripts, styles,\nimages) and tells you how many via `hidden` \u2014 on a dev server they outnumber real\nAPI calls ~15:1 and would crowd out everything worth seeing. Failed assets are\nalways shown (a 404 image is a real bug). To inspect assets deliberately, ask:\n`observe({kind:\"network\", filters:{resource_in:[\"script\",\"stylesheet\",\"image\"]}})`.\n\n### iframes \u2014 already in the tree\n\n`observe({kind:\"tree\"})` reads embedded documents too (payment fields, editors,\nconsent screens). A node inside one carries `frame` = the iframe's URL; its\n`bounds` are page coordinates, so clicking it needs nothing special. If a\nselector mysteriously fails to resolve on a node you can see, check whether it\nhas a `frame` \u2014 and prefer clicking the node object over a hand-written selector.\n\n### Tabs \u2014 a click can open one\n\nWhen more than one tab is open, every `act` result carries a `tabs` array\n(`index`, `url`, `title`, `active`). A click on an external link, an OAuth\nbutton, or `target=\"_blank\"` opens a new tab and **you are still on the old one**\n\u2014 if a click seems to have done nothing, check `tabs` before concluding the\nbutton is broken.\n\n- `observe({kind:\"tabs\"})` \u2014 list them any time.\n- `act({action:\"switch_tab\", target:\"1\"})` \u2014 drive tab 1 from now on. Console and\n network capture follow you; what the previous tab recorded is kept.\n\nSwitch back the same way when the popup flow is done.\n";
|
|
@@ -63,6 +63,29 @@ bug. Only \`navigate\` to URLs given in the goal or seen in network entries. If
|
|
|
63
63
|
link's click target is hidden (e.g. inside a closed menu), click the parent menu
|
|
64
64
|
item first, then re-observe.
|
|
65
65
|
|
|
66
|
+
### Verify input from the TREE, never from vision
|
|
67
|
+
|
|
68
|
+
Form controls carry their LIVE state in the tree: \`value\` (what an
|
|
69
|
+
input/textarea/select currently holds) and \`checked\` (checkbox/radio). \`name\`
|
|
70
|
+
stays the label, so you can still target the field by it.
|
|
71
|
+
|
|
72
|
+
After typing or toggling, confirm with one \`observe\`:
|
|
73
|
+
\`observe({kind:"tree", query:"input", fields:["name","value","checked"]})\`
|
|
74
|
+
|
|
75
|
+
NEVER spend a \`look\` asking "did my text land?" or "is the box checked now?" —
|
|
76
|
+
the tree answers exactly, instantly, and for free. Vision is for how things LOOK,
|
|
77
|
+
not for reading back your own input.
|
|
78
|
+
|
|
79
|
+
### Typing replaces nothing unless you say so
|
|
80
|
+
|
|
81
|
+
\`act({action:"type"})\` APPENDS to whatever the field already holds. Re-typing a
|
|
82
|
+
field you have used before yields \`old textnew text\` — and that doubled value is
|
|
83
|
+
YOUR bug, not the app's. Pass \`clear: true\` to replace the contents instead:
|
|
84
|
+
\`act({action:"type", target:"...", text:"...", clear:true})\`.
|
|
85
|
+
|
|
86
|
+
Use \`clear\` whenever the field may be non-empty: a retry, a second item through
|
|
87
|
+
the same form, or any field you have not just seen empty in the tree.
|
|
88
|
+
|
|
66
89
|
### Login bypass
|
|
67
90
|
|
|
68
91
|
If the target has \`?debug-ai=true\` support (the app's captcha bypass gate),
|
|
@@ -94,5 +117,52 @@ API calls) — not mechanically after every single \`act\`.
|
|
|
94
117
|
|
|
95
118
|
Record any errors as \`console\` or \`network\` bugs with the request URL / error
|
|
96
119
|
message as \`detail\` and the screenshot path as \`evidence\` when relevant.
|
|
120
|
+
|
|
121
|
+
### Network entries carry the WHY, not just the status
|
|
122
|
+
|
|
123
|
+
Each row is a full exchange: \`method\`, \`url\`, \`status\`, \`ok\`, \`durationMs\`,
|
|
124
|
+
and for API calls (\`fetch\`/\`xhr\`) the \`requestBody\`, \`responseBody\`, and
|
|
125
|
+
redacted \`requestHeaders\`/\`responseHeaders\`.
|
|
126
|
+
|
|
127
|
+
**A failing request is only half-reported without its \`responseBody\`.** When a
|
|
128
|
+
submit fails, do NOT stop at "POST /api/x returned 400" — read the row and quote
|
|
129
|
+
what the server actually said (\`{"error":"password too short"}\`); that string is
|
|
130
|
+
what turns a finding into a fix. Same for the \`requestBody\`: it shows whether the
|
|
131
|
+
UI even sent what you typed.
|
|
132
|
+
|
|
133
|
+
Credential header values arrive as \`<redacted, N chars>\`. That is deliberate —
|
|
134
|
+
presence is what you need (a missing \`cookie\` explains a 401), never the secret.
|
|
135
|
+
|
|
136
|
+
Other reads that pay off:
|
|
137
|
+
- \`filters:{duration_gte:1000}\` — requests slow enough to be a UX bug.
|
|
138
|
+
- \`filters:{body_contains:"error"}\` — failures that still returned HTTP 200.
|
|
139
|
+
|
|
140
|
+
A default \`network\` read hides successful static assets (scripts, styles,
|
|
141
|
+
images) and tells you how many via \`hidden\` — on a dev server they outnumber real
|
|
142
|
+
API calls ~15:1 and would crowd out everything worth seeing. Failed assets are
|
|
143
|
+
always shown (a 404 image is a real bug). To inspect assets deliberately, ask:
|
|
144
|
+
\`observe({kind:"network", filters:{resource_in:["script","stylesheet","image"]}})\`.
|
|
145
|
+
|
|
146
|
+
### iframes — already in the tree
|
|
147
|
+
|
|
148
|
+
\`observe({kind:"tree"})\` reads embedded documents too (payment fields, editors,
|
|
149
|
+
consent screens). A node inside one carries \`frame\` = the iframe's URL; its
|
|
150
|
+
\`bounds\` are page coordinates, so clicking it needs nothing special. If a
|
|
151
|
+
selector mysteriously fails to resolve on a node you can see, check whether it
|
|
152
|
+
has a \`frame\` — and prefer clicking the node object over a hand-written selector.
|
|
153
|
+
|
|
154
|
+
### Tabs — a click can open one
|
|
155
|
+
|
|
156
|
+
When more than one tab is open, every \`act\` result carries a \`tabs\` array
|
|
157
|
+
(\`index\`, \`url\`, \`title\`, \`active\`). A click on an external link, an OAuth
|
|
158
|
+
button, or \`target="_blank"\` opens a new tab and **you are still on the old one**
|
|
159
|
+
— if a click seems to have done nothing, check \`tabs\` before concluding the
|
|
160
|
+
button is broken.
|
|
161
|
+
|
|
162
|
+
- \`observe({kind:"tabs"})\` — list them any time.
|
|
163
|
+
- \`act({action:"switch_tab", target:"1"})\` — drive tab 1 from now on. Console and
|
|
164
|
+
network capture follow you; what the previous tab recorded is kept.
|
|
165
|
+
|
|
166
|
+
Switch back the same way when the popup flow is done.
|
|
97
167
|
`;
|
|
98
168
|
//# sourceMappingURL=web-addendum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-addendum.js","sourceRoot":"","sources":["../../../src/agent/prompts/web-addendum.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG
|
|
1
|
+
{"version":3,"file":"web-addendum.js","sourceRoot":"","sources":["../../../src/agent/prompts/web-addendum.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8JlC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect that `.ui-debugger-mcp.json` changed after the server read it.
|
|
3
|
+
*
|
|
4
|
+
* Config is resolved ONCE at boot (`main.ts`): it decides the workspace layout,
|
|
5
|
+
* the provider, the per-role models and the self-look probe, all of which are
|
|
6
|
+
* wired into long-lived objects. Re-reading it mid-process would leave those
|
|
7
|
+
* half-updated, so the server keeps its boot-time view — correctly.
|
|
8
|
+
*
|
|
9
|
+
* What was NOT correct is doing that silently. Observed end-to-end: a run failed
|
|
10
|
+
* on a bad model id, the caller found the typo, fixed the file, started a new run
|
|
11
|
+
* — and got the identical error, because the server was still on the old config.
|
|
12
|
+
* From the caller's side the fix simply had no effect, with nothing anywhere
|
|
13
|
+
* saying why. It then retried the same thing again.
|
|
14
|
+
*
|
|
15
|
+
* So: fingerprint the file at boot, compare before each run, and if it moved,
|
|
16
|
+
* fail loud with the one instruction that actually resolves it. A stale config is
|
|
17
|
+
* a bad assumption, and the house rule is to crash on those rather than run on.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Content fingerprint of the project's config file — `null` when it is absent or
|
|
21
|
+
* unreadable (a project running on defaults has nothing to drift from).
|
|
22
|
+
*
|
|
23
|
+
* Contents, not mtime: editors and formatters rewrite files without changing
|
|
24
|
+
* anything that matters, and a spurious "restart me" is its own kind of noise.
|
|
25
|
+
*/
|
|
26
|
+
export declare function configFingerprint(cwd: string): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* A comparison against the fingerprint taken at boot. Returns whether the file
|
|
29
|
+
* has changed since — including a config that was created or deleted while the
|
|
30
|
+
* server was up, both of which change what a run would do.
|
|
31
|
+
*/
|
|
32
|
+
export declare function makeConfigWatch(cwd: string): () => boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect that `.ui-debugger-mcp.json` changed after the server read it.
|
|
3
|
+
*
|
|
4
|
+
* Config is resolved ONCE at boot (`main.ts`): it decides the workspace layout,
|
|
5
|
+
* the provider, the per-role models and the self-look probe, all of which are
|
|
6
|
+
* wired into long-lived objects. Re-reading it mid-process would leave those
|
|
7
|
+
* half-updated, so the server keeps its boot-time view — correctly.
|
|
8
|
+
*
|
|
9
|
+
* What was NOT correct is doing that silently. Observed end-to-end: a run failed
|
|
10
|
+
* on a bad model id, the caller found the typo, fixed the file, started a new run
|
|
11
|
+
* — and got the identical error, because the server was still on the old config.
|
|
12
|
+
* From the caller's side the fix simply had no effect, with nothing anywhere
|
|
13
|
+
* saying why. It then retried the same thing again.
|
|
14
|
+
*
|
|
15
|
+
* So: fingerprint the file at boot, compare before each run, and if it moved,
|
|
16
|
+
* fail loud with the one instruction that actually resolves it. A stale config is
|
|
17
|
+
* a bad assumption, and the house rule is to crash on those rather than run on.
|
|
18
|
+
*/
|
|
19
|
+
import { readFileSync } from 'node:fs';
|
|
20
|
+
import { join } from 'node:path';
|
|
21
|
+
import { CONFIG_FILENAME } from './load.js';
|
|
22
|
+
/**
|
|
23
|
+
* Content fingerprint of the project's config file — `null` when it is absent or
|
|
24
|
+
* unreadable (a project running on defaults has nothing to drift from).
|
|
25
|
+
*
|
|
26
|
+
* Contents, not mtime: editors and formatters rewrite files without changing
|
|
27
|
+
* anything that matters, and a spurious "restart me" is its own kind of noise.
|
|
28
|
+
*/
|
|
29
|
+
export function configFingerprint(cwd) {
|
|
30
|
+
try {
|
|
31
|
+
const raw = readFileSync(join(cwd, CONFIG_FILENAME), 'utf8');
|
|
32
|
+
return Bun.hash(raw).toString(16);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A comparison against the fingerprint taken at boot. Returns whether the file
|
|
40
|
+
* has changed since — including a config that was created or deleted while the
|
|
41
|
+
* server was up, both of which change what a run would do.
|
|
42
|
+
*/
|
|
43
|
+
export function makeConfigWatch(cwd) {
|
|
44
|
+
const atBoot = configFingerprint(cwd);
|
|
45
|
+
return () => configFingerprint(cwd) !== atBoot;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=fingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../../src/config/fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,EAAE,MAAM,CAAC,CAAC;QAC7D,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,GAAG,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC;AACjD,CAAC"}
|
package/dist/config/load.d.ts
CHANGED
|
@@ -21,7 +21,13 @@ export declare const CONFIG_FILENAME = ".ui-debugger-mcp.json";
|
|
|
21
21
|
export declare const OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1";
|
|
22
22
|
/** Default workspace dir (per-project sessions, profiles, logs). */
|
|
23
23
|
export declare const DEFAULT_WORKSPACE = "./tmp/ui-debugger-mcp";
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Per-role model defaults — deepseek for text (driver + summary), qwen-vl for image.
|
|
26
|
+
*
|
|
27
|
+
* Plain catalog ids, no routing suffix: the router rejects `#uptime` outright
|
|
28
|
+
* (`… is not a valid model ID`, HTTP 400), so shipping it as the default driver
|
|
29
|
+
* made a fresh install fail on its very first run. See `idea/models.md`.
|
|
30
|
+
*/
|
|
25
31
|
export declare const DEFAULT_MODELS: ResolvedModels;
|
|
26
32
|
/** Fully resolved per-role models — every role present after defaulting. */
|
|
27
33
|
export interface ResolvedModels {
|
package/dist/config/load.js
CHANGED
|
@@ -24,10 +24,16 @@ export const CONFIG_FILENAME = '.ui-debugger-mcp.json';
|
|
|
24
24
|
export const OPENROUTER_BASE_URL = 'https://openrouter.ai/api/v1';
|
|
25
25
|
/** Default workspace dir (per-project sessions, profiles, logs). */
|
|
26
26
|
export const DEFAULT_WORKSPACE = './tmp/ui-debugger-mcp';
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Per-role model defaults — deepseek for text (driver + summary), qwen-vl for image.
|
|
29
|
+
*
|
|
30
|
+
* Plain catalog ids, no routing suffix: the router rejects `#uptime` outright
|
|
31
|
+
* (`… is not a valid model ID`, HTTP 400), so shipping it as the default driver
|
|
32
|
+
* made a fresh install fail on its very first run. See `idea/models.md`.
|
|
33
|
+
*/
|
|
28
34
|
export const DEFAULT_MODELS = {
|
|
29
|
-
driver: 'deepseek/deepseek-v4-flash
|
|
30
|
-
vision: '
|
|
35
|
+
driver: 'deepseek/deepseek-v4-flash',
|
|
36
|
+
vision: 'qwen/qwen3-vl-32b-instruct',
|
|
31
37
|
summary: 'deepseek/deepseek-v4-flash',
|
|
32
38
|
};
|
|
33
39
|
/**
|
package/dist/config/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,8EAA8E;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAElE,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAEzD
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,8EAA8E;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAElE,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,MAAM,EAAE,4BAA4B;IACpC,MAAM,EAAE,4BAA4B;IACpC,OAAO,EA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AAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;aACvE,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,IAAI,WAAW,CAAC,KAAK,eAAe,kBAAkB,MAAM,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,wFAAwF;AACxF,SAAS,eAAe,CAAC,GAAuC;IAC9D,MAAM,MAAM,GAAG,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC;IAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,WAAW,CACnB,4EAA4E,CAC7E,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,mBAAmB,CAAC;IACnE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const NAME = "ui-debugger-mcp";
|
|
2
|
-
export declare const VERSION = "1.
|
|
2
|
+
export declare const VERSION = "1.3.1";
|
package/dist/index.js
CHANGED
package/dist/main.js
CHANGED
|
@@ -6,6 +6,7 @@ import { createOpenRouterProvider, resolveProviderConfig } from './agent/provide
|
|
|
6
6
|
import { runStatus, runStop } from './cli/control.js';
|
|
7
7
|
import { printUsage, runHelp, runVersion } from './cli/help.js';
|
|
8
8
|
import { runInit } from './cli/init.js';
|
|
9
|
+
import { makeConfigWatch } from './config/fingerprint.js';
|
|
9
10
|
import { loadConfig } from './config/load.js';
|
|
10
11
|
import { NAME, VERSION } from './index.js';
|
|
11
12
|
import { startStdioServer } from './mcp/server.js';
|
|
@@ -95,6 +96,9 @@ async function main() {
|
|
|
95
96
|
cwd,
|
|
96
97
|
build: builder,
|
|
97
98
|
state: new FileStatePort(workspace),
|
|
99
|
+
// Everything above was resolved from the config file as it read a moment
|
|
100
|
+
// ago; if it changes underneath us, say so instead of running on stale wiring.
|
|
101
|
+
configChanged: makeConfigWatch(cwd),
|
|
98
102
|
});
|
|
99
103
|
// Graceful stop: a CLI `stop` (or any SIGTERM/SIGINT) tears the run down —
|
|
100
104
|
// abort the loop, close the browser, free the profile — then exits cleanly.
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AA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
|
|
25
25
|
* supersedes it. The retained snapshot holds no target resources (the adapter is
|
|
26
26
|
* already closed) and never participates in the one-run gate.
|
|
27
27
|
*/
|
|
28
|
-
import type
|
|
28
|
+
import { type ResolvedConfig } from '../config/load.js';
|
|
29
29
|
import type { Target } from '../config/schema.js';
|
|
30
|
-
import type
|
|
30
|
+
import { type Findings } from '../findings/schema.js';
|
|
31
31
|
import type { SessionManager } from '../session/manager.js';
|
|
32
32
|
import type { Session, SnapshotField } from '../session/session.js';
|
|
33
33
|
import { type StatePort } from '../session/state-file.js';
|
|
@@ -123,6 +123,13 @@ export interface DebugServiceDeps {
|
|
|
123
123
|
defaultTimeoutMs?: number;
|
|
124
124
|
/** Injected clock (epoch ms) for session ids + the run deadline; defaults to `Date.now`. */
|
|
125
125
|
now?: () => number;
|
|
126
|
+
/**
|
|
127
|
+
* Has `.ui-debugger-mcp.json` changed since boot? Config is resolved once and
|
|
128
|
+
* wired into long-lived objects, so a changed file means every later run would
|
|
129
|
+
* silently use the OLD settings — see `config/fingerprint.ts`. Defaults to
|
|
130
|
+
* "never changed" (unit tests hold no file).
|
|
131
|
+
*/
|
|
132
|
+
configChanged?: () => boolean;
|
|
126
133
|
}
|
|
127
134
|
export declare class DebugService implements DebugApi {
|
|
128
135
|
#private;
|
|
@@ -25,11 +25,26 @@
|
|
|
25
25
|
* supersedes it. The retained snapshot holds no target resources (the adapter is
|
|
26
26
|
* already closed) and never participates in the one-run gate.
|
|
27
27
|
*/
|
|
28
|
-
import {
|
|
28
|
+
import { CONFIG_FILENAME } from '../config/load.js';
|
|
29
|
+
import { ConfigError, SessionBusyError, SessionNotFoundError, SessionSettledError, TargetNotFoundError, } from '../errors.js';
|
|
30
|
+
import { FindingsSchema } from '../findings/schema.js';
|
|
29
31
|
import { noopStatePort } from '../session/state-file.js';
|
|
30
32
|
import { generateSessionId } from '../session/workspace.js';
|
|
31
33
|
/** Default wall-clock cap on a debug run before it auto-ends (overridable per run). */
|
|
32
34
|
export const DEFAULT_SESSION_TIMEOUT_MS = 300_000;
|
|
35
|
+
/**
|
|
36
|
+
* Narrow a findings object to the requested keys — the `fields` projection for a
|
|
37
|
+
* snapshot read off disk (a live {@link Session} projects its own).
|
|
38
|
+
*/
|
|
39
|
+
function projectFindings(findings, fields) {
|
|
40
|
+
const out = {};
|
|
41
|
+
for (const field of fields) {
|
|
42
|
+
// Assigning key-by-key off a validated object; the index signature is what
|
|
43
|
+
// makes this need the cast, not any doubt about the value's type.
|
|
44
|
+
out[field] = findings[field];
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
33
48
|
export class DebugService {
|
|
34
49
|
#manager;
|
|
35
50
|
#config;
|
|
@@ -38,6 +53,7 @@ export class DebugService {
|
|
|
38
53
|
#state;
|
|
39
54
|
#defaultTimeoutMs;
|
|
40
55
|
#now;
|
|
56
|
+
#configChanged;
|
|
41
57
|
/** Live wall-clock timer for the active run; cleared when the run ends. */
|
|
42
58
|
#timer;
|
|
43
59
|
/**
|
|
@@ -62,6 +78,7 @@ export class DebugService {
|
|
|
62
78
|
this.#state = deps.state ?? noopStatePort;
|
|
63
79
|
this.#defaultTimeoutMs = deps.defaultTimeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS;
|
|
64
80
|
this.#now = deps.now ?? (() => Date.now());
|
|
81
|
+
this.#configChanged = deps.configChanged ?? (() => false);
|
|
65
82
|
}
|
|
66
83
|
/**
|
|
67
84
|
* Open a run: assemble the session, take the profile lock, point the adapter at
|
|
@@ -87,6 +104,9 @@ export class DebugService {
|
|
|
87
104
|
throw new SessionBusyError(`A debug session is already starting for '${cwd}'. ` +
|
|
88
105
|
'Wait for it to open (or end it) before starting another — one run per project at a time.');
|
|
89
106
|
}
|
|
107
|
+
// Before anything is launched: a run built from config the caller has already
|
|
108
|
+
// replaced is worse than no run — it reproduces the very failure they just fixed.
|
|
109
|
+
this.#assertConfigFresh();
|
|
90
110
|
this.#starting = true;
|
|
91
111
|
const deadline = this.#now() + (timeoutMs ?? this.#defaultTimeoutMs);
|
|
92
112
|
/** Budget left on the caller's cap; never negative — a blown budget is simply spent. */
|
|
@@ -134,6 +154,21 @@ export class DebugService {
|
|
|
134
154
|
this.#starting = false;
|
|
135
155
|
}
|
|
136
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Refuse to start on config this server can no longer honour.
|
|
159
|
+
*
|
|
160
|
+
* The message names the one action that works. Without it the caller edits the
|
|
161
|
+
* file, sees the identical failure, and has no way to tell a bad fix from an
|
|
162
|
+
* unread one — which is exactly how a real session burned two runs.
|
|
163
|
+
*/
|
|
164
|
+
#assertConfigFresh() {
|
|
165
|
+
if (!this.#configChanged())
|
|
166
|
+
return;
|
|
167
|
+
throw new ConfigError(`${CONFIG_FILENAME} changed on disk after this ui-debugger-mcp server started, so a run now ` +
|
|
168
|
+
'would still use the OLD settings (models, targets, urls are read once at boot). ' +
|
|
169
|
+
'Restart the MCP server to pick the new config up — in Claude Code, /mcp → reconnect ' +
|
|
170
|
+
'ui-debugger, or restart the session.');
|
|
171
|
+
}
|
|
137
172
|
/**
|
|
138
173
|
* The other half of the one-run gate: another *live* server process holding a
|
|
139
174
|
* run on this project. The manager only sees this process's memory, so without
|
|
@@ -147,8 +182,10 @@ export class DebugService {
|
|
|
147
182
|
if (foreign === null)
|
|
148
183
|
return;
|
|
149
184
|
throw new SessionBusyError(`Another ui-debugger-mcp server (pid ${foreign.pid}) already has a debug session ` +
|
|
150
|
-
`('${foreign.sessionId}') active for '${cwd}'.
|
|
151
|
-
|
|
185
|
+
`('${foreign.sessionId}') active for '${cwd}'. One run per project at a time. ` +
|
|
186
|
+
`Read what it is doing with get_findings({session_id:'${foreign.sessionId}'}) — a run ` +
|
|
187
|
+
'that has already settled is just waiting to be closed by its own client. To take the ' +
|
|
188
|
+
"project over, run 'ui-debugger-mcp stop' in this directory, then start again.");
|
|
152
189
|
}
|
|
153
190
|
/**
|
|
154
191
|
* Arm the wall-clock cap on what is LEFT of the run's budget: auto-end the run when
|
|
@@ -190,9 +227,34 @@ export class DebugService {
|
|
|
190
227
|
* long-poll returns at once: a settled run has nothing left to wait for).
|
|
191
228
|
*/
|
|
192
229
|
async getFindings({ session_id, wait, fields, }) {
|
|
193
|
-
|
|
230
|
+
let session;
|
|
231
|
+
try {
|
|
232
|
+
session = this.#requireReadable(session_id);
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
// Our own memory has no such run — but another live server on this project
|
|
236
|
+
// might, and `start_debug` has already named that session to this caller.
|
|
237
|
+
// Answering "no such session" there is a contradiction that sends the
|
|
238
|
+
// caller into a retry loop; serve what that run has flushed instead.
|
|
239
|
+
const foreign = await this.#foreignSnapshot(session_id);
|
|
240
|
+
if (foreign)
|
|
241
|
+
return fields ? projectFindings(foreign, fields) : foreign;
|
|
242
|
+
throw error;
|
|
243
|
+
}
|
|
194
244
|
return fields ? session.snapshot(fields, wait) : session.snapshot(undefined, wait);
|
|
195
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* A foreign run's findings as last flushed to disk, or `null` if this id names
|
|
248
|
+
* no such run. Read-only and point-in-time: we do not own that run, so there is
|
|
249
|
+
* nothing to long-poll — the owning server is the one advancing it.
|
|
250
|
+
*/
|
|
251
|
+
async #foreignSnapshot(session_id) {
|
|
252
|
+
const raw = await this.#state.foreignFindings(session_id);
|
|
253
|
+
if (raw === null)
|
|
254
|
+
return null;
|
|
255
|
+
const parsed = FindingsSchema.safeParse(raw);
|
|
256
|
+
return parsed.success ? parsed.data : null;
|
|
257
|
+
}
|
|
196
258
|
/** List configured targets (the whole catalog, or one when named) plus resolved models/workspace. */
|
|
197
259
|
describe({ target }) {
|
|
198
260
|
const entries = Object.entries(this.#config.targets);
|