@jmfederico/pi-web 1.202605.11 → 1.202605.13

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 (48) hide show
  1. package/README.md +47 -50
  2. package/dist/cli.js +514 -115
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/apple-touch-icon.png +0 -0
  5. package/dist/client/assets/{CodeViewer-0NuLmnBL.js → CodeViewer-ncgSvOQM.js} +1 -1
  6. package/dist/client/assets/TerminalPanel-DjuVNsp5.js +75 -0
  7. package/dist/client/assets/index-CDGTKzLD.js +1239 -0
  8. package/dist/client/favicon.svg +11 -0
  9. package/dist/client/index.html +6 -2
  10. package/dist/client/manifest.webmanifest +24 -0
  11. package/dist/client/pwa-icon-192.png +0 -0
  12. package/dist/client/pwa-icon-512.png +0 -0
  13. package/dist/config.js +4 -4
  14. package/dist/pi-web-plugins/pi-web/pi-web-plugin.js +13 -9
  15. package/dist/server/diagnostics/nodePtySpawnHelper.js +135 -0
  16. package/dist/server/diagnostics/nodePtySpawnHelper.js.map +1 -0
  17. package/dist/server/piWebPluginService.js +9 -9
  18. package/dist/server/piWebStatus.js +8 -8
  19. package/dist/server/piWebStatus.js.map +1 -1
  20. package/dist/server/sessions/piSessionService.js +169 -19
  21. package/dist/server/sessions/piSessionService.js.map +1 -1
  22. package/dist/server/sessions/sessionArchiveTree.js +35 -0
  23. package/dist/server/sessions/sessionArchiveTree.js.map +1 -0
  24. package/dist/server/sessions/sessionCommandService.js +88 -2
  25. package/dist/server/sessions/sessionCommandService.js.map +1 -1
  26. package/dist/server/sessions/sessionRoutes.js +8 -0
  27. package/dist/server/sessions/sessionRoutes.js.map +1 -1
  28. package/dist/server/terminalProxyRoutes.js +70 -0
  29. package/dist/server/terminalProxyRoutes.js.map +1 -1
  30. package/dist/server/terminals/terminalRoutes.js +65 -1
  31. package/dist/server/terminals/terminalRoutes.js.map +1 -1
  32. package/dist/server/terminals/terminalService.js +202 -37
  33. package/dist/server/terminals/terminalService.js.map +1 -1
  34. package/dist/server/workspaceExplorerRoutes.js +18 -0
  35. package/dist/server/workspaceExplorerRoutes.js.map +1 -1
  36. package/dist/server/workspaces/fileContentService.js +23 -3
  37. package/dist/server/workspaces/fileContentService.js.map +1 -1
  38. package/dist/server/workspaces/imagePreviewService.js +40 -0
  39. package/dist/server/workspaces/imagePreviewService.js.map +1 -0
  40. package/dist/shared/workspaceFiles.js +3 -0
  41. package/dist/shared/workspaceFiles.js.map +1 -0
  42. package/docs/assets/favicon.svg +11 -0
  43. package/docs/plugins.md +43 -42
  44. package/extensions/pi-web.ts +12 -5
  45. package/package.json +1 -1
  46. package/plugin-api.d.ts +2 -0
  47. package/dist/client/assets/TerminalPanel-BG6_9svt.js +0 -47
  48. package/dist/client/assets/index-DmVN7DQr.js +0 -1143
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Pi Web
1
+ # PI WEB
2
2
 
