← 返回更新日志

Pi v0.47.0

2026-01-16 · GitHub 原文
### 破坏性变更 - 直接使用 `Editor` 的扩展现在必须将 `TUI` 作为第一个构造函数参数传入:`new Editor(tui, theme)`。`tui` 参数在扩展工厂函数中可用。([#732](https://github.com/badlogic/pi-mono/issues/732)) ### 新增 - **OpenAI Codex 官方支持**:完全兼容 OpenAI 的 Codex CLI 模型(`gpt-5.1`、`gpt-5.2`、`gpt-5.1-codex-mini`、`gpt-5.2-codex`)。功能包括用于 OpenAI 白名单的静态系统提示词、通过会话 ID 实现提示词缓存,以及跨轮次保留推理签名。设置 `OPENAI_API_KEY` 并使用 `--provider openai-codex` 或选择 Codex 模型即可。([#737](https://github.com/badlogic/pi-mono/pull/737)) - 读取工具中新增 `pi-internal://` URL 方案,用于访问内部文档。模型可以读取 coding-agent 包中的文件(README、文档、示例)以了解如何扩展 pi。 - 扩展系统新增 `input` 事件,用于在代理处理用户输入前进行拦截、转换或处理。支持三种返回类型:`continue`(透传)、`transform`(修改文本/图像)、`handled`(无需 LLM 直接响应)。处理器可链式转换,并在返回 `handled` 时短路。([#761](https://github.com/badlogic/pi-mono/pull/761) by [@nicobailon](https://github.com/nicobailon)) - 扩展示例:`input-transform.ts` 演示输入拦截模式(快速模式、即时命令、源路由)([#761](https://github.com/badlogic/pi-mono/pull/761) by [@nicobailon](https://github.com/nicobailon)) - 自定义工具 HTML 导出:带有 `renderCall`/`renderResult` 的扩展现在可在 `/share` 和 `/export` 输出中渲染,并支持 ANSI 到 HTML 的颜色转换([#702](https://github.com/badlogic/pi-mono/pull/702) by [@aliou](https://github.com/aliou)) - 树形模式下的直接过滤快捷键:Ctrl+D(默认)、Ctrl+T(无工具)、Ctrl+U(仅用户)、Ctrl+L(仅带标签)、Ctrl+A(全部)([#747](https://github.com/badlogic/pi-mono/pull/747) by [@kaofelix](https://github.com/kaofelix)) ### 变更 - 技能命令(`/skill:name`)现在在 `AgentSession` 中展开,而非交互式模式。这使得技能命令可在 RPC 和打印模式中运行,并允许 `input` 事件在展开前拦截 `/skill:name`。 ### 修复 - 通过 `setEditorText` 加载大提示词时,编辑器不再破坏终端显示。内容现在支持垂直滚动,并带有指示器显示视口上方/下方的行数。([#732](https://github.com/badlogic/pi-mono/issues/732)) - 管道标准输入现在可正常工作:`echo foo | pi` 等同于 `pi -p foo`。当标准输入为管道时,由于交互式模式需要 TTY,打印模式将自动启用([#708](https://github.com/badlogic/pi-mono/issues/708)) - 当过滤器隐藏中间条目时,会话树现在会保留分支连接符和缩进,使后代节点连接到最近的可见祖先,且兄弟分支对齐。已在 TUI 和 HTML 导出中修复([#739](https://github.com/badlogic/pi-mono/pull/739) by [@w-winter](https://github.com/w-winter)) - 新增 `upstream connect`、`connection refused` 和 `reset before headers` 模式以支持自动重试错误检测([#733](https://github.com/badlogic/pi-mono/issues/733)) - 技能和提示词模板中的多行 YAML frontmatter 现在可正确解析。使用 `yaml` 库集中处理 frontmatter 解析。([#728](https://github.com/badlogic/pi-mono/pull/728) by [@richardgill](https://github.com/richardgill)) - `ctx.shutdown()` 现在会在退出前等待待处理的 UI 渲染完成,确保通知和最终输出可见([#756](https://github.com/badlogic/pi-mono/issues/756)) - OpenAI Codex 提供程序现在会对临时错误(429、5xx、连接失败)进行指数退避重试([#733](https://github.com/badlogic/pi-mono/issues/733))