agentpage 0.0.34 → 0.0.36
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 +2 -1
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -318,7 +318,7 @@ agent.clearSystemPrompts();
|
|
|
318
318
|
console.log(agent.getSystemPrompts());
|
|
319
319
|
```
|
|
320
320
|
|
|
321
|
-
内置 prompt 的核心规则包括:快照优先决策、任务增量消费(REMAINING 协议)、批量执行、禁止 page_info
|
|
321
|
+
内置 prompt 的核心规则包括:快照优先决策、任务增量消费(REMAINING 协议)、批量执行、禁止 page_info 空转等。并且在点击场景中要求优先选择具备明确点击信号(如 `clk/pdn/mdn`、`onclick`、链接/按钮语义)的目标;若点击无效,下一轮应优先尝试同语义组中邻近的可操作元素,避免重复点击无效节点。注册表中的 Prompt 会作为扩展段追加到内置 prompt 之后。
|
|
322
322
|
|
|
323
323
|
#### `dryRun`(干运行模式)
|
|
324
324
|
|
|
@@ -1173,6 +1173,7 @@ loop 对本轮返回做以下处理:
|
|
|
1173
1173
|
- `Current remaining instruction`
|
|
1174
1174
|
- `Done steps (do NOT repeat)`
|
|
1175
1175
|
- `Previous round planned task array`
|
|
1176
|
+
- `Effect verification` — 要求 AI 对比上轮操作与当前快照,确认每个操作是否生效;未生效时从同区域找其他目标而非重复
|
|
1176
1177
|
- `Previous round model output (normalized)`
|
|
1177
1178
|
- `Latest DOM snapshot`
|
|
1178
1179
|
|
package/dist/index.mjs
CHANGED
|
@@ -499,7 +499,10 @@ function buildCompactMessages(userMessage, trace, latestSnapshot, currentUrl, hi
|
|
|
499
499
|
];
|
|
500
500
|
if (hasErrors) contextParts.push("", "The last step failed. Retry with a different approach, or skip and continue with other visible targets.");
|
|
501
501
|
else contextParts.push("", "If the goal is fully done, reply with a short summary (no tool calls).");
|
|
502
|
-
if (previousRoundTasks && previousRoundTasks.length > 0)
|
|
502
|
+
if (previousRoundTasks && previousRoundTasks.length > 0) {
|
|
503
|
+
contextParts.push("", "Previous round planned task array (already executed):", ...previousRoundTasks.map((task, index) => `${index + 1}. ${task}`));
|
|
504
|
+
contextParts.push("", "## Effect verification (MANDATORY before planning new actions)", "Compare the above executed actions against the CURRENT snapshot below:", "- Did each action produce the expected result? (e.g., click opened a dialog/navigated; fill changed the input value; select_option updated the selected item)", "- If an action had NO visible effect (page unchanged near the target area), do NOT repeat the same target.", " Instead, look for a different actionable element nearby (sibling/ancestor in the same row/card/group) that has stronger interaction signals (click listeners, button/link semantics).", "- Only after confirming which previous actions succeeded, plan this round's new actions on the remaining unfinished parts.");
|
|
505
|
+
}
|
|
503
506
|
if (previousRoundPlannedTasks && previousRoundPlannedTasks.length > 0) contextParts.push("", "Previous round model planned task array (before execution):", ...previousRoundPlannedTasks.map((task, index) => `${index + 1}. ${task}`));
|
|
504
507
|
if (previousRoundModelOutput) contextParts.push("", "Previous round model output (normalized, for task reduction input):", previousRoundModelOutput);
|
|
505
508
|
contextParts.push("", "After this round, include one plain text line:", "REMAINING: <new remaining instruction after this-round actions>", "or REMAINING: DONE");
|
|
@@ -1716,6 +1719,9 @@ function buildSystemPrompt(params = {}) {
|
|
|
1716
1719
|
"- Only interactive elements (with events, inputs, buttons, links, etc.) carry #hashID. Elements without #hashID are context-only (labels, headings, text) and cannot be targeted.",
|
|
1717
1720
|
"- Snapshot tag in brackets may show ARIA role instead of HTML tag when it better describes the interaction pattern (e.g. [combobox] for input with role=\"combobox\", [slider] for div with role=\"slider\"). Treat the bracket tag as the primary interaction hint.",
|
|
1718
1721
|
"- listeners=\"...\" on snapshot indicates bound event handlers (see Listener Abbrevs below). Prefer targets with relevant listeners when multiple candidates look similar.",
|
|
1722
|
+
"- Click targeting rule (MANDATORY): for click/navigation actions, prioritize elements with explicit click signals (listeners containing clk/pdn/mdn, onclick, native link/button semantics, or role=button/link).",
|
|
1723
|
+
"- Do NOT click focus/hover-only nodes for navigation (e.g. listeners only like fcs/blr/men/mlv without click-related signals). Treat those as context labels unless no better actionable target exists.",
|
|
1724
|
+
"- Correlation fallback: if a click produced no progress, in the next round choose the nearest actionable sibling/ancestor within the same semantic group (same row/card/form), such as adjacent repo path/link/button, instead of repeating the same ineffective target.",
|
|
1719
1725
|
"- Batch independent visible actions in one round. Do not split one form into many rounds unnecessarily.",
|
|
1720
1726
|
"- Strict input order (MANDATORY): before every fill/type/select_option, click or focus the SAME target immediately in the SAME round.",
|
|
1721
1727
|
"- Multi-field rule (MANDATORY): execute alternating pairs in one batch: focus/click field A -> fill/type A -> focus/click field B -> fill/type B.",
|