Skip to content

Commit 196cd24

Browse files
committed
feat: add account routing workbench
1 parent 825f25a commit 196cd24

32 files changed

Lines changed: 5054 additions & 469 deletions

File tree

.agents/skills/gettokens-claude-code-account-list/SKILL.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
---
22
name: gettokens-claude-code-account-list
3-
description: GetTokens Claude Code 账号列表:Anthropic 格式账号筛选、请求顺序、路由探测、模型映射、官方默认模型 profile 与 local apply 边界。
3+
description: GetTokens Claude Code 账号列表:Claude Channel Routing、Anthropic 格式账号筛选、请求顺序、三模式路由、项目绑定、路由探测、模型映射、官方默认模型 profile 与 local apply 边界。
44
---
55

66
# GetTokens Claude Code Account List
77

8-
当任务涉及 Claude Code 账号列表、Claude Code relay 账号请求顺序、Anthropic 格式账号筛选、Claude Code 模型映射、官方默认模型 profile、`~/.claude/settings.json` local apply 或 Claude Code 路由探测时使用本 skill。
8+
当任务涉及 Claude Code 账号列表、Claude Channel Routing、Claude Code relay 账号请求顺序、Anthropic 格式账号筛选、Claude Code route mode、项目绑定、模型映射、官方默认模型 profile、`~/.claude/settings.json` local apply 或 Claude Code 路由探测时使用本 skill。
99

1010
## 1. 业务边界
1111

1212
- Claude Code 账号列表不是 `settings.json` 多 key 管理器。
13-
- 它是 GetTokens relay 可供 Claude Code 使用的 Anthropic 格式账号请求工作台。
13+
- 它是 GetTokens relay 可供 Claude Code 使用的 Anthropic 格式 Channel Routing 工作台。
14+
- 总账号池只管理 Account Inventory;Claude Code 账号列表拥有 Claude 渠道顺序、渠道 route mode、渠道组状态、项目绑定、dry-run/explain 和 probe。
15+
- Claude 渠道配置不得通过全局 `UpdateAccountPriority` 表达;渠道顺序必须保存到 Claude channel config。
16+
- 新 GetTokens route mode 只允许 `sequential / balanced / project`
17+
- `dedicated / prefer / ordered / weighted / canary` 只作为上游兼容输入,不进入 Claude 新 UI / Wails DTO / engine policy。
18+
- `exclude` 不是 route mode,只能作为请求级 deny 或 pool filter。
19+
- 旧 allow / deny / order / fallback 只作为请求级兼容 policy,不作为新页面主配置模型。
1420
- P0 账号筛选条件:`AccountRecord.supportedFormats` 包含 `anthropic`
1521
- Claude Code 本地仍只写一个 relay endpoint / relay key;多账号轮换发生在 GetTokens relay 内。
1622
- 不把 provider 名称等于 `claude` 作为筛选条件。
@@ -21,11 +27,12 @@ description: GetTokens Claude Code 账号列表:Anthropic 格式账号筛选
2127
- `supportedFormats` 包含 `anthropic`
2228
- 存在可用于 relay 的凭证或 auth route id
2329
- 请求出口优先 `formatBaseUrls.anthropic`,没有时回退 `baseUrl`
24-
- 请求顺序复用 Codex 账号列表模式
30+
- 请求顺序使用 Claude channel config,不复用全局账号 priority
2531
- 禁用或阻塞账号保留在排序中
2632
- 运行时请求候选只包含当前可请求账号
27-
- 拖拽排序写回 `UpdateAccountPriority`
33+
- 拖拽排序写回 Claude channel config
2834
- 启停写回 `SetAccountDisabled`
35+
- 项目模式只限定目标账号或账号组;命中账号组后,组内选择继续使用 `sequential``balanced`
2936
- 浏览器 preview 必须在缺少 Wails runtime 时稳定显示 preview 数据。
3037

