@firstpick/pi-package-webui 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/bin/pi-webui.mjs +367 -72
- package/lib/git-workflow-preferences.mjs +21 -1
- package/lib/session-tree-event-targets.mjs +70 -0
- package/lib/subagent-launch-policy.mjs +375 -0
- package/lib/subagent-launch-slots.mjs +2 -1
- package/package.json +1 -1
- package/public/app.js +721 -35
- package/public/index.html +38 -2
- package/public/service-worker.js +1 -1
- package/public/styles.css +254 -3
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/control-visibility.spec.mjs +141 -2
- package/tests/browser/events-tree-context-menu.spec.mjs +240 -0
- package/tests/browser/guided-git-fallback.spec.mjs +153 -0
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/compact-sections-static.test.mjs +4 -0
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-visibility-static.test.mjs +66 -3
- package/tests/controls-layout-static.test.mjs +3 -3
- package/tests/events-tree-context-menu-static.test.mjs +131 -0
- package/tests/fast-mode-client-static.test.mjs +5 -2
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/file-viewer-image-static.test.mjs +3 -3
- package/tests/git-workflow-preferences.test.mjs +30 -1
- package/tests/guided-git-fallback-runtime.test.mjs +418 -0
- package/tests/guided-git-fallback-ui-static.test.mjs +60 -0
- package/tests/guided-git-message-reliability-static.test.mjs +8 -7
- package/tests/intercom-conversation-viewer-static.test.mjs +3 -3
- package/tests/main-output-loading-static.test.mjs +3 -3
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +3 -3
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/mobile-static.test.mjs +7 -5
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/persistent-ui-layout-static.test.mjs +3 -3
- package/tests/prompt-input-vertical-scroll-static.test.mjs +3 -3
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/remote-auth-settings-harness.test.mjs +23 -0
- package/tests/resource-defaults-helper.test.mjs +12 -0
- package/tests/session-sampling-helper.test.mjs +1 -0
- package/tests/session-sampling-ui-static.test.mjs +3 -3
- package/tests/session-tree-event-targets.test.mjs +106 -0
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/subagent-launch-policy.test.mjs +532 -0
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/subagents-helper.test.mjs +211 -1
- package/tests/syntax-highlighting-static.test.mjs +3 -3
- package/tests/tab-close-continuity-static.test.mjs +23 -0
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/webui-rpc-helper.mjs +220 -3
|
@@ -287,11 +287,11 @@ assert.match(html, /data-side-panel-section="controls"/, "side panel controls sh
|
|
|
287
287
|
assert.match(html, /data-side-panel-section="commands"/, "side panel commands should live in a collapsible section");
|
|
288
288
|
assert.match(html, /class="side-panel-section-toggle"[^>]*aria-controls="sidePanelSectionControls"/, "side panel section toggles should target their content panels");
|
|
289
289
|
assert.match(html, /class="side-panel-section-label">Events<\/span>/, "side panel events should expose a section toggle label");
|
|
290
|
-
assert.match(app, /function addEvent\(message, level = "info", \{ toolCallId = "",
|
|
290
|
+
assert.match(app, /function addEvent\(message, level = "info", \{ toolCallId = "", toolEventPhase = "", details = \[\], notify = true,[\s\S]*?make\("button", `event \$\{level\}`[\s\S]*?chatEventTimestamp[\s\S]*?jumpToChatEvent\(line\)/, "event log entries should be keyboard-accessible controls that navigate into the chat");
|
|
291
291
|
assert.match(app, /function chatEventTargetForLine\(line\)[\s\S]*?chatToolCallId[\s\S]*?data-tool-call-id[\s\S]*?\.message\[data-chat-timestamp\]/, "event navigation should prefer exact tool cards and otherwise match the closest chat timestamp");
|
|
292
292
|
assert.match(app, /function jumpToChatEvent\(line\)[\s\S]*?setChatScrollTopInstant[\s\S]*?highlightChatEventTarget[\s\S]*?setSidePanelCollapsed\(true, \{ persist: false \}\)/, "event navigation should dismiss overlay sidebars, scroll the chat, and highlight its target");
|
|
293
293
|
assert.match(app, /function applyChatEventMetadata\(bubble, message\)[\s\S]*?bubble\.dataset\.chatTimestamp/, "rendered chat events should expose timestamps for sidebar navigation");
|
|
294
|
-
assert.match(app, /addEvent\(
|
|
294
|
+
assert.match(app, /case "tool_execution_start":[\s\S]*?addEvent\(\.\.\.toolLifecycleEventArguments\(event, "start"\)\)/, "tool start events should retain exact tool-card navigation while adding bounded lifecycle details");
|
|
295
295
|
assert.match(css, /\.event:hover,[\s\S]*?\.message\.chat-event-target[\s\S]*?@keyframes chat-event-target-pulse/, "clickable events and highlighted chat targets should have visible interaction states");
|
|
296
296
|
const sidePanelToggleStates = Array.from(
|
|
297
297
|
html.matchAll(/class="side-panel-section-toggle"[^>]*aria-expanded="([^"]+)"/g),
|
|
@@ -1790,7 +1790,7 @@ assert.match(server, /\["short", "long", "input"\][\s\S]*cleanGitCommitMessageIn
|
|
|
1790
1790
|
assert.match(css, /\.git-workflow-message-input-row \{[\s\S]*flex:\s*1 1 100%/, "manual git workflow commit input should span the Message stage actions row");
|
|
1791
1791
|
assert.match(css, /\.git-workflow-actions button\[data-tooltip\]::after \{[\s\S]*content:\s*attr\(data-tooltip\)[\s\S]*white-space:\s*pre-line/, "guided git workflow action tooltips should render multiline step lists");
|
|
1792
1792
|
assert.match(app, /function gitBranchNamePromptMessage\(\)[\s\S]*hasAvailableCommand\("git-branch-name"\)[\s\S]*return "\/git-branch-name"/, "guided git workflow should ask the agent to generate PR branch names when the prompt is available");
|
|
1793
|
-
assert.match(app, /async function loadGitWorkflowBranchName\([\s\S]*gitWorkflowRequest\(
|
|
1793
|
+
assert.match(app, /async function loadGitWorkflowBranchName\([\s\S]*generationId[\s\S]*gitWorkflowRequest\(`\/api\/git-workflow\/branch-name\$\{query\}`/, "guided git workflow should load exactly correlated generated branch names before branch creation");
|
|
1794
1794
|
assert.match(app, /async function createGitPrBranchWithSuggestion\([\s\S]*appPromptText\(\{ title: "New PR branch worktree"[\s\S]*chooseGitWorktreeBase\(branch\)[\s\S]*assertGuidedGitStagedContentBinding\(tabId, "PR worktree creation"\)[\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch", \{ body: \{ branch, baseRef, sessionMode: "fork-current", openTab: true, [\s\S]*expectedStagedContentHash/, "guided git worktrees should ask for a base ref before verifying and carrying staged content");
|
|
1795
1795
|
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");
|
|
1796
1796
|
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");
|
|
@@ -1813,8 +1813,9 @@ assert.doesNotMatch(app, /visibility = "(?:public|private)"/, "publication visib
|
|
|
1813
1813
|
assert.match(server, /async function gitAddAllPayload\([\s\S]*platform\(\) === "win32"[\s\S]*findWindowsReservedGitPath\([\s\S]*windowsReservedGitPathFailure\(/, "guided git add should preflight Windows-reserved untracked paths before staging");
|
|
1814
1814
|
assert.match(app, /Pre-commit verification reminder[\s\S]*Continue with this commit/, "configured verification reminders should run before committing");
|
|
1815
1815
|
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");
|
|
1816
|
-
assert.match(server, /event\?\.type
|
|
1817
|
-
assert.match(server, /
|
|
1816
|
+
assert.match(server, /function consumeGitWorkflowGenerationEvent\(tab, event[\s\S]*event\?\.type !== "agent_settled"[\s\S]*settleGitWorkflowGeneration\(tab, record, settlement\)/, "server should settle the owned Guided Git attempt only after agent settlement");
|
|
1817
|
+
assert.match(server, /async function finishGitWorkflowGeneration\(tab, record[\s\S]*restoreGitWorkflowGenerationProfile\(tab, record\)/, "server should restore the active tab model and effort after Guided Git generation finishes");
|
|
1818
|
+
assert.match(server, /case "\/api\/git-workflow\/branch-name": \{[\s\S]*generationId[\s\S]*readGitWorkflowBranchName\(cwd, \{ generationId/, "server should expose exactly correlated generated branch-name loading for the guided PR workflow");
|
|
1818
1819
|
assert.match(server, /case "\/api\/git-workflow\/branch":[\s\S]*createGitWorkflowBranchWorktree\(tab, body\)/, "server should route guided PR branch creation through worktree tabs");
|
|
1819
1820
|
assert.match(server, /async function createGitWorkflowBranchWorktree\(tab, body = \{\}\)[\s\S]*expectedStagedContentHashFromBody\(body\)[\s\S]*snapshotGitWorkflowBranchState\(root, tab\.cwd, expectedStagedContentHash\)[\s\S]*applyGitWorkflowBranchStateToWorktree\(snapshot, worktreePath\)[\s\S]*openWorktreeResultForTab\(tab, createdResult/, "guided PR worktree creation should verify and copy exact staged state before opening the worktree tab");
|
|
1820
1821
|
assert.match(server, /case "\/api\/git-workflow\/create-pr":[\s\S]*runGitHubWorkflowCommand\(\["pr", "create"/, "server should create PRs with the GitHub CLI after confirmation");
|
|
@@ -2198,6 +2199,7 @@ assert.match(app, /function bindTerminalTabDragAndDrop\(/, "terminal tabs should
|
|
|
2198
2199
|
assert.match(app, /function handleTerminalTabDrop\(sourceTabId, target\)[\s\S]*?createTerminalCustomGroup/, "dropping a terminal tab onto another tab or group should create or update a custom group");
|
|
2199
2200
|
assert.match(css, /\.terminal-tab\.terminal-tab-drag-over,[\s\S]*?\.terminal-tab-group-item\.terminal-tab-drag-over/, "terminal tab drop targets should show drag-over affordance");
|
|
2200
2201
|
assert.match(app, /function closeTerminalTabGroup\(group\)[\s\S]*?closeTerminalTabs\(group\.tabs\.map\(\(tab\) => tab\.id\)/, "terminal tab groups should be closable as a batch");
|
|
2202
|
+
assert.match(app, /const closedActiveCwd = closedActiveTab \? tabs\.find\(\(tab\) => tab\.id === activeTabId\)\?\.cwd \|\| "" : ""[\s\S]*?const sameCwdFallbackTabId = closedActiveCwd[\s\S]*?item\.cwd === closedActiveCwd/, "closing the active terminal should prefer another open tab in the same cwd");
|
|
2201
2203
|
assert.match(app, /function closeAllTerminalTabs\(\)[\s\S]*?closeTerminalTabs\(tabs\.map\(\(tab\) => tab\.id\)/, "tab header should close all terminal tabs as a batch");
|
|
2202
2204
|
assert.match(app, /WARNING: \$\{activeAgentTabs\.length\}[\s\S]*?still running or waiting for input/, "tab close confirmations should warn when agents are still running");
|
|
2203
2205
|
assert.match(app, /elements\.closeAllTabsButton\.addEventListener\("click", \(\) => closeAllTerminalTabs\(\)\)/, "close-all tabs button should be wired in JS");
|
|
@@ -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-v132/, "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
|
|
|
@@ -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-
|
|
275
|
-
assert.match(html, /styles\.css\?v=
|
|
276
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
274
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v132"/, "changed browser assets should advance the PWA cache identity");
|
|
275
|
+
assert.match(html, /styles\.css\?v=137/, "the page should request the updated layout stylesheet revision");
|
|
276
|
+
assert.match(html, /data-app-src="\/app\.js\?v=166"/, "the boot loader should request the updated app module revision");
|
|
277
277
|
|
|
278
278
|
console.log("persistent-ui-layout-static.test.mjs passed");
|
|
@@ -19,8 +19,8 @@ const resizePromptInput = app.slice(resizeStart, resizeEnd);
|
|
|
19
19
|
assert.match(css, /#promptInput \{[\s\S]*max-height: min\(25vh, 10rem\);[\s\S]*overflow-y: auto;[\s\S]*overscroll-behavior-y: contain;/, "the prompt should retain bounded growth with native vertical scrolling as its CSS fallback");
|
|
20
20
|
assert.match(resizePromptInput, /input\.style\.height = "auto";[\s\S]*Math\.min\(input\.scrollHeight, maxHeight\)[\s\S]*input\.style\.overflowY = "auto";/, "every auto-resize pass should preserve vertical scrolling after the height cap is reached or growth stalls");
|
|
21
21
|
assert.doesNotMatch(resizePromptInput, /overflowY[^\n]+"hidden"/, "auto-resizing must not disable the prompt's vertical overflow fallback");
|
|
22
|
-
assert.match(html, /styles\.css\?v=
|
|
23
|
-
assert.match(html, /app\.js\?v=
|
|
24
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
22
|
+
assert.match(html, /styles\.css\?v=137/, "the page should request the scroll-enabled stylesheet revision");
|
|
23
|
+
assert.match(html, /app\.js\?v=166/, "the page should request the scroll-enabled app revision");
|
|
24
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v132"/, "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");
|
|
@@ -504,8 +504,8 @@ assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(p
|
|
|
504
504
|
assert.match(css, /\.questionnaire-options button\s*\{\s*min-height:\s*3\.35rem/, "mobile questionnaire targets must exceed the 44px floor");
|
|
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
|
-
assert.match(html, /styles\.css\?v=
|
|
508
|
-
assert.match(html, /app\.js\?v=
|
|
509
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
507
|
+
assert.match(html, /styles\.css\?v=137/, "questionnaire CSS needs the current stylesheet revision");
|
|
508
|
+
assert.match(html, /app\.js\?v=166/, "questionnaire behavior needs the current app revision");
|
|
509
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v132"/, "questionnaire public assets need a coherent PWA cache revision");
|
|
510
510
|
|
|
511
511
|
console.log("questionnaire-dialog.test.mjs passed");
|
|
@@ -133,6 +133,11 @@ try {
|
|
|
133
133
|
assert.equal(initialGitSetup.body?.data?.configured, false, "guided Git should require first-time model setup");
|
|
134
134
|
assert.equal(initialGitSetup.body?.data?.preferences?.stagingPolicy, "review", "review/select should be the safe staging default");
|
|
135
135
|
assert.equal(initialGitSetup.body?.data?.preferences?.reviewProcessEnabled, true, "manual review should remain enabled by default for compatibility");
|
|
136
|
+
assert.deepEqual(initialGitSetup.body?.data?.preferences?.generation?.fallback, {
|
|
137
|
+
provider: "",
|
|
138
|
+
modelId: "",
|
|
139
|
+
thinkingLevel: "low",
|
|
140
|
+
}, "existing settings should expose fallback as disabled until explicitly selected");
|
|
136
141
|
assert.equal(initialGitSetup.body?.data?.models?.[0]?.id, "fake-model");
|
|
137
142
|
|
|
138
143
|
const unsupportedEffort = await request("/api/git-workflow/preferences", {
|
|
@@ -141,6 +146,24 @@ try {
|
|
|
141
146
|
});
|
|
142
147
|
assert.equal(unsupportedEffort.status, 400, "setup should reject effort levels unsupported by the selected model");
|
|
143
148
|
|
|
149
|
+
const sameAsPrimaryFallback = await request("/api/git-workflow/preferences", {
|
|
150
|
+
method: "POST",
|
|
151
|
+
body: { preferences: { generation: { provider: "fake", modelId: "fake-model", thinkingLevel: "off", fallback: { provider: "fake", modelId: "fake-model", thinkingLevel: "off" } } } },
|
|
152
|
+
});
|
|
153
|
+
assert.equal(sameAsPrimaryFallback.status, 400, "setup should reject a fallback equal to the primary model");
|
|
154
|
+
|
|
155
|
+
const unavailableFallback = await request("/api/git-workflow/preferences", {
|
|
156
|
+
method: "POST",
|
|
157
|
+
body: { preferences: { generation: { provider: "fake", modelId: "fake-model", thinkingLevel: "off", fallback: { provider: "fake", modelId: "missing-model", thinkingLevel: "off" } } } },
|
|
158
|
+
});
|
|
159
|
+
assert.equal(unavailableFallback.status, 400, "setup should reject unavailable fallback models");
|
|
160
|
+
|
|
161
|
+
const invalidFallbackEffort = await request("/api/git-workflow/preferences", {
|
|
162
|
+
method: "POST",
|
|
163
|
+
body: { preferences: { generation: { provider: "fake", modelId: "fake-model", thinkingLevel: "off", fallback: { provider: "", modelId: "", thinkingLevel: "extreme" } } } },
|
|
164
|
+
});
|
|
165
|
+
assert.equal(invalidFallbackEffort.status, 400, "setup should reject unsupported fallback effort values even while fallback is disabled");
|
|
166
|
+
|
|
144
167
|
const invalidStagingPolicy = await request("/api/git-workflow/preferences", {
|
|
145
168
|
method: "POST",
|
|
146
169
|
body: { preferences: { generation: { provider: "fake", modelId: "fake-model", thinkingLevel: "off" }, stagingPolicy: "everything" } },
|
|
@@ -58,6 +58,7 @@ try {
|
|
|
58
58
|
extensionHandlers.set(name, handlers);
|
|
59
59
|
},
|
|
60
60
|
registerCommand(name, command) { registeredCommands.set(name, command); },
|
|
61
|
+
registerTool() {},
|
|
61
62
|
getAllTools() {
|
|
62
63
|
return ["read", "bash", "write"].map((name) => ({ name, description: `${name} tool`, sourceInfo: { source: "builtin" } }));
|
|
63
64
|
},
|
|
@@ -109,9 +110,20 @@ try {
|
|
|
109
110
|
for (const handler of extensionHandlers.get("session_start") || []) await handler({ reason: "startup" }, ctx);
|
|
110
111
|
assert.deepEqual(activeTools, ["read", "bash", "write"], "an initial settings-read failure must leave Pi's runtime tools unchanged");
|
|
111
112
|
assert.ok(notifications.some((entry) => /tools and skills remain unchanged/i.test(entry.message)), "initial settings failure should emit a bounded warning");
|
|
113
|
+
const applyLaunchSlotDefaults = (extensionHandlers.get("tool_call") || [])[0];
|
|
114
|
+
assert.ok(applyLaunchSlotDefaults, "resource defaults helper should register launch-slot admission");
|
|
115
|
+
const unavailableReviewer = await applyLaunchSlotDefaults({ toolName: "subagent", input: { agent: "reviewer", task: "Review while settings are unavailable" } }, ctx);
|
|
116
|
+
assert.equal(unavailableReviewer?.block, true, "a reviewer-bearing direct launch must fail closed after snapshot load failure");
|
|
117
|
+
assert.match(unavailableReviewer?.reason || "", /snapshot could not be loaded.*Reload the active tab/i);
|
|
118
|
+
const unavailableWorkflow = await applyLaunchSlotDefaults({ toolName: "subagent", input: { workflowScript: "return runs.run('review', {agent:'reviewer', task:'Review'})" } }, ctx);
|
|
119
|
+
assert.equal(unavailableWorkflow?.block, true, "an opaque workflow launch must fail closed after snapshot load failure");
|
|
120
|
+
const unaffectedDelegate = { agent: "delegate", task: "Continue non-reviewer work", model: "provider/delegate" };
|
|
121
|
+
assert.equal(await applyLaunchSlotDefaults({ toolName: "subagent", input: unaffectedDelegate }, ctx), undefined, "a non-reviewer direct launch should remain available after snapshot load failure");
|
|
122
|
+
assert.equal(unaffectedDelegate.model, "provider/delegate");
|
|
112
123
|
|
|
113
124
|
await writeFile(settingsFile, `${JSON.stringify(settingsPayload, null, 2)}\n`, "utf8");
|
|
114
125
|
for (const handler of extensionHandlers.get("session_start") || []) await handler({ reason: "settings-restored" }, ctx);
|
|
126
|
+
assert.equal(await applyLaunchSlotDefaults({ toolName: "subagent", input: { agent: "reviewer", task: "Review after reload" } }, ctx), undefined, "a successful reload should clear snapshot-failure admission blocking");
|
|
115
127
|
availableSkills = ["skill-a", "skill-b", "skill-c"];
|
|
116
128
|
assert.deepEqual(activeTools, ["read", "write"], "a new session should inherit the global tool allowlist");
|
|
117
129
|
assert.deepEqual(
|
|
@@ -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-v132"/, "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
|
-
assert.match(html, /styles\.css\?v=
|
|
63
|
-
assert.match(html, /app\.js\?v=
|
|
62
|
+
assert.match(html, /styles\.css\?v=137/, "the changed stylesheet should have a new revision");
|
|
63
|
+
assert.match(html, /app\.js\?v=166/, "the changed app module should have a new revision");
|
|
64
64
|
|
|
65
65
|
// --- Browser state behavior -------------------------------------------------
|
|
66
66
|
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { sessionTreeEventTargets } from "../lib/session-tree-event-targets.mjs";
|
|
3
|
+
|
|
4
|
+
function messageEntry(id, message) {
|
|
5
|
+
return { type: "message", id, parentId: null, timestamp: "2026-08-20T12:00:00.000Z", message };
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
{
|
|
9
|
+
const entries = [
|
|
10
|
+
messageEntry("assistant-1", {
|
|
11
|
+
role: "assistant",
|
|
12
|
+
content: [
|
|
13
|
+
{ type: "text", text: "PRIVATE_ASSISTANT_TEXT" },
|
|
14
|
+
{ type: "toolCall", id: "call-read", name: "read", arguments: { path: "/private/secret.txt" } },
|
|
15
|
+
{ type: "toolCall", toolCallId: "call-bash", toolName: "bash", arguments: { command: "printenv TOKEN" } },
|
|
16
|
+
],
|
|
17
|
+
}),
|
|
18
|
+
messageEntry("result-read", {
|
|
19
|
+
role: "toolResult",
|
|
20
|
+
toolCallId: "call-read",
|
|
21
|
+
toolName: "read",
|
|
22
|
+
content: [{ type: "text", text: "PRIVATE_READ_RESULT" }],
|
|
23
|
+
}),
|
|
24
|
+
messageEntry("result-bash", {
|
|
25
|
+
role: "toolResult",
|
|
26
|
+
toolCallId: "call-bash",
|
|
27
|
+
toolName: "bash",
|
|
28
|
+
content: [{ type: "text", text: "PRIVATE_BASH_RESULT" }],
|
|
29
|
+
}),
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const targets = sessionTreeEventTargets(entries);
|
|
33
|
+
assert.deepEqual(targets, [
|
|
34
|
+
{ toolCallId: "call-read", toolName: "read", startEntryId: "assistant-1", finishEntryId: "result-read" },
|
|
35
|
+
{ toolCallId: "call-bash", toolName: "bash", startEntryId: "assistant-1", finishEntryId: "result-bash" },
|
|
36
|
+
], "multiple calls should map their shared assistant start and distinct result finishes in call order");
|
|
37
|
+
assert.equal(JSON.stringify(targets).includes("PRIVATE_"), false, "message and result content must not enter event targets");
|
|
38
|
+
assert.equal(JSON.stringify(targets).includes("/private/secret.txt"), false, "tool arguments must not enter event targets");
|
|
39
|
+
assert.deepEqual(Object.keys(targets[0]), ["toolCallId", "toolName", "startEntryId", "finishEntryId"], "the contract should expose only the four approved fields");
|
|
40
|
+
assert.doesNotThrow(() => JSON.stringify(targets), "event targets should be JSON-safe");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
{
|
|
44
|
+
const entries = [
|
|
45
|
+
messageEntry("assistant-first", {
|
|
46
|
+
role: "assistant",
|
|
47
|
+
content: [
|
|
48
|
+
{ type: "toolCall", id: "duplicate", name: "first-name", arguments: { secret: "FIRST_ARGUMENT_SECRET" } },
|
|
49
|
+
{ type: "toolCall", id: "", name: "missing-id" },
|
|
50
|
+
{ type: "toolCall", name: "also-missing-id" },
|
|
51
|
+
],
|
|
52
|
+
}),
|
|
53
|
+
messageEntry("assistant-later", {
|
|
54
|
+
role: "assistant",
|
|
55
|
+
content: [{ type: "toolCall", id: "duplicate", name: "later-name", arguments: { secret: "LATER_ARGUMENT_SECRET" } }],
|
|
56
|
+
}),
|
|
57
|
+
messageEntry("result-first", {
|
|
58
|
+
role: "toolResult",
|
|
59
|
+
toolCallId: "duplicate",
|
|
60
|
+
toolName: "result-name",
|
|
61
|
+
content: "FIRST_RESULT_SECRET",
|
|
62
|
+
}),
|
|
63
|
+
messageEntry("result-later", {
|
|
64
|
+
role: "toolResult",
|
|
65
|
+
toolCallId: "duplicate",
|
|
66
|
+
toolName: "later-result-name",
|
|
67
|
+
content: "LATER_RESULT_SECRET",
|
|
68
|
+
}),
|
|
69
|
+
messageEntry("result-missing-id", { role: "toolResult", toolName: "read", content: "MISSING_ID_RESULT_SECRET" }),
|
|
70
|
+
messageEntry("not-a-tool-call", { role: "assistant", content: [{ type: "text", text: "ignore" }] }),
|
|
71
|
+
{ type: "message", message: { role: "toolResult", toolCallId: "missing-entry-id", toolName: "read" } },
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
assert.deepEqual(sessionTreeEventTargets(entries), [
|
|
75
|
+
{ toolCallId: "duplicate", toolName: "first-name", startEntryId: "assistant-first", finishEntryId: "result-first" },
|
|
76
|
+
], "missing IDs should be ignored and duplicate boundaries should keep their first stable entry IDs and tool name");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
{
|
|
80
|
+
const finishOnly = sessionTreeEventTargets([
|
|
81
|
+
messageEntry("finish-only-entry", {
|
|
82
|
+
role: "toolResult",
|
|
83
|
+
toolCallId: "finish-only",
|
|
84
|
+
toolName: "write",
|
|
85
|
+
content: [{ type: "text", text: "FINISH_ONLY_RESULT_SECRET" }],
|
|
86
|
+
}),
|
|
87
|
+
]);
|
|
88
|
+
assert.deepEqual(finishOnly, [
|
|
89
|
+
{ toolCallId: "finish-only", toolName: "write", startEntryId: null, finishEntryId: "finish-only-entry" },
|
|
90
|
+
], "persisted finish-only records should remain navigable without inventing a start boundary");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
{
|
|
94
|
+
const resultBeforeCall = sessionTreeEventTargets([
|
|
95
|
+
messageEntry("finish-before-start", { role: "toolResult", toolCallId: "out-of-order", toolName: "bash", content: "secret" }),
|
|
96
|
+
messageEntry("start-after-finish", { role: "assistant", content: [{ type: "toolCall", id: "out-of-order", name: "bash", arguments: {} }] }),
|
|
97
|
+
]);
|
|
98
|
+
assert.deepEqual(resultBeforeCall, [
|
|
99
|
+
{ toolCallId: "out-of-order", toolName: "bash", startEntryId: "start-after-finish", finishEntryId: "finish-before-start" },
|
|
100
|
+
], "merge logic should fill either boundary without depending on entry ordering");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
assert.deepEqual(sessionTreeEventTargets(undefined), [], "non-array input should return an empty JSON-safe list");
|
|
104
|
+
assert.deepEqual(sessionTreeEventTargets([null, {}, { type: "message", id: "empty-message" }]), [], "malformed entries should be ignored");
|
|
105
|
+
|
|
106
|
+
console.log("session-tree-event-targets.test.mjs passed");
|
|
@@ -27,8 +27,8 @@ assert.doesNotMatch(layout, /sectionHeightMin|sectionHeightMax|validateSectionHe
|
|
|
27
27
|
assert.match(app, /const UI_LAYOUT_SIDE_PANEL_FIELDS = \["placement", "sectionLayout", "collapsedSectionIds", "hiddenSectionIds", "collapsedPanels", "panelWidths"\];/, "the browser durable layout field list should omit section heights");
|
|
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
|
-
assert.match(html, /styles\.css\?v=
|
|
31
|
-
assert.match(html, /app\.js\?v=
|
|
32
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
30
|
+
assert.match(html, /styles\.css\?v=137/, "removing section resize styles should advance the stylesheet revision");
|
|
31
|
+
assert.match(html, /app\.js\?v=166/, "removing section resize behavior should advance the app revision");
|
|
32
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v132"/, "removing browser assets should advance the PWA cache identity");
|
|
33
33
|
|
|
34
34
|
console.log("side-panel-section-height-removal-static.test.mjs passed");
|