3
3
  [![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)
4
4
  [![npm version](https://img.shields.io/npm/v/@jmfederico/pi-web)](https://www.npmjs.com/package/@jmfederico/pi-web)
@@ -8,15 +8,15 @@
8
8
 
9
9
  Website: <https://pi-web.dev/>
10
10
 
11
- ![Pi Web](docs/assets/pi-web-banner.png)
11
+ ![PI WEB](docs/assets/pi-web-banner.png)
12
12
 
13
13
  **Run AI coding agents on your own machine or server, keep them alive in real workspaces, and control everything from a browser.**
14
14
 
15
- 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.
15
+ 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.
16
16
 
17
- ![Pi Web demo](docs/assets/pi-web-demo.gif)
17
+ ![PI WEB demo](docs/assets/pi-web-demo.gif)
18
18
 
19
- With Pi Web you can:
19
+ With PI WEB you can:
20
20
 
21
21
  - launch and supervise multiple coding-agent sessions in parallel;
22
22
  - keep sessions running when your browser disconnects or the UI restarts;
@@ -26,15 +26,15 @@ With Pi Web you can:
26
26
  - move fluidly between laptop, phone, tablet, and desktop without moving the development environment;
27
27
  - turn any server, desktop, or remote dev box into an agent-first development hub.
28
28
 
29
- ## Why use Pi Web?
29
+ ## Why use PI WEB?
30
30
 
31
31
  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.
32
32
 
33
- 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.
33
+ 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.
34
34
 
35
35
  ## Core model
36
36
 
37
- Pi Web organizes work into three levels:
37
+ PI WEB organizes work into three levels:
38
38
 
39
39
  ```text
40
40
  Project a folder on the server
@@ -65,7 +65,7 @@ This maps naturally to real development work:
65
65
 
66
66
  ## Architecture
67
67
 
68
- Pi Web uses a split-process architecture so agent runtimes are not owned by the browser-facing dev server.
68
+ PI WEB uses a split-process architecture so agent runtimes are not owned by the browser-facing dev server.
69
69
 
70
70
  ```text
71
71
  Browser UI
@@ -90,7 +90,7 @@ The web process serves the API and browser UI. In development it can autoreload
90
90
 
91
91
  ## State model
92
92
 
93
- Pi Web keeps its own state intentionally small:
93
+ PI WEB keeps its own state intentionally small:
94
94
 
95
95
  - Projects: `~/.pi-web/projects.json`
96
96
  - Workspaces: discovered from git worktrees, not stored
@@ -99,18 +99,18 @@ Pi Web keeps its own state intentionally small:
99
99
 
100
100
  ## Plugins
101
101
 
102
- 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. They do not run in the session daemon and are not sandboxed.
102
+ 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. They do not run in the session daemon and are not sandboxed.
103
103
 
104
104
  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, and `pi-web-plugins/pi-web` demonstrates a dynamic status panel.
105
105
 
106
106
  A useful prompt for AI agents:
107
107
 
108
108
  ```text
109
- Build a Pi Web plugin for this project. Goal: <describe the UI behavior>.
109
+ Build a PI WEB plugin for this project. Goal: <describe the UI behavior>.
110
110
  Before coding, read https://pi-web.dev/plugins.html and https://pi-web.dev/plugins.md.
111
- Create it under ~/.pi-web/plugins/<plugin-id> using the documented Pi Web v1 plugin API.
111
+ Create it under ~/.pi-web/plugins/<plugin-id> using the documented PI WEB v1 plugin API.
112
112
  Validate with /pi-web-plugins/manifest.json and explain reload/debug steps.
113
- Do not modify Pi Web itself.
113
+ Do not modify PI WEB itself.
114
114
  ```
115
115
 
116
116
  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:
@@ -123,32 +123,24 @@ See the full [Plugin API](docs/plugins.md) for contribution types, package metad
123
123
 
124
124
  ## Install
125
125
 
126
- Recommended install uses npm plus systemd user services:
126
+ Recommended install uses npm plus native per-user services.
127
127
 
128
128
  ```bash
129
129
  npm install -g @jmfederico/pi-web
130
-
131
- # Recommended on servers: keep user services running after logout/reboot.
132
- sudo loginctl enable-linger "$USER"
133
-
134
130
  pi-web install
135
131
  ```
136
132
 
137
- `loginctl enable-linger` is optional for local desktop use, but recommended on servers. It lets the user systemd manager start at boot and continue running after you log out, so Pi Web remains available without an active SSH/login session.
138
-
139
- This writes and starts:
140
-
141
- - `~/.config/systemd/user/pi-web-sessiond.service`
142
- - `~/.config/systemd/user/pi-web.service`
143
-
144
- The generated services run through `bash -lc` so they see a shell environment similar to running `pi` from your terminal.
145
-
146
- To check whether lingering is enabled:
133
+ On Linux servers, `loginctl enable-linger` is optional but recommended so the user systemd manager starts at boot and continues running after logout:
147
134
 
148
135
  ```bash
136
+ sudo loginctl enable-linger "$USER"
149
137
  loginctl show-user "$USER" -p Linger
150
138
  ```
151
139
 
140
+ This writes and starts PI WEB's session daemon and web/API user services. The native user-service backend is selected automatically.
141
+
142
+ 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.
143
+
152
144
  Open <http://127.0.0.1:8504>.
153
145
 
154
146
  Useful commands:
@@ -167,7 +159,7 @@ One-line install is also available for users who prefer it:
167
159
  curl -fsSL https://raw.githubusercontent.com/jmfederico/pi-web/main/install.sh | sh
168
160
  ```
169
161
 
170
- Pi Web is also published as a Pi package. Installing it through Pi exposes a `/pi-web` command inside Pi:
162
+ PI WEB is also published as a Pi package. Installing it through Pi exposes a `/pi-web` command inside Pi:
171
163
 
172
164
  ```bash
173
165
  pi install npm:@jmfederico/pi-web
@@ -183,7 +175,7 @@ Then in Pi:
183
175
  /pi-web doctor
184
176
  ```
185
177
 
186
- 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 journal lines; use `pi-web logs` in a shell when you want to follow logs continuously.
178
+ 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.
187
179
 
188
180
  Advanced users may run the binaries however they prefer:
189
181
 
@@ -211,6 +203,14 @@ npm run dev:web
211
203
  npm run dev:client
212
204
  ```
213
205
 
206
+ Or install the split development setup as native per-user services from the checkout:
207
+
208
+ ```bash
209
+ pi-web install --dev
210
+ ```
211
+
212
+ `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.
213
+
214
214
  `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.
215
215
 
216
216
  ## Production-style run from a checkout
@@ -231,9 +231,9 @@ npm publish --access public
231
231
 
232
232
  `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.
233
233
 
234
- 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.
234
+ 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.
235
235
 
236
- 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.
236
+ 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.
237
237
 
238
238
 
239
239
  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.
@@ -248,26 +248,26 @@ Environment variables:
248
248
 
249
249
  - `PI_WEB_PORT` / `PORT` — web server port. Defaults to `8504`.
250
250
  - `PI_WEB_HOST` — web server bind host. Defaults to `127.0.0.1`.
251
- - `PI_WEB_DATA_DIR` — Pi Web data directory. Defaults to `~/.pi-web`.
251
+ - `PI_WEB_DATA_DIR` — PI WEB data directory. Defaults to `~/.pi-web`.
252
252
  - `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`.
253
253
  - `PI_WEB_SESSIOND_PORT` — optional TCP port for the daemon. If unset, the daemon listens on the Unix socket instead.
254
254
  - `PI_WEB_SESSIOND_HOST` — daemon TCP bind host when `PI_WEB_SESSIOND_PORT` is set. Defaults to `127.0.0.1`.
255
255
  - `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.
256
256
  - `PI_WEB_PROJECTS_FILE` — optional override for the projects storage JSON file. Defaults to `$PI_WEB_DATA_DIR/projects.json`.
257
257
 
258
- ## systemd user services
258
+ ## Development services
259
259
 
260
- A practical local or server setup is two user services:
260
+ `pi-web install --dev` creates a practical local setup with two native per-user services:
261
261
 
262
- - `pi-web-sessiond.service` runs `npm run start:sessiond` without autoreload.
263
- - `pi-web-ui-dev.service` runs `npm run dev:web` and `npm run dev:client` for API reloads, bundled plugin rebuilds, and Vite HMR.
262
+ - `pi-web-sessiond` runs `npm run start:sessiond` from the checkout without autoreload.
263
+ - `pi-web-ui-dev` runs `npm run dev:web` and `npm run dev:client` for API reloads, bundled plugin rebuilds, and Vite HMR.
264
264
 
265
- Example units:
265
+ Under the hood, the native backends are systemd user services and LaunchAgents. For reference, an equivalent systemd setup looks like:
266
266
 
267
267
  ```ini
268
268
  # ~/.config/systemd/user/pi-web-sessiond.service
269
269
  [Unit]
270
- Description=Pi Web session daemon
270
+ Description=PI WEB session daemon
271
271
 
272
272
  [Service]
273
273
  Type=simple
@@ -282,7 +282,7 @@ WantedBy=default.target
282
282
  ```ini
283
283
  # ~/.config/systemd/user/pi-web-ui-dev.service
284
284
  [Unit]
285
- Description=Pi Web UI dev server
285
+ Description=PI WEB UI dev server
286
286
  After=pi-web-sessiond.service
287
287
  Wants=pi-web-sessiond.service
288
288
 
@@ -296,32 +296,29 @@ Restart=no
296
296
  WantedBy=default.target
297
297
  ```
298
298
 
299
- On servers, enable persistent user services so the user systemd manager starts at boot and remains running after logout:
299
+ On Linux servers, enable persistent user services so the user systemd manager starts at boot and remains running after logout:
300
300
 
301
301
  ```bash
302
302
  sudo loginctl enable-linger "$USER"
303
303
  loginctl show-user "$USER" -p Linger
304
304
  ```
305
305
 
306
- After creating or changing units:
306
+ Install or refresh the development services with:
307
307
 
308
308
  ```bash
309
- systemctl --user daemon-reload
310
- systemctl --user enable --now pi-web-sessiond.service
311
- systemctl --user enable --now pi-web-ui-dev.service
309
+ pi-web install --dev
312
310
  ```
313
311
 
314
312
  Useful logs:
315
313
 
316
314
  ```bash
317
- journalctl --user -u pi-web-sessiond.service -f
318
- journalctl --user -u pi-web-ui-dev.service -f
315
+ pi-web logs
319
316
  ```
320
317
 
321
318
  If code affecting the session daemon changes, restart it manually:
322
319
 
323
320
  ```bash
324
- systemctl --user restart pi-web-sessiond.service
321
+ pi-web restart
325
322
  ```
326
323
 
327
324
  ## Current limitations
@@ -333,7 +330,7 @@ systemctl --user restart pi-web-sessiond.service
333
330
 
334
331
  ## Vision
335
332
 
336
- Pi Web is the beginning of an agent-first development environment:
333
+ PI WEB is the beginning of an agent-first development environment:
337
334
 
338
335
  - agents run persistently on servers;
339
336
  - humans connect through the browser;