github agegr/pi-web v0.21.0

57 minutes ago

中文

基于 v0.20.0..v0.21.0 的提交整理。

npm install -g @agegr/pi-web@latest

新增

  • 扩展的网页卡片(ADR 0008):扩展可以在 pi 的事件总线上为自己的工具注册一个浏览器卡片(pi-web/v1/tool-card),并用 pi-web/v1/claim-ui 把 ctx.ui.custom() 请求交给它。卡片运行在无网络的沙箱 iframe 中,通过 done 回答,等待输入、重放、Stop 和 ANSI 回退都与之前一致;pi CLI 会忽略这两条消息。附带示例 examples/pi-ask-user。(#1865)
    • 扩展命令的 custom() 也可以声明卡片,placement 为 "float"(默认,取代浮动面板)或 "panel"(在右侧面板标签页中打开,会话随即空闲,agent 可在旁边工作)。示例 examples/pi-tic-tac-toe:/tic-tac-toe 在标签页中打开棋盘,agent 用工具下 O。(#1885)

    • 两个示例已发布到 npm,装上就能体验(或在 Pi Web 的 设置 › 插件 中添加 npm:@agegr/pi-ask-user、npm:@agegr/pi-tic-tac-toe):

      pi install npm:@agegr/pi-ask-user
      pi install npm:@agegr/pi-tic-tac-toe

      装好后,新会话会提示一次怎么试:/ask-user-demo 让 agent 先用卡片问你几个问题再规划一个小应用,/tic-tac-toe 在右侧标签页里和 agent 下井字棋。(052e831)

    • 扩展现在以 ctx.mode === "tui" 绑定,按 pi 文档写的扩展(用 tui 守卫 custom())在网页里也能打开界面;扩展界面打开时,界面外的 Esc 不再停止运行。(#1870)

  • 在文件查看器中直接编辑文本文件(ADR 0009):完整显示的文本文件多了「编辑」按钮,Save / Cancel 或 Cmd/Ctrl+S 保存;保存前校验文件哈希,磁盘上已变化时提示 Reload 并保留草稿。只替换已有文件,不新建。(#1936)
  • 输入框可增高到视口的 30%,与 pi TUI 编辑器一致,最低仍为 200 px。(#1964,#1949)
  • 韩语界面。(#1842,感谢 Lahai-Roi)
  • 设置有未保存的草稿时关闭会先确认(模型、子 Agent)。(#1897,感谢 zinc0x1E)
  • 登录密码框增加显示 / 隐藏按钮。(#1874,感谢 zinc0x1E)
  • 工具卡片中的主目录显示为 ~,与 pi TUI 一致。(#1846,感谢 Brynne Taylor)

修复

  • 会话与 worktree:
    • 打开所在 worktree 已删除的对话时直接显示「Project folder not found」;新建对话、项目的「+」和 Ctrl+Alt+N 会改在项目根目录开始,worktree 文件夹残留在磁盘上时也是如此;找不到所属仓库时改为询问文件夹。(#1898、#1880、#1931、#1961,感谢 Shani Singh 和 Ed Schofield)
    • 缺少 .git 指针的残留 checkout 归回其仓库分组。(#1851,感谢 Brynne Taylor)
    • 用 ?cwd= 打开的文件夹被删除后,不再一直停在「Unable to open workspace」。(#1884,感谢 threwxiu-jpg)
    • 新对话中执行 /compact 或 /name 后,侧边栏会出现它的行。(#1951)
  • 对话:
    • 波斯语、阿拉伯语等从右到左的文字按其阅读方向显示。(#1895,感谢 Mehdi Pourfar)
    • 回复过程中点「滚动到最新」会持续跟随回复。(#1954)
    • 同一行中较后的 # 也能打开会话选择器;会话标题中的反引号不再影响下一个引用。(#1882、#1883,感谢 Shani Singh)
    • 手机上扩展的 custom 面板提供终端的额外按键行(方向键、Esc 等)。(#1858)
  • 侧边聊天:请求携带父会话的完整工具列表并在执行时拦截,以命中父会话的提示缓存;名称不再截断半个 emoji。(#1894,感谢 langlangxu;#1938,感谢 Shani Singh)
  • 子 Agent:
    • append 模式的 profile 会加载项目的 AGENTS.md / CLAUDE.md。(#1896,感谢 Cocoyu,修复 #1849)
    • 只读会话拒绝可写工具的子 Agent;同一子 Agent 的并行 resume 只运行一次;重新打开的子 Agent 使用父会话的模型运行时;失败运行的文本不再整体标为「Partial output」。(#1953、#1937,感谢 Shani Singh;#1932、#1857)
  • 文件:
    • 本地文件链接中的行号锚点生效。(#1862,感谢 Lei, HUANG)
    • 拒绝 NTFS 流语法和 .git 的 8.3 短名 GIT~1。(#1867,感谢 Qiaochu Hu)
    • Windows 上从变更文件打开的标签页跟随文件树中的移动和删除。(#1881,感谢 Shani Singh)
    • 同一次上传中的替换不会覆盖本次上传刚写入的文件。(#1945,感谢 Shani Singh)
  • MCP:读写 mcp.json 时去掉 UTF-8 BOM;JSON 对象参数(如 Smithery 的 --config)中的密钥成员会被遮盖。(#1866,感谢 Qiaochu Hu;#1946,感谢 Shani Singh)
  • 设置:设置 › 通用不再因 settings.json 锁的秒级重试而迟迟加载 (#1962,修复 #1960);设置 › 模型在非 JSON 回复时显示 HTTP 状态 (#1920、#1941);技能安装数 999,950+ 显示为 1M (#1940);多行的 disable-model-invocation 值被整体替换或删除 (#1947)。
  • 启动器:Next.js 服务随启动器一起退出,不再在输出关闭后成为占满 CPU 的孤儿进程。(#1859,修复 #1856)

改进

  • pi 升级到 1.8.0,包括对 MCP 2026-07-28(无 initialize 握手)的支持。完整列表见 pi v1.8.0。(74314c0)
  • 性能:侧边栏选中会话时不再闪出加载帧;首次发送不再被音频初始化卡顿;代码块只加载所需的 Prism 语言 (#1861)。最近三个文件标签页保持挂载 (#1860,感谢 Tiger)。点击变更文件时 git status 只查询该文件,被替换的扫描会被终止且不再占用 index 锁 (#1852、#1853,感谢 Brynne Taylor)。
  • 视觉:悬停即时响应并淡出,菜单和对话框带打开动效 (#1864);错误、警告、成功颜色改用在每个主题上都清晰可读的状态色 token,差异视图颜色统一 (#1916、#1918、#1928、#1958、#1943);浅色主题的用户消息改为中性卡片,引用块不填充,表格去掉斑马纹 (#1890,感谢 threwxiu-jpg)。

内部调整

  • 一批代码结构重构(拆分 rpc-manager、useAgentSession、AppShell、侧边栏和输入框的模块,事件和会话条目改用 pi 自身的类型等),对使用没有可见影响。
  • 发布 npm 包 @agegr/pi-web@0.21.0 和镜像 ghcr.io/agegr/pi-web:0.21.0。

English

Prepared from commits in v0.20.0..v0.21.0.

npm install -g @agegr/pi-web@latest

Added

  • Web cards for extensions (ADR 0008): an extension registers a browser card for one of its tools on pi's event bus (pi-web/v1/tool-card) and hands a ctx.ui.custom() request to it with pi-web/v1/claim-ui. The card runs in a sandboxed iframe with no network and answers through done, so the awaiting-input state, replay, Stop and the ANSI fallback work as before; the pi CLI ignores both messages. Example: examples/pi-ask-user. (#1865)
    • A command's custom() can claim a card too, with placement "float" (the default, in place of the floating panel) or "panel" (a right-panel tab; the session goes idle so the agent works beside it). Example: examples/pi-tic-tac-toe, where /tic-tac-toe opens a board in a tab and the agent plays O with a tool. (#1885)

    • Both examples are on npm, ready to try (or add npm:@agegr/pi-ask-user and npm:@agegr/pi-tic-tac-toe in Pi Web under Settings › Plugins):

      pi install npm:@agegr/pi-ask-user
      pi install npm:@agegr/pi-tic-tac-toe

      The next new session says once what to try: /ask-user-demo has the agent ask you a few questions on a card before planning a small app, and /tic-tac-toe opens a board in a right-panel tab to play the agent. (052e831)

    • Extensions are now bound with ctx.mode === "tui", so extensions that guard custom() with tui as pi's docs say open their UI here too; while an extension UI is open, Esc outside it no longer stops the run. (#1870)

  • Edit a text file in place in the file viewer (ADR 0009): a text file shown whole gets an Edit key; Save / Cancel or Cmd/Ctrl+S. The save checks the file's hash; a file changed on disk offers Reload and keeps the draft. Existing files only, nothing is created. (#1936)
  • The composer grows to 30% of the viewport, as pi's TUI editor does, never under 200 px. (#1964, #1949)
  • Korean locale. (#1842, thanks Lahai-Roi)
  • Settings asks before closing with an unsaved draft (Models, Sub-agents). (#1897, thanks zinc0x1E)
  • Show / hide button on the login password. (#1874, thanks zinc0x1E)
  • Tool cards show the home folder as ~, as pi's TUI does. (#1846, thanks Brynne Taylor)

Fixed

  • Sessions and worktrees:
    • Opening a chat whose worktree was removed shows "Project folder not found" at once; New, a project's "+" and Ctrl+Alt+N start in the project root instead, also when the worktree's folder is still on disk, and ask for a folder when no repository can be found. (#1898, #1880, #1931, #1961, thanks Shani Singh and Ed Schofield)
    • A checkout left without its .git pointer is grouped back under its repository. (#1851, thanks Brynne Taylor)
    • A folder opened with ?cwd= and then deleted no longer leaves the app on "Unable to open workspace". (#1884, thanks threwxiu-jpg)
    • A fresh chat gets its sidebar row after /compact or /name. (#1951)
  • Chat:
    • Persian, Arabic and other right-to-left text renders in its reading direction. (#1895, thanks Mehdi Pourfar)
    • "Scroll to latest" clicked mid-reply keeps following the reply. (#1954)
    • A later # on the line opens the session picker; a backtick in a quoted session's title no longer affects the next reference. (#1882, #1883, thanks Shani Singh)
    • On phones, an extension's custom panel gets the terminal's extra key rows (arrows, Esc). (#1858)
  • Side chats: the request carries the parent's full tool list and blocks execution instead, so it can hit the parent's prompt cache; a name no longer cuts an emoji in half. (#1894, thanks langlangxu; #1938, thanks Shani Singh)
  • Subagents:
    • Append-mode profiles load the project's AGENTS.md / CLAUDE.md. (#1896, thanks Cocoyu, fixes #1849)
    • A Read-only session refuses a subagent whose tools can write; two parallel resumes of one child run it once; a reopened child uses its parent's model runtime; a failed run's text is no longer labelled "Partial output" as a whole. (#1953, #1937, thanks Shani Singh; #1932, #1857)
  • Files:
    • Line anchors in local file links work. (#1862, thanks Lei, HUANG)
    • NTFS stream syntax and .git's 8.3 short name GIT~1 are refused. (#1867, thanks Qiaochu Hu)
    • On Windows, tabs opened from the changed files follow moves and deletes in the tree. (#1881, thanks Shani Singh)
    • A replacement in an upload never overwrites a file the same upload wrote. (#1945, thanks Shani Singh)
  • MCP: a UTF-8 BOM in mcp.json is stripped when reading and editing; secret members of a JSON object argument (such as Smithery's --config) are masked. (#1866, thanks Qiaochu Hu; #1946, thanks Shani Singh)
  • Settings: Settings › General no longer waits seconds on the settings.json lock's retries (#1962, fixes #1960); Settings › Models shows the HTTP status for an answer that is not JSON (#1920, #1941); 999,950+ skill installs show as 1M (#1940); a multi-line disable-model-invocation value is replaced or removed whole (#1947).
  • Launcher: the Next.js server ends with its launcher instead of being left as an orphan spinning a CPU after its output closed. (#1859, fixes #1856)

Improved

  • pi upgraded to 1.8.0, including support for MCP 2026-07-28 (no initialize handshake). See pi v1.8.0 for the full list. (74314c0)
  • Performance: picking a session in the sidebar no longer paints a loading frame, the first send no longer stalls on audio setup, and code blocks load only their own Prism language (#1861). The last three file tabs stay mounted (#1860, thanks Tiger). A click on a changed file asks git status about that file only, and a replaced scan is stopped and keeps off the index lock (#1852, #1853, thanks Brynne Taylor).
  • Look and feel: hovers answer at once and fade out, menus and dialogs open with motion (#1864); error, warning and success colors use status tokens readable on every theme, and diffs share one set of colors (#1916, #1918, #1928, #1958, #1943); Light's user turn is a neutral card, quotes are unfilled and tables unstriped (#1890, thanks threwxiu-jpg).

Internal

  • A batch of structural refactors (splitting rpc-manager, useAgentSession, AppShell, the sidebar and composer into modules, typing events and session entries with pi's own types, and so on), with no visible change in use.
  • Published npm package @agegr/pi-web@0.21.0 and image ghcr.io/agegr/pi-web:0.21.0.

Don't miss a new pi-web release

NewReleases is sending notifications on new releases.