@firstpick/pi-package-webui 0.9.3 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +4 -1
  2. package/lib/ui-layout-settings.mjs +37 -6
  3. package/package.json +1 -1
  4. package/public/app.js +535 -10
  5. package/public/index.html +33 -26
  6. package/public/service-worker.js +1 -1
  7. package/public/stream-output-controller.mjs +31 -2
  8. package/public/styles.css +62 -6
  9. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  10. package/tests/browser/control-deck-side-panels.spec.mjs +42 -0
  11. package/tests/browser/control-visibility.spec.mjs +396 -0
  12. package/tests/browser/intercom-conversation-viewer.spec.mjs +2 -0
  13. package/tests/browser/persistent-ui-layout.spec.mjs +9 -9
  14. package/tests/codex-fast-mode-static.test.mjs +2 -2
  15. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  16. package/tests/control-deck-side-panels-static.test.mjs +3 -1
  17. package/tests/control-visibility-static.test.mjs +294 -0
  18. package/tests/controls-layout-static.test.mjs +3 -3
  19. package/tests/fast-mode-client-static.test.mjs +1 -1
  20. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  21. package/tests/file-viewer-image-static.test.mjs +3 -3
  22. package/tests/fixtures/streaming-workloads.mjs +131 -0
  23. package/tests/git-workflow-preferences.test.mjs +2 -2
  24. package/tests/http-endpoints-harness.test.mjs +4 -4
  25. package/tests/intercom-conversation-viewer-static.test.mjs +6 -5
  26. package/tests/main-output-loading-static.test.mjs +3 -3
  27. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  28. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  29. package/tests/mobile-foundation-static.test.mjs +3 -3
  30. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  31. package/tests/mobile-static.test.mjs +6 -6
  32. package/tests/open-issue-wizard-static.test.mjs +2 -2
  33. package/tests/persistent-ui-layout-static.test.mjs +6 -6
  34. package/tests/questionnaire-dialog.test.mjs +3 -3
  35. package/tests/session-sampling-ui-static.test.mjs +3 -3
  36. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  37. package/tests/stream-output-isolation-static.test.mjs +7 -0
  38. package/tests/stream-output-workloads.test.mjs +239 -0
  39. package/tests/subagent-observability-static.test.mjs +4 -2
  40. package/tests/subagents-helper.test.mjs +109 -0
  41. package/tests/syntax-highlighting-static.test.mjs +3 -3
  42. package/tests/terminal-cwd-grouping-static.test.mjs +22 -0
  43. package/tests/theme-customizer-static.test.mjs +1 -1
  44. package/tests/ui-layout-settings.test.mjs +54 -7
  45. package/tests/webui-settings-locking.test.mjs +3 -3
  46. package/webui-rpc-helper.mjs +126 -5
package/README.md CHANGED
@@ -17,7 +17,7 @@ Pi Web UI keeps the normal Pi agent experience while giving you more room to man
17
17
 
18
18
  | Area | Highlights |
19
19
  | --- | --- |
20
- | **Sessions and workspaces** | Run several isolated Pi sessions, resume prior work, switch projects, preserve per-tab drafts, and create branch worktrees. |
20
+ | **Sessions and workspaces** | Run several isolated Pi sessions, resume prior work, switch projects, preserve per-tab drafts, add another tab directly from the tab strip, and create branch worktrees. |
21
21
  | **Live agent work** | Follow streaming Markdown with syntax highlighting for code blocks, thinking, tool output, queues, todo progress, managed agent runs, and direct agent-to-agent conversations without leaving the browser. |
22
22
  | **Models and controls** | Change models and thinking effort, manage scoped models, configure tools and skills, and use the command palette. |
23
23
  | **Files and prompts** | Upload or paste files and images, edit text attachments, use slash-command suggestions, browse project files, and reference project paths with `@`. |
