@minniexcode/codex-switch 0.0.12 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.AI.md +37 -6
- package/README.CN.md +45 -11
- package/README.md +45 -13
- package/dist/app/add-provider.js +22 -24
- package/dist/app/edit-provider.js +34 -55
- package/dist/app/get-current-profile.js +15 -3
- package/dist/app/get-status.js +11 -8
- package/dist/app/list-config-profiles.js +3 -1
- package/dist/app/list-providers.js +10 -4
- package/dist/app/remove-provider.js +52 -19
- package/dist/app/run-doctor.js +29 -28
- package/dist/app/setup-codex.js +3 -3
- package/dist/app/show-config.js +3 -1
- package/dist/app/switch-provider.js +36 -5
- package/dist/cli/output.js +36 -18
- package/dist/commands/handlers.js +2 -2
- package/dist/commands/help.js +3 -3
- package/dist/commands/registry.js +35 -30
- package/dist/domain/config.js +250 -185
- package/dist/domain/providers.js +23 -0
- package/dist/domain/runtime-state.js +15 -15
- package/dist/domain/setup.js +3 -1
- package/dist/interaction/interactive.js +2 -2
- package/dist/runtime/codex-version.js +7 -0
- package/dist/storage/config-repo.js +6 -14
- package/docs/Design/codex-switch-v0.1.0-design.md +152 -0
- package/docs/Design/codex-switch-v0.1.1-design.md +33 -0
- package/docs/PRD/codex-switch-prd-v0.1.0.md +217 -205
- package/docs/Reference/codex-config-reference.md +41 -0
- package/docs/Reference/codex-config-reference.zh-CN.md +41 -0
- package/docs/Tests/testing.md +31 -78
- package/docs/cli-usage.md +86 -27
- package/docs/codex-switch-command-design.md +649 -649
- package/docs/codex-switch-product-overview.md +81 -80
- package/docs/codex-switch-technical-architecture.md +1115 -1115
- package/package.json +51 -51
|
@@ -1,205 +1,217 @@
|
|
|
1
|
-
# codex-switch `0.1.0` Release Gate PRD
|
|
2
|
-
|
|
3
|
-
## 文档信息
|
|
4
|
-
|
|
5
|
-
- 状态:Release Gate
|
|
6
|
-
- 产品名:`codex-switch`
|
|
7
|
-
- CLI 命令名:`codexs`
|
|
8
|
-
-
|
|
9
|
-
- 目标版本:`0.1.0`
|
|
10
|
-
- 文档定位:定义 `codex-switch`
|
|
11
|
-
- 关联 beta PRD:[`./codex-switch-prd-v0.0.12.md`](./codex-switch-prd-v0.0.12.md)
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`0.1.0`
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- `
|
|
41
|
-
- `
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
45
|
-
- `
|
|
46
|
-
- `
|
|
47
|
-
- `
|
|
48
|
-
- `
|
|
49
|
-
- `
|
|
50
|
-
- `
|
|
51
|
-
- `
|
|
52
|
-
- `
|
|
53
|
-
- `
|
|
54
|
-
- `
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- `
|
|
59
|
-
- `
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
- `
|
|
93
|
-
- `
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
- `
|
|
98
|
-
- `
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
codexs
|
|
112
|
-
codexs
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
codexs
|
|
122
|
-
codexs
|
|
123
|
-
codexs
|
|
124
|
-
codexs
|
|
125
|
-
codexs
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
- `
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
- `status
|
|
153
|
-
|
|
154
|
-
###
|
|
155
|
-
|
|
156
|
-
- README、README.CN、README.AI、CLI usage、product overview、PRD、changelog
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
-
|
|
190
|
-
- `
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
1
|
+
# codex-switch `0.1.0` Release Gate PRD
|
|
2
|
+
|
|
3
|
+
## 文档信息
|
|
4
|
+
|
|
5
|
+
- 状态:Release Gate
|
|
6
|
+
- 产品名:`codex-switch`
|
|
7
|
+
- CLI 命令名:`codexs`
|
|
8
|
+
- 当前稳定基线:`0.0.12`
|
|
9
|
+
- 目标版本:`0.1.0`
|
|
10
|
+
- 文档定位:定义 `codex-switch` 第一次稳定发布前必须满足的门槛
|
|
11
|
+
- 关联 beta PRD:[`./codex-switch-prd-v0.0.12.md`](./codex-switch-prd-v0.0.12.md)
|
|
12
|
+
- 关联实现约束设计:[`../Design/codex-switch-v0.1.0-design.md`](../Design/codex-switch-v0.1.0-design.md)
|
|
13
|
+
- 关联长期演进稿:[`./codex-switch-prd-v0.0.5-to-v0.1.0.md`](./codex-switch-prd-v0.0.5-to-v0.1.0.md)
|
|
14
|
+
|
|
15
|
+
## 1. 定位
|
|
16
|
+
|
|
17
|
+
`0.1.0` 是 `codex-switch` 的第一条稳定发布线,不是继续扩 feature surface 的版本,也不是把 `0.0.12` 再包装一次。
|
|
18
|
+
|
|
19
|
+
这个版本的判断标准只有一个:当前仓库已经足够稳定,能把命令面、输出契约、主工作流、诊断语义和文档事实对外固定下来,并且不需要再依赖开发期解释来“补全理解”。
|
|
20
|
+
|
|
21
|
+
## 2. 当前阻塞项
|
|
22
|
+
|
|
23
|
+
以下问题仍然阻止 `0.1.0` 成为真正可发布的稳定版本:
|
|
24
|
+
|
|
25
|
+
1. `tests/` 被忽略,导致测试无法被版本化和审阅。
|
|
26
|
+
2. README 里仍有失效的 `docs/Tests/testing.md` 链接,用户会直接遇到死链。
|
|
27
|
+
3. 版本叙事仍停留在 `0.0.12`,对外材料没有把 `0.1.0` 讲成稳定发布线。
|
|
28
|
+
4. 发布故事和实现状态还没有完全对齐,尤其是主工作流、`migrate` 定位和 `setup` 定位。
|
|
29
|
+
|
|
30
|
+
这些阻塞项必须先被收口,`0.1.0` 才能成立。
|
|
31
|
+
|
|
32
|
+
## 3. `0.1.0` 的稳定合同
|
|
33
|
+
|
|
34
|
+
`0.1.0` 必须把以下内容视为稳定合同,不再当作可随意重写的草案。
|
|
35
|
+
|
|
36
|
+
### 3.1 命令面
|
|
37
|
+
|
|
38
|
+
稳定命令面包括:
|
|
39
|
+
|
|
40
|
+
- `init`
|
|
41
|
+
- `login`
|
|
42
|
+
- `list`
|
|
43
|
+
- `show`
|
|
44
|
+
- `current`
|
|
45
|
+
- `status`
|
|
46
|
+
- `doctor`
|
|
47
|
+
- `config show`
|
|
48
|
+
- `config list-profiles`
|
|
49
|
+
- `add`
|
|
50
|
+
- `edit`
|
|
51
|
+
- `switch`
|
|
52
|
+
- `remove`
|
|
53
|
+
- `import`
|
|
54
|
+
- `export`
|
|
55
|
+
- `bridge start`
|
|
56
|
+
- `bridge status`
|
|
57
|
+
- `bridge stop`
|
|
58
|
+
- `backups list`
|
|
59
|
+
- `rollback`
|
|
60
|
+
|
|
61
|
+
其中:
|
|
62
|
+
|
|
63
|
+
- `migrate` 只能是高级 adopt helper。
|
|
64
|
+
- `setup` 只能是 deprecated entry。
|
|
65
|
+
|
|
66
|
+
### 3.2 `--json` envelope
|
|
67
|
+
|
|
68
|
+
`--json` 的顶层 envelope 必须保持不变:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"ok": true,
|
|
73
|
+
"command": "list",
|
|
74
|
+
"data": {},
|
|
75
|
+
"warnings": [],
|
|
76
|
+
"error": null
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
约束如下:
|
|
81
|
+
|
|
82
|
+
- 顶层字段名不变。
|
|
83
|
+
- 顶层字段顺序和 shape 不变。
|
|
84
|
+
- 新信息只能继续追加到 `data`、`warnings` 或 `error.details`。
|
|
85
|
+
|
|
86
|
+
### 3.3 dual-path model
|
|
87
|
+
|
|
88
|
+
`0.1.0` 必须把以下分层固定为正式合同:
|
|
89
|
+
|
|
90
|
+
- tool home:
|
|
91
|
+
- `codex-switch.json`
|
|
92
|
+
- `providers.json`
|
|
93
|
+
- `backups/`
|
|
94
|
+
- `runtime/`
|
|
95
|
+
- `runtimes/`
|
|
96
|
+
- target Codex runtime:
|
|
97
|
+
- `config.toml`
|
|
98
|
+
- `auth.json`
|
|
99
|
+
|
|
100
|
+
含义必须稳定:
|
|
101
|
+
|
|
102
|
+
- `providers.json` 是管理态 SSOT。
|
|
103
|
+
- `config.toml` 是受管 runtime routing 文件。
|
|
104
|
+
- `auth.json` 是受管 auth projection 文件。
|
|
105
|
+
|
|
106
|
+
### 3.4 主工作流
|
|
107
|
+
|
|
108
|
+
Direct provider 主路径:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
codexs init
|
|
112
|
+
codexs add <provider> --profile <name> --api-key <key>
|
|
113
|
+
codexs switch <provider>
|
|
114
|
+
codexs status
|
|
115
|
+
codexs doctor
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Copilot provider 主路径:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
codexs init
|
|
122
|
+
codexs login copilot
|
|
123
|
+
codexs add <provider> --copilot --profile <name>
|
|
124
|
+
codexs switch <provider>
|
|
125
|
+
codexs status
|
|
126
|
+
codexs doctor
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`migrate` 的定位必须明确为:
|
|
130
|
+
|
|
131
|
+
- 面向已有 runtime state 的高级 adopt helper。
|
|
132
|
+
- 不应与 fresh install 主路径混淆。
|
|
133
|
+
- 不应被写成所有新用户都应先执行的默认步骤。
|
|
134
|
+
|
|
135
|
+
## 4. Release Gate
|
|
136
|
+
|
|
137
|
+
只有以下条件全部满足,才允许发布 `0.1.0`。
|
|
138
|
+
|
|
139
|
+
### 4.1 工作流
|
|
140
|
+
|
|
141
|
+
- fresh tool home 下 direct provider 主路径可稳定走通。
|
|
142
|
+
- fresh tool home 下 Copilot 主路径可稳定走通。
|
|
143
|
+
- `switch` 的成功语义仍然等于 config 和 auth projection 都正确。
|
|
144
|
+
- `rollback` 对受管写操作仍然可信。
|
|
145
|
+
|
|
146
|
+
### 4.2 输出与语义
|
|
147
|
+
|
|
148
|
+
- `--json` 读命令输出稳定。
|
|
149
|
+
- 非交互模式不会意外触发 prompt。
|
|
150
|
+
- 错误码和 issue code 对常见失败场景足够稳定。
|
|
151
|
+
- `status` 与 `doctor` 能清楚说明下一步修复动作。
|
|
152
|
+
- `list`、`status`、`doctor` 的人类可读输出和交互提示一致。
|
|
153
|
+
|
|
154
|
+
### 4.3 文档
|
|
155
|
+
|
|
156
|
+
- README、README.CN、README.AI、CLI usage、product overview、PRD、design 和 changelog 与实际行为一致。
|
|
157
|
+
- `docs/Tests/testing.md` 不能继续停留在忽略状态,测试回归必须落仓库并可版本化。
|
|
158
|
+
- 主路径在所有面向用户的文档中必须一致。
|
|
159
|
+
- `0.1.0` 的定位必须压过旧的 `0.0.12` 叙事。
|
|
160
|
+
|
|
161
|
+
### 4.4 包内容
|
|
162
|
+
|
|
163
|
+
- `npm pack --dry-run` 结果合理。
|
|
164
|
+
- tarball 中包含正确的 README、LICENSE、docs、dist。
|
|
165
|
+
- `codexs --help`、`codexs --version`、安装指引与 npm 包元数据一致。
|
|
166
|
+
|
|
167
|
+
### 4.5 结构
|
|
168
|
+
|
|
169
|
+
- 不再保留明显误导性的历史目录语义。
|
|
170
|
+
- 稳定模块的边界说明足够清楚。
|
|
171
|
+
- 新问题不再需要反复回到超大入口文件修补。
|
|
172
|
+
|
|
173
|
+
## 5. 可执行验证清单
|
|
174
|
+
|
|
175
|
+
`0.1.0` 的发布前验证必须至少覆盖以下项目:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npm run build
|
|
179
|
+
npm test
|
|
180
|
+
npx tsc --noEmit
|
|
181
|
+
npm pack --dry-run
|
|
182
|
+
node dist/cli.js --help
|
|
183
|
+
node dist/cli.js --version
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
同时必须做以下行为验证:
|
|
187
|
+
|
|
188
|
+
- fresh direct provider flow。
|
|
189
|
+
- fresh Copilot provider flow。
|
|
190
|
+
- `list/status/doctor` 语义检查。
|
|
191
|
+
- `--json` 输出检查。
|
|
192
|
+
- `migrate` 作为高级 adopt helper 的检查。
|
|
193
|
+
- `setup` 作为 deprecated entry 的检查。
|
|
194
|
+
|
|
195
|
+
## 6. 明确不在范围内
|
|
196
|
+
|
|
197
|
+
`0.1.0` 不要求完成以下内容:
|
|
198
|
+
|
|
199
|
+
- 新 upstream。
|
|
200
|
+
- GUI / TUI。
|
|
201
|
+
- daemon。
|
|
202
|
+
- plugin system。
|
|
203
|
+
- auto migration。
|
|
204
|
+
- 兼容层。
|
|
205
|
+
- dual-read / dual-write。
|
|
206
|
+
- `migrate` 的完整非交互产品化。
|
|
207
|
+
- 旧状态的自动升级保留逻辑。
|
|
208
|
+
|
|
209
|
+
## 7. 若 Gate 未通过
|
|
210
|
+
|
|
211
|
+
如果任何阻塞项仍然存在,就不要强行发布 `0.1.0`。
|
|
212
|
+
|
|
213
|
+
此时应继续发布 beta 或 rc 版本,而不是为了版本号好看提前进入稳定线。
|
|
214
|
+
|
|
215
|
+
## 8. 结论
|
|
216
|
+
|
|
217
|
+
`0.1.0` 的本质不是“功能更多”,而是“承诺更稳”。当命令面、输出契约、主工作流、诊断语义、包内容和文档事实完全一致时,这个版本号才成立。
|
|
@@ -137,6 +137,12 @@ model_reasoning_effort = "high"
|
|
|
137
137
|
approval_policy = "never"
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
+
Important `codex-switch` note:
|
|
141
|
+
|
|
142
|
+
- official Codex still supports profiles
|
|
143
|
+
- `codex-switch` `0.1.1` does not treat top-level `profile` as the recommended managed runtime selector
|
|
144
|
+
- in `codex-switch`, legacy `profile` and `[profiles.*]` are mainly inspect-and-adopt inputs for `migrate`, `doctor`, and `config` inspection flows
|
|
145
|
+
|
|
140
146
|
## 4. `config.toml` by topic
|
|
141
147
|
|
|
142
148
|
### 4.1 Model, reasoning, and response style
|
|
@@ -194,6 +200,8 @@ Core keys:
|
|
|
194
200
|
- `model_providers.<id>.env_http_headers`
|
|
195
201
|
- `model_providers.<id>.query_params`
|
|
196
202
|
- `model_providers.<id>.request_max_retries`
|
|
203
|
+
- `model_providers.<id>.wire_api`
|
|
204
|
+
- `model_providers.<id>.requires_openai_auth`
|
|
197
205
|
|
|
198
206
|
Authentication options for custom providers include:
|
|
199
207
|
|
|
@@ -214,6 +222,22 @@ Related Bedrock keys:
|
|
|
214
222
|
- `model_providers.amazon-bedrock.aws.profile`
|
|
215
223
|
- `model_providers.amazon-bedrock.aws.region`
|
|
216
224
|
|
|
225
|
+
#### `codex-switch` 0.1.1 managed projection
|
|
226
|
+
|
|
227
|
+
When `codex-switch` manages a direct OpenAI-compatible route for Codex `0.134.0+`, it intentionally projects a narrower runtime shape than the full official provider schema:
|
|
228
|
+
|
|
229
|
+
- top-level `model` is the active model selector
|
|
230
|
+
- top-level `model_provider` is the active route selector
|
|
231
|
+
- projected `[model_providers.<id>]` keeps `base_url`
|
|
232
|
+
- projected `[model_providers.<id>]` fixes `wire_api = "responses"`
|
|
233
|
+
- projected `[model_providers.<id>]` fixes `requires_openai_auth = true`
|
|
234
|
+
- projected runtime config does not keep `env_key`
|
|
235
|
+
- projected runtime config does not keep `env_key_instructions`
|
|
236
|
+
|
|
237
|
+
Authentication is projected through `auth.json` with `OPENAI_API_KEY`, not through `env_key` in the managed runtime config.
|
|
238
|
+
|
|
239
|
+
That is a `codex-switch` product decision, not a limitation of Codex itself. If you hand-write or independently manage Codex config, `env_key` remains a valid official mechanism.
|
|
240
|
+
|
|
217
241
|
### 4.3.1 `openai_base_url` vs custom providers
|
|
218
242
|
|
|
219
243
|
If you only want to point the built-in OpenAI provider to a proxy, router, or residency-specific endpoint, use:
|
|
@@ -539,6 +563,23 @@ env_key = "OPENAI_API_KEY"
|
|
|
539
563
|
http_headers = { "X-Team" = "platform" }
|
|
540
564
|
```
|
|
541
565
|
|
|
566
|
+
This is an official Codex-style custom provider example.
|
|
567
|
+
|
|
568
|
+
If you are using `codex-switch` managed direct-provider projection instead, the runtime projection is intentionally narrower:
|
|
569
|
+
|
|
570
|
+
```toml
|
|
571
|
+
model = "gpt-5.4"
|
|
572
|
+
model_provider = "proxy"
|
|
573
|
+
|
|
574
|
+
[model_providers.proxy]
|
|
575
|
+
name = "proxy"
|
|
576
|
+
base_url = "https://proxy.example.com/v1"
|
|
577
|
+
wire_api = "responses"
|
|
578
|
+
requires_openai_auth = true
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
In that managed projection, `OPENAI_API_KEY` is expected in `auth.json` rather than through `env_key` in `config.toml`.
|
|
582
|
+
|
|
542
583
|
### 6.4 Locked-down shell environment
|
|
543
584
|
|
|
544
585
|
```toml
|
|
@@ -149,6 +149,12 @@ model_reasoning_effort = "high"
|
|
|
149
149
|
approval_policy = "never"
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
+
对 `codex-switch` 0.1.1 的补充说明:
|
|
153
|
+
|
|
154
|
+
- 官方 Codex 仍然支持 profiles
|
|
155
|
+
- `codex-switch` 不再把顶层 `profile` 视为推荐的受管 runtime selector
|
|
156
|
+
- 在 `codex-switch` 里,legacy `profile` 和 `[profiles.*]` 主要用于 `migrate`、`doctor` 和 `config` 检视的 adopt / inspect 场景
|
|
157
|
+
|
|
152
158
|
## 4. `config.toml` 主题整理
|
|
153
159
|
|
|
154
160
|
### 4.1 模型、推理强度与输出风格
|
|
@@ -206,6 +212,8 @@ Codex 把“当前使用哪个 provider”和“provider 怎么定义”拆开
|
|
|
206
212
|
- `model_providers.<id>.env_http_headers`
|
|
207
213
|
- `model_providers.<id>.query_params`
|
|
208
214
|
- `model_providers.<id>.request_max_retries`
|
|
215
|
+
- `model_providers.<id>.wire_api`
|
|
216
|
+
- `model_providers.<id>.requires_openai_auth`
|
|
209
217
|
|
|
210
218
|
自定义 provider 的认证方式包括:
|
|
211
219
|
|
|
@@ -229,6 +237,22 @@ Bedrock 相关 key:
|
|
|
229
237
|
- `model_providers.amazon-bedrock.aws.profile`
|
|
230
238
|
- `model_providers.amazon-bedrock.aws.region`
|
|
231
239
|
|
|
240
|
+
#### `codex-switch` 0.1.1 的受管投影
|
|
241
|
+
|
|
242
|
+
当 `codex-switch` 为 Codex `0.134.0+` 管理一个 direct OpenAI-compatible route 时,它会有意把运行态投影限制在一组更窄的字段上:
|
|
243
|
+
|
|
244
|
+
- 顶层 `model` 是活动模型选择器
|
|
245
|
+
- 顶层 `model_provider` 是活动路由选择器
|
|
246
|
+
- 投影后的 `[model_providers.<id>]` 保留 `base_url`
|
|
247
|
+
- 投影后的 `[model_providers.<id>]` 固定写 `wire_api = "responses"`
|
|
248
|
+
- 投影后的 `[model_providers.<id>]` 固定写 `requires_openai_auth = true`
|
|
249
|
+
- 受管运行态投影不会保留 `env_key`
|
|
250
|
+
- 受管运行态投影不会保留 `env_key_instructions`
|
|
251
|
+
|
|
252
|
+
认证信息会通过 `auth.json` 里的 `OPENAI_API_KEY` 投影,而不是通过运行态 `config.toml` 中的 `env_key`。
|
|
253
|
+
|
|
254
|
+
这属于 `codex-switch` 的产品约束,不是 Codex 官方能力限制。如果你是手工维护或独立维护 Codex config,`env_key` 仍然是官方支持的方式。
|
|
255
|
+
|
|
232
256
|
### 4.3.1 `openai_base_url` 和自定义 provider 的区别
|
|
233
257
|
|
|
234
258
|
如果你只是想把内置 `openai` provider 指向公司网关、路由层或者某个数据驻留 endpoint,官方建议直接用:
|
|
@@ -568,6 +592,23 @@ env_key = "OPENAI_API_KEY"
|
|
|
568
592
|
http_headers = { "X-Team" = "platform" }
|
|
569
593
|
```
|
|
570
594
|
|
|
595
|
+
这段是官方 Codex 风格的自定义 provider 示例。
|
|
596
|
+
|
|
597
|
+
如果你走的是 `codex-switch` 的受管 direct-provider 投影,运行态会被有意收窄为:
|
|
598
|
+
|
|
599
|
+
```toml
|
|
600
|
+
model = "gpt-5.4"
|
|
601
|
+
model_provider = "proxy"
|
|
602
|
+
|
|
603
|
+
[model_providers.proxy]
|
|
604
|
+
name = "proxy"
|
|
605
|
+
base_url = "https://proxy.example.com/v1"
|
|
606
|
+
wire_api = "responses"
|
|
607
|
+
requires_openai_auth = true
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
在这种受管投影下,`OPENAI_API_KEY` 预期写在 `auth.json`,而不是通过 `config.toml` 里的 `env_key` 暴露。
|
|
611
|
+
|
|
571
612
|
### 6.4 最小暴露的 shell 环境策略
|
|
572
613
|
|
|
573
614
|
```toml
|
package/docs/Tests/testing.md
CHANGED
|
@@ -1,78 +1,31 @@
|
|
|
1
|
-
# Testing Guide
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- `
|
|
32
|
-
- `doctor --json`
|
|
33
|
-
|
|
34
|
-
Primary workflow checks:
|
|
35
|
-
|
|
36
|
-
- fresh tool home direct path
|
|
37
|
-
- fresh tool home Copilot path
|
|
38
|
-
- read commands in `--json`
|
|
39
|
-
- write commands in sandbox
|
|
40
|
-
|
|
41
|
-
Specific `0.0.12` checks:
|
|
42
|
-
|
|
43
|
-
- top-level help shows direct primary workflow before `migrate`
|
|
44
|
-
- `migrate` is clearly presented as advanced adopt
|
|
45
|
-
- `setup` remains deprecation-only
|
|
46
|
-
- human-readable `init` output shows tool home, tool config, and providers registry
|
|
47
|
-
- human-readable `status` output shows tool home and target runtime
|
|
48
|
-
- human-readable `doctor` output is repair-oriented
|
|
49
|
-
- `--version` matches `package.json.version`
|
|
50
|
-
|
|
51
|
-
## Test Limits
|
|
52
|
-
|
|
53
|
-
- `login copilot` depends on SDK install, official CLI invocation, and auth recheck. Automation should distinguish mocked coverage from real-environment validation.
|
|
54
|
-
- `migrate` remains intentionally interactive for adopt detail collection. Non-interactive tests should verify the current failure contract rather than force a fake full automation path.
|
|
55
|
-
|
|
56
|
-
## Reporting Template
|
|
57
|
-
|
|
58
|
-
```text
|
|
59
|
-
Version under test: 0.0.12
|
|
60
|
-
Build: PASS/FAIL
|
|
61
|
-
Suite results:
|
|
62
|
-
- commands: PASS/FAIL
|
|
63
|
-
- cli-e2e: PASS/FAIL
|
|
64
|
-
- interaction: PASS/FAIL
|
|
65
|
-
- runtime: PASS/FAIL
|
|
66
|
-
- workflows: PASS/FAIL
|
|
67
|
-
|
|
68
|
-
Release checks:
|
|
69
|
-
- help/version: PASS/FAIL
|
|
70
|
-
- direct path: PASS/FAIL
|
|
71
|
-
- copilot path: PASS/FAIL
|
|
72
|
-
- json reads: PASS/FAIL
|
|
73
|
-
- sandbox writes: PASS/FAIL
|
|
74
|
-
|
|
75
|
-
Open risks:
|
|
76
|
-
- <risk 1>
|
|
77
|
-
- <risk 2>
|
|
78
|
-
```
|
|
1
|
+
# codex-switch Testing Guide
|
|
2
|
+
|
|
3
|
+
This guide records the release gate for `0.1.0`.
|
|
4
|
+
|
|
5
|
+
## Required checks
|
|
6
|
+
|
|
7
|
+
Run these commands before publishing or reviewing release changes:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm run build
|
|
11
|
+
npm test
|
|
12
|
+
npx tsc --noEmit
|
|
13
|
+
npm pack --dry-run
|
|
14
|
+
node dist/cli.js --help
|
|
15
|
+
node dist/cli.js --version
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Release scenarios
|
|
19
|
+
|
|
20
|
+
- Fresh direct-provider flow: `init -> add -> switch -> status -> doctor`
|
|
21
|
+
- Fresh Copilot flow: `init -> login copilot -> add --copilot -> switch -> status -> doctor`
|
|
22
|
+
- Ambiguous active profile: `list`, `status`, and provider pickers must surface ambiguity instead of inventing a unique current provider
|
|
23
|
+
- `--json` envelope: top-level `ok`, `command`, `data`, `warnings`, and `error` must remain stable
|
|
24
|
+
- `migrate`: advanced adopt helper only
|
|
25
|
+
- `setup`: deprecated entry only
|
|
26
|
+
|
|
27
|
+
## Fixture guidance
|
|
28
|
+
|
|
29
|
+
- Prefer isolated temp directories for mutating tests.
|
|
30
|
+
- Keep fixtures small and realistic.
|
|
31
|
+
- Use `dev-codex/local-sandbox` only when a test needs a representative Codex directory layout.
|