@jmfederico/pi-web 1.202606.6 → 1.202606.7

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 (55) hide show
  1. package/README.md +84 -296
  2. package/dist/cli.js +25 -7
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/assets/CodeViewer-CQU9mJ74.js +4 -0
  5. package/dist/client/assets/{TerminalPanel-BZKsaE9s.js → TerminalPanel-DtfVBsqI.js} +1 -1
  6. package/dist/client/assets/UnifiedDiffViewer-BZQQK99S.js +34 -0
  7. package/dist/client/assets/index-CbE7df66.js +2742 -0
  8. package/dist/client/assets/{vendor-editor-core-Bc1A7SO7.js → vendor-editor-core-C7aWiQy0.js} +2 -2
  9. package/dist/client/assets/{vendor-editor-languages-D0CnB2js.js → vendor-editor-languages-EW34FfVy.js} +1 -1
  10. package/dist/client/index.html +3 -3
  11. package/dist/config.js +33 -1
  12. package/dist/config.js.map +1 -1
  13. package/dist/plugin-api.d.ts +30 -2
  14. package/dist/server/app.js +16 -4
  15. package/dist/server/app.js.map +1 -1
  16. package/dist/server/configRoutes.js +4 -1
  17. package/dist/server/configRoutes.js.map +1 -1
  18. package/dist/server/machines/machineClient.js +33 -5
  19. package/dist/server/machines/machineClient.js.map +1 -1
  20. package/dist/server/machines/machineProxyRoutes.js +18 -3
  21. package/dist/server/machines/machineProxyRoutes.js.map +1 -1
  22. package/dist/server/sessions/attachmentService.js +69 -11
  23. package/dist/server/sessions/attachmentService.js.map +1 -1
  24. package/dist/server/sessions/piSessionManagerGateway.js +20 -2
  25. package/dist/server/sessions/piSessionManagerGateway.js.map +1 -1
  26. package/dist/server/sessions/piSessionService.js +466 -33
  27. package/dist/server/sessions/piSessionService.js.map +1 -1
  28. package/dist/server/sessions/sessionCleanup.js +157 -0
  29. package/dist/server/sessions/sessionCleanup.js.map +1 -0
  30. package/dist/server/sessions/sessionRoutes.js +17 -0
  31. package/dist/server/sessions/sessionRoutes.js.map +1 -1
  32. package/dist/server/sessions/spawnSubsessionTool.js +6 -3
  33. package/dist/server/sessions/spawnSubsessionTool.js.map +1 -1
  34. package/dist/server/workspaceExplorerRoutes.js +55 -3
  35. package/dist/server/workspaceExplorerRoutes.js.map +1 -1
  36. package/dist/server/workspaces/fileContentService.js +112 -1
  37. package/dist/server/workspaces/fileContentService.js.map +1 -1
  38. package/dist/server/workspaces/pathSafety.js +16 -1
  39. package/dist/server/workspaces/pathSafety.js.map +1 -1
  40. package/dist/server/workspaces/projectPiWebConfig.js +6 -1
  41. package/dist/server/workspaces/projectPiWebConfig.js.map +1 -1
  42. package/dist/shared/apiTypes.d.ts +83 -6
  43. package/dist/shared/apiTypes.js +1 -0
  44. package/dist/shared/apiTypes.js.map +1 -1
  45. package/dist/shared/capabilities.js +3 -2
  46. package/dist/shared/capabilities.js.map +1 -1
  47. package/dist/shared/federatedRoutes.js +5 -0
  48. package/dist/shared/federatedRoutes.js.map +1 -1
  49. package/dist/shared/promptAttachments.js +30 -11
  50. package/dist/shared/promptAttachments.js.map +1 -1
  51. package/docs/config.md +40 -3
  52. package/docs/plugins.md +127 -3
  53. package/package.json +1 -1
  54. package/dist/client/assets/CodeViewer-Bv8l_MFi.js +0 -4
  55. package/dist/client/assets/index-C9oPLpm7.js +0 -2408
