@firstpick/pi-package-webui 0.9.3 → 0.9.5
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 +4 -1
- package/lib/ui-layout-settings.mjs +37 -6
- package/package.json +1 -1
- package/public/app.js +535 -10
- package/public/index.html +33 -26
- package/public/service-worker.js +1 -1
- package/public/stream-output-controller.mjs +31 -2
- package/public/styles.css +62 -6
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/control-deck-side-panels.spec.mjs +42 -0
- package/tests/browser/control-visibility.spec.mjs +396 -0
- package/tests/browser/intercom-conversation-viewer.spec.mjs +2 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +9 -9
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-deck-side-panels-static.test.mjs +3 -1
- package/tests/control-visibility-static.test.mjs +294 -0
- package/tests/controls-layout-static.test.mjs +3 -3
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/file-viewer-image-static.test.mjs +3 -3
- package/tests/fixtures/streaming-workloads.mjs +131 -0
- package/tests/git-workflow-preferences.test.mjs +2 -2
- package/tests/http-endpoints-harness.test.mjs +4 -4
- package/tests/intercom-conversation-viewer-static.test.mjs +6 -5
- 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 +6 -6
- package/tests/open-issue-wizard-static.test.mjs +2 -2
- package/tests/persistent-ui-layout-static.test.mjs +6 -6
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/session-sampling-ui-static.test.mjs +3 -3
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/stream-output-isolation-static.test.mjs +7 -0
- package/tests/stream-output-workloads.test.mjs +239 -0
- package/tests/subagent-observability-static.test.mjs +4 -2
- package/tests/subagents-helper.test.mjs +109 -0
- package/tests/syntax-highlighting-static.test.mjs +3 -3
- package/tests/terminal-cwd-grouping-static.test.mjs +22 -0
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/ui-layout-settings.test.mjs +54 -7
- package/tests/webui-settings-locking.test.mjs +3 -3
- package/webui-rpc-helper.mjs +126 -5
|
@@ -74,7 +74,7 @@ assert.match(html, /id="newTabWorktreeButton" class="terminal-new-tab-menu-item
|
|
|
74
74
|
assert.match(html, /id="closeAllTabsButton"[\s\S]*?>Close all Tabs<\/button>/, "tab header should expose a top-right close-all tabs action");
|
|
75
75
|
assert.match(html, /id="sidePanelBackdrop"/, "mobile side panel needs an overlay/backdrop close target");
|
|
76
76
|
assert.match(html, /<div class="side-panel-heading">[\s\S]*<strong class="side-panel-title">Control Deck<\/strong>[\s\S]*<div class="side-panel-version-row"[\s\S]*<button id="piVersionButton"[\s\S]*aria-controls="piReleaseNotesDialog"[\s\S]*<button id="webuiVersionButton"[\s\S]*aria-controls="webuiPackageDialog"[\s\S]*id="webuiDevBadge"/, "Control Deck header should keep its title separate from an aligned version and build row");
|
|
77
|
-
assert.match(html, /<div class="side-panel-brand-row">[\s\S]*<span class="side-panel-kicker">Pi Web UI<\/span>[\s\S]*<a class="sponsor-link" href="https:\/\/github\.com\/sponsors\/Firstp1ck" target="_blank" rel="noopener noreferrer" aria-label="Sponsor Firstp1ck on GitHub"[^>]*>♡<\/a>/, "Control Deck brand should expose a subtle, accessible sponsor link beside the Pi Web UI name");
|
|
77
|
+
assert.match(html, /<div class="side-panel-brand-row">[\s\S]*<span class="side-panel-kicker">Pi Web UI<\/span>[\s\S]*<a class="sponsor-link" data-visibility-key="control-deck\.sponsor" href="https:\/\/github\.com\/sponsors\/Firstp1ck" target="_blank" rel="noopener noreferrer" aria-label="Sponsor Firstp1ck on GitHub"[^>]*>♡<\/a>/, "Control Deck brand should expose a subtle, accessible sponsor link beside the Pi Web UI name");
|
|
78
78
|
assert.match(html, /<dialog id="piReleaseNotesDialog"[\s\S]*id="piReleaseNotesTitle"[\s\S]*id="piReleaseNotesStatus"[\s\S]*id="piReleaseNotesBody"[\s\S]*id="piReleaseNotesGithubLink"/, "Pi release notes should use a dedicated accessible dialog");
|
|
79
79
|
assert.doesNotMatch(html, /Safer option|confirmationAlternative/, "shared confirmation dialogs should not render a safer-option row");
|
|
80
80
|
assert.doesNotMatch(app, /confirmationAlternative|\balternative:\s*options\.alternative/, "confirmation logic should not populate a removed safer-option row");
|
|
@@ -111,10 +111,10 @@ assert.match(html, /id="optionsSafetyGuardSetupButton"[\s\S]*data-command="\/saf
|
|
|
111
111
|
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");
|
|
112
112
|
assert.match(app, /const NATIVE_SELECTOR_COMMANDS = new Set\(\[[^\]]*"summary"[^\]]*"summary-setup"[^\]]*"workflow-setup"[^\]]*\]\)/, "exact /summary, /summary-setup, and /workflow-setup should be browser-native selector commands");
|
|
113
113
|
assert.match(app, /function createTerminalTabSessionSummaryButton\(tab\)[\s\S]*hasAvailableCommand\("summary", \{ tabId: tab\.id \}\)[\s\S]*setAttribute\("aria-busy"[\s\S]*openSessionSummaryForTab\(tab\.id, \{ focusReturnKey:/, "each terminal tab summary action should use that tab's command catalog, busy state, focus restoration, and direct target");
|
|
114
|
-
assert.match(app, /function renderTerminalTab\(tab\)[\s\S]*createTerminalTabActions\(tab\)[\s\S]*function renderTerminalTabGroupItem\(tab, group\)[\s\S]*createTerminalTabActions\(tab\)/, "regular and grouped Pi terminal tabs should render shared per-tab split and summary actions");
|
|
114
|
+
assert.match(app, /function renderTerminalTab\(tab, \{ showCwdAdd = false \} = \{\}\)[\s\S]*createTerminalTabActions\(tab\)[\s\S]*function renderTerminalTabGroupItem\(tab, group\)[\s\S]*createTerminalTabActions\(tab\)/, "regular and grouped Pi terminal tabs should render shared per-tab split and summary actions");
|
|
115
115
|
assert.match(app, /function createTerminalTabActions\(tab\)[\s\S]*createTerminalTabSplitButton\(tab\)[\s\S]*createTerminalTabSessionSummaryButton\(tab\)/, "each terminal action slot should place Split beside Summary");
|
|
116
116
|
assert.match(app, /function terminalTabControlKey\(node\)[\s\S]*terminal-tab-split-button[\s\S]*terminal-tab:\$\{tabId\}:split[\s\S]*terminal-tab-summary-button[\s\S]*terminal-tab:\$\{tabId\}:summary/, "per-tab split and summary actions should retain stable focus continuity keys");
|
|
117
|
-
assert.match(app, /\.terminal-tab-close, \.terminal-tab-actions, \.terminal-tab-group-add/, "per-tab actions should not initiate terminal-tab dragging");
|
|
117
|
+
assert.match(app, /\.terminal-tab-close, \.terminal-tab-actions, \.terminal-tab-cwd-add, \.terminal-tab-group-add/, "per-tab actions should not initiate terminal-tab dragging");
|
|
118
118
|
assert.match(app, /function prefetchInactiveTabCommandCatalogs\(\)[\s\S]*refreshCommands\(activeTabContext\(tab\.id\)\)[\s\S]*function refreshTabs[\s\S]*prefetchInactiveTabCommandCatalogs\(\)/, "restored inactive tabs should fetch their own command catalogs without activation");
|
|
119
119
|
assert.match(app, /const focusReturnKey = sessionSummaryOverlayFocusReturnKey[\s\S]*querySelectorAll\("button"\)[\s\S]*terminalTabControlKey\(node\) === focusReturnKey/, "summary overlay focus restoration should resolve rerendered per-tab controls by continuity key");
|
|
120
120
|
assert.match(app, /sessionSummaryOverlayFocusReturnKey = focusReturnKey \|\| terminalTabControlKey\(sessionSummaryOverlayFocusReturn\)/, "summary overlay opening should preserve an explicit per-tab focus key or capture the active control key");
|
|
@@ -332,7 +332,7 @@ assert.match(app, /attachmentTextDialog\?\.addEventListener\("keydown"[\s\S]*eve
|
|
|
332
332
|
assert.match(css, /\.attachment-text-dialog[\s\S]*\.attachment-text-editor/, "text attachment editor should have dedicated dialog styling");
|
|
333
333
|
assert.match(html, /id="composerActionsButton"/, "mobile composer should expose a compact actions trigger");
|
|
334
334
|
assert.match(html, /id="composerActionsPanel"/, "secondary composer controls should live in a mobile actions panel");
|
|
335
|
-
assert.match(html, /<div class="composer-row">[\s\S]*id="abortButton"[\s\S]*id="btwButton"[\s\S]*id="sendButton"/, "Abort and /btw should live in the bottom composer row beside Send");
|
|
335
|
+
assert.match(html, /<div class="composer-row" data-visibility-region="composer">[\s\S]*id="abortButton"[\s\S]*id="btwButton"[\s\S]*id="sendButton"/, "Abort and /btw should live in the bottom composer row beside Send");
|
|
336
336
|
assert.match(html, /id="btwButton"[\s\S]*class="composer-icon-button composer-btw-button"[\s\S]*?<svg class="composer-icon"/, "composer should expose an icon-only /btw side-question button");
|
|
337
337
|
assert.doesNotMatch(html, /id="btwButton"[\s\S]*?<span>\/btw<\/span>[\s\S]*?id="sendButton"/, "/btw composer button should not show a text label");
|
|
338
338
|
assert.match(html, /id="abortButton"[^>]*Hold Esc or the Abort button for 3 seconds/, "Abort should advertise guarded Esc and long-press affordances");
|
|
@@ -363,7 +363,7 @@ assert.match(html, /id="conversationModeChip" class="composer-conversation-mode-
|
|
|
363
363
|
const workflowModeButtonHtml = html.match(/<button\s+id="workflowModeButton"[\s\S]*?<\/button>/)?.[0] || "";
|
|
364
364
|
const workflowOverlayOpenButtonHtml = html.match(/<button\s+id="workflowOverlayOpenButton"[\s\S]*?<\/button>/)?.[0] || "";
|
|
365
365
|
const optionsMenuHtml = html.match(/<div id="optionsMenu"[\s\S]*?<\/div>/)?.[0] || "";
|
|
366
|
-
assert.match(html, /id="commandSuggest"[\s\S]*?<div class="composer-input-row">\s*<div id="workflowModeControls" class="composer-workflow-mode-dock" role="group" aria-label="Workflow Mode controls"[\s\S]*id="workflowOverlayOpenButton"[\s\S]*aria-controls="widgetArea"[\s\S]*id="workflowModeButton"[\s\S]*?<\/div>\s*<div class="composer-context-tags">/, "Workflow Mode should remain directly accessible as an isolated icon-only overlay inside the prompt frame");
|
|
366
|
+
assert.match(html, /id="commandSuggest"[\s\S]*?<div class="composer-input-row" data-visibility-region="inputframe">\s*<div id="workflowModeControls" class="composer-workflow-mode-dock" role="group" aria-label="Workflow Mode controls" data-visibility-key="input\.workflow"[\s\S]*id="workflowOverlayOpenButton"[\s\S]*aria-controls="widgetArea"[\s\S]*id="workflowModeButton"[\s\S]*?<\/div>\s*<div class="composer-context-tags">/, "Workflow Mode should remain directly accessible as an isolated icon-only overlay inside the prompt frame");
|
|
367
367
|
assert.doesNotMatch(html, /composer-workflow-mode-dock-label|>Workflow mode<\/span>/, "Workflow Mode dock should not render visible text beside the icon");
|
|
368
368
|
assert.doesNotMatch(optionsMenuHtml, /id="workflowModeButton"|Workflow Mode/, "Options menu should not duplicate or hide the directly accessible Workflow Mode control");
|
|
369
369
|
assert.doesNotMatch(workflowOverlayOpenButtonHtml, /\stitle=/, "Workflow overlay restore should not combine a browser-native tooltip with its styled tooltip");
|
|
@@ -2181,7 +2181,7 @@ assert.match(app, /const totalTabCount = tabs\.length \+ subagentTerminalViews\.
|
|
|
2181
2181
|
assert.match(app, /appendTerminalTabContent\(button, \{ title: activeTitle,[\s\S]*?count: groupTabs\.length,[^}]*\}\)/, "group buttons should show the active terminal name instead of only the cwd label");
|
|
2182
2182
|
assert.match(app, /wrapper\.addEventListener\("pointerenter", \(\) => setOpenTerminalTabGroup\(group\.key\)\)/, "terminal tab groups should mark themselves open while hovered");
|
|
2183
2183
|
assert.match(app, /if \(openTerminalTabGroupKey\) \{\n\s+scheduleRefreshTabs\(600\);/, "tab polling should defer full tab refreshes while a group menu is open");
|
|
2184
|
-
assert.match(app, /function shouldRenderTerminalTabGroup\(group, groupCount\) \{\n\s+if \(group\.custom\) return group\.tabs\.length > 1;\n\s+return groupCount > 1 && group\.tabs\.length > 1 && Boolean\(group\.cwd\);\n\}/, "terminal tabs should always render custom groups while only collapsing cwd groups when multiple groups are available");
|
|
2184
|
+
assert.match(app, /function shouldRenderTerminalTabGroup\(group, groupCount\) \{\n\s+if \(group\.custom\) return group\.tabs\.length > 1;\n\s+return groupCount > 1 && group\.tabs\.length > 1 && Boolean\(group\.cwd\);\n\}/, "terminal tabs should always render custom groups while only collapsing multi-tab cwd groups when multiple groups are available");
|
|
2185
2185
|
assert.match(app, /TERMINAL_CUSTOM_GROUPS_STORAGE_KEY/, "frontend should persist custom terminal tab groups in browser storage");
|
|
2186
2186
|
assert.match(app, /function bindTerminalTabDragAndDrop\(/, "terminal tabs should bind drag-and-drop grouping behavior");
|
|
2187
2187
|
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");
|
|
@@ -46,7 +46,7 @@ assert.doesNotMatch(botClient, /OPENAI_API_KEY|GITHUB_APP_|PRIVATE_KEY/, "the br
|
|
|
46
46
|
|
|
47
47
|
assert.match(html, /__PI_WEBUI_ISSUE_BOT_CONFIG__[\s\S]*?enabled: false/, "the page must expose only disabled-by-default public runtime configuration");
|
|
48
48
|
assert.match(html, /id="openIssueButton"[\s\S]*?aria-controls="issueWizardDialog"/, "the persistent Control Deck action must target the dialog");
|
|
49
|
-
assert.match(html, /<footer class="side-panel-footer" data-control-deck-shared-footer>[\s\S]*?id="openIssueButton"/, "the singleton action must stay outside scrolling Control Deck content while rehosting with the active shell");
|
|
49
|
+
assert.match(html, /<footer class="side-panel-footer" data-control-deck-shared-footer data-visibility-region="control-deck">[\s\S]*?id="openIssueButton"/, "the singleton action must stay outside scrolling Control Deck content while rehosting with the active shell");
|
|
50
50
|
assert.match(html, /<dialog id="issueWizardDialog"[\s\S]*?aria-labelledby="issueWizardTitle"[\s\S]*?aria-describedby="issueWizardDescription"/, "the dialog must have an accessible name and description");
|
|
51
51
|
for (const step of [1, 2, 3, 4, 5]) assert.match(html, new RegExp(`data-issue-wizard-page="${step}"`), `step ${step} markup must exist`);
|
|
52
52
|
assert.match(html, /id="issueWizardStatus"[^>]*role="status"[^>]*aria-live="polite"/, "wizard progress must retain its accessible live region");
|
|
@@ -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-v115/, "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
|
|
|
@@ -14,12 +14,12 @@ const [html, app, serviceWorker] = await Promise.all([
|
|
|
14
14
|
|
|
15
15
|
assert.match(
|
|
16
16
|
app,
|
|
17
|
-
/const UI_LAYOUT_SCHEMA_VERSION =
|
|
18
|
-
"the browser controller should target the accepted version-
|
|
17
|
+
/const UI_LAYOUT_SCHEMA_VERSION = 3;[\s\S]*const UI_LAYOUT_ENDPOINT = "\/api\/interface-preferences";/,
|
|
18
|
+
"the browser controller should target the accepted version-3 layout schema on the existing interface-preferences endpoint",
|
|
19
19
|
);
|
|
20
20
|
assert.match(
|
|
21
21
|
app,
|
|
22
|
-
/const UI_LAYOUT_FIELDS = \["sidePanel", "composerActions", "footerScopedModelOrder", "terminalTabs", "fileViewerWidth"\];/,
|
|
22
|
+
/const UI_LAYOUT_FIELDS = \["sidePanel", "composerActions", "controlVisibility", "footerScopedModelOrder", "terminalTabs", "fileViewerWidth"\];/,
|
|
23
23
|
"every approved arrangement surface should be a durable layout field",
|
|
24
24
|
);
|
|
25
25
|
assert.match(
|
|
@@ -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-v115"/, "changed browser assets should advance the PWA cache identity");
|
|
275
|
+
assert.match(html, /styles\.css\?v=129/, "the page should request the updated layout stylesheet revision");
|
|
276
|
+
assert.match(html, /data-app-src="\/app\.js\?v=150"/, "the boot loader should request the updated app module revision");
|
|
277
277
|
|
|
278
278
|
console.log("persistent-ui-layout-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=129/, "questionnaire CSS needs the current stylesheet revision");
|
|
508
|
+
assert.match(html, /app\.js\?v=150/, "questionnaire behavior needs the current app revision");
|
|
509
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v115"/, "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-v115"/, "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=129/, "the changed stylesheet should have a new revision");
|
|
63
|
+
assert.match(html, /app\.js\?v=150/, "the changed app module should have a new revision");
|
|
64
64
|
|
|
65
65
|
// --- Browser state behavior -------------------------------------------------
|
|
66
66
|
|
|
@@ -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=129/, "removing section resize styles should advance the stylesheet revision");
|
|
31
|
+
assert.match(html, /app\.js\?v=150/, "removing section resize behavior should advance the app revision");
|
|
32
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v115"/, "removing browser assets should advance the PWA cache identity");
|
|
33
33
|
|
|
34
34
|
console.log("side-panel-section-height-removal-static.test.mjs passed");
|
|
@@ -85,5 +85,12 @@ assert.doesNotMatch(app, /function scheduleStreamingAssistantTextRender|function
|
|
|
85
85
|
assert.match(app, /onUnknownStreamEvent: preserveUnknownTranscriptEvidence/, "unknown transcript-shaped events should retain transcript-only evidence");
|
|
86
86
|
assert.match(app, /reconcileUnknownTranscriptEvidenceAtBarrier\(event\)/, "unknown evidence should request authoritative reconciliation only at a semantic barrier");
|
|
87
87
|
assert.match(app, /streamIsolationDebug[\s\S]*?__piStreamIsolationDebug/, "the opt-in test diagnostic ledger should be exposed only behind the explicit debug flag");
|
|
88
|
+
assert.match(controller, /receivedAt: diagnosticsEnabled \? now\(\) : undefined/, "receipt timing must be disabled with diagnostics");
|
|
89
|
+
assert.match(controller, /maxAgeMs[\s\S]*?drainMs/, "diagnostic batches should report queue age and drain duration");
|
|
90
|
+
assert.match(app, /version: 2,[\s\S]*?batchPaintMaxMs[\s\S]*?transcriptNodeMax[\s\S]*?currentMessageNodeMax/, "ledger v2 should expose paint and DOM-node high-water counters");
|
|
91
|
+
assert.match(app, /function scheduleStreamPaintDiagnostic[\s\S]*?requestAnimationFrame[\s\S]*?type: "paint-opportunity"/, "paint opportunity timing should run only from the opt-in diagnostic path");
|
|
92
|
+
assert.match(app, /function streamDiagnosticBytes[\s\S]*?length \* 2/, "stream byte metrics should use conservative UTF-16 accounting");
|
|
93
|
+
assert.match(app, /new PerformanceObserver[\s\S]*?type: "longtask"[\s\S]*?type: "long-animation-frame"/, "supported long-task and long-frame entries should feed the ledger");
|
|
94
|
+
assert.match(app, /type: "markdown-commit"[\s\S]*?tailBytes[\s\S]*?tailKind/, "mutable Markdown tail diagnostics should include size and block kind");
|
|
88
95
|
|
|
89
96
|
console.log("stream-output-isolation-static.test.mjs passed");
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_STREAM_PENDING_BYTE_LIMIT,
|
|
4
|
+
DEFAULT_STREAM_PENDING_ENTRY_LIMIT,
|
|
5
|
+
createStreamOutputController,
|
|
6
|
+
} from "../public/stream-output-controller.mjs";
|
|
7
|
+
import {
|
|
8
|
+
concatenatedDeltaText,
|
|
9
|
+
longParagraphDeltaEvents,
|
|
10
|
+
messageUpdateEvent,
|
|
11
|
+
mixedSemanticBurstEvents,
|
|
12
|
+
openFenceDeltaEvents,
|
|
13
|
+
overflowBurstEvents,
|
|
14
|
+
smallTextDeltaEvents,
|
|
15
|
+
thinkingStreamEvents,
|
|
16
|
+
} from "./fixtures/streaming-workloads.mjs";
|
|
17
|
+
|
|
18
|
+
class FakeFrames {
|
|
19
|
+
next = 1;
|
|
20
|
+
callbacks = new Map();
|
|
21
|
+
|
|
22
|
+
schedule = (callback) => {
|
|
23
|
+
const handle = this.next++;
|
|
24
|
+
this.callbacks.set(handle, callback);
|
|
25
|
+
return handle;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
cancel = (handle) => {
|
|
29
|
+
this.callbacks.delete(handle);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
runAll() {
|
|
33
|
+
while (this.callbacks.size) {
|
|
34
|
+
const [handle, callback] = this.callbacks.entries().next().value;
|
|
35
|
+
this.callbacks.delete(handle);
|
|
36
|
+
callback();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function harness({ diagnostics = true, nowStepMs = 1 } = {}) {
|
|
42
|
+
const frames = new FakeFrames();
|
|
43
|
+
const records = [];
|
|
44
|
+
const applied = { text: "", thinking: "", toolCall: "", toolExecution: [], errors: 0, order: [] };
|
|
45
|
+
let clock = 0;
|
|
46
|
+
let nowCalls = 0;
|
|
47
|
+
const controller = createStreamOutputController({
|
|
48
|
+
scheduleFrame: frames.schedule,
|
|
49
|
+
cancelFrame: frames.cancel,
|
|
50
|
+
now: () => {
|
|
51
|
+
nowCalls += 1;
|
|
52
|
+
clock += nowStepMs;
|
|
53
|
+
return clock;
|
|
54
|
+
},
|
|
55
|
+
applyTextUpdate: (event) => {
|
|
56
|
+
applied.text += event.assistantMessageEvent.delta || "";
|
|
57
|
+
applied.order.push(`text:${event.assistantMessageEvent.type}`);
|
|
58
|
+
},
|
|
59
|
+
applyThinkingUpdate: (event) => {
|
|
60
|
+
applied.thinking += event.assistantMessageEvent.delta || "";
|
|
61
|
+
applied.order.push(`thinking:${event.assistantMessageEvent.type}`);
|
|
62
|
+
},
|
|
63
|
+
applyToolCallUpdate: (event) => {
|
|
64
|
+
applied.toolCall += event.assistantMessageEvent.delta || "";
|
|
65
|
+
applied.order.push(`tool-call:${event.assistantMessageEvent.type}`);
|
|
66
|
+
},
|
|
67
|
+
applyToolExecutionUpdate: (event) => {
|
|
68
|
+
applied.toolExecution.push(event.partialResult?.content || "");
|
|
69
|
+
applied.order.push("tool-execution");
|
|
70
|
+
},
|
|
71
|
+
applyStreamError: () => {
|
|
72
|
+
applied.errors += 1;
|
|
73
|
+
applied.order.push("stream-error");
|
|
74
|
+
},
|
|
75
|
+
onDiagnostic: diagnostics ? (record) => records.push(record) : undefined,
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
frames,
|
|
79
|
+
records,
|
|
80
|
+
applied,
|
|
81
|
+
controller,
|
|
82
|
+
nowCallCount: () => nowCalls,
|
|
83
|
+
dispatchAll(events) {
|
|
84
|
+
for (const event of events) controller.dispatch(event);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 1) Small-delta burst: lossless coalescing collapses transport events into few batches.
|
|
90
|
+
{
|
|
91
|
+
const run = harness();
|
|
92
|
+
const events = smallTextDeltaEvents(1000);
|
|
93
|
+
run.dispatchAll(events);
|
|
94
|
+
run.frames.runAll();
|
|
95
|
+
assert.equal(run.applied.text, concatenatedDeltaText(events), "coalesced text must equal exact concatenation");
|
|
96
|
+
const batches = run.records.filter((record) => record.type === "batch");
|
|
97
|
+
const receipts = run.records.filter((record) => record.type === "receipt");
|
|
98
|
+
assert.equal(receipts.length, 1000, "every transport event must be received");
|
|
99
|
+
assert.ok(batches.length <= 5, `render batches (${batches.length}) must stay far below transport events`);
|
|
100
|
+
const totalSources = batches.reduce((total, batch) => total + batch.sourceCount, 0);
|
|
101
|
+
assert.equal(totalSources, 1000, "batch sourceCounts must account for every source event");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 2) Long unbroken paragraph (1 MB): byte-limit overflow drains stay lossless and bounded.
|
|
105
|
+
{
|
|
106
|
+
const run = harness();
|
|
107
|
+
const events = longParagraphDeltaEvents(1024 * 1024, 512);
|
|
108
|
+
run.dispatchAll(events);
|
|
109
|
+
run.frames.runAll();
|
|
110
|
+
run.controller.flush();
|
|
111
|
+
assert.equal(run.applied.text.length, 1024 * 1024, "no paragraph bytes may be lost");
|
|
112
|
+
assert.equal(run.applied.text, concatenatedDeltaText(events), "paragraph must survive overflow drains byte-for-byte");
|
|
113
|
+
const overflow = run.records.filter((record) => record.type === "overflow");
|
|
114
|
+
assert.ok(overflow.length > 0, "1 MB through a 256 KB queue must report overflow");
|
|
115
|
+
for (const record of run.records.filter((entry) => entry.type === "queued")) {
|
|
116
|
+
assert.ok(record.pendingBytes <= DEFAULT_STREAM_PENDING_BYTE_LIMIT, "pending bytes must never exceed the configured bound");
|
|
117
|
+
assert.ok(record.pendingCount <= DEFAULT_STREAM_PENDING_ENTRY_LIMIT, "pending entries must never exceed the configured bound");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// 3) Open code fences: under-limit and over-limit fixtures both stream losslessly.
|
|
122
|
+
for (const codeBytes of [40 * 1024, 100 * 1024]) {
|
|
123
|
+
const run = harness();
|
|
124
|
+
const events = openFenceDeltaEvents(codeBytes);
|
|
125
|
+
run.dispatchAll(events);
|
|
126
|
+
run.frames.runAll();
|
|
127
|
+
run.controller.flush();
|
|
128
|
+
const expected = concatenatedDeltaText(events);
|
|
129
|
+
assert.equal(run.applied.text, expected, `open fence (${codeBytes} bytes) must stream losslessly`);
|
|
130
|
+
assert.ok(expected.startsWith("```js\n"), "fixture must open a fence");
|
|
131
|
+
assert.ok(!/```\s*$/.test(expected), "fixture fence must remain open");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 4) Thinking stream: start/end barriers flush synchronously and text is exact.
|
|
135
|
+
{
|
|
136
|
+
const run = harness();
|
|
137
|
+
const events = thinkingStreamEvents(500);
|
|
138
|
+
run.dispatchAll(events);
|
|
139
|
+
assert.equal(run.controller.pendingCount(), 0, "thinking_end barrier must leave nothing queued");
|
|
140
|
+
assert.equal(run.applied.thinking, concatenatedDeltaText(events, "thinking_delta"), "thinking text must be exact");
|
|
141
|
+
const barriers = run.records.filter((record) => record.type === "barrier");
|
|
142
|
+
assert.ok(barriers.length >= 1, "the thinking_end barrier flush must be diagnosed");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 5) Mixed semantic burst: cross-kind order is preserved exactly.
|
|
146
|
+
{
|
|
147
|
+
const run = harness();
|
|
148
|
+
run.dispatchAll(mixedSemanticBurstEvents());
|
|
149
|
+
run.frames.runAll();
|
|
150
|
+
run.controller.flush();
|
|
151
|
+
assert.deepEqual(run.applied.order, [
|
|
152
|
+
"thinking:thinking_start",
|
|
153
|
+
"thinking:thinking_delta",
|
|
154
|
+
"thinking:thinking_end",
|
|
155
|
+
"text:text_start",
|
|
156
|
+
"text:text_delta",
|
|
157
|
+
"tool-call:toolcall_start",
|
|
158
|
+
"tool-call:toolcall_delta",
|
|
159
|
+
"tool-call:toolcall_end",
|
|
160
|
+
"tool-execution",
|
|
161
|
+
"text:text_delta",
|
|
162
|
+
"stream-error",
|
|
163
|
+
"text:text_end",
|
|
164
|
+
], "semantic order must match server order with only adjacent same-kind coalescing");
|
|
165
|
+
assert.equal(run.applied.thinking, "planning steps");
|
|
166
|
+
assert.equal(run.applied.text, "Running the command now. Done.");
|
|
167
|
+
assert.equal(run.applied.toolCall, '{"cmd":"ls"}');
|
|
168
|
+
assert.deepEqual(run.applied.toolExecution, ["file-a\nfile-b\n"], "superseding partial tool results must coalesce to the latest");
|
|
169
|
+
assert.equal(run.applied.errors, 1);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// 6) Overflow burst: alternating kinds defeat coalescing, hit the entry limit, stay ordered.
|
|
173
|
+
{
|
|
174
|
+
const run = harness();
|
|
175
|
+
const events = overflowBurstEvents({ pairs: 200 });
|
|
176
|
+
run.dispatchAll(events);
|
|
177
|
+
run.frames.runAll();
|
|
178
|
+
run.controller.flush();
|
|
179
|
+
assert.equal(run.applied.text, concatenatedDeltaText(events, "text_delta"));
|
|
180
|
+
assert.equal(run.applied.thinking, concatenatedDeltaText(events, "thinking_delta"));
|
|
181
|
+
const entryOverflows = run.records.filter((record) => record.type === "overflow" && record.reason === "entry-limit");
|
|
182
|
+
assert.ok(entryOverflows.length > 0, "400 non-coalescible events must hit the 128-entry limit");
|
|
183
|
+
for (const record of run.records.filter((entry) => entry.type === "queued")) {
|
|
184
|
+
assert.ok(record.pendingCount <= DEFAULT_STREAM_PENDING_ENTRY_LIMIT);
|
|
185
|
+
}
|
|
186
|
+
// Alternation must be preserved within each flushed window: text i before thinking i.
|
|
187
|
+
const textIndex = run.applied.order.filter((kind) => kind.startsWith("text") || kind.startsWith("thinking"));
|
|
188
|
+
assert.equal(textIndex[0], "text:text_delta", "first applied event must be the first dispatched kind");
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// 7) Batch latency and drain duration are measured with the injected clock.
|
|
192
|
+
{
|
|
193
|
+
const run = harness({ nowStepMs: 5 });
|
|
194
|
+
run.controller.dispatch(messageUpdateEvent("text_delta", "a"));
|
|
195
|
+
run.controller.dispatch(messageUpdateEvent("text_delta", "b"));
|
|
196
|
+
run.frames.runAll();
|
|
197
|
+
const batch = run.records.find((record) => record.type === "batch");
|
|
198
|
+
assert.ok(batch, "a batch record must exist");
|
|
199
|
+
assert.equal(typeof batch.maxAgeMs, "number", "batch latency must be reported");
|
|
200
|
+
assert.equal(typeof batch.drainMs, "number", "drain duration must be reported");
|
|
201
|
+
assert.ok(batch.maxAgeMs > 0, "coalesced batches must report the oldest entry's age");
|
|
202
|
+
assert.ok(batch.drainMs > 0, "drain duration must be measured across application");
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// 8) Coalesced entries keep the oldest receipt time so latency is not hidden by merging.
|
|
206
|
+
{
|
|
207
|
+
const run = harness({ nowStepMs: 10 });
|
|
208
|
+
run.controller.dispatch(messageUpdateEvent("text_delta", "first"));
|
|
209
|
+
run.controller.dispatch(messageUpdateEvent("text_delta", "second"));
|
|
210
|
+
run.controller.dispatch(messageUpdateEvent("text_delta", "third"));
|
|
211
|
+
run.frames.runAll();
|
|
212
|
+
const batch = run.records.find((record) => record.type === "batch");
|
|
213
|
+
// Clock: dispatch receipts at 10, 20, 30; drain start at 40 → oldest age 30.
|
|
214
|
+
assert.equal(batch.maxAgeMs, 30, "merged entry must retain the first source's receipt time");
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// 9) Disabled diagnostics never touch the clock: the hot path is measurement-free.
|
|
218
|
+
{
|
|
219
|
+
const run = harness({ diagnostics: false });
|
|
220
|
+
run.dispatchAll(smallTextDeltaEvents(100));
|
|
221
|
+
run.frames.runAll();
|
|
222
|
+
run.controller.flush();
|
|
223
|
+
assert.equal(run.nowCallCount(), 0, "the disabled hot path must never call now()");
|
|
224
|
+
assert.equal(run.applied.text, concatenatedDeltaText(smallTextDeltaEvents(100)));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// 10) Oversize direct application also reports latency fields.
|
|
228
|
+
{
|
|
229
|
+
const run = harness({ nowStepMs: 2 });
|
|
230
|
+
const oversize = messageUpdateEvent("text_delta", "x".repeat(DEFAULT_STREAM_PENDING_BYTE_LIMIT));
|
|
231
|
+
run.controller.dispatch(oversize);
|
|
232
|
+
const direct = run.records.find((record) => record.type === "batch" && record.direct === true);
|
|
233
|
+
assert.ok(direct, "an oversize event must be applied directly");
|
|
234
|
+
assert.equal(typeof direct.maxAgeMs, "number");
|
|
235
|
+
assert.equal(typeof direct.drainMs, "number");
|
|
236
|
+
assert.equal(run.applied.text.length, DEFAULT_STREAM_PENDING_BYTE_LIMIT, "oversize events are applied, never dropped");
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
console.log("stream-output-workloads tests passed");
|
|
@@ -24,9 +24,11 @@ assert.match(app, /subagentRunCanRefresh[\s\S]*subagentRunCanCancel[\s\S]*subage
|
|
|
24
24
|
assert.match(app, /function subagentRunIsAttachedProjection[\s\S]*source === "explicit-attach"[\s\S]*function subagentRunCanDismiss[\s\S]*provider === "webui-registry"/, "terminal registry rows should clear while stale explicit attaches remain manually detachable");
|
|
25
25
|
assert.match(app, /function finishedSubagentRunSelections[\s\S]*subagentRunIsTerminal\(run\) && subagentRunCanDismiss\(run\)/, "Auto-Clear should not immediately remove stale attached sessions");
|
|
26
26
|
assert.match(app, /agent\.unavailableReason[\s\S]*Output is unavailable for this registered agent/, "output views should show truthful unavailable evidence");
|
|
27
|
+
assert.match(app, /const SUBAGENT_ASYNC_WIDGET_KEY = "subagent-async"[\s\S]*case "setWidget":[\s\S]*widgetKey === SUBAGENT_ASYNC_WIDGET_KEY[\s\S]*widgetLines: undefined[\s\S]*return;/, "native async-status widget updates should be discarded before reaching the generic main-output renderer");
|
|
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");
|
|
27
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");
|
|
28
30
|
assert.match(html, /Managed and registered Pi agent runs[\s\S]*External agents/, "help should explain managed, registered, and external groups");
|
|
29
|
-
assert.match(html, /styles\.css\?v=
|
|
30
|
-
assert.match(worker, /pi-webui-pwa-
|
|
31
|
+
assert.match(html, /styles\.css\?v=129[\s\S]*app\.js\?v=150/, "browser assets should use the current subagent-observability revisions");
|
|
32
|
+
assert.match(worker, /pi-webui-pwa-v115/, "PWA cache identity should advance with subagent widget suppression");
|
|
31
33
|
|
|
32
34
|
console.log("subagent-observability-static.test.mjs passed");
|
|
@@ -406,6 +406,115 @@ assert.ok(payload.runs.some((run) => run.id === workflowRunId), "pi-subagents po
|
|
|
406
406
|
|
|
407
407
|
const helperCommand = registeredCommands.get("webui-helper");
|
|
408
408
|
assert.ok(helperCommand?.handler, "Web UI helper command should be registered");
|
|
409
|
+
|
|
410
|
+
const warmingWorkflowRunId = "workflow-warming-up";
|
|
411
|
+
const warmingWorkflowDir = await mkdtemp(path.join(asyncRunDir, "workflow-warmup-"));
|
|
412
|
+
const warmingWorkflowSessionFile = path.join(warmingWorkflowDir, "worker-session.jsonl");
|
|
413
|
+
const warmingWorkflowStartedAt = Date.now() - 500;
|
|
414
|
+
await writeFile(path.join(warmingWorkflowDir, "status.json"), JSON.stringify({
|
|
415
|
+
runId: warmingWorkflowRunId,
|
|
416
|
+
mode: "workflow",
|
|
417
|
+
state: "running",
|
|
418
|
+
startedAt: warmingWorkflowStartedAt,
|
|
419
|
+
lastUpdate: Date.now(),
|
|
420
|
+
steps: [],
|
|
421
|
+
}));
|
|
422
|
+
bus.emit("subagent:async-started", {
|
|
423
|
+
id: warmingWorkflowRunId,
|
|
424
|
+
mode: "workflow",
|
|
425
|
+
asyncDir: warmingWorkflowDir,
|
|
426
|
+
workflowGraph: { nodes: [] },
|
|
427
|
+
});
|
|
428
|
+
const warmingWorkflowFleet = {
|
|
429
|
+
version: 1,
|
|
430
|
+
entries: [
|
|
431
|
+
{ key: "fleet-reviewer-1", agent: "reviewer", startedAt: fleetStartedAt, tokens: { input: 0, output: 0, total: 0 } },
|
|
432
|
+
{ key: "fleet-reviewer-2", agent: "reviewer", startedAt: fleetStartedAt + 1, tokens: { input: 0, output: 0, total: 0 } },
|
|
433
|
+
{ key: "fleet-worker", agent: "worker", startedAt: fleetStartedAt + 2, tokens: { input: 0, output: 0, total: 0 } },
|
|
434
|
+
{ key: "fleet-nested", agent: "nested-oracle", startedAt: fleetStartedAt + 3, tokens: { input: 0, output: 0, total: 0 } },
|
|
435
|
+
{ key: "fleet-recovered", agent: "scout", role: "Recovery scout", model: "openai-codex/gpt-5.6-terra:xhigh", effort: "xhigh", startedAt: fleetStartedAt + 4, tokens: { input: 0, output: 0, total: 0 } },
|
|
436
|
+
{ key: "fleet-warming-workflow", agent: "workflow", startedAt: warmingWorkflowStartedAt, tokens: { input: 0, output: 0, total: 0 } },
|
|
437
|
+
{ key: "fleet-warming-worker", agent: "worker", model: "openai-codex/gpt-5.6-sol", effort: "high", startedAt: warmingWorkflowStartedAt + 1, tokens: { input: 0, output: 0, total: 0 } },
|
|
438
|
+
],
|
|
439
|
+
totalActive: 7,
|
|
440
|
+
omitted: 0,
|
|
441
|
+
};
|
|
442
|
+
const pollWarmingWorkflow = async (text, asyncSnapshot) => {
|
|
443
|
+
subagentRpcReplyHook = (request) => {
|
|
444
|
+
if (request.method !== "status" || Object.keys(request.params || {}).length) return false;
|
|
445
|
+
subagentRpcReplyHook = null;
|
|
446
|
+
bus.emit(`subagents:rpc:v1:reply:${request.requestId}`, {
|
|
447
|
+
version: 1,
|
|
448
|
+
requestId: request.requestId,
|
|
449
|
+
method: request.method,
|
|
450
|
+
success: true,
|
|
451
|
+
data: { text, details: { mode: "single", results: [] }, fleet: warmingWorkflowFleet, ...(asyncSnapshot ? { asyncSnapshot } : {}) },
|
|
452
|
+
});
|
|
453
|
+
return true;
|
|
454
|
+
};
|
|
455
|
+
bus.emit("subagents:rpc:v1:ready", { version: 1 });
|
|
456
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
457
|
+
};
|
|
458
|
+
const warmingHeaderOnlyStatus = `Active async runs: 1
|
|
459
|
+
|
|
460
|
+
- ${warmingWorkflowRunId} | running | active | workflow | steps 0 | ~/repo`;
|
|
461
|
+
await pollWarmingWorkflow(warmingHeaderOnlyStatus);
|
|
462
|
+
await pollWarmingWorkflow(warmingHeaderOnlyStatus);
|
|
463
|
+
payload = latestPayload();
|
|
464
|
+
assert.equal(payload.runs.some((run) => run.id === "fleet:fleet-warming-workflow"), false, "a known workflow controller must not become an empty recovered Workflow row while its first child locator is pending");
|
|
465
|
+
await writeFile(warmingWorkflowSessionFile, `${JSON.stringify({
|
|
466
|
+
type: "message",
|
|
467
|
+
timestamp: "2026-07-26T12:00:10.000Z",
|
|
468
|
+
message: { role: "assistant", content: [{ type: "text", text: "Workflow worker output is live." }] },
|
|
469
|
+
})}\n`);
|
|
470
|
+
await writeFile(path.join(warmingWorkflowDir, "status.json"), JSON.stringify({
|
|
471
|
+
runId: warmingWorkflowRunId,
|
|
472
|
+
mode: "workflow",
|
|
473
|
+
state: "running",
|
|
474
|
+
startedAt: warmingWorkflowStartedAt,
|
|
475
|
+
lastUpdate: Date.now(),
|
|
476
|
+
steps: [{ agent: "worker", status: "running", sessionFile: warmingWorkflowSessionFile, model: "openai-codex/gpt-5.6-sol", thinking: "high" }],
|
|
477
|
+
}));
|
|
478
|
+
await pollWarmingWorkflow("No active async runs.", {
|
|
479
|
+
kind: "pi-subagents.async-status-snapshot",
|
|
480
|
+
version: 1,
|
|
481
|
+
generatedAt: Date.now(),
|
|
482
|
+
runs: [{
|
|
483
|
+
id: warmingWorkflowRunId,
|
|
484
|
+
kind: "workflow",
|
|
485
|
+
label: "workflow",
|
|
486
|
+
state: "running",
|
|
487
|
+
startedAt: warmingWorkflowStartedAt,
|
|
488
|
+
updatedAt: Date.now(),
|
|
489
|
+
children: [{ id: "ws1-input-backend", kind: "step", label: "ws1-input-backend", state: "running" }],
|
|
490
|
+
}],
|
|
491
|
+
});
|
|
492
|
+
payload = latestPayload();
|
|
493
|
+
const warmingWorkflowRun = payload.runs.find((run) => run.id === warmingWorkflowRunId);
|
|
494
|
+
assert.deepEqual(warmingWorkflowRun && {
|
|
495
|
+
source: warmingWorkflowRun.source,
|
|
496
|
+
status: warmingWorkflowRun.status,
|
|
497
|
+
agents: warmingWorkflowRun.agents.map((agent) => [agent.name, agent.model, agent.thinking]),
|
|
498
|
+
}, {
|
|
499
|
+
source: "async",
|
|
500
|
+
status: "running",
|
|
501
|
+
agents: [["worker", "openai-codex/gpt-5.6-sol", "high"]],
|
|
502
|
+
}, "an active workflow header must keep the run alive until its first worker locator appears");
|
|
503
|
+
assert.equal(payload.runs.some((run) => run.id === "fleet:fleet-warming-worker"), false, "the real workflow worker must replace its temporary fleet placeholder");
|
|
504
|
+
const warmingWorkflowCanonical = latestCanonicalPayload().instances.find((instance) => instance.runId === warmingWorkflowRunId && instance.name === "worker");
|
|
505
|
+
assert.ok(warmingWorkflowCanonical, "the resolved workflow worker should publish a canonical output handle");
|
|
506
|
+
await helperCommand.handler(JSON.stringify({
|
|
507
|
+
requestId: "warming-workflow-live-output-test",
|
|
508
|
+
action: "subagent-output",
|
|
509
|
+
payload: { outputId: warmingWorkflowCanonical.outputRef.id },
|
|
510
|
+
}), ctx);
|
|
511
|
+
const warmingWorkflowOutput = helperResponse("warming-workflow-live-output-test");
|
|
512
|
+
assert.equal(warmingWorkflowOutput.ok, true);
|
|
513
|
+
assert.equal(warmingWorkflowOutput.data.source, "async");
|
|
514
|
+
assert.equal(warmingWorkflowOutput.data.agent.unavailable, undefined);
|
|
515
|
+
assert.deepEqual(warmingWorkflowOutput.data.agent.recentOutput, ["Workflow worker output is live."], "a newly resolved workflow worker should expose its live transcript instead of the recovered placeholder");
|
|
516
|
+
bus.emit("subagent:async-complete", { id: warmingWorkflowRunId });
|
|
517
|
+
|
|
409
518
|
await helperCommand.handler(JSON.stringify({
|
|
410
519
|
requestId: "recovered-subagent-output-test",
|
|
411
520
|
action: "subagent-output",
|
|
@@ -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-
|
|
64
|
-
assert.match(html, /styles\.css\?v=
|
|
65
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
63
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v115"/, "adding a startup module should advance the PWA cache identity");
|
|
64
|
+
assert.match(html, /styles\.css\?v=129/, "new token styles should advance the stylesheet revision");
|
|
65
|
+
assert.match(html, /data-app-src="\/app\.js\?v=150"/, "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,22 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
|
|
4
|
+
const app = readFileSync(new URL("../public/app.js", import.meta.url), "utf8");
|
|
5
|
+
const styles = readFileSync(new URL("../public/styles.css", import.meta.url), "utf8");
|
|
6
|
+
const predicateSource = app.match(/function shouldRenderTerminalTabGroup\(group, groupCount\) \{([\s\S]*?)\n\}/)?.[1];
|
|
7
|
+
assert.ok(predicateSource, "terminal CWD grouping predicate should be present");
|
|
8
|
+
|
|
9
|
+
const shouldRenderTerminalTabGroup = new Function("group", "groupCount", predicateSource);
|
|
10
|
+
assert.equal(shouldRenderTerminalTabGroup({ custom: false, cwd: "/repo/one", tabs: [{}] }, 2), false, "a one-tab CWD should remain a normal tab instead of duplicating itself in a group dropdown");
|
|
11
|
+
assert.equal(shouldRenderTerminalTabGroup({ custom: false, cwd: "/repo/one", tabs: [{}, {}] }, 2), true, "a multi-tab CWD should retain its group dropdown");
|
|
12
|
+
assert.equal(shouldRenderTerminalTabGroup({ custom: false, cwd: "", tabs: [{}, {}] }, 2), false, "tabs without a CWD should remain ungrouped");
|
|
13
|
+
assert.equal(shouldRenderTerminalTabGroup({ custom: true, cwd: "", tabs: [{}] }, 2), false, "a one-tab custom group should remain ungrouped");
|
|
14
|
+
assert.equal(shouldRenderTerminalTabGroup({ custom: true, cwd: "", tabs: [{}, {}] }, 1), true, "multi-tab custom groups should retain their existing behavior");
|
|
15
|
+
|
|
16
|
+
assert.match(app, /function createTerminalTabCwdAddMenu\(tab\)[\s\S]*make\("div", "terminal-tab-cwd-add-menu"\)[\s\S]*make\("button", "terminal-tab-group-add terminal-tab-cwd-add", "\+ Tab"\)[\s\S]*createTerminalTab\(tab\.cwd \|\| currentDirectoryForNewTab\(\)/, "a singleton CWD should receive a below-tab + Tab menu using its directory");
|
|
17
|
+
assert.match(app, /const showCwdAdd = groups\.length > 1 && group\.tabs\.length === 1 && Boolean\(group\.cwd\);[\s\S]*renderTerminalTab\(tab, \{ showCwdAdd \}\)/, "the direct + Tab action should appear only for singleton CWDs when multiple CWD groups are open");
|
|
18
|
+
assert.match(app, /function renderTerminalTab\(tab, \{ showCwdAdd = false \} = \{\}\)[\s\S]*terminal-tab-cwd-add-host[\s\S]*if \(showCwdAdd\) wrapper\.append\(createTerminalTabCwdAddMenu\(tab\)\)/, "singleton CWDs should stay on the regular tab rendering path with a separate add-only menu");
|
|
19
|
+
assert.match(styles, /\.terminal-tab-cwd-add-menu \{[\s\S]*position:\s*absolute;[\s\S]*inset:\s*100% 0 auto 0;[\s\S]*display:\s*none;/, "the singleton + Tab menu should sit hidden directly below its tab");
|
|
20
|
+
assert.match(styles, /\.terminal-tab-cwd-add-host:hover \.terminal-tab-cwd-add-menu,\n\.terminal-tab-cwd-add-host:focus-within \.terminal-tab-cwd-add-menu \{\n\s+display:\s*flex;/, "hover or keyboard focus should reveal the singleton + Tab menu");
|
|
21
|
+
|
|
22
|
+
console.log("terminal-cwd-grouping-static.test.mjs passed");
|
|
@@ -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-v115"/, "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");
|