@firstpick/pi-package-webui 0.1.2 → 0.1.3
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 +16 -9
- package/bin/pi-webui.mjs +1039 -33
- package/index.ts +136 -29
- package/package.json +3 -2
- package/public/app.js +2419 -132
- package/public/index.html +13 -3
- package/public/service-worker.js +13 -1
- package/public/styles.css +669 -124
- package/tests/mobile-static.test.mjs +202 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Local browser companion for [Pi coding agent](https://www.npmjs.com/package/@ear
|
|
|
5
5
|
This package provides:
|
|
6
6
|
|
|
7
7
|
- `pi-webui`: a local HTTP/SSE server that starts `pi --mode rpc`, serves the static browser UI, and proxies browser actions to Pi RPC commands.
|
|
8
|
-
- `/webui-start
|
|
8
|
+
- `/webui-start` (alias: `/start-webui`): a Pi slash command that launches `pi-webui` for the current Pi working directory and opens the browser.
|
|
9
9
|
- `/webui-status`: a Pi slash command that reports the Web UI URL, online state, network exposure, and optional detailed runtime info.
|
|
10
10
|
- A no-build web app in `public/` with no runtime frontend dependencies.
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ This package provides:
|
|
|
19
19
|
|
|
20
20
|
## Quick start
|
|
21
21
|
|
|
22
|
-
Install the package from npm into Pi, then restart Pi so `/webui-start` and `/webui-status` are loaded:
|
|
22
|
+
Install the package from npm into Pi, then restart Pi so `/webui-start` (also available as `/start-webui`) and `/webui-status` are loaded:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
pi install npm:@firstpick/pi-package-webui
|
|
@@ -50,18 +50,22 @@ pi-webui --cwd /path/to/project
|
|
|
50
50
|
|
|
51
51
|
- Browser chat with Pi over RPC
|
|
52
52
|
- Isolated terminal tabs: each Web UI tab starts its own separate `pi --mode rpc` subprocess, event stream, session state, and prompt draft
|
|
53
|
+
- Automatic tab naming from the first prompt on default-named tabs, plus `/name <title>` to manually sync the Pi session and browser tab name
|
|
54
|
+
- Per-tab activity indicators for idle, working, blocked, and completed unseen work, with browser notifications when a tab needs an extension UI response
|
|
53
55
|
- Live assistant text streaming, including streamed thinking blocks when exposed by the provider
|
|
54
56
|
- Prompt, steer, follow-up, abort, new session, and manual compact controls
|
|
55
57
|
- Busy-session behavior selector for follow-up vs steer
|
|
56
58
|
- Model and thinking-level controls
|
|
57
59
|
- Slash-command autocomplete while typing `/...`
|
|
60
|
+
- `@` file/path references with live suggestions from the active tab cwd
|
|
58
61
|
- Tool, process, compaction, queue, and extension event log
|
|
59
|
-
- Collapsible side panel with session state, queue, available commands, events,
|
|
62
|
+
- Collapsible side panel with session state, queue, available commands, events, local-network exposure status/control, and a theme picker
|
|
60
63
|
- Pi-style footer with token, cache, estimated Pi-context tokens, speed, cost, context usage, clickable per-tab cwd picker with server-persisted fast picks, git branch, changes, runtime, model, and thinking level
|
|
61
64
|
- Guided Git workflow: `git add .`, ask Pi to run `/git-staged-msg`, preview short/long messages, commit with the selected message, and `git push`
|
|
62
65
|
- Basic rendering for user, assistant, tool result, bash execution, and thinking messages
|
|
66
|
+
- Feedback reactions (`👍`, `👎`, `?`) on final assistant output plus tool/bash action cards, with queued post-run submission that asks Pi to create/update a LEARNING
|
|
63
67
|
- Basic extension UI bridge for `notify`, `setStatus`, `setWidget`, `setTitle`, `set_editor_text`, `select`, `confirm`, `input`, and `editor`
|
|
64
|
-
-
|
|
68
|
+
- Side-panel theme picker backed by the bundled `@firstpick/pi-themes-bundle` themes
|
|
65
69
|
- PWA metadata, icons, and service worker for install-to-home-screen support when served from a secure context
|
|
66
70
|
- Static frontend: no bundler, no frontend install step
|
|
67
71
|
|
|
@@ -69,7 +73,7 @@ pi-webui --cwd /path/to/project
|
|
|
69
73
|
|
|
70
74
|
- The mobile composer starts as a one-line `Ask Pi…` input, grows with user-entered lines, and scrolls the transcript to the latest output when focused.
|
|
71
75
|
- When Pi is idle, `Steer` and `Follow-up` live inside `Actions`; while a run is active, they move back into the main composer row for quick steering/follow-up.
|
|
72
|
-
- PWA install support
|
|
76
|
+
- PWA install support and blocked-tab browser notifications require browser service-worker/notification support and usually HTTPS or `localhost`. Plain `http://<LAN-IP>` may show the app but may not offer install or notifications on Chrome/Safari.
|
|
73
77
|
|
|
74
78
|
## Pi slash commands
|
|
75
79
|
|
|
@@ -98,7 +102,7 @@ Examples:
|
|
|
98
102
|
/webui-start --name browser -- --model anthropic/claude-sonnet-4-5:high
|
|
99
103
|
```
|
|
100
104
|
|
|
101
|
-
If a compatible Web UI is already running on the target URL, `/webui-start` stops that instance
|
|
105
|
+
If a compatible Web UI is already running on the target URL, `/webui-start`/`/start-webui` captures its open terminal tabs plus any terminal tabs closed during the current server run, stops that instance, then starts a fresh server and reopens those tabs from their session files when available.
|
|
102
106
|
|
|
103
107
|
Status commands:
|
|
104
108
|
|
|
@@ -172,13 +176,16 @@ pi --mode rpc [--no-session] [--name <name>] [...extra Pi args]
|
|
|
172
176
|
The local server exposes:
|
|
173
177
|
|
|
174
178
|
- static files from `public/`
|
|
175
|
-
- `GET /api/tabs`, `POST /api/tabs`, `PATCH /api/tabs/:id`, and `DELETE /api/tabs/:id` for isolated Web UI terminal tabs and per-tab cwd changes
|
|
179
|
+
- `GET /api/tabs`, `POST /api/tabs`, `PATCH /api/tabs/:id`, and `DELETE /api/tabs/:id` for isolated Web UI terminal tabs and per-tab cwd changes; default-named tabs are auto-renamed from the first conversation prompt
|
|
176
180
|
- `GET /api/directories?tab=<tabId>&path=<path>` for the browser cwd picker
|
|
181
|
+
- `GET /api/path-suggestions?tab=<tabId>&query=<path>` for `@` file/path reference autocomplete in the prompt composer
|
|
177
182
|
- `GET /api/path-fast-picks` and `POST /api/path-fast-picks` for cwd picker fast picks persisted across browser tabs, Pi terminal tabs, and Web UI server restarts
|
|
183
|
+
- `GET /api/themes` for bundled theme data from `@firstpick/pi-themes-bundle`
|
|
178
184
|
- `GET /api/network` and localhost-only `POST /api/network/open` for local-network exposure status/control
|
|
179
185
|
- `GET /api/webui-status?detailed=1` for slash-command status reporting
|
|
180
|
-
- `POST /api/shutdown` for localhost-only graceful restarts from `/webui-start
|
|
186
|
+
- `POST /api/shutdown` for localhost-only graceful restarts from `/webui-start`/`/start-webui`; restart captures detailed tab status first so open and recently closed tabs can be restored with their session files
|
|
181
187
|
- HTTP endpoints for prompt/session/model/thinking/compact/git actions; tab-scoped calls use `?tab=<tabId>`
|
|
188
|
+
- `POST /api/action-feedback?tab=<tabId>` to turn queued action/final-output reactions into a Pi prompt that creates/updates a LEARNING after the run is idle
|
|
182
189
|
- `/api/events?tab=<tabId>` as a per-tab Server-Sent Events stream for Pi RPC events
|
|
183
190
|
- `/api/extension-ui-response?tab=<tabId>` for browser responses to extension UI prompts
|
|
184
191
|
|
|
@@ -187,7 +194,7 @@ Pi stdout is read as JSONL and split only on `\n`, matching Pi RPC framing.
|
|
|
187
194
|
## Network and safety notes
|
|
188
195
|
|
|
189
196
|
- Default bind is localhost-only: `127.0.0.1:31415`.
|
|
190
|
-
- The side-panel "Open to network" button rebinds the current server to `0.0.0.0
|
|
197
|
+
- The side-panel "Open to network" button rebinds the current server to `0.0.0.0`, shows LAN URLs when available, and toggles to "Close for network" to rebind back to localhost-only access.
|
|
191
198
|
- `--host 0.0.0.0` also makes the UI reachable from the network and is unsafe unless the network is trusted.
|
|
192
199
|
- The UI is intended as a local companion, not a hardened multi-user web service.
|
|
193
200
|
- Browser actions can trigger Pi tools, shell commands, file edits, and git operations according to the spawned Pi session's permissions.
|