@livx.cc/agentx 0.99.37 → 0.99.38

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.
@@ -199,10 +199,15 @@ interface RunResult {
199
199
  };
200
200
  /** True if ANY turn's usage was estimated (provider gave none) rather than exact — lets the UI mark cost `~`. */
201
201
  usageEstimated?: boolean;
202
- /** Advertised tools the model NAMED in its own prose while the run's invocation ledger shows zero calls
203
- * to them — a fabricated tool use, proven against ground truth rather than guessed from phrasing.
204
- * Present even when the recovery nudge succeeded (it records that the turn needed rescuing); a host
205
- * can use it to tell the user plainly instead of shipping the model's invented result. */
202
+ /** Advertised tools the model NAMED in the reply it is handing back while the run's invocation ledger
203
+ * shows zero calls to them — a fabricated tool use, proven against ground truth rather than guessed
204
+ * from phrasing. A host can use it to tell the user plainly instead of shipping the invented result.
205
+ *
206
+ * Re-evaluated at RETURN time, not frozen at detection: a claim the recovery nudge rescued (the model
207
+ * went and made the real call) is dropped. It used to survive, on the reading that the field recorded
208
+ * "this turn needed rescuing" — but the only consumer turns it into a sentence for the user ("I never
209
+ * ran it"), and on the guard's own success path that sentence is false. Whether a turn needed rescuing
210
+ * is a telemetry question, and the `log.warn` at the nudge already answers it. */
206
211
  fabricatedToolClaims?: string[];
207
212
  error?: unknown;
208
213
  }
@@ -546,6 +551,11 @@ declare class Agent {
546
551
  * a rarer case at the cost of the common honest one.
547
552
  */
548
553
  private fabricatedToolNames;
554
+ /** The claims still standing at return time: named in this run's prose, and STILL absent from the
555
+ * invocation ledger. Re-checked here rather than trusted from detection because the ledger moves —
556
+ * the recovery nudge can succeed, and then the host would tell the user "I never ran it" about a
557
+ * call that demonstrably ran. See `RunResult.fabricatedToolClaims`. */
558
+ private survivingClaims;
549
559
  private dispatch;
550
560
  /** `/compact` aims to land the transcript at this fraction of the context window. */
551
561
  private static readonly COMPACT_TARGET;
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- import { H as Hooks, i as RunResult, R as ReasoningEffort, A as Agent } from './Agent-B--fZNJy.js';
2
+ import { H as Hooks, i as RunResult, R as ReasoningEffort, A as Agent } from './Agent-DJwg1g8V.js';
3
3
  import { IFilesystem } from '@livx.cc/wcli/core';
4
4
  import { M as Message, U as UserQuestion, H as HostBridge, c as ContentPart, g as MessageContent } from './tools-Byyh_bae.js';
5
5
 
package/dist/cli.js CHANGED
@@ -4099,7 +4099,8 @@ var Agent = class _Agent {
4099
4099
  const kill = (finishReason) => {
4100
4100
  log6.warn(`kill-switch: ${finishReason} (steps=${steps}, tokens=${usage.totalTokens}, budgetTokens=${Math.round(usage.totalTokens - 0.9 * usage.cacheReadTokens)}, ms=${Date.now() - start - this.parkedMs}${finishReason === "timeout" ? `, idle=${Date.now() - lastProgressAt - this.parkedMs}ms` : ""}${this.parkedMs ? ` +${this.parkedMs} parked` : ""})`);
4101
4101
  this.ctx.jobs?.killAll();
4102
- return { text: lastAssistantText(this.transcript), steps, finishReason, messages: this.transcript, usage, usageEstimated, ...this.fabricatedClaims.size ? { fabricatedToolClaims: [...this.fabricatedClaims] } : {} };
4102
+ const claims = this.survivingClaims();
4103
+ return { text: lastAssistantText(this.transcript), steps, finishReason, messages: this.transcript, usage, usageEstimated, ...claims.length ? { fabricatedToolClaims: claims } : {} };
4103
4104
  };
4104
4105
  while (true) {
4105
4106
  if (o.signal?.aborted) return kill("aborted");
@@ -4262,7 +4263,8 @@ var Agent = class _Agent {
4262
4263
  await this.ctx.jobs?.drain();
4263
4264
  this.releaseStaleImages();
4264
4265
  await this.activeHooks?.onStop?.(res.content ?? "");
4265
- return { text: res.content ?? "", steps, finishReason: "stop", messages: this.transcript, usage, usageEstimated, ...this.fabricatedClaims.size ? { fabricatedToolClaims: [...this.fabricatedClaims] } : {} };
4266
+ const claims = this.survivingClaims();
4267
+ return { text: res.content ?? "", steps, finishReason: "stop", messages: this.transcript, usage, usageEstimated, ...claims.length ? { fabricatedToolClaims: claims } : {} };
4266
4268
  }
4267
4269
  const fp = toolCalls.map((tc) => tc.function.name + ":" + (tc.function.arguments ?? "")).join("|");
4268
4270
  repeats = fp === lastFp ? repeats + 1 : 1;
@@ -4437,6 +4439,14 @@ var Agent = class _Agent {
4437
4439
  }
4438
4440
  return out;
4439
4441
  }
4442
+ /** The claims still standing at return time: named in this run's prose, and STILL absent from the
4443
+ * invocation ledger. Re-checked here rather than trusted from detection because the ledger moves —
4444
+ * the recovery nudge can succeed, and then the host would tell the user "I never ran it" about a
4445
+ * call that demonstrably ran. See `RunResult.fabricatedToolClaims`. */
4446
+ survivingClaims() {
4447
+ if (!this.fabricatedClaims.size) return [];
4448
+ return [...this.fabricatedClaims].filter((n) => !this.invokedTools.has(n));
4449
+ }
4440
4450
  async dispatch(tc) {
4441
4451
  this.invokedTools.add(tc.function.name);
4442
4452
  const tool = this.activeTools.find((t) => t.name === tc.function.name);