@firstpick/pi-package-webui 0.8.5 → 0.8.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.
Files changed (110) hide show
  1. package/README.md +18 -584
  2. package/bin/pi-webui-launcher.mjs +22 -0
  3. package/bin/pi-webui-update-supervisor.mjs +86 -0
  4. package/bin/pi-webui.mjs +933 -554
  5. package/index.ts +16 -6
  6. package/lib/component-update-state.mjs +21 -0
  7. package/lib/git-workflow-preferences.mjs +20 -2
  8. package/lib/optional-feature-catalog.mjs +1 -0
  9. package/lib/sampling-parameter-capabilities.mjs +160 -0
  10. package/lib/session-summary-core.mjs +4 -3
  11. package/lib/session-summary-preferences.mjs +16 -1
  12. package/lib/subagent-launch-slots.mjs +14 -2
  13. package/lib/trust-boundaries.mjs +16 -0
  14. package/lib/update/executor.mjs +99 -0
  15. package/lib/update/journal.mjs +175 -0
  16. package/lib/update/owners.mjs +70 -0
  17. package/lib/update/plan.mjs +134 -0
  18. package/lib/update/resolver.mjs +168 -0
  19. package/lib/update/supervisor.mjs +238 -0
  20. package/lib/update/verify.mjs +52 -0
  21. package/lib/update-commands.mjs +25 -13
  22. package/lib/webui-workspaces.mjs +17 -1
  23. package/lib/workspace-session-summaries.mjs +400 -0
  24. package/package.json +4 -4
  25. package/public/app.js +2487 -349
  26. package/public/index.html +200 -51
  27. package/public/middle-button-drag-scroll.mjs +154 -0
  28. package/public/sampling-parameter-controls.mjs +361 -0
  29. package/public/service-worker.js +5 -1
  30. package/public/stream-output-controller.mjs +327 -0
  31. package/public/styles.css +666 -71
  32. package/public/theme-contract.mjs +244 -0
  33. package/session-summary.ts +164 -4
  34. package/tests/aur-review-widget-static.test.mjs +2 -1
  35. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  36. package/tests/browser/control-deck-component-updates.spec.mjs +20 -22
  37. package/tests/browser/interaction-continuity.spec.mjs +2 -2
  38. package/tests/browser/middle-button-drag-scroll.spec.mjs +145 -0
  39. package/tests/browser/persistent-ui-layout.spec.mjs +68 -23
  40. package/tests/browser/sampling-tooltip.spec.mjs +228 -0
  41. package/tests/browser/session-summary.spec.mjs +131 -3
  42. package/tests/browser/stream-output-isolation.spec.mjs +510 -0
  43. package/tests/browser/update-reconnect.spec.mjs +92 -0
  44. package/tests/codex-fast-mode-static.test.mjs +2 -2
  45. package/tests/common-options-submenus-interaction-static.test.mjs +172 -0
  46. package/tests/common-options-submenus-markup-static.test.mjs +152 -0
  47. package/tests/component-update-api-static.test.mjs +22 -61
  48. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  49. package/tests/control-deck-component-updates-static.test.mjs +13 -237
  50. package/tests/durable-rpc-supervisor-harness.test.mjs +3 -1
  51. package/tests/fast-mode-client-static.test.mjs +3 -2
  52. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  53. package/tests/feature-system-prompt-optional-feature-static.test.mjs +49 -0
  54. package/tests/fixtures/fake-pi.mjs +269 -2
  55. package/tests/fixtures/update/tree-timeout-descendant.mjs +6 -0
  56. package/tests/fixtures/update/tree-timeout-parent.mjs +11 -0
  57. package/tests/git-footer-context-menu-static.test.mjs +58 -0
  58. package/tests/git-workflow-preferences.test.mjs +7 -1
  59. package/tests/guided-git-aur-review.test.mjs +4 -3
  60. package/tests/http-endpoints-harness.test.mjs +274 -23
  61. package/tests/middle-button-drag-scroll-static.test.mjs +24 -0
  62. package/tests/middle-button-drag-scroll.test.mjs +170 -0
  63. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  64. package/tests/mobile-foundation-static.test.mjs +5 -6
  65. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  66. package/tests/mobile-static.test.mjs +85 -50
  67. package/tests/native-parity.test.mjs +1 -1
  68. package/tests/open-issue-wizard-static.test.mjs +2 -3
  69. package/tests/optional-feature-migration-frontend.test.mjs +9 -5
  70. package/tests/persistent-ui-layout-static.test.mjs +13 -2
  71. package/tests/questionnaire-dialog.test.mjs +3 -3
  72. package/tests/remote-auth-settings-harness.test.mjs +43 -0
  73. package/tests/rpc-supervisor-host.test.mjs +11 -2
  74. package/tests/safety-guard-auto-review-harness.test.mjs +117 -0
  75. package/tests/safety-guard-auto-review-static.test.mjs +34 -0
  76. package/tests/sampling-native-controls-user-flow.test.mjs +752 -0
  77. package/tests/sampling-parameter-capabilities.test.mjs +167 -0
  78. package/tests/sampling-parameter-controls.test.mjs +241 -0
  79. package/tests/session-sampling-helper.test.mjs +228 -0
  80. package/tests/session-sampling-http.test.mjs +168 -0
  81. package/tests/session-sampling-ui-static.test.mjs +370 -0
  82. package/tests/session-summary-core.test.mjs +205 -10
  83. package/tests/side-panel-section-height-removal-static.test.mjs +34 -0
  84. package/tests/side-panel-section-reorder-static.test.mjs +3 -3
  85. package/tests/staged-content-hash-contract.test.mjs +52 -11
  86. package/tests/stream-lifecycle-core.test.mjs +134 -0
  87. package/tests/stream-output-controller.test.mjs +252 -0
  88. package/tests/stream-output-isolation-static.test.mjs +89 -0
  89. package/tests/streaming-ui-coupling.test.mjs +50 -0
  90. package/tests/subagent-gate-visibility.test.mjs +1 -1
  91. package/tests/subagent-launch-slots-static.test.mjs +1 -1
  92. package/tests/subagent-launch-slots.test.mjs +18 -1
  93. package/tests/theme-contract.test.mjs +104 -0
  94. package/tests/theme-customizer-static.test.mjs +82 -0
  95. package/tests/theme-scheme-mode.test.mjs +15 -0
  96. package/tests/ui-layout-settings.test.mjs +18 -1
  97. package/tests/update-api-harness.test.mjs +111 -0
  98. package/tests/update-commands.test.mjs +15 -45
  99. package/tests/update-executor-process-tree-harness.test.mjs +22 -0
  100. package/tests/update-journal-harness.test.mjs +59 -0
  101. package/tests/update-lock-multiprocess-harness.test.mjs +46 -0
  102. package/tests/update-owners.test.mjs +27 -0
  103. package/tests/update-plan.test.mjs +58 -0
  104. package/tests/update-resolver.test.mjs +56 -0
  105. package/tests/update-supervisor-harness.test.mjs +57 -0
  106. package/tests/update-tab-restore-harness.test.mjs +24 -0
  107. package/tests/update-verify.test.mjs +31 -0
  108. package/tests/workspace-files-live-updates-static.test.mjs +13 -4
  109. package/tests/workspace-session-summaries.test.mjs +288 -0
  110. package/webui-rpc-helper.mjs +119 -0
