黄奕彬

外部精选

Pi 0.87.0

本文来自外部来源,不是黄奕彬的原创文章。本站提供原文入口,并在采集端生成 AI 结构化摘要、解读与中文翻译(如有),一切以原文为准。

阅读原文(pi.dev)
来源
Pi Changelog ↗
作者 / 署名
未标注
发布日期
本站收录时间
原文域名
pi.dev

以上时间均为北京时间;来源更新时间由来源提供,不代表首次发布时间。

结构化摘要 AI 生成

背景与问题

面向 Pi 0.87.0 的版本发布说明,读者是 Pi 的二次开发者、扩展作者与宿主集成方。背景问题:此前版本中,编辑模型上下文需要改写历史、扩展缺少可操作的生命周期边界、图像输入限制无法按模型配置,且存在上下文编辑产出非法内容、用量核算错误、缓存误重建、工具声明丢失等缺陷。

本版本要解决的核心是:在不改写原始会话历史的前提下精细控制发送给模型的上下文。

方法或内容

发布说明分四节:

  • 新特性:规范化会话上下文与扩展边界(ContextEditEntry)、全量 transcript 上下文扩展(context_with_system)、按模型图像输入限制(inputLimits.images.resize)。
  • 破坏性变更:移除 shouldStopAfterTurn、扩展 SessionEntry/ExtensionEvent 联合类型、SessionManager 成为 provider context 权威、ExtensionRunner.emit() 不再接受 turn_end、推迟 agent_settled 处理器请求的运行。
  • 新增:appendContextEdit、appendCompaction、可操作边界事件等 5 项。
  • 修复:约 11 项缺陷,覆盖上下文编辑、用量核算、缓存、工具声明、/bug、CLI 输入与 OpenAI 兼容端点。

关键发现 / 结果

关键变更点:

  • sessionManager.appendContextEdit(entryId, null) 可在未来 provider context 中省略一条消息,不改原始历史、用量与 UI 历史。
  • finishTurn 替代 shouldStopAfterTurn:在 turn_end 前运行、之后应用决策,并接收 error 与 aborted 响应;迁移时对硬退出返回 undefined。
  • 向 session.agent.state.messages 赋值不再替换未来请求历史;需改用 SessionManager.inMemory(cwd, { id }, entries)、session.navigateTree(),或经 session.sessionManager 追加后调用 session.refreshContext()。
  • 新增 context_with_system:在 context handlers 之后、于含 system 消息的完整 transcript 上运行并逐字发送结果。
  • sessionManager.appendCompaction(summary, null, tokensBefore) 提供 retain-none 压缩输入。
  • 修复后:字符串上下文编辑替换生成文本块;被放弃的模型尝试不再留在未来上下文;context handlers 不再丢弃 prompt 与工具声明;/bug 离线模式不再上传;GIF 开头的文本文件不再被误判为图像。

原文未说明性能或兼容性数据。

结论与意义

原文未给出显式结论段,隐含结论:升级到 0.87.0 的 TypeScript 消费者与扩展作者必须按破坏性变更逐项迁移(处理 context_edit、AgentBeforeSettleEvent 等新联合类型成员,替换被移除的 API)。适用边界:所有行为以 0.87.0 为准,并与 @earendil-works/pi-agent-core 的变更联动。原文未说明后续版本的稳定性承诺。

AI 解读 AI 生成

方法:按「时空变量」分析(时间 / 空间 / 变量,严格区分包含、相关与因果),对象包括原文作者、署名人员与关键技术及其实际原理;结论用「元反空」(元思考、反思考、空思考、综合)整理。

时间:何时发生,现在是否仍成立

发布时间为来源日期 2026年9月21日 08:00(北京时间),即北京时间 2026-09-21 08:00。内容描述该版本发布当天的变更,属版本快照:API 形态与修复效果仅在 0.87.0 及其依赖链上成立。后续版本是否延续这些行为,原文未说明。

空间:谁的环境 / 场景

适用环境:Pi 产品 0.87.0 版本,经 npm 与 GitHub release 分发。具体场景:

  • 基于 AgentSession/SessionManager/ExtensionRunner 的 TypeScript 宿主集成与扩展作者。
  • 通过 models. 配置 inputLimits.images.resize 的部署。
  • 使用 OpenAI 兼容 Chat Completions 端点(未显式声明支持严格 schema 的继承端点)的部署。
  • 使用 /bug 命令与 CLI @file 输入的本地使用形态。

