acpx 0.1.16 → 0.3.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/README.md +6 -4
- package/dist/{acp-jsonrpc-CGT_1Mel.js → acp-jsonrpc-BNHXq7qK.js} +2 -2
- package/dist/{acp-jsonrpc-CGT_1Mel.js.map → acp-jsonrpc-BNHXq7qK.js.map} +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +45 -37
- package/dist/cli.js.map +1 -1
- package/dist/{output-BgMdEq3x.js → output-BmkPP7qE.js} +3 -6
- package/dist/{output-BgMdEq3x.js.map → output-BmkPP7qE.js.map} +1 -1
- package/dist/{output-render-C_rsjEYP.js → output-render-DEAaMxg8.js} +5 -6
- package/dist/{output-render-C_rsjEYP.js.map → output-render-DEAaMxg8.js.map} +1 -1
- package/dist/{queue-ipc-CEetz4_7.js → queue-ipc-EQLpBMKv.js} +355 -268
- package/dist/queue-ipc-EQLpBMKv.js.map +1 -0
- package/dist/rolldown-runtime-CiIaOW0V.js +13 -0
- package/dist/{runtime-session-id-B03l5p1Q.js → runtime-session-id-C544sPPL.js} +2 -3
- package/dist/{runtime-session-id-B03l5p1Q.js.map → runtime-session-id-C544sPPL.js.map} +1 -1
- package/dist/{session-BARXiu6-.js → session-C2Q8ktsN.js} +258 -93
- package/dist/session-C2Q8ktsN.js.map +1 -0
- package/package.json +4 -6
- package/skills/acpx/SKILL.md +7 -4
- package/dist/queue-ipc-CEetz4_7.js.map +0 -1
- package/dist/rolldown-runtime-CjeV3_4I.js +0 -18
- package/dist/session-BARXiu6-.js.map +0 -1
package/README.md
CHANGED
|
@@ -139,7 +139,7 @@ acpx codex --file - "extra context" # explicit stdin + appended args
|
|
|
139
139
|
acpx codex --no-wait 'draft test migration plan' # enqueue without waiting if session is busy
|
|
140
140
|
acpx codex cancel # cooperative cancel of in-flight prompt
|
|
141
141
|
acpx codex set-mode auto # session/set_mode (adapter-defined mode id)
|
|
142
|
-
acpx codex set
|
|
142
|
+
acpx codex set thought_level high # codex compatibility alias -> reasoning_effort
|
|
143
143
|
acpx exec 'summarize this repo' # default agent shortcut (codex)
|
|
144
144
|
acpx codex exec 'what does this repo do?' # one-shot, no saved session
|
|
145
145
|
|
|
@@ -285,13 +285,15 @@ Built-ins:
|
|
|
285
285
|
| `openclaw` | native (`openclaw acp`) | [OpenClaw ACP bridge](https://github.com/openclaw/openclaw) |
|
|
286
286
|
| `codex` | [codex-acp](https://github.com/zed-industries/codex-acp) | [Codex CLI](https://codex.openai.com) |
|
|
287
287
|
| `claude` | [claude-agent-acp](https://github.com/zed-industries/claude-agent-acp) | [Claude Code](https://claude.ai/code) |
|
|
288
|
-
| `gemini` | native (`gemini --
|
|
288
|
+
| `gemini` | native (`gemini --acp`) | [Gemini CLI](https://github.com/google/gemini-cli) |
|
|
289
289
|
| `cursor` | native (`cursor-agent acp`) | [Cursor CLI](https://cursor.com/docs/cli/acp) |
|
|
290
290
|
| `copilot` | native (`copilot --acp --stdio`) | [GitHub Copilot CLI](https://docs.github.com/copilot/how-tos/copilot-chat/use-copilot-chat-in-the-command-line) |
|
|
291
|
+
| `droid` | native (`droid exec --output-format acp`) | [Factory Droid](https://www.factory.ai) |
|
|
292
|
+
| `iflow` | native (`iflow --experimental-acp`) | [iFlow CLI](https://github.com/iflow-ai/iflow-cli) |
|
|
293
|
+
| `kilocode` | `npx -y @kilocode/cli acp` | [Kilocode](https://kilocode.ai) |
|
|
291
294
|
| `kimi` | native (`kimi acp`) | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) |
|
|
292
|
-
| `opencode` | `npx -y opencode-ai acp` | [OpenCode](https://opencode.ai) |
|
|
293
295
|
| `kiro` | native (`kiro-cli acp`) | [Kiro CLI](https://kiro.dev) |
|
|
294
|
-
| `
|
|
296
|
+
| `opencode` | `npx -y opencode-ai acp` | [OpenCode](https://opencode.ai) |
|
|
295
297
|
| `qwen` | native (`qwen --acp`) | [Qwen Code](https://github.com/QwenLM/qwen-code) |
|
|
296
298
|
|
|
297
299
|
Additional built-in agent docs live in [agents/README.md](agents/README.md).
|
|
@@ -49,7 +49,7 @@ function parseJsonRpcErrorMessage(message) {
|
|
|
49
49
|
if (!errorRecord || typeof errorRecord.message !== "string") return;
|
|
50
50
|
return errorRecord.message;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
52
|
//#endregion
|
|
54
53
|
export { parsePromptStopReason as i, isSessionUpdateNotification as n, parseJsonRpcErrorMessage as r, isAcpJsonRpcMessage as t };
|
|
55
|
-
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=acp-jsonrpc-BNHXq7qK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acp-jsonrpc-
|
|
1
|
+
{"version":3,"file":"acp-jsonrpc-BNHXq7qK.js","names":[],"sources":["../src/acp-jsonrpc.ts"],"sourcesContent":["import type { AnyMessage } from \"@agentclientprotocol/sdk\";\n\ntype JsonRpcId = string | number | null;\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return null;\n }\n return value as Record<string, unknown>;\n}\n\nfunction hasValidId(value: unknown): value is JsonRpcId {\n return (\n value === null ||\n typeof value === \"string\" ||\n (typeof value === \"number\" && Number.isFinite(value))\n );\n}\n\nfunction isErrorObject(value: unknown): value is { code: number; message: string } {\n const record = asRecord(value);\n return (\n !!record &&\n typeof record.code === \"number\" &&\n Number.isFinite(record.code) &&\n typeof record.message === \"string\"\n );\n}\n\nfunction hasResultOrError(value: Record<string, unknown>): boolean {\n const hasResult = Object.hasOwn(value, \"result\");\n const hasError = Object.hasOwn(value, \"error\");\n if (hasResult && hasError) {\n return false;\n }\n if (!hasResult && !hasError) {\n return false;\n }\n if (hasError && !isErrorObject(value.error)) {\n return false;\n }\n return true;\n}\n\nexport function isAcpJsonRpcMessage(value: unknown): value is AnyMessage {\n const record = asRecord(value);\n if (!record || record.jsonrpc !== \"2.0\") {\n return false;\n }\n\n const hasMethod = typeof record.method === \"string\" && record.method.length > 0;\n const hasId = Object.hasOwn(record, \"id\");\n\n if (hasMethod && !hasId) {\n // Notification\n return true;\n }\n\n if (hasMethod && hasId) {\n // Request\n return hasValidId(record.id);\n }\n\n if (!hasMethod && hasId) {\n // Response\n if (!hasValidId(record.id)) {\n return false;\n }\n return hasResultOrError(record);\n }\n\n return false;\n}\n\nexport function isJsonRpcNotification(message: AnyMessage): boolean {\n return (\n Object.hasOwn(message, \"method\") &&\n typeof (message as { method?: unknown }).method === \"string\" &&\n !Object.hasOwn(message, \"id\")\n );\n}\n\nexport function isSessionUpdateNotification(message: AnyMessage): boolean {\n return (\n isJsonRpcNotification(message) && (message as { method?: unknown }).method === \"session/update\"\n );\n}\n\nexport function parsePromptStopReason(message: AnyMessage): string | undefined {\n if (!Object.hasOwn(message, \"id\") || !Object.hasOwn(message, \"result\")) {\n return undefined;\n }\n const record = asRecord((message as { result?: unknown }).result);\n if (!record) {\n return undefined;\n }\n return typeof record.stopReason === \"string\" ? record.stopReason : undefined;\n}\n\nexport function parseJsonRpcErrorMessage(message: AnyMessage): string | undefined {\n if (!Object.hasOwn(message, \"error\")) {\n return undefined;\n }\n const errorRecord = asRecord((message as { error?: unknown }).error);\n if (!errorRecord || typeof errorRecord.message !== \"string\") {\n return undefined;\n }\n return errorRecord.message;\n}\n"],"mappings":";AAIA,SAAS,SAAS,OAAgD;AAChE,KAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,MAAM,CAC7D,QAAO;AAET,QAAO;;AAGT,SAAS,WAAW,OAAoC;AACtD,QACE,UAAU,QACV,OAAO,UAAU,YAChB,OAAO,UAAU,YAAY,OAAO,SAAS,MAAM;;AAIxD,SAAS,cAAc,OAA4D;CACjF,MAAM,SAAS,SAAS,MAAM;AAC9B,QACE,CAAC,CAAC,UACF,OAAO,OAAO,SAAS,YACvB,OAAO,SAAS,OAAO,KAAK,IAC5B,OAAO,OAAO,YAAY;;AAI9B,SAAS,iBAAiB,OAAyC;CACjE,MAAM,YAAY,OAAO,OAAO,OAAO,SAAS;CAChD,MAAM,WAAW,OAAO,OAAO,OAAO,QAAQ;AAC9C,KAAI,aAAa,SACf,QAAO;AAET,KAAI,CAAC,aAAa,CAAC,SACjB,QAAO;AAET,KAAI,YAAY,CAAC,cAAc,MAAM,MAAM,CACzC,QAAO;AAET,QAAO;;AAGT,SAAgB,oBAAoB,OAAqC;CACvE,MAAM,SAAS,SAAS,MAAM;AAC9B,KAAI,CAAC,UAAU,OAAO,YAAY,MAChC,QAAO;CAGT,MAAM,YAAY,OAAO,OAAO,WAAW,YAAY,OAAO,OAAO,SAAS;CAC9E,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK;AAEzC,KAAI,aAAa,CAAC,MAEhB,QAAO;AAGT,KAAI,aAAa,MAEf,QAAO,WAAW,OAAO,GAAG;AAG9B,KAAI,CAAC,aAAa,OAAO;AAEvB,MAAI,CAAC,WAAW,OAAO,GAAG,CACxB,QAAO;AAET,SAAO,iBAAiB,OAAO;;AAGjC,QAAO;;AAGT,SAAgB,sBAAsB,SAA8B;AAClE,QACE,OAAO,OAAO,SAAS,SAAS,IAChC,OAAQ,QAAiC,WAAW,YACpD,CAAC,OAAO,OAAO,SAAS,KAAK;;AAIjC,SAAgB,4BAA4B,SAA8B;AACxE,QACE,sBAAsB,QAAQ,IAAK,QAAiC,WAAW;;AAInF,SAAgB,sBAAsB,SAAyC;AAC7E,KAAI,CAAC,OAAO,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,OAAO,SAAS,SAAS,CACpE;CAEF,MAAM,SAAS,SAAU,QAAiC,OAAO;AACjE,KAAI,CAAC,OACH;AAEF,QAAO,OAAO,OAAO,eAAe,WAAW,OAAO,aAAa,KAAA;;AAGrE,SAAgB,yBAAyB,SAAyC;AAChF,KAAI,CAAC,OAAO,OAAO,SAAS,QAAQ,CAClC;CAEF,MAAM,cAAc,SAAU,QAAgC,MAAM;AACpE,KAAI,CAAC,eAAe,OAAO,YAAY,YAAY,SACjD;AAEF,QAAO,YAAY"}
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","names":[],"sources":["../src/types.ts","../src/cli/flags.ts","../src/cli/output-render.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","names":[],"sources":["../src/types.ts","../src/cli/flags.ts","../src/cli/output-render.ts"],"mappings":";;;;KAyGY,eAAA;EACV,WAAA;EACA,aAAA;EACA,iBAAA;EACA,YAAA;EACA,aAAA;EACA,gBAAA;AAAA;AAAA,cAmEW,qBAAA;AAAA,KACD,mBAAA;EACV,MAAA;EACA,IAAA;IACE,KAAA;IACA,MAAA;EAAA;AAAA;AAAA,KAIQ,kBAAA;EAEN,IAAA;AAAA;EAGA,OAAA;IACE,GAAA;IACA,OAAA;EAAA;AAAA;EAIF,KAAA,EAAO,mBAAA;AAAA;AAAA,KAGD,cAAA;EACV,EAAA;EACA,IAAA;EACA,SAAA;EACA,KAAA;EACA,iBAAA;EACA,iBAAA;AAAA;AAAA,KAGU,wBAAA;EAEN,IAAA;AAAA;EAGA,KAAA,EAAO,mBAAA;AAAA;AAAA,KAGD,iBAAA;EACV,WAAA;EACA,SAAA;EACA,QAAA;EACA,OAAA,EAAS,wBAAA;EACT,MAAA;AAAA;AAAA,KAGU,mBAAA;EAEN,IAAA;AAAA;EAGA,QAAA;IACE,IAAA;IACA,SAAA;EAAA;AAAA;EAIF,gBAAA;AAAA;EAGA,OAAA,EAAS,cAAA;AAAA;AAAA,KAGH,kBAAA;EACV,EAAA;EACA,OAAA,EAAS,kBAAA;AAAA;AAAA,KAGC,mBAAA;EACV,OAAA,EAAS,mBAAA;EACT,YAAA,EAAc,MAAA,SAAe,iBAAA;EAC7B,iBAAA;AAAA;AAAA,KAGU,cAAA;EAEN,IAAA,EAAM,kBAAA;AAAA;EAGN,KAAA,EAAO,mBAAA;AAAA;AAAA,KAID,iBAAA;EACV,YAAA;EACA,aAAA;EACA,2BAAA;EACA,uBAAA;AAAA;AAAA,KAWU,gBAAA;EACV,eAAA;EACA,eAAA;EACA,kBAAA;EACA,cAAA,GAAiB,mBAAA;AAAA;AAAA,KAGP,aAAA;EACV,MAAA,SAAe,qBAAA;EACf,YAAA;EACA,YAAA;EACA,cAAA;EACA,YAAA;EACA,GAAA;EACA,IAAA;EACA,SAAA;EACA,UAAA;EACA,OAAA;EACA,aAAA;EACA,QAAA,EAAU,eAAA;EACV,MAAA;EACA,QAAA;EACA,GAAA;EACA,cAAA;EACA,YAAA;EACA,iBAAA;EACA,mBAAA,GAAsB,MAAA,CAAO,OAAA;EAC7B,eAAA;EACA,yBAAA;EACA,eAAA;EACA,iBAAA,GAAoB,iBAAA;EACpB,KAAA;EACA,QAAA,EAAU,cAAA;EACV,UAAA;EACA,sBAAA,EAAwB,iBAAA;EACxB,mBAAA,EAAqB,MAAA,SAAe,iBAAA;EACpC,IAAA,GAAO,gBAAA;AAAA;;;iBCvNO,eAAA,CAAgB,KAAA;AAAA,iBAgChB,iBAAA,CAAkB,KAAA;AAAA,iBAgBlB,aAAA,CAAc,KAAA;;;KClIzB,uBAAA;AAAA,iBAkJW,6BAAA,CACd,MAAA,EAAQ,aAAA,EACR,UAAA,UACA,gBAAA,GAAkB,uBAAA"}
|
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as
|
|
3
|
-
import { a as findGitRepositoryRoot, c as flushPerfMetricsCapture,
|
|
4
|
-
import { t as formatPromptSessionBannerLine } from "./output-render-
|
|
2
|
+
import { A as OUTPUT_FORMATS, C as exitCodeForOutputErrorCode, D as AUTH_POLICIES, E as normalizeOutputError, I as textPrompt, M as PromptInputValidationError, N as mergePromptSourceWithText, O as EXIT_CODES, P as parsePromptSource, k as NON_INTERACTIVE_PERMISSION_POLICIES } from "./queue-ipc-EQLpBMKv.js";
|
|
3
|
+
import { a as findGitRepositoryRoot, c as flushPerfMetricsCapture, l as installPerfMetricsCapture, o as findSession, r as runSessionQueueOwner, s as findSessionByDirectoryWalk, u as InterruptedError } from "./session-C2Q8ktsN.js";
|
|
4
|
+
import { t as formatPromptSessionBannerLine } from "./output-render-DEAaMxg8.js";
|
|
5
5
|
import { readFileSync, realpathSync } from "node:fs";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
import fs$1 from "node:fs/promises";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { Command, CommanderError, InvalidArgumentError } from "commander";
|
|
10
10
|
import os from "node:os";
|
|
11
|
-
|
|
12
11
|
//#region src/agent-registry.ts
|
|
13
12
|
const ACP_ADAPTER_PACKAGE_RANGES = {
|
|
14
13
|
pi: "^0.0.22",
|
|
@@ -20,13 +19,15 @@ const AGENT_REGISTRY = {
|
|
|
20
19
|
openclaw: "openclaw acp",
|
|
21
20
|
codex: `npx @zed-industries/codex-acp@${ACP_ADAPTER_PACKAGE_RANGES.codex}`,
|
|
22
21
|
claude: `npx -y @zed-industries/claude-agent-acp@${ACP_ADAPTER_PACKAGE_RANGES.claude}`,
|
|
23
|
-
gemini: "gemini --
|
|
22
|
+
gemini: "gemini --acp",
|
|
24
23
|
cursor: "cursor-agent acp",
|
|
25
24
|
copilot: "copilot --acp --stdio",
|
|
25
|
+
droid: "droid exec --output-format acp",
|
|
26
|
+
iflow: "iflow --experimental-acp",
|
|
27
|
+
kilocode: "npx -y @kilocode/cli acp",
|
|
26
28
|
kimi: "kimi acp",
|
|
27
|
-
opencode: "npx -y opencode-ai acp",
|
|
28
29
|
kiro: "kiro-cli acp",
|
|
29
|
-
|
|
30
|
+
opencode: "npx -y opencode-ai acp",
|
|
30
31
|
qwen: "qwen --acp"
|
|
31
32
|
};
|
|
32
33
|
const DEFAULT_AGENT_NAME = "codex";
|
|
@@ -50,7 +51,6 @@ function resolveAgentCommand(agentName, overrides) {
|
|
|
50
51
|
function listBuiltInAgents(overrides) {
|
|
51
52
|
return Object.keys(mergeAgentRegistry(overrides));
|
|
52
53
|
}
|
|
53
|
-
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/cli/flags.ts
|
|
56
56
|
function parseOutputFormat$1(value) {
|
|
@@ -145,7 +145,7 @@ function resolveGlobalFlags(command, config) {
|
|
|
145
145
|
nonInteractivePermissions: opts.nonInteractivePermissions ?? config.nonInteractivePermissions,
|
|
146
146
|
jsonStrict,
|
|
147
147
|
timeout: opts.timeout ?? config.timeoutMs,
|
|
148
|
-
ttl: opts.ttl ?? config.ttlMs ??
|
|
148
|
+
ttl: opts.ttl ?? config.ttlMs ?? 3e5,
|
|
149
149
|
verbose,
|
|
150
150
|
format,
|
|
151
151
|
model: typeof opts.model === "string" ? parseNonEmptyValue("Model", opts.model) : void 0,
|
|
@@ -168,14 +168,13 @@ function resolveOutputPolicy(format, jsonStrict) {
|
|
|
168
168
|
function resolveAgentInvocation(explicitAgentName, globalFlags, config) {
|
|
169
169
|
const override = globalFlags.agent?.trim();
|
|
170
170
|
if (override && explicitAgentName) throw new InvalidArgumentError("Do not combine positional agent with --agent override");
|
|
171
|
-
const agentName = explicitAgentName ?? config.defaultAgent ??
|
|
171
|
+
const agentName = explicitAgentName ?? config.defaultAgent ?? "codex";
|
|
172
172
|
return {
|
|
173
173
|
agentName,
|
|
174
174
|
agentCommand: override && override.length > 0 ? override : resolveAgentCommand(agentName, config.agents),
|
|
175
175
|
cwd: path.resolve(globalFlags.cwd)
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
|
-
|
|
179
178
|
//#endregion
|
|
180
179
|
//#region src/mcp-servers.ts
|
|
181
180
|
function asRecord$1(value) {
|
|
@@ -278,7 +277,6 @@ function parseOptionalMcpServers(value, sourcePath, fieldName = "mcpServers") {
|
|
|
278
277
|
if (value === void 0) return;
|
|
279
278
|
return parseMcpServers(value, sourcePath, fieldName);
|
|
280
279
|
}
|
|
281
|
-
|
|
282
280
|
//#endregion
|
|
283
281
|
//#region src/config.ts
|
|
284
282
|
const DEFAULT_TIMEOUT_MS = void 0;
|
|
@@ -415,7 +413,7 @@ async function loadResolvedConfig(cwd) {
|
|
|
415
413
|
const [globalResult, projectResult] = await Promise.all([readConfigFile(globalPath), readConfigFile(projectPath)]);
|
|
416
414
|
const globalConfig = globalResult.config;
|
|
417
415
|
const projectConfig = projectResult.config;
|
|
418
|
-
const defaultAgent = parseDefaultAgent(projectConfig?.defaultAgent, projectPath) ?? parseDefaultAgent(globalConfig?.defaultAgent, globalPath) ??
|
|
416
|
+
const defaultAgent = parseDefaultAgent(projectConfig?.defaultAgent, projectPath) ?? parseDefaultAgent(globalConfig?.defaultAgent, globalPath) ?? "codex";
|
|
419
417
|
const defaultPermissions = parsePermissionMode(projectConfig?.defaultPermissions, projectPath) ?? parsePermissionMode(globalConfig?.defaultPermissions, globalPath) ?? DEFAULT_PERMISSION_MODE;
|
|
420
418
|
const nonInteractivePermissions = parseNonInteractivePermissionPolicy(projectConfig?.nonInteractivePermissions, projectPath) ?? parseNonInteractivePermissionPolicy(globalConfig?.nonInteractivePermissions, globalPath) ?? DEFAULT_NON_INTERACTIVE_PERMISSION_POLICY;
|
|
421
419
|
const authPolicy = parseAuthPolicy(projectConfig?.authPolicy, projectPath) ?? parseAuthPolicy(globalConfig?.authPolicy, globalPath) ?? DEFAULT_AUTH_POLICY;
|
|
@@ -499,7 +497,6 @@ async function initGlobalConfigFile() {
|
|
|
499
497
|
created: true
|
|
500
498
|
};
|
|
501
499
|
}
|
|
502
|
-
|
|
503
500
|
//#endregion
|
|
504
501
|
//#region src/queue-owner-env.ts
|
|
505
502
|
function asRecord(value) {
|
|
@@ -534,7 +531,6 @@ async function runQueueOwnerFromEnv(env) {
|
|
|
534
531
|
if (!payload) throw new Error("missing ACPX_QUEUE_OWNER_PAYLOAD");
|
|
535
532
|
await runSessionQueueOwner(parseQueueOwnerPayload(payload));
|
|
536
533
|
}
|
|
537
|
-
|
|
538
534
|
//#endregion
|
|
539
535
|
//#region src/version.ts
|
|
540
536
|
const UNKNOWN_VERSION = "0.0.0-unknown";
|
|
@@ -575,7 +571,6 @@ function getAcpxVersion() {
|
|
|
575
571
|
cachedVersion = resolveAcpxVersion();
|
|
576
572
|
return cachedVersion;
|
|
577
573
|
}
|
|
578
|
-
|
|
579
574
|
//#endregion
|
|
580
575
|
//#region src/cli-core.ts
|
|
581
576
|
var NoSessionError = class extends Error {
|
|
@@ -601,17 +596,22 @@ async function readPromptInputFromStdin() {
|
|
|
601
596
|
return data;
|
|
602
597
|
}
|
|
603
598
|
async function readPrompt(promptParts, filePath, cwd) {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
599
|
+
try {
|
|
600
|
+
if (filePath) {
|
|
601
|
+
const prompt = mergePromptSourceWithText(filePath === "-" ? await readPromptInputFromStdin() : await fs$1.readFile(path.resolve(cwd, filePath), "utf8"), promptParts.join(" "));
|
|
602
|
+
if (prompt.length === 0) throw new InvalidArgumentError("Prompt from --file is empty");
|
|
603
|
+
return prompt;
|
|
604
|
+
}
|
|
605
|
+
const joined = promptParts.join(" ").trim();
|
|
606
|
+
if (joined.length > 0) return textPrompt(joined);
|
|
607
|
+
if (process.stdin.isTTY) throw new InvalidArgumentError("Prompt is required (pass as argument, --file, or pipe via stdin)");
|
|
608
|
+
const prompt = parsePromptSource(await readPromptInputFromStdin());
|
|
609
|
+
if (prompt.length === 0) throw new InvalidArgumentError("Prompt from stdin is empty");
|
|
607
610
|
return prompt;
|
|
611
|
+
} catch (error) {
|
|
612
|
+
if (error instanceof PromptInputValidationError) throw new InvalidArgumentError(error.message);
|
|
613
|
+
throw error;
|
|
608
614
|
}
|
|
609
|
-
const joined = promptParts.join(" ").trim();
|
|
610
|
-
if (joined.length > 0) return joined;
|
|
611
|
-
if (process.stdin.isTTY) throw new InvalidArgumentError("Prompt is required (pass as argument, --file, or pipe via stdin)");
|
|
612
|
-
const prompt = (await readPromptInputFromStdin()).trim();
|
|
613
|
-
if (!prompt) throw new InvalidArgumentError("Prompt from stdin is empty");
|
|
614
|
-
return prompt;
|
|
615
615
|
}
|
|
616
616
|
function applyPermissionExitCode(result) {
|
|
617
617
|
const stats = result.permissionStats;
|
|
@@ -623,25 +623,33 @@ function emitJsonResult(format, payload) {
|
|
|
623
623
|
process.stdout.write(`${JSON.stringify(payload)}\n`);
|
|
624
624
|
return true;
|
|
625
625
|
}
|
|
626
|
+
function isCodexAgentInvocation(agent) {
|
|
627
|
+
if (agent.agentName === "codex") return true;
|
|
628
|
+
return /\bcodex-acp\b/.test(agent.agentCommand);
|
|
629
|
+
}
|
|
630
|
+
function resolveCompatibleConfigId(agent, configId) {
|
|
631
|
+
if (isCodexAgentInvocation(agent) && configId === "thought_level") return "reasoning_effort";
|
|
632
|
+
return configId;
|
|
633
|
+
}
|
|
626
634
|
let sessionModulePromise;
|
|
627
635
|
let outputModulePromise;
|
|
628
636
|
let outputRenderModulePromise;
|
|
629
637
|
let queueIpcModulePromise;
|
|
630
638
|
let skillflagModulePromise;
|
|
631
639
|
function loadSessionModule() {
|
|
632
|
-
sessionModulePromise ??= import("./session-
|
|
640
|
+
sessionModulePromise ??= import("./session-C2Q8ktsN.js").then((n) => n.t);
|
|
633
641
|
return sessionModulePromise;
|
|
634
642
|
}
|
|
635
643
|
function loadOutputModule() {
|
|
636
|
-
outputModulePromise ??= import("./output-
|
|
644
|
+
outputModulePromise ??= import("./output-BmkPP7qE.js");
|
|
637
645
|
return outputModulePromise;
|
|
638
646
|
}
|
|
639
647
|
function loadOutputRenderModule() {
|
|
640
|
-
outputRenderModulePromise ??= import("./output-render-
|
|
648
|
+
outputRenderModulePromise ??= import("./output-render-DEAaMxg8.js").then((n) => n.n);
|
|
641
649
|
return outputRenderModulePromise;
|
|
642
650
|
}
|
|
643
651
|
function loadQueueIpcModule() {
|
|
644
|
-
queueIpcModulePromise ??= import("./queue-ipc-
|
|
652
|
+
queueIpcModulePromise ??= import("./queue-ipc-EQLpBMKv.js").then((n) => n.r);
|
|
645
653
|
return queueIpcModulePromise;
|
|
646
654
|
}
|
|
647
655
|
function loadSkillflagModule() {
|
|
@@ -678,7 +686,7 @@ async function handlePrompt(explicitAgentName, promptParts, flags, command, conf
|
|
|
678
686
|
await printPromptSessionBanner(record, agent.cwd, outputPolicy.format, outputPolicy.jsonStrict);
|
|
679
687
|
const result = await sendSession({
|
|
680
688
|
sessionId: record.acpxRecordId,
|
|
681
|
-
|
|
689
|
+
prompt,
|
|
682
690
|
mcpServers: config.mcpServers,
|
|
683
691
|
permissionMode,
|
|
684
692
|
nonInteractivePermissions: globalFlags.nonInteractivePermissions,
|
|
@@ -725,7 +733,7 @@ async function handleExec(explicitAgentName, promptParts, flags, command, config
|
|
|
725
733
|
applyPermissionExitCode(await runOnce({
|
|
726
734
|
agentCommand: agent.agentCommand,
|
|
727
735
|
cwd: agent.cwd,
|
|
728
|
-
|
|
736
|
+
prompt,
|
|
729
737
|
mcpServers: config.mcpServers,
|
|
730
738
|
permissionMode,
|
|
731
739
|
nonInteractivePermissions: globalFlags.nonInteractivePermissions,
|
|
@@ -829,10 +837,11 @@ async function handleSetMode(explicitAgentName, modeId, flags, command, config)
|
|
|
829
837
|
async function handleSetConfigOption(explicitAgentName, configId, value, flags, command, config) {
|
|
830
838
|
const globalFlags = resolveGlobalFlags(command, config);
|
|
831
839
|
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
840
|
+
const resolvedConfigId = resolveCompatibleConfigId(agent, configId);
|
|
832
841
|
const { setSessionConfigOption } = await loadSessionModule();
|
|
833
842
|
const result = await setSessionConfigOption({
|
|
834
843
|
sessionId: (await findRoutedSessionOrThrow(agent.agentCommand, agent.agentName, agent.cwd, resolveSessionNameFromFlags(flags, command))).acpxRecordId,
|
|
835
|
-
configId,
|
|
844
|
+
configId: resolvedConfigId,
|
|
836
845
|
value,
|
|
837
846
|
mcpServers: config.mcpServers,
|
|
838
847
|
nonInteractivePermissions: globalFlags.nonInteractivePermissions,
|
|
@@ -1184,7 +1193,7 @@ function registerSessionsCommand(parent, explicitAgentName, config) {
|
|
|
1184
1193
|
sessionsCommand.command("show").description("Show session metadata for current cwd").argument("[name]", "Session name", parseSessionName).action(async function(name) {
|
|
1185
1194
|
await handleSessionsShow(explicitAgentName, name, this, config);
|
|
1186
1195
|
});
|
|
1187
|
-
sessionsCommand.command("history").description("Show recent session history entries").argument("[name]", "Session name", parseSessionName).option("--limit <count>", "Maximum number of entries to show (default: 20)", parseHistoryLimit,
|
|
1196
|
+
sessionsCommand.command("history").description("Show recent session history entries").argument("[name]", "Session name", parseSessionName).option("--limit <count>", "Maximum number of entries to show (default: 20)", parseHistoryLimit, 20).action(async function(name, flags) {
|
|
1188
1197
|
await handleSessionsHistory(explicitAgentName, name, flags, this, config);
|
|
1189
1198
|
});
|
|
1190
1199
|
sessionsCommand.command("read").description("Read full session history").argument("[name]", "Session name", parseSessionName).option("--tail <count>", "Show only the last N entries instead of all history", parseHistoryLimit).action(async function(name, flags) {
|
|
@@ -1413,7 +1422,7 @@ Examples:
|
|
|
1413
1422
|
acpx codex exec "what does this repo do"
|
|
1414
1423
|
acpx codex cancel
|
|
1415
1424
|
acpx codex set-mode plan
|
|
1416
|
-
acpx codex set
|
|
1425
|
+
acpx codex set thought_level high
|
|
1417
1426
|
acpx codex -s backend "fix the API"
|
|
1418
1427
|
acpx codex sessions
|
|
1419
1428
|
acpx codex sessions new --name backend
|
|
@@ -1439,7 +1448,7 @@ Examples:
|
|
|
1439
1448
|
defaultCode: "USAGE",
|
|
1440
1449
|
origin: "cli"
|
|
1441
1450
|
});
|
|
1442
|
-
|
|
1451
|
+
await emitRequestedError(error, normalized, requestedOutputPolicy);
|
|
1443
1452
|
process.exit(exitCodeForOutputErrorCode(normalized.code));
|
|
1444
1453
|
}
|
|
1445
1454
|
if (error instanceof InterruptedError) process.exit(EXIT_CODES.INTERRUPTED);
|
|
@@ -1452,7 +1461,6 @@ Examples:
|
|
|
1452
1461
|
flushPerfMetricsCapture();
|
|
1453
1462
|
}
|
|
1454
1463
|
}
|
|
1455
|
-
|
|
1456
1464
|
//#endregion
|
|
1457
1465
|
//#region src/cli.ts
|
|
1458
1466
|
function isCliEntrypoint(argv) {
|
|
@@ -1466,7 +1474,7 @@ function isCliEntrypoint(argv) {
|
|
|
1466
1474
|
}
|
|
1467
1475
|
}
|
|
1468
1476
|
if (isCliEntrypoint(process.argv)) main(process.argv);
|
|
1469
|
-
|
|
1470
1477
|
//#endregion
|
|
1471
1478
|
export { formatPromptSessionBannerLine, parseAllowedTools, parseMaxTurns, parseTtlSeconds };
|
|
1479
|
+
|
|
1472
1480
|
//# sourceMappingURL=cli.js.map
|