@firstpick/pi-package-webui 0.6.5 → 0.6.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.
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=66" />
15
+ <link rel="stylesheet" href="/styles.css?v=69" />
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">
@@ -174,7 +174,7 @@
174
174
  aria-controls="publishMenu"
175
175
  data-tooltip="Publish workflows: choose an npm or AUR release flow."
176
176
  ><svg class="composer-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M12 16V4m0 0 5 5m-5-5-5 5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M5 16v3a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
177
- <div id="publishMenu" class="composer-publish-menu-panel" role="menu" aria-label="Publish workflows">
177
+ <div id="publishMenu" class="composer-publish-menu-panel composer-auto-height-menu-panel" role="menu" aria-label="Publish workflows">
178
178
  <button id="releaseNpmButton" class="composer-publish-menu-item" type="button" role="menuitem" data-command="/release-npm">
179
179
  <span>NPM Release</span>
180
180
  </button>
@@ -195,7 +195,7 @@
195
195
  aria-controls="nativeCommandMenu"
196
196
  data-tooltip="Skills/tools setup: open skill or tool setup."
197
197
  ><svg class="composer-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 5h16v14H4z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/><path d="m7 10 2.5 2L7 14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 15h5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
198
- <div id="nativeCommandMenu" class="composer-publish-menu-panel composer-native-command-menu-panel" role="menu" aria-label="Skills and tools setup">
198
+ <div id="nativeCommandMenu" class="composer-publish-menu-panel composer-native-command-menu-panel composer-auto-height-menu-panel" role="menu" aria-label="Skills and tools setup">
199
199
  <button id="nativeSkillsButton" class="composer-publish-menu-item composer-native-command-menu-item" type="button" role="menuitem" data-command="/skills">
200
200
  <span>Skills Setup</span>
201
201
  </button>
@@ -214,9 +214,9 @@
214
214
  aria-haspopup="menu"
215
215
  aria-expanded="false"
216
216
  aria-controls="optionsMenu"
217
- data-tooltip="Options: command palette, Git-footer Visibility, natural conversation, resume, reload, remote, name, clone, settings, export, fork, or tree."
217
+ data-tooltip="Options: command palette, Guided Git Setup, Git-footer Visibility, natural conversation, resume, reload, remote, name, clone, settings, export, fork, or tree."
218
218
  ><svg class="composer-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 7h16M4 12h16M4 17h16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="8" cy="7" r="1.6" fill="currentColor"/><circle cx="16" cy="12" r="1.6" fill="currentColor"/><circle cx="11" cy="17" r="1.6" fill="currentColor"/></svg></button>
219
- <div id="optionsMenu" class="composer-publish-menu-panel composer-options-menu-panel" role="menu" aria-label="Common Pi options">
219
+ <div id="optionsMenu" class="composer-publish-menu-panel composer-options-menu-panel composer-auto-height-menu-panel" role="menu" aria-label="Common Pi options">
220
220
  <button id="optionsCommandPaletteButton" class="composer-publish-menu-item composer-options-menu-item" type="button" role="menuitem">
221
221
  <span>Command Palette</span>
222
222
  </button>
@@ -241,6 +241,9 @@
241
241
  <button id="optionsSettingsButton" class="composer-publish-menu-item composer-options-menu-item" type="button" role="menuitem" data-command="/settings">
242
242
  <span>Settings</span>
243
243
  </button>
244
+ <button id="optionsGitWorkflowSetupButton" class="composer-publish-menu-item composer-options-menu-item" type="button" role="menuitem" data-command="/git-workflow-setup">
245
+ <span>Guided Git Setup</span>
246
+ </button>
244
247
  <button id="optionsCloneButton" class="composer-publish-menu-item composer-options-menu-item" type="button" role="menuitem" data-command="/clone">
245
248
  <span>Clone Session</span>
246
249
  </button>
@@ -280,7 +283,7 @@
280
283
  aria-controls="appRunnerMenuPanel"
281
284
  data-tooltip="App runners: run detected project commands in this tab's working directory."
282
285
  ><svg class="composer-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M8 5v14l11-7z" fill="currentColor"/></svg></button>
