@firstpick/pi-package-webui 0.5.8 → 0.5.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 +2 -0
- package/bin/pi-webui.mjs +529 -7
- package/package.json +1 -1
- package/public/app.js +527 -45
- package/public/index.html +12 -4
- package/public/styles.css +211 -2
- package/tests/compaction-resume-harness.test.mjs +114 -0
- package/tests/compaction-static.test.mjs +25 -0
- package/tests/fixtures/compacting-pi.mjs +115 -0
- package/tests/fixtures/fake-pi.mjs +66 -1
- package/tests/http-endpoints-harness.test.mjs +121 -2
- package/tests/mobile-static.test.mjs +30 -5
|
@@ -37,6 +37,21 @@ async function request(host, pathname, { method = "GET", body, timeoutMs = 5_000
|
|
|
37
37
|
return { status: response.status, body: payload };
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
async function rmWithRetry(target) {
|
|
41
|
+
let lastError;
|
|
42
|
+
for (let attempt = 0; attempt < 8; attempt++) {
|
|
43
|
+
try {
|
|
44
|
+
await rm(target, { recursive: true, force: true });
|
|
45
|
+
return;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
lastError = error;
|
|
48
|
+
if (error?.code !== "EBUSY" && error?.code !== "EPERM" && error?.code !== "ENOTEMPTY") throw error;
|
|
49
|
+
await delay(150 * (attempt + 1));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
throw lastError;
|
|
53
|
+
}
|
|
54
|
+
|
|
40
55
|
function runGitFixture(args, cwd, message) {
|
|
41
56
|
const result = spawnSync("git", args, {
|
|
42
57
|
cwd,
|
|
@@ -567,6 +582,62 @@ try {
|
|
|
567
582
|
await request("127.0.0.1", "/api/app-runner/clear", { method: "POST", body: { tab: tabId } });
|
|
568
583
|
}
|
|
569
584
|
|
|
585
|
+
if (process.platform !== "win32") {
|
|
586
|
+
await writeFile(path.join(cwd, "signal-runner.mjs"), [
|
|
587
|
+
"import { writeFileSync } from 'node:fs';",
|
|
588
|
+
"process.on('SIGINT', () => { writeFileSync('signal-result.txt', 'SIGINT\\n'); process.exit(130); });",
|
|
589
|
+
"process.on('SIGTERM', () => { writeFileSync('signal-result.txt', 'SIGTERM\\n'); process.exit(143); });",
|
|
590
|
+
"console.log('signal runner ready');",
|
|
591
|
+
"setInterval(() => {}, 1000);",
|
|
592
|
+
"",
|
|
593
|
+
].join("\n"));
|
|
594
|
+
const savedSignalRunner = await request("127.0.0.1", "/api/app-runner-config", {
|
|
595
|
+
method: "POST",
|
|
596
|
+
body: { tab: tabId, runner: { label: "Signal node", command: process.execPath, path: "signal-runner.mjs" } },
|
|
597
|
+
timeoutMs: 10_000,
|
|
598
|
+
});
|
|
599
|
+
assert.equal(savedSignalRunner.status, 200, `saving a signal custom runner should succeed: ${savedSignalRunner.body?.error || ""}`);
|
|
600
|
+
const signalRunner = savedSignalRunner.body?.data?.runners?.find((runner) => runner.custom === true && runner.label === "Signal node");
|
|
601
|
+
assert.ok(signalRunner?.id, "signal custom runner should appear in detected app runners");
|
|
602
|
+
let signalRunState = await request("127.0.0.1", "/api/app-runner", {
|
|
603
|
+
method: "POST",
|
|
604
|
+
body: { tab: tabId, runnerId: signalRunner.id },
|
|
605
|
+
timeoutMs: 10_000,
|
|
606
|
+
});
|
|
607
|
+
assert.equal(signalRunState.status, 200, `signal runner start should return ok: ${signalRunState.body?.error || ""}`);
|
|
608
|
+
for (let attempt = 0; attempt < 50; attempt++) {
|
|
609
|
+
signalRunState = await request("127.0.0.1", `/api/app-runners?tab=${encodeURIComponent(tabId)}`, { timeoutMs: 5_000 });
|
|
610
|
+
const output = [
|
|
611
|
+
...(signalRunState.body?.data?.activeRun?.lines || []),
|
|
612
|
+
signalRunState.body?.data?.activeRun?.pendingLine || "",
|
|
613
|
+
].join("\n");
|
|
614
|
+
if (/signal runner ready/.test(output)) break;
|
|
615
|
+
await delay(100);
|
|
616
|
+
}
|
|
617
|
+
assert.match([
|
|
618
|
+
...(signalRunState.body?.data?.activeRun?.lines || []),
|
|
619
|
+
signalRunState.body?.data?.activeRun?.pendingLine || "",
|
|
620
|
+
].join("\n"), /signal runner ready/, "signal app runner should start before stop is requested");
|
|
621
|
+
const signalStop = await request("127.0.0.1", "/api/app-runner/stop", { method: "POST", body: { tab: tabId }, timeoutMs: 10_000 });
|
|
622
|
+
assert.equal(signalStop.status, 200, `signal runner stop should return ok: ${signalStop.body?.error || ""}`);
|
|
623
|
+
assert.match((signalStop.body?.data?.activeRun?.lines || []).join("\n"), /sending Ctrl\+C/, "Web UI stop should document Ctrl+C-equivalent interruption");
|
|
624
|
+
let signalResult = "";
|
|
625
|
+
for (let attempt = 0; attempt < 50; attempt++) {
|
|
626
|
+
signalRunState = await request("127.0.0.1", `/api/app-runners?tab=${encodeURIComponent(tabId)}`, { timeoutMs: 5_000 });
|
|
627
|
+
try {
|
|
628
|
+
signalResult = await readFile(path.join(cwd, "signal-result.txt"), "utf8");
|
|
629
|
+
} catch {
|
|
630
|
+
signalResult = "";
|
|
631
|
+
}
|
|
632
|
+
const signalRunStopped = signalRunState.body?.data?.activeRun?.status && signalRunState.body.data.activeRun.status !== "running";
|
|
633
|
+
if (signalResult && signalRunStopped) break;
|
|
634
|
+
await delay(100);
|
|
635
|
+
}
|
|
636
|
+
assert.equal(signalResult.trim(), "SIGINT", "Web UI app-runner stop should deliver SIGINT like terminal Ctrl+C, not SIGTERM");
|
|
637
|
+
assert.notEqual(signalRunState.body?.data?.activeRun?.status, "running", "signal app runner should fully stop before cleanup continues");
|
|
638
|
+
await request("127.0.0.1", "/api/app-runner/clear", { method: "POST", body: { tab: tabId } });
|
|
639
|
+
}
|
|
640
|
+
|
|
570
641
|
await writeFile(path.join(cwd, ".pi-webui-runners.json"), `${JSON.stringify({
|
|
571
642
|
version: 1,
|
|
572
643
|
runners: [{ id: "broken-custom", label: "Broken custom", command: "definitely-missing-pi-webui-runner", path: "custom-runner.mjs" }],
|
|
@@ -587,6 +658,51 @@ try {
|
|
|
587
658
|
assert.equal(copy.body?.data?.status, "succeeded", "native /copy should succeed through the adapter");
|
|
588
659
|
assert.equal(copy.body?.data?.copyText, "fake last text");
|
|
589
660
|
|
|
661
|
+
// Natural Conversation shell: /talk availability drives per-tab status and safety guards.
|
|
662
|
+
const conversationFeature = await request("127.0.0.1", `/api/features/natural-conversation?tab=${encodeURIComponent(tabId)}`);
|
|
663
|
+
assert.equal(conversationFeature.status, 200);
|
|
664
|
+
assert.equal(conversationFeature.body?.data?.available, true, "fake /talk command should make Natural Conversation available");
|
|
665
|
+
assert.ok(conversationFeature.body?.data?.commands?.includes("talk"), "Natural Conversation feature data should expose loaded /talk commands");
|
|
666
|
+
assert.equal(conversationFeature.body?.data?.mode?.enabled, false, "Natural Conversation should start disabled per tab");
|
|
667
|
+
|
|
668
|
+
const conversationOn = await request("127.0.0.1", "/api/conversation-mode", {
|
|
669
|
+
method: "POST",
|
|
670
|
+
body: { enabled: true, tab: tabId },
|
|
671
|
+
});
|
|
672
|
+
assert.equal(conversationOn.status, 200, `conversation-mode on should succeed: ${conversationOn.body?.error || ""}`);
|
|
673
|
+
assert.equal(conversationOn.body?.data?.mode?.enabled, true, "conversation-mode on should update tab-local mode state");
|
|
674
|
+
assert.equal(conversationOn.body?.tab?.conversationMode?.enabled, true, "conversation mode should be included in returned tab metadata");
|
|
675
|
+
|
|
676
|
+
const conversationState = await request("127.0.0.1", `/api/state?tab=${encodeURIComponent(tabId)}`);
|
|
677
|
+
assert.equal(conversationState.status, 200);
|
|
678
|
+
assert.equal(conversationState.body?.data?.thinkingLevel, "off", "Natural Conversation shell should keep thinking forced off");
|
|
679
|
+
|
|
680
|
+
const blockedSlash = await request("127.0.0.1", "/api/prompt", { method: "POST", body: { message: "/copy", tab: tabId } });
|
|
681
|
+
assert.equal(blockedSlash.status, 409, "non-/talk slash commands should be blocked while Natural Conversation is active");
|
|
682
|
+
assert.match(String(blockedSlash.body?.error || ""), /Natural Conversation Mode is active; slash commands are blocked/);
|
|
683
|
+
|
|
684
|
+
const blockedSettings = await request("127.0.0.1", "/api/settings", { method: "POST", body: { thinkingLevel: "high", tab: tabId } });
|
|
685
|
+
assert.equal(blockedSettings.status, 409, "settings changes should be blocked while Natural Conversation is active");
|
|
686
|
+
assert.match(String(blockedSettings.body?.error || ""), /settings changes are blocked/);
|
|
687
|
+
|
|
688
|
+
const blockedBash = await request("127.0.0.1", "/api/bash", { method: "POST", body: { command: "echo blocked", tab: tabId } });
|
|
689
|
+
assert.equal(blockedBash.status, 409, "user bash should be blocked while Natural Conversation is active");
|
|
690
|
+
assert.match(String(blockedBash.body?.error || ""), /bash is blocked|Natural Conversation Mode is active/);
|
|
691
|
+
|
|
692
|
+
const allowedConversationPrompt = await request("127.0.0.1", "/api/prompt", { method: "POST", body: { message: "Explain the current repo briefly", tab: tabId } });
|
|
693
|
+
assert.equal(allowedConversationPrompt.status, 200, "ordinary prompts remain allowed while Natural Conversation is active");
|
|
694
|
+
|
|
695
|
+
const sttPlaceholder = await request("127.0.0.1", "/api/stt/transcribe", { method: "POST", body: { tab: tabId } });
|
|
696
|
+
assert.equal(sttPlaceholder.status, 501, "hosted/local STT placeholder route should be explicit and non-operational");
|
|
697
|
+
assert.match(String(sttPlaceholder.body?.error || ""), /STT\/TTS fallbacks are not implemented/);
|
|
698
|
+
|
|
699
|
+
const conversationOff = await request("127.0.0.1", "/api/conversation-mode", {
|
|
700
|
+
method: "POST",
|
|
701
|
+
body: { enabled: false, tab: tabId },
|
|
702
|
+
});
|
|
703
|
+
assert.equal(conversationOff.status, 200, `conversation-mode off should succeed: ${conversationOff.body?.error || ""}`);
|
|
704
|
+
assert.equal(conversationOff.body?.data?.mode?.enabled, false, "conversation-mode off should restore normal WebUI actions");
|
|
705
|
+
|
|
590
706
|
// Bash FIFO queue: concurrent requests must execute serially on the RPC.
|
|
591
707
|
const [bashA, bashB] = await Promise.all([
|
|
592
708
|
request("127.0.0.1", "/api/bash", { method: "POST", body: { command: "echo a", tab: tabId }, timeoutMs: 10_000 }),
|
|
@@ -709,8 +825,11 @@ try {
|
|
|
709
825
|
}
|
|
710
826
|
assert.notEqual(child.exitCode, null, "server should exit after /api/shutdown");
|
|
711
827
|
} finally {
|
|
712
|
-
if (child.exitCode === null)
|
|
713
|
-
|
|
828
|
+
if (child.exitCode === null) {
|
|
829
|
+
child.kill("SIGKILL");
|
|
830
|
+
await new Promise((resolve) => child.once("exit", resolve));
|
|
831
|
+
}
|
|
832
|
+
await rmWithRetry(cwd);
|
|
714
833
|
}
|
|
715
834
|
|
|
716
835
|
console.log("http-endpoints-harness.test.mjs passed");
|
|
@@ -154,6 +154,9 @@ assert.ok(
|
|
|
154
154
|
Math.min(optionsReloadIndex, optionsNameIndex) < optionsRemoteIndex && optionsRemoteIndex < Math.max(optionsReloadIndex, optionsNameIndex),
|
|
155
155
|
"Open Remote should render between Reload Pi and Name Session",
|
|
156
156
|
);
|
|
157
|
+
assert.match(html, /id="optionsConversationModeButton"[^>]*data-command="\/talk"[^>]*hidden[\s\S]*?<span>Start Conversation<\/span>/, "Options menu should include the feature-gated Natural Conversation toggle");
|
|
158
|
+
assert.match(html, /id="conversationModeChip" class="composer-conversation-mode-chip"[\s\S]*hidden>Voice: off<\/button>/, "composer should expose a hidden-until-active conversation status chip");
|
|
159
|
+
assert.match(html, /id="conversationModeEndButton" class="composer-conversation-end-button"[\s\S]*hidden>End conversation<\/button>/, "composer should expose a persistent End conversation button while active");
|
|
157
160
|
assert.match(html, /id="appRunnerMenuPanel"[^>]*aria-label="Detected app runners"/, "app-runner dropdown should render detected runner choices only from JS data");
|
|
158
161
|
assert.match(html, /id="appRunnerInfoDialog"[\s\S]*id="appRunnerInfoBody"/, "app-runner explanation popup should have a dynamic details body");
|
|
159
162
|
assert.match(app, /\.pi-webui-runners\.json/, "app-runner popup should explain the project-local custom runner config file");
|
|
@@ -695,7 +698,13 @@ assert.match(app, /id: "safetyGuard"[\s\S]*?@firstpick\/pi-extension-safety-guar
|
|
|
695
698
|
assert.match(app, /id: "tuiSkillsCommand"[\s\S]*?@firstpick\/pi-extension-setup-skills/, "optional features should include the TUI skills command companion");
|
|
696
699
|
assert.match(app, /id: "tuiToolsCommand"[\s\S]*?@firstpick\/pi-extension-tools/, "optional features should include the TUI tools command companion");
|
|
697
700
|
assert.match(app, /id: "remoteWebui"[\s\S]*?@firstpick\/pi-package-remote-webui/, "optional features should include the Remote WebUI companion");
|
|
698
|
-
assert.match(app, /
|
|
701
|
+
assert.match(app, /id: "naturalConversation"[\s\S]*?@firstpick\/pi-package-natural-conversation[\s\S]*?capabilityLabel: "\/talk, \/voice, or \/conversation"/, "optional features should include the capability-detected Natural Conversation shell");
|
|
702
|
+
assert.match(app, /NATURAL_CONVERSATION_COMMAND_NAMES = \["talk", "voice", "conversation"\]/, "frontend should detect Natural Conversation only from RPC-visible command aliases");
|
|
703
|
+
assert.match(app, /const conversationModeByTab = new Map\(\)/, "frontend should track Natural Conversation state per terminal tab");
|
|
704
|
+
assert.match(app, /function defaultConversationModeState[\s\S]*allowedTools: \["read", "grep", "find", "ls"\]/, "frontend Natural Conversation defaults should mirror the read-only tool allowlist");
|
|
705
|
+
assert.match(app, /function renderConversationModeControls\(\)[\s\S]*document\.body\.classList\.toggle\("conversation-mode-active", active\)[\s\S]*optionsConversationModeButton[\s\S]*conversationModeChip[\s\S]*conversationModeEndButton/, "frontend should render active Natural Conversation controls and page\/composer state");
|
|
706
|
+
assert.match(app, /async function setNaturalConversationModeEnabled\(enabled\)[\s\S]*api\("\/api\/conversation-mode", \{ method: "POST"/, "frontend Natural Conversation toggle should use the WebUI shell endpoint");
|
|
707
|
+
assert.match(app, /function updateOptionalFeatureAvailability\(\)[\s\S]*hasAvailableCommand\("git-staged-msg"\)[\s\S]*hasAvailableCommand\("release-npm"\)[\s\S]*hasAvailableCommand\("release-aur"\)[\s\S]*hasAvailableCommand\("safety-guard"\)[\s\S]*hasLoadedRpcCommand\("skills"\)[\s\S]*hasAvailableCommand\("todo-progress-status"\)[\s\S]*hasLoadedRpcCommand\("tools"\)[\s\S]*hasAvailableCommand\("remote"\)[\s\S]*NATURAL_CONVERSATION_COMMAND_NAMES\.some\(\(name\) => hasAvailableCommand\(name\)\)/, "optional feature detection should call RPC-visible commands directly and distinguish native resource selectors from TUI companions");
|
|
699
708
|
assert.match(app, /hasRemoteWebuiCommand = isOptionalFeatureEnabled\("remoteWebui"\) && hasAvailableCommand\("remote"\)[\s\S]*optionsRemoteButton\.hidden = !hasRemoteWebuiCommand[\s\S]*syncRemoteWebuiControlVisibility\(hasRemoteWebuiCommand\)/, "Options menu should track /remote availability and delegate network card visibility");
|
|
700
709
|
assert.match(app, /function syncRemoteWebuiControlVisibility[\s\S]*networkControlField\.hidden = !hasRemoteWebuiCommand/, "Remote WebUI network card should render whenever the optional feature and /remote command are enabled");
|
|
701
710
|
assert.match(app, /if \(featureId === "remoteWebui"\) syncRemoteWebuiControlVisibility\(false\)/, "Disabling Remote WebUI should immediately hide browser network controls before broader rerendering");
|
|
@@ -752,7 +761,12 @@ assert.match(app, /function renderReleaseNpmOutputWidget\(\)/, "release-npm live
|
|
|
752
761
|
assert.match(app, /async function refreshAppRunners\(tabContext = activeTabContext\(\)\)/, "frontend should load detected app runners for the active tab cwd");
|
|
753
762
|
assert.match(app, /function renderAppRunnerWidget\(\)/, "frontend should render app runner output in the shared top widget area");
|
|
754
763
|
assert.match(app, /function tabAppRunnerRunningRun\(tab\)[\s\S]*appRunnerIsRunning\(run\)/, "frontend should derive running app-runner state for terminal tab indicators");
|
|
755
|
-
assert.match(app, /function appendTerminalTabContent\(button, \{ title, indicator, meta, count = null, appRunnerRun = null \}\)[\s\S]*terminal-tab-app-runner-indicator/, "terminal tab content should render a visible app-runner badge");
|
|
764
|
+
assert.match(app, /function appendTerminalTabContent\(button, \{ title, indicator, meta, count = null, appRunnerRun = null, conversationModeActive = false \}\)[\s\S]*terminal-tab-app-runner-indicator/, "terminal tab content should render a visible app-runner badge");
|
|
765
|
+
assert.match(app, /function appendTerminalTabContent\(button,[\s\S]*terminal-tab-conversation-indicator/, "terminal tab content should render a visible Natural Conversation badge");
|
|
766
|
+
assert.match(app, /function renderTerminalTab\(tab\)[\s\S]*conversation-mode-running/, "terminal tabs should indicate active Natural Conversation mode per tab");
|
|
767
|
+
assert.match(css, /\.composer-conversation-mode-chip[\s\S]*\.composer-conversation-end-button/, "Natural Conversation composer controls should have dedicated styles");
|
|
768
|
+
assert.match(css, /\.composer\.conversation-mode-active[\s\S]*body\.conversation-mode-active \.composer::before/, "active Natural Conversation mode should visibly glow around the composer");
|
|
769
|
+
assert.match(css, /\.terminal-tab\.conversation-mode-running[\s\S]*\.terminal-tab-conversation-indicator/, "Natural Conversation tabs should have active-tab and badge styles");
|
|
756
770
|
assert.match(app, /function renderTerminalTabGroup\(group[\s\S]*tabGroupAppRunnerRunningRun\(groupTabs\)[\s\S]*app-runner-running/, "terminal tab groups should indicate when any child tab has a running app runner");
|
|
757
771
|
assert.match(server, /function tabMeta\(tab\)[\s\S]*appRunner: publicAppRunnerState\(tab\.appRunner\)/, "server should expose app-runner state in tab metadata for inactive tab indicators");
|
|
758
772
|
assert.match(app, /function renderAppRunnerInputForm\(run\)[\s\S]*app-runner-stdin-input[\s\S]*Send stdin/, "frontend should let running app runners receive line-oriented stdin");
|
|
@@ -956,7 +970,7 @@ assert.match(app, /sendPromptFromModeButton\("follow-up", elements\.followUpButt
|
|
|
956
970
|
assert.match(app, /async function sendBtwQuestion\(question,[\s\S]*?`\/btw \$\{cleanQuestion\}`[\s\S]*?await sendPrompt\("prompt", message, \{ targetTabId, throwOnError: true \}\)/, "/btw helper should send text as an ephemeral slash command");
|
|
957
971
|
assert.match(app, /async function sendBtwPromptFromButton\(\)[\s\S]*?if \(!question\) \{\n\s+openBtwComposerWidget\(\);/, "empty /btw button should open the side-question widget input");
|
|
958
972
|
assert.match(app, /function renderBtwComposerForm\(\)[\s\S]*?form\.requestSubmit\(\)[\s\S]*?sendBtwQuestion\(question\)/, "/btw widget input should submit each message as a /btw trigger");
|
|
959
|
-
assert.match(app, /function makeBtwTransferIcon\(\)[\s\S]*?class", "btw-transfer-icon"[\s\S]*?function transferBtwContextToMain\(button\)[\s\S]*?`\/btw-transfer \$\{encoded\}`[\s\S]*?streamingBehavior:
|
|
973
|
+
assert.match(app, /function makeBtwTransferIcon\(\)[\s\S]*?class", "btw-transfer-icon"[\s\S]*?function transferBtwContextToMain\(button, \{ transferMode = "full" \} = \{\}\)[\s\S]*?`\/btw-transfer \$\{encoded\}`[\s\S]*?streamingBehavior: "steer"[\s\S]*?Summarize & Steer/, "/btw widget should expose full-context and summary transfer actions that send steering context during active runs");
|
|
960
974
|
assert.match(app, /async function sendPrompt\(kind = "prompt", explicitMessage, \{ targetTabId = activeTabId, throwOnError = false, streamingBehavior \} = \{\}\)[\s\S]*?if \(targetWasStreaming\) body\.streamingBehavior = streamingBehavior \|\| busyBehavior/, "prompt sending should support a per-call streaming behavior override");
|
|
961
975
|
assert.match(app, /function runPublishWorkflow\(command\)[\s\S]*?sendPrompt\("prompt", `\/\$\{resolvedCommandName\}\$\{commandRest\}`\)/, "Publish workflows should send resolved slash commands directly without replacing the draft");
|
|
962
976
|
assert.match(app, /async function runNativeCommandMenu\(command\)[\s\S]*?await handleNativeSlashSelectorCommand\(command\)/, "skills/tools command menu should open native selector dialogs directly");
|
|
@@ -1143,7 +1157,7 @@ assert.ok(mochaBackground.length > 8000, "Catppuccin Mocha background image shou
|
|
|
1143
1157
|
|
|
1144
1158
|
assert.match(server, /AuthStorage, SessionManager/, "server should import AuthStorage for safe OAuth token refresh");
|
|
1145
1159
|
assert.match(server, /DefaultPackageManager/, "server should use Pi's package resolver when controlling Web UI tab extension loading");
|
|
1146
|
-
assert.match(server, /WEBUI_CONTROLLED_PACKAGES = new Set\(\[WEBUI_PACKAGE
|
|
1160
|
+
assert.match(server, /WEBUI_CONTROLLED_PACKAGES = new Set\(\[[\s\S]*WEBUI_PACKAGE[\s\S]*filter\(\(\[featureId\]\) => featureId !== NATURAL_CONVERSATION_FEATURE_ID\)/, "server should identify Web UI-controlled packages for de-duplicated feature loading while leaving Natural Conversation independently owned");
|
|
1147
1161
|
assert.match(server, /const args = \["--mode", "rpc", "--no-extensions", "--no-skills", "--no-prompt-templates", "--no-themes"\]/, "Web UI tabs should disable implicit resource loading before adding curated resource paths");
|
|
1148
1162
|
assert.match(server, /normalPiResourcePathsForTab[\s\S]*WEBUI_CONTROLLED_PACKAGES\.has\(packageName\)[\s\S]*continue/, "Web UI tab resource resolution should exclude separately installed Web UI feature packages");
|
|
1149
1163
|
assert.match(server, /startedWebuiResourcePaths\(resourceType\)/, "Web UI tabs should load feature resources from the started Web UI package");
|
|
@@ -1270,7 +1284,15 @@ assert.match(server, /\["btwCommand", "@firstpick\/pi-extension-btw"\]/, "server
|
|
|
1270
1284
|
assert.match(server, /\["safetyGuard", "@firstpick\/pi-extension-safety-guard"\]/, "server should allow installing the safety guard optional feature");
|
|
1271
1285
|
assert.match(server, /\["tuiSkillsCommand", "@firstpick\/pi-extension-setup-skills"\]/, "server should allow installing the TUI skills optional feature");
|
|
1272
1286
|
assert.match(server, /\["tuiToolsCommand", "@firstpick\/pi-extension-tools"\]/, "server should allow installing the TUI tools optional feature");
|
|
1273
|
-
assert.match(server,
|
|
1287
|
+
assert.match(server, /\["naturalConversation", "@firstpick\/pi-package-natural-conversation"\]/, "server should know the standalone Natural Conversation package for status\/install guidance without making it WebUI-owned");
|
|
1288
|
+
assert.match(server, /const NATURAL_CONVERSATION_COMMAND_NAMES = \["talk", "voice", "conversation"\]/, "server should detect Natural Conversation from RPC-visible command aliases");
|
|
1289
|
+
assert.match(server, /function naturalConversationFeatureData\(tab[\s\S]*getCommandData\(tab\)[\s\S]*available[\s\S]*mode/, "server should expose a capability-based Natural Conversation feature snapshot");
|
|
1290
|
+
assert.match(server, /url\.pathname === "\/api\/features\/natural-conversation" && req\.method === "GET"[\s\S]*naturalConversationFeatureData\(tab\)/, "server should expose Natural Conversation feature metadata");
|
|
1291
|
+
assert.match(server, /url\.pathname === "\/api\/conversation-mode" && req\.method === "POST"[\s\S]*setNaturalConversationMode\(tab, body\)/, "server should toggle Natural Conversation through the package-owned slash command");
|
|
1292
|
+
assert.match(server, /url\.pathname === "\/api\/stt\/transcribe" \|\| url\.pathname === "\/api\/tts\/speech"[\s\S]*501[\s\S]*hosted\/local STT\/TTS fallbacks are not implemented/, "server STT\/TTS routes should be explicit later-phase placeholders");
|
|
1293
|
+
assert.match(server, /function ensureNaturalConversationPromptSafety\(tab, command\)[\s\S]*setThinkingLevelForTab\(tab, "off"/, "server should force thinking off before WebUI prompts while conversation mode is active");
|
|
1294
|
+
assert.match(server, /function enforceNaturalConversationCommandAllowed\(tab, command\)[\s\S]*thinking is forced off[\s\S]*slash commands are blocked from the Web UI shell/, "server should block unsafe direct RPC\/WebUI commands while conversation mode is active");
|
|
1295
|
+
assert.match(server, /function optionalFeaturePackageStatus\(featureId\)/, "server should report optional feature package install\/update status");
|
|
1274
1296
|
assert.match(server, /function installOptionalFeaturePackage\(featureId\)/, "server should provide optional feature package installation helper");
|
|
1275
1297
|
assert.match(server, /PI_WEBUI_OPTIONAL_FEATURE_INSTALL_ROOT/, "optional feature installs should support an explicit package-manager root override");
|
|
1276
1298
|
assert.match(server, /function configuredAgentNpmRoot\(\)/, "global Web UI launches should consider Pi's agent npm root for optional packages");
|
|
@@ -1317,6 +1339,7 @@ assert.match(readme, /avoiding duplicate loads while keeping global `pi-webui` l
|
|
|
1317
1339
|
assert.match(readme, /checks loaded Pi capabilities directly through RPC-visible commands and live widget events/, "README should document capability-based startup checks");
|
|
1318
1340
|
assert.match(readme, /side panel shows each optional feature as enabled, disabled, installed-but-not-loaded, update-available, or install-needed/, "README should document optional feature side-panel controls");
|
|
1319
1341
|
assert.match(readme, /Installing or updating a feature is an explicit, warned action with running\/failure feedback/, "README should document optional feature install and update warning behavior");
|
|
1342
|
+
assert.match(readme, /Natural Conversation Mode shell[\s\S]*\/talk[\s\S]*read-only/, "README should document the optional Natural Conversation WebUI shell");
|
|
1320
1343
|
assert.match(readme, /\.\/dev\/scripts\/start-webui\.sh --dev --cwd \/path\/to\/project/, "README should document the dev helper launcher");
|
|
1321
1344
|
assert.match(readme, /sync-pi-package-symlinks\.sh[\s\S]*only one copy is loaded/, "README should document dev companion symlink setup");
|
|
1322
1345
|
assert.match(startScript, /--dev\)/, "start-webui.sh should accept a --dev flag");
|
|
@@ -1335,6 +1358,8 @@ for (const [name, range] of Object.entries(companionDependencies)) {
|
|
|
1335
1358
|
assert.equal(pkg.dependencies?.[name], undefined, `webui package should not require optional companion ${name}`);
|
|
1336
1359
|
}
|
|
1337
1360
|
assert.equal(pkg.bundledDependencies, undefined, "webui optional companion packages should not be bundled into the tarball");
|
|
1361
|
+
assert.equal(pkg.optionalDependencies?.["@firstpick/pi-package-natural-conversation"], undefined, "webui package should not optionally depend on the standalone Natural Conversation package");
|
|
1362
|
+
assert.ok(!pkg.pi?.extensions?.some((entry) => String(entry).includes("pi-package-natural-conversation")), "webui Pi manifest should not load Natural Conversation directly; /talk must come from the standalone package");
|
|
1338
1363
|
assert.ok(pkg.pi?.extensions?.includes("./index.ts"), "webui Pi manifest should load its own extension");
|
|
1339
1364
|
for (const extensionPath of [
|
|
1340
1365
|
"node_modules/@firstpick/pi-extension-git-footer-status/index.ts",
|