@chainingintention/pi-web-cn 1.202606.3 → 1.202606.5

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.
Files changed (59) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +364 -364
  3. package/dist/cli.js +32 -32
  4. package/dist/client/assets/{CodeViewer-B4nxYc0g.js → CodeViewer-DRxmEzh1.js} +1 -1
  5. package/dist/client/assets/{TerminalPanel-htr2dU1I.js → TerminalPanel-BcGKwlLZ.js} +1 -1
  6. package/dist/client/assets/{index-BjUH4a8R.js → index-BZE2v69K.js} +149 -141
  7. package/dist/client/favicon.svg +11 -11
  8. package/dist/client/index.html +17 -17
  9. package/dist/client/manifest.webmanifest +24 -24
  10. package/dist/config.js +72 -0
  11. package/dist/config.js.map +1 -1
  12. package/dist/pi-web-plugins/info/package.json +9 -9
  13. package/dist/pi-web-plugins/info/pi-web-plugin.js +14 -14
  14. package/dist/pi-web-plugins/updates/package.json +9 -9
  15. package/dist/pi-web-plugins/updates/pi-web-plugin.js +75 -75
  16. package/dist/pi-web-plugins/workspace-tasks/config.js +1 -1
  17. package/dist/pi-web-plugins/workspace-tasks/package.json +9 -9
  18. package/dist/pi-web-plugins/workspace-tasks/pi-web-plugin.js +10 -10
  19. package/dist/pi-web-plugins/workspace-tasks/taskRunner.js +1 -1
  20. package/dist/pi-web-plugins/workspace-tasks/tasksPanelElement.js +58 -58
  21. package/dist/pi-web-plugins/workspace-tasks/workspaceTasksClient.js +1 -1
  22. package/dist/server/app.js +48 -17
  23. package/dist/server/app.js.map +1 -1
  24. package/dist/server/configRoutes.js +77 -0
  25. package/dist/server/configRoutes.js.map +1 -1
  26. package/dist/server/gitRoutes.js +16 -3
  27. package/dist/server/gitRoutes.js.map +1 -1
  28. package/dist/server/managementEmbed.js +205 -0
  29. package/dist/server/managementEmbed.js.map +1 -0
  30. package/dist/server/sessiond/sessionProxyRoutes.js +66 -8
  31. package/dist/server/sessiond/sessionProxyRoutes.js.map +1 -1
  32. package/dist/server/sessions/managementPermissionSystem.js +94 -0
  33. package/dist/server/sessions/managementPermissionSystem.js.map +1 -0
  34. package/dist/server/sessions/managementSandbox.js +156 -0
  35. package/dist/server/sessions/managementSandbox.js.map +1 -0
  36. package/dist/server/sessions/piSessionService.js +320 -26
  37. package/dist/server/sessions/piSessionService.js.map +1 -1
  38. package/dist/server/sessions/sessionRoutes.js +9 -4
  39. package/dist/server/sessions/sessionRoutes.js.map +1 -1
  40. package/dist/server/terminalProxyRoutes.js +54 -8
  41. package/dist/server/terminalProxyRoutes.js.map +1 -1
  42. package/dist/server/terminals/terminalRoutes.js +12 -3
  43. package/dist/server/terminals/terminalRoutes.js.map +1 -1
  44. package/dist/server/terminals/terminalService.js +48 -4
  45. package/dist/server/terminals/terminalService.js.map +1 -1
  46. package/dist/server/workspaceExplorerRoutes.js +17 -4
  47. package/dist/server/workspaceExplorerRoutes.js.map +1 -1
  48. package/dist/server/workspaces/pathSafety.js +9 -2
  49. package/dist/server/workspaces/pathSafety.js.map +1 -1
  50. package/dist/sessiond/sessionDaemonClient.js +12 -12
  51. package/dist/sessiond/sessionDaemonClient.js.map +1 -1
  52. package/dist/shared/apiTypes.d.ts +18 -0
  53. package/docs/assets/favicon.svg +11 -11
  54. package/docs/plugins.md +762 -762
  55. package/extensions/pi-web.ts +133 -133
  56. package/install.sh +5 -5
  57. package/package.json +127 -127
  58. package/plugin-api/unstable.d.ts +1 -1
  59. package/plugin-api.d.ts +1 -1
