@chainingintention/pi-web-cn 1.202606.24 → 1.202606.26

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 (88) hide show
  1. package/README.md +84 -277
  2. package/dist/cli.js +31 -11
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/assets/CodeViewer-CEaJIjgA.js +4 -0
  5. package/dist/client/assets/{TerminalPanel-DR8I9BBO.js → TerminalPanel-BdMJbtLB.js} +1 -1
  6. package/dist/client/assets/UnifiedDiffViewer-Dkgg-4fh.js +34 -0
  7. package/dist/client/assets/index-iRSp25EB.js +2735 -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 +6 -3
  11. package/dist/config.js +9 -1
  12. package/dist/config.js.map +1 -1
  13. package/dist/plugin-api.d.ts +30 -2
  14. package/dist/server/app.js +35 -17
  15. package/dist/server/app.js.map +1 -1
  16. package/dist/server/gitRoutes.js +1 -1
  17. package/dist/server/gitRoutes.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/managementEmbed.js +42 -22
  23. package/dist/server/managementEmbed.js.map +1 -1
  24. package/dist/server/sessiond/sessionProxyRoutes.js +1 -1
  25. package/dist/server/sessiond/sessionProxyRoutes.js.map +1 -1
  26. package/dist/server/sessiond.js +2 -2
  27. package/dist/server/sessiond.js.map +1 -1
  28. package/dist/server/sessions/attachmentService.js +68 -10
  29. package/dist/server/sessions/attachmentService.js.map +1 -1
  30. package/dist/server/sessions/authProviderOptions.js +1 -5
  31. package/dist/server/sessions/authProviderOptions.js.map +1 -1
  32. package/dist/server/sessions/piSessionManagerGateway.js +20 -2
  33. package/dist/server/sessions/piSessionManagerGateway.js.map +1 -1
  34. package/dist/server/sessions/piSessionService.js +515 -51
  35. package/dist/server/sessions/piSessionService.js.map +1 -1
  36. package/dist/server/sessions/sessionCleanup.js +157 -0
  37. package/dist/server/sessions/sessionCleanup.js.map +1 -0
  38. package/dist/server/sessions/sessionNameGenerator.js +39 -2
  39. package/dist/server/sessions/sessionNameGenerator.js.map +1 -1
  40. package/dist/server/sessions/sessionRoutes.js +17 -0
  41. package/dist/server/sessions/sessionRoutes.js.map +1 -1
  42. package/dist/server/sessions/spawnSessionTool.js +7 -2
  43. package/dist/server/sessions/spawnSessionTool.js.map +1 -1
  44. package/dist/server/sessions/spawnSubsessionTool.js +14 -4
  45. package/dist/server/sessions/spawnSubsessionTool.js.map +1 -1
  46. package/dist/server/workspaceExplorerRoutes.js +74 -24
  47. package/dist/server/workspaceExplorerRoutes.js.map +1 -1
  48. package/dist/server/workspaces/effectivePathAccess.js +27 -0
  49. package/dist/server/workspaces/effectivePathAccess.js.map +1 -0
  50. package/dist/server/workspaces/fileContentService.js +118 -7
  51. package/dist/server/workspaces/fileContentService.js.map +1 -1
  52. package/dist/server/workspaces/fileOperationService.js +1 -19
  53. package/dist/server/workspaces/fileOperationService.js.map +1 -1
  54. package/dist/server/workspaces/fileSuggestions.js +311 -23
  55. package/dist/server/workspaces/fileSuggestions.js.map +1 -1
  56. package/dist/server/workspaces/fileTreeService.js +16 -7
  57. package/dist/server/workspaces/fileTreeService.js.map +1 -1
  58. package/dist/server/workspaces/imagePreviewService.js +5 -5
  59. package/dist/server/workspaces/imagePreviewService.js.map +1 -1
  60. package/dist/server/workspaces/pathAccessPolicy.js +90 -0
  61. package/dist/server/workspaces/pathAccessPolicy.js.map +1 -0
  62. package/dist/server/workspaces/pathSafety.js +19 -10
  63. package/dist/server/workspaces/pathSafety.js.map +1 -1
  64. package/dist/server/workspaces/projectPiWebConfig.js +61 -0
  65. package/dist/server/workspaces/projectPiWebConfig.js.map +1 -0
  66. package/dist/server/workspaces/workspaceDeletionRoutes.js +1 -1
  67. package/dist/server/workspaces/workspaceDeletionRoutes.js.map +1 -1
  68. package/dist/shared/apiTypes.d.ts +89 -6
  69. package/dist/shared/apiTypes.js +2 -0
  70. package/dist/shared/apiTypes.js.map +1 -1
  71. package/dist/shared/capabilities.js +4 -2
  72. package/dist/shared/capabilities.js.map +1 -1
  73. package/dist/shared/federatedRoutes.js +6 -1
  74. package/dist/shared/federatedRoutes.js.map +1 -1
  75. package/dist/shared/piWebConfigParsing.js +44 -3
  76. package/dist/shared/piWebConfigParsing.js.map +1 -1
  77. package/dist/shared/promptAttachments.js +30 -11
  78. package/dist/shared/promptAttachments.js.map +1 -1
  79. package/docs/assets/pi-web-desktop.png +0 -0
  80. package/docs/assets/pi-web-mobile.png +0 -0
  81. package/docs/assets/pi-web-tablet.png +0 -0
  82. package/docs/config.md +203 -0
  83. package/docs/plugins.md +128 -4
  84. package/package.json +3 -1
  85. package/dist/client/assets/CodeViewer-DA68s2LY.js +0 -4
  86. package/dist/client/assets/index-Bjpa_x8C.js +0 -2354
  87. package/docs/assets/pi-web-demo.gif +0 -0
  88. package/docs/assets/pi-web-demo.webm +0 -0
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # PI WEB — web UI for Pi Coding Agent
1
+ # PI WEB
2
2
 
