@firstpick/pi-package-webui 0.6.4 → 0.6.6
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 +20 -8
- package/bin/pi-webui.mjs +1477 -80
- package/index.ts +124 -0
- package/lib/WEBUI_TUI_NATIVE_PARITY.json +13 -0
- package/lib/git-workflow-preferences.mjs +153 -0
- package/lib/git-worktrees.mjs +42 -0
- package/lib/trust-boundaries.mjs +2 -0
- package/package.json +3 -3
- package/public/app.js +2838 -190
- package/public/index.html +50 -7
- package/public/styles.css +738 -4
- package/tests/fixtures/fake-pi.mjs +53 -0
- package/tests/git-workflow-preferences.test.mjs +67 -0
- package/tests/http-endpoints-harness.test.mjs +418 -0
- package/tests/markdown-links.test.mjs +113 -0
- package/tests/mobile-static.test.mjs +64 -17
- package/tests/native-parity-harness.test.mjs +1 -1
- package/tests/native-parity.test.mjs +1 -0
- package/tests/remote-auth-settings-harness.test.mjs +41 -0
- package/tests/subagents-helper.test.mjs +210 -0
- package/tests/theme-scheme-mode.test.mjs +5 -5
- package/webui-rpc-helper.mjs +536 -2
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import vm from "node:vm";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath, URL } from "node:url";
|
|
6
|
+
|
|
7
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const app = await readFile(join(root, "public", "app.js"), "utf8");
|
|
9
|
+
|
|
10
|
+
function findFunctionSource(source, name) {
|
|
11
|
+
const signature = new RegExp(`function\\s+${name}\\s*\\(`, "m");
|
|
12
|
+
const match = signature.exec(source);
|
|
13
|
+
assert.ok(match, `${name} should be defined`);
|
|
14
|
+
let parenDepth = 0;
|
|
15
|
+
let openBrace = -1;
|
|
16
|
+
for (let index = match.index + match[0].length - 1; index < source.length; index += 1) {
|
|
17
|
+
const char = source[index];
|
|
18
|
+
if (char === "(") parenDepth += 1;
|
|
19
|
+
else if (char === ")") parenDepth -= 1;
|
|
20
|
+
else if (char === "{" && parenDepth === 0) {
|
|
21
|
+
openBrace = index;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
assert.notEqual(openBrace, -1, `${name} body should open`);
|
|
26
|
+
let depth = 0;
|
|
27
|
+
for (let index = openBrace; index < source.length; index += 1) {
|
|
28
|
+
const char = source[index];
|
|
29
|
+
if (char === "{") depth += 1;
|
|
30
|
+
else if (char === "}") {
|
|
31
|
+
depth -= 1;
|
|
32
|
+
if (depth === 0) return source.slice(match.index, index + 1);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
assert.fail(`${name} body should close`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const helperNames = [
|
|
39
|
+
"markdownFilePathFromHref",
|
|
40
|
+
"safeMarkdownLinkHref",
|
|
41
|
+
"normalizeMarkdownWorkspacePath",
|
|
42
|
+
"markdownWorkspaceFilePath",
|
|
43
|
+
];
|
|
44
|
+
const context = { URL };
|
|
45
|
+
vm.runInNewContext(
|
|
46
|
+
`${helperNames.map((name) => findFunctionSource(app, name)).join("\n\n")}\nthis.markdownLinkHelpers = { ${helperNames.join(", ")} };`,
|
|
47
|
+
context,
|
|
48
|
+
);
|
|
49
|
+
const {
|
|
50
|
+
markdownFilePathFromHref,
|
|
51
|
+
safeMarkdownLinkHref,
|
|
52
|
+
markdownWorkspaceFilePath,
|
|
53
|
+
} = context.markdownLinkHelpers;
|
|
54
|
+
|
|
55
|
+
for (const href of [
|
|
56
|
+
"https://example.com/docs",
|
|
57
|
+
"mailto:dev@example.com",
|
|
58
|
+
"#details",
|
|
59
|
+
"docs/README.md",
|
|
60
|
+
"./docs/README.md",
|
|
61
|
+
"../README.md",
|
|
62
|
+
"/home/dev/project/README.md",
|
|
63
|
+
"C:/Users/dev/project/README.md",
|
|
64
|
+
String.raw`C:\Users\dev\project\README.md`,
|
|
65
|
+
"file:///C:/Users/dev/project/README.md",
|
|
66
|
+
]) {
|
|
67
|
+
assert.equal(safeMarkdownLinkHref(href), href, `safe Markdown link should be accepted: ${href}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
for (const href of [
|
|
71
|
+
"javascript:alert(1)",
|
|
72
|
+
"data:text/html,unsafe",
|
|
73
|
+
"vbscript:msgbox(1)",
|
|
74
|
+
"//example.com/unsafe",
|
|
75
|
+
String.raw`\\server\share\README.md`,
|
|
76
|
+
"file://server/share/README.md",
|
|
77
|
+
]) {
|
|
78
|
+
assert.equal(safeMarkdownLinkHref(href), "", `unsafe or remote-file Markdown link should be rejected: ${href}`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
assert.equal(markdownFilePathFromHref("README.md#overview"), "README.md");
|
|
82
|
+
assert.equal(markdownFilePathFromHref("file:///C:/My%20Project/README.md#overview"), "C:/My Project/README.md");
|
|
83
|
+
assert.equal(markdownFilePathFromHref(String.raw`C:\My Project\README.md`), "C:/My Project/README.md");
|
|
84
|
+
assert.equal(markdownFilePathFromHref("https://example.com/README.md"), "");
|
|
85
|
+
|
|
86
|
+
assert.equal(
|
|
87
|
+
markdownWorkspaceFilePath("C:/Users/Dev/Project/docs/README.md", String.raw`c:\users\dev\project`),
|
|
88
|
+
"docs/README.md",
|
|
89
|
+
"Windows workspace matching should be case-insensitive",
|
|
90
|
+
);
|
|
91
|
+
assert.equal(
|
|
92
|
+
markdownWorkspaceFilePath("file:///C:/Users/Dev/Project/My%20Doc.md", "C:/Users/Dev/Project"),
|
|
93
|
+
"My Doc.md",
|
|
94
|
+
"file URLs should resolve to a workspace-relative path",
|
|
95
|
+
);
|
|
96
|
+
assert.equal(
|
|
97
|
+
markdownWorkspaceFilePath("/home/dev/project/docs/README.md", "/home/dev/project"),
|
|
98
|
+
"docs/README.md",
|
|
99
|
+
"POSIX absolute paths should resolve inside the workspace",
|
|
100
|
+
);
|
|
101
|
+
assert.equal(markdownWorkspaceFilePath("docs/../README.md", "/unused"), "README.md");
|
|
102
|
+
assert.equal(markdownWorkspaceFilePath("../README.md", "/unused", "docs/guides"), "docs/README.md");
|
|
103
|
+
assert.equal(markdownWorkspaceFilePath("../../secret.txt", "/unused", "docs"), "", "relative traversal outside the workspace should be rejected");
|
|
104
|
+
assert.equal(markdownWorkspaceFilePath("D:/secret.txt", "C:/Users/Dev/Project"), "", "absolute paths outside the workspace should be rejected");
|
|
105
|
+
assert.equal(markdownWorkspaceFilePath("/home/dev/other/secret.txt", "/home/dev/project"), "", "POSIX paths outside the workspace should be rejected");
|
|
106
|
+
|
|
107
|
+
const configureMarkdownLinkSource = findFunctionSource(app, "configureMarkdownLink");
|
|
108
|
+
assert.match(configureMarkdownLinkSource, /link\.dataset\.markdownFileHref = href/, "local Markdown links should retain their file target");
|
|
109
|
+
assert.match(configureMarkdownLinkSource, /markdownWorkspaceFilePath\(href, cwd, basePath\)/, "local Markdown links should be scoped to the active workspace");
|
|
110
|
+
assert.match(configureMarkdownLinkSource, /openFileInViewer\(workspacePath\)/, "local Markdown links should open in the WebUI file viewer");
|
|
111
|
+
assert.match(app, /configureMarkdownLink\(link, href\);/, "inline Markdown rendering should configure every accepted link");
|
|
112
|
+
|
|
113
|
+
console.log("markdown link tests passed");
|
|
@@ -28,8 +28,8 @@ const helper = await readFile(join(root, "webui-rpc-helper.mjs"), "utf8");
|
|
|
28
28
|
const companionDependencies = {
|
|
29
29
|
"@firstpick/pi-extension-bang-command-autocomplete": "^0.2.1",
|
|
30
30
|
"@firstpick/pi-extension-btw": "^0.1.2",
|
|
31
|
-
"@firstpick/pi-extension-fish-user-bash": "^0.2.
|
|
32
|
-
"@firstpick/pi-extension-git-footer-status": "^0.3.
|
|
31
|
+
"@firstpick/pi-extension-fish-user-bash": "^0.2.1",
|
|
32
|
+
"@firstpick/pi-extension-git-footer-status": "^0.3.8",
|
|
33
33
|
"@firstpick/pi-extension-release-aur": "^0.1.7",
|
|
34
34
|
"@firstpick/pi-extension-release-npm": "^0.4.0",
|
|
35
35
|
"@firstpick/pi-extension-safety-guard": "^0.2.3",
|
|
@@ -71,9 +71,14 @@ assert.match(html, /id="agentDoneNotificationsToggle"/, "side panel should expos
|
|
|
71
71
|
assert.match(html, /id="agentDoneNotificationsStatus"/, "agent-done notifications toggle should expose status text");
|
|
72
72
|
assert.match(html, /id="thinkingVisibilityToggle"/, "side panel should expose a thinking-output visibility toggle");
|
|
73
73
|
assert.match(html, /id="thinkingVisibilityStatus"/, "thinking-output visibility toggle should expose status text");
|
|
74
|
+
assert.match(html, /<option value="xhigh">xhigh<\/option>\s*<option value="max">max<\/option>/, "side panel should expose Pi's max thinking effort after xhigh");
|
|
75
|
+
assert.match(app, /const SETTINGS_THINKING_OPTIONS = \["off", "minimal", "low", "medium", "high", "xhigh", "max"\]/, "native settings should expose every Pi thinking effort");
|
|
76
|
+
assert.match(app, /return levels\.length \? levels : \["off", "minimal", "low", "medium", "high", "xhigh", "max"\]/, "footer thinking picker fallback should include max effort");
|
|
77
|
+
assert.match(server, /const THINKING_LEVELS = \["off", "minimal", "low", "medium", "high", "xhigh", "max"\]/, "server should accept Pi's max thinking effort");
|
|
74
78
|
assert.match(html, /id="terminalTabsLayoutSelect"[\s\S]*<option value="left">Left sidebar<\/option>/, "side panel controls should expose a terminal-tabs layout selector");
|
|
75
79
|
assert.match(html, /id="terminalTabsLayoutStatus"/, "terminal-tabs layout selector should expose status text");
|
|
76
80
|
assert.match(html, /id="nativeCommandDialog"/, "native slash selector UI should have a dedicated dialog");
|
|
81
|
+
assert.match(html, /id="optionsGitWorkflowSetupButton"[\s\S]*data-command="\/git-workflow-setup"[\s\S]*Guided Git Setup/, "Common Pi options should expose native Guided Git Setup");
|
|
77
82
|
assert.match(html, /id="nativeCommandSearch"[^>]*type="search"/, "native slash selector dialog should expose a filter box");
|
|
78
83
|
assert.match(html, /id="remoteQrDialog"[\s\S]*id="remoteQrBody"[\s\S]*id="remoteQrCopyButton"/, "remote WebUI should expose a dedicated QR popup dialog");
|
|
79
84
|
assert.match(html, /id="commandPaletteCloseButton"[^>]*aria-label="Close command palette"[^>]*>Close<\/button>/, "command palette should expose a visible accessible close button");
|
|
@@ -86,6 +91,9 @@ assert.match(html, /class="optional-features-description[\s\S]*href="https:\/\/g
|
|
|
86
91
|
assert.doesNotMatch(html, /id="btwOverlayDialog"/, "/btw should not use a blocking modal overlay");
|
|
87
92
|
assert.match(html, /id="codexUsageBox"/, "side panel should expose Codex subscription usage status");
|
|
88
93
|
assert.match(html, /data-side-panel-section="codex-usage"/, "Codex usage should live in a collapsible side-panel section");
|
|
94
|
+
assert.match(html, /data-side-panel-section="subagents"[\s\S]*class="side-panel-section-label">Subagents<\/span>[\s\S]*id="subagentCountBadge"[\s\S]*id="subagentsBox"/, "side panel should expose grouped running subagents with a live count");
|
|
95
|
+
assert.doesNotMatch(html, /id="subagentOverlayDialog"/, "subagent output should not use a blocking modal dialog");
|
|
96
|
+
assert.match(html, /data-side-panel-section="session"[\s\S]*data-side-panel-section="subagents"[\s\S]*data-side-panel-section="queue"/, "Subagents should appear between Session and Queue in the side panel");
|
|
89
97
|
assert.match(html, /data-side-panel-section="queue"[\s\S]*id="createPromptListButton"[\s\S]*>Create prompt list<\/button>/, "Queue section should expose prompt-list creation");
|
|
90
98
|
assert.match(html, /id="loadPromptListButton"[\s\S]*>Load List<\/button>[\s\S]*id="runLoadedPromptListButton"[^>]*disabled[^>]*>Run<\/button>/, "Queue section should expose load and run controls for saved prompt lists");
|
|
91
99
|
assert.match(html, /id="promptListDialog"[\s\S]*id="promptListAddPromptButton"[\s\S]*\+ Add follow-up prompt/, "prompt-list dialog should add follow-up prompt rows");
|
|
@@ -151,6 +159,9 @@ assert.match(html, /id="nativeSkillsButton"[^>]*data-command="\/skills"[\s\S]*?<
|
|
|
151
159
|
assert.match(html, /id="nativeToolsButton"[^>]*data-command="\/tools"[\s\S]*?<span>Tools Setup<\/span>/, "skills/tools command menu should include Tools Setup");
|
|
152
160
|
assert.match(html, /id="appRunnerInfoButton"[\s\S]*?aria-controls="appRunnerInfoDialog"/, "detected app-runner controls should expose an explanation popup button");
|
|
153
161
|
assert.match(html, /id="appRunnerMenuButton"[\s\S]*?aria-controls="appRunnerMenuPanel"/, "composer should expose a detected app-runner dropdown button");
|
|
162
|
+
for (const menuId of ["publishMenu", "nativeCommandMenu", "optionsMenu", "appRunnerMenuPanel"]) {
|
|
163
|
+
assert.match(html, new RegExp(`id="${menuId}"[^>]*class="[^"]*composer-auto-height-menu-panel`), `${menuId} should opt into content-height sizing without internal scrolling`);
|
|
164
|
+
}
|
|
154
165
|
assert.ok(html.indexOf('id="optionsMenuButton"') < html.indexOf('id="appRunnerMenuButton"'), "app-runner dropdown should render to the right of the settings/options button");
|
|
155
166
|
assert.match(html, /id="optionsRemoteButton"[^>]*data-command="\/remote"[^>]*hidden[\s\S]*?<span>Open Remote<\/span>/, "Options menu should include the Remote WebUI launcher by label");
|
|
156
167
|
const optionsRemoteIndex = html.indexOf('id="optionsRemoteButton"');
|
|
@@ -261,6 +272,7 @@ assert.match(css, /\.message\.toolResult \.message-collapse\[open\] > \.message-
|
|
|
261
272
|
assert.match(css, /\.tool-output-details\[open\] > \.tool-output-code \{[\s\S]*?max-height:\s*min\(34rem, 52dvh\);[\s\S]*?overflow:\s*auto/, "expanded live tool output should get an internal scrollbar");
|
|
262
273
|
assert.match(css, /\.run-indicator-pulse \{[\s\S]*?animation:\s*run-indicator-pulse/, "active agent run indicator should have an animated pulse");
|
|
263
274
|
assert.match(css, /\.optional-features-box \{[\s\S]*?display:\s*grid/, "optional features should render as a side-panel feature list");
|
|
275
|
+
assert.match(css, /\.optional-feature-section \{[\s\S]*?display:\s*grid[\s\S]*?\.optional-feature-section-list \{[\s\S]*?display:\s*grid/, "optional features should render grouped type subsections");
|
|
264
276
|
assert.match(css, /\.btw-widget \{[\s\S]*?\.btw-widget-composer \{[\s\S]*?\.btw-transfer-action \{[\s\S]*?\.btw-live-widget \.release-npm-output-details\[open\] \.release-npm-terminal \{[\s\S]*?height:\s*clamp/, "/btw should render as a non-blocking release-style output widget with its own input and transfer action");
|
|
265
277
|
assert.match(css, /\.prompt-list-controls \{[\s\S]*?display:\s*grid/, "Queue prompt-list controls should render as a side-panel control group");
|
|
266
278
|
assert.match(css, /\.prompt-list-dialog \{[\s\S]*?width:\s*min\(58rem/, "prompt-list editor dialog should have a wider prompt-friendly layout");
|
|
@@ -273,6 +285,12 @@ assert.match(css, /\.webui-version-badge,\n\.webui-dev-badge \{[\s\S]*?border-ra
|
|
|
273
285
|
assert.match(css, /\.webui-dev-badge \{[\s\S]*?color:\s*var\(--ctp-yellow\)/, "Web UI dev indicator should have distinct warning styling");
|
|
274
286
|
assert.match(css, /\.side-panel-section\.collapsed \.side-panel-section-content,\n\.side-panel-section-content\[hidden\] \{\n\s+display:\s*none;/, "collapsed side panel section content should be hidden");
|
|
275
287
|
assert.match(css, /\.side-panel-section:not\(\.collapsed\) \.side-panel-section-chevron/, "expanded side panel sections should rotate the chevron");
|
|
288
|
+
assert.match(css, /\.subagents-box\.has-items[\s\S]*\.subagent-tab-group[\s\S]*\.subagent-agent-row/, "running subagents should render as grouped terminal/session cards");
|
|
289
|
+
assert.match(css, /\.subagent-agent-row:hover,[\s\S]*\.subagent-agent-row:focus-visible/, "subagent rows should expose clickable hover and keyboard focus states");
|
|
290
|
+
assert.match(css, /\.subagent-overlay-widget[\s\S]*\.subagent-overlay-terminal[\s\S]*\.subagent-overlay-close-action/, "subagent output should reuse the non-blocking App Runner widget visual language");
|
|
291
|
+
assert.match(css, /\.subagent-output-waiting-dot[\s\S]*@keyframes subagent-output-waiting-pulse/, "subagent output should animate one transient ellipsis while waiting");
|
|
292
|
+
assert.doesNotMatch(css, /\.extension-dialog\.subagent-overlay-dialog/, "subagent output should not retain blocking dialog styles");
|
|
293
|
+
assert.match(css, /@keyframes subagent-running-pulse/, "running subagents should expose a live activity indicator");
|
|
276
294
|
assert.match(css, /\.optional-feature-pill\.enabled/, "optional features should visually distinguish enabled state");
|
|
277
295
|
assert.match(css, /\.todo-widget \{[\s\S]*?display:\s*grid/, "todo-progress widget should render as a styled checklist card");
|
|
278
296
|
assert.match(css, /\.todo-widget-summary \{[\s\S]*?cursor:\s*pointer/, "todo-progress widget should expose a compact expandable summary");
|
|
@@ -319,10 +337,11 @@ assert.match(css, /\.composer-publish-menu:hover > \.composer-publish-button\[da
|
|
|
319
337
|
assert.match(css, /\.composer-publish-menu-panel \{[\s\S]*?display:\s*none;[\s\S]*?flex-direction:\s*column/, "Publish workflow menu should hide when closed and expand like grouped tabs");
|
|
320
338
|
assert.match(css, /\.composer-publish-menu:hover \.composer-publish-menu-panel,[\s\S]*?\.composer-publish-menu:focus-within \.composer-publish-menu-panel,[\s\S]*?\.composer-publish-menu\.open \.composer-publish-menu-panel \{\n\s+display:\s*flex;/, "Publish workflow menu should open on hover, focus, or explicit open state");
|
|
321
339
|
assert.match(css, /\.composer-native-command-button \{[\s\S]*?color:\s*var\(--ctp-mauve\)/, "skills/tools command menu should have a distinct slash-command button style");
|
|
322
|
-
assert.match(css, /\.composer-
|
|
323
|
-
assert.match(css, /\.composer-publish-menu-panel \{[\s\S]*?overscroll-behavior:\s*contain;[\s\S]*?-webkit-overflow-scrolling:\s*touch/, "dropdown panels should
|
|
324
|
-
assert.match(css, /\.composer-actions-panel > \.composer-publish-menu \.composer-publish-menu-panel \{[\s\S]*?max-height:\s*min\(var\(--mobile-dropdown-max-height, 34dvh\), calc\(var\(--visual-viewport-height, 100dvh\) - 2rem\)\)/, "mobile composer dropdowns should
|
|
325
|
-
assert.match(css, /\.composer-actions-panel > \.composer-options-menu \.composer-publish-menu-panel,\n\s+\.composer-actions-panel > \.composer-app-runner-menu \.composer-publish-menu-panel \{\n\s+inset-inline:\s*auto 0;/, "mobile Options and app-runner dropdowns should share
|
|
340
|
+
assert.match(css, /\.composer-auto-height-menu-panel \{[\s\S]*?height:\s*auto;[\s\S]*?max-height:\s*none;[\s\S]*?overflow:\s*visible;[\s\S]*?overflow-y:\s*visible;/, "content-height composer menus should grow with their active commands without an internal scrollbar");
|
|
341
|
+
assert.match(css, /\.composer-publish-menu-panel \{[\s\S]*?overscroll-behavior:\s*contain;[\s\S]*?-webkit-overflow-scrolling:\s*touch/, "dropdown panels should default to contained momentum scrolling when their options overflow");
|
|
342
|
+
assert.match(css, /\.composer-actions-panel > \.composer-publish-menu \.composer-publish-menu-panel \{[\s\S]*?max-height:\s*min\(var\(--mobile-dropdown-max-height, 34dvh\), calc\(var\(--visual-viewport-height, 100dvh\) - 2rem\)\)/, "mobile composer dropdowns should default to an in-viewport scroll height");
|
|
343
|
+
assert.match(css, /\.composer-actions-panel > \.composer-options-menu \.composer-publish-menu-panel,\n\s+\.composer-actions-panel > \.composer-app-runner-menu \.composer-publish-menu-panel \{\n\s+inset-inline:\s*auto 0;/, "mobile Options and app-runner dropdowns should share right-aligned popover placement");
|
|
344
|
+
assert.match(css, /\.composer-actions-panel > \.composer-publish-menu \.composer-auto-height-menu-panel \{[\s\S]*?height:\s*auto;[\s\S]*?max-height:\s*none;[\s\S]*?overflow:\s*visible;[\s\S]*?overflow-y:\s*visible;/, "mobile content-height menus should grow with their active commands without an internal scrollbar");
|
|
326
345
|
assert.match(css, /\.composer-native-command-menu-item \{[\s\S]*?color:\s*var\(--ctp-mauve\)/, "skills/tools command menu items should be styled separately from publish actions");
|
|
327
346
|
assert.match(css, /\.composer-actions-panel > \.composer-publish-menu[\s\S]*?grid-column: span 1/, "Publish and command menu buttons should fit beside Git workflow in mobile actions");
|
|
328
347
|
assert.match(css, /\.composer-actions-panel[\s\S]*?bottom:\s*calc\(100% \+ 0\.42rem\)/, "mobile composer actions should open as an above-composer sheet");
|
|
@@ -487,7 +506,7 @@ assert.match(app, /const hadNetworkStatus = networkStatusLoaded;[\s\S]*if \(!had
|
|
|
487
506
|
assert.match(app, /remoteAuthToggle: \$\("#remoteAuthToggle"\)/, "Remote WebUI controls should bind the remote PIN auth toggle");
|
|
488
507
|
assert.match(html, /id="networkControlField"[^>]*hidden/, "Remote WebUI browser controls should be hidden until the optional package is loaded and enabled");
|
|
489
508
|
assert.match(app, /remoteWebuiCommand\(enable \? "authOn" : "authOff"/, "remote PIN auth toggle should dispatch through the Remote WebUI package command");
|
|
490
|
-
assert.match(server, /
|
|
509
|
+
assert.match(server, /webuiSettingsFile,[\s\S]*from "\.\.\/lib\/git-workflow-preferences\.mjs"/, "server should use the shared Pi Web UI settings persistence module");
|
|
491
510
|
assert.match(server, /let persistedRemoteAuthEnabled = await readPersistedRemoteAuthEnabled\(\)/, "server should load the saved Remote PIN auth preference before startup");
|
|
492
511
|
assert.match(server, /if \(remoteAuthStartupEnabled\(\)\) enableRemoteAuth\(remoteAuthStartupReason\(\)\)/, "saved Remote PIN auth preference should enable auth on startup");
|
|
493
512
|
assert.match(server, /await saveRemoteAuthPreference\(true\)/, "enabling Remote PIN auth should persist the on preference");
|
|
@@ -541,7 +560,7 @@ assert.match(app, /function setOptionsMenuOpen\(open\)[\s\S]*scheduleMobileDropd
|
|
|
541
560
|
assert.match(app, /function focusPromptInput\(\{ defer = false \} = \{\}\)/, "frontend should focus the prompt composer programmatically after tab/app startup");
|
|
542
561
|
assert.match(app, /async function switchTab\(tabId\)[\s\S]*?restoreActiveDraft\(\);\n\s+focusPromptInput\(\{ defer: true \}\);/, "switching to a newly opened tab should focus the prompt input immediately");
|
|
543
562
|
assert.match(app, /async function initializeTabs\(\)[\s\S]*?restoreActiveDraft\(\);[\s\S]*if \(!loadedTabs\.length\)[\s\S]*focusPromptInput\(\{ defer: true \}\);/, "starting the Web UI should prompt for cwd when needed and focus active tabs");
|
|
544
|
-
assert.match(app, /resizePromptInput\(\);\nfocusPromptInput\(\{ defer: true \}\);\nrestoreStoredSkillUsage\(\);\nrestoreBusyPromptBehaviorSetting\(\);\nupdateComposerModeButtons\(\);/, "startup should request prompt focus and restore skill tags before waiting for tab state refreshes");
|
|
563
|
+
assert.match(app, /resizePromptInput\(\);\nrestoreFileViewerWidthPreference\(\);\nfocusPromptInput\(\{ defer: true \}\);\nrestoreStoredSkillUsage\(\);\nrestoreBusyPromptBehaviorSetting\(\);\nupdateComposerModeButtons\(\);/, "startup should restore browser preferences, request prompt focus, and restore skill tags before waiting for tab state refreshes");
|
|
545
564
|
assert.match(app, /elements\.promptInput\.addEventListener\("focus", \(\) => \{\n\s+syncMobileChatToBottomForInput\(\);/, "focusing mobile input should scroll output to bottom");
|
|
546
565
|
assert.match(app, /navigator\.serviceWorker\.register\("\/service-worker\.js"\)/, "PWA service worker should be registered by the app");
|
|
547
566
|
assert.match(app, /function serverStartCommandText\(\)[\s\S]*return `pi-webui\$\{currentPortArg\(\)\}`/, "PWA/offline shell should build a pathless pi-webui recovery command");
|
|
@@ -595,6 +614,8 @@ assert.match(app, /const node = make\("details", "widget todo-widget"\)/, "todo-
|
|
|
595
614
|
assert.match(app, /Optional feature detection intentionally checks loaded Pi capabilities/, "optional Web UI features should be detected through loaded capabilities, not package folders");
|
|
596
615
|
assert.match(app, /function resetOptionalFeatureAvailability\(\)/, "optional feature state should reset across active-tab and reload boundaries");
|
|
597
616
|
assert.match(app, /function renderOptionalFeaturePanel\(\)/, "side panel should render optional feature installed/enabled state");
|
|
617
|
+
assert.match(app, /const OPTIONAL_FEATURE_SECTIONS = \[[\s\S]*label: "Composer & commands"[\s\S]*label: "Workflows & releases"[\s\S]*label: "Safety & access"[\s\S]*label: "UI widgets & native parity"[\s\S]*label: "Conversation"/, "optional features should be grouped into five type subsections");
|
|
618
|
+
assert.match(app, /function renderOptionalFeatureSection\(section, features\)[\s\S]*optional-feature-section[\s\S]*optional-feature-section-title[\s\S]*optional-feature-section-list/, "optional feature panel should render subsection headers and lists");
|
|
598
619
|
assert.match(app, /function setSidePanelSectionCollapsed\(record, collapsed/, "side panel sections should have explicit collapse/expand behavior");
|
|
599
620
|
assert.match(
|
|
600
621
|
app,
|
|
@@ -612,6 +633,23 @@ assert.match(
|
|
|
612
633
|
"side-panel section toggles should expand at most one section at a time",
|
|
613
634
|
);
|
|
614
635
|
assert.match(app, /function renderCodexUsage\(\)/, "frontend should render Codex usage buckets in the side panel");
|
|
636
|
+
assert.match(app, /function renderSubagents\(\)[\s\S]*subagentTabsWithRunningAgents\(\)[\s\S]*renderSubagentTabGroup\(tab\)/, "frontend should group running subagents by terminal and session");
|
|
637
|
+
assert.match(app, /function openSubagentOverlay\(tab, run, agent\)[\s\S]*activeTabId !== tab\.tabId[\s\S]*await switchTab\(tab\.tabId\)[\s\S]*renderWidgets\(\)/, "clicking an agent should switch to its owning tab before rendering the live widget");
|
|
638
|
+
assert.match(app, /function renderWidgets\(\)[\s\S]*renderAppRunnerWidget\(\)[\s\S]*renderSubagentOverlayWidget\(\)/, "subagent output should render in the shared non-blocking top widget area after App Runner");
|
|
639
|
+
assert.doesNotMatch(app, /subagentOverlayDialog\.showModal|elements\.subagentOverlayDialog/, "subagent output should not open or depend on a modal dialog");
|
|
640
|
+
assert.match(app, /api\(`\/api\/subagents\/output\?\$\{query\}`, \{ scoped: false \}\)/, "subagent overlay should fetch selected live output from the owning tab");
|
|
641
|
+
assert.match(app, /SUBAGENT_OVERLAY_REFRESH_MS = 1000/, "subagent overlay should poll selected live output at a fast cadence");
|
|
642
|
+
assert.match(app, /function appendSubagentOutputWaitingIndicator\(parent\)[\s\S]*subagent-output-waiting-dot[\s\S]*if \(running && agent\.currentTool\) appendSubagentOutputWaitingIndicator\(terminal\)/, "subagent widget should render one replaceable waiting animation instead of transcript spam");
|
|
643
|
+
assert.match(app, /api\("\/api\/subagents", \{ scoped: false \}\)/, "frontend should refresh the cross-tab subagent overview");
|
|
644
|
+
assert.match(app, /SUBAGENTS_ACTIVE_REFRESH_MS = 1500/, "running subagents should receive a fast live refresh cadence");
|
|
645
|
+
assert.match(server, /url\.pathname === "\/api\/subagents" && req\.method === "GET"[\s\S]*webuiSubagentsData\(\)/, "server should expose a cross-tab running-subagent endpoint");
|
|
646
|
+
assert.match(server, /url\.pathname === "\/api\/subagents\/output" && req\.method === "GET"[\s\S]*webuiSubagentOutputData\(tab, runId, agentId\)/, "server should expose selected running subagent output only through its owning tab");
|
|
647
|
+
assert.match(server, /rememberWebuiSubagentsStatusEvent\(tab, event\)/, "server should ingest the helper's structured subagent status without forwarding internal JSON to the browser footer");
|
|
648
|
+
assert.match(helper, /SUBAGENT_RPC_REQUEST_EVENT = "subagents:rpc:v1:request"/, "Web UI helper should use pi-subagents' stable status RPC");
|
|
649
|
+
assert.match(helper, /case "subagent-output":[\s\S]*subagentOutputSnapshot\(payload\)/, "Web UI helper should return bounded live state and recent output for the selected child agent");
|
|
650
|
+
assert.match(helper, /line\.trim\(\)\.toLowerCase\(\) === "\(no output\)"/, "subagent transcript extraction should suppress empty tool-result markers");
|
|
651
|
+
assert.match(helper, /SUBAGENT_ASYNC_STARTED_EVENT = "subagent:async-started"[\s\S]*SUBAGENT_ASYNC_COMPLETE_EVENT = "subagent:async-complete"/, "Web UI helper should track async subagent lifecycle events");
|
|
652
|
+
assert.match(helper, /pi\.on\("tool_execution_start"[\s\S]*event\.toolName !== "subagent"[\s\S]*pi\.on\("tool_execution_end"/, "Web UI helper should track foreground subagent executions");
|
|
615
653
|
assert.match(app, /if \(normalized === "prolite"\) return "Usage";/, "Codex Prolite plan labels should display as Usage in the side panel");
|
|
616
654
|
assert.match(app, /api\(`\/api\/codex-usage\$\{suffix\}`, \{ scoped: false \}\)/, "Codex usage should load through a server endpoint without browser credentials");
|
|
617
655
|
assert.match(app, /restoreSidePanelSectionState\(\);\nbindSidePanelSectionToggles\(\);/, "side panel section state should restore before toggles are bound");
|
|
@@ -629,7 +667,7 @@ assert.match(app, /function footerPayloadWithLiveModel\(payload\)[\s\S]*?shortMo
|
|
|
629
667
|
assert.match(app, /function footerContextDisplayWithAuto\(value, state = currentState\)[\s\S]*footerAutoCompactionEnabled\(state\)[\s\S]*`\$\{withoutAuto\} \(auto\)`/, "context displays should append the auto-compaction indicator when enabled");
|
|
630
668
|
assert.match(app, /function footerPayloadWithLiveModel\(payload\)[\s\S]*const contextChip = \(chip\)[\s\S]*footerContextDisplayWithAuto\(chip\?\.value\)[\s\S]*if \(chip\?\.key === "context"\) return \[contextChip\(chip\)\]/, "git footer context chips should use live Web UI auto-compaction state");
|
|
631
669
|
assert.match(app, /async function toggleFooterAutoCompaction\(tabContext = activeTabContext\(\)\)[\s\S]*currentState = \{ \.\.\.currentState, autoCompactionEnabled: enabled \}[\s\S]*api\("\/api\/auto-compaction", \{ method: "POST", body: \{ enabled \}, tabId: tabContext\.tabId \}\)/, "git footer context box should optimistically toggle auto-compaction through the Web UI API");
|
|
632
|
-
assert.match(app, /function renderGitFooterPayload\(payload\)[\s\S]*classList\.remove\("statusbar-tui-footer"\)[\s\S]*classList\.add\("statusbar-git-footer"\)[\s\S]*payload\.main\.map\(renderGitFooterPayloadMetric\)[\s\S]*payload\.meta\.map/, "enabled git footer payload should use the styled extension chip renderer, not the default TUI line");
|
|
670
|
+
assert.match(app, /function renderGitFooterPayload\(payload\)[\s\S]*classList\.remove\("statusbar-tui-footer"\)[\s\S]*classList\.add\("statusbar-git-footer"\)[\s\S]*payload\.main\.map\(\(chip\) => renderGitFooterPayloadMetric\(chip, payload\)\)[\s\S]*payload\.meta\.map\(\(chip\) => renderGitFooterPayloadMeta\(chip, tab, payload\)\)/, "enabled git footer payload should use the styled extension chip renderer, not the default TUI line");
|
|
633
671
|
assert.match(app, /function ensureFooterTooltipNode\(\)[\s\S]*footer-floating-tooltip[\s\S]*document\.body\.append\(footerTooltipNode\)/, "git footer tooltips should render into a single floating viewport-level node");
|
|
634
672
|
const footerTooltipSource = app.match(/function applyFooterTooltip\(node, tooltip, options = \{\}\)[\s\S]*?\n}\n\nfunction footerMetric/)?.[0] || "";
|
|
635
673
|
assert.ok(footerTooltipSource, "git footer tooltip application source should be inspectable");
|
|
@@ -638,10 +676,10 @@ assert.match(app, /const GIT_FOOTER_TOOLTIP_COPY = \{[\s\S]*tokens:[\s\S]*cache:
|
|
|
638
676
|
assert.match(app, /function gitFooterPayloadTooltip\(chip, options = \{\}\)[\s\S]*GIT_FOOTER_TOOLTIP_COPY\[key\][\s\S]*`Current: \$\{value\}`/, "git footer tooltips should combine explanations with the current chip value");
|
|
639
677
|
assert.match(app, /function isRedundantFooterTooltipTitle\(sourceTitle, chip, value\)[\s\S]*labels\.map\(\(label\) => `\$\{label\}: \$\{value\}`\)/, "git footer tooltips should suppress duplicate label/current title lines");
|
|
640
678
|
assert.match(app, /function gitFooterTooltipAlign\(chip\)[\s\S]*\["tokens", "cwd"\][\s\S]*return "start";[\s\S]*\["model", "thinking"\][\s\S]*return "end";/, "git footer tooltip alignment should keep edge boxes readable");
|
|
641
|
-
assert.match(app, /function renderGitFooterPayloadMetric\(chip\)[\s\S]*applyGitFooterContextToggleOptions\(chip, options\)[\s\S]*gitFooterPayloadTooltip\(chip, \{ action \}\)[\s\S]*footerMetric\(chip\.icon/, "git footer main payload chips should render as styled metrics with explanatory tooltips and context action support");
|
|
642
|
-
assert.match(app, /function applyFooterChangedFilesDropdown\(node, chip\)[\s\S]*chip\?\.key !== "changes"[\s\S]*footer-changes-with-files[\s\S]*footer-changed-files-popover/, "git footer changes chip should render a changed-files hover popover when files are present");
|
|
679
|
+
assert.match(app, /function renderGitFooterPayloadMetric\(chip, payload\)[\s\S]*applyGitFooterContextToggleOptions\(chip, options\)[\s\S]*gitFooterPayloadTooltip\(chip, \{ action \}\)[\s\S]*footerMetric\(chip\.icon/, "git footer main payload chips should render as styled metrics with explanatory tooltips and context action support");
|
|
680
|
+
assert.match(app, /function applyFooterChangedFilesDropdown\(node, chip, payload\)[\s\S]*gitFooterPayloadVisible\(payload, "webui-changed-files-popover"\)[\s\S]*chip\?\.key !== "changes"[\s\S]*footer-changes-with-files[\s\S]*footer-changed-files-popover/, "git footer changes chip should render a changed-files hover popover when files are present");
|
|
643
681
|
assert.match(app, /function insertChangedFilePathReference\(path\)[\s\S]*formatPathReference\(path\)[\s\S]*input\.focus\(\)/, "clicking changed files should insert an @path reference and focus the composer");
|
|
644
|
-
assert.match(app, /function renderGitFooterPayloadMeta\(chip, tab\)[\s\S]*options\.title = gitFooterPayloadTooltip\(chip, \{ action \}\)[\s\S]*footerMeta\(chip\.label, chip\.value, footerMetaClassForPayload\(chip\), options\)[\s\S]*applyFooterChangedFilesDropdown\(node, chip\)/, "git footer meta payload chips should render as styled metadata with explanatory tooltips and changes popovers");
|
|
682
|
+
assert.match(app, /function renderGitFooterPayloadMeta\(chip, tab, payload\)[\s\S]*options\.title = gitFooterPayloadTooltip\(chip, \{ action \}\)[\s\S]*footerMeta\(chip\.label, chip\.value, footerMetaClassForPayload\(chip\), options\)[\s\S]*applyFooterChangedFilesDropdown\(node, chip, payload\)/, "git footer meta payload chips should render as styled metadata with explanatory tooltips and changes popovers");
|
|
645
683
|
assert.match(app, /chip\.key === "git"[\s\S]*setFooterBranchPickerOpen\(!footerBranchPickerOpen\)[\s\S]*Worktree actions are the safe default for parallel work/, "git branch footer chip should open the worktree-aware branch picker");
|
|
646
684
|
assert.match(app, /chip\.key === "worktree"[\s\S]*setFooterBranchPickerOpen\(!footerBranchPickerOpen\)[\s\S]*Click to manage branch worktrees/, "worktree footer chip should open the branch worktree picker");
|
|
647
685
|
assert.match(app, /function footerPayloadWithLiveModel\(payload\)[\s\S]*const worktreeLabel = gitWorkspaceBadgeLabel\(workspace\)[\s\S]*key: "worktree"/, "git footer payload should inject a live worktree chip from tab metadata");
|
|
@@ -791,7 +829,7 @@ assert.match(app, /const gitWorkflowsByTab = new Map\(\)/, "guided git workflow
|
|
|
791
829
|
assert.match(app, /function bindGitWorkflowToActiveTab\(\) \{\n\s+gitWorkflow = gitWorkflowForTab\(activeTabId\) \|\| createGitWorkflowState\(\);/, "guided git workflow should render only the active terminal tab's workflow state");
|
|
792
830
|
assert.match(app, /function setGitWorkflow\(patch, \{ tabId = activeTabId \} = \{\}\)[\s\S]*if \(tabId === activeTabId\) \{[\s\S]*renderGitWorkflow\(\);/, "guided git workflow should not render inactive terminal workflows globally");
|
|
793
831
|
assert.match(html, /id="gitPrDialog"[\s\S]*id="gitPrTitleInput"[\s\S]*id="gitPrBodyEditor"[\s\S]*id="gitPrCreateButton"/, "guided git workflow should expose a PR review dialog with title and body editing");
|
|
794
|
-
assert.match(app, /addGitWorkflowAction\("Create PR worktree", \(\) => createGitPrBranch\(\), "primary", false, GIT_WORKFLOW_CREATE_PR_TOOLTIP\)/, "guided git workflow should offer a Create PR worktree action after message generation");
|
|
832
|
+
assert.match(app, /addGitWorkflowAction\("Create PR worktree", \(\) => createGitPrBranch\(\), deliveryMode === "pr-worktree" \? "primary" : "", false, GIT_WORKFLOW_CREATE_PR_TOOLTIP\)/, "guided git workflow should offer and preference-highlight a Create PR worktree action after message generation");
|
|
795
833
|
assert.match(app, /const GIT_WORKFLOW_CREATE_PR_TOOLTIP = \[[\s\S]*"Create PR worktree:"[\s\S]*"1\. Ask Pi to generate a type\/feature-name branch from staged changes\."[\s\S]*"4\. Create or open a Git worktree for that branch instead of switching this checkout\."[\s\S]*"7\. Push and Create PR will push upstream, run \/pr, let you review, then run gh pr create\."/, "Create PR worktree should have an up-to-date step-by-step tooltip");
|
|
796
834
|
assert.match(app, /const GIT_WORKFLOW_MANUAL_BRANCH_TOOLTIP = \[[\s\S]*"Manual PR worktree:"[\s\S]*"1\. Skip agent branch-name generation\."[\s\S]*"4\. Create or open a Git worktree for that branch instead of switching this checkout\."[\s\S]*"7\. Push and Create PR will push upstream, run \/pr, let you review, then run gh pr create\."/, "Manual worktree should have an up-to-date step-by-step tooltip");
|
|
797
835
|
assert.match(app, /addGitWorkflowAction\("Manual worktree", \(\) => createGitPrBranchManually\(\), "", false, GIT_WORKFLOW_MANUAL_BRANCH_TOOLTIP\)/, "Manual worktree should render with its tooltip");
|
|
@@ -809,7 +847,13 @@ assert.match(app, /async function createGitPrBranchWithSuggestion\([\s\S]*prompt
|
|
|
809
847
|
assert.match(app, /function syncGitWorkflowWorktreeTabs\(result\)[\s\S]*Array\.isArray\(result\?\.tabs\)[\s\S]*applyTabMetadata\(result\.tab\)/, "guided git workflow should merge worktree tab metadata returned by the branch endpoint");
|
|
810
848
|
assert.match(app, /const targetTabId = result\.tab\?\.id[\s\S]*setGitWorkflow\(nextState, \{ tabId: targetTabId \}\)[\s\S]*switchTab\(targetTabId\)/, "guided git workflow should transfer PR state to the opened worktree tab");
|
|
811
849
|
assert.match(app, /addGitWorkflowAction\("Push and Create PR", \(\) => pushAndCreatePrGitWorkflow\(\), "primary", false\)/, "guided git workflow should replace push with Push and Create PR in PR mode");
|
|
812
|
-
assert.match(app, /async function runGitPrPrompt\(tabId = gitWorkflowActionTabId\(\), \{ prefixOutput = "" \} = \{\}\)[\s\S]*
|
|
850
|
+
assert.match(app, /async function runGitPrPrompt\(tabId = gitWorkflowActionTabId\(\), \{ prefixOutput = "" \} = \{\}\)[\s\S]*\/api\/git-workflow\/generate"[\s\S]*kind: "pr"/, "guided git workflow should generate PR descriptions with the configured generation profile");
|
|
851
|
+
assert.match(app, /async function runGitMessagePrompt\([\s\S]*\/api\/git-workflow\/generate"[\s\S]*kind: "commit"/, "guided git workflow should generate commit messages with the configured model and effort");
|
|
852
|
+
assert.match(app, /async function runGitBranchNamePrompt\([\s\S]*\/api\/git-workflow\/generate"[\s\S]*kind: "branch"/, "guided git workflow should generate branch names with the configured model and effort");
|
|
853
|
+
assert.match(app, /async function acceptCurrentGitStaging\([\s\S]*summary\?\.staged[\s\S]*No staged files are available/, "review staging should require a non-empty current staged set");
|
|
854
|
+
assert.match(app, /Pre-commit verification reminder[\s\S]*Continue with this commit/, "configured verification reminders should run before committing");
|
|
855
|
+
assert.match(server, /async function startGitWorkflowGeneration\([\s\S]*set_model[\s\S]*setThinkingLevelForTab[\s\S]*type: "prompt"/, "server should apply the configured generation profile before prompting Pi");
|
|
856
|
+
assert.match(server, /event\?\.type === "agent_settled"[\s\S]*restoreGitWorkflowGenerationProfile\(tab\)/, "server should restore the active tab model and effort after generation settles");
|
|
813
857
|
assert.match(server, /case "\/api\/git-workflow\/branch-name":[\s\S]*readGitWorkflowBranchName\(cwd\)/, "server should expose generated branch-name file loading for the guided PR workflow");
|
|
814
858
|
assert.match(server, /case "\/api\/git-workflow\/branch":[\s\S]*createGitWorkflowBranchWorktree\(tab, body\)/, "server should route guided PR branch creation through worktree tabs");
|
|
815
859
|
assert.match(server, /async function createGitWorkflowBranchWorktree\(tab, body = \{\}\)[\s\S]*snapshotGitWorkflowBranchState\(root, tab\.cwd\)[\s\S]*applyGitWorkflowBranchStateToWorktree\(snapshot, worktreePath\)[\s\S]*openWorktreeResultForTab\(tab, createdResult/, "guided PR worktree creation should copy staged state before opening the worktree tab");
|
|
@@ -892,8 +936,8 @@ assert.match(app, /function thinkingFormatOpenMatch\(text\)[\s\S]*?CHANNEL_THINK
|
|
|
892
936
|
assert.match(app, /function splitThinkingFormatText\(text, \{ streaming = false \} = \{\}\)[\s\S]*?thinkingFormatOpenMatch\(rest\)[\s\S]*?finalText: stripThinkingFormatOutputSeparator\(rest\)/, "tagged thinking output should split thinking text from final response text");
|
|
893
937
|
assert.match(app, /function visibleThinkingText\(text\)[\s\S]*?trimmed === UNEXPOSED_THINKING_TEXT[\s\S]*?return "";/, "provider no-thinking placeholders should normalize to empty thinking output");
|
|
894
938
|
assert.match(app, /if \(isThinkingPart\) \{[\s\S]*?visibleThinkingText\(assistantThinkingText\(part\)\)[\s\S]*?if \(thinking\) displayMessages\.push/, "assistant transcript splitting should skip empty or unexposed thinking parts");
|
|
895
|
-
assert.match(app, /message\.role === "thinking"[\s\S]*?visibleThinkingText\(message\.thinking \|\| textFromContent\(message\.content\)\)[\s\S]*?if \(thinkingOutputVisible && thinkingText\)
|
|
896
|
-
assert.match(app, /function showStreamingThinking\(initialText = ""\)[\s\S]*?if \(initialText && !streamThinking\.textContent\) streamThinking
|
|
939
|
+
assert.match(app, /message\.role === "thinking"[\s\S]*?visibleThinkingText\(message\.thinking \|\| textFromContent\(message\.content\)\)[\s\S]*?if \(thinkingOutputVisible && thinkingText\) appendThinkingMarkdown\(body, thinkingText\);/, "thinking cards should suppress empty and provider no-thinking placeholder output while rendering visible reasoning as markdown");
|
|
940
|
+
assert.match(app, /function showStreamingThinking\(initialText = ""\)[\s\S]*?if \(initialText && !streamThinking\.textContent\) renderThinkingMarkdown\(streamThinking, initialText\);/, "live thinking should not create a visible placeholder card before content arrives");
|
|
897
941
|
assert.match(app, /function setStreamingThinkingText\(text\)[\s\S]*?const thinking = visibleThinkingText\(text\);[\s\S]*?if \(!thinkingOutputVisible \|\| !thinking\) return false;[\s\S]*?return true;/, "live thinking text setters should ignore empty text instead of clearing or flashing the card");
|
|
898
942
|
assert.match(app, /function syncStreamingThinkingFromUpdate\(event, update, \{ placeholder = "" \} = \{\}\)[\s\S]*?return setStreamingThinkingText\(streamThinkingRawText \|\| placeholder\);/, "incremental thinking sync should only report success after setting visible thinking text");
|
|
899
943
|
assert.doesNotMatch(app, /text \|\| placeholder \|\| streamThinkingBubble/, "partial-message thinking sync should not clear an existing thinking card when a partial carries no visible thinking text");
|
|
@@ -1058,11 +1102,14 @@ for (const command of ["resume", "reload", "remote", "name", "clone", "settings"
|
|
|
1058
1102
|
const id = command.replace(/^./, (letter) => letter.toUpperCase());
|
|
1059
1103
|
assert.match(app, new RegExp(`options${id}Button\\.addEventListener\\("click", \\(\\) => runNativeCommandMenu\\("\\/${command}"\\)\\)`), `Options menu should launch /${command}`);
|
|
1060
1104
|
}
|
|
1105
|
+
assert.match(app, /optionsGitWorkflowSetupButton\?\.addEventListener\("click", \(\) => runNativeCommandMenu\("\/git-workflow-setup"\)\)/, "Options menu should launch native Guided Git Setup");
|
|
1106
|
+
assert.match(extension, /registerCommand\("git-workflow-setup"[\s\S]*runGitWorkflowSetup/, "Pi extension should register the reusable /git-workflow-setup command");
|
|
1107
|
+
assert.match(app, /async function openNativeGitWorkflowSetupDialog\([\s\S]*\/api\/git-workflow\/preferences/, "Web UI should implement Guided Git Setup with the persisted preferences API");
|
|
1061
1108
|
assert.match(app, /async function sendPrompt\(kind = "prompt", explicitMessage, \{ targetTabId = activeTabId, throwOnError = false, streamingBehavior \} = \{\}\)/, "prompt sending should accept direct messages that bypass the input field and optional target tab");
|
|
1062
1109
|
assert.match(app, /const rawMessage = usesPromptInput \? elements\.promptInput\.value : explicitMessage/, "direct prompt sends should not read the input textarea");
|
|
1063
1110
|
assert.match(app, /if \(usesPromptInput\) \{[\s\S]*?if \(targetStillActive\) \{[\s\S]*?elements\.promptInput\.value = "";/, "direct prompt sends should preserve the input textarea draft");
|
|
1064
1111
|
assert.match(app, /make\("button", "command-item"\)[\s\S]*?sendPrompt\("prompt", `\/\$\{command\.name\}`\)/, "side-panel command clicks should send the slash command directly");
|
|
1065
|
-
assert.match(app, /const NATIVE_SELECTOR_COMMANDS = new Set\(\["model", "settings", "theme", "fork", "clone", "name", "resume", "tree", "login", "logout", "scoped-models", "tools", "skills"\]\)/, "frontend should route native slash commands into selector UIs");
|
|
1112
|
+
assert.match(app, /const NATIVE_SELECTOR_COMMANDS = new Set\(\["model", "settings", "git-workflow-setup", "theme", "fork", "clone", "name", "resume", "tree", "login", "logout", "scoped-models", "tools", "skills"\]\)/, "frontend should route native slash commands, including Guided Git Setup, into selector UIs");
|
|
1066
1113
|
assert.match(app, /async function handleNativeSlashSelectorCommand\(message/, "frontend should intercept exact native slash commands before prompt forwarding");
|
|
1067
1114
|
assert.match(app, /kind === "prompt" && attachments\.length === 0 && await handleNativeSlashSelectorCommand/, "prompt sending should open native selector dialogs before marking a run active");
|
|
1068
1115
|
assert.match(app, /function openNativeModelSelector\(\)[\s\S]*?nativeCommandApi\("\/api\/models"\)/, "native /model selector should load models through the active tab API");
|
|
@@ -129,7 +129,7 @@ for (const target of ["state", "tabs", "commands", "themes", "workspace"]) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
const slashCommands = nativeSlashCommandEntries(parity);
|
|
132
|
-
assert.equal(slashCommands.length,
|
|
132
|
+
assert.equal(slashCommands.length, 25);
|
|
133
133
|
assert.equal(slashCommands[0].name, "settings");
|
|
134
134
|
assert.equal(slashCommands.at(-1).name, "quit");
|
|
135
135
|
|
|
@@ -53,6 +53,7 @@ const slashSurfaces = parity.surfaces.filter((surface) => surface.kind === "slas
|
|
|
53
53
|
const slashCommandNames = slashSurfaces.map((surface) => surface.command?.name).filter(Boolean);
|
|
54
54
|
const requiredNativeCommands = [
|
|
55
55
|
"settings",
|
|
56
|
+
"git-workflow-setup",
|
|
56
57
|
"model",
|
|
57
58
|
"theme",
|
|
58
59
|
"scoped-models",
|
|
@@ -62,10 +62,51 @@ try {
|
|
|
62
62
|
assert.equal(startupAuth.body?.data?.auth?.enabled, true, "saved Remote PIN auth setting should enable auth at next startup");
|
|
63
63
|
assert.match(startupAuth.body?.data?.auth?.pin, /^\d{4}$/, "startup auth should generate a fresh PIN, not persist one");
|
|
64
64
|
|
|
65
|
+
const initialGitSetup = await request("/api/git-workflow/preferences");
|
|
66
|
+
assert.equal(initialGitSetup.status, 200);
|
|
67
|
+
assert.equal(initialGitSetup.body?.data?.configured, false, "guided Git should require first-time model setup");
|
|
68
|
+
assert.equal(initialGitSetup.body?.data?.preferences?.stagingPolicy, "review", "review/select should be the safe staging default");
|
|
69
|
+
assert.equal(initialGitSetup.body?.data?.models?.[0]?.id, "fake-model");
|
|
70
|
+
|
|
71
|
+
const unsupportedEffort = await request("/api/git-workflow/preferences", {
|
|
72
|
+
method: "POST",
|
|
73
|
+
body: { preferences: { generation: { provider: "fake", modelId: "fake-model", thinkingLevel: "low" } } },
|
|
74
|
+
});
|
|
75
|
+
assert.equal(unsupportedEffort.status, 400, "setup should reject effort levels unsupported by the selected model");
|
|
76
|
+
|
|
77
|
+
const invalidStagingPolicy = await request("/api/git-workflow/preferences", {
|
|
78
|
+
method: "POST",
|
|
79
|
+
body: { preferences: { generation: { provider: "fake", modelId: "fake-model", thinkingLevel: "off" }, stagingPolicy: "everything" } },
|
|
80
|
+
});
|
|
81
|
+
assert.equal(invalidStagingPolicy.status, 400, "setup should reject invalid preference choices instead of silently normalizing them");
|
|
82
|
+
|
|
83
|
+
const savedGitSetup = await request("/api/git-workflow/preferences", {
|
|
84
|
+
method: "POST",
|
|
85
|
+
body: {
|
|
86
|
+
preferences: {
|
|
87
|
+
generation: { provider: "fake", modelId: "fake-model", thinkingLevel: "off", unavailablePolicy: "ask" },
|
|
88
|
+
commit: { language: "de", defaultVariant: "long", scope: "required" },
|
|
89
|
+
stagingPolicy: "review",
|
|
90
|
+
deliveryMode: "ask",
|
|
91
|
+
verificationPolicy: "ask",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
assert.equal(savedGitSetup.status, 200);
|
|
96
|
+
assert.equal(savedGitSetup.body?.data?.configured, true);
|
|
97
|
+
assert.equal(savedGitSetup.body?.data?.preferences?.commit?.language, "de");
|
|
98
|
+
|
|
99
|
+
const generation = await request("/api/git-workflow/generate", { method: "POST", body: { kind: "commit" } });
|
|
100
|
+
assert.equal(generation.status, 200);
|
|
101
|
+
assert.equal(generation.body?.data?.message, "/git-staged-msg de required");
|
|
102
|
+
assert.deepEqual(generation.body?.data?.generation, { provider: "fake", modelId: "fake-model", thinkingLevel: "off" });
|
|
103
|
+
|
|
65
104
|
const disableAuth = await request("/api/remote-auth/settings", { method: "POST", body: { enabled: false } });
|
|
66
105
|
assert.equal(disableAuth.status, 200);
|
|
67
106
|
const savedAfterDisable = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
107
|
+
assert.equal(savedAfterDisable.version, 2, "Web UI settings should migrate to the guided Git schema version");
|
|
68
108
|
assert.equal(savedAfterDisable.remoteAuthEnabled, false, "disabling Remote PIN auth should persist the off preference");
|
|
109
|
+
assert.equal(savedAfterDisable.gitWorkflow?.generation?.modelId, "fake-model", "Remote PIN updates should preserve guided Git preferences");
|
|
69
110
|
|
|
70
111
|
const enableAuth = await request("/api/remote-auth/settings", { method: "POST", body: { enabled: true } });
|
|
71
112
|
assert.equal(enableAuth.status, 200);
|