package/README.md CHANGED
@@ -1,364 +1,364 @@
1
- # PI WEB
2
-
3
- This fork is a translation plan for PI WEB. Its goal is to translate the plugin's displayed content into Chinese while preserving the upstream functionality.
4
-
5
- [![CI](https://github.com/jmfederico/pi-web/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/jmfederico/pi-web/actions/workflows/ci.yml)
6
- [![npm version](https://img.shields.io/npm/v/%40chainingintention%2Fpi-web-cn)](https://www.npmjs.com/package/@chainingintention/pi-web-cn)
7
- [![Node.js](https://img.shields.io/node/v/%40chainingintention%2Fpi-web-cn)](package.json)
8
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
- [![Pi Coding Agent](https://img.shields.io/badge/Pi-Coding%20Agent-6f42c1)](https://github.com/earendil-works/pi/tree/main/packages/coding-agent)
10
-
11
- Website: <https://pi-web.dev/>
12
-
13
- ![PI WEB](docs/assets/pi-web-banner.png)
14
-
15
- **Run AI coding agents on your own machine or server, keep them alive in real workspaces, and control everything from a browser.**
16
-
17
- PI WEB is a web control plane for [Pi Coding Agent](https://github.com/earendil-works/pi/tree/main/packages/coding-agent). Add your repositories once, open project workspaces and git worktrees, start agent sessions inside them, and come back later without losing the work. Your browser becomes the cockpit; your server becomes the persistent development environment. Start on your laptop, check in from your phone, and continue from an iPad or another machine whenever that is the device you have at hand.
18
-
19
- ![PI WEB demo](docs/assets/pi-web-demo.gif)
20
-
21
- With PI WEB you can:
22
-
23
- - launch and supervise multiple coding-agent sessions in parallel;
24
- - keep sessions running when your browser disconnects or the UI restarts;
25
- - organize agent work by project, workspace, branch, experiment, or review;
26
- - use git worktrees to isolate concurrent features and fixes;
27
- - chat with Pi Coding Agent through a realtime web UI;
28
- - move fluidly between laptop, phone, tablet, and desktop without moving the development environment;
29
- - turn any server, desktop, or remote dev box into an agent-first development hub.
30
-
31
- ## Why use PI WEB?
32
-
33
- Agentic development works best when agents are not trapped inside a single local terminal. They need stable environments, access to real repositories, and room to work across branches and tasks. Humans need the opposite: a clear place to supervise, redirect, review, and decide.
34
-
35
- PI WEB connects those two worlds. The work stays in the server-side environment while you move between devices: laptop for deep focus, phone for a quick check-in, tablet for review, desktop when you are back at a desk. It is not trying to recreate the old desktop IDE in a browser; it is a control surface for persistent, parallel, human-in-the-loop agent work.
36
-
37
- ## Core model
38
-
39
- PI WEB organizes work into four levels:
40
-
41
- ```text
42
- Machine a local or remote PI WEB runtime endpoint
43
- Project a folder on that machine
44
- Workspace a git worktree, or the project folder for non-git projects
45
- Session a chat with Pi Coding Agent running inside a workspace
46
- ```
47
-
48
- This maps naturally to real development work:
49
-
50
- - select the local machine or another registered PI WEB runtime;
51
- - add a project once on the selected machine;
52
- - use worktrees to separate branches, features, experiments, and reviews;
53
- - start one or more agent sessions inside each workspace;
54
- - leave sessions running even when the browser disconnects or the UI restarts.
55
-
56
- ## Features
57
-
58
- - Add and list local or remote PI WEB machines from the action palette.
59
- - Proxy remote projects, workspaces, files, git state, sessions, and terminals through the currently opened PI WEB server.
60
- - Add and list server-side projects.
61
- - Discover git worktrees automatically with `git worktree list --porcelain`.
62
- - Support non-git folders as single-workspace projects.
63
- - Start, resume, archive, and restore Pi sessions per workspace.
64
- - Chat with Pi Coding Agent through realtime WebSocket events.
65
- - Keep active agent runtimes alive across browser disconnects and web/API restarts.
66
- - Explicitly stop or abort active session work.
67
- - View live session status: streaming, compaction, bash activity, token usage, cost, model, and context usage.
68
- - Send prompts, shell input, and supported commands through the Pi SDK path.
69
- - Reuse your existing Pi auth and model configuration from `~/.pi/agent`.
70
- - Extend the UI with trusted plugins that add actions, workspace panels, and workspace-label metadata. See [Plugin API](docs/plugins.md) for LLM-friendly plugin-building docs.
71
-
72
- ## Architecture
73
-
74
- PI WEB uses a split-process architecture so agent runtimes are not owned by the browser-facing dev server.
75
-
76
- ```text
77
- Browser UI
78
-
79
-
80
- Fastify Web/API process
81
- │ HTTP + WebSocket proxy
82
-
83
- Session daemon
84
-
85
-
86
- Pi Coding Agent SDK
87
- ```
88
-
89
- ### Session daemon
90
-
91
- The session daemon owns active Pi session runtimes. It is intended to be long-lived so sessions can survive browser disconnects and web/API restarts.
92
-
93
- ### Web/API/UI server
94
-
95
- The web process serves the API and browser UI. In development it can autoreload freely while active sessions continue running in the daemon.
96
-
97
- ## State model
98
-
99
- PI WEB keeps its own state intentionally small:
100
-
101
- - Machines: `~/.pi-web/machines.json` stores only opt-in remote machine records; the local machine is synthesized.
102
- - Projects: `~/.pi-web/projects.json`
103
- - Workspaces: discovered from git worktrees, not stored
104
- - Sessions and chat history: Pi's default JSONL session storage on the selected machine
105
- - Active session runtimes and WebSockets: memory in each selected machine's session daemon
106
-
107
- ## Machine federation
108
-
109
- The Machines section lets one PI WEB instance act as a gateway to other PI WEB runtimes. Register a remote machine from **Actions → Add Machine** with the remote PI WEB base URL, for example a Tailscale, WireGuard, SSH tunnel, or trusted reverse-proxy URL. The browser continues talking to the local PI WEB origin; project, workspace, file, git, session, activity, and terminal HTTP/WebSocket traffic is proxied server-to-server.
110
-
111
- Remote model-provider credentials and OAuth state stay on the target machine. API-key provider configuration can be proxied, but OAuth login should be completed by opening the remote PI WEB directly. Register remote machines only when you trust the endpoint and the network path: adding a machine gives this PI WEB server permission to contact that URL with the optional bearer token you configured.
112
-
113
- ## Plugins
114
-
115
- PI WEB production installs can load trusted local UI plugins without rebuilding PI WEB. Plugins are browser-side ES modules that can add action-palette actions, workspace panels, and workspace-label metadata, using documented context helpers for workspace files and terminals. They do not run in the session daemon and are not sandboxed.
116
-
117
- The supported package shape is intentionally singular: `piWeb.plugins` entries with explicit `id` and `module`, plus a browser module that exports `{ apiVersion: 1, name, activate }`. The bundled `pi-web-plugins/info` TypeScript source is the canonical minimal real example, `pi-web-plugins/updates` demonstrates a dynamic status panel, and built-in [Workspace Tasks](docs/plugins.md#workspace-tasks) adds a workspace tab for running configured shell commands in PI WEB terminals.
118
-
119
- A useful prompt for AI agents:
120
-
121
- ```text
122
- Build a PI WEB plugin for this project. Goal: <describe the UI behavior>.
123
- Before coding, read https://pi-web.dev/plugins.html and https://pi-web.dev/plugins.md.
124
- Create it under ~/.pi-web/plugins/<plugin-id> using the documented PI WEB v1 plugin API.
125
- Validate with /pi-web-plugins/manifest.json and explain reload/debug steps.
126
- Do not modify PI WEB itself.
127
- ```
128
-
129
- Manage discovered plugins in **Settings → Plugins** or with the top-level `plugins` config key. Plugins are enabled by default; set `plugins.<plugin-id>.enabled` to `false` and reload the browser tab to prevent PI WEB from importing that plugin.
130
-
131
- Reload the browser tab after adding or editing a plugin. If `PI_WEB_DATA_DIR` is set, use `$PI_WEB_DATA_DIR/plugins` instead of `~/.pi-web/plugins`. Check discovery with:
132
-
133
- ```bash
134
- curl http://127.0.0.1:8504/pi-web-plugins/manifest.json
135
- ```
136
-
137
- See the full [Plugin API](docs/plugins.md) for contribution types, package metadata, and troubleshooting.
138
-
139
- ## Install
140
-
141
- Recommended install uses npm plus native per-user services.
142
-
143
- ```bash
144
- npm install -g @chainingintention/pi-web-cn
145
- pi-web install
146
- ```
147
-
148
- On Linux servers, `loginctl enable-linger` is optional but recommended so the user systemd manager starts at boot and continues running after logout:
149
-
150
- ```bash
151
- sudo loginctl enable-linger "$USER"
152
- loginctl show-user "$USER" -p Linger
153
- ```
154
-
155
- This writes and starts PI WEB's session daemon and web/API user services. The native user-service backend is selected automatically.
156
-
157
- The generated services run through your detected login shell (`bash`, `zsh`, or `fish` with `-lc`) so they see a shell environment similar to running `pi` from your terminal.
158
-
159
- Open <http://127.0.0.1:8504>.
160
-
161
- Useful commands:
162
-
163
- ```bash
164
- pi-web status
165
- pi-web logs
166
- pi-web restart
167
- pi-web doctor
168
- pi-web version
169
- pi-web uninstall
170
- ```
171
-
172
- Use `pi-web version` to compare the installed package version with the versions reported by the running Web/UI and session daemon services.
173
-
174
- One-line install is also available for users who prefer it:
175
-
176
- ```bash
177
- curl -fsSL https://raw.githubusercontent.com/jmfederico/pi-web/main/install.sh | sh
178
- ```
179
-
180
- PI WEB is also published as a Pi package. Installing it through Pi exposes a `/pi-web` command inside Pi:
181
-
182
- ```bash
183
- pi install npm:@chainingintention/pi-web-cn
184
- ```
185
-
186
- Then in Pi:
187
-
188
- ```text
189
- /pi-web install
190
- /pi-web status
191
- /pi-web logs
192
- /pi-web restart
193
- /pi-web doctor
194
- /pi-web version
195
- ```
196
-
197
- The Pi command is a convenience wrapper around the same service installer. When installed this way, the service installer can use PI WEB's package-local server entrypoints, so `pi-web-server` and `pi-web-sessiond` do not need to be on your shell `PATH`. `/pi-web logs` shows the last 100 service log lines; use `pi-web logs` in a shell when you want to follow logs continuously.
198
-
199
- Advanced users may run the binaries however they prefer:
200
-
201
- ```bash
202
- pi-web-sessiond
203
- PI_WEB_PORT=8504 pi-web-server
204
- ```
205
-
206
- ## Development quick start
207
-
208
- ```bash
209
- npm install
210
- npm run dev
211
- ```
212
-
213
- Open the Vite URL, usually <http://localhost:8505>.
214
-
215
- During development, the static marketing/docs site is also served by the Vite dev server at <http://localhost:8505/site/>.
216
-
217
- For the recommended split development setup, run these in separate terminals:
218
-
219
- ```bash
220
- npm run dev:sessiond
221
- npm run dev:web
222
- npm run dev:client
223
- ```
224
-
225
- Or install the split development setup as native per-user services from the checkout:
226
-
227
- ```bash
228
- pi-web install --dev
229
- ```
230
-
231
- `pi-web install --dev` writes the session daemon plus a UI development service using the native user-service backend. `pi-web uninstall` removes both production and development service files; no uninstall flags are needed.
232
-
233
- `dev:web` also watches bundled plugin TypeScript and rebuilds the browser-loaded plugin JavaScript under `dist/pi-web-plugins/`. You can restart `dev:web` or `dev:client` without stopping active Pi sessions.
234
-
235
- ## Production-style run from a checkout
236
-
237
- ```bash
238
- npm run build
239
- npm run start:sessiond
240
- PI_WEB_PORT=8504 npm start
241
- ```
242
-
243
- ## Packaging and publishing
244
-
245
- ```bash
246
- npm run verify
247
- npm run pack:dry
248
- npm publish --access public
249
- ```
250
-
251
- `prepack` builds `dist/` and bundled plugin JavaScript before npm creates the tarball, and `prepublishOnly` runs verification before publishing. Releases can also be published by the GitHub Actions npm workflow when a GitHub release is published.
252
-
253
- PI WEB uses a single-line CalVer-inspired npm version: `MAJOR.YYYYMM.SEQUENCE`, for example `1.202605.1`. The major number signals breaking-change eras; the middle number is the release month; the final number increments for additional releases in that month. Older major eras may be deprecated rather than maintained in parallel.
254
-
255
- PI WEB declares `@earendil-works/pi-coding-agent` as a peer dependency (`>=0.74.0 <1`) and a development dependency for local builds. This keeps published installs flexible: npm 7+ installs the peer automatically, and users can upgrade the Pi package within the compatible range without PI WEB pinning a separate copy.
256
-
257
-
258
- The web server defaults to `127.0.0.1:8504`. Set `PI_WEB_HOST=0.0.0.0` only when you intentionally want to bind directly on all interfaces.
259
-
260
- The session daemon defaults to a private Unix socket at:
261
-
262
- ```text
263
- ~/.pi-web/sessiond.sock
264
- ```
265
-
266
- Environment variables:
267
-
268
- - `PI_WEB_PORT` / `PORT` — web server port. Defaults to `8504`.
269
- - `PI_WEB_HOST` — web server bind host. Defaults to `127.0.0.1`.
270
- - `PI_WEB_DATA_DIR` — PI WEB data directory. Defaults to `~/.pi-web`.
271
- - `PI_WEB_SESSIOND_SOCKET` — Unix socket path used by both the daemon and web process when `PI_WEB_SESSIOND_URL` is not set. Defaults to `$PI_WEB_DATA_DIR/sessiond.sock`.
272
- - `PI_WEB_SESSIOND_PORT` — optional TCP port for the daemon. If unset, the daemon listens on the Unix socket instead.
273
- - `PI_WEB_SESSIOND_HOST` — daemon TCP bind host when `PI_WEB_SESSIOND_PORT` is set. Defaults to `127.0.0.1`.
274
- - `PI_WEB_SESSIOND_URL` — daemon URL used by the web process when connecting over TCP, for example `http://127.0.0.1:3001`. If you set `PI_WEB_SESSIOND_PORT`, set this for the web process too.
275
- - `PI_WEB_PROJECTS_FILE` — optional override for the projects storage JSON file. Defaults to `$PI_WEB_DATA_DIR/projects.json`.
276
- - `PI_WEB_MACHINES_FILE` — optional override for the remote machine registry JSON file. Defaults to `$PI_WEB_DATA_DIR/machines.json`.
277
-
278
- ## Development services
279
-
280
- `pi-web install --dev` creates a practical local setup with two native per-user services:
281
-
282
- - `pi-web-sessiond` runs `npm run start:sessiond` from the checkout without autoreload.
283
- - `pi-web-ui-dev` runs `npm run dev:web` and `npm run dev:client` for API reloads, bundled plugin rebuilds, and Vite HMR.
284
-
285
- Under the hood, the native backends are systemd user services and LaunchAgents. For reference, an equivalent systemd setup looks like:
286
-
287
- ```ini
288
- # ~/.config/systemd/user/pi-web-sessiond.service
289
- [Unit]
290
- Description=PI WEB session daemon
291
-
292
- [Service]
293
- Type=simple
294
- WorkingDirectory=/srv/dev/pi-web
295
- ExecStart=/bin/bash -lc 'exec npm run start:sessiond'
296
- Restart=no
297
-
298
- [Install]
299
- WantedBy=default.target
300
- ```
301
-
302
- ```ini
303
- # ~/.config/systemd/user/pi-web-ui-dev.service
304
- [Unit]
305
- Description=PI WEB UI dev server
306
- After=pi-web-sessiond.service
307
- Wants=pi-web-sessiond.service
308
-
309
- [Service]
310
- Type=simple
311
- WorkingDirectory=/srv/dev/pi-web
312
- ExecStart=/bin/bash -lc 'trap "kill 0" EXIT; npm run dev:web & npm run dev:client & wait'
313
- Restart=no
314
-
315
- [Install]
316
- WantedBy=default.target
317
- ```
318
-
319
- On Linux servers, enable persistent user services so the user systemd manager starts at boot and remains running after logout:
320
-
321
- ```bash
322
- sudo loginctl enable-linger "$USER"
323
- loginctl show-user "$USER" -p Linger
324
- ```
325
-
326
- Install or refresh the development services with:
327
-
328
- ```bash
329
- pi-web install --dev
330
- ```
331
-
332
- Useful logs:
333
-
334
- ```bash
335
- pi-web logs
336
- ```
337
-
338
- If code affecting the session daemon changes, restart it manually:
339
-
340
- ```bash
341
- pi-web restart
342
- ```
343
-
344
- ## Current limitations
345
-
346
- - Assumes trusted users and trusted server paths.
347
- - Not a sandbox, permission model, or secure multi-tenant platform.
348
- - Some Pi TUI slash-command behavior is not yet represented exactly in the web UI.
349
- - Workspaces are discovered from existing git worktrees; UI-driven worktree management is a natural next step.
350
-
351
- ## Vision
352
-
353
- PI WEB is the beginning of an agent-first development environment:
354
-
355
- - agents run persistently on servers;
356
- - humans connect through the browser;
357
- - work is organized by projects, workspaces, and sessions;
358
- - the UI grows around the needs of agentic development rather than the habits of local IDEs.
359
-
360
- The goal is simple: make it practical to run more development remotely, in parallel, with agents as first-class participants and humans focused on direction, judgment, and review.
361
-
362
- ## License
363
-
364
- MIT © 2026 Federico Jaramillo Martinez. See [LICENSE](LICENSE).
1
+ # PI WEB
2
+
3
+ This fork is a translation plan for PI WEB. Its goal is to translate the plugin's displayed content into Chinese while preserving the upstream functionality.
4
+
5
+ [![CI](https://github.com/jmfederico/pi-web/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/jmfederico/pi-web/actions/workflows/ci.yml)
6
+ [![npm version](https://img.shields.io/npm/v/%40chainingintention%2Fpi-web-cn)](https://www.npmjs.com/package/@chainingintention/pi-web-cn)
7
+ [![Node.js](https://img.shields.io/node/v/%40chainingintention%2Fpi-web-cn)](package.json)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+ [![Pi Coding Agent](https://img.shields.io/badge/Pi-Coding%20Agent-6f42c1)](https://github.com/earendil-works/pi/tree/main/packages/coding-agent)
10
+
11
+ Website: <https://pi-web.dev/>
12
+
13
+ ![PI WEB](docs/assets/pi-web-banner.png)
14
+
15
+ **Run AI coding agents on your own machine or server, keep them alive in real workspaces, and control everything from a browser.**
16
+
17
+ PI WEB is a web control plane for [Pi Coding Agent](https://github.com/earendil-works/pi/tree/main/packages/coding-agent). Add your repositories once, open project workspaces and git worktrees, start agent sessions inside them, and come back later without losing the work. Your browser becomes the cockpit; your server becomes the persistent development environment. Start on your laptop, check in from your phone, and continue from an iPad or another machine whenever that is the device you have at hand.
18
+
19
+ ![PI WEB demo](docs/assets/pi-web-demo.gif)
20
+
21
+ With PI WEB you can:
22
+
23
+ - launch and supervise multiple coding-agent sessions in parallel;
24
+ - keep sessions running when your browser disconnects or the UI restarts;
25
+ - organize agent work by project, workspace, branch, experiment, or review;
26
+ - use git worktrees to isolate concurrent features and fixes;
27
+ - chat with Pi Coding Agent through a realtime web UI;
28
+ - move fluidly between laptop, phone, tablet, and desktop without moving the development environment;
29
+ - turn any server, desktop, or remote dev box into an agent-first development hub.
30
+
31
+ ## Why use PI WEB?
32
+
33
+ Agentic development works best when agents are not trapped inside a single local terminal. They need stable environments, access to real repositories, and room to work across branches and tasks. Humans need the opposite: a clear place to supervise, redirect, review, and decide.
34
+
35
+ PI WEB connects those two worlds. The work stays in the server-side environment while you move between devices: laptop for deep focus, phone for a quick check-in, tablet for review, desktop when you are back at a desk. It is not trying to recreate the old desktop IDE in a browser; it is a control surface for persistent, parallel, human-in-the-loop agent work.
36
+
37
+ ## Core model
38
+
39
+ PI WEB organizes work into four levels:
40
+
41
+ ```text
42
+ Machine a local or remote PI WEB runtime endpoint
43
+ Project a folder on that machine
44
+ Workspace a git worktree, or the project folder for non-git projects
45
+ Session a chat with Pi Coding Agent running inside a workspace
46
+ ```
47
+
48
+ This maps naturally to real development work:
49
+
50
+ - select the local machine or another registered PI WEB runtime;
51
+ - add a project once on the selected machine;
52
+ - use worktrees to separate branches, features, experiments, and reviews;
53
+ - start one or more agent sessions inside each workspace;
54
+ - leave sessions running even when the browser disconnects or the UI restarts.
55
+
56
+ ## Features
57
+
58
+ - Add and list local or remote PI WEB machines from the action palette.
59
+ - Proxy remote projects, workspaces, files, git state, sessions, and terminals through the currently opened PI WEB server.
60
+ - Add and list server-side projects.
61
+ - Discover git worktrees automatically with `git worktree list --porcelain`.
62
+ - Support non-git folders as single-workspace projects.
63
+ - Start, resume, archive, and restore Pi sessions per workspace.
64
+ - Chat with Pi Coding Agent through realtime WebSocket events.
65
+ - Keep active agent runtimes alive across browser disconnects and web/API restarts.
66
+ - Explicitly stop or abort active session work.
67
+ - View live session status: streaming, compaction, bash activity, token usage, cost, model, and context usage.
68
+ - Send prompts, shell input, and supported commands through the Pi SDK path.
69
+ - Reuse your existing Pi auth and model configuration from `~/.pi/agent`.
70
+ - Extend the UI with trusted plugins that add actions, workspace panels, and workspace-label metadata. See [Plugin API](docs/plugins.md) for LLM-friendly plugin-building docs.
71
+
72
+ ## Architecture
73
+
74
+ PI WEB uses a split-process architecture so agent runtimes are not owned by the browser-facing dev server.
75
+
76
+ ```text
77
+ Browser UI
78
+
79
+
80
+ Fastify Web/API process
81
+ │ HTTP + WebSocket proxy
82
+
83
+ Session daemon
84
+
85
+
86
+ Pi Coding Agent SDK
87
+ ```
88
+
89
+ ### Session daemon
90
+
91
+ The session daemon owns active Pi session runtimes. It is intended to be long-lived so sessions can survive browser disconnects and web/API restarts.
92
+
93
+ ### Web/API/UI server
94
+
95
+ The web process serves the API and browser UI. In development it can autoreload freely while active sessions continue running in the daemon.
96
+
97
+ ## State model
98
+
99
+ PI WEB keeps its own state intentionally small:
100
+
101
+ - Machines: `~/.pi-web/machines.json` stores only opt-in remote machine records; the local machine is synthesized.
102
+ - Projects: `~/.pi-web/projects.json`
103
+ - Workspaces: discovered from git worktrees, not stored
104
+ - Sessions and chat history: Pi's default JSONL session storage on the selected machine
105
+ - Active session runtimes and WebSockets: memory in each selected machine's session daemon
106
+
107
+ ## Machine federation
108
+
109
+ The Machines section lets one PI WEB instance act as a gateway to other PI WEB runtimes. Register a remote machine from **Actions → Add Machine** with the remote PI WEB base URL, for example a Tailscale, WireGuard, SSH tunnel, or trusted reverse-proxy URL. The browser continues talking to the local PI WEB origin; project, workspace, file, git, session, activity, and terminal HTTP/WebSocket traffic is proxied server-to-server.
110
+
111
+ Remote model-provider credentials and OAuth state stay on the target machine. API-key provider configuration can be proxied, but OAuth login should be completed by opening the remote PI WEB directly. Register remote machines only when you trust the endpoint and the network path: adding a machine gives this PI WEB server permission to contact that URL with the optional bearer token you configured.
112
+
113
+ ## Plugins
114
+
115
+ PI WEB production installs can load trusted local UI plugins without rebuilding PI WEB. Plugins are browser-side ES modules that can add action-palette actions, workspace panels, and workspace-label metadata, using documented context helpers for workspace files and terminals. They do not run in the session daemon and are not sandboxed.
116
+
117
+ The supported package shape is intentionally singular: `piWeb.plugins` entries with explicit `id` and `module`, plus a browser module that exports `{ apiVersion: 1, name, activate }`. The bundled `pi-web-plugins/info` TypeScript source is the canonical minimal real example, `pi-web-plugins/updates` demonstrates a dynamic status panel, and built-in [Workspace Tasks](docs/plugins.md#workspace-tasks) adds a workspace tab for running configured shell commands in PI WEB terminals.
118
+
119
+ A useful prompt for AI agents:
120
+
121
+ ```text
122
+ Build a PI WEB plugin for this project. Goal: <describe the UI behavior>.
123
+ Before coding, read https://pi-web.dev/plugins.html and https://pi-web.dev/plugins.md.
124
+ Create it under ~/.pi-web/plugins/<plugin-id> using the documented PI WEB v1 plugin API.
125
+ Validate with /pi-web-plugins/manifest.json and explain reload/debug steps.
126
+ Do not modify PI WEB itself.
127
+ ```
128
+
129
+ Manage discovered plugins in **Settings → Plugins** or with the top-level `plugins` config key. Plugins are enabled by default; set `plugins.<plugin-id>.enabled` to `false` and reload the browser tab to prevent PI WEB from importing that plugin.
130
+
131
+ Reload the browser tab after adding or editing a plugin. If `PI_WEB_DATA_DIR` is set, use `$PI_WEB_DATA_DIR/plugins` instead of `~/.pi-web/plugins`. Check discovery with:
132
+
133
+ ```bash
134
+ curl http://127.0.0.1:8504/pi-web-plugins/manifest.json
135
+ ```
136
+
137
+ See the full [Plugin API](docs/plugins.md) for contribution types, package metadata, and troubleshooting.
138
+
139
+ ## Install
140
+
141
+ Recommended install uses npm plus native per-user services.
142
+
143
+ ```bash
144
+ npm install -g @chainingintention/pi-web-cn
145
+ pi-web install
146
+ ```
147
+
148
+ On Linux servers, `loginctl enable-linger` is optional but recommended so the user systemd manager starts at boot and continues running after logout:
149
+
150
+ ```bash
151
+ sudo loginctl enable-linger "$USER"
152
+ loginctl show-user "$USER" -p Linger
153
+ ```
154
+
155
+ This writes and starts PI WEB's session daemon and web/API user services. The native user-service backend is selected automatically.
156
+
157
+ The generated services run through your detected login shell (`bash`, `zsh`, or `fish` with `-lc`) so they see a shell environment similar to running `pi` from your terminal.
158
+
159
+ Open <http://127.0.0.1:8504>.
160
+
161
+ Useful commands:
162
+
163
+ ```bash
164
+ pi-web status
165
+ pi-web logs
166
+ pi-web restart
167
+ pi-web doctor
168
+ pi-web version
169
+ pi-web uninstall
170
+ ```
171
+
172
+ Use `pi-web version` to compare the installed package version with the versions reported by the running Web/UI and session daemon services.
173
+
174
+ One-line install is also available for users who prefer it:
175
+
176
+ ```bash
177
+ curl -fsSL https://raw.githubusercontent.com/jmfederico/pi-web/main/install.sh | sh
178
+ ```
179
+
180
+ PI WEB is also published as a Pi package. Installing it through Pi exposes a `/pi-web` command inside Pi:
181
+
182
+ ```bash
183
+ pi install npm:@chainingintention/pi-web-cn
184
+ ```
185
+
186
+ Then in Pi:
187
+
188
+ ```text
189
+ /pi-web install
190
+ /pi-web status
191
+ /pi-web logs
192
+ /pi-web restart
193
+ /pi-web doctor
194
+ /pi-web version
195
+ ```
196
+
197
+ The Pi command is a convenience wrapper around the same service installer. When installed this way, the service installer can use PI WEB's package-local server entrypoints, so `pi-web-server` and `pi-web-sessiond` do not need to be on your shell `PATH`. `/pi-web logs` shows the last 100 service log lines; use `pi-web logs` in a shell when you want to follow logs continuously.
198
+
199
+ Advanced users may run the binaries however they prefer:
200
+
201
+ ```bash
202
+ pi-web-sessiond
203
+ PI_WEB_PORT=8504 pi-web-server
204
+ ```
205
+
206
+ ## Development quick start
207
+
208
+ ```bash
209
+ npm install
210
+ npm run dev
211
+ ```
212
+
213
+ Open the Vite URL, usually <http://localhost:8505>.
214
+
215
+ During development, the static marketing/docs site is also served by the Vite dev server at <http://localhost:8505/site/>.
216
+
217
+ For the recommended split development setup, run these in separate terminals:
218
+
219
+ ```bash
220
+ npm run dev:sessiond
221
+ npm run dev:web
222
+ npm run dev:client
223
+ ```
224
+
225
+ Or install the split development setup as native per-user services from the checkout:
226
+
227
+ ```bash
228
+ pi-web install --dev
229
+ ```
230
+
231
+ `pi-web install --dev` writes the session daemon plus a UI development service using the native user-service backend. `pi-web uninstall` removes both production and development service files; no uninstall flags are needed.
232
+
233
+ `dev:web` also watches bundled plugin TypeScript and rebuilds the browser-loaded plugin JavaScript under `dist/pi-web-plugins/`. You can restart `dev:web` or `dev:client` without stopping active Pi sessions.
234
+
235
+ ## Production-style run from a checkout
236
+
237
+ ```bash
238
+ npm run build
239
+ npm run start:sessiond
240
+ PI_WEB_PORT=8504 npm start
241
+ ```
242
+
243
+ ## Packaging and publishing
244
+
245
+ ```bash
246
+ npm run verify
247
+ npm run pack:dry
248
+ npm publish --access public
249
+ ```
250
+
251
+ `prepack` builds `dist/` and bundled plugin JavaScript before npm creates the tarball, and `prepublishOnly` runs verification before publishing. Releases can also be published by the GitHub Actions npm workflow when a GitHub release is published.
252
+
253
+ PI WEB uses a single-line CalVer-inspired npm version: `MAJOR.YYYYMM.SEQUENCE`, for example `1.202605.1`. The major number signals breaking-change eras; the middle number is the release month; the final number increments for additional releases in that month. Older major eras may be deprecated rather than maintained in parallel.
254
+
255
+ PI WEB declares `@earendil-works/pi-coding-agent` as a peer dependency (`>=0.74.0 <1`) and a development dependency for local builds. This keeps published installs flexible: npm 7+ installs the peer automatically, and users can upgrade the Pi package within the compatible range without PI WEB pinning a separate copy.
256
+
257
+
258
+ The web server defaults to `127.0.0.1:8504`. Set `PI_WEB_HOST=0.0.0.0` only when you intentionally want to bind directly on all interfaces.
259
+
260
+ The session daemon defaults to a private Unix socket at:
261
+
262
+ ```text
263
+ ~/.pi-web/sessiond.sock
264
+ ```
265
+
266
+ Environment variables:
267
+
268
+ - `PI_WEB_PORT` / `PORT` — web server port. Defaults to `8504`.
269
+ - `PI_WEB_HOST` — web server bind host. Defaults to `127.0.0.1`.
270
+ - `PI_WEB_DATA_DIR` — PI WEB data directory. Defaults to `~/.pi-web`.
271
+ - `PI_WEB_SESSIOND_SOCKET` — Unix socket path used by both the daemon and web process when `PI_WEB_SESSIOND_URL` is not set. Defaults to `$PI_WEB_DATA_DIR/sessiond.sock`.
272
+ - `PI_WEB_SESSIOND_PORT` — optional TCP port for the daemon. If unset, the daemon listens on the Unix socket instead.
273
+ - `PI_WEB_SESSIOND_HOST` — daemon TCP bind host when `PI_WEB_SESSIOND_PORT` is set. Defaults to `127.0.0.1`.
274
+ - `PI_WEB_SESSIOND_URL` — daemon URL used by the web process when connecting over TCP, for example `http://127.0.0.1:3001`. If you set `PI_WEB_SESSIOND_PORT`, set this for the web process too.
275
+ - `PI_WEB_PROJECTS_FILE` — optional override for the projects storage JSON file. Defaults to `$PI_WEB_DATA_DIR/projects.json`.
276
+ - `PI_WEB_MACHINES_FILE` — optional override for the remote machine registry JSON file. Defaults to `$PI_WEB_DATA_DIR/machines.json`.
277
+
278
+ ## Development services
279
+
280
+ `pi-web install --dev` creates a practical local setup with two native per-user services:
281
+
282
+ - `pi-web-sessiond` runs `npm run start:sessiond` from the checkout without autoreload.
283
+ - `pi-web-ui-dev` runs `npm run dev:web` and `npm run dev:client` for API reloads, bundled plugin rebuilds, and Vite HMR.
284
+
285
+ Under the hood, the native backends are systemd user services and LaunchAgents. For reference, an equivalent systemd setup looks like:
286
+
287
+ ```ini
288
+ # ~/.config/systemd/user/pi-web-sessiond.service
289
+ [Unit]
290
+ Description=PI WEB session daemon
291
+
292
+ [Service]
293
+ Type=simple
294
+ WorkingDirectory=/srv/dev/pi-web
295
+ ExecStart=/bin/bash -lc 'exec npm run start:sessiond'
296
+ Restart=no
297
+
298
+ [Install]
299
+ WantedBy=default.target
300
+ ```
301
+
302
+ ```ini
303
+ # ~/.config/systemd/user/pi-web-ui-dev.service
304
+ [Unit]
305
+ Description=PI WEB UI dev server
306
+ After=pi-web-sessiond.service
307
+ Wants=pi-web-sessiond.service
308
+
309
+ [Service]
310
+ Type=simple
311
+ WorkingDirectory=/srv/dev/pi-web
312
+ ExecStart=/bin/bash -lc 'trap "kill 0" EXIT; npm run dev:web & npm run dev:client & wait'
313
+ Restart=no
314
+
315
+ [Install]
316
+ WantedBy=default.target
317
+ ```
318
+
319
+ On Linux servers, enable persistent user services so the user systemd manager starts at boot and remains running after logout:
320
+
321
+ ```bash
322
+ sudo loginctl enable-linger "$USER"
323
+ loginctl show-user "$USER" -p Linger
324
+ ```
325
+
326
+ Install or refresh the development services with:
327
+
328
+ ```bash
329
+ pi-web install --dev
330
+ ```
331
+
332
+ Useful logs:
333
+
334
+ ```bash
335
+ pi-web logs
336
+ ```
337
+
338
+ If code affecting the session daemon changes, restart it manually:
339
+
340
+ ```bash
341
+ pi-web restart
342
+ ```
343
+
344
+ ## Current limitations
345
+
346
+ - Assumes trusted users and trusted server paths.
347
+ - Not a sandbox, permission model, or secure multi-tenant platform.
348
+ - Some Pi TUI slash-command behavior is not yet represented exactly in the web UI.
349
+ - Workspaces are discovered from existing git worktrees; UI-driven worktree management is a natural next step.
350
+
351
+ ## Vision
352
+
353
+ PI WEB is the beginning of an agent-first development environment:
354
+
355
+ - agents run persistently on servers;
356
+ - humans connect through the browser;
357
+ - work is organized by projects, workspaces, and sessions;
358
+ - the UI grows around the needs of agentic development rather than the habits of local IDEs.
359
+
360
+ The goal is simple: make it practical to run more development remotely, in parallel, with agents as first-class participants and humans focused on direction, judgment, and review.
361
+
362
+ ## License
363
+
364
+ MIT © 2026 Federico Jaramillo Martinez. See [LICENSE](LICENSE).