@firstpick/pi-package-webui 0.9.1 → 0.9.3

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 (107) hide show
  1. package/README.md +31 -9
  2. package/bin/pi-webui-launcher.mjs +23 -12
  3. package/bin/pi-webui.mjs +729 -93
  4. package/index.ts +266 -1
  5. package/lib/agent-run-adapters.mjs +500 -0
  6. package/lib/agent-run-protocol.mjs +262 -0
  7. package/lib/agent-run-registry.mjs +339 -0
  8. package/lib/git-workflow-preferences.mjs +18 -28
  9. package/lib/intercom-conversations.mjs +491 -0
  10. package/lib/intercom-transcript-filter.mjs +99 -0
  11. package/lib/resource-selection.mjs +140 -0
  12. package/lib/trust-boundaries.mjs +2 -0
  13. package/lib/ui-layout-settings.mjs +172 -28
  14. package/lib/update/package-layout.mjs +50 -0
  15. package/lib/update/plan.mjs +11 -0
  16. package/package.json +2 -2
  17. package/public/app.js +2276 -419
  18. package/public/index.html +142 -72
  19. package/public/service-worker.js +2 -1
  20. package/public/stream-output-controller.mjs +15 -0
  21. package/public/styles.css +764 -92
  22. package/public/syntax-highlight.mjs +622 -0
  23. package/tests/agent-run-adapters.test.mjs +217 -0
  24. package/tests/agent-run-launcher.test.mjs +41 -0
  25. package/tests/agent-run-protocol.test.mjs +82 -0
  26. package/tests/agent-run-registry.test.mjs +102 -0
  27. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  28. package/tests/browser/control-deck-side-panels.spec.mjs +354 -0
  29. package/tests/browser/controls-layout.spec.mjs +122 -0
  30. package/tests/browser/file-tree-git-ignored.spec.mjs +113 -0
  31. package/tests/browser/interaction-continuity.spec.mjs +161 -0
  32. package/tests/browser/intercom-conversation-viewer.spec.mjs +355 -0
  33. package/tests/browser/mobile-foundation.spec.mjs +26 -0
  34. package/tests/browser/model-search-focus.spec.mjs +96 -0
  35. package/tests/browser/optimistic-prompt.spec.mjs +22 -0
  36. package/tests/browser/persistent-ui-layout.spec.mjs +285 -66
  37. package/tests/browser/resource-profiles.spec.mjs +200 -0
  38. package/tests/browser/subagent-observability.spec.mjs +116 -0
  39. package/tests/codex-fast-mode-static.test.mjs +7 -6
  40. package/tests/common-options-submenus-interaction-static.test.mjs +2 -0
  41. package/tests/common-options-submenus-markup-static.test.mjs +1 -0
  42. package/tests/component-update-api-static.test.mjs +2 -1
  43. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  44. package/tests/composer-skill-tag-layout.test.mjs +32 -2
  45. package/tests/control-deck-component-updates-static.test.mjs +6 -0
  46. package/tests/control-deck-side-panels-static.test.mjs +68 -0
  47. package/tests/controls-layout-static.test.mjs +22 -0
  48. package/tests/fast-mode-client-static.test.mjs +2 -2
  49. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  50. package/tests/feature-system-prompt-optional-feature-static.test.mjs +5 -5
  51. package/tests/file-tree-git-ignored-static.test.mjs +152 -0
  52. package/tests/file-tree-search-layout-static.test.mjs +2 -1
  53. package/tests/file-viewer-image-static.test.mjs +69 -0
  54. package/tests/fixtures/fake-pi.mjs +147 -12
  55. package/tests/foreground-transcript-catch-up-static.test.mjs +1 -1
  56. package/tests/git-panel-file-preview-static.test.mjs +5 -5
  57. package/tests/git-panel-live-updates-static.test.mjs +3 -3
  58. package/tests/git-workflow-preferences.test.mjs +55 -6
  59. package/tests/http-endpoints-harness.test.mjs +295 -14
  60. package/tests/intercom-conversation-viewer-static.test.mjs +105 -0
  61. package/tests/intercom-conversations-http.test.mjs +252 -0
  62. package/tests/intercom-conversations.test.mjs +374 -0
  63. package/tests/intercom-main-transcript-suppression-static.test.mjs +52 -0
  64. package/tests/intercom-tag-layout-static.test.mjs +46 -0
  65. package/tests/intercom-transcript-filter.test.mjs +98 -0
  66. package/tests/main-output-loading-static.test.mjs +59 -0
  67. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  68. package/tests/mobile-compact-layout.test.mjs +2 -3
  69. package/tests/mobile-continuity-tablet-static.test.mjs +6 -6
  70. package/tests/mobile-foundation-static.test.mjs +3 -3
  71. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  72. package/tests/mobile-static.test.mjs +76 -42
  73. package/tests/native-parity.test.mjs +8 -7
  74. package/tests/open-issue-wizard-static.test.mjs +2 -2
  75. package/tests/optional-feature-migration-frontend.test.mjs +5 -5
  76. package/tests/optional-feature-resource-setup-static.test.mjs +29 -0
  77. package/tests/persistent-ui-layout-static.test.mjs +13 -13
  78. package/tests/questionnaire-dialog.test.mjs +3 -3
  79. package/tests/remote-auth-settings-harness.test.mjs +1 -1
  80. package/tests/resource-defaults-helper.test.mjs +60 -6
  81. package/tests/resource-selection.test.mjs +114 -0
  82. package/tests/resource-tui-extension.test.mjs +23 -0
  83. package/tests/session-sampling-ui-static.test.mjs +3 -3
  84. package/tests/side-panel-context-menu-static.test.mjs +1 -1
  85. package/tests/side-panel-resize-static.test.mjs +26 -16
  86. package/tests/side-panel-section-height-removal-static.test.mjs +4 -4
  87. package/tests/side-panel-section-reorder-static.test.mjs +16 -70
  88. package/tests/stream-output-controller.test.mjs +8 -0
  89. package/tests/stream-output-isolation-static.test.mjs +2 -2
  90. package/tests/streaming-ui-coupling.test.mjs +5 -0
  91. package/tests/subagent-gate-visibility.test.mjs +2 -1
  92. package/tests/subagent-launch-slots.test.mjs +1 -1
  93. package/tests/subagent-observability-static.test.mjs +32 -0
  94. package/tests/subagent-reliability-integration.test.mjs +183 -0
  95. package/tests/subagent-workflow-section-static.test.mjs +67 -0
  96. package/tests/subagents-helper.test.mjs +548 -5
  97. package/tests/syntax-highlight.test.mjs +235 -0
  98. package/tests/syntax-highlighting-static.test.mjs +84 -0
  99. package/tests/terminal-tabs-resize-static.test.mjs +35 -0
  100. package/tests/theme-customizer-static.test.mjs +5 -5
  101. package/tests/thinking-format-parser.test.mjs +64 -0
  102. package/tests/ui-layout-settings.test.mjs +104 -32
  103. package/tests/update-api-harness.test.mjs +24 -10
  104. package/tests/update-package-layout.test.mjs +38 -0
  105. package/tests/update-plan.test.mjs +11 -1
  106. package/tests/webui-settings-locking.test.mjs +33 -3
  107. package/webui-rpc-helper.mjs +700 -89
