@firstpick/pi-package-webui 0.10.2 → 0.10.3
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/DEVELOPMENT.md +28 -0
- package/README.md +10 -0
- package/TECHNICAL.md +14 -0
- package/bin/pi-webui.mjs +236 -20
- package/lib/append-system-selection.mjs +311 -0
- package/lib/git-workflow-preferences.mjs +6 -0
- package/lib/trust-boundaries.mjs +37 -0
- package/package.json +1 -1
- package/public/app.js +162 -7
- package/public/index.html +5 -2
- package/public/service-worker.js +1 -1
- package/tests/append-system-http.test.mjs +622 -0
- package/tests/append-system-selection.test.mjs +259 -0
- package/tests/append-system-selector-static.test.mjs +95 -0
- package/tests/boot-failure-diagnostics.test.mjs +2 -2
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/common-options-submenus-interaction-static.test.mjs +4 -0
- package/tests/common-options-submenus-markup-static.test.mjs +2 -1
- package/tests/composer-action-grid-reorder-static.test.mjs +2 -2
- package/tests/control-visibility-static.test.mjs +2 -2
- package/tests/controls-layout-static.test.mjs +2 -2
- package/tests/events-tree-context-menu-static.test.mjs +2 -2
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +1 -1
- package/tests/file-viewer-image-static.test.mjs +2 -2
- package/tests/guided-git-activation-static.test.mjs +2 -2
- package/tests/guided-git-fallback-ui-static.test.mjs +2 -2
- package/tests/intercom-conversation-viewer-static.test.mjs +2 -2
- package/tests/main-output-loading-static.test.mjs +2 -2
- package/tests/middle-button-drag-scroll-static.test.mjs +2 -2
- package/tests/mobile-continuity-tablet-static.test.mjs +2 -2
- package/tests/mobile-foundation-static.test.mjs +2 -2
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/native-parity-harness.test.mjs +7 -0
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-prompt-impact-static.test.mjs +2 -2
- package/tests/persistent-ui-layout-static.test.mjs +2 -2
- package/tests/prompt-input-vertical-scroll-static.test.mjs +2 -2
- package/tests/questionnaire-dialog.test.mjs +2 -2
- package/tests/session-sampling-ui-static.test.mjs +2 -2
- package/tests/side-panel-section-height-removal-static.test.mjs +2 -2
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/syntax-highlighting-static.test.mjs +2 -2
- package/tests/terminal-tab-prompt-tooltip-static.test.mjs +147 -0
- package/tests/terminal-tab-workspace-static.test.mjs +1 -1
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/windows-drive-cwd-picker-static.test.mjs +2 -2
|
@@ -60,6 +60,6 @@ assert.match(css, /data-mobile-presentation="essential"/, "Essential presentatio
|
|
|
60
60
|
assert.match(css, /html\[data-mobile-shell="v2"\] body\.mobile-keyboard-open \.widget-area,[\s\S]*?\.composer-actions-button \{ display: block !important; \}/, "v2 keyboard mode must keep run widgets and the actions entry available");
|
|
61
61
|
assert.match(css, /@media \(prefers-reduced-motion: reduce\)/, "reduced-motion behavior is required");
|
|
62
62
|
assert.match(css, /@media \(forced-colors: active\)/, "forced-color affordances are required");
|
|
63
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
63
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "browser asset changes need a coherent cache tuple");
|
|
64
64
|
|
|
65
65
|
console.log("mobile-phone-experience-static.test.mjs passed");
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
guardsForNativeCommand,
|
|
10
10
|
isLocalAddress,
|
|
11
11
|
isLocalRequest,
|
|
12
|
+
isLoopbackHostAuthority,
|
|
12
13
|
LOCALHOST_ONLY_POST_ROUTES,
|
|
13
14
|
remoteShellTrustWarning,
|
|
14
15
|
requireLocalhost,
|
|
@@ -39,6 +40,12 @@ assert.equal(isLocalAddress("::1"), true);
|
|
|
39
40
|
assert.equal(isLocalAddress("192.168.1.50"), false);
|
|
40
41
|
assert.equal(isLocalRequest(localReq), true);
|
|
41
42
|
assert.equal(isLocalRequest(remoteReq), false);
|
|
43
|
+
for (const authority of ["localhost", "localhost:8080", "LOCALHOST.", "127.0.0.1", "127.42.0.1:65535", "[::1]", "[0:0:0:0:0:0:0:1]:8080"]) {
|
|
44
|
+
assert.equal(isLoopbackHostAuthority(authority), true, `${authority} should be accepted as a loopback Host authority`);
|
|
45
|
+
}
|
|
46
|
+
for (const authority of ["", "attacker.example", "attacker.example:8080", "128.0.0.1", "127.0.0.1.attacker.example", "127.1", "[::ffff:127.0.0.1]", "[::1]:65536", "localhost:bad"]) {
|
|
47
|
+
assert.equal(isLoopbackHostAuthority(authority), false, `${authority || "an empty Host"} should be rejected as a loopback Host authority`);
|
|
48
|
+
}
|
|
42
49
|
|
|
43
50
|
assert.throws(() => requireLocalhost(remoteReq, "blocked"), (error) => error.statusCode === 403);
|
|
44
51
|
assert.throws(() => requireLocalhostRoute(remoteReq, "/api/update"), (error) => error.statusCode === 403);
|
|
@@ -68,7 +68,7 @@ assert.match(server, /STATIC_PUBLIC_FILE_EXTENSIONS[\s\S]*"\.mjs"/, "the server
|
|
|
68
68
|
assert.match(serviceWorker, /"\/issue-wizard-state\.mjs"/, "the PWA shell must keep caching the pure wizard module");
|
|
69
69
|
assert.match(serviceWorker, /"\/issue-bot-client\.mjs"/, "the PWA shell must cache the browser client module");
|
|
70
70
|
// Intent preserved: changing the public startup graph advances the PWA cache identity.
|
|
71
|
-
assert.match(serviceWorker, /pi-webui-pwa-
|
|
71
|
+
assert.match(serviceWorker, /pi-webui-pwa-v154/, "the PWA cache name must change with browser wiring updates");
|
|
72
72
|
assert.match(packageJson, /node --check public\/issue-wizard-state\.mjs/, "the package check must keep syntax-checking the pure wizard module");
|
|
73
73
|
assert.match(packageJson, /node --check public\/issue-bot-client\.mjs/, "the package check must syntax-check the browser client module");
|
|
74
74
|
|
|
@@ -61,7 +61,7 @@ assert.match(readme, /\+.*initial system prompt[\s\S]*?\+\.\.\..*session is runn
|
|
|
61
61
|
assert.match(technical, /prompt-impact indicators[\s\S]*?tool schemas and ordinary user or tool messages are not counted/i, "technical reference should state the measurement boundary");
|
|
62
62
|
assert.match(development, /reports\/pi-default-system-prompt-evaluation\.md[\s\S]*?promptImpact/, "contributor guide should identify the evidence source and catalog field");
|
|
63
63
|
assert.match(html, /styles\.css\?v=152/, "indicator styles should advance the stylesheet revision");
|
|
64
|
-
assert.match(html, /app\.js\?v=
|
|
65
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
64
|
+
assert.match(html, /app\.js\?v=183/, "indicator rendering should advance the app revision");
|
|
65
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "browser asset changes should advance the PWA cache identity");
|
|
66
66
|
|
|
67
67
|
console.log("optional-feature-prompt-impact-static.test.mjs passed");
|
|
@@ -271,8 +271,8 @@ assert.match(
|
|
|
271
271
|
|
|
272
272
|
// --- Coherent browser asset revisions --------------------------------------
|
|
273
273
|
|
|
274
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
274
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "changed browser assets should advance the PWA cache identity");
|
|
275
275
|
assert.match(html, /styles\.css\?v=152/, "the page should request the updated layout stylesheet revision");
|
|
276
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
276
|
+
assert.match(html, /data-app-src="\/app\.js\?v=183"/, "the boot loader should request the updated app module revision");
|
|
277
277
|
|
|
278
278
|
console.log("persistent-ui-layout-static.test.mjs passed");
|
|
@@ -20,7 +20,7 @@ assert.match(css, /#promptInput \{[\s\S]*--prompt-input-block-chrome: calc\(1\.8
|
|
|
20
20
|
assert.match(resizePromptInput, /input\.style\.height = "auto";[\s\S]*borderTopWidth[\s\S]*borderBottomWidth[\s\S]*naturalHeight = input\.scrollHeight \+ borderBlock[\s\S]*isCapped \? "auto" : "hidden"/, "auto-resizing should include the textarea borders and enable vertical scrolling only after the six-line cap");
|
|
21
21
|
assert.doesNotMatch(resizePromptInput, /input\.style\.overflowY = "auto";/, "auto-resizing must not force a scrollbar below the six-line cap");
|
|
22
22
|
assert.match(html, /styles\.css\?v=152/, "the page should request the six-line prompt stylesheet revision");
|
|
23
|
-
assert.match(html, /app\.js\?v=
|
|
24
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
23
|
+
assert.match(html, /app\.js\?v=183/, "the page should request the current app revision");
|
|
24
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "the PWA cache identity should advance with the prompt scroll assets");
|
|
25
25
|
|
|
26
26
|
console.log("prompt-input-vertical-scroll-static.test.mjs passed");
|
|
@@ -505,7 +505,7 @@ assert.match(css, /\.questionnaire-options button\s*\{\s*min-height:\s*3\.35rem/
|
|
|
505
505
|
assert.match(css, /@media \(prefers-reduced-motion: reduce\)\s*\{[\s\S]*?\*, \*::before, \*::after[\s\S]*?transition-duration:\s*1ms !important/, "global reduced-motion rules must cover questionnaire transitions");
|
|
506
506
|
|
|
507
507
|
assert.match(html, /styles\.css\?v=152/, "questionnaire CSS needs the current stylesheet revision");
|
|
508
|
-
assert.match(html, /app\.js\?v=
|
|
509
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
508
|
+
assert.match(html, /app\.js\?v=183/, "questionnaire behavior needs the current app revision");
|
|
509
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "questionnaire public assets need a coherent PWA cache revision");
|
|
510
510
|
|
|
511
511
|
console.log("questionnaire-dialog.test.mjs passed");
|
|
@@ -57,10 +57,10 @@ assert.match(css, /\.sampling-parameter-control\.unsupported:hover:not\(\.sampli
|
|
|
57
57
|
assert.match(css, /\.sampling-parameter-control\.unsupported:focus-visible:not\(\.sampling-tooltip-dismissed\) > \.sampling-parameter-unsupported-tooltip/, "keyboard focus should reveal dismissible unsupported reasons");
|
|
58
58
|
assert.match(css, /\.sampling-parameter-unsupported-tooltip\.sampling-tooltip-below/, "bounded placement should support flipping below top-edge rows");
|
|
59
59
|
assert.match(css, /pointer-events: auto;/, "a visible unsupported tooltip should remain pointer-hoverable");
|
|
60
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
60
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "native-control assets should advance the cache identity");
|
|
61
61
|
assert.match(serviceWorker, /"\/sampling-parameter-controls\.mjs"/, "the pure sampling module should be part of the offline app shell");
|
|
62
62
|
assert.match(html, /styles\.css\?v=152/, "the changed stylesheet should have a new revision");
|
|
63
|
-
assert.match(html, /app\.js\?v=
|
|
63
|
+
assert.match(html, /app\.js\?v=183/, "the changed app module should have a new revision");
|
|
64
64
|
|
|
65
65
|
// --- Browser state behavior -------------------------------------------------
|
|
66
66
|
|
|
@@ -28,7 +28,7 @@ assert.match(app, /const UI_LAYOUT_SIDE_PANEL_FIELDS = \["placement", "sectionLa
|
|
|
28
28
|
assert.match(app, /function clearRemovedSidePanelSectionHeightState\(\)[\s\S]*localStorage\.removeItem\(REMOVED_SIDE_PANEL_SECTION_HEIGHT_STORAGE_KEY\)[\s\S]*record\.field === "sidePanel" && record\.subfield === "sectionHeights"/, "startup should remove the retired cache and pending mutations");
|
|
29
29
|
assert.match(app, /clearRemovedSidePanelSectionHeightState\(\);\s*restoreDurableUiLayoutPendingJournal\(\);/, "retired height state should be cleared before pending layout restoration");
|
|
30
30
|
assert.match(html, /styles\.css\?v=152/, "removing section resize styles should advance the stylesheet revision");
|
|
31
|
-
assert.match(html, /app\.js\?v=
|
|
32
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
31
|
+
assert.match(html, /app\.js\?v=183/, "removing section resize behavior should advance the app revision");
|
|
32
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "removing browser assets should advance the PWA cache identity");
|
|
33
33
|
|
|
34
34
|
console.log("side-panel-section-height-removal-static.test.mjs passed");
|
|
@@ -28,7 +28,7 @@ assert.match(app, /const SUBAGENT_ASYNC_WIDGET_KEY = "subagent-async"[\s\S]*case
|
|
|
28
28
|
assert.match(app, /for \(const \[key, value\] of widgets\)[\s\S]*if \(key === SUBAGENT_ASYNC_WIDGET_KEY\) continue;/, "stale cached async-status widgets should remain hidden defensively");
|
|
29
29
|
assert.match(css, /\.subagent-source-badge[\s\S]*text-overflow: ellipsis[\s\S]*@media \(max-width: 720px\)/, "source badges should remain compact and responsive");
|
|
30
30
|
assert.match(html, /Managed and registered Pi agent runs[\s\S]*External agents/, "help should explain managed, registered, and external groups");
|
|
31
|
-
assert.match(html, /styles\.css\?v=152[\s\S]*app\.js\?v=
|
|
32
|
-
assert.match(worker, /pi-webui-pwa-
|
|
31
|
+
assert.match(html, /styles\.css\?v=152[\s\S]*app\.js\?v=183/, "browser assets should use the current subagent-observability revisions");
|
|
32
|
+
assert.match(worker, /pi-webui-pwa-v154/, "PWA cache identity should advance with subagent widget suppression");
|
|
33
33
|
|
|
34
34
|
console.log("subagent-observability-static.test.mjs passed");
|
|
@@ -60,9 +60,9 @@ assert.match(css, /\.markdown-code \.syntax-comment \{[^}]*font-style: italic;/,
|
|
|
60
60
|
|
|
61
61
|
// --- Offline/PWA startup closure and coherent revisions ---
|
|
62
62
|
assert.match(serviceWorker, /"\/syntax-highlight\.mjs",/, "the eagerly imported tokenizer must be part of the offline app shell");
|
|
63
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
63
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "adding a startup module should advance the PWA cache identity");
|
|
64
64
|
assert.match(html, /styles\.css\?v=152/, "new token styles should advance the stylesheet revision");
|
|
65
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
65
|
+
assert.match(html, /data-app-src="\/app\.js\?v=183"/, "new renderer wiring should advance the app module revision");
|
|
66
66
|
assert.match(pkg, /node --check public\/syntax-highlight\.mjs/, "the package check should syntax-check the startup-critical tokenizer");
|
|
67
67
|
|
|
68
68
|
const appShell = serviceWorker.slice(serviceWorker.indexOf("const APP_SHELL"), serviceWorker.indexOf("];", serviceWorker.indexOf("const APP_SHELL")));
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import vm from "node:vm";
|
|
6
|
+
|
|
7
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const app = await readFile(join(root, "public", "app.js"), "utf8");
|
|
9
|
+
|
|
10
|
+
function appFunctionSource(name, nextName) {
|
|
11
|
+
const start = app.indexOf(`function ${name}(`);
|
|
12
|
+
const end = app.indexOf(`\nfunction ${nextName}(`, start);
|
|
13
|
+
assert.ok(start >= 0 && end > start, `${name} should remain a standalone frontend helper`);
|
|
14
|
+
return app.slice(start, end);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function appFunctionToMarker(name, marker) {
|
|
18
|
+
const start = app.indexOf(`function ${name}(`);
|
|
19
|
+
const end = app.indexOf(marker, start);
|
|
20
|
+
assert.ok(start >= 0 && end > start, `${name} should remain extractable for behavioral tests`);
|
|
21
|
+
return app.slice(start, end);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const promptSource = appFunctionSource("terminalTabPromptTooltip", "terminalTabGroupRepresentedTab");
|
|
25
|
+
const representedTabSource = appFunctionSource("terminalTabGroupRepresentedTab", "terminalTabTooltip");
|
|
26
|
+
const tabTooltipSource = appFunctionSource("terminalTabTooltip", "terminalTabGroupStatusTooltip");
|
|
27
|
+
const groupTooltipSource = appFunctionSource("terminalTabGroupTooltip", "appendTerminalTabContent");
|
|
28
|
+
const regularRendererSource = appFunctionSource("renderTerminalTab", "renderTerminalTabGroupItem");
|
|
29
|
+
const groupedItemRendererSource = appFunctionSource("renderTerminalTabGroupItem", "shouldRenderTerminalTabGroup");
|
|
30
|
+
const collapsedGroupRendererSource = appFunctionSource("renderTerminalTabGroup", "updateTerminalTabGroupOpenState");
|
|
31
|
+
const stripAnsiSource = appFunctionToMarker("stripAnsi", "\n\nconst ANSI_16_COLORS");
|
|
32
|
+
const cleanTooltipSource = appFunctionToMarker("cleanTooltipText", "\n\nconst TOOLTIP_HOVER_DELAY_MS");
|
|
33
|
+
const applyStyledTooltipSource = appFunctionSource("applyStyledTooltip", "applyFooterTooltip");
|
|
34
|
+
|
|
35
|
+
const promptResults = vm.runInNewContext(`
|
|
36
|
+
${promptSource}
|
|
37
|
+
const exactBound = "/" + "a".repeat(4095);
|
|
38
|
+
({
|
|
39
|
+
positive: terminalTabPromptTooltip({ prompt: { kind: "append-system", path: "/home/user/.pi/agent/minimal/APPEND_SYSTEM.md" } }),
|
|
40
|
+
textOnly: terminalTabPromptTooltip({ prompt: { kind: "append-system", path: "/tmp/<prompt>&.md" } }),
|
|
41
|
+
exactBound: terminalTabPromptTooltip({ prompt: { kind: "append-system", path: exactBound } }),
|
|
42
|
+
nullPrompt: terminalTabPromptTooltip({ prompt: null }),
|
|
43
|
+
missingPrompt: terminalTabPromptTooltip({}),
|
|
44
|
+
wrongKind: terminalTabPromptTooltip({ prompt: { kind: "system", path: "/tmp/APPEND_SYSTEM.md" } }),
|
|
45
|
+
relativePath: terminalTabPromptTooltip({ prompt: { kind: "append-system", path: "relative/APPEND_SYSTEM.md" } }),
|
|
46
|
+
oversizedPath: terminalTabPromptTooltip({ prompt: { kind: "append-system", path: "/" + "a".repeat(4096) } }),
|
|
47
|
+
multilinePath: terminalTabPromptTooltip({ prompt: { kind: "append-system", path: "/tmp/prompt\\ncontent" } }),
|
|
48
|
+
extraField: terminalTabPromptTooltip({ prompt: { kind: "append-system", path: "/tmp/APPEND_SYSTEM.md", content: "secret" } }),
|
|
49
|
+
commandOnly: terminalTabPromptTooltip({ command: "pi --append-system-prompt /tmp/APPEND_SYSTEM.md" }),
|
|
50
|
+
});
|
|
51
|
+
`);
|
|
52
|
+
|
|
53
|
+
assert.equal(promptResults.positive, "Append-system prompt: /home/user/.pi/agent/minimal/APPEND_SYSTEM.md", "a valid tab-local descriptor should produce the exact approved label");
|
|
54
|
+
assert.equal(promptResults.textOnly, "Append-system prompt: /tmp/<prompt>&.md", "the helper should return text without interpreting markup-like path characters");
|
|
55
|
+
assert.equal(promptResults.exactBound.length, "Append-system prompt: ".length + 4096, "the server's 4,096-character path boundary should remain usable");
|
|
56
|
+
for (const [name, result] of Object.entries(promptResults).filter(([name]) => !["positive", "textOnly", "exactBound"].includes(name))) {
|
|
57
|
+
assert.equal(result, "", `${name} must not add an append-system tooltip line`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const tooltipResults = vm.runInNewContext(`
|
|
61
|
+
${promptSource}
|
|
62
|
+
${representedTabSource}
|
|
63
|
+
${tabTooltipSource}
|
|
64
|
+
${groupTooltipSource}
|
|
65
|
+
const activeTabId = "tab-active";
|
|
66
|
+
const defaultTab = { id: "tab-default", title: "Default", running: true, cwd: "/workspace/default", prompt: null };
|
|
67
|
+
const activeTab = { id: "tab-active", title: "Active", running: true, cwd: "/workspace/active", prompt: { kind: "append-system", path: "/visible/active/APPEND_SYSTEM.md" } };
|
|
68
|
+
const inactiveTab = { id: "tab-inactive", title: "Inactive", running: true, cwd: "/workspace/inactive", prompt: { kind: "append-system", path: "/visible/inactive/APPEND_SYSTEM.md" } };
|
|
69
|
+
({
|
|
70
|
+
regular: terminalTabTooltip(activeTab),
|
|
71
|
+
defaultTab: terminalTabTooltip(defaultTab),
|
|
72
|
+
group: terminalTabGroupTooltip({ custom: true, tabs: [inactiveTab, activeTab] }, "Prompt group"),
|
|
73
|
+
});
|
|
74
|
+
`, {
|
|
75
|
+
normalizeDisplayPath: (value) => String(value || ""),
|
|
76
|
+
tabIndicator: () => ({ label: "Idle", state: "idle" }),
|
|
77
|
+
terminalTabGitTooltip: () => "",
|
|
78
|
+
terminalTabActiveTooltip: () => "",
|
|
79
|
+
terminalDisplayGroupTitle: () => "Group",
|
|
80
|
+
terminalTabGroupWorkspaceTooltip: () => "Working folder: /workspace",
|
|
81
|
+
terminalTabGroupStatusTooltip: () => "2 idle",
|
|
82
|
+
terminalTabGroupActiveTooltip: () => "",
|
|
83
|
+
isMobileView: () => false,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
assert.match(tooltipResults.regular, /Working folder: \/workspace\/active\nAppend-system prompt: \/visible\/active\/APPEND_SYSTEM\.md\nClick to switch/, "regular tooltips should preserve working-folder and action lines around the new prompt line");
|
|
87
|
+
assert.doesNotMatch(tooltipResults.defaultTab, /Append-system prompt:/, "default tabs should keep their existing tooltip lines unchanged");
|
|
88
|
+
assert.match(tooltipResults.group, /Append-system prompt: \/visible\/active\/APPEND_SYSTEM\.md/, "a collapsed group should show its active represented tab's descriptor");
|
|
89
|
+
assert.doesNotMatch(tooltipResults.group, /\/visible\/inactive\/APPEND_SYSTEM\.md/, "a collapsed group must not borrow another group member's descriptor");
|
|
90
|
+
|
|
91
|
+
const styledTooltipResults = vm.runInNewContext(`
|
|
92
|
+
${promptSource}
|
|
93
|
+
${stripAnsiSource}
|
|
94
|
+
${cleanTooltipSource}
|
|
95
|
+
let styledTooltipDescriptionSerial = 0;
|
|
96
|
+
${applyStyledTooltipSource}
|
|
97
|
+
function tooltipNode() {
|
|
98
|
+
const attributes = new Map();
|
|
99
|
+
return {
|
|
100
|
+
attributes,
|
|
101
|
+
children: [],
|
|
102
|
+
dataset: {},
|
|
103
|
+
id: "",
|
|
104
|
+
append(child) { this.children.push(child); },
|
|
105
|
+
getAttribute(name) { return attributes.get(name) || null; },
|
|
106
|
+
removeAttribute(name) { attributes.delete(name); },
|
|
107
|
+
setAttribute(name, value) { attributes.set(name, String(value)); },
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const promptTooltip = terminalTabPromptTooltip({ prompt: { kind: "append-system", path: "/tmp/prompt two/APPEND_SYSTEM.md" } });
|
|
111
|
+
const promptNode = tooltipNode();
|
|
112
|
+
applyStyledTooltip(promptNode, promptTooltip, { ariaLabel: false, description: true, preserveInternalSpaces: true });
|
|
113
|
+
const ordinaryNode = tooltipNode();
|
|
114
|
+
applyStyledTooltip(ordinaryNode, "Ordinary repeated\\twhitespace", { ariaLabel: true });
|
|
115
|
+
({
|
|
116
|
+
promptTooltip,
|
|
117
|
+
promptData: promptNode.getAttribute("data-tooltip"),
|
|
118
|
+
promptDescribedBy: promptNode.getAttribute("aria-describedby"),
|
|
119
|
+
promptDescriptionId: promptNode.children[0]?.id,
|
|
120
|
+
promptDescriptionText: promptNode.children[0]?.textContent,
|
|
121
|
+
preservedCleanup: cleanTooltipText("\\u001b[31m Keep spaces\\r\\n\\n\\nTail\\tlabel \\u001b[0m", { preserveInternalSpaces: true }),
|
|
122
|
+
ordinaryData: ordinaryNode.getAttribute("data-tooltip"),
|
|
123
|
+
ordinaryAriaLabel: ordinaryNode.getAttribute("aria-label"),
|
|
124
|
+
});
|
|
125
|
+
`, {
|
|
126
|
+
bindStyledTooltipEvents: () => {},
|
|
127
|
+
make: (_tag, className, text) => ({ className, id: "", textContent: text || "" }),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const consecutiveSpaceTooltip = "Append-system prompt: /tmp/prompt two/APPEND_SYSTEM.md";
|
|
131
|
+
assert.equal(styledTooltipResults.promptTooltip, consecutiveSpaceTooltip, "the descriptor formatter must retain consecutive spaces in a valid path");
|
|
132
|
+
assert.equal(styledTooltipResults.promptData, consecutiveSpaceTooltip, "the styled tooltip data attribute must retain consecutive path spaces");
|
|
133
|
+
assert.equal(styledTooltipResults.promptDescriptionText, consecutiveSpaceTooltip, "the aria-describedby text must retain consecutive path spaces");
|
|
134
|
+
assert.equal(styledTooltipResults.promptDescribedBy, styledTooltipResults.promptDescriptionId, "the preserved description text must remain connected to its trigger");
|
|
135
|
+
assert.equal(styledTooltipResults.preservedCleanup, "Keep spaces\n\nTail label", "space preservation must retain ANSI stripping, CR/LF normalization, newline bounds, trimming, and non-space whitespace cleanup");
|
|
136
|
+
assert.equal(styledTooltipResults.ordinaryData, "Ordinary repeated whitespace", "ordinary styled tooltips must keep the default repeated-whitespace collapse");
|
|
137
|
+
assert.equal(styledTooltipResults.ordinaryAriaLabel, "Ordinary repeated whitespace", "ordinary tooltip accessibility labels must keep the default sanitizer behavior");
|
|
138
|
+
|
|
139
|
+
assert.match(regularRendererSource, /applyStyledTooltip\(button, terminalTabTooltip\(tab\), \{[^}]*preserveInternalSpaces: true/, "regular tabs should explicitly preserve valid prompt-path spaces");
|
|
140
|
+
assert.match(groupedItemRendererSource, /applyStyledTooltip\(button, terminalTabTooltip\(tab\), \{[^}]*preserveInternalSpaces: true/, "grouped tab items should explicitly preserve valid prompt-path spaces");
|
|
141
|
+
assert.match(collapsedGroupRendererSource, /const activeGroupTab = terminalTabGroupRepresentedTab\(groupTabs\)[\s\S]*applyStyledTooltip\(button, terminalTabGroupTooltip\(group, groupTitle\), \{[^}]*preserveInternalSpaces: true/, "collapsed groups should use the same represented-tab selection and explicit space preservation for their styled tooltip");
|
|
142
|
+
assert.equal(app.match(/applyStyledTooltip\(button, terminalTabTooltip\(tab\)/g)?.length, 2, "regular and grouped-item call sites should continue sharing terminalTabTooltip");
|
|
143
|
+
assert.doesNotMatch(promptSource, /\bsettings\b|appendSystemPromptPath|\.command\b|piArgs/, "prompt display must not infer state from global settings or tab commands");
|
|
144
|
+
assert.doesNotMatch(`${promptSource}\n${tabTooltipSource}\n${groupTooltipSource}`, /\bfetch\s*\(|nativeCommandApi|XMLHttpRequest|FileReader|\/api\/.*file/i, "tooltip rendering must not load prompt files or contents");
|
|
145
|
+
assert.doesNotMatch(`${regularRendererSource}\n${groupedItemRendererSource}\n${collapsedGroupRendererSource}`, /\.innerHTML\s*=/, "tab tooltip call sites should retain attribute/text-only rendering");
|
|
146
|
+
|
|
147
|
+
console.log("terminal tab prompt tooltip static tests passed");
|
|
@@ -90,7 +90,7 @@ assert.match(results.group, /^Tooltip group · 2 tabs\nWorkspaces: projects\/pi-
|
|
|
90
90
|
assert.match(results.group, /Click to switch · Drop tabs here to add$/, "group hover summary should preserve the drop-target affordance");
|
|
91
91
|
assert.doesNotMatch(terminalTabMetaSource, /\bpid\b/i, "compact tab metadata should not expose the process PID");
|
|
92
92
|
assert.equal(app.match(/applyStyledTooltip\(button, terminalTabTooltip\(tab\)/g)?.length, 2, "single and grouped-item tabs should share one tooltip formatter");
|
|
93
|
-
assert.match(renderTerminalTabGroupSource, /applyStyledTooltip\(button, terminalTabGroupTooltip\(group, groupTitle\), \{ ariaLabel: false, description: true, placement: "right", variant: "workspace", targetKey: `terminal-group:\$\{group\.key\}:switch` \}\)/, "group hover disclosure should use the shared floating tooltip layer with stable semantic identity to the right of its trigger");
|
|
93
|
+
assert.match(renderTerminalTabGroupSource, /applyStyledTooltip\(button, terminalTabGroupTooltip\(group, groupTitle\), \{ ariaLabel: false, description: true, placement: "right", preserveInternalSpaces: true, variant: "workspace", targetKey: `terminal-group:\$\{group\.key\}:switch` \}\)/, "group hover disclosure should use the shared floating tooltip layer with stable semantic identity to the right of its trigger while preserving valid prompt-path spaces");
|
|
94
94
|
assert.doesNotMatch(renderTerminalTabGroupSource, /terminal-tab-group-summary|menu\.append\(summary\)/, "group hover disclosure should not render an in-flow summary that shifts group menu items");
|
|
95
95
|
assert.match(renderTerminalTabGroupSource, /dropdown: true[\s\S]*button\.addEventListener\("click", \(\) => \{[\s\S]*if \(isMobileView\(\)\)[\s\S]*toggleOpenTerminalTabGroup\(group\.key\)[\s\S]*switchTab\(activeGroupTab\.id\)/, "mobile terminal group titles should toggle their dropdown while desktop titles keep switching terminals");
|
|
96
96
|
assert.match(renderSubagentTerminalTabGroupSource, /dropdown: true[\s\S]*button\.addEventListener\("click", \(\) => \{[\s\S]*if \(isMobileView\(\)\)[\s\S]*toggleOpenTerminalTabGroup\(group\.key\)[\s\S]*activateSubagentTerminalView\(activeView\.id\)/, "mobile subagent group titles should toggle their dropdown while desktop titles keep switching views");
|
|
@@ -34,7 +34,7 @@ assert.match(html, /role="alert" hidden>[\s\S]*Replace this exact target\?/, "ov
|
|
|
34
34
|
|
|
35
35
|
assert.match(app, /from "\.\/theme-contract\.mjs"/, "frontend should consume the shared browser-safe theme contract");
|
|
36
36
|
assert.match(serviceWorker, /"\/theme-contract\.mjs"/, "the PWA app shell should cache the startup-critical theme contract");
|
|
37
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
37
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "adding the theme contract to the startup graph should advance the PWA cache identity");
|
|
38
38
|
assert.match(pkg, /node --check public\/theme-contract\.mjs/, "the package check should syntax-check the startup-critical theme contract");
|
|
39
39
|
assert.match(app, /function themeDraftFromCatalog\(theme, name = theme\?\.name\)[\s\S]*colors: cloneThemeDraft\(theme\?\.colors \|\| \{\}\)/, "catalog metadata should be projected into a schema-only editable draft");
|
|
40
40
|
assert.match(app, /for \(const \{ name, label \} of group\.tokens\)/, "visual controls should render from the exact shared token inventory");
|
|
@@ -75,7 +75,7 @@ assert.match(development, /virtual \*\*This PC\*\* response with an empty cwd an
|
|
|
75
75
|
assert.ok(packageJson.files.includes("TECHNICAL.md"), "the published package should include its advanced user reference");
|
|
76
76
|
assert.ok(packageJson.files.includes("DEVELOPMENT.md"), "the published package should include its contributor guide");
|
|
77
77
|
assert.match(html, /styles\.css\?v=152/, "the existing picker layout should retain its stylesheet revision");
|
|
78
|
-
assert.match(html, /app\.js\?v=
|
|
79
|
-
assert.match(serviceWorker, /pi-webui-pwa-
|
|
78
|
+
assert.match(html, /app\.js\?v=183/, "the changed picker behavior should advance the app revision");
|
|
79
|
+
assert.match(serviceWorker, /pi-webui-pwa-v154/, "the changed browser assets should advance the PWA cache identity");
|
|
80
80
|
|
|
81
81
|
console.log("windows-drive-cwd-picker-static.test.mjs passed");
|