@strayl/agent 0.1.19 → 0.1.20
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/agent.js +1 -17
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -13563,9 +13563,6 @@ async function runAgent(config) {
|
|
|
13563
13563
|
const maxIterations = config.maxIterations ?? 200;
|
|
13564
13564
|
let consecutiveLLMErrors = 0;
|
|
13565
13565
|
const MAX_CONSECUTIVE_LLM_ERRORS = 5;
|
|
13566
|
-
let consecutiveTextOnly = 0;
|
|
13567
|
-
const MAX_CONSECUTIVE_TEXT_ONLY = 3;
|
|
13568
|
-
let totalToolCallsExecuted = 0;
|
|
13569
13566
|
if (config.restoreCheckpoint) {
|
|
13570
13567
|
const cp = config.restoreCheckpoint;
|
|
13571
13568
|
context.restoreMessages(cp.messages);
|
|
@@ -13752,21 +13749,8 @@ ${IMPLEMENTATION_MODE_PROMPT2}`);
|
|
|
13752
13749
|
});
|
|
13753
13750
|
}
|
|
13754
13751
|
if (completedToolCalls.length === 0) {
|
|
13755
|
-
|
|
13756
|
-
break;
|
|
13757
|
-
}
|
|
13758
|
-
consecutiveTextOnly++;
|
|
13759
|
-
const completionPattern = /\b(task\s+(is\s+)?complete|all\s+done|finished|ready\s+to\s+(use|go|test)|work\s+is\s+done|that'?s\s+it|nothing\s+(else|more)\s+to\s+do|i'?m\s+done)\b/i;
|
|
13760
|
-
const isExplicitlyDone = completionPattern.test(assistantText);
|
|
13761
|
-
if (isExplicitlyDone || consecutiveTextOnly >= MAX_CONSECUTIVE_TEXT_ONLY) {
|
|
13762
|
-
break;
|
|
13763
|
-
}
|
|
13764
|
-
context.addUser("[System: You responded with text but did not use any tools. If the task is complete, say so explicitly. Otherwise, continue working \u2014 use your tools to make progress on the user's request.]");
|
|
13765
|
-
emitter.emit({ type: "text-delta", text: "" });
|
|
13766
|
-
continue;
|
|
13752
|
+
break;
|
|
13767
13753
|
}
|
|
13768
|
-
consecutiveTextOnly = 0;
|
|
13769
|
-
totalToolCallsExecuted += completedToolCalls.length;
|
|
13770
13754
|
for (const tc of completedToolCalls) {
|
|
13771
13755
|
if (stdin.isCancelled()) {
|
|
13772
13756
|
context.addToolResult(tc.id, tc.function.name, JSON.stringify({ error: "Cancelled by user." }));
|