fix(capabilities): 兼容 Kimi 的严格工具 Schema 校验 - #50
Merged
Conversation
Merged
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 #49
问题
openpi_load_tools.groups.items由Type.Enum生成,仅包含enum,没有显式的type。Kimi/Moonshot 在模型推理前校验全部活动工具,因此当 capability gateway 可见时直接返回:Pi 内置工具正常;只加载 OpenPI capabilities extension 即可复现。
--no-tools会绕过 Schema,不能作为兼容性通过证据。修复
type: "string" + enumSchema。OpenPiCapability静态类型、原有 enum 值、运行逻辑和工具表面预算。anyOf + const,避免无意义增加常驻输入。仓库扫描确认:这是产品源码中唯一一处
Type.Enum;另一处手写 enum 已明确包含type: "string"。验证
type: "string"。bun run check:通过(仅有既存 Effect warnings)。bun run test:746 Node + 29 Vitest 全绿。git diff --check:通过。0.84.2,kimi-code/k3:low,--no-extensions排除 npm 包,显式加载本分支 capabilities extension,保留正常工具模式并触发openpi_load_tools进入请求;K3 成功返回schema-ok,不再出现 HTTP 400。性能
仅增加一个
"type":"string"字段;不增加模型调用、工具调用或运行时分支,provider surface 仍通过既有 500 字符预算测试。