201 lines
6.7 KiB
YAML
201 lines
6.7 KiB
YAML
# ============================================================
|
||
# AgentDock 适配器 · OpenAI Codex CLI(Wave 2.1)
|
||
# 数据依据:调研底稿 agent-cli-survey-2026-08-24.md §1 + 架构 §3.3
|
||
# ============================================================
|
||
id: codex
|
||
name: Codex CLI
|
||
name_zh: Codex CLI
|
||
vendor: OpenAI
|
||
status: available
|
||
adapter_version: 1.1.0
|
||
license: Apache-2.0
|
||
|
||
platforms:
|
||
windows:
|
||
architectures: [x64]
|
||
notes: 原生支持(PowerShell 脚本安装,非 WSL);亦可走 npm
|
||
linux:
|
||
distributions: [ubuntu]
|
||
architectures: [x64]
|
||
|
||
official:
|
||
homepage: https://github.com/openai/codex
|
||
docs: https://learn.chatgpt.com/docs/codex/cli
|
||
allowed_hosts: [chatgpt.com, github.com, api.github.com, releases.openai.com, registry.npmjs.org, api.openai.com]
|
||
|
||
runtime_deps: []
|
||
|
||
install:
|
||
preferred: npm
|
||
channels:
|
||
- id: npm
|
||
platforms: [windows, linux]
|
||
command: [npm, install, -g, "@openai/codex"]
|
||
package: "@openai/codex"
|
||
elevate: never
|
||
post_checks: [detect]
|
||
- id: official_script
|
||
platforms: [windows]
|
||
script:
|
||
url: https://chatgpt.com/codex/install.ps1
|
||
kind: powershell_irm
|
||
elevate: never
|
||
post_checks: [detect]
|
||
- id: github_release
|
||
platforms: [windows, linux]
|
||
package: codex
|
||
elevate: never
|
||
post_checks: [detect]
|
||
|
||
detect:
|
||
executable: codex
|
||
version_args: ["--version"]
|
||
version_regex: "^codex-cli (\\d+\\.\\d+\\.\\d+)"
|
||
version_unconfirmed: true
|
||
|
||
update:
|
||
method: npm_update
|
||
command: [npm, update, -g, "@openai/codex"]
|
||
source:
|
||
kind: npm
|
||
package: "@openai/codex"
|
||
|
||
uninstall:
|
||
method: npm_uninstall
|
||
command: [npm, uninstall, -g, "@openai/codex"]
|
||
keep_config_default: true
|
||
|
||
authorization:
|
||
modes:
|
||
- mode: browser_oauth
|
||
command: [codex, login]
|
||
status_command: [codex, login, status]
|
||
notes_zh: 浏览器登录 ChatGPT 账号(需 Plus/Pro/Business/EDU/Enterprise 计划)
|
||
- mode: device_code
|
||
command: [codex, login, --device-auth]
|
||
notes_zh: 设备码登录,不弹浏览器
|
||
- mode: api_key
|
||
command: [codex, login, --with-api-key]
|
||
env_keys: [OPENAI_API_KEY]
|
||
notes_zh: API Key 从系统密钥库读取,经 stdin 注入,不进 argv
|
||
test:
|
||
url: https://api.openai.com/v1/models
|
||
key_header: Authorization
|
||
bearer: true
|
||
|
||
# 配置机制(调研底稿 §1「配置机制」):用户级 ~/.codex/config.toml(TOML)
|
||
# 官方确认可配:model / approval_policy / sandbox_mode / model_reasoning_effort /
|
||
# web_search / log_dir / [model_providers.<id>](base_url / env_key / wire_api)/
|
||
# 简化键 openai_base_url。表单字段名与官方文档一致。
|
||
configuration:
|
||
files:
|
||
- path: "~/.codex/config.toml"
|
||
format: toml
|
||
scope: user
|
||
environment:
|
||
- key: OPENAI_API_KEY
|
||
sensitive: true
|
||
maps_to_field: api_key
|
||
fields:
|
||
- id: model
|
||
label_zh: 默认模型
|
||
group: common
|
||
help_zh: 官方键 model,如 gpt-5.6-terra(对应官方 config-basic 文档)
|
||
required: false
|
||
sensitive: false
|
||
type: string
|
||
storage: file
|
||
docs_url: https://learn.chatgpt.com/docs/config-file/config-basic
|
||
- id: approval_policy
|
||
label_zh: 审批策略
|
||
group: advanced
|
||
help_zh: 官方键 approval_policy,控制执行命令前是否需人工确认
|
||
required: false
|
||
sensitive: false
|
||
type: enum
|
||
storage: file
|
||
docs_url: https://learn.chatgpt.com/docs/config-file/config-basic
|
||
options:
|
||
- value: untrusted
|
||
label_zh: 不信任(全部确认)
|
||
- value: on-failure
|
||
label_zh: 失败时确认
|
||
- value: on-request
|
||
label_zh: 每次请求确认
|
||
- value: never
|
||
label_zh: 永不确认
|
||
- id: openai_base_url
|
||
label_zh: Base URL
|
||
group: advanced
|
||
help_zh: 官方简化键 openai_base_url,自定义 OpenAI 兼容端点/网关/代理
|
||
required: false
|
||
sensitive: false
|
||
type: url
|
||
storage: file
|
||
docs_url: https://learn.chatgpt.com/docs/config-file/config-advanced
|
||
- id: api_key
|
||
label_zh: API Key
|
||
group: auth
|
||
help_zh: 存入系统密钥库(对应环境变量 OPENAI_API_KEY),写入后仅显示「已保存」;也可用 codex login --with-api-key 注入
|
||
required: false
|
||
sensitive: true
|
||
type: string
|
||
storage: keyring
|
||
docs_url: https://learn.chatgpt.com/docs/config-file/config-advanced
|
||
|
||
models:
|
||
list:
|
||
- id: gpt-5.6-terra
|
||
label_zh: GPT-5.6 Terra(默认)
|
||
- id: gpt-5
|
||
label_zh: GPT-5
|
||
|
||
diagnostics:
|
||
- rule_id: path.not_installed
|
||
- rule_id: path.not_in_path
|
||
- rule_id: version_conflict.multiple_copies
|
||
- rule_id: config.corrupt
|
||
|
||
documentation:
|
||
quickstart_zh: 安装后运行 `codex` 登录 ChatGPT 账号,或用 `codex exec "任务"` 无头执行。
|
||
install_zh: 推荐 `npm install -g @openai/codex`(本适配器默认渠道);也可走官方 PowerShell 脚本(irm https://chatgpt.com/codex/install.ps1)或 GitHub Releases 二进制。
|
||
auth_zh: 三种授权:① 浏览器登录 ChatGPT 账号(`codex login`,需订阅计划);② 设备码(`codex login --device-auth`);③ API Key(`codex login --with-api-key`,从 stdin 读取,或经 OPENAI_API_KEY 环境变量)。
|
||
commands:
|
||
- cmd: codex
|
||
desc_zh: 启动交互式会话
|
||
- cmd: codex exec "提示词"
|
||
desc_zh: 无头单次执行(别名 codex e)
|
||
- cmd: codex exec --json "提示词"
|
||
desc_zh: 以 JSONL 事件流输出
|
||
- cmd: codex exec --output-schema <schema>
|
||
desc_zh: 约束输出为指定 JSON Schema
|
||
- cmd: codex exec -o 文件
|
||
desc_zh: 将输出写入文件
|
||
- cmd: codex exec --sandbox
|
||
desc_zh: 在沙箱中执行
|
||
- cmd: codex login
|
||
desc_zh: 浏览器登录 ChatGPT 账号
|
||
- cmd: codex login --device-auth
|
||
desc_zh: 设备码流程登录
|
||
- cmd: codex login --with-api-key
|
||
desc_zh: 从 stdin 读取 API Key 登录
|
||
- cmd: codex login status
|
||
desc_zh: 查询当前登录状态
|
||
params:
|
||
- param: --json
|
||
desc_zh: 以 JSONL 事件流输出(exec 子命令)
|
||
- param: --output-schema
|
||
desc_zh: 约束输出为指定 JSON Schema
|
||
- param: -o / --output
|
||
desc_zh: 输出写入文件
|
||
- param: --ephemeral
|
||
desc_zh: 使用不落盘的临时会话
|
||
- param: --sandbox
|
||
desc_zh: 在沙箱中执行
|
||
- param: --device-auth
|
||
desc_zh: 使用设备码流程登录(login 子命令)
|
||
updated_at: "2026-08-25"
|
||
risks_zh:
|
||
- --version 官方文档未确认,适配器已标 version_unconfirmed 并实测兜底
|
||
- 表单覆盖常用配置键;model_providers 表等高级自定义 provider 请以官方文档为准(见上方链接)
|