变量:实际改变了什么

相对此前的实际改变:

  • 行为:移除 shouldStopAfterTurn;session.agent.state.messages 赋值失效;ExtensionRunner.emit() 拒绝 turn_end;agent_settled 处理器请求的运行被推迟至所有 settled 处理器完成(仍观察到 ctx.isIdle() === true)。
  • 结构:SessionEntry 新增 context_edit、ExtensionEvent 新增 AgentBeforeSettleEvent、TurnEndEvent 增加必填 boundary 字段。
  • 数据:编辑后上下文的用量不再被丢弃或复用过期值;过期的空闲缓存不再被重建。
  • 价格原文未说明。

区分:包含 ≠ 相关 ≠ 因果

包含:ContextEditEntry 是 SessionEntry 联合类型的成员;AgentBeforeSettleEvent 是 ExtensionEvent 联合类型的成员。相关:崩溃诊断提示只识别堆栈中出现的已加载扩展,原文未断言这些扩展导致了崩溃。

因果:多条 Fixed 条目以 caused/leaving/made 明确因果,如 context handlers 丢弃 prompt 与工具声明导致请求缺少内置工具、使 Codex 输出原始 tool-call 文本。其余条目仅叙述现象与修复结果,是否构成因果原文未逐一说明。

对象:作者/署名与关键技术原理