package/README.md CHANGED
@@ -18,13 +18,13 @@ Pi Web UI keeps the normal Pi agent experience while giving you more room to man
18
18
  | Area | Highlights |
19
19
  | --- | --- |
20
20
  | **Sessions and workspaces** | Run several isolated Pi sessions, resume prior work, switch projects, preserve per-tab drafts, and create branch worktrees. |
21
- | **Live agent work** | Follow streaming Markdown, thinking, tool output, queues, todo progress, subagents, and context usage without leaving the browser. |
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
- | **Files and prompts** | Upload or paste files and images, edit text attachments, use slash-command suggestions, and reference project paths with `@`. |
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 `@`. |
24
24
  | **Git workflows** | Inspect changes, switch branches, review diffs, stage work, generate commit messages, push, and prepare pull requests through guided steps. |
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
- | **Desktop and mobile** | Use a full desktop workspace or a compact phone layout with touch-friendly navigation and controls. |
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
28
 
29
29
  ## Quick start
30
30
 
@@ -61,7 +61,18 @@ Check the server at any time with:
61
61
  2. Confirm the working directory in the footer or choose another project.
62
62
  3. Select a model and thinking effort.
63
63
  4. Enter a prompt, attach context if needed, and follow the live response.
64
- 5. Open the side panel for sessions, Git, app runners, themes, updates, and optional features.
64
+ 5. Open the Control Deck for sessions, Git, app runners, themes, updates, and optional features. Under **Controls → Interface**, choose **Top bar** or **Sidebar** for terminal tabs, then choose **Right**, **Left**, or **Both** for the Control Deck. In **Sidebar**, **Both** is unavailable; choosing **Right** or **Left** swaps the Control Deck and terminal/tabs rails across the chat.
65
+ 6. On desktop, drag the workspace-facing edge of any visible Control Deck—or the terminal/tabs rail in **Sidebar**—to choose a comfortable width. In **Both**, resize the left and right Control Decks independently; widths return on your next visit.
66
+
67
+ When session history is still loading, the main window shows **Loading agent output…** with a small inline spinner. Existing transcript content and controls remain available; no popup interrupts your work.
68
+
69
+ 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
+ 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
+
73
+ 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.
74
+
75
+ When agents exchange direct Intercom messages or use native subagent-supervisor coordination, one compact tag per conversation appears beneath the composer. Up to eight tags share one row; denser groups wrap into a compact grid instead of creating a horizontal scrollbar. Long names shorten with an ellipsis, while the full name remains available to assistive technology and on hover. Select a tag to open a read-only chat view showing the two agent names or IDs and their messages. Generic Intercom transport calls and received Intercom records stay out of the main agent-output transcript, while attachments, tool output, and reasoning remain excluded from the chat view.
65
76
 
