feat(desktop): 支持使用当前 Codex CLI 账号 - #3858
Open
JupiterTheWarlock wants to merge 2 commits into
Open
Conversation
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/maker-host/auth-adapters.ts | 新增系统 Codex OAuth 探测与显式采用事务,包含链接复核、owner/cancel 边界和失败回滚。 |
| apps/desktop/src/main/maker-host/nativeProviderAuthBinding.ts | 扩展原生供应商绑定,使显式采用系统凭证时清除撤销状态并保留 inherited 来源。 |
| apps/desktop/src/main/maker-ipc/localCliDetect.ts | 在 Main 进程识别 Codex OAuth 可用性,并仅向 Renderer 返回布尔元数据。 |
| apps/desktop/src/main/maker-ipc/authHandlers.ts | 将 local-cli 纳入受运行时校验的 Codex 登录模式,并继续复用现有操作所有权与取消机制。 |
| apps/desktop/src/renderer/hooks/codexAuthLogin.ts | 将本机 CLI 采用接入 Renderer 登录单飞、模式切换和 owner lease 流程。 |
| apps/desktop/src/renderer/hooks/useCodexAuth.ts | 扩展认证状态机以承载 local-cli pending 状态和登录结果。 |
| apps/desktop/src/renderer/components/settings/ProvidersSection.tsx | 在 OpenAI 设置中增加 Codex CLI 采用入口,并在已连接状态显示账号标识。 |
| apps/desktop/src/shared/localCliDetect.ts | 为本机 CLI 检测结果新增 OAuth 可复用性元数据契约。 |
| packages/maker-core/src/interfaces/auth-adapter.ts | 将 local-cli 添加到共享登录模式接口,保持各层类型一致。 |
Sequence Diagram
sequenceDiagram
participant U as 用户
participant R as Renderer 设置页
participant P as Preload / IPC
participant M as Main 鉴权适配器
participant S as 系统 Codex auth.json
participant C as Cindy codex-home
R->>P: 检测 Codex CLI OAuth 可用性
P->>M: 请求非敏感登录元数据
M->>S: 读取并校验 OAuth 形态与账号 ID
M-->>R: oauthLoggedIn 布尔值
U->>R: 选择“使用 Codex CLI”
R->>P: triggerLogin(local-cli)
P->>M: 启动受跟踪的登录操作
M->>S: 复核账号与 OAuth 状态
M->>C: 建立共享 auth.json 链接
M->>M: 复核 owner generation 与链接拓扑
M->>M: 清除断开边界并记录继承来源
M-->>R: 返回认证状态并刷新供应商
Reviews (1): Last reviewed commit: "fix(desktop): roll back superseded Codex..." | Re-trigger Greptile
Signed-off-by: JupiterTheWarlock <84393202+JupiterTheWarlock@users.noreply.github.com>
Signed-off-by: JupiterTheWarlock <84393202+JupiterTheWarlock@users.noreply.github.com>
JupiterTheWarlock
force-pushed
the
feat/use-current-codex-cli-account
branch
from
September 3, 2026 09:24
8fcdf16 to
e000a91
Compare
Contributor
|
这个 PR 会在设置页增加「使用当前 Codex CLI 账号」的用户可见入口,并改变登录交互,需要先做维护者确认。 确认方式:直接在本 PR 上 Approve;若需要修改,请 Request Changes,作者改完后再 Approve 即放行。 讨论 issue:#3863 |
Contributor
|
命中 UI 路径(apps/desktop/src/renderer/components/settings/ProvidersSection.tsx / apps/desktop/src/renderer/hooks/codexAuthLogin.ts / apps/desktop/src/renderer/hooks/useCodexAuth.ts)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范 |
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.
Closes #3857
改动说明
为内置 OpenAI 供应商增加“使用当前 Codex CLI 账号”操作。
当 Cindy 未连接,并且检测到本机存在有效的 Codex CLI ChatGPT OAuth 账号时,用户可以明确选择该账号,无需重新打开浏览器登录。
实现
local-cli登录模式,复用现有登录单飞、取消和状态刷新流程;auth.json链接机制,不复制 OAuth Token;native-harness-inherited凭证来源;API Key-only、格式损坏或缺少账号 ID 的 Codex 凭证不会显示为可复用的 OAuth 账号。
现有
reconnect-required恢复行为保持不变。安全边界
测试
自动化验证:
pnpm --filter desktop typecheckgit diff --check覆盖:
Windows 桌面实机验证:
非目标
本次改动不提供完整的多账号管理或账号切换界面。