@firstpick/pi-package-webui 0.8.6 → 0.8.7
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 +18 -606
- package/bin/pi-webui-launcher.mjs +22 -0
- package/bin/pi-webui-update-supervisor.mjs +86 -0
- package/bin/pi-webui.mjs +558 -524
- package/index.ts +8 -5
- package/lib/component-update-state.mjs +21 -0
- package/lib/git-workflow-preferences.mjs +17 -2
- package/lib/optional-feature-catalog.mjs +1 -0
- package/lib/sampling-parameter-capabilities.mjs +160 -0
- package/lib/session-summary-preferences.mjs +16 -1
- package/lib/subagent-launch-slots.mjs +14 -2
- package/lib/trust-boundaries.mjs +3 -0
- package/lib/update/executor.mjs +99 -0
- package/lib/update/journal.mjs +175 -0
- package/lib/update/owners.mjs +70 -0
- package/lib/update/plan.mjs +134 -0
- package/lib/update/resolver.mjs +168 -0
- package/lib/update/supervisor.mjs +238 -0
- package/lib/update/verify.mjs +52 -0
- package/lib/update-commands.mjs +25 -13
- package/lib/webui-workspaces.mjs +17 -1
- package/package.json +4 -4
- package/public/app.js +1290 -82
- package/public/index.html +124 -48
- package/public/middle-button-drag-scroll.mjs +154 -0
- package/public/sampling-parameter-controls.mjs +361 -0
- package/public/service-worker.js +3 -1
- package/public/styles.css +417 -1
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/control-deck-component-updates.spec.mjs +20 -22
- package/tests/browser/middle-button-drag-scroll.spec.mjs +145 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +68 -23
- package/tests/browser/sampling-tooltip.spec.mjs +228 -0
- package/tests/browser/update-reconnect.spec.mjs +92 -0
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/common-options-submenus-interaction-static.test.mjs +172 -0
- package/tests/common-options-submenus-markup-static.test.mjs +152 -0
- package/tests/component-update-api-static.test.mjs +22 -61
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-deck-component-updates-static.test.mjs +13 -237
- package/tests/durable-rpc-supervisor-harness.test.mjs +3 -1
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/feature-system-prompt-optional-feature-static.test.mjs +49 -0
- package/tests/fixtures/fake-pi.mjs +66 -0
- package/tests/fixtures/update/tree-timeout-descendant.mjs +6 -0
- package/tests/fixtures/update/tree-timeout-parent.mjs +11 -0
- package/tests/git-footer-context-menu-static.test.mjs +58 -0
- package/tests/http-endpoints-harness.test.mjs +68 -18
- package/tests/middle-button-drag-scroll-static.test.mjs +24 -0
- package/tests/middle-button-drag-scroll.test.mjs +170 -0
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +4 -4
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/mobile-static.test.mjs +23 -21
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-migration-frontend.test.mjs +9 -5
- package/tests/persistent-ui-layout-static.test.mjs +13 -2
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/remote-auth-settings-harness.test.mjs +34 -0
- package/tests/rpc-supervisor-host.test.mjs +11 -2
- package/tests/safety-guard-auto-review-harness.test.mjs +117 -0
- package/tests/safety-guard-auto-review-static.test.mjs +34 -0
- package/tests/sampling-native-controls-user-flow.test.mjs +752 -0
- package/tests/sampling-parameter-capabilities.test.mjs +167 -0
- package/tests/sampling-parameter-controls.test.mjs +241 -0
- package/tests/session-sampling-helper.test.mjs +228 -0
- package/tests/session-sampling-http.test.mjs +168 -0
- package/tests/session-sampling-ui-static.test.mjs +370 -0
- package/tests/session-summary-core.test.mjs +24 -11
- package/tests/side-panel-section-height-removal-static.test.mjs +34 -0
- package/tests/side-panel-section-reorder-static.test.mjs +3 -3
- package/tests/staged-content-hash-contract.test.mjs +52 -11
- package/tests/subagent-launch-slots.test.mjs +18 -1
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/ui-layout-settings.test.mjs +18 -1
- package/tests/update-api-harness.test.mjs +111 -0
- package/tests/update-commands.test.mjs +15 -45
- package/tests/update-executor-process-tree-harness.test.mjs +22 -0
- package/tests/update-journal-harness.test.mjs +59 -0
- package/tests/update-lock-multiprocess-harness.test.mjs +46 -0
- package/tests/update-owners.test.mjs +27 -0
- package/tests/update-plan.test.mjs +58 -0
- package/tests/update-resolver.test.mjs +56 -0
- package/tests/update-supervisor-harness.test.mjs +57 -0
- package/tests/update-tab-restore-harness.test.mjs +24 -0
- package/tests/update-verify.test.mjs +31 -0
- package/tests/workspace-files-live-updates-static.test.mjs +13 -4
- package/webui-rpc-helper.mjs +119 -0
package/lib/update-commands.mjs
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
return /(?:^|[^A-Za-z0-9_-])--all(?:$|[^A-Za-z0-9_-])/.test(String(output || ""));
|
|
3
|
-
}
|
|
1
|
+
const EXACT_VERSION = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/;
|
|
4
2
|
|
|
5
|
-
export function
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export function exactPackageSpec(packageName, version) {
|
|
4
|
+
const name = String(packageName || "").trim();
|
|
5
|
+
const exact = String(version || "").trim().replace(/^v/i, "");
|
|
6
|
+
if (!name || !EXACT_VERSION.test(exact)) throw new TypeError("packageName and an exact version are required");
|
|
7
|
+
return `${name}@${exact}`;
|
|
8
|
+
}
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
export function exactNpmInstallArgs({ installRoot, packageName, version, registry } = {}) {
|
|
11
|
+
const root = String(installRoot || "").trim();
|
|
12
|
+
const registryUrl = new URL(String(registry || ""));
|
|
13
|
+
if (!root) throw new TypeError("installRoot is required");
|
|
14
|
+
if (!/^https?:$/.test(registryUrl.protocol) || registryUrl.username || registryUrl.password || registryUrl.hash) {
|
|
15
|
+
throw new TypeError("registry must be a credential-free HTTP(S) URL");
|
|
16
|
+
}
|
|
10
17
|
return [
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
"install", "--prefix", root, "--ignore-scripts", "--no-save", "--package-lock=false",
|
|
19
|
+
"--registry", registryUrl.href, exactPackageSpec(packageName, version),
|
|
13
20
|
];
|
|
14
21
|
}
|
|
15
22
|
|
|
16
|
-
export function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
export function updatePlanConfirmationText(plan) {
|
|
24
|
+
if (!plan?.transactionId || !/^[a-f0-9]{64}$/.test(String(plan.digest || ""))) throw new TypeError("persisted update plan is required");
|
|
25
|
+
const targets = (plan.targets || []).map((target) => `${target.id} ${target.currentVersion} → ${target.targetVersion}`);
|
|
26
|
+
const refusals = (plan.refusals || []).map((item) => `${item.id}: ${item.guidance}`);
|
|
27
|
+
return [
|
|
28
|
+
targets.length ? `Exact targets: ${targets.join(" · ")}` : "No automatic targets were accepted.",
|
|
29
|
+
refusals.length ? `Refused: ${refusals.join(" · ")}` : "",
|
|
30
|
+
`Plan digest: ${plan.digest}`,
|
|
31
|
+
].filter(Boolean).join("\n");
|
|
20
32
|
}
|
package/lib/webui-workspaces.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
5
6
|
|
|
6
7
|
export const WEBUI_WORKSPACES_VERSION = 1;
|
|
7
8
|
export const WEBUI_WORKSPACE_LIMIT = 20;
|
|
@@ -152,13 +153,28 @@ export async function listWebuiWorkspaces(storageFile = webuiWorkspacesFile(), o
|
|
|
152
153
|
return document.workspaces.slice().reverse().map(workspaceMetadata).filter(Boolean);
|
|
153
154
|
}
|
|
154
155
|
|
|
156
|
+
async function renameWithWindowsRetry(source, target) {
|
|
157
|
+
let lastError;
|
|
158
|
+
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
159
|
+
try {
|
|
160
|
+
await rename(source, target);
|
|
161
|
+
return;
|
|
162
|
+
} catch (error) {
|
|
163
|
+
lastError = error;
|
|
164
|
+
if (process.platform !== "win32" || !["EACCES", "EBUSY", "EPERM"].includes(error?.code)) throw error;
|
|
165
|
+
await delay(25 * (attempt + 1));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
throw lastError;
|
|
169
|
+
}
|
|
170
|
+
|
|
155
171
|
async function writeWorkspaceDocument(document, storageFile) {
|
|
156
172
|
const normalized = normalizeWebuiWorkspaces(document);
|
|
157
173
|
await mkdir(path.dirname(storageFile), { recursive: true });
|
|
158
174
|
const temporaryFile = `${storageFile}.${process.pid}.${Date.now()}.${randomUUID()}.tmp`;
|
|
159
175
|
try {
|
|
160
176
|
await writeFile(temporaryFile, `${JSON.stringify(normalized, null, 2)}\n`, { mode: 0o600 });
|
|
161
|
-
await
|
|
177
|
+
await renameWithWindowsRetry(temporaryFile, storageFile);
|
|
162
178
|
} catch (error) {
|
|
163
179
|
await rm(temporaryFile, { force: true }).catch(() => {});
|
|
164
180
|
throw error;
|
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.7",
|
|
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",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
"bin": {
|
|
30
|
-
"pi-webui": "./bin/pi-webui.mjs"
|
|
30
|
+
"pi-webui": "./bin/pi-webui-launcher.mjs"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"check": "node --check public/app.js && node --check public/stream-output-controller.mjs && node --check public/theme-contract.mjs && node --check public/transcript-renderer.mjs && node --check public/mobile-shell-state.mjs && node --check public/issue-wizard-state.mjs && node --check public/issue-bot-client.mjs && node --check public/workflow-status-stack.mjs && node --check public/fast-output-live.mjs && node --check public/subagent-launch-slot-state.mjs && node --check public/subagent-gate-visibility.mjs && node --check public/voice-conversation.mjs && node --check public/aur-review-payload.mjs && node --check public/guided-git-command-state.mjs && node --check public/guided-git-review-state.mjs && node --check bin/pi-webui.mjs && node --check bin/pi-webui-rpc-supervisor.mjs && node --check lib/rpc-supervisor-protocol.mjs && node --check lib/rpc-supervisor-state.mjs && node --check lib/rpc-supervisor-client.mjs && node --check webui-rpc-helper.mjs && node --check lib/subagent-launch-slots.mjs && node --check lib/git-live-watcher.mjs && node --check lib/workspace-files-live-watcher.mjs && node --check lib/git-message-artifacts.mjs && node --check lib/trust-boundaries.mjs && node --check lib/native-command-adapter.mjs && node --check lib/session-actions.mjs && node --check lib/auth-actions.mjs && node --check lib/temp-artifacts.mjs && node tests/run-all.mjs",
|
|
33
|
+
"check": "node --check public/app.js && node --check public/middle-button-drag-scroll.mjs && node --check public/stream-output-controller.mjs && node --check public/theme-contract.mjs && node --check public/transcript-renderer.mjs && node --check public/mobile-shell-state.mjs && node --check public/issue-wizard-state.mjs && node --check public/issue-bot-client.mjs && node --check public/workflow-status-stack.mjs && node --check public/fast-output-live.mjs && node --check public/subagent-launch-slot-state.mjs && node --check public/subagent-gate-visibility.mjs && node --check public/voice-conversation.mjs && node --check public/aur-review-payload.mjs && node --check public/guided-git-command-state.mjs && node --check public/guided-git-review-state.mjs && node --check bin/pi-webui.mjs && node --check bin/pi-webui-launcher.mjs && node --check bin/pi-webui-update-supervisor.mjs && node --check lib/update/supervisor.mjs && node --check bin/pi-webui-rpc-supervisor.mjs && node --check lib/rpc-supervisor-protocol.mjs && node --check lib/rpc-supervisor-state.mjs && node --check lib/rpc-supervisor-client.mjs && node --check webui-rpc-helper.mjs && node --check lib/subagent-launch-slots.mjs && node --check lib/git-live-watcher.mjs && node --check lib/workspace-files-live-watcher.mjs && node --check lib/git-message-artifacts.mjs && node --check lib/trust-boundaries.mjs && node --check lib/native-command-adapter.mjs && node --check lib/session-actions.mjs && node --check lib/auth-actions.mjs && node --check lib/temp-artifacts.mjs && node tests/run-all.mjs",
|
|
34
34
|
"test": "node tests/run-all.mjs",
|
|
35
35
|
"test:browser": "playwright test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@earendil-works/pi-ai": "^0.83.0",
|
|
39
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
39
|
+
"@earendil-works/pi-coding-agent": "^0.84.0",
|
|
40
40
|
"@earendil-works/pi-tui": "^0.83.0",
|
|
41
41
|
"@firstpick/pi-utils": "^0.2.5",
|
|
42
42
|
"mermaid": "^11.15.0",
|