@firstpick/pi-package-webui 0.8.2 → 0.8.4

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 (52) hide show
  1. package/README.md +76 -19
  2. package/bin/pi-webui.mjs +864 -140
  3. package/lib/WEBUI_TUI_NATIVE_PARITY.json +26 -0
  4. package/lib/git-workflow-preferences.mjs +246 -19
  5. package/lib/optional-feature-catalog.mjs +29 -0
  6. package/lib/optional-feature-migration.mjs +410 -0
  7. package/lib/session-summary-core.mjs +320 -0
  8. package/lib/session-summary-preferences.mjs +267 -0
  9. package/lib/thinking-stream-recovery.mjs +156 -0
  10. package/lib/ui-layout-settings.mjs +254 -0
  11. package/package.json +5 -40
  12. package/public/app.js +2898 -92
  13. package/public/index.html +77 -14
  14. package/public/service-worker.js +1 -1
  15. package/public/styles.css +669 -2
  16. package/session-summary.ts +403 -0
  17. package/tests/aur-review-widget-static.test.mjs +3 -2
  18. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  19. package/tests/browser/composer-action-grid-reorder.spec.mjs +303 -0
  20. package/tests/browser/feature-decision-output-popup.spec.mjs +156 -0
  21. package/tests/browser/interaction-continuity.spec.mjs +29 -0
  22. package/tests/browser/persistent-ui-layout.spec.mjs +744 -0
  23. package/tests/browser/session-summary.spec.mjs +271 -0
  24. package/tests/codex-fast-mode-static.test.mjs +10 -9
  25. package/tests/composer-action-grid-reorder-static.test.mjs +63 -0
  26. package/tests/fast-mode-client-static.test.mjs +2 -2
  27. package/tests/feature-decision-output-popup-static.test.mjs +172 -0
  28. package/tests/fixtures/fake-pi.mjs +51 -1
  29. package/tests/git-workflow-preferences.test.mjs +4 -2
  30. package/tests/http-endpoints-harness.test.mjs +507 -4
  31. package/tests/interaction-state-stability-static.test.mjs +3 -0
  32. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  33. package/tests/mobile-foundation-static.test.mjs +3 -3
  34. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  35. package/tests/mobile-static.test.mjs +118 -103
  36. package/tests/native-parity-harness.test.mjs +9 -1
  37. package/tests/native-parity.test.mjs +23 -1
  38. package/tests/open-issue-wizard-static.test.mjs +1 -1
  39. package/tests/optional-feature-migration-frontend.test.mjs +72 -0
  40. package/tests/optional-feature-migration.test.mjs +142 -0
  41. package/tests/persistent-ui-layout-static.test.mjs +267 -0
  42. package/tests/questionnaire-dialog.test.mjs +511 -0
  43. package/tests/queue-edit-reorder-static.test.mjs +1 -0
  44. package/tests/remote-auth-settings-harness.test.mjs +1 -1
  45. package/tests/session-summary-core.test.mjs +491 -0
  46. package/tests/session-summary-preferences.test.mjs +103 -0
  47. package/tests/side-panel-resize-static.test.mjs +1 -0
  48. package/tests/side-panel-section-reorder-static.test.mjs +3 -3
  49. package/tests/subagent-launch-slots.test.mjs +1 -1
  50. package/tests/thinking-stream-recovery.test.mjs +88 -0
  51. package/tests/ui-layout-settings.test.mjs +92 -0
  52. package/tests/webui-settings-locking.test.mjs +159 -0