@@ -25,6 +25,7 @@ Pi Web UI keeps the normal Pi agent experience while giving you more room to man
25
25
  | **Project utilities** | Launch detected app runners, manage working directories, search files and transcripts, and customize themes. |
26
26
  | **Companion features** | Add stats, remote access, voice, `/btw`, richer Git status, themes, release tools, and other supported Pi packages. |
27
27
  | **Desktop and mobile** | Use a full desktop workspace with resizable left and right side panels, or a compact phone layout with touch-friendly navigation and controls. |
28
+ | **Customizable controls** | Hide optional workspace, Control Deck, composer, workflow, attachment, and input-tag controls while keeping Send available. |
28
29
 
29
30
  ## Quick start
30
31
 
@@ -68,6 +69,8 @@ When session history is still loading, the main window shows **Loading agent out
68
69
 
69
70
  Tracked skills appear as compact tags above the composer. Select a named tag to open its skill file; when space is limited, select the **+X** tag to expand the remaining selectable tags upward.
70
71
 
72
+ To simplify the interface, right-click a supported button and choose **Hide**, or right-click empty space in a marked toolbar, Control Deck header/footer, or composer area to choose every visible control and input-tag type. Use **Show all** or **Reset defaults** to recover hidden items. This preference is global across Web UI workspaces and browsers; **Send** always remains available.
73
+
71
74
  Open **Subagents** to follow agent runs launched by managed extensions or registered SDK, RPC, JSON, print, interactive, tmux, workflow, schedule, gate, and custom integrations. Runs linked to an open WebUI terminal stay in that terminal’s group; other registered runs appear under **External agents**. Each agent row shows its launch source and lifecycle, and only offers output or controls that its owner supports. A `pi-subagents` workflow appears as a collapsible **Workflow** header with its model-powered agents nested inside, rather than as another agent row. Starting or restarting the server reconnects active runs without reopening stale, lost, or already-finished rows from an earlier server run.
72
75
 
