@strayl/agent 0.1.22 → 0.1.23

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.
Files changed (2) hide show
  1. package/dist/agent.js +7 -4
  2. package/package.json +1 -1
package/dist/agent.js CHANGED
@@ -13568,6 +13568,7 @@ async function runAgent(config) {
13568
13568
  let consecutiveLLMErrors = 0;
13569
13569
  const MAX_CONSECUTIVE_LLM_ERRORS = 5;
13570
13570
  let nudgedToContinue = false;
13571
+ let hasUsedTools = false;
13571
13572
  if (config.restoreCheckpoint) {
13572
13573
  const cp = config.restoreCheckpoint;
13573
13574
  context.restoreMessages(cp.messages);
@@ -13755,17 +13756,19 @@ ${IMPLEMENTATION_MODE_PROMPT2}`);
13755
13756
  });
13756
13757
  }
13757
13758
  if (completedToolCalls.length === 0) {
13758
- emitter.emit({ type: "debug", message: `[LOOP] No tool calls. textLen=${assistantText.length} nudgedToContinue=${nudgedToContinue} text="${assistantText.slice(0, 200)}"` });
13759
- if (!nudgedToContinue) {
13759
+ emitter.emit({ type: "debug", message: `[LOOP] No tool calls. textLen=${assistantText.length} nudgedToContinue=${nudgedToContinue} hasUsedTools=${hasUsedTools} mode=${currentMode} text="${assistantText.slice(0, 200)}"` });
13760
+ const shouldNudge = !nudgedToContinue && (hasUsedTools || currentMode === "implement");
13761
+ if (shouldNudge) {
13760
13762
  nudgedToContinue = true;
13761
13763
  emitter.emit({ type: "debug", message: `[LOOP] Sending nudge to continue...` });
13762
- context.addUser("[System: You responded with text but did not call any tools. If you are done, respond with your final message. Otherwise, use your tools to continue working.]");
13764
+ context.addUser("[System: You responded with text but did not call any tools. If your task is complete, say so briefly. If there is unfinished work from the user's original request, continue using tools.]");
13763
13765
  continue;
13764
13766
  }
13765
- emitter.emit({ type: "debug", message: `[LOOP] Already nudged, breaking loop. Agent will terminate.` });
13767
+ emitter.emit({ type: "debug", message: `[LOOP] No nudge needed (hasUsedTools=${hasUsedTools}), breaking loop. Agent will terminate.` });
13766
13768
  break;
13767
13769
  }
13768
13770
  emitter.emit({ type: "debug", message: `[LOOP] Tool calls: ${completedToolCalls.map((tc) => tc.function.name).join(", ")}` });
13771
+ hasUsedTools = true;
13769
13772
  nudgedToContinue = false;
13770
13773
  for (const tc of completedToolCalls) {
13771
13774
  if (stdin.isCancelled()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strayl/agent",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"