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