Pi Coding Agent v1.5.0:破坏性变更工具参数校验与默认模型切换
v1.5.0
推荐理由
v1.5.0 包含破坏性变更:工具参数校验逻辑已迁移至 pi-schema,TypeBox 特有特性不再生效且 MCP 工具行为改变。使用自定义工具或 MCP 集成的开发者必须检查 schema 兼容性,避免运行时校验失败。
New Features
新功能
- Extension update changelogs: see what changed in installed extension packages on the next fresh launch after an update. Package authors can choose the changelog path, and collapseChangelog condenses the notices. See Show a changelog.
- Faster streaming: large tool calls are parsed incrementally, and code-heavy answers and tool rows reuse highlighting and rendered Markdown instead of repeating the work on every update. See Keep rendering responsive.
- Custom self-update commands: use PI_SELF_UPDATE_COMMAND or selfUpdateCommand to update pi through a wrapper or another package manager. See Custom update command.
- GPT-6.1 Terra: available through OpenAI, Azure OpenAI Responses, and OpenAI Codex, with tool search, mid-conversation thinking-level changes, and thinking off. Codex offers a 500K context window. See Models.
- 扩展更新日志:在更新后的下次全新启动时,查看已安装扩展包中的变更内容。扩展作者可以选择日志路径,collapseChangelog 选项可将通知折叠。参见显示更新日志。
- 更快的流式处理:大型工具调用会进行增量解析,代码密集型回答和工具行会复用高亮显示和渲染后的 Markdown,而不是在每次更新时重复执行这些操作。参见保持渲染响应能力。
- 自定义自更新命令:使用 PI_SELF_UPDATE_COMMAND 或 selfUpdateCommand 通过包装器或其他包管理器来更新 pi。参见自定义更新命令。
- GPT-6.1 Terra:可通过 OpenAI、Azure OpenAI Responses 和 OpenAI Codex 使用,支持工具搜索、对话中途的思维层级更改以及关闭思维模式。Codex 提供 500K 上下文窗口。参见模型。
Breaking Changes
破坏性变更
- Tool argument validation runs on @earendil-works/pi-schema. TypeBox features outside JSON Schema (Type.Refine(), Type.BigInt(), Type.Undefined(), codecs, Format.Set() formats) no longer apply to tool arguments; see Tool parameter schemas and TypeBox. Plain JSON Schema tools, including MCP tools, now get the same coercion as TypeBox tools, such as converting numeric strings and wrapping a single value into an array. Validation failures the model sees list pi-schema's messages (- path: missing, - limit: expected number, got string) instead of TypeBox's (must have required properties path, must be number).
- 工具参数验证现在基于 @earendil-works/pi-schema。TypeBox 中超出 JSON Schema 范围的功能(Type.Refine()、Type.BigInt()、Type.Undefined()、编解码器、Format.Set() 格式)不再适用于工具参数;参见工具参数模式和 TypeBox。纯 JSON Schema 工具(包括 MCP 工具)现在与 TypeBox 工具一样获得相同的类型强制转换,例如将数字字符串转换为数字,或将单个值包装为数组。模型看到的验证失败信息现在列出的是 pi-schema 的消息(- path: missing, - limit: expected number, got string),而不是 TypeBox 的消息(must have required properties path, must be number)。
Added
新增
- Extension packages can now show their changelog after an update. Pi reads pi.changelogPath from the package's package.json, or CHANGELOG.md in the package root, and on the next fresh launch shows entries newer than the last seen version under "Extension Updates". The collapseChangelog setting condenses this to one line per package (#5958, #8790)
- pi.exec() accepts a maxBuffer option that limits stdout and stderr combined, and its result has a truncated field that is true when output exceeded the limit (#11360)
- Device-code login (for example GitHub Copilot) now opens the verification page and copies the code when you press Enter. Providers can turn either action off with openBrowserOnConfirm: false or copyCodeOnConfirm: false (#9282, #9301)
- pi update can update Pi through a wrapper or another package manager. Set PI_SELF_UPDATE_COMMAND (for example mise use -g npm:{packageName}@{version}) or the global selfUpdateCommand setting; pi update runs it when pi.dev reports a newer release and fills {packageName}, {version}, and {installSpec} from that release. See Custom update command (#7756, #5607)
- Extensions can format the user's configured keybindings with keyText() and keyHint() from the tool render context and the message and entry renderer options. Importing these functions from @earendil-works/pi-coding-agent can resolve the extension's own copy of the package, which does not see pi's keybindings, so hints such as keyHint("app.tools.expand", "to expand") rendered without the key. The docs now recommend the injected functions (#4748)
- Added persisted session-entry messageId and ISO timestamp to MarkdownTransformContext. They are available when rendering saved entries and undefined for live rendering (#7952 by @vipentti)
- Added a blocked option to inline ctx.ui.custom() components so approval prompts and other custom dialogs can report that pi is waiting for user input. Overlays ignore the option. See Custom screens and overlays (#11428)
- Added Usage.cost.totalFromProvider to distinguish billed totals from catalog estimates in SDK and extension usage data; combined usage is marked provider-reported only when every part is (#11178)
- Added concrete responseModel metadata to messages from pi-messages providers such as Radius, including when a virtual model is requested. See AssistantMessage (#11265)
- Added GPT-6.1 Terra for OpenAI, Azure OpenAI Responses, and OpenAI Codex, with tool search and mid-conversation thinking-level changes. It supports thinking off; Codex offers a 500K context window
- 扩展包现在可以在更新后显示其更新日志。Pi 会从包的 package.json 中读取 pi.changelogPath,或者从包根目录的 CHANGELOG.md 中读取,并在下次全新启动时在“扩展更新”下显示比上次看到的版本更新的条目。collapseChangelog 设置会将这些条目压缩为每个包一行(#5958, #8790)
- pi.exec() 接受一个 maxBuffer 选项,用于限制 stdout 和 stderr 的总和,其结果包含一个 truncated 字段,当输出超过限制时为 true(#11360)
- 设备码登录(例如 GitHub Copilot)现在会在你按下 Enter 键时打开验证页面并复制代码。提供商可以通过 openBrowserOnConfirm: false 或 copyCodeOnConfirm: false 禁用任一操作(#9282, #9301)
- pi update 可以通过包装器或另一个包管理器来更新 Pi。设置 PI_SELF_UPDATE_COMMAND(例如 mise use -g npm:{packageName}@{version})或全局 selfUpdateCommand 设置;当 pi.dev 报告有新版本时,pi update 会运行该命令,并从该版本中填充 {packageName}、{version} 和 {installSpec}。请参阅自定义更新命令 (#7756, #5607)
- 扩展程序可以使用工具渲染上下文以及消息和条目渲染选项中的 keyText() 和 keyHint() 来格式化用户配置的快捷键。从 @earendil-works/pi-coding-agent 导入这些函数可以解析扩展程序自身的包副本,该副本无法看到 pi 的快捷键配置,因此会导致如 keyHint("app.tools.expand", "to expand") 等提示在渲染时缺少按键信息。文档现在推荐使用注入的函数 (#4748)
- 向 MarkdownTransformContext 添加了持久化的 session-entry messageId 和 ISO 时间戳。它们在渲染已保存的条目时可用,而在实时渲染时为 undefined(由 @vipentti 提交,#7952)
- 为 inline ctx.ui.custom() 组件添加了 blocked 选项,以便审批提示和其他自定义对话框能够报告 pi 正在等待用户输入。覆盖层(Overlays)会忽略此选项。请参阅自定义屏幕和覆盖层 (#11428)
- 新增 Usage.cost.totalFromProvider,用于在 SDK 和扩展程序的用量数据中区分计费总额与目录估算值;仅当所有部分均由提供商报告时,合并用量才会标记为 provider-reported(#11178)
- 向来自 pi-messages 提供商(如 Radius)的消息中添加了具体的 responseModel 元数据,包括请求虚拟模型时的情况。请参阅 AssistantMessage(#11265)
- 为 OpenAI、Azure OpenAI Responses 和 OpenAI Codex 新增了 GPT-6.1 Terra,支持工具搜索和对话中途的思维层级变更。它支持关闭思维模式;Codex 提供 500K 上下文窗口
Changed
更改
- Extensions keep importing Type, Static and TSchema from @earendil-works/pi-ai: Pi maps that import to pi-ai's compat entry plus the TypeBox it bundles, now that pi-ai itself no longer re-exports TypeBox, and its StringEnum there stays a TypeBox TUnsafe<T>. The built-in tool factories (createReadTool() and the others) return TypeBoxAgentTool<typeof schema>, which keeps params typed for TypeBox.
- Tightened system prompt
- pi update for installs from the pi.dev installer no longer passes --min-release-age=0 to npm ci. The release lockfile pins every package, so the flag had no effect, and security scanners that block it stopped the update (#11262)
- /model and /scoped-models now show a model's name next to its ID when the name adds words the ID lacks, such as a renamed models.json override (#5916, #11347)
- MCP OAuth sign-in now uses pi's Client ID Metadata Document by default when the authorization server supports it for public clients, and registers a client dynamically otherwise, like Codex, Claude Code, and opencode. Clients registered before stay in use while their redirect URI matches. The new default oauth.clientRegistration: "auto" registers when clientName or a non-default callbackUrl is set; "dcr" always registers. pi mcp add --oauth-client-registration sets the mode (#11426)
- Changed the default OpenAI model from gpt-5.5 to gpt-6.1-sol, including after ChatGPT sign-in when no model is selected (#11442)
- Updated the built-in model catalog to models.dev v2. Realtime and image-only models are no longer offered as chat models; newer OpenAI and Google chat models are included
- 扩展程序继续从 @earendil-works/pi-ai 导入 Type、Static 和 TSchema:Pi 将该导入映射到 pi-ai 的兼容入口及其捆绑的 TypeBox,因为 pi-ai 本身不再重新导出 TypeBox,且其内部的 StringEnum 仍保持为 TypeBox TUnsafe<T>。内置的工具工厂(createReadTool() 及其他)返回 TypeBoxAgentTool<type of schema>,从而保持参数针对 TypeBox 的类型安全。
- 收紧系统提示词
- 通过 pi.dev 安装程序安装的 pi update 不再向 npm ci 传递 --min-release-age=0 参数。由于发布锁定文件固定了每个包,该标志无效,且阻止该标志的安全扫描程序会中断更新(#11262)
- /model 和 /scoped-models 现在会在模型 ID 旁边显示其名称,当名称包含 ID 所缺少的词汇时(例如重命名的 models.json 覆盖)(#5916, #11347)
- MCP OAuth 登录现在在授权服务器支持公共客户端时默认使用 pi 的 Client ID Metadata Document,否则动态注册客户端,如 Codex、Claude Code 和 opencode。之前注册的客户端在其重定向 URI 匹配时仍可使用。新的默认 oauth.clientRegistration: "auto" 在设置 clientName 或非默认 callbackUrl 时进行注册;"dcr" 始终注册。pi mcp add --oauth-client-registration 设置模式 (#11426)
- 将默认 OpenAI 模型从 gpt-5.5 更改为 gpt-6.1-sol,包括 ChatGPT 登录后未选择模型的情况 (#11442)
- 更新内置模型目录至 models.dev v2。Realtime 和仅图像模型不再作为聊天模型提供;包含较新的 OpenAI 和 Google 聊天模型
Fixed
已修复
- Updated glob matching to prevent denial of service from amplified glob patterns.
- Fixed a saved "Do not trust" decision being ignored for projects without trust-requiring resources, for example a folder with only AGENTS.md. pi auto-trusted such projects, so ctx.isProjectTrusted() returned true and package commands treated them as trusted. A saved decision in trust.json now takes precedence; auto-trust applies only when no decision is saved (#10947)
- Fixed Shift+Enter queueing a follow-up instead of inserting a newline in Apple Terminal setups that send ESC + Return. pi now checks the local Shift key state for that sequence, as it already did for plain Return; Alt+Enter without Shift still queues a follow-up (#11559)
- Fixed the working status (OSC 7501) disappearing in Rex and iTerm2 during runs in regular TUI mode. Rendered messages wrote OSC 133 prompt markers to the terminal, which the terminal treats as a new shell prompt; regular mode no longer writes them (#11519)
- Fixed compaction, branch summaries, and bug-report summaries in SDK sessions passing the stored OAuth token back to the model runtime as an explicit API key. Provider auth that treats explicit keys differently from stored OAuth now sees the OAuth login, as normal prompts do (#11520)
- Fixed a redundant system prompt update (tools, rules) when an extension set the same active tools in a different order, for example a reversed pi.setActiveTools() list. Tools that stay active now keep their order and newly activated tools are appended (#11495)
- Fixed pi.exec() crashing pi with RangeError: Invalid string length when a command printed more output than fits in a string. The default output cap is the smaller of 256 MiB and the runtime string limit; past the cap, the command is terminated and the result has truncated: true and a nonzero exit code (#11360)
- Fixed pi.exec() never returning when a command ignored SIGTERM after a timeout or abort. pi now sends SIGKILL 5 seconds later, as intended
- Fixed pi install and pi remove adding ever deeper nested entries to the npm package-lock.json when the agent directory is reached through a symlink, such as ~/.pi linked into a dotfiles repo. pi now passes the resolved real path to npm (#11358)
- 更新 glob 匹配以防止因放大的 glob 模式导致的拒绝服务攻击。
- 修复了对无需信任资源的项目(例如仅包含 AGENTS.md 的文件夹)忽略已保存的“不信任”决策的问题。pi 自动信任此类项目,因此 ctx.isProjectTrusted() 返回 true,且包命令将其视为受信任。trust.json 中的已保存决策现在优先;仅在未保存决策时应用自动信任 (#10947)
- 修复了在发送 ESC + Return 的 Apple Terminal 设置中 Shift+Enter 排队后续操作而非插入换行符的问题。pi 现在检查该序列的本地 Shift 键状态,正如它对普通 Return 所做的那样;不带 Shift 的 Alt+Enter 仍然会排队后续操作 (#11559)
- 修复了在 Rex 和 iTerm2 中常规 TUI 模式下运行期间工作状态 (OSC 7501) 消失的问题。渲染的消息向终端写入 OSC 133 提示标记,终端将其视为新 shell 提示;常规模式不再写入它们 (#11519)
- 修复了 SDK 会话中的压缩、分支摘要和错误报告摘要将存储的 OAuth 令牌作为显式 API 密钥传递回模型运行时的问题。将显式密钥与存储的 OAuth 区别对待的提供商身份验证现在能看到 OAuth 登录,就像正常提示一样 (#11520)
- 修复了当扩展以不同顺序设置相同的活跃工具(例如反转的 pi.setActiveTools() 列表)时冗余的系统提示更新(工具、规则)。保持活跃的工具现在保留其顺序,新激活的工具被追加 (#11495)
- 修复了当命令输出的内容超过字符串容量时,pi.exec() 因 RangeError: Invalid string length 导致 pi 崩溃的问题。默认输出上限为 256 MiB 与运行时字符串限制中的较小值;超出上限后,命令将被终止,结果中 truncated 字段为 true 且退出码非零 (#11360)
- 修复了当命令在超时或中止后忽略 SIGTERM 信号时,pi.exec() 永远不返回的问题。现在 pi 会按预期在 5 秒后发送 SIGKILL 信号
- 修复了当代理目录通过符号链接(例如将 ~/.pi 链接到 dotfiles 仓库)访问时,pi install 和 pi remove 向 npm package-lock.json 添加越来越深的嵌套条目问题。现在 pi 会将解析后的真实路径传递给 npm (#11358)
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力