66
77
  Useful shortcuts:
67
78
 
@@ -70,6 +81,7 @@ Useful shortcuts:
70
81
  - `Ctrl/Cmd+F` searches the active file, transcript, or subagent output and highlights every match.
71
82
  - `Alt+Enter` queues the composer as a follow-up.
72
83
  - Hold `Esc` to abort active work.
84
+ - In the Control Deck, use `Alt+Up` / `Alt+Down` to reorder a section. In **Both**, use `Alt+Left` / `Alt+Right` to move it between sides.
73
85
 
74
86
  ## Feature gallery
75
87
 
@@ -91,7 +103,7 @@ See the active project, model, context, Git state, queue, sessions, and common a
91
103
 
92
104
  **Optional feature needed:** None — the control panel is included in Pi Web UI core. Companion-specific sections require their corresponding packages.
93
105
 
94
- Manage the current session, workspace, model, theme, notifications, updates, usage, and optional packages.
106
+ Manage the current session, workspace, model, theme, notifications, updates, usage, and optional packages. The **Controls** section keeps each setting on one compact name/value row; point to or focus a setting name for plain-language help.
95
107
 
96
108
  #### Working-directory picker
97
109
 
@@ -101,6 +113,12 @@ Manage the current session, workspace, model, theme, notifications, updates, usa
101
113
 
102
114
  Browse, search, save, or create project directories and open them in the active Pi tab.
103
115
 
116
+ #### Files panel
117
+
118
+ **Optional feature needed:** None — the Files panel is included in Pi Web UI core.
119
+
120
+ Browse and search the files of the active project, open them in the viewer, and use the row menu for file actions. The viewer edits text, previews Markdown, and displays PNG, JPEG, GIF, WebP, and AVIF images read-only. In a Git repository, files and folders that Git ignores stay listed and fully usable, but appear greyed out so generated output such as `node_modules` or build folders is easy to tell apart. Point at a greyed row to see the “Ignored by Git” hint in its tooltip.
121
+
104
122
  #### Queue manager
105
123
 
