@strayl/agent 0.1.16 → 0.1.17
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 +23 -2
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -133,7 +133,15 @@ Use sub-agents aggressively for parallel speedup:
|
|
|
133
133
|
Create todos when: 3+ files involved, installing packages + writing code, sequential dependencies.
|
|
134
134
|
Do NOT create todos for: single file edits, research only, single commands.
|
|
135
135
|
Granularity: ONE completable action per todo.
|
|
136
|
-
Lifecycle: create todos \u2192 set in_progress \u2192 completed \u2192 write_todos({ todos: [] }) when all done
|
|
136
|
+
Lifecycle: create todos \u2192 set in_progress \u2192 completed \u2192 write_todos({ todos: [] }) when all done.
|
|
137
|
+
|
|
138
|
+
## Task Completion
|
|
139
|
+
- Keep working until the user's request is FULLY implemented \u2014 do not stop after one step of a multi-step task
|
|
140
|
+
- After each action, verify the result and proceed to the next step
|
|
141
|
+
- A task is complete ONLY when: code is written, verified (build/test), and the feature works end-to-end
|
|
142
|
+
- If you output a text response without using tools, the system will ask you to continue \u2014 use your tools to make progress
|
|
143
|
+
- When truly done, include a clear completion statement (e.g., "The task is complete" or "All done")
|
|
144
|
+
- NEVER stop just because you explained what you did \u2014 actually verify it works`;
|
|
137
145
|
PLAN_MODE_SYSTEM_PROMPT = `
|
|
138
146
|
|
|
139
147
|
## PLAN MODE \u2014 YOU CAN ONLY DO 3 THINGS
|
|
@@ -13555,6 +13563,8 @@ async function runAgent(config) {
|
|
|
13555
13563
|
const maxIterations = config.maxIterations ?? 200;
|
|
13556
13564
|
let consecutiveLLMErrors = 0;
|
|
13557
13565
|
const MAX_CONSECUTIVE_LLM_ERRORS = 5;
|
|
13566
|
+
let consecutiveTextOnly = 0;
|
|
13567
|
+
const MAX_CONSECUTIVE_TEXT_ONLY = 3;
|
|
13558
13568
|
if (config.restoreCheckpoint) {
|
|
13559
13569
|
const cp = config.restoreCheckpoint;
|
|
13560
13570
|
context.restoreMessages(cp.messages);
|
|
@@ -13740,7 +13750,18 @@ ${IMPLEMENTATION_MODE_PROMPT2}`);
|
|
|
13740
13750
|
context_left_percent: leftPercent
|
|
13741
13751
|
});
|
|
13742
13752
|
}
|
|
13743
|
-
if (completedToolCalls.length === 0)
|
|
13753
|
+
if (completedToolCalls.length === 0) {
|
|
13754
|
+
consecutiveTextOnly++;
|
|
13755
|
+
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;
|
|
13756
|
+
const isExplicitlyDone = completionPattern.test(assistantText);
|
|
13757
|
+
if (isExplicitlyDone || consecutiveTextOnly >= MAX_CONSECUTIVE_TEXT_ONLY) {
|
|
13758
|
+
break;
|
|
13759
|
+
}
|
|
13760
|
+
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.]");
|
|
13761
|
+
emitter.emit({ type: "text-delta", text: "" });
|
|
13762
|
+
continue;
|
|
13763
|
+
}
|
|
13764
|
+
consecutiveTextOnly = 0;
|
|
13744
13765
|
for (const tc of completedToolCalls) {
|
|
13745
13766
|
if (stdin.isCancelled()) {
|
|
13746
13767
|
context.addToolResult(tc.id, tc.function.name, JSON.stringify({ error: "Cancelled by user." }));
|