@livx.cc/agentx 0.99.75 → 0.99.77

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
  appendSystemPrompt?: string;
148
148
  voiceSystemPrompt?: string;
149
149
  addDirs?: string[];
150
+ mcpConfig?: string;
150
151
  print?: boolean;
151
152
  debug?: boolean;
152
153
  scratch?: boolean;
package/dist/cli.js CHANGED
@@ -12082,12 +12082,11 @@ function toClaudeCodeMcp(servers) {
12082
12082
  function claudeCodeProviderOptions(model, cwd, mcpServers) {
12083
12083
  if (!(model ?? "").startsWith("claude-code/")) return void 0;
12084
12084
  const env = (() => {
12085
- if (process.env.AGENTX_CC_USE_API_KEY) return void 0;
12086
- const { ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, ...rest } = process.env;
12087
- return rest;
12085
+ const base = process.env.AGENTX_CC_USE_API_KEY ? process.env : (({ ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, ...rest }) => rest)(process.env);
12086
+ return { ENABLE_CLAUDEAI_MCP_SERVERS: "false", ...base };
12088
12087
  })();
12089
12088
  const warm = process.env.AGENTX_CC_WARM === "0" ? {} : { claudeCodeSession: randomUUID() };
12090
- return { cwd, ...env ? { env } : {}, ...warm, ...toClaudeCodeMcp(mcpServers) ?? {} };
12089
+ return { cwd, env, ...warm, ...toClaudeCodeMcp(mcpServers) ?? {} };
12091
12090
  }
12092
12091
  function providerOptionsFor(model, cwd, mcpServers, hostMcpServers) {
12093
12092
  return cursorProviderOptions(model, cwd, mcpServers, hostMcpServers) ?? claudeCodeProviderOptions(model, cwd, mcpServers);
@@ -12889,14 +12888,90 @@ var JsonlDiagSink = class {
12889
12888
  };
12890
12889
 
12891
12890
  // cli/config.ts
12892
- import { homedir as homedir4 } from "os";
12891
+ import { homedir as homedir5 } from "os";
12893
12892
  import { existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
12894
- import { join as join7 } from "path";
12893
+ import { join as join8 } from "path";
12895
12894
  import { pathToFileURL } from "url";
12895
+
12896
+ // cli/permissions.ts
12897
+ import { writeFileSync as writeFileSync4, mkdirSync as mkdirSync7 } from "fs";
12898
+ import { homedir as homedir4 } from "os";
12899
+ import { join as join7 } from "path";
12900
+ var RULE_RE = /^(\w[\w*-]*)(?:\((.+)\))?$/;
12901
+ function parseOne(raw, decision) {
12902
+ const m = RULE_RE.exec(raw.trim());
12903
+ if (!m) return null;
12904
+ const [, tool, pathGlob] = m;
12905
+ return pathGlob ? { tool, pathGlob, decision } : { tool, decision };
12906
+ }
12907
+ function parsePermRules(perms, explicit = false) {
12908
+ if (!perms) return [];
12909
+ const out = [];
12910
+ for (const [decision, list] of [["deny", perms.deny], ["allow", perms.allow], ["ask", perms.ask]]) {
12911
+ for (const raw of list ?? []) {
12912
+ const r = parseOne(raw, decision);
12913
+ if (r) out.push(explicit ? { ...r, explicit } : r);
12914
+ }
12915
+ }
12916
+ return out;
12917
+ }
12918
+ function describeRule(r) {
12919
+ return `${r.decision.padEnd(5)} ${r.tool ?? "*"}${r.pathGlob ? `(${r.pathGlob})` : ""}`;
12920
+ }
12921
+ var PERM_FILE = (cwd) => join7(cwd, ".agent", "permissions.json");
12922
+ function loadPersistedRules(cwd) {
12923
+ const j = readJsonFile(PERM_FILE(cwd), null);
12924
+ return j ? { allow: j.allow ?? [], ask: j.ask ?? [], deny: j.deny ?? [] } : {};
12925
+ }
12926
+ function loadClaudeSettings(cwd, home = homedir4()) {
12927
+ const files = [join7(home, ".claude", "settings.json"), join7(cwd, ".claude", "settings.json"), join7(cwd, ".claude", "settings.local.json")];
12928
+ let out = {};
12929
+ for (const p of files) {
12930
+ const perms = readJsonFile(p, null)?.permissions;
12931
+ if (perms) out = mergePerms(out, { allow: perms.allow, ask: perms.ask, deny: perms.deny }) ?? out;
12932
+ }
12933
+ return out;
12934
+ }
12935
+ function persistRule(cwd, decision, ruleStr) {
12936
+ const cur = loadPersistedRules(cwd);
12937
+ const list = cur[decision] ??= [];
12938
+ if (!list.includes(ruleStr)) list.push(ruleStr);
12939
+ try {
12940
+ mkdirSync7(join7(cwd, ".agent"), { recursive: true });
12941
+ writeFileSync4(PERM_FILE(cwd), JSON.stringify(cur, null, 2) + "\n");
12942
+ } catch {
12943
+ }
12944
+ }
12945
+ function mergePerms(a, b) {
12946
+ if (!a && !b) return void 0;
12947
+ const out = {};
12948
+ for (const k of ["allow", "ask", "deny"]) {
12949
+ const merged = [...a?.[k] ?? [], ...b?.[k] ?? []];
12950
+ if (merged.length) out[k] = [...new Set(merged)];
12951
+ }
12952
+ return Object.keys(out).length ? out : void 0;
12953
+ }
12954
+ var TRUST_FILE = join7(homedir4(), ".agent", "trusted.json");
12955
+ function isTrusted(cwd, file = TRUST_FILE) {
12956
+ const list = readJsonFile(file, []);
12957
+ return Array.isArray(list) && list.includes(cwd);
12958
+ }
12959
+ function trustDir(cwd, file = TRUST_FILE) {
12960
+ let list = readJsonFile(file, []);
12961
+ if (!Array.isArray(list)) list = [];
12962
+ if (!list.includes(cwd)) list.push(cwd);
12963
+ try {
12964
+ mkdirSync7(join7(file, ".."), { recursive: true });
12965
+ writeFileSync4(file, JSON.stringify(list, null, 2) + "\n");
12966
+ } catch {
12967
+ }
12968
+ }
12969
+
12970
+ // cli/config.ts
12896
12971
  var FILES = ["config.ts", "config.js", "config.mjs", "config.json"];
12897
12972
  async function loadFrom(dir) {
12898
12973
  for (const f of FILES) {
12899
- const p = join7(dir, ".agent", f);
12974
+ const p = join8(dir, ".agent", f);
12900
12975
  if (!existsSync5(p)) continue;
12901
12976
  try {
12902
12977
  const mod = await import(pathToFileURL(p).href, f.endsWith(".json") ? { with: { type: "json" } } : void 0);
@@ -12909,7 +12984,7 @@ async function loadFrom(dir) {
12909
12984
  return {};
12910
12985
  }
12911
12986
  function loadSettings(dir) {
12912
- const p = join7(dir, ".agent", "settings.json");
12987
+ const p = join8(dir, ".agent", "settings.json");
12913
12988
  if (!existsSync5(p)) return {};
12914
12989
  try {
12915
12990
  const raw = JSON.parse(readFileSync7(p, "utf8"));
@@ -12932,17 +13007,28 @@ function loadSettings(dir) {
12932
13007
  return {};
12933
13008
  }
12934
13009
  }
12935
- async function loadConfig(cwd) {
12936
- const userSettings = loadSettings(homedir4());
12937
- const user = await loadFrom(homedir4());
13010
+ async function loadConfig(cwd, overlayFile) {
13011
+ const userSettings = loadSettings(homedir5());
13012
+ const user = await loadFrom(homedir5());
12938
13013
  const projectSettings = loadSettings(cwd);
12939
13014
  const project = await loadFrom(cwd);
12940
13015
  const merged = { ...userSettings, ...user, ...projectSettings, ...project };
12941
13016
  if (userSettings.mcpServers || user.mcpServers || projectSettings.mcpServers || project.mcpServers) {
12942
13017
  merged.mcpServers = { ...userSettings.mcpServers, ...user.mcpServers, ...projectSettings.mcpServers, ...project.mcpServers };
12943
13018
  }
13019
+ if (overlayFile) applyOverlay(merged, overlayFile);
12944
13020
  return merged;
12945
13021
  }
13022
+ function applyOverlay(cfg, file) {
13023
+ let raw;
13024
+ try {
13025
+ raw = JSON.parse(readFileSync7(file, "utf8"));
13026
+ } catch (e) {
13027
+ throw new Error(`--mcp-config ${file}: ${e?.message ?? e}`);
13028
+ }
13029
+ if (raw?.mcpServers && typeof raw.mcpServers === "object") cfg.mcpServers = { ...cfg.mcpServers, ...raw.mcpServers };
13030
+ if (raw?.permissions && typeof raw.permissions === "object") cfg.permissions = mergePerms(cfg.permissions, raw.permissions);
13031
+ }
12946
13032
 
12947
13033
  // cli/hooks-config.ts
12948
13034
  import { spawnSync as spawnSync3 } from "child_process";
@@ -13067,15 +13153,15 @@ function formatDiff(ops, opts = {}) {
13067
13153
  }
13068
13154
 
13069
13155
  // cli/session.ts
13070
- import { existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync8, writeFileSync as writeFileSync4, readdirSync, renameSync, symlinkSync as symlinkSync2, unlinkSync, readlinkSync, statSync as statSync6 } from "fs";
13071
- import { homedir as homedir5 } from "os";
13072
- import { join as join8 } from "path";
13156
+ import { existsSync as existsSync6, mkdirSync as mkdirSync8, readFileSync as readFileSync8, writeFileSync as writeFileSync5, readdirSync, renameSync, symlinkSync as symlinkSync2, unlinkSync, readlinkSync, statSync as statSync6 } from "fs";
13157
+ import { homedir as homedir6 } from "os";
13158
+ import { join as join9 } from "path";
13073
13159
  var log30 = forComponent("session");
13074
- var globalDir = () => join8(homedir5(), ".agent", "sessions");
13160
+ var globalDir = () => join9(homedir6(), ".agent", "sessions");
13075
13161
  var SessionStore = class {
13076
13162
  dir;
13077
13163
  constructor(cwd) {
13078
- this.dir = join8(cwd, ".agent", "sessions");
13164
+ this.dir = join9(cwd, ".agent", "sessions");
13079
13165
  }
13080
13166
  /** Sortable, human-readable id: `YYYYMMDD-HHMMSS-<folder>`. */
13081
13167
  newId(now4 = Date.now(), cwd) {
@@ -13083,10 +13169,10 @@ var SessionStore = class {
13083
13169
  const p = (n, w = 2) => String(n).padStart(w, "0");
13084
13170
  const slug2 = (cwd ?? process.cwd()).split("/").pop()?.replace(/[^A-Za-z0-9_-]/g, "") || "session";
13085
13171
  let id = `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}-${slug2}`;
13086
- if (existsSync6(this.dir) && existsSync6(join8(this.dir, `${id}.json`))) {
13172
+ if (existsSync6(this.dir) && existsSync6(join9(this.dir, `${id}.json`))) {
13087
13173
  for (let i = 2; i <= 99; i++) {
13088
13174
  const c = `${id}-${i}`;
13089
- if (!existsSync6(join8(this.dir, `${c}.json`))) {
13175
+ if (!existsSync6(join9(this.dir, `${c}.json`))) {
13090
13176
  id = c;
13091
13177
  break;
13092
13178
  }
@@ -13100,15 +13186,15 @@ var SessionStore = class {
13100
13186
  }
13101
13187
  save(data) {
13102
13188
  if (!this.safeId(data.meta.id)) throw new Error(`unsafe session id: ${data.meta.id}`);
13103
- if (!existsSync6(this.dir)) mkdirSync7(this.dir, { recursive: true });
13104
- const path = join8(this.dir, `${data.meta.id}.json`);
13189
+ if (!existsSync6(this.dir)) mkdirSync8(this.dir, { recursive: true });
13190
+ const path = join9(this.dir, `${data.meta.id}.json`);
13105
13191
  const tmp = `${path}.${process.pid}.tmp`;
13106
- writeFileSync4(tmp, JSON.stringify(data));
13192
+ writeFileSync5(tmp, JSON.stringify(data));
13107
13193
  renameSync(tmp, path);
13108
13194
  try {
13109
13195
  const gd = globalDir();
13110
- if (!existsSync6(gd)) mkdirSync7(gd, { recursive: true });
13111
- const link2 = join8(gd, `${data.meta.id}.json`);
13196
+ if (!existsSync6(gd)) mkdirSync8(gd, { recursive: true });
13197
+ const link2 = join9(gd, `${data.meta.id}.json`);
13112
13198
  if (!existsSync6(link2)) symlinkSync2(path, link2);
13113
13199
  } catch {
13114
13200
  }
@@ -13118,7 +13204,7 @@ var SessionStore = class {
13118
13204
  log30.debug(`rejecting unsafe session id: ${id}`);
13119
13205
  return void 0;
13120
13206
  }
13121
- const path = join8(this.dir, `${id}.json`);
13207
+ const path = join9(this.dir, `${id}.json`);
13122
13208
  if (!existsSync6(path)) return void 0;
13123
13209
  try {
13124
13210
  return JSON.parse(readFileSync8(path, "utf8"));
@@ -13134,7 +13220,7 @@ var SessionStore = class {
13134
13220
  for (const f of readdirSync(this.dir)) {
13135
13221
  if (!f.endsWith(".json")) continue;
13136
13222
  try {
13137
- metas.push(JSON.parse(readFileSync8(join8(this.dir, f), "utf8")).meta);
13223
+ metas.push(JSON.parse(readFileSync8(join9(this.dir, f), "utf8")).meta);
13138
13224
  } catch (e) {
13139
13225
  log30.debug(`skipping unreadable session file ${f}`, e);
13140
13226
  }
@@ -13149,7 +13235,7 @@ var SessionStore = class {
13149
13235
  for (const f of readdirSync(this.dir)) {
13150
13236
  if (!f.endsWith(".json")) continue;
13151
13237
  try {
13152
- const st = statSync6(join8(this.dir, f));
13238
+ const st = statSync6(join9(this.dir, f));
13153
13239
  out.push({ id: f.slice(0, -5), mtime: st.mtimeMs, size: st.size });
13154
13240
  } catch {
13155
13241
  }
@@ -13168,7 +13254,7 @@ var SessionStore = class {
13168
13254
  function globalSessionLoad(idOrPrefix) {
13169
13255
  const gd = globalDir();
13170
13256
  if (!existsSync6(gd)) return void 0;
13171
- const exact = join8(gd, `${idOrPrefix}.json`);
13257
+ const exact = join9(gd, `${idOrPrefix}.json`);
13172
13258
  if (existsSync6(exact)) {
13173
13259
  try {
13174
13260
  const target = readlinkSync(exact);
@@ -13182,7 +13268,7 @@ function globalSessionLoad(idOrPrefix) {
13182
13268
  if (!f.endsWith(".json")) continue;
13183
13269
  const base = f.slice(0, -5);
13184
13270
  if (base.includes(idOrPrefix) || base.endsWith(idOrPrefix)) {
13185
- const target = readlinkSync(join8(gd, f));
13271
+ const target = readlinkSync(join9(gd, f));
13186
13272
  return JSON.parse(readFileSync8(target, "utf8"));
13187
13273
  }
13188
13274
  }
@@ -13197,10 +13283,10 @@ function globalSessionList() {
13197
13283
  for (const f of readdirSync(gd)) {
13198
13284
  if (!f.endsWith(".json")) continue;
13199
13285
  try {
13200
- const target = readlinkSync(join8(gd, f));
13286
+ const target = readlinkSync(join9(gd, f));
13201
13287
  if (!existsSync6(target)) {
13202
13288
  try {
13203
- unlinkSync(join8(gd, f));
13289
+ unlinkSync(join9(gd, f));
13204
13290
  } catch {
13205
13291
  }
13206
13292
  continue;
@@ -13372,15 +13458,15 @@ ${formatDiff(ops)}`);
13372
13458
  // cli/gitCheckpoints.ts
13373
13459
  import { execFile as execFile3 } from "child_process";
13374
13460
  import { promisify } from "util";
13375
- import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync8 } from "fs";
13376
- import { homedir as homedir6 } from "os";
13377
- import { join as join9, resolve as resolve3, sep as sep3, parse as parsePath } from "path";
13461
+ import { writeFileSync as writeFileSync6, mkdirSync as mkdirSync9 } from "fs";
13462
+ import { homedir as homedir7 } from "os";
13463
+ import { join as join10, resolve as resolve3, sep as sep3, parse as parsePath } from "path";
13378
13464
  var log31 = forComponent("checkpoints");
13379
13465
  var exec = promisify(execFile3);
13380
13466
  var DEFAULT_EXCLUDE = [".agent/", ".git/", "node_modules/", "dist/", "build/", ".next/", "target/", ".venv/", "__pycache__/", "*.log"];
13381
13467
  function isBroadRoot(p) {
13382
13468
  const abs = resolve3(p);
13383
- return abs === resolve3(homedir6()) || abs === parsePath(abs).root;
13469
+ return abs === resolve3(homedir7()) || abs === parsePath(abs).root;
13384
13470
  }
13385
13471
  var ShadowRepo = class {
13386
13472
  // undefined = unprobed; false = git/this root unusable
@@ -13414,11 +13500,11 @@ var ShadowRepo = class {
13414
13500
  if (this.ready !== void 0) return this.ready;
13415
13501
  try {
13416
13502
  await exec(this.git, ["--version"]);
13417
- mkdirSync8(this.gitDir, { recursive: true });
13503
+ mkdirSync9(this.gitDir, { recursive: true });
13418
13504
  const valid = await this.run("rev-parse", "--git-dir").then(() => true, () => false);
13419
13505
  if (!valid) await this.run("init", "-q");
13420
- mkdirSync8(join9(this.gitDir, "info"), { recursive: true });
13421
- writeFileSync5(join9(this.gitDir, "info", "exclude"), this.exclude.join("\n") + "\n");
13506
+ mkdirSync9(join10(this.gitDir, "info"), { recursive: true });
13507
+ writeFileSync6(join10(this.gitDir, "info", "exclude"), this.exclude.join("\n") + "\n");
13422
13508
  this.ready = true;
13423
13509
  } catch (e) {
13424
13510
  log31.debug(`git checkpoints unavailable for ${this.workTree}`, e);
@@ -13533,7 +13619,7 @@ var GitCheckpoints = class {
13533
13619
  const abs = resolve3(d);
13534
13620
  if (abs === cwd || abs.startsWith(cwd + sep3)) continue;
13535
13621
  if (cwd.startsWith(abs + sep3)) continue;
13536
- out.push({ workTree: abs, gitDir: join9(abs, ".agent", "checkpoints.git") });
13622
+ out.push({ workTree: abs, gitDir: join10(abs, ".agent", "checkpoints.git") });
13537
13623
  }
13538
13624
  return out;
13539
13625
  }
@@ -13676,7 +13762,7 @@ var GitCheckpointsOptions = class {
13676
13762
  /** Real working tree to snapshot (the launch cwd). */
13677
13763
  workTree = process.cwd();
13678
13764
  /** Isolated git dir for the cwd shadow repo (kept out of the user's real .git). */
13679
- gitDir = join9(process.cwd(), ".agent", "checkpoints.git");
13765
+ gitDir = join10(process.cwd(), ".agent", "checkpoints.git");
13680
13766
  /** Extra mounted dirs (`--add-dir`); those outside cwd each get their own shadow repo. */
13681
13767
  addDirs = [];
13682
13768
  /** Conversation id → per-session restore-point ref. */
@@ -13691,80 +13777,6 @@ var GitCheckpointsOptions = class {
13691
13777
  git = "git";
13692
13778
  };
13693
13779
 
13694
- // cli/permissions.ts
13695
- import { writeFileSync as writeFileSync6, mkdirSync as mkdirSync9 } from "fs";
13696
- import { homedir as homedir7 } from "os";
13697
- import { join as join10 } from "path";
13698
- var RULE_RE = /^(\w[\w*-]*)(?:\((.+)\))?$/;
13699
- function parseOne(raw, decision) {
13700
- const m = RULE_RE.exec(raw.trim());
13701
- if (!m) return null;
13702
- const [, tool, pathGlob] = m;
13703
- return pathGlob ? { tool, pathGlob, decision } : { tool, decision };
13704
- }
13705
- function parsePermRules(perms, explicit = false) {
13706
- if (!perms) return [];
13707
- const out = [];
13708
- for (const [decision, list] of [["deny", perms.deny], ["allow", perms.allow], ["ask", perms.ask]]) {
13709
- for (const raw of list ?? []) {
13710
- const r = parseOne(raw, decision);
13711
- if (r) out.push(explicit ? { ...r, explicit } : r);
13712
- }
13713
- }
13714
- return out;
13715
- }
13716
- function describeRule(r) {
13717
- return `${r.decision.padEnd(5)} ${r.tool ?? "*"}${r.pathGlob ? `(${r.pathGlob})` : ""}`;
13718
- }
13719
- var PERM_FILE = (cwd) => join10(cwd, ".agent", "permissions.json");
13720
- function loadPersistedRules(cwd) {
13721
- const j = readJsonFile(PERM_FILE(cwd), null);
13722
- return j ? { allow: j.allow ?? [], ask: j.ask ?? [], deny: j.deny ?? [] } : {};
13723
- }
13724
- function loadClaudeSettings(cwd, home = homedir7()) {
13725
- const files = [join10(home, ".claude", "settings.json"), join10(cwd, ".claude", "settings.json"), join10(cwd, ".claude", "settings.local.json")];
13726
- let out = {};
13727
- for (const p of files) {
13728
- const perms = readJsonFile(p, null)?.permissions;
13729
- if (perms) out = mergePerms(out, { allow: perms.allow, ask: perms.ask, deny: perms.deny }) ?? out;
13730
- }
13731
- return out;
13732
- }
13733
- function persistRule(cwd, decision, ruleStr) {
13734
- const cur = loadPersistedRules(cwd);
13735
- const list = cur[decision] ??= [];
13736
- if (!list.includes(ruleStr)) list.push(ruleStr);
13737
- try {
13738
- mkdirSync9(join10(cwd, ".agent"), { recursive: true });
13739
- writeFileSync6(PERM_FILE(cwd), JSON.stringify(cur, null, 2) + "\n");
13740
- } catch {
13741
- }
13742
- }
13743
- function mergePerms(a, b) {
13744
- if (!a && !b) return void 0;
13745
- const out = {};
13746
- for (const k of ["allow", "ask", "deny"]) {
13747
- const merged = [...a?.[k] ?? [], ...b?.[k] ?? []];
13748
- if (merged.length) out[k] = [...new Set(merged)];
13749
- }
13750
- return Object.keys(out).length ? out : void 0;
13751
- }
13752
- var TRUST_FILE = join10(homedir7(), ".agent", "trusted.json");
13753
- function isTrusted(cwd, file = TRUST_FILE) {
13754
- const list = readJsonFile(file, []);
13755
- return Array.isArray(list) && list.includes(cwd);
13756
- }
13757
- function trustDir(cwd, file = TRUST_FILE) {
13758
- let list = readJsonFile(file, []);
13759
- if (!Array.isArray(list)) list = [];
13760
- if (!list.includes(cwd)) list.push(cwd);
13761
- try {
13762
- mkdirSync9(join10(file, ".."), { recursive: true });
13763
- writeFileSync6(file, JSON.stringify(list, null, 2) + "\n");
13764
- } catch {
13765
- }
13766
- }
13767
-
13768
13780
  // cli/complete.ts
13769
13781
  function lastToken(line) {
13770
13782
  const m = line.match(/(\S*)$/);
@@ -15973,6 +15985,7 @@ function parseArgs(argv) {
15973
15985
  else if (x === "--append-system-prompt") a.appendSystemPrompt = val(++i, x);
15974
15986
  else if (x === "--voice-system-prompt") a.voiceSystemPrompt = val(++i, x);
15975
15987
  else if (x === "--add-dir") (a.addDirs ??= []).push(val(++i, x));
15988
+ else if (x === "--mcp-config") a.mcpConfig = val(++i, x);
15976
15989
  else if (x === "--reasoning") a.reasoning = parseReasoning(val(++i, x));
15977
15990
  else if (x === "--session-id") a.sessionId = val(++i, x);
15978
15991
  else if (x === "--fork-session") a.fork = true;
@@ -16054,6 +16067,7 @@ Flags:
16054
16067
  --no-think with --duplex: disable the Think tier (Act handles everything)
16055
16068
  --voice-system-prompt <text> with --duplex: appended to the voice (reflex) prompt only (--append-system-prompt \u2192 workers)
16056
16069
  --add-dir <path> mount another directory into the workspace (repeatable; disk mode only)
16070
+ --mcp-config <file> JSON { mcpServers?, permissions? } merged over .agent config for this run only
16057
16071
  --subagents allow the Task tool (spawn child agents)
16058
16072
  --reasoning <e> extended thinking: off|low|medium|high or a token budget (anthropic/openai)
16059
16073
  --session-id <id> use this id for the session (instead of an auto-generated one)
@@ -19610,7 +19624,7 @@ async function main() {
19610
19624
  };
19611
19625
  }
19612
19626
  const cwd = resolve4(args.cwd ?? process.cwd());
19613
- const cfg = await loadConfig(cwd);
19627
+ const cfg = await loadConfig(cwd, args.mcpConfig && resolve4(args.mcpConfig));
19614
19628
  if (!args.autoRoute && !args.model && (cfg.model === "auto" || !cfg.model && await jevAvailable())) {
19615
19629
  args.autoRoute = true;
19616
19630
  args.model = autoModels().standard;