@firstpick/pi-package-webui 0.8.7 → 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +5 -0
  2. package/bin/pi-webui-rpc-supervisor.mjs +4 -1
  3. package/bin/pi-webui.mjs +9 -1
  4. package/lib/rpc-supervisor-protocol.mjs +6 -1
  5. package/package.json +1 -1
  6. package/public/app.js +679 -128
  7. package/public/index.html +49 -13
  8. package/public/service-worker.js +1 -1
  9. package/public/styles.css +836 -16
  10. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  11. package/tests/browser/interaction-continuity.spec.mjs +58 -0
  12. package/tests/browser/mobile-foundation.spec.mjs +363 -5
  13. package/tests/browser/optimistic-prompt.spec.mjs +24 -10
  14. package/tests/browser/persistent-ui-layout.spec.mjs +2 -0
  15. package/tests/browser/side-panel-section-reorder.spec.mjs +16 -1
  16. package/tests/codex-fast-mode-static.test.mjs +2 -2
  17. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  18. package/tests/fast-mode-client-static.test.mjs +1 -1
  19. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  20. package/tests/file-tree-search-layout-static.test.mjs +261 -0
  21. package/tests/fixtures/fake-pi.mjs +6 -2
  22. package/tests/http-endpoints-harness.test.mjs +6 -2
  23. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  24. package/tests/mobile-compact-layout.test.mjs +60 -0
  25. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  26. package/tests/mobile-foundation-static.test.mjs +12 -12
  27. package/tests/mobile-phone-experience-static.test.mjs +2 -2
  28. package/tests/mobile-static.test.mjs +226 -21
  29. package/tests/open-issue-wizard-static.test.mjs +1 -1
  30. package/tests/optional-feature-migration-frontend.test.mjs +4 -0
  31. package/tests/persistent-ui-layout-static.test.mjs +3 -3
  32. package/tests/prompt-routing-tab-status.test.mjs +8 -0
  33. package/tests/questionnaire-dialog.test.mjs +3 -3
  34. package/tests/rpc-supervisor-host.test.mjs +18 -1
  35. package/tests/rpc-supervisor-protocol.test.mjs +5 -0
  36. package/tests/session-sampling-ui-static.test.mjs +3 -3
  37. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  38. package/tests/side-panel-section-reorder-static.test.mjs +23 -10
  39. package/tests/streaming-ui-coupling.test.mjs +8 -0
  40. package/tests/terminal-tab-workspace-static.test.mjs +15 -1
  41. package/tests/theme-customizer-static.test.mjs +1 -1
@@ -28,13 +28,23 @@ assert.match(
28
28
  );