3138
## 3. 模型映射语义
@@ -48,6 +55,7 @@ description: GetTokens Claude Code 账号列表:Anthropic 格式账号筛选
4855
- profile 可一键填充 Claude Code local apply 字段,也可生成 relay 映射草稿;保存仍走 `models[]``oauth-model-alias`
4956
- 已保存的用户映射优先级最高;profile 更新只能提示,不能自动覆盖。
5057
- 官方默认值表维护在 `docs-linhay/spaces/20260519-claude-code-account-list/plans/official-model-profiles.md`
58+
- 官方模型 profile 和 local apply 不并入共享 channel routing 模型;它们仍属于 Claude Code 领域逻辑。
5159

5260
## 5. 当前官方校准结论
5361

@@ -71,3 +79,6 @@ description: GetTokens Claude Code 账号列表:Anthropic 格式账号筛选
7179
- 模型映射同名透传
7280
- 同一真实模型多个 Claude alias
7381
- 官方默认 profile 不覆盖用户映射
82+
- Claude channel config 保存不影响 Codex channel config
83+
- `ChannelRouteMode` 只接受 `sequential / balanced / project`
84+
- 上游兼容模式不进入 Claude 新配置保存

.agents/skills/gettokens-codex-account-list/SKILL.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,53 @@
11
---
22
name: gettokens-codex-account-list
3-
description: GetTokens Codex 账号列表:账号请求顺序、路由探测、模型映射、OAuth 透传语义、openai-compatible 映射保存与浏览器预览。
3+
description: GetTokens Codex 账号列表:Codex Channel Routing、账号请求顺序、三模式路由、项目绑定、路由探测、模型映射、OAuth 透传语义、openai-compatible 映射保存与浏览器预览。
44
---
55

66
# GetTokens Codex Account List
77

8-
当任务涉及 `frontend/src/features/codex/CodexAccountListFeature.tsx`、Codex 账号请求顺序、路由探测、模型映射、OAuth/auth-file 映射、openai-compatible provider 映射,或后端 `ProbeCodexAccountRouting` / OAuth model alias 时使用本 skill。
8+
当任务涉及 `frontend/src/features/codex/CodexAccountListFeature.tsx`、Codex Channel Routing、Codex 账号请求顺序、路由模式、项目绑定、路由探测、模型映射、OAuth/auth-file 映射、openai-compatible provider 映射,或后端 Codex route explain / probe / OAuth model alias 时使用本 skill。
99

1010
## 1. 业务边界
11-
- Codex 账号列表是请求调试与账号顺序工作台,不是账号创建页。
11+
- Codex 账号列表是 Codex Channel Routing 工作台,不是账号创建页,也不是总账号池。
12+
- 总账号池只管理 Account Inventory;Codex 账号列表拥有 Codex 渠道顺序、渠道 route mode、渠道组状态、项目绑定、dry-run/explain 和 probe。
13+
- Codex 渠道配置不得通过全局 `UpdateAccountPriority` 表达;渠道顺序必须保存到 Codex channel config。
14+
- 新 GetTokens route mode 只允许 `sequential / balanced / project`
15+
- `dedicated / prefer / ordered / weighted / canary` 只作为上游兼容输入,不进入 Codex 新 UI / Wails DTO / engine policy。
16+
- `exclude` 不是 route mode,只能作为请求级 deny 或 pool filter。
17+
-`allowAccountIDs / denyAccountIDs / orderAccountIDs / allowFallback` 只作为请求级兼容 policy,不作为新页面主配置模型。
1218
- 账号来源统一展示,但语义保持分离:
1319
- `auth-file` / OAuth Codex
1420
- `codex-api-key`
1521
- `openai-compatible`
1622
- 禁用账号保留在排序中,但不参与运行时请求候选。
1723
-`codex-api-key`,禁用不能只停留在 GetTokens 本地 store:sidecar `codex-api-key` 配置必须保存 `disabled:true`,CLIProxyAPI synthesizer 必须生成 disabled runtime auth,之后由 `manual-disabled` route guard 排除候选。
18-
- 请求测试顺序只来自当前可请求账号的拖拽顺序,从上到下执行。
19-
- 不再维护第二套独立策略顺序;允许/排除只过滤候选,不重排候选。
24+
- 项目模式只限定目标账号或账号组;命中账号组后,组内选择继续使用 `sequential``balanced`
2025

