agentpage 0.0.41 → 0.0.42
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 +6 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -896,7 +896,7 @@ async function executeAgentLoop(params) {
|
|
|
896
896
|
}
|
|
897
897
|
pendingNotFoundRetry = void 0;
|
|
898
898
|
}
|
|
899
|
-
if (parsedInstructionState.hasRemainingProtocol) remainingInstruction =
|
|
899
|
+
if (parsedInstructionState.hasRemainingProtocol && parsedInstructionState.nextInstruction.trim().length === 0) remainingInstruction = "";
|
|
900
900
|
if (remainingInstruction.trim().length > 0 && round < maxRounds - 1) {
|
|
901
901
|
protocolViolationHint = [
|
|
902
902
|
"Protocol violation in previous round:",
|
|
@@ -1007,6 +1007,7 @@ async function executeAgentLoop(params) {
|
|
|
1007
1007
|
}
|
|
1008
1008
|
previousRoundModelOutput = parsedInstructionState.hasRemainingProtocol ? normalizeModelOutput(response.text) : `REMAINING: ${remainingInstruction || "DONE"}`;
|
|
1009
1009
|
lastRoundHadError = roundHasError;
|
|
1010
|
+
if (executedTaskCalls.length === 0 && response.toolCalls.length > 0) lastRoundHadError = true;
|
|
1010
1011
|
previousRoundTasks = buildTaskArray(executedTaskCalls);
|
|
1011
1012
|
previousRoundPlannedTasks = plannedTasksCurrentRound;
|
|
1012
1013
|
if (parsedInstructionState.hasRemainingProtocol && remainingInstruction.trim().length === 0 && !roundHasError) {
|
|
@@ -1014,20 +1015,17 @@ async function executeAgentLoop(params) {
|
|
|
1014
1015
|
if (finalReply) callbacks?.onText?.(finalReply);
|
|
1015
1016
|
break;
|
|
1016
1017
|
}
|
|
1017
|
-
if (consecutiveNoProtocolRounds >=
|
|
1018
|
+
if (consecutiveNoProtocolRounds >= 5) {
|
|
1018
1019
|
finalReply = response.text?.trim() || "任务已完成。";
|
|
1019
1020
|
if (finalReply) callbacks?.onText?.(finalReply);
|
|
1020
1021
|
break;
|
|
1021
1022
|
}
|
|
1022
|
-
if (consecutiveNoProtocolRounds >=
|
|
1023
|
-
"Protocol reminder: REMAINING protocol missing for
|
|
1023
|
+
if (consecutiveNoProtocolRounds >= 3) protocolViolationHint = [
|
|
1024
|
+
"Protocol reminder: REMAINING protocol missing for 3+ rounds with tool calls.",
|
|
1024
1025
|
"You MUST include REMAINING: <text> or REMAINING: DONE in every response.",
|
|
1025
1026
|
"If the task is fully complete, return REMAINING: DONE with no tool calls."
|
|
1026
1027
|
].join("\n");
|
|
1027
|
-
const idleResult = detectIdleLoop(
|
|
1028
|
-
name: tc.name,
|
|
1029
|
-
input: tc.input
|
|
1030
|
-
})), consecutiveReadOnlyRounds);
|
|
1028
|
+
const idleResult = detectIdleLoop(executedTaskCalls, consecutiveReadOnlyRounds);
|
|
1031
1029
|
if (idleResult === -1) {
|
|
1032
1030
|
finalReply = response.text?.trim() || "任务已完成。";
|
|
1033
1031
|
if (finalReply) callbacks?.onText?.(finalReply);
|