@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/index.js CHANGED
@@ -5191,11 +5191,12 @@ var Agent = class _Agent {
5191
5191
  let emptyNudged = false;
5192
5192
  let closureNudged = false;
5193
5193
  let lastProgressAt = start;
5194
+ const turnUser = this.transcript[this.transcript.length - 1];
5194
5195
  const kill = (finishReason) => {
5195
5196
  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` : ""})`);
5196
5197
  this.jobs.killAll(`run ended: ${finishReason}`, true);
5197
5198
  const claims = this.survivingClaims();
5198
- 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 } : {} };
5199
+ 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 } : {} };
5199
5200
  };
5200
5201
  const overBudget = () => !!o.maxTokens && spent >= o.maxTokens;
5201
5202
  const canNudge = () => steps < o.maxSteps && !overBudget();
@@ -6055,8 +6056,9 @@ function summarize(messages, focus) {
6055
6056
  }
6056
6057
  return lines.join("\n");
6057
6058
  }
6058
- function lastAssistantText(messages) {
6059
+ function lastAssistantText(messages, since) {
6059
6060
  for (let i = messages.length - 1; i >= 0; i--) {
6061
+ if (since && messages[i] === since) return "";
6060
6062
  if (messages[i].role === "assistant") return contentText(messages[i].content);
6061
6063
  }
6062
6064
  return "";