@@ -0,0 +1,170 @@
1
+ import assert from "node:assert/strict";
2
+ import {
3
+ findMiddleButtonDragScrollTarget,
4
+ installMiddleButtonDragScroll,
5
+ middleButtonAutoScrollVelocity,
6
+ } from "../public/middle-button-drag-scroll.mjs";
7
+
8
+ class FakeEventTarget {
9
+ listeners = new Map();
10
+
11
+ addEventListener(type, listener) {
12
+ const listeners = this.listeners.get(type) || new Set();
13
+ listeners.add(listener);
14
+ this.listeners.set(type, listeners);
15
+ }
16
+
17
+ removeEventListener(type, listener) {
18
+ this.listeners.get(type)?.delete(listener);
19
+ }
20
+
21
+ emit(type, event = {}) {
22
+ for (const listener of [...(this.listeners.get(type) || [])]) listener(event);
23
+ }
24
+ }
25
+
26
+ function frameHarness() {
27
+ let nextId = 1;
28
+ const callbacks = new Map();
29
+ return {
30
+ requestFrame(callback) {
31
+ const id = nextId++;
32
+ callbacks.set(id, callback);
33
+ return id;
34
+ },
35
+ cancelFrame(id) { callbacks.delete(id); },
36
+ run(timestamp) {
37
+ const entry = callbacks.entries().next().value;
38
+ assert.ok(entry, "an animation frame should be pending");
39
+ const [id, callback] = entry;
40
+ callbacks.delete(id);
41
+ callback(timestamp);
42
+ },
43
+ get pending() { return callbacks.size; },
44
+ };
45
+ }
46
+
47
+ function fakeElement({ parentElement = null, scrollHeight = 0, clientHeight = 0, scrollTop = 0, overflowY = "visible", interactive = false } = {}) {
48
+ const style = {
49
+ scrollBehavior: "",
50
+ removeProperty(name) {
51
+ if (name === "scroll-behavior") this.scrollBehavior = "";
52
+ },
53
+ };
54
+ return {
55
+ nodeType: 1,
56
+ parentElement,
57
+ scrollHeight,
58
+ clientHeight,
59
+ scrollTop,
60
+ overflowY,
61
+ interactive,
62
+ style,
63
+ closest() { return this.interactive ? this : null; },
64
+ };
65
+ }
66
+
67
+ function pointerEvent(overrides = {}) {
68
+ return {
69
+ button: 1,
70
+ pointerId: 7,
71
+ pointerType: "mouse",
72
+ clientY: 200,
73
+ defaultPrevented: false,
74
+ preventDefault() { this.defaultPrevented = true; },
75
+ ...overrides,
76
+ };
77
+ }
78
+
79
+ const getStyle = (node) => ({ overflowY: node.overflowY });
80
+
81
+ assert.equal(middleButtonAutoScrollVelocity(10), 0, "the center dead zone should suppress accidental scrolling");
82
+ assert.equal(middleButtonAutoScrollVelocity(20), 120, "downward displacement should produce downward velocity");
83
+ assert.equal(middleButtonAutoScrollVelocity(-20), -120, "upward displacement should produce upward velocity");
84
+ assert.equal(middleButtonAutoScrollVelocity(1000), 1200, "automatic scrolling should have a bounded maximum speed");
85
+
86
+ {
87
+ const outer = fakeElement({ scrollHeight: 1200, clientHeight: 300, overflowY: "auto" });
88
+ const inner = fakeElement({ parentElement: outer, scrollHeight: 800, clientHeight: 200, overflowY: "scroll" });
89
+ const child = fakeElement({ parentElement: inner });
90
+ assert.equal(findMiddleButtonDragScrollTarget(child, { getStyle }), inner, "the nearest vertical scroll surface should win");
91
+ inner.scrollHeight = inner.clientHeight;
92
+ assert.equal(findMiddleButtonDragScrollTarget(child, { getStyle }), outer, "a non-overflowing child should fall back to its scrollable parent");
93
+ }
94
+
95
+ {
96
+ const root = new FakeEventTarget();
97
+ const eventTarget = new FakeEventTarget();
98
+ const frames = frameHarness();
99
+ const activeClasses = new Set();
100
+ const classTarget = { classList: { add: (name) => activeClasses.add(name), remove: (name) => activeClasses.delete(name) } };
101
+ const surface = fakeElement({ scrollHeight: 1200, clientHeight: 300, scrollTop: 500, overflowY: "auto" });
102
+ surface.style.scrollBehavior = "smooth";
103
+ const child = fakeElement({ parentElement: surface });
104
+ const directions = [];
105
+ const controller = installMiddleButtonDragScroll({
106
+ root,
107
+ eventTarget,
108
+ classTarget,
109
+ getStyle,
110
+ requestFrame: (callback) => frames.requestFrame(callback),
111
+ cancelFrame: (frame) => frames.cancelFrame(frame),
112
+ onDirection: (direction) => directions.push(direction),
113
+ });
114
+
115
+ const down = pointerEvent({ target: child });
116
+ root.emit("pointerdown", down);
117
+ assert.equal(down.defaultPrevented, true, "an accepted middle press should suppress native browser autoscroll");
118
+ assert.equal(surface.style.scrollBehavior, "auto", "smooth scrolling should be disabled during automatic movement");
119
+ assert.equal(activeClasses.has("middle-button-auto-scrolling"), true);
120
+ assert.equal(frames.pending, 1);
121
+
122
+ const mouseDown = pointerEvent({ target: child });
123
+ root.emit("mousedown", mouseDown);
124
+ assert.equal(mouseDown.defaultPrevented, true, "the compatibility mouse event should also suppress native browser autoscroll");
125
+
126
+ const moveDown = pointerEvent({ target: child, clientY: 260 });
127
+ eventTarget.emit("pointermove", moveDown);
128
+ assert.equal(moveDown.defaultPrevented, true);
129
+ assert.equal(surface.scrollTop, 500, "pointer movement should select direction without directly grabbing content");
130
+ assert.deepEqual({ target: directions[0].target, offsetY: directions[0].offsetY }, { target: surface, offsetY: 60 });
131
+
132
+ frames.run(0);
133
+ assert.equal(surface.scrollTop, 510, "a displaced pointer should scroll down on the next animation frame");
134
+ frames.run(100);
135
+ assert.equal(surface.scrollTop, 540, "scrolling should continue while the pointer remains displaced and stationary");
136
+
137
+ const moveUp = pointerEvent({ target: child, clientY: 140 });
138
+ eventTarget.emit("pointermove", moveUp);
139
+ assert.equal(directions.at(-1).offsetY, -60);
140
+ frames.run(150);
141
+ assert.equal(surface.scrollTop, 510, "moving above the press point should reverse automatic scrolling upward");
142
+
143
+ eventTarget.emit("pointerup", pointerEvent({ target: child, clientY: 140 }));
144
+ assert.equal(frames.pending, 0, "releasing the middle button should cancel automatic scrolling immediately");
145
+ assert.equal(surface.style.scrollBehavior, "smooth", "the previous inline scroll behavior should be restored");
146
+ assert.equal(activeClasses.has("middle-button-auto-scrolling"), false);
147
+
148
+ controller.destroy();
149
+ assert.equal(root.listeners.get("pointerdown")?.size, 0, "destroy should remove the delegated pointer listener");
150
+ }
151
+
152
+ {
153
+ const root = new FakeEventTarget();
154
+ const eventTarget = new FakeEventTarget();
155
+ const surface = fakeElement({ scrollHeight: 1000, clientHeight: 200, scrollTop: 300, overflowY: "auto" });
156
+ const interactiveChild = fakeElement({ parentElement: surface, interactive: true });
157
+ installMiddleButtonDragScroll({ root, eventTarget, classTarget: null, getStyle });
158
+
159
+ const leftClick = pointerEvent({ target: surface, button: 0 });
160
+ root.emit("pointerdown", leftClick);
161
+ assert.equal(leftClick.defaultPrevented, false, "left-button interactions must remain untouched");
162
+
163
+ const middleClick = pointerEvent({ target: interactiveChild });
164
+ root.emit("pointerdown", middleClick);
165
+ assert.equal(middleClick.defaultPrevented, false, "interactive targets should retain native middle-click behavior");
166
+ eventTarget.emit("pointermove", pointerEvent({ target: interactiveChild, clientY: 260 }));
167
+ assert.equal(surface.scrollTop, 300);
168
+ }
169
+
170
+ console.log("middle-button-drag-scroll.test.mjs passed");
@@ -47,9 +47,9 @@ assert.match(css, /html\[data-tablet-shell="v2"\] \.mobile-shell-nav[\s\S]*?widt
47
47
  assert.match(css, /html\[data-tablet-shell="v2"\] \.mobile-shell-surface[\s\S]*?width: min\(30rem, 72vw\)/, "tablet inspector must be a bounded right-side sheet");
48
48
  assert.match(css, /html\[data-tablet-shell="v2"\] \.file-viewer-pane[\s\S]*?position: fixed[\s\S]*?inset: 0/, "tablet files must default to full-screen replacement");
49
49
  assert.match(css, /and \(pointer: coarse\)[\s\S]*?min-height: 44px/, "coarse tablet pointers must retain the 44px target floor");
50
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v72"/, "continuity/tablet assets need a coherent cache identity");
51
- assert.match(html, /styles\.css\?v=98/, "tablet CSS must have a coherent HTML revision");
52
- assert.match(html, /app\.js\?v=113/, "continuity app logic must have a coherent HTML revision");
50
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "continuity/tablet assets need a coherent cache identity");
51
+ assert.match(html, /styles\.css\?v=104/, "tablet CSS must have a coherent HTML revision");
52
+ assert.match(html, /app\.js\?v=120/, "continuity app logic must have a coherent HTML revision");
53
53
  assert.match(readme, /tabletShell=v2/, "tablet preview and rollback must be documented");
