@livx.cc/agentx 0.99.116 → 0.99.118
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/cli.js +4 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -5300,11 +5300,12 @@ var Agent = class _Agent {
|
|
|
5300
5300
|
let emptyNudged = false;
|
|
5301
5301
|
let closureNudged = false;
|
|
5302
5302
|
let lastProgressAt = start;
|
|
5303
|
+
const turnUser = this.transcript[this.transcript.length - 1];
|
|
5303
5304
|
const kill = (finishReason) => {
|
|
5304
5305
|
log8.warn(`kill-switch: ${finishReason} (steps=${steps}, tokens=${usage.totalTokens}, budgetTokens=${Math.round(spent)}, ms=${Date.now() - start - this.parkedMs}${finishReason === "timeout" ? `, idle=${Date.now() - lastProgressAt - this.parkedMs}ms` : ""}${this.parkedMs ? ` +${this.parkedMs} parked` : ""})`);
|
|
5305
5306
|
this.jobs.killAll(`run ended: ${finishReason}`, true);
|
|
5306
5307
|
const claims = this.survivingClaims();
|
|
5307
|
-
return { text: lastAssistantText(this.transcript), steps, finishReason, messages: this.transcript, usage, usageEstimated, ...finishReason === "budget" ? { budget: { spent: Math.round(spent), limit: o.maxTokens, stepPrompt } } : {}, ...claims.length ? { fabricatedToolClaims: claims } : {} };
|
|
5308
|
+
return { text: lastAssistantText(this.transcript, turnUser), steps, finishReason, messages: this.transcript, usage, usageEstimated, ...finishReason === "budget" ? { budget: { spent: Math.round(spent), limit: o.maxTokens, stepPrompt } } : {}, ...claims.length ? { fabricatedToolClaims: claims } : {} };
|
|
5308
5309
|
};
|
|
5309
5310
|
const overBudget = () => !!o.maxTokens && spent >= o.maxTokens;
|
|
5310
5311
|
const canNudge = () => steps < o.maxSteps && !overBudget();
|
|
@@ -6164,8 +6165,9 @@ function summarize(messages, focus) {
|
|
|
6164
6165
|
}
|
|
6165
6166
|
return lines.join("\n");
|
|
6166
6167
|
}
|
|
6167
|
-
function lastAssistantText(messages) {
|
|
6168
|
+
function lastAssistantText(messages, since) {
|
|
6168
6169
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
6170
|
+
if (since && messages[i] === since) return "";
|
|
6169
6171
|
if (messages[i].role === "assistant") return contentText(messages[i].content);
|
|
6170
6172
|
}
|
|
6171
6173
|
return "";
|