@firstpick/pi-package-webui 0.6.0 → 0.6.2

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/public/index.html CHANGED
@@ -12,7 +12,7 @@
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
14
14
  <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
15
- <link rel="stylesheet" href="/styles.css?v=62" />
15
+ <link rel="stylesheet" href="/styles.css?v=63" />
16
16
  </head>
17
17
  <body>
18
18
  <button id="sidePanelExpandButton" class="side-panel-expand-button" type="button" aria-controls="sidePanel" aria-expanded="false" aria-label="Expand side panel" title="Expand side panel">
@@ -73,6 +73,7 @@
73
73
  </div>
74
74
  </div>
75
75
  </div>
76
+ <button id="splitTabButton" class="terminal-split-button" type="button" aria-label="Split the active terminal to the right" aria-pressed="false"><svg class="terminal-split-icon terminal-split-icon-split" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="4" y="5" width="16" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 5v14M15 12h4m0 0-2-2m2 2-2 2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg><svg class="terminal-split-icon terminal-split-icon-unsplit" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="4" y="5" width="16" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 5v14M19 12h-4m0 0 2-2m-2 2 2 2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
76
77
  <button id="commandPaletteButton" class="terminal-command-palette-button" type="button" aria-label="Open command palette" data-tooltip="Command palette:&#10;• Search and run actions, slash commands, models, and tabs.&#10;• Shortcut: Ctrl/Cmd+K."><svg class="composer-icon command-palette-launcher-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 7.5h14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M5 12h9" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M5 16.5h5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M17 14.5 19.5 17 17 19.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
77
78
  <button id="workspaceDashboardToggleButton" class="terminal-dashboard-button" type="button" aria-controls="workspaceDashboard" aria-expanded="false" aria-label="Show workspace overview" data-tooltip="Workspace overview:&#10;• Shows current tab, cwd, model, context, session, and queue.&#10;• Opens common workspace/session actions from one place."><svg class="composer-icon workspace-overview-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 11.4 12 4l8 7.4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M6.5 10.5V20h11v-9.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 20v-5h4v5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
78
79
  <button id="closeAllTabsButton" class="terminal-close-all-button" type="button" aria-label="Close all terminal tabs">Close all Tabs</button>
@@ -318,6 +319,18 @@
318
319
  </div>
319
320
  </section>
320
321
 
322
+ <section id="terminalSplitShell" class="terminal-split-shell" aria-label="Split terminal" hidden>
323
+ <header class="terminal-split-toolbar">
324
+ <div class="terminal-split-heading">
325
+ <span class="terminal-split-kicker">Split terminal</span>
326
+ <strong id="terminalSplitTitle">Independent terminal</strong>
327
+ <span id="terminalSplitMeta" class="terminal-split-meta muted"></span>
328
+ </div>
329
+ <button id="terminalSplitCloseButton" class="terminal-split-close-button" type="button" aria-label="Close split terminal view">Close split</button>
330
+ </header>
331
+ <iframe id="terminalSplitFrame" class="terminal-split-frame" title="Independent split terminal"></iframe>
332
+ </section>
333
+
321
334
  <button id="sidePanelBackdrop" class="side-panel-backdrop" type="button" aria-label="Close side panel" hidden></button>
322
335
  <aside id="sidePanel" class="side-panel">
323
336
  <div class="side-panel-header">
@@ -385,6 +398,11 @@
385
398
  </div>
386
399
  <div class="control-field">
387
400
  <label for="themeSelect" id="themeControlLabel" title="Open or close theme search" tabindex="0">Theme</label>
401
+ <div id="themeSchemeToggle" class="theme-scheme-toggle" role="group" aria-label="Theme mode">
402
+ <button type="button" data-scheme-mode="light" aria-pressed="false" title="Always use your light theme">Light</button>
403
+ <button type="button" data-scheme-mode="dark" aria-pressed="false" title="Always use your dark theme">Dark</button>
404
+ <button type="button" data-scheme-mode="auto" aria-pressed="false" title="Follow your system light/dark setting">Auto</button>
405
+ </div>
388
406
  <input id="themeSearchInput" class="model-search-input theme-search-input" type="search" placeholder="Search themes…" autocomplete="off" spellcheck="false" hidden />
