agentpage 0.0.44 → 0.0.46
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/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -965,11 +965,19 @@ async function executeAgentLoop(params) {
|
|
|
965
965
|
consecutiveSamePlannedBatch = 1;
|
|
966
966
|
lastPlannedBatchKey = plannedBatchKey;
|
|
967
967
|
}
|
|
968
|
-
if (consecutiveSamePlannedBatch >=
|
|
968
|
+
if (consecutiveSamePlannedBatch >= 3 && !lastRoundHadError) {
|
|
969
969
|
finalReply = response.text?.trim() || "任务已完成。";
|
|
970
970
|
if (finalReply) callbacks?.onText?.(finalReply);
|
|
971
971
|
break;
|
|
972
972
|
}
|
|
973
|
+
if (consecutiveSamePlannedBatch >= 2 && !lastRoundHadError) protocolViolationHint = [
|
|
974
|
+
"Repeated action warning:",
|
|
975
|
+
"- You performed the EXACT same tool call(s) as the previous round, but no visible change occurred.",
|
|
976
|
+
"This round you MUST do ONE of:",
|
|
977
|
+
"1) Try a DIFFERENT element or approach (e.g., look for an alternative button, link, or parent container);",
|
|
978
|
+
"2) If the task is truly complete, return REMAINING: DONE with no tool calls.",
|
|
979
|
+
"Do NOT repeat the same action again."
|
|
980
|
+
].join("\n");
|
|
973
981
|
if (dryRun) {
|
|
974
982
|
finalReply = response.text ? response.text + "\n\n" : "";
|
|
975
983
|
finalReply += "🔧 AI 请求调用以下工具(dry-run 模式,未执行):\n";
|