@developerz.ai/ui-debugger-mcp 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -10
- package/dist/adapters/android/adb.d.ts +34 -5
- package/dist/adapters/android/adb.js +74 -20
- package/dist/adapters/android/adb.js.map +1 -1
- package/dist/adapters/android/android-adapter.d.ts +23 -7
- package/dist/adapters/android/android-adapter.js +106 -36
- package/dist/adapters/android/android-adapter.js.map +1 -1
- package/dist/adapters/android/android-adapter.test-helpers.d.ts +52 -0
- package/dist/adapters/android/android-adapter.test-helpers.js +115 -0
- package/dist/adapters/android/android-adapter.test-helpers.js.map +1 -0
- package/dist/adapters/android/commands.d.ts +27 -4
- package/dist/adapters/android/commands.js +66 -4
- package/dist/adapters/android/commands.js.map +1 -1
- package/dist/adapters/android/ports.d.ts +32 -0
- package/dist/adapters/android/ports.js +47 -0
- package/dist/adapters/android/ports.js.map +1 -0
- package/dist/adapters/android/uiautomator.d.ts +10 -2
- package/dist/adapters/android/uiautomator.js +36 -4
- package/dist/adapters/android/uiautomator.js.map +1 -1
- package/dist/adapters/browser/browser-adapter.d.ts +16 -13
- package/dist/adapters/browser/browser-adapter.js +196 -313
- 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 +223 -19
- package/dist/adapters/browser/cdp.js.map +1 -1
- package/dist/adapters/browser/extractor.d.ts +53 -0
- package/dist/adapters/browser/extractor.js +224 -0
- package/dist/adapters/browser/extractor.js.map +1 -0
- package/dist/adapters/browser/filters.d.ts +15 -0
- package/dist/adapters/browser/filters.js +93 -0
- package/dist/adapters/browser/filters.js.map +1 -0
- package/dist/adapters/browser/launch.d.ts +41 -0
- package/dist/adapters/browser/launch.js +61 -0
- package/dist/adapters/browser/launch.js.map +1 -0
- package/dist/adapters/budget.d.ts +16 -0
- package/dist/adapters/budget.js +25 -0
- package/dist/adapters/budget.js.map +1 -0
- package/dist/adapters/contract.d.ts +82 -6
- package/dist/adapters/desktop/atspi.d.ts +15 -0
- package/dist/adapters/desktop/atspi.js +37 -17
- package/dist/adapters/desktop/atspi.js.map +1 -1
- package/dist/adapters/desktop/capture.js +8 -1
- package/dist/adapters/desktop/capture.js.map +1 -1
- package/dist/adapters/desktop/desktop-adapter.d.ts +9 -2
- package/dist/adapters/desktop/desktop-adapter.js +84 -32
- package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
- package/dist/adapters/desktop/input.d.ts +16 -1
- package/dist/adapters/desktop/input.js +30 -0
- package/dist/adapters/desktop/input.js.map +1 -1
- package/dist/adapters/desktop/proc.d.ts +18 -3
- package/dist/adapters/desktop/proc.js +48 -5
- package/dist/adapters/desktop/proc.js.map +1 -1
- package/dist/adapters/factory.d.ts +3 -1
- package/dist/adapters/factory.js +6 -2
- package/dist/adapters/factory.js.map +1 -1
- package/dist/adapters/limit.d.ts +10 -0
- package/dist/adapters/limit.js +19 -0
- package/dist/adapters/limit.js.map +1 -0
- package/dist/agent/belt/act.d.ts +44 -9
- package/dist/agent/belt/act.js +176 -21
- 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 +42 -16
- package/dist/agent/belt/observe.js +134 -22
- package/dist/agent/belt/observe.js.map +1 -1
- package/dist/agent/belt/report.d.ts +29 -9
- package/dist/agent/belt/report.js +77 -10
- package/dist/agent/belt/report.js.map +1 -1
- package/dist/agent/belt/trail.d.ts +34 -0
- package/dist/agent/belt/trail.js +64 -0
- package/dist/agent/belt/trail.js.map +1 -0
- package/dist/agent/capabilities.d.ts +4 -4
- package/dist/agent/capabilities.js +41 -13
- package/dist/agent/capabilities.js.map +1 -1
- package/dist/agent/loop.d.ts +70 -21
- package/dist/agent/loop.js +146 -48
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/prompts/compose.d.ts +9 -1
- package/dist/agent/prompts/compose.js +5 -4
- package/dist/agent/prompts/compose.js.map +1 -1
- package/dist/agent/prompts/debug-agent.d.ts +13 -1
- package/dist/agent/prompts/debug-agent.js +98 -14
- package/dist/agent/prompts/debug-agent.js.map +1 -1
- package/dist/agent/prompts/desktop-addendum.d.ts +1 -1
- package/dist/agent/prompts/desktop-addendum.js +1 -1
- package/dist/agent/prompts/web-addendum.d.ts +1 -1
- package/dist/agent/prompts/web-addendum.js +84 -16
- package/dist/agent/prompts/web-addendum.js.map +1 -1
- package/dist/cli/control.d.ts +3 -1
- package/dist/cli/control.js +26 -40
- package/dist/cli/control.js.map +1 -1
- package/dist/cli/help.d.ts +3 -1
- package/dist/cli/help.js +6 -2
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/init.d.ts +3 -6
- package/dist/cli/init.js +64 -16
- package/dist/cli/init.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 +17 -4
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +12 -5
- package/dist/config/schema.js +17 -7
- package/dist/config/schema.js.map +1 -1
- package/dist/errors.d.ts +14 -2
- package/dist/errors.js +24 -4
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/main.js +26 -8
- package/dist/main.js.map +1 -1
- package/dist/mcp/server.d.ts +16 -1
- package/dist/mcp/server.js +23 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/server.test-helpers.d.ts +23 -0
- package/dist/mcp/server.test-helpers.js +49 -0
- package/dist/mcp/server.test-helpers.js.map +1 -0
- package/dist/mcp/tools/describe.js +5 -0
- package/dist/mcp/tools/describe.js.map +1 -1
- package/dist/mcp/tools/end-session.js +5 -0
- package/dist/mcp/tools/end-session.js.map +1 -1
- package/dist/mcp/tools/get-findings.js +23 -3
- package/dist/mcp/tools/get-findings.js.map +1 -1
- package/dist/mcp/tools/output.d.ts +50 -0
- package/dist/mcp/tools/output.js +55 -0
- package/dist/mcp/tools/output.js.map +1 -0
- package/dist/mcp/tools/result.d.ts +24 -1
- package/dist/mcp/tools/result.js +106 -5
- package/dist/mcp/tools/result.js.map +1 -1
- package/dist/mcp/tools/send-message.js +5 -0
- package/dist/mcp/tools/send-message.js.map +1 -1
- package/dist/mcp/tools/start-debug.js +7 -1
- package/dist/mcp/tools/start-debug.js.map +1 -1
- package/dist/services/debug-service.d.ts +47 -8
- package/dist/services/debug-service.js +185 -14
- package/dist/services/debug-service.js.map +1 -1
- package/dist/services/session-builder.d.ts +20 -3
- package/dist/services/session-builder.js +43 -13
- package/dist/services/session-builder.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/atomic-write.d.ts +24 -0
- package/dist/session/atomic-write.js +39 -0
- package/dist/session/atomic-write.js.map +1 -0
- package/dist/session/findings-store.js +3 -4
- package/dist/session/findings-store.js.map +1 -1
- package/dist/session/process-identity.d.ts +16 -0
- package/dist/session/process-identity.js +29 -0
- package/dist/session/process-identity.js.map +1 -1
- package/dist/session/session.js +36 -4
- package/dist/session/session.js.map +1 -1
- package/dist/session/state-file.d.ts +64 -5
- package/dist/session/state-file.js +76 -9
- package/dist/session/state-file.js.map +1 -1
- package/dist/session/workspace.d.ts +11 -0
- package/dist/session/workspace.js +14 -1
- package/dist/session/workspace.js.map +1 -1
- package/package.json +4 -1
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":"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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,23 +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 } 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
|
+
/**
|
|
30
|
+
* The four observable channels `kind` selects (each routes to one contract method).
|
|
31
|
+
* Exported so the prompt-vs-schema drift guard (`prompts/schema-drift.test.ts`) can
|
|
32
|
+
* assert every `kind:"…"` example the prompts teach is one the belt actually accepts.
|
|
33
|
+
*/
|
|
34
|
+
export declare const OBSERVE_KINDS: readonly ["tree", "screenshot", "console", "network", "tabs"];
|
|
35
|
+
/**
|
|
36
|
+
* Selectable {@link Node} columns — the `fields` projection whitelist (contract-level).
|
|
37
|
+
* Exported for the same drift guard as {@link OBSERVE_KINDS}.
|
|
38
|
+
*/
|
|
39
|
+
export declare const NODE_FIELDS: readonly ["role", "name", "bounds", "enabled", "testid", "style", "frame", "value", "checked"];
|
|
29
40
|
/** `observe` input — flat + SQL-like; `kind` picks the table, the rest compose the read. */
|
|
30
41
|
export declare const ObserveInputSchema: z.ZodObject<{
|
|
31
42
|
kind: z.ZodEnum<{
|
|
32
43
|
screenshot: "screenshot";
|
|
33
44
|
console: "console";
|
|
34
45
|
network: "network";
|
|
46
|
+
tabs: "tabs";
|
|
35
47
|
tree: "tree";
|
|
36
48
|
}>;
|
|
37
49
|
query: z.ZodOptional<z.ZodString>;
|
|
38
50
|
fields: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
51
|
+
value: "value";
|
|
39
52
|
name: "name";
|
|
40
|
-
|
|
53
|
+
frame: "frame";
|
|
41
54
|
bounds: "bounds";
|
|
42
55
|
enabled: "enabled";
|
|
56
|
+
role: "role";
|
|
43
57
|
testid: "testid";
|
|
58
|
+
checked: "checked";
|
|
44
59
|
style: "style";
|
|
45
60
|
}>>>;
|
|
46
61
|
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
|
|
@@ -48,13 +63,13 @@ export declare const ObserveInputSchema: z.ZodObject<{
|
|
|
48
63
|
within: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
49
64
|
role: z.ZodString;
|
|
50
65
|
name: z.ZodString;
|
|
51
|
-
bounds: z.ZodObject<{
|
|
66
|
+
bounds: z.ZodOptional<z.ZodObject<{
|
|
52
67
|
x: z.ZodNumber;
|
|
53
68
|
y: z.ZodNumber;
|
|
54
69
|
width: z.ZodNumber;
|
|
55
70
|
height: z.ZodNumber;
|
|
56
|
-
}, z.core.$strip
|
|
57
|
-
enabled: z.ZodBoolean
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
58
73
|
testid: z.ZodOptional<z.ZodString>;
|
|
59
74
|
}, z.core.$strip>]>>;
|
|
60
75
|
}, z.core.$strip>;
|
|
@@ -76,19 +91,30 @@ export type ObserveResult = {
|
|
|
76
91
|
kind: 'console';
|
|
77
92
|
count: number;
|
|
78
93
|
entries: ConsoleEntry[];
|
|
94
|
+
} | {
|
|
95
|
+
kind: 'tabs';
|
|
96
|
+
count: number;
|
|
97
|
+
tabs: TabInfo[];
|
|
79
98
|
} | {
|
|
80
99
|
kind: 'network';
|
|
81
100
|
count: number;
|
|
82
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;
|
|
83
106
|
};
|
|
84
107
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
108
|
+
* Resolve `within` to something the {@link Adapter} contract takes — a selector string
|
|
109
|
+
* or a {@link Node}. Two coercions, each fixing a shape drivers actually produce:
|
|
110
|
+
*
|
|
111
|
+
* - a JSON-*stringified* node (`within: "{\"role\": …}"`). Before this it fell through
|
|
112
|
+
* as a selector, normalized to `text={"role"…}`, matched nothing, and returned an
|
|
113
|
+
* empty tree with no clue why — the single biggest step-waster observed.
|
|
114
|
+
* Garbage-that-looks-like-JSON fails loud instead of reading the whole page.
|
|
115
|
+
* - a node projected without `bounds` (`fields:["role","name"]`) → {@link scopeOf}.
|
|
90
116
|
*/
|
|
91
|
-
export declare function coerceWithin(within: ObserveInput['within']):
|
|
117
|
+
export declare function coerceWithin(within: ObserveInput['within']): NodeRef | undefined;
|
|
92
118
|
/**
|
|
93
119
|
* Route one `observe` call to the adapter and shape the result. Pure over the
|
|
94
120
|
* {@link Adapter} + {@link EvidenceRecorder} seams (no `tool()` wrapper), so it
|
|
@@ -97,21 +123,21 @@ export declare function coerceWithin(within: ObserveInput['within']): ObserveInp
|
|
|
97
123
|
export declare function runObserve(adapter: Adapter, recorder: EvidenceRecorder, input: ObserveInput): Promise<ObserveResult>;
|
|
98
124
|
/** Build the `observe` tool bound to one adapter + recorder, for the debug agent's belt. */
|
|
99
125
|
export declare function createObserveTool(adapter: Adapter, recorder: EvidenceRecorder): import("ai").Tool<{
|
|
100
|
-
kind: "screenshot" | "console" | "network" | "tree";
|
|
126
|
+
kind: "screenshot" | "console" | "network" | "tabs" | "tree";
|
|
101
127
|
query?: string | undefined;
|
|
102
|
-
fields?: ("name" | "
|
|
128
|
+
fields?: ("value" | "name" | "frame" | "bounds" | "enabled" | "role" | "testid" | "checked" | "style")[] | undefined;
|
|
103
129
|
filters?: Record<string, string | number | boolean | string[]> | undefined;
|
|
104
130
|
limit?: number | undefined;
|
|
105
131
|
within?: string | {
|
|
106
132
|
role: string;
|
|
107
133
|
name: string;
|
|
108
|
-
bounds
|
|
134
|
+
bounds?: {
|
|
109
135
|
x: number;
|
|
110
136
|
y: number;
|
|
111
137
|
width: number;
|
|
112
138
|
height: number;
|
|
113
|
-
};
|
|
114
|
-
enabled
|
|
139
|
+
} | undefined;
|
|
140
|
+
enabled?: boolean | undefined;
|
|
115
141
|
testid?: string | undefined;
|
|
116
142
|
} | undefined;
|
|
117
143
|
}, ObserveResult>;
|
|
@@ -26,16 +26,26 @@
|
|
|
26
26
|
import { tool } from 'ai';
|
|
27
27
|
import { z } from 'zod';
|
|
28
28
|
import { AgentError } from '../../errors.js';
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
/**
|
|
30
|
+
* The four observable channels `kind` selects (each routes to one contract method).
|
|
31
|
+
* Exported so the prompt-vs-schema drift guard (`prompts/schema-drift.test.ts`) can
|
|
32
|
+
* assert every `kind:"…"` example the prompts teach is one the belt actually accepts.
|
|
33
|
+
*/
|
|
34
|
+
export const OBSERVE_KINDS = ['tree', 'screenshot', 'console', 'network', 'tabs'];
|
|
35
|
+
/**
|
|
36
|
+
* Selectable {@link Node} columns — the `fields` projection whitelist (contract-level).
|
|
37
|
+
* Exported for the same drift guard as {@link OBSERVE_KINDS}.
|
|
38
|
+
*/
|
|
39
|
+
export const NODE_FIELDS = [
|
|
33
40
|
'role',
|
|
34
41
|
'name',
|
|
35
42
|
'bounds',
|
|
36
43
|
'enabled',
|
|
37
44
|
'testid',
|
|
38
45
|
'style',
|
|
46
|
+
'frame',
|
|
47
|
+
'value',
|
|
48
|
+
'checked',
|
|
39
49
|
];
|
|
40
50
|
/**
|
|
41
51
|
* Columns a no-`fields` read returns. `style` (colour + contrast per text node)
|
|
@@ -48,7 +58,41 @@ const DEFAULT_PROJECTION = [
|
|
|
48
58
|
'bounds',
|
|
49
59
|
'enabled',
|
|
50
60
|
'testid',
|
|
61
|
+
'frame',
|
|
62
|
+
'value',
|
|
63
|
+
'checked',
|
|
51
64
|
];
|
|
65
|
+
/**
|
|
66
|
+
* Rows a no-`limit` `console`/`network` read returns (newest first, so the cap keeps
|
|
67
|
+
* what just happened). The ring buffers hold 1000 entries each (`browser/cdp.ts`), the
|
|
68
|
+
* driver is told to check both channels after acting, and the SDK re-sends every tool
|
|
69
|
+
* result on every later step — so one unbounded read on a chatty page costs
|
|
70
|
+
* entries × remaining steps of context. An explicit `limit` (including `0`) still wins.
|
|
71
|
+
*/
|
|
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
|
+
}
|
|
52
96
|
/** One `filters` predicate value; arrays back `_in`-style set membership (matches `FilterValue`). */
|
|
53
97
|
const FilterValueSchema = z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]);
|
|
54
98
|
/** On-screen rectangle backing a {@link Node} `within` reference. */
|
|
@@ -58,17 +102,26 @@ const BoundsSchema = z.object({
|
|
|
58
102
|
width: z.number(),
|
|
59
103
|
height: z.number(),
|
|
60
104
|
});
|
|
61
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* A {@link Node} echoed back as a `within` scope (the alternative to a selector string).
|
|
107
|
+
*
|
|
108
|
+
* `bounds`/`enabled` are OPTIONAL: a `fields:["role","name"]` read — what the web
|
|
109
|
+
* addendum recommends for slim reads — returns neither, and rejecting the very node
|
|
110
|
+
* observe just handed back is the kind of contradiction that burns steps. Role + name
|
|
111
|
+
* are enough; {@link coerceWithin} turns a region-less node into a selector.
|
|
112
|
+
*/
|
|
62
113
|
const NodeSchema = z.object({
|
|
63
114
|
role: z.string(),
|
|
64
115
|
name: z.string(),
|
|
65
|
-
bounds: BoundsSchema,
|
|
66
|
-
enabled: z.boolean(),
|
|
116
|
+
bounds: BoundsSchema.optional(),
|
|
117
|
+
enabled: z.boolean().optional(),
|
|
67
118
|
testid: z.string().optional(),
|
|
68
119
|
});
|
|
69
120
|
/** `observe` input — flat + SQL-like; `kind` picks the table, the rest compose the read. */
|
|
70
121
|
export const ObserveInputSchema = z.object({
|
|
71
|
-
kind: z
|
|
122
|
+
kind: z
|
|
123
|
+
.enum(OBSERVE_KINDS)
|
|
124
|
+
.describe('channel to read: tree | screenshot | console | network | tabs'),
|
|
72
125
|
query: z
|
|
73
126
|
.string()
|
|
74
127
|
.optional()
|
|
@@ -81,11 +134,16 @@ export const ObserveInputSchema = z.object({
|
|
|
81
134
|
.record(z.string(), FilterValueSchema)
|
|
82
135
|
.optional()
|
|
83
136
|
.describe('WHERE-style predicates, e.g. { visible_eq: true } | { status_gte: 400 }; per-channel'),
|
|
84
|
-
limit: z
|
|
137
|
+
limit: z
|
|
138
|
+
.number()
|
|
139
|
+
.int()
|
|
140
|
+
.nonnegative()
|
|
141
|
+
.optional()
|
|
142
|
+
.describe(`cap how many rows return (console/network default ${DEFAULT_LOG_LIMIT})`),
|
|
85
143
|
within: z
|
|
86
144
|
.union([z.string(), NodeSchema])
|
|
87
145
|
.optional()
|
|
88
|
-
.describe('tree scope: restrict to a subtree/region (a selector string, or a node OBJECT exactly as observe returned it — not a JSON string)'),
|
|
146
|
+
.describe('tree scope: restrict to a subtree/region (a selector string, or a node OBJECT exactly as observe returned it — role + name is enough, not a JSON string)'),
|
|
89
147
|
});
|
|
90
148
|
/** ARIA roles Playwright's `role=` engine accepts (others fall back to a text selector). */
|
|
91
149
|
const ARIA_ROLES = new Set([
|
|
@@ -173,14 +231,40 @@ function pick(obj, keys) {
|
|
|
173
231
|
return out;
|
|
174
232
|
}
|
|
175
233
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
234
|
+
* A `within` node as a contract {@link NodeRef}: its on-screen region when it has one,
|
|
235
|
+
* else the selector its testid/role/name resolve to — the same string `observe` would
|
|
236
|
+
* have attached to that node as `target`.
|
|
237
|
+
*
|
|
238
|
+
* Adapters scope a {@link Node} `within` by `bounds` ALONE, so a region-less node has
|
|
239
|
+
* to become a selector or it would silently read nothing. `enabled` is never read when
|
|
240
|
+
* scoping; the contract just requires the field, so a projection that dropped it
|
|
241
|
+
* defaults to `true` rather than throwing away an exact region.
|
|
242
|
+
*/
|
|
243
|
+
function scopeOf(node) {
|
|
244
|
+
const { bounds } = node;
|
|
245
|
+
if (bounds !== undefined)
|
|
246
|
+
return { ...node, bounds, enabled: node.enabled ?? true };
|
|
247
|
+
const selector = baseSelector(node);
|
|
248
|
+
if (selector)
|
|
249
|
+
return selector;
|
|
250
|
+
throw new AgentError('observe `within` node has no `bounds` and no name/testid to resolve it — re-read with `fields` including "bounds", or pass a selector string');
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Resolve `within` to something the {@link Adapter} contract takes — a selector string
|
|
254
|
+
* or a {@link Node}. Two coercions, each fixing a shape drivers actually produce:
|
|
255
|
+
*
|
|
256
|
+
* - a JSON-*stringified* node (`within: "{\"role\": …}"`). Before this it fell through
|
|
257
|
+
* as a selector, normalized to `text={"role"…}`, matched nothing, and returned an
|
|
258
|
+
* empty tree with no clue why — the single biggest step-waster observed.
|
|
259
|
+
* Garbage-that-looks-like-JSON fails loud instead of reading the whole page.
|
|
260
|
+
* - a node projected without `bounds` (`fields:["role","name"]`) → {@link scopeOf}.
|
|
181
261
|
*/
|
|
182
262
|
export function coerceWithin(within) {
|
|
183
|
-
if (
|
|
263
|
+
if (within === undefined)
|
|
264
|
+
return undefined;
|
|
265
|
+
if (typeof within !== 'string')
|
|
266
|
+
return scopeOf(within);
|
|
267
|
+
if (!within.trimStart().startsWith('{'))
|
|
184
268
|
return within;
|
|
185
269
|
let data;
|
|
186
270
|
try {
|
|
@@ -191,9 +275,9 @@ export function coerceWithin(within) {
|
|
|
191
275
|
}
|
|
192
276
|
const parsed = NodeSchema.safeParse(data);
|
|
193
277
|
if (!parsed.success) {
|
|
194
|
-
throw new AgentError('observe `within` was a JSON string but not a valid node (needs role
|
|
278
|
+
throw new AgentError('observe `within` was a JSON string but not a valid node (needs role + name) — pass a node from a previous observe, or a selector string');
|
|
195
279
|
}
|
|
196
|
-
return parsed.data;
|
|
280
|
+
return scopeOf(parsed.data);
|
|
197
281
|
}
|
|
198
282
|
/**
|
|
199
283
|
* Route one `observe` call to the adapter and shape the result. Pure over the
|
|
@@ -218,13 +302,41 @@ export async function runObserve(adapter, recorder, input) {
|
|
|
218
302
|
const path = await recorder.saveScreenshot('observe', png);
|
|
219
303
|
return { kind, path, bytes: png.byteLength };
|
|
220
304
|
}
|
|
305
|
+
// Both log channels default to a bounded tail (see DEFAULT_LOG_LIMIT); an explicit
|
|
306
|
+
// `limit` — including `0` — passes through, invalid ones still die in the adapter.
|
|
221
307
|
case 'console': {
|
|
222
|
-
const entries = await adapter.console({ filters, limit });
|
|
308
|
+
const entries = await adapter.console({ filters, limit: limit ?? DEFAULT_LOG_LIMIT });
|
|
223
309
|
return { kind, count: entries.length, entries };
|
|
224
310
|
}
|
|
225
311
|
case 'network': {
|
|
226
|
-
|
|
227
|
-
|
|
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 };
|
|
228
340
|
}
|
|
229
341
|
default: {
|
|
230
342
|
const unreachable = kind;
|
|
@@ -235,7 +347,7 @@ export async function runObserve(adapter, recorder, input) {
|
|
|
235
347
|
/** Build the `observe` tool bound to one adapter + recorder, for the debug agent's belt. */
|
|
236
348
|
export function createObserveTool(adapter, recorder) {
|
|
237
349
|
return tool({
|
|
238
|
-
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.',
|
|
239
351
|
inputSchema: ObserveInputSchema,
|
|
240
352
|
execute: (input) => runObserve(adapter, recorder, input),
|
|
241
353
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe.js","sourceRoot":"","sources":["../../../src/agent/belt/observe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"observe.js","sourceRoot":"","sources":["../../../src/agent/belt/observe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAA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,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"}
|
|
@@ -86,23 +86,37 @@ export interface FindingsWriter {
|
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* Build the canonical findings record from a validated report input. The base
|
|
89
|
-
* verdict shape; {@link terminalFindings}
|
|
90
|
-
*
|
|
89
|
+
* verdict shape; {@link terminalFindings} merges the loop's recorded act-trail
|
|
90
|
+
* into its `steps`, so both the persisted write and the returned counts agree.
|
|
91
91
|
*/
|
|
92
92
|
export declare function reportFindings(input: ReportInput): Findings;
|
|
93
|
+
/**
|
|
94
|
+
* Merge the driver's reported steps with the loop's recorded act-`trail`. Nothing
|
|
95
|
+
* is discarded: the driver's `ok: false` steps and notes (the prompt mandates
|
|
96
|
+
* them) survive alongside the mechanical trail and its evidence frames.
|
|
97
|
+
*
|
|
98
|
+
* The trail is the spine — it is the true chronology, recorded at act time — and
|
|
99
|
+
* each entry the driver restated verbatim (models commonly echo the `act` result
|
|
100
|
+
* label) is fused in place, driver fields winning, trail filling the gaps. Steps
|
|
101
|
+
* the driver reported that no trail entry matches — assertions, observations, acts
|
|
102
|
+
* from a step that also called `report` — follow in reported order, since nothing
|
|
103
|
+
* places them in the chronology. Both inputs keep their relative order, and equal
|
|
104
|
+
* labels pair up first-come-first-served, so repeating an action pairs each
|
|
105
|
+
* occurrence with a distinct trail entry.
|
|
106
|
+
*/
|
|
107
|
+
export declare function mergeSteps(reported: readonly Step[], trail: readonly Step[]): Step[];
|
|
93
108
|
/**
|
|
94
109
|
* The authoritative terminal {@link Findings}: the report input with the loop's
|
|
95
|
-
* recorded act-`trail`
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* so they never drift (a `0`-step result returned over a trail-filled file).
|
|
110
|
+
* recorded act-`trail` merged into its `steps` (see {@link mergeSteps}) — never a
|
|
111
|
+
* wholesale replacement, which silently dropped every step the driver reported.
|
|
112
|
+
* The single source of truth for the terminal write AND the counts, so they never
|
|
113
|
+
* drift (a `0`-step result returned over a trail-filled file).
|
|
100
114
|
*/
|
|
101
115
|
export declare function terminalFindings(input: ReportInput, trail?: readonly Step[]): Findings;
|
|
102
116
|
/**
|
|
103
117
|
* Write the terminal verdict and report the stop. Both the persisted findings and
|
|
104
118
|
* the returned counts derive from one {@link terminalFindings} object — the loop's
|
|
105
|
-
* `trail`
|
|
119
|
+
* `trail` merged with the driver's reported steps. Pure over the
|
|
106
120
|
* {@link FindingsWriter} seam, so it unit-tests against a fake with no disk.
|
|
107
121
|
*/
|
|
108
122
|
export declare function runReport(writer: FindingsWriter, input: ReportInput, trail?: readonly Step[]): Promise<ReportResult>;
|
|
@@ -110,8 +124,14 @@ export declare function runReport(writer: FindingsWriter, input: ReportInput, tr
|
|
|
110
124
|
* Build the `report` tool bound to one findings store, for the debug agent's belt.
|
|
111
125
|
* `getTrail` (when wired by the loop) supplies the recorded act-trail so the
|
|
112
126
|
* written verdict and its counts both reflect the steps actually taken.
|
|
127
|
+
*
|
|
128
|
+
* It may be async — and the wired one is. `report` executes CONCURRENTLY with the
|
|
129
|
+
* other tool calls of its own step, so when the driver emits `act` + `report`
|
|
130
|
+
* together the act is still running here; the wired read is the act trail's
|
|
131
|
+
* `settled()`, which waits for it (see `belt/trail.ts`). Waiting is safe: the
|
|
132
|
+
* step's own `Promise.all` already awaits that act.
|
|
113
133
|
*/
|
|
114
|
-
export declare function createReportTool(writer: FindingsWriter, getTrail?: () => readonly Step[]): import("ai").Tool<{
|
|
134
|
+
export declare function createReportTool(writer: FindingsWriter, getTrail?: () => readonly Step[] | Promise<readonly Step[]>): import("ai").Tool<{
|
|
115
135
|
status: "passed" | "failed";
|
|
116
136
|
steps: {
|
|
117
137
|
step: string;
|