← 返回更新日志

Pi v0.99.0

2026-09-29 · GitHub 原文
### 新功能 - **Codemode 和 MCP** — 连接 MCP 服务器,让模型运行可并行调用工具的 JavaScript。参见 [MCP 服务器](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/mcp.md) 和 [启用 codemode](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/cli.md#enable-codemode)。 - **系统主题** — Pi 现在默认使用终端自身的调色板。参见 [使用终端的颜色](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/themes.md#use-your-terminals-colors)。 - **使用 ChatGPT 登录** — 通过 `/login openai`,在 OpenAI 提供商中使用 ChatGPT 订阅。参见 [交互式身份验证](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/providers.md#authenticate-interactively)。 - **虚拟模型** — 扩展可以将每个请求路由到不同的物理模型。参见 [虚拟模型](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/virtual-models.md)。 - **分类器模型** — 在 codemode 脚本中运行 Jev 分类器,或将任意 llama.cpp 模型用作分类器。参见 [codemode 的工作原理](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/cli.md#how-codemode-works) 和 [分类](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/llama-cpp.md#classification)。 ### 新增 - 将 codemode、工具搜索和 MCP 支持作为内置扩展加入。`codemode` 工具会在 QuickJS 沙箱中运行模型编写的 JavaScript,以调用 pi 的工具;通过 `defaultTools` 或 `--tools` 启用,并使用 `codemode.mode` 和 `codemode.inlineBudget` 配置。`tool_search` 可查找尚未向模型声明的工具,并将其声明出来。通过 stdio 或可流式传输的 HTTP 连接的 MCP 服务器(支持 OAuth),可通过 `mcp.json`(全局配置,或在项目受信任后进行项目级配置)或 `pi.registerMcpServer()` 添加,并通过 `/mcp` 和 `pi mcp add|remove|list|login|logout` 管理。参见 [MCP 服务器](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/mcp.md) 和 [启用 codemode](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/cli.md#enable-codemode)([#10040](https://github.com/earendil-works/pi/issues/10040))。 - 新增用于编排工具的扩展工具 API:`exposure`(`direct`、`model-only`、`codemode`、`deferred` 或 `hidden`)、`namespace`、`annotations`、带有 `structuredContent` 的 `outputSchema`、`isError` 结果、`prepareLoadout()`,以及用于嵌套工具调用的 `ctx.executeTool()`。嵌套调用会发出带有 `parentToolCallId` 的事件,并作为有数量上限的 `nestedCalls` 记录在发起调用的工具结果中。参见 [工具暴露方式](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/extensions.md#tool-exposure)。 - 当某个扩展注册了与内置扩展同名的工具、命令或标志并将其替换时,新增警告([#10174](https://github.com/earendil-works/pi/pull/10174),由 [@cristinaponcela](https://github.com/cristinaponcela) 提交)。 - 新增实验性虚拟模型:扩展通过 `pi.registerVirtualModel()` 注册虚拟模型,并为每个请求选择物理模型和思考级别。页脚会显示路由后的模型,`/session` 会列出各物理模型的费用,`examples/extensions/jev-router.ts` 展示了如何使用 Jev 分类器进行路由。参见 [虚拟模型](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/virtual-models.md)。 - 在 OpenAI 提供商的 `/login` 中新增“使用 ChatGPT 登录”,可通过 ChatGPT 订阅使用 OpenAI API。Pi 会在全局设置中为此登录保存稳定的 `deviceId`,并在错误报告中将其排除。 - 新增 `system` 主题,并设为默认主题。它会从终端报告的前景色、背景色和 ANSI 调色板中获取 pi 的颜色;终端在浅色和深色模式之间切换时,也会重新生成颜色。参见 [使用终端的颜色](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/themes.md#use-your-terminals-colors)。 - 主题文件新增 `#rgb`、`oklch()` 和 `okhsl()` 颜色格式,以及可选的 `appearance` 字段;扩展新增 `theme.style()`、`theme.colors` 和 `theme.appearance`。参见 [主题](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/themes.md) 和 [TUI](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/tui.md)。 - 为每个 llama.cpp 聊天模型新增分类器模型,基于下一个 token 的标签概率给出分类结果。参见 [分类](https://github.com/earendil-works/pi/blob/v0.99.0/packages/coding-agent/docs/llama-cpp.md#classification)。 - 在 OpenRouter、Cloudflare Workers AI、Vercel AI Gateway 和 OpenCode Zen 上新增继承的 Jev 分类器模型。 - 新增 `fullscreenWheelScrollLines` 设置项及对应的 `/settings` 选项,用于控制全屏模式下鼠标滚轮的滚动行数。默认值 `"auto"` 会在非本地 macOS 终端中加快快速滚轮滚动([#9758](https://github.com/earendil-works/pi/issues/9758))。 - 成功的 RPC `prompt`、`steer` 和 `follow_up` 响应,以及 `AgentSession.steer()`/`followUp()` 和 `RpcClient.prompt()`/`steer()`/`followUp()`,现在会针对每个输入返回处理方式;`RpcClient.prompt()` 还接受 `streamingBehavior`([#9098](https://github.com/earendil-works/pi/issues/9098),[#9803](https://github.com/earendil-works/pi/issues/9803))。 - 在 `ModelRuntime` 中新增图像生成:`generateImages()` 支持由运行时解析身份验证信息(已存储的凭据、OAuth、运行时 API 密钥、`models.json` 请求头);还新增 `getModelsOfType()`、`getModelOfType()`、`getAvailableOfType()`、`getAllModels()` 和 `getAllAvailable()`。OpenRouter 图像模型列在 `openrouter` 提供商下,并与其共用凭据;同一个上游 ID 可以分别对应聊天和图像条目。`models.json` 中的提供商以及未提供模型列表的扩展注册仍使用内置图像生成功能。扩展模型列表可以包含带判别类型的聊天、图像和分类器条目及其操作实现;如果提供了此类列表,它会替换该提供商在所有操作中的模型目录。面向聊天的读取接口(`getModels()`、`getAvailableSnapshot()`、模型选择器)保持不变。 - 在 `ModelRuntime` 中新增分类器支持,包括 `classify()`、分类器模型访问器、由运行时解析的身份验证,以及内置的 TypeSafe `jev-latest` 模型。 - 向 pi.dev 模型目录请求新增 `types=chat,image,classifier`,使远程刷新可以覆盖所有受支持的模型类型;未知模型类型的条目会被忽略。 - 新增 `provider_stream_event` 扩展事件,用于在规范化之前观察已解析的提供商事件;另提供可选的 `/debug-provider` 示例查看器([#9784](https://github.com/earendil-works/pi/issues/9784),[#9901](https://github.com/earendil-works/pi/pull/9901),由 [@davidbrai](https://github.com/davidbrai) 提交)。 - HTML 导出中新增显示/隐藏切换按钮(`H`),用于控制标记为 `display: false` 的自定义消息。消息默认仍保持隐藏,也可以从侧边栏中显示([#8896](https://github.com/earendil-works/pi/issues/8896),[#10020](https://github.com/earendil-works/pi/pull/10020),由 [@rwachtler](https://github.com/rwachtler) 提交)。 - 为 Anthropic 新增继承的 Claude Sonnet 5.5 支持,包括自适应思考和 1M 上下文窗口。 - 在 `pi config` 中新增“内置”部分,可全局或按项目禁用内置的 `mcp`、`llama.cpp`、`codemode` 和 `tool-search` 扩展;设置值以 `-builtin:<name>` 的形式存储在 `extensions` 中。SDK 内联扩展可通过 `builtin: true` 启用此功能。 - `defaultTools` 设置新增 `+name` 和 `-name` 条目,可在不重复列出默认值的情况下添加或移除工具,例如 `"defaultTools": ["+codemode"]`。项目级此类条目会在用户设置基础上生效。文档新增了如何在不使用 MCP 的情况下启用 `codemode`,以及如何在 codemode 脚本中使用 Jev 等分类器模型的说明。 - 将 codemode 中 `models.classify()` 调用的 token 用量和费用计入 codemode 工具结果,因此会计入会话费用;codemode 结果会显示每次调用的费用。 ### 变更 - 构建方式从 TypeScript 原生预览版切换到 TypeScript 7.0,目标版本设为 ES2024;运行源码时则以 Node 内置的类型剥离功能取代 `tsx`([#9965](https://github.com/earendil-works/pi/issues/9965))。 - 从启动横幅中移除了 `[Themes]` 部分。自定义主题仍可在 `/settings` 中使用,主题冲突仍会报告。 - 启动标题现在显示 pi 标志和版本号,而不是应用名称。 - 内置的 `dark` 和 `light` 主题已更新为新版 pi 配色,并使用 OKHSL 编写。 - 浅色/深色终端检测现在优先使用报告的背景色,其次使用终端报告的浅色/深色状态,最后使用 `COLORFGBG`。首次设置时不再显示检测到的外观模式。 - 将继承的 OpenAI Codex 提供商重命名为“OpenAI Codex (legacy)”;OpenAI 提供商中的“使用 ChatGPT 登录”现已取代它。 - 继承的终端检测现在会将 `TERM=*-direct` 视为真彩色终端。 - 在错误、诊断信息、RPC 来源信息和错误报告中,内置扩展和工具现在命名为 `builtin:<name>`(例如 `builtin:mcp` 和 `builtin:read`),不再使用 `<inline:name>` 和 `<builtin:name>`。它们的斜杠命令也不再带有 `[t]` 自动补全标签。 - `--no-extensions` 现在也会禁用内置扩展,包括 llama.cpp 提供商。可通过 `-e builtin:<name>` 显式加载,例如 `pi -ne -e builtin:mcp`。 - 没有自定义调用渲染器的工具调用(包括直接调用 MCP 工具)现在会显示参数:折叠时在标题行显示为 `key=value`,展开时每个参数占一行,格式为 `key: value`。MCP 调用的标题现在显示为 `server/tool`,结果默认折叠为 5 行。 - `bash` 和 `powershell` 的结构化结果(codemode 脚本接收的结果)现在最多可包含 1 MiB 输出,而不是面向模型的 2000 行或 50KB;同时新增 `truncated` 和 `full_output_path`。超长输出会保留开头和结尾各 512 KiB。空输出现在为 `""`,不再是 `(no output)`。 ### 修复 - 修复了 X11 剪贴板所有者接受未通告的图像目标时,剪贴板文本被错误识别为图像的问题([#9786](https://github.com/earendil-works/pi/issues/9786))。 - 阻止托管的 git 包自动安装 Pi 的 peer 依赖,并对在 `dependencies` 中列出由宿主提供的模块的扩展包发出警告([#9863](https://github.com/earendil-works/pi/issues/9863))。 - 修复了通过 `-e` 加载的固定版本 git 扩展在引用发生变化后仍继续使用首次下载的提交的问题([#9982](https://github.com/earendil-works/pi/issues/9982))。 - 修复了 `RpcClient` 在事件处理期间某个监听器取消订阅时跳过下一个事件监听器的问题;这可能导致 `collectEvents()` 之后的 `waitForIdle()` 超时([#9990](https://github.com/earendil-works/pi/issues/9990))。 - 修复了模型将省略的 `offset` 和 `limit` 发送为 `null` 时,读取整个文件的 `read` 调用被渲染为 `:1` 的问题([#9996](https://github.com/earendil-works/pi/issues/9996))。 - 修复了 pi 在首次收到助手响应之前退出时,新会话会丢失的问题。现在发送第一条用户消息时就会创建会话文件([#10000](https://github.com/earendil-works/pi/issues/10000))。 - 修复了未加载的 llama.cpp 自动加载预设覆盖缓存的运行时上下文窗口,并改用 GGUF 训练上下文窗口的问题([#10077](https://github.com/earendil-works/pi/issues/10077),[#10158](https://github.com/earendil-works/pi/pull/10158),由 [@cristinaponcela](https://github.com/cristinaponcela) 提交)。 - 修复了自定义主题忽略 `terminal.trueColor` 和其他终端能力覆盖设置、因而以 256 色渲染的问题([#9973](https://github.com/earendil-works/pi/issues/9973),[#10039](https://github.com/earendil-works/pi/pull/10039),由 [@christianklotz](https://github.com/christianklotz) 提交)。 - 修复了粘贴从 Finder 复制的文件时插入文件图标图像而非文件路径的问题;在 bash 模式下,路径现在会加引号([#9999](https://github.com/earendil-works/pi/issues/9999),[#10136](https://github.com/earendil-works/pi/pull/10136),由 [@christianklotz](https://github.com/christianklotz) 提交)。 - 修复了更换主题后,启动标题、已加载资源和聊天通知仍保留旧颜色的问题。 - 修复了 Fireworks 默认模型仍指向已移除的 Kimi K2.6 的问题;现在默认使用 Kimi K3。 - 修复了 OpenCode Go 默认模型仍指向已移除的 Kimi K2.6 的问题;现在默认使用 Kimi K3。 - 修复了 Together 默认模型仍指向已移除的 Kimi K2.6 的问题;现在默认使用 Kimi K3。 - 降低了长会话流式输出期间以及主题预览时的 CPU 使用率:页脚现在会缓存会话用量总计,折叠的 bash 结果会缓存预览,`sanitizeBinaryOutput()` 不再将输出拆分成逐字符数组。 - 修复了通过 `ctx.executeTool()`(例如从 codemode 脚本中)调用的工具用量未计入会话费用的问题;现在会将其加入发起调用的工具结果用量中。 - 修复了当已加载技能名称不包含 `skill` 中的字母时,继承的 `/skill` 自动补全列表为空的问题([#9944](https://github.com/earendil-works/pi/issues/9944))。 - 修复了在 `(`、`[`、`{`、`<` 或反引号等起始符后,继承的路径和 `@` 自动补全无法使用的问题。 - 修复了使用 Kitty 图形协议的终端中,继承的图像显示被拉伸的问题([#8938](https://github.com/earendil-works/pi/issues/8938),[#9957](https://github.com/earendil-works/pi/pull/9957),由 [@rwachtler](https://github.com/rwachtler) 提交)。 - 修复了扩展在关闭期间关闭浮层后,继承的 shell 光标在退出后仍保持隐藏的问题([#10026](https://github.com/earendil-works/pi/issues/10026))。 - 修复了在 `/settings` 子菜单中点击鼠标将其关闭后,继承的键盘输入会丢失的问题。 - 修复了通过 Vercel AI Gateway 写入继承的 Anthropic 1 小时缓存时,费用按 5 分钟缓存费率计算的问题([#9210](https://github.com/earendil-works/pi/issues/9210))。 - 修复了通过 OpenAI 兼容 API 直接调用 `stream()`/`complete()` 时,继承的模型级 `samplingParams` 被丢弃的问题([#9506](https://github.com/earendil-works/pi/issues/9506))。 - 修复了 Mistral GLM 请求在收到空内容增量后因 “Expected at most one leading ThinkChunk” 而失败的问题([#9674](https://github.com/earendil-works/pi/issues/9674))。 - 修复了继承的 OpenAI Fast 模式请求按标准费率计费的问题([#10034](https://github.com/earendil-works/pi/issues/10034))。 - 修复了继承的 Mistral 推理模型忽略所请求思考级别的问题([#9678](https://github.com/earendil-works/pi/issues/9678))。 - 修复了继承的 OpenCode Zen 和 OpenCode Go `qwen3.8-flash` 将思考内容作为纯文本重放到后续轮次的问题([#10047](https://github.com/earendil-works/pi/issues/10047))。 - 修复了来自 llama.cpp 等省略 `output_index` 的服务器的继承 OpenAI Responses 流可能导致工具调用混乱的问题;此类流现在会以错误结束([#9974](https://github.com/earendil-works/pi/issues/9974))。 - 修复了继承的 Anthropic 和 OpenAI Codex 浏览器登录在提供商重定向并返回授权错误后无限等待的问题;同时修复了 Anthropic 回调端口被占用时登录失败的问题。 - 修复了上游模型元数据不完整时,继承的 GitHub Copilot Claude Opus 5.5 提供不受支持的思考级别的问题。