← 返回更新日志

Pi v0.99.2

2026-09-30 · GitHub 原文
### 新功能 - MCP 服务器不再妨碍使用:具有默认 `codemode` 暴露方式的服务器不再列在 `codemode` 描述中,也不再阻塞第一次提示。它们会显示在一个简短的系统提示部分中,脚本可通过 `searchTools()` 和 `describeNamespace()` 查找其工具。参见[控制工具暴露](https://github.com/earendil-works/pi/blob/v0.99.2/packages/coding-agent/docs/mcp.md#control-tool-exposure)。 - 更多 MCP 身份验证选项:对于只接受已知 OAuth 客户端的服务器,可使用 `oauth.clientName`;还可以使用 `"auth": { "provider": "<provider>" }`,通过提供商的 `/login` 令牌对 HTTP 服务器进行身份验证。参见[使用 OAuth 进行身份验证](https://github.com/earendil-works/pi/blob/v0.99.2/packages/coding-agent/docs/mcp.md#authenticate-with-oauth)。 - 支持通过 Anthropic SDK 环境变量配置 Anthropic 工作负载身份联合。参见[使用环境变量中的 API 密钥](https://github.com/earendil-works/pi/blob/v0.99.2/packages/coding-agent/docs/providers.md#use-an-api-key-from-the-environment)。 - `/reload` 会启用新添加到 `defaultTools` 设置中的工具。参见[工具](https://github.com/earendil-works/pi/blob/v0.99.2/packages/coding-agent/docs/settings.md#tools)。 ### 新增 - 为 MCP 服务器新增 `description` 字段(`pi mcp add --description`)。该字段会与服务器一起显示在系统提示中,并用于在工具搜索中对其工具进行排序;同时新增 `describeNamespace(name)` codemode 辅助函数,用于返回命名空间的说明和工具名称。`describeNamespace()` 和 `searchTools()` 接受以下形式的命名空间:`mcp__dev-radius`、`mcp__dev_radius`、`dev-radius` 或 `dev_radius`。 - 为 MCP 服务器新增 `oauth.clientName` 设置(`pi mcp add --oauth-client-name`),用于更改 OAuth 客户端注册期间发送的客户端名称,适用于只接受已知客户端的服务器([#10226](https://github.com/earendil-works/pi/issues/10226))。 - 为 HTTP MCP 服务器新增 `"auth": { "provider": "<provider>" }` 配置,用于将提供商当前的 `/login` 令牌作为 bearer 令牌发送,而不是使用 MCP OAuth。每次请求都会读取该令牌,因此提供商刷新令牌后会立即生效。该配置只允许在全局 `mcp.json` 和扩展中使用,并且除回环主机外都要求使用 https。 - 支持通过 `ANTHROPIC_FEDERATION_RULE_ID`、`ANTHROPIC_ORGANIZATION_ID` 和 `ANTHROPIC_IDENTITY_TOKEN_FILE` 环境变量配置 Anthropic 工作负载身份联合(参见[提供商](https://github.com/earendil-works/pi/blob/v0.99.2/packages/coding-agent/docs/providers.md))([#10177](https://github.com/earendil-works/pi/issues/10177)、由 [@philfreo](https://github.com/philfreo) 提交的 [#10242](https://github.com/earendil-works/pi/pull/10242))。 - `/reload` 现在会启用新添加到 `defaultTools` 设置中的工具。已从该设置中移除的工具仍保持启用状态;会话期间手动关闭的工具仍保持关闭,除非它们是新添加的工具;`--tools`、`--no-tools` 和 `--no-builtin-tools` 仍会覆盖该设置([#10245](https://github.com/earendil-works/pi/issues/10245))。 ### 变更 - 具有默认 `codemode` 暴露方式的 MCP 服务器不再出现在 `codemode` 描述中;脚本可通过 `searchTools()` 查找它们。`codemode-deferred` 现在是 `codemode` 的别名。对于模型无需搜索即可看到的工具,请使用 `direct` 暴露方式([#10212](https://github.com/earendil-works/pi/issues/10212))。 - `codemode` 描述不再包含延迟工具、工具数量或 MCP 服务器说明,因此 MCP 服务器连接或工具发生变化时,该描述也不会随之变化。出于同样的原因,`tool_search` 描述也不再列出它可以加载工具的服务器。服务器现在会显示在 `mcp_servers` 系统提示部分中,其中包含一行摘要;该部分会在每次提示开始时更新,发生变化的部分会追加到对话中。脚本可通过 `describeNamespace()` 读取服务器说明([#10212](https://github.com/earendil-works/pi/issues/10212))。 - 第一次提示不再等待没有 `direct` 工具的 MCP 服务器。它们会在后台连接,并在 codemode 脚本指定这些服务器、脚本搜索工具或运行 `tool_search` 时等待其完成([#10212](https://github.com/earendil-works/pi/issues/10212))。 ### 修复 - 修复了新会话间歇性忽略已保存的默认模型,或在默认模型属于通过扩展注册且拥有已保存凭据的原生提供商时警告没有可用模型的问题([#9962](https://github.com/earendil-works/pi/issues/9962)、由 [@davidbrai](https://github.com/davidbrai) 提交的 [#10190](https://github.com/earendil-works/pi/pull/10190))。 - 修复了 `/mcp` 登录 URL 跨行换行时无法点击的问题。现在会像 `/login` 一样,将其作为终端超链接输出,并附带 `Cmd/Ctrl+click to open` 提示行([#10186](https://github.com/earendil-works/pi/issues/10186))。 - 修复了 codemode 的 `image()` 接受格式错误的 base64 数据或不受支持的图像类型的问题。该问题会持久化一个无效的图像块,导致之后每次提供商请求都失败并返回 HTTP 400([#10215](https://github.com/earendil-works/pi/issues/10215))。 - 修复了 codemode 无法从独立 Windows 可执行文件启动脚本工作进程的问题([#10204](https://github.com/earendil-works/pi/issues/10204))。 - 修复了提示提交速度随会话长度变慢的问题,原因是解析会话模型选择时,每条助手消息都会查询一次模型目录([#10198](https://github.com/earendil-works/pi/issues/10198))。 - 修复了使用已刷新 pi.dev 目录的提供商的模型查询速度变慢的问题,原因是合并远程目录模型的操作需要二次时间复杂度。 - 修复了 `built-in-tool-renderer.ts` 和 `minimal-mode.ts` 扩展示例会从系统提示中移除内置工具摘要和使用指南的问题([#10072](https://github.com/earendil-works/pi/issues/10072)、由 [@christianklotz](https://github.com/christianklotz) 提交的 [#10193](https://github.com/earendil-works/pi/pull/10193))。 - 修复了 Z.AI CN 端点返回 `Prompt exceeds max length` 错误时的上下文溢出检测问题([#10208](https://github.com/earendil-works/pi/issues/10208))。 - 修复了工具架构使用 Anthropic 严格工具调用拒绝的关键字(例如 `minimum`/`maximum`)时 Anthropic 请求失败的问题;此类工具现在会以非严格模式发送([#9953](https://github.com/earendil-works/pi/issues/9953))。 - 修复了 `Retry-After` 标头包含无法解析的日期时提供商重试立即触发的问题;现在会使用指数退避([#9571](https://github.com/earendil-works/pi/issues/9571))。 - 修复了注册扩展命令时未提供字符串名称或处理函数,导致输入 `/` 时 pi 崩溃的问题;现在扩展会加载失败并返回错误([#10054](https://github.com/earendil-works/pi/issues/10054))。 - 修复了折叠后的 `codemode` 和 MCP 工具结果在输出为一长行(例如压缩后的 JSON)时占满屏幕的问题。与 bash 输出一样,预览现在会限制为换行后的行数,而不是逻辑行数。 - 修复了 `codemode.mode: "only"` 虽然请求只声明 `codemode`,却仍在系统提示的工具列表中列出 `read`、`bash`、`edit` 和 `write` 的问题([#10192](https://github.com/earendil-works/pi/issues/10192))。 - 修复了当两个工具名称仅在 `-` 和 `_` 上不同时(例如 `read-file` 和 `read_file`),codemode 脚本调用错误 MCP 工具的问题。与 Codex 一样,MCP 工具名和命名空间名现在会将 `-` 替换为 `_`(`mcp__my-server__x` 现在变为 `mcp__my_server__x`);同一服务器中发生名称冲突的工具都会获得哈希后缀;名称仅在 `-` 和 `_` 上不同的服务器会被拒绝([#10239](https://github.com/earendil-works/pi/issues/10239))。