@livx.cc/agentx 0.99.134 → 0.99.136

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 { c as AgentOptions, H as Hooks, x as RunResult, k as Decider, b as Agent, q as PermissionPolicy, G as Gender, L as LineKind, d as ChannelMode, y as SecondChannelOptions, S as SecondChannel } from './secondChannel-D-8AGmAT.js';
2
- export { A as ADVISE_LIMIT, a as AdvisorSetup, C as CC_WRITE_TOOLS, e as ChatFragment, f as ChatUsage, g as Classification, h as Classifier, i as CompactResult, j as ContextFileSpec, D as DEFAULT_MUTATING, l as Decision, M as ModelRouter, m as ModelRouterOptions, P as PLANNER_BLOCKED, n as PLANNER_REFUSAL, o as PLAN_FIRST, p as PermissionOptions, r as PermissionRule, s as PreToolUseDecision, R as ReasoningEffort, t as RecordingHooks, u as RecordingLifecycle, v as RouteDecision, w as RouterState, T as Tier, z as ToolUse, B as ToolUseMeta, W as WRITE_TOOLS, E as advisorFor, F as advisorPrompt, I as ccModeOptions, J as claudeCodeDisallowedTools, K as composeHooks, N as delegatePrompt, O as delegateTools, Q as delegateWorkerFor, U as estimateTokens, V as jevAvailable, X as jevClassifier, Y as loadContextFiles, Z as loadInstructions, _ as makeAdvisor, $ as meterWorkers, a0 as pickTier, a1 as planMode, a2 as plannerBlocks, a3 as reasoningToChatFragment } from './secondChannel-D-8AGmAT.js';
1
+ import { c as AgentOptions, H as Hooks, x as RunResult, k as Decider, b as Agent, q as PermissionPolicy, G as Gender, L as LineKind, d as ChannelMode, y as SecondChannelOptions, S as SecondChannel } from './secondChannel-BqUiRI5w.js';
2
+ export { A as ADVISE_LIMIT, a as AdvisorSetup, C as CC_WRITE_TOOLS, e as ChatFragment, f as ChatUsage, g as Classification, h as Classifier, i as CompactResult, j as ContextFileSpec, D as DEFAULT_MUTATING, l as Decision, M as ModelRouter, m as ModelRouterOptions, P as PLANNER_BLOCKED, n as PLANNER_REFUSAL, o as PLAN_FIRST, p as PermissionOptions, r as PermissionRule, s as PreToolUseDecision, R as ReasoningEffort, t as RecordingHooks, u as RecordingLifecycle, v as RouteDecision, w as RouterState, T as Tier, z as ToolUse, B as ToolUseMeta, W as WRITE_TOOLS, E as advisorFor, F as advisorPrompt, I as ccModeOptions, J as claudeCodeDisallowedTools, K as composeHooks, N as delegatePrompt, O as delegateTools, Q as delegateWorkerFor, U as estimateTokens, V as jevAvailable, X as jevClassifier, Y as loadContextFiles, Z as loadInstructions, _ as makeAdvisor, $ as meterWorkers, a0 as pickTier, a1 as planMode, a2 as plannerBlocks, a3 as reasoningToChatFragment } from './secondChannel-BqUiRI5w.js';
3
3
  export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, latestClaude, 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
@@ -5607,7 +5607,7 @@ var Agent = class _Agent {
5607
5607
  }
5608
5608
  const sc = err?.statusCode;
5609
5609
  const serverSide = sc >= 500 || sc === 408 || /Service Unavailable|overloaded|Internal server error|Bad gateway|Gateway time/i.test(String(err?.message ?? ""));
5610
- const network = !sc && /ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|EPIPE|socket hang up|socket connection was closed|closed unexpectedly|stream failed mid-response|premature close|fetch failed|network|terminated|UND_ERR/i.test(String(err?.message ?? err?.code ?? err));
5610
+ const network = !sc && /ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|EPIPE|socket hang up|socket connection was closed|closed unexpectedly|premature close|fetch failed|network|terminated|UND_ERR/i.test(String(err?.message ?? err?.code ?? err));
5611
5611
  const stalled = err?.code === "stall";
5612
5612
  const empty = err?.code === "empty" || err?.code === "cursor_silent";
5613
5613
  const maxAttempts = empty ? Math.max(o.emptyRetries, 0) : 2;
@@ -5763,9 +5763,10 @@ var Agent = class _Agent {
5763
5763
  if (o.maxRepeats && repeats >= o.maxRepeats) return kill("loop");
5764
5764
  toolCallsTotal += toolCalls.length;
5765
5765
  if (o.maxToolCalls && toolCallsTotal > o.maxToolCalls) return kill("max_tool_calls");
5766
+ const cutAtCap = res.finishReason === "max_tokens" || res.finishReason === "length";
5766
5767
  for (const tc of toolCalls) {
5767
5768
  if (o.signal?.aborted) return kill("aborted");
5768
- const raw = await this.dispatch(tc);
5769
+ const raw = cutAtCap && tc === toolCalls[toolCalls.length - 1] ? this.cutAtCapResult(tc) : await this.dispatch(tc);
5769
5770
  let content;
5770
5771
  if (typeof raw === "string") {
5771
5772
  content = nonEmptyResult(raw, tc.function.name);
@@ -5983,6 +5984,15 @@ var Agent = class _Agent {
5983
5984
  const invoked = new Set([...this.invokedTools].map(toolKey));
5984
5985
  return [...this.fabricatedClaims].filter((n) => !invoked.has(toolKey(n)));
5985
5986
  }
5987
+ /** A tool call the output cap cut mid-arguments: never run it (its args are incomplete), and say WHY —
5988
+ * a generic "missing argument" makes the model re-send the same oversized call. */
5989
+ cutAtCapResult(tc) {
5990
+ this.invokedTools.add(tc.function.name);
5991
+ const msg = `Error: your reply hit the output token limit while writing this ${tc.function.name} call, so its arguments were cut off and it did NOT run. Re-sending the same call will be cut again. Split it: write a smaller first part now, then add the rest in further calls (e.g. Edit to append), each well under the limit.`;
5992
+ log9.warn(`${tc.function.name} cut at the output cap \u2014 not run`);
5993
+ this.options.host?.notify?.({ kind: "tool_result", id: tc.id ?? "", output: msg, isError: true });
5994
+ return msg;
5995
+ }
5986
5996
  async dispatch(tc) {
5987
5997
  this.invokedTools.add(tc.function.name);
5988
5998
  const tool = this.activeTools.find((t) => t.name === tc.function.name);