73
76
  Independent Pi processes do not appear automatically. Start them through `pi-webui agent run`, attach a persisted session with `pi-webui agent attach`, or use a cooperating registration adapter. See [TECHNICAL.md](TECHNICAL.md#subagent-observability) for supported commands and limitations.
@@ -1,6 +1,6 @@
1
1
  import { createHash } from "node:crypto";
2
2
 
3
- export const UI_LAYOUT_VERSION = 2;
3
+ export const UI_LAYOUT_VERSION = 3;
4
4
  export const UI_LAYOUT_REQUEST_MAX_BYTES = 32 * 1024;
5
5
  export const UI_LAYOUT_LIMITS = Object.freeze({
6
6
  idLength: 256,
@@ -18,6 +18,7 @@ export const UI_LAYOUT_LIMITS = Object.freeze({
18
18
  terminalTabsSidebarWidthMax: 4096,
19
19
  });
20
20
 
21
+ const PREVIOUS_UI_LAYOUT_VERSION = 2;
21
22
  const LEGACY_UI_LAYOUT_VERSION = 1;
22
23
  const UNSAFE_OBJECT_KEYS = new Set(["__proto__", "constructor", "prototype"]);
23
24
  const TERMINAL_TAB_LAYOUTS = new Set(["top", "left"]);
@@ -61,6 +62,10 @@ function boundedUniqueStringList(value, label) {
61
62
  });
62
63
  }
63
64
 
65
+ function boundedDeterministicStringList(value, label) {
66
+ return boundedUniqueStringList(value, label).sort();
67
+ }
68
+
64
69
  function nullable(value, validate) {
65
70
  return value === null ? null : validate(value);
66
71
  }
@@ -247,6 +252,16 @@ function validateFileViewerWidth(value) {
247
252
  return validateBoundedWidth(value, "layout.fileViewerWidth", UI_LAYOUT_LIMITS.fileViewerWidthMin, UI_LAYOUT_LIMITS.fileViewerWidthMax);
248
253
  }
249
254
 
255
+ function validateControlVisibility(value) {
256
+ const source = objectValue(value);
257
+ if (!source) invalid("layout.controlVisibility must be an object or null");
258
+ assertOnlyKeys(source, new Set(["hiddenIds"]), "layout.controlVisibility");
259
+ if (!own(source, "hiddenIds")) invalid("layout.controlVisibility must include hiddenIds");
260
+ return {
261
+ hiddenIds: nullable(source.hiddenIds, (entry) => boundedDeterministicStringList(entry, "layout.controlVisibility.hiddenIds")),
262
+ };
263
+ }
264
+
250
265
  export function defaultUiLayout() {
251
266
  return {
252
267
  version: UI_LAYOUT_VERSION,
@@ -259,6 +274,7 @@ export function defaultUiLayout() {
259
274
  panelWidths: { left: null, right: null },
260
275
  },
261
276
  composerActions: { order: null, grid: null },
277
+ controlVisibility: { hiddenIds: null },
262
278
  footerScopedModelOrder: null,
263
279
  terminalTabs: { layout: null, customGroups: null, sidebarWidth: null },
264
280
  fileViewerWidth: null,
@@ -273,7 +289,7 @@ function softField(validate, fallback = null) {
273
289
  }
274
290
  }
275
291
 
276
- function normalizeSharedLayoutFields(source, sidePanel) {
292
+ function normalizeSharedLayoutFields(source, sidePanel, controlVisibility = defaultUiLayout().controlVisibility) {
277
293
  const composerActions = objectValue(source.composerActions);
278
294
  const terminalTabs = objectValue(source.terminalTabs);
279
295
  return {
@@ -283,6 +299,7 @@ function normalizeSharedLayoutFields(source, sidePanel) {
283
299
  order: softField(() => nullable(composerActions?.order ?? null, (entry) => boundedUniqueStringList(entry, "uiLayout.composerActions.order"))),
284
300
  grid: softField(() => nullable(composerActions?.grid ?? null, validateGrid)),
285
301
  },
302
+ controlVisibility,
286
303
  footerScopedModelOrder: softField(() => nullable(source.footerScopedModelOrder ?? null, (entry) => boundedUniqueStringList(entry, "uiLayout.footerScopedModelOrder"))),
287
304
  terminalTabs: {
288
305
  layout: TERMINAL_TAB_LAYOUTS.has(terminalTabs?.layout) ? terminalTabs.layout : null,
@@ -303,7 +320,14 @@ function normalizeSideValues(source, validate, fallback) {
303
320
  return Object.fromEntries(SIDES.map((side) => [side, softField(() => nullable(record?.[side] ?? null, (value) => validate(value, side)), fallback)]));
304
321
  }
305
322
 
306
- function normalizeVersionTwo(source) {
323
+ function normalizedControlVisibility(source) {
324
+ return softField(
325
+ () => source.controlVisibility == null ? defaultUiLayout().controlVisibility : validateControlVisibility(source.controlVisibility),
326
+ defaultUiLayout().controlVisibility,
327
+ );
328
+ }
329
+
330
+ function normalizeCurrentVersion(source, { migrate = false } = {}) {
307
331
  const sidePanel = objectValue(source.sidePanel);
308
332
  return normalizeSharedLayoutFields(source, {
309
333
  placement: CONTROL_DECK_PLACEMENTS.has(sidePanel?.placement) ? sidePanel.placement : null,
@@ -318,7 +342,11 @@ function normalizeVersionTwo(source) {
318
342
  return value;
319
343
  }, null),
320
344
  panelWidths: normalizeSideValues(sidePanel?.panelWidths, (value, side) => validatePanelWidth(value, `uiLayout.sidePanel.panelWidths.${side}`), null),
321
- });
345
+ }, migrate ? defaultUiLayout().controlVisibility : normalizedControlVisibility(source));
346
+ }
347
+
348
+ function migrateVersionTwo(source) {
349
+ return normalizeCurrentVersion(source, { migrate: true });
322
350
  }
323
351
 
324
352
  function migrateVersionOne(source, legacySidePanelWidth) {
@@ -344,7 +372,8 @@ function migrateVersionOne(source, legacySidePanelWidth) {
344
372
  export function normalizeUiLayout(value, { legacySidePanelWidth = null } = {}) {
345
373
  const source = objectValue(value);
346
374
  if (!source) return defaultUiLayout();
347
- if (source.version === UI_LAYOUT_VERSION) return normalizeVersionTwo(source);
375
+ if (source.version === UI_LAYOUT_VERSION) return normalizeCurrentVersion(source);
376
+ if (source.version === PREVIOUS_UI_LAYOUT_VERSION) return migrateVersionTwo(source);
348
377
  if (source.version === LEGACY_UI_LAYOUT_VERSION) return migrateVersionOne(source, legacySidePanelWidth);
349
378
  return defaultUiLayout();
350
379
  }
@@ -352,7 +381,7 @@ export function normalizeUiLayout(value, { legacySidePanelWidth = null } = {}) {
352
381
  export function validateUiLayoutPatch(value) {
353
382
  const source = objectValue(value);
354
383
  if (!source) invalid("layout must be an object");
355
- const allowed = new Set(["version", "sidePanel", "composerActions", "footerScopedModelOrder", "terminalTabs", "fileViewerWidth"]);
384
+ const allowed = new Set(["version", "sidePanel", "composerActions", "controlVisibility", "footerScopedModelOrder", "terminalTabs", "fileViewerWidth"]);
356
385
  assertOnlyKeys(source, allowed, "layout");
357
386
  if (own(source, "version") && source.version !== UI_LAYOUT_VERSION) invalid(`layout.version must be ${UI_LAYOUT_VERSION}`);
358
387
  const mutableFields = [...allowed].filter((field) => field !== "version" && own(source, field));
@@ -360,6 +389,7 @@ export function validateUiLayoutPatch(value) {
360
389
  const patch = {};
361
390
  if (own(source, "sidePanel")) patch.sidePanel = nullable(source.sidePanel, (entry) => validateSidePanel(entry, { partial: true }));
362
391
  if (own(source, "composerActions")) patch.composerActions = nullable(source.composerActions, (entry) => validateComposerActions(entry, { partial: true }));
392
+ if (own(source, "controlVisibility")) patch.controlVisibility = nullable(source.controlVisibility, validateControlVisibility);
363
393
  if (own(source, "footerScopedModelOrder")) patch.footerScopedModelOrder = nullable(source.footerScopedModelOrder, (entry) => boundedUniqueStringList(entry, "layout.footerScopedModelOrder"));
364
394
  if (own(source, "terminalTabs")) patch.terminalTabs = nullable(source.terminalTabs, (entry) => validateTerminalTabs(entry, { partial: true }));
365
395
  if (own(source, "fileViewerWidth")) patch.fileViewerWidth = nullable(source.fileViewerWidth, validateFileViewerWidth);
@@ -383,6 +413,7 @@ export function mergeUiLayout(current, patch) {
383
413
  }
384
414
  }
385
415
  if (own(value, "composerActions")) merged.composerActions = value.composerActions === null ? defaultUiLayout().composerActions : value.composerActions;
416
+ if (own(value, "controlVisibility")) merged.controlVisibility = value.controlVisibility === null ? defaultUiLayout().controlVisibility : value.controlVisibility;
386
417
  if (own(value, "footerScopedModelOrder")) merged.footerScopedModelOrder = value.footerScopedModelOrder;
387
418
  if (own(value, "terminalTabs")) {
388
419
  merged.terminalTabs = value.terminalTabs === null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firstpick/pi-package-webui",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "Pi Web UI companion package with a local browser UI CLI plus /webui-start and /webui-status commands.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-package-webui#readme",