3
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
4
 
@@ -6,162 +6,55 @@ This fork is a translation plan for PI WEB. Its goal is to translate the plugin'
6
6
  [![npm version](https://img.shields.io/npm/v/%40chainingintention%2Fpi-web-cn)](https://www.npmjs.com/package/@chainingintention/pi-web-cn)
7
7
  [![Node.js](https://img.shields.io/node/v/%40chainingintention%2Fpi-web-cn)](package.json)
8
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
9
 
11
- Website: <https://pi-web.dev/>
10
+ **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.**
12
11
 
13
- ![PI WEB](docs/assets/pi-web-banner.png)
14
-
15
- **Run Pi Coding Agent from a web UI, keep sessions alive in real workspaces, and supervise them from any device.**
16
-
17
- 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.
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?
12
+ Run agents where your code, tools, credentials, and build caches live. Supervise them from any browser.
32
13
 
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.
14
+ Website and docs: <https://pi-web.dev/>
34
15
 
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
- ### Is PI WEB a Pi web UI?
38
-
39
- 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.
40
-
41
- ## Core model
42
-
43
- PI WEB organizes work into four levels:
44
-
45
- ```text
46
- Machine a local or remote PI WEB runtime endpoint
47
- Project a folder on that machine
48
- Workspace a git worktree, or the project folder for non-git projects
49
- Session a chat with Pi Coding Agent running inside a workspace
50
- ```
51
-
52
- This maps naturally to real development work:
53
-
54
- - select the local machine or another registered PI WEB runtime;
55
- - add a project once on the selected machine;
56
- - use worktrees to separate branches, features, experiments, and reviews;
57
- - start one or more agent sessions inside each workspace;
58
- - leave sessions running even when the browser disconnects or the UI restarts.
59
-
60
- ## Features
61
-
62
- - Add and list local or remote PI WEB machines from the action palette.
63
- - Proxy remote projects, workspaces, files, git state, sessions, and terminals through the currently opened PI WEB server.
64
- - Add and list server-side projects.
65
- - Discover git worktrees automatically with `git worktree list --porcelain`.
66
- - Support non-git folders as single-workspace projects.
67
- - Start, resume, archive, and restore Pi sessions per workspace.
68
- - Chat with Pi Coding Agent through realtime WebSocket events.
69
- - Keep active agent runtimes alive across browser disconnects and web/API restarts.
70
- - Explicitly stop or abort active session work.
71
- - View live session status: streaming, compaction, bash activity, token usage, cost, model, and context usage.
72
- - Send prompts, shell input, and supported commands through the Pi SDK path.
73
- - Reuse your existing Pi auth and model configuration from `~/.pi/agent`.
74
- - 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.
75
-
76
- ## Architecture
77
-
78
- 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.
79
-
80
- ```text
81
- Browser UI
82
- │
83
- ▼
84
- Fastify Web/API process
85
- │ HTTP + WebSocket proxy
86
- ▼
87
- Session daemon
88
- │
89
- ▼
90
- Pi Coding Agent SDK
91
- ```
92
-
93
- ### Session daemon
94
-
95
- 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.
96
-
97
- ### Web/API/UI server
98
-
99
- The web process serves the API and browser UI. In development it can autoreload freely while active sessions continue running in the daemon.
100
-
101
- ## State model
102
-
103
- PI WEB keeps its own state intentionally small:
104
-
105
- - Machines: `~/.pi-web/machines.json` stores only opt-in remote machine records; the local machine is synthesized.
106
- - Projects: `~/.pi-web/projects.json`
107
- - Workspaces: discovered from git worktrees, not stored
108
- - Sessions and chat history: Pi's default JSONL session storage on the selected machine
109
- - Active session runtimes and WebSockets: memory in each selected machine's session daemon
110
-
111
- ## Machine federation
112
-
113
- 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.
114
-
115
- 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.
116
-
117
- ## Plugins
16
+ ![PI WEB](docs/assets/pi-web-banner.png)
118
17
 
119
- 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.
18
+ ![PI WEB desktop screenshot](docs/assets/pi-web-desktop.png)
120
19
 
121
- 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.
20
+ ## Why PI WEB?
122
21
 
123
- A useful prompt for AI agents:
22
+ Agentic development works better when the work environment is persistent.
124
23
 
125
- ```text
126
- Build a PI WEB plugin for this project. Goal: <describe the UI behavior>.
127
- Before coding, read https://pi-web.dev/plugins and https://pi-web.dev/plugins.md.
128
- Create it under ~/.pi-web/plugins/<plugin-id> using the documented PI WEB v1 plugin API.
129
- Validate with /pi-web-plugins/manifest.json and explain reload/debug steps.
130
- Do not modify PI WEB itself.
131
- ```
24
+ PI WEB lets you:
132
25
 
133
- 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.
26
+ - keep Pi Coding Agent sessions alive after browser disconnects;
27
+ - run agents inside real repositories and git worktrees;
28
+ - supervise multiple sessions in parallel;
29
+ - switch between laptop, phone, tablet, and desktop;
30
+ - use a server, workstation, or remote dev box as your agent runtime;
31
+ - manage projects, workspaces, files, terminals, sessions, and remote machines from one web UI.
134
32
 
135
- 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:
33
+ Your browser is the control surface. The work stays where it can keep running.
136
34
 
137
- ```bash
138
- curl http://127.0.0.1:8504/pi-web-plugins/manifest.json
139
- ```
35
+ ## Quick start
140
36
 
141
- See the full [Plugin API](docs/plugins.md) for contribution types, package metadata, and troubleshooting.
37
+ Requirements:
142
38
 
143
- ## Install
39
+ - Node.js 22 or newer
40
+ - npm
41
+ - Pi Coding Agent configured for your user
42
+ - git and the development tools your agents need
144
43
 
145
- Recommended install uses npm plus native per-user services.
44
+ Install and start PI WEB as per-user services:
146
45
 
147
46
  ```bash
148
47
  npm install -g @chainingintention/pi-web-cn
149
48
  pi-web install
49
+ pi-web doctor
150
50
  ```
151
51
 
152
- On Linux servers, `loginctl enable-linger` is optional but recommended so the user systemd manager starts at boot and continues running after logout:
52
+ Then open:
153
53
 
154
- ```bash
155
- sudo loginctl enable-linger "$USER"
156
- loginctl show-user "$USER" -p Linger
54
+ ```text
55
+ http://127.0.0.1:8504
157
56
  ```
158
57
 
159
- This writes and starts PI WEB's session daemon and web/API user services. The native user-service backend is selected automatically.
160
-
161
- 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.
162
-
163
- Open <http://127.0.0.1:8504>.
164
-
165
58
  Useful commands:
166
59
 
167
60
  ```bash
@@ -173,198 +66,112 @@ pi-web version
173
66
  pi-web uninstall
174
67
  ```
175
68
 
176
- Use `pi-web version` to compare the installed package version with the versions reported by the running Web/UI and session daemon services.
177
-
178
- One-line install is also available for users who prefer it:
179
-
180
- ```bash
181
- curl -fsSL https://raw.githubusercontent.com/jmfederico/pi-web/main/install.sh | sh
182
- ```
183
-
184
- PI WEB is also published as a Pi package. Installing it through Pi exposes a `/pi-web` command inside Pi:
69
+ 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).
185
70
 
186
- ```bash
187
- pi install npm:@chainingintention/pi-web-cn
188
- ```
71
+ ## Core model
189
72
 
190
- Then in Pi:
73
+ PI WEB organizes work like this:
191
74
 
192
75
  ```text
193
- /pi-web install
194
- /pi-web status
195
- /pi-web logs
196
- /pi-web restart
197
- /pi-web doctor
198
- /pi-web version
76
+ Machine a local or remote PI WEB runtime endpoint
77
+ Project a folder on that machine
78
+ Workspace a git worktree, or the project folder for non-git projects
79
+ Session a Pi Coding Agent chat running inside a workspace
199
80
  ```
200
81
 
201
- 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.
82
+ A typical flow:
202
83
 
203
- Advanced users may run the binaries however they prefer:
84
+ 1. Add a project.
85
+ 2. Choose a workspace or git worktree.
86
+ 3. Start a session.
87
+ 4. Let the agent work.
88
+ 5. Come back later from any browser.
204
89
 
205
- ```bash
206
- pi-web-sessiond
207
- PI_WEB_PORT=8504 pi-web-server
208
- ```
90
+ ## Remote-first development
209
91
 
210
- ## Development quick start
92
+ PI WEB is designed for remote AI-driven development.
211
93
 
212
- ```bash
213
- npm install
214
- npm run dev
215
- ```
94
+ 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.
216
95
 
217
- Open the Vite URL, usually <http://localhost:8505>.
96
+ Use a private network, SSH tunnel, trusted reverse proxy, or federated PI WEB machine setup when accessing it remotely.
218
97
 
219
- During development, the static marketing/docs site is also served by the Vite dev server at <http://localhost:8505/site/>.
98
+ Read more: [Remote-first development](https://pi-web.dev/remote-first)
220
99
 
221
- For the recommended split development setup, run these in separate terminals:
100
+ ## Machines and fleets
222
101
 
223
- ```bash
224
- npm run dev:sessiond
225
- npm run dev:web
226
- npm run dev:client
227
- ```
102
+ 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.
228
103
 
229
- Or install the split development setup as native per-user services from the checkout:
104
+ Read more: [Fleet and machines guide](https://pi-web.dev/machines)
230
105
 
231
- ```bash
232
- pi-web install --dev
233
- ```
234
-
235
- `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.
106
+ ## Plugins
236
107
 
237
- `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.
108
+ PI WEB supports trusted local browser-side plugins that can add actions, workspace panels, and workspace metadata.
238
109
 
239
- ## Production-style run from a checkout
110
+ Read more: [Plugin API](https://pi-web.dev/plugins)
240
111
 
241
- ```bash
242
- npm run build
243
- npm run start:sessiond
244
- PI_WEB_PORT=8504 npm start
245
- ```
112
+ ## Configuration
246
113
 
247
- ## Packaging and publishing
114
+ Global config lives at:
248
115
 
249
- ```bash
250
- npm run verify
251
- npm run pack:dry
252
- npm publish --access public
116
+ ```text
117
+ $PI_WEB_CONFIG
118
+ ~/.config/pi-web/config.json
253
119
  ```
254
120
 
255
- `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.
256
-
257
- 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.
258
-
259
- 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.
260
-
261
-
262
- 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.
263
-
264
- The session daemon defaults to a private Unix socket at:
121
+ Project-local PI WEB config lives at:
265
122
 
266
123
  ```text
267
- ~/.pi-web/sessiond.sock
124
+ <project>/.pi-web/config.json
268
125
  ```
269
126
 
270
- Environment variables:
271
-
272
- - `PI_WEB_PORT` / `PORT` — web server port. Defaults to `8504`.
273
- - `PI_WEB_HOST` — web server bind host. Defaults to `127.0.0.1`.
274
- - `PI_WEB_DATA_DIR` — PI WEB data directory. Defaults to `~/.pi-web`.
275
- - `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`.
276
- - `PI_WEB_SESSIOND_PORT` — optional TCP port for the daemon. If unset, the daemon listens on the Unix socket instead.
277
- - `PI_WEB_SESSIOND_HOST` — daemon TCP bind host when `PI_WEB_SESSIOND_PORT` is set. Defaults to `127.0.0.1`.
278
- - `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.
279
- - `PI_WEB_PROJECTS_FILE` — optional override for the projects storage JSON file. Defaults to `$PI_WEB_DATA_DIR/projects.json`.
280
- - `PI_WEB_MACHINES_FILE` — optional override for the remote machine registry JSON file. Defaults to `$PI_WEB_DATA_DIR/machines.json`.
281
- - `PI_WEB_MAX_UPLOAD_BYTES` — maximum accepted HTTP request body size in bytes (covers pasted/attached images). Defaults to 64 MB. Also configurable as `maxUploadBytes` in `config.json`.
282
- - `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.
283
- - `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.
284
-
285
- ## Development services
286
-
287
- `pi-web install --dev` creates a practical local setup with two native per-user services:
288
-
289
- - `pi-web-sessiond` runs `npm run start:sessiond` from the checkout without autoreload.
290
- - `pi-web-ui-dev` runs `npm run dev:web` and `npm run dev:client` for API reloads, bundled plugin rebuilds, and Vite HMR.
291
-
292
- Under the hood, the native backends are systemd user services and LaunchAgents. For reference, an equivalent systemd setup looks like:
293
-
294
- ```ini
295
- # ~/.config/systemd/user/pi-web-sessiond.service
296
- [Unit]
297
- Description=PI WEB session daemon
298
-
299
- [Service]
300
- Type=simple
301
- WorkingDirectory=/srv/dev/pi-web
302
- ExecStart=/bin/bash -lc 'exec npm run start:sessiond'
303
- Restart=no
127
+ Common configuration includes host/port, path access, uploads, plugins, shortcuts, and session daemon options.
304
128
 
305
- [Install]
306
- WantedBy=default.target
307
- ```
129
+ Read more: [Configuration reference](https://pi-web.dev/config)
308
130
 
309
- ```ini
310
- # ~/.config/systemd/user/pi-web-ui-dev.service
311
- [Unit]
312
- Description=PI WEB UI dev server
313
- After=pi-web-sessiond.service
314
- Wants=pi-web-sessiond.service
315
-
316
- [Service]
317
- Type=simple
318
- WorkingDirectory=/srv/dev/pi-web
319
- ExecStart=/bin/bash -lc 'trap "kill 0" EXIT; npm run dev:web & npm run dev:client & wait'
320
- Restart=no
321
-
322
- [Install]
323
- WantedBy=default.target
324
- ```
131
+ ## Development
325
132
 
326
- On Linux servers, enable persistent user services so the user systemd manager starts at boot and remains running after logout:
133
+ Clone the repository and run:
327
134
 
328
135
  ```bash
329
- sudo loginctl enable-linger "$USER"
330
- loginctl show-user "$USER" -p Linger
136
+ npm install
137
+ npm run dev
331
138
  ```
332
139
 
333
- Install or refresh the development services with:
140
+ Open the Vite URL, usually:
334
141
 
335
- ```bash
336
- pi-web install --dev
142
+ ```text
143
+ http://localhost:8505
337
144
  ```
338
145
 
339
- Useful logs:
146
+ For the split development setup:
340
147
 
341
148
  ```bash
342
- pi-web logs
149
+ npm run dev:sessiond
150
+ npm run dev:web
151
+ npm run dev:client
343
152
  ```
344
153
 
345
- If code affecting the session daemon changes, restart it manually:
154
+ Validate changes with:
346
155
 
347
156
  ```bash
348
- pi-web restart
157
+ npm run verify
349
158
  ```
350
159
 
351
- ## Current limitations
352
-
353
- - Assumes trusted users and trusted server paths.
354
- - Not a sandbox, permission model, or secure multi-tenant platform.
355
- - Some Pi TUI slash-command behavior is not yet represented exactly in the web UI.
356
- - Workspaces are discovered from existing git worktrees; UI-driven worktree management is a natural next step.
160
+ ## Security model
357
161
 
358
- ## Vision
162
+ PI WEB assumes trusted users, trusted repositories, and trusted server paths.
359
163
 
360
- PI WEB is the beginning of an agent-first development environment:
164
+ 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.
361
165
 
362
- - agents run persistently on servers;
363
- - humans connect through the browser;
364
- - work is organized by projects, workspaces, and sessions;
365
- - the UI grows around the needs of agentic development rather than the habits of local IDEs.
166
+ ## Documentation
366
167
 
367
- 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.
168
+ - [Website](https://pi-web.dev/)
169
+ - [Install](https://pi-web.dev/install)
170
+ - [Remote-first development](https://pi-web.dev/remote-first)
171
+ - [Machines / fleet](https://pi-web.dev/machines)
172
+ - [Configuration](https://pi-web.dev/config)
173
+ - [Plugins](https://pi-web.dev/plugins)
174
+ - [FAQ](https://pi-web.dev/faq)
368
175
 
369
176
  ## License
370
177
 
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";
@@ -303,20 +303,21 @@ function restartOrder(refs) {
303
303
  return orderServiceRefs(refs, restartServiceOrder);
304
304
  }
305
305
  function productionServiceDefinitions(options, configPath, executables) {
306
+ const environment = configEnvironment(options, configPath);
306
307
  return [
307
308
  {
308
309
  ...serviceRefs.sessiond,
309
310
  description: "PI WEB session daemon",
310
311
  shellCommand: `exec ${executables.sessiond.command}`,
311
312
  restart: "on-failure",
312
- environment: {},
313
+ environment,
313
314
  },
314
315
  {
315
316
  ...serviceRefs.web,
316
317
  description: "PI WEB server",
317
318
  shellCommand: `exec ${executables.web.command}`,
318
319
  restart: "on-failure",
319
- environment: configEnvironment(options, configPath),
320
+ environment,
320
321
  after: ["sessiond"],
321
322
  wants: ["sessiond"],
322
323
  },
@@ -343,13 +344,14 @@ function validateDevCheckout(root) {
343
344
  throw new Error(`Development mode requires missing npm scripts: ${missing.join(", ")}.`);
344
345
  }
345
346
  function devServiceDefinitions(options, configPath, root) {
347
+ const environment = configEnvironment(options, configPath);
346
348
  return [
347
349
  {
348
350
  ...serviceRefs.sessiond,
349
351
  description: "PI WEB session daemon (dev)",
350
352
  shellCommand: "exec npm run start:sessiond",
351
353
  restart: "never",
352
- environment: {},
354
+ environment,
353
355
  workingDirectory: root,
354
356
  },
355
357
  {
@@ -357,7 +359,7 @@ function devServiceDefinitions(options, configPath, root) {
357
359
  description: "PI WEB UI dev server",
358
360
  shellCommand: `exec /usr/bin/env bash -c ${serviceShellQuote('trap "kill 0" EXIT; npm run dev:web & npm run dev:client & wait')}`,
359
361
  restart: "never",
360
- environment: configEnvironment(options, configPath),
362
+ environment,
361
363
  after: ["sessiond"],
362
364
  wants: ["sessiond"],
363
365
  workingDirectory: root,
@@ -773,8 +775,12 @@ function systemdUserServiceShellCommand(command, cwd) {
773
775
  function commandCheck(command) {
774
776
  return `command -v ${command}`;
775
777
  }
776
- function commandWithVersionCheck(command) {
777
- 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)`;
778
784
  }
779
785
  function nodeVersionCheck() {
780
786
  return [
@@ -965,8 +971,22 @@ async function main() {
965
971
  else
966
972
  throw new Error(`Unknown command: ${command}`);
967
973
  }
968
- main().catch((error) => {
969
- console.error(error instanceof Error ? error.message : String(error));
970
- process.exit(1);
971
- });
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
+ }
972
992
  //# sourceMappingURL=cli.js.map