@firstpick/pi-package-webui 0.7.3 → 0.7.5
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 +34 -20
- package/bin/pi-webui.mjs +332 -39
- package/index.ts +10 -1
- package/lib/git-workflow-preferences.mjs +91 -22
- package/lib/subagent-launch-slots.mjs +304 -0
- package/lib/trust-boundaries.mjs +1 -0
- package/lib/webui-output-mode.mjs +97 -0
- package/package.json +22 -22
- package/public/app.js +1629 -69
- package/public/fast-output-live.mjs +179 -0
- package/public/index.html +86 -12
- package/public/service-worker.js +3 -1
- package/public/styles.css +769 -37
- package/public/subagent-launch-slot-state.mjs +64 -0
- package/tests/chat-scroll-intent-static.test.mjs +59 -0
- package/tests/custom-message-markdown-static.test.mjs +15 -0
- package/tests/fast-mode-client-static.test.mjs +169 -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/footer-middle-truncation.test.mjs +2 -2
- package/tests/git-workflow-preferences.test.mjs +8 -2
- package/tests/http-endpoints-harness.test.mjs +74 -0
- package/tests/mobile-static.test.mjs +86 -15
- package/tests/remote-auth-settings-harness.test.mjs +1 -1
- package/tests/side-panel-resize-static.test.mjs +43 -0
- package/tests/subagent-launch-slot-state.test.mjs +36 -0
- package/tests/subagent-launch-slots-static.test.mjs +34 -0
- package/tests/subagent-launch-slots.test.mjs +143 -0
- package/tests/subagents-helper.test.mjs +46 -0
- package/tests/webui-output-mode.test.mjs +73 -0
- package/webui-rpc-helper.mjs +37 -9
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
|
+
Fast mode keeps live output lightweight, coalesces sustained live DOM/scroll flushes to at most once every 100 ms, preserves Markdown formatting for live and reconciled thinking, and displays only the current transient tool status as a compact labeled row with a state pill; each new tool or assistant delta replaces that status instead of retaining a tool-call history. Final reconciliation keeps visible thinking formatted and renders the final assistant response as Markdown while omitting intermediate tool calls, results, diffs, images, and raw details. The existing final `/api/messages` transcript remains authoritative. Fast mode does not change Pi generation, prompts, tools, models, providers, inference, stored 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.
|
|
@@ -143,6 +156,7 @@ Optional Natural Conversation server-side voice fallback variables:
|
|
|
143
156
|
|
|
144
157
|
- Pathless `pi-webui` startup: the server opens first, then the browser prompts for the first terminal CWD.
|
|
145
158
|
- Multi-tab Pi sessions with isolated processes, working directories, prompt drafts, activity state, per-tab settings, and a workspace dashboard for common actions.
|
|
159
|
+
- The Subagents side panel includes a separate **Agent models** editor above the live monitor. It stores WebUI-owned launch slots for the eight builtin roles (`context-builder`, `delegate`, `oracle`, `planner`, `researcher`, `reviewer`, `scout`, and `worker`): every role keeps a non-removable base slot, while added same-role slots copy a model/thinking draft but retain independent stable IDs. Choose **User default** or **This project**; projects inherit user defaults until saved, and **Use user defaults** removes a project override. Select `Default / inherit` to inherit both values, or an active-tab provider-qualified model and its supported thinking levels. Saves are revision-checked and localhost-only; saved assignments guide only future delegation after **Reload active tab**, never running children. The configuration form has independent load/draft/error state, so its controls are not reset by live subagent monitoring.
|
|
146
160
|
- Tracked subagent output can open in the existing non-blocking overlay/widget or in a dedicated **Subagent** terminal tab, selected from the Subagents side-panel section and saved in the browser. Side-panel rows and both output views show the effective model and reasoning effort (or an explicit `unknown` for legacy metadata). Subagent tabs are view-only, reuse the bounded live transcript at the normal full terminal width, show the pulsing **Agent is running:** card with current child activity, and close without stopping or interrupting the child run; use the parent terminal for interaction. The package also registers a generic `subagent_gate` tool that launches task slots through pi-subagents RPC v1, enforces a required success quorum, and performs bounded reason-aware retries only when declared safe; the side panel retains gate quorum, attempt, provider, and failure-class history after children finish.
|
|
147
161
|
- Unified command palette (`Ctrl/Cmd+K`) for commands, tabs, models, sessions, settings, app controls, and frequent Web UI actions.
|
|
148
162
|
- Automatic tab naming from the first prompt, with `--name <name>` still available for an explicit initial tab name.
|
|
@@ -200,70 +214,70 @@ These screenshots show the v0.4.8 Web UI surfaces. Current implementations inclu
|
|
|
200
214
|
|
|
201
215
|
### Main window
|
|
202
216
|
|
|
203
|
-

|
|
204
218
|
|
|
205
219
|
- **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
220
|
- **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
221
|
|
|
208
222
|
### Workspace dashboard
|
|
209
223
|
|
|
210
|
-

|
|
211
225
|
|
|
212
226
|
- **What it is:** The project home base for an active Web UI tab, combining cwd, model, context, git, queue, session, and activity status.
|
|
213
227
|
- **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
228
|
|
|
215
229
|
### Control panel
|
|
216
230
|
|
|
217
|
-

