@firstpick/pi-package-webui 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -9
- package/bin/pi-webui.mjs +415 -29
- package/index.ts +16 -1
- package/lib/trust-boundaries.mjs +1 -0
- package/package.json +1 -1
- package/public/app.js +766 -47
- package/public/index.html +44 -1
- package/public/styles.css +516 -4
- package/tests/http-endpoints-harness.test.mjs +97 -1
- package/tests/mobile-static.test.mjs +21 -10
- package/tests/session-auth-harness.test.mjs +4 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Local browser UI for [Pi coding agent](https://www.npmjs.com/package/@earendil-w
|
|
|
6
6
|
|
|
7
7
|
Pi Web UI gives you a local browser companion for Pi: multi-tab chat, streaming output, model controls, uploads, slash-command helpers, workspace navigation, and optional extension widgets.
|
|
8
8
|
|
|
9
|
-
> **Security:** Pi Web UI
|
|
9
|
+
> **Security:** Pi Web UI can control the spawned Pi session and run anything that session is allowed to run. It binds to `127.0.0.1` by default. Remote PIN authentication is off by default; enable it in **Controls → Network → Remote PIN auth** before exposing it on trusted networks.
|
|
10
10
|
|
|
11
11
|
## Requirements
|
|
12
12
|
|
|
@@ -54,6 +54,8 @@ Check a running Web UI with:
|
|
|
54
54
|
--no-open Do not open the browser automatically
|
|
55
55
|
--no-session Start Pi RPC with --no-session
|
|
56
56
|
--name <name> Initial Web UI tab name
|
|
57
|
+
--remote-auth Enable startup PIN authentication for non-local clients
|
|
58
|
+
--no-remote-auth Disable startup PIN authentication
|
|
57
59
|
-- <pi args...> Extra arguments forwarded to Pi RPC
|
|
58
60
|
```
|
|
59
61
|
|
|
@@ -63,6 +65,7 @@ Examples:
|
|
|
63
65
|
/webui-start
|
|
64
66
|
/webui-start 31500
|
|
65
67
|
/webui-start --port 31500 --no-open
|
|
68
|
+
/webui-start --remote-auth --host 0.0.0.0
|
|
66
69
|
/webui-start --name browser -- --model anthropic/claude-sonnet-4-5:high
|
|
67
70
|
```
|
|
68
71
|
|
|
@@ -74,7 +77,7 @@ Running `/webui-start` again on the same URL restarts the server and restores cu
|
|
|
74
77
|
/webui-status [detailed] [port] [--port N] [--host HOST]
|
|
75
78
|
```
|
|
76
79
|
|
|
77
|
-
`/webui-status` reports the URL, online state, and
|
|
80
|
+
`/webui-status` reports the URL, online state, network exposure, and Remote PIN auth state. `detailed` adds tabs, sessions, models/providers, and recent backend events.
|
|
78
81
|
|
|
79
82
|
## Standalone CLI
|
|
80
83
|
|
|
@@ -96,6 +99,8 @@ pi-webui [options] [-- <pi args...>]
|
|
|
96
99
|
--pi <command> Pi executable to spawn (default: bundled dependency, then "pi")
|
|
97
100
|
--no-session Start Pi RPC with --no-session
|
|
98
101
|
--name <name> Initial Web UI tab name
|
|
102
|
+
--remote-auth Enable startup PIN authentication for non-local clients
|
|
103
|
+
--no-remote-auth Disable startup PIN authentication
|
|
99
104
|
-h, --help Show help
|
|
100
105
|
-v, --version Print version
|
|
101
106
|
```
|
|
@@ -107,6 +112,7 @@ Examples:
|
|
|
107
112
|
```bash
|
|
108
113
|
pi-webui
|
|
109
114
|
pi-webui --cwd ~/src/my-project
|
|
115
|
+
pi-webui --host 0.0.0.0 --remote-auth --cwd ~/src/my-project
|
|
110
116
|
pi-webui --port 3000 -- --model anthropic/claude-sonnet-4-5:high
|
|
111
117
|
PI_WEBUI_PI_BIN=/path/to/pi pi-webui --no-session
|
|
112
118
|
```
|
|
@@ -116,16 +122,19 @@ Environment variables:
|
|
|
116
122
|
- `PI_WEBUI_HOST`
|
|
117
123
|
- `PI_WEBUI_PORT`
|
|
118
124
|
- `PI_WEBUI_PI_BIN`
|
|
125
|
+
- `PI_WEBUI_REMOTE_AUTH=1` to start with remote PIN authentication enabled
|
|
119
126
|
|
|
120
127
|
## Main features
|
|
121
128
|
|
|
122
129
|
- Pathless `pi-webui` startup: the server opens first, then the browser prompts for the first terminal CWD.
|
|
123
|
-
- Multi-tab Pi sessions with isolated processes, working directories, prompt drafts, and
|
|
130
|
+
- Multi-tab Pi sessions with isolated processes, working directories, prompt drafts, activity state, and a workspace dashboard for common actions.
|
|
131
|
+
- Unified command palette (`Ctrl/Cmd+K`) for commands, tabs, models, sessions, settings, and frequent Web UI actions.
|
|
124
132
|
- Automatic tab naming from the first prompt, with `--name <name>` still available for an explicit initial tab name.
|
|
125
|
-
- Streaming chat transcript with Markdown, thinking output, tool/bash cards, queue and compaction events, and abort controls.
|
|
133
|
+
- Streaming chat transcript with Markdown, thinking output, tool/bash cards, queue and compaction events, edit-and-retry from user prompts, and abort controls.
|
|
126
134
|
- Prompt composer with uploads, drag/drop/paste, inline image support, slash-command autocomplete, and `@` file/path references with live suggestions.
|
|
127
135
|
- Browser dialogs for common Pi selectors such as `/model`, `/settings`, `/theme`, `/fork`, `/clone`, `/resume`, `/tree`, `/scoped-models`, `/tools`, and `/skills`.
|
|
128
136
|
- Model, thinking, session, workspace, theme, optional-feature, Codex usage, network, update/restart, event, and notification controls in the side panel.
|
|
137
|
+
- Persistent context-window meter with manual compact and auto-compaction controls near the composer.
|
|
129
138
|
- Side-panel theme picker backed by optional `@firstpick/pi-themes-bundle` themes when loaded.
|
|
130
139
|
- Per-tab cwd changes, a clickable footer cwd picker, saved path fast picks, server-persisted fast picks, and restart-safe restoration of open tabs.
|
|
131
140
|
- Detected app runner dropdown for the active tab cwd, including Cargo, Bun, npm/npx/pnpm, Python/uv, Go/Golang, Zig, C/C++, Docker Compose, root/dev/scripts shell scripts, and other common project runners with live output pinned at the top of the terminal. Projects can add browseable custom runners in `.pi-webui-runners.json` with a command (default `./`) plus a relative path to the file to run.
|
|
@@ -138,8 +147,10 @@ Useful browser endpoints exposed by the local server include:
|
|
|
138
147
|
|
|
139
148
|
- `GET /api/path-suggestions?tab=<tabId>&query=<path>` for `@` file/path references with live suggestions.
|
|
140
149
|
- `POST /api/action-feedback?tab=<tabId>` for feedback on final assistant output and action cards.
|
|
141
|
-
- `
|
|
150
|
+
- `GET /api/optional-features` for optional companion package install/update status.
|
|
151
|
+
- `POST /api/optional-feature-install` for installing or updating known optional companion packages from the side panel.
|
|
142
152
|
- `GET /api/update-status` and localhost-only `POST /api/update` for checking Pi/Web UI updates and running `pi update` plus all detected local/global Web UI and Pi package-manager updates followed by a Web UI server restart.
|
|
153
|
+
- `GET /api/remote-auth`, `POST /api/remote-auth`, and localhost-only `POST /api/remote-auth/settings` for optional 4-digit PIN authentication when serving non-local browser clients.
|
|
143
154
|
|
|
144
155
|
For local development, run the checkout helper directly, for example:
|
|
145
156
|
|
|
@@ -151,9 +162,9 @@ Run `../dev/scripts/sync-pi-package-symlinks.sh` first when developing companion
|
|
|
151
162
|
|
|
152
163
|
## Optional companion packages
|
|
153
164
|
|
|
154
|
-
A normal Pi/npm install includes the optional companion packages unless optional dependencies are disabled. Each Web UI tab curates Pi resources from the Web UI package that started the server, while preserving unrelated user/project resources
|
|
165
|
+
A normal Pi/npm install includes the optional companion packages unless optional dependencies are disabled. Each Web UI tab curates Pi resources from the Web UI package that started the server, while preserving unrelated user/project resources. Companion packages installed as global/npm-prefix siblings of the started Web UI package are reused when the Web UI package does not have its own nested optional dependency copy, avoiding duplicate loads while keeping global `pi-webui` launches working. Startup checks loaded Pi capabilities directly through RPC-visible commands and live widget events, then the side panel shows each optional feature as enabled, disabled, installed-but-not-loaded, update-available, or install-needed. Installing or updating a feature is an explicit, warned action with running/failure feedback in the row and activity log; it is localhost-only, limited to known packages, and requires reloading the active Pi tab after installation.
|
|
155
166
|
|
|
156
|
-
When the standalone global `pi-webui` launcher is used, optional companion installs
|
|
167
|
+
When the standalone global `pi-webui` launcher is used, optional companion installs target the npm prefix containing the Web UI package when that prefix is safe, otherwise the Pi agent npm root if it contains Web UI. Override the target explicitly with `PI_WEBUI_OPTIONAL_FEATURE_INSTALL_ROOT=/path/to/package-root` when needed.
|
|
157
168
|
|
|
158
169
|
Optional companions:
|
|
159
170
|
|
|
@@ -194,8 +205,11 @@ This requires `/git-staged-msg` and `/pr` from `@firstpick/pi-prompts-git-pr`; b
|
|
|
194
205
|
|
|
195
206
|
- Default bind is localhost-only: `127.0.0.1:31415`.
|
|
196
207
|
- The side-panel **Open to network** button rebinds the server to `0.0.0.0`, shows LAN URLs when available, and toggles to "Close for network".
|
|
197
|
-
-
|
|
198
|
-
-
|
|
208
|
+
- The side-panel **Remote PIN auth** toggle is off by default. When enabled, the server generates a random 4-digit PIN, shows it in Controls and `/webui-status`, and requires it from non-local browser clients.
|
|
209
|
+
- Localhost clients stay frictionless and can toggle Remote PIN auth; changing the toggle disconnects existing event streams so remote clients must re-authenticate after enablement.
|
|
210
|
+
- `--host 0.0.0.0` also exposes the Web UI to the local network; pass `--remote-auth` to start with PIN auth already enabled.
|
|
211
|
+
- Any connected browser client with access (and the PIN, if enabled) can control Pi and run Web UI bash actions as the Web UI process user.
|
|
212
|
+
- Remote PIN auth is a simple trusted-LAN HTTP gate, not hardened multi-user authentication; do not expose it to untrusted networks.
|
|
199
213
|
- The Web UI update endpoint is restricted to localhost, because it runs package update commands and restarts the server.
|
|
200
214
|
- Treat Pi Web UI as a local companion, not a hardened multi-user web service.
|
|
201
215
|
|
|
@@ -204,4 +218,5 @@ This requires `/git-staged-msg` and `/pr` from `@firstpick/pi-prompts-git-pr`; b
|
|
|
204
218
|
- **`/webui-start` is missing:** restart Pi after installing the package.
|
|
205
219
|
- **Wrong port or existing server:** use `/webui-status detailed`, or start on another port with `/webui-start --port 31500`.
|
|
206
220
|
- **Optional feature is disabled or missing:** check the side panel, install the companion package if needed, then run `/reload` in the active Pi tab.
|
|
221
|
+
- **Remote browser asks for a PIN:** read it from **Controls → Network → Remote PIN auth**, `/webui-status`, or the local Web UI server log. Disable the toggle from localhost to remove the PIN gate.
|
|
207
222
|
- **PWA install or notifications are unavailable:** use `localhost` or HTTPS; browser support varies on LAN HTTP URLs.
|