29
29
  assert.match(
30
30
  app,
31
- /function moveSidePanelSectionRelative\(fromId, targetRecord, insertBefore\)[\s\S]*parent\.insertBefore\(sourceRecord\.section, targetRecord\.section\)[\s\S]*targetRecord\.section\.nextSibling[\s\S]*persistSidePanelSectionOrder\(\)/,
32
- "reordering should move the complete section before or after its target and persist immediately",
31
+ /function isSidePanelSectionReorderingEnabled\(\) \{\n\s+return !isMobileView\(\) \|\| sidePanelSectionEditMode;[\s\S]*function moveSidePanelSectionRelative\(fromId, targetRecord, insertBefore\) \{\n\s+if \(!isSidePanelSectionReorderingEnabled\(\)\) return false;[\s\S]*parent\.insertBefore\(sourceRecord\.section, targetRecord\.section\)[\s\S]*targetRecord\.section\.nextSibling[\s\S]*persistSidePanelSectionOrder\(\)/,
32
+ "desktop reordering should stay enabled while mobile reordering fails closed outside Edit mode",
33
+ );
34
+ assert.match(
35
+ app,
36
+ /function moveSidePanelSectionByOffset\(sectionId, offset\) \{\n\s+if \(!isSidePanelSectionReorderingEnabled\(\)\) return false;/,
37
+ "keyboard reordering should follow the desktop-always/mobile-Edit gate",
38
+ );
39
+ assert.match(
40
+ app,
41
+ /function beginSidePanelSectionPointerDrag\(event, sectionId\) \{\n\s+if \(!isSidePanelSectionReorderingEnabled\(\) \|\| event\.button !== 0/,
42
+ "pointer and touch dragging should follow the responsive reorder gate",
33
43
  );
34
44
  assert.match(
35
45
  app,
36
46
  /function updateSidePanelSectionPointerDrag\(event\)[\s\S]*Math\.hypot[\s\S]*SIDE_PANEL_SECTION_POINTER_DRAG_THRESHOLD_PX[\s\S]*sidePanelSectionToggleFromPoint[\s\S]*getBoundingClientRect\(\)[\s\S]*moveSidePanelSectionRelative/,
37
- "pointer dragging should activate only after the threshold and use header midpoint placement",
47
+ "edit-mode pointer dragging should activate only after the threshold and use header midpoint placement",
38
48
  );
39
49
  assert.match(
40
50
  app,
@@ -43,8 +53,8 @@ assert.match(
43
53
  );
44
54
  assert.match(
45
55
  app,
46
- /function bindSidePanelSectionToggles\(\)[\s\S]*Date\.now\(\) < sidePanelSectionSuppressClickUntil[\s\S]*event\.altKey[\s\S]*event\.key !== "ArrowUp"[\s\S]*moveSidePanelSectionByOffset[\s\S]*beginSidePanelSectionPointerDrag/,
47
- "section headers should retain click toggling while supporting Alt+Arrow keyboard and pointer reordering",
56
+ /function bindSidePanelSectionToggles\(\)[\s\S]*Date\.now\(\) < sidePanelSectionSuppressClickUntil[\s\S]*!isSidePanelSectionReorderingEnabled\(\) \|\| !event\.altKey[\s\S]*event\.key !== "ArrowUp"[\s\S]*moveSidePanelSectionByOffset[\s\S]*beginSidePanelSectionPointerDrag/,
57
+ "section headers should retain click toggling while the responsive gate controls Alt+Arrow and pointer reordering",
48
58
  );
49
59
  assert.match(
50
60
  app,
@@ -58,11 +68,14 @@ assert.match(
58
68
  );
59
69
  assert.match(
60
70
  css,
61
- /\.side-panel-section-toggle\[data-side-panel-section-toggle\][\s\S]*cursor: grab[\s\S]*touch-action: none[\s\S]*\.side-panel-section\.dragging[\s\S]*cursor: grabbing[\s\S]*\.drag-over-before[\s\S]*\.drag-over-after/,
62
- "section headers should expose model-picker-style grab, dragging, and insertion-marker affordances",
71
+ /\.side-panel-edit-button \{\n\s+display: none;[\s\S]*?\.side-panel\.section-edit-mode \.side-panel-section-toggle\[data-side-panel-section-toggle\] \{\n\s+cursor: grab;\n\s+touch-action: none;\n\s+user-select: none;\n\}[\s\S]*?@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\) \{[\s\S]*?\.side-panel-edit-button \{ display: inline-flex;[\s\S]*?\.side-panel\.section-edit-mode \.side-panel-section-toggle\[data-side-panel-section-toggle\] \{\n\s+border-color:[\s\S]*?box-shadow:[\s\S]*?\.side-panel\.section-edit-mode \.side-panel-section-label::before \{/,
72
+ "desktop should keep drag capture without edit highlighting while mobile restores Edit and its visual affordance",
63
73
  );
64
- assert.match(html, /styles\.css\?v=104/, "changed side-panel styles should advance the stylesheet revision");
65
- assert.match(html, /app\.js\?v=120/, "changed side-panel behavior should advance the app revision");
66
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "changed browser assets should advance the PWA cache identity");
74
+ assert.match(html, /id="sidePanelEditButton"[^>]*aria-controls="sidePanel"[^>]*aria-pressed="false"[^>]*aria-label="Edit Control Deck section order"[\s\S]*side-panel-edit-button-label">Edit</, "mobile Control Deck should retain an accessible Edit toggle");
75
+ assert.match(app, /function setSidePanelSectionEditMode\(enabled\)[\s\S]*const next = isMobileView\(\) && !!enabled;[\s\S]*classList\.toggle\("section-edit-mode", reorderingEnabled\)[\s\S]*aria-pressed[\s\S]*"Done" : "Edit"[\s\S]*aria-keyshortcuts/, "mobile Edit state and always-enabled desktop reorder affordances should stay synchronized");
76
+ assert.match(app, /function setSidePanelCollapsed\(collapsed,[\s\S]*if \(collapsed\) setSidePanelSectionEditMode\(false\);/, "closing the Control Deck should leave transient edit mode");
77
+ assert.match(html, /styles\.css\?v=107/, "changed side-panel styles should advance the stylesheet revision");
78
+ assert.match(html, /app\.js\?v=121/, "changed side-panel behavior should advance the app revision");
79
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v84"/, "changed browser assets should advance the PWA cache identity");
67
80
 
68
81
  console.log("side-panel-section-reorder-static.test.mjs passed");
@@ -5,6 +5,7 @@ import { fileURLToPath } from "node:url";
5
5
 
6
6
  const root = join(dirname(fileURLToPath(import.meta.url)), "..");
7
7
  const app = await readFile(join(root, "public", "app.js"), "utf8");
8
+ const styles = await readFile(join(root, "public", "styles.css"), "utf8");
8
9
  const transcriptRenderer = await readFile(join(root, "public", "transcript-renderer.mjs"), "utf8");
9
10
 
10
11
  const SELF_CONTAINED_THEORY_TITLES = new Map([
@@ -85,6 +86,7 @@ assertDocTheory(8, "steer prompt");
85
86
 
86
87
  const syncLiveTodoProgressWidgetFromText = findFunctionBody(app, "syncLiveTodoProgressWidgetFromText");
87
88
  const scheduleLiveWidgetRender = findFunctionBody(app, "scheduleLiveWidgetRender");
89
+ const appendOptimisticUserPrompt = findFunctionBody(app, "appendOptimisticUserPrompt");
88
90
  const handleMessageUpdate = findFunctionBody(app, "handleMessageUpdate");
89
91
  const scrollChatToBottom = findFunctionBody(app, "scrollChatToBottom");
90
92
  const stripTodoProgressLines = findFunctionBody(app, "stripTodoProgressLines");
@@ -126,6 +128,12 @@ assert.match(
126
128
  "disabling todo-progress should still suppress the optional widget renderer itself",
127
129
  );
128
130
 
131
+ assert.match(styles, /\.chat \{[\s\S]*?display:\s*flex;[\s\S]*?flex-direction:\s*column;/, "the transcript should retain a stable vertical flow as composer geometry changes");
132
+ assert.match(styles, /\.chat > \.message:first-of-type \{ margin-top:\s*0; \}/, "settled transcript cards should stay top-anchored while the prompt textarea auto-resizes");
133
+ assert.doesNotMatch(styles, /\.chat > \.message:first-of-type \{ margin-top:\s*auto; \}/, "short transcripts must not follow the moving composer edge while the user types");
134
+ assert.match(appendOptimisticUserPrompt, /renderAllMessages\(\);[\s\S]*?scrollChatToBottom\(\{ force:\s*true \}\);/, "submitting a prompt should explicitly resume bottom-follow for the new turn");
135
+ assert.doesNotMatch(appendOptimisticUserPrompt, /if \(autoFollowChat \|\| isChatNearBottom\(\)\)/, "a paused reader position should not leave a newly submitted turn off-screen");
136
+
129
137
  futureInvariant("theory #1: message_update streaming hot path must not call immediate scroll/layout work", () => {
130
138
  assert.doesNotMatch(handleMessageUpdate, /scrollChatToBottom\s*\(/, "handleMessageUpdate should schedule/coalesce follow-scroll instead of calling scrollChatToBottom() directly");
131
139
  });
@@ -38,6 +38,7 @@ const sources = [
38
38
  ].join("\n");
39
39
  const terminalTabMetaSource = appFunctionSource("terminalTabMeta", "terminalTabGitTooltip");
40
40
  const renderTerminalTabGroupSource = appFunctionSource("renderTerminalTabGroup", "updateTerminalTabGroupOpenState");
41
+ const renderSubagentTerminalTabGroupSource = appFunctionSource("renderSubagentTerminalTabGroup", "openSubagentOutput");
41
42
 
42
43
  const context = {
43
44
  normalizeDisplayPath: (value) => String(value || "").replace(/\\/g, "/"),
@@ -51,6 +52,7 @@ const context = {
51
52
  tabWorkflowModeActive: (tab) => tab.workflowMode === true,
52
53
  workflowRunningCountForTab: (id) => id === "tab-1" ? 2 : 0,
53
54
  terminalDisplayGroupTitle: () => "Workspace group",
55
+ isMobileView: () => false,
54
56
  };
55
57
 
56
58
  const results = vm.runInNewContext(`
@@ -90,9 +92,21 @@ assert.doesNotMatch(terminalTabMetaSource, /\bpid\b/i, "compact tab metadata sho
90
92
  assert.equal(app.match(/applyStyledTooltip\(button, terminalTabTooltip\(tab\)/g)?.length, 2, "single and grouped-item tabs should share one tooltip formatter");
91
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");
92
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
+ 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
+ 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");
97
+ assert.equal((`${renderTerminalTabGroupSource}\n${renderSubagentTerminalTabGroupSource}`.match(/event\.pointerType === "touch"/g) || []).length, 4, "touch pointer enter and leave should not compete with explicit dropdown taps");
98
+ assert.match(renderTerminalTabGroupSource, /menu\.id = `terminalTabGroupMenu\$\{\+\+terminalTabGroupMenuSerial\}`[\s\S]*button\.setAttribute\("aria-controls", menu\.id\)/, "regular terminal dropdown buttons should own their generated group list");
99
+ assert.match(renderSubagentTerminalTabGroupSource, /menu\.id = `terminalTabGroupMenu\$\{\+\+terminalTabGroupMenuSerial\}`[\s\S]*button\.setAttribute\("aria-controls", menu\.id\)/, "subagent dropdown buttons should own their generated group list");
100
+ assert.match(styles, /\.terminal-tab-group-dropdown-indicator \{[\s\S]*display:\s*none;[\s\S]*\.terminal-tab-group-button\[aria-expanded="true"\] \.terminal-tab-group-dropdown-indicator[\s\S]*rotate\(180deg\)/, "group buttons should expose a stateful dropdown indicator");
101
+ assert.match(styles, /\.terminal-tab-group-button \{\n\s+width:\s*100%;\n\s+min-width:\s*0;[\s\S]*\.terminal-tab-group-dropdown-indicator \{ display:\s*inline-grid; \}/, "mobile terminal groups should show the dropdown indicator and retain a full-width trigger");
102
+ assert.match(styles, /\.terminal-tab-group:hover:not\(\.menu-open\) \.terminal-tab-group-menu,[\s\S]*\.terminal-tab-group:focus-within:not\(\.menu-open\) \.terminal-tab-group-menu \{\n\s+display:\s*none;/, "mobile focus and latched hover should not keep a toggled-closed group visible");
103
+ assert.match(app, /if \(activeDrawerModal\.surface === elements\.terminalTabsShell && openTerminalTabGroupKey\)[\s\S]*event\.stopPropagation\(\)[\s\S]*clearOpenTerminalTabGroup\(openTerminalTabGroupKey, \{ force: true \}\)[\s\S]*terminal-tab-group-button/, "Escape should close a mobile group dropdown before closing the terminal drawer");
104
+ assert.match(app, /if \(tabId === activeTabId\) \{\n\s+clearOpenTerminalTabGroup\(null, \{ force: true \}\);\n\s+setMobileTabsExpanded\(false\);/, "selecting the already-active regular group member should close the mobile group and drawer");
105
+ assert.match(app, /async function activateSubagentTerminalView\(viewId\)[\s\S]*clearOpenTerminalTabGroup\(null, \{ force: true \}\);\n\s+setMobileTabsExpanded\(false\);/, "selecting a subagent group member should close the mobile group and drawer");
106
+ assert.match(app, /lines\.push\(isMobileView\(\) \? "Tap to open group terminals" : "Click to switch · Drop tabs here to add"\)/, "group accessible descriptions should match mobile dropdown and desktop switch behavior");
93
107
  assert.match(app, /footerTooltipNode\.setAttribute\("role", "tooltip"\)/, "the shared visual tooltip should expose tooltip semantics");
94
108
  assert.match(app, /document\.addEventListener\("keydown", \(event\) => \{[\s\S]*event\.key === "Escape" && footerTooltipTarget[\s\S]*hideFooterTooltip\(footerTooltipTarget\)[\s\S]*\}, true\)/, "Escape should dismiss both hover- and focus-triggered tooltips from the document capture phase");
95
- assert.match(app, /data-tooltip-variant"\) === "workspace" && !node\.matches\(":focus-visible"\)/, "touch focus should not flash the large workspace tooltip while keyboard focus remains supported");
109
+ assert.match(app, /node\.addEventListener\("focus", \(\) => \{[\s\S]*?!node\.matches\(":focus-visible"\)[\s\S]*?showFooterTooltip\(node\)/, "touch focus should not flash styled tooltips while keyboard focus remains supported");
96
110
  assert.match(app, /styled-tooltip-description[\s\S]*aria-describedby/, "detailed tab tooltip text should be available as an accessible description");
97
111
  assert.match(styles, /footer-floating-tooltip\[data-variant="workspace"\][\s\S]*line-height: 1\.52/, "workspace tooltips should use the readable visual variant");
98
112
  assert.doesNotMatch(styles, /terminal-tab-group-summary/, "group tooltip styling should not reserve in-flow menu space");
@@ -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-v81"/, "adding the theme contract to the startup graph should advance the PWA cache identity");
37
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v84"/, "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");