zcode-app-cli 3.11.2-24 → 3.12.3-26
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.md +35 -8
- package/bin/zcode.js +265 -133
- package/docs/CONFIGURATION.md +387 -0
- package/docs/CONFIGURATION.zh-CN.md +324 -0
- package/docs/PROVIDER_CONFIG.md +271 -0
- package/docs/PROVIDER_CONFIG.zh-CN.md +245 -0
- package/package.json +15 -6
- package/provider.example.json +151 -0
- package/{config.example.json → setting.example.json} +0 -47
- package/vendor/cli-config.cjs +161 -0
- package/vendor/extraction.json +17 -4
- package/vendor/node_modules/@zcode/tui/dist/index.js +495 -1095
- package/vendor/packages/browser-use-plugin/dist/mcp/server.js +35543 -34422
- package/vendor/packages/document-skills-plugin/.zcode-plugin/plugin.json +2 -2
- package/vendor/packages/document-skills-plugin/package.json +4 -4
- package/vendor/packages/document-skills-plugin/skills/docx/SKILL.md +34 -0
- package/vendor/packages/document-skills-plugin/skills/docx/references/docx-js-advanced.md +9 -0
- package/vendor/packages/document-skills-plugin/skills/docx/routes/edit.md +11 -0
- package/vendor/packages/document-skills-plugin/skills/docx/routes/format.md +7 -0
- package/vendor/packages/document-skills-plugin/skills/docx/routes/read.md +7 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/SKILL.md +10 -1
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/process.md +19 -4
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/env_check.sh +6 -2
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup.md +12 -3
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_mac_linux.sh +9 -3
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_windows.ps1 +8 -3
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/pdf.py +30 -6
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/setup.sh +9 -3
- package/vendor/packages/document-skills-plugin/skills/pptx/SKILL.md +33 -0
- package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/setup.md +29 -4
- package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/setup_mac_linux.sh +8 -3
- package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/setup_windows.ps1 +8 -3
- package/vendor/packages/document-skills-plugin/skills/xlsx/quality/pipeline.md +9 -0
- package/vendor/packages/document-skills-plugin/skills/xlsx/setup.sh +8 -3
- package/vendor/packages/document-skills-plugin/skills/xlsx/xlsx.py +15 -1
- package/vendor/packages/restore-legacy-sessions-plugin/skills/restore-legacy-sessions/scripts/restore-conversation.mjs +13 -8
- package/vendor/provider/zcode-builtin.json +6296 -0
- package/vendor/zcode.cjs +1159 -840
- package/zcode-runtime.lock.json +3 -3
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# 配置说明
|
|
2
|
+
|
|
3
|
+
[English](CONFIGURATION.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
CLI 跟随当前 ZCode runtime 的 provider registry schema。通用运行设置与 provider 配置
|
|
6
|
+
分别存储;模型配置中的“智能配置”对应英文界面的 **Smart configuration**。
|
|
7
|
+
|
|
8
|
+
## 配置文件
|
|
9
|
+
|
|
10
|
+
| 文件 | 用途 |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| `~/.zcode/cli/setting.json` | CLI 主题、通知、工具、存储和其他运行设置 |
|
|
13
|
+
| `~/.zcode/v2/setting.json` | 桌面端已有的语言和记忆偏好,CLI 只读不修改 |
|
|
14
|
+
| `~/.zcode/v2/provider_config.json` | Provider、模型元数据覆盖和默认模型 |
|
|
15
|
+
| `~/.zcode/v2/credentials.json` | 原生 runtime 持久化的凭证 |
|
|
16
|
+
|
|
17
|
+
Windows 使用 `%USERPROFILE%` 代替 `~`。Provider 文件默认与桌面端共用,修改 provider
|
|
18
|
+
或已保存的默认模型会影响两个客户端;`/model` 只切换当前 CLI 会话。
|
|
19
|
+
|
|
20
|
+
设置 `ZCODE_PERSONAL_PROVIDER_CONFIG_FILE` 可使用独立的 provider 文件。
|
|
21
|
+
`ZCODE_DATA_BASE_DIR` 改变原生 runtime 的基础目录,包括 provider 和凭证存储。
|
|
22
|
+
CLI 通用设置仍使用用户目录中的 `~/.zcode/cli/setting.json`。
|
|
23
|
+
|
|
24
|
+
首次启动时,CLI 根据不含凭证的 [`setting.example.json`](../setting.example.json)
|
|
25
|
+
创建通用设置,不覆盖已有文件。Provider 配置由原生登录创建,或参考
|
|
26
|
+
[`provider.example.json`](../provider.example.json) 填写。
|
|
27
|
+
[Provider 配置字段参考](PROVIDER_CONFIG.zh-CN.md) 列出了全部个人配置字段、桌面端字段对应关系
|
|
28
|
+
及上游目录继承规则。
|
|
29
|
+
|
|
30
|
+
## 启动迁移
|
|
31
|
+
|
|
32
|
+
CLI 参考桌面端迁移规则,使用 runtime 的原生解析器和带文件锁的 provider 仓库。
|
|
33
|
+
桌面端在首次创建原生文件时导入旧 provider;由于共享文件可能已经存在,CLI 启动时会额外
|
|
34
|
+
执行一次从 `~/.zcode/cli/config.json` 到共享文件的合并。
|
|
35
|
+
|
|
36
|
+
只添加缺失的个人 provider ID,保留已有 provider 定义、模型覆盖、排序和共享默认选择。
|
|
37
|
+
账号 provider 和加密密钥不参与导入;已删除的模型也不导入。模型 ID 与 provider 别名
|
|
38
|
+
由上游解析器规范化,不支持的 provider 配置会记为跳过。
|
|
39
|
+
|
|
40
|
+
CLI 专属字段迁移到 `~/.zcode/cli/setting.json`,省略 provider、main/lite 和目录覆盖字段。
|
|
41
|
+
旧文件保留原样。`~/.zcode/cli/migrations/` 中按目标 provider 文件记录完成标记,防止后续
|
|
42
|
+
启动恢复用户已删除的 provider。独立的 `settings-v1.json` 标记防止重置新设置文件后
|
|
43
|
+
再次导入旧设置。
|
|
44
|
+
|
|
45
|
+
旧文件不作为运行时配置 fallback。新文件无效时会报告错误,不会用旧设置替换它。
|
|
46
|
+
|
|
47
|
+
## 设置归属与优先级
|
|
48
|
+
|
|
49
|
+
| 设置或操作 | 读写行为 |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| Provider 和模型元数据 | 共享的原生 `provider_config.json` |
|
|
52
|
+
| `/settings` 中的默认模型 | 写入共享默认选择,并应用到当前会话 |
|
|
53
|
+
| `/model`、模型循环切换、推理强度 | 修改并保存当前会话选择,不改共享默认值 |
|
|
54
|
+
| `/new` | 读取当前共享默认模型 |
|
|
55
|
+
| 恢复会话/重启 | 恢复该会话保存的模型和推理选项 |
|
|
56
|
+
| 语言与记忆 | 读取桌面端 `localePreference`/`memoryEnabled`,显式 CLI 设置优先 |
|
|
57
|
+
| 主题、终端布局、选中复制、通知 | CLI `setting.json` |
|
|
58
|
+
| 工具权限、重试、流超时、CLI 插件/MCP 等运行设置 | CLI `setting.json`,保留原生项目和环境配置优先级 |
|
|
59
|
+
| 更新缓存、诊断日志、迁移状态 | CLI 目录下的运行文件 |
|
|
60
|
+
|
|
61
|
+
CLI 不向桌面端的 `setting.json` 增加字段。通知和显示设置只写 CLI 文件。
|
|
62
|
+
共享偏好在加载 runtime 设置时生效,不会因修改其他 CLI 选项而被复制进 CLI 设置。
|
|
63
|
+
|
|
64
|
+
## 模型目录与默认选择
|
|
65
|
+
|
|
66
|
+
原生 registry 加载随包提供的目录,并管理上游目录刷新。`/model`、模型循环切换以及
|
|
67
|
+
**设置 > Model providers** 会从配置源刷新当前 registry,保留当前会话。
|
|
68
|
+
CLI 不再维护独立的旧版模型目录缓存。
|
|
69
|
+
|
|
70
|
+
Provider 文件中的 `config.defaultModelSelection` 决定新会话使用的模型。
|
|
71
|
+
`/settings` 通过原生仓库保存该选择并应用到当前会话;`/model provider/model` 只切换
|
|
72
|
+
当前会话。恢复的会话可以继续使用它自己保存的选择。
|
|
73
|
+
|
|
74
|
+
保存的选择未指定推理选项时,runtime 使用该模型的目录默认值补齐。
|
|
75
|
+
已经明确选择的推理强度会保留。
|
|
76
|
+
|
|
77
|
+
## 首次设置
|
|
78
|
+
|
|
79
|
+
第一次交互启动会显示设置向导,可选择 **Sign in**、**Custom provider** 或 **Skip for now**。
|
|
80
|
+
使用 `/setup` 可以重新打开。通用配置旁的 `setup-pending` 标记在非交互命令后仍会保留,
|
|
81
|
+
成功配置或明确跳过后才会清除。已有原生 provider 配置会被直接识别,无需单独导入桌面端配置。
|
|
82
|
+
|
|
83
|
+
## 模型访问
|
|
84
|
+
|
|
85
|
+
- **macOS 上的 Z.AI OAuth:** 使用 `zcode login`;`zcode login --oauth` 强制重新授权。
|
|
86
|
+
`--no-browser` 只输出授权链接。
|
|
87
|
+
- **Z.AI/BigModel Coding Plan API Key:** 打开 `/login`,选择掩码输入的 API Key 选项。
|
|
88
|
+
凭证和 provider 的保存由官方 runtime 负责。
|
|
89
|
+
- **自定义 provider:** 直接配置原生 provider 文件,可使用自定义 ID,无需额外 OAuth 登录。
|
|
90
|
+
|
|
91
|
+
普通的 `zcode login` 会识别已经配置的原生默认模型并提示配置路径。
|
|
92
|
+
本地仅检查配置是否存在,凭证校验与解密由 runtime 负责。
|
|
93
|
+
|
|
94
|
+
macOS OAuth 会临时注册回调接收器、校验 `state`,恢复原来的 `zcode://` 处理程序,并通过
|
|
95
|
+
stdin 把回调交给 runtime。Runtime 交换令牌、保存加密凭证、解析 Coding Plan API Key,
|
|
96
|
+
再保存原生默认模型;TUI 随后重新读取 provider 配置。BigModel 使用 runtime 的 localhost 回调。
|
|
97
|
+
|
|
98
|
+
## 自定义 Provider
|
|
99
|
+
|
|
100
|
+
`provider.example.json` 中启用的模型自动继承上游目录,禁用的参考模型分别展示智能覆盖和
|
|
101
|
+
手动配置的全部字段。填写空 API Key、替换占位 ID 和地址,并删除不需要的参考条目。
|
|
102
|
+
已有文件应合并修改,保留其他规则和选择。
|
|
103
|
+
|
|
104
|
+
最小配置结构如下:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"schemaVersion": 1,
|
|
109
|
+
"config": {
|
|
110
|
+
"providerConfigRules": {
|
|
111
|
+
"providerRules": [
|
|
112
|
+
{
|
|
113
|
+
"providerId": "custom",
|
|
114
|
+
"providerName": "Custom provider",
|
|
115
|
+
"config": {
|
|
116
|
+
"group": "standard-personal",
|
|
117
|
+
"access": { "type": "api-key", "apiKey": "YOUR_API_KEY" },
|
|
118
|
+
"api": {
|
|
119
|
+
"type": "openai-chat-completions",
|
|
120
|
+
"baseUrl": "https://api.example.com/v1"
|
|
121
|
+
},
|
|
122
|
+
"personalModelIds": ["your-model-id"]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"modelConfigRules": {
|
|
128
|
+
"providerModelRules": [],
|
|
129
|
+
"manualProviderModelRules": []
|
|
130
|
+
},
|
|
131
|
+
"defaultModelSelection": {
|
|
132
|
+
"providerId": "custom",
|
|
133
|
+
"modelId": "your-model-id"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Anthropic 兼容接口使用 `anthropic-messages`,Chat Completions 使用
|
|
140
|
+
`openai-chat-completions`,Responses API 使用 `openai-responses`。
|
|
141
|
+
`baseUrl` 是 API 根地址;模型 ID 区分大小写,引用格式为 `providerId/modelId`。
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
/model custom/your-model-id
|
|
145
|
+
/settings
|
|
146
|
+
/new
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
原生目录提供已知模型的上下文、推理选项及输入输出能力。自定义覆盖写在
|
|
150
|
+
`modelConfigRules` 下,包括 `properties.contextWindow`、`properties.inputFormat`
|
|
151
|
+
和 `optionSpecs`。图片、视频及 PDF 支持以所选模型的 registry 元数据为准。
|
|
152
|
+
|
|
153
|
+
桌面端三个能力开关分别对应 `properties.supportsJsonSchemaOutput`、
|
|
154
|
+
`supportsNativeWebSearch`、`supportsMidConversationSystem`。最大输出 Token 是
|
|
155
|
+
`optionSpecs.maxOutputTokens.max`,与上下文容量不同;请求参数映射写在对应选项的
|
|
156
|
+
`map` 字符串中。完整说明见 [Provider 字段参考](PROVIDER_CONFIG.zh-CN.md)。
|
|
157
|
+
|
|
158
|
+
上游目录更新后,智能配置模型会自动继承新的能力与参数规格;只有显式个人覆盖保持固定。
|
|
159
|
+
同步 runtime 会复制完整目录,`/model` 会刷新实时 registry,不必把上游能力值逐个写进个人文件。
|
|
160
|
+
|
|
161
|
+
## 权限模式与计划状态
|
|
162
|
+
|
|
163
|
+
CLI 与桌面端一样提供三种权限模式:`build`(变更前确认)、`edit`(自动编辑)、
|
|
164
|
+
`yolo`(完全访问)。`/mode` 打开选择器,Shift+Tab 在三种模式间循环。
|
|
165
|
+
底层的 `auto` 值不作为菜单选项。
|
|
166
|
+
|
|
167
|
+
`/plan` 独立切换计划开关,也可以用 `/plan on`、`/plan off` 明确指定状态。
|
|
168
|
+
切换权限不会改变 Plan 开关,切换 Plan 也不会改变权限。验证由原生 runtime 负责,
|
|
169
|
+
包括 Plan 与进行中的 Goal 不可同时开启的限制。
|
|
170
|
+
|
|
171
|
+
Plan 开启时,在输入框上边框右端显示 `Plan`,不增加行数;空编辑器会显示规划提示。
|
|
172
|
+
状态栏始终显示权限模式,`/status` 分别列出 Mode 和 Plan。
|
|
173
|
+
标签跟随原生状态变化,包括批准计划、新会话及恢复会话,不额外写入 CLI Plan 偏好。
|
|
174
|
+
|
|
175
|
+
## 发送前的访问检查
|
|
176
|
+
|
|
177
|
+
新的无界面提示和普通 TUI 输入会在开始模型请求前,检查明显缺少 provider 配置或
|
|
178
|
+
显式缺少 API Key 的情况。检查不会输出密钥、凭证,也不会通过网络验证它们。
|
|
179
|
+
账号鉴权、格式错误的配置、环境覆盖、项目配置以及恢复的无界面会话,仍由 runtime 处理。
|
|
180
|
+
|
|
181
|
+
TUI 会把被拒绝的输入放回空编辑器,或保留在后续输入队列中,不覆盖新草稿。
|
|
182
|
+
无界面命令会退出并输出配置说明。登录、设置和其他管理命令仍可使用。
|
|
183
|
+
|
|
184
|
+
### 后台 Agent
|
|
185
|
+
|
|
186
|
+
运行超过一秒的 Agent 调用默认转入后台,通过 `/tasks` 继续访问;短任务保留在当前轮次,
|
|
187
|
+
便于直接使用结果。阈值单位为毫秒:
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"subagents": {
|
|
192
|
+
"autoBackgroundMs": 1000
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
设为 `0` 可禁用自动后台化。工具调用中显式设置 `run_in_background: true` 时会立即进入后台。
|
|
198
|
+
|
|
199
|
+
### 请求重试和流中断
|
|
200
|
+
|
|
201
|
+
重试分类和执行由官方 runtime 负责。CLI 提供默认五次重试预算,可使用原生环境变量覆盖:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
ZCODE_MODEL_RETRY_MAX_RETRIES=3 zcode
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
新建配置使用 60 秒的模型流空闲超时:
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"modelStream": {
|
|
212
|
+
"idleTimeoutMs": 60000
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
已有配置不会被覆盖;如果旧文件仍为 `600000`,需要手动修改。可重试的超时、断流、
|
|
218
|
+
限流、服务端和网络错误会重试并在 TUI 中显示。鉴权失败和无效请求不重试。
|
|
219
|
+
|
|
220
|
+
## Runtime 诊断日志
|
|
221
|
+
|
|
222
|
+
交互 TUI 会捕获 runtime 的 `stderr`,防止后台日志破坏终端显示。Runtime 非零退出时,
|
|
223
|
+
TUI 结束后会输出退出状态和日志路径。日志限制为 2 MB,下次启动时轮转为 `.1`,
|
|
224
|
+
两个文件均使用仅当前用户可读写的权限。
|
|
225
|
+
|
|
226
|
+
默认路径为 `~/.zcode/cli/tui-runtime.log`,也可指定独立路径:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
ZCODE_TUI_RUNTIME_LOG=/tmp/zcode-tui-runtime.log zcode
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## TUI 显示模式
|
|
233
|
+
|
|
234
|
+
默认使用普通终端回滚模式。将 `ui.tuiMode` 设为 `"fullscreen"` 可使用替代屏幕、
|
|
235
|
+
独立滚动的会话记录、固定输入区和鼠标滚轮/滚动条导航。浏览旧消息时输入区仍然可用。
|
|
236
|
+
内容放得下时隐藏滚动条;滚动时短暂显示,并跟随明暗主题。
|
|
237
|
+
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"ui": {
|
|
241
|
+
"tuiMode": "fullscreen"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
也可以在 `/settings` 或 `/config` 的 **Display mode** 中修改。
|
|
247
|
+
`ZCODE_TUI_MODE=fullscreen` 和 `ZCODE_TUI_MODE=regular` 临时覆盖保存值,设置页会提示该覆盖,
|
|
248
|
+
不会删除环境变量。
|
|
249
|
+
|
|
250
|
+
正常退出或处理 `SIGINT`、`SIGTERM`、`SIGHUP` 时会恢复终端状态。
|
|
251
|
+
任何终端程序都无法拦截强制的 `SIGKILL`。
|
|
252
|
+
|
|
253
|
+
### 选中自动复制
|
|
254
|
+
|
|
255
|
+
全屏模式中,释放鼠标选择会把文本复制到系统剪贴板。将 `ui.copyOnSelect` 设为 `false`
|
|
256
|
+
可只高亮、不自动复制;终端原生选择仍可通过按住 Shift 或终端指定的修饰键使用。
|
|
257
|
+
此选项只影响全屏模式,普通回滚模式不启用鼠标选择。
|
|
258
|
+
设置页中的 **Fullscreen copy on select** 提供同一开关。
|
|
259
|
+
|
|
260
|
+
```json
|
|
261
|
+
{
|
|
262
|
+
"ui": {
|
|
263
|
+
"copyOnSelect": false
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## 主题
|
|
269
|
+
|
|
270
|
+
在 CLI `setting.json` 中将 `ui.theme` 设为 `"auto"`、`"dark"` 或 `"light"`。
|
|
271
|
+
macOS/Linux 路径为 `~/.zcode/cli/setting.json`,Windows 为
|
|
272
|
+
`%USERPROFILE%\.zcode\cli\setting.json`。明确指定的明暗主题优先于终端探测。
|
|
273
|
+
`auto` 在启动时查询终端背景和配色模式,并应用匹配的调色板。
|
|
274
|
+
|
|
275
|
+
## 轮次完成通知
|
|
276
|
+
|
|
277
|
+
默认在终端失去焦点时,为普通 Agent 轮次的完成或失败发送通知。
|
|
278
|
+
自动选择终端能力的策略与 Codex 一致:`auto` 在 Ghostty、iTerm2、Kitty、Warp 和 WezTerm
|
|
279
|
+
中使用 OSC 9,在 Apple Terminal 等终端中使用 BEL。显式选择 OSC 9 而终端不支持时也改用 BEL,
|
|
280
|
+
避免发送被忽略的序列。
|
|
281
|
+
|
|
282
|
+
`unfocused` 条件使用终端的 DEC 焦点报告。在尚未确认焦点支持时,会发送通知,
|
|
283
|
+
不会一直当作“已聚焦”而抑制通知。`native` 需要明确启用,并使用已有系统工具:
|
|
284
|
+
macOS 的 `terminal-notifier`、Linux 的 `notify-send` 或 Windows 的 `SnoreToast`。
|
|
285
|
+
项目不捆绑这些工具;命令不可用或发送失败时使用 BEL。
|
|
286
|
+
|
|
287
|
+
macOS 会将检测到的终端 App 用作发送者和点击目标。能否恢复精确的标签页或窗格取决于终端;
|
|
288
|
+
默认 `auto` 可以保留支持 OSC 的终端原生行为。
|
|
289
|
+
|
|
290
|
+
在 TUI 中打开设置:
|
|
291
|
+
|
|
292
|
+
```text
|
|
293
|
+
/config
|
|
294
|
+
/settings
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
两个命令等效。保存一项后返回设置首页,便于连续修改;Esc 先返回首页,再关闭设置。
|
|
298
|
+
修改立即应用到当前会话,并持久化到 CLI `setting.json` 的 `ui.notifications`:
|
|
299
|
+
|
|
300
|
+
```json
|
|
301
|
+
{
|
|
302
|
+
"ui": {
|
|
303
|
+
"notifications": {
|
|
304
|
+
"method": "auto",
|
|
305
|
+
"condition": "unfocused"
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
环境变量在启动时覆盖文件值,适合当前 shell 的临时设置:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
export ZCODE_TUI_NOTIFICATION_METHOD=auto # auto|osc9|bel|native|off
|
|
315
|
+
export ZCODE_TUI_NOTIFICATION_CONDITION=always # unfocused|always
|
|
316
|
+
zcode
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## 官方 MCP 可用性
|
|
320
|
+
|
|
321
|
+
如果捆绑 runtime 没有官方 MCP 的可信来源 registry,官方 HTTP MCP 服务会显示为禁用,
|
|
322
|
+
诊断码为 `official_auth_unavailable`。插件的其他组件仍然可用。
|
|
323
|
+
这不会关闭证书、来源或权限校验;runtime 提供所需 registry 时也不会抑制服务。
|
|
324
|
+
该处理不会改写用户配置。
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Provider configuration reference
|
|
2
|
+
|
|
3
|
+
English | [简体中文](PROVIDER_CONFIG.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
ZCode Desktop and CLI share `~/.zcode/v2/provider_config.json` (underscore).
|
|
6
|
+
`ZCODE_PERSONAL_PROVIDER_CONFIG_FILE` can select another file. General terminal,
|
|
7
|
+
tool and network settings belong in `~/.zcode/cli/setting.json`.
|
|
8
|
+
|
|
9
|
+
[`provider.example.json`](../provider.example.json) covers the current personal
|
|
10
|
+
provider schema. It is valid JSON without comments. This reference explains the
|
|
11
|
+
fields, alternatives and restrictions that cannot be expressed as JSON comments.
|
|
12
|
+
|
|
13
|
+
## Using the example
|
|
14
|
+
|
|
15
|
+
The example deliberately contains three different model configurations:
|
|
16
|
+
|
|
17
|
+
| Model | Purpose |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `your-model-id` | Enabled; inherits model capabilities and request mappings from the upstream catalog |
|
|
20
|
+
| `overrides-reference` | Disabled; demonstrates every field available in an smart-configuration override |
|
|
21
|
+
| `manual-reference` | Disabled; demonstrates the complete manual-configuration schema |
|
|
22
|
+
|
|
23
|
+
The disabled `coding-plan-example` provider demonstrates template inheritance,
|
|
24
|
+
the Coding Plan API-key type and a built-in logo. It is separate from account login.
|
|
25
|
+
|
|
26
|
+
To configure a real provider:
|
|
27
|
+
|
|
28
|
+
1. Choose a stable `providerId`, such as `local`. `providerName` is its display name;
|
|
29
|
+
changing that name does not change the ID. The legacy CLI JSON key was the ID.
|
|
30
|
+
2. Fill in the API key, API type and base URL. The example has an **empty API key**.
|
|
31
|
+
3. Replace `your-model-id` in the provider membership, model rule, model order and
|
|
32
|
+
default selection. Model IDs are case-sensitive and may contain `/`.
|
|
33
|
+
4. Remove the disabled reference models/provider and their ordering entries unless
|
|
34
|
+
you need them. Copy only the specific overrides your endpoint requires.
|
|
35
|
+
5. Merge into an existing file rather than replacing other providers and rules.
|
|
36
|
+
Run `/model` to refresh the registry, then choose the model.
|
|
37
|
+
|
|
38
|
+
The reference capability values and token limits describe an example, not the
|
|
39
|
+
capabilities of your server. Leaving a field absent lets the catalog supply it;
|
|
40
|
+
copying an explicit `false` or limit pins that field to your chosen value.
|
|
41
|
+
|
|
42
|
+
## Top-level structure
|
|
43
|
+
|
|
44
|
+
| Path | Type / values | Meaning |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| `schemaVersion` | `1` | Current personal configuration format; not the App or catalog revision |
|
|
47
|
+
| `config.providerConfigRules.providerRules` | Array | Personal provider definitions and overrides, each with a unique `providerId` |
|
|
48
|
+
| `config.modelConfigRules.providerModelRules` | Array | Smart model configuration: partial overrides applied over the catalog |
|
|
49
|
+
| `config.modelConfigRules.manualProviderModelRules` | Array | Manual model configuration: the full editable model configuration |
|
|
50
|
+
| `config.providerOrder` | Optional array of provider IDs | Preferred provider display order |
|
|
51
|
+
| `config.defaultModelSelection` | Optional object | Shared default selection for new sessions |
|
|
52
|
+
|
|
53
|
+
Both model-rule arrays are present even when empty. A given `(providerId, modelId)`
|
|
54
|
+
must not appear in both arrays. A rule uses exact IDs, not a regular expression.
|
|
55
|
+
|
|
56
|
+
## Provider fields
|
|
57
|
+
|
|
58
|
+
Paths in this section are relative to an entry in `providerRules`.
|
|
59
|
+
|
|
60
|
+
| Path | Type / values | Meaning |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| `providerId` | Nonempty string | Stable reference used by models, defaults and saved sessions |
|
|
63
|
+
| `providerName` | Optional string or `null` | Display name; omitted names use the provider ID |
|
|
64
|
+
| `templateId` | Optional string or `null` | Inherit an installed provider template; the example uses `zai-api` |
|
|
65
|
+
| `enabled` | Optional boolean | Enable/disable the provider without deleting its configuration |
|
|
66
|
+
| `config.group` | `"standard-personal"` or `null`, optional | The editable personal-provider group |
|
|
67
|
+
| `config.logo` | Optional object or `null` | Built-in display logo; `null` clears an inherited logo |
|
|
68
|
+
| `config.logo.type` | `"builtin"` | Current supported logo representation |
|
|
69
|
+
| `config.logo.key` | Nonempty string | Built-in logo key, such as `zai` or `bigmodel` |
|
|
70
|
+
| `config.access` | Optional object or `null` | API-key authentication configuration; see below |
|
|
71
|
+
| `config.api` | Optional object or `null` | Endpoint configuration; see below |
|
|
72
|
+
| `config.personalModelIds` | Optional array of nonempty strings or `null` | Additional models belonging to this provider |
|
|
73
|
+
| `config.modelOrder` | Optional array of nonempty strings or `null` | Preferred model order within the provider |
|
|
74
|
+
| `config.visibility` | `"visible"`, `"hidden"`, or `null`, optional | Provider visibility in model selection |
|
|
75
|
+
|
|
76
|
+
`templateId` must refer to a template in the installed upstream catalog. Current
|
|
77
|
+
examples include `zai-api`, `zai-standard-api`, `bigmodel-api` and
|
|
78
|
+
`bigmodel-standard-api`; template availability follows the upstream release.
|
|
79
|
+
Template-supplied model IDs do not need to be copied into `personalModelIds`.
|
|
80
|
+
|
|
81
|
+
### Authentication
|
|
82
|
+
|
|
83
|
+
| Path under `config.access` | Type / values | Meaning |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| `type` | `"api-key"` or `"zhipu-coding-plan-api-key"` | Direct API key or Z.AI/BigModel Coding Plan API key |
|
|
86
|
+
| `apiKey` | Optional string or `null` | Actual key; an empty/missing key does not authenticate a model request |
|
|
87
|
+
| `apiKeyManagementUrl` | Optional URL string or `null` | Link to the provider's key-management page; not a model endpoint |
|
|
88
|
+
|
|
89
|
+
The native schema also has an account-access branch with `type: "zhipu-account"`,
|
|
90
|
+
`accountType: "zai" | "bigmodel"`, `mode: "start-plan" |
|
|
91
|
+
"individual-coding-plan" | "team-coding-plan" | "off-peak"`, and an `entitled`
|
|
92
|
+
boolean. These describe runtime-managed account access. They are not a way to
|
|
93
|
+
configure an API key or grant a subscription. For fixed `account:*` providers,
|
|
94
|
+
the personal file **rejects an `access` override**. Use native login and its
|
|
95
|
+
credential store; the example does not manufacture an account provider.
|
|
96
|
+
|
|
97
|
+
### Endpoint
|
|
98
|
+
|
|
99
|
+
| Path under `config.api` | Type / values | Meaning |
|
|
100
|
+
| --- | --- | --- |
|
|
101
|
+
| `type` | `"anthropic-messages"`, `"openai-chat-completions"`, `"openai-responses"` | Wire protocol understood by the endpoint |
|
|
102
|
+
| `baseUrl` | Optional string or `null` | API root; the effective configuration must resolve to a valid URL |
|
|
103
|
+
| `headers` | Optional object of string values or `null` | Additional HTTP headers, e.g. `{"X-Client-Name":"zcode-cli"}` |
|
|
104
|
+
|
|
105
|
+
Fields can be inherited from a template. A standalone custom provider needs an
|
|
106
|
+
effective API type, base URL and usable authentication. `headers` is a map of
|
|
107
|
+
header names to strings; it is not a place for model request-body parameters.
|
|
108
|
+
|
|
109
|
+
## Model fields: smart configuration
|
|
110
|
+
|
|
111
|
+
Each entry in `providerModelRules` has `providerId`, `modelId` and `config`.
|
|
112
|
+
Its `config` is a **partial overlay**. An entry containing only
|
|
113
|
+
`{"enabled": true}` inherits all capability fields and option specifications.
|
|
114
|
+
|
|
115
|
+
| Path under model `config` | Type | Desktop field / meaning |
|
|
116
|
+
| --- | --- | --- |
|
|
117
|
+
| `enabled` | Boolean | Include/exclude this model |
|
|
118
|
+
| `properties.contextWindow` | Positive integer | Context window: total context capacity in tokens |
|
|
119
|
+
| `properties.inputFormat.supportsText` | Boolean | Text input; text is required by Desktop's model editor |
|
|
120
|
+
| `properties.inputFormat.supportsImage` | Boolean | Image input |
|
|
121
|
+
| `properties.inputFormat.supportsVideo` | Boolean | Video input |
|
|
122
|
+
| `properties.inputFormat.supportsAudio` | Boolean | Audio capability in the native schema; not a promise of a CLI audio attachment UI |
|
|
123
|
+
| `properties.inputFormat.supportsPdf` | Boolean | Direct PDF input; note the spelling `Pdf` |
|
|
124
|
+
| `properties.outputFormat.supportsText` | Boolean | Text output; this is the current schema's only output-format field |
|
|
125
|
+
| `properties.supportsToolCall` | Boolean | Tool/function calling |
|
|
126
|
+
| `properties.supportsJsonSchemaOutput` | Boolean | Structured output: API-supported JSON Schema output |
|
|
127
|
+
| `properties.supportsNativeWebSearch` | Boolean | Native web search: runtime/provider-native search capability |
|
|
128
|
+
| `properties.supportsMidConversationSystem` | Boolean | Mid-conversation system messages: system messages inserted after the initial message |
|
|
129
|
+
| `properties.requiresMfjsToolSchema` | Boolean | Advanced compatibility flag for the runtime's tool-schema format; normally inherit it |
|
|
130
|
+
| `optionSpecs.maxOutputTokens.max` | Positive integer | Max output tokens: output limit, separate from the context window |
|
|
131
|
+
| `optionSpecs.maxOutputTokens.map` | Nonempty expression string | Maps the output-token value into API request parameters |
|
|
132
|
+
| `optionSpecs.reasoningLevel.values` | Nonempty array of unique nonblank strings | Reasoning levels, ordered from lower to higher; available labels depend on the model |
|
|
133
|
+
| `optionSpecs.reasoningLevel.map` | Nonempty expression string | Reasoning parameter mapping: maps the selected reasoning level into API request parameters |
|
|
134
|
+
|
|
135
|
+
All these fields are optional in an smart override. Changing one nested
|
|
136
|
+
field leaves its siblings inherited. The full example lists every field in the
|
|
137
|
+
disabled `overrides-reference` model so it does not silently pin the enabled
|
|
138
|
+
model's capabilities.
|
|
139
|
+
|
|
140
|
+
### Multimodal capabilities and the three capability switches
|
|
141
|
+
|
|
142
|
+
For an existing `local/glm-5.3-flash` entry, an image/video/PDF override can be:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"providerId": "local",
|
|
147
|
+
"modelId": "glm-5.3-flash",
|
|
148
|
+
"config": {
|
|
149
|
+
"properties": {
|
|
150
|
+
"inputFormat": {
|
|
151
|
+
"supportsImage": true,
|
|
152
|
+
"supportsVideo": true,
|
|
153
|
+
"supportsPdf": true
|
|
154
|
+
},
|
|
155
|
+
"supportsJsonSchemaOutput": false,
|
|
156
|
+
"supportsNativeWebSearch": false,
|
|
157
|
+
"supportsMidConversationSystem": false
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Only enable capabilities your endpoint actually supports. JSON Schema output
|
|
164
|
+
is more than asking the model to write JSON. Native search is distinct from
|
|
165
|
+
configuring a search MCP server. Mid-conversation system-message support is
|
|
166
|
+
distinct from accepting an initial system prompt.
|
|
167
|
+
|
|
168
|
+
### Token limits and request mappings
|
|
169
|
+
|
|
170
|
+
`properties.contextWindow` and `optionSpecs.maxOutputTokens.max` are independent.
|
|
171
|
+
For example, a 1,000,000-token context and a 128,000-token output limit use those
|
|
172
|
+
two different paths. Preserve an existing mapping when changing only a limit.
|
|
173
|
+
|
|
174
|
+
Mappings are **strings containing the native mapping expression**, not JSON
|
|
175
|
+
objects, JavaScript callbacks or the old `providerOptionsByLevel` structure.
|
|
176
|
+
The runtime validates the expression. The two variables are `reasoningLevel`
|
|
177
|
+
and `maxOutputTokens`, each in its corresponding map.
|
|
178
|
+
|
|
179
|
+
| Example endpoint behavior | Mapping string |
|
|
180
|
+
| --- | --- |
|
|
181
|
+
| Chat Completions output parameter | `{"max_tokens": maxOutputTokens}` |
|
|
182
|
+
| An endpoint requiring `max_completion_tokens` | `{"max_completion_tokens": maxOutputTokens}` |
|
|
183
|
+
| Responses output parameter | `{"max_output_tokens": maxOutputTokens}` |
|
|
184
|
+
| Direct reasoning-effort parameter | `{"reasoning_effort": reasoningLevel}` |
|
|
185
|
+
| No extra request parameters | `{}` |
|
|
186
|
+
|
|
187
|
+
The complete example additionally demonstrates a conditional reasoning map:
|
|
188
|
+
`reasoningLevel == "disabled" ? {} : {"reasoning_effort": reasoningLevel}`.
|
|
189
|
+
An Anthropic-compatible endpoint may need a different map, such as the upstream
|
|
190
|
+
catalog's `thinking` / `output_config` parameters. API type alone does not imply
|
|
191
|
+
that every model supports the same reasoning fields or levels.
|
|
192
|
+
|
|
193
|
+
## Model fields: manual configuration
|
|
194
|
+
|
|
195
|
+
Turning off Desktop's **Smart configuration** uses `manualProviderModelRules`. A manual entry
|
|
196
|
+
has the same `providerId` and `modelId` identity, but a different `config` schema:
|
|
197
|
+
|
|
198
|
+
- `enabled` is optional.
|
|
199
|
+
- `properties.contextWindow` is required.
|
|
200
|
+
- `properties.inputFormat` must contain `supportsImage`, `supportsVideo` and
|
|
201
|
+
`supportsPdf`, each a boolean.
|
|
202
|
+
- `properties.supportsJsonSchemaOutput`, `supportsNativeWebSearch` and
|
|
203
|
+
`supportsMidConversationSystem` are required booleans.
|
|
204
|
+
- `optionSpecs.maxOutputTokens` must contain the positive integer `max`.
|
|
205
|
+
- `optionSpecs.reasoningLevel` must contain both `values` and `map`.
|
|
206
|
+
|
|
207
|
+
Do not put `supportsText`, `supportsAudio`, `outputFormat`, `supportsToolCall`,
|
|
208
|
+
`requiresMfjsToolSchema` or `maxOutputTokens.map` in a manual entry: they are not
|
|
209
|
+
fields of that schema. Protocol-level fields still come from the catalog;
|
|
210
|
+
manual mode fixes the editable fields listed above. Move the entry between the
|
|
211
|
+
arrays when changing mode; never duplicate its identity across both arrays.
|
|
212
|
+
|
|
213
|
+
## Defaults, inheritance and clearing overrides
|
|
214
|
+
|
|
215
|
+
`config.defaultModelSelection` accepts exactly:
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"providerId": "local",
|
|
220
|
+
"modelId": "glm-5.3-flash",
|
|
221
|
+
"options": {
|
|
222
|
+
"reasoningLevel": "high"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
`options` and `options.reasoningLevel` are optional. An explicit level must belong
|
|
228
|
+
to that model's effective `reasoningLevel.values`. Omit `options` to let the
|
|
229
|
+
runtime complete the selection from the model's current defaults. There is no
|
|
230
|
+
`maxOutputTokens` field inside `defaultModelSelection.options`.
|
|
231
|
+
|
|
232
|
+
Missing fields inherit. To resume automatic upstream updates for a capability,
|
|
233
|
+
delete its personal override. Many provider fields and smart model-overlay
|
|
234
|
+
fields accept `null` to clear a value; `null` is **not** a synonym for inheritance
|
|
235
|
+
and can make the effective model incomplete. Manual required fields cannot be
|
|
236
|
+
cleared this way. Use Desktop's restore action, or remove the relevant override.
|
|
237
|
+
|
|
238
|
+
## Automatic upstream model updates
|
|
239
|
+
|
|
240
|
+
Runtime synchronization copies the entire current upstream
|
|
241
|
+
`config/provider/zcode-builtin.json`, including model matching rules, all
|
|
242
|
+
capabilities, token limits and request mappings. An existing extracted file is
|
|
243
|
+
replaced with the current source catalog; it does not pin the previous revision.
|
|
244
|
+
The native runtime also owns its normal catalog refresh and revision handling.
|
|
245
|
+
|
|
246
|
+
The registry combines the upstream catalog with this personal file. Smart
|
|
247
|
+
models automatically inherit updated multimodal flags, tool/search/system-message
|
|
248
|
+
capabilities, context/output limits, reasoning levels and mappings. Explicit
|
|
249
|
+
personal overrides win. Manual editable values remain fixed. Refreshing does
|
|
250
|
+
not copy effective values into the personal file, because that would turn every
|
|
251
|
+
upstream value into a permanent user override.
|
|
252
|
+
|
|
253
|
+
Model resolution depends on the upstream model, API and provider-site rules.
|
|
254
|
+
An unknown custom endpoint can need explicit overrides; the CLI does not guess
|
|
255
|
+
that a model supports images or native search just from its name. `/model`
|
|
256
|
+
refreshes the live registry. Changing the catalog does not change a saved model
|
|
257
|
+
identity or deliberately chosen reasoning level.
|
|
258
|
+
|
|
259
|
+
## Fields belonging elsewhere
|
|
260
|
+
|
|
261
|
+
The personal file is not a copy of the upstream catalog. These catalog-only
|
|
262
|
+
fields are not accepted here: `revision`, `templateRules`, `templateNameMap`,
|
|
263
|
+
`builtinModelIds`, `modelRules`, `modelApiRules`, `providerSiteRules`,
|
|
264
|
+
`templateModelRules` and `builtinProviderModelRules`. The `zai-family` and
|
|
265
|
+
`bigmodel-family` groups are likewise declared by native account configuration.
|
|
266
|
+
|
|
267
|
+
The old `provider`, `model.main`, `model.lite`, `models`, `modalities`, `limit` and
|
|
268
|
+
`modelCatalog` structures are not fields in this schema. CLI permission modes,
|
|
269
|
+
Plan state, retry settings, timeouts, notifications, storage paths and MCP/plugin
|
|
270
|
+
settings also do not belong in `provider_config.json`; see
|
|
271
|
+
[Configuration](CONFIGURATION.md).
|