站点规划Site plan#
一句话结论Takeaway信息架构 = 一个总览页 + 每个包一个子页面,全部使用同一个包模板。计划已完成:全部 14 个包都已深挖(9 项模板齐全、各有 10 页演示),全站 125 张图。Information architecture = one overview page + one page per package, all following the same package template. The plan is complete: all 14 packages are fully covered (all nine template parts, a 10-slide deck each), 125 diagrams site-wide.
| 包Package | npm | 状态Status | 定位Role |
|---|---|---|---|
| agent-core | @earendil-works/pi-agent-core | 已完成Done | 通用 Agent:状态、事件循环、工具执行与钩子General-purpose agent with transport abstraction, state management, and attachment support |
| pi-ai | @earendil-works/pi-ai | 已完成Done | 统一的 LLM API:模型目录、认证、42 个 provider、事件流Unified LLM API with automatic model discovery and provider configuration |
| coding-agent | @earendil-works/pi-coding-agent | 已完成Done | 编码智能体 CLI:工具、会话树、压缩、扩展与运行模式Coding agent CLI with read, bash, edit, write tools and session management |
| tui | @earendil-works/pi-tui | 已完成Done | 差分渲染的终端 UI 库Terminal User Interface library with differential rendering for efficient text-based applications |
| mcp | @earendil-works/pi-mcp | 已完成Done | 独立的 Model Context Protocol 客户端Standalone Model Context Protocol client for pi and other applications |
| codemode | @earendil-works/pi-codemode | 已完成Done | 沙箱化 JavaScript 执行:唯一能力是调用注入的工具Sandboxed JavaScript execution where the only capability is calling injected tools |
| telemetry | @earendil-works/pi-telemetry | 已完成Done | 与厂商无关的遥测契约与类型化 schema 工具Vendor-neutral telemetry contracts and typed schema utilities for pi |
| chord | @earendil-works/chord | 已完成Done | 应用组合运行时:服务、复制状态、RPC 与插件Application composition runtime for services, replicated state, RPC, and plugins |
| durable | @earendil-works/pi-durable | 已完成Done | 持久化的会话、任务与文档运行时Durable conversation, task, and document runtime for Pi |
| env | @earendil-works/pi-env | 已完成Done | Pi Durable 的远程执行环境(经 SSH 部署的小型守护进程)Remote execution environments for Pi Durable: a small daemon deployed over SSH and its ExecutionEnv client |
| protocol | @earendil-works/pi-protocol | 已完成Done | 远程 pi 会话的传输无关 CBOR 协议Transport-neutral CBOR protocol for remote pi sessions |
| client | @earendil-works/pi-client | 已完成Done | 基于分帧 CBOR 的远程 pi 会话客户端Transport-neutral client for remote pi sessions over framed CBOR bytes |
| server | @earendil-works/pi-server | 已完成Done | 实验性的 pi 服务端experimental server package for pi |
| evals | @earendil-works/pi-evals | 已完成Done | 私有包:行为评测与成对的文档提升对比(Docker 隔离)Private package: behavioural evals and paired documentation-lift comparisons (Docker-isolated) |
包模板Package template#
每个包页面按以下 9 项组织;完成的包页面全部覆盖,占位页显示进度。Every package page is organised by these nine parts; finished pages cover all of them, placeholders show progress.
- 概览Overview定位、依赖、规模、一句话结论role, deps, size, one-line takeaway
- 公共 APIPublic API导出路径与导出符号(逐行链接)export paths and exported symbols (line-linked)
- 内部架构图Internal architecture模块 / 文件之间的结构structure between modules and files
- 关键流程Key flows时序、状态机、数据流sequences, state machines, data flow
- 数据类型Data types核心接口与它们的关系core interfaces and how they relate
- 扩展点Extension points宿主可以替换或注入的地方where a host can plug in or replace behaviour
- 关键文件Key files链接到 v1.1.0 的具体行links to exact lines at v1.1.0
- 测试Tests测试文件与用例数test files and case counts
- 交叉链接Cross-links相关包与相关章节related packages and sections
下一步Next steps#
- 计划已完成Plan complete — 8 批之后,全部 14 个包都已按同一模板完成深挖:125 张手绘图(第一版 12 张 + 新增 113 张),14 套包演示文稿。没有剩余的批次;之后的工作是随新版本更新。After eight batches all 14 packages are covered with the same template: 125 hand-laid diagrams (12 from the first edition + 113 new), and 14 package decks. No batches remain; future work is keeping up with new releases.
本版站点变更What changed in this edition#
本次更新:telemetry 与 evals 完成(第 8 批),全部 14 个包完成This update: telemetry and evals done (batch 8) — all 14 packages covered
- telemetry 深挖:新增 8 张图(契约与两个参考上下文、span 模型、一次 startSpan()、适配器契约与 9 个一致性用例、InMemoryTelemetryContext、可序列化 schema、类型化启动器、在 pi 中的使用)。telemetry deep dive: 8 new diagrams (the contract and two reference contexts, the span model, one startSpan(), the adapter contract and its 9 conformance cases, InMemoryTelemetryContext, serializable schemas, typed starters, how pi uses it).
- evals 深挖:新增 8 张图(三个目录、7 个评测、一次 eval:docs、任务计划、Dockerfile 的 5 个阶段、三层沙箱、一次 harness 运行、报告与一个按 report.ts 规则算出的 report.txt)。evals deep dive: 8 new diagrams (three directories, the seven evals, one eval:docs run, the task plan, the five Dockerfile stages, the three-layer sandbox, one harness run, the report with a report.txt computed by the report.ts rules).
- 两个包各有 10 页的演示文稿;evals 是私有包、没有 exports,公共 API 一节改为 npm 脚本、参数与 src/ 各模块的逐行导出表。A 10-slide deck for each package; evals is private with no exports, so its public-API section lists the npm scripts, flags and line-linked exports of each src/ module.
- 路线图计划完成:全部 14 个包已深挖,全站合计 125 张图。The roadmap plan is complete: all 14 packages covered, 125 diagrams site-wide.
上次更新:protocol、client 与 server 完成(第 7 批)Previous update: protocol, client and server done (batch 7)
- protocol 深挖:新增 8 张图(三层结构、一条消息的往返、8 种消息、RpcTarget 路由、一条连接上的消息顺序、分帧、严格的 CBOR 子集、与 chord 的分界)。protocol deep dive: 8 new diagrams (three layers, one message there and back, the 8 messages, RpcTarget routes, message order on one connection, framing, the strict CBOR subset, the boundary with chord).
- client 深挖:新增 8 张图(模块、连接状态机、一个请求、服务订阅、附着与 Chord 适配器、字节传输与 Unix 写队列、本机发现、失败语义与恢复)。client deep dive: 8 new diagrams (modules, the connection state machine, one request, service subscriptions, attachments and the Chord adapter, byte transports and the Unix write queue, local discovery, failure semantics and recovery).
- server 深挖:新增 8 张图(模块、ServerHost 契约、连接阶段与握手、请求处理、SessionRouter、附着的释放、Unix 监听器、错误码与测试工具)。server deep dive: 8 new diagrams (modules, the ServerHost contract, connection stages and the handshake, request handling, SessionRouter, attachment release, the Unix listener, error codes and the testing kit).
- 三个包各有 10 页的演示文稿;protocol 与 server 的根入口用
export *,公共 API 表改为展开到声明所在的模块并逐行链接;当时全站合计 109 张图。A 10-slide deck for each package; protocol and server useexport *at the root, so their public-API tables expand to the declaring modules with line links; 109 diagrams site-wide at the time. - telemetry 与 evals 顺延到第 8 批。telemetry and evals move to batch 8.
更早:chord、durable 与 env 完成(第 6 批)Earlier: chord, durable and env done (batch 6)
- chord 深挖:新增 8 张图(模块、facet 生命周期、热重载、服务、远程服务、复制状态、增量与草稿、打包与加载)。chord deep dive: 8 new diagrams (modules, the facet lifecycle, hot reload, services, remote services, replicated state, deltas and drafts, bundling and loading).
- durable 深挖:新增 8 张图(模块、数据模型、一次运行、任务、收件箱、文档、存储、扩展)。durable deep dive: 8 new diagrams (modules, the data model, one run, tasks, the inbox, documents, storage, extensions).
- env 深挖:新增 8 张图(模块、TypeScript 与 Rust 的分工、SSH 部署、帧格式、一次连接、命令执行、文件操作、文件监视)。env deep dive: 8 new diagrams (modules, the TypeScript / Rust split, SSH deployment, the frame format, one connection, command execution, file operations, file watching).
- 三个包各有 10 页的演示文稿,公共 API 表按 index.ts 的导出自动生成;当时全站合计 85 张图。A 10-slide deck for each package and public-API tables generated from the index.ts exports; 85 diagrams site-wide at the time.
更早:mcp 与 codemode 完成(第 5 批)Earlier: mcp and codemode done (batch 5)
- mcp 深挖:新增 8 张图(模块、连接生命周期与握手、请求与分页、stdio 传输、Streamable HTTP、OAuth、结果内容与错误、在 pi 中的使用)。mcp deep dive: 8 new diagrams (modules, connection lifecycle and handshake, requests and paging, the stdio transport, Streamable HTTP, OAuth, result content and errors, how pi uses it).
- codemode 深挖:新增 8 张图(模块、三层隔离、一次执行、工具调用往返、脚本 API 与限额、类型与源码格式、TypeScript 声明、在 pi 中的使用)。codemode deep dive: 8 new diagrams (modules, three layers of isolation, one execution, the tool-call round trip, the script API and limits, types and the source format, TypeScript declarations, how pi uses it).
- 两个包各有 10 页的演示文稿。A 10-slide deck for each package.
- 演示文稿:较高的图(如 tui 的差分渲染、coding-agent 的会话装配与 JSONL 格式)改用“左文右图”版式,显示得更大。Decks: tall diagrams (such as tui differential rendering, coding-agent session wiring and the JSONL format) now use a text-beside-diagram layout and render larger.
- telemetry 按路线图留在第 7 批。telemetry stays in batch 7, as planned.
更早:coding-agent 与 tui 完成Earlier: coding-agent and tui done
- coding-agent 深挖:新增 9 张图(模块、CLI 启动、AgentSession 装配、会话替换、内置工具、JSONL 格式、扩展 API、RPC 协议、设置与资源),并保留第一版的 4 节coding-agent deep dive: 9 new diagrams (modules, CLI start-up, AgentSession wiring, session replacement, built-in tools, the JSONL format, the extension API, the RPC protocol, settings and resources), keeping the four first-edition sections.
- tui 深挖:新增 8 张图(模块、组件模型、差分渲染、两种屏幕、输入与按键、编辑器与补全、覆盖层、终端能力)。tui deep dive: 8 new diagrams (modules, the component model, differential rendering, the two screens, input and keys, the editor and autocomplete, overlays, terminal capabilities).
- 两个包各有 10 页的演示文稿;两个包的公共 API 表按 index.ts 的导出自动生成。A 10-slide deck for each package; both public-API tables are generated from the index.ts exports.
- 修复:中文幻灯片页脚显示英文站名。Fix: Chinese slides showed the English site name in the footer.
信息架构Information architecture
- 单页 → 总览 + 14 个包子页面 + 路线图;全站顶部导航带包切换器,子页面有面包屑。Single page → overview + 14 package pages + roadmap; a global top nav with a package switcher, breadcrumbs on sub-pages.
- 第一版 12 节全部保留:4 节留在总览,8 节迁到所属包页面;旧锚点自动跳转。All 12 first-edition sections kept: 4 stay on the overview, 8 moved to their package pages; old anchors redirect.
新内容New content
- agent-core 与 pi-ai 深挖:新增 16 张手绘图(当时合计 28 张),公共 API、扩展点、测试与交叉链接。agent-core and pi-ai deep dives: 16 new hand-laid diagrams (28 in total at the time), plus public API, extension points, tests and cross-links.
- 两个包各自的演示文稿;12 个包的自动占位页。A slide deck for each of the two packages; generated placeholder pages for 12 packages.
源码版本Source version
- 分析对象从开发中的提交
4130bd5改为发布标签v1.1.0(abe508e,2026-10-07);所有 GitHub 链接改为指向该标签,所有行号重新计算。The analysed source moved from the in-progress commit4130bd5to the release tagv1.1.0(abe508e, 2026-10-07); every GitHub link now targets the tag and every line number was recomputed. - 构建时断言:所有 14 个包的 package.json 版本均为 1.1.0;12 项核心计数(provider、API、事件、RPC 命令等)在标签上与第一版一致。Build-time assertions: all 14 package.json versions are 1.1.0; the 12 core counts (providers, APIs, events, RPC commands …) are unchanged at the tag.
名称Name
- 站点更名为“图解 Pi Agent”。The site is now called “Pi Agent, Illustrated”.
Pi 1.1.0 变更日志Pi 1.1.0 changelog#
Pi v1.1.0 发布于 2026-10-07。以下摘自各包 CHANGELOG.md 的 [1.1.0] 段(原文为英文,每类最多显示 4 条)。合计:Added 29 · Changed 5 · Breaking Changes 4 · Fixed 35 · New Features 5。Pi v1.1.0 was released on 2026-10-07. Excerpts from each package's CHANGELOG.md [1.1.0] section (at most four per category). Totals: Added 29 · Changed 5 · Breaking Changes 4 · Fixed 35 · New Features 5.
agent-core已完成DoneAdded 1Changed 1
Added · 1
- Added
durationMsto tool result messages,AgentToolCallOutcome, andtool_execution_endevents: how longexecute()took, measured with a monotonic clock and excluding hooks. Calls that did not run have …
Changed · 1
streamProxy()returns anAssistantMessageEventStream, so proxied responses getdurationMslike direct ones
pi-ai已完成DoneBreaking Changes 1Added 6Changed 1Fixed 10
Breaking Changes · 1
- A stream function must return an
AssistantMessageEventStream, for example fromcreateAssistantMessageEventStream(); a hand-writtenEventStream<AssistantMessageEvent, AssistantMessage>subclass no longer …
Added · 6
- Added
durationMstoAssistantMessage:AssistantMessageEventStreammeasures each response with a monotonic clock from the start of the request to its final message, for every API implementation, including … - Added an optional
durationMstoToolResultMessagefor the execution time of the tool - Added the
openai-decisionsclassifier API for OpenAI's Decisions API, withgpt-6-lunaas a classifier model of theopenaiprovider. It needs an API key, so it is not listed as available whileopenai… - Added Claude Haiku 5.5 (
claude-haiku-5-5) to theanthropicprovider with its prompt-length pricing tier, adaptive thinking withxhigh/maxeffort, per-message effort, and mid-conversation system … - …
Changed · 1
- The faux provider's prompt-cache usage estimate compares the previous and current prompt message by message and compares characters only from the first differing message; the usage numbers are unchanged.
Fixed · 10
- Fixed
server_busyandservers are currently busyprovider errors ending the turn instead of being retried - Fixed the error message of a failed lazy API setup, such as a module load or auth failure, using its failure time as
timestampinstead of the request start - Reduced context-limit request failures by estimating input at 3.5 characters per token instead of 4 when calculating output limits
- Fixed Radius models disabled by an organization owner still being listed: a fetched or cached Radius catalog now replaces the shipped default catalog instead of being merged into it
- …
coding-agent已完成DoneNew Features 5Added 9Changed 2Fixed 22
Added · 9
- Added
+nameand-nameentries to--tools, which change the default tool selection instead of replacing it, for examplepi -t +codemode - Added
durationMsto the tool render context and totool_execution_endextension events: the recorded execution time of a final tool result - Added
outputPadto the tool render context (#10557 by @rwachtler) - Added OpenAI's GPT-6 Luna as a classifier model through the Decisions API, available with
OPENAI_API_KEY(see Use classifier models) - …
Changed · 2
- Changed
outputPadto also apply to!command output, tool output, and summary blocks (#9946, #10557 by @rwachtler) - Changed
pi mcp login --timeoutto limit the whole sign-in, including requests to the authorization server, instead of only the wait for the browser
Fixed · 22
- Fixed bash and PowerShell results losing
Tookafter reloading a session, and the liveTookincluding wall-clock steps; both now show the recorded execution time - Fixed managed installs keeping every old release;
pi updatenow keeps only the new release and the one it updated from (#10392, #10511 by @davidbrai) - Fixed standalone binaries loading
.env,.env.local, and.env.developmentfrom the launch directory into Pi's environment - Fixed
!!command headers losing their dim color once output arrives (#10557 by @rwachtler) - …
tui已完成DoneBreaking Changes 1Added 3Fixed 1
Breaking Changes · 1
Terminalimplementations must providesetProgramStatus(status); a terminal without OSC 7501 support can implement it as a no-op
Added · 3
- Added
Box.setPaddingX(...)andText.setPaddingX(...)(#10557 by @rwachtler) - Added
Terminal.setProgramStatus()andformatProgramStatus()for the Program Status Protocol (OSC 7501).ProcessTerminalasks the terminal for support at startup and sends reports only if it answers; … - Added
TuiAltScreen.resetTextSelection(), which drops the text selection and multi-click state, for example before a host replaces the transcript (#9311, #10567 by @christianklotz)
Fixed · 1
- Fixed Markdown links not being clickable in Herdr:
TERM_PROGRAM=herdris now detected as supporting OSC 8 hyperlinks
mcp已完成DoneAdded 1Fixed 1
Added · 1
- Added a
signaloption toauthorizeMcp(),registerClient(), the token request functions, and the discovery functions, which aborts their requests. An aborted refresh no longer falls back to a new …
Fixed · 1
- Fixed
StreamableHttpTransport.close()callingAuthProvider.token(), which could refresh tokens over the network before the session DELETE and delay closing; the DELETE now reuses the token of the last …
codemode已完成DoneAdded 1
Added · 1
- Added
console: trueto text output items produced byconsole.*, so hosts can tell them apart fromtext()output
telemetry已完成Done
该版本没有单独的条目。No entries of its own in this release.
durable已完成DoneBreaking Changes 2Added 8Changed 1Fixed 1
Breaking Changes · 2
Storageimplementations must honor the neworderfield ofConversationQuery,EntryQuery,TaskQuery, andSubmissionQuery, and continue a cursor in the order it was returned with. A storage that …TaskRuntime.context()takes the cutoff as an options object, matchingConversation.context():runtime.context(conversationId, context, { at })replacesruntime.context(conversationId, context, at).
Added · 8
ToolExecutionApi.modelsandHookApi.models: the Harness'smodels, so tools and hooks can resolve models and make requests with the same catalog, credentials, and request transforms as generation.Conversation.context(context, { at })returns the model context as of a visible earlier entry, the same viewfork(at)would start with, without creating a conversation.ScanOrder(ascendingordescending) asorderon conversation, entry, task, and submission scans, includingTx.scanTasks()andConversation.entries(), so hosts can page the newest tasks first. …- Task records carry startedAt and endedAt, wall-clock times the Session stamps at the first change to running and at the change to terminal, with HarnessOptions.now or the new createSession(storage, …
- …
Changed · 1
runtime.context()keeps each conversation's last read range and derived view in memory: a later read by any of its tasks with the same head marker scans and derives only the entries committed since. A …
Fixed · 1
- A conversation's first system message, and the baseline after a compaction or reset, now leads the model context instead of following the input that started the run. Providers with native mid-conversation tool …
env已完成Done
该版本没有单独的条目。No entries of its own in this release.
protocol已完成Done
该版本没有单独的条目。No entries of its own in this release.
client已完成Done
该版本没有单独的条目。No entries of its own in this release.
server已完成Done
该版本没有单独的条目。No entries of its own in this release.