@hyperdreamer/pi-webui 1.29.0 → 1.31.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/README.md +1 -1
- package/dist/client/assets/{CodeViewer-CFluauNE.js → CodeViewer-D-OaSuPI.js} +1 -1
- package/dist/client/assets/{index-BEBGqZPh.js → index-CCnvZJ20.js} +484 -484
- package/dist/client/assets/{mathjaxEngine-D9QxelfG.js → mathjaxEngine-CTytMfH6.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/config.js +20 -0
- package/dist/config.js.map +1 -1
- package/dist/server/app.js +3 -0
- package/dist/server/app.js.map +1 -1
- package/dist/server/configRoutes.js +9 -3
- package/dist/server/configRoutes.js.map +1 -1
- package/dist/server/http/browserOriginGuard.js +75 -0
- package/dist/server/http/browserOriginGuard.js.map +1 -0
- package/dist/server/http/fileViewReply.js +132 -0
- package/dist/server/http/fileViewReply.js.map +1 -0
- package/dist/server/machines/machineProxyRoutes.js +1 -0
- package/dist/server/machines/machineProxyRoutes.js.map +1 -1
- package/dist/server/sessiond/sessionDaemonApp.js +25 -0
- package/dist/server/sessiond/sessionDaemonApp.js.map +1 -0
- package/dist/server/sessiond.js +2 -9
- package/dist/server/sessiond.js.map +1 -1
- package/dist/server/sessions/sessionHistoryExport.js +3 -73
- package/dist/server/sessions/sessionHistoryExport.js.map +1 -1
- package/dist/server/workspaceExplorerRoutes.js +66 -0
- package/dist/server/workspaceExplorerRoutes.js.map +1 -1
- package/dist/server/workspaces/fileViewService.js +196 -0
- package/dist/server/workspaces/fileViewService.js.map +1 -0
- package/dist/server/workspaces/pathAccessPolicy.js +42 -9
- package/dist/server/workspaces/pathAccessPolicy.js.map +1 -1
- package/dist/shared/apiTypes.d.ts +2 -0
- package/dist/shared/apiTypes.js.map +1 -1
- package/dist/shared/browserOrigins.js +29 -0
- package/dist/shared/browserOrigins.js.map +1 -0
- package/dist/shared/federatedRoutes.js +1 -0
- package/dist/shared/federatedRoutes.js.map +1 -1
- package/dist/shared/fileViewTypes.js +18 -0
- package/dist/shared/fileViewTypes.js.map +1 -0
- package/docs/config.md +32 -1
- package/package.json +11 -7
package/docs/config.md
CHANGED
|
@@ -25,6 +25,29 @@ The deployment path is not a PI WEBUI config-file key or environment setting. Th
|
|
|
25
25
|
|
|
26
26
|
For a nested deployment, redirect the slashless prefix to the trailing-slash URL, strip the prefix before forwarding to PI WEBUI, and proxy authenticated HTTP and WebSocket traffic through the same location. Relative browser and PWA URLs then stay within that prefix. See the [reverse proxy installation guide](https://pi-webui.dev/install#reverse-proxy-prefix) for a complete Nginx example.
|
|
27
27
|
|
|
28
|
+
<a id="browser-origins"></a>
|
|
29
|
+
### Browser origins
|
|
30
|
+
|
|
31
|
+
The optional machine-global `allowedOrigins` key trusts additional exact browser origins. Manage it in the global config file or config API; this feature adds no Settings editor for the list. It is unsupported in project-local `.pi-webui/config.json`, and it has no environment override. An apparent `PI_WEBUI_ALLOWED_ORIGINS` variable has no effect.
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"allowedOrigins": ["https://pi.example", "https://pi.example:8443"]
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Each entry must be an absolute HTTP or HTTPS origin with no credentials, path beyond an optional single root slash, query, fragment, wildcard, or origin list. Entries normalize scheme/host case and default ports: `HTTPS://PI.EXAMPLE:443/` becomes `https://pi.example`. Matching includes scheme, host, and effective port. Invalid values reject the entire field.
|
|
40
|
+
|
|
41
|
+
Omitting the file key or configuring `[]` grants no extra origins. Omission from either config update API preserves the current list; send an explicit `"allowedOrigins": []` to clear it. Both config and effectiveConfig responses show desired values, including a newly saved list, and do not prove that either running guard has activated them.
|
|
42
|
+
|
|
43
|
+
Browser POST, PUT, PATCH, DELETE, and all WebSocket upgrades are checked whenever Origin is present. Same-origin traffic and explicitly configured exact origins are accepted. `Origin: null`, malformed origins, and foreign origins are rejected with HTTP 403 before an action or socket attachment. Nonbrowser clients with no Origin continue to work. Safe GET/HEAD reads retain existing CORS behavior; this key grants no new cross-origin read access.
|
|
44
|
+
|
|
45
|
+
A reverse proxy that preserves Host and supplies the correct first X-Forwarded-Proto token needs no extra origin. If it rewrites Host, list the public scheme, authority, and nondefault port on the receiving machine. `allowedHosts` controls Vite development host admission and grants no browser-origin trust.
|
|
46
|
+
|
|
47
|
+
Installing the guard and changing `allowedOrigins` require restarting the web/API process and manually restarting `pi-webui-sessiond.service` on that machine. Ordinary UI/API autoreload does not restart the long-lived daemon. For this development setup, the daemon command is `systemctl --user restart pi-webui-sessiond.service`; the UI/API owner is `pi-webui-ui-dev.service`. Perform the restart when ready to activate the change.
|
|
48
|
+
|
|
49
|
+
DNS rebinding remains outside this protection: an attacker hostname whose Host and Origin agree can still match. Browser-origin matching does not implement host admission.
|
|
50
|
+
|
|
28
51
|
## Precedence and reloads
|
|
29
52
|
|
|
30
53
|
Machine-global runtime values are resolved as:
|
|
@@ -41,6 +64,7 @@ Process restarts depend on the key:
|
|
|
41
64
|
|
|
42
65
|
- `host` / `port`: restart the gateway web/API service or process.
|
|
43
66
|
- `maxUploadBytes`: restart both the web/API process and the session daemon on that machine.
|
|
67
|
+
- `allowedOrigins`: restart both the web/API process and the session daemon on that machine; a saved list is desired configuration until both guards restart.
|
|
44
68
|
- `agent.command` / `agent.dir` / `spawnSessions` / `subsessions`: restart the session daemon on that machine.
|
|
45
69
|
- `modelTiers`: saved settings apply immediately in **Settings → Model tiers**; validates all six ladder rows atomically.
|
|
46
70
|
- `utilityModels`: saved settings apply immediately in **Settings → Utility models**; existing sessions use updated values on their next utility operation.
|
|
@@ -141,7 +165,7 @@ Plugins may own separate project files, such as `.pi-webui/tasks.json` for the b
|
|
|
141
165
|
|
|
142
166
|
## Configuration matrix
|
|
143
167
|
|
|
144
|
-
Rows with JSON key `—` are runtime-only environment variables, not config-file keys. `Global` means machine-global. In Settings, selected-machine-safe global keys (`pathAccess`, `uploads`, `maxUploadBytes`, `agent`, `spawnSessions`, `subsessions`, `modelTiers`, `utilityModels`, and `plugins`) are edited for the selected machine
|
|
168
|
+
Rows with JSON key `—` are runtime-only environment variables, not config-file keys. `Global` means machine-global. In Settings, selected-machine-safe global keys (`pathAccess`, `uploads`, `maxUploadBytes`, `agent`, `spawnSessions`, `subsessions`, `modelTiers`, `utilityModels`, and `plugins`) are edited for the selected machine. The machine-global `allowedOrigins` key is config/API-managed for the selected machine rather than exposed in Settings, while gateway host/port/allowedHosts stay gateway-owned; keyboard shortcuts and machine registry/tokens stay local.
|
|
145
169
|
|
|
146
170
|
| Config | JSON key | Env var | Scope | Project-local behavior | Applies / restart |
|
|
147
171
|
| --- | --- | --- | --- | --- | --- |
|
|
@@ -149,6 +173,7 @@ Rows with JSON key `—` are runtime-only environment variables, not config-file
|
|
|
149
173
|
| Web/API bind host | `host` | `PI_WEBUI_HOST` | Global | Not supported locally | Restart web/API |
|
|
150
174
|
| Web/API port | `port` | `PI_WEBUI_PORT`, `PORT` | Global | Not supported locally | Restart web/API |
|
|
151
175
|
| Dev-server allowed hosts | `allowedHosts` | `PI_WEBUI_ALLOWED_HOSTS` | Global | Not supported locally | Restart dev web/UI |
|
|
176
|
+
| Extra trusted browser origins | `allowedOrigins` | — | Global (machine) | Not supported locally | Restart web/API and session daemon on that machine |
|
|
152
177
|
| External filesystem roots | `pathAccess.allowedPaths` | — | Global + project | **Merges**: global roots first, then project roots; duplicates removed | Next file request; refresh existing views if needed |
|
|
153
178
|
| Manual file upload default folder | `uploads.defaultFolder` | — | Global + project | **Overrides**: project value wins for workspaces in that project; otherwise global/default applies | New Upload dialogs and direct drag/drop batches after config/workspace refresh |
|
|
154
179
|
| Upload/body limit | `maxUploadBytes` | `PI_WEBUI_MAX_UPLOAD_BYTES` | Global | Not supported locally | Restart web/API and session daemon on that machine |
|
|
@@ -219,6 +244,12 @@ In **Settings → General**, external filesystem roots are saved on the selected
|
|
|
219
244
|
|
|
220
245
|
This is not a sandbox for the underlying Pi Coding Agent or your OS user. It only controls PI WEBUI UI/API file exposure outside a workspace.
|
|
221
246
|
|
|
247
|
+
Transcript local-file links and Markdown images open a read-only preview served by the machine that owns the session. Workspace-relative reads stay inside that workspace. Absolute external paths require an allowed root on that machine; global and project-local external roots merge using the same policy as the Files panel.
|
|
248
|
+
|
|
249
|
+
Previews support HTML/SVG, PDF, raster images, and text/source files up to **64 MB (67,108,864 bytes)**. Unsupported files, nonregular filesystem entries, and directories are rejected; this view does not browse directories or write files. Self-contained HTML works, but sibling local images, scripts, and styles inside HTML do not resolve. Remote PDFs transfer whole, without range seeking.
|
|
250
|
+
|
|
251
|
+
HTML and SVG can animate under a restricted document policy with an opaque origin. Permitted remote scripts, styles, and images can still load. A document may navigate its own tab; the browser-origin checks described below protect PI WEBUI actions and socket upgrades after navigation.
|
|
252
|
+
|
|
222
253
|
### Manual upload defaults
|
|
223
254
|
|
|
224
255
|
The Files panel can upload one or more files in two ways:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperdreamer/pi-webui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Web UI for persistent Pi Coding Agent sessions in real workspaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Federico Jaramillo Martinez and HyperDreamer",
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@changesets/cli": "^2.31.0",
|
|
93
|
-
"@earendil-works/pi-agent-core": "^1.
|
|
94
|
-
"@earendil-works/pi-ai": "^1.
|
|
95
|
-
"@earendil-works/pi-coding-agent": "^1.
|
|
93
|
+
"@earendil-works/pi-agent-core": "^1.5.2",
|
|
94
|
+
"@earendil-works/pi-ai": "^1.5.2",
|
|
95
|
+
"@earendil-works/pi-coding-agent": "^1.5.2",
|
|
96
96
|
"@eslint/js": "^10.0.1",
|
|
97
97
|
"@types/node": "^24.13.3",
|
|
98
98
|
"@types/ws": "^8.18.1",
|
|
@@ -115,7 +115,11 @@
|
|
|
115
115
|
"node": ">=22.19.0"
|
|
116
116
|
},
|
|
117
117
|
"overrides": {
|
|
118
|
+
"@fastify/static": {
|
|
119
|
+
"glob": "^14.0.3"
|
|
120
|
+
},
|
|
118
121
|
"@xmldom/xmldom": "^0.9.12",
|
|
122
|
+
"minimatch": "^11.0.4",
|
|
119
123
|
"undici": "^8.12.3"
|
|
120
124
|
},
|
|
121
125
|
"repository": {
|
|
@@ -128,9 +132,9 @@
|
|
|
128
132
|
"homepage": "https://pi-webui.dev/",
|
|
129
133
|
"packageManager": "npm@11.11.0",
|
|
130
134
|
"peerDependencies": {
|
|
131
|
-
"@earendil-works/pi-agent-core": ">=1.
|
|
132
|
-
"@earendil-works/pi-ai": ">=1.
|
|
133
|
-
"@earendil-works/pi-coding-agent": ">=1.
|
|
135
|
+
"@earendil-works/pi-agent-core": ">=1.5.2 <2",
|
|
136
|
+
"@earendil-works/pi-ai": ">=1.5.2 <2",
|
|
137
|
+
"@earendil-works/pi-coding-agent": ">=1.5.2 <2"
|
|
134
138
|
},
|
|
135
139
|
"keywords": [
|
|
136
140
|
"pi-package",
|