@livx.cc/agentx 0.99.158 → 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 +1 -0
- package/dist/cli.js +40 -13
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
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.
|
|
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
|
-
|
|
17293
|
-
|
|
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
|
|
@@ -18493,13 +18515,13 @@ function holdLine(c) {
|
|
|
18493
18515
|
const said = new Set(c.history.filter((h) => h.who === "you").map((h) => norm3(h.text)));
|
|
18494
18516
|
return (HOLDS[c.lang] ?? []).find((x) => !said.has(norm3(x))) ?? "";
|
|
18495
18517
|
}
|
|
18496
|
-
function fastQuickLane(ai, model, gender, persona = "", hedgeMs = 900) {
|
|
18518
|
+
function fastQuickLane(ai, model, gender, persona = "", hedgeMs = 900, tools = true) {
|
|
18497
18519
|
return async (c, signal) => {
|
|
18498
18520
|
if (c.rest && GO_ON.test(c.heard)) return { kind: "resume", line: "" };
|
|
18499
18521
|
const hold = holdLine(c);
|
|
18500
18522
|
if (hold) return { kind: "say", line: hold };
|
|
18501
18523
|
const ask = async () => {
|
|
18502
|
-
const raw = await fastText(ai, { model, prompt: quickPrompt(c, gender, persona), signal, temperature: 0.4 });
|
|
18524
|
+
const raw = await fastText(ai, { model, prompt: quickPrompt(c, gender, persona, tools), signal, temperature: 0.4 });
|
|
18503
18525
|
const mv = quickMove(raw, c);
|
|
18504
18526
|
if (!mv) log39.debug(`quick lane: unusable "${raw.slice(0, 80)}"`);
|
|
18505
18527
|
return mv;
|
|
@@ -18516,12 +18538,12 @@ function fastQuickLane(ai, model, gender, persona = "", hedgeMs = 900) {
|
|
|
18516
18538
|
}
|
|
18517
18539
|
};
|
|
18518
18540
|
}
|
|
18519
|
-
function quickPrompt(c, gender, persona = "") {
|
|
18541
|
+
function quickPrompt(c, gender, persona = "", tools = true) {
|
|
18520
18542
|
const hist = c.history.slice(-12).map((h) => `${h.who === "user" ? "Them" : "You"}: ${h.text.slice(0, 400)}${h.cut ? " \u2014(they cut you here)" : ""}`).join("\n");
|
|
18521
18543
|
return `${persona ? `Who you are on this call:
|
|
18522
18544
|
${persona.slice(0, 500)}
|
|
18523
18545
|
|
|
18524
|
-
` : ""}You are the quick voice of a live phone call. A slower expert colleague works behind you: they use tools, the web and files and think things through. You answer at once.
|
|
18546
|
+
` : ""}You are the quick voice of a live phone call. ${tools ? "A slower expert colleague works behind you: they use tools, the web and files and think things through." : "A slower colleague works behind you and thinks things through. This call has NO tools: nothing can be looked up, checked, searched or fetched by anyone."} You answer at once.
|
|
18525
18547
|
|
|
18526
18548
|
The call so far:
|
|
18527
18549
|
${hist || "(just started)"}
|
|
@@ -18532,7 +18554,7 @@ They just said: "${c.heard}"
|
|
|
18532
18554
|
Reply with exactly ONE line, one of:
|
|
18533
18555
|
BYE: <a short farewell> \u2014 they mean to end the call ("no, thank you, bye", "okay, talk later"): the call hangs up after it. Judge the intent: "say bye to Dan" or "before I go, one more thing" is not an end.
|
|
18534
18556
|
SAY: <your words> \u2014 ONLY a greeting or how-are-you, a short reaction ("wow", "really?"), or when they ask exactly to repeat something ALREADY said ("say that again", "which one was that?"). Any request ("tell me a story\u2026"), any question about content ("what is\u2026?", "wait, what?", "how long is it?") is DEEP, even if you could guess. Max two short sentences. Use only facts from the call above; never invent a name, number, news item or result.
|
|
18535
|
-
DEEP: <a 2-8 word acknowledgement> | <what the colleague must do, names spelled right> \u2014 anything needing a lookup, current information, tools, files, or real thinking. The acknowledgement is your natural first reaction to THIS kind of ask, in your own voice: a lookup says you're on it and names what you'll look at ("Sure, let me pull up the kitty changelog."); a story, joke or idea gets a reaction to the idea itself (a story about a dragon: "Ooh, a dragon story, okay\u2026"); a question about what was said gets a short "ah"-type reaction ("Ah, good question."). Say "checking" or "looking" only when something is actually looked up. Never a result. The speech-to-text misspells names: fix them from context ("Haka News" \u2192 Hacker News).
|
|
18557
|
+
DEEP: <a 2-8 word acknowledgement> | <what the colleague must do, names spelled right> \u2014 anything needing a lookup, current information, tools, files, or real thinking. The acknowledgement is your natural first reaction to THIS kind of ask, in your own voice: ${tools ? `a lookup says you're on it and names what you'll look at ("Sure, let me pull up the kitty changelog."); ` : `never say you will check, look up, pull up, find or fetch anything \u2014 nothing can be; a question gets a short thinking reaction ("Hmm, okay\u2026", "Right, so\u2026"); `}a story, joke or idea gets a reaction to the idea itself (a story about a dragon: "Ooh, a dragon story, okay\u2026"); a question about what was said gets a short "ah"-type reaction ("Ah, good question."). Say "checking" or "looking" only when something is actually looked up. Never a result. The speech-to-text misspells names: fix them from context ("Haka News" \u2192 Hacker News).
|
|
18536
18558
|
QUIET \u2014 nothing is owed: a bare "okay", "mm-hm", or a reaction you already answered.
|
|
18537
18559
|
"Wait" / "hold on" with nothing new: a brief SAY ("Sure.") \u2014 no work for the colleague. Vary your words: never reuse an acknowledgement or reaction already said in this call.
|
|
18538
18560
|
A reaction ("wow", "really?") gets a short fitting reply in your own words ("I know, right?"), never their word back. Never repeat what was already said. Speak ${languageName(c.lang)}. ${personaHint(gender)} Output only the line.`;
|
|
@@ -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,
|
|
@@ -25947,7 +25973,8 @@ async function channelServe(args, ai, cfg) {
|
|
|
25947
25973
|
...fast,
|
|
25948
25974
|
// no `ai` here: the channel's model wiring is explicit
|
|
25949
25975
|
...quick ? {
|
|
25950
|
-
quick: fastQuickLane(ai, fast.fastModel, args.voiceGender, process.env.AGENTX_CALL_PERSONA ?? ""),
|
|
25976
|
+
quick: fastQuickLane(ai, fast.fastModel, args.voiceGender, process.env.AGENTX_CALL_PERSONA ?? "", void 0, process.env.AGENTX_CALL_NO_TOOLS !== "1"),
|
|
25977
|
+
// (1: MAIN has no tools — a sandboxed phone call)
|
|
25951
25978
|
noteTurn: (text) => out({ type: "note", text }),
|
|
25952
25979
|
heardCut: () => cut?.heard ?? null,
|
|
25953
25980
|
cutRest: () => cut && cut.full.slice(cut.heard.length).trim() || null,
|