@firstpick/pi-package-webui 0.1.1 → 0.1.2
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 -13
- package/bin/pi-webui.mjs +457 -15
- package/index.ts +304 -4
- package/package.json +7 -2
- package/public/app.js +644 -40
- 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 +48 -22
- package/public/manifest.webmanifest +40 -0
- package/public/service-worker.js +46 -0
- package/public/styles.css +704 -26
- package/tests/mobile-static.test.mjs +170 -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
|
|
8
|
+
- `/webui-start`: 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-
|
|
22
|
+
Install the package from npm into Pi, then restart Pi so `/webui-start` 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
|
|
|
@@ -56,17 +57,24 @@ pi-webui --cwd /path/to/project
|
|
|
56
57
|
- Slash-command autocomplete while typing `/...`
|
|
57
58
|
- Tool, process, compaction, queue, and extension event log
|
|
58
59
|
- Collapsible side panel with session state, queue, available commands, events, and local-network exposure status/control
|
|
59
|
-
- Pi-style footer with token, cache, estimated Pi-context tokens, speed, cost, context usage, clickable per-tab cwd picker with
|
|
60
|
+
- 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
61
|
- 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
62
|
- Basic rendering for user, assistant, tool result, bash execution, and thinking messages
|
|
62
63
|
- Basic extension UI bridge for `notify`, `setStatus`, `setWidget`, `setTitle`, `set_editor_text`, `select`, `confirm`, `input`, and `editor`
|
|
63
64
|
- Cyberpunk/Catppuccin-inspired theme
|
|
65
|
+
- PWA metadata, icons, and service worker for install-to-home-screen support when served from a secure context
|
|
64
66
|
- Static frontend: no bundler, no frontend install step
|
|
65
67
|
|
|
66
|
-
##
|
|
68
|
+
## Mobile/PWA notes
|
|
69
|
+
|
|
70
|
+
- 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
|
+
- 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 requires browser service-worker support and usually HTTPS or `localhost`. Plain `http://<LAN-IP>` may show the app but may not offer install on Chrome/Safari.
|
|
73
|
+
|
|
74
|
+
## Pi slash commands
|
|
67
75
|
|
|
68
76
|
```text
|
|
69
|
-
/start
|
|
77
|
+
/webui-start [port] [options] [-- <pi args...>]
|
|
70
78
|
```
|
|
71
79
|
|
|
72
80
|
Options:
|
|
@@ -84,13 +92,23 @@ Options:
|
|
|
84
92
|
Examples:
|
|
85
93
|
|
|
86
94
|
```text
|
|
87
|
-
/start
|
|
88
|
-
/start
|
|
89
|
-
/start
|
|
90
|
-
/start
|
|
95
|
+
/webui-start
|
|
96
|
+
/webui-start 31500
|
|
97
|
+
/webui-start --port 31500 --no-open
|
|
98
|
+
/webui-start --name browser -- --model anthropic/claude-sonnet-4-5:high
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
If a compatible Web UI is already running on the target URL, `/webui-start` stops that instance first, then starts a fresh server for the current cwd and opens it.
|
|
102
|
+
|
|
103
|
+
Status commands:
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
/webui-status
|
|
107
|
+
/webui-status detailed
|
|
108
|
+
/webui-status detailed --port 31500
|
|
91
109
|
```
|
|
92
110
|
|
|
93
|
-
|
|
111
|
+
`/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
112
|
|
|
95
113
|
## CLI
|
|
96
114
|
|
|
@@ -156,8 +174,10 @@ The local server exposes:
|
|
|
156
174
|
- static files from `public/`
|
|
157
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
|
|
158
176
|
- `GET /api/directories?tab=<tabId>&path=<path>` for the browser cwd picker
|
|
177
|
+
- `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
|
|
159
178
|
- `GET /api/network` and localhost-only `POST /api/network/open` for local-network exposure status/control
|
|
160
|
-
- `
|
|
179
|
+
- `GET /api/webui-status?detailed=1` for slash-command status reporting
|
|
180
|
+
- `POST /api/shutdown` for localhost-only graceful restarts from `/webui-start`
|
|
161
181
|
- HTTP endpoints for prompt/session/model/thinking/compact/git actions; tab-scoped calls use `?tab=<tabId>`
|
|
162
182
|
- `/api/events?tab=<tabId>` as a per-tab Server-Sent Events stream for Pi RPC events
|
|
163
183
|
- `/api/extension-ui-response?tab=<tabId>` for browser responses to extension UI prompts
|