@firstpick/pi-package-webui 0.8.8 → 0.9.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 +12 -0
- package/bin/pi-webui-rpc-supervisor.mjs +4 -1
- package/bin/pi-webui.mjs +15 -3
- package/lib/rpc-supervisor-protocol.mjs +6 -1
- package/package.json +1 -1
- package/public/app.js +659 -150
- package/public/index.html +28 -13
- package/public/service-worker.js +1 -1
- package/public/styles.css +789 -23
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/interaction-continuity.spec.mjs +120 -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/search-match-highlighting.spec.mjs +104 -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/file-viewer-search-static.test.mjs +7 -2
- package/tests/fixtures/fake-pi.mjs +4 -1
- package/tests/foreground-transcript-catch-up-static.test.mjs +91 -0
- package/tests/http-endpoints-harness.test.mjs +35 -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 +39 -20
- 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/search-match-highlighting-static.test.mjs +27 -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/stream-output-isolation-static.test.mjs +1 -1
- 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
|
@@ -9,7 +9,9 @@ Use Pi from a local browser with tabs, streaming responses, uploads, model contr
|
|
|
9
9
|
- Work in several Pi sessions at once.
|
|
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
|
+
- Search files, transcripts, and live agent output with every match highlighted.
|
|
12
13
|
- Resume sessions, switch projects, and use guided Git helpers.
|
|
14
|
+
- Keep phone sessions compact with expandable terminal navigation and secondary composer actions.
|
|
13
15
|
- Add optional themes, statistics, remote access, voice features, and other companion packages.
|
|
14
16
|
|
|
15
17
|
## Install
|
|
@@ -30,6 +32,10 @@ Inside Pi, run:
|
|
|
30
32
|
|
|
31
33
|
Open the printed address, usually <http://127.0.0.1:31415/>. Check a running server with `/webui-status`.
|
|
32
34
|
|
|
35
|
+
Press `Ctrl/Cmd+F` while a file, transcript, or subagent output view is active to highlight every match; use `Enter` and `Shift+Enter` to move between matches.
|
|
36
|
+
|
|
37
|
+
You can leave the Web UI on another desktop workspace while Pi runs. When you return, it replaces hidden live-output updates with one current transcript snapshot so the page does not replay every intermediate render.
|
|
38
|
+
|
|
33
39
|
You can also install the standalone launcher:
|
|
34
40
|
|
|
35
41
|
```bash
|
|
@@ -39,6 +45,12 @@ pi-webui
|
|
|
39
45
|
|
|
40
46
|
If no working directory is supplied, the browser asks which project to open first.
|
|
41
47
|
|
|
48
|
+
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.
|
|
49
|
+
|
|
50
|
+
Pushes started from the Git footer or Guided Git target the active tab's currently checked-out branch on the remote and track that same-named remote branch as its upstream, replacing a mismatched upstream such as `origin/main`.
|
|
51
|
+
|
|
52
|
+
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.
|
|
53
|
+
|
|
42
54
|
## Keep it private
|
|
43
55
|
|
|
44
56
|
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,
|
|
@@ -8338,12 +8339,20 @@ async function handleGitWorkflowRequest(pathname, body = {}, tabOrCwd = options.
|
|
|
8338
8339
|
// clobber remote commits we have not seen, and requires confirmation.
|
|
8339
8340
|
const forceWithLease = body.forceWithLease === true;
|
|
8340
8341
|
if (forceWithLease) requireConfirmed(body, `Force-pushing ${currentBranch} (--force-with-lease) rewrites the remote branch and`);
|
|
8341
|
-
const
|
|
8342
|
-
const
|
|
8342
|
+
const remotes = await gitRemoteNames(root);
|
|
8343
|
+
const remote = remotes.includes("origin") ? "origin" : remotes[0];
|
|
8344
|
+
const args = remote
|
|
8345
|
+
? ["push", "-u", ...(forceWithLease ? ["--force-with-lease"] : []), remote, "HEAD"]
|
|
8346
|
+
: ["push", ...(forceWithLease ? ["--force-with-lease"] : [])];
|
|
8347
|
+
const label = remote
|
|
8348
|
+
? `git push -u${forceWithLease ? " --force-with-lease" : ""} ${remote} HEAD`
|
|
8349
|
+
: undefined;
|
|
8350
|
+
const payload = await runGuardedGitMutation(args, { cwd: root, label, timeoutMs: 15 * 60 * 1000 });
|
|
8343
8351
|
if (payload.data) {
|
|
8344
8352
|
payload.data.branch = currentBranch;
|
|
8345
8353
|
payload.data.protectedBranch = protectedBranch;
|
|
8346
8354
|
payload.data.forceWithLease = forceWithLease;
|
|
8355
|
+
if (remote) payload.data.remote = remote;
|
|
8347
8356
|
}
|
|
8348
8357
|
return applyGitSyncFailure(payload, { push: true });
|
|
8349
8358
|
}
|
|
@@ -9109,6 +9118,7 @@ try {
|
|
|
9109
9118
|
process.env.PI_WEBUI_HOST = options.host;
|
|
9110
9119
|
process.env.PI_WEBUI_PORT = String(options.port);
|
|
9111
9120
|
const recoveryEndpointToken = String(process.env.PI_WEBUI_RECOVERY_TOKEN || "").trim() || `${randomUUID()}${randomUUID()}`;
|
|
9121
|
+
const recoveryEndpointTokens = new Set([recoveryEndpointToken]);
|
|
9112
9122
|
|
|
9113
9123
|
function recoveryLoopbackUrl(bindHost = options.host) {
|
|
9114
9124
|
const normalized = String(bindHost || "").trim().toLowerCase().replace(/^\[|\]$/g, "");
|
|
@@ -14331,7 +14341,8 @@ function recoveryText(value, field, maxChars) {
|
|
|
14331
14341
|
function requireRecoveryEndpointAuthorization(req) {
|
|
14332
14342
|
requireLocalhostRoute(req, RECOVERY_ENDPOINT_PATH);
|
|
14333
14343
|
const match = String(req.headers.authorization || "").match(/^Bearer\s+(.+)$/iu);
|
|
14334
|
-
|
|
14344
|
+
const credential = match?.[1]?.trim();
|
|
14345
|
+
if (!credential || ![...recoveryEndpointTokens].some((expected) => safeTimingEqual(credential, expected))) {
|
|
14335
14346
|
throw makeHttpError(401, "Invalid recovery endpoint credential");
|
|
14336
14347
|
}
|
|
14337
14348
|
}
|
|
@@ -16615,6 +16626,7 @@ if (options.migrationDryRun) {
|
|
|
16615
16626
|
}
|
|
16616
16627
|
|
|
16617
16628
|
rpcSupervisor = await initializeRpcSupervisor();
|
|
16629
|
+
if (rpcSupervisor?.state?.token) recoveryEndpointTokens.add(deriveSupervisorRecoveryToken(rpcSupervisor.state.token));
|
|
16618
16630
|
rpcSupervisorSnapshot = rpcSupervisor?.snapshot || null;
|
|
16619
16631
|
installRpcSupervisorEventDispatch(rpcSupervisorSnapshot);
|
|
16620
16632
|
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.
|
|
3
|
+
"version": "0.9.0",
|
|
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",
|