package/README.md CHANGED
@@ -1,170 +1,58 @@
1
- # PI WEB — web UI for Pi Coding Agent
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)
5
5
  [![Node.js](https://img.shields.io/node/v/@jmfederico/pi-web)](package.json)
6
6
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
- [![Pi Coding Agent](https://img.shields.io/badge/Pi-Coding%20Agent-6f42c1)](https://github.com/earendil-works/pi/tree/main/packages/coding-agent)
8
7
 
9
- Website: <https://pi-web.dev/>
8
+ **PI WEB is a web UI for [Pi Coding Agent](https://github.com/earendil-works/pi/tree/main/packages/coding-agent) that keeps agent sessions running in real workspaces on your machine or server.**
10
9
 
11
- ![PI WEB](docs/assets/pi-web-banner.png)
12
-
13
- **Run Pi Coding Agent from a web UI, keep sessions alive in real workspaces, and supervise them from any device.**
14
-
15
- PI WEB is a web UI for [Pi Coding Agent](https://github.com/earendil-works/pi/tree/main/packages/coding-agent) that keeps agent sessions running on your own machine or server. Add your repositories once, open project workspaces and git worktrees, start 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
-
17
- ![PI WEB desktop screenshot showing an agent-created pi-web.dev screenshot selected in the file preview](docs/assets/pi-web-desktop.png)
18
-
19
- <p align="center">
20
- <img src="docs/assets/pi-web-tablet.png" alt="PI WEB tablet screenshot" width="58%" />
21
- <img src="docs/assets/pi-web-mobile.png" alt="PI WEB mobile chat screenshot" width="28%" />
22
- </p>
23
-
24
- With PI WEB you can:
25
-
26
- - launch and supervise multiple coding-agent sessions in parallel;
27
- - keep sessions running when your browser disconnects or the UI restarts;
28
- - organize agent work by project, workspace, branch, experiment, or review;
29
- - use git worktrees to isolate concurrent features and fixes;
30
- - chat with Pi Coding Agent through a realtime web UI;
31
- - move fluidly between laptop, phone, tablet, and desktop without moving the development environment;
32
- - turn any server, desktop, or remote dev box into an agent-first development hub.
33
-
34
- ## Why use PI WEB?
35
-
36
- 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.
37
-
38
- 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.
39
-
40
- ### Is PI WEB a Pi web UI?
41
-
42
- Yes. PI WEB is a Pi web UI for running and supervising Pi Coding Agent sessions from a browser. Unlike simple session viewers, PI WEB is built around persistent server-side workspaces, long-running session daemons, git worktrees, remote machines, and multi-device supervision.
43
-
44
- ## Core model
45
-
46
- PI WEB organizes work into four levels:
10
+ Run agents where your code, tools, credentials, and build caches live. Supervise them from any browser.
47
11
 
48
- ```text
49
- Machine a local or remote PI WEB runtime endpoint
50
- Project a folder on that machine
51
- Workspace a git worktree, or the project folder for non-git projects
52
- Session a chat with Pi Coding Agent running inside a workspace
53
- ```
54
-
55
- This maps naturally to real development work:
56
-
57
- - select the local machine or another registered PI WEB runtime;
58
- - add a project once on the selected machine;
59
- - use worktrees to separate branches, features, experiments, and reviews;
60
- - start one or more agent sessions inside each workspace;
61
- - leave sessions running even when the browser disconnects or the UI restarts.
62
-
63
- ## Features
64
-
65
- - Add and list local or remote PI WEB machines from the action palette.
66
- - Proxy remote projects, workspaces, files, git state, sessions, and terminals through the currently opened PI WEB server.
67
- - Add and list server-side projects.
68
- - Discover git worktrees automatically with `git worktree list --porcelain`.
69
- - Support non-git folders as single-workspace projects.
70
- - Start, resume, archive, and restore Pi sessions per workspace.
71
- - Chat with Pi Coding Agent through realtime WebSocket events.
72
- - Keep active agent runtimes alive across browser disconnects and web/API restarts.
73
- - Explicitly stop or abort active session work.
74
- - View live session status: streaming, compaction, bash activity, token usage, cost, model, and context usage.
75
- - Send prompts, shell input, and supported commands through the Pi SDK path.
76
- - Reuse your existing Pi auth and model configuration from `~/.pi/agent`.
77
- - 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.
78
-
79
- ## Architecture
80
-
81
- PI WEB uses a split-process architecture so agent runtimes are not owned by the browser-facing dev server. Under the hood, it acts as a browser-based control plane for sessions, workspaces, files, terminals, and trusted remote machines.
82
-
83
- ```text
84
- Browser UI
85
- │
86
- ▼
87
- Fastify Web/API process
88
- │ HTTP + WebSocket proxy
89
- ▼
90
- Session daemon
91
- │
92
- ▼
93
- Pi Coding Agent SDK
94
- ```
12
+ Website and docs: <https://pi-web.dev/>
95
13
 
96
- ### Session daemon
97
-
98
- 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.
99
-
100
- ### Web/API/UI server
101
-
102
- The web process serves the API and browser UI. In development it can autoreload freely while active sessions continue running in the daemon.
103
-
104
- ## State model
105
-
106
- PI WEB keeps its own state intentionally small:
107
-
108
- - Machines: `~/.pi-web/machines.json` stores only opt-in remote machine records; the local machine is synthesized.
109
- - Projects: `~/.pi-web/projects.json`
110
- - Workspaces: discovered from git worktrees, not stored
111
- - Sessions and chat history: Pi's default JSONL session storage on the selected machine
112
- - Active session runtimes and WebSockets: memory in each selected machine's session daemon
113
-
114
- ## Machine federation
115
-
116
- 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 URL reachable over NetBird, Tailscale, WireGuard, an SSH tunnel, or a trusted reverse proxy. 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. See the [Fleet guide](https://pi-web.dev/machines) for setup, trust model, and troubleshooting details.
117
-
118
- 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.
119
-
120
- ## Plugins
14
+ ![PI WEB](docs/assets/pi-web-banner.png)
121
15
 
122
- 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.
16
+ ![PI WEB desktop screenshot](docs/assets/pi-web-desktop.png)
123
17
 
124
- The supported package shape is intentionally singular: `piWeb.plugins` entries with explicit `id` and `module` plus optional `machineSpecific` metadata, and 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.
18
+ ## Why PI WEB?
125
19
 
126
- A useful prompt for AI agents:
20
+ Agentic development works better when the work environment is persistent.
127
21
 
128
- ```text
129
- Build a PI WEB plugin for this project. Goal: <describe the UI behavior>.
130
- Before coding, read https://pi-web.dev/plugins and https://pi-web.dev/plugins.md.
131
- Create it under ~/.pi-web/plugins/<plugin-id> using the documented PI WEB v1 plugin API.
132
- Validate with /pi-web-plugins/manifest.json and explain reload/debug steps.
133
- Do not modify PI WEB itself.
134
- ```
22
+ PI WEB lets you:
135
23
 
136
- 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.
24
+ - keep Pi Coding Agent sessions alive after browser disconnects;
25
+ - run agents inside real repositories and git worktrees;
26
+ - supervise multiple sessions in parallel;
27
+ - switch between laptop, phone, tablet, and desktop;
28
+ - use a server, workstation, or remote dev box as your agent runtime;
29
+ - manage projects, workspaces, files, terminals, sessions, and remote machines from one web UI.
137
30
 
138
- 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:
31
+ Your browser is the control surface. The work stays where it can keep running.
139
32
 
140
- ```bash
141
- curl http://127.0.0.1:8504/pi-web-plugins/manifest.json
142
- ```
33
+ ## Quick start
143
34
 
144
- See the full [Plugin API](docs/plugins.md) for contribution types, package metadata, and troubleshooting.
35
+ Requirements:
145
36
 
146
- ## Install
37
+ - Node.js 22 or newer
38
+ - npm
39
+ - Pi Coding Agent configured for your user
40
+ - git and the development tools your agents need
147
41
 
148
- Recommended install uses npm plus native per-user services.
42
+ Install and start PI WEB as per-user services:
149
43
 
150
44
  ```bash
151
45
  npm install -g @jmfederico/pi-web
152
46
  pi-web install
47
+ pi-web doctor
153
48
  ```
154
49
 
155
- On Linux servers, `loginctl enable-linger` is optional but recommended so the user systemd manager starts at boot and continues running after logout:
50
+ Then open:
156
51
 
157
- ```bash
158
- sudo loginctl enable-linger "$USER"
159
- loginctl show-user "$USER" -p Linger
52
+ ```text
53
+ http://127.0.0.1:8504
160
54
  ```
161
55
 
162
- This writes and starts PI WEB's session daemon and web/API user services. The native user-service backend is selected automatically.
163
-
164
- 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.
165
-
166
- Open <http://127.0.0.1:8504>.
167
-
168
56
  Useful commands:
169
57
 
170
58
  ```bash
@@ -176,212 +64,112 @@ pi-web version
176
64
  pi-web uninstall
177
65
  ```
178
66
 
179
- Use `pi-web version` to compare the installed package version with the versions reported by the running Web/UI and session daemon services.
180
-
181
- One-line install is also available for users who prefer it:
67
+ For more install options, including one-line install, Pi package install, WSL/manual usage, and remote access, see the [installation guide](https://pi-web.dev/install).
182
68
 
183
- ```bash
184
- curl -fsSL https://raw.githubusercontent.com/jmfederico/pi-web/main/install.sh | sh
185
- ```
186
-
187
- PI WEB is also published as a Pi package. Installing it through Pi exposes a `/pi-web` command inside Pi:
188
-
189
- ```bash
190
- pi install npm:@jmfederico/pi-web
191
- ```
69
+ ## Core model
192
70
 
193
- Then in Pi:
71
+ PI WEB organizes work like this:
194
72
 
195
73
  ```text
196
- /pi-web install
197
- /pi-web status
198
- /pi-web logs
199
- /pi-web restart
200
- /pi-web doctor
201
- /pi-web version
202
- ```
203
-
204
- 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.
205
-
206
- Advanced users may run the binaries however they prefer:
207
-
208
- ```bash
209
- pi-web-sessiond
210
- PI_WEB_PORT=8504 pi-web-server
211
- ```
212
-
213
- ## Development quick start
214
-
215
- ```bash
216
- npm install
217
- npm run dev
74
+ Machine a local or remote PI WEB runtime endpoint
75
+ Project a folder on that machine
76
+ Workspace a git worktree, or the project folder for non-git projects
77
+ Session a Pi Coding Agent chat running inside a workspace
218
78
  ```
219
79
 
220
- Open the Vite URL, usually <http://localhost:8505>.
221
-
222
- During development, the static marketing/docs site is also served by the Vite dev server at <http://localhost:8505/site/>.
80
+ A typical flow:
223
81
 
224
- For the recommended split development setup, run these in separate terminals:
82
+ 1. Add a project.
83
+ 2. Choose a workspace or git worktree.
84
+ 3. Start a session.
85
+ 4. Let the agent work.
86
+ 5. Come back later from any browser.
225
87
 
226
- ```bash
227
- npm run dev:sessiond
228
- npm run dev:web
229
- npm run dev:client
230
- ```
88
+ ## Remote-first development
231
89
 
232
- Or install the split development setup as native per-user services from the checkout:
90
+ PI WEB is designed for remote AI-driven development.
233
91
 
234
- ```bash
235
- pi-web install --dev
236
- ```
92
+ Instead of tying agent work to your laptop session, run PI WEB on a machine that stays available: a server, desktop, cloud VM, home lab machine, or remote dev box.
237
93
 
238
- `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.
94
+ Use a private network, SSH tunnel, trusted reverse proxy, or federated PI WEB machine setup when accessing it remotely.
239
95
 
240
- `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.
96
+ Read more: [Remote-first development](https://pi-web.dev/remote-first)
241
97
 
242
- ## Production-style run from a checkout
98
+ ## Machines and fleets
243
99
 
244
- ```bash
245
- npm run build
246
- npm run start:sessiond
247
- PI_WEB_PORT=8504 npm start
248
- ```
100
+ PI WEB can register other PI WEB runtimes as remote machines. One browser-facing PI WEB instance can proxy projects, files, git state, sessions, terminals, and activity from trusted remote machines.
249
101
 
250
- ## Packaging and publishing
102
+ Read more: [Fleet and machines guide](https://pi-web.dev/machines)
251
103
 
252
- ```bash
253
- npm run verify
254
- npm run pack:dry
255
- npm publish --access public
256
- ```
257
-
258
- `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.
259
-
260
- 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.
104
+ ## Plugins
261
105
 
262
- PI WEB declares `@earendil-works/pi-coding-agent` as a peer dependency (`>=0.78.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.
106
+ PI WEB supports trusted local browser-side plugins that can add actions, workspace panels, and workspace metadata.
263
107
 
108
+ Read more: [Plugin API](https://pi-web.dev/plugins)
264
109
 
265
110
  ## Configuration
266
111
 
267
- Global PI WEB config lives at `$PI_WEB_CONFIG`, or `$XDG_CONFIG_HOME/pi-web/config.json`, or `~/.config/pi-web/config.json`. Project-local core config lives at `<project>/.pi-web/config.json`.
268
-
269
- See the full [Configuration reference](docs/config.md) for config-file precedence, project-local config, external path access, session daemon settings, plugins, shortcuts, upload limits, and environment variables.
270
-
271
- 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 behind a trusted network, firewall, or authenticated proxy.
272
-
273
- The session daemon defaults to a private Unix socket at:
112
+ Global config lives at:
274
113
 
275
114
  ```text
276
- ~/.pi-web/sessiond.sock
115
+ $PI_WEB_CONFIG
116
+ ~/.config/pi-web/config.json
277
117
  ```
278
118
 
279
- Common config keys:
280
-
281
- - `host` / `port` — web/API bind address. Environment overrides: `PI_WEB_HOST`, `PI_WEB_PORT` / `PORT`.
282
- - `pathAccess.allowedPaths` — external filesystem roots that PI WEB may list/read through the file explorer and absolute `@` path completions. Absolute paths are denied by default.
283
- - `maxUploadBytes` — maximum accepted request body size. Defaults to 64 MB. Environment override: `PI_WEB_MAX_UPLOAD_BYTES`.
284
- - `spawnSessions` — enable the `spawn_session` tool. Defaults to `true`. Environment override: `PI_WEB_SPAWN_SESSIONS`.
285
- - `subsessions` — beta tracked-subsession tools (`spawn_subsession`, `list_subsessions`, `check_subsession`, `read_subsession`). Defaults to `false`, requires `spawnSessions`, and requires a session daemon restart after changes. Environment override: `PI_WEB_SUBSESSIONS`.
286
- - `plugins` — plugin enablement/settings. Reload the browser after changing plugin enablement.
287
- - `shortcuts` — keyboard shortcut overrides; use `null` to disable an action shortcut.
119
+ Project-local PI WEB config lives at:
288
120
 
289
- Operational environment variables:
290
-
291
- - `PI_WEB_CONFIG` — path to the global config JSON file.
292
- - `PI_WEB_DATA_DIR` — PI WEB-managed data directory. Defaults to `~/.pi-web`.
293
- - `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`.
294
- - `PI_WEB_SESSIOND_PORT` — optional TCP port for the daemon. If unset, the daemon listens on the Unix socket instead.
295
- - `PI_WEB_SESSIOND_HOST` — daemon TCP bind host when `PI_WEB_SESSIOND_PORT` is set. Defaults to `127.0.0.1`.
296
- - `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.
297
- - `PI_WEB_PROJECTS_FILE` — optional override for the projects storage JSON file. Defaults to `$PI_WEB_DATA_DIR/projects.json`.
298
- - `PI_WEB_MACHINES_FILE` — optional override for the remote machine registry JSON file. Defaults to `$PI_WEB_DATA_DIR/machines.json`.
299
- - `PI_CODING_AGENT_SESSION_DIR` — Pi session storage directory. PI WEB follows the same session-location priority as Pi for web sessions: this environment variable, then `sessionDir` in Pi settings for the selected workspace, then Pi's default session directory.
300
- - `PI_CODING_AGENT_DIR` — Pi agent config directory. PI WEB uses this for Pi auth, settings, resources, and default session storage, matching Pi's own configuration layout.
301
-
302
- ## Development services
303
-
304
- `pi-web install --dev` creates a practical local setup with two native per-user services:
305
-
306
- - `pi-web-sessiond` runs `npm run start:sessiond` from the checkout without autoreload.
307
- - `pi-web-ui-dev` runs `npm run dev:web` and `npm run dev:client` for API reloads, bundled plugin rebuilds, and Vite HMR.
308
-
309
- Under the hood, the native backends are systemd user services and LaunchAgents. For reference, an equivalent systemd setup looks like:
310
-
311
- ```ini
312
- # ~/.config/systemd/user/pi-web-sessiond.service
313
- [Unit]
314
- Description=PI WEB session daemon
121
+ ```text
122
+ <project>/.pi-web/config.json
123
+ ```
315
124
 
316
- [Service]
317
- Type=simple
318
- WorkingDirectory=/srv/dev/pi-web
319
- ExecStart=/bin/bash -lc 'exec npm run start:sessiond'
320
- Restart=no
125
+ Common configuration includes host/port, path access, uploads, plugins, shortcuts, and session daemon options.
321
126
 
322
- [Install]
323
- WantedBy=default.target
324
- ```
127
+ Read more: [Configuration reference](https://pi-web.dev/config)
325
128
 
326
- ```ini
327
- # ~/.config/systemd/user/pi-web-ui-dev.service
328
- [Unit]
329
- Description=PI WEB UI dev server
330
- After=pi-web-sessiond.service
331
- Wants=pi-web-sessiond.service
332
-
333
- [Service]
334
- Type=simple
335
- WorkingDirectory=/srv/dev/pi-web
336
- ExecStart=/bin/bash -lc 'trap "kill 0" EXIT; npm run dev:web & npm run dev:client & wait'
337
- Restart=no
338
-
339
- [Install]
340
- WantedBy=default.target
341
- ```
129
+ ## Development
342
130
 
343
- On Linux servers, enable persistent user services so the user systemd manager starts at boot and remains running after logout:
131
+ Clone the repository and run:
344
132
 
345
133
  ```bash
346
- sudo loginctl enable-linger "$USER"
347
- loginctl show-user "$USER" -p Linger
134
+ npm install
135
+ npm run dev
348
136
  ```
349
137
 
350
- Install or refresh the development services with:
138
+ Open the Vite URL, usually:
351
139
 
352
- ```bash
353
- pi-web install --dev
140
+ ```text
141
+ http://localhost:8505
354
142
  ```
355
143
 
356
- Useful logs:
144
+ For the split development setup:
357
145
 
358
146
  ```bash
359
- pi-web logs
147
+ npm run dev:sessiond
148
+ npm run dev:web
149
+ npm run dev:client
360
150
  ```
361
151
 
362
- If code affecting the session daemon changes, restart it manually:
152
+ Validate changes with:
363
153
 
364
154
  ```bash
365
- pi-web restart
155
+ npm run verify
366
156
  ```
367
157
 
368
- ## Current limitations
369
-
370
- - Assumes trusted users and trusted server paths.
371
- - Not a sandbox, permission model, or secure multi-tenant platform.
372
- - Some Pi TUI slash-command behavior is not yet represented exactly in the web UI.
373
- - Workspaces are discovered from existing git worktrees; UI-driven worktree management is a natural next step.
158
+ ## Security model
374
159
 
375
- ## Vision
160
+ PI WEB assumes trusted users, trusted repositories, and trusted server paths.
376
161
 
377
- PI WEB is the beginning of an agent-first development environment:
162
+ It is not a sandbox, permission system, or multi-tenant platform. Do not expose it directly to the public internet without a trusted network, firewall, VPN, SSH tunnel, or authenticated reverse proxy.
378
163
 
379
- - agents run persistently on servers;
380
- - humans connect through the browser;
381
- - work is organized by projects, workspaces, and sessions;
382
- - the UI grows around the needs of agentic development rather than the habits of local IDEs.
164
+ ## Documentation
383
165
 
384
- 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.
166
+ - [Website](https://pi-web.dev/)
167
+ - [Install](https://pi-web.dev/install)
168
+ - [Remote-first development](https://pi-web.dev/remote-first)
169
+ - [Machines / fleet](https://pi-web.dev/machines)
170
+ - [Configuration](https://pi-web.dev/config)
171
+ - [Plugins](https://pi-web.dev/plugins)
172
+ - [FAQ](https://pi-web.dev/faq)
385
173
 
386
174
  ## License
387
175
 
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawnSync } from "node:child_process";
3
- import { existsSync, readFileSync } from "node:fs";
3
+ import { existsSync, readFileSync, realpathSync } from "node:fs";
4
4
  import { mkdir, rm, writeFile } from "node:fs/promises";
5
5
  import { homedir, userInfo } from "node:os";
6
6
  import { basename, dirname, join, resolve } from "node:path";
@@ -775,8 +775,12 @@ function systemdUserServiceShellCommand(command, cwd) {
775
775
  function commandCheck(command) {
776
776
  return `command -v ${command}`;
777
777
  }
778
- function commandWithVersionCheck(command) {
779
- return `${commandCheck(command)} && (${command} --version 2>&1 || true)`;
778
+ export function commandWithVersionCheck(command) {
779
+ const found = commandCheck(command);
780
+ if (detectServiceShell().name === "fish") {
781
+ return `${found} && begin; ${command} --version 2>&1 || true; end`;
782
+ }
783
+ return `${found} && (${command} --version 2>&1 || true)`;
780
784
  }
781
785
  function nodeVersionCheck() {
782
786
  return [
@@ -967,8 +971,22 @@ async function main() {
967
971
  else
968
972
  throw new Error(`Unknown command: ${command}`);
969
973
  }
970
- main().catch((error) => {
971
- console.error(error instanceof Error ? error.message : String(error));
972
- process.exit(1);
973
- });
974
+ export function isCliEntrypoint(entrypoint = process.argv[1], modulePath = fileURLToPath(import.meta.url)) {
975
+ if (entrypoint === undefined)
976
+ return false;
977
+ if (entrypoint === modulePath)
978
+ return true;
979
+ try {
980
+ return realpathSync(entrypoint) === realpathSync(modulePath);
981
+ }
982
+ catch {
983
+ return false;
984
+ }
985
+ }
986
+ if (isCliEntrypoint()) {
987
+ main().catch((error) => {
988
+ console.error(error instanceof Error ? error.message : String(error));
989
+ process.exit(1);
990
+ });
991
+ }
974
992
  //# sourceMappingURL=cli.js.map