@developerz.ai/ui-debugger-mcp 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -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/belt/act.js
CHANGED
|
@@ -29,8 +29,16 @@
|
|
|
29
29
|
import { tool } from 'ai';
|
|
30
30
|
import { z } from 'zod';
|
|
31
31
|
import { AgentError } from '../../errors.js';
|
|
32
|
-
/** The
|
|
33
|
-
export const ACT_ACTIONS = [
|
|
32
|
+
/** The action verbs `act` routes to the shared contract. */
|
|
33
|
+
export const ACT_ACTIONS = [
|
|
34
|
+
'click',
|
|
35
|
+
'type',
|
|
36
|
+
'key',
|
|
37
|
+
'scroll',
|
|
38
|
+
'navigate',
|
|
39
|
+
'wait',
|
|
40
|
+
'switch_tab',
|
|
41
|
+
];
|
|
34
42
|
/**
|
|
35
43
|
* `act` input — ONE flat object the driver fills per call: `action` picks the
|
|
36
44
|
* verb, the rest are its (optional) operands, validated per-action in
|
|
@@ -44,12 +52,18 @@ export const ACT_ACTIONS = ['click', 'type', 'key', 'scroll', 'navigate', 'wait'
|
|
|
44
52
|
* text" out of the schema and into a loud runtime check.
|
|
45
53
|
*/
|
|
46
54
|
export const ActInputSchema = z.object({
|
|
47
|
-
action: z
|
|
55
|
+
action: z
|
|
56
|
+
.enum(ACT_ACTIONS)
|
|
57
|
+
.describe('what to do: click | type | key | scroll | navigate | wait | switch_tab'),
|
|
48
58
|
target: z
|
|
49
59
|
.string()
|
|
50
60
|
.optional()
|
|
51
|
-
.describe('what to act on — CSS, role+name (button "Save"), or visible text (web); navigate: URL/window/activity; wait: selector to await (required unless networkIdle); scroll: region to scroll within (optional)'),
|
|
61
|
+
.describe('what to act on — CSS, role+name (button "Save"), or visible text (web); navigate: URL/window/activity; wait: selector to await (required unless networkIdle); scroll: region to scroll within (optional); switch_tab: tab index from observe({kind:"tabs"})'),
|
|
52
62
|
text: z.string().optional().describe('text to type (action=type)'),
|
|
63
|
+
clear: z
|
|
64
|
+
.boolean()
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('replace the field contents instead of appending to them (action=type)'),
|
|
53
67
|
key: z
|
|
54
68
|
.string()
|
|
55
69
|
.optional()
|
|
@@ -107,6 +121,18 @@ function required(value, field, action) {
|
|
|
107
121
|
}
|
|
108
122
|
return value;
|
|
109
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* The tab index `switch_tab` names. `target` is a string for every other verb, so
|
|
126
|
+
* the index arrives as one — reject anything that is not a whole, non-negative
|
|
127
|
+
* number rather than silently driving tab 0.
|
|
128
|
+
*/
|
|
129
|
+
function tabIndex(target) {
|
|
130
|
+
const index = Number(target.trim());
|
|
131
|
+
if (!Number.isInteger(index) || index < 0) {
|
|
132
|
+
throw new AgentError(`act 'switch_tab' needs a tab index as 'target' (e.g. "1"), got ${JSON.stringify(target)} — list them with observe({kind:"tabs"})`);
|
|
133
|
+
}
|
|
134
|
+
return index;
|
|
135
|
+
}
|
|
110
136
|
/**
|
|
111
137
|
* Label an act from its INPUT — the fallback for a step that threw before a
|
|
112
138
|
* target-derived label existed. Never echoes `text` (typed secrets stay out of
|
|
@@ -133,6 +159,23 @@ async function performAct(adapter, input) {
|
|
|
133
159
|
// the real `requires 'text'` failure, nor cost an unnecessary `find()`.
|
|
134
160
|
const text = required(input.text, 'text', 'type');
|
|
135
161
|
const node = await resolve(adapter, required(input.target, 'target', 'type'));
|
|
162
|
+
if (input.clear === true) {
|
|
163
|
+
// `type` appends by design (it focuses and types, it does not `fill`), so
|
|
164
|
+
// re-typing a field silently produced doubled values like
|
|
165
|
+
// "Finish project reportFinish project report" — which the driver then
|
|
166
|
+
// reported as an app bug.
|
|
167
|
+
//
|
|
168
|
+
// Empty the field FIRST, then type: select-all-then-type would not work,
|
|
169
|
+
// because every `type` focuses its target by clicking, and that click
|
|
170
|
+
// collapses the selection it was meant to overwrite. Deleting instead
|
|
171
|
+
// leaves an empty field, where the re-click's caret position is moot.
|
|
172
|
+
// Built from existing contract verbs, so desktop and android get it too.
|
|
173
|
+
await adapter.type(node, '');
|
|
174
|
+
await adapter.pressKey('Control+a');
|
|
175
|
+
await adapter.pressKey('Delete');
|
|
176
|
+
await adapter.type(node, text);
|
|
177
|
+
return `type ${text.length} chars into ${describeNode(node)} (replacing)`;
|
|
178
|
+
}
|
|
136
179
|
await adapter.type(node, text);
|
|
137
180
|
return `type ${text.length} chars into ${describeNode(node)}`;
|
|
138
181
|
}
|
|
@@ -167,6 +210,14 @@ async function performAct(adapter, input) {
|
|
|
167
210
|
await adapter.scroll({ direction, amount: input.amount, within: input.target });
|
|
168
211
|
return `scroll ${direction}${input.amount !== undefined ? ` ${input.amount}px` : ''}`;
|
|
169
212
|
}
|
|
213
|
+
case 'switch_tab': {
|
|
214
|
+
if (!adapter.selectTab) {
|
|
215
|
+
throw new AgentError("act 'switch_tab' is not supported on this target (web only)");
|
|
216
|
+
}
|
|
217
|
+
const index = tabIndex(required(input.target, 'target', 'switch_tab'));
|
|
218
|
+
await adapter.selectTab(index);
|
|
219
|
+
return `switch to tab ${index}`;
|
|
220
|
+
}
|
|
170
221
|
default: {
|
|
171
222
|
const unreachable = input.action;
|
|
172
223
|
throw new AgentError(`unknown act action: ${JSON.stringify(unreachable)}`);
|
|
@@ -198,7 +249,13 @@ export async function runAct(adapter, recorder, input, trail) {
|
|
|
198
249
|
const screenshot = await recorder.saveScreenshot(label, png);
|
|
199
250
|
await recorder.appendLog('agent', `act ${label} → ${screenshot}`);
|
|
200
251
|
trail?.record({ step: label, ok: true, screenshot });
|
|
201
|
-
return {
|
|
252
|
+
return {
|
|
253
|
+
action: input.action,
|
|
254
|
+
label,
|
|
255
|
+
ok: true,
|
|
256
|
+
screenshot,
|
|
257
|
+
...(await extraTabs(adapter)),
|
|
258
|
+
};
|
|
202
259
|
}
|
|
203
260
|
catch (error) {
|
|
204
261
|
trail?.record({ step: label, ok: false, note: failureNote(error) });
|
|
@@ -210,16 +267,56 @@ export async function runAct(adapter, recorder, input, trail) {
|
|
|
210
267
|
settle?.();
|
|
211
268
|
}
|
|
212
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* The open tabs, but only when there is more than one to report — see
|
|
272
|
+
* {@link ActResult.tabs}. Never fails an otherwise-good act: a target that
|
|
273
|
+
* cannot list tabs, or one that throws mid-teardown, simply reports none.
|
|
274
|
+
*/
|
|
275
|
+
async function extraTabs(adapter) {
|
|
276
|
+
if (!adapter.tabs)
|
|
277
|
+
return {};
|
|
278
|
+
try {
|
|
279
|
+
const tabs = await adapter.tabs();
|
|
280
|
+
return tabs.length > 1 ? { tabs } : {};
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return {};
|
|
284
|
+
}
|
|
285
|
+
}
|
|
213
286
|
/**
|
|
214
287
|
* Build the `act` tool bound to one adapter + recorder, for the debug agent's belt.
|
|
215
288
|
* `trail` (when wired by the loop) is the run's shared step trail, so every act —
|
|
216
289
|
* the ones that worked and the ones that threw — lands in the persisted findings.
|
|
217
290
|
*/
|
|
218
291
|
export function createActTool(adapter, recorder, trail) {
|
|
292
|
+
/**
|
|
293
|
+
* Acts run ONE AT A TIME, however many the driver emits in a step.
|
|
294
|
+
*
|
|
295
|
+
* A model routinely batches independent-looking actions into a single step —
|
|
296
|
+
* `type` the email and `type` the password — and the SDK executes a step's tool
|
|
297
|
+
* calls concurrently. But an act is compound (focus the target, then type into
|
|
298
|
+
* it) and keyboard input is dispatched at the PAGE, not at an element: two acts
|
|
299
|
+
* in flight interleave their keystrokes into whichever field last took focus.
|
|
300
|
+
*
|
|
301
|
+
* Observed end-to-end: a registration typed
|
|
302
|
+
* `tTeessttuPsaesrs1TestPass123!…` into the password field and the app happily
|
|
303
|
+
* created the account. Nothing errored — the run just silently tested something
|
|
304
|
+
* other than what it typed, which is the worst failure mode a debugger can have.
|
|
305
|
+
*
|
|
306
|
+
* Chaining here rather than locking the adapter: the atomic unit is the whole
|
|
307
|
+
* act, not any single contract call it makes.
|
|
308
|
+
*/
|
|
309
|
+
let queue = Promise.resolve();
|
|
219
310
|
return tool({
|
|
220
|
-
description: 'Drive the target with one action, chosen by action: click | type | key | scroll | navigate | wait. Resolves target via find, then routes to the adapter (click/type/open/waitFor) and records a step to agent.log plus a post-action screenshot. Use observe to read state before and after.',
|
|
311
|
+
description: 'Drive the target with one action, chosen by action: click | type | key | scroll | navigate | wait | switch_tab. Resolves target via find, then routes to the adapter (click/type/open/waitFor) and records a step to agent.log plus a post-action screenshot. Returns tabs when more than one is open — a click may have opened one. Use observe to read state before and after.',
|
|
221
312
|
inputSchema: ActInputSchema,
|
|
222
|
-
execute: (input) =>
|
|
313
|
+
execute: (input) => {
|
|
314
|
+
const next = queue.then(() => runAct(adapter, recorder, input, trail));
|
|
315
|
+
// The chain must survive a failed act: swallow the rejection on the QUEUE
|
|
316
|
+
// copy only, so a thrown act still reaches the driver via `next`.
|
|
317
|
+
queue = next.catch(() => undefined);
|
|
318
|
+
return next;
|
|
319
|
+
},
|
|
223
320
|
});
|
|
224
321
|
}
|
|
225
322
|
//# sourceMappingURL=act.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"act.js","sourceRoot":"","sources":["../../../src/agent/belt/act.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,
|
|
1
|
+
{"version":3,"file":"act.js","sourceRoot":"","sources":["../../../src/agent/belt/act.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH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ACtF;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,KAAK,GAAqB,OAAO,CAAC,OAAO,EAAE,CAAC;IAEhD,OAAO,IAAI,CAAC;QACV,WAAW,EACT,kXAAkX;QACpX,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;YACvE,0EAA0E;YAC1E,kEAAkE;YAClE,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -85,7 +85,7 @@ export interface EvidenceRecorder {
|
|
|
85
85
|
* Pins the reply to the exact JSON `look` parses, so any competent multimodal
|
|
86
86
|
* model behaves the same (never relies on a 3rd-party default).
|
|
87
87
|
*/
|
|
88
|
-
export declare const VISION_SYSTEM_PROMPT = "You are the vision guy \u2014 the eyes of a blind UI-testing driver.\nYou are given a screenshot of the target UI plus a question and/or an expected look.\nDescribe what you see and judge how it looks: layout, alignment, spacing, colour,\noverlap, cut-off or unreadable text \u2014 anything that looks broken or off.\n\nReply with ONLY a JSON object (no prose, no markdown fences) of this exact shape:\n\n{\n \"description\": \"what you see, answering the question if one was asked\",\n \"matches\": true, // include ONLY when an expected look was given: does it match it?\n \"issues\": [ // visual problems found; [] when there are none\n { \"what\": \"the problem\", \"where\": \"where on screen\", \"severity\": \"low\" | \"medium\" | \"high\" }\n ]\n}\n\nSeverity: high =
|
|
88
|
+
export declare const VISION_SYSTEM_PROMPT = "You are the vision guy \u2014 the eyes of a blind UI-testing driver.\nYou are given a screenshot of the target UI plus a question and/or an expected look.\nDescribe what you see and judge how it looks: layout, alignment, spacing, colour,\noverlap, cut-off or unreadable text \u2014 anything that looks broken or off.\n\nReply with ONLY a JSON object (no prose, no markdown fences) of this exact shape:\n\n{\n \"description\": \"what you see, answering the question if one was asked\",\n \"matches\": true, // include ONLY when an expected look was given: does it match it?\n \"issues\": [ // visual problems found; [] when there are none\n { \"what\": \"the problem\", \"where\": \"where on screen\", \"severity\": \"low\" | \"medium\" | \"high\" }\n ]\n}\n\nSeverity, by user impact: high = a user cannot read or use something (overlap,\ninvisible interactive element, text cut off mid-word, broken layout);\nmedium = it works but looks wrong (misalignment, cramped or uneven spacing, weak\ncontrast); low = polish (a few pixels off, a slightly odd shade, icon sizing).\nBe concrete about \"where\" (e.g. \"top-right header\", \"primary submit button\").\n\n## Report only what is ON this screenshot\n\n- `\"issues\": []` is a normal, useful answer. An empty list is not a failure to\n find something \u2014 a clean screen is a real result. Never pad the list to look thorough.\n- Judge only what is VISIBLE here. This is one viewport, not the whole page:\n content below the fold is not \"missing\", and you cannot see hover, focus,\n animation, other screen sizes, or what happens after a click. Do not report any\n of those.\n- Do not judge whether the CONTENT is correct \u2014 whether a total is right, a name is\n the expected one, a list holds the intended items. You cannot know the intent.\n Report how it LOOKS. If something reads as obviously placeholder (\"lorem ipsum\",\n \"undefined\", \"NaN\", an empty state where data was clearly expected), that IS\n visual and worth flagging.\n- If you are unsure whether something is a defect or the intended design, say so in\n `description` and leave it out of `issues`. A speculative issue costs the driver\n a real investigation.\n\n## If you were asked to read back a value\n\nWhen the question is just \"what does this field contain?\" / \"is the box checked?\" /\n\"what does this text say?\", answer it plainly in `description` \u2014 and add one\nsentence noting the driver can read this structurally from\n`observe({kind:\"tree\"})` (fields `value`, `checked`, `name`), which is exact\nwhere a screenshot is a guess. Reading small text off pixels is the one thing you\nare worst at; say when you are unsure rather than guessing a value.\n\nOutput the JSON object and nothing else.";
|
|
89
89
|
/** Whether a provider error says the vision model rejected image input (text-only model). */
|
|
90
90
|
export declare function isImageRejection(message: string): boolean;
|
|
91
91
|
/** The latched, actionable message the driver gets when the vision model is text-only. */
|
package/dist/agent/belt/look.js
CHANGED
|
@@ -67,9 +67,38 @@ Reply with ONLY a JSON object (no prose, no markdown fences) of this exact shape
|
|
|
67
67
|
]
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
Severity: high =
|
|
71
|
-
|
|
70
|
+
Severity, by user impact: high = a user cannot read or use something (overlap,
|
|
71
|
+
invisible interactive element, text cut off mid-word, broken layout);
|
|
72
|
+
medium = it works but looks wrong (misalignment, cramped or uneven spacing, weak
|
|
73
|
+
contrast); low = polish (a few pixels off, a slightly odd shade, icon sizing).
|
|
72
74
|
Be concrete about "where" (e.g. "top-right header", "primary submit button").
|
|
75
|
+
|
|
76
|
+
## Report only what is ON this screenshot
|
|
77
|
+
|
|
78
|
+
- \`"issues": []\` is a normal, useful answer. An empty list is not a failure to
|
|
79
|
+
find something — a clean screen is a real result. Never pad the list to look thorough.
|
|
80
|
+
- Judge only what is VISIBLE here. This is one viewport, not the whole page:
|
|
81
|
+
content below the fold is not "missing", and you cannot see hover, focus,
|
|
82
|
+
animation, other screen sizes, or what happens after a click. Do not report any
|
|
83
|
+
of those.
|
|
84
|
+
- Do not judge whether the CONTENT is correct — whether a total is right, a name is
|
|
85
|
+
the expected one, a list holds the intended items. You cannot know the intent.
|
|
86
|
+
Report how it LOOKS. If something reads as obviously placeholder ("lorem ipsum",
|
|
87
|
+
"undefined", "NaN", an empty state where data was clearly expected), that IS
|
|
88
|
+
visual and worth flagging.
|
|
89
|
+
- If you are unsure whether something is a defect or the intended design, say so in
|
|
90
|
+
\`description\` and leave it out of \`issues\`. A speculative issue costs the driver
|
|
91
|
+
a real investigation.
|
|
92
|
+
|
|
93
|
+
## If you were asked to read back a value
|
|
94
|
+
|
|
95
|
+
When the question is just "what does this field contain?" / "is the box checked?" /
|
|
96
|
+
"what does this text say?", answer it plainly in \`description\` — and add one
|
|
97
|
+
sentence noting the driver can read this structurally from
|
|
98
|
+
\`observe({kind:"tree"})\` (fields \`value\`, \`checked\`, \`name\`), which is exact
|
|
99
|
+
where a screenshot is a guess. Reading small text off pixels is the one thing you
|
|
100
|
+
are worst at; say when you are unsure rather than guessing a value.
|
|
101
|
+
|
|
73
102
|
Output the JSON object and nothing else.`;
|
|
74
103
|
/** Compose the driver's question + expectation into the vision guy's user prompt. */
|
|
75
104
|
function buildPrompt({ question, expect }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"look.js","sourceRoot":"","sources":["../../../src/agent/belt/look.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAErE,wFAAwF;AACxF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,+EAA+E,CAAC;IAC5F,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,4EAA4E,CAAC;CAC1F,CAAC,CAAC;AAIH,6EAA6E;AAC7E,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAEtD,uEAAuE;AACvE,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IACvE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;IAC3E,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,6CAA6C,CAAC;CACrF,CAAC,CAAC;AAIH,yFAAyF;AACzF,MAAM,iBAAi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AK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;YACtF,OAAO,EAAE,IAAI,EAAE,CAAC;QAClB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3D,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;YAC/E,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/D,OAAO,IAAI,CAAC;QACV,WAAW,EACT,0XAA0X;QAC5X,WAAW,EAAE,eAAe;QAC5B,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC;KACjE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -24,34 +24,38 @@
|
|
|
24
24
|
* swallow it or silently fall back.
|
|
25
25
|
*/
|
|
26
26
|
import { z } from 'zod';
|
|
27
|
-
import type { Adapter, ConsoleEntry, NetworkEntry, Node, NodeRef } from '../../adapters/contract.js';
|
|
27
|
+
import type { Adapter, ConsoleEntry, NetworkEntry, Node, NodeRef, TabInfo } from '../../adapters/contract.js';
|
|
28
28
|
import type { EvidenceRecorder } from './look.js';
|
|
29
29
|
/**
|
|
30
30
|
* The four observable channels `kind` selects (each routes to one contract method).
|
|
31
31
|
* Exported so the prompt-vs-schema drift guard (`prompts/schema-drift.test.ts`) can
|
|
32
32
|
* assert every `kind:"…"` example the prompts teach is one the belt actually accepts.
|
|
33
33
|
*/
|
|
34
|
-
export declare const OBSERVE_KINDS: readonly ["tree", "screenshot", "console", "network"];
|
|
34
|
+
export declare const OBSERVE_KINDS: readonly ["tree", "screenshot", "console", "network", "tabs"];
|
|
35
35
|
/**
|
|
36
36
|
* Selectable {@link Node} columns — the `fields` projection whitelist (contract-level).
|
|
37
37
|
* Exported for the same drift guard as {@link OBSERVE_KINDS}.
|
|
38
38
|
*/
|
|
39
|
-
export declare const NODE_FIELDS: readonly ["role", "name", "bounds", "enabled", "testid", "style"];
|
|
39
|
+
export declare const NODE_FIELDS: readonly ["role", "name", "bounds", "enabled", "testid", "style", "frame", "value", "checked"];
|
|
40
40
|
/** `observe` input — flat + SQL-like; `kind` picks the table, the rest compose the read. */
|
|
41
41
|
export declare const ObserveInputSchema: z.ZodObject<{
|
|
42
42
|
kind: z.ZodEnum<{
|
|
43
43
|
screenshot: "screenshot";
|
|
44
44
|
console: "console";
|
|
45
45
|
network: "network";
|
|
46
|
+
tabs: "tabs";
|
|
46
47
|
tree: "tree";
|
|
47
48
|
}>;
|
|
48
49
|
query: z.ZodOptional<z.ZodString>;
|
|
49
50
|
fields: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
51
|
+
value: "value";
|
|
50
52
|
name: "name";
|
|
53
|
+
frame: "frame";
|
|
51
54
|
bounds: "bounds";
|
|
52
55
|
enabled: "enabled";
|
|
53
56
|
role: "role";
|
|
54
57
|
testid: "testid";
|
|
58
|
+
checked: "checked";
|
|
55
59
|
style: "style";
|
|
56
60
|
}>>>;
|
|
57
61
|
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
|
|
@@ -87,10 +91,18 @@ export type ObserveResult = {
|
|
|
87
91
|
kind: 'console';
|
|
88
92
|
count: number;
|
|
89
93
|
entries: ConsoleEntry[];
|
|
94
|
+
} | {
|
|
95
|
+
kind: 'tabs';
|
|
96
|
+
count: number;
|
|
97
|
+
tabs: TabInfo[];
|
|
90
98
|
} | {
|
|
91
99
|
kind: 'network';
|
|
92
100
|
count: number;
|
|
93
101
|
entries: NetworkEntry[];
|
|
102
|
+
/** Static-asset rows a default read held back (absent when none were). */
|
|
103
|
+
hidden?: number;
|
|
104
|
+
/** How to see the held-back rows — present only alongside {@link hidden}. */
|
|
105
|
+
hint?: string;
|
|
94
106
|
};
|
|
95
107
|
/**
|
|
96
108
|
* Resolve `within` to something the {@link Adapter} contract takes — a selector string
|
|
@@ -111,9 +123,9 @@ export declare function coerceWithin(within: ObserveInput['within']): NodeRef |
|
|
|
111
123
|
export declare function runObserve(adapter: Adapter, recorder: EvidenceRecorder, input: ObserveInput): Promise<ObserveResult>;
|
|
112
124
|
/** Build the `observe` tool bound to one adapter + recorder, for the debug agent's belt. */
|
|
113
125
|
export declare function createObserveTool(adapter: Adapter, recorder: EvidenceRecorder): import("ai").Tool<{
|
|
114
|
-
kind: "screenshot" | "console" | "network" | "tree";
|
|
126
|
+
kind: "screenshot" | "console" | "network" | "tabs" | "tree";
|
|
115
127
|
query?: string | undefined;
|
|
116
|
-
fields?: ("name" | "bounds" | "enabled" | "role" | "testid" | "style")[] | undefined;
|
|
128
|
+
fields?: ("value" | "name" | "frame" | "bounds" | "enabled" | "role" | "testid" | "checked" | "style")[] | undefined;
|
|
117
129
|
filters?: Record<string, string | number | boolean | string[]> | undefined;
|
|
118
130
|
limit?: number | undefined;
|
|
119
131
|
within?: string | {
|
|
@@ -31,7 +31,7 @@ import { AgentError } from '../../errors.js';
|
|
|
31
31
|
* Exported so the prompt-vs-schema drift guard (`prompts/schema-drift.test.ts`) can
|
|
32
32
|
* assert every `kind:"…"` example the prompts teach is one the belt actually accepts.
|
|
33
33
|
*/
|
|
34
|
-
export const OBSERVE_KINDS = ['tree', 'screenshot', 'console', 'network'];
|
|
34
|
+
export const OBSERVE_KINDS = ['tree', 'screenshot', 'console', 'network', 'tabs'];
|
|
35
35
|
/**
|
|
36
36
|
* Selectable {@link Node} columns — the `fields` projection whitelist (contract-level).
|
|
37
37
|
* Exported for the same drift guard as {@link OBSERVE_KINDS}.
|
|
@@ -43,6 +43,9 @@ export const NODE_FIELDS = [
|
|
|
43
43
|
'enabled',
|
|
44
44
|
'testid',
|
|
45
45
|
'style',
|
|
46
|
+
'frame',
|
|
47
|
+
'value',
|
|
48
|
+
'checked',
|
|
46
49
|
];
|
|
47
50
|
/**
|
|
48
51
|
* Columns a no-`fields` read returns. `style` (colour + contrast per text node)
|
|
@@ -55,6 +58,9 @@ const DEFAULT_PROJECTION = [
|
|
|
55
58
|
'bounds',
|
|
56
59
|
'enabled',
|
|
57
60
|
'testid',
|
|
61
|
+
'frame',
|
|
62
|
+
'value',
|
|
63
|
+
'checked',
|
|
58
64
|
];
|
|
59
65
|
/**
|
|
60
66
|
* Rows a no-`limit` `console`/`network` read returns (newest first, so the cap keeps
|
|
@@ -64,6 +70,29 @@ const DEFAULT_PROJECTION = [
|
|
|
64
70
|
* entries × remaining steps of context. An explicit `limit` (including `0`) still wins.
|
|
65
71
|
*/
|
|
66
72
|
const DEFAULT_LOG_LIMIT = 50;
|
|
73
|
+
/**
|
|
74
|
+
* Resource types a default `network` read keeps: the app talking to its backend,
|
|
75
|
+
* plus the navigation itself.
|
|
76
|
+
*
|
|
77
|
+
* A page's traffic is overwhelmingly static assets — measured on a Vite dev
|
|
78
|
+
* server, one real API call for every fifteen `script` loads (HMR re-requests
|
|
79
|
+
* every module). Reading the newest 50 rows there returns fifty module fetches
|
|
80
|
+
* and not one API call, which makes the channel useless exactly where it matters
|
|
81
|
+
* most. Assets stay one explicit `resource_in` away (see {@link keepByDefault}).
|
|
82
|
+
*/
|
|
83
|
+
const API_RESOURCE_TYPES = new Set(['fetch', 'xhr', 'websocket', 'eventsource', 'document']);
|
|
84
|
+
/**
|
|
85
|
+
* Whether a default (unfiltered) `network` read shows this entry.
|
|
86
|
+
*
|
|
87
|
+
* Anything that FAILED is kept whatever its type — a 404 stylesheet or a broken
|
|
88
|
+
* image is a real bug, and hiding it to cut noise would defeat the point. An
|
|
89
|
+
* entry with no resource type is kept too: unknown is not the same as static.
|
|
90
|
+
*/
|
|
91
|
+
function keepByDefault(entry) {
|
|
92
|
+
if (!entry.ok)
|
|
93
|
+
return true;
|
|
94
|
+
return entry.resourceType === undefined || API_RESOURCE_TYPES.has(entry.resourceType);
|
|
95
|
+
}
|
|
67
96
|
/** One `filters` predicate value; arrays back `_in`-style set membership (matches `FilterValue`). */
|
|
68
97
|
const FilterValueSchema = z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]);
|
|
69
98
|
/** On-screen rectangle backing a {@link Node} `within` reference. */
|
|
@@ -90,7 +119,9 @@ const NodeSchema = z.object({
|
|
|
90
119
|
});
|
|
91
120
|
/** `observe` input — flat + SQL-like; `kind` picks the table, the rest compose the read. */
|
|
92
121
|
export const ObserveInputSchema = z.object({
|
|
93
|
-
kind: z
|
|
122
|
+
kind: z
|
|
123
|
+
.enum(OBSERVE_KINDS)
|
|
124
|
+
.describe('channel to read: tree | screenshot | console | network | tabs'),
|
|
94
125
|
query: z
|
|
95
126
|
.string()
|
|
96
127
|
.optional()
|
|
@@ -278,8 +309,34 @@ export async function runObserve(adapter, recorder, input) {
|
|
|
278
309
|
return { kind, count: entries.length, entries };
|
|
279
310
|
}
|
|
280
311
|
case 'network': {
|
|
281
|
-
|
|
282
|
-
|
|
312
|
+
// Read the caller's filters UNCAPPED, then apply the asset default and the
|
|
313
|
+
// limit here: capping first would spend the whole budget on static assets
|
|
314
|
+
// and leave nothing to hide, reporting `hidden: 0` on a page that is 90%
|
|
315
|
+
// noise. The read is an in-memory ring, so the extra rows cost nothing.
|
|
316
|
+
const matched = await adapter.network({ filters });
|
|
317
|
+
// An explicit `resource_in` is the caller naming the types they want —
|
|
318
|
+
// never second-guess it.
|
|
319
|
+
const explicitTypes = filters !== undefined && 'resource_in' in filters;
|
|
320
|
+
const kept = explicitTypes ? matched : matched.filter(keepByDefault);
|
|
321
|
+
const entries = kept.slice(0, limit ?? DEFAULT_LOG_LIMIT);
|
|
322
|
+
const hidden = matched.length - kept.length;
|
|
323
|
+
return {
|
|
324
|
+
kind,
|
|
325
|
+
count: entries.length,
|
|
326
|
+
entries,
|
|
327
|
+
// Never truncate silently: say what was held back and how to see it.
|
|
328
|
+
...(hidden > 0 && {
|
|
329
|
+
hidden,
|
|
330
|
+
hint: `${hidden} static asset request(s) hidden; add filters:{resource_in:["script","stylesheet","image","font"]} to see them`,
|
|
331
|
+
}),
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
case 'tabs': {
|
|
335
|
+
if (!adapter.tabs) {
|
|
336
|
+
throw new AgentError("observe kind 'tabs' is not supported on this target — only web targets have tabs");
|
|
337
|
+
}
|
|
338
|
+
const tabs = await adapter.tabs();
|
|
339
|
+
return { kind, count: tabs.length, tabs };
|
|
283
340
|
}
|
|
284
341
|
default: {
|
|
285
342
|
const unreachable = kind;
|
|
@@ -290,7 +347,7 @@ export async function runObserve(adapter, recorder, input) {
|
|
|
290
347
|
/** Build the `observe` tool bound to one adapter + recorder, for the debug agent's belt. */
|
|
291
348
|
export function createObserveTool(adapter, recorder) {
|
|
292
349
|
return tool({
|
|
293
|
-
description: 'Read the target without mutating it. Pick a channel with kind (tree=UI nodes, screenshot=PNG evidence saved to screenshots/ — returns its path, console=logs, network=requests); compose with query/fields/filters/limit/within. Use it to inspect state before and after acting.',
|
|
350
|
+
description: 'Read the target without mutating it. Pick a channel with kind (tree=UI nodes incl. iframe content, screenshot=PNG evidence saved to screenshots/ — returns its path, console=logs, network=requests with status/timing/payloads, tabs=open tabs); compose with query/fields/filters/limit/within. Use it to inspect state before and after acting.',
|
|
294
351
|
inputSchema: ObserveInputSchema,
|
|
295
352
|
execute: (input) => runObserve(adapter, recorder, input),
|
|
296
353
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe.js","sourceRoot":"","sources":["../../../src/agent/belt/observe.ts"],"names":[],"mappings":"AAAA;;;;;;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I,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QAC5C,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,WAAW,GAAU,IAAI,CAAC;YAChC,MAAM,IAAI,UAAU,CAAC,yBAAyB,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;AACH,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,QAA0B;IAC5E,OAAO,IAAI,CAAC;QACV,WAAW,EACT,oVAAoV;QACtV,WAAW,EAAE,kBAAkB;QAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC;KACzD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -28,10 +28,13 @@ const CatalogSchema = z.object({
|
|
|
28
28
|
});
|
|
29
29
|
/**
|
|
30
30
|
* Catalog id for a routing-suffixed model id. The router accepts suffixes the
|
|
31
|
-
* `/models` catalog does not list as ids of their own —
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* `/models` catalog does not list as ids of their own — `:nitro`, `:floor`. Some
|
|
32
|
+
* suffixed ids ARE listed verbatim (`…:free`), so the probe tries the id as given
|
|
33
|
+
* first and only then falls back to this base form.
|
|
34
|
+
*
|
|
35
|
+
* `#` is stripped too, but only so a user-supplied `#…` id still resolves a
|
|
36
|
+
* capability — the router itself rejects `#` suffixes outright, so no default
|
|
37
|
+
* ships one (see {@link DEFAULT_MODELS}).
|
|
35
38
|
*/
|
|
36
39
|
function baseModelId(modelId) {
|
|
37
40
|
const base = modelId.replace(/[#:].*$/, '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/agent/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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,IAAI,CAAC,CAAC,CAAC;IAExE,MAAM,UAAU,GAAG,KAAK,EAAE,YAAY,EAAE,gBAAgB,CAAC;IACzD,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC,CAAC,sDAAsD;IACpF,OAAO,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/agent/loop.d.ts
CHANGED
|
@@ -24,8 +24,18 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { type LanguageModel, type ModelMessage, type Tool, ToolLoopAgent } from 'ai';
|
|
26
26
|
import type { Bug, Findings, Step, VisualIssue } from '../findings/schema.js';
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Safety cap on driver steps before the loop force-stops (paired with
|
|
29
|
+
* `hasToolCall('report')`).
|
|
30
|
+
*
|
|
31
|
+
* Raised from 30 on measurement, not taste: the tool's own headline scenario —
|
|
32
|
+
* register an account, log in, add two todos, toggle one, then exercise three
|
|
33
|
+
* filters — spent all 30 steps and died one action short of reporting, which
|
|
34
|
+
* costs the entire run (no verdict, no findings, full token spend). The observed
|
|
35
|
+
* pace is ~3s/step, so 60 still finishes well inside the default 300s wall-clock
|
|
36
|
+
* cap, which remains the real bound on what a run costs.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DEFAULT_MAX_STEPS = 60;
|
|
29
39
|
/** Kickoff turn — the story lives in `instructions`; this nudges the driver to start the loop. */
|
|
30
40
|
export declare const KICKOFF_PROMPT = "Begin. Work toward the goal with observe/act/look, then call report exactly once with your verdict.";
|
|
31
41
|
/** The driver's inner belt — the four fat tools the loop drives (see `idea/mcp-tools.md`). */
|
package/dist/agent/loop.js
CHANGED
|
@@ -24,8 +24,18 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { hasToolCall, stepCountIs, ToolLoopAgent, } from 'ai';
|
|
26
26
|
import { z } from 'zod';
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Safety cap on driver steps before the loop force-stops (paired with
|
|
29
|
+
* `hasToolCall('report')`).
|
|
30
|
+
*
|
|
31
|
+
* Raised from 30 on measurement, not taste: the tool's own headline scenario —
|
|
32
|
+
* register an account, log in, add two todos, toggle one, then exercise three
|
|
33
|
+
* filters — spent all 30 steps and died one action short of reporting, which
|
|
34
|
+
* costs the entire run (no verdict, no findings, full token spend). The observed
|
|
35
|
+
* pace is ~3s/step, so 60 still finishes well inside the default 300s wall-clock
|
|
36
|
+
* cap, which remains the real bound on what a run costs.
|
|
37
|
+
*/
|
|
38
|
+
export const DEFAULT_MAX_STEPS = 60;
|
|
29
39
|
/** Kickoff turn — the story lives in `instructions`; this nudges the driver to start the loop. */
|
|
30
40
|
export const KICKOFF_PROMPT = 'Begin. Work toward the goal with observe/act/look, then call report exactly once with your verdict.';
|
|
31
41
|
/**
|