283
- <div id="appRunnerMenuPanel" class="composer-publish-menu-panel composer-app-runner-menu-panel" role="menu" aria-label="Detected app runners"></div>
286
+ <div id="appRunnerMenuPanel" class="composer-publish-menu-panel composer-app-runner-menu-panel composer-auto-height-menu-panel" role="menu" aria-label="Detected app runners"></div>
284
287
  </div>
285
288
  </div>
286
289
  <div class="spacer"></div>
@@ -411,6 +414,7 @@
411
414
  <option value="medium">medium</option>
412
415
  <option value="high">high</option>
413
416
  <option value="xhigh">xhigh</option>
417
+ <option value="max">max</option>
414
418
  </select>
415
419
  <button id="setThinkingButton" type="button">Set thinking</button>
416
420
  </div>
@@ -575,6 +579,21 @@
575
579
  <dl id="stateDetails" class="details"></dl>
576
580
  </div>
577
581
  </section>
582
+ <section class="side-panel-section collapsed" data-side-panel-section="subagents">
583
+ <h2>
584
+ <button id="sidePanelSectionToggleSubagents" class="side-panel-section-toggle" type="button" aria-expanded="false" aria-controls="sidePanelSectionSubagents" aria-label="Expand Subagents section" title="Expand Subagents section" data-side-panel-section-toggle="subagents">
585
+ <span class="side-panel-section-label">Subagents</span>
586
+ <span class="side-panel-section-trailing">
587
+ <span id="subagentCountBadge" class="side-panel-section-badge subagent-count-badge" hidden>0</span>
588
+ <span class="side-panel-section-chevron" aria-hidden="true">›</span>
589
+ </span>
590
+ </button>
591
+ </h2>
592
+ <div id="sidePanelSectionSubagents" class="side-panel-section-content" hidden>
593
+ <p id="subagentsStatus" class="subagents-status muted" role="status" aria-live="polite">Checking running subagents…</p>
594
+ <div id="subagentsBox" class="subagents-box muted">Checking running subagents…</div>
595
+ </div>
596
+ </section>
578
597
  <section class="side-panel-section collapsed" data-side-panel-section="queue">
579
598
  <h2>
580
599
  <button id="sidePanelSectionToggleQueue" class="side-panel-section-toggle" type="button" aria-expanded="false" aria-controls="sidePanelSectionQueue" aria-label="Expand Queue section" title="Expand Queue section" data-side-panel-section-toggle="queue">
@@ -882,6 +901,6 @@
882
901
  </form>
883
902
  </dialog>
884
903
 
885
- <script type="module" src="/app.js?v=66"></script>
904
+ <script type="module" src="/app.js?v=69"></script>
886
905
  </body>
887
906
  </html>
package/public/styles.css CHANGED
@@ -1786,6 +1786,164 @@ body.embedded-split .side-panel-backdrop {
1786
1786
  background: rgba(var(--ctp-crust-rgb), 0.46);
1787
1787
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 0 1rem rgba(148, 226, 213, 0.05);
1788
1788
  }