389
407
  <select id="themeSelect" title="Theme"></select>
390
408
  <div id="themeSearchResults" class="model-search-results theme-search-results" role="listbox" aria-label="Theme search results" hidden></div>
@@ -762,6 +780,6 @@
762
780
  </form>
763
781
  </dialog>
764
782
 
765
- <script type="module" src="/app.js?v=60"></script>
783
+ <script type="module" src="/app.js?v=62"></script>
766
784
  </body>
767
785
  </html>
package/public/styles.css CHANGED
@@ -309,6 +309,12 @@ textarea::placeholder { color: rgba(var(--ctp-subtext-rgb), 0.62); }
309
309
  body.side-panel-collapsed .layout {
310
310
  grid-template-columns: minmax(0, 1fr);
311
311
  }
312
+ body.terminal-split-open .layout {
313
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(20rem, 24rem);
314
+ }
315
+ body.terminal-split-open.side-panel-collapsed .layout {
316
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
317
+ }
312
318
  body.side-panel-collapsed .side-panel {
313
319
  display: none;
314
320
  }
@@ -617,6 +623,112 @@ body.side-panel-collapsed .terminal-tabs-shell {
617
623
  height: 100%;
618
624
  min-height: 0;
619
625
  }
626
+ .terminal-split-shell {
627
+ position: relative;
628
+ display: flex;
629
+ flex-direction: column;
630
+ min-width: 0;
631
+ min-height: 0;
632
+ height: 100%;
633
+ overflow: hidden;
634
+ border: 1px solid rgba(148, 226, 213, 0.22);
635
+ border-radius: 1.1rem;
636
+ background: var(--panel-gradient);
637
+ box-shadow: 0 1rem 3rem var(--shadow), 0 0 2rem rgba(148, 226, 213, 0.10), inset 0 1px 0 rgba(255,255,255,0.06);
638
+ }
639
+ .terminal-split-shell[hidden] {
640
+ display: none !important;
641
+ }
642
+ .terminal-split-toolbar {
643
+ flex: 0 0 auto;
644
+ display: flex;
645
+ align-items: center;
646
+ justify-content: space-between;
647
+ gap: 0.75rem;
648
+ min-width: 0;
649
+ padding: 0.58rem 0.72rem;
650
+ border-bottom: 1px solid rgba(180, 190, 254, 0.16);
651
+ background:
652
+ linear-gradient(90deg, rgba(var(--ctp-crust-rgb), 0.96), rgba(var(--ctp-base-rgb), 0.82), rgba(var(--ctp-mantle-rgb), 0.92)),
653
+ radial-gradient(circle at 0% 0%, rgba(148, 226, 213, 0.14), transparent 16rem);
654
+ box-shadow: inset 0 -1px 0 rgba(255,255,255,0.035), 0 0.45rem 1rem rgba(var(--ctp-crust-rgb), 0.18);
655
+ }
656
+ .terminal-split-heading {
657
+ display: grid;
658
+ gap: 0.08rem;
659
+ min-width: 0;
660
+ }
661
+ .terminal-split-kicker {
662
+ color: var(--ctp-teal);
663
+ font-size: 0.62rem;
664
+ font-weight: 900;
665
+ letter-spacing: 0.12em;
666
+ text-transform: uppercase;
667
+ }
668
+ .terminal-split-heading strong,
669
+ .terminal-split-meta {
670
+ min-width: 0;
671
+ overflow: hidden;
672
+ text-overflow: ellipsis;
673
+ white-space: nowrap;
674
+ }
675
+ .terminal-split-heading strong {
676
+ color: var(--ctp-text);
677
+ font-size: 0.86rem;
678
+ }
679
+ .terminal-split-meta {
680
+ max-width: min(30rem, 42vw);
681
+ color: rgba(var(--ctp-subtext-rgb), 0.68);
682
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
683
+ font-size: 0.66rem;
684
+ }
685
+ .terminal-split-close-button {
686
+ flex: 0 0 auto;
687
+ min-height: 2.2rem;
688
+ padding: 0.34rem 0.64rem;
689
+ color: var(--ctp-teal);
690
+ white-space: nowrap;
691
+ border-color: rgba(148, 226, 213, 0.34);
692
+ background:
693
+ linear-gradient(120deg, rgba(148, 226, 213, 0.13), rgba(137, 180, 250, 0.08)),
694
+ rgba(var(--ctp-crust-rgb), 0.62);
695
+ }
696
+ .terminal-split-close-button:hover,
697
+ .terminal-split-close-button:focus-visible {
698
+ color: #11111b;
699
+ border-color: transparent;
700
+ background: linear-gradient(120deg, var(--ctp-teal), var(--ctp-blue));
701
+ }
702
+ .terminal-split-frame {
703
+ flex: 1 1 auto;
704
+ min-width: 0;
705
+ min-height: 0;
706
+ width: 100%;
707
+ border: 0;
708
+ background: var(--ctp-crust);
709
+ }
710
+ body.embedded-split .layout,
711
+ body.embedded-split.side-panel-collapsed .layout {
712
+ grid-template-columns: minmax(0, 1fr);
713
+ gap: 0;
714
+ width: 100%;
715
+ height: 100vh;
716
+ height: var(--visual-viewport-height, 100dvh);
717
+ min-height: 0;
718
+ padding: 0;
719
+ overflow: hidden;
720
+ }
721
+ body.embedded-split .chat-panel {
722
+ height: 100%;
723
+ border-radius: 0;
724
+ }
725
+ body.embedded-split .terminal-tabs-shell,
726
+ body.embedded-split .terminal-split-shell,
727
+ body.embedded-split .side-panel,
728
+ body.embedded-split .side-panel-expand-button,
729
+ body.embedded-split .side-panel-backdrop {
730
+ display: none !important;
731
+ }
620
732
  .side-panel {
621
733
  display: grid;
622
734
  grid-template-rows: auto minmax(0, 1fr);
@@ -835,6 +947,40 @@ body.side-panel-collapsed .terminal-tabs-shell {
835
947
  width: 100%;
836
948
  min-width: 0;
837
949
  }
950
+ .theme-scheme-toggle {
951
+ display: flex;
952
+ gap: 2px;
953
+ padding: 2px;
954
+ border: 1px solid var(--border);
955
+ border-radius: 8px;
956
+ background: var(--panel-2);
957
+ }
958
+ .theme-scheme-toggle button {
959
+ flex: 1 1 0;
960
+ width: auto;
961
+ padding: 0.2rem 0.4rem;
962
+ border: 0;
963
+ border-radius: 6px;
964
+ background: transparent;
965
+ color: rgba(var(--ctp-text-rgb), 0.72);
966
+ font-size: 0.72rem;
967
+ font-weight: 800;
968
+ letter-spacing: 0.04em;
969
+ cursor: pointer;
970
+ transition: background 0.15s ease, color 0.15s ease;
971
+ }
972
+ .theme-scheme-toggle button:hover {
973
+ color: var(--text);
974
+ }
975
+ .theme-scheme-toggle button.active {
976
+ background: var(--panel);
977
+ color: var(--text);
978
+ box-shadow: inset 0 0 0 1px var(--accent);
979
+ }
980
+ .theme-scheme-toggle button:focus-visible {
981
+ outline: 2px solid var(--accent-2);
982
+ outline-offset: 1px;
983
+ }
838
984
  .model-search-input {
839
985
  padding: 0.5rem 0.7rem;
840
986
  border-color: rgba(148, 226, 213, 0.34);
@@ -894,6 +1040,35 @@ body.side-panel-collapsed .terminal-tabs-shell {
894
1040
  min-height: 2.25rem;
895
1041
  padding: 0.36rem 0.58rem;
896
1042
  }
1043
+ .theme-search-result-title {
1044
+ display: grid;
1045
+ grid-template-columns: minmax(0, 1fr) auto;
1046
+ gap: 0.5rem;
1047
+ align-items: center;
1048
+ }
1049
+ .theme-search-result-scheme {
1050
+ justify-self: end;
1051
+ padding: 0.08rem 0.42rem;
1052
+ border: 1px solid rgba(var(--ctp-subtext-rgb), 0.22);
1053
+ border-radius: 999px;
1054
+ color: rgba(var(--ctp-subtext-rgb), 0.78);
1055
+ background: rgba(var(--ctp-surface-rgb), 0.36);
1056
+ font-size: 0.66rem;
1057
+ font-weight: 900;
1058
+ letter-spacing: 0.03em;
1059
+ line-height: 1.2;
1060
+ text-transform: uppercase;
1061
+ }
1062
+ .theme-search-result-scheme.light {
1063
+ color: #f9e2af;
1064
+ border-color: rgba(249, 226, 175, 0.36);
1065
+ background: rgba(249, 226, 175, 0.12);
1066
+ }
1067
+ .theme-search-result-scheme.dark {
1068
+ color: #89b4fa;
1069
+ border-color: rgba(137, 180, 250, 0.34);
1070
+ background: rgba(137, 180, 250, 0.12);
1071
+ }
897
1072
  .background-input {
898
1073
  position: absolute;
899
1074
  width: 1px;
@@ -1263,6 +1438,37 @@ body.side-panel-collapsed .terminal-tabs-shell {
1263
1438
  .optional-feature-row.missing {
1264
1439
  border-color: rgba(243, 139, 168, 0.25);
1265
1440
  }
1441
+ .optional-feature-row.failed {
1442
+ border-color: rgba(243, 139, 168, 0.42);
1443
+ background:
1444
+ linear-gradient(135deg, rgba(243, 139, 168, 0.08), rgba(var(--ctp-crust-rgb), 0.58)),
1445
+ rgba(var(--ctp-crust-rgb), 0.55);
1446
+ }
1447
+ .optional-feature-panel-notice {
1448
+ display: grid;
1449
+ grid-template-columns: minmax(0, 1fr) auto;
1450
+ gap: 0.62rem;
1451
+ align-items: center;
1452
+ padding: 0.62rem;
1453
+ border: 1px solid rgba(249, 226, 175, 0.22);
1454
+ border-radius: 0.72rem;
1455
+ background: rgba(var(--ctp-surface-rgb), 0.34);
1456
+ }
1457
+ .optional-feature-panel-notice.error {
1458
+ border-color: rgba(243, 139, 168, 0.32);
1459
+ }
1460
+ .optional-feature-panel-notice-copy {
1461
+ display: grid;
1462
+ gap: 0.18rem;
1463
+ min-width: 0;
1464
+ color: rgba(var(--ctp-subtext-rgb), 0.78);
1465
+ font-size: 0.72rem;
1466
+ line-height: 1.35;
1467
+ }
1468
+ .optional-feature-panel-notice-copy strong {
1469
+ color: var(--ctp-red);
1470
+ font-size: 0.76rem;
1471
+ }
1266
1472
  .optional-feature-main {
1267
1473
  display: grid;
1268
1474
  gap: 0.28rem;
@@ -1309,16 +1515,73 @@ body.side-panel-collapsed .terminal-tabs-shell {
1309
1515
  color: var(--ctp-peach);
1310
1516
  border-color: rgba(250, 179, 135, 0.34);
1311
1517
  }
1312
- .optional-feature-pill.missing {
1518
+ .optional-feature-pill.missing,
1519
+ .optional-feature-pill.failed {
1313
1520
  color: var(--ctp-red);
1314
1521
  border-color: rgba(243, 139, 168, 0.32);
1315
1522
  }
1316
1523
  .optional-feature-detail,
1317
- .optional-feature-description {
1524
+ .optional-feature-description,
1525
+ .optional-feature-hint {
1318
1526
  color: rgba(var(--ctp-subtext-rgb), 0.74);
1319
1527
  font-size: 0.72rem;
1320
1528
  line-height: 1.35;
1321
1529
  }
1530
+ .optional-feature-detail.error {
1531
+ color: var(--ctp-red);
1532
+ font-weight: 800;
1533
+ }
1534
+ .optional-feature-hint {
1535
+ color: var(--ctp-yellow);
1536
+ }
1537
+ .optional-feature-progress {
1538
+ overflow: hidden;
1539
+ height: 0.34rem;
1540
+ border: 1px solid rgba(250, 179, 135, 0.20);
1541
+ border-radius: 999px;
1542
+ background: rgba(var(--ctp-surface-rgb), 0.32);
1543
+ }
1544
+ .optional-feature-progress span {
1545
+ display: block;
1546
+ width: 42%;
1547
+ height: 100%;
1548
+ border-radius: inherit;
1549
+ background: linear-gradient(90deg, var(--ctp-yellow), var(--ctp-peach), var(--ctp-mauve));
1550
+ box-shadow: 0 0 0.75rem rgba(250, 179, 135, 0.28);
1551
+ animation: optional-feature-progress 1.2s ease-in-out infinite;
1552
+ }
1553
+ @keyframes optional-feature-progress {
1554
+ 0% { transform: translateX(-115%); }
1555
+ 50% { transform: translateX(70%); }
1556
+ 100% { transform: translateX(240%); }
1557
+ }
1558
+ .optional-feature-command {
1559
+ max-width: 100%;
1560
+ overflow-x: auto;
1561
+ padding: 0.34rem 0.42rem;
1562
+ border: 1px solid rgba(180, 190, 254, 0.14);
1563
+ border-radius: 0.48rem;
1564
+ background: rgba(var(--ctp-base-rgb), 0.36);
1565
+ }
1566
+ .optional-feature-command code {
1567
+ color: rgba(var(--ctp-teal-rgb), 0.92);
1568
+ font-size: 0.66rem;
1569
+ white-space: pre;
1570
+ }
1571
+ .optional-feature-error-output {
1572
+ max-height: 8rem;
1573
+ max-width: 100%;
1574
+ overflow: auto;
1575
+ margin: 0;
1576
+ padding: 0.46rem 0.52rem;
1577
+ border: 1px solid rgba(243, 139, 168, 0.20);
1578
+ border-radius: 0.52rem;
1579
+ color: rgba(var(--ctp-text-rgb), 0.86);
1580
+ background: rgba(var(--ctp-base-rgb), 0.42);
1581
+ font-size: 0.66rem;
1582
+ line-height: 1.35;
1583
+ white-space: pre-wrap;
1584
+ }
1322
1585
  .optional-feature-package {
1323
1586
  width: fit-content;
1324
1587
  max-width: 100%;
@@ -1371,6 +1634,44 @@ body.side-panel-collapsed .terminal-tabs-shell {
1371
1634
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.035), 0 0.45rem 1rem rgba(var(--ctp-crust-rgb), 0.20);
1372
1635
  }
1373
1636
  .terminal-tabs-toggle-button { display: none; }
1637
+ .terminal-split-button {
1638
+ flex: 0 0 auto;
1639
+ display: inline-grid;
1640
+ place-items: center;
1641
+ width: 2.5rem;
1642
+ min-width: 2.5rem;
1643
+ min-height: 2.35rem;
1644
+ padding: 0.38rem;
1645
+ color: var(--ctp-blue);
1646
+ white-space: nowrap;
1647
+ border-color: rgba(137, 180, 250, 0.32);
1648
+ background:
1649
+ linear-gradient(120deg, rgba(137, 180, 250, 0.12), rgba(148, 226, 213, 0.08)),
1650
+ rgba(var(--ctp-crust-rgb), 0.62);
1651
+ }
1652
+ .terminal-split-button[aria-pressed="true"] {
1653
+ color: var(--ctp-teal);
1654
+ border-color: rgba(148, 226, 213, 0.48);
1655
+ box-shadow: 0 0 1rem rgba(148, 226, 213, 0.16), inset 0 1px 0 rgba(255,255,255,0.05);
1656
+ }
1657
+ .terminal-split-button:hover,
1658
+ .terminal-split-button:focus-visible {
1659
+ color: #11111b;
1660
+ border-color: transparent;
1661
+ background: linear-gradient(120deg, var(--ctp-blue), var(--ctp-teal));
1662
+ }
1663
+ .terminal-split-icon {
1664
+ display: block;
1665
+ width: 1.18rem;
1666
+ height: 1.18rem;
1667
+ }
1668
+ .terminal-split-icon-unsplit,
1669
+ .terminal-split-button[aria-pressed="true"] .terminal-split-icon-split {
1670
+ display: none;
1671
+ }
1672
+ .terminal-split-button[aria-pressed="true"] .terminal-split-icon-unsplit {
1673
+ display: block;
1674
+ }
1374
1675
  .terminal-close-all-button {
1375
1676
  flex: 0 0 auto;
1376
1677
  min-height: 2.35rem;
@@ -1941,6 +2242,10 @@ body.side-panel-collapsed .terminal-tabs-shell {
1941
2242
  justify-content: flex-start;
1942
2243
  text-align: left;
1943
2244
  }
2245
+ body.terminal-tabs-left .terminal-split-button {
2246
+ width: 100%;
2247
+ min-width: 0;
2248
+ }
1944
2249
  body.terminal-tabs-left .terminal-new-tab-menu .composer-publish-menu-panel {
1945
2250
  --terminal-left-dropdown-bridge: 0.78rem;
1946
2251
  inset: 0 auto auto 100%;
@@ -5930,6 +6235,11 @@ button.composer-skill-tag:focus-visible {
5930
6235
  display: none !important;
5931
6236
  opacity: 0 !important;
5932
6237
  }
6238
+ .composer-publish-menu-panel .composer-publish-menu-item[data-tooltip]::before,
6239
+ .composer-publish-menu-panel .composer-publish-menu-item[data-tooltip]::after {
6240
+ display: none !important;
6241
+ opacity: 0 !important;
6242
+ }
5933
6243
 
5934
6244
  .details {
5935
6245
  display: grid;
@@ -7665,6 +7975,10 @@ button.composer-skill-tag:focus-visible {
7665
7975
  min-height: 0;
7666
7976
  max-height: calc(var(--visual-viewport-height, 100dvh) - 2rem);
7667
7977
  }
7978
+ .terminal-split-shell,
7979
+ .terminal-split-button {
7980
+ display: none !important;
7981
+ }
7668
7982
  .chat { flex-basis: 0; }
7669
7983
  body:not(.side-panel-collapsed) { overflow: hidden; }
7670
7984
  body:not(.side-panel-collapsed) .chat-panel {
@@ -514,11 +514,13 @@ assert.match(server, /url\.pathname === "\/api\/restart" && req\.method === "POS
514
514
  assert.match(server, /PI_WEBUI_RESTORE_TABS: JSON\.stringify\(restorableTabs \|\| \[\]\)/, "server restart should preserve restorable tab metadata");
515
515
  assert.match(server, /if \(webuiDevServer\) env\.PI_WEBUI_DEV = "1";/, "server restart should explicitly preserve dev mode");
516
516
  assert.match(server, /const updateArgs = all \? \["update", "--all"\] : \["update"\]/, "server update should use pi update by default and pi update --all for package-inclusive updates");
517
- assert.match(server, /async function resolveUpdateTasks\(\{ all = false \} = \{\}\)[\s\S]*await resolvePiUpdateCommand\(\{ all \}\)/, "server update should resolve a single Pi update command with the selected all mode");
517
+ assert.match(server, /async function resolveUpdateTasks\(\{ all = false \} = \{\}\)[\s\S]*if \(!all\) return uniqueUpdateTasks\(\[piTask\]\)[\s\S]*currentWebuiPackageUpdateTask\(\)[\s\S]*agentPackageRootUpdateTask\(\)[\s\S]*projectPackageRootUpdateTasks\(\)[\s\S]*npmGlobalPackageRootUpdateTask\(\)[\s\S]*bunGlobalPackageRootUpdateTask\(\)/, "server all-update should run pi update plus detected local/global Pi package root tasks");
518
+ assert.match(server, /const UPDATE_PACKAGE_NAMES = \[\.\.\.new Set\(\[[\s\S]*WEBUI_CONTROLLED_PACKAGES[\s\S]*OPTIONAL_FEATURE_PACKAGES\.values\(\)/, "package-inclusive updates should include Web UI controlled Optional Feature packages");
518
519
  assert.match(app, /const command = all \? "pi update --all" : "pi update"/, "frontend update confirmation should describe self-only and all update commands");
520
+ assert.match(app, /Optional Features, and detected Pi package roots/, "frontend all-update confirmation should describe optional-feature and detected-root coverage");
519
521
  assert.match(app, /api\(all \? "\/api\/update\?all=1" : "\/api\/update"/, "frontend all update should call the explicit all-mode endpoint");
520
522
  assert.match(html, /<option value="update-all">Update Pi \+ Packages &amp; Restart<\/option>/, "side panel should expose pi update --all as a separate server action");
521
- assert.match(readme, /`pi update` for Pi-only updates[\s\S]*`pi update --all` for Pi plus configured packages/, "README should document self-only and all update modes");
523
+ assert.match(readme, /`pi update` for Pi-only updates[\s\S]*`pi update --all` plus detected Web UI\/Optional Feature package-root updates/, "README should document self-only and expanded all update modes");
522
524
  assert.match(server, /async function closeNetworkAccess\(\)/, "server should expose a local-only rebind helper for closing network access");
523
525
  assert.match(server, /url\.pathname === "\/api\/network\/close" && req\.method === "POST"/, "server should route network close requests");
524
526
  assert.match(server, /server\.closeAllConnections\?\.\(\)/, "network rebind should force-close long-lived clients so close-to-localhost can complete");
@@ -0,0 +1,132 @@
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
+
6
+ // Static guard for the Light / Dark / Auto theme scheme switch: the picker stores
7
+ // theme picks in the matching light/dark slot, "auto" follows the OS prefers-color-scheme,
8
+ // and existing users keep their theme (auto is opt-in). This locks the wiring across
9
+ // app.js / index.html / styles.css, including the persistence rules: theme names are
10
+ // only stored after a pick was validated and applied, never from degraded loads.
11
+
12
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..");
13
+ const app = await readFile(join(root, "public", "app.js"), "utf8");
14
+ const html = await readFile(join(root, "public", "index.html"), "utf8");
15
+ const css = await readFile(join(root, "public", "styles.css"), "utf8");
16
+
17
+ // ── app.js: state, storage, and scheme resolution ────────────────────────────
18
+ for (const decl of [
19
+ 'const THEME_MODE_STORAGE_KEY = "pi-webui-theme-mode"',
20
+ 'const THEME_LIGHT_STORAGE_KEY = "pi-webui-theme-light"',
21
+ 'const THEME_DARK_STORAGE_KEY = "pi-webui-theme-dark"',
22
+ 'const THEME_SCHEME_MODES = new Set(["light", "dark", "auto"])',
23
+ 'window.matchMedia?.("(prefers-color-scheme: dark)")',
24
+ ]) {
25
+ assert.ok(app.includes(decl), `app.js should declare: ${decl}`);
26
+ }
27
+
28
+ for (const fn of [
29
+ "function osPrefersDark(",
30
+ "function effectiveScheme(",
31
+ "function effectiveThemeName(",
32
+ "function renderThemeSchemeToggle(",
33
+ "async function applySchemeTheme(",
34
+ "async function chooseTheme(",
35
+ "function handleOsSchemeChange(",
36
+ "function updateColorSchemeListener(",
37
+ "async function setThemeSchemeMode(",
38
+ "function seedThemeSchemeFromStoredTheme(",
39
+ "function storedThemeMode(",
40
+ "function storedSchemeTheme(",
41
+ ]) {
42
+ assert.ok(app.includes(fn), `app.js should define ${fn.replace(/\($/, "")}`);
43
+ }
44
+
45
+ // Auto follows the OS only while the auto mode is active.
46
+ assert.match(
47
+ app,
48
+ /function updateColorSchemeListener\(\)[\s\S]*?addEventListener\("change", handleOsSchemeChange\)/,
49
+ "auto mode should attach an OS prefers-color-scheme listener",
50
+ );
51
+ assert.match(
52
+ app,
53
+ /function handleOsSchemeChange\(\)\s*\{\s*if \(themeSchemeMode !== "auto"\) return;/,
54
+ "OS listener must be a no-op outside auto mode",
55
+ );
56
+
57
+ // Existing users keep their theme: migration seeds the matching slot, mode is the
58
+ // stored theme's own scheme (never forced to auto).
59
+ assert.match(
60
+ app,
61
+ /themeSchemeMode = storedThemeMode\(\) \?\? seedThemeSchemeFromStoredTheme\(\)/,
62
+ "init should reuse a stored mode or migrate the existing theme",
63
+ );
64
+ assert.ok(
65
+ !/seedThemeSchemeFromStoredTheme[\s\S]*?return "auto"/.test(app),
66
+ "migration must not default existing users to auto",
67
+ );
68
+ assert.match(
69
+ app,
70
+ /function seedThemeSchemeFromStoredTheme\(\)[\s\S]*?if \(!storedTheme\) return "dark";[\s\S]*?storeThemeMode\(scheme\);/,
71
+ "migration must not persist mode or slots when the stored theme is unresolvable (degraded bundle load)",
72
+ );
73
+
74
+ // Persistence lives inside applyTheme's validated persist branch (matching light/dark
75
+ // scheme slot + legacy key), reached only after setThemeByName found and classified
76
+ // the theme. chooseTheme is the single persist:true entry point; applySchemeTheme
77
+ // (init, mode switches, OS changes) never persists, so a degraded bundle load cannot
78
+ // clobber stored picks.
79
+ assert.match(
80
+ app,
81
+ /if \(persist\) \{\s*storeSchemeTheme\(isLight \? "light" : "dark", theme\.name\);\s*storeThemeName\(theme\.name\);\s*\}/,
82
+ "applyTheme's persist branch must write the theme's matching scheme slot and the legacy key",
83
+ );
84
+ assert.equal(
85
+ (app.match(/persist: true/g) || []).length,
86
+ 1,
87
+ "chooseTheme must be the only persist:true call site",
88
+ );
89
+ assert.match(
90
+ app,
91
+ /async function chooseTheme\(name, options = \{\}\) \{\s*await setThemeByName\(name, \{ \.\.\.options, persist: true \}\);\s*\}/,
92
+ "chooseTheme should delegate persistence to the validated setThemeByName path",
93
+ );
94
+ assert.match(
95
+ app,
96
+ /async function applySchemeTheme\(options = \{\}\) \{\s*await setThemeByName\(effectiveThemeName\(\), \{ \.\.\.options, persist: false \}\);\s*\}/,
97
+ "applySchemeTheme must never persist",
98
+ );
99
+
100
+ // Auto mode also works on MediaQueryList implementations without addEventListener
101
+ // (legacy addListener API), matching the mobileViewMedia wiring.
102
+ assert.match(
103
+ app,
104
+ /colorSchemeMedia\.addListener\?\.\(handleOsSchemeChange\)/,
105
+ "updateColorSchemeListener should fall back to the legacy addListener API",
106
+ );
107
+ assert.match(app, /elements\.themeSelect\.addEventListener\("change"[\s\S]*?chooseTheme\(/, "select change should call chooseTheme");
108
+ assert.match(
109
+ app,
110
+ /elements\.themeSchemeToggle\?\.querySelectorAll\("\[data-scheme-mode\]"\)[\s\S]*?setThemeSchemeMode\(button\.dataset\.schemeMode/,
111
+ "toggle buttons should call setThemeSchemeMode",
112
+ );
113
+ assert.ok(app.includes('themeSchemeToggle: $("#themeSchemeToggle")'), "themeSchemeToggle element should be registered");
114
+ assert.match(
115
+ app,
116
+ /theme-search-result-scheme[\s\S]*?themeIsLight\(theme\) \? "Light" : "Dark"/,
117
+ "theme search rows should show a Light/Dark scheme label next to each theme name",
118
+ );
119
+
120
+ // ── index.html: the switch markup ────────────────────────────────────────────
121
+ assert.match(html, /id="themeSchemeToggle"[^>]*role="group"/, "index.html should contain the theme scheme toggle group");
122
+ for (const mode of ["light", "dark", "auto"]) {
123
+ assert.match(html, new RegExp(`data-scheme-mode="${mode}"`), `toggle should have a ${mode} button`);
124
+ }
125
+
126
+ // ── styles.css: the switch styling ───────────────────────────────────────────
127
+ assert.match(css, /\.theme-scheme-toggle\s*\{/, "styles.css should style the toggle");
128
+ assert.match(css, /\.theme-scheme-toggle button\.active\s*\{/, "styles.css should style the active mode");
129
+ assert.match(css, /\.theme-search-result-title\s*\{[\s\S]*?grid-template-columns:\s*minmax\(0, 1fr\) auto;/, "theme rows should place the scheme label beside the name");
130
+ assert.match(css, /\.theme-search-result-scheme\s*\{/, "styles.css should style theme scheme labels");
131
+
132
+ console.log("theme-scheme-mode: all assertions passed");