@livx.cc/agentx 0.99.159 → 0.99.160

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
@@ -177,6 +177,7 @@ interface Args {
177
177
  voiceSystemPrompt?: string;
178
178
  voicePersona?: string;
179
179
  addDirs?: string[];
180
+ confine?: boolean;
180
181
  mcpConfig?: string;
181
182
  print?: boolean;
182
183
  debug?: boolean;
package/dist/cli.js CHANGED
@@ -4214,7 +4214,7 @@ var PermissionPolicy = class {
4214
4214
  if (this.options.default !== "deny") return void 0;
4215
4215
  const gate = async (input) => {
4216
4216
  const t = input?.tool_input ?? {}, path = t.file_path ?? t.notebook_path ?? t.path;
4217
- const d = this.decide({ name: String(input?.tool_name ?? ""), args: { ...t, ...typeof path === "string" ? { path } : {} } });
4217
+ const d = this.decide({ name: String(input?.tool_name ?? "").replace(/^mcp__agentx__/, ""), args: { ...t, ...typeof path === "string" ? { path } : {} } });
4218
4218
  return d === "allow" ? {} : { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: `not on this run's tool allow-list (${input?.tool_name})` } };
4219
4219
  };
4220
4220
  return { PreToolUse: [{ hooks: [gate] }] };
@@ -17003,7 +17003,7 @@ function defaultOpenBrowser(url) {
17003
17003
  import { randomUUID } from "crypto";
17004
17004
  import { execFile as execFile3 } from "child_process";
17005
17005
  import { resolve as resolve3, basename as basename3, join as join7 } from "path";
17006
- import { existsSync as existsSync3, mkdirSync as mkdirSync4 } from "fs";
17006
+ import { existsSync as existsSync3, mkdirSync as mkdirSync4, realpathSync as realpathSync3 } from "fs";
17007
17007
  import { platform, arch, release, userInfo, homedir as homedir2, tmpdir } from "os";
17008
17008
  init_tools_shell();
17009
17009
 
@@ -17177,6 +17177,7 @@ function claudeCodeProviderOptions(model, cwd, mcpServers) {
17177
17177
  function providerOptionsFor(model, cwd, mcpServers, hostMcpServers) {
17178
17178
  return cursorProviderOptions(model, cwd, mcpServers, hostMcpServers) ?? claudeCodeProviderOptions(model, cwd, mcpServers);
17179
17179
  }
17180
+ var CONFINE_DENY = ["**/.agent", "**/.agent/**", "**/.claude", "**/.claude/**", "**/.mcp.json", "**/AGENTS.md", "**/CLAUDE.md", "**/CLAUDE.local.md"];
17180
17181
  async function buildAgent(o) {
17181
17182
  if (typeof o.sandbox !== "boolean")
17182
17183
  throw new Error(
@@ -17215,7 +17216,23 @@ async function buildAgent(o) {
17215
17216
  fs = bod;
17216
17217
  }
17217
17218
  let mountNote = "";
17218
- if (o.addDirs?.length && !virtual) {
17219
+ if (o.confine) {
17220
+ if (virtual) throw new Error("--confine is a disk-mode jail; --sandbox/--boddb already contain the agent.");
17221
+ if (isClaudeCode && o.permissions?.options.default !== "deny") throw new Error("claude-code/* can be confined only with an allow-list (--onlyTools): its own tools bypass the jail.");
17222
+ const roots = [...new Set([cwd, ...o.addDirs ?? []].map((d) => realpathSync3(resolve3(d))))];
17223
+ const mem = new MemFilesystem3();
17224
+ for (const r of roots) await mkdirp(mem, r);
17225
+ mem.setCwd(roots[0]);
17226
+ const mounts = [];
17227
+ for (const r of roots) {
17228
+ const d = new NodeDiskFilesystem(r);
17229
+ await d.init();
17230
+ mounts.push({ prefix: r, fs: new JailedFilesystem(d, { deny: [...DEFAULT_DENY, ...CONFINE_DENY] }) });
17231
+ }
17232
+ fs = new MountFilesystem(new JailedFilesystem(mem, { confineTo: [] }), mounts);
17233
+ if (roots.length > 1) mountNote = `You can reach ONLY these directories (read/write), by their full path:
17234
+ ${roots.join("\n")}`;
17235
+ } else if (o.addDirs?.length && !virtual) {
17219
17236
  const used = /* @__PURE__ */ new Set();
17220
17237
  const mounts = [];
17221
17238
  const notes = [];
@@ -17289,8 +17306,13 @@ Reference files in them by their mount path (the left side).`;
17289
17306
  // Warm cursor session (default on; CURSOR_WARM=0 to disable): one long-lived agent reused across
17290
17307
  // turns, amortising the ~2s Agent.create + h2 handshake. Keyed per agentx launch.
17291
17308
  ...(() => {
17292
- const po = providerOptionsFor(o.model, cwd, o.mcpServers, o.hostMcpServers);
17293
- return po ? { providerOptions: o.lean && isClaudeCode ? { ...po, settingSources: [] } : po } : {};
17309
+ let po = providerOptionsFor(o.model, cwd, o.mcpServers, o.hostMcpServers);
17310
+ if (po && o.lean && isClaudeCode) po = { ...po, settingSources: [] };
17311
+ if (po && o.confine && isClaudeCode) {
17312
+ if (!po.claudeCodeSession) throw new Error("claude-code/* cannot be confined without the warm session (AGENTX_CC_WARM=0): its own tools would bypass the jail.");
17313
+ return { providerOptions: { ...po, tools: [] }, ccBridge: "all" };
17314
+ }
17315
+ return po ? { providerOptions: po } : {};
17294
17316
  })(),
17295
17317
  // A child on ANOTHER provider (delegate mode's anthropic planner → claude-code/* worker, or back) gets that
17296
17318
  // runtime's own options (cwd, env, MCP) — the Agent default inherits only same-provider options, so a claude-code
@@ -17331,7 +17353,7 @@ Windows paths: file tools accept ${cwd} style paths and the same path written ${
17331
17353
  return { systemPrompt: basePrompt + "\n\n" + extra };
17332
17354
  })(),
17333
17355
  tools: (() => {
17334
- if (isClaudeCode) return [];
17356
+ if (isClaudeCode) return o.confine ? toolsByName(o.tools ?? DEFAULT_TOOLS).filter((t) => o.permissions?.decide({ name: t.name, args: {} }) !== "deny") : [];
17335
17357
  const requested = o.tools ?? DEFAULT_TOOLS;
17336
17358
  const base = toolsByName([...requested, ...autoWebTools()]);
17337
17359
  const tail = [...o.extraTools ?? []];
@@ -18040,7 +18062,7 @@ var VoiceIO = class extends VoiceEngine {
18040
18062
  const duplex = bin ? new AecDuplexAudio(bin) : null;
18041
18063
  super({
18042
18064
  ...o,
18043
- stt: o.stt ?? new SonioxSTT({ auth: o.sonioxApiKey, source: duplex ?? new NodeMicSource(), terms: o.sttTerms }),
18065
+ stt: o.stt ?? new SonioxSTT({ auth: o.sonioxApiKey, source: duplex ?? new NodeMicSource(), terms: o.sttTerms, agentTextInput: true }),
18044
18066
  tts: o.tts ?? new CartesiaTTS({ auth: o.cartesiaApiKey, voiceId: o.cartesiaVoiceId }),
18045
18067
  asideTts: o.tts ? o.asideTts : new CartesiaTTS({ auth: o.cartesiaApiKey, voiceId: o.cartesiaVoiceId }),
18046
18068
  // asides (VoiceCall.aside): a 2nd client — the reply's context may still stream
@@ -21901,6 +21923,7 @@ function parseArgs(argv) {
21901
21923
  else if (x === "--voice-system-prompt") a.voiceSystemPrompt = val(++i, x);
21902
21924
  else if (x === "--voice-persona") a.voicePersona = readPersona(val(++i, x));
21903
21925
  else if (x === "--add-dir") (a.addDirs ??= []).push(val(++i, x));
21926
+ else if (x === "--confine") a.confine = true;
21904
21927
  else if (x === "--mcp-config") a.mcpConfig = val(++i, x);
21905
21928
  else if (x === "--reasoning") a.reasoning = parseReasoning(val(++i, x));
21906
21929
  else if (x === "--session-id") a.sessionId = val(++i, x);
@@ -22019,6 +22042,8 @@ Flags:
22019
22042
  --no-think with --duplex: disable the Think tier (Act handles everything)
22020
22043
  --voice-system-prompt <text> with --duplex: appended to the voice (reflex) prompt only (--append-system-prompt \u2192 workers)
22021
22044
  --add-dir <path> mount another directory into the workspace (repeatable; disk mode only)
22045
+ --confine file tools reach ONLY cwd + --add-dir dirs (no absolute paths/../symlinks out; secrets still hidden);
22046
+ claude-code/* needs --onlyTools with it (its own tools are then switched off)
22022
22047
  --mcp-config <file> JSON { mcpServers?, permissions?, skillDirs? } merged over .agent config for this run only
22023
22048
  --subagents allow the Task tool (spawn child agents)
22024
22049
  --delegate <worker> delegate mode: the main model plans (its writes are refused), <worker> writes via Task
@@ -22801,6 +22826,7 @@ function optsFor(args, ai, cfg = {}, extraTools = []) {
22801
22826
  scratch: args.scratch,
22802
22827
  appendSystemPrompt: args.appendSystemPrompt,
22803
22828
  addDirs: args.addDirs,
22829
+ confine: args.confine,
22804
22830
  stream: args.stream,
22805
22831
  host: makeHost(args.outputFormat, { stream: true }),
22806
22832
  planMode: args.plan || cfg.planMode || false,