@firstpick/pi-package-webui 0.9.8 → 0.9.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.
- package/DEVELOPMENT.md +882 -0
- package/README.md +1 -1
- package/TECHNICAL.md +415 -0
- package/bin/pi-webui.mjs +40 -1
- package/lib/windows-drive-roots.mjs +114 -0
- package/package.json +3 -1
- package/public/app.js +54 -17
- package/public/index.html +7 -3
- package/public/service-worker.js +1 -1
- package/public/styles.css +13 -1
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/windows-drive-parent.spec.mjs +198 -0
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-visibility-static.test.mjs +3 -3
- package/tests/controls-layout-static.test.mjs +3 -3
- package/tests/events-tree-context-menu-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/guided-git-activation-static.test.mjs +3 -3
- package/tests/guided-git-fallback-ui-static.test.mjs +2 -2
- 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/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/session-sampling-ui-static.test.mjs +3 -3
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/syntax-highlighting-static.test.mjs +3 -3
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/windows-drive-cwd-picker-static.test.mjs +81 -0
- package/tests/windows-drive-roots.test.mjs +130 -0
|
@@ -54,7 +54,7 @@ assert.match(readme, /fallback model and its own reasoning effort[\s\S]*tries th
|
|
|
54
54
|
assert.match(technical, /## Guided Git generation profiles[\s\S]*strict one-retry policy[\s\S]*model and reasoning effort are restored[\s\S]*dead Pi process cannot run the fallback/i, "technical reference should document configuration and operational limits");
|
|
55
55
|
assert.match(development, /### Fallback browser\/runtime contract[\s\S]*fallbackUsed: true[\s\S]*webui_git_workflow_generation_fallback_started[\s\S]*never sends a retry/, "development guide should preserve the response/event and browser ownership contract");
|
|
56
56
|
|
|
57
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
58
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
57
|
+
assert.match(html, /data-app-src="\/app\.js\?v=175"/, "the changed browser app should use the next query revision");
|
|
58
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142";/, "the PWA cache identity should advance with browser behavior");
|
|
59
59
|
|
|
60
60
|
console.log("guided-git-fallback-ui-static.test.mjs passed");
|
|
@@ -95,9 +95,9 @@ assert.match(css, /\.composer-intercom-tag:hover,[\s\S]*\.composer-intercom-tag:
|
|
|
95
95
|
assert.match(css, /\.extension-dialog\.intercom-conversation-dialog \{[\s\S]*width: min\(76rem,[\s\S]*height: min\(54rem,/, "the viewer should use a large in-app modal");
|
|
96
96
|
assert.match(css, /@media \(max-width: 720px\)[\s\S]*\.composer-intercom-tag \{ min-height: 44px;[\s\S]*\.extension-dialog\.intercom-conversation-dialog[\s\S]*width: calc\(100vw - 0\.7rem\)/, "tags and the dialog should remain reachable on narrow and coarse-pointer layouts");
|
|
97
97
|
|
|
98
|
-
assert.match(html, /\/styles\.css\?v=
|
|
99
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
100
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
98
|
+
assert.match(html, /\/styles\.css\?v=143/, "the stylesheet URL should advance for the bounded conversation tags");
|
|
99
|
+
assert.match(html, /data-app-src="\/app\.js\?v=175"/, "the guarded app URL should advance for current browser wiring");
|
|
100
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "the PWA cache identity should advance with browser assets");
|
|
101
101
|
|
|
102
102
|
assert.match(readme, /one compact tag per conversation appears beneath the composer/i, "the README should explain the user-visible entry point");
|
|
103
103
|
assert.match(technical, /## Agent conversation viewer[\s\S]*Attachments, tool calls and results, thinking, stdout\/stderr, filesystem paths, raw session records/i, "the advanced guide should document privacy exclusions");
|
|
@@ -52,9 +52,9 @@ assert.match(css, /@media \(prefers-reduced-motion: reduce\)[\s\S]*?animation-du
|
|
|
52
52
|
assert.match(css, /body\.terminal-tabs-left \.main-output-surface \{ grid-row: 4; \}/, "sidebar tab placement should keep the stable output surface in the transcript grid row");
|
|
53
53
|
assert.match(css, /body\.subagent-terminal-active \.main-output-surface,/, "the main output surface should stay hidden in the dedicated subagent view");
|
|
54
54
|
|
|
55
|
-
assert.match(html, /styles\.css\?v=
|
|
56
|
-
assert.match(html, /app\.js\?v=
|
|
57
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
55
|
+
assert.match(html, /styles\.css\?v=143/, "the stylesheet cache query should advance");
|
|
56
|
+
assert.match(html, /app\.js\?v=175/, "the app cache query should advance");
|
|
57
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "the PWA cache identity should advance with browser assets");
|
|
58
58
|
assert.match(readme, /Loading agent output/, "user documentation should describe the visible loading feedback");
|
|
59
59
|
assert.match(development, /main output loading/i, "developer documentation should preserve the request-ownership contract");
|
|
60
60
|
|
|
@@ -16,9 +16,9 @@ assert.match(app, /import \{ installMiddleButtonDragScroll \} from "\.\/middle-b
|
|
|
16
16
|
assert.match(app, /installMiddleButtonDragScroll\(\{[\s\S]*onDirection: \(\{ target, offsetY \}\)[\s\S]*noteChatUserScrollIntent\(\{ type: "middle-drag", deltaY: offsetY \}\)/, "chat auto-scroll direction should feed the existing follow/pause intent state");
|
|
17
17
|
assert.match(app, /event\?\.type === "middle-drag"\) return event\.deltaY > 0;/, "moving below the press point should be recognized as intent to read later chat output");
|
|
18
18
|
assert.match(css, /body\.middle-button-auto-scrolling,[\s\S]*cursor: all-scroll !important;[\s\S]*user-select: none !important;/, "active automatic scrolling should expose a directional-scroll affordance and suppress accidental selection");
|
|
19
|
-
assert.match(html, /styles\.css\?v=
|
|
20
|
-
assert.match(html, /app\.js\?v=
|
|
21
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
19
|
+
assert.match(html, /styles\.css\?v=143/, "changed drag-scroll styles should advance the stylesheet revision");
|
|
20
|
+
assert.match(html, /app\.js\?v=175/, "changed drag-scroll wiring should advance the app revision");
|
|
21
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142";[\s\S]*"\/middle-button-drag-scroll\.mjs"/, "offline PWA installs should refresh and cache the new controller module");
|
|
22
22
|
assert.match(JSON.parse(packageJson).scripts.check, /node --check public\/middle-button-drag-scroll\.mjs/, "the package check should parse the startup-critical controller module");
|
|
23
23
|
|
|
24
24
|
console.log("middle-button-drag-scroll-static.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-
|
|
51
|
-
assert.match(html, /styles\.css\?v=
|
|
52
|
-
assert.match(html, /app\.js\?v=
|
|
50
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "continuity/tablet assets need a coherent cache identity");
|
|
51
|
+
assert.match(html, /styles\.css\?v=143/, "tablet CSS must have a coherent HTML revision");
|
|
52
|
+
assert.match(html, /app\.js\?v=175/, "continuity app logic must have a coherent HTML revision");
|
|
53
53
|
assert.match(technical, /tabletShell=v2[\s\S]*tabletShell=legacy/, "technical reference should document tablet preview and rollback");
|
|
54
54
|
|
|
55
55
|
console.log("mobile-continuity-tablet-static.test.mjs passed");
|
|
@@ -37,9 +37,9 @@ assert.match(pkg.scripts.check, /node --check public\/transcript-renderer\.mjs/,
|
|
|
37
37
|
assert.match(server, /STATIC_PUBLIC_FILE_EXTENSIONS[\s\S]*"\.mjs"/, "the server must serve typed startup modules from the public asset boundary");
|
|
38
38
|
assert.match(serviceWorker, /"\/mobile-shell-state\.mjs"/, "the PWA shell must cache the new startup module");
|
|
39
39
|
assert.match(serviceWorker, /"\/transcript-renderer\.mjs"/, "the PWA shell must cache the transcript startup module");
|
|
40
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
41
|
-
assert.match(html, /styles\.css\?v=
|
|
42
|
-
assert.match(html, /app\.js\?v=
|
|
40
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "the cache identity must change with the startup graph");
|
|
41
|
+
assert.match(html, /styles\.css\?v=143/, "the stylesheet revision must change with mobile/tablet CSS fixes");
|
|
42
|
+
assert.match(html, /app\.js\?v=175/, "the app revision must change with continuity/tablet wiring");
|
|
43
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");
|
|
44
44
|
assert.match(serviceWorker, /MOBILE_NAVIGATION_MESSAGE_TYPE = "pi-webui:navigate:v1"/, "the service worker must use a versioned active-client navigation message");
|
|
45
45
|
assert.match(serviceWorker, /client\.postMessage\(\{ type: MOBILE_NAVIGATION_MESSAGE_TYPE, target \}\)/, "existing clients must receive only a validated target message");
|
|
@@ -60,6 +60,6 @@ assert.match(css, /data-mobile-presentation="essential"/, "Essential presentatio
|
|
|
60
60
|
assert.match(css, /html\[data-mobile-shell="v2"\] body\.mobile-keyboard-open \.widget-area,[\s\S]*?\.composer-actions-button \{ display: block !important; \}/, "v2 keyboard mode must keep run widgets and the actions entry available");
|
|
61
61
|
assert.match(css, /@media \(prefers-reduced-motion: reduce\)/, "reduced-motion behavior is required");
|
|
62
62
|
assert.match(css, /@media \(forced-colors: active\)/, "forced-color affordances are required");
|
|
63
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
63
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "browser asset changes need a coherent cache tuple");
|
|
64
64
|
|
|
65
65
|
console.log("mobile-phone-experience-static.test.mjs passed");
|
|
@@ -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-v142/, "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-v142"/, "changed browser assets should advance the PWA cache identity");
|
|
275
|
+
assert.match(html, /styles\.css\?v=143/, "the page should request the updated layout stylesheet revision");
|
|
276
|
+
assert.match(html, /data-app-src="\/app\.js\?v=175"/, "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]*--prompt-input-block-chrome: calc\(1\.8rem \+ 2px\);[\s\S]*max-height: calc\(6lh \+ var\(--prompt-input-block-chrome\)\);[\s\S]*overflow-y: auto;[\s\S]*overscroll-behavior-y: contain;/, "the prompt should show six complete lines before native vertical scrolling begins");
|
|
20
20
|
assert.match(resizePromptInput, /input\.style\.height = "auto";[\s\S]*borderTopWidth[\s\S]*borderBottomWidth[\s\S]*naturalHeight = input\.scrollHeight \+ borderBlock[\s\S]*isCapped \? "auto" : "hidden"/, "auto-resizing should include the textarea borders and enable vertical scrolling only after the six-line cap");
|
|
21
21
|
assert.doesNotMatch(resizePromptInput, /input\.style\.overflowY = "auto";/, "auto-resizing must not force a scrollbar below the six-line cap");
|
|
22
|
-
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=143/, "the page should request the six-line prompt stylesheet revision");
|
|
23
|
+
assert.match(html, /app\.js\?v=175/, "the page should request the current app revision");
|
|
24
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "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=143/, "questionnaire CSS needs the current stylesheet revision");
|
|
508
|
+
assert.match(html, /app\.js\?v=175/, "questionnaire behavior needs the current app revision");
|
|
509
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "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-v142"/, "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=143/, "the changed stylesheet should have a new revision");
|
|
63
|
+
assert.match(html, /app\.js\?v=175/, "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=143/, "removing section resize styles should advance the stylesheet revision");
|
|
31
|
+
assert.match(html, /app\.js\?v=175/, "removing section resize behavior should advance the app revision");
|
|
32
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "removing browser assets should advance the PWA cache identity");
|
|
33
33
|
|
|
34
34
|
console.log("side-panel-section-height-removal-static.test.mjs passed");
|
|
@@ -28,7 +28,7 @@ assert.match(app, /const SUBAGENT_ASYNC_WIDGET_KEY = "subagent-async"[\s\S]*case
|
|
|
28
28
|
assert.match(app, /for \(const \[key, value\] of widgets\)[\s\S]*if \(key === SUBAGENT_ASYNC_WIDGET_KEY\) continue;/, "stale cached async-status widgets should remain hidden defensively");
|
|
29
29
|
assert.match(css, /\.subagent-source-badge[\s\S]*text-overflow: ellipsis[\s\S]*@media \(max-width: 720px\)/, "source badges should remain compact and responsive");
|
|
30
30
|
assert.match(html, /Managed and registered Pi agent runs[\s\S]*External agents/, "help should explain managed, registered, and external groups");
|
|
31
|
-
assert.match(html, /styles\.css\?v=
|
|
32
|
-
assert.match(worker, /pi-webui-pwa-
|
|
31
|
+
assert.match(html, /styles\.css\?v=143[\s\S]*app\.js\?v=175/, "browser assets should use the current subagent-observability revisions");
|
|
32
|
+
assert.match(worker, /pi-webui-pwa-v142/, "PWA cache identity should advance with subagent widget suppression");
|
|
33
33
|
|
|
34
34
|
console.log("subagent-observability-static.test.mjs passed");
|
|
@@ -60,9 +60,9 @@ assert.match(css, /\.markdown-code \.syntax-comment \{[^}]*font-style: italic;/,
|
|
|
60
60
|
|
|
61
61
|
// --- Offline/PWA startup closure and coherent revisions ---
|
|
62
62
|
assert.match(serviceWorker, /"\/syntax-highlight\.mjs",/, "the eagerly imported tokenizer must be part of the offline app shell");
|
|
63
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
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-v142"/, "adding a startup module should advance the PWA cache identity");
|
|
64
|
+
assert.match(html, /styles\.css\?v=143/, "new token styles should advance the stylesheet revision");
|
|
65
|
+
assert.match(html, /data-app-src="\/app\.js\?v=175"/, "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")));
|
|
@@ -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-v142"/, "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");
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join, win32 } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const [app, html, styles, readme, technical, development, serviceWorker, server, packageJsonText] = await Promise.all([
|
|
8
|
+
readFile(join(root, "public", "app.js"), "utf8"),
|
|
9
|
+
readFile(join(root, "public", "index.html"), "utf8"),
|
|
10
|
+
readFile(join(root, "public", "styles.css"), "utf8"),
|
|
11
|
+
readFile(join(root, "README.md"), "utf8"),
|
|
12
|
+
readFile(join(root, "TECHNICAL.md"), "utf8"),
|
|
13
|
+
readFile(join(root, "DEVELOPMENT.md"), "utf8"),
|
|
14
|
+
readFile(join(root, "public", "service-worker.js"), "utf8"),
|
|
15
|
+
readFile(join(root, "bin", "pi-webui.mjs"), "utf8"),
|
|
16
|
+
readFile(join(root, "package.json"), "utf8"),
|
|
17
|
+
]);
|
|
18
|
+
const packageJson = JSON.parse(packageJsonText);
|
|
19
|
+
|
|
20
|
+
function sourceBetween(source, start, end) {
|
|
21
|
+
const startIndex = source.indexOf(start);
|
|
22
|
+
const endIndex = source.indexOf(end, startIndex + start.length);
|
|
23
|
+
assert.ok(startIndex >= 0 && endIndex > startIndex, `expected source block from ${start} to ${end}`);
|
|
24
|
+
return source.slice(startIndex, endIndex);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
assert.equal(win32.resolve("C:\\repo", "D:/"), "D:\\", "Node should treat a slash-form drive root as an absolute Windows cwd");
|
|
28
|
+
assert.match(html, /id="pathPickerPathInput"[^>]*placeholder="Path, e\.g\. C:\/ or D:\/project"[^>]*aria-label="Directory path"/, "the cwd picker should expose an accessible direct-path field with Windows drive examples");
|
|
29
|
+
assert.match(html, /id="pathPickerPathButton"[^>]*>Go<\/button>/, "the direct-path field should have an explicit Go action");
|
|
30
|
+
assert.match(app, /pathPickerPathInput: \$\("#pathPickerPathInput"\)[\s\S]*pathPickerPathButton: \$\("#pathPickerPathButton"\)/, "the browser should bind both direct-path controls");
|
|
31
|
+
|
|
32
|
+
const openEnteredPath = sourceBetween(app, "async function openPathPickerEnteredPath()", "function pathPickerCreateName()");
|
|
33
|
+
assert.match(openEnteredPath, /const cwd = pathPickerEnteredPath\(\)[\s\S]*await loadPathPickerDirectory\(cwd\)/, "direct paths should use the existing validated directory loader without rewriting drive-qualified input");
|
|
34
|
+
const renderPicker = sourceBetween(app, "function renderPathPicker(data)", "async function loadPathPickerDirectory(cwd, { focusAfterLoad = false } = {})");
|
|
35
|
+
assert.match(renderPicker, /pathPickerState\.selectable = data\.selectable !== false/, "the browser should default ordinary directories to selectable while honoring the virtual view contract");
|
|
36
|
+
assert.match(renderPicker, /pathPickerState\.displayCwd = data\.displayCwd \|\| pathPickerState\.cwd/, "the virtual This PC label should be retained independently of its empty cwd");
|
|
37
|
+
assert.match(renderPicker, /pathPickerChooseButton\.disabled = !pathPickerState\.selectable \|\| !pathPickerState\.cwd/, "Use this directory should stay disabled for the virtual view");
|
|
38
|
+
const searchControls = sourceBetween(app, "function updatePathPickerSearchControls()", "function pathPickerDirectoryMatchesSearch");
|
|
39
|
+
assert.match(searchControls, /pathPickerState\.selectable === false \|\| !!pathPickerState\.cwd/, "search should remain available in the non-selectable This PC view");
|
|
40
|
+
const createControls = sourceBetween(app, "function updateCreateDirectoryControls()", "function pathPickerSearchQuery()");
|
|
41
|
+
assert.match(createControls, /pathPickerState\.selectable !== false/, "directory creation should be gated by virtual-view selectability");
|
|
42
|
+
const currentFastPickBlock = sourceBetween(app, "function currentFastPick()", "function updateAddFastPickButton()");
|
|
43
|
+
assert.match(currentFastPickBlock, /pathPickerState\.selectable === false/, "the virtual view should not be pinnable");
|
|
44
|
+
const directoryList = sourceBetween(app, "function renderPathPickerDirectoryList()", "function clearPathPickerSearch");
|
|
45
|
+
assert.match(directoryList, /loadPathPickerDirectory\(directory\.cwd, \{ focusAfterLoad: true \}\)/, "clicking a listed drive should use the existing directory loader and restore stable focus");
|
|
46
|
+
assert.match(renderPicker, /loadPathPickerDirectory\(data\.parent, \{ focusAfterLoad: true \}\)/, "Parent navigation should restore focus after replacing its button");
|
|
47
|
+
const fastPicks = sourceBetween(app, "function renderFastPicks()", "async function addCurrentFastPick()");
|
|
48
|
+
assert.match(fastPicks, /loadPathPickerDirectory\(pick\.cwd, \{ focusAfterLoad: true \}\)/, "fast-pick navigation should restore focus after rerendering");
|
|
49
|
+
|
|
50
|
+
const loadDirectory = sourceBetween(app, "async function loadPathPickerDirectory(cwd, { focusAfterLoad = false } = {})", "async function createPathPickerDirectory()");
|
|
51
|
+
assert.match(loadDirectory, /encodeURIComponent\(cwd\)/, "drive-qualified paths and the internal Parent destination should be URL-encoded before the directory request");
|
|
52
|
+
assert.doesNotMatch(loadDirectory.slice(loadDirectory.indexOf("} catch (error)")), /pathPickerPathInput\.value\s*=/, "failed drive lookups should keep the entered path editable");
|
|
53
|
+
assert.match(loadDirectory, /pathPickerCurrent\.textContent = pathPickerState\.displayCwd \|\| pathPickerState\.cwd \|\| "Unable to load directory"/, "a failed drive load from This PC should restore the virtual display label");
|
|
54
|
+
assert.match(loadDirectory, /if \(focusAfterLoad\) elements\.pathPickerSearchInput\.focus\(\{ preventScroll: true \}\)/, "navigation-originated loads should restore focus to the stable search control");
|
|
55
|
+
assert.match(html, /id="pathPickerError"[^>]*role="alert"[^>]*hidden/, "directory load failures should be exposed through one dedicated live alert");
|
|
56
|
+
assert.match(app, /pathPickerPathInput\.addEventListener\("keydown"[\s\S]*event\.key !== "Enter"[\s\S]*openPathPickerEnteredPath\(\)/, "Enter should open the entered path");
|
|
57
|
+
assert.match(app, /pathPickerPathButton\.addEventListener\("click"[\s\S]*openPathPickerEnteredPath\(\)/, "the Go button should open the entered path");
|
|
58
|
+
assert.match(server, /platform\(\) === "win32" && isWindowsDriveRoot\(cwd\)[\s\S]*WINDOWS_DRIVES_PICKER_PATH/, "Parent from a Windows drive root should target the virtual This PC destination");
|
|
59
|
+
assert.match(server, /platform\(\) === "win32" && viewPath === WINDOWS_DRIVES_PICKER_PATH[\s\S]*getWindowsDrivesPickerData\(activeCwd\)/, "the virtual Parent destination should be intercepted only on Windows");
|
|
60
|
+
|
|
61
|
+
const splitFlow = sourceBetween(app, "async function splitTerminalTab", "async function createTerminalTabFromChosenDirectory");
|
|
62
|
+
assert.match(splitFlow, /pickCwd\([\s\S]*body: \{ cwd: resolvedCwd \}/, "split terminals without a cwd should use the shared drive-aware picker");
|
|
63
|
+
const newTabFlow = sourceBetween(app, "async function createTerminalTabFromChosenDirectory", "async function createFirstTerminalTabFromChosenDirectory");
|
|
64
|
+
assert.match(newTabFlow, /pickCwd\([\s\S]*createTerminalTab\(cwd/, "new terminal tabs should use the shared drive-aware picker");
|
|
65
|
+
const firstTabFlow = sourceBetween(app, "async function createFirstTerminalTabFromChosenDirectory", "function tabHasActiveAgent");
|
|
66
|
+
assert.match(firstTabFlow, /pickCwd\([\s\S]*createTerminalTab\(cwd/, "the first terminal should use the shared drive-aware picker");
|
|
67
|
+
const cwdChangeFlow = sourceBetween(app, "async function changeActiveTabCwd()", "function footerControlKey(node)");
|
|
68
|
+
assert.match(cwdChangeFlow, /await pickCwd\([\s\S]*method: "PATCH", body: \{ cwd \}/, "cwd changes should use the shared picker and pass its selected drive-qualified path to the existing tab route");
|
|
69
|
+
|
|
70
|
+
assert.match(styles, /\.path-picker-path-row[\s\S]*grid-template-columns: minmax\(0, 1fr\) auto/, "the direct-path controls should use the picker row layout");
|
|
71
|
+
assert.match(styles, /\.path-picker-current-row,[\s\S]*\.path-picker-path-row,[\s\S]*grid-template-columns: 1fr/, "the direct-path controls should stack on narrow screens");
|
|
72
|
+
assert.match(readme, /Windows[\s\S]*`C:\/`[\s\S]*`D:\/project`[\s\S]*\*\*Parent\*\*[\s\S]*\*\*This PC\*\*/, "the README should explain both typed paths and Parent-based Windows drive switching");
|
|
73
|
+
assert.match(technical, /working-directory picker accepts a direct path[\s\S]*\*\*Parent\*\* opens a \*\*This PC\*\*[\s\S]*navigation-only/i, "the technical reference should document the virtual drive view and its control limits");
|
|
74
|
+
assert.match(development, /virtual \*\*This PC\*\* response with an empty cwd and `selectable: false`/i, "the contributor guide should record the server/browser virtual-view contract");
|
|
75
|
+
assert.ok(packageJson.files.includes("TECHNICAL.md"), "the published package should include its advanced user reference");
|
|
76
|
+
assert.ok(packageJson.files.includes("DEVELOPMENT.md"), "the published package should include its contributor guide");
|
|
77
|
+
assert.match(html, /styles\.css\?v=143/, "the existing picker layout should retain its stylesheet revision");
|
|
78
|
+
assert.match(html, /app\.js\?v=175/, "the changed picker behavior should advance the app revision");
|
|
79
|
+
assert.match(serviceWorker, /pi-webui-pwa-v142/, "the changed browser assets should advance the PWA cache identity");
|
|
80
|
+
|
|
81
|
+
console.log("windows-drive-cwd-picker-static.test.mjs passed");
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import {
|
|
6
|
+
WINDOWS_DRIVES_PICKER_PATH,
|
|
7
|
+
WINDOWS_DRIVE_DISCOVERY_MAX_OUTPUT,
|
|
8
|
+
WINDOWS_DRIVE_DISCOVERY_TIMEOUT_MS,
|
|
9
|
+
createWindowsDriveRootDiscovery,
|
|
10
|
+
isWindowsDriveRoot,
|
|
11
|
+
mergeWindowsDriveRoots,
|
|
12
|
+
normalizeWindowsDriveRoot,
|
|
13
|
+
parseWindowsDriveRoots,
|
|
14
|
+
windowsDriveRootsFromKnownPaths,
|
|
15
|
+
windowsDrivesPickerData,
|
|
16
|
+
} from "../lib/windows-drive-roots.mjs";
|
|
17
|
+
|
|
18
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
19
|
+
|
|
20
|
+
assert.equal(normalizeWindowsDriveRoot("c:\\"), "C:\\");
|
|
21
|
+
assert.equal(normalizeWindowsDriveRoot("d:/"), "D:\\");
|
|
22
|
+
assert.equal(isWindowsDriveRoot("Z:\\"), true);
|
|
23
|
+
for (const invalid of ["C:", "C:project", "C:\\project", " C:\\", "C:\\\\", "\\\\server\\share\\", "/"] ) {
|
|
24
|
+
assert.equal(normalizeWindowsDriveRoot(invalid), null, `${JSON.stringify(invalid)} must not be accepted as a drive root`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
assert.deepEqual(
|
|
28
|
+
parseWindowsDriveRoots("D:\\\r\nc:/\r\ninvalid\r\nd:\\\r\n Z:\\\r\n"),
|
|
29
|
+
["C:\\", "D:\\"],
|
|
30
|
+
"PowerShell output should be parsed strictly, normalized, deduplicated, and sorted",
|
|
31
|
+
);
|
|
32
|
+
assert.deepEqual(
|
|
33
|
+
windowsDriveRootsFromKnownPaths(["d:\\project", "C:/Users/test", "e:", "e:relative", "/home/test", null]),
|
|
34
|
+
["C:\\", "D:\\", "E:\\"],
|
|
35
|
+
"known absolute paths and system drive designators should provide fallback roots",
|
|
36
|
+
);
|
|
37
|
+
assert.deepEqual(mergeWindowsDriveRoots(["z:/", "C:\\"], ["c:/", "D:\\"]), ["C:\\", "D:\\", "Z:\\"]);
|
|
38
|
+
|
|
39
|
+
const virtualData = windowsDrivesPickerData(["D:\\", "c:/", "bad"], [{ label: "Tab", cwd: "C:\\repo" }]);
|
|
40
|
+
assert.deepEqual(virtualData, {
|
|
41
|
+
cwd: "",
|
|
42
|
+
displayCwd: "This PC",
|
|
43
|
+
parent: null,
|
|
44
|
+
roots: [{ label: "Tab", cwd: "C:\\repo" }],
|
|
45
|
+
directories: [
|
|
46
|
+
{ name: "C:\\", cwd: "C:\\", displayCwd: "C:\\", hidden: false },
|
|
47
|
+
{ name: "D:\\", cwd: "D:\\", displayCwd: "D:\\", hidden: false },
|
|
48
|
+
],
|
|
49
|
+
truncated: false,
|
|
50
|
+
selectable: false,
|
|
51
|
+
});
|
|
52
|
+
assert.equal(WINDOWS_DRIVES_PICKER_PATH, "::pi-webui-windows-drives::");
|
|
53
|
+
|
|
54
|
+
let currentTime = 1_000;
|
|
55
|
+
const commandCalls = [];
|
|
56
|
+
const discover = createWindowsDriveRootDiscovery({
|
|
57
|
+
now: () => currentTime,
|
|
58
|
+
cacheTtlMs: 100,
|
|
59
|
+
runCommand: async (...args) => {
|
|
60
|
+
commandCalls.push(args);
|
|
61
|
+
return { exitCode: 0, timedOut: false, stdoutTruncated: false, stdout: "D:\\\r\nC:/\r\nmalformed\r\n" };
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
assert.deepEqual(await discover({ cwd: "C:\\repo", knownPaths: ["E:\\work"] }), ["C:\\", "D:\\", "E:\\"]);
|
|
66
|
+
assert.equal(commandCalls.length, 1);
|
|
67
|
+
assert.equal(commandCalls[0][0], "powershell.exe");
|
|
68
|
+
assert.deepEqual(commandCalls[0][1].slice(0, 4), ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command"]);
|
|
69
|
+
assert.match(commandCalls[0][1][4], /\[System\.IO\.DriveInfo\]::GetDrives\(\)/);
|
|
70
|
+
assert.match(commandCalls[0][1][4], /\.IsReady/);
|
|
71
|
+
assert.deepEqual(commandCalls[0][2], {
|
|
72
|
+
cwd: "C:\\repo",
|
|
73
|
+
timeoutMs: WINDOWS_DRIVE_DISCOVERY_TIMEOUT_MS,
|
|
74
|
+
maxOutputLength: WINDOWS_DRIVE_DISCOVERY_MAX_OUTPUT,
|
|
75
|
+
utf8Output: true,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
assert.deepEqual(
|
|
79
|
+
await discover({ cwd: "C:\\other", knownPaths: ["F:"] }),
|
|
80
|
+
["C:\\", "D:\\", "F:\\"],
|
|
81
|
+
"cached discovery should merge fresh known roots without rerunning PowerShell",
|
|
82
|
+
);
|
|
83
|
+
assert.equal(commandCalls.length, 1);
|
|
84
|
+
currentTime += 101;
|
|
85
|
+
await discover({ cwd: "C:\\other" });
|
|
86
|
+
assert.equal(commandCalls.length, 2, "expired discovery should rerun PowerShell");
|
|
87
|
+
|
|
88
|
+
let releaseConcurrent;
|
|
89
|
+
let concurrentCalls = 0;
|
|
90
|
+
const concurrent = createWindowsDriveRootDiscovery({
|
|
91
|
+
runCommand: async () => {
|
|
92
|
+
concurrentCalls += 1;
|
|
93
|
+
await new Promise((resolve) => { releaseConcurrent = resolve; });
|
|
94
|
+
return { exitCode: 0, timedOut: false, stdoutTruncated: false, stdout: "G:\\\n" };
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
const firstConcurrent = concurrent({ knownPaths: ["C:\\repo"] });
|
|
98
|
+
const secondConcurrent = concurrent({ knownPaths: ["D:\\repo"] });
|
|
99
|
+
releaseConcurrent();
|
|
100
|
+
assert.deepEqual(await firstConcurrent, ["C:\\", "G:\\"]);
|
|
101
|
+
assert.deepEqual(await secondConcurrent, ["D:\\", "G:\\"]);
|
|
102
|
+
assert.equal(concurrentCalls, 1, "concurrent picker requests should share one PowerShell process");
|
|
103
|
+
|
|
104
|
+
for (const failedResult of [
|
|
105
|
+
{ exitCode: 1, timedOut: false, stdout: "Z:\\\n" },
|
|
106
|
+
{ exitCode: undefined, timedOut: true, stdout: "Z:\\\n" },
|
|
107
|
+
{ exitCode: 0, timedOut: false, stdoutTruncated: true, stdout: "Z:\\\n" },
|
|
108
|
+
]) {
|
|
109
|
+
const failedDiscovery = createWindowsDriveRootDiscovery({ runCommand: async () => failedResult });
|
|
110
|
+
assert.deepEqual(await failedDiscovery({ knownPaths: ["C:\\repo", "D:"] }), ["C:\\", "D:\\"]);
|
|
111
|
+
}
|
|
112
|
+
const throwingDiscovery = createWindowsDriveRootDiscovery({ runCommand: async () => { throw new Error("unavailable"); } });
|
|
113
|
+
assert.deepEqual(await throwingDiscovery({ knownPaths: ["C:\\repo"] }), ["C:\\"]);
|
|
114
|
+
|
|
115
|
+
const serverSource = await readFile(join(root, "bin", "pi-webui.mjs"), "utf8");
|
|
116
|
+
assert.match(serverSource, /platform\(\) === "win32" && viewPath === WINDOWS_DRIVES_PICKER_PATH[\s\S]*return getWindowsDrivesPickerData\(activeCwd\)/, "the sentinel must be intercepted only on Windows before cwd resolution");
|
|
117
|
+
assert.match(serverSource, /platform\(\) === "win32" && isWindowsDriveRoot\(cwd\)[\s\S]*\? WINDOWS_DRIVES_PICKER_PATH/, "Windows drive roots should route Parent to the virtual picker");
|
|
118
|
+
assert.match(serverSource, /windowsDrivesPickerData\(driveRoots, pathPickerRoots\(activeCwd, activeCwd\)\)/, "the server should return the tested non-selectable virtual payload");
|
|
119
|
+
assert.match(
|
|
120
|
+
serverSource,
|
|
121
|
+
/function windowsDriveDiscoveryCwd\(\) \{[\s\S]*process\.env\.SystemRoot \|\| process\.env\.WINDIR \|\| path\.dirname\(process\.execPath\)[\s\S]*cwd: windowsDriveDiscoveryCwd\(\)/,
|
|
122
|
+
"drive discovery should launch from a stable Windows system or executable directory rather than the active drive",
|
|
123
|
+
);
|
|
124
|
+
assert.doesNotMatch(
|
|
125
|
+
serverSource,
|
|
126
|
+
/discoverWindowsDriveRoots\(\{\s*cwd: activeCwd/,
|
|
127
|
+
"a removable active cwd must not be used as the PowerShell process cwd",
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
console.log("windows-drive-roots.test.mjs passed");
|