Skip to content

Commit 8b4600d

Browse files
author
SentienceDEV
committed
fix: planner intent specificity, vision auto-type on CLICK_XY, exempt CLICK from pre-verification
- Planner prompt: instruct specific intent with label/placeholder context - Vision TYPE: CLICK_XY returns field coords, executor auto-types input after click - Pre-verification: exempt CLICK actions from skip (Next/Submit buttons) - Vision prompt: ask for CLICK_XY on correct field by label, not two-step action
1 parent 8b8f080 commit 8b4600d

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

src/agents/planner-executor/planner-executor-agent.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,8 @@ export class PlannerExecutorAgent {
14591459
this.config.preStepVerification &&
14601460
(plannerAction.verify?.length || 0) > 0 &&
14611461
plannerAction.action !== 'TYPE_AND_SUBMIT' &&
1462-
plannerAction.action !== 'TYPE'
1462+
plannerAction.action !== 'TYPE' &&
1463+
plannerAction.action !== 'CLICK'
14631464
) {
14641465
const alreadySatisfied = await this.checkPreStepVerification(runtime, plannerAction);
14651466
if (alreadySatisfied) {
@@ -1905,14 +1906,26 @@ export class PlannerExecutorAgent {
19051906
error: 'CLICK_XY not supported by runtime (no clickCoordinate method)',
19061907
};
19071908
}
1909+
const isVisionTypeAction =
1910+
plannerAction.action === 'TYPE_AND_SUBMIT' || plannerAction.action === 'TYPE';
1911+
if (isVisionTypeAction && plannerAction.input && runtime.typeCoordinate) {
1912+
await new Promise(r => setTimeout(r, 300));
1913+
await runtime.typeCoordinate(plannerAction.input);
1914+
if (this.config.verbose) {
1915+
console.log(`[VISION] AUTO-TYPE after CLICK_XY: "${plannerAction.input}"`);
1916+
}
1917+
}
19081918
await new Promise(r => setTimeout(r, 500));
19091919
const urlAfter = await runtime.getCurrentUrl();
19101920
const verificationPassed = await this.verifyStepOutcome(runtime, plannerAction);
19111921
return {
19121922
stepId: stepNum,
19131923
goal: stepGoal,
19141924
status: verificationPassed ? StepStatus.SUCCESS : StepStatus.FAILED,
1915-
actionTaken: `CLICK_XY(${vx}, ${vy})`,
1925+
actionTaken:
1926+
isVisionTypeAction && plannerAction.input
1927+
? `CLICK_XY(${vx}, ${vy}) + TYPE_AT("${plannerAction.input}")`
1928+
: `CLICK_XY(${vx}, ${vy})`,
19161929
llmResponseText: executorResp?.content,
19171930
verificationPassed,
19181931
usedVision: true,

src/agents/planner-executor/prompts.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function buildStepwisePlannerPrompt(
5858
5959
Actions:
6060
- NAVIGATE: Go directly to a URL when the next destination is known. Set "target" to the URL.
61-
- CLICK: Click an element. Set "intent" to element type/role. Set "input" to EXACT text from elements list.
61+
- CLICK: Click an element. Set "intent" to describe the SPECIFIC element (include label, placeholder, or nearby text, e.g. "email textbox", "display name field", "Next button", NOT just "textbox" or "button"). Set "input" to EXACT text from elements list.
6262
- TYPE_AND_SUBMIT: Type text into a search box and submit. Set "input" to the SEARCH QUERY from the goal (NOT the element label).
6363
- SCROLL: Scroll page. Set "direction" to "up" or "down".
6464
- WAIT: Wait for content to appear when a follow-up verification is needed.
@@ -104,7 +104,9 @@ RULES:
104104
8. Output ONLY JSON - no <think> tags, no markdown, no prose
105105
9. Do NOT output <think> or any reasoning
106106
10. Do NOT return DONE until ALL parts of the goal are complete
107-
11. Never copy example URLs from these instructions. Only NAVIGATE to a URL from the user's task, the current page, or a visible element.`;
107+
11. Never copy example URLs from these instructions. Only NAVIGATE to a URL from the user's task, the current page, or a visible element.
108+
12. For multi-step forms: process each field as a separate step, then CLICK the Next/Submit button as a separate step.
109+
13. "intent" must be SPECIFIC: describe the element with its label or context (e.g., "email field", "plan dropdown", "Next button on step 2")`;
108110

109111
// Inject extraction-specific guidance when the goal is an extraction task
110112
const extractionGuidance = isExtractionTask(goal) ? getExtractionDomainGuidance() : '';
@@ -368,11 +370,12 @@ RULES:
368370
- Be precise with coordinates — aim for the center of the target element
369371
- Do NOT output any reasoning or prose
370372
- Do NOT use CLICK(id) — only coordinate-based actions
373+
- For form fields, match the field by its LABEL or PLACEHOLDER text, not just any input
371374
- Example: CLICK_XY(450, 320)`;
372375

373376
let actionHint: string;
374377
if (isTypeAction && inputText) {
375-
actionHint = `First CLICK_XY on the input field, then TYPE_AT("${inputText}")`;
378+
actionHint = `Return CLICK_XY(x, y) for the INPUT FIELD matching: "${intent || goal}". Look at field labels/placeholders to find the correct field.`;
376379
} else {
377380
actionHint = `Return CLICK_XY(x, y) for the element matching: "${intent || goal}"`;
378381
}

0 commit comments

Comments
 (0)