@firstpick/pi-package-webui 0.1.2 → 0.1.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 +18 -9
- package/bin/pi-webui.mjs +1039 -33
- package/index.ts +136 -29
- package/package.json +3 -2
- package/public/app.js +3025 -137
- package/public/index.html +43 -3
- package/public/service-worker.js +13 -1
- package/public/styles.css +1031 -131
- package/tests/mobile-static.test.mjs +260 -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,24 @@ 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 and an optional side-panel toggle for agent-done notifications
|
|
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`
|
|
65
|
+
- Hover-expand Publish workflow menu beside Git workflow, currently offering NPM Release and AUR Release
|
|
62
66
|
- Basic rendering for user, assistant, tool result, bash execution, and thinking messages
|
|
67
|
+
- 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
68
|
- Basic extension UI bridge for `notify`, `setStatus`, `setWidget`, `setTitle`, `set_editor_text`, `select`, `confirm`, `input`, and `editor`
|
|
64
|
-
-
|
|
69
|
+
- Specialized `/release-npm` and `/release-aur` widget rendering with scrollable live logs plus toggle/abort actions
|
|
70
|
+
- Side-panel theme picker backed by the bundled `@firstpick/pi-themes-bundle` themes
|
|
65
71
|
- PWA metadata, icons, and service worker for install-to-home-screen support when served from a secure context
|
|
66
72
|
- Static frontend: no bundler, no frontend install step
|
|
67
73
|
|
|
@@ -69,7 +75,7 @@ pi-webui --cwd /path/to/project
|
|
|
69
75
|
|
|
70
76
|
- 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
77
|
- 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
|
|
78
|
+
- PWA install support, blocked-tab browser notifications, and optional agent-done 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
79
|
|
|
74
80
|
## Pi slash commands
|
|
75
81
|
|
|
@@ -98,7 +104,7 @@ Examples:
|
|
|
98
104
|
/webui-start --name browser -- --model anthropic/claude-sonnet-4-5:high
|
|
99
105
|
```
|
|
100
106
|
|
|
101
|
-
If a compatible Web UI is already running on the target URL, `/webui-start` stops that instance
|
|
107
|
+
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
108
|
|
|
103
109
|
Status commands:
|
|
104
110
|
|
|
@@ -172,13 +178,16 @@ pi --mode rpc [--no-session] [--name <name>] [...extra Pi args]
|
|
|
172
178
|
The local server exposes:
|
|
173
179
|
|
|
174
180
|
- 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
|
|
181
|
+
- `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
182
|
- `GET /api/directories?tab=<tabId>&path=<path>` for the browser cwd picker
|
|
183
|
+
- `GET /api/path-suggestions?tab=<tabId>&query=<path>` for `@` file/path reference autocomplete in the prompt composer
|
|
177
184
|
- `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
|
|
185
|
+
- `GET /api/themes` for bundled theme data from `@firstpick/pi-themes-bundle`
|
|
178
186
|
- `GET /api/network` and localhost-only `POST /api/network/open` for local-network exposure status/control
|
|
179
187
|
- `GET /api/webui-status?detailed=1` for slash-command status reporting
|
|
180
|
-
- `POST /api/shutdown` for localhost-only graceful restarts from `/webui-start
|
|
188
|
+
- `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
189
|
- HTTP endpoints for prompt/session/model/thinking/compact/git actions; tab-scoped calls use `?tab=<tabId>`
|
|
190
|
+
- `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
191
|
- `/api/events?tab=<tabId>` as a per-tab Server-Sent Events stream for Pi RPC events
|
|
183
192
|
- `/api/extension-ui-response?tab=<tabId>` for browser responses to extension UI prompts
|
|
184
193
|
|
|
@@ -187,7 +196,7 @@ Pi stdout is read as JSONL and split only on `\n`, matching Pi RPC framing.
|
|
|
187
196
|
## Network and safety notes
|
|
188
197
|
|
|
189
198
|
- 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
|
|
199
|
+
- 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
200
|
- `--host 0.0.0.0` also makes the UI reachable from the network and is unsafe unless the network is trusted.
|
|
192
201
|
- The UI is intended as a local companion, not a hardened multi-user web service.
|
|
193
202
|
- Browser actions can trigger Pi tools, shell commands, file edits, and git operations according to the spawned Pi session's permissions.
|