Repository navigation
fix(zcode): prefer the builtin provider config ZCode Desktop refreshed - #1256
Conversation
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Without ZCODE_BUILTIN_PROVIDER_CONFIG_FILE the adapter handed the CLI the config bundled in the App. ZCode Desktop refreshes that config from its Endpoint into its runtime provider directory and starts its own CLI with the refreshed file, so Models added after the App shipped were missing from the ZCode catalog. Pick the highest-revision refreshed file of the installed App version when it is newer than the bundled one, and keep the bundled file otherwise.
9f6dbeb to
dac155e
Compare
Summary
ZCode 适配器在未设置
ZCODE_BUILTIN_PROVIDER_CONFIG_FILE时,固定把安装包自带的config/provider/zcode-builtin.json传给 CLI。ZCode Desktop 从 Endpoint 把内置 Provider 配置刷新到{dataRoot}/runtime/provider/<platform>/<App version>/endpoint-<key>/zcode-builtin.json,并用自己的resolveZCodeBuiltinCachePaths与EndpointScopedZCodeBuiltinSource(bundledFilePath与activeFilePath)决定生效文件;它启动自带 CLI 时传的是刷新后的文件。App 发布后新增的 Model 只存在于刷新后的文件中,所以 codexhost 的 ZCode 模型目录缺少这些 Model。改动:
packages/adapters/zcode/src/builtin-provider-config.ts:内置 Provider 配置的 schema(从account.ts移出,两处共用)与resolveDesktopBuiltinProviderConfig。后者在已安装 App 版本的 Endpoint 目录中取能按 schema 解析且revision最高的刷新文件,仅当它高于安装包文件的revision时返回该路径,否则返回undefined。installation.ts:传给 CLI 的文件按「环境变量 › Desktop 刷新后的文件 › 安装包文件」选取,dataRoot的计算移到选取之前。account.ts:改用共用的 schema,读取与basedOnZCodeBuiltinRevision的计算不变。test/installation.test.ts:覆盖优先选取、各类回退、多个 Endpoint 目录取最高 revision、环境变量优先。docs/harnesses/zcode/zcode-harness-integration.md:新增「内置 Provider 配置」一节并同步环境变量说明与验证记录。刷新文件缺失、无法解析或版本不高于安装包文件时,检测结果与现状一致。
Related issues
Fixes #1255
UI Demo
无 / N/A:不涉及可见 UI 改动。
Test plan
自动测试(Node 24.9.0,Windows 11 x64):
npx tsc -b packages/adapters/zcode:通过。npx vitest run --config tests/vitest.config.js packages/adapters/zcode/test/installation.test.ts:21 通过。新增的「prefers the builtin Provider config ZCode Desktop refreshed for the installed App version」与「takes the highest revision among Desktop's Endpoint copies of the builtin Provider config」在本改动之前失败(21 个中 2 个失败),改动之后通过。npx vitest run --config tests/vitest.config.js packages/adapters/zcode/test:226 通过,20 跳过(需要CODEXHOST_TEST_ZCODE_APP的原生测试)。npx prettier --check与npx eslint只对改动文件运行:通过。实机(Windows 11 x64,ZCode Desktop 4.0.0,Node 24.9.0):本机没有 Rust 工具链,未运行
npm start;改用已安装的 0.27.0 启动器加载npm run build:typescript构建的 Host,在独立数据目录与独立端口启动,环境未设置ZCODE_BUILTIN_PROVIDER_CONFIG_FILE。main@d0b0892:codexhost harness inspect zcode的目录不含account:bigmodel-individual-coding-plan/GLM-5.4,默认 Model 为 GLM-5.3。account:bigmodel-individual-coding-plan与bigmodel-api各一条),默认 Model 为 GLM-5.4;未指定 Model 的codexhost delegate start --harness zcode以BigModel / GLM-5.4执行并正常完成。未验证:macOS 与 Linux;同一 App 版本下多个 Endpoint 目录并存的真实安装(只有单元测试);全量测试未在本地运行。
全仓静态检查补充:
npm run typecheck与node tools/check-boundaries.mjs通过。npm run lint报 21 个 eslint 错误,全部位于本 PR 未改动的文件(packages/web-server、packages/host-runtime/test、packages/renderer-extension/test),main@d0b0892上相同;本 PR 改动的文件无错误。