pi-webapp 0.1.25 → 0.1.27

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,127 +1,156 @@
1
1
  # pi-webapp
2
2
 
3
- [简体中文](README.zh-CN.md)
3
+ ### Your Pi coding agent. A visual workspace to build with it.
4
4
 
5
- ## Download pi desktop
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.
6
6
 
7
- **⬇ Test release · v0.1.21 / desktop build 6 · bundled Pi 1.3.0**
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)
8
8
 
9
- | Your computer | Download |
9
+ **Desktop test build 8:** [macOS · Apple Silicon](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-mac-arm64.dmg) · [macOS · Intel](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-mac-x64.dmg) · [Windows x64](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-win-x64.exe) · [Linux x64](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-linux-x86_64.AppImage). Verify [SHA-256](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/SHA256SUMS); unsigned/unnotarized test-release limits apply. [Install safely](#desktop-downloads).
10
+
11
+ [![Pi workbench with project sessions, an agent conversation, and a highlighted code preview](assets/readme/workbench.png)](assets/readme/workbench.png)
12
+
13
+ *Follow the conversation and inspect the linked source file in the same workspace. Real UI, seeded demo data—not a live model transcript.*
14
+
15
+ ```bash
16
+ npx pi-webapp
17
+ ```
18
+
19
+ **One command for the Web. A bundled runtime for desktop. The same Pi underneath.**
20
+
21
+ ## Why pi-webapp?
22
+
23
+ - **Keep your coding context together.** Follow the agent, inspect a file, run a command, and review a diff without leaving the workspace.
24
+ - **Work across projects without interrupting tasks.** Chats run independently; switching projects or starting another conversation leaves existing work running in the background.
25
+ - **See what the agent is doing.** Streaming replies, expandable reasoning and tool calls, token usage, and execution traces make progress easier to follow.
26
+ - **Build on Pi, not around it.** Keep Pi's session storage, model choices, skills, and extension ecosystem. The interface adds a workbench, not a replacement agent engine.
27
+
28
+ ## See the workflow
29
+
30
+ **Discuss → inspect → review → verify.** The workbench above keeps your conversation and source side by side; the same tool panel takes you from reviewing a change to running its tests.
31
+
32
+ | Review before committing | Verify in a real terminal |
10
33
  | --- | --- |
11
- | macOS · Apple Silicon (M-series, arm64) | [Download DMG](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/pi-0.1.21-desktop.6-mac-arm64.dmg) |
12
- | macOS · Intel (x64) | [Download DMG](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/pi-0.1.21-desktop.6-mac-x64.dmg) |
13
- | Windows · x64 | [Download EXE installer](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/pi-0.1.21-desktop.6-win-x64.exe) |
14
- | Linux · x64 | [Download AppImage](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/pi-0.1.21-desktop.6-linux-x86_64.AppImage) |
34
+ | [![Git panel showing staged tests and the highlighted free-shipping boundary fix](assets/readme/git-review.png)](assets/readme/git-review.png) | [![Integrated terminal running the demo project's tests with two passes and zero failures](assets/readme/terminal.png)](assets/readme/terminal.png) |
35
+ | Inspect the diff and stage only what you intend to commit. | Run project commands without losing the conversation. |
15
36
 
16
- [Release notes](https://github.com/chengzhiyi/pi-webapp/releases/tag/desktop-v0.1.21-b6) · [SHA-256 checksums](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/SHA256SUMS) · [Runtime/source metadata](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/desktop-release.json) · [Previous build 5](https://github.com/chengzhiyi/pi-webapp/releases/tag/desktop-v0.1.20-b5) · [Use Web/npm instead](#install-and-open)
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).*
17
38
 
18
- > **Install:** macOS: open the DMG and drag **pi.app** into Applications. Windows: run the EXE installer. Linux: make the AppImage executable, then run it; use `--appimage-extract-and-run` if FUSE is unavailable. Node and pinned Pi **1.3.0** are bundled; no separate installation is required. Configure your model account in Settings. Quit the old desktop before replacing it; a reused external Web service keeps its own Pi version and is never automatically stopped or upgraded.
19
- >
20
- > **Unsigned test build:** macOS is not notarized; Windows may show an unknown-publisher warning. Only proceed if you trust the source; never globally disable system security. Installer-payload smoke tests passed on all four targets, not every Linux distribution or real model-provider login. Windows ARM/Linux ARM are not included. Desktop automatic updates are not provided in this build.
39
+ ## Core features
21
40
 
22
- ![pi-webapp cover](assets/cover-webapp.png)
41
+ | Capability | What you can do |
42
+ | --- | --- |
43
+ | **Live agent conversations** | Send messages and image/file attachments; pause and continue tasks; switch models and thinking levels. Render Markdown, code, reasoning, and tool results in context. |
44
+ | **Multi-project sessions** | Discover saved Pi sessions, add workspaces, and switch between independently running chats. Return to ongoing output and pending plugin interactions. |
45
+ | **Files beside the conversation** | Browse the workspace, follow file links from chat, and preview highlighted code, Markdown, and images in read-only tabs. |
46
+ | **Real integrated terminals** | Run interactive shells in the workspace, use Ctrl+C, and keep processes and output when switching chats or panels. |
47
+ | **Git review and workflow** | Review changes and inline diffs, stage/unstage files, commit the staged index, create/switch local branches, and explore commit history with a branch graph. |
48
+ | **A flexible workbench** | Resize, split, or expand tool panels; use workspace focus mode while keeping navigation within reach. Each chat retains its own tool tabs until the page reloads. |
49
+ | **Models, skills, and plugins** | Configure providers and models, manage Pi packages/extensions/skills, and toggle bundled Files, Terminal, and Git capabilities. Supported Web plugins can add their own UI. |
50
+ | **Browser and desktop entry points** | Use the background launcher, open `/web` from Pi's terminal, or launch the Electron desktop app with bundled Node/Pi. |
51
+
52
+ > Chats run independently, but files and Git changes in the same worktree are shared. Switching chats does not stop work; stopping the service ends its background tasks. Terminals and agent tools run with your system permissions, not in a sandbox.
23
53
 
24
- **pi-webapp** opens the active Pi coding agent session in a local browser. Pi continues to run the agent, tools, and session storage; the browser provides a live interface for conversation and control.
54
+ ## Get started
25
55
 
26
- ## Install and open
56
+ ### Web: run one command
27
57
 
28
- Requires Node.js 22.19 or later. To open the web interface directly:
58
+ Requires **Node.js 22.19+** and npm. Run in your project directory:
29
59
 
30
60
  ```bash
31
61
  npx pi-webapp
32
62
  ```
33
63
 
34
- This starts Pi in the background and opens the default browser on a local graphical desktop, leaving the terminal free. If Pi is missing, the launcher installs the official `@earendil-works/pi-coding-agent` package with npm. An existing Pi installation must be version 0.87.1 or later. The launcher does not replace an older installation automatically. Running the launcher again reopens the existing server. Remote or headless sessions print the address instead; set `PI_WEBAPP_AUTO_OPEN=0` to disable automatic opening.
35
-
36
- In Settings → General → App updates, the web page checks npm for a newer `pi-webapp` release. When started by the background launcher from an npm package, **Update and restart** installs the verified release under Pi's `pi-web/releases/` data directory, restarts the server, and reloads the same browser address. Wait for any active reply to finish first. If the new version cannot start, the launcher restores the previous service. This works for both `npx` and global-command launches; later launches select the managed release automatically. It does not change the npm global installation. Source checkouts and `/web` pages opened from an existing Pi terminal show version information but cannot restart from the web page. If the service does not return, run `pi-webapp status` and check `~/.pi/agent/pi-web/launcher.log`.
64
+ The launcher starts Pi in the background and opens your browser on a local graphical desktop. If Pi is missing, it installs the official `@earendil-works/pi-coding-agent` package. An existing Pi installation must be **0.87.1+**; older installations are not replaced automatically. Running the command again reopens the existing service. Headless sessions print the local address instead; `PI_WEBAPP_AUTO_OPEN=0` disables automatic opening.
37
65
 
38
- Use `npx pi-webapp status` to show the address and `npx pi-webapp stop` to stop the background service. After a global install, use `pi-webapp status` and `pi-webapp stop`.
66
+ 1. Open **Settings → Models** to configure a provider and choose a model you have access to.
67
+ 2. Select or add a workspace, then start a conversation.
68
+ 3. Open the conversation's upper-right tool panel to explore **Files**, **Terminal**, or **Git changes** alongside the agent.
39
69
 
40
- You can also install the launcher globally:
70
+ Model access is required separately; a local interface does not mean offline inference. Keep token-bearing local URLs private and do not expose the service directly to the public internet.
41
71
 
42
72
  ```bash
43
- npm install -g pi-webapp
44
- pi-webapp
73
+ npx pi-webapp status # Show the running service address
74
+ npx pi-webapp stop # Stop the service after active work finishes
45
75
  ```
46
76
 
47
- To use the extension inside an existing Pi terminal, the original workflow remains available:
77
+ Prefer a global command? Run `npm install -g pi-webapp`, then `pi-webapp`.
78
+
79
+ **Updates:** npm-launcher installations support **Settings → General → App updates → Update and restart**, with rollback if the new service fails to start. Finish active work first. Source checkouts and terminal `/web` sessions show version information but cannot restart from the page. See the [update guide](docs/en/updates.md).
80
+
81
+ ### Already using Pi in a terminal?
48
82
 
49
83
  ```bash
50
84
  pi install npm:pi-webapp
51
85
  pi
52
86
  ```
53
87
 
54
- In Pi, enter `/web` to open the interface in your default browser. Pi also prints the local URL for remote or headless environments. The URL contains a random token valid only for the current Pi process. Enter `/web` again to reopen it.
88
+ Enter **`/web`** inside Pi. The browser stays synchronized with that terminal session; Pi continues to own the agent, tools, and session storage. Exiting that Pi process ends its service.
55
89
 
56
- ## Features
90
+ ## Desktop downloads
57
91
 
58
- - View the current conversation with Markdown, streaming output, expandable reasoning and tool calls, token usage, and a turn-by-turn trace.
59
- - Send messages, pause and continue a run, start a new Pi session, and change the current model or thinking level. The bottom-right control pauses an active run; an empty composer offers Continue after pausing, including after refreshing or reopening the session. Continue uses an internal control action without adding a user message; the model makes a new request based on existing progress, and plan mode still requires fresh approval.
60
- - Browse workspaces and saved sessions. Add a workspace with the native directory picker when available, or use the built-in directory browser over SSH.
61
- - Open the right sidebar from the permanent control in the conversation’s upper-right corner. Choose **Workspace files** to browse the current session’s directory tree and open read-only file tabs. Workspace-relative and in-workspace absolute file links in the conversation also open these previews; external URLs still open in a new tab. Previews support highlighted code with line numbers, Markdown with preview/source modes, and PNG/JPEG/GIF/WebP images with a lightbox. The sidebar supports resizing, split panes, fullscreen, and plugin content. Switching chats retains their tabs and expanded directories until the page reloads. Manually reload listings or previews as needed. Listings show up to 1,000 entries per directory; text previews allow up to 512 KB / 10,000 lines, and images up to 8 MB. HTML/SVG remain source text; unsupported binary files show a notice. Reads, including resolved symlink targets, stay within the current session’s workspace.
62
- - Choose **Open terminal** on the right sidebar’s start page to launch the default shell in the current session’s workspace. Supports interactive input, streaming output, Ctrl+C, resizing, split panes, and fullscreen. Tab changes, sidebar collapse, and chat switches retain the process, environment, and screen. Short disconnects reconnect automatically without replaying uncertain input. Closing a tab or stopping the service reaps its process; disconnected browsers have a five-minute retention window. Page reloads reset tabs, and processes do not survive service restarts. Limits: 8 terminals per session, 32 per service, and 2,000 scrollback rows. Shells run with the Pi user’s system permissions; the workspace is their initial directory, not a shell sandbox.
63
- - Choose **Git changes** on the right sidebar’s start page to review the current branch, commit, locally recorded upstream divergence, and staged, unstaged, untracked, or conflicted files. Click a file to preview its read-only unified diff inside the Git panel, keeping the file list visible and the tab count unchanged. Lists and diffs scroll independently; narrow panes stack them and panes at least 720 px wide place them side by side. The selected file is highlighted and retained with its Git tab, follows staging changes, and clears when the file is no longer changed. Close the preview to restore the full list. Diffs hide raw Git headers, show old/new line numbers and addition/deletion counts, and offer previous/next navigation between contiguous change blocks with a position counter. File-mode changes and missing final newlines retain compact notices. Reads stay within the session’s directory, including when it is a repository subdirectory; linked worktrees and repositories without commits are supported. Visible Git tabs refresh after agent state changes, on focus, and every five seconds; hidden tabs stop polling. Requires Git on the machine running Pi. Lists show up to 1,000 files and diffs up to 512 KB / 10,000 lines. Binary files, submodules and unresolved conflicts show notices. Changes belong to the shared working tree, not exclusively to one chat; working-file and historical diffs remain read-only.
64
- - In **Git changes → Changes**, use each file’s **+ / −** button to stage or unstage it, use the fixed bottom composer to commit only the staged index (Ctrl/Cmd+Enter is supported), and click the branch name to search/switch local branches or open **New branch**. The file list scrolls independently; full repository metadata is available on the short repository name’s tooltip. Drafts stay with each chat’s Git tab. Commits and branch switches require a root workspace; switching also requires a clean working tree, including untracked files. Writes require all known chats using the worktree to be idle, reject stale snapshots, and honor Git hooks/signing. Conflicts, active Git operations, locks and occupied worktree branches block incompatible writes. Failed or unconfirmed operations retain drafts and never retry automatically. Changes are shared by chats using the same worktree. No fetch/push, forced switch, stash or discard is performed.
65
- - In **Git changes → History**, browse commits alongside their branch/merge graph, with HEAD, local branch, remote-tracking branch and tag labels. Load history 50 commits at a time; a ref change resets pagination to prevent mixed histories. Open commit details for the full message, author/committer, timestamps, parents and changed files, then preview a read-only file diff alongside the same commit file list without opening another tab. Merge details let you select the parent to compare against; root commits compare against an empty tree. The graph shows repository-wide metadata while commit files and diffs stay within the session directory. Graph selection and loaded history remain with each chat’s Git tab until the page reloads. Remote labels use local refs without fetching.
66
- - Attach up to 20 files of 20 MB each by selecting, dropping, or pasting them. Images show previews and are also sent as Pi image content.
67
- - Open Plugins directly below New session in the sidebar to inspect and switch the bundled Git, Files and Terminal capabilities. Switches are global, persist locally, and require every chat to be idle. Disabling closes related tabs and blocks backend requests; Terminal asks for confirmation before ending all service-owned terminals. External Pi Web runtimes remain managed through Packages & extensions rather than a misleading UI-only switch.
68
- - Manage appearance, Pi packages, extensions, skills, and models from the settings panel. The Models page can add models, edit display names, context windows, output limits, and input types, and restore built-in defaults; changes are saved to Pi's `models.json`. Browser sign-in opens the provider's authorization page automatically; manual code entry remains available when a callback cannot reach Pi. Stored provider credentials can also be removed there. Credentials stay in Pi's local `auth.json` and are never returned to the browser.
92
+ **Latest desktop test release: [pi 0.1.24 · build 8](https://github.com/chengzhiyi/pi-webapp/releases/tag/desktop-v0.1.24-b8).** Download the installer for your operating system and CPU:
69
93
 
70
- If you enter `/web` manually in a Pi terminal, that terminal session stays synchronized with the browser. With the launcher, Pi runs in the background. Sessions opened in other workspaces use the Pi SDK and load that workspace's skills and project context. They load enabled Web plugin Pi entries explicitly while keeping other Pi extensions isolated from the parent bridge.
71
-
72
- Chats run independently: switching workspaces or chats, or creating a new chat, leaves existing tasks running in the background. Returning to a chat restores its running output, history, and pending plugin interactions. Stop affects only the selected chat. Sessions remain in memory until the Pi service stops; stopping or restarting the service ends background tasks.
94
+ | Platform | Download |
95
+ | --- | --- |
96
+ | **macOS · Apple Silicon (arm64)** | [Download DMG](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-mac-arm64.dmg) |
97
+ | **macOS · Intel (x64)** | [Download DMG](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-mac-x64.dmg) |
98
+ | **Windows · x64** | [Download EXE installer](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-win-x64.exe) |
99
+ | **Linux · x64** | [Download AppImage](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-linux-x86_64.AppImage) |
73
100
 
74
- On startup, the app discovers workspaces from Pi's saved sessions, so conversations from other directories appear in the sidebar. Workspace records and attachments stay under Pi's existing `pi-web/` data directory. Removing a workspace from the sidebar does not delete its files or sessions; you can add it again manually.
101
+ [All releases](https://github.com/chengzhiyi/pi-webapp/releases) · [SHA256SUMS](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/SHA256SUMS) · [Build/runtime metadata](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/desktop-release.json)
75
102
 
76
- ## Optional desktop application
103
+ The **pi** desktop app bundles Node and Pi—no separate runtime installation needed. It can reuse a compatible Web service, open the same service in your browser, and let you choose whether background tasks continue after closing the app. Bring your own model credentials, Git/SSH setup, and project toolchains.
77
104
 
78
- **[Download pi desktop test releases](https://github.com/chengzhiyi/pi-webapp/releases)** — macOS Apple Silicon (arm64) only for now. Download the DMG from a `desktop-v...` prerelease; compare `SHA256SUMS`, install **pi.app**, and check the build in **pi → 关于 pi**. From desktop build 7, macOS packages are fully ad-hoc signed but have no publisher identity or notarization; Gatekeeper may still block them. Follow the [small-group test installation guide](docs/desktop-testing.md), never disable macOS security globally. Old downloads are not retroactively fixed. Windows/Linux are not yet validated release downloads.
105
+ - **Install:** macOS: drag **pi.app** from the DMG into Applications. Windows: run the EXE installer. Linux: make the AppImage executable and run it; see the release notes for the FUSE alternative.
106
+ - **Verify:** compare the installer with `SHA256SUMS` from the same release. Confirm **build 8** in **pi → 关于 pi (About pi)**. Quit the old desktop before replacing it; do not delete `~/.pi`.
107
+ - **Test-release limits:** these are opt-in prereleases, not publisher-signed stable distributions. macOS uses ad-hoc signatures without Apple notarization and may be blocked by Gatekeeper; follow the [macOS test installation guide](docs/desktop-testing.md) and stop if verification fails. Windows/Linux packages are unsigned. Never disable system security globally. Desktop updates require manual installation; Windows ARM and Linux ARM are not included.
79
108
 
80
- The same UI can run in the **pi** Electron desktop application while the browser and `/web` entry points remain available. Desktop packages include Node/Pi, reuse compatible running services, and let you open the same service in a browser or choose whether to keep background tasks running on exit.
109
+ ## Architecture highlights
81
110
 
82
- From source: `npm ci` → `npm run desktop:prepare` → `npm run desktop:start`. Run `npm run desktop:package` to create a host-native installer under `desktop-release/`. Local QA targets macOS arm64; Windows/Linux configurations need verification on their respective systems. Test packages without a publisher signature support checked downloads and manual installation only, not automatic installation. Installers include a desktop build number; check **pi → 关于 pi** for the running build and executable location. Quit the old desktop before replacing it; an external compatible Web backend need not be stopped. Finish tasks and stop an owned runtime before replacing that runtime.
111
+ **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.
83
112
 
84
- See [desktop build, testing and release boundaries](docs/desktop.md).
113
+ [![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)
85
114
 
86
- ## Develop locally
115
+ *The UI is shared; session orchestration, agent execution, and workspace capabilities keep distinct responsibilities.*
87
116
 
88
- ```bash
89
- npm install
90
- npm run check
91
- npm run test
92
- npm run build
93
- npm run start
94
- npm run status
95
- npm run stop
96
- ```
117
+ | Design choice | Why it matters |
118
+ | --- | --- |
119
+ | **Thin Pi adapter, separate host** | Agent integration stays small; server orchestration, browser UI, and workspace capabilities have explicit ownership instead of growing inside one extension entry point. |
120
+ | **Typed, validated cross-boundary contracts** | Browser code uses wire DTOs rather than Node/Pi runtime objects. HTTP actions and NDJSON events keep commands and live state updates explicit. |
121
+ | **Plugin-owned capabilities** | Built-in Git, Files, and Terminal each own their server/client/contracts and cleanup. A registry dispatches requests; the host workbench manages tabs, docking, focus, and session identity. |
122
+ | **Lifecycle-aware sessions** | Background sessions retain progress and pending interactions when you navigate away. Switching a chat preserves tool resources; closing a tab disposes its resource. |
123
+ | **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. |
124
+ | **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. |
97
125
 
98
- `npm run start` builds the project, starts Pi in the background, and opens the web interface. After editing the extension, run `npm run stop` followed by `npm run start`. If you develop with `pi -e .`, enter `/reload` and `/web` in Pi after rebuilding. Refreshing an old browser page alone does not replace the running bridge.
126
+ 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.
99
127
 
100
- For local Web plugin development with the sibling `pi-extensions` workspace, follow its `README.md`. Set `PI_WEBAPP_PLUGIN_DEV_ROOTS=../pi-extensions/packages/plan-mode` when starting this app; browser asset changes refresh automatically and Pi entry changes trigger a safe reload when the agent is idle.
128
+ Read the [architecture and ownership guide](docs/architecture.md) or [Web plugin integration notes](docs/web-plugins.md) for lifecycle and extension details.
101
129
 
102
- Source ownership is split across `src/adapters/pi/` (the thin Pi entry), `src/host/` (server and browser host), `src/plugins/builtin/` (Git, Files and Terminal, each with server/client/contracts), `src/contracts/`, and shared UI in `web/src/ui/`. See [architecture and plugin management](docs/architecture.md). The npm package contains only the bundled, minified JavaScript extension, built web assets, cover image, and the English and Chinese READMEs. No TypeScript source or source maps are published. Minification makes the shipped code harder to read; it does not encrypt JavaScript.
130
+ ## Guides & development
103
131
 
104
- ## Error collection
132
+ - **New users:** [First conversation](docs/en/getting-started.md) · [Sessions](docs/en/sessions.md) · [Workspace tools](docs/en/workspace-tools.md)
133
+ - **Configuration:** [Models, packages, and skills](docs/en/configuration.md) · [Updates](docs/en/updates.md) · [Troubleshooting](docs/en/troubleshooting.md)
134
+ - **Contributors:** [Architecture](docs/architecture.md) · [Web plugins](docs/web-plugins.md) · [Desktop builds](docs/desktop.md)
105
135
 
106
- Frontend and extension Sentry error reporting is enabled by default with the built-in public DSN. Set `PI_WEB_SENTRY_DSN` in the Pi process environment to use another project, or `PI_WEB_SENTRY_ENABLED=false` to disable reporting. Collection is limited to sanitized stacks, semantic breadcrumbs and state summaries; conversations, source contents, attachments, credentials and session recordings are excluded. See [Sentry configuration](docs/sentry.md) for the default destination, separate destinations, limits and private source-map uploads.
136
+ The guides follow the source tree; installed versions may differ. For desktop availability, use the verified release links above and their release notes.
107
137
 
108
- ## Publish
138
+ ### Develop locally
109
139
 
110
- CI resolves the published `@chengzhiyi/pi-web-protocol` version before `npm ci`.
111
- Until the first protocol publication, verification builds a pinned `pi-extensions`
112
- commit in an ignored `.ci/` checkout and uses that local package. Checks, tests,
113
- and builds still run; the Actions summary explains why host publication is waiting.
114
- Release builds always require the published npm dependency. Once it exists, the
115
- next workflow uses its exact version and the release commit records the lockfile.
116
- Use Actions' manual run after initializing npm; protocol releases do not trigger
117
- this repository automatically.
140
+ ```bash
141
+ npm ci
142
+ npm run check
143
+ npm test
144
+ npm run build
145
+ npm run start
146
+ ```
118
147
 
119
- `npm publish` runs the checks, tests, and production build. The `pi-package` keyword makes the published npm package eligible for the [Pi package catalog](https://pi.dev/packages); catalog updates may lag behind npm.
148
+ `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.
120
149
 
121
- GitHub Actions runs `check`, `test`, and `build` on pull requests to `main`. A push to `main` repeats those checks, chooses the next patch version from the source version and npm `latest`, then commits the updated `package.json` and `package-lock.json` to `main` before publishing. The release commit uses the workflow's `GITHUB_TOKEN` and does not start another workflow run. To start a new minor or major series, raise the version in both package files in the pull request. Each release also updates the package's `pi.image` URL to its own version. The repository must allow the workflow to push to `main` for publishing to proceed.
150
+ For desktop development: `npm run desktop:prepare` → `npm run desktop:start`. `npm run desktop:package` creates a host-native installer in `desktop-release/`. For trusted local plugin development, see `PI_WEBAPP_PLUGIN_DEV_ROOTS` in the [plugin notes](docs/web-plugins.md).
122
151
 
123
- Before the first automated release, configure npm Trusted Publishing for the `pi-webapp` package: GitHub owner `chengzhiyi`, repository `pi-webapp`, workflow filename `ci.yml`, no environment, and allow direct `npm publish`. This workflow uses GitHub's OIDC identity and does not need an npm token. Keep the package's repository URL in `package.json` aligned with the GitHub repository.
152
+ ---
124
153
 
125
- ## License
154
+ **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.
126
155
 
127
- MIT. See the `LICENSE` file.
156
+ MIT licensed. See [LICENSE](LICENSE).
package/README.zh-CN.md CHANGED
@@ -1,125 +1,156 @@
1
1
  # pi-webapp
2
2
 
3
- [English](README.md)
3
+ ### 让 Pi 编程 Agent,拥有一个看得见、用得顺的工作台。
4
4
 
5
- ## 下载 pi 桌面版
5
+ 把 AI 对话、项目文件、终端和 Git 放在同一个界面中,不必放弃 Pi 的工具、技能和终端工作流。在浏览器里直接使用,打开独立桌面窗口,或从已有 Pi 会话一键进入。
6
6
 
7
- **⬇ 测试版 · v0.1.21 / 桌面构建 6 · 内置 Pi 1.3.0**
7
+ [English](README.md) · [快速开始](#快速开始) · [下载桌面端](#桌面端下载) · [使用指南](docs/zh/getting-started.md) · [npm](https://www.npmjs.com/package/pi-webapp)
8
8
 
9
- | 你的电脑 | 下载安装包 |
9
+ **桌面测试版 build 8:** [macOS · Apple 芯片](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-mac-arm64.dmg) · [macOS · Intel](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-mac-x64.dmg) · [Windows x64](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-win-x64.exe) · [Linux x64](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-linux-x86_64.AppImage)。请核对 [SHA-256](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/SHA256SUMS);测试包未签名或无发布者身份,macOS 未公证。[安全安装说明](#桌面端下载)。
10
+
11
+ [![Pi 工作台:左侧项目会话,中间 Agent 对话,右侧代码高亮预览](assets/readme/workbench.png)](assets/readme/workbench.png)
12
+
13
+ *一边跟进对话,一边查看消息中链接的源码。截图来自真实界面,使用英文演示数据,并非真实模型执行记录。*
14
+
15
+ ```bash
16
+ npx pi-webapp
17
+ ```
18
+
19
+ **Web 一条命令启动,桌面端自带运行时,底层仍是你熟悉的 Pi。**
20
+
21
+ ## 为什么选择 pi-webapp?
22
+
23
+ - **少切窗口,多关注代码。** 一边跟进 Agent,一边查看文件、运行命令、审查差异,让对话与项目上下文留在一起。
24
+ - **多个项目,任务不中断。** 各聊天独立运行;切换工作区或新开对话,不会打断原来正在执行的任务。
25
+ - **不只看到答案,也能看懂过程。** 流式回复、可展开的推理和工具调用、Token 用量及执行轨迹,让进度更容易掌握。
26
+ - **增强 Pi,而不是另起一套。** 继续使用 Pi 的会话存储、模型选择、技能与扩展生态,新增的是可视化工作台,而非替代 Agent 引擎。
27
+
28
+ ## 看图了解工作流
29
+
30
+ **对话 → 查看源码 → 审查改动 → 运行验证。** 上方工作台把对话和代码放在一起;同一个工具面板,还能让你从差异审查直接进入终端验证。
31
+
32
+ | 提交前,看清每一处改动 | 不离开对话,直接运行验证 |
10
33
  | --- | --- |
11
- | macOS · Apple 芯片(M 系列,arm64) | [下载 DMG](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/pi-0.1.21-desktop.6-mac-arm64.dmg) |
12
- | macOS · Intel 芯片(x64) | [下载 DMG](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/pi-0.1.21-desktop.6-mac-x64.dmg) |
13
- | Windows · x64 | [下载 EXE 安装程序](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/pi-0.1.21-desktop.6-win-x64.exe) |
14
- | Linux · x64 | [下载 AppImage](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/pi-0.1.21-desktop.6-linux-x86_64.AppImage) |
34
+ | [![Git 面板:已暂存的测试,以及包邮门槛修复的红绿差异](assets/readme/git-review.png)](assets/readme/git-review.png) | [![内置终端:实际运行演示项目测试,2 项通过、0 项失败](assets/readme/terminal.png)](assets/readme/terminal.png) |
35
+ | 对照差异审查,按需暂存要提交的文件。 | 在项目目录执行命令,保留当前对话上下文。 |
15
36
 
16
- [版本说明](https://github.com/chengzhiyi/pi-webapp/releases/tag/desktop-v0.1.21-b6) · [SHA-256 校验和](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/SHA256SUMS) · [运行时与源码元数据](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.21-b6/desktop-release.json) · [旧构建 5(保留回退)](https://github.com/chengzhiyi/pi-webapp/releases/tag/desktop-v0.1.20-b5) · [改用 Web/npm 方式](#安装与打开)
37
+ *点击图片可查看原图。截图使用隔离的演示仓库,终端实际运行了两项回归测试;不使用提供方凭据或私有项目数据。[图片生成与维护说明](assets/readme/README.md)。*
17
38
 
18
- > **安装:** macOS 打开 DMG,将 **pi.app** 拖入“应用程序”;Windows 运行 EXE 安装程序;Linux 为 AppImage 添加可执行权限后运行,缺少 FUSE 时可加 `--appimage-extract-and-run`。已内置 Node 和锁定版本的 Pi **1.3.0**,无需另装;首次使用在设置中配置模型账户。替换前先退出旧桌面。复用外部 Web 后台时,其 Pi 仍保持原版本,不会自动停止或升级。
19
- >
20
- > **未签名测试版:** macOS 未公证,Windows 可能提示未知发布者;仅在确认来源可信后按单个应用的系统提示处理,不要全局关闭系统安全保护。四种实际安装包均通过原生运行冒烟,但不代表已测试所有 Linux 发行版或真实模型账户登录。不含 Windows ARM/Linux ARM;本构建尚无桌面自动更新。
39
+ ## 核心功能
21
40
 
22
- ![pi-webapp 封面](assets/cover-webapp.png)
41
+ | 能力 | 你可以做什么 |
42
+ | --- | --- |
43
+ | **实时 Agent 对话** | 发送消息与图片/文件附件,暂停与继续任务,切换模型及思考级别;在上下文中阅读 Markdown、代码、推理和工具结果。 |
44
+ | **多项目与多会话** | 发现已有 Pi 会话、添加工作区,在独立运行的聊天之间切换;回来时继续查看输出和待处理的插件交互。 |
45
+ | **对话旁的文件预览** | 浏览工作区,点击聊天中的文件路径,在只读标签页查看高亮代码、Markdown 与图片。 |
46
+ | **真正的交互式终端** | 在工作区启动 shell,交互输入、Ctrl+C;切换聊天或面板时保留进程与输出。 |
47
+ | **Git 审查与操作** | 查看改动和内联差异、逐文件暂存/取消暂存、提交暂存区、创建/切换本地分支,并用分支关系图浏览提交历史。 |
48
+ | **灵活的工作台布局** | 调宽、分栏、展开工具面板,或进入工作区专注模式,同时保留导航入口。各聊天保留自己的工具标签,直到网页刷新。 |
49
+ | **模型、技能与插件** | 配置提供方和模型,管理 Pi 软件包/扩展/技能,启停内置文件、终端与 Git;兼容的 Web 插件还可贡献自己的界面。 |
50
+ | **浏览器与桌面入口** | 用后台启动器打开 Web,从 Pi 终端输入 `/web`,或运行自带 Node/Pi 的 Electron 桌面应用。 |
51
+
52
+ > 聊天独立运行,但同一工作树中的文件和 Git 改动是共享的。切换聊天不会停止任务;停止服务会结束其后台任务。终端与 Agent 工具使用你的系统权限,不是沙箱环境。
23
53
 
24
- **pi-webapp** 可以在本地浏览器中打开当前活跃的 Pi 编程 Agent 会话。Agent、工具和会话存储仍由 Pi 运行和管理;浏览器提供实时的对话与控制界面。
54
+ ## 快速开始
25
55
 
26
- ## 安装与打开
56
+ ### Web:一条命令启动
27
57
 
28
- 需要 Node.js 22.19 或更新版本。推荐直接运行:
58
+ 需要 **Node.js 22.19+** 和 npm。在项目目录运行:
29
59
 
30
60
  ```bash
31
61
  npx pi-webapp
32
62
  ```
33
63
 
34
- 该命令会在后台启动 Pi,并在本地图形桌面用默认浏览器打开网页,终端可继续使用。若未找到 Pi,会自动通过 npm 安装官方 `@earendil-works/pi-coding-agent`。已有 Pi 需要 0.87.1 或更新版本;启动器不会自动覆盖旧版本。再次运行启动命令会重新打开已有服务。远程或无图形界面时只显示地址;设置 `PI_WEBAPP_AUTO_OPEN=0` 可关闭自动打开。
35
-
36
- 网页的「设置 → 通用设置 → 应用更新」会检查 npm 上的 `pi-webapp` 新版本。通过 npm 包的后台启动器运行时,点击「升级并重启」会先将新版安装并校验到 Pi 数据目录的 `pi-web/releases/`,然后重启服务,网页会在原地址重新加载。请先等待当前回复结束。若新版无法启动,启动器会恢复旧版服务。`npx` 和全局命令启动均可使用;后续启动会自动选用已安装的新版。此操作不会改动 npm 全局安装。源码目录运行和已有 Pi 终端中的 `/web` 页面可以查看版本,但不能从网页重启。若服务未恢复,可运行 `pi-webapp status` 并查看 `~/.pi/agent/pi-web/launcher.log`。
64
+ 启动器会在后台启动 Pi,并在本地图形桌面打开默认浏览器。未安装 Pi 时,会自动安装官方 `@earendil-works/pi-coding-agent`;已有 Pi 需要 **0.87.1+**,旧版本不会被自动覆盖。再次执行命令会重新打开已有服务。无图形界面时显示本地地址;设置 `PI_WEBAPP_AUTO_OPEN=0` 可关闭自动打开。
37
65
 
38
- 可用 `npx pi-webapp status` 查看地址,用 `npx pi-webapp stop` 停止后台服务。全局安装后可直接运行 `pi-webapp status` 和 `pi-webapp stop`。
66
+ 1. 进入「**设置 → 模型**」,配置提供方并选择有权使用的模型。
67
+ 2. 选择或添加工作区,开始一次对话。
68
+ 3. 打开对话右上角的工具面板,在 Agent 旁边使用「**文件**」「**终端**」或「**Git 改动**」。
39
69
 
40
- 也可以将启动器安装为全局命令:
70
+ 模型访问权限需自行配置;本地界面不等于离线推理。请勿分享带访问令牌的本地 URL,也不要把服务直接暴露到公网。
41
71
 
42
72
  ```bash
43
- npm install -g pi-webapp
44
- pi-webapp
73
+ npx pi-webapp status # 查看运行中的服务地址
74
+ npx pi-webapp stop # 完成当前任务后停止服务
45
75
  ```
46
76
 
47
- 如果希望在已有 Pi 终端中使用,仍可按原方式安装扩展:
77
+ 习惯全局命令?先运行 `npm install -g pi-webapp`,再运行 `pi-webapp`。
78
+
79
+ **升级:** 通过 npm 后台启动器运行时,可在「设置 → 通用设置 → 应用更新」中「升级并重启」;新版启动失败会回退。请先结束活跃任务。源码运行和 Pi 终端 `/web` 页面仅显示版本信息,不能从网页重启。详见[更新指南](docs/zh/updates.md)。
80
+
81
+ ### 已经在终端使用 Pi?
48
82
 
49
83
  ```bash
50
84
  pi install npm:pi-webapp
51
85
  pi
52
86
  ```
53
87
 
54
- 在 Pi 中输入 `/web`,即可在默认浏览器中打开界面。对于远程或无图形界面的环境,Pi 也会输出本地访问地址。该地址包含一个随机令牌,仅在当前 Pi 进程运行期间有效。再次输入 `/web` 可以重新打开界面。
88
+ 在 Pi 中输入 **`/web`** 即可。浏览器与该终端会话保持同步,Agent、工具和会话存储继续由 Pi 管理;退出该 Pi 进程会结束其服务。
55
89
 
56
- ## 功能
90
+ ## 桌面端下载
57
91
 
58
- - 查看当前对话,包括 Markdown 内容、流式输出、可展开的推理过程与工具调用、Token 用量,以及逐轮执行轨迹。
59
- - 发送消息、暂停与继续运行、启动新的 Pi 会话,以及切换当前模型或思考级别。运行时右下角显示暂停;暂停后清空输入框即可继续,刷新或重新打开会话后仍可恢复。继续通过内部控制动作恢复原任务,不新增用户消息;模型会基于已有进度发起新请求,计划模式仍需重新审批。
60
- - 浏览工作区和已保存的会话。环境支持时可通过系统目录选择器添加工作区;通过 SSH 使用时,也可使用内置目录浏览器。
61
- - 通过对话右上角的常驻入口打开右侧工具栏,在「工作区文件」中逐层浏览当前会话的目录,点击文件打开只读预览。对话中的工作区相对路径及工作区内绝对路径链接也会直接打开右侧预览,外部网址仍在新窗口打开。支持带行号和高亮的代码、Markdown 预览与源码切换,以及 PNG/JPEG/GIF/WebP 图片与放大查看。面板可收起、调宽、分栏或全屏,并继续承载插件内容;切换聊天会保留各自的标签和目录展开状态(刷新网页后重置)。文件树和预览提供手动刷新,每层最多显示 1000 项,文本预览上限 512 KB / 10000 行、图片上限 8 MB;HTML/SVG 显示源码,其他二进制文件显示不支持提示。文件读取限制在当前会话工作区内,包括符号链接的真实目标。
62
- - 在右侧「开始」页选择「打开终端」,以当前会话的工作区为初始目录启动默认 shell。支持真实交互输入、持续输出、Ctrl+C、尺寸调整、分栏和全屏。切换标签、折叠侧栏和切换聊天保留进程、环境变量与终端画面;短暂断线会自动重连,未确认的输入不会重放。关闭标签或停止服务会回收进程;浏览器关闭或连接持续丢失后,后台最多保留 5 分钟。刷新网页会重置标签,不支持跨服务重启恢复进程。每会话最多 8 个终端、服务最多 32 个,保留 2000 行滚动历史。终端使用 Pi 所在用户的系统权限,工作区是初始目录,不是 shell 沙箱。
63
- - 在右侧「开始」页选择「Git 改动」,查看当前分支、提交、基于本地记录的上游领先/落后数量,以及已暂存、未暂存、未跟踪和冲突文件。点击文件直接在 Git 面板内预览只读差异,保留文件列表且不增加标签页。列表与差异独立滚动,窄面板上下排列,宽度达到 720 px 时左右并排。选中文件高亮并随 Git 标签保留,暂存状态变化时跟随对应范围,文件不再有改动时收起预览;也可手动关闭恢复完整列表。差异隐藏原始 Git 头信息,显示新旧行号与增删行数,可用上一处/下一处按钮逐个跳转连续改动块并查看当前位置;文件权限变化、末尾无换行等信息保留为简洁提示。读取范围限制在当前会话目录内,包括仓库子目录;支持独立工作树和尚无提交的仓库。可见的 Git 标签会在 Agent 状态变化、页面重新聚焦时刷新,并每 5 秒检查一次;隐藏后停止轮询。需要在 Pi 所在机器安装 Git。最多显示 1000 个文件,差异上限 512 KB / 10000 行;二进制文件、子模块和未解决冲突显示提示。改动属于共享工作树,不代表全部由当前聊天产生;工作区与历史文件的差异视图保持只读。
64
- - 在「Git 改动 → 改动」中,用文件右侧的 **+ / −** 逐文件暂存或取消暂存;底部固定提交栏仅提交暂存区内容(支持 Ctrl/Cmd+Enter);点击顶部分支名称,可搜索和切换本地分支,选择「新建分支」才展开创建表单。文件列表独立滚动,仓库完整信息通过短名称的悬停提示查看。草稿随各聊天的 Git 标签保留。提交和切换分支要求仓库根目录工作区,切换还要求整个工作树干净(包括未跟踪文件)。写操作要求共用工作树的已知聊天均为空闲,并校验状态快照,遵守 Git hooks 与签名配置。冲突、未完成的 Git 操作、锁及其他工作树占用的分支会阻止相应操作。失败或结果不明时保留草稿,不自动重试。同一工作树的改动由多个聊天共享。不执行 fetch/push、强制切换、stash 或丢弃改动。
65
- - 在「Git 改动 → 历史」中浏览提交及其分支、合并关系图,显示 HEAD、本地分支、远端跟踪分支和标签。历史每次加载 50 条;引用变化时重新加载首页,避免分页混入不同版本的历史。点击提交查看完整说明、作者与提交者、时间、父提交及改动文件,再点击文件在当前提交详情内预览只读差异,保留文件列表,不再新建差异标签。合并提交可选择比较的父提交,根提交与空目录比较。关系图展示整个仓库的提交元数据,提交文件和差异仍限制在当前会话目录内。历史选中项与已加载页随各聊天的 Git 标签保留,网页刷新后重置。远端标签仅使用本地记录,不发起拉取。
66
- - 通过选择、拖放或粘贴附加文件,最多 20 个,每个不超过 20 MB。图片会显示预览,并作为 Pi 图片内容发送。
67
- - 从侧栏「新会话」下方的「插件」入口管理内置 Git、文件和终端。支持列表/详情、搜索、真实启停和全局持久化;所有聊天空闲后才可切换。停用会关闭相关标签并阻止后端请求,停用终端需确认并结束此服务的全部终端。外部 Pi Web 插件展示运行时归属,仍通过「包与扩展」管理,不提供只隐藏 UI 的假开关。
68
- - 在设置面板中管理外观、Pi 软件包、扩展、技能和模型。模型页可添加模型、编辑显示名称、上下文窗口、最大输出 token 数和输入类型,或恢复内置模型的默认参数;配置写入 Pi 的 `models.json`。网页登录会自动打开提供方授权页;当回调无法到达 Pi 时,仍可手动粘贴授权码。已保存的提供方认证可在这里移除。凭据保留在 Pi 本地的 `auth.json`,不会返回给浏览器。
92
+ **最新桌面测试版:[pi 0.1.24 · build 8](https://github.com/chengzhiyi/pi-webapp/releases/tag/desktop-v0.1.24-b8)。** 请按系统与芯片选择安装包:
69
93
 
70
- 如果通过 Pi 终端手动输入 `/web`,该终端会话会与浏览器保持同步。使用启动器时,Pi 在后台运行。在其他工作区打开的会话使用 Pi SDK,并加载该工作区的技能和项目上下文;已启用的 Web 插件 Pi 入口会显式加载,其他普通 Pi 扩展仍与主会话隔离。
71
-
72
- 每个聊天独立运行:切换工作区、切换聊天或新建聊天时,原任务会继续在后台执行。切回后会恢复正在输出的内容、历史记录和待处理的插件交互。“停止”只影响当前选中的聊天。会话实例会保留到 Pi 服务停止;停止或重启服务会结束后台任务。
94
+ | 平台 | 下载 |
95
+ | --- | --- |
96
+ | **macOS · Apple 芯片(arm64)** | [下载 DMG](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-mac-arm64.dmg) |
97
+ | **macOS · Intel(x64)** | [下载 DMG](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-mac-x64.dmg) |
98
+ | **Windows · x64** | [下载 EXE 安装包](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-win-x64.exe) |
99
+ | **Linux · x64** | [下载 AppImage](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/pi-0.1.24-desktop.8-linux-x86_64.AppImage) |
73
100
 
74
- 启动时会从 Pi 已保存的会话中发现工作区,因此先前在其他目录使用 Pi 的会话也会出现在侧边栏。工作区记录和附件继续存放在 Pi 现有的 `pi-web/` 数据目录下。从侧边栏移除工作区不会删除其文件或会话;移除后如需再次显示,可以手动添加。
101
+ [全部版本](https://github.com/chengzhiyi/pi-webapp/releases) · [SHA256SUMS 校验文件](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/SHA256SUMS) · [构建与运行时信息](https://github.com/chengzhiyi/pi-webapp/releases/download/desktop-v0.1.24-b8/desktop-release.json)
75
102
 
76
- ## 桌面端(可选)
103
+ 桌面应用名为 **pi**,自带 Node 和 Pi,无需另装运行时。支持复用兼容的 Web 服务、在浏览器中打开同一服务,以及退出时选择是否保留后台任务。模型凭据、Git/SSH 配置和项目工具链仍需自行准备。
77
104
 
78
- **[下载 pi 桌面测试版](https://github.com/chengzhiyi/pi-webapp/releases)** — 目前仅发布已验收的 macOS Apple 芯片(arm64)版本。在 `desktop-v...` 预发布版本中下载 DMG,核对 `SHA256SUMS` 后安装 **pi.app**,在“pi → 关于 pi”查看构建号。桌面构建 7 起使用完整 ad-hoc 临时签名,但没有发布者身份、未公证,macOS 仍可能拦截;请按[小范围测试安装说明](docs/desktop-testing.md)操作,不要全局关闭系统安全保护。旧测试包不会自动修复;Windows/Linux 暂不提供已验收的发行包。
105
+ - **安装:** macOS 从 DMG 将 **pi.app** 拖入“应用程序”;Windows 运行 EXE;Linux 为 AppImage 添加执行权限后运行,不支持 FUSE 时可参考该版本发布说明中的替代方式。
106
+ - **核对:** 对照同一 Release 的 `SHA256SUMS` 校验安装包,在「pi → 关于 pi」确认 **build 8**。替换前先退出旧桌面,不要删除 `~/.pi`。
107
+ - **测试版边界:** 当前为自愿参与的预发布测试包,不是具有发布者签名的稳定发行版。macOS 使用 ad-hoc 临时签名、未经过 Apple 公证,可能被 Gatekeeper 拦截;请按 [macOS 测试安装说明](docs/desktop-testing.md)核验,失败就停止。Windows/Linux 安装包未签名。不要全局关闭系统安全保护。桌面更新需手动安装;暂不包含 Windows ARM 和 Linux ARM。
79
108
 
80
- 同一套界面也可在名为 **pi** 的 Electron 桌面程序中使用,现有浏览器与 `/web` 方式保持不变。桌面包自带 Node/Pi,支持独立窗口、已有服务复用、在浏览器打开同一服务,以及退出时选择保留或停止后台任务。
109
+ ## 技术架构亮点
81
110
 
82
- 源码构建:`npm ci` → `npm run desktop:prepare` → `npm run desktop:start`。运行 `npm run desktop:package` 生成当前系统/架构的安装包,输出到 `desktop-release/`。当前本地验证目标为 macOS arm64;Windows/Linux 打包配置需在对应系统验证。无发布者签名的测试包仅支持校验下载后手动安装,不会自动安装更新。安装包文件名包含桌面构建号;“pi → 关于 pi”显示实际运行的构建号和应用位置。替换前先退出旧桌面,外部兼容 Web 后台无需停止;若替换桌面自有运行时,请先结束任务并停止该自有后台。
111
+ **一套 Agent 引擎,多种使用入口,插件化工作台。** Pi 负责模型执行、工具与会话持久化;pi-webapp 负责界面、会话编排与工作区工具。
83
112
 
84
- 详细说明见 [桌面端构建、测试与发布边界](docs/desktop.md)。
113
+ [![架构图:浏览器与 Electron 复用 React 工作台,经本地 Node 宿主连接 Pi 引擎与工作区插件](assets/readme/architecture-zh.svg)](assets/readme/architecture-zh.svg)
85
114
 
86
- ## 本地开发
115
+ *共享的是界面;会话编排、Agent 执行与工作区能力,仍然各司其职。*
87
116
 
88
- ```bash
89
- npm install
90
- npm run check
91
- npm run test
92
- npm run build
93
- npm run start
94
- npm run status
95
- npm run stop
96
- ```
117
+ | 设计 | 带来的价值 |
118
+ | --- | --- |
119
+ | **薄 Pi 适配层,独立宿主职责** | Agent 接入保持轻量,服务编排、浏览器 UI 与工作区能力各有归属,避免所有逻辑挤进单一扩展入口。 |
120
+ | **类型化、可校验的跨端契约** | 浏览器只依赖传输 DTO,不直接耦合 Node/Pi 运行时对象;HTTP 动作与 NDJSON 事件明确划分命令和实时状态更新。 |
121
+ | **能力插件化,而非页面堆叠** | Git、文件和终端分别拥有 server/client/contracts 与清理逻辑,由注册表分发请求;标签、停靠、专注模式和会话身份交给宿主工作台。 |
122
+ | **面向生命周期的会话管理** | 离开聊天仍保留后台进度与待处理交互;切换聊天保留工具资源,关闭标签则释放对应资源。 |
123
+ | **宿主边界上的操作保护** | 本地传输校验令牌与请求来源;文件预览限制工作区及符号链接范围;Git 写入拒绝过期状态,并协调同工作树的已知聊天。这些检查不等于操作系统沙箱。 |
124
+ | **多入口复用同一套界面** | React + TypeScript 构建工作台,Vite/esbuild 完成打包,Electron 提供桌面外壳,无需另维护一套桌面对话 UI。 |
97
125
 
98
- `npm run start` 会构建项目、在后台启动 Pi 并打开 Web 界面。修改扩展后,运行 `npm run stop`,再运行 `npm run start`;如果使用 `pi -e .` 开发,则在 Pi 中依次输入 `/reload` 和 `/web`。仅刷新旧的浏览器页面不会替换正在运行的连接桥接代码。
126
+ 源码导航:`src/adapters/pi/` → Pi 入口 · `src/host/` → 前后端宿主 · `src/plugins/builtin/` → 工作区能力 · `src/contracts/` → 跨端契约 · `web/src/ui/` → 共享 UI · `desktop/` → Electron 外壳。
99
127
 
100
- 与同级 `pi-extensions` 联调时,先在该目录运行 `pnpm install && pnpm build`,再运行 `pnpm dev`;在本项目设置 `PI_WEBAPP_PLUGIN_DEV_ROOTS=../pi-extensions/packages/plan-mode` 后执行 `npm run start`。浏览器资源变化后页面会刷新,Pi 入口变化后会等待代理空闲并重载扩展。完整步骤见 `pi-extensions/README.md`。
128
+ 深入了解:[架构与职责划分](docs/architecture.md) · [Web 插件接入与生命周期](docs/web-plugins.md)。
101
129
 
102
- 源码按职责组织:`src/adapters/pi/` 为薄 Pi 入口,`src/host/` 为前后端宿主,`src/plugins/builtin/` 分别集中 Git、文件和终端的 server/client/contract,`src/contracts/` 保存宿主跨端契约,`web/src/ui/` 保留共享 UI。详见[目录与插件管理说明](docs/architecture.md)。npm 软件包仅包含打包并压缩后的 JavaScript 扩展、构建后的 Web 资源、封面图片,以及英文和中文 README;不会发布 TypeScript 源码或 source map。代码压缩会增加阅读发布版本代码的难度,但不会对 JavaScript 加密。
130
+ ## 使用指南与开发
103
131
 
104
- ## 错误采集
132
+ - **新用户:** [首次对话](docs/zh/getting-started.md) · [会话管理](docs/zh/sessions.md) · [工作区工具](docs/zh/workspace-tools.md)
133
+ - **配置与排错:** [模型、软件包与技能](docs/zh/configuration.md) · [版本更新](docs/zh/updates.md) · [常见问题](docs/zh/troubleshooting.md)
134
+ - **参与开发:** [架构说明](docs/architecture.md) · [Web 插件](docs/web-plugins.md) · [桌面构建](docs/desktop.md)
105
135
 
106
- 前后端 Sentry 错误采集默认开启,使用内置公共 DSN,无需额外配置。在启动 Pi 的环境中设置 `PI_WEB_SENTRY_DSN` 可覆盖默认项目,使用 `PI_WEB_SENTRY_ENABLED=false` 关闭。默认只采集脱敏堆栈、操作轨迹和状态摘要,不采集对话、源码正文、附件内容或凭据,不启用界面录制。默认上报地址、独立前后端 DSN 和私有 sourcemap 上传步骤见 [Sentry 配置说明](docs/sentry.md)。
136
+ 指南随源码演进,可能与你安装的版本不同;桌面端支持范围以上方已核实的下载链接及对应版本发布说明为准。
107
137
 
108
- ## 发布
138
+ ### 本地开发
109
139
 
110
- CI 会先从 npm 解析 `@chengzhiyi/pi-web-protocol` 的已发布版本,再运行 `npm ci`。
111
- 首次发布协议前,校验任务会将固定提交的 `pi-extensions` 检出到被忽略的 `.ci/`
112
- 目录,构建协议并使用本地包,完整执行检查、测试与构建;Actions 摘要会说明
113
- 宿主发布仍在等待协议初始化。正式发布始终要求准确的 npm 依赖,并将清单和
114
- 锁文件变化同步回仓库。协议发布后可以在 Actions 手动运行工作流;协议发布
115
- 不会主动触发这个仓库。
140
+ ```bash
141
+ npm ci
142
+ npm run check
143
+ npm test
144
+ npm run build
145
+ npm run start
146
+ ```
116
147
 
117
- `npm publish` 会运行检查、测试和生产构建。`pi-package` 关键词使发布到 npm 的软件包有资格进入 [Pi 软件包目录](https://pi.dev/packages);目录更新可能晚于 npm。
148
+ `npm run start` 会构建并启动后台服务。修改扩展代码后,运行 `npm run stop` 再运行 `npm run start`;仅刷新网页不会替换桥接代码。使用 `pi -e .` 开发时,重新构建后在 Pi 中输入 `/reload`,再输入 `/web`。
118
149
 
119
- GitHub Actions 会在针对 `main` 的拉取请求中运行 `check`、`test` 和 `build`。代码推送到 `main` 后会再次运行这些检查,根据源码版本和 npm `latest` 版本确定下一个补丁版本,先将更新后的 `package.json` 和 `package-lock.json` 提交回 `main`,再发布到 npm。版本同步提交使用工作流的 `GITHUB_TOKEN`,不会再次触发工作流。如需开始新的次版本或主版本,请在拉取请求中同步提高两个包文件的版本。每次发布也会将包内 `pi.image` 的地址更新为该版本。仓库必须允许工作流推送到 `main`,发布才能继续。
150
+ 桌面开发:`npm run desktop:prepare` → `npm run desktop:start`;`npm run desktop:package` 在 `desktop-release/` 生成当前系统的安装包。可信本地插件联调可参考[插件说明](docs/web-plugins.md)中的 `PI_WEBAPP_PLUGIN_DEV_ROOTS`。
120
151
 
121
- 首次自动发布前,请在 npm 的 `pi-webapp` 包设置中配置 Trusted Publishing:GitHub 所有者为 `chengzhiyi`,仓库为 `pi-webapp`,工作流文件名为 `ci.yml`,不设置环境,并允许直接执行 `npm publish`。工作流通过 GitHub OIDC 认证,无需 npm token。`package.json` 中的仓库地址应与 GitHub 仓库保持一致。
152
+ ---
122
153
 
123
- ## 许可证
154
+ **让下一次 Pi 任务,从一个可视化工作台开始:** 运行 `npx pi-webapp`,或[体验桌面测试版](#桌面端下载)。如果它让你的工作更顺手,欢迎 [Star 项目](https://github.com/chengzhiyi/pi-webapp)帮助更多人发现,也欢迎[提交反馈与可复现的问题](https://github.com/chengzhiyi/pi-webapp/issues),一起完善工作流。
124
155
 
125
- MIT。详见 `LICENSE` 文件。
156
+ 基于 MIT 许可证开源。详见 [LICENSE](LICENSE)。
@@ -0,0 +1,30 @@
1
+ # README visual assets
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.
4
+
5
+ | Asset | Contents |
6
+ | --- | --- |
7
+ | `workbench.png` | Full workbench: project navigation, conversation, and read-only TypeScript preview. |
8
+ | `git-review.png` | Git tool panel: staged regression tests and the actual `>` → `>=` working-tree diff. |
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. |
11
+
12
+ ## Regenerate screenshots
13
+
14
+ From a source checkout with Node.js 22.19+ and dependencies installed:
15
+
16
+ ```bash
17
+ npm run build
18
+ npx playwright install chromium # Only if the browser is not installed yet
19
+ node --experimental-strip-types scripts/capture-readme.ts
20
+ ```
21
+
22
+ The capture script starts a loopback bridge only for the bounded capture run and closes it afterward. It creates a temporary Git repository and shell, seeds example messages without calling a model, checks code and diff rendering, runs the demo tests in a real PTY, and checks for browser errors before cleanup. The Git repository, plugin settings, and shell profile are temporary; your normal Pi service and settings are not changed. The helper currently uses a POSIX shell and Git; run it on macOS/Linux.
23
+
24
+ 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
+
26
+ ## Maintain the diagrams
27
+
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.
29
+
30
+ 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.