54
54
 
55
55
  console.log("mobile-continuity-tablet-static.test.mjs passed");
@@ -34,13 +34,12 @@ assert.equal(pkg.devDependencies?.["@axe-core/playwright"], "4.12.1", "axe must
34
34
  assert.match(app, /from "\.\/mobile-shell-state\.mjs"/, "app boot must import the pure mobile shell module");
35
35
  assert.match(pkg.scripts.check, /node --check public\/mobile-shell-state\.mjs/, "package checks must syntax-check every public module in the startup graph");
36
36
  assert.match(pkg.scripts.check, /node --check public\/transcript-renderer\.mjs/, "package checks must syntax-check the transcript startup module");
37
- assert.match(server, /"mobile-shell-state\.mjs"/, "the server allowlist must serve the new public module");
38
- assert.match(server, /"transcript-renderer\.mjs"/, "the server allowlist must serve the transcript startup module");
37
+ assert.match(server, /STATIC_PUBLIC_FILE_EXTENSIONS[\s\S]*"\.mjs"/, "the server must serve typed startup modules from the public asset boundary");
39
38
  assert.match(serviceWorker, /"\/mobile-shell-state\.mjs"/, "the PWA shell must cache the new startup module");
40
39
  assert.match(serviceWorker, /"\/transcript-renderer\.mjs"/, "the PWA shell must cache the transcript startup module");
41
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v72"/, "the cache identity must change with the startup graph");
42
- assert.match(html, /styles\.css\?v=98/, "the stylesheet revision must change with mobile/tablet CSS fixes");
43
- assert.match(html, /app\.js\?v=113/, "the app revision must change with continuity/tablet wiring");
40
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "the cache identity must change with the startup graph");
41
+ assert.match(html, /styles\.css\?v=104/, "the stylesheet revision must change with mobile/tablet CSS fixes");
42
+ assert.match(html, /app\.js\?v=120/, "the app revision must change with continuity/tablet wiring");
44
43
  assert.match(serviceWorker, /const APP_SHELL_NETWORK_TIMEOUT_MS = 8_000;[\s\S]*?event\.waitUntil\([\s\S]*?cache\.put\(request, response\.clone\(\)\)[\s\S]*?return networkResponse;/, "runtime cache writes must extend the event lifetime without blocking bounded network responses");
45
44
  assert.match(serviceWorker, /MOBILE_NAVIGATION_MESSAGE_TYPE = "pi-webui:navigate:v1"/, "the service worker must use a versioned active-client navigation message");
46
45
  assert.match(serviceWorker, /client\.postMessage\(\{ type: MOBILE_NAVIGATION_MESSAGE_TYPE, target \}\)/, "existing clients must receive only a validated target message");
@@ -58,7 +57,7 @@ assert.match(server, /requestId was already used for a different prompt/, "reque
58
57
  assert.match(server, /runId: null/, "tab activity must expose an opaque parent-run field");
59
58
  assert.match(server, /activity\.runId = randomUUID\(\)/, "parent-run IDs must be server-issued opaque values");
60
59
  assert.match(server, /function markTabFailed\([\s\S]*?activity\.status = "failed"[\s\S]*?activity\.completionSerial/, "failed parent turns must be represented distinctly from successful completion");
61
- assert.match(server, /SSE_BACKPRESSURE_MAX_PENDING_BYTES = 512 \* 1024/, "SSE backpressure buffering must remain explicitly bounded");
60
+ assert.match(server, /SSE_BACKPRESSURE_MAX_PENDING_BYTES = 4 \* 1024 \* 1024/, "SSE backpressure buffering must remain explicitly bounded above the healthy fixture burst");
62
61
  assert.match(server, /res\.once\("drain", \(\) => flushSseClient\(client\)\)/, "healthy SSE clients must resume after transient write backpressure");
63
62
  assert.match(server, /client\.tab\?\.sseClients\?\.delete\(client\)/, "eviction must remove only the slow client");
64
63
  assert.match(server, /client\.res\?\.end\(\)/, "slow-client eviction must finish chunked SSE responses gracefully");
@@ -60,6 +60,6 @@ assert.match(css, /data-mobile-presentation="essential"/, "Essential presentatio
60
60
  assert.match(css, /html\[data-mobile-shell="v2"\] body\.mobile-keyboard-open \.widget-area,[\s\S]*?\.composer-actions-button \{ display: block !important; \}/, "v2 keyboard mode must keep run widgets and the actions entry available");
61
61
  assert.match(css, /@media \(prefers-reduced-motion: reduce\)/, "reduced-motion behavior is required");
62
62
  assert.match(css, /@media \(forced-colors: active\)/, "forced-color affordances are required");
63
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v72"/, "browser asset changes need a coherent cache tuple");
63
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "browser asset changes need a coherent cache tuple");
64
64
 
65
65
  console.log("mobile-phone-experience-static.test.mjs passed");