@alas-ide/codex-acp

中文文档
2.5.0-alas.9发布于 2026/11/08Apache-2.0ES Module构建来源已验证近 30 天下载 1878

npm version

原始使用文档
文档目录8 节
  1. Features
  2. Installation
  3. Authentication
  4. Runtime options
  5. Development
  6. Subagent sessions
  7. Background terminal tasks
  8. License

ACP adapter for Codex CLI

npm version

Use OpenAI Codex from Agent Client Protocol clients.

codex-acp is a stdio ACP agent server. It starts the Codex App Server, translates ACP requests into Codex operations, and maps Codex events back into the client.

Features

  • ChatGPT, API key, and client-provided custom gateway authentication.
  • Model, reasoning effort, fast mode, approval, and sandbox mode configuration.
  • Concrete recommended model and reasoning-effort values through the opt-in AIR recommended config values capability.
  • Text prompts, embedded context, images, resource links, and additional workspace directories.
  • Shell command, file change, permission request, MCP tool call, terminal output, reasoning, plan, web search, image generation, image view, token usage, and review events.
  • Compact file changes through the negotiated AIR diff patch extension.
  • For AIR, one tool call shape with each fact in one field, as the tool call contract defines. Other clients keep the earlier fields.
  • Native ACP subagent sessions (after capability negotiation) with separate child histories and root-routed permissions; a legacy tool-call fallback otherwise.
  • Mid-turn input through the _session/steering extension, with an opt-in host-owned fallback when no turn can accept it.
  • Async Codex questions as non-blocking form elicitations, with answers steered into the turn that asked them.
  • Background terminal tasks in AIR, with task status and targeted stop support after capability negotiation.
  • Session-scoped long-running goals in AIR through the goal extension.
  • Typed warnings and errors through the opt-in AIR session failure extension.
  • All AIR extensions, capabilities, and _meta keys: AIR extensions.
  • A per-turn agent file-change report after capability negotiation.
  • Client-provided, session-scoped system prompt append, preserving configured developer instructions.
  • Client-provided MCP servers over command-based stdio config and HTTP transport.
  • Slash commands: /status, /mcp (with /mcp reconnect), /skills, /goal, /review, /review-branch, /review-commit, /compact, and /logout, as well as configured skills.

Installation

Run the published package directly:

npx -y @agentclientprotocol/codex-acp

Or install it globally:

npm install -g @agentclientprotocol/codex-acp
codex-acp --version

The npm package includes a compatible @openai/codex dependency. Set CODEX_PATH only when you want the adapter to run a different Codex binary:

CODEX_PATH=/path/to/codex npx -y @agentclientprotocol/codex-acp

To try changes that have landed on main but are not released yet, install from the preview channel. Pushes to main trigger preview publishing without waiting for CI or release-please; release commits are excluded, and newer pushes can replace queued previews. See docs/RELEASES.md.

npx -y @agentclientprotocol/codex-acp@preview

Authentication

The adapter advertises ACP auth methods during initialization. Clients can authenticate with:

  • ChatGPT login. Set NO_BROWSER=1 to hide this method in remote or browserless environments.
  • API key via CODEX_API_KEY or OPENAI_API_KEY.
  • A custom OpenAI-compatible gateway, when the client opts in to the gateway auth capability.

Runtime options

  • CODEX_API_KEY - API key used when the API-key auth method is selected. Takes precedence over OPENAI_API_KEY.
  • OPENAI_API_KEY - fallback API key used when the API-key auth method is selected.
  • CODEX_PATH - run a specific Codex executable instead of the bundled package dependency.
  • CODEX_CONFIG - JSON object merged into the Codex session config.
  • MODEL_PROVIDER - model provider to pass to Codex for new sessions.
  • DEFAULT_AUTH_REQUEST - ACP auth request JSON used when Codex requires authentication.
  • INITIAL_AGENT_MODE - initial mode id: read-only, workspace-write, agent, or agent-full-access.
  • NO_BROWSER - hide browser-based ChatGPT auth when set.
  • APP_SERVER_LOGS - directory for adapter logs.

Development

npm install
npm run start
npm run typecheck
npm test

Build standalone binaries in dist/bin with:

npm run bundle:all

See readme-dev.md for local client configuration, binary packaging, and Codex type regeneration.

Subagent sessions

Subagent sessions follow the draft ACP subagent RFD and are enabled only after bilateral capability negotiation during initialize. Without native negotiation, the subagent lifecycle stays an ordinary ACP tool call.

See docs/subagent-sessions.md for the negotiation, lifecycle events, session/load reconstruction, and legacy fallback details.

Background terminal tasks

Codex can keep a shell command running after a turn continues. AIR clients can show this work in the Async Tasks panel and stop one command.

See AIR extensions for the capability, lifecycle events, and stop request.

License

By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.

版本与发布记录

@alas-ide/codex-acp 共发布 17 个版本,首次发布于 2026/10/05;过去 12 个月发布了 17 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.5.0-alas.9latest2026/11/08今天
2.5.0-alas.82026/11/071 天前
2.5.0-alas.72026/11/071 天前
2.5.0-alas.62026/11/062 天前
2.5.0-alas.52026/11/053 天前
2.5.0-alas.42026/11/035 天前

关于 @alas-ide/codex-acp 的常见问题

如何安装 @alas-ide/codex-acp?

在项目目录运行 npm install @alas-ide/codex-acp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 codex-acp,可以用 npx codex-acp 直接运行。

@alas-ide/codex-acp 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/alas-ide__codex-acp 是否存在。

@alas-ide/codex-acp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@alas-ide/codex-acp 可以商用吗?

@alas-ide/codex-acp 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@alas-ide/codex-acp 的下载量有多少?

根据 npm 官方下载统计,@alas-ide/codex-acp 在 2026/10/06 – 2026/11/04 这 30 天内被下载 1,878 次,日均约 63 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@alas-ide/codex-acp 还在维护吗?

最新版本 2.5.0-alas.9 发布于 2026/11/08(今天);至今共发布 17 个版本,其中过去 12 个月发布了 17 个;首次发布于 2026/10/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。