@firstpick/pi-package-webui 0.1.0
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/LICENSE +21 -0
- package/README.md +95 -0
- package/bin/pi-webui.mjs +808 -0
- package/index.ts +271 -0
- package/package.json +37 -0
- package/public/app.js +1340 -0
- package/public/index.html +123 -0
- package/public/styles.css +1122 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Firstpick
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @firstpick/pi-package-webui
|
|
2
|
+
|
|
3
|
+
Pi Web UI companion package for [Pi coding agent](https://www.npmjs.com/package/@earendil-works/pi-coding-agent).
|
|
4
|
+
|
|
5
|
+
Category: **Pi package / companion app**. It bundles both:
|
|
6
|
+
|
|
7
|
+
- a CLI server, `pi-webui`, that starts `pi --mode rpc`, serves a small no-build web app, and proxies prompts/events over HTTP + Server-Sent Events
|
|
8
|
+
- a Pi extension command, `/start-webui`, that launches the local server from terminal Pi and opens the browser
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- Chat with Pi from a browser
|
|
13
|
+
- Live assistant text streaming
|
|
14
|
+
- Tool start/finish event log
|
|
15
|
+
- Prompt, steer, follow-up, abort, new session
|
|
16
|
+
- Model and thinking-level controls
|
|
17
|
+
- Guided git workflow: `git add .`, `/git-staged-msg`, preview generated messages, short/long commit, and `git push`
|
|
18
|
+
- Pi slash command `/start-webui` to launch the local server from terminal Pi and open the browser
|
|
19
|
+
- ChatGPT-style collapsible session/queue/commands/events side panel with in-panel control
|
|
20
|
+
- Pi-style footer between transcript and input with token, cost, context, model, cwd, and git summary
|
|
21
|
+
- Slash-command autocomplete while typing `/...` in the prompt box
|
|
22
|
+
- Enter sends, Shift+Enter inserts a new line
|
|
23
|
+
- Cyberpunk Catppuccin-inspired visual theme
|
|
24
|
+
- Basic rendering for user/assistant/tool/bash messages
|
|
25
|
+
- Basic RPC extension UI support: `select`, `confirm`, `input`, `editor`, notifications, status, widgets
|
|
26
|
+
- No frontend build step and no runtime web dependencies
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# from this package directory during development
|
|
32
|
+
node bin/pi-webui.mjs --cwd /path/to/project
|
|
33
|
+
|
|
34
|
+
# after global install
|
|
35
|
+
pi-webui --cwd /path/to/project
|
|
36
|
+
|
|
37
|
+
# pass Pi CLI args after --
|
|
38
|
+
pi-webui --port 3000 -- --model anthropic/claude-sonnet-4-5:high
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Open the printed URL, usually <http://127.0.0.1:31415/>.
|
|
42
|
+
|
|
43
|
+
## Pi slash command
|
|
44
|
+
|
|
45
|
+
Install this package as a Pi package, then reload Pi:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pi install ./pi-package-webui
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
From terminal Pi, run:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
/start-webui
|
|
55
|
+
/start-webui --port 31500
|
|
56
|
+
/start-webui --no-open
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The command starts `pi-webui` for the current Pi cwd, shows the localhost URL, and opens it in the default browser unless `--no-open` is passed.
|
|
60
|
+
|
|
61
|
+
## CLI
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
pi-webui [options] [-- <pi args...>]
|
|
65
|
+
|
|
66
|
+
Options:
|
|
67
|
+
--host <host> HTTP bind host (default: 127.0.0.1)
|
|
68
|
+
--port <port> HTTP port (default: 31415)
|
|
69
|
+
--cwd <path> Working directory for the Pi session (default: current dir)
|
|
70
|
+
--pi <command> Pi executable to spawn (default: bundled dependency, then "pi")
|
|
71
|
+
--no-session Start Pi RPC with --no-session
|
|
72
|
+
--name <name> Initial Pi session name
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Environment:
|
|
76
|
+
|
|
77
|
+
- `PI_WEBUI_HOST`
|
|
78
|
+
- `PI_WEBUI_PORT`
|
|
79
|
+
- `PI_WEBUI_PI_BIN` (overrides bundled Pi resolution)
|
|
80
|
+
|
|
81
|
+
## Security
|
|
82
|
+
|
|
83
|
+
This UI has **no authentication**. It can control Pi, including tools such as shell commands and file edits if enabled in the spawned Pi session.
|
|
84
|
+
|
|
85
|
+
Default binding is `127.0.0.1`. Do not use `--host 0.0.0.0` unless you are on a trusted network and understand the risk.
|
|
86
|
+
|
|
87
|
+
## How it works
|
|
88
|
+
|
|
89
|
+
The server spawns Pi in RPC mode:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pi --mode rpc
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Browser actions call local HTTP endpoints. Agent events from Pi stdout are broadcast to the browser through Server-Sent Events. The JSONL reader follows Pi RPC framing rules and splits records only on `\n`.
|