1789
+ .subagent-count-badge {
1790
+ background: linear-gradient(135deg, var(--ctp-teal), var(--ctp-green));
1791
+ box-shadow: 0 0 0.8rem rgba(148, 226, 213, 0.24);
1792
+ }
1793
+ .subagents-status {
1794
+ margin: 0 0 0.48rem;
1795
+ font-size: 0.72rem;
1796
+ line-height: 1.35;
1797
+ }
1798
+ .subagents-box {
1799
+ display: grid;
1800
+ gap: 0.58rem;
1801
+ padding: 0.64rem;
1802
+ border: 1px solid rgba(180, 190, 254, 0.16);
1803
+ border-radius: 0.85rem;
1804
+ background: rgba(var(--ctp-crust-rgb), 0.50);
1805
+ box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 0 1rem rgba(148, 226, 213, 0.05);
1806
+ }
1807
+ .subagents-box.has-items {
1808
+ border-color: rgba(148, 226, 213, 0.26);
1809
+ background:
1810
+ radial-gradient(circle at 0 0, rgba(148, 226, 213, 0.08), transparent 10rem),
1811
+ rgba(var(--ctp-crust-rgb), 0.54);
1812
+ }
1813
+ .subagents-empty,
1814
+ .subagents-stale {
1815
+ color: rgba(var(--ctp-subtext-rgb), 0.72);
1816
+ font-size: 0.74rem;
1817
+ line-height: 1.4;
1818
+ }
1819
+ .subagent-tab-group {
1820
+ display: grid;
1821
+ min-width: 0;
1822
+ overflow: hidden;
1823
+ border: 1px solid rgba(180, 190, 254, 0.14);
1824
+ border-radius: 0.76rem;
1825
+ background: rgba(var(--ctp-base-rgb), 0.26);
1826
+ }
1827
+ .subagent-tab-group.active {
1828
+ border-color: rgba(137, 180, 250, 0.30);
1829
+ }
1830
+ .subagent-tab-header {
1831
+ display: flex;
1832
+ justify-content: space-between;
1833
+ gap: 0.55rem;
1834
+ align-items: center;
1835
+ width: 100%;
1836
+ min-height: 42px;
1837
+ padding: 0.48rem 0.56rem;
1838
+ border: 0;
1839
+ border-bottom: 1px solid rgba(180, 190, 254, 0.11);
1840
+ border-radius: 0;
1841
+ color: rgba(var(--ctp-text-rgb), 0.94);
1842
+ background: rgba(var(--ctp-surface-rgb), 0.20);
1843
+ text-align: left;
1844
+ }
1845
+ .subagent-tab-header:hover,
1846
+ .subagent-tab-header:focus-visible {
1847
+ transform: none;
1848
+ color: var(--ctp-blue);
1849
+ background: rgba(137, 180, 250, 0.10);
1850
+ }
1851
+ .subagent-tab-title {
1852
+ display: grid;
1853
+ gap: 0.12rem;
1854
+ min-width: 0;
1855
+ }
1856
+ .subagent-tab-title strong,
1857
+ .subagent-tab-session {
1858
+ overflow: hidden;
1859
+ text-overflow: ellipsis;
1860
+ white-space: nowrap;
1861
+ }
1862
+ .subagent-tab-title strong {
1863
+ font-size: 0.78rem;
1864
+ }
1865
+ .subagent-tab-session {
1866
+ color: rgba(var(--ctp-subtext-rgb), 0.66);
1867
+ font-size: 0.64rem;
1868
+ font-weight: 650;
1869
+ }
1870
+ .subagent-tab-count {
1871
+ display: inline-flex;
1872
+ align-items: center;
1873
+ justify-content: center;
1874
+ min-width: 1.45rem;
1875
+ min-height: 1.45rem;
1876
+ padding: 0 0.35rem;
1877
+ border: 1px solid rgba(148, 226, 213, 0.24);
1878
+ border-radius: 999px;
1879
+ color: var(--ctp-teal);
1880
+ background: rgba(148, 226, 213, 0.08);
1881
+ font-size: 0.68rem;
1882
+ font-weight: 900;
1883
+ }
1884
+ .subagent-agent-list {
1885
+ display: grid;
1886
+ gap: 0.38rem;
1887
+ padding: 0.5rem;
1888
+ }
1889
+ .subagent-agent-row {
1890
+ display: grid;
1891
+ grid-template-columns: auto minmax(0, 1fr);
1892
+ gap: 0.48rem;
1893
+ align-items: start;
1894
+ width: 100%;
1895
+ min-width: 0;
1896
+ min-height: 0;
1897
+ padding: 0.42rem 0.48rem;
1898
+ border: 1px solid transparent;
1899
+ border-radius: 0.62rem;
1900
+ color: inherit;
1901
+ background: rgba(var(--ctp-surface-rgb), 0.16);
1902
+ text-align: left;
1903
+ }
1904
+ .subagent-agent-row:hover,
1905
+ .subagent-agent-row:focus-visible {
1906
+ border-color: rgba(148, 226, 213, 0.38);
1907
+ background: rgba(148, 226, 213, 0.09);
1908
+ box-shadow: 0 0 0.8rem rgba(148, 226, 213, 0.08);
1909
+ transform: none;
1910
+ }
1911
+ .subagent-agent-row.nested {
1912
+ margin-left: 0.68rem;
1913
+ border-left: 2px solid rgba(203, 166, 247, 0.32);
1914
+ }
1915
+ .subagent-running-dot {
1916
+ width: 0.52rem;
1917
+ height: 0.52rem;
1918
+ margin-top: 0.22rem;
1919
+ border-radius: 999px;
1920
+ background: var(--ctp-green);
1921
+ box-shadow: 0 0 0.6rem rgba(166, 227, 161, 0.62);
1922
+ animation: subagent-running-pulse 1.35s ease-in-out infinite;
1923
+ }
1924
+ .subagent-agent-content {
1925
+ display: grid;
1926
+ gap: 0.13rem;
1927
+ min-width: 0;
1928
+ }
1929
+ .subagent-agent-name {
1930
+ overflow: hidden;
1931
+ color: rgba(var(--ctp-text-rgb), 0.94);
1932
+ font-size: 0.76rem;
1933
+ text-overflow: ellipsis;
1934
+ white-space: nowrap;
1935
+ }
1936
+ .subagent-agent-meta {
1937
+ color: rgba(var(--ctp-subtext-rgb), 0.67);
1938
+ font-size: 0.64rem;
1939
+ line-height: 1.35;
1940
+ overflow-wrap: anywhere;
1941
+ }
1942
+ @keyframes subagent-running-pulse {
1943
+ 0%, 100% { opacity: 0.58; transform: scale(0.86); }
1944
+ 50% { opacity: 1; transform: scale(1); }
1945
+ }
1946
+
1789
1947
  .optional-feature-section {
1790
1948
  display: grid;
1791
1949
  gap: 0.48rem;
@@ -6577,8 +6735,13 @@ button.composer-skill-tag:focus-visible {
6577
6735
  .composer-publish-menu.open .composer-publish-menu-panel {
6578
6736
  display: flex;
6579
6737
  }
6580
- .composer-options-menu-panel {
6581
- max-height: min(calc(var(--visual-viewport-height, 100dvh) - 2rem), 48rem);
6738
+ .composer-auto-height-menu-panel {
6739
+ height: auto;
6740
+ max-height: none;
6741
+ overflow: visible;
6742
+ overflow-y: visible;
6743
+ overscroll-behavior: auto;
6744
+ -webkit-overflow-scrolling: auto;
6582
6745
  }
6583
6746
  .composer-publish-menu.open .composer-publish-button {
6584
6747
  border-color: rgba(250, 179, 135, 0.58);
@@ -7637,6 +7800,51 @@ button.composer-skill-tag:focus-visible {
7637
7800
  font-weight: 700;
7638
7801
  line-height: 1.45;
7639
7802
  }
7803
+ .subagent-overlay-widget {
7804
+ min-height: 0;
7805
+ margin: 0;
7806
+ border-color: rgba(166, 227, 161, 0.62);
7807
+ border-left-color: rgba(166, 227, 161, 0.92);
7808
+ box-shadow: 0 0 1rem rgba(166, 227, 161, 0.10), inset 0 1px 0 rgba(255,255,255,0.04);
7809
+ }
7810
+ .subagent-overlay-widget .release-npm-output-details {
7811
+ min-height: 0;
7812
+ }
7813
+ .subagent-overlay-terminal {
7814
+ min-height: min(12rem, 30dvh);
7815
+ max-height: min(24rem, 46dvh);
7816
+ }
7817
+ .subagent-output-waiting {
7818
+ display: inline-flex;
7819
+ width: fit-content;
7820
+ min-width: 2.1rem;
7821
+ gap: 0.12rem;
7822
+ color: var(--ctp-green);
7823
+ font-weight: 900;
7824
+ letter-spacing: 0.08em;
7825
+ }
7826
+ .subagent-output-waiting-dot {
7827
+ animation: subagent-output-waiting-pulse 1.15s ease-in-out infinite;
7828
+ }
7829
+ .subagent-output-waiting-dot:nth-child(2) { animation-delay: 140ms; }
7830
+ .subagent-output-waiting-dot:nth-child(3) { animation-delay: 280ms; }
7831
+ @keyframes subagent-output-waiting-pulse {
7832
+ 0%, 70%, 100% { opacity: 0.22; transform: translateY(0); }
7833
+ 35% { opacity: 1; transform: translateY(-0.12rem); }
7834
+ }
7835
+ .subagent-overlay-output-controls {
7836
+ min-width: 0;
7837
+ }
7838
+ .subagent-overlay-output-controls .app-runner-output-meta {
7839
+ overflow-wrap: anywhere;
7840
+ }
7841
+ .subagent-overlay-output-controls .warning {
7842
+ color: var(--ctp-yellow);
7843
+ }
7844
+ .subagent-overlay-close-action {
7845
+ color: var(--ctp-yellow);
7846
+ border-color: rgba(249, 226, 175, 0.34);
7847
+ }
7640
7848
  .extension-dialog.stats-overlay-dialog {
7641
7849
  width: min(92rem, calc(100vw - 1.5rem));
7642
7850
  height: min(54rem, calc(var(--visual-viewport-height, 100dvh) - 1.5rem));
@@ -9359,6 +9567,14 @@ button.composer-skill-tag:focus-visible {
9359
9567
  .composer-actions-panel > .composer-app-runner-menu .composer-publish-menu-panel {
9360
9568
  inset-inline: auto 0;
9361
9569
  }
9570
+ .composer-actions-panel > .composer-publish-menu .composer-auto-height-menu-panel {
9571
+ height: auto;
9572
+ max-height: none;
9573
+ overflow: visible;
9574
+ overflow-y: visible;
9575
+ overscroll-behavior: auto;
9576
+ -webkit-overflow-scrolling: auto;
9577
+ }
9362
9578
  .composer-actions-panel > .composer-publish-menu .composer-publish-menu-item {
9363
9579
  width: 100%;
9364
9580
  min-width: 0;
@@ -10731,3 +10947,62 @@ button.workspace-dashboard-chip {
10731
10947
  gap: 0.15rem;
10732
10948
  padding: 0.3rem 0.1rem;
10733
10949
  }
10950
+
10951
+ /* Tokenized pi.artifact/v1 document viewer */
10952
+ .document-artifact-card {
10953
+ display: flex;
10954
+ align-items: center;
10955
+ justify-content: space-between;
10956
+ gap: 0.8rem;
10957
+ margin-top: 0.55rem;
10958
+ padding: 0.65rem 0.75rem;
10959
+ border: 1px solid rgba(137, 220, 235, 0.32);
10960
+ border-radius: 0.72rem;
10961
+ background: rgba(137, 220, 235, 0.08);
10962
+ }
10963
+ .document-artifact-card > div:first-child,
10964
+ .document-artifact-title { display: grid; gap: 0.15rem; min-width: 0; }
10965
+ .document-artifact-card-actions,
10966
+ .document-artifact-actions,
10967
+ .document-artifact-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
10968
+ .document-artifact-card.unavailable { border-color: rgba(249, 226, 175, 0.32); background: rgba(249, 226, 175, 0.08); }
10969
+ .document-artifact-dialog {
10970
+ width: min(96vw, 92rem);
10971
+ height: min(94vh, 70rem);
10972
+ padding: 0;
10973
+ border: 1px solid rgba(180, 190, 254, 0.3);
10974
+ border-radius: 1rem;
10975
+ background: var(--ctp-base);
10976
+ color: var(--ctp-text);
10977
+ }
10978
+ .document-artifact-dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px); }
10979
+ .document-artifact-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
10980
+ .document-artifact-header {
10981
+ display: flex;
10982
+ align-items: center;
10983
+ justify-content: space-between;
10984
+ gap: 1rem;
10985
+ padding: 0.75rem 0.9rem;
10986
+ border-bottom: 1px solid rgba(180, 190, 254, 0.18);
10987
+ }
10988
+ .document-artifact-body { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr); min-height: 0; }
10989
+ .document-artifact-sidebar { overflow: auto; display: grid; align-content: start; gap: 0.5rem; padding: 0.65rem; border-right: 1px solid rgba(180, 190, 254, 0.16); }
10990
+ .document-artifact-thumbnail { display: grid; gap: 0.25rem; padding: 0.35rem; border-radius: 0.55rem; }
10991
+ .document-artifact-thumbnail.active { border-color: var(--ctp-blue); box-shadow: 0 0 0 1px var(--ctp-blue); }
10992
+ .document-artifact-thumbnail img { width: 100%; max-height: 9rem; object-fit: contain; background: white; }
10993
+ .document-artifact-stage { overflow: auto; display: grid; align-content: start; justify-items: center; gap: 0.65rem; padding: 0.75rem; }
10994
+ .document-artifact-toolbar { position: sticky; z-index: 2; top: 0; width: 100%; padding: 0.45rem; border-radius: 0.65rem; background: rgba(var(--ctp-mantle-rgb), 0.94); }
10995
+ .document-artifact-meta { margin-left: auto; color: rgba(var(--ctp-subtext-rgb), 0.82); font-size: 0.76rem; }
10996
+ .document-artifact-search { width: min(100%, 46rem); }
10997
+ .document-artifact-page { max-width: min(100%, 70rem); height: auto; transform-origin: top center; background: white; box-shadow: 0 0.7rem 2rem rgba(0, 0, 0, 0.32); transition: transform 120ms ease; }
10998
+ .document-artifact-semantic { width: min(100%, 70rem); }
10999
+ .document-artifact-semantic pre { overflow: auto; max-height: 24rem; white-space: pre-wrap; }
11000
+ .document-artifact-loading,
11001
+ .document-artifact-error { padding: 1.2rem; }
11002
+ @media (max-width: 720px) {
11003
+ .document-artifact-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; }
11004
+ .document-artifact-body { grid-template-columns: 1fr; }
11005
+ .document-artifact-sidebar { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid rgba(180, 190, 254, 0.16); }
11006
+ .document-artifact-thumbnail { flex: 0 0 6rem; }
11007
+ .document-artifact-header { align-items: flex-start; }
11008
+ }
@@ -0,0 +1,18 @@
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
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..");
7
+ const [server, app, styles] = await Promise.all([
8
+ readFile(join(root, "bin", "pi-webui.mjs"), "utf8"),
9
+ readFile(join(root, "public", "app.js"), "utf8"),
10
+ readFile(join(root, "public", "styles.css"), "utf8"),
11
+ ]);
12
+
13
+ for (const contract of ["pi.artifact/v1", "registerDocumentArtifact", "rewriteArtifactsForTab", "documentArtifactRecord", "sendDocumentArtifactFile", "/api/artifacts/"]) assert.ok(server.includes(contract), `server should contain ${contract}`);
14
+ for (const privateField of ["manifestPath", "downloadPath", "outputPath", "sourcePath", "stagedPath", "pdfPath", "workspace", "recoveryPath"]) assert.match(server, new RegExp(`PRIVATE_ARTIFACT_KEYS[^;]+[\\s\\S]*?${privateField}`), `artifact sanitizer should cover ${privateField}`);
15
+ for (const feature of ["openDocumentArtifact", "appendDocumentArtifact", "Send page to composer", "Previous", "Rotate", "Semantic structure, revisions, warnings, and diff"]) assert.ok(app.includes(feature), `browser viewer should contain ${feature}`);
16
+ for (const selector of [".document-artifact-dialog", ".document-artifact-sidebar", ".document-artifact-page", "@media (max-width: 720px)"]) assert.ok(styles.includes(selector), `viewer stylesheet should contain ${selector}`);
17
+ assert.equal(/details\.artifact\s*=/.test(server), false, "server should replace details immutably rather than mutating raw RPC artifacts");
18
+ console.log("document-artifact-static.test.mjs passed");
@@ -207,12 +207,75 @@ function handleWebuiHelperPrompt(command, base) {
207
207
  case "skills-state":
208
208
  respondHelper({ requestId, ok: true, data: { skills: [] } });
209
209
  return true;
210
+ case "subagent-output":
211
+ respondHelper({
212
+ requestId,
213
+ ok: true,
214
+ data: {
215
+ version: 1,
216
+ runId: request.payload?.runId || "fixture-run",
217
+ source: "async",
218
+ mode: "parallel",
219
+ startedAt: Date.now() - 3000,
220
+ updatedAt: Date.now(),
221
+ agent: {
222
+ id: request.payload?.agentId || "fixture-run:0",
223
+ name: String(request.payload?.agentId || "").endsWith(":1") ? "scout" : "reviewer",
224
+ index: String(request.payload?.agentId || "").endsWith(":1") ? 1 : 0,
225
+ status: "running",
226
+ currentTool: "read",
227
+ currentToolArgs: "README.md",
228
+ recentTools: [{ tool: "grep", args: "Subagents", endMs: Date.now() - 200 }],
229
+ recentOutput: ["Inspecting current implementation", "Waiting for the next tool result"],
230
+ turnCount: 2,
231
+ toolCount: 3,
232
+ tokens: 420,
233
+ },
234
+ },
235
+ });
236
+ return true;
210
237
  default:
211
238
  respondHelper({ requestId, ok: false, error: `Unknown webui-helper action: ${String(request.action || "")}` });
212
239
  return true;
213
240
  }
214
241
  }
215
242
 
243
+ function handleDocumentArtifactFixturePrompt(command, base) {
244
+ const message = String(command.message || "").trim();
245
+ if (message === "fixture document artifact clear") { for (let index = dynamicMessages.length - 1; index >= 0; index--) if (dynamicMessages[index]?.toolName === "docx_render") { dynamicMessages.splice(index, 1); dynamicEntries.splice(index, 1); } dynamicLeafId = dynamicEntries.at(-1)?.id || "u0000002"; respond({ ...base, data: { output: "fake document artifacts cleared" } }); return true; }
246
+ if (message !== "fixture document artifact" || !process.env.FAKE_PI_ARTIFACT_MANIFEST) return false;
247
+ const toolCallId = `artifact-${randomUUID()}`, artifact = { schema: "pi.artifact/v1", kind: "document", id: "fixture-document-artifact", revisionId: "fixture-revision", title: "fixture.docx", mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", pageCount: 1, manifestPath: process.env.FAKE_PI_ARTIFACT_MANIFEST, downloadPath: process.env.FAKE_PI_ARTIFACT_DOWNLOAD, expiresAt: new Date(Date.now() + 60 * 60 * 1000).toISOString() }, result = { content: [{ type: "text", text: "Rendered fixture document" }], details: { artifact } };
248
+ appendDynamicMessage({ role: "toolResult", toolCallId, toolName: "docx_render", content: result.content, details: result.details, isError: false, timestamp: Date.now() });
249
+ respond({ ...base, data: { output: "fake document artifact emitted" } });
250
+ emitEvent({ type: "tool_execution_end", toolCallId, toolName: "docx_render", isError: false, result });
251
+ return true;
252
+ }
253
+
254
+ function handleSubagentFixturePrompt(command, base) {
255
+ const message = String(command.message || "").trim();
256
+ if (message !== "fixture subagents running" && message !== "fixture subagents clear") return false;
257
+ const runs = message.endsWith("clear") ? [] : [{
258
+ id: "fixture-run",
259
+ source: "async",
260
+ mode: "parallel",
261
+ status: "running",
262
+ startedAt: Date.now() - 2500,
263
+ agents: [
264
+ { id: "fixture-run:0", name: "reviewer", status: "running", index: 0, currentTool: "read", nested: false },
265
+ { id: "fixture-run:1", name: "scout", status: "running", index: 1, nested: false },
266
+ ],
267
+ }];
268
+ respond({ ...base, data: { output: "fake subagent status emitted" } });
269
+ emitEvent({
270
+ type: "extension_ui_request",
271
+ id: randomUUID(),
272
+ method: "setStatus",
273
+ statusKey: "webui-subagents",
274
+ statusText: `PI_WEBUI_SUBAGENTS_V1 ${JSON.stringify({ version: 1, available: true, updatedAt: Date.now(), runs })}`,
275
+ });
276
+ return true;
277
+ }
278
+
216
279
  function handleTalkPrompt(command, base) {
217
280
  const message = String(command.message || "").trim();
218
281
  const match = message.match(/^\/(talk|voice|conversation)(?:\s+(\S+))?/i);
@@ -315,6 +378,8 @@ rl.on("line", (line) => {
315
378
  }
316
379
  case "prompt":
317
380
  if (handleWebuiHelperPrompt(command, base)) return;
381
+ if (handleSubagentFixturePrompt(command, base)) return;
382
+ if (handleDocumentArtifactFixturePrompt(command, base)) return;
318
383
  if (handleTalkPrompt(command, base)) return;
319
384
  if (handleVoiceScriptPrompt(command, base)) return;
320
385
  respond({ ...base, data: { output: "fake prompt accepted" } });
@@ -0,0 +1,67 @@
1
+ import assert from "node:assert/strict";
2
+ import { mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import path from "node:path";
5
+ import {
6
+ GIT_WORKFLOW_SETUP_VERSION,
7
+ gitWorkflowPreferencesSummary,
8
+ isGitWorkflowSetupComplete,
9
+ readGitWorkflowPreferences,
10
+ readWebuiSettings,
11
+ supportedGitWorkflowThinkingLevels,
12
+ writeGitWorkflowPreferences,
13
+ } from "../lib/git-workflow-preferences.mjs";
14
+
15
+ assert.deepEqual(supportedGitWorkflowThinkingLevels({ reasoning: false }), ["off"]);
16
+ assert.deepEqual(
17
+ supportedGitWorkflowThinkingLevels({ reasoning: true }),
18
+ ["off", "minimal", "low", "medium", "high"],
19
+ "models without an explicit map should expose standard levels but not opt-in extended levels",
20
+ );
21
+ assert.deepEqual(
22
+ supportedGitWorkflowThinkingLevels({ reasoning: true, thinkingLevelMap: { minimal: null, xhigh: null, max: "max" } }),
23
+ ["off", "low", "medium", "high", "max"],
24
+ "null map entries should be hidden while explicit extended levels remain available",
25
+ );
26
+
27
+ const root = await mkdtemp(path.join(tmpdir(), "pi-webui-git-preferences-"));
28
+ const settingsFile = path.join(root, "settings.json");
29
+
30
+ try {
31
+ await writeFile(settingsFile, `${JSON.stringify({ version: 1, remoteAuthEnabled: true }, null, 2)}\n`, "utf8");
32
+ const migrated = await readWebuiSettings(settingsFile);
33
+ assert.equal(migrated.version, 2);
34
+ assert.equal(migrated.remoteAuthEnabled, true, "legacy Remote PIN state should survive schema migration");
35
+ assert.equal(isGitWorkflowSetupComplete(migrated.gitWorkflow), false);
36
+ assert.equal(migrated.gitWorkflow.stagingPolicy, "review");
37
+ assert.equal(migrated.gitWorkflow.generation.thinkingLevel, "low");
38
+
39
+ const saved = await writeGitWorkflowPreferences({
40
+ generation: { provider: "fake", modelId: "fake-model", thinkingLevel: "off", unavailablePolicy: "ask" },
41
+ commit: { language: "de", defaultVariant: "long", scope: "required" },
42
+ stagingPolicy: "preserve",
43
+ deliveryMode: "pr-worktree",
44
+ verificationPolicy: "none",
45
+ }, settingsFile);
46
+ assert.equal(saved.setupVersion, GIT_WORKFLOW_SETUP_VERSION);
47
+ assert.equal(isGitWorkflowSetupComplete(saved), true);
48
+ assert.equal(saved.commit.language, "de");
49
+ assert.equal(saved.commit.defaultVariant, "long");
50
+ assert.equal(saved.stagingPolicy, "preserve");
51
+
52
+ const partiallyUpdated = await writeGitWorkflowPreferences({ deliveryMode: "current" }, settingsFile);
53
+ assert.equal(partiallyUpdated.generation.modelId, "fake-model", "partial updates should preserve the selected model");
54
+ assert.equal(partiallyUpdated.commit.language, "de", "partial updates should preserve nested commit preferences");
55
+ assert.equal(partiallyUpdated.deliveryMode, "current");
56
+
57
+ const persisted = JSON.parse(await readFile(settingsFile, "utf8"));
58
+ assert.equal(persisted.version, 2);
59
+ assert.equal(persisted.remoteAuthEnabled, true);
60
+ assert.equal(persisted.gitWorkflow.generation.provider, "fake");
61
+ assert.match(gitWorkflowPreferencesSummary(await readGitWorkflowPreferences(settingsFile)), /fake\/fake-model/);
62
+ if (process.platform !== "win32") assert.equal((await stat(settingsFile)).mode & 0o777, 0o600);
63
+
64
+ console.log("git-workflow-preferences.test.mjs passed");
65
+ } finally {
66
+ await rm(root, { recursive: true, force: true });
67
+ }