@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/loop.js
CHANGED
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
* any mid-run messages (the smart agent's `send_message`) into a standing
|
|
10
10
|
* instruction block re-appended to EVERY turn (the SDK rebuilds each step's
|
|
11
11
|
* prompt from scratch), so the driver adapts without restarting or forgetting.
|
|
12
|
-
* - **incremental findings** — `onStepFinish`
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* - **incremental findings** — `onStepFinish` snapshots the shared act trail
|
|
13
|
+
* (`act` records each step as it happens) plus `look`'s visual issues and
|
|
14
|
+
* error-level console rows, and flushes them as `status: 'running'` findings,
|
|
15
|
+
* so `get_findings` streams findings before the verdict lands, and a run that
|
|
16
|
+
* crashes, aborts or hits the step cap keeps everything surfaced so far.
|
|
15
17
|
*
|
|
16
18
|
* Adapter-blind and model-blind like the belt: the loop never touches a protocol
|
|
17
19
|
* or a provider. It is pure over two seams — {@link LoopInbox} (drain) and
|
|
@@ -22,12 +24,43 @@
|
|
|
22
24
|
*/
|
|
23
25
|
import { hasToolCall, stepCountIs, ToolLoopAgent, } from 'ai';
|
|
24
26
|
import { z } from 'zod';
|
|
25
|
-
/**
|
|
26
|
-
|
|
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;
|
|
27
39
|
/** Kickoff turn — the story lives in `instructions`; this nudges the driver to start the loop. */
|
|
28
40
|
export const KICKOFF_PROMPT = 'Begin. Work toward the goal with observe/act/look, then call report exactly once with your verdict.';
|
|
29
|
-
/**
|
|
30
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The `look` result fields lifted into streamed visual findings: the vision guy's
|
|
43
|
+
* `issues[]` and the frame it judged (see `belt/look.ts`). A SELF-look result (a
|
|
44
|
+
* multimodal driver judging the frame with its own eyes) carries no `issues`, so
|
|
45
|
+
* it contributes nothing here — those issues reach findings via `report`.
|
|
46
|
+
*/
|
|
47
|
+
const LookVisualSchema = z.object({
|
|
48
|
+
screenshot: z.string().optional(),
|
|
49
|
+
issues: z
|
|
50
|
+
.array(z.object({
|
|
51
|
+
what: z.string(),
|
|
52
|
+
where: z.string(),
|
|
53
|
+
severity: z.enum(['low', 'medium', 'high']),
|
|
54
|
+
}))
|
|
55
|
+
.default([]),
|
|
56
|
+
});
|
|
57
|
+
/** The `observe` console rows lifted into streamed bugs (see `belt/observe.ts`). */
|
|
58
|
+
const ConsoleObserveSchema = z.object({
|
|
59
|
+
kind: z.literal('console'),
|
|
60
|
+
entries: z
|
|
61
|
+
.array(z.object({ level: z.string(), text: z.string(), location: z.string().optional() }))
|
|
62
|
+
.default([]),
|
|
63
|
+
});
|
|
31
64
|
/**
|
|
32
65
|
* `prepareStep`: fold mid-run messages into the next model turn. Drains the inbox
|
|
33
66
|
* into `standing` — the run-long list of caller instructions — then, while any
|
|
@@ -121,42 +154,113 @@ export function budgetNudge(stepNumber, maxSteps) {
|
|
|
121
154
|
}
|
|
122
155
|
return `Step budget almost spent: ~${remaining} of ${maxSteps} steps left. Finish exploring and call \`report\` soon with all findings; an unreported run is wasted.`;
|
|
123
156
|
}
|
|
124
|
-
/**
|
|
125
|
-
|
|
126
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Lift a finished step's `look` results into visual findings — each issue the
|
|
159
|
+
* vision guy flagged, carrying the frame it was judged on as evidence.
|
|
160
|
+
*/
|
|
161
|
+
export function visualFrom(toolResults) {
|
|
162
|
+
const issues = [];
|
|
127
163
|
for (const result of toolResults) {
|
|
128
|
-
if (result.toolName !== '
|
|
164
|
+
if (result.toolName !== 'look')
|
|
165
|
+
continue;
|
|
166
|
+
const parsed = LookVisualSchema.safeParse(result.output);
|
|
167
|
+
if (!parsed.success)
|
|
129
168
|
continue;
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
169
|
+
const { screenshot } = parsed.data;
|
|
170
|
+
for (const issue of parsed.data.issues) {
|
|
171
|
+
issues.push({
|
|
172
|
+
issue: issue.what,
|
|
173
|
+
where: issue.where,
|
|
174
|
+
severity: issue.severity,
|
|
175
|
+
...(screenshot !== undefined && { screenshot }),
|
|
176
|
+
});
|
|
133
177
|
}
|
|
134
178
|
}
|
|
135
|
-
return
|
|
179
|
+
return issues;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Lift a finished step's `observe` console reads into bugs — ERROR rows only
|
|
183
|
+
* (warn/log/info are working noise, not findings). The console channel is a ring
|
|
184
|
+
* buffer read non-destructively, so a re-read returns rows already lifted;
|
|
185
|
+
* {@link progressForStep} dedupes by message before they land.
|
|
186
|
+
*/
|
|
187
|
+
export function consoleBugsFrom(toolResults) {
|
|
188
|
+
const bugs = [];
|
|
189
|
+
for (const result of toolResults) {
|
|
190
|
+
if (result.toolName !== 'observe')
|
|
191
|
+
continue;
|
|
192
|
+
const parsed = ConsoleObserveSchema.safeParse(result.output);
|
|
193
|
+
if (!parsed.success)
|
|
194
|
+
continue;
|
|
195
|
+
for (const entry of parsed.data.entries) {
|
|
196
|
+
if (entry.level !== 'error')
|
|
197
|
+
continue;
|
|
198
|
+
bugs.push({
|
|
199
|
+
kind: 'console',
|
|
200
|
+
detail: entry.text,
|
|
201
|
+
...(entry.location !== undefined && { evidence: entry.location }),
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return bugs;
|
|
206
|
+
}
|
|
207
|
+
/** Dedupe key for a streamed finding — its message, case- and whitespace-insensitive. */
|
|
208
|
+
function messageKey(...parts) {
|
|
209
|
+
return parts.join(' @ ').trim().toLowerCase().replace(/\s+/g, ' ');
|
|
210
|
+
}
|
|
211
|
+
/** Append the `fresh` entries whose key is not already present; returns how many landed. */
|
|
212
|
+
function appendNew(into, fresh, key) {
|
|
213
|
+
const seen = new Set(into.map(key));
|
|
214
|
+
let added = 0;
|
|
215
|
+
for (const item of fresh) {
|
|
216
|
+
const k = key(item);
|
|
217
|
+
if (seen.has(k))
|
|
218
|
+
continue;
|
|
219
|
+
seen.add(k);
|
|
220
|
+
into.push(item);
|
|
221
|
+
added += 1;
|
|
222
|
+
}
|
|
223
|
+
return added;
|
|
136
224
|
}
|
|
137
225
|
/**
|
|
138
226
|
* Decide the running-findings write for a finished step. Steps aside for the
|
|
139
|
-
* terminal `report` step (it owns the verdict
|
|
140
|
-
* `
|
|
141
|
-
* and returns the `running` findings to
|
|
227
|
+
* terminal `report` step (it owns the verdict, and already merged the trail — see
|
|
228
|
+
* `belt/report.ts`); otherwise appends this step's NEW `look` issues and console
|
|
229
|
+
* errors to `running` (mutated in place) and returns the `running` findings to
|
|
230
|
+
* persist — act steps are already on `running.steps`, recorded by `act` itself.
|
|
231
|
+
* `null` when the step surfaced nothing new — no act, and every issue/error
|
|
232
|
+
* already streamed.
|
|
142
233
|
*/
|
|
143
|
-
export function progressForStep(step,
|
|
234
|
+
export function progressForStep(step, running) {
|
|
144
235
|
if (step.toolCalls.some((call) => call.toolName === 'report'))
|
|
145
236
|
return null;
|
|
146
|
-
|
|
147
|
-
|
|
237
|
+
// Checked against `toolCalls`, NOT `toolResults`: a FAILED act still lands on
|
|
238
|
+
// `running.steps` (`act` records `ok: false` at act time, then rethrows — see
|
|
239
|
+
// `belt/act.ts`), but AI SDK 6 routes a rejected tool call to a `tool-error`
|
|
240
|
+
// content part, never `toolResults` (see `describeStep` above). Gating on
|
|
241
|
+
// `toolResults` would miss every failed act — exactly the step a crashed run
|
|
242
|
+
// most needs preserved — unless the same step happened to also add a bug or
|
|
243
|
+
// visual issue.
|
|
244
|
+
const acted = step.toolCalls.some((call) => call.toolName === 'act');
|
|
245
|
+
const bugs = appendNew(running.bugs, consoleBugsFrom(step.toolResults), (bug) => messageKey(bug.detail));
|
|
246
|
+
const visual = appendNew(running.visual, visualFrom(step.toolResults), (issue) => messageKey(issue.issue, issue.where));
|
|
247
|
+
if (!acted && bugs === 0 && visual === 0)
|
|
148
248
|
return null;
|
|
149
|
-
|
|
150
|
-
|
|
249
|
+
return {
|
|
250
|
+
status: 'running',
|
|
251
|
+
steps: [...running.steps],
|
|
252
|
+
bugs: [...running.bugs],
|
|
253
|
+
visual: [...running.visual],
|
|
254
|
+
};
|
|
151
255
|
}
|
|
152
256
|
/** Summarize a finished step for `logs/agent.log`: the tools it called (+ input) + any error text. */
|
|
153
257
|
export function describeStep(step, index) {
|
|
154
258
|
const calls = step.toolCalls
|
|
155
259
|
.map((c) => (c.input !== undefined ? `${c.toolName}(${compactArg(c.input)})` : c.toolName))
|
|
156
260
|
.join(', ') || '(no tool call)';
|
|
157
|
-
const errors = step.
|
|
158
|
-
.filter((
|
|
159
|
-
.map((
|
|
261
|
+
const errors = (step.content ?? [])
|
|
262
|
+
.filter((part) => part.type === 'tool-error')
|
|
263
|
+
.map((part) => `${part.toolName ?? 'tool'}: ${errorText(part.error)}`);
|
|
160
264
|
const tail = errors.length > 0 ? ` — ERROR ${errors.join('; ')}` : '';
|
|
161
265
|
return `step ${index}: ${calls}${tail}`;
|
|
162
266
|
}
|
|
@@ -170,21 +274,9 @@ function compactArg(input) {
|
|
|
170
274
|
return String(input);
|
|
171
275
|
}
|
|
172
276
|
}
|
|
173
|
-
/**
|
|
174
|
-
function
|
|
175
|
-
|
|
176
|
-
return true;
|
|
177
|
-
return typeof output === 'object' && output !== null && 'error' in output;
|
|
178
|
-
}
|
|
179
|
-
/** Pull a short error string out of a tool result output. */
|
|
180
|
-
function errorText(output) {
|
|
181
|
-
if (output instanceof Error)
|
|
182
|
-
return output.message;
|
|
183
|
-
if (typeof output === 'object' && output !== null && 'error' in output) {
|
|
184
|
-
const e = output.error;
|
|
185
|
-
return e instanceof Error ? e.message : String(e);
|
|
186
|
-
}
|
|
187
|
-
return String(output);
|
|
277
|
+
/** Pull a short error string out of a `tool-error` part's `error` field. */
|
|
278
|
+
function errorText(error) {
|
|
279
|
+
return error instanceof Error ? error.message : String(error);
|
|
188
280
|
}
|
|
189
281
|
/**
|
|
190
282
|
* Build the debug agent loop. The driver runs `observe`→`act`→`look` until it
|
|
@@ -198,6 +290,11 @@ export function createDebugAgent(options) {
|
|
|
198
290
|
// Run-long list of mid-run caller instructions: drained from the inbox once,
|
|
199
291
|
// re-folded into EVERY step's prompt (the SDK never persists a prepareStep override).
|
|
200
292
|
const standing = [];
|
|
293
|
+
// The running flush's accumulators. `steps` IS the shared act trail (same array
|
|
294
|
+
// the `act` and `report` tools hold — `act` writes it at act time); bugs/visual
|
|
295
|
+
// accumulate here only — they are streamed evidence, and the driver owns the
|
|
296
|
+
// terminal verdict's own arrays.
|
|
297
|
+
const running = { steps: trail, bugs: [], visual: [] };
|
|
201
298
|
return new ToolLoopAgent({
|
|
202
299
|
model,
|
|
203
300
|
tools,
|
|
@@ -218,13 +315,14 @@ export function createDebugAgent(options) {
|
|
|
218
315
|
onStepFinish: async (step) => {
|
|
219
316
|
stepIndex += 1;
|
|
220
317
|
log?.(describeStep(step, stepIndex));
|
|
221
|
-
//
|
|
222
|
-
// snapshot
|
|
223
|
-
//
|
|
224
|
-
//
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
318
|
+
// Stream this step's new `look` issues + console errors and flush a running
|
|
319
|
+
// snapshot of the shared trail (`act` already recorded its own steps there).
|
|
320
|
+
// The terminal `report` step writes its own verdict — with that same trail
|
|
321
|
+
// merged into `steps` (see `createReportTool`) — so the running flush steps
|
|
322
|
+
// aside for it (`progressForStep` returns null on the report step).
|
|
323
|
+
const snapshot = progressForStep(step, running);
|
|
324
|
+
if (snapshot)
|
|
325
|
+
await progress.writeFindings(snapshot);
|
|
228
326
|
},
|
|
229
327
|
});
|
|
230
328
|
}
|
package/dist/agent/loop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/agent/loop.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/agent/loop.ts"],"names":[],"m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 1. Base debug-agent prompt (loop rules, tools, finding shape, verdict)
|
|
9
|
+
* 1. Base debug-agent prompt (loop rules, tools, finding shape, verdict),
|
|
10
|
+
* in the eye mode (`selfLook`) the belt's `look` tool actually runs in
|
|
10
11
|
* 2. Target addendum (web/desktop/android specifics)
|
|
11
12
|
* 3. Session story (what the smart agent wants done)
|
|
12
13
|
* 4. Criteria (optional) (pass/fail rules for this run)
|
|
@@ -20,6 +21,13 @@ export interface ComposeOptions {
|
|
|
20
21
|
story: string;
|
|
21
22
|
/** Optional pass/fail criteria. When omitted, agent uses built-in judgment. */
|
|
22
23
|
criteria?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Which `look` the belt is wired to — self-look (the driver is multimodal and
|
|
26
|
+
* judges the frame itself) or the separate vision guy. Required, not defaulted:
|
|
27
|
+
* a wrong prompt here tells the driver it cannot see what it can, or to ask a
|
|
28
|
+
* vision model that this run never calls.
|
|
29
|
+
*/
|
|
30
|
+
selfLook: boolean;
|
|
23
31
|
}
|
|
24
32
|
/**
|
|
25
33
|
* Compose the full system prompt for a debug-agent session.
|
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
* independently, diffed in review, and swapped without touching the others.
|
|
7
7
|
*
|
|
8
8
|
* Composition order:
|
|
9
|
-
* 1. Base debug-agent prompt (loop rules, tools, finding shape, verdict)
|
|
9
|
+
* 1. Base debug-agent prompt (loop rules, tools, finding shape, verdict),
|
|
10
|
+
* in the eye mode (`selfLook`) the belt's `look` tool actually runs in
|
|
10
11
|
* 2. Target addendum (web/desktop/android specifics)
|
|
11
12
|
* 3. Session story (what the smart agent wants done)
|
|
12
13
|
* 4. Criteria (optional) (pass/fail rules for this run)
|
|
13
14
|
*/
|
|
14
15
|
import { ANDROID_ADDENDUM_PROMPT } from './android-addendum.js';
|
|
15
|
-
import {
|
|
16
|
+
import { debugAgentPrompt } from './debug-agent.js';
|
|
16
17
|
import { DESKTOP_ADDENDUM_PROMPT } from './desktop-addendum.js';
|
|
17
18
|
import { WEB_ADDENDUM_PROMPT } from './web-addendum.js';
|
|
18
19
|
/** Resolved per-target addendum string. */
|
|
@@ -28,7 +29,7 @@ const TARGET_ADDENDA = {
|
|
|
28
29
|
* model can orient itself without relying on positional context.
|
|
29
30
|
*/
|
|
30
31
|
export function composeSystemPrompt(options) {
|
|
31
|
-
const { target, story, criteria } = options;
|
|
32
|
+
const { target, story, criteria, selfLook } = options;
|
|
32
33
|
const addendum = TARGET_ADDENDA[target];
|
|
33
34
|
const storySection = `\
|
|
34
35
|
## Your goal for this session
|
|
@@ -45,7 +46,7 @@ Evaluate each one explicitly in your \`report\`:
|
|
|
45
46
|
${criteria.map((c, i) => `${i + 1}. ${c}`).join('\n')}
|
|
46
47
|
`
|
|
47
48
|
: '';
|
|
48
|
-
return [
|
|
49
|
+
return [debugAgentPrompt(selfLook), addendum, storySection, criteriaSection]
|
|
49
50
|
.filter((section) => section.length > 0)
|
|
50
51
|
.join('\n---\n\n');
|
|
51
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../src/agent/prompts/compose.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../src/agent/prompts/compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAKxD,2CAA2C;AAC3C,MAAM,cAAc,GAA+B;IACjD,GAAG,EAAE,mBAAmB;IACxB,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,uBAAuB;CACjC,CAAC;AAkBF;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAuB;IACzD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEtD,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAExC,MAAM,YAAY,GAAG;;;EAGrB,KAAK,CAAC,IAAI,EAAE;CACb,CAAC;IAEA,MAAM,eAAe,GACnB,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAC7B,CAAC,CAAC;;;;;;EAMN,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;CACpD;QACK,CAAC,CAAC,EAAE,CAAC;IAET,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,CAAC;SACzE,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;SACvC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -5,5 +5,17 @@
|
|
|
5
5
|
* format, and terminal verdict — without assuming any model-specific defaults.
|
|
6
6
|
* Extended per-target via addenda (see `web-addendum.ts`) and composed with
|
|
7
7
|
* the session story + criteria via `compose.ts`.
|
|
8
|
+
*
|
|
9
|
+
* ONE body, two eye modes (see `belt/look.ts`):
|
|
10
|
+
* - vision mode — the driver is blind; `look` asks a separate vision model.
|
|
11
|
+
* - self-look mode — control + vision are the SAME multimodal model; `look`
|
|
12
|
+
* attaches the frame to the tool result and the driver judges it itself.
|
|
13
|
+
* Only the paragraphs that would contradict the live tool differ; everything
|
|
14
|
+
* else is shared so the two variants can never drift.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Build the base prompt for one eye mode. `selfLook` must match the `look` tool
|
|
18
|
+
* actually bound to the belt (`session-builder.ts`) — a mismatch tells the driver
|
|
19
|
+
* to ask a vision model that is not there, or that it cannot see what it can.
|
|
8
20
|
*/
|
|
9
|
-
export declare
|
|
21
|
+
export declare function debugAgentPrompt(selfLook: boolean): string;
|
|
@@ -5,26 +5,62 @@
|
|
|
5
5
|
* format, and terminal verdict — without assuming any model-specific defaults.
|
|
6
6
|
* Extended per-target via addenda (see `web-addendum.ts`) and composed with
|
|
7
7
|
* the session story + criteria via `compose.ts`.
|
|
8
|
+
*
|
|
9
|
+
* ONE body, two eye modes (see `belt/look.ts`):
|
|
10
|
+
* - vision mode — the driver is blind; `look` asks a separate vision model.
|
|
11
|
+
* - self-look mode — control + vision are the SAME multimodal model; `look`
|
|
12
|
+
* attaches the frame to the tool result and the driver judges it itself.
|
|
13
|
+
* Only the paragraphs that would contradict the live tool differ; everything
|
|
14
|
+
* else is shared so the two variants can never drift.
|
|
15
|
+
*/
|
|
16
|
+
/** Blind driver + separate vision guy: `look` is a second model call, and it can latch off. */
|
|
17
|
+
const VISION_MODE = {
|
|
18
|
+
eyes: 'You are FAST and BLIND: you NEVER see pixels. When visual judgment is needed, call `look`.',
|
|
19
|
+
belt: '- `look` — ask the vision model to describe/judge a screenshot. Use when you need eyes.',
|
|
20
|
+
cost: 'Vision tokens are expensive.',
|
|
21
|
+
// `createLookExecute` latches on VisionUnavailableError: once a text-only vision
|
|
22
|
+
// model rejects the frame, every later `look` fails fast with the same guidance.
|
|
23
|
+
extraRule: `
|
|
24
|
+
- If \`look\` reports it is unavailable for this run, do not call it again — finish
|
|
25
|
+
the structural checks and state in your report summary that visual checks could
|
|
26
|
+
not be performed (unverified, not passed).`,
|
|
27
|
+
};
|
|
28
|
+
/** Multimodal driver: `look` hands the frame back to it — no vision guy, no latch. */
|
|
29
|
+
const SELF_LOOK_MODE = {
|
|
30
|
+
eyes: 'You are FAST and MULTIMODAL: `look` attaches the current frame to the tool result, and YOU judge it with your own eyes.',
|
|
31
|
+
belt: '- `look` — capture the current screen and judge it yourself; the frame comes back attached.',
|
|
32
|
+
// `pruneStaleFrames` (agent/loop.ts) drops older frames from the re-sent history.
|
|
33
|
+
cost: 'Only the newest frame stays in your context, so judge each one as it arrives.',
|
|
34
|
+
extraRule: '',
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Build the base prompt for one eye mode. `selfLook` must match the `look` tool
|
|
38
|
+
* actually bound to the belt (`session-builder.ts`) — a mismatch tells the driver
|
|
39
|
+
* to ask a vision model that is not there, or that it cannot see what it can.
|
|
8
40
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
41
|
+
export function debugAgentPrompt(selfLook) {
|
|
42
|
+
const mode = selfLook ? SELF_LOOK_MODE : VISION_MODE;
|
|
43
|
+
return `\
|
|
44
|
+
You are the debug agent — the driver that tests UIs and reports findings.
|
|
11
45
|
You control the target (browser, desktop, or mobile) through structured tools.
|
|
12
|
-
|
|
46
|
+
${mode.eyes}
|
|
13
47
|
|
|
14
48
|
## Your tool belt
|
|
15
49
|
|
|
16
|
-
- \`observe\` — read state: DOM tree, screenshot path, console logs, network requests.
|
|
17
|
-
- \`act\` — take action: click, type, key, scroll, navigate, wait.
|
|
18
|
-
|
|
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
|
+
${mode.belt}
|
|
19
53
|
- \`report\` — emit the final structured findings and STOP. Call once; it ends your run.
|
|
20
54
|
|
|
21
55
|
## Structure-first rule
|
|
22
56
|
|
|
23
57
|
Always prefer structured reads over vision:
|
|
24
58
|
1. Use \`observe({kind:"tree"})\` to read DOM / accessibility tree.
|
|
25
|
-
2.
|
|
59
|
+
2. Where the target supports them, use \`observe({kind:"console"})\` and
|
|
60
|
+
\`observe({kind:"network"})\` to watch errors.
|
|
26
61
|
3. Call \`look\` ONLY when visual judgment is needed — layout, colour, alignment,
|
|
27
|
-
"does this look right?", "is this element centred?".
|
|
62
|
+
"does this look right?", "is this element centred?".
|
|
63
|
+
${mode.cost}
|
|
28
64
|
|
|
29
65
|
Never screenshot for information you can read from the tree or logs.
|
|
30
66
|
|
|
@@ -32,15 +68,47 @@ Never screenshot for information you can read from the tree or logs.
|
|
|
32
68
|
|
|
33
69
|
- Start with \`observe\` to understand the current state.
|
|
34
70
|
- \`act\` to advance: navigate, click interactive elements, fill inputs.
|
|
35
|
-
-
|
|
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.
|
|
36
77
|
- If a step requires visual confirmation (looks good? aligned?), call \`look\`.
|
|
37
|
-
- Record a visual finding any time \`look\`
|
|
78
|
+
- Record a visual finding any time a \`look\` turns up an issue; attach the screenshot path.
|
|
38
79
|
- Repeated elements (e.g. several "Add to cart" buttons): test EACH instance and
|
|
39
80
|
report exactly which work and which fail. Never generalize one instance's
|
|
40
|
-
behavior to all of them.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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.
|
|
44
112
|
|
|
45
113
|
## Mid-run instructions
|
|
46
114
|
|
|
@@ -69,6 +137,21 @@ Collect bugs as you go. Three kinds:
|
|
|
69
137
|
|
|
70
138
|
Each bug: \`{ kind, detail: "concise description", evidence?: "screenshot or log path" }\`
|
|
71
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
|
+
|
|
72
155
|
## Visual findings
|
|
73
156
|
|
|
74
157
|
Collect visual issues discovered via \`look\`. Each:
|
|
@@ -105,4 +188,5 @@ When the goal is complete (or you hit the step limit), call \`report\` exactly o
|
|
|
105
188
|
Do NOT stop before calling \`report\`. Do NOT call \`report\` more than once.
|
|
106
189
|
The summary is for the smart agent — make it actionable: what broke, where, what to fix.
|
|
107
190
|
`;
|
|
191
|
+
}
|
|
108
192
|
//# sourceMappingURL=debug-agent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-agent.js","sourceRoot":"","sources":["../../../src/agent/prompts/debug-agent.ts"],"names":[],"mappings":"AAAA
|
|
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,yHAAyH;IAC/H,IAAI,EAAE,6FAA6F;IACnG,kFAAkF;IAClF,IAAI,EAAE,+EAA+E;IACrF,SAAS,EAAE,EAAE;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAiB;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC;IAErD,OAAO;;;EAGP,IAAI,CAAC,IAAI;;;;;;EAMT,IAAI,CAAC,IAAI;;;;;;;;;;;KAWN,IAAI,CAAC,IAAI;;;;;;;;;;;;;;;;;;;iFAmBmE,IAAI,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4G9F,CAAC;AACF,CAAC"}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Provider-agnostic — no vendor tricks; any competent model drives the same loop.
|
|
9
9
|
*/
|
|
10
|
-
export declare const DESKTOP_ADDENDUM_PROMPT = "## Desktop target \u2014 AT-SPI + X11 reach\n\nYou are driving a native Linux application, already launched for you (managed).\nYou read it through the **AT-SPI2 accessibility tree** (over D-Bus), drive it with\n**xdotool** (X11/XWayland synthetic input), and capture frames with **scrot/grim**.\nThere is no DOM, no JavaScript context, and **no console or network channel**.\n\n### Channels and when to reach for each\n\n| Channel | What it gives you | Use via |\n|---------------|-------------------|---------|\n| a11y tree | element roles, names, on-screen bounds, enabled state | `observe({kind:\"tree\"})` |\n| screenshot | the current frame as PNG (evidence + vision) | `observe({kind:\"screenshot\"})`, `look` |\n\n`observe({kind:\"console\"})` and `observe({kind:\"network\"})` are **unsupported** on\ndesktop and error out \u2014 native apps expose no such streams. Never call them; judge\nbehaviour from the a11y tree and the pixels instead.\n\n### The app is already up \u2014 don't navigate to a URL\n\nThe window is launched and focused before your first step. There is no address bar.\nOnly use `act({action:\"navigate\", target:\"<window title>\"})` to re-focus a specific\nwindow by title when several are open; normally you skip it and act directly.\n\n### Tree-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 missing, try scrolling (`act({action:\"scroll\"})`) or waiting\n (`act({action:\"wait\", target:\"<role/name>\"})`), then re-observe.\n3. The a11y tree is often thinner than a DOM \u2014 many custom widgets expose little.\n When the tree gives you no answer, call `look` for pixels sooner than you would\n on web, and use the screenshot to judge layout, spacing, and visual polish.\n\n### Waiting \u2014 node queries only\n\n`act({action:\"wait\"})` polls the a11y tree for a `target` to appear. There is no\n`networkIdle` on desktop (no network channel) \u2014 waiting on it errors. Wait on a\nvisible element instead, e.g. a button or a heading you expect to render.\n\n### Selectors \u2014 use the node's `target`, don't invent one\n\nActionable nodes from `observe({kind:\"tree\"})` carry a ready-to-use `target` string\nbuilt from their a11y role + name (e.g. `role=button[name=\"Save\" i]`). When a node\nhas a `target`, COPY it verbatim into `act({action, target})`. Do NOT hand-craft a\nselector. If a node is unnamed, pass its visible text as `target`, or scope the read\nwith `within`/`filters` and act on what comes back.\n\n### Findings \u2014 functional + visual\n\nRecord functional bugs (a click that does nothing, a disabled control that should be\nlive, a wrong value) AND visual/UX feedback (misaligned, clipped, low-contrast,\ncramped). Attach the screenshot path as `evidence`. With no console/network to mine,\nthe a11y tree and
|
|
10
|
+
export declare const DESKTOP_ADDENDUM_PROMPT = "## Desktop target \u2014 AT-SPI + X11 reach\n\nYou are driving a native Linux application, already launched for you (managed).\nYou read it through the **AT-SPI2 accessibility tree** (over D-Bus), drive it with\n**xdotool** (X11/XWayland synthetic input), and capture frames with **scrot/grim**.\nThere is no DOM, no JavaScript context, and **no console or network channel**.\n\n### Channels and when to reach for each\n\n| Channel | What it gives you | Use via |\n|---------------|-------------------|---------|\n| a11y tree | element roles, names, on-screen bounds, enabled state | `observe({kind:\"tree\"})` |\n| screenshot | the current frame as PNG (evidence + vision) | `observe({kind:\"screenshot\"})`, `look` |\n\n`observe({kind:\"console\"})` and `observe({kind:\"network\"})` are **unsupported** on\ndesktop and error out \u2014 native apps expose no such streams. Never call them; judge\nbehaviour from the a11y tree and the pixels instead.\n\n### The app is already up \u2014 don't navigate to a URL\n\nThe window is launched and focused before your first step. There is no address bar.\nOnly use `act({action:\"navigate\", target:\"<window title>\"})` to re-focus a specific\nwindow by title when several are open; normally you skip it and act directly.\n\n### Tree-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 missing, try scrolling (`act({action:\"scroll\"})`) or waiting\n (`act({action:\"wait\", target:\"<role/name>\"})`), then re-observe.\n3. The a11y tree is often thinner than a DOM \u2014 many custom widgets expose little.\n When the tree gives you no answer, call `look` for pixels sooner than you would\n on web, and use the screenshot to judge layout, spacing, and visual polish.\n\n### Waiting \u2014 node queries only\n\n`act({action:\"wait\"})` polls the a11y tree for a `target` to appear. There is no\n`networkIdle` on desktop (no network channel) \u2014 waiting on it errors. Wait on a\nvisible element instead, e.g. a button or a heading you expect to render.\n\n### Selectors \u2014 use the node's `target`, don't invent one\n\nActionable nodes from `observe({kind:\"tree\"})` carry a ready-to-use `target` string\nbuilt from their a11y role + name (e.g. `role=button[name=\"Save\" i]`). When a node\nhas a `target`, COPY it verbatim into `act({action, target})`. Do NOT hand-craft a\nselector. If a node is unnamed, pass its visible text as `target`, or scope the read\nwith `within`/`filters` and act on what comes back.\n\n### Findings \u2014 functional + visual\n\nRecord functional bugs (a click that does nothing, a disabled control that should be\nlive, a wrong value) AND visual/UX feedback (misaligned, clipped, low-contrast,\ncramped). Attach the screenshot path as `evidence`. With no console/network to mine,\nthe a11y tree and what `look` reports back are your only signals \u2014 lean on both.\n";
|
|
@@ -61,6 +61,6 @@ with \`within\`/\`filters\` and act on what comes back.
|
|
|
61
61
|
Record functional bugs (a click that does nothing, a disabled control that should be
|
|
62
62
|
live, a wrong value) AND visual/UX feedback (misaligned, clipped, low-contrast,
|
|
63
63
|
cramped). Attach the screenshot path as \`evidence\`. With no console/network to mine,
|
|
64
|
-
the a11y tree and
|
|
64
|
+
the a11y tree and what \`look\` reports back are your only signals — lean on both.
|
|
65
65
|
`;
|
|
66
66
|
//# sourceMappingURL=desktop-addendum.js.map
|