@firstpick/pi-package-webui 0.1.1 → 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 +44 -17
- package/bin/pi-webui.mjs +1483 -35
- package/index.ts +430 -23
- package/package.json +9 -3
- package/public/app.js +3067 -176
- package/public/apple-touch-icon.png +0 -0
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/index.html +60 -24
- package/public/manifest.webmanifest +40 -0
- package/public/service-worker.js +58 -0
- package/public/styles.css +1348 -125
- package/tests/mobile-static.test.mjs +370 -0
package/README.md
CHANGED
|
@@ -5,7 +5,8 @@ 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
|
-
- `/start-webui
|
|
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
|
+
- `/webui-status`: a Pi slash command that reports the Web UI URL, online state, network exposure, and optional detailed runtime info.
|
|
9
10
|
- A no-build web app in `public/` with no runtime frontend dependencies.
|
|
10
11
|
|
|
11
12
|
> **Security:** Pi Web UI has no authentication. It can control the spawned Pi session, including any tools Pi is allowed to run. It binds to `127.0.0.1` by default; do not expose it on untrusted networks.
|
|
@@ -18,7 +19,7 @@ This package provides:
|
|
|
18
19
|
|
|
19
20
|
## Quick start
|
|
20
21
|
|
|
21
|
-
Install the package from npm into Pi, then restart Pi so `/start-webui`
|
|
22
|
+
Install the package from npm into Pi, then restart Pi so `/webui-start` (also available as `/start-webui`) and `/webui-status` are loaded:
|
|
22
23
|
|
|
23
24
|
```bash
|
|
24
25
|
pi install npm:@firstpick/pi-package-webui
|
|
@@ -27,10 +28,10 @@ pi install npm:@firstpick/pi-package-webui
|
|
|
27
28
|
From inside terminal Pi:
|
|
28
29
|
|
|
29
30
|
```text
|
|
30
|
-
/start
|
|
31
|
+
/webui-start
|
|
31
32
|
```
|
|
32
33
|
|
|
33
|
-
Open the printed URL, usually <http://127.0.0.1:31415/>. The command opens it automatically unless `--no-open` is passed.
|
|
34
|
+
Open the printed URL, usually <http://127.0.0.1:31415/>. The command opens it automatically unless `--no-open` is passed. Check a running instance with `/webui-status` or `/webui-status detailed`.
|
|
34
35
|
|
|
35
36
|
For direct development from this package directory:
|
|
36
37
|
|
|
@@ -49,24 +50,35 @@ pi-webui --cwd /path/to/project
|
|
|
49
50
|
|
|
50
51
|
- Browser chat with Pi over RPC
|
|
51
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
|
|
52
55
|
- Live assistant text streaming, including streamed thinking blocks when exposed by the provider
|
|
53
56
|
- Prompt, steer, follow-up, abort, new session, and manual compact controls
|
|
54
57
|
- Busy-session behavior selector for follow-up vs steer
|
|
55
58
|
- Model and thinking-level controls
|
|
56
59
|
- Slash-command autocomplete while typing `/...`
|
|
60
|
+
- `@` file/path references with live suggestions from the active tab cwd
|
|
57
61
|
- Tool, process, compaction, queue, and extension event log
|
|
58
|
-
- Collapsible side panel with session state, queue, available commands, events,
|
|
59
|
-
- Pi-style footer with token, cache, estimated Pi-context tokens, speed, cost, context usage, clickable per-tab cwd picker with
|
|
62
|
+
- Collapsible side panel with session state, queue, available commands, events, local-network exposure status/control, and a theme picker
|
|
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
|
|
60
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`
|
|
61
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
|
|
62
67
|
- Basic extension UI bridge for `notify`, `setStatus`, `setWidget`, `setTitle`, `set_editor_text`, `select`, `confirm`, `input`, and `editor`
|
|
63
|
-
-
|
|
68
|
+
- Side-panel theme picker backed by the bundled `@firstpick/pi-themes-bundle` themes
|
|
69
|
+
- PWA metadata, icons, and service worker for install-to-home-screen support when served from a secure context
|
|
64
70
|
- Static frontend: no bundler, no frontend install step
|
|
65
71
|
|
|
66
|
-
##
|
|
72
|
+
## Mobile/PWA notes
|
|
73
|
+
|
|
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.
|
|
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.
|
|
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.
|
|
77
|
+
|
|
78
|
+
## Pi slash commands
|
|
67
79
|
|
|
68
80
|
```text
|
|
69
|
-
/start
|
|
81
|
+
/webui-start [port] [options] [-- <pi args...>]
|
|
70
82
|
```
|
|
71
83
|
|
|
72
84
|
Options:
|
|
@@ -84,13 +96,23 @@ Options:
|
|
|
84
96
|
Examples:
|
|
85
97
|
|
|
86
98
|
```text
|
|
87
|
-
/start
|
|
88
|
-
/start
|
|
89
|
-
/start
|
|
90
|
-
/start
|
|
99
|
+
/webui-start
|
|
100
|
+
/webui-start 31500
|
|
101
|
+
/webui-start --port 31500 --no-open
|
|
102
|
+
/webui-start --name browser -- --model anthropic/claude-sonnet-4-5:high
|
|
103
|
+
```
|
|
104
|
+
|
|
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.
|
|
106
|
+
|
|
107
|
+
Status commands:
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
/webui-status
|
|
111
|
+
/webui-status detailed
|
|
112
|
+
/webui-status detailed --port 31500
|
|
91
113
|
```
|
|
92
114
|
|
|
93
|
-
|
|
115
|
+
`/webui-status` reports the page URL, whether the server is online, and whether it is open to the local network. `detailed` adds Web UI/Pi PIDs, bind info, tabs, current session/model/thinking state, available providers, per-tab workspace/stats summaries, and recent backend events.
|
|
94
116
|
|
|
95
117
|
## CLI
|
|
96
118
|
|
|
@@ -154,11 +176,16 @@ pi --mode rpc [--no-session] [--name <name>] [...extra Pi args]
|
|
|
154
176
|
The local server exposes:
|
|
155
177
|
|
|
156
178
|
- static files from `public/`
|
|
157
|
-
- `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
|
|
158
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
|
|
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`
|
|
159
184
|
- `GET /api/network` and localhost-only `POST /api/network/open` for local-network exposure status/control
|
|
160
|
-
- `
|
|
185
|
+
- `GET /api/webui-status?detailed=1` for slash-command status reporting
|
|
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
|
|
161
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
|
|
162
189
|
- `/api/events?tab=<tabId>` as a per-tab Server-Sent Events stream for Pi RPC events
|
|
163
190
|
- `/api/extension-ui-response?tab=<tabId>` for browser responses to extension UI prompts
|
|
164
191
|
|
|
@@ -167,7 +194,7 @@ Pi stdout is read as JSONL and split only on `\n`, matching Pi RPC framing.
|
|
|
167
194
|
## Network and safety notes
|
|
168
195
|
|
|
169
196
|
- Default bind is localhost-only: `127.0.0.1:31415`.
|
|
170
|
-
- 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.
|
|
171
198
|
- `--host 0.0.0.0` also makes the UI reachable from the network and is unsafe unless the network is trusted.
|
|
172
199
|
- The UI is intended as a local companion, not a hardened multi-user web service.
|
|
173
200
|
- Browser actions can trigger Pi tools, shell commands, file edits, and git operations according to the spawned Pi session's permissions.
|