@livx.cc/agentx 0.96.10 → 0.96.12

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.js CHANGED
@@ -7146,6 +7146,12 @@ function resolveAecBinary() {
7146
7146
  }
7147
7147
  return bin;
7148
7148
  }
7149
+ function aecUnavailableHint() {
7150
+ if (process.env.MIC_AEC === "0" || process.platform !== "darwin") return null;
7151
+ if (resolveAecBinary()) return null;
7152
+ if (spawnSync2("which", ["swiftc"]).status !== 0) return "install Xcode CLI tools (`xcode-select --install`) for echo cancellation";
7153
+ return null;
7154
+ }
7149
7155
  var NodeMicSource = class {
7150
7156
  aec;
7151
7157
  bin;
@@ -10831,6 +10837,12 @@ function makeAskResolver(cwd) {
10831
10837
  }
10832
10838
  };
10833
10839
  }
10840
+ function hasBrowserMcp(cfg, extraTools) {
10841
+ const isBrowser = (s) => /browser/i.test(s);
10842
+ if (Object.entries(cfg.mcpServers ?? {}).some(([n, c]) => isBrowser(n) && !c?.disabled)) return true;
10843
+ return extraTools.some((t) => t.name.startsWith("mcp__") && isBrowser(t.name.slice(5).split("__")[0]));
10844
+ }
10845
+ var BROWSER_MAX_CONTEXT_TOKENS = 12e4;
10834
10846
  function optsFor(args, ai, cfg = {}, extraTools = []) {
10835
10847
  const perm = resolvePermMode(args, canPrompt);
10836
10848
  if (perm.notice) err(dim(` \u26A0 ${perm.notice}
@@ -10869,7 +10881,9 @@ function optsFor(args, ai, cfg = {}, extraTools = []) {
10869
10881
  maxRepeats: cfg.maxRepeats,
10870
10882
  maxToolCalls: cfg.maxToolCalls,
10871
10883
  keepToolOutputs: cfg.keepToolOutputs,
10872
- maxContextTokens: cfg.maxContextTokens,
10884
+ // Token-aware backstop: explicit config wins; else auto-enable for browser MCP runs (huge DOM/screenshot
10885
+ // results otherwise accumulate past the maxTokens budget kill-switch mid-browse). Off for normal sessions.
10886
+ maxContextTokens: cfg.maxContextTokens ?? (hasBrowserMcp(cfg, extraTools) ? BROWSER_MAX_CONTEXT_TOKENS : void 0),
10873
10887
  learnFromMistakes: cfg.learnFromMistakes,
10874
10888
  // Forwarded to cursor/* delegations for environment parity (chat-model providers ignore it).
10875
10889
  // Raw config (pre-OAuth): unresolved-oauth http servers are skipped by the cursor mapper.
@@ -10890,7 +10904,11 @@ async function makeAgent(args, ai, cfg, extraTools = []) {
10890
10904
  else if (args.shell === false) err(dim(" \u2296 --no-shell: VFS bash only (no real /bin/sh)\n"));
10891
10905
  if (args.harden && !virtual) err(dim(` \u26E8 hardened shell: writes confined to cwd+tmp${args.hardenNet ? "" : ", network blocked"} (sandbox-exec/bwrap)
10892
10906
  `));
10893
- const agent = await buildAgent(optsFor(args, ai, cfg, extraTools));
10907
+ const opts = optsFor(args, ai, cfg, extraTools);
10908
+ if (opts.maxContextTokens === BROWSER_MAX_CONTEXT_TOKENS && cfg.maxContextTokens == null)
10909
+ err(dim(` \u229E browser MCP detected \u2014 auto-capping sent context at ~${BROWSER_MAX_CONTEXT_TOKENS / 1e3}k tok (set maxContextTokens in config to override)
10910
+ `));
10911
+ const agent = await buildAgent(opts);
10894
10912
  const display = displayHooks(agent.options.fs, { flush: agent.options.host?.flushText });
10895
10913
  agent.options.hooks = cfg.hooks ? composeHooks(display, hooksFromConfig(cfg.hooks)) : display;
10896
10914
  return agent;
@@ -13048,6 +13066,11 @@ ${out}
13048
13066
  const inNote = inDev ? `, in: ${inDev.name}` : "";
13049
13067
  err(dim(` \u{1F3A4} voice on (${voiceIO.usingAec ? "echo-cancelled" : "heuristic echo \u2014 headphones recommended"}${inNote}) \u2014 just talk; speak over it to interrupt; say "voice off" to stop
13050
13068
  `));
13069
+ if (!voiceIO.usingAec) {
13070
+ const hint = aecUnavailableHint();
13071
+ if (hint) err(yellow(` \u26A0 no echo cancellation \u2014 ${hint}
13072
+ `));
13073
+ }
13051
13074
  if (inDev?.virtual) err(yellow(` \u26A0 default input "${inDev.name}" looks like a virtual device \u2014 if it can't hear you, switch your Mac input to a real mic
13052
13075
  `));
13053
13076
  if (greet) {