署名:结构化作者字段为空,原文未标注作者;正文两条修复标注贡献者 @christianklotz(#9841 /bug 离线上传、#9830 frontmatter 警告),仅为该两条修复的贡献标注,非整体署名。关键技术(按原文描述):

  • ContextEditEntry:append-only 上下文编辑,replacement: null 表示省略,否则传内容替换。
  • SessionManager:AgentSession provider context 的权威来源,支持恢复、navigateTree() 导航与 refreshContext() 刷新。
  • context_with_system:在 context handlers 之后、含 system 消息的完整 transcript 上运行,结果逐字发送。
  • finishTurn:先于 turn_end 运行、之后应用决策,并接收 error/aborted 响应。
  • emitBoundary(baseEvent, buildContext):宿主用于分发可操作边界。
  • inputLimits.images.resize:按模型的缓存安全图像缩放,作用于附件、图像读取与工具结果图像。

元反空综合结论

元——这条内容本质在解决两个工程问题:让模型看到的上下文可被省略、替换、压缩而原始历史与用量不变(上下文可编辑性),以及让扩展在回合结束、agent 落定等边界上做出可持久化的决策(扩展生命周期边界)。

反——最可能失效或有边界的主张:一切 API 形态仅是 0.87.0 快照,破坏性变更本身即证明 API 在持续演进;对 Codex 输出原始 tool-call 文本等下游行为的描述依赖当时集成状态;「cache-safe」缩放未给出量化依据;推迟 agent_settled 运行的语义依赖通知派发的实现细节。

空——去掉叙事后的必要事实:3 项新特性、5 项破坏性变更、5 项新增能力、约 11 项修复,附议题编号与迁移替代方案,全部限定于 Pi 0.87.0。

综合:这是一份面向二次开发者、可信度较高的发布说明,可据此规划迁移;但应视为版本快照而非长期契约。

中文译文 AI 生成

更新日志发布说明2026年9月21日Pi 0.87.0 GitHub release npm

新特性

  • 规范的会话上下文与扩展边界——无需重写历史即可编辑模型上下文,并添加可操作的生命周期钩子。参见 ContextEditEntry 和扩展事件。
  • 完整转录的上下文扩展——使用 context_with_system 进行按请求的系统消息转换。参见 context_with_system。
  • 按模型的图像输入限制——为附件、读取和工具结果图像按模型配置缓存安全的图像缩放。参见 Image Input Limits。

破坏性变更

  • 移除了继承的 shouldStopAfterTurn agent 选项。请改用 finishTurn 并返回 { action: "end" }。finishTurn 在 turn_end 之前运行,但会在其后应用该决策,并且它也会接收 error 和 aborted 响应;迁移普通响应谓词时,请对这些硬退出返回 undefined。完整的前后对比示例请参见 @earendil-works/pi-agent-core 更新日志。
  • 向导出的 SessionEntry 联合类型添加了 ContextEditEntry。对 entry 进行穷举 switch 的 TypeScript 消费方必须处理 context_edit;省略时使用 replacement: null,否则使用内容替换。
  • 使 SessionManager 成为 AgentSession provider 上下文的权威来源。赋值 session.agent.state.messages 不再会替换后续请求历史;请使用 SessionManager.inMemory(cwd, { id }, entries) 恢复,使用 session.navigateTree() 导航,或通过 session.sessionManager 追加并调用 session.refreshContext()。
  • 扩展了 TurnEndEvent,新增必填的边界字段,并向导出的 ExtensionEvent 联合类型添加了 AgentBeforeSettleEvent。构造事件或对 ExtensionEvent 进行穷举 switch 的消费方必须处理这些新形状。ExtensionRunner.emit() 不再接受 turn_end;宿主集成应使用 emitBoundary(baseEvent, buildContext) 分发可操作的边界。
  • 将 agent_settled 处理器中请求的运行推迟到所有 settled 处理器完成之后。处理器仍会观察到 ctx.isIdle() === true,但在同一次通知分发期间不会再看到重入的 agent_start。

新增

  • 新增了仅追加的模型上下文编辑。例如,sessionManager.appendContextEdit(entryId, null) 会在后续 provider 上下文中省略一条消息,而不改变原始历史、用量或 UI 历史。
  • 新增了可操作的 turn_end 和 agent_before_settle 扩展边界。返回 { entries: [...event.entries, draft], continue: true } 可按顺序持久化结构性条目,并确保发起一次后续 provider 请求,而不改变 steering 或后续调度。
  • 新增了不保留任何条目的压缩输入:sessionManager.appendCompaction(summary, null, tokensBefore) 会将该次压缩自身的 ID 存储为其保留的边界。
  • 新增了 context_with_system 扩展事件,它在上下文处理器之后对包含系统消息的完整转录运行,并逐字发送其结果。参见 context_with_system。
  • 通过 models.json 中的 inputLimits.images.resize 新增了按模型的图像缩放配置,应用于文件附件、图像读取和工具结果图像(#9631)。

修复

  • 修复了字符串形式的上下文编辑替换会生成无效的 assistant 和 tool-result 消息内容而非文本块的问题。
  • 修复了上下文不可见的边界元数据与替换编辑导致新追加或替换的输入在其首次 provider 请求之前被摘要的问题。
  • 修复了已编辑上下文的用量核算问题:它既会丢弃最新一次上下文编辑之后捕获的有效 assistant 用量,又会在后续压缩使其过期后重用该用量。
  • 修复了部分错误重试和最终的长度/溢出恢复会在后续 provider 上下文中保留被放弃的模型尝试的问题;运行后恢复产生的省略现在会被持久化,且不会隐藏原始转录历史或改变队列调度。
  • 修复了会过滤或切片消息的上下文处理器丢弃 prompt 和工具声明的问题,这在扩展驱动的压缩之后会导致请求缺少内置工具,或使 Codex 输出原始的工具调用文本。处理器不再看到系统消息;Pi 会在其运行后恢复 prompt 和工具状态。参见 context(#9789、#9822)。
  • 修复了 /bug 在离线模式下仍允许上传的问题,同时保留本地 zip 导出(#9841,作者 @christianklotz)。
  • 修复了空闲 prompt 缓存预热在其定时器或扩展决策被延迟时会重建过期缓存的问题。
  • 通过提示改进了崩溃诊断,可识别出现在堆栈跟踪中的已加载扩展。
  • 修复了以 GIF 开头的文本文件被误分类为图像并从读取和 CLI @file 输入中被省略的问题(#9755)。
  • 修复了格式错误的 prompt 模板 frontmatter 被静默忽略而非报告为资源警告的问题(#9830,作者 @christianklotz)。
  • 修复了继承的未知 OpenAI 兼容 Chat Completions 端点在未明确声明支持的情况下收到严格工具 schema 的问题(#9816)。
展开原文提取正文(采集端自动提取,可能有缺失)

ChangelogRelease notesSep 21, 2026Pi 0.87.0GitHub releasenpmNew Features

Canonical session context and extension boundaries — Edit model context without rewriting history and add actionable lifecycle hooks. See ContextEditEntry and extension events. Full-transcript context extensions — Use context_with_system for per-request system-message transformations. See context_with_system. Per-model image input limits — Configure cache-safe image resizing per model for attachments, read, and tool-result images. See Image Input Limits.

Breaking Changes

Removed the inherited shouldStopAfterTurn agent option. Use finishTurn and return { action: "end" } instead. finishTurn runs before turn_end but applies the decision afterward, and it also receives error and aborted responses; migrate normal-response predicates by returning undefined for those hard exits. See the @earendil-works/pi-agent-core changelog for a complete before-and-after example. Added ContextEditEntry to the exported SessionEntry union. TypeScript consumers with exhaustive entry switches must handle context_edit; use replacement: null for omission and a content replacement otherwise. Made SessionManager canonical for AgentSession provider context. Assigning session.agent.state.messages no longer replaces future request history; restore with SessionManager.inMemory(cwd, { id }, entries), navigate with session.navigateTree(), or append through session.sessionManager and call session.refreshContext(). Expanded TurnEndEvent with required boundary fields and added AgentBeforeSettleEvent to the exported ExtensionEvent union. Consumers constructing events or exhaustively switching on ExtensionEvent must handle the new shapes. ExtensionRunner.emit() no longer accepts turn_end; host integrations dispatch actionable boundaries with emitBoundary(baseEvent, buildContext). Deferred runs requested from agent_settled handlers until all settled handlers finish. Handlers still observe ctx.isIdle() === true, but no longer see a reentrant agent_start during the same notification dispatch.

Added

Added append-only model-context edits. For example, sessionManager.appendContextEdit(entryId, null) omits one message from future provider context without changing raw history, usage, or UI history. Added actionable turn_end and agent_before_settle extension boundaries. Return { entries: [...event.entries, draft], continue: true } to persist structural entries in order and ensure one next provider request without changing steering or follow-up scheduling. Added retain-none compaction input: sessionManager.appendCompaction(summary, null, tokensBefore) stores the compaction's own ID as its kept boundary. Added the context_with_system extension event, which runs after context handlers on the full transcript including system messages and sends its result verbatim. See context_with_system. Added per-model image resize profiles through inputLimits.images.resize in models.json, applied to file attachments, image reads, and tool-result images (#9631).

Fixed

Fixed string context-edit replacements producing invalid assistant and tool-result message content instead of text blocks. Fixed context-invisible boundary metadata and replacement edits causing newly appended or replaced input to be summarized before its first provider request. Fixed edited-context accounting both discarding valid assistant usage captured after the latest context edit and reusing that usage after a later compaction made it stale. Fixed selected error retries and final length/overflow recovery retaining abandoned model attempts in future provider context; post-run recovery omissions are now persisted without hiding raw transcript history or changing queue scheduling. Fixed context handlers that filter or slice messages dropping the prompt and tool declarations, which after extension-driven compaction left requests without built-in tools or made Codex emit raw tool-call text. Handlers no longer see system messages; Pi restores the prompt and tool state after they run. See context (#9789, #9822). Fixed /bug allowing uploads in offline mode while preserving local zip exports (#9841 by @christianklotz). Fixed idle prompt-cache warming rebuilding expired caches when its timer or an extension decision is delayed. Improved crash diagnostics with hints identifying loaded extensions that appear in the stack trace. Fixed text files beginning with GIF being misclassified as images and omitted from read and CLI @file input (#9755). Fixed malformed prompt template frontmatter being silently ignored instead of reported as a resource warning (#9830 by @christianklotz). Fixed inherited unknown OpenAI-compatible Chat Completions endpoints receiving strict tool schemas unless they explicitly advertise support (#9816).

原文入口

阅读原文(pi.dev)

原文将在新窗口打开。收录时间不是内容更新时间;正文、译文与解读的版权归原作者/来源所有,本站仅作个人阅读辅助并保留原文入口;页面时间均为北京时间。

作者/署名来自原文结构化字段(Atom/RSS/HTML meta/JSON-LD;GitHub release 显示的是发布者账号),未经模型补充。

了解来源批准与收录规则