feat(runtime): 支持 Codex 兼容 CLI 独立运行时 - #719
Open
xiongz-c wants to merge 5 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
此前
cliId同时承担协议适配器和具体发行版身份,cliPathOverride只能替换启动二进制。Codex 魔改发行版虽然大体可运行,但版本检查、更新提示、会话恢复和 UI 展示仍可能沿用官方 Codex 语义。本 PR 引入一套通用的 Codex-compatible runtime 能力,让未来兼容 Codex 契约的独立 CLI 通过配置接入,不需要逐个新增 adapter。完整设计见
docs/design/2026-08-03-codex-compatible-runtime.md。方案
cliId固定为协议能力,新增cliRuntime描述具体发行版:稳定 id、展示名、可执行文件和更新策略。auto、self、npm、none,只有官方 runtime 可以使用官方 Codex 更新源。auto必须唯一证明 npm bin 所有权;来源冲突、歧义或换包时 fail-closed。--version预检、legacy path 迁移以及运行时状态展示。cliPathOverride降级影子,使旧版 BotMux 仍启动同一二进制;新 loader 对缺失或不一致的影子直接拒绝。向前与向后兼容
cliRuntime的现有 20+ CLI 路径不变。cliPathOverride继续可启动并使用安全的auto更新探测;因无法证明完整兼容契约,RPC 增强保持关闭。-才表示清除。影响面评估
cliId=codex;其他 adapter 共用路径有回归覆盖。验证
pnpm build:通过。node-pty。pnpm test:12459 passed,35 skipped;仅剩 2 条 master 既有基线失败,相关测试文件本 PR 未修改:test/v2-run-archive.test.ts:612:对目录调用非 recursivermSync。test/v3-host-execution.test.ts:205:对目录调用非 recursivermSync。git diff --check、公开域名审计、私有 CLI/主机名扫描:通过。Dashboard 示例
提交关系
docs(design):先定义 schema、边界、迁移和验收矩阵。feat(runtime):引入 runtime 模型、严格校验和降级影子。fix(update):按发行版隔离更新来源、缓存和通知水位。feat(codex):打通会话快照、RPC、adopt/resume 与展示闭环。feat(dashboard):补齐 Dashboard、预检、文档和截图。