acpx 0.17.1 → 0.18.0
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/{agent-registry-evUoJINz.js → agent-registry-DdKB-zia.js} +16 -17
- package/dist/{agent-registry-evUoJINz.js.map → agent-registry-DdKB-zia.js.map} +1 -1
- package/dist/agent-registry.d.ts.map +1 -1
- package/dist/agent-registry.js +1 -1
- package/dist/{cli-B2ycKzaO.js → cli-8mVHeUXh.js} +5 -5
- package/dist/{cli-B2ycKzaO.js.map → cli-8mVHeUXh.js.map} +1 -1
- package/dist/cli.js +122 -94
- package/dist/cli.js.map +1 -1
- package/dist/{client-CkbBoSGd.d.ts → client-DeNKZZcu.d.ts} +14 -12
- package/dist/client-DeNKZZcu.d.ts.map +1 -0
- package/dist/{flows-xGyhmoHO.js → flows-WOQNzCMC.js} +5 -5
- package/dist/{flows-xGyhmoHO.js.map → flows-WOQNzCMC.js.map} +1 -1
- package/dist/flows.d.ts +1 -1
- package/dist/flows.js +1 -1
- package/dist/{invocation-options-eZEBh4vd.js → invocation-options-B6d7TI-y.js} +7 -6
- package/dist/{invocation-options-eZEBh4vd.js.map → invocation-options-B6d7TI-y.js.map} +1 -1
- package/dist/{ipc-D2rstexT.js → ipc-BJrvfNXr.js} +305 -88
- package/dist/ipc-BJrvfNXr.js.map +1 -0
- package/dist/{output-D2xL6wdp.js → output-CL18YmsG.js} +9 -6
- package/dist/output-CL18YmsG.js.map +1 -0
- package/dist/{queue-owner-runtime-Dgv3e2Tp.js → queue-owner-runtime-Cr0dWJuL.js} +952 -433
- package/dist/queue-owner-runtime-Cr0dWJuL.js.map +1 -0
- package/dist/runtime.d.ts +39 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +272 -154
- package/dist/runtime.js.map +1 -1
- package/dist/{session-watch-CTe9Bnbc.js → session-watch-B8Q_TsGf.js} +4 -4
- package/dist/{session-watch-CTe9Bnbc.js.map → session-watch-B8Q_TsGf.js.map} +1 -1
- package/dist/{watch-DxuXEc8n.js → watch-Dp73ph8h.js} +2 -2
- package/dist/{watch-DxuXEc8n.js.map → watch-Dp73ph8h.js.map} +1 -1
- package/package.json +1 -1
- package/skills/acpx/SKILL.md +26 -7
- package/dist/client-CkbBoSGd.d.ts.map +0 -1
- package/dist/ipc-D2rstexT.js.map +0 -1
- package/dist/output-D2xL6wdp.js.map +0 -1
- package/dist/queue-owner-runtime-Dgv3e2Tp.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as getTextErrorRemediationHints, o as __exportAll, t as createOutputFormatter } from "./output-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { O as renderArgvIdentity, i as DEFAULT_AGENT_NAME, l as normalizeAgentName$1, s as listBuiltInAgents } from "./agent-registry-
|
|
6
|
-
import { C as resolvePermissionMode, S as resolveOutputPolicy, T as toTimerMilliseconds, _ as parseSessionName, a as addGlobalFlags, b as resolveAgentInvocation, c as addSessionOption, d as parseDaysOlderThan, f as parseHistoryLimit, g as parsePruneBeforeDate, h as parseOutputFormat$1, i as addExecConfigOption, m as parseNonEmptyValue, n as sessionConnectionOptions, o as addPromptInputOption, p as parseMaxTurns, r as sessionOptionsFromGlobalFlags, s as addSessionNameOption, t as resolvePermissionPolicyFromFlags, u as parseAllowedTools, v as parseTimeoutSeconds, w as resolveSessionNameFromFlags, x as resolveGlobalFlags, y as parseTtlSeconds } from "./invocation-options-
|
|
2
|
+
import { n as getTextErrorRemediationHints, o as __exportAll, t as createOutputFormatter } from "./output-CL18YmsG.js";
|
|
3
|
+
import { At as AcpxOperationalError, B as serializeSessionRecordForDisk, D as findGitRepositoryRoot, Et as OUTPUT_FORMATS, H as normalizeAgentSessionId, L as writeSessionRecord, Mt as AgentSpawnError, N as normalizeName, O as findSession, S as parsePromptSource, St as EXIT_CODES, dt as sessionEventActivePath, ft as sessionEventLockPath, gt as isProcessAlive, j as listSessions, k as findSessionByDirectoryWalk, lt as defaultSessionEventLog, mt as writePrivateFile, u as probeQueueOwnerHealth, w as textPrompt, x as mergePromptSourceWithText, y as PromptInputValidationError, z as parseSessionRecord } from "./ipc-BJrvfNXr.js";
|
|
4
|
+
import { $ as getAcpxVersion, at as InterruptedError, d as flushPerfMetricsCapture, dt as normalizeOutputError, f as installPerfMetricsCapture, i as runOnce, it as isLegacyZedCodexAcpInvocation, n as runSessionQueueOwner, ot as TimeoutError, rt as listSessionEvents, s as DISCARD_OUTPUT_FORMATTER, u as buildQueueOwnerArgOverride, ut as exitCodeForOutputErrorCode } from "./queue-owner-runtime-Cr0dWJuL.js";
|
|
5
|
+
import { O as renderArgvIdentity, i as DEFAULT_AGENT_NAME, l as normalizeAgentName$1, s as listBuiltInAgents } from "./agent-registry-DdKB-zia.js";
|
|
6
|
+
import { C as resolvePermissionMode, S as resolveOutputPolicy, T as toTimerMilliseconds, _ as parseSessionName, a as addGlobalFlags, b as resolveAgentInvocation, c as addSessionOption, d as parseDaysOlderThan, f as parseHistoryLimit, g as parsePruneBeforeDate, h as parseOutputFormat$1, i as addExecConfigOption, m as parseNonEmptyValue, n as sessionConnectionOptions, o as addPromptInputOption, p as parseMaxTurns, r as sessionOptionsFromGlobalFlags, s as addSessionNameOption, t as resolvePermissionPolicyFromFlags, u as parseAllowedTools, v as parseTimeoutSeconds, w as resolveSessionNameFromFlags, x as resolveGlobalFlags, y as parseTtlSeconds } from "./invocation-options-B6d7TI-y.js";
|
|
7
7
|
import { realpathSync } from "node:fs";
|
|
8
8
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
9
9
|
import path from "node:path";
|
|
@@ -402,11 +402,11 @@ let sessionModulePromise;
|
|
|
402
402
|
let outputModulePromise;
|
|
403
403
|
let outputRenderModulePromise;
|
|
404
404
|
function loadSessionModule() {
|
|
405
|
-
sessionModulePromise ??= import("./output-
|
|
405
|
+
sessionModulePromise ??= import("./output-CL18YmsG.js").then((n) => n.a);
|
|
406
406
|
return sessionModulePromise;
|
|
407
407
|
}
|
|
408
408
|
function loadOutputModule() {
|
|
409
|
-
outputModulePromise ??= import("./output-
|
|
409
|
+
outputModulePromise ??= import("./output-CL18YmsG.js").then((n) => n.r);
|
|
410
410
|
return outputModulePromise;
|
|
411
411
|
}
|
|
412
412
|
function loadOutputRenderModule() {
|
|
@@ -891,7 +891,7 @@ async function handleSessionsWatch(explicitAgentName, flags, command, config) {
|
|
|
891
891
|
includeClosed: true
|
|
892
892
|
});
|
|
893
893
|
if (!record) throw new Error(missingScopedSessionMessage(agent, flags.name));
|
|
894
|
-
const { runSessionWatch } = await import("./session-watch-
|
|
894
|
+
const { runSessionWatch } = await import("./session-watch-B8Q_TsGf.js");
|
|
895
895
|
await runSessionWatch(record, {
|
|
896
896
|
cursor: flags.cursor,
|
|
897
897
|
policy: resolveRequestedOutputPolicy(globalFlags)
|
|
@@ -951,6 +951,26 @@ async function handleSessionsPrune(explicitAgentName, flags, command, config) {
|
|
|
951
951
|
}), globalFlags.format);
|
|
952
952
|
}
|
|
953
953
|
//#endregion
|
|
954
|
+
//#region src/cli/compare-args.ts
|
|
955
|
+
function addCompareOptions(command) {
|
|
956
|
+
return command.option("--cwd <dir>", "Target workspace").option("--approve-all", "Auto-approve all permission requests").option("--approve-reads", "Auto-approve read/search requests and prompt for writes").option("--deny-all", "Deny all permission requests").option("--timeout <seconds>", "Per-agent timeout in seconds", parseTimeoutSeconds).option("--format <fmt>", "Output format: text, json, quiet", parseOutputFormat$1).option("--json", "Alias for --format json").option("-f, --file <path>", "Read prompt text from file path (use - for stdin)", (value) => parseNonEmptyValue("Prompt file", value)).option("--prompt-file <path>", "Alias for --file", (value) => parseNonEmptyValue("Prompt file", value));
|
|
957
|
+
}
|
|
958
|
+
const VALUE_FLAGS = new Set(addCompareOptions(new Command()).options.filter((option) => option.required).flatMap((option) => [option.long, option.short].filter((flag) => flag !== void 0)));
|
|
959
|
+
function scanCompareArgs(argv) {
|
|
960
|
+
let cwd;
|
|
961
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
962
|
+
const token = argv[index];
|
|
963
|
+
if (token === "--") return {
|
|
964
|
+
cwd,
|
|
965
|
+
promptTokens: argv.slice(index + 1)
|
|
966
|
+
};
|
|
967
|
+
if (token === "--cwd") cwd = argv[index + 1];
|
|
968
|
+
else if (token.startsWith("--cwd=")) cwd = token.slice(6);
|
|
969
|
+
if (VALUE_FLAGS.has(token)) index += 1;
|
|
970
|
+
}
|
|
971
|
+
return { cwd };
|
|
972
|
+
}
|
|
973
|
+
//#endregion
|
|
954
974
|
//#region src/cli/compare-command.ts
|
|
955
975
|
const DEFAULT_COMPARE_TIMEOUT_MS = 3e5;
|
|
956
976
|
const FINAL_MESSAGE_PREVIEW_CHARS = 200;
|
|
@@ -972,14 +992,15 @@ function truncate(value, maxChars) {
|
|
|
972
992
|
if (value.length <= maxChars) return value;
|
|
973
993
|
return `${value.slice(0, Math.max(0, maxChars - 3))}...`;
|
|
974
994
|
}
|
|
975
|
-
function
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
995
|
+
function splitCompareArgs(args, filePath, promptTokens) {
|
|
996
|
+
if (promptTokens !== void 0) {
|
|
997
|
+
const agents = args.slice(0, args.length - promptTokens.length);
|
|
998
|
+
if (agents.length === 0) throw new InvalidArgumentError("At least one agent is required");
|
|
999
|
+
return {
|
|
1000
|
+
agents,
|
|
1001
|
+
promptText: promptTokens.join(" ")
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
983
1004
|
if (filePath) {
|
|
984
1005
|
if (args.length === 0) throw new InvalidArgumentError("At least one agent is required");
|
|
985
1006
|
return {
|
|
@@ -987,15 +1008,6 @@ function splitCompareArgs(args, filePath, command) {
|
|
|
987
1008
|
promptText: ""
|
|
988
1009
|
};
|
|
989
1010
|
}
|
|
990
|
-
const promptTokens = promptTokensAfterDoubleDash(command);
|
|
991
|
-
if (promptTokens.length > 0) {
|
|
992
|
-
const agents = args.slice(0, -promptTokens.length);
|
|
993
|
-
if (agents.length === 0) throw new InvalidArgumentError("At least one agent is required");
|
|
994
|
-
return {
|
|
995
|
-
agents,
|
|
996
|
-
promptText: promptTokens.join(" ")
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
1011
|
if (args.length < 2) throw new InvalidArgumentError("Usage: acpx compare <agent>... '<prompt>'");
|
|
1000
1012
|
return {
|
|
1001
1013
|
agents: args.slice(0, -1),
|
|
@@ -1149,22 +1161,53 @@ function updateCompareExitCode(rows) {
|
|
|
1149
1161
|
}
|
|
1150
1162
|
if (rows.some((row) => row.status === "cancelled")) process.exitCode = EXIT_CODES.TIMEOUT;
|
|
1151
1163
|
}
|
|
1164
|
+
async function runCompareAgents(agents, run) {
|
|
1165
|
+
const rows = [];
|
|
1166
|
+
let interrupted = false;
|
|
1167
|
+
const onInterrupt = () => {
|
|
1168
|
+
interrupted = true;
|
|
1169
|
+
};
|
|
1170
|
+
const signals = [
|
|
1171
|
+
"SIGINT",
|
|
1172
|
+
"SIGTERM",
|
|
1173
|
+
"SIGHUP"
|
|
1174
|
+
];
|
|
1175
|
+
for (const signal of signals) process.once(signal, onInterrupt);
|
|
1176
|
+
try {
|
|
1177
|
+
for (const agentName of agents) {
|
|
1178
|
+
if (interrupted) break;
|
|
1179
|
+
const row = await run(agentName);
|
|
1180
|
+
rows.push(interrupted ? {
|
|
1181
|
+
...row,
|
|
1182
|
+
status: "cancelled",
|
|
1183
|
+
error: "Interrupted"
|
|
1184
|
+
} : row);
|
|
1185
|
+
}
|
|
1186
|
+
} finally {
|
|
1187
|
+
for (const signal of signals) process.off(signal, onInterrupt);
|
|
1188
|
+
}
|
|
1189
|
+
return {
|
|
1190
|
+
rows,
|
|
1191
|
+
interrupted
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1152
1194
|
function resolvePromptFile(flags) {
|
|
1153
1195
|
if (flags.file && flags.promptFile && flags.file !== flags.promptFile) throw new InvalidArgumentError("Use only one prompt file flag: --file or --prompt-file");
|
|
1154
1196
|
return flags.file ?? flags.promptFile;
|
|
1155
1197
|
}
|
|
1156
1198
|
function registerCompareCommand(program, config) {
|
|
1157
|
-
program.command("compare").description("Run one prompt across multiple agents and summarize the results").argument("<args...>", "Agents followed by prompt text, or agents with --file")
|
|
1199
|
+
addCompareOptions(program.command("compare").description("Run one prompt across multiple agents and summarize the results").argument("<args...>", "Agents followed by prompt text, or agents with --file")).action(async function(args, flags) {
|
|
1158
1200
|
if (config.disableExec) throw new Error("compare subcommand is disabled by configuration (disableExec: true)");
|
|
1159
1201
|
const globalFlags = resolveGlobalFlags(this, config);
|
|
1202
|
+
if (flags.cwd !== void 0) globalFlags.cwd = path.resolve(flags.cwd);
|
|
1160
1203
|
if (globalFlags.agent) throw new InvalidArgumentError("Do not combine compare with --agent; pass agent names");
|
|
1161
1204
|
const outputPolicy = resolveOutputPolicy(flags.json === true ? "json" : globalFlags.format, globalFlags.jsonStrict === true);
|
|
1162
1205
|
const promptFile = resolvePromptFile(flags);
|
|
1163
|
-
const {
|
|
1206
|
+
const { promptTokens } = scanCompareArgs(program.args.slice(1));
|
|
1207
|
+
const { agents, promptText } = splitCompareArgs(args, promptFile, promptTokens);
|
|
1164
1208
|
const prompt = await readPromptInput(promptFile, promptText, globalFlags.cwd, "final argument");
|
|
1165
1209
|
const permissionPolicy = await resolvePermissionPolicyFromFlags(globalFlags);
|
|
1166
|
-
const rows =
|
|
1167
|
-
for (const agentName of agents) rows.push(await runAgentForCompare({
|
|
1210
|
+
const { rows, interrupted } = await runCompareAgents(agents, async (agentName) => await runAgentForCompare({
|
|
1168
1211
|
agentName,
|
|
1169
1212
|
prompt,
|
|
1170
1213
|
config,
|
|
@@ -1172,7 +1215,8 @@ function registerCompareCommand(program, config) {
|
|
|
1172
1215
|
permissionPolicy
|
|
1173
1216
|
}));
|
|
1174
1217
|
printRows(rows, outputPolicy.format);
|
|
1175
|
-
|
|
1218
|
+
if (interrupted) process.exitCode = EXIT_CODES.INTERRUPTED;
|
|
1219
|
+
else updateCompareExitCode(rows);
|
|
1176
1220
|
});
|
|
1177
1221
|
}
|
|
1178
1222
|
//#endregion
|
|
@@ -1336,9 +1380,7 @@ function parseDefaultAgent(value, sourcePath) {
|
|
|
1336
1380
|
function parseAgents(value, sourcePath) {
|
|
1337
1381
|
if (value == null) return;
|
|
1338
1382
|
if (!isObject(value)) throw new Error(`Invalid config agents in ${sourcePath}: expected object`);
|
|
1339
|
-
|
|
1340
|
-
for (const [name, raw] of Object.entries(value)) parsed[normalizeAgentName$1(name)] = parseAgentEntry(raw, name, sourcePath);
|
|
1341
|
-
return parsed;
|
|
1383
|
+
return Object.fromEntries(Object.entries(value).map(([name, raw]) => [normalizeAgentName$1(name), parseAgentEntry(raw, name, sourcePath)]));
|
|
1342
1384
|
}
|
|
1343
1385
|
function parseAgentEntry(raw, name, sourcePath) {
|
|
1344
1386
|
if (!isObject(raw)) throw new Error(`Invalid config agents.${name} in ${sourcePath}: expected object with command`);
|
|
@@ -1490,8 +1532,7 @@ function resolveMcpServers(projectConfig, projectPath, globalConfig, globalPath,
|
|
|
1490
1532
|
return [];
|
|
1491
1533
|
}
|
|
1492
1534
|
function toConfigDisplay(config) {
|
|
1493
|
-
const agents = {};
|
|
1494
|
-
for (const [name, agent] of Object.entries(config.agents)) agents[name] = agent.argv ? { argv: [...agent.argv] } : { command: agent.command };
|
|
1535
|
+
const agents = Object.fromEntries(Object.entries(config.agents).map(([name, agent]) => [name, agent.argv ? { argv: [...agent.argv] } : { command: agent.command }]));
|
|
1495
1536
|
return {
|
|
1496
1537
|
defaultAgent: config.defaultAgent,
|
|
1497
1538
|
defaultPermissions: config.defaultPermissions,
|
|
@@ -2074,7 +2115,7 @@ function registerAgentCommand(program, agentName, config) {
|
|
|
2074
2115
|
}
|
|
2075
2116
|
function registerFlowCommand(program, config) {
|
|
2076
2117
|
program.command("flow").description("Run multi-step ACP workflows from flow files").command("run").description("Run a flow file").argument("<file>", "Flow module path").option("--input-json <json>", "Flow input as JSON").option("--input-file <path>", "Read flow input JSON from file").option("--default-agent <name>", "Default agent profile for ACP nodes without profile", (value) => parseNonEmptyValue("Default agent", value)).action(async function(file, flags) {
|
|
2077
|
-
const { handleFlowRun } = await import("./cli-
|
|
2118
|
+
const { handleFlowRun } = await import("./cli-8mVHeUXh.js");
|
|
2078
2119
|
await handleFlowRun(file, flags, this, config);
|
|
2079
2120
|
});
|
|
2080
2121
|
}
|
|
@@ -2280,54 +2321,38 @@ function detectAgentToken(argv) {
|
|
|
2280
2321
|
for (let index = 0; index < argv.length; index += 1) {
|
|
2281
2322
|
const token = argv[index];
|
|
2282
2323
|
const step = scanAgentTokenStep(token, hasAgentOverride);
|
|
2283
|
-
if (step.result) return
|
|
2324
|
+
if (step.result) return {
|
|
2325
|
+
...step.result,
|
|
2326
|
+
index
|
|
2327
|
+
};
|
|
2284
2328
|
if (step.hasAgentOverride) hasAgentOverride = true;
|
|
2285
2329
|
index += step.indexDelta;
|
|
2286
2330
|
}
|
|
2287
2331
|
return { hasAgentOverride };
|
|
2288
2332
|
}
|
|
2289
|
-
function
|
|
2333
|
+
function lastTopLevelFlagValue(argv, flag) {
|
|
2334
|
+
let value;
|
|
2290
2335
|
for (let index = 0; index < argv.length; index += 1) {
|
|
2291
2336
|
const token = argv[index];
|
|
2292
2337
|
const scan = classifyTopLevelFlagScan(token);
|
|
2293
2338
|
if (scan.stop) break;
|
|
2294
|
-
|
|
2295
|
-
if (
|
|
2296
|
-
if (isCwdFlagToken(token)) break;
|
|
2339
|
+
if (token === flag) value = argv[index + 1];
|
|
2340
|
+
else if (token.startsWith(`${flag}=`)) value = token.slice(flag.length + 1);
|
|
2297
2341
|
if (scan.skipNext) index += 1;
|
|
2298
2342
|
}
|
|
2299
|
-
return
|
|
2343
|
+
return value;
|
|
2300
2344
|
}
|
|
2301
|
-
function
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
if (
|
|
2345
|
+
function detectInitialCwd(argv) {
|
|
2346
|
+
const command = detectAgentToken(argv);
|
|
2347
|
+
if (command.token === "compare" && command.index !== void 0) {
|
|
2348
|
+
const { cwd } = scanCompareArgs(argv.slice(command.index + 1));
|
|
2349
|
+
if (cwd !== void 0) return path.resolve(cwd);
|
|
2306
2350
|
}
|
|
2351
|
+
return path.resolve(lastTopLevelFlagValue(argv, "--cwd") ?? process.cwd());
|
|
2307
2352
|
}
|
|
2308
|
-
function
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
path: resolveMcpConfigPath(nextToken, cwd),
|
|
2312
|
-
stop: true
|
|
2313
|
-
};
|
|
2314
|
-
if (token.startsWith("--mcp-config=")) return {
|
|
2315
|
-
path: resolveMcpConfigPath(token.slice(13), cwd),
|
|
2316
|
-
stop: true
|
|
2317
|
-
};
|
|
2318
|
-
return { skipNext: TOP_LEVEL_VERSION_VALUE_FLAGS.has(token) };
|
|
2319
|
-
}
|
|
2320
|
-
function resolveMcpConfigPath(value, cwd) {
|
|
2321
|
-
const trimmed = value?.trim();
|
|
2322
|
-
return trimmed && trimmed !== "--" ? path.resolve(cwd, trimmed) : void 0;
|
|
2323
|
-
}
|
|
2324
|
-
function isCwdFlagToken(token) {
|
|
2325
|
-
return token === "--cwd" || token.startsWith("--cwd=");
|
|
2326
|
-
}
|
|
2327
|
-
function readCwdFlagValue(token, nextToken) {
|
|
2328
|
-
const value = (token === "--cwd" ? nextToken : readInlineFlagValue(token, "--cwd"))?.trim();
|
|
2329
|
-
if (!value || value === "--") return;
|
|
2330
|
-
return value;
|
|
2353
|
+
function detectMcpConfigPath(argv, cwd) {
|
|
2354
|
+
const value = lastTopLevelFlagValue(argv, "--mcp-config");
|
|
2355
|
+
return value ? path.resolve(cwd, value) : void 0;
|
|
2331
2356
|
}
|
|
2332
2357
|
function detectRequestedOutputFormat(argv, fallback) {
|
|
2333
2358
|
let detectedFormat = fallback;
|
|
@@ -2487,34 +2512,37 @@ async function main(argv = process.argv) {
|
|
|
2487
2512
|
return;
|
|
2488
2513
|
}
|
|
2489
2514
|
await maybeHandleSkillflag(normalizedArgv);
|
|
2490
|
-
const initialCwd = detectInitialCwd(rawArgs);
|
|
2491
|
-
const config = await loadResolvedConfig(initialCwd, { mcpConfigPath: detectMcpConfigPath(rawArgs, initialCwd) });
|
|
2492
2515
|
const requestedJsonStrict = detectJsonStrict(rawArgs);
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
...resolveOutputPolicy(requestedOutputFormat, requestedJsonStrict),
|
|
2516
|
+
let requestedOutputPolicy = {
|
|
2517
|
+
...resolveOutputPolicy(detectRequestedOutputFormat(rawArgs, "text"), requestedJsonStrict),
|
|
2496
2518
|
suppressReads: rawArgs.some((token) => token === "--suppress-reads")
|
|
2497
2519
|
};
|
|
2498
|
-
const program = createProgram(requestedJsonStrict);
|
|
2499
|
-
addGlobalFlags(program);
|
|
2500
|
-
configurePublicCli({
|
|
2501
|
-
program,
|
|
2502
|
-
argv: rawArgs,
|
|
2503
|
-
config,
|
|
2504
|
-
requestedJsonStrict,
|
|
2505
|
-
topLevelVerbs: TOP_LEVEL_VERBS,
|
|
2506
|
-
listBuiltInAgents,
|
|
2507
|
-
detectAgentToken,
|
|
2508
|
-
registerAgentCommand,
|
|
2509
|
-
registerDefaultCommands,
|
|
2510
|
-
handlePromptAction: async (command, promptParts) => {
|
|
2511
|
-
await handlePrompt(void 0, promptParts, {}, command, config);
|
|
2512
|
-
}
|
|
2513
|
-
});
|
|
2514
|
-
program.exitOverride((error) => {
|
|
2515
|
-
throw error;
|
|
2516
|
-
});
|
|
2517
2520
|
try {
|
|
2521
|
+
const initialCwd = detectInitialCwd(rawArgs);
|
|
2522
|
+
const config = await loadResolvedConfig(initialCwd, { mcpConfigPath: detectMcpConfigPath(rawArgs, initialCwd) });
|
|
2523
|
+
requestedOutputPolicy = {
|
|
2524
|
+
...resolveOutputPolicy(detectRequestedOutputFormat(rawArgs, config.format), requestedJsonStrict),
|
|
2525
|
+
suppressReads: requestedOutputPolicy.suppressReads
|
|
2526
|
+
};
|
|
2527
|
+
const program = createProgram(requestedJsonStrict);
|
|
2528
|
+
addGlobalFlags(program);
|
|
2529
|
+
configurePublicCli({
|
|
2530
|
+
program,
|
|
2531
|
+
argv: rawArgs,
|
|
2532
|
+
config,
|
|
2533
|
+
requestedJsonStrict,
|
|
2534
|
+
topLevelVerbs: TOP_LEVEL_VERBS,
|
|
2535
|
+
listBuiltInAgents,
|
|
2536
|
+
detectAgentToken,
|
|
2537
|
+
registerAgentCommand,
|
|
2538
|
+
registerDefaultCommands,
|
|
2539
|
+
handlePromptAction: async (command, promptParts) => {
|
|
2540
|
+
await handlePrompt(void 0, promptParts, {}, command, config);
|
|
2541
|
+
}
|
|
2542
|
+
});
|
|
2543
|
+
program.exitOverride((error) => {
|
|
2544
|
+
throw error;
|
|
2545
|
+
});
|
|
2518
2546
|
await program.parseAsync(normalizedArgv);
|
|
2519
2547
|
} catch (error) {
|
|
2520
2548
|
await handleProgramParseError(error, requestedOutputPolicy);
|