pi-webapp 0.1.38-alpha.2 → 0.1.39-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # pi-webapp
2
2
 
3
- ### Your Pi coding agent. A visual workspace to build with it.
3
+ ### One workspace for your Pi coding agent.
4
4
 
5
- Bring conversations, project files, terminals, and Git into one interface—without giving up Pi's tools, skills, or terminal workflow. Run it in your browser, open a dedicated desktop window, or connect directly from an existing Pi session.
5
+ Conversations, project files, terminals, and Git—side by side. Use the same workbench in your browser or on desktop, while keeping Pi's tools, skills, extensions, and terminal workflow.
6
6
 
7
- [简体中文](README.zh-CN.md) · [Get started](#get-started) · [Download desktop](#desktop-downloads) · [User guide](docs/en/getting-started.md) · [npm](https://www.npmjs.com/package/pi-webapp)
7
+ [简体中文](README.zh-CN.md) · [Get started](#get-started) · [Download desktop](#desktop-downloads) · [Architecture](#architecture-highlights) · [User guide](docs/en/getting-started.md) · [npm](https://www.npmjs.com/package/pi-webapp)
8
8
 
9
- **Desktop test build 10:** [macOS · Apple Silicon](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/pi-0.1.28-desktop.10-mac-arm64.dmg) · [macOS · Intel](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/pi-0.1.28-desktop.10-mac-x64.dmg) · [Windows x64](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/pi-0.1.28-desktop.10-win-x64.exe) · [Linux x64](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/pi-0.1.28-desktop.10-linux-x86_64.AppImage). Verify [SHA-256](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/SHA256SUMS); unsigned/unnotarized test-release limits apply. [Install safely](#desktop-downloads).
9
+ **Desktop test build 10:** [macOS Apple Silicon DMG](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/pi-0.1.28-desktop.10-mac-arm64.dmg) · [Intel, Windows & Linux downloads](#desktop-downloads) · [SHA-256 checksums](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/SHA256SUMS). These are unsigned/unnotarized test packages. See [safe installation](docs/desktop-testing.md).
10
10
 
11
11
  [![Pi workbench with project sessions, an agent conversation, and a highlighted code preview](assets/readme/workbench.png)](assets/readme/workbench.png)
12
12
 
@@ -36,6 +36,20 @@ npx pi-webapp
36
36
 
37
37
  *Click any image for full size. Screenshots use an isolated demo repository. The terminal really runs its two regression tests; no provider credentials or private project data are used. [How these images are made](assets/readme/README.md).*
38
38
 
39
+ ## Excalidraw: turn conversations into editable diagrams
40
+
41
+ **Describe it → refine it → keep it.** Ask Pi for an architecture diagram, flowchart, or concept sketch. The drawing appears in the conversation; **Edit** opens the native Excalidraw canvas—not a flattened image.
42
+
43
+ [![Excalidraw tool card with a hand-drawn three-step workflow and an Edit button for opening the native canvas](assets/readme/excalidraw.png)](assets/readme/excalidraw.png)
44
+
45
+ *Real plugin UI with a seeded example, not a live model transcript. Click the image for full size.*
46
+
47
+ - **Create in context:** describe the drawing in the main conversation, without opening another drawing service.
48
+ - **Make it yours:** move shapes, edit labels, adjust layout, and use native undo/redo.
49
+ - **Keep the result:** save editable `.excalidraw` source to the workspace or export a PNG from the editor.
50
+
51
+ **Optional plugin:** explicitly install and enable `@chengzhiyi/pi-excalidraw` in **Plugins → Hosted plugins**, using an available compatible release. It is not bundled or auto-installed, and needs no drawing-service account. [Setup, saving & recovery](docs/diagrams.md).
52
+
39
53
  ## Core features
40
54
 
41
55
  | Capability | What you can do |
@@ -61,7 +75,9 @@ Requires **Node.js 22.19+** and npm. Run in your project directory:
61
75
  npx pi-webapp
62
76
  ```
63
77
 
64
- The launcher starts the npm package's exactly pinned, verified Pi SDK (currently **1.3.0**) in the background and opens your browser on a local graphical desktop. It neither uses nor replaces global Pi, so a global upgrade cannot silently change the business package's runtime. Running the command again reopens the existing service. Headless sessions print the local address instead; `PI_WEBAPP_AUTO_OPEN=0` disables automatic opening.
78
+ The launcher starts a local background service with the package's pinned **Pi SDK 1.3.0** and opens your browser. No global Pi installation is needed or changed. Run the command again to reopen the existing service.
79
+
80
+ On headless machines, it prints the local address. Set `PI_WEBAPP_AUTO_OPEN=0` to disable automatic browser opening.
65
81
 
66
82
  1. Open **Settings → Models** to configure a provider and choose a model you have access to.
67
83
  2. Select or add a workspace, then start a conversation.
@@ -110,11 +126,11 @@ The **pi** desktop app bundles Node and Pi—no separate runtime installation ne
110
126
 
111
127
  ## Architecture highlights
112
128
 
113
- **One agent engine, multiple interfaces, and a plugin-oriented workbench.** Pi handles model execution, tools, and session persistence; pi-webapp handles presentation, session orchestration, and workspace tools.
129
+ **Shared React workbench → local Node host → Pi execution.** This is a local, modular application—not a microservice cluster. Pi owns agent execution and session persistence; pi-webapp adds the interface, session orchestration, and workspace capabilities.
114
130
 
115
- [![Architecture: browser and Electron share a React workbench connected to a local Node host, which integrates the Pi agent engine and workspace plugins](assets/readme/architecture-en.svg)](assets/readme/architecture-en.svg)
131
+ [![Three-layer architecture: shared React UI, HTTP/NDJSON transport, local Node host, and Pi execution; typed contracts, optional hosted plugins, and diagnostics alongside](assets/readme/architecture-en.png)](assets/readme/architecture-en.png)
116
132
 
117
- *The UI is shared; session orchestration, agent execution, and workspace capabilities keep distinct responsibilities.*
133
+ *Three main connectors show the layer boundaries. Components within a layer are peers, not a sequential call chain. Click to view full size.*
118
134
 
119
135
  | Design choice | Why it matters |
120
136
  | --- | --- |
@@ -125,9 +141,18 @@ The **pi** desktop app bundles Node and Pi—no separate runtime installation ne
125
141
  | **Guardrails at the host boundary** | Loopback transport uses token/origin checks; file previews enforce workspace and symlink boundaries. Git writes reject stale state and coordinate known chats sharing the worktree. These checks are not an OS sandbox. |
126
142
  | **One UI across entry points** | React + TypeScript power the workbench, Vite/esbuild bundle the app, and Electron provides the desktop shell without a separate conversation UI. |
127
143
 
128
- **Optional drawings:** install and enable the official `@chengzhiyi/pi-excalidraw` card in Plugins. The host ships no Excalidraw editor/fonts and does not auto-install it on offline startup. Hotplug keeps existing sessions; ordinary updates wait for open editors, while explicit reopen resets native undo. Old drawings/backups are preserved; see [migration and recovery](docs/diagrams.md). The development protocol/plugin artifacts on this branch are verification-only, not a published release.
144
+ **Optional, not built in:** drawings belong to the official `@chengzhiyi/pi-excalidraw` plugin, installed and enabled explicitly in Plugins. The host ships no editor/fonts and does not auto-install it on offline startup. Hosted plugins use a separate Node process for lifecycle management—not a security sandbox. Development protocol/plugin artifacts on this branch are verification-only, not a published release. See [drawing migration and recovery](docs/diagrams.md) for update behavior and preserved backups.
129
145
 
130
- Source layout: `src/adapters/pi/` → Pi entry · `src/host/` → server/browser host · `src/plugins/builtin/` → workspace capabilities · `src/contracts/` → cross-boundary contracts · `web/src/ui/` → shared UI · `desktop/` → Electron shell.
146
+ ### Source map
147
+
148
+ | Directory | Responsibility |
149
+ | --- | --- |
150
+ | `web/src/ui/` · `src/host/client/` | Shared UI, conversation shell, workbench, and browser plugin management |
151
+ | `src/host/server/` | Transport, sessions, workspaces, model configuration, and plugin lifecycle |
152
+ | `src/adapters/pi/` | Thin Pi extension entry point |
153
+ | `src/plugins/builtin/` | Files, Git, and Terminal; each owns server, client, and contracts |
154
+ | `src/contracts/` · `src/platform/telemetry/` | Wire contracts and shared diagnostics |
155
+ | `bin/` · `desktop/` | CLI launcher and Electron shell |
131
156
 
132
157
  Read the [architecture and ownership guide](docs/architecture.md) or [Web plugin integration notes](docs/web-plugins.md) for lifecycle and extension details.
133
158
 
@@ -145,8 +170,7 @@ The guides follow the source tree; installed versions may differ. For desktop av
145
170
  npm ci
146
171
  npm run check
147
172
  npm test
148
- npm run build
149
- npm run start
173
+ npm run start # Build and launch the local service
150
174
  ```
151
175
 
152
176
  `npm run start` builds and launches the background service. After changing extension code, run `npm run stop` and `npm run start`; reloading the browser alone does not replace the bridge. With `pi -e .`, rebuild and enter `/reload`, then `/web` in Pi.
@@ -155,6 +179,6 @@ For desktop development: `npm run desktop:prepare` → `npm run desktop:start`.
155
179
 
156
180
  ---
157
181
 
158
- **Give your next Pi task a visual workspace:** run `npx pi-webapp` or [try the desktop test build](#desktop-downloads). If it helps your workflow, a [GitHub star](https://github.com/chengzhiyi/pi-webapp) helps others discover it; [feedback and reproducible issues](https://github.com/chengzhiyi/pi-webapp/issues) help shape what comes next.
182
+ [Report a bug or request a feature](https://github.com/chengzhiyi/pi-webapp/issues) · [Star on GitHub](https://github.com/chengzhiyi/pi-webapp)
159
183
 
160
184
  MIT licensed. See [LICENSE](LICENSE).
package/README.zh-CN.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # pi-webapp
2
2
 
3
- ### 让 Pi 编程 Agent,拥有一个看得见、用得顺的工作台。
3
+ ### 一个工作台,连接你的 Pi 编程 Agent。
4
4
 
5
- 把 AI 对话、项目文件、终端和 Git 放在同一个界面中,不必放弃 Pi 的工具、技能和终端工作流。在浏览器里直接使用,打开独立桌面窗口,或从已有 Pi 会话一键进入。
5
+ 把 AI 对话、项目文件、终端与 Git 放在一起。浏览器与桌面端共用一套工作台,同时保留 Pi 的工具、技能、扩展与终端工作流。
6
6
 
7
- [English](README.md) · [快速开始](#快速开始) · [下载桌面端](#桌面端下载) · [使用指南](docs/zh/getting-started.md) · [npm](https://www.npmjs.com/package/pi-webapp)
7
+ [English](README.md) · [快速开始](#快速开始) · [下载桌面端](#桌面端下载) · [项目架构](#技术架构亮点) · [使用指南](docs/zh/getting-started.md) · [npm](https://www.npmjs.com/package/pi-webapp)
8
8
 
9
- **桌面测试版 build 10:** [macOS · Apple 芯片](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/pi-0.1.28-desktop.10-mac-arm64.dmg) · [macOS · Intel](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/pi-0.1.28-desktop.10-mac-x64.dmg) · [Windows x64](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/pi-0.1.28-desktop.10-win-x64.exe) · [Linux x64](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/pi-0.1.28-desktop.10-linux-x86_64.AppImage)。请核对 [SHA-256](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/SHA256SUMS);测试包未签名或无发布者身份,macOS 未公证。[安全安装说明](#桌面端下载)。
9
+ **桌面测试版 build 10:** [macOS Apple 芯片 DMG](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/pi-0.1.28-desktop.10-mac-arm64.dmg) · [Intel、Windows 与 Linux 下载](#桌面端下载) · [SHA-256 校验文件](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.28-b10/SHA256SUMS)。测试包未签名或未公证,详见[安全安装说明](docs/desktop-testing.md)。
10
10
 
11
11
  [![Pi 工作台:左侧项目会话,中间 Agent 对话,右侧代码高亮预览](assets/readme/workbench.png)](assets/readme/workbench.png)
12
12
 
@@ -36,6 +36,20 @@ npx pi-webapp
36
36
 
37
37
  *点击图片可查看原图。截图使用隔离的演示仓库,终端实际运行了两项回归测试;不使用提供方凭据或私有项目数据。[图片生成与维护说明](assets/readme/README.md)。*
38
38
 
39
+ ## Excalidraw:把对话变成可编辑的手绘图稿
40
+
41
+ **说出想法 → 动手调整 → 保存成果。** 直接让 Pi 绘制架构图、流程图或概念草图,图稿会出现在对话中;点击 **Edit(编辑)** 即可进入原生 Excalidraw 画布,而不是只能查看一张静态图片。
42
+
43
+ [![Excalidraw 真实工具卡片:三步手绘流程图,右上角 Edit 按钮可打开原生画布](assets/readme/excalidraw.png)](assets/readme/excalidraw.png)
44
+
45
+ *截图来自真实插件界面,使用预设英文示例,并非实时模型生成记录。点击图片可查看原图。*
46
+
47
+ - **在对话里生成:** 用自然语言描述要画的内容,无需另开绘图服务。
48
+ - **亲手调整细节:** 移动图形、修改文字、调整布局,支持原生撤销与重做。
49
+ - **保留可编辑成果:** 将 `.excalidraw` 源文件保存到工作区,或从编辑器导出 PNG。
50
+
51
+ **可选插件:** 在「**插件 → Hosted 插件**」中显式安装并启用 `@chengzhiyi/pi-excalidraw`,需要可用的兼容发行版。插件不随宿主内置,也不会自动安装,无需额外绘图服务账号。[安装、保存与恢复说明](docs/diagrams.md)。
52
+
39
53
  ## 核心功能
40
54
 
41
55
  | 能力 | 你可以做什么 |
@@ -49,8 +63,6 @@ npx pi-webapp
49
63
  | **模型、技能与插件** | 配置提供方和模型,管理 Pi 软件包/扩展/技能,启停内置文件、终端与 Git;兼容的 Web 插件还可贡献自己的界面。 |
50
64
  | **浏览器与桌面入口** | 用后台启动器打开 Web,从 Pi 终端输入 `/web`,或运行自带 Node/Pi 的 Electron 桌面应用。 |
51
65
 
52
- **可选绘图:** 在插件管理中显式安装、启用官方 `@chengzhiyi/pi-excalidraw`。宿主不再携带编辑器和专用字体,首次离线启动不会自动安装。热插拔不替换会话;普通更新等待编辑器关闭,显式重新打开会重置原生撤销历史。旧图稿与浏览器备份保留,详见[迁移与恢复](docs/diagrams.md)。本分支开发协议和插件产物仅用于验证,并非已发布版本。
53
-
54
66
  > 聊天独立运行,但同一工作树中的文件和 Git 改动是共享的。切换聊天不会停止任务;停止服务会结束其后台任务。终端与 Agent 工具使用你的系统权限,不是沙箱环境。
55
67
 
56
68
  ## 快速开始
@@ -63,7 +75,9 @@ npx pi-webapp
63
75
  npx pi-webapp
64
76
  ```
65
77
 
66
- 启动器会使用 npm 包精确依赖的已验证 Pi SDK(当前 **1.3.0**)在后台启动,并在本地图形桌面打开默认浏览器;不使用或覆盖全局 Pi,避免全局版本升级破坏业务包兼容性。再次执行命令会重新打开已有服务。无图形界面时显示本地地址;设置 `PI_WEBAPP_AUTO_OPEN=0` 可关闭自动打开。
78
+ 启动器使用随包锁定的 **Pi SDK 1.3.0** 启动本地后台服务,并打开浏览器;无需安装或修改全局 Pi。再次运行命令即可打开已有服务。
79
+
80
+ 无图形界面时显示本地地址;设置 `PI_WEBAPP_AUTO_OPEN=0` 可关闭浏览器自动打开。
67
81
 
68
82
  1. 进入「**设置 → 模型**」,配置提供方并选择有权使用的模型。
69
83
  2. 选择或添加工作区,开始一次对话。
@@ -112,11 +126,11 @@ pi
112
126
 
113
127
  ## 技术架构亮点
114
128
 
115
- **一套 Agent 引擎,多种使用入口,插件化工作台。** Pi 负责模型执行、工具与会话持久化;pi-webapp 负责界面、会话编排与工作区工具。
129
+ **共享 React 工作台 → 本地 Node 宿主 → Pi 执行能力。** 这是本地运行的模块化应用,不是微服务集群。Pi 负责 Agent 执行与会话持久化;pi-webapp 负责界面、会话编排与工作区能力。
116
130
 
117
- [![架构图:浏览器与 Electron 复用 React 工作台,经本地 Node 宿主连接 Pi 引擎与工作区插件](assets/readme/architecture-zh.svg)](assets/readme/architecture-zh.svg)
131
+ [![三层架构:共享 React 界面,经 HTTP/NDJSON 连接本地 Node 宿主与 Pi 执行能力;旁列跨端契约、可选 Hosted 插件和诊断支撑](assets/readme/architecture-zh.png)](assets/readme/architecture-zh.png)
118
132
 
119
- *共享的是界面;会话编排、Agent 执行与工作区能力,仍然各司其职。*
133
+ *三条主干连线突出层间边界;同层模块为并列能力,不表示串行调用。点击图片可查看原图。*
120
134
 
121
135
  | 设计 | 带来的价值 |
122
136
  | --- | --- |
@@ -127,7 +141,18 @@ pi
127
141
  | **宿主边界上的操作保护** | 本地传输校验令牌与请求来源;文件预览限制工作区及符号链接范围;Git 写入拒绝过期状态,并协调同工作树的已知聊天。这些检查不等于操作系统沙箱。 |
128
142
  | **多入口复用同一套界面** | React + TypeScript 构建工作台,Vite/esbuild 完成打包,Electron 提供桌面外壳,无需另维护一套桌面对话 UI。 |
129
143
 
130
- 源码导航:`src/adapters/pi/` → Pi 入口 · `src/host/` → 前后端宿主 · `src/plugins/builtin/` → 工作区能力 · `src/contracts/` → 跨端契约 · `web/src/ui/` → 共享 UI · `desktop/` → Electron 外壳。
144
+ **绘图为可选扩展,而非内置能力:** 在插件管理中显式安装、启用官方 `@chengzhiyi/pi-excalidraw`。宿主不携带编辑器和专用字体,首次离线启动不会自动安装。Hosted 插件使用独立 Node 子进程管理生命周期,但不是安全沙箱。本分支开发协议和插件产物仅用于验证,并非已发布版本。更新行为、旧图稿及备份保留方式见[绘图迁移与恢复](docs/diagrams.md)。
145
+
146
+ ### 源码导航
147
+
148
+ | 目录 | 职责 |
149
+ | --- | --- |
150
+ | `web/src/ui/` · `src/host/client/` | 共享 UI、对话外壳、工作台与浏览器插件管理 |
151
+ | `src/host/server/` | 传输、会话、工作区、模型配置与插件生命周期 |
152
+ | `src/adapters/pi/` | 轻量 Pi 扩展入口 |
153
+ | `src/plugins/builtin/` | 文件、Git、终端,各自拥有服务端、客户端和契约 |
154
+ | `src/contracts/` · `src/platform/telemetry/` | 跨端数据契约与共享诊断 |
155
+ | `bin/` · `desktop/` | CLI 启动器与 Electron 外壳 |
131
156
 
132
157
  深入了解:[架构与职责划分](docs/architecture.md) · [Web 插件接入与生命周期](docs/web-plugins.md)。
133
158
 
@@ -145,8 +170,7 @@ pi
145
170
  npm ci
146
171
  npm run check
147
172
  npm test
148
- npm run build
149
- npm run start
173
+ npm run start # 构建并启动本地服务
150
174
  ```
151
175
 
152
176
  `npm run start` 会构建并启动后台服务。修改扩展代码后,运行 `npm run stop` 再运行 `npm run start`;仅刷新网页不会替换桥接代码。使用 `pi -e .` 开发时,重新构建后在 Pi 中输入 `/reload`,再输入 `/web`。
@@ -155,6 +179,6 @@ npm run start
155
179
 
156
180
  ---
157
181
 
158
- **让下一次 Pi 任务,从一个可视化工作台开始:** 运行 `npx pi-webapp`,或[体验桌面测试版](#桌面端下载)。如果它让你的工作更顺手,欢迎 [Star 项目](https://github.com/chengzhiyi/pi-webapp)帮助更多人发现,也欢迎[提交反馈与可复现的问题](https://github.com/chengzhiyi/pi-webapp/issues),一起完善工作流。
182
+ [提交问题或功能建议](https://github.com/chengzhiyi/pi-webapp/issues) · [在 GitHub 上 Star 项目](https://github.com/chengzhiyi/pi-webapp)
159
183
 
160
184
  基于 MIT 许可证开源。详见 [LICENSE](LICENSE)。
@@ -1,13 +1,16 @@
1
1
  # README visual assets
2
2
 
3
- These images illustrate the real pi-webapp interface using a **seeded demo conversation** and a disposable checkout project. They are not a recording of a live model run. No provider authentication, user sessions, or private repositories are used.
3
+ The UI screenshots illustrate the real pi-webapp interface using **seeded demo conversations** and disposable workspaces. They are not a recording of a live model run. No provider authentication, user sessions, or private repositories are used.
4
4
 
5
5
  | Asset | Contents |
6
6
  | --- | --- |
7
7
  | `workbench.png` | Full workbench: project navigation, conversation, and read-only TypeScript preview. |
8
8
  | `git-review.png` | Git tool panel: staged regression tests and the actual `>` → `>=` working-tree diff. |
9
9
  | `terminal.png` | Terminal tool panel: actual Node test execution in the disposable project, with two passing tests. |
10
- | `architecture-en.svg` / `architecture-zh.svg` | Editable, self-contained architecture diagrams. Text, shapes, and connectors only; no remote fonts, scripts, or embedded private data. |
10
+ | `excalidraw.png` | Actual optional Excalidraw plugin tool card, with a seeded hand-drawn workflow and native Edit entry. Captured at 2× density, not a fabricated UI or live model transcript. |
11
+ | `architecture-zh.png` | User-supplied hand-drawn architecture image, embedded directly in the Chinese README. Preserve this original when regenerating SVGs. |
12
+ | `architecture-en.png` | High-resolution English architecture image, embedded directly in the English README. |
13
+ | `architecture-en.svg` / `architecture-zh.svg` | Editable vector counterparts using the same layered composition; the Chinese PNG retains the supplied hand-drawn styling. No remote fonts, scripts, or embedded private data. |
11
14
 
12
15
  ## Regenerate screenshots
13
16
 
@@ -23,8 +26,30 @@ The capture script starts a loopback bridge only for the bounded capture run and
23
26
 
24
27
  Screenshots are captured at a 1440 × 760 viewport and 1.5× pixel density. The hero shows the full page; the Git and terminal images crop to the tool panel so their details remain legible side by side. Do not fabricate UI controls or test output in post-processing. Interface copy is English in both READMEs; surrounding captions are localized.
25
28
 
29
+ ## Regenerate the Excalidraw showcase
30
+
31
+ Build the host, then provide an independently built compatible plugin archive:
32
+
33
+ ```bash
34
+ npm run build
35
+ CAPTURE_README_EXCALIDRAW=1 HOSTED_EXCALIDRAW_TGZ=/absolute/path/plugin.tgz \
36
+ npx playwright test test/browser/readme-excalidraw.spec.ts --workers=1
37
+ ```
38
+
39
+ Unset inherited `PI_WEBAPP_RESTART_PORT`, `PI_WEBAPP_RESTART_TOKEN`, and `PI_WEBAPP_LAUNCHER_NONCE` when capturing from inside a running Pi Web service, so the temporary bridge uses its own port and token. The opt-in capture uses the actual host, plugin worker, preview, and native editor with deterministic local registry/model fixtures; it makes no external requests. It saves only the tool-card crop, verifies the editor opens, and cleans up its temporary workspace. A local verification archive is not evidence of an npm release. Both READMEs share the English demo image with localized surrounding text.
40
+
26
41
  ## Maintain the diagrams
27
42
 
28
- Edit both SVGs together when boundaries change; keep their dimensions and palette consistent. Match the host/Pi/plugin responsibilities in `docs/architecture.md`, provide a descriptive title and alternative text, and verify XML and browser rendering. Keep critical text inside the canvas.
43
+ The architecture diagrams use the chat-authored three-layer composition: shared UI, local Node host, and execution capabilities, with only three vertical connectors. The side rail shows contracts, optional hosted extensions, and diagnostics. Excalidraw is an optional plugin, not a builtin.
44
+
45
+ Regenerate both localized SVGs from their shared layout and copy:
46
+
47
+ ```bash
48
+ node scripts/generate-readme-architecture.mjs
49
+ ```
50
+
51
+ READMEs embed PNGs for image-renderer compatibility; keep the workbench, Git, and terminal screenshots visible as well. The Chinese PNG is the user's supplied original, not a generated SVG export. To refresh the English PNG, render `architecture-en.svg` at 2× pixel density (2800 × 2240) with a browser screenshot. Verify all five embedded images load in each README.
52
+
53
+ Edit the generator rather than the generated SVGs. Keep both languages, dimensions, and palette in sync; check responsibilities against the current source and `docs/architecture.md`. The diagrams include accessible titles/descriptions and use only local text and vector shapes. Validate XML and browser rendering, including text bounds, after regeneration. Same-layer placement does not imply sequential calls; process boundaries do not imply security sandboxes.
29
54
 
30
55
  The package's `files` list includes this directory so the README images remain available in npm packages, not only on GitHub. Keep the existing `assets/cover-webapp.png` separate: it is also used as the Pi package catalog cover.
@@ -1,39 +1,93 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="1120" height="668" viewBox="0 0 1120 668" role="img" aria-labelledby="title desc">
2
- <title id="title">One workbench, multiple entry points</title>
3
- <desc id="desc">The browser and Electron desktop share a React workbench. Both connect to a local Node host with HTTP actions and NDJSON events. The host orchestrates sessions, integrates Pi through an extension or SDK, and dispatches workspace plugin capabilities.</desc>
1
+ <svg xmlns="http://www.w3.org/2000/svg" xml:lang="en" width="1400" height="1120" viewBox="0 0 1400 1120" role="img" aria-labelledby="title desc">
2
+ <title id="title">One workbench. A complete Agent workflow.</title>
3
+ <desc id="desc">Browser and Electron share a React workbench. HTTP actions and NDJSON events connect it to a local Node host, which orchestrates Pi sessions and plugins. Pi SDK, model providers and local tools supply execution. Contracts, optional hosted extensions and diagnostics are shown alongside the main layers.</desc>
4
4
  <defs>
5
- <marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M1 1 9 5 1 9" fill="none" stroke="#5368ed" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></marker>
5
+ <marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M1 1 9 5 1 9Z" fill="#7b8fa1"/></marker>
6
6
  </defs>
7
- <rect width="1120" height="668" rx="16" fill="#f8fafc"/>
8
- <g font-family="Arial, sans-serif" fill="#162033">
9
- <text x="32" y="56" font-size="32" font-weight="700">One workbench. Multiple entry points.</text>
10
- <text x="32" y="92" font-size="21" fill="#526078">A visual layer on Pi, not another agent engine.</text>
11
- <g fill="none" stroke="#5368ed" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
12
- <path d="M288 224 V256 H560 V286" marker-end="url(#arrow)"/>
13
- <path d="M832 224 V256 H560"/>
14
- <path d="M560 408 V440 H288 V470" marker-end="url(#arrow)"/>
15
- <path d="M560 440 H832 V470" marker-end="url(#arrow)"/>
16
- </g>
17
- <g stroke="#dce2ee" stroke-width="2" fill="#ffffff">
18
- <rect x="32" y="128" width="512" height="96" rx="16"/>
19
- <rect x="576" y="128" width="512" height="96" rx="16"/>
20
- <rect x="32" y="472" width="512" height="128" rx="16"/>
21
- <rect x="576" y="472" width="512" height="128" rx="16"/>
22
- </g>
23
- <text x="64" y="168" font-size="25" font-weight="700">Browser</text>
24
- <text x="64" y="202" font-size="21" fill="#526078">React workbench · npx or /web</text>
25
- <text x="608" y="168" font-size="25" font-weight="700">Electron desktop</text>
26
- <text x="608" y="202" font-size="21" fill="#526078">Same Web UI · bundled Node / Pi</text>
27
- <rect x="224" y="288" width="672" height="120" rx="16" fill="#eef1ff" stroke="#5368ed" stroke-width="2"/>
28
- <text x="560" y="326" font-size="27" font-weight="700" text-anchor="middle" fill="#3549c6">Local Node host</text>
29
- <text x="560" y="360" font-size="21" text-anchor="middle">HTTP actions · NDJSON events · typed contracts</text>
30
- <text x="560" y="390" font-size="20" text-anchor="middle" fill="#526078">Session lifecycle + plugin registry</text>
31
- <text x="64" y="514" font-size="25" font-weight="700">Pi agent engine</text>
32
- <text x="64" y="548" font-size="21" fill="#526078">Models · tools · session storage</text>
33
- <text x="64" y="578" font-size="20" fill="#526078">Native extension / SDK integration</text>
34
- <text x="608" y="514" font-size="25" font-weight="700">Workspace capabilities</text>
35
- <text x="608" y="548" font-size="21" fill="#526078">Files · Terminal · Git · Web plugins</text>
36
- <text x="608" y="578" font-size="20" fill="#526078">Scoped actions, panels, and resource cleanup</text>
37
- <text x="560" y="642" font-size="20" text-anchor="middle" fill="#526078">Clear boundaries between UI, orchestration, and agent execution.</text>
7
+ <rect width="1400" height="1120" rx="16" fill="#ffffff"/>
8
+ <g font-family="Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif" stroke-linejoin="round" stroke-linecap="round">
9
+ <text x="60" y="54" font-size="16" fill="#64748b" font-weight="600" text-anchor="start">SYSTEM ARCHITECTURE / PI WEBAPP</text>
10
+ <text x="60" y="110" font-size="36" fill="#0f172a" font-weight="700" text-anchor="start">One workbench. A complete Agent workflow.</text>
11
+ <text x="60" y="150" font-size="18" fill="#64748b" font-weight="400" text-anchor="start">Shared UI · Local-first host · Typed contracts · Pluggable capabilities</text>
12
+ <rect x="60" y="190" width="1000" height="180" rx="12" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1.5"/>
13
+ <text x="84" y="234" font-size="20" fill="#334155" font-weight="600" text-anchor="start">01 Interaction layer</text>
14
+ <text x="1036" y="234" font-size="15" fill="#64748b" font-weight="400" text-anchor="end">web/src/ui · src/host/client</text>
15
+ <g id="entry" data-card="true">
16
+ <rect x="84" y="262" width="190" height="76" rx="12" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
17
+ <text x="179" y="294" font-size="17" fill="#334155" font-weight="600" text-anchor="middle">Browser / Electron</text>
18
+ <text x="179" y="318" font-size="17" fill="#334155" font-weight="400" text-anchor="middle">One React interface</text>
19
+ </g>
20
+ <g id="workbench" data-card="true">
21
+ <rect x="298" y="262" width="464" height="76" rx="12" fill="#eaf2f9" stroke="#93b5d4" stroke-width="1.5"/>
22
+ <text x="530" y="294" font-size="18" fill="#334155" font-weight="600" text-anchor="middle">React + TypeScript workbench</text>
23
+ <text x="530" y="318" font-size="18" fill="#334155" font-weight="400" text-anchor="middle">Chat · Sessions · Dock panels · Settings</text>
24
+ </g>
25
+ <g id="plugin-ui" data-card="true">
26
+ <rect x="786" y="262" width="250" height="76" rx="12" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
27
+ <text x="911" y="294" font-size="16" fill="#334155" font-weight="600" text-anchor="middle">Plugin views</text>
28
+ <text x="911" y="318" font-size="16" fill="#334155" font-weight="400" text-anchor="middle">Built-in panels / Extension UI</text>
29
+ </g>
30
+ <g id="transport" data-card="true">
31
+ <rect x="60" y="418" width="1000" height="74" rx="12" fill="#eef4f8" stroke="#a8bdce" stroke-width="1.5"/>
32
+ <text x="560" y="461" font-size="19" fill="#334155" font-weight="600" text-anchor="middle">Transport HTTP actions / NDJSON events · Bearer + Origin checks</text>
33
+ </g>
34
+ <rect x="60" y="540" width="1000" height="228" rx="12" fill="#f5f3f9" stroke="#b8b0d1" stroke-width="1.5"/>
35
+ <text x="84" y="584" font-size="20" fill="#504565" font-weight="600" text-anchor="start">02 Local Node host</text>
36
+ <text x="1036" y="584" font-size="15" fill="#776e89" font-weight="400" text-anchor="end">src/host/server</text>
37
+ <g id="orchestration" data-card="true">
38
+ <rect x="84" y="610" width="440" height="82" rx="12" fill="#ffffff" stroke="#b8b0d1" stroke-width="1.5"/>
39
+ <text x="304" y="645" font-size="17" fill="#334155" font-weight="600" text-anchor="middle">Application orchestration &amp; lifecycle</text>
40
+ <text x="304" y="669" font-size="17" fill="#334155" font-weight="400" text-anchor="middle">Sessions / Workspaces / Model auth / Attachments</text>
41
+ </g>
42
+ <g id="plugin-registry" data-card="true">
43
+ <rect x="548" y="610" width="488" height="82" rx="12" fill="#ebe7f4" stroke="#b8b0d1" stroke-width="1.5"/>
44
+ <text x="792" y="645" font-size="17" fill="#334155" font-weight="600" text-anchor="middle">Plugin registration &amp; runtime management</text>
45
+ <text x="792" y="669" font-size="17" fill="#334155" font-weight="400" text-anchor="middle">Files · Git · Terminal / Hosted extensions</text>
46
+ </g>
47
+ <text x="84" y="738" font-size="16" fill="#776e89" font-weight="400" text-anchor="start">Thin Pi adapter · Foreground / background sessions · Plugin switches &amp; cleanup</text>
48
+ <rect x="60" y="816" width="1000" height="156" rx="12" fill="#f1f7f4" stroke="#abc4b7" stroke-width="1.5"/>
49
+ <text x="84" y="860" font-size="20" fill="#365c4a" font-weight="600" text-anchor="start">03 Execution &amp; external capabilities</text>
50
+ <g id="pi-runtime" data-card="true">
51
+ <rect x="84" y="884" width="292" height="62" rx="12" fill="#ffffff" stroke="#abc4b7" stroke-width="1.5"/>
52
+ <text x="230" y="921" font-size="18" fill="#334155" font-weight="600" text-anchor="middle">Pi SDK · AgentSession</text>
53
+ </g>
54
+ <g id="model-providers" data-card="true">
55
+ <rect x="400" y="884" width="288" height="62" rx="12" fill="#ffffff" stroke="#abc4b7" stroke-width="1.5"/>
56
+ <text x="544" y="921" font-size="18" fill="#334155" font-weight="600" text-anchor="middle">Model providers · APIs</text>
57
+ </g>
58
+ <g id="local-tools" data-card="true">
59
+ <rect x="712" y="884" width="324" height="62" rx="12" fill="#ffffff" stroke="#abc4b7" stroke-width="1.5"/>
60
+ <text x="874" y="921" font-size="17" fill="#334155" font-weight="600" text-anchor="middle">Filesystem · Git · PTY / Processes</text>
61
+ </g>
62
+ <g id="contracts" data-card="true">
63
+ <rect x="1092" y="190" width="248" height="302" rx="12" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1.5"/>
64
+ <text x="1116" y="232" font-size="20" fill="#475569" font-weight="600" text-anchor="start">Typed contracts</text>
65
+ <text x="1116" y="284" font-size="16" fill="#475569" font-weight="400" text-anchor="start">Wire DTOs</text>
66
+ <text x="1116" y="309" font-size="16" fill="#475569" font-weight="400" text-anchor="start">Event validation</text>
67
+ <text x="1116" y="334" font-size="16" fill="#475569" font-weight="400" text-anchor="start">Plugin / Workbench API</text>
68
+ <text x="1116" y="384" font-size="16" fill="#475569" font-weight="400" text-anchor="start">Browser code never imports</text>
69
+ <text x="1116" y="409" font-size="16" fill="#475569" font-weight="400" text-anchor="start">Node / Pi runtime objects</text>
70
+ <text x="1116" y="476" font-size="15" fill="#64748b" font-weight="400" text-anchor="start">src/contracts</text>
71
+ </g>
72
+ <g id="extensions" data-card="true">
73
+ <rect x="1092" y="540" width="248" height="228" rx="12" fill="#faf7f1" stroke="#c5bba9" stroke-width="1.5"/>
74
+ <text x="1116" y="582" font-size="20" fill="#756044" font-weight="600" text-anchor="start">Optional extensions</text>
75
+ <text x="1116" y="634" font-size="16" fill="#756044" font-weight="400" text-anchor="start">Hosted plugin runtime</text>
76
+ <text x="1116" y="659" font-size="16" fill="#756044" font-weight="400" text-anchor="start">Separate Node process</text>
77
+ <text x="1116" y="709" font-size="16" fill="#756044" font-weight="400" text-anchor="start">Official Excalidraw plugin</text>
78
+ <text x="1116" y="734" font-size="16" fill="#756044" font-weight="400" text-anchor="start">Opt-in, not built in</text>
79
+ </g>
80
+ <g id="support" data-card="true">
81
+ <rect x="1092" y="816" width="248" height="156" rx="12" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1.5"/>
82
+ <text x="1116" y="858" font-size="20" fill="#475569" font-weight="600" text-anchor="start">Cross-cutting support</text>
83
+ <text x="1116" y="910" font-size="14" fill="#475569" font-weight="400" text-anchor="start">Sentry · Diagnostics</text>
84
+ <text x="1116" y="935" font-size="14" fill="#475569" font-weight="400" text-anchor="start">CLI / Desktop launch &amp; updates</text>
85
+ </g>
86
+ <path d="M560 373 V411" fill="none" stroke="#7b8fa1" stroke-width="2" marker-end="url(#arrow)"/>
87
+ <path d="M560 495 V533" fill="none" stroke="#7b8fa1" stroke-width="2" marker-end="url(#arrow)"/>
88
+ <path d="M560 771 V809" fill="none" stroke="#7b8fa1" stroke-width="2" marker-end="url(#arrow)"/>
89
+ <path d="M60 1014 H1340" fill="none" stroke="#e2e8f0"/>
90
+ <text x="60" y="1058" font-size="16" fill="#64748b" font-weight="400" text-anchor="start">A local modular host, not a microservice cluster. Peers within a layer do not imply sequential calls.</text>
91
+ <text x="60" y="1090" font-size="14" fill="#64748b" font-weight="400" text-anchor="start">Source: src/host · src/plugins/builtin · src/contracts · web · desktop</text>
38
92
  </g>
39
93
  </svg>