@firstpick/pi-package-webui 0.1.4 → 0.1.6
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 -11
- package/bin/pi-webui.mjs +608 -26
- package/index.ts +82 -10
- package/package.json +34 -4
- package/public/app.js +3118 -211
- package/public/catppuccin-mocha-background.png +0 -0
- package/public/index.html +152 -52
- package/public/matrix-background.webp +0 -0
- package/public/service-worker.js +3 -1
- package/public/styles.css +772 -17
- package/tests/mobile-static.test.mjs +231 -36
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`: 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
|
|
|
@@ -17,9 +17,25 @@ This package provides:
|
|
|
17
17
|
- Pi available through this package dependency or as `pi` on `PATH`
|
|
18
18
|
- A modern browser with Server-Sent Events support
|
|
19
19
|
|
|
20
|
+
## Optional companion packages
|
|
21
|
+
|
|
22
|
+
The Web UI declares its companion Pi packages as npm `optionalDependencies`. A normal npm/Pi install will install them, while minimal installs can skip them with npm's optional-dependency controls such as `npm install --omit=optional`.
|
|
23
|
+
|
|
24
|
+
At startup, the browser checks loaded Pi capabilities directly through RPC-visible commands and live widget events; it does not inspect npm package folders. That means locally symlinked/dev packages and separately installed Pi packages work as long as their commands/widgets are loaded in the active Pi tab.
|
|
25
|
+
|
|
26
|
+
The side panel shows each optional feature as enabled, disabled, or install-needed. Disabling a feature is Web UI-local and hides Web UI affordances/specialized renderers without uninstalling or unloading the underlying Pi package. Installing a missing feature is an explicit, warned action: the server runs npm install for the whitelisted package from localhost only, then prompts you to `/reload` the active Pi tab so newly installed resources can load.
|
|
27
|
+
|
|
28
|
+
Optional companions:
|
|
29
|
+
|
|
30
|
+
- `@firstpick/pi-prompts-git-pr` for the guided Git workflow's `/git-staged-msg` prompt.
|
|
31
|
+
- `@firstpick/pi-extension-release-npm` and `@firstpick/pi-extension-release-aur` for Publish menu commands and live release widgets.
|
|
32
|
+
- `@firstpick/pi-extension-todo-progress` for the specialized todo-progress widget.
|
|
33
|
+
- `@firstpick/pi-extension-git-footer-status` and `@firstpick/pi-extension-stats` for richer Pi status/footer and stats commands.
|
|
34
|
+
- `@firstpick/pi-themes-bundle` for theme resources used by the browser theme picker and Pi themes.
|
|
35
|
+
|
|
20
36
|
## Quick start
|
|
21
37
|
|
|
22
|
-
Install the package from npm into Pi, then restart Pi so `/webui-start`
|
|
38
|
+
Install the package from npm into Pi, then restart Pi so `/webui-start` and `/webui-status` are loaded:
|
|
23
39
|
|
|
24
40
|
```bash
|
|
25
41
|
pi install npm:@firstpick/pi-package-webui
|
|
@@ -54,12 +70,14 @@ pi-webui --cwd /path/to/project
|
|
|
54
70
|
- 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
|
|
55
71
|
- Live assistant text streaming, including streamed thinking blocks when exposed by the provider
|
|
56
72
|
- Prompt, steer, follow-up, abort, new session, and manual compact controls
|
|
73
|
+
- Attachment button plus drag/drop and clipboard paste for images, documents, video, audio, and other files; uploaded files are saved to a server temp path and supported images are also sent through Pi RPC image attachments
|
|
57
74
|
- Busy-session behavior selector for follow-up vs steer
|
|
58
75
|
- Model and thinking-level controls
|
|
76
|
+
- Browser-native selector dialogs for native slash commands such as `/model`, `/settings`, `/theme`, `/fork`, `/clone`, `/resume`, and `/tree`; `/login`/`/logout` currently show non-secret guidance rather than accepting credentials in the browser
|
|
59
77
|
- Slash-command autocomplete while typing `/...`
|
|
60
78
|
- `@` file/path references with live suggestions from the active tab cwd
|
|
61
79
|
- Tool, process, compaction, queue, and extension event log
|
|
62
|
-
- Collapsible side panel with session state, queue, available commands, events, local-network exposure status/control, and a theme picker
|
|
80
|
+
- Collapsible side panel with independently collapsible sections for controls, optional features, session state, queue, available commands, events, local-network exposure status/control, and a theme picker
|
|
63
81
|
- 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
|
|
64
82
|
- 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
83
|
- Hover-expand Publish workflow menu beside Git workflow, currently offering NPM Release and AUR Release
|
|
@@ -67,7 +85,7 @@ pi-webui --cwd /path/to/project
|
|
|
67
85
|
- Feedback reactions (`👍`, `👎`, `?`) on final assistant output plus tool/bash action cards, with queued post-run submission that asks Pi to create/update a LEARNING
|
|
68
86
|
- Basic extension UI bridge for `notify`, `setStatus`, `setWidget`, `setTitle`, `set_editor_text`, `select`, `confirm`, `input`, and `editor`
|
|
69
87
|
- Specialized `/release-npm` and `/release-aur` widget rendering with scrollable live logs plus toggle/abort actions
|
|
70
|
-
- Side-panel theme picker backed by
|
|
88
|
+
- Side-panel theme picker backed by optional `@firstpick/pi-themes-bundle` themes when loaded
|
|
71
89
|
- PWA metadata, icons, and service worker for install-to-home-screen support when served from a secure context
|
|
72
90
|
- Static frontend: no bundler, no frontend install step
|
|
73
91
|
|
|
@@ -91,7 +109,7 @@ Options:
|
|
|
91
109
|
--port <port> HTTP port (default: 31415)
|
|
92
110
|
--no-open Do not open the browser automatically
|
|
93
111
|
--no-session Start Pi RPC with --no-session
|
|
94
|
-
--name <name> Initial
|
|
112
|
+
--name <name> Initial Web UI tab display name
|
|
95
113
|
-- <pi args...> Extra arguments forwarded to Pi RPC
|
|
96
114
|
```
|
|
97
115
|
|
|
@@ -104,7 +122,7 @@ Examples:
|
|
|
104
122
|
/webui-start --name browser -- --model anthropic/claude-sonnet-4-5:high
|
|
105
123
|
```
|
|
106
124
|
|
|
107
|
-
If a compatible Web UI is already running on the target URL, `/webui-start
|
|
125
|
+
If a compatible Web UI is already running on the target URL, `/webui-start` captures its currently open terminal tabs, stops that instance, then starts a fresh server and reopens only those open tabs from their session files when available. Tabs you closed in the Web UI stay closed; use `/resume` if you want to reopen an older Pi session manually.
|
|
108
126
|
|
|
109
127
|
Status commands:
|
|
110
128
|
|
|
@@ -130,7 +148,7 @@ Options:
|
|
|
130
148
|
--cwd <path> Default working directory for Pi tabs (default: current dir)
|
|
131
149
|
--pi <command> Pi executable to spawn (default: bundled dependency, then "pi")
|
|
132
150
|
--no-session Start Pi RPC with --no-session
|
|
133
|
-
--name <name> Initial
|
|
151
|
+
--name <name> Initial Web UI tab display name
|
|
134
152
|
-h, --help Show help
|
|
135
153
|
-v, --version Print version
|
|
136
154
|
```
|
|
@@ -159,7 +177,7 @@ The browser button runs a native local workflow in the Web UI server process:
|
|
|
159
177
|
4. Commit with either the short message (`git commit -m ...`) or the long message (`git commit -F ...`).
|
|
160
178
|
5. Run `git push`.
|
|
161
179
|
|
|
162
|
-
This workflow
|
|
180
|
+
This workflow requires `/git-staged-msg` from `@firstpick/pi-prompts-git-pr`, which writes the two `dev/COMMIT/` files above. The Web UI enables the Git workflow button only when that command is loaded in the active Pi tab. If package resources are filtered or optional dependencies were omitted, make sure `/git-staged-msg` remains enabled. The workflow can be cancelled between steps; active native git commands are terminated on cancel where possible.
|
|
163
181
|
|
|
164
182
|
## How it works
|
|
165
183
|
|
|
@@ -172,9 +190,11 @@ pi --mode rpc
|
|
|
172
190
|
With options, each spawned command becomes:
|
|
173
191
|
|
|
174
192
|
```bash
|
|
175
|
-
pi --mode rpc [--no-session] [
|
|
193
|
+
pi --mode rpc [--no-session] [...extra Pi args]
|
|
176
194
|
```
|
|
177
195
|
|
|
196
|
+
Web UI tab titles are stored in Web UI metadata instead of being forwarded as Pi CLI `--name` flags, so multiple tabs remain compatible with bundled Pi CLI versions that do not support session naming.
|
|
197
|
+
|
|
178
198
|
The local server exposes:
|
|
179
199
|
|
|
180
200
|
- static files from `public/`
|
|
@@ -182,10 +202,13 @@ The local server exposes:
|
|
|
182
202
|
- `GET /api/directories?tab=<tabId>&path=<path>` for the browser cwd picker
|
|
183
203
|
- `GET /api/path-suggestions?tab=<tabId>&query=<path>` for `@` file/path reference autocomplete in the prompt composer
|
|
184
204
|
- `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
|
-
- `
|
|
205
|
+
- `POST /api/attachments` for browser-selected, pasted, or dropped files; files are stored under the OS temp directory and referenced in the prompt, while supported images can also be sent inline via RPC `images`
|
|
206
|
+
- `GET /api/themes` for optional theme data from `@firstpick/pi-themes-bundle` when available
|
|
207
|
+
- `GET /api/fork-messages`, `POST /api/fork`, `POST /api/clone`, `GET /api/sessions`, `POST /api/switch-session`, `GET /api/session-tree`, and `POST /api/tree-navigate` for browser-native native slash selectors
|
|
208
|
+
- localhost-only `POST /api/optional-feature-install` for explicit, warned installation of whitelisted optional feature packages
|
|
186
209
|
- `GET /api/network` and localhost-only `POST /api/network/open` for local-network exposure status/control
|
|
187
210
|
- `GET /api/webui-status?detailed=1` for slash-command status reporting
|
|
188
|
-
- `POST /api/shutdown` for localhost-only graceful restarts from `/webui-start
|
|
211
|
+
- `POST /api/shutdown` for localhost-only graceful restarts from `/webui-start`; restart captures detailed open-tab status first so currently open tabs can be restored with their session files
|
|
189
212
|
- HTTP endpoints for prompt/session/model/thinking/compact/git actions; tab-scoped calls use `?tab=<tabId>`
|
|
190
213
|
- `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
|
|
191
214
|
- `/api/events?tab=<tabId>` as a per-tab Server-Sent Events stream for Pi RPC events
|