106
124
  ![Pi Web UI queue panel with prompt-list controls and queued-message status](https://raw.githubusercontent.com/Firstp1ck/pi-coding-agent-forge/main/pi-package-webui/images/Webui_Queues_v0.4.8.png)
@@ -117,7 +135,7 @@ Review follow-ups, steering messages, user-bash work, and prompt lists while a t
117
135
 
118
136
  **Optional feature needed:** None — included in Pi Web UI core.
119
137
 
120
- Choose the supported reasoning effort before sending the next prompt.
138
+ Choose the supported reasoning effort before sending the next prompt. Local models that return tagged `<think>…</think>` reasoning keep that content in the Thinking card, including literal tag examples inside the reasoning.
121
139
 
122
140
  #### Scoped models
123
141
 
@@ -133,7 +151,7 @@ Search available models and control project or global model scope and cycling or
133
151
 
134
152
  **Optional feature needed:** None — the browser tools setup is included in Pi Web UI core.
135
153
 
136
- Enable tools for the current session or save the allowlist inherited by future sessions.
154
+ Enable tools for the current session, save a global default, or configure an exact model profile. Selecting that model automatically applies its tool profile unless the session has its own tool selection.
137
155
 
138
156
  #### Skills setup
139
157
 
@@ -141,7 +159,7 @@ Enable tools for the current session or save the allowlist inherited by future s
141
159
 
142
160
  **Optional feature needed:** None — the browser skills setup is included in Pi Web UI core.
143
161
 
144
- Find installed skills and manage session-specific or global activation.
162
+ Find installed skills and manage session, global, or exact-model activation. Selecting a configured model automatically applies its skill profile unless the session has its own skill selection.
145
163
 
146
164
  ### Project automation and Git
147
165
 
@@ -213,7 +231,7 @@ Explore token, cost, cache, model, session, and daily usage through the optional
213
231
 
214
232
  ## Optional features
215
233
 
216
- Open **Optional features** in the side panel to discover Web UI-aware companions. Configurable companions expose separate **Enable/Disable** and **Setup** actions, so configuration remains available without forcing a feature on.
234
+ Open **Optional features** in the side panel to discover Web UI-aware companions. Configurable companions expose separate **Enable/Disable** and **Setup** actions, so configuration remains available without forcing a feature on. The loaded **TUI Skills command** and **TUI Tools command** rows provide **Setup** buttons for the browser-native Skills Setup and Tools Setup dialogs.
217
235
 
218
236
  Popular additions include:
219
237
 
@@ -251,6 +269,10 @@ Use the optional Remote Web UI package when you need trusted-LAN access and PIN
251
269
 
252
270
  ## Technical details
253
271
 
272
+ Core updates use a persisted exact-target plan bound to a plan digest. The server verifies package ownership before mutation, supports npm-hoisted bundled Pi installs, and refuses plans with no accepted targets without entering the restart flow.
273
+
274
+ > **Before downgrading:** stop the Web UI and back up `~/.pi/webui/settings.json`. Older releases do not understand the two-sided Control Deck layout and can overwrite it. Re-upgrade before restoring the backup.
275
+
254
276
  See [TECHNICAL.md](TECHNICAL.md) for complete commands, configuration, update and rollback behavior, session continuity, security, compatibility, mobile behavior, and troubleshooting.
255
277
 
256
278
  Contributor-only architecture, API, and testing information lives in [DEVELOPMENT.md](DEVELOPMENT.md).
@@ -8,15 +8,26 @@ import { readRuntimePointer } from "../lib/update/supervisor.mjs";
8
8
  const bootstrapRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
9
9
  const bootstrapServer = path.join(bootstrapRoot, "bin", "pi-webui.mjs");
10
10
  const agentDir = process.env.PI_CODING_AGENT_DIR || path.join(homedir(), ".pi", "agent");
11
- const pointer = await readRuntimePointer(agentDir, "current");
12
- const serverEntry = pointer?.serverEntry || bootstrapServer;
13
- const child = spawn(process.execPath, [serverEntry, ...process.argv.slice(2)], {
14
- cwd: process.cwd(), env: process.env, stdio: "inherit", windowsHide: true,
15
- });
16
- child.once("error", (error) => { console.error(`Pi Web UI launcher failed: ${error.message || error}`); process.exitCode = 1; });
17
- child.once("exit", (code, signal) => {
18
- if (signal) {
19
- try { process.kill(process.pid, signal); } catch { process.exitCode = 1; }
20
- } else process.exitCode = code ?? 1;
21
- });
22
- for (const signal of ["SIGINT", "SIGTERM"]) process.on(signal, () => { try { child.kill(signal); } catch {} });
11
+
12
+ if (process.argv[2] === "agent") {
13
+ try {
14
+ const { runAgentCli } = await import("../lib/agent-run-adapters.mjs");
15
+ process.exitCode = await runAgentCli(process.argv.slice(3), { agentDir });
16
+ } catch (error) {
17
+ console.error(`Pi Web UI agent command failed: ${error?.message || error}`);
18
+ process.exitCode = 1;
19
+ }
20
+ } else {
21
+ const pointer = await readRuntimePointer(agentDir, "current");
22
+ const serverEntry = pointer?.serverEntry || bootstrapServer;
23
+ const child = spawn(process.execPath, [serverEntry, ...process.argv.slice(2)], {
24
+ cwd: process.cwd(), env: process.env, stdio: "inherit", windowsHide: true,
25
+ });
26
+ child.once("error", (error) => { console.error(`Pi Web UI launcher failed: ${error.message || error}`); process.exitCode = 1; });
27
+ child.once("exit", (code, signal) => {
28
+ if (signal) {
29
+ try { process.kill(process.pid, signal); } catch { process.exitCode = 1; }
30
+ } else process.exitCode = code ?? 1;
31
+ });
32
+ for (const signal of ["SIGINT", "SIGTERM"]) process.on(signal, () => { try { child.kill(signal); } catch {} });
33
+ }