@@ -0,0 +1,156 @@
1
+ const COMPLETED_RECOVERY_LIMIT = 128;
2
+
3
+ function text(value) {
4
+ return typeof value === "string" ? value : "";
5
+ }
6
+
7
+ function thinkingContentIndex(event = {}, update = event.assistantMessageEvent || {}) {
8
+ const value = update.contentIndex ?? event.contentIndex;
9
+ return Number.isInteger(value) && value >= 0 ? value : 0;
10
+ }
11
+
12
+ function thinkingPart(part) {
13
+ return !!(part && typeof part === "object" && (part.type === "thinking" || typeof part.thinking === "string"));
14
+ }
15
+
16
+ function thinkingPartText(part) {
17
+ if (!thinkingPart(part)) return "";
18
+ return text(part.thinking) || text(part.content) || text(part.text);
19
+ }
20
+
21
+ function messageThinkingAt(message, contentIndex) {
22
+ if (!Array.isArray(message?.content)) return "";
23
+ return thinkingPartText(message.content[contentIndex]);
24
+ }
25
+
26
+ function messageThinkingTemplateAt(message, contentIndex) {
27
+ if (!Array.isArray(message?.content)) return null;
28
+ const part = message.content[contentIndex];
29
+ return thinkingPart(part) ? part : null;
30
+ }
31
+
32
+ /**
33
+ * Prefer the longer value only when the two snapshots are prefix-compatible.
34
+ * Divergent authoritative content wins so provider corrections/redactions are
35
+ * never silently overwritten by an earlier stream accumulator.
36
+ */
37
+ export function reconcileThinkingSnapshot(accumulated, snapshot) {
38
+ const previous = text(accumulated);
39
+ const next = text(snapshot);
40
+ if (!previous) return next;
41
+ if (!next) return previous;
42
+ if (next.startsWith(previous)) return next;
43
+ if (previous.startsWith(next)) return previous;
44
+ return next;
45
+ }
46
+
47
+ function replaceThinkingAt(message, contentIndex, recovered, template = null) {
48
+ if (!message || message.role !== "assistant" || !Array.isArray(message.content) || !recovered) return message;
49
+ const current = message.content[contentIndex];
50
+ let replacement = null;
51
+ if (thinkingPart(current)) {
52
+ replacement = { ...current, type: current.type || "thinking", thinking: recovered };
53
+ } else if (thinkingPart(template) && contentIndex <= message.content.length) {
54
+ replacement = { ...template, type: template.type || "thinking", thinking: recovered };
55
+ }
56
+ if (!replacement) return message;
57
+ const content = [...message.content];
58
+ if (contentIndex < content.length) content[contentIndex] = replacement;
59
+ else content.push(replacement);
60
+ return { ...message, content };
61
+ }
62
+
63
+ function recoveryKey(timestamp, contentIndex) {
64
+ if (timestamp === undefined || timestamp === null || timestamp === "") return "";
65
+ return `${String(timestamp)}|${contentIndex}`;
66
+ }
67
+
68
+ export class ThinkingStreamRecovery {
69
+ #active = new Map();
70
+ #completed = new Map();
71
+
72
+ ingest(rawEvent) {
73
+ if (!rawEvent || typeof rawEvent !== "object") return rawEvent;
74
+ const event = rawEvent;
75
+ if (event.type === "message_start" && event.message?.role === "assistant") {
76
+ this.#active.clear();
77
+ return event;
78
+ }
79
+ if (event.type === "message_update") return this.#ingestUpdate(event);
80
+ if (event.type === "message_end" && event.message?.role === "assistant") return this.#ingestEnd(event);
81
+ return event;
82
+ }
83
+
84
+ applyToMessages(messages) {
85
+ if (!Array.isArray(messages) || this.#completed.size === 0) return messages;
86
+ let changed = false;
87
+ const recoveredMessages = messages.map((message) => {
88
+ if (message?.role !== "assistant") return message;
89
+ let recoveredMessage = message;
90
+ for (const record of this.#completed.values()) {
91
+ if (record.timestamp !== String(message.timestamp ?? "")) continue;
92
+ const authoritative = messageThinkingAt(recoveredMessage, record.contentIndex);
93
+ const recovered = reconcileThinkingSnapshot(record.text, authoritative);
94
+ if (recovered !== authoritative) {
95
+ recoveredMessage = replaceThinkingAt(recoveredMessage, record.contentIndex, recovered, record.template);
96
+ }
97
+ }
98
+ if (recoveredMessage !== message) changed = true;
99
+ return recoveredMessage;
100
+ });
101
+ return changed ? recoveredMessages : messages;
102
+ }
103
+
104
+ #ingestUpdate(event) {
105
+ const update = event.assistantMessageEvent;
106
+ if (!update || typeof update !== "object" || !["thinking_start", "thinking_delta", "thinking_end"].includes(update.type)) return event;
107
+ const contentIndex = thinkingContentIndex(event, update);
108
+ const existing = this.#active.get(contentIndex) || { text: "", template: null };
109
+ const partialText = messageThinkingAt(update.partial, contentIndex);
110
+ const direct = text(update.content) || text(update.thinking);
111
+ const delta = text(update.delta);
112
+ const template = messageThinkingTemplateAt(update.partial, contentIndex) || existing.template;
113
+ let recovered = existing.text;
114
+
115
+ if (update.type === "thinking_delta") {
116
+ const appended = recovered + delta;
117
+ recovered = partialText ? reconcileThinkingSnapshot(appended, partialText) : appended;
118
+ } else {
119
+ recovered = reconcileThinkingSnapshot(recovered, direct || partialText || delta);
120
+ }
121
+ this.#active.set(contentIndex, { text: recovered, template });
122
+
123
+ if (update.type !== "thinking_end" || !recovered) return event;
124
+ const authoritative = direct || partialText || delta;
125
+ if (recovered === authoritative && (!delta || delta === recovered)) return event;
126
+ const patchedUpdate = { ...update, content: recovered };
127
+ if (Object.prototype.hasOwnProperty.call(patchedUpdate, "delta")) patchedUpdate.delta = recovered;
128
+ if (update.partial) patchedUpdate.partial = replaceThinkingAt(update.partial, contentIndex, recovered, template);
129
+ return { ...event, assistantMessageEvent: patchedUpdate };
130
+ }
131
+
132
+ #ingestEnd(event) {
133
+ let message = event.message;
134
+ for (const [contentIndex, record] of this.#active) {
135
+ if (!record.text) continue;
136
+ const authoritative = messageThinkingAt(message, contentIndex);
137
+ const recovered = reconcileThinkingSnapshot(record.text, authoritative);
138
+ if (recovered !== authoritative) message = replaceThinkingAt(message, contentIndex, recovered, record.template);
139
+ const key = recoveryKey(message.timestamp, contentIndex);
140
+ if (key) this.#rememberCompleted(key, {
141
+ timestamp: String(message.timestamp),
142
+ contentIndex,
143
+ text: recovered,
144
+ template: record.template,
145
+ });
146
+ }
147
+ this.#active.clear();
148
+ return message === event.message ? event : { ...event, message };
149
+ }
150
+
151
+ #rememberCompleted(key, record) {
152
+ this.#completed.delete(key);
153
+ this.#completed.set(key, record);
154
+ while (this.#completed.size > COMPLETED_RECOVERY_LIMIT) this.#completed.delete(this.#completed.keys().next().value);
155
+ }
156
+ }
@@ -0,0 +1,254 @@
1
+ import { createHash } from "node:crypto";
2
+
3
+ export const UI_LAYOUT_VERSION = 1;
4
+ export const UI_LAYOUT_REQUEST_MAX_BYTES = 32 * 1024;
5
+ export const UI_LAYOUT_LIMITS = Object.freeze({
6
+ idLength: 256,
7
+ titleLength: 160,
8
+ listItems: 128,
9
+ groups: 32,
10
+ gridColumns: 24,
11
+ gridSlots: 4096,
12
+ fileViewerWidthMin: 384,
13
+ fileViewerWidthMax: 4096,
14
+ });
15
+
16
+ const UNSAFE_OBJECT_KEYS = new Set(["__proto__", "constructor", "prototype"]);
17
+ const TERMINAL_TAB_LAYOUTS = new Set(["top", "left"]);
18
+
19
+ function objectValue(value) {
20
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
21
+ }
22
+
23
+ function own(value, key) {
24
+ return Object.prototype.hasOwnProperty.call(value, key);
25
+ }
26
+
27
+ function invalid(message) {
28
+ const error = new TypeError(message);
29
+ error.code = "UI_LAYOUT_INVALID";
30
+ throw error;
31
+ }
32
+
33
+ function assertOnlyKeys(value, allowed, label) {
34
+ const unknown = Object.keys(value).filter((key) => !allowed.has(key));
35
+ if (unknown.length) invalid(`${label} contains unsupported field${unknown.length === 1 ? "" : "s"}: ${unknown.join(", ")}`);
36
+ }
37
+
38
+ function boundedString(value, label, maxLength = UI_LAYOUT_LIMITS.idLength) {
39
+ if (typeof value !== "string" || value.length === 0 || value.length > maxLength || value !== value.trim() || /[\u0000-\u001f\u007f]/u.test(value)) {
40
+ invalid(`${label} must be a non-empty trimmed string of at most ${maxLength} characters without control characters`);
41
+ }
42
+ return value;
43
+ }
44
+
45
+ function boundedUniqueStringList(value, label) {
46
+ if (!Array.isArray(value) || value.length > UI_LAYOUT_LIMITS.listItems) invalid(`${label} must be an array with at most ${UI_LAYOUT_LIMITS.listItems} items`);
47
+ const seen = new Set();
48
+ return value.map((item, index) => {
49
+ const result = boundedString(item, `${label}[${index}]`);
50
+ if (seen.has(result)) invalid(`${label} must not contain duplicate values`);
51
+ seen.add(result);
52
+ return result;
53
+ });
54
+ }
55
+
56
+ function nullable(value, validate) {
57
+ return value === null ? null : validate(value);
58
+ }
59
+
60
+ function validateSidePanel(value, { partial = false } = {}) {
61
+ const source = objectValue(value);
62
+ if (!source) invalid("layout.sidePanel must be an object or null");
63
+ const fields = new Set(["sectionOrder", "collapsedSectionIds", "hiddenSectionIds", "collapsed"]);
64
+ assertOnlyKeys(source, fields, "layout.sidePanel");
65
+ if (partial && Object.keys(source).length === 0) invalid("layout.sidePanel must name at least one field");
66
+ const result = {};
67
+ for (const field of ["sectionOrder", "collapsedSectionIds", "hiddenSectionIds"]) {
68
+ if (!partial || own(source, field)) result[field] = nullable(source[field] ?? null, (entry) => boundedUniqueStringList(entry, `layout.sidePanel.${field}`));
69
+ }
70
+ if (!partial || own(source, "collapsed")) {
71
+ const collapsed = source.collapsed ?? null;
72
+ if (collapsed !== null && typeof collapsed !== "boolean") invalid("layout.sidePanel.collapsed must be a boolean or null");
73
+ result.collapsed = collapsed;
74
+ }
75
+ return result;
76
+ }
77
+
78
+ function validateGrid(value) {
79
+ const source = objectValue(value);
80
+ if (!source) invalid("layout.composerActions.grid must be an object or null");
81
+ assertOnlyKeys(source, new Set(["version", "columns", "positions"]), "layout.composerActions.grid");
82
+ if (source.version !== 2) invalid("layout.composerActions.grid.version must be 2");
83
+ if (!Number.isInteger(source.columns) || source.columns < 1 || source.columns > UI_LAYOUT_LIMITS.gridColumns) {
84
+ invalid(`layout.composerActions.grid.columns must be an integer between 1 and ${UI_LAYOUT_LIMITS.gridColumns}`);
85
+ }
86
+ const positions = objectValue(source.positions);
87
+ if (!positions) invalid("layout.composerActions.grid.positions must be an object");
88
+ const entries = Object.entries(positions);
89
+ if (entries.length > UI_LAYOUT_LIMITS.listItems) invalid(`layout.composerActions.grid.positions must contain at most ${UI_LAYOUT_LIMITS.listItems} items`);
90
+ const result = {};
91
+ const usedSlots = new Set();
92
+ for (const [rawId, slot] of entries) {
93
+ const id = boundedString(rawId, "layout.composerActions.grid position id");
94
+ if (UNSAFE_OBJECT_KEYS.has(id)) invalid("layout.composerActions.grid contains an unsupported position id");
95
+ if (!Number.isInteger(slot) || slot < 0 || slot >= UI_LAYOUT_LIMITS.gridSlots) {
96
+ invalid(`layout.composerActions.grid positions must be integers between 0 and ${UI_LAYOUT_LIMITS.gridSlots - 1}`);
97
+ }
98
+ if (usedSlots.has(slot)) invalid("layout.composerActions.grid positions must not reuse a slot");
99
+ usedSlots.add(slot);
100
+ result[id] = slot;
101
+ }
102
+ return { version: 2, columns: source.columns, positions: result };
103
+ }
104
+
105
+ function validateComposerActions(value, { partial = false } = {}) {
106
+ const source = objectValue(value);
107
+ if (!source) invalid("layout.composerActions must be an object or null");
108
+ assertOnlyKeys(source, new Set(["order", "grid"]), "layout.composerActions");
109
+ if (partial && (!own(source, "order") || !own(source, "grid"))) {
110
+ invalid("layout.composerActions must include order and grid together");
111
+ }
112
+ return {
113
+ order: nullable(source.order ?? null, (entry) => boundedUniqueStringList(entry, "layout.composerActions.order")),
114
+ grid: nullable(source.grid ?? null, validateGrid),
115
+ };
116
+ }
117
+
118
+ function validateCustomGroups(value) {
119
+ const source = objectValue(value);
120
+ if (!source) invalid("layout.terminalTabs.customGroups must be an object or null");
121
+ assertOnlyKeys(source, new Set(["version", "groups"]), "layout.terminalTabs.customGroups");
122
+ if (source.version !== 1) invalid("layout.terminalTabs.customGroups.version must be 1");
123
+ if (!Array.isArray(source.groups) || source.groups.length > UI_LAYOUT_LIMITS.groups) {
124
+ invalid(`layout.terminalTabs.customGroups.groups must be an array with at most ${UI_LAYOUT_LIMITS.groups} groups`);
125
+ }
126
+ const groupIds = new Set();
127
+ const claimedTabIds = new Set();
128
+ const groups = source.groups.map((group, index) => {
129
+ const record = objectValue(group);
130
+ if (!record) invalid(`layout.terminalTabs.customGroups.groups[${index}] must be an object`);
131
+ assertOnlyKeys(record, new Set(["id", "title", "tabIds"]), `layout.terminalTabs.customGroups.groups[${index}]`);
132
+ const id = boundedString(record.id, `layout.terminalTabs.customGroups.groups[${index}].id`);
133
+ if (groupIds.has(id)) invalid("layout.terminalTabs.customGroups group ids must be unique");
134
+ groupIds.add(id);
135
+ const title = boundedString(record.title, `layout.terminalTabs.customGroups.groups[${index}].title`, UI_LAYOUT_LIMITS.titleLength);
136
+ const tabIds = boundedUniqueStringList(record.tabIds, `layout.terminalTabs.customGroups.groups[${index}].tabIds`);
137
+ for (const tabId of tabIds) {
138
+ if (claimedTabIds.has(tabId)) invalid("layout.terminalTabs.customGroups tab ids may appear in only one group");
139
+ claimedTabIds.add(tabId);
140
+ }
141
+ return { id, title, tabIds };
142
+ });
143
+ return { version: 1, groups };
144
+ }
145
+
146
+ function validateTerminalTabs(value, { partial = false } = {}) {
147
+ const source = objectValue(value);
148
+ if (!source) invalid("layout.terminalTabs must be an object or null");
149
+ assertOnlyKeys(source, new Set(["layout", "customGroups"]), "layout.terminalTabs");
150
+ if (partial && Object.keys(source).length === 0) invalid("layout.terminalTabs must name at least one field");
151
+ const result = {};
152
+ if (!partial || own(source, "layout")) {
153
+ const layout = source.layout ?? null;
154
+ if (layout !== null && !TERMINAL_TAB_LAYOUTS.has(layout)) invalid("layout.terminalTabs.layout must be top, left, or null");
155
+ result.layout = layout;
156
+ }
157
+ if (!partial || own(source, "customGroups")) result.customGroups = nullable(source.customGroups ?? null, validateCustomGroups);
158
+ return result;
159
+ }
160
+
161
+ function validateFileViewerWidth(value) {
162
+ if (!Number.isFinite(value) || value < UI_LAYOUT_LIMITS.fileViewerWidthMin || value > UI_LAYOUT_LIMITS.fileViewerWidthMax) {
163
+ invalid(`layout.fileViewerWidth must be between ${UI_LAYOUT_LIMITS.fileViewerWidthMin} and ${UI_LAYOUT_LIMITS.fileViewerWidthMax} pixels or null`);
164
+ }
165
+ return Math.round(value);
166
+ }
167
+
168
+ export function defaultUiLayout() {
169
+ return {
170
+ version: UI_LAYOUT_VERSION,
171
+ sidePanel: { sectionOrder: null, collapsedSectionIds: null, hiddenSectionIds: null, collapsed: null },
172
+ composerActions: { order: null, grid: null },
173
+ footerScopedModelOrder: null,
174
+ terminalTabs: { layout: null, customGroups: null },
175
+ fileViewerWidth: null,
176
+ };
177
+ }
178
+
179
+ function softField(validate, fallback = null) {
180
+ try {
181
+ return validate();
182
+ } catch {
183
+ return fallback;
184
+ }
185
+ }
186
+
187
+ export function normalizeUiLayout(value) {
188
+ const source = objectValue(value);
189
+ const defaults = defaultUiLayout();
190
+ if (!source || source.version !== UI_LAYOUT_VERSION) return defaults;
191
+ const sidePanel = objectValue(source.sidePanel);
192
+ const composerActions = objectValue(source.composerActions);
193
+ const terminalTabs = objectValue(source.terminalTabs);
194
+ return {
195
+ version: UI_LAYOUT_VERSION,
196
+ sidePanel: {
197
+ sectionOrder: softField(() => nullable(sidePanel?.sectionOrder ?? null, (entry) => boundedUniqueStringList(entry, "uiLayout.sidePanel.sectionOrder"))),
198
+ collapsedSectionIds: softField(() => nullable(sidePanel?.collapsedSectionIds ?? null, (entry) => boundedUniqueStringList(entry, "uiLayout.sidePanel.collapsedSectionIds"))),
199
+ hiddenSectionIds: softField(() => nullable(sidePanel?.hiddenSectionIds ?? null, (entry) => boundedUniqueStringList(entry, "uiLayout.sidePanel.hiddenSectionIds"))),
200
+ collapsed: typeof sidePanel?.collapsed === "boolean" ? sidePanel.collapsed : null,
201
+ },
202
+ composerActions: {
203
+ order: softField(() => nullable(composerActions?.order ?? null, (entry) => boundedUniqueStringList(entry, "uiLayout.composerActions.order"))),
204
+ grid: softField(() => nullable(composerActions?.grid ?? null, validateGrid)),
205
+ },
206
+ footerScopedModelOrder: softField(() => nullable(source.footerScopedModelOrder ?? null, (entry) => boundedUniqueStringList(entry, "uiLayout.footerScopedModelOrder"))),
207
+ terminalTabs: {
208
+ layout: TERMINAL_TAB_LAYOUTS.has(terminalTabs?.layout) ? terminalTabs.layout : null,
209
+ customGroups: softField(() => nullable(terminalTabs?.customGroups ?? null, validateCustomGroups)),
210
+ },
211
+ fileViewerWidth: softField(() => nullable(source.fileViewerWidth ?? null, validateFileViewerWidth)),
212
+ };
213
+ }
214
+
215
+ export function validateUiLayoutPatch(value) {
216
+ const source = objectValue(value);
217
+ if (!source) invalid("layout must be an object");
218
+ const allowed = new Set(["version", "sidePanel", "composerActions", "footerScopedModelOrder", "terminalTabs", "fileViewerWidth"]);
219
+ assertOnlyKeys(source, allowed, "layout");
220
+ if (own(source, "version") && source.version !== UI_LAYOUT_VERSION) invalid(`layout.version must be ${UI_LAYOUT_VERSION}`);
221
+ const mutableFields = [...allowed].filter((field) => field !== "version" && own(source, field));
222
+ if (mutableFields.length === 0) invalid("layout must name at least one mutable field");
223
+ const patch = {};
224
+ if (own(source, "sidePanel")) patch.sidePanel = nullable(source.sidePanel, (entry) => validateSidePanel(entry, { partial: true }));
225
+ if (own(source, "composerActions")) patch.composerActions = nullable(source.composerActions, (entry) => validateComposerActions(entry, { partial: true }));
226
+ if (own(source, "footerScopedModelOrder")) patch.footerScopedModelOrder = nullable(source.footerScopedModelOrder, (entry) => boundedUniqueStringList(entry, "layout.footerScopedModelOrder"));
227
+ if (own(source, "terminalTabs")) patch.terminalTabs = nullable(source.terminalTabs, (entry) => validateTerminalTabs(entry, { partial: true }));
228
+ if (own(source, "fileViewerWidth")) patch.fileViewerWidth = nullable(source.fileViewerWidth, validateFileViewerWidth);
229
+ return patch;
230
+ }
231
+
232
+ export function mergeUiLayout(current, patch) {
233
+ const base = normalizeUiLayout(current);
234
+ const value = validateUiLayoutPatch(patch);
235
+ const merged = { ...base };
236
+ if (own(value, "sidePanel")) {
237
+ merged.sidePanel = value.sidePanel === null
238
+ ? defaultUiLayout().sidePanel
239
+ : { ...base.sidePanel, ...value.sidePanel };
240
+ }
241
+ if (own(value, "composerActions")) merged.composerActions = value.composerActions === null ? defaultUiLayout().composerActions : value.composerActions;
242
+ if (own(value, "footerScopedModelOrder")) merged.footerScopedModelOrder = value.footerScopedModelOrder;
243
+ if (own(value, "terminalTabs")) {
244
+ merged.terminalTabs = value.terminalTabs === null
245
+ ? defaultUiLayout().terminalTabs
246
+ : { ...base.terminalTabs, ...value.terminalTabs };
247
+ }
248
+ if (own(value, "fileViewerWidth")) merged.fileViewerWidth = value.fileViewerWidth;
249
+ return normalizeUiLayout(merged);
250
+ }
251
+
252
+ export function uiLayoutRevision(value) {
253
+ return createHash("sha256").update(JSON.stringify(normalizeUiLayout(value))).digest("hex");
254
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firstpick/pi-package-webui",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
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",
@@ -23,29 +23,7 @@
23
23
  "image": "https://raw.githubusercontent.com/Firstp1ck/pi-coding-agent-forge/main/pi-package-webui/images/Webui_MainWindow_v0.4.8.png",
24
24
  "extensions": [
25
25
  "./index.ts",
26
- "node_modules/@firstpick/pi-extension-bang-command-autocomplete/index.ts",
27
- "node_modules/@firstpick/pi-extension-fish-user-bash/index.ts",
28
- "node_modules/@firstpick/pi-extension-btw/index.ts",
29
- "node_modules/@firstpick/pi-extension-codex-fast-mode/index.ts",
30
- "node_modules/@firstpick/pi-extension-git-footer-status/index.ts",
31
- "node_modules/@firstpick/pi-extension-release-aur/index.ts",
32
- "node_modules/@firstpick/pi-extension-release-npm/index.ts",
33
- "node_modules/@firstpick/pi-extension-workflows/index.ts",
34
- "node_modules/@firstpick/pi-extension-safety-guard/index.ts",
35
- "node_modules/@firstpick/pi-extension-setup-skills/index.ts",
36
- "node_modules/@firstpick/pi-extension-stats/index.ts",
37
- "node_modules/@firstpick/pi-extension-todo-progress/index.ts",
38
- "node_modules/@firstpick/pi-extension-tools/index.ts",
39
- "node_modules/@firstpick/pi-package-remote-webui/index.ts"
40
- ],
41
- "skills": [
42
- "node_modules/@firstpick/pi-extension-release-aur/skills"
43
- ],
44
- "prompts": [
45
- "node_modules/@firstpick/pi-prompts-git-pr/prompts"
46
- ],
47
- "themes": [
48
- "node_modules/@firstpick/pi-themes-bundle/themes"
26
+ "./session-summary.ts"
49
27
  ]
50
28
  },
