@strayl/agent 0.1.15 → 0.1.16
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 +17 -0
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -7225,6 +7225,12 @@ var LLMClient = class {
|
|
|
7225
7225
|
}
|
|
7226
7226
|
}
|
|
7227
7227
|
}
|
|
7228
|
+
if (!emittedToolCalls && partialToolCalls.size > 0) {
|
|
7229
|
+
const hasIncomplete = [...partialToolCalls.values()].some((p) => !p.id || !p.name);
|
|
7230
|
+
if (hasIncomplete) {
|
|
7231
|
+
throw new Error("LLM stream truncated: incomplete tool calls received (provider may have timed out)");
|
|
7232
|
+
}
|
|
7233
|
+
}
|
|
7228
7234
|
}
|
|
7229
7235
|
};
|
|
7230
7236
|
|
|
@@ -13707,6 +13713,17 @@ ${IMPLEMENTATION_MODE_PROMPT2}`);
|
|
|
13707
13713
|
emitter.emit({ type: "session-end", usage: context.totalUsage(), exit_reason: "cancelled" });
|
|
13708
13714
|
return;
|
|
13709
13715
|
}
|
|
13716
|
+
if (!assistantText.trim() && completedToolCalls.length === 0) {
|
|
13717
|
+
consecutiveLLMErrors++;
|
|
13718
|
+
if (consecutiveLLMErrors >= MAX_CONSECUTIVE_LLM_ERRORS) {
|
|
13719
|
+
emitter.emit({ type: "error", message: `LLM returned empty response ${consecutiveLLMErrors} times in a row`, recoverable: false });
|
|
13720
|
+
break;
|
|
13721
|
+
}
|
|
13722
|
+
const backoffMs = Math.min(2e3 * Math.pow(2, consecutiveLLMErrors - 1), 16e3);
|
|
13723
|
+
emitter.emit({ type: "error", message: `LLM returned empty response (${consecutiveLLMErrors}/${MAX_CONSECUTIVE_LLM_ERRORS}) \u2014 retrying in ${backoffMs / 1e3}s`, recoverable: true });
|
|
13724
|
+
await new Promise((r) => setTimeout(r, backoffMs));
|
|
13725
|
+
continue;
|
|
13726
|
+
}
|
|
13710
13727
|
consecutiveLLMErrors = 0;
|
|
13711
13728
|
context.addAssistant(assistantText, completedToolCalls.length > 0 ? completedToolCalls : void 0);
|
|
13712
13729
|
{
|