@developerz.ai/ui-debugger-mcp 1.0.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/LICENSE +21 -0
- package/README.md +295 -0
- package/dist/adapters/android/adb.d.ts +38 -0
- package/dist/adapters/android/adb.js +72 -0
- package/dist/adapters/android/adb.js.map +1 -0
- package/dist/adapters/android/android-adapter.d.ts +63 -0
- package/dist/adapters/android/android-adapter.js +306 -0
- package/dist/adapters/android/android-adapter.js.map +1 -0
- package/dist/adapters/android/commands.d.ts +59 -0
- package/dist/adapters/android/commands.js +178 -0
- package/dist/adapters/android/commands.js.map +1 -0
- package/dist/adapters/android/uiautomator.d.ts +81 -0
- package/dist/adapters/android/uiautomator.js +296 -0
- package/dist/adapters/android/uiautomator.js.map +1 -0
- package/dist/adapters/browser/browser-adapter.d.ts +72 -0
- package/dist/adapters/browser/browser-adapter.js +434 -0
- package/dist/adapters/browser/browser-adapter.js.map +1 -0
- package/dist/adapters/browser/cdp.d.ts +83 -0
- package/dist/adapters/browser/cdp.js +308 -0
- package/dist/adapters/browser/cdp.js.map +1 -0
- package/dist/adapters/browser/query.d.ts +25 -0
- package/dist/adapters/browser/query.js +85 -0
- package/dist/adapters/browser/query.js.map +1 -0
- package/dist/adapters/contract.d.ts +159 -0
- package/dist/adapters/contract.js +22 -0
- package/dist/adapters/contract.js.map +1 -0
- package/dist/adapters/desktop/atspi.d.ts +95 -0
- package/dist/adapters/desktop/atspi.js +359 -0
- package/dist/adapters/desktop/atspi.js.map +1 -0
- package/dist/adapters/desktop/capture.d.ts +35 -0
- package/dist/adapters/desktop/capture.js +67 -0
- package/dist/adapters/desktop/capture.js.map +1 -0
- package/dist/adapters/desktop/desktop-adapter.d.ts +60 -0
- package/dist/adapters/desktop/desktop-adapter.js +215 -0
- package/dist/adapters/desktop/desktop-adapter.js.map +1 -0
- package/dist/adapters/desktop/input.d.ts +67 -0
- package/dist/adapters/desktop/input.js +191 -0
- package/dist/adapters/desktop/input.js.map +1 -0
- package/dist/adapters/desktop/proc.d.ts +23 -0
- package/dist/adapters/desktop/proc.js +38 -0
- package/dist/adapters/desktop/proc.js.map +1 -0
- package/dist/adapters/factory.d.ts +23 -0
- package/dist/adapters/factory.js +45 -0
- package/dist/adapters/factory.js.map +1 -0
- package/dist/agent/belt/act.d.ts +100 -0
- package/dist/agent/belt/act.js +166 -0
- package/dist/agent/belt/act.js.map +1 -0
- package/dist/agent/belt/look.d.ts +98 -0
- package/dist/agent/belt/look.js +160 -0
- package/dist/agent/belt/look.js.map +1 -0
- package/dist/agent/belt/observe.d.ts +102 -0
- package/dist/agent/belt/observe.js +185 -0
- package/dist/agent/belt/observe.js.map +1 -0
- package/dist/agent/belt/report.d.ts +133 -0
- package/dist/agent/belt/report.js +112 -0
- package/dist/agent/belt/report.js.map +1 -0
- package/dist/agent/loop.d.ts +136 -0
- package/dist/agent/loop.js +173 -0
- package/dist/agent/loop.js.map +1 -0
- package/dist/agent/models.d.ts +26 -0
- package/dist/agent/models.js +22 -0
- package/dist/agent/models.js.map +1 -0
- package/dist/agent/prompts/android-addendum.d.ts +12 -0
- package/dist/agent/prompts/android-addendum.js +76 -0
- package/dist/agent/prompts/android-addendum.js.map +1 -0
- package/dist/agent/prompts/compose.d.ts +30 -0
- package/dist/agent/prompts/compose.js +52 -0
- package/dist/agent/prompts/compose.js.map +1 -0
- package/dist/agent/prompts/debug-agent.d.ts +9 -0
- package/dist/agent/prompts/debug-agent.js +102 -0
- package/dist/agent/prompts/debug-agent.js.map +1 -0
- package/dist/agent/prompts/desktop-addendum.d.ts +10 -0
- package/dist/agent/prompts/desktop-addendum.js +66 -0
- package/dist/agent/prompts/desktop-addendum.js.map +1 -0
- package/dist/agent/prompts/web-addendum.d.ts +9 -0
- package/dist/agent/prompts/web-addendum.js +70 -0
- package/dist/agent/prompts/web-addendum.js.map +1 -0
- package/dist/agent/provider.d.ts +17 -0
- package/dist/agent/provider.js +29 -0
- package/dist/agent/provider.js.map +1 -0
- package/dist/cli/control.d.ts +19 -0
- package/dist/cli/control.js +152 -0
- package/dist/cli/control.js.map +1 -0
- package/dist/cli/help.d.ts +9 -0
- package/dist/cli/help.js +41 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/init.d.ts +20 -0
- package/dist/cli/init.js +119 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/config/load.d.ts +64 -0
- package/dist/config/load.js +105 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/schema.d.ts +105 -0
- package/dist/config/schema.js +62 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/errors.d.ts +41 -0
- package/dist/errors.js +90 -0
- package/dist/errors.js.map +1 -0
- package/dist/findings/schema.d.ts +64 -0
- package/dist/findings/schema.js +27 -0
- package/dist/findings/schema.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +95 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp/server.d.ts +25 -0
- package/dist/mcp/server.js +31 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/describe.d.ts +12 -0
- package/dist/mcp/tools/describe.js +32 -0
- package/dist/mcp/tools/describe.js.map +1 -0
- package/dist/mcp/tools/end-session.d.ts +11 -0
- package/dist/mcp/tools/end-session.js +27 -0
- package/dist/mcp/tools/end-session.js.map +1 -0
- package/dist/mcp/tools/get-findings.d.ts +12 -0
- package/dist/mcp/tools/get-findings.js +42 -0
- package/dist/mcp/tools/get-findings.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +17 -0
- package/dist/mcp/tools/index.js +24 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/result.d.ts +10 -0
- package/dist/mcp/tools/result.js +20 -0
- package/dist/mcp/tools/result.js.map +1 -0
- package/dist/mcp/tools/send-message.d.ts +11 -0
- package/dist/mcp/tools/send-message.js +31 -0
- package/dist/mcp/tools/send-message.js.map +1 -0
- package/dist/mcp/tools/start-debug.d.ts +12 -0
- package/dist/mcp/tools/start-debug.js +50 -0
- package/dist/mcp/tools/start-debug.js.map +1 -0
- package/dist/services/debug-service.d.ts +133 -0
- package/dist/services/debug-service.js +163 -0
- package/dist/services/debug-service.js.map +1 -0
- package/dist/services/replay.d.ts +102 -0
- package/dist/services/replay.js +184 -0
- package/dist/services/replay.js.map +1 -0
- package/dist/services/session-builder.d.ts +65 -0
- package/dist/services/session-builder.js +198 -0
- package/dist/services/session-builder.js.map +1 -0
- package/dist/services/summarize.d.ts +59 -0
- package/dist/services/summarize.js +93 -0
- package/dist/services/summarize.js.map +1 -0
- package/dist/session/findings-store.d.ts +52 -0
- package/dist/session/findings-store.js +176 -0
- package/dist/session/findings-store.js.map +1 -0
- package/dist/session/manager.d.ts +47 -0
- package/dist/session/manager.js +66 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/session/process-identity.d.ts +45 -0
- package/dist/session/process-identity.js +81 -0
- package/dist/session/process-identity.js.map +1 -0
- package/dist/session/session.d.ts +156 -0
- package/dist/session/session.js +309 -0
- package/dist/session/session.js.map +1 -0
- package/dist/session/state-file.d.ts +72 -0
- package/dist/session/state-file.js +104 -0
- package/dist/session/state-file.js.map +1 -0
- package/dist/session/workspace.d.ts +60 -0
- package/dist/session/workspace.js +75 -0
- package/dist/session/workspace.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The debug agent loop — the fast guy's run, as a conversation.
|
|
3
|
+
*
|
|
4
|
+
* A {@link ToolLoopAgent} drives the inner belt (`observe`/`act`/`look`/`report`)
|
|
5
|
+
* with the `driver` model until the goal is met (`report`, the terminal verdict)
|
|
6
|
+
* or a safety step cap trips. Two things make it a *conversation*, not a job:
|
|
7
|
+
*
|
|
8
|
+
* - **inbox** — `prepareStep` drains the session inbox between steps and folds
|
|
9
|
+
* any mid-run messages (the smart agent's `send_message`) into the next turn,
|
|
10
|
+
* so the driver adapts without restarting.
|
|
11
|
+
* - **incremental findings** — `onStepFinish` lifts each step's `act` results
|
|
12
|
+
* into a running step trail and flushes it as `status: 'running'` findings,
|
|
13
|
+
* so `get_findings` shows live progress before the verdict lands.
|
|
14
|
+
*
|
|
15
|
+
* Adapter-blind and model-blind like the belt: the loop never touches a protocol
|
|
16
|
+
* or a provider. It is pure over two seams — {@link LoopInbox} (drain) and
|
|
17
|
+
* {@link ProgressWriter} (flush) — so its logic unit-tests with no network. The
|
|
18
|
+
* `report` step owns the terminal write, so the running flush steps aside for it
|
|
19
|
+
* (never clobbers the verdict with a `running` snapshot). Abort propagates: an
|
|
20
|
+
* aborted run rejects loud (wired to `end_session`), never a silent half-finish.
|
|
21
|
+
*/
|
|
22
|
+
import { hasToolCall, stepCountIs, ToolLoopAgent, } from 'ai';
|
|
23
|
+
import { z } from 'zod';
|
|
24
|
+
/** Safety cap on driver steps before the loop force-stops (paired with `hasToolCall('report')`). */
|
|
25
|
+
export const DEFAULT_MAX_STEPS = 30;
|
|
26
|
+
/** Kickoff turn — the story lives in `instructions`; this nudges the driver to start the loop. */
|
|
27
|
+
export const KICKOFF_PROMPT = 'Begin. Work toward the goal with observe/act/look, then call report exactly once with your verdict.';
|
|
28
|
+
/** The `act` result fields lifted into the step trail: its label and the post-action frame. */
|
|
29
|
+
const ActStepSchema = z.object({ label: z.string(), screenshot: z.string() });
|
|
30
|
+
/**
|
|
31
|
+
* `prepareStep`: fold any mid-run messages into the next model turn. Drains the
|
|
32
|
+
* inbox; when non-empty, appends one user message so the driver adapts before its
|
|
33
|
+
* next action. Returns `{}` (no override) when the inbox is empty.
|
|
34
|
+
*/
|
|
35
|
+
export function drainInboxIntoStep(inbox, messages) {
|
|
36
|
+
const pending = inbox.drain();
|
|
37
|
+
if (pending.length === 0)
|
|
38
|
+
return {};
|
|
39
|
+
const injected = {
|
|
40
|
+
role: 'user',
|
|
41
|
+
content: `New instructions from the smart agent (mid-run):\n${pending
|
|
42
|
+
.map((message) => `- ${message}`)
|
|
43
|
+
.join('\n')}\nFold these in, then continue.`,
|
|
44
|
+
};
|
|
45
|
+
return { messages: [...messages, injected] };
|
|
46
|
+
}
|
|
47
|
+
/** Steps left at or below which the driver is nudged to wrap up and `report`. */
|
|
48
|
+
export const BUDGET_WARN = 6;
|
|
49
|
+
/**
|
|
50
|
+
* A step-budget reminder folded into the turn as the run nears its cap — so the
|
|
51
|
+
* driver converges on `report` instead of churning to the hard `stepCountIs` stop
|
|
52
|
+
* (which leaves an empty, verdict-less `failed` run). `null` while there is ample
|
|
53
|
+
* budget. `stepNumber` is the 0-based index of the step about to run.
|
|
54
|
+
*/
|
|
55
|
+
export function budgetNudge(stepNumber, maxSteps) {
|
|
56
|
+
const remaining = maxSteps - stepNumber;
|
|
57
|
+
if (remaining > BUDGET_WARN)
|
|
58
|
+
return null;
|
|
59
|
+
if (remaining <= 1) {
|
|
60
|
+
return 'This is your final step. Call `report` NOW with every bug and visual issue you have found so far — do not act again.';
|
|
61
|
+
}
|
|
62
|
+
return `Step budget almost spent: ~${remaining} of ${maxSteps} steps left. Finish exploring and call \`report\` soon with all findings; an unreported run is wasted.`;
|
|
63
|
+
}
|
|
64
|
+
/** Lift a finished step's `act` results into ordered step-trail entries (each with its frame). */
|
|
65
|
+
export function stepTrailFrom(toolResults) {
|
|
66
|
+
const steps = [];
|
|
67
|
+
for (const result of toolResults) {
|
|
68
|
+
if (result.toolName !== 'act')
|
|
69
|
+
continue;
|
|
70
|
+
const parsed = ActStepSchema.safeParse(result.output);
|
|
71
|
+
if (parsed.success) {
|
|
72
|
+
steps.push({ step: parsed.data.label, ok: true, screenshot: parsed.data.screenshot });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return steps;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Decide the running-findings write for a finished step. Steps aside for the
|
|
79
|
+
* terminal `report` step (it owns the verdict) and for steps that produced no
|
|
80
|
+
* `act` results; otherwise appends the fresh trail to `trail` (mutated in place)
|
|
81
|
+
* and returns the `running` findings to persist.
|
|
82
|
+
*/
|
|
83
|
+
export function progressForStep(step, trail) {
|
|
84
|
+
if (step.toolCalls.some((call) => call.toolName === 'report'))
|
|
85
|
+
return null;
|
|
86
|
+
const fresh = stepTrailFrom(step.toolResults);
|
|
87
|
+
if (fresh.length === 0)
|
|
88
|
+
return null;
|
|
89
|
+
trail.push(...fresh);
|
|
90
|
+
return { status: 'running', steps: [...trail], bugs: [], visual: [] };
|
|
91
|
+
}
|
|
92
|
+
/** Summarize a finished step for `logs/agent.log`: the tools it called (+ input) + any error text. */
|
|
93
|
+
export function describeStep(step, index) {
|
|
94
|
+
const calls = step.toolCalls
|
|
95
|
+
.map((c) => (c.input !== undefined ? `${c.toolName}(${compactArg(c.input)})` : c.toolName))
|
|
96
|
+
.join(', ') || '(no tool call)';
|
|
97
|
+
const errors = step.toolResults
|
|
98
|
+
.filter((r) => isErrorOutput(r.output))
|
|
99
|
+
.map((r) => `${r.toolName}: ${errorText(r.output)}`);
|
|
100
|
+
const tail = errors.length > 0 ? ` — ERROR ${errors.join('; ')}` : '';
|
|
101
|
+
return `step ${index}: ${calls}${tail}`;
|
|
102
|
+
}
|
|
103
|
+
/** Compact one-line JSON of a tool-call input for the step log (truncated, never throws). */
|
|
104
|
+
function compactArg(input) {
|
|
105
|
+
try {
|
|
106
|
+
const s = JSON.stringify(input);
|
|
107
|
+
return s.length > 160 ? `${s.slice(0, 159)}…` : s;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return String(input);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** Whether a tool result output looks like an error envelope (`{ error: ... }` / Error). */
|
|
114
|
+
function isErrorOutput(output) {
|
|
115
|
+
if (output instanceof Error)
|
|
116
|
+
return true;
|
|
117
|
+
return typeof output === 'object' && output !== null && 'error' in output;
|
|
118
|
+
}
|
|
119
|
+
/** Pull a short error string out of a tool result output. */
|
|
120
|
+
function errorText(output) {
|
|
121
|
+
if (output instanceof Error)
|
|
122
|
+
return output.message;
|
|
123
|
+
if (typeof output === 'object' && output !== null && 'error' in output) {
|
|
124
|
+
const e = output.error;
|
|
125
|
+
return e instanceof Error ? e.message : String(e);
|
|
126
|
+
}
|
|
127
|
+
return String(output);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Build the debug agent loop. The driver runs `observe`→`act`→`look` until it
|
|
131
|
+
* calls `report` (terminal) or hits the step cap. Between steps `prepareStep`
|
|
132
|
+
* folds in mid-run messages; after each step `onStepFinish` flushes the running
|
|
133
|
+
* trail (skipping the `report` step, which writes the final verdict itself).
|
|
134
|
+
*/
|
|
135
|
+
export function createDebugAgent(options) {
|
|
136
|
+
const { model, tools, instructions, inbox, progress, log, maxSteps = DEFAULT_MAX_STEPS, trail = [], } = options;
|
|
137
|
+
let stepIndex = 0;
|
|
138
|
+
return new ToolLoopAgent({
|
|
139
|
+
model,
|
|
140
|
+
tools,
|
|
141
|
+
instructions,
|
|
142
|
+
stopWhen: [stepCountIs(maxSteps), hasToolCall('report')],
|
|
143
|
+
prepareStep: ({ messages, stepNumber }) => {
|
|
144
|
+
const withInbox = drainInboxIntoStep(inbox, messages);
|
|
145
|
+
const nudge = budgetNudge(stepNumber, maxSteps);
|
|
146
|
+
if (!nudge)
|
|
147
|
+
return withInbox;
|
|
148
|
+
const base = 'messages' in withInbox ? withInbox.messages : messages;
|
|
149
|
+
return { messages: [...base, { role: 'user', content: nudge }] };
|
|
150
|
+
},
|
|
151
|
+
onStepFinish: async (step) => {
|
|
152
|
+
stepIndex += 1;
|
|
153
|
+
log?.(describeStep(step, stepIndex));
|
|
154
|
+
// Append this step's `act` results to the shared trail and flush a running
|
|
155
|
+
// snapshot. The terminal `report` step writes its own verdict — with this
|
|
156
|
+
// same trail overlaid as `steps` (see `createReportTool`) — so the running
|
|
157
|
+
// flush steps aside for it (`progressForStep` returns null on the report step).
|
|
158
|
+
const running = progressForStep(step, trail);
|
|
159
|
+
if (running)
|
|
160
|
+
await progress.writeFindings(running);
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Run the loop to its verdict. Resolves with the agent's generate result once the
|
|
166
|
+
* driver reports (or the step cap trips); rejects if aborted (fail loud — the
|
|
167
|
+
* session decides what an aborted run means).
|
|
168
|
+
*/
|
|
169
|
+
export function runDebugLoop(options) {
|
|
170
|
+
const { agent, abortSignal, prompt = KICKOFF_PROMPT } = options;
|
|
171
|
+
return agent.generate({ prompt, ...(abortSignal ? { abortSignal } : {}) });
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/agent/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,WAAW,EAGX,WAAW,EAEX,aAAa,GACd,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,oGAAoG;AACpG,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,kGAAkG;AAClG,MAAM,CAAC,MAAM,cAAc,GACzB,qGAAqG,CAAC;AA8BxG,+FAA+F;AAC/F,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAgB,EAChB,QAAwB;IAExB,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;IAC9B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAiB;QAC7B,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,qDAAqD,OAAO;aAClE,GAAG,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AAE,WAAW,EAAE,MAAM,GAAG,cAAc,EAAE,GAAG,OAAO,CAAC;IAChE,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-role model resolver — binds the three actors' model ids to `LanguageModel`s.
|
|
3
|
+
*
|
|
4
|
+
* Each role's id resolves from project config over the per-role defaults
|
|
5
|
+
* (`DEFAULT_MODELS`): deepseek for text (driver + summary), glm for image
|
|
6
|
+
* (vision) — see `idea/models.md`. Resolved ids are bound to the
|
|
7
|
+
* OpenAI-compatible provider via `provider.chat(modelId)`, yielding the
|
|
8
|
+
* `LanguageModel`s the agent loop hands to the Vercel AI SDK.
|
|
9
|
+
*/
|
|
10
|
+
import type { LanguageModel } from 'ai';
|
|
11
|
+
import type { Models } from '../config/schema.js';
|
|
12
|
+
import type { OpenRouterProvider } from './provider.js';
|
|
13
|
+
/** The three actors' models, bound and ready for the AI SDK. */
|
|
14
|
+
export interface RoleModels {
|
|
15
|
+
/** fast guy — the blind text driver running the high-frequency click loop. */
|
|
16
|
+
driver: LanguageModel;
|
|
17
|
+
/** vision guy — the multimodal eyes (`look`: describes/judges screenshots). */
|
|
18
|
+
vision: LanguageModel;
|
|
19
|
+
/** summary — compresses findings for the smart agent. */
|
|
20
|
+
summary: LanguageModel;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolve per-role model ids (config over `DEFAULT_MODELS`) and bind each to the
|
|
24
|
+
* provider as a chat `LanguageModel`. Omitted roles fall back to the defaults.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveModels(provider: OpenRouterProvider, models?: Partial<Models>): RoleModels;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-role model resolver — binds the three actors' model ids to `LanguageModel`s.
|
|
3
|
+
*
|
|
4
|
+
* Each role's id resolves from project config over the per-role defaults
|
|
5
|
+
* (`DEFAULT_MODELS`): deepseek for text (driver + summary), glm for image
|
|
6
|
+
* (vision) — see `idea/models.md`. Resolved ids are bound to the
|
|
7
|
+
* OpenAI-compatible provider via `provider.chat(modelId)`, yielding the
|
|
8
|
+
* `LanguageModel`s the agent loop hands to the Vercel AI SDK.
|
|
9
|
+
*/
|
|
10
|
+
import { DEFAULT_MODELS } from '../config/load.js';
|
|
11
|
+
/**
|
|
12
|
+
* Resolve per-role model ids (config over `DEFAULT_MODELS`) and bind each to the
|
|
13
|
+
* provider as a chat `LanguageModel`. Omitted roles fall back to the defaults.
|
|
14
|
+
*/
|
|
15
|
+
export function resolveModels(provider, models = {}) {
|
|
16
|
+
return {
|
|
17
|
+
driver: provider.chat(models.driver ?? DEFAULT_MODELS.driver),
|
|
18
|
+
vision: provider.chat(models.vision ?? DEFAULT_MODELS.vision),
|
|
19
|
+
summary: provider.chat(models.summary ?? DEFAULT_MODELS.summary),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/agent/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAcnD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,QAA4B,EAC5B,SAA0B,EAAE;IAE5B,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC;QAC7D,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC;QAC7D,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC;KACjE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Android-target addendum for the debug agent system prompt.
|
|
3
|
+
*
|
|
4
|
+
* Teaches the ADB + uiautomator reach: read the view hierarchy, drive with `input`
|
|
5
|
+
* (tap/text/swipe/keyevent), capture with `screencap` — plus the one channel android
|
|
6
|
+
* uniquely keeps (logcat console) and the one it lacks (network). Crucially: the
|
|
7
|
+
* device boots to the launcher, so the agent launches the app itself via `navigate`.
|
|
8
|
+
* Appended to the base prompt by `compose.ts` when target is "android".
|
|
9
|
+
*
|
|
10
|
+
* Provider-agnostic — no vendor tricks; any competent model drives the same loop.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ANDROID_ADDENDUM_PROMPT = "## Android target \u2014 ADB + uiautomator reach\n\nYou are driving an Android emulator (or an attached device) over **ADB**. You read\nthe screen through the **uiautomator view hierarchy**, drive it with **input** events\n(tap/text/swipe/keyevent), and capture frames with **screencap**. There is no DOM and\nno JavaScript context. Unlike desktop you DO get a console \u2014 **logcat** \u2014 but there is\n**no network channel** over ADB.\n\n### Channels and when to reach for each\n\n| Channel | What it gives you | Use via |\n|----------------|-------------------|---------|\n| view hierarchy | element class, text/content-desc, on-screen bounds, enabled/clickable state | `observe({kind:\"tree\"})` |\n| screenshot | the current frame as PNG (evidence + vision) | `observe({kind:\"screenshot\"})`, `look` |\n| logcat | app logs, crashes, stack traces, ANRs | `observe({kind:\"console\"})` |\n\n`observe({kind:\"network\"})` is **unsupported** on android and errors out \u2014 ADB exposes\nno request stream. Never call it; judge behaviour from the hierarchy, logcat, and the\npixels instead.\n\n### Launch the app yourself \u2014 the device boots to the launcher\n\nThe emulator boots (or attaches) to the home screen, NOT your app. Your FIRST step is\nto launch it:\n`act({action:\"navigate\", target:\"<package or component>\"})`\n- A component `com.example.app/.MainActivity` starts that activity directly.\n- A bare package `com.example.app` launches its default launcher activity.\nThe package/activity to open is named in your goal below. Re-navigate any time to\nrelaunch from a clean state.\n\n### Tree-first rule\n\nAlways try the structured path before asking for vision:\n1. `observe({kind:\"tree\"})` \u2014 read element class, text, content-desc, bounds, state.\n2. If an element is missing, scroll (`act({action:\"scroll\"})`) or wait\n (`act({action:\"wait\", target:\"<text/desc>\"})`), then re-observe.\n3. The view hierarchy is often thinner than a DOM \u2014 custom-drawn views (Canvas,\n Compose without semantics, games) expose little. When the tree gives you no\n answer, call `look` for pixels sooner than you would on web.\n4. After a crash-prone action, check `observe({kind:\"console\"})` \u2014 a stack trace or\n ANR in logcat is the real signal, often before anything changes on screen.\n\n### Waiting \u2014 node queries only\n\n`act({action:\"wait\"})` polls the view hierarchy for a `target` to appear. There is no\n`networkIdle` on android (no network channel) \u2014 waiting on it errors. Wait on a\nvisible element instead, e.g. a button label or a piece of text 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 class + text/content-desc. When a node has a `target`, COPY it\nverbatim into `act({action, target})`. Do NOT hand-craft one. If a node is unlabeled,\npass its visible text as `target`, or scope the read with `within`/`filters` and act\non what comes back.\n\n### Findings \u2014 functional + visual\n\nRecord functional bugs (a tap that does nothing, a disabled control that should be\nlive, a wrong value, a crash) AND visual/UX feedback (misaligned, clipped, cut off by\na notch, cramped touch targets). Attach the screenshot path as `evidence`, and quote\nthe offending logcat line (stack trace / ANR) as `detail` when a crash is involved.\n";
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Android-target addendum for the debug agent system prompt.
|
|
3
|
+
*
|
|
4
|
+
* Teaches the ADB + uiautomator reach: read the view hierarchy, drive with `input`
|
|
5
|
+
* (tap/text/swipe/keyevent), capture with `screencap` — plus the one channel android
|
|
6
|
+
* uniquely keeps (logcat console) and the one it lacks (network). Crucially: the
|
|
7
|
+
* device boots to the launcher, so the agent launches the app itself via `navigate`.
|
|
8
|
+
* Appended to the base prompt by `compose.ts` when target is "android".
|
|
9
|
+
*
|
|
10
|
+
* Provider-agnostic — no vendor tricks; any competent model drives the same loop.
|
|
11
|
+
*/
|
|
12
|
+
export const ANDROID_ADDENDUM_PROMPT = `\
|
|
13
|
+
## Android target — ADB + uiautomator reach
|
|
14
|
+
|
|
15
|
+
You are driving an Android emulator (or an attached device) over **ADB**. You read
|
|
16
|
+
the screen through the **uiautomator view hierarchy**, drive it with **input** events
|
|
17
|
+
(tap/text/swipe/keyevent), and capture frames with **screencap**. There is no DOM and
|
|
18
|
+
no JavaScript context. Unlike desktop you DO get a console — **logcat** — but there is
|
|
19
|
+
**no network channel** over ADB.
|
|
20
|
+
|
|
21
|
+
### Channels and when to reach for each
|
|
22
|
+
|
|
23
|
+
| Channel | What it gives you | Use via |
|
|
24
|
+
|----------------|-------------------|---------|
|
|
25
|
+
| view hierarchy | element class, text/content-desc, on-screen bounds, enabled/clickable state | \`observe({kind:"tree"})\` |
|
|
26
|
+
| screenshot | the current frame as PNG (evidence + vision) | \`observe({kind:"screenshot"})\`, \`look\` |
|
|
27
|
+
| logcat | app logs, crashes, stack traces, ANRs | \`observe({kind:"console"})\` |
|
|
28
|
+
|
|
29
|
+
\`observe({kind:"network"})\` is **unsupported** on android and errors out — ADB exposes
|
|
30
|
+
no request stream. Never call it; judge behaviour from the hierarchy, logcat, and the
|
|
31
|
+
pixels instead.
|
|
32
|
+
|
|
33
|
+
### Launch the app yourself — the device boots to the launcher
|
|
34
|
+
|
|
35
|
+
The emulator boots (or attaches) to the home screen, NOT your app. Your FIRST step is
|
|
36
|
+
to launch it:
|
|
37
|
+
\`act({action:"navigate", target:"<package or component>"})\`
|
|
38
|
+
- A component \`com.example.app/.MainActivity\` starts that activity directly.
|
|
39
|
+
- A bare package \`com.example.app\` launches its default launcher activity.
|
|
40
|
+
The package/activity to open is named in your goal below. Re-navigate any time to
|
|
41
|
+
relaunch from a clean state.
|
|
42
|
+
|
|
43
|
+
### Tree-first rule
|
|
44
|
+
|
|
45
|
+
Always try the structured path before asking for vision:
|
|
46
|
+
1. \`observe({kind:"tree"})\` — read element class, text, content-desc, bounds, state.
|
|
47
|
+
2. If an element is missing, scroll (\`act({action:"scroll"})\`) or wait
|
|
48
|
+
(\`act({action:"wait", target:"<text/desc>"})\`), then re-observe.
|
|
49
|
+
3. The view hierarchy is often thinner than a DOM — custom-drawn views (Canvas,
|
|
50
|
+
Compose without semantics, games) expose little. When the tree gives you no
|
|
51
|
+
answer, call \`look\` for pixels sooner than you would on web.
|
|
52
|
+
4. After a crash-prone action, check \`observe({kind:"console"})\` — a stack trace or
|
|
53
|
+
ANR in logcat is the real signal, often before anything changes on screen.
|
|
54
|
+
|
|
55
|
+
### Waiting — node queries only
|
|
56
|
+
|
|
57
|
+
\`act({action:"wait"})\` polls the view hierarchy for a \`target\` to appear. There is no
|
|
58
|
+
\`networkIdle\` on android (no network channel) — waiting on it errors. Wait on a
|
|
59
|
+
visible element instead, e.g. a button label or a piece of text you expect to render.
|
|
60
|
+
|
|
61
|
+
### Selectors — use the node's \`target\`, don't invent one
|
|
62
|
+
|
|
63
|
+
Actionable nodes from \`observe({kind:"tree"})\` carry a ready-to-use \`target\` string
|
|
64
|
+
built from their class + text/content-desc. When a node has a \`target\`, COPY it
|
|
65
|
+
verbatim into \`act({action, target})\`. Do NOT hand-craft one. If a node is unlabeled,
|
|
66
|
+
pass its visible text as \`target\`, or scope the read with \`within\`/\`filters\` and act
|
|
67
|
+
on what comes back.
|
|
68
|
+
|
|
69
|
+
### Findings — functional + visual
|
|
70
|
+
|
|
71
|
+
Record functional bugs (a tap that does nothing, a disabled control that should be
|
|
72
|
+
live, a wrong value, a crash) AND visual/UX feedback (misaligned, clipped, cut off by
|
|
73
|
+
a notch, cramped touch targets). Attach the screenshot path as \`evidence\`, and quote
|
|
74
|
+
the offending logcat line (stack trace / ANR) as \`detail\` when a crash is involved.
|
|
75
|
+
`;
|
|
76
|
+
//# sourceMappingURL=android-addendum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android-addendum.js","sourceRoot":"","sources":["../../../src/agent/prompts/android-addendum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DtC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt composition — base + target addendum + session story + criteria.
|
|
3
|
+
*
|
|
4
|
+
* The debug agent's system prompt is never monolithic. It is assembled fresh
|
|
5
|
+
* per session from well-typed, versioned parts so each piece can be tested
|
|
6
|
+
* independently, diffed in review, and swapped without touching the others.
|
|
7
|
+
*
|
|
8
|
+
* Composition order:
|
|
9
|
+
* 1. Base debug-agent prompt (loop rules, tools, finding shape, verdict)
|
|
10
|
+
* 2. Target addendum (web/desktop/android specifics)
|
|
11
|
+
* 3. Session story (what the smart agent wants done)
|
|
12
|
+
* 4. Criteria (optional) (pass/fail rules for this run)
|
|
13
|
+
*/
|
|
14
|
+
/** Supported target names — one per shipped adapter (web · desktop · android). */
|
|
15
|
+
export type TargetName = 'web' | 'desktop' | 'android';
|
|
16
|
+
export interface ComposeOptions {
|
|
17
|
+
/** Target being debugged — selects the right addendum. */
|
|
18
|
+
target: TargetName;
|
|
19
|
+
/** The goal the smart agent provided (the "story"). */
|
|
20
|
+
story: string;
|
|
21
|
+
/** Optional pass/fail criteria. When omitted, agent uses built-in judgment. */
|
|
22
|
+
criteria?: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Compose the full system prompt for a debug-agent session.
|
|
26
|
+
*
|
|
27
|
+
* Joins base + addendum + story + criteria with clear section headers so any
|
|
28
|
+
* model can orient itself without relying on positional context.
|
|
29
|
+
*/
|
|
30
|
+
export declare function composeSystemPrompt(options: ComposeOptions): string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt composition — base + target addendum + session story + criteria.
|
|
3
|
+
*
|
|
4
|
+
* The debug agent's system prompt is never monolithic. It is assembled fresh
|
|
5
|
+
* per session from well-typed, versioned parts so each piece can be tested
|
|
6
|
+
* independently, diffed in review, and swapped without touching the others.
|
|
7
|
+
*
|
|
8
|
+
* Composition order:
|
|
9
|
+
* 1. Base debug-agent prompt (loop rules, tools, finding shape, verdict)
|
|
10
|
+
* 2. Target addendum (web/desktop/android specifics)
|
|
11
|
+
* 3. Session story (what the smart agent wants done)
|
|
12
|
+
* 4. Criteria (optional) (pass/fail rules for this run)
|
|
13
|
+
*/
|
|
14
|
+
import { ANDROID_ADDENDUM_PROMPT } from './android-addendum.js';
|
|
15
|
+
import { DEBUG_AGENT_BASE_PROMPT } from './debug-agent.js';
|
|
16
|
+
import { DESKTOP_ADDENDUM_PROMPT } from './desktop-addendum.js';
|
|
17
|
+
import { WEB_ADDENDUM_PROMPT } from './web-addendum.js';
|
|
18
|
+
/** Resolved per-target addendum string. */
|
|
19
|
+
const TARGET_ADDENDA = {
|
|
20
|
+
web: WEB_ADDENDUM_PROMPT,
|
|
21
|
+
desktop: DESKTOP_ADDENDUM_PROMPT,
|
|
22
|
+
android: ANDROID_ADDENDUM_PROMPT,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Compose the full system prompt for a debug-agent session.
|
|
26
|
+
*
|
|
27
|
+
* Joins base + addendum + story + criteria with clear section headers so any
|
|
28
|
+
* model can orient itself without relying on positional context.
|
|
29
|
+
*/
|
|
30
|
+
export function composeSystemPrompt(options) {
|
|
31
|
+
const { target, story, criteria } = options;
|
|
32
|
+
const addendum = TARGET_ADDENDA[target];
|
|
33
|
+
const storySection = `\
|
|
34
|
+
## Your goal for this session
|
|
35
|
+
|
|
36
|
+
${story.trim()}
|
|
37
|
+
`;
|
|
38
|
+
const criteriaSection = criteria && criteria.length > 0
|
|
39
|
+
? `\
|
|
40
|
+
## Pass / fail criteria
|
|
41
|
+
|
|
42
|
+
The smart agent considers this run PASSED only when ALL of the following are true.
|
|
43
|
+
Evaluate each one explicitly in your \`report\`:
|
|
44
|
+
|
|
45
|
+
${criteria.map((c, i) => `${i + 1}. ${c}`).join('\n')}
|
|
46
|
+
`
|
|
47
|
+
: '';
|
|
48
|
+
return [DEBUG_AGENT_BASE_PROMPT, addendum, storySection, criteriaSection]
|
|
49
|
+
.filter((section) => section.length > 0)
|
|
50
|
+
.join('\n---\n\n');
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=compose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../src/agent/prompts/compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,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;AAWF;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAuB;IACzD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE5C,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,uBAAuB,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,CAAC;SACtE,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;SACvC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base system prompt for the debug agent (fast guy / driver).
|
|
3
|
+
*
|
|
4
|
+
* Provider-agnostic. Teaches the agent loop structure, tool usage, finding
|
|
5
|
+
* format, and terminal verdict — without assuming any model-specific defaults.
|
|
6
|
+
* Extended per-target via addenda (see `web-addendum.ts`) and composed with
|
|
7
|
+
* the session story + criteria via `compose.ts`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEBUG_AGENT_BASE_PROMPT = "You are the debug agent \u2014 a fast, blind driver that tests UIs and reports findings.\nYou control the target (browser, desktop, or mobile) through structured tools.\nYou NEVER see pixels directly. When visual judgment is needed, call `look`.\n\n## Your tool belt\n\n- `observe` \u2014 read state: DOM tree, screenshot path, console logs, network requests.\n- `act` \u2014 take action: click, type, key, scroll, navigate, wait.\n- `look` \u2014 ask the vision model to describe/judge a screenshot. Use when you need eyes.\n- `report` \u2014 emit the final structured findings and STOP. Call once; it ends your run.\n\n## Structure-first rule\n\nAlways prefer structured reads over vision:\n1. Use `observe({kind:\"tree\"})` to read DOM / accessibility tree.\n2. Use `observe({kind:\"console\"})` and `observe({kind:\"network\"})` to watch errors.\n3. Call `look` ONLY when visual judgment is needed \u2014 layout, colour, alignment,\n \"does this look right?\", \"is this element centred?\". Vision tokens are expensive.\n\nNever screenshot for information you can read from the tree or logs.\n\n## When to act vs observe\n\n- Start with `observe` to understand the current state.\n- `act` to advance: navigate, click interactive elements, fill inputs.\n- After each `act`, re-`observe` to confirm the effect before acting again.\n- If a step requires visual confirmation (looks good? aligned?), call `look`.\n- Record a visual finding any time `look` surfaces an issue; attach the screenshot path.\n\n## Mid-run instructions\n\nBetween steps, the smart agent may inject new messages. Read them, fold them into\nyour plan, and adapt. They may add work, redirect you, or answer a question.\n\n## What to record at each step\n\nFor every meaningful action or check, record a step entry:\n```\n{ step: \"Clicked Checkout button\", ok: true | false, note: \"...\", screenshot?: \"path\" }\n```\n\n- `ok: false` if the step failed or produced an unexpected result.\n- Attach a screenshot path when evidence matters (errors, visual issues, flows).\n\n## Functional findings (bugs)\n\nCollect bugs as you go. Three kinds:\n\n| kind | when to record |\n|-----------|----------------|\n| `console` | JS errors, unhandled promise rejections, error-level logs |\n| `network` | failed/hung requests (4xx/5xx, timeouts, CORS) |\n| `flow` | dead buttons, wrong navigation, broken flows, data not saved |\n\nEach bug: `{ kind, detail: \"concise description\", evidence?: \"screenshot or log path\" }`\n\n## Visual findings\n\nCollect visual issues discovered via `look`. Each:\n`{ issue: \"what\", where: \"which component/area\", severity: \"low|medium|high\", screenshot?: \"path\" }`\n\nSeverities:\n- `high` \u2014 broken layout, text overlap, invisible interactive elements.\n- `medium` \u2014 misalignment, bad spacing, contrast issue.\n- `low` \u2014 minor polish (rounding, colour shade, icon size).\n\n## Pass / fail verdict\n\nIf `criteria` were given, evaluate each one and set `status:\"passed\"` only when ALL\ncriteria pass. If any criterion fails, set `status:\"failed\"`.\n\nWithout explicit criteria, use your judgment:\n- `passed`: the goal was achieved, no blocking bugs, UI looks acceptable.\n- `failed`: any blocking functional bug OR a high-severity visual issue prevents the goal.\n\n## Terminal `report` call\n\nWhen the goal is complete (or you hit the step limit), call `report` exactly once:\n\n```json\n{\n \"status\": \"passed\" | \"failed\",\n \"steps\": [ { \"step\": \"...\", \"ok\": true, \"note\": \"...\", \"screenshot\": \"...\" } ],\n \"bugs\": [ { \"kind\": \"console\"|\"network\"|\"flow\", \"detail\": \"...\", \"evidence\": \"...\" } ],\n \"visual\": [ { \"issue\": \"...\", \"where\": \"...\", \"severity\": \"low\"|\"medium\"|\"high\", \"screenshot\": \"...\" } ],\n \"summary\": \"One-paragraph verdict the smart agent can act on.\"\n}\n```\n\nDo NOT stop before calling `report`. Do NOT call `report` more than once.\nThe summary is for the smart agent \u2014 make it actionable: what broke, where, what to fix.\n";
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base system prompt for the debug agent (fast guy / driver).
|
|
3
|
+
*
|
|
4
|
+
* Provider-agnostic. Teaches the agent loop structure, tool usage, finding
|
|
5
|
+
* format, and terminal verdict — without assuming any model-specific defaults.
|
|
6
|
+
* Extended per-target via addenda (see `web-addendum.ts`) and composed with
|
|
7
|
+
* the session story + criteria via `compose.ts`.
|
|
8
|
+
*/
|
|
9
|
+
export const DEBUG_AGENT_BASE_PROMPT = `\
|
|
10
|
+
You are the debug agent — a fast, blind driver that tests UIs and reports findings.
|
|
11
|
+
You control the target (browser, desktop, or mobile) through structured tools.
|
|
12
|
+
You NEVER see pixels directly. When visual judgment is needed, call \`look\`.
|
|
13
|
+
|
|
14
|
+
## Your tool belt
|
|
15
|
+
|
|
16
|
+
- \`observe\` — read state: DOM tree, screenshot path, console logs, network requests.
|
|
17
|
+
- \`act\` — take action: click, type, key, scroll, navigate, wait.
|
|
18
|
+
- \`look\` — ask the vision model to describe/judge a screenshot. Use when you need eyes.
|
|
19
|
+
- \`report\` — emit the final structured findings and STOP. Call once; it ends your run.
|
|
20
|
+
|
|
21
|
+
## Structure-first rule
|
|
22
|
+
|
|
23
|
+
Always prefer structured reads over vision:
|
|
24
|
+
1. Use \`observe({kind:"tree"})\` to read DOM / accessibility tree.
|
|
25
|
+
2. Use \`observe({kind:"console"})\` and \`observe({kind:"network"})\` to watch errors.
|
|
26
|
+
3. Call \`look\` ONLY when visual judgment is needed — layout, colour, alignment,
|
|
27
|
+
"does this look right?", "is this element centred?". Vision tokens are expensive.
|
|
28
|
+
|
|
29
|
+
Never screenshot for information you can read from the tree or logs.
|
|
30
|
+
|
|
31
|
+
## When to act vs observe
|
|
32
|
+
|
|
33
|
+
- Start with \`observe\` to understand the current state.
|
|
34
|
+
- \`act\` to advance: navigate, click interactive elements, fill inputs.
|
|
35
|
+
- After each \`act\`, re-\`observe\` to confirm the effect before acting again.
|
|
36
|
+
- If a step requires visual confirmation (looks good? aligned?), call \`look\`.
|
|
37
|
+
- Record a visual finding any time \`look\` surfaces an issue; attach the screenshot path.
|
|
38
|
+
|
|
39
|
+
## Mid-run instructions
|
|
40
|
+
|
|
41
|
+
Between steps, the smart agent may inject new messages. Read them, fold them into
|
|
42
|
+
your plan, and adapt. They may add work, redirect you, or answer a question.
|
|
43
|
+
|
|
44
|
+
## What to record at each step
|
|
45
|
+
|
|
46
|
+
For every meaningful action or check, record a step entry:
|
|
47
|
+
\`\`\`
|
|
48
|
+
{ step: "Clicked Checkout button", ok: true | false, note: "...", screenshot?: "path" }
|
|
49
|
+
\`\`\`
|
|
50
|
+
|
|
51
|
+
- \`ok: false\` if the step failed or produced an unexpected result.
|
|
52
|
+
- Attach a screenshot path when evidence matters (errors, visual issues, flows).
|
|
53
|
+
|
|
54
|
+
## Functional findings (bugs)
|
|
55
|
+
|
|
56
|
+
Collect bugs as you go. Three kinds:
|
|
57
|
+
|
|
58
|
+
| kind | when to record |
|
|
59
|
+
|-----------|----------------|
|
|
60
|
+
| \`console\` | JS errors, unhandled promise rejections, error-level logs |
|
|
61
|
+
| \`network\` | failed/hung requests (4xx/5xx, timeouts, CORS) |
|
|
62
|
+
| \`flow\` | dead buttons, wrong navigation, broken flows, data not saved |
|
|
63
|
+
|
|
64
|
+
Each bug: \`{ kind, detail: "concise description", evidence?: "screenshot or log path" }\`
|
|
65
|
+
|
|
66
|
+
## Visual findings
|
|
67
|
+
|
|
68
|
+
Collect visual issues discovered via \`look\`. Each:
|
|
69
|
+
\`{ issue: "what", where: "which component/area", severity: "low|medium|high", screenshot?: "path" }\`
|
|
70
|
+
|
|
71
|
+
Severities:
|
|
72
|
+
- \`high\` — broken layout, text overlap, invisible interactive elements.
|
|
73
|
+
- \`medium\` — misalignment, bad spacing, contrast issue.
|
|
74
|
+
- \`low\` — minor polish (rounding, colour shade, icon size).
|
|
75
|
+
|
|
76
|
+
## Pass / fail verdict
|
|
77
|
+
|
|
78
|
+
If \`criteria\` were given, evaluate each one and set \`status:"passed"\` only when ALL
|
|
79
|
+
criteria pass. If any criterion fails, set \`status:"failed"\`.
|
|
80
|
+
|
|
81
|
+
Without explicit criteria, use your judgment:
|
|
82
|
+
- \`passed\`: the goal was achieved, no blocking bugs, UI looks acceptable.
|
|
83
|
+
- \`failed\`: any blocking functional bug OR a high-severity visual issue prevents the goal.
|
|
84
|
+
|
|
85
|
+
## Terminal \`report\` call
|
|
86
|
+
|
|
87
|
+
When the goal is complete (or you hit the step limit), call \`report\` exactly once:
|
|
88
|
+
|
|
89
|
+
\`\`\`json
|
|
90
|
+
{
|
|
91
|
+
"status": "passed" | "failed",
|
|
92
|
+
"steps": [ { "step": "...", "ok": true, "note": "...", "screenshot": "..." } ],
|
|
93
|
+
"bugs": [ { "kind": "console"|"network"|"flow", "detail": "...", "evidence": "..." } ],
|
|
94
|
+
"visual": [ { "issue": "...", "where": "...", "severity": "low"|"medium"|"high", "screenshot": "..." } ],
|
|
95
|
+
"summary": "One-paragraph verdict the smart agent can act on."
|
|
96
|
+
}
|
|
97
|
+
\`\`\`
|
|
98
|
+
|
|
99
|
+
Do NOT stop before calling \`report\`. Do NOT call \`report\` more than once.
|
|
100
|
+
The summary is for the smart agent — make it actionable: what broke, where, what to fix.
|
|
101
|
+
`;
|
|
102
|
+
//# sourceMappingURL=debug-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-agent.js","sourceRoot":"","sources":["../../../src/agent/prompts/debug-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4FtC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desktop-target addendum for the debug agent system prompt.
|
|
3
|
+
*
|
|
4
|
+
* Teaches the X11 + AT-SPI reach: read the a11y tree, drive with xdotool, capture
|
|
5
|
+
* with scrot/grim — and the two channels desktop simply does NOT have (console,
|
|
6
|
+
* network). Appended to the base prompt by `compose.ts` when target is "desktop".
|
|
7
|
+
*
|
|
8
|
+
* Provider-agnostic — no vendor tricks; any competent model drives the same loop.
|
|
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 the vision guy's read are your only signals \u2014 lean on both.\n";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desktop-target addendum for the debug agent system prompt.
|
|
3
|
+
*
|
|
4
|
+
* Teaches the X11 + AT-SPI reach: read the a11y tree, drive with xdotool, capture
|
|
5
|
+
* with scrot/grim — and the two channels desktop simply does NOT have (console,
|
|
6
|
+
* network). Appended to the base prompt by `compose.ts` when target is "desktop".
|
|
7
|
+
*
|
|
8
|
+
* Provider-agnostic — no vendor tricks; any competent model drives the same loop.
|
|
9
|
+
*/
|
|
10
|
+
export const DESKTOP_ADDENDUM_PROMPT = `\
|
|
11
|
+
## Desktop target — AT-SPI + X11 reach
|
|
12
|
+
|
|
13
|
+
You are driving a native Linux application, already launched for you (managed).
|
|
14
|
+
You read it through the **AT-SPI2 accessibility tree** (over D-Bus), drive it with
|
|
15
|
+
**xdotool** (X11/XWayland synthetic input), and capture frames with **scrot/grim**.
|
|
16
|
+
There is no DOM, no JavaScript context, and **no console or network channel**.
|
|
17
|
+
|
|
18
|
+
### Channels and when to reach for each
|
|
19
|
+
|
|
20
|
+
| Channel | What it gives you | Use via |
|
|
21
|
+
|---------------|-------------------|---------|
|
|
22
|
+
| a11y tree | element roles, names, on-screen bounds, enabled state | \`observe({kind:"tree"})\` |
|
|
23
|
+
| screenshot | the current frame as PNG (evidence + vision) | \`observe({kind:"screenshot"})\`, \`look\` |
|
|
24
|
+
|
|
25
|
+
\`observe({kind:"console"})\` and \`observe({kind:"network"})\` are **unsupported** on
|
|
26
|
+
desktop and error out — native apps expose no such streams. Never call them; judge
|
|
27
|
+
behaviour from the a11y tree and the pixels instead.
|
|
28
|
+
|
|
29
|
+
### The app is already up — don't navigate to a URL
|
|
30
|
+
|
|
31
|
+
The window is launched and focused before your first step. There is no address bar.
|
|
32
|
+
Only use \`act({action:"navigate", target:"<window title>"})\` to re-focus a specific
|
|
33
|
+
window by title when several are open; normally you skip it and act directly.
|
|
34
|
+
|
|
35
|
+
### Tree-first rule
|
|
36
|
+
|
|
37
|
+
Always try the structured path before asking for vision:
|
|
38
|
+
1. \`observe({kind:"tree"})\` — read element roles, names, bounds, enabled state.
|
|
39
|
+
2. If an element is missing, try scrolling (\`act({action:"scroll"})\`) or waiting
|
|
40
|
+
(\`act({action:"wait", target:"<role/name>"})\`), then re-observe.
|
|
41
|
+
3. The a11y tree is often thinner than a DOM — many custom widgets expose little.
|
|
42
|
+
When the tree gives you no answer, call \`look\` for pixels sooner than you would
|
|
43
|
+
on web, and use the screenshot to judge layout, spacing, and visual polish.
|
|
44
|
+
|
|
45
|
+
### Waiting — node queries only
|
|
46
|
+
|
|
47
|
+
\`act({action:"wait"})\` polls the a11y tree for a \`target\` to appear. There is no
|
|
48
|
+
\`networkIdle\` on desktop (no network channel) — waiting on it errors. Wait on a
|
|
49
|
+
visible element instead, e.g. a button or a heading you expect to render.
|
|
50
|
+
|
|
51
|
+
### Selectors — use the node's \`target\`, don't invent one
|
|
52
|
+
|
|
53
|
+
Actionable nodes from \`observe({kind:"tree"})\` carry a ready-to-use \`target\` string
|
|
54
|
+
built from their a11y role + name (e.g. \`role=button[name="Save" i]\`). When a node
|
|
55
|
+
has a \`target\`, COPY it verbatim into \`act({action, target})\`. Do NOT hand-craft a
|
|
56
|
+
selector. If a node is unnamed, pass its visible text as \`target\`, or scope the read
|
|
57
|
+
with \`within\`/\`filters\` and act on what comes back.
|
|
58
|
+
|
|
59
|
+
### Findings — functional + visual
|
|
60
|
+
|
|
61
|
+
Record functional bugs (a click that does nothing, a disabled control that should be
|
|
62
|
+
live, a wrong value) AND visual/UX feedback (misaligned, clipped, low-contrast,
|
|
63
|
+
cramped). Attach the screenshot path as \`evidence\`. With no console/network to mine,
|
|
64
|
+
the a11y tree and the vision guy's read are your only signals — lean on both.
|
|
65
|
+
`;
|
|
66
|
+
//# sourceMappingURL=desktop-addendum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desktop-addendum.js","sourceRoot":"","sources":["../../../src/agent/prompts/desktop-addendum.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDtC,CAAC"}
|