51
29
  "bin": {
@@ -57,32 +35,19 @@
57
35
  "test:browser": "playwright test"
58
36
  },
59
37
  "dependencies": {
38
+ "@earendil-works/pi-ai": "^0.83.0",
60
39
  "@earendil-works/pi-coding-agent": "^0.83.0",
40
+ "@earendil-works/pi-tui": "^0.83.0",
61
41
  "@firstpick/pi-utils": "^0.2.5",
62
42
  "mermaid": "^11.15.0",
63
43
  "typebox": "^1.3.6"
64
44
  },
65
45
  "optionalDependencies": {
66
- "@firstpick/pi-extension-bang-command-autocomplete": "^0.2.2",
67
- "@firstpick/pi-extension-btw": "^0.1.4",
68
- "@firstpick/pi-extension-codex-fast-mode": "^0.1.0",
69
- "@firstpick/pi-extension-fish-user-bash": "^0.2.2",
70
- "@firstpick/pi-extension-git-footer-status": "^0.4.3",
71
- "@firstpick/pi-extension-release-aur": "^0.1.8",
72
- "@firstpick/pi-extension-release-npm": "^0.4.4",
73
- "@firstpick/pi-extension-safety-guard": "^0.2.6",
74
- "@firstpick/pi-extension-setup-skills": "^0.1.9",
75
- "@firstpick/pi-extension-stats": "^0.2.9",
76
- "@firstpick/pi-extension-todo-progress": "^0.2.9",
77
- "@firstpick/pi-extension-tools": "^0.1.7",
78
- "@firstpick/pi-extension-workflows": "^0.1.7",
79
- "@firstpick/pi-package-remote-webui": "^0.1.8",
80
- "@firstpick/pi-prompts-git-pr": "^0.1.5",
81
- "@firstpick/pi-themes-bundle": "^0.1.5",
82
46
  "node-pty": "^1.1.0"
83
47
  },
84
48
  "files": [
85
49
  "index.ts",
50
+ "session-summary.ts",
86
51
  "lib",
87
52
  "webui-rpc-helper.mjs",
88
53
  "bin",