@firstpick/pi-package-webui 0.8.8 → 0.8.9
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 +5 -0
- package/bin/pi-webui-rpc-supervisor.mjs +4 -1
- package/bin/pi-webui.mjs +5 -1
- package/lib/rpc-supervisor-protocol.mjs +6 -1
- package/package.json +1 -1
- package/public/app.js +426 -101
- package/public/index.html +27 -13
- package/public/service-worker.js +1 -1
- package/public/styles.css +741 -16
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/interaction-continuity.spec.mjs +58 -0
- package/tests/browser/mobile-foundation.spec.mjs +363 -5
- package/tests/browser/optimistic-prompt.spec.mjs +24 -10
- package/tests/browser/persistent-ui-layout.spec.mjs +2 -0
- package/tests/browser/side-panel-section-reorder.spec.mjs +16 -1
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/file-tree-search-layout-static.test.mjs +261 -0
- package/tests/fixtures/fake-pi.mjs +4 -1
- package/tests/http-endpoints-harness.test.mjs +6 -2
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-compact-layout.test.mjs +60 -0
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +12 -12
- package/tests/mobile-phone-experience-static.test.mjs +2 -2
- package/tests/mobile-static.test.mjs +32 -18
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/persistent-ui-layout-static.test.mjs +3 -3
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/rpc-supervisor-host.test.mjs +18 -1
- package/tests/rpc-supervisor-protocol.test.mjs +5 -0
- package/tests/session-sampling-ui-static.test.mjs +3 -3
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/side-panel-section-reorder-static.test.mjs +23 -10
- package/tests/streaming-ui-coupling.test.mjs +8 -0
- package/tests/terminal-tab-workspace-static.test.mjs +15 -1
- package/tests/theme-customizer-static.test.mjs +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Use Pi from a local browser with tabs, streaming responses, uploads, model contr
|
|
|
10
10
|
- Change models and thinking effort without leaving the browser.
|
|
11
11
|
- Upload files and images, use slash-command suggestions, and manage follow-up prompts.
|
|
12
12
|
- Resume sessions, switch projects, and use guided Git helpers.
|
|
13
|
+
- Keep phone sessions compact with expandable terminal navigation and secondary composer actions.
|
|
13
14
|
- Add optional themes, statistics, remote access, voice features, and other companion packages.
|
|
14
15
|
|
|
15
16
|
## Install
|
|
@@ -39,6 +40,10 @@ pi-webui
|
|
|
39
40
|
|
|
40
41
|
If no working directory is supplied, the browser asks which project to open first.
|
|
41
42
|
|
|
43
|
+
To create a parallel checkout, click the Git branch box in the footer and use **Create branch worktree**. After the worktree is created, the browser asks whether to open it in a separate Pi tab and switch there; choosing **Cancel** keeps the current tab active and leaves the new worktree available for later.
|
|
44
|
+
|
|
45
|
+
On a phone, tap the current terminal name to open full-screen terminal navigation. Grouped terminals use their title as a dropdown; open the group, then choose an individual terminal. The composer keeps the prompt, attachment, Send, and active-run controls visible; tap **More** to open session, workflow, command, and mode controls in a full-screen overlay, then use the top `−` control or `Escape` to minimize it. Todo progress stays on one line until you tap it to expand the full goal, progress bar, and checklist. Git footer **Details** opens full-screen with refresh inside and a top `−` button to minimize it; session metrics and workspace, Git, and runtime details use compact grouped grids instead of stretched rows. Phone layouts use balanced compact text, spacing, cards, and 40-pixel controls so more content remains visible. Hover-only tooltips stay hidden on touch controls. In the **Control Deck**, desktop section dragging and `Alt+Arrow` movement are always available. On a phone, tap **Edit** to enable reordering, then tap **Done** to lock the order again.
|
|
46
|
+
|
|
42
47
|
## Keep it private
|
|
43
48
|
|
|
44
49
|
Pi Web UI can do anything the connected Pi session is allowed to do. It listens only on `127.0.0.1` by default. Do not expose it directly to an untrusted network. Use the optional Remote Web UI package when you need trusted-LAN access and PIN protection.
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
RpcSupervisorProtocolError,
|
|
16
16
|
assertProtocolCompatible,
|
|
17
17
|
constantTimeTokenEqual,
|
|
18
|
+
deriveSupervisorRecoveryToken,
|
|
18
19
|
encodeFrame,
|
|
19
20
|
frameReader,
|
|
20
21
|
validateClientFrame,
|
|
@@ -395,9 +396,11 @@ class SupervisorHost {
|
|
|
395
396
|
|
|
396
397
|
async spawnChildCandidate(child) {
|
|
397
398
|
const cwd = await realpath(child.cwd).catch(() => child.cwd);
|
|
399
|
+
const env = sanitizedSupervisorEnvironment(process.env);
|
|
400
|
+
if (env.PI_WEBUI_RECOVERY_URL) env.PI_WEBUI_RECOVERY_TOKEN = deriveSupervisorRecoveryToken(this.token);
|
|
398
401
|
const processChild = spawn(child.command, child.args, {
|
|
399
402
|
cwd,
|
|
400
|
-
env
|
|
403
|
+
env,
|
|
401
404
|
stdio: ["pipe", "pipe", "pipe"],
|
|
402
405
|
detached: process.platform !== "win32",
|
|
403
406
|
windowsHide: true,
|
package/bin/pi-webui.mjs
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
} from "../lib/webui-workspaces.mjs";
|
|
37
37
|
import { nativeExportDownloadPayload } from "../lib/native-export-payload.mjs";
|
|
38
38
|
import { discoverStartAttachRpcSupervisor } from "../lib/rpc-supervisor-client.mjs";
|
|
39
|
+
import { deriveSupervisorRecoveryToken } from "../lib/rpc-supervisor-protocol.mjs";
|
|
39
40
|
import { readSupervisorState, supervisorPaths } from "../lib/rpc-supervisor-state.mjs";
|
|
40
41
|
import {
|
|
41
42
|
collectOpenSessionFiles,
|
|
@@ -9109,6 +9110,7 @@ try {
|
|
|
9109
9110
|
process.env.PI_WEBUI_HOST = options.host;
|
|
9110
9111
|
process.env.PI_WEBUI_PORT = String(options.port);
|
|
9111
9112
|
const recoveryEndpointToken = String(process.env.PI_WEBUI_RECOVERY_TOKEN || "").trim() || `${randomUUID()}${randomUUID()}`;
|
|
9113
|
+
const recoveryEndpointTokens = new Set([recoveryEndpointToken]);
|
|
9112
9114
|
|
|
9113
9115
|
function recoveryLoopbackUrl(bindHost = options.host) {
|
|
9114
9116
|
const normalized = String(bindHost || "").trim().toLowerCase().replace(/^\[|\]$/g, "");
|
|
@@ -14331,7 +14333,8 @@ function recoveryText(value, field, maxChars) {
|
|
|
14331
14333
|
function requireRecoveryEndpointAuthorization(req) {
|
|
14332
14334
|
requireLocalhostRoute(req, RECOVERY_ENDPOINT_PATH);
|
|
14333
14335
|
const match = String(req.headers.authorization || "").match(/^Bearer\s+(.+)$/iu);
|
|
14334
|
-
|
|
14336
|
+
const credential = match?.[1]?.trim();
|
|
14337
|
+
if (!credential || ![...recoveryEndpointTokens].some((expected) => safeTimingEqual(credential, expected))) {
|
|
14335
14338
|
throw makeHttpError(401, "Invalid recovery endpoint credential");
|
|
14336
14339
|
}
|
|
14337
14340
|
}
|
|
@@ -16615,6 +16618,7 @@ if (options.migrationDryRun) {
|
|
|
16615
16618
|
}
|
|
16616
16619
|
|
|
16617
16620
|
rpcSupervisor = await initializeRpcSupervisor();
|
|
16621
|
+
if (rpcSupervisor?.state?.token) recoveryEndpointTokens.add(deriveSupervisorRecoveryToken(rpcSupervisor.state.token));
|
|
16618
16622
|
rpcSupervisorSnapshot = rpcSupervisor?.snapshot || null;
|
|
16619
16623
|
installRpcSupervisorEventDispatch(rpcSupervisorSnapshot);
|
|
16620
16624
|
const initialTabs = await createInitialTabs();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { randomUUID, timingSafeEqual } from "node:crypto";
|
|
1
|
+
import { createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
2
2
|
import { StringDecoder } from "node:string_decoder";
|
|
3
3
|
|
|
4
4
|
export const RPC_SUPERVISOR_PROTOCOL = Object.freeze({ major: 1, minor: 2 });
|
|
@@ -105,6 +105,11 @@ export function constantTimeTokenEqual(actual, expected) {
|
|
|
105
105
|
return timingSafeEqual(left, right);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
export function deriveSupervisorRecoveryToken(supervisorToken) {
|
|
109
|
+
if (typeof supervisorToken !== "string" || !supervisorToken) throw new TypeError("supervisorToken is required");
|
|
110
|
+
return createHmac("sha256", supervisorToken).update("pi-webui-recovery-v1").digest("base64url");
|
|
111
|
+
}
|
|
112
|
+
|
|
108
113
|
export function newRequestId() {
|
|
109
114
|
return randomUUID();
|
|
110
115
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firstpick/pi-package-webui",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
4
4
|
"description": "Pi Web UI companion package with a local browser UI CLI plus /webui-start and /webui-status commands.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-package-webui#readme",
|