@livx.cc/agentx 0.99.37 → 0.99.39

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as AgentOptions, H as Hooks, i as RunResult, A as Agent } from './Agent-B--fZNJy.js';
2
- export { C as ChatFragment, b as CompactResult, D as DEFAULT_MUTATING, c as Decision, P as PermissionOptions, d as PermissionPolicy, e as PermissionRule, f as PreToolUseDecision, R as ReasoningEffort, g as RecordingHooks, h as RecordingLifecycle, T as ToolUse, j as ToolUseMeta, k as composeHooks, l as estimateTokens, p as planMode, r as reasoningToChatFragment } from './Agent-B--fZNJy.js';
1
+ import { a as AgentOptions, H as Hooks, i as RunResult, A as Agent } from './Agent-DJwg1g8V.js';
2
+ export { C as ChatFragment, b as CompactResult, D as DEFAULT_MUTATING, c as Decision, P as PermissionOptions, d as PermissionPolicy, e as PermissionRule, f as PreToolUseDecision, R as ReasoningEffort, g as RecordingHooks, h as RecordingLifecycle, T as ToolUse, j as ToolUseMeta, k as composeHooks, l as estimateTokens, p as planMode, r as reasoningToChatFragment } from './Agent-DJwg1g8V.js';
3
3
  export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, modelShortLabel, resolveModelAlias, resolveModelSwitch } from './models.js';
4
4
  import { IFilesystem, FileMetadata } from '@livx.cc/wcli/core';
5
5
  export { CommandExecutor, FileMetadata, IFilesystem, IndexedDbFilesystem, MemFilesystem, registerHeadlessCommands } from '@livx.cc/wcli/core';
package/dist/index.js CHANGED
@@ -1986,9 +1986,10 @@ function makeRealShellTool(options) {
1986
1986
  timeoutMs: { type: "number", description: "wall-clock cap for THIS command, overriding the default (clamped to the tool max)" }
1987
1987
  }
1988
1988
  },
1989
- async run({ command, background, timeoutMs: askedTimeoutMs }, ctx) {
1989
+ async run({ command, background, timeoutMs: askedTimeoutMs, timeout: aliasTimeout }, ctx) {
1990
1990
  const cmd = String(command ?? "");
1991
- const timeoutMs = Number.isFinite(askedTimeoutMs) && Number(askedTimeoutMs) > 0 ? Math.min(Number(askedTimeoutMs), maxTimeoutMs) : defaultTimeoutMs;
1991
+ const asked = Number.isFinite(askedTimeoutMs) ? askedTimeoutMs : aliasTimeout;
1992
+ const timeoutMs = Number.isFinite(asked) && Number(asked) > 0 ? Math.min(Number(asked), maxTimeoutMs) : defaultTimeoutMs;
1992
1993
  if (!cmd.trim()) return "[exit 1] empty command";
1993
1994
  if (background) {
1994
1995
  if (!options.registry) return "Error: background execution is not enabled in this host (no job registry).";
@@ -4064,7 +4065,8 @@ var Agent = class _Agent {
4064
4065
  const kill = (finishReason) => {
4065
4066
  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` : ""})`);
4066
4067
  this.ctx.jobs?.killAll();
4067
- return { text: lastAssistantText(this.transcript), steps, finishReason, messages: this.transcript, usage, usageEstimated, ...this.fabricatedClaims.size ? { fabricatedToolClaims: [...this.fabricatedClaims] } : {} };
4068
+ const claims = this.survivingClaims();
4069
+ return { text: lastAssistantText(this.transcript), steps, finishReason, messages: this.transcript, usage, usageEstimated, ...claims.length ? { fabricatedToolClaims: claims } : {} };
4068
4070
  };
4069
4071
  while (true) {
4070
4072
  if (o.signal?.aborted) return kill("aborted");
@@ -4227,7 +4229,8 @@ var Agent = class _Agent {
4227
4229
  await this.ctx.jobs?.drain();
4228
4230
  this.releaseStaleImages();
4229
4231
  await this.activeHooks?.onStop?.(res.content ?? "");
4230
- return { text: res.content ?? "", steps, finishReason: "stop", messages: this.transcript, usage, usageEstimated, ...this.fabricatedClaims.size ? { fabricatedToolClaims: [...this.fabricatedClaims] } : {} };
4232
+ const claims = this.survivingClaims();
4233
+ return { text: res.content ?? "", steps, finishReason: "stop", messages: this.transcript, usage, usageEstimated, ...claims.length ? { fabricatedToolClaims: claims } : {} };
4231
4234
  }
4232
4235
  const fp = toolCalls.map((tc) => tc.function.name + ":" + (tc.function.arguments ?? "")).join("|");
4233
4236
  repeats = fp === lastFp ? repeats + 1 : 1;
@@ -4402,6 +4405,14 @@ var Agent = class _Agent {
4402
4405
  }
4403
4406
  return out;
4404
4407
  }
4408
+ /** The claims still standing at return time: named in this run's prose, and STILL absent from the
4409
+ * invocation ledger. Re-checked here rather than trusted from detection because the ledger moves —
4410
+ * the recovery nudge can succeed, and then the host would tell the user "I never ran it" about a
4411
+ * call that demonstrably ran. See `RunResult.fabricatedToolClaims`. */
4412
+ survivingClaims() {
4413
+ if (!this.fabricatedClaims.size) return [];
4414
+ return [...this.fabricatedClaims].filter((n) => !this.invokedTools.has(n));
4415
+ }
4405
4416
  async dispatch(tc) {
4406
4417
  this.invokedTools.add(tc.function.name);
4407
4418
  const tool = this.activeTools.find((t) => t.name === tc.function.name);