|
|
218
232
|
|
|
219
233
|
- **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
234
|
- **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
235
|
|
|
222
236
|
### Working-directory picker
|
|
223
237
|
|
|
224
|
-

|
|
225
239
|
|
|
226
240
|
- **What it is:** A browser-native cwd chooser used at first launch and for per-tab working-directory changes.
|
|
227
241
|
- **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
242
|
|
|
229
243
|
### App runners
|
|
230
244
|
|
|
231
|
-

|
|
232
246
|
|
|
233
247
|
- **What it is:** A project runner detector for common stacks plus browseable custom runners from `.pi-webui-runners.json`.
|
|
234
248
|
- **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
249
|
|
|
236
250
|
### Queue manager
|
|
237
251
|
|
|
238
|
-

|
|
239
253
|
|
|
240
254
|
- **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
255
|
- **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
256
|
|
|
243
257
|
### Thinking effort picker
|
|
244
258
|
|
|
245
|
-

|
|
246
260
|
|
|
247
261
|
- **What it is:** A browser picker for Pi's model thinking/reasoning effort setting.
|
|
248
262
|
- **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
263
|
|
|
250
264
|
### Scoped models
|
|
251
265
|
|
|
252
|
-

|
|
253
267
|
|
|
254
268
|
- **What it is:** A Web UI editor for `/scoped-models`, project/global model scope rules, and model cycling order.
|
|
255
269
|
- **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
270
|
|
|
257
271
|
### Tools setup
|
|
258
272
|
|
|
259
|
-

|
|
260
274
|
|
|
261
275
|
- **What it is:** A browser-native `/tools` setup dialog for active and available Pi tools.
|
|
262
276
|
- **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
277
|
|
|
264
278
|
### Skills setup
|
|
265
279
|
|
|
266
|
-

|
|
267
281
|
|
|
268
282
|
- **What it is:** A browser-native `/skills` setup dialog for skills available in the active Pi tab.
|
|
269
283
|
- **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 +286,49 @@ Session-specific choices always win when their branch is resumed or selected in
|
|
|
272
286
|
|
|
273
287
|
### Optional features
|
|
274
288
|
|
|
275
|
-

|
|
276
290
|
|
|
277
291
|
- **What it is:** A companion-package manager for Web UI-aware extensions, prompts, themes, and optional dashboards.
|
|
278
292
|
- **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
293
|
|
|
280
294
|
### `/btw` side questions
|
|
281
295
|
|
|
282
|
-

|
|
283
297
|
|
|
284
298
|
- **What it is:** A Web UI widget for the optional `/btw` side-question extension, keeping quick questions separate from the main agent flow.
|
|
285
299
|
- **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
300
|
|
|
287
301
|
### Guided Git workflow
|
|
288
302
|
|
|
289
|
-

|
|
290
304
|
|
|
291
305
|
- **What it is:** A guided browser workflow for staging changes, generating commit messages, committing, pushing, and optionally creating a pull request.
|
|
292
306
|
- **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
307
|
|
|
294
308
|
### Git branch picker
|
|
295
309
|
|
|
296
|
-

|
|
297
311
|
|
|
298
312
|
- **What it is:** A footer branch picker backed by the active tab's current Git repository.
|
|
299
313
|
- **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
314
|
|
|
301
315
|
### Git diff viewer
|
|
302
316
|
|
|
303
|
-

|
|
304
318
|
|
|
305
319
|
- **What it is:** A browser diff dialog for current Git changes in the active workspace.
|
|
306
320
|
- **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
321
|
|
|
308
322
|
### Codex usage
|
|
309
323
|
|
|
310
|
-

|
|
311
325
|
|
|
312
326
|
- **What it is:** A side-panel usage widget for Codex-family subscription-backed models.
|
|
313
327
|
- **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
328
|
|
|
315
329
|
### Pi stats dashboard
|
|
316
330
|
|
|
317
|
-

|
|
318
332
|
|
|
319
333
|
- **What it is:** The browser overlay from the optional stats companion, summarizing token, cost, cache, prompt/context, model, session, and command usage.
|
|
320
334
|
- **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 +373,7 @@ Run `../dev/scripts/sync-pi-package-symlinks.sh` first when developing companion
|
|
|
359
373
|
|
|
360
374
|
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
375
|
|
|
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/
|
|
376
|
+
`@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
377
|
|
|
364
378
|
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
379
|
|
|
@@ -372,7 +386,7 @@ Optional companions:
|
|
|
372
386
|
- `@firstpick/pi-prompts-git-pr` — guided Git commit/push workflow.
|
|
373
387
|
- `@firstpick/pi-extension-release-npm` — NPM publish menu and release widgets.
|
|
374
388
|
- `@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/
|
|
389
|
+
- `@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
390
|
- `@firstpick/pi-extension-workflows` — `/workflow` runtime with non-blocking Web UI subprocess-output widgets.
|
|
377
391
|
- `@firstpick/pi-extension-safety-guard` — configurable guardrails for dangerous bash commands and protected file edits, with native `/safety-guard-setup` controls.
|
|
378
392
|
- `@firstpick/pi-extension-setup-skills` — TUI `/skills` setup command alongside WebUI-native skill toggles.
|