2126
## 2. 前端结构
2227
- `CodexAccountListFeature.tsx` 保持为 controller:
2328
- Wails/browser 数据加载
24-
- 顺序保存
29+
- Codex channel config 读取和保存
2530
- 路由探测调度
31+
- dry-run/explain 调度
2632
- modal 打开/关闭与 hash 同步
2733
- 模型映射保存编排
34+
- Account Routing Engine rollout 期间应新增共享领域:
35+
- `frontend/src/features/channel-routing/model/channelRouting.ts`
36+
- `frontend/src/features/channel-routing/model/channelRoutingValidation.ts`
37+
- `frontend/src/features/channel-routing/model/channelRoutingSelectors.ts`
38+
- `frontend/src/features/channel-routing/model/channelRoutingPreviewData.ts`
39+
- `frontend/src/features/channel-routing/components/ChannelRoutingWorkbench.tsx`
40+
- `frontend/src/features/channel-routing/components/RouteExplainPanel.tsx`
2841
- UI 组件放在 `frontend/src/features/codex/components/`
2942
- `CodexRouteProbeCard.tsx`
3043
- `CodexAccountOrderRow.tsx`
3144
- `CodexAccountDetailModal.tsx`
3245
- `ModelCombobox.tsx`
3346
- `codexAccountPresentation.ts`
3447
- 纯模型逻辑放在 `frontend/src/features/codex/model/`
35-
- `codexAccountList.ts`:账号合并、排序、优先级更新
48+
- `codexAccountList.ts`:账号合并、渠道展示排序、可请求状态
3649
- `codexModelMappings.ts`:OAuth/openai-compatible 模型映射归一
37-
- `codexRoutePolicy.ts`候选过滤、探测日志、路由状态
50+
- `codexRoutePolicy.ts`旧请求级兼容 policy、探测日志、路由状态
3851
- 不新增 catch-all helper 文件;按账号、映射、路由策略拆分。
3952

4053
## 3. 模型映射语义
@@ -47,8 +60,8 @@ description: GetTokens Codex 账号列表:账号请求顺序、路由探测、
4760

4861
## 4. 路由探测语义
4962
- `ProbeCodexAccountRouting` 使用页面传入的候选约束发起最小 relay 请求。
50-
- 前端传给后端的 `orderAccountIDs` 必须是当前拖拽排序后的可请求账号 ID 列表
51-
- `allowAccountIDs` 表示首选候选;`denyAccountIDs` 表示排除候选;`allowFallback` 只在设置允许账号后决定是否继续尝试其他未排除账号
63+
- 新主路径应优先使用 Codex channel config + dry-run/explain,展示候选池、过滤原因、排序步骤和最终选择
64+
- `orderAccountIDs / allowAccountIDs / denyAccountIDs / allowFallback` 仅作为请求级兼容探测输入,不能回写为 Codex channel config
5265
- 探测结果需要同时展示:
5366
- 终端式流输出
5467
- 当前候选顺序
@@ -59,14 +72,14 @@ description: GetTokens Codex 账号列表:账号请求顺序、路由探测、
5972
## 5. 浏览器预览
6073
- `#frame=codex&workspace=account-list` 必须可在普通浏览器预览。
6174
- 缺少 `window.go.main.App` 时使用 `previewData.ts`,不能让页面空白。
62-
- 浏览器预览中的排序、启停、模型映射保存是本地状态更新,并需要给出 preview-only 提示。
75+
- 浏览器预览中的渠道配置、排序、启停、模型映射保存是本地状态更新,并需要给出 preview-only 提示。
6376
- 视觉或交互调整要优先用浏览器预览快速验证;涉及真实 sidecar、Wails 绑定或账号命中时,再用桌面环境补验。
6477

6578
## 6. UI 规则
6679
- 保持 Swiss-industrial 风格:硬边框、黑白灰、紧凑高密度、monospace 辅助信息。
67-
- 账号行固定为单一请求顺序列表,不再额外渲染重复策略账号列表。
80+
- 账号行固定为单一 Codex 渠道顺序列表,不再额外渲染重复策略账号列表。
6881
- 账号行主体点击打开详情;嵌套按钮、switch、combobox、策略控件必须阻止冒泡。
69-
- 策略控件常驻行内:默认 / 允许 / 排除。
82+
- 新主控件应围绕 `sequential / balanced / project`、渠道组范围、项目绑定和 explain;旧“默认 / 允许 / 排除”只用于请求级兼容探测入口
7083
- 路由探测卡片独立于账号顺序卡片;测试流常驻显示,不使用卡中卡文本模块。
7184
- 请求顺序列表模式用于高密度排序,不再做卡片式信息堆叠:
7285
- 左侧 rail 固定承载顺位与拖拽柄,顺位数字和拖拽柄横向排列。
@@ -106,6 +119,10 @@ description: GetTokens Codex 账号列表:账号请求顺序、路由探测、
106119
- 后端、Wails 或 sidecar 探测调整:
107120
- `go test ./internal/wailsapp -run 'TestListOAuthModelAliases|TestUpdateOAuthModelAliases|TestProbeCodexAccountRouting|TestDetectCodexRoutingProbeHit|TestSidecarRelayRequest'`
108121
- 涉及公共 DTO 或绑定时重新生成 `frontend/wailsjs` 并跑类型检查。
122+
- Account Routing Engine rollout 额外覆盖:
123+
- Codex channel config 保存不影响 Claude channel config。
124+
- `ChannelRouteMode` 只接受 `sequential / balanced / project`
125+
- 上游兼容模式不进入 Codex 新配置保存。
109126
- 视觉截图放到 `docs-linhay/spaces/20260511-codex-account-list-tab/screenshots/<YYYYMMDD>/codex/`
110127

111128
## 9. 文档

.agents/skills/gettokens-domain-engineering/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ This skill unifies the technical rules for building, styling, and debugging GetT
112112

113113
## 3.2 Codex Workspace & Local Config Surfaces
114114
- **Codex Binary**: For Codex CLI binary version/source management, use the dedicated `gettokens-codex-binary-management` skill. Keep it as an independent binary-management business; do not merge it into account pool, local apply, usage, session, or routing flows.
115-
- **Codex Account List**: For Codex account request order, route probing, OAuth/auth-file model aliasing, openai-compatible model mappings, and `#frame=codex&workspace=account-list`, use the dedicated `gettokens-codex-account-list` skill. Keep request order semantics in that skill: draggable account order is the test order, while allow/deny only filters candidates.
115+
- **Codex Account List / Channel Routing**: For Codex account request order, route probing, OAuth/auth-file model aliasing, openai-compatible model mappings, channel route mode, project bindings, and `#frame=codex&workspace=account-list`, use the dedicated `gettokens-codex-account-list` skill. In the Account Routing Engine rollout, Codex account list is the Codex Channel Routing workspace: channel order, route mode, channel group state, project bindings, dry-run/explain, and probe are Codex-owned channel config, not global account inventory priority.
116116
- **Codex Extensions**: For Codex Skills / MCP Servers, `[[skills.config]]`, `tk://github.com` / `tk://gitlab.com` skill sources, and `#frame=codex&workspace=skills|mcp-servers`, use the dedicated `gettokens-codex-extensions-management` skill. Keep source-accurate parsing, modal/list UI semantics, and cleanup split rules in that skill instead of expanding this general domain skill.
117117
- **Claude Code Workspace Parity**: When Claude Code adds a capability that corresponds to existing Codex workspace entries, keep the workspace granularity aligned with Codex unless Claude semantics clearly require a different information architecture.
118118
- If Codex exposes separate workspaces such as `#frame=codex&workspace=skills` and `#frame=codex&workspace=mcp-servers`, Claude should expose separate workspaces such as `#frame=claude&workspace=skills` and `#frame=claude&workspace=mcp-servers`, not a single merged page with internal tabs.

0 commit comments

Comments
 (0)