@livx.cc/agentx 0.99.130 → 0.99.132

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.d.ts CHANGED
@@ -147,6 +147,7 @@ interface Args {
147
147
  modeScope?: 'sticky' | 'message';
148
148
  maxSteps?: number;
149
149
  maxTokens?: number;
150
+ maxToolCalls?: number;
150
151
  timeoutMs?: number;
151
152
  reasoning?: ReasoningEffort;
152
153
  help: boolean;
@@ -265,11 +266,14 @@ declare function cacheMultipliers(model?: string): {
265
266
  write: number;
266
267
  };
267
268
  /** USD cost from a model's per-1K pricing (ai.libx.js ModelPricing) + token usage. 0 if unpriced.
268
- * Cache-aware: promptTokens includes cache reads/writes — priced at the provider's real multipliers
269
- * (via `model`) so cached runs aren't overstated. Omitting `model` falls back to Anthropic's rates. */
269
+ * Cache-aware: promptTokens includes cache reads/writes. The catalog's own cache prices
270
+ * (`cacheCostPer1K` / `cacheWriteCostPer1K`) win; otherwise the provider's multipliers (via `model`)
271
+ * apply. Omitting `model` falls back to Anthropic's rates. */
270
272
  declare function costOf(pricing: {
271
273
  inputCostPer1K: number;
272
274
  outputCostPer1K: number;
275
+ cacheCostPer1K?: number;
276
+ cacheWriteCostPer1K?: number;
273
277
  } | undefined, promptTokens?: number, completionTokens?: number, cacheCreationTokens?: number, cacheReadTokens?: number, model?: string): number;
274
278
  /** Cost of one turn at `model`'s rate (looks up ai.libx.js pricing). Subscription `claude-code/<alias>` models
275
279
  * are priced at their API-equivalent Anthropic rate so auto-vs-pinned comparisons stay meaningful. */
package/dist/cli.js CHANGED
@@ -15414,7 +15414,8 @@ Windows paths: file tools accept ${cwd} style paths and the same path written ${
15414
15414
  ...o.maxTokens != null ? { maxTokens: o.maxTokens } : {},
15415
15415
  ...o.timeoutMs != null ? { timeoutMs: o.timeoutMs } : {},
15416
15416
  ...o.maxRepeats != null ? { maxRepeats: o.maxRepeats } : {},
15417
- ...o.maxToolCalls != null ? { maxToolCalls: o.maxToolCalls } : {},
15417
+ // a raised step budget raises the tool-call cap with it (else 100 stops a 300-step run at step ~86)
15418
+ ...o.maxToolCalls != null ? { maxToolCalls: o.maxToolCalls } : (o.maxSteps ?? 0) * 4 > 100 ? { maxToolCalls: o.maxSteps * 4 } : {},
15418
15419
  // Context-v2: by default, note-take over a long session (stub tool outputs older than the last 8).
15419
15420
  keepToolOutputs: o.keepToolOutputs ?? 8,
15420
15421
  ...o.maxContextTokens != null ? { maxContextTokens: o.maxContextTokens } : {},
@@ -19548,6 +19549,7 @@ function parseArgs(argv) {
19548
19549
  else if (x === "--fork-session") a.fork = true;
19549
19550
  else if (x === "--worktree" || x === "-w") a.worktree = val(++i, x);
19550
19551
  else if (x === "--max-steps") a.maxSteps = numFlag(argv[++i], "--max-steps");
19552
+ else if (x === "--max-tool-calls") a.maxToolCalls = numFlag(argv[++i], "--max-tool-calls");
19551
19553
  else if (x === "--max-tokens") a.maxTokens = numFlag(argv[++i], "--max-tokens");
19552
19554
  else if (x === "--timeout") a.timeoutMs = numFlag(argv[++i], "--timeout") * 1e3;
19553
19555
  else if (x === "--output-format") {
@@ -19661,6 +19663,7 @@ Flags:
19661
19663
  -w, --worktree <slug> run in an isolated git worktree (.claude/worktrees/<slug>); auto-cleaned on exit if no changes
19662
19664
  --max-steps <n> step budget (default 30)
19663
19665
  --max-tokens <n> token budget kill-switch (default 200000)
19666
+ --max-tool-calls <n> tool-call kill-switch (default 100, or 4 per step when --max-steps is higher)
19664
19667
  --timeout <sec> wall-clock kill-switch (default 120)
19665
19668
  --input-format stream-json with --duplex|--voice + --output-format stream-json: headless duplex for a host app
19666
19669
  (NDJSON turns/barge-ins on stdin, reflex text + worker speech + task events on stdout)
@@ -20244,7 +20247,7 @@ function costOf(pricing, promptTokens = 0, completionTokens = 0, cacheCreationTo
20244
20247
  if (!pricing) return 0;
20245
20248
  const mult = model ? cacheMultipliers(model) : { read: 0.1, write: 1.25 };
20246
20249
  const fresh = Math.max(0, promptTokens - cacheCreationTokens - cacheReadTokens);
20247
- return fresh / 1e3 * pricing.inputCostPer1K + cacheCreationTokens / 1e3 * pricing.inputCostPer1K * mult.write + cacheReadTokens / 1e3 * pricing.inputCostPer1K * mult.read + completionTokens / 1e3 * pricing.outputCostPer1K;
20250
+ return fresh / 1e3 * pricing.inputCostPer1K + cacheCreationTokens / 1e3 * (pricing.cacheWriteCostPer1K ?? pricing.inputCostPer1K * mult.write) + cacheReadTokens / 1e3 * (pricing.cacheCostPer1K ?? pricing.inputCostPer1K * mult.read) + completionTokens / 1e3 * pricing.outputCostPer1K;
20248
20251
  }
20249
20252
  var autoModels = () => ({ ...new ModelRouterOptions().models, ...JSON.parse(process.env.AGENTX_AUTO_MODELS || "{}") });
20250
20253
  function autoRouteSend(args, agent, session, pof) {
@@ -20442,7 +20445,7 @@ function optsFor(args, ai, cfg = {}, extraTools = []) {
20442
20445
  maxTokens: args.maxTokens ?? cfg.maxTokens,
20443
20446
  timeoutMs: args.timeoutMs ?? cfg.timeoutMs,
20444
20447
  maxRepeats: cfg.maxRepeats,
20445
- maxToolCalls: cfg.maxToolCalls,
20448
+ maxToolCalls: args.maxToolCalls ?? cfg.maxToolCalls,
20446
20449
  keepToolOutputs: cfg.keepToolOutputs,
20447
20450
  maxContextTokens: cfg.maxContextTokens,
20448
20451
  // Adaptive browser trimming (engages on actual browser tool USE, inside the Agent — see BROWSER_TRIM).