@firstpick/pi-package-webui 0.7.3 → 0.7.4
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 +33 -20
- package/bin/pi-webui.mjs +203 -39
- package/index.ts +10 -1
- package/lib/git-workflow-preferences.mjs +10 -3
- package/lib/webui-output-mode.mjs +97 -0
- package/package.json +5 -5
- package/public/app.js +688 -24
- package/public/fast-output-live.mjs +179 -0
- package/public/index.html +28 -3
- package/public/service-worker.js +2 -1
- package/public/styles.css +391 -16
- package/tests/fast-mode-client-static.test.mjs +121 -0
- package/tests/fast-mode-output-work.test.mjs +69 -0
- package/tests/fast-mode-sse-harness.test.mjs +204 -0
- package/tests/fast-output-live.test.mjs +106 -0
- package/tests/fixtures/fake-pi.mjs +58 -0
- package/tests/fixtures/fast-mode-output-events.mjs +50 -0
- package/tests/git-workflow-preferences.test.mjs +8 -2
- package/tests/http-endpoints-harness.test.mjs +9 -0
- package/tests/mobile-static.test.mjs +58 -14
- package/tests/remote-auth-settings-harness.test.mjs +1 -1
- package/tests/webui-output-mode.test.mjs +73 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Local browser UI for [Pi coding agent](https://www.npmjs.com/package/@earendil-works/pi-coding-agent).
|
|
4
4
|
|
|
5
|
-

|
|
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
|
|
|
@@ -101,6 +101,7 @@ pi-webui [options] [-- <pi args...>]
|
|
|
101
101
|
--name <name> Initial Web UI tab name
|
|
102
102
|
--remote-auth Enable startup PIN authentication for non-local clients
|
|
103
103
|
--no-remote-auth Disable startup PIN authentication
|
|
104
|
+
--output-mode <mode> Web UI output default: normal or compact-v1
|
|
104
105
|
-h, --help Show help
|
|
105
106
|
-v, --version Print version
|
|
106
107
|
```
|
|
@@ -114,6 +115,7 @@ pi-webui
|
|
|
114
115
|
pi-webui --cwd ~/src/my-project
|
|
115
116
|
pi-webui --host 0.0.0.0 --remote-auth --cwd ~/src/my-project
|
|
116
117
|
pi-webui --port 3000 -- --model anthropic/claude-sonnet-4-5:high
|
|
118
|
+
pi-webui --output-mode compact-v1
|
|
117
119
|
PI_WEBUI_PI_BIN=/path/to/pi pi-webui --no-session
|
|
118
120
|
```
|
|
119
121
|
|
|
@@ -122,6 +124,7 @@ Environment variables:
|
|
|
122
124
|
- `PI_WEBUI_HOST` and `PI_WEBUI_PORT` set the default bind address.
|
|
123
125
|
- `PI_WEBUI_PI_BIN=/path/to/pi` selects the Pi executable when `--pi` is not passed.
|
|
124
126
|
- `PI_WEBUI_REMOTE_AUTH=1` starts with Remote PIN authentication enabled.
|
|
127
|
+
- `PI_WEBUI_OUTPUT_MODE=normal|compact-v1` sets the server default for newly auto-negotiated browser connections.
|
|
125
128
|
- Pi Web UI automatically injects a loopback `PI_WEBUI_RECOVERY_URL` and a bearer `PI_WEBUI_RECOVERY_TOKEN` into spawned Pi RPC processes. The authenticated endpoint can only create a separate plan-only recovery tab; keep any manually supplied token private.
|
|
126
129
|
- `PI_WEBUI_SETTINGS_FILE=/path/to/settings.json` overrides persisted Web UI settings such as Remote PIN auth, guided Git preferences, and global Tools/Skills defaults.
|
|
127
130
|
- `PI_WEBUI_OPTIONAL_FEATURE_INSTALL_ROOT=/path/to/package-root` overrides the npm prefix used for optional companion installs.
|
|
@@ -130,6 +133,16 @@ Environment variables:
|
|
|
130
133
|
- `PI_BANG_AUTOCOMPLETE_INCLUDE_HISTORY=1` lets optional bang-command autocomplete include local fish/bash/zsh history executables.
|
|
131
134
|
- `PI_BANG_AUTOCOMPLETE_RUNTIME_STORE_PATH=/path/to/runtime.json` overrides the runtime store shared with `@firstpick/pi-extension-bang-command-autocomplete`.
|
|
132
135
|
|
|
136
|
+
### Compact live output mode
|
|
137
|
+
|
|
138
|
+
Normal output is the default. In the sidebar, open **Controls → Output processing**, select **Fast**, and click **Apply**. The same persisted server default is also available under **Settings → Browser workflow → Output processing**. Alternatively, set `--output-mode compact-v1`, `PI_WEBUI_OUTPUT_MODE=compact-v1`, or `outputModeDefault` directly. Precedence is explicit CLI flag, then environment variable, then the persisted setting, then `normal`.
|
|
139
|
+
|
|
140
|
+
The browser negotiates compact-v1 per EventSource connection (`outputMode=auto&outputModeProtocol=1`), so normal and compact clients can share one Pi tab. A browser only enables compact handling after the protocol-1 acknowledgement; an older server gets one normal-mode reconnect instead. The server default applies only to `auto` clients, and active auto streams change representation at a semantic boundary.
|
|
141
|
+
|
|
142
|
+
Compact mode keeps live text and thinking as plain text, coalesces sustained live DOM/scroll flushes to at most once every 100 ms, and uses lightweight tool shells. It then reconciles with the existing final `/api/messages` transcript to restore Markdown, thinking formatting, and full tool cards. It does not change Pi generation, prompts, tools, models, providers, inference, final transcript semantics, or the normal renderer.
|
|
143
|
+
|
|
144
|
+
The included fast-mode metric measures deterministic post-parse serialized JSON byte-work only (`R + 2×S`) and semantic parity; it does not claim wall-clock improvement, lower DOM CPU, reduced network latency, or higher model token/s.
|
|
145
|
+
|
|
133
146
|
Optional Natural Conversation server-side voice fallback variables:
|
|
134
147
|
|
|
135
148
|
- `PI_VOICE_STT_URL` enables a local STT endpoint for `POST /api/stt/transcribe`; Web UI forwards audio as multipart form data.
|
|
@@ -200,70 +213,70 @@ These screenshots show the v0.4.8 Web UI surfaces. Current implementations inclu
|
|
|
200
213
|
|
|
201
214
|
### Main window
|
|
202
215
|
|
|
203
|
-

|
|
204
217
|
|
|
205
218
|
- **What it is:** The primary Web UI workspace for Pi, with terminal tabs, chat transcript, live assistant output, footer metrics, prompt composer, attachments, and side-panel controls in one browser view.
|
|
206
219
|
- **What you can do:** Run multiple Pi sessions, send prompts or follow-ups, monitor tokens/cache/cost/context/git/model state, attach files, launch quick actions, and control the active session without returning to the terminal.
|
|
207
220
|
|
|
208
221
|
### Workspace dashboard
|
|
209
222
|
|
|
210
|
-

|
|
211
224
|
|
|
212
225
|
- **What it is:** The project home base for an active Web UI tab, combining cwd, model, context, git, queue, session, and activity status.
|
|
213
226
|
- **What you can do:** Start or resume work, verify the tab is pointed at the right project, jump into common session/workspace actions, and spot queued or active work before prompting.
|
|
214
227
|
|
|
215
228
|
### Control panel
|
|
216
229
|
|
|
217
|
-

|
|
218
231
|
|
|
219
232
|
- **What it is:** The side rail for Web UI state and settings, including model, thinking effort, session/workspace controls, theme, optional companions, Remote WebUI, updates, notifications, and usage widgets.
|
|
220
233
|
- **What you can do:** Change model or effort, compact/manage sessions, toggle notifications, check or install optional packages, run confirmed updates/restarts, and manage remote/PIN controls when the remote companion is loaded.
|
|
221
234
|
|
|
222
235
|
### Working-directory picker
|
|
223
236
|
|
|
224
|
-

|
|
225
238
|
|
|
226
239
|
- **What it is:** A browser-native cwd chooser used at first launch and for per-tab working-directory changes.
|
|
227
240
|
- **What you can do:** Search and browse project paths, choose recent or saved directories, create a new directory, and start or move a Pi tab into the selected workspace.
|
|
228
241
|
|
|
229
242
|
### App runners
|
|
230
243
|
|
|
231
|
-

|
|
232
245
|
|
|
233
246
|
- **What it is:** A project runner detector for common stacks plus browseable custom runners from `.pi-webui-runners.json`.
|
|
234
247
|
- **What you can do:** Launch dev servers, tests, builds, scripts, and custom commands from the active cwd, pass arguments, watch pinned live output, and send line-oriented stdin to interactive runners. Windows runners use ConPTY through the optional `node-pty` dependency so Bash/Node scripts receive a real TTY; set `PI_WEBUI_APP_RUNNER_PTY=off` to force the pipe fallback.
|
|
235
248
|
|
|
236
249
|
### Queue manager
|
|
237
250
|
|
|
238
|
-

|
|
239
252
|
|
|
240
253
|
- **What it is:** The queue surface for follow-up prompts, steering messages, user bash work, and loaded prompt lists while a tab is busy or ready.
|
|
241
254
|
- **What you can do:** Create or load prompt lists, run batches when supported, see pending queued messages, and decide whether prompts sent during an active run should steer the current agent or wait as follow-ups.
|
|
242
255
|
|
|
243
256
|
### Thinking effort picker
|
|
244
257
|
|
|
245
|
-

|
|
246
259
|
|
|
247
260
|
- **What it is:** A browser picker for Pi's model thinking/reasoning effort setting.
|
|
248
261
|
- **What you can do:** Switch between `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`, confirm the effective effort in the footer, and tune speed/cost/quality before sending a prompt.
|
|
249
262
|
|
|
250
263
|
### Scoped models
|
|
251
264
|
|
|
252
|
-

|
|
253
266
|
|
|
254
267
|
- **What it is:** A Web UI editor for `/scoped-models`, project/global model scope rules, and model cycling order.
|
|
255
268
|
- **What you can do:** Search available models, enable or disable scoped entries, inspect the effective model source, and save model choices so future prompts and tabs use the intended provider/model.
|
|
256
269
|
|
|
257
270
|
### Tools setup
|
|
258
271
|
|
|
259
|
-

|
|
260
273
|
|
|
261
274
|
- **What it is:** A browser-native `/tools` setup dialog for active and available Pi tools.
|
|
262
275
|
- **What you can do:** Search tools, inspect descriptions and availability, then use **Session only** to change the current branch immediately or **Global default** to save the tool allowlist inherited by future sessions.
|
|
263
276
|
|
|
264
277
|
### Skills setup
|
|
265
278
|
|
|
266
|
-

|
|
267
280
|
|
|
268
281
|
- **What it is:** A browser-native `/skills` setup dialog for skills available in the active Pi tab.
|
|
269
282
|
- **What you can do:** Find skills by name or description, then use **Session only** to change automatic invocation on the current branch or **Global default** to save the skill allowlist inherited by future sessions.
|
|
@@ -272,49 +285,49 @@ Session-specific choices always win when their branch is resumed or selected in
|
|
|
272
285
|
|
|
273
286
|
### Optional features
|
|
274
287
|
|
|
275
|
-

|
|
276
289
|
|
|
277
290
|
- **What it is:** A companion-package manager for Web UI-aware extensions, prompts, themes, and optional dashboards.
|
|
278
291
|
- **What you can do:** See whether each companion is enabled, disabled, installed-but-not-loaded, missing, or updateable; install/update known packages from localhost; and reload affected tabs when a feature becomes available.
|
|
279
292
|
|
|
280
293
|
### `/btw` side questions
|
|
281
294
|
|
|
282
|
-

|
|
283
296
|
|
|
284
297
|
- **What it is:** A Web UI widget for the optional `/btw` side-question extension, keeping quick questions separate from the main agent flow.
|
|
285
298
|
- **What you can do:** Ask short side questions without derailing the main chat, inspect live output, steer or stop the side thread, and transfer useful context back into the main prompt when needed.
|
|
286
299
|
|
|
287
300
|
### Guided Git workflow
|
|
288
301
|
|
|
289
|
-

|
|
290
303
|
|
|
291
304
|
- **What it is:** A guided browser workflow for staging changes, generating commit messages, committing, pushing, and optionally creating a pull request.
|
|
292
305
|
- **What you can do:** Run the stage/message/commit/push steps, choose generated short or long commit messages, type a manual message, create or confirm PR branch names, review generated PR text, and push only after confirmation.
|
|
293
306
|
|
|
294
307
|
### Git branch picker
|
|
295
308
|
|
|
296
|
-

|
|
297
310
|
|
|
298
311
|
- **What it is:** A footer branch picker backed by the active tab's current Git repository.
|
|
299
312
|
- **What you can do:** View the current branch/repo, switch local branches, create and switch to a new branch, and get warnings when a branch change could affect active agent work.
|
|
300
313
|
|
|
301
314
|
### Git diff viewer
|
|
302
315
|
|
|
303
|
-

|
|
304
317
|
|
|
305
318
|
- **What it is:** A browser diff dialog for current Git changes in the active workspace.
|
|
306
319
|
- **What you can do:** Review staged, unstaged, untracked, and incoming changes; jump between files; see additions/deletions with line numbers; and inspect text previews before asking Pi to edit, commit, or create a PR.
|
|
307
320
|
|
|
308
321
|
### Codex usage
|
|
309
322
|
|
|
310
|
-

|
|
311
324
|
|
|
312
325
|
- **What it is:** A side-panel usage widget for Codex-family subscription-backed models.
|
|
313
326
|
- **What you can do:** Refresh usage, monitor short-window and weekly limits, see reset timing, and decide whether to switch models or delay large prompts.
|
|
314
327
|
|
|
315
328
|
### Pi stats dashboard
|
|
316
329
|
|
|
317
|
-

|
|
318
331
|
|
|
319
332
|
- **What it is:** The browser overlay from the optional stats companion, summarizing token, cost, cache, prompt/context, model, session, and command usage.
|
|
320
333
|
- **What you can do:** Filter by time range, refresh analytics, review daily/model/session breakdowns, inspect cost and cache behavior, and calibrate prompt estimates for more accurate local usage visibility.
|
|
@@ -359,7 +372,7 @@ Run `../dev/scripts/sync-pi-package-symlinks.sh` first when developing companion
|
|
|
359
372
|
|
|
360
373
|
A normal Pi/npm install includes the published 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.
|
|
361
374
|
|
|
362
|
-
`@firstpick/pi-extension-aur-review` is intentionally not bundled with this WebUI release until it is published. From this workspace, install it locally with `pi install /home/firstpick/
|
|
375
|
+
`@firstpick/pi-extension-aur-review` is intentionally not bundled with this WebUI release until it is published. From this workspace, install it locally with `pi install /home/firstpick/pi-coding-agent-forge/pi-extension-aur-review`, then reload the affected Pi/WebUI tab. `pi install npm:@firstpick/pi-extension-aur-review` becomes valid only after that package is published to npm.
|
|
363
376
|
|
|
364
377
|
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.
|
|
365
378
|
|
|
@@ -372,7 +385,7 @@ Optional companions:
|
|
|
372
385
|
- `@firstpick/pi-prompts-git-pr` — guided Git commit/push workflow.
|
|
373
386
|
- `@firstpick/pi-extension-release-npm` — NPM publish menu and release widgets.
|
|
374
387
|
- `@firstpick/pi-extension-release-aur` — AUR publish menu and release widgets.
|
|
375
|
-
- `@firstpick/pi-extension-aur-review` — Deterministic manual repository/Git review with working-tree standalone snapshots, staged Guided Git snapshots, and a specialized browser card. Install from `/home/firstpick/
|
|
388
|
+
- `@firstpick/pi-extension-aur-review` — Deterministic manual repository/Git review with working-tree standalone snapshots, staged Guided Git snapshots, and a specialized browser card. Install from `/home/firstpick/pi-coding-agent-forge/pi-extension-aur-review` locally for now; npm installation is valid only after publication.
|
|
376
389
|
- `@firstpick/pi-extension-workflows` — `/workflow` runtime with non-blocking Web UI subprocess-output widgets.
|
|
377
390
|
- `@firstpick/pi-extension-safety-guard` — configurable guardrails for dangerous bash commands and protected file edits, with native `/safety-guard-setup` controls.
|
|
378
391
|
- `@firstpick/pi-extension-setup-skills` — TUI `/skills` setup command alongside WebUI-native skill toggles.
|