pi-stereo-view 0.1.15 → 0.1.17
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/CHANGELOG.md +18 -0
- package/README.md +6 -6
- package/package.json +1 -1
- package/src/compact-tools.ts +1 -1
- package/src/content.ts +2 -2
- package/src/index.ts +29 -9
- package/src/layout.ts +116 -51
- package/src/native.ts +10 -10
- package/src/nested-calls.ts +1 -1
- package/src/nested-tree.ts +6 -6
- package/src/search-highlight.ts +1 -1
- package/src/search-matcher.ts +1 -1
- package/src/search.ts +1 -1
- package/src/timestamps.ts +1 -1
- package/src/tool-groups.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.1.17 - 2026-11-09
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Pi loads the extension faster.
|
|
10
|
+
|
|
11
|
+
## 0.1.16 - 2026-11-08
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Use descriptive labels for text controls and wrap controls onto additional lines in narrow panels.
|
|
16
|
+
- Separate the toolbar from history with a full-width line in combined view.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Close Stereo View settings when clicking outside the menu.
|
|
21
|
+
- Keep the panel header background continuous between controls and across wrapped rows.
|
|
22
|
+
|
|
5
23
|
## 0.1.15 - 2026-11-08
|
|
6
24
|
|
|
7
25
|
### Added
|
package/README.md
CHANGED
|
@@ -78,13 +78,13 @@ Click the toolbar and the buttons in each panel's header. Buttons use icons by d
|
|
|
78
78
|
|
|
79
79
|
| Icons | Text | Action |
|
|
80
80
|
| --- | --- | --- |
|
|
81
|
-
| `[ ▣ ]` / `[ ◫ ]` | `[
|
|
82
|
-
| `[ ▤ ]` / `[ ▥ ]` | `[Rows]` / `[
|
|
81
|
+
| `[ ▣ ]` / `[ ◫ ]` | `[Combine]` / `[Split]` | Turn split history off / on. |
|
|
82
|
+
| `[ ▤ ]` / `[ ▥ ]` | `[Rows]` / `[Columns]` | Switch between rows and columns. |
|
|
83
83
|
| `[ ↕ ]` / `[ ↔ ]` | `[Swap]` | Swap the panels. |
|
|
84
|
-
| `[ ↗ ]` / `[ ↙ ]` | `[
|
|
84
|
+
| `[ ↗ ]` / `[ ↙ ]` | `[Maximize]` / `[Restore]` | Zoom a panel / restore the split. |
|
|
85
85
|
| `[ ≡ ]` | `[Menu]` | Open display and Conversation height settings. |
|
|
86
86
|
| `[ ⌕ ]` | `[Find]` | Search this panel. |
|
|
87
|
-
| `[ ⊟ ]` / `[ ⊞ ]` | `[
|
|
87
|
+
| `[ ⊟ ]` / `[ ⊞ ]` | `[Compact tools]` / `[Full tools]` | Compact Activity tools / restore full tools. |
|
|
88
88
|
|
|
89
89
|
**Resize:** drag the double line between the panels — `═` in rows, `║` in columns.
|
|
90
90
|
|
|
@@ -98,11 +98,11 @@ Swap the panels whenever you want. Zoom a panel to give it the whole history are
|
|
|
98
98
|
|
|
99
99
|
## Compact Activity
|
|
100
100
|
|
|
101
|
-
Click `[ ⊟ ]` or `[
|
|
101
|
+
Click `[ ⊟ ]` or `[Compact tools]` beside Find and Maximize in the Activity header to show compact tool calls. Adjacent calls to the same tool in the same state share a header with a count; every failed call stays separate, even beside another failure. Click that header to show the individual compact rows, then click a row to open its original full card and linked output. Left guides mark each level: members sit inside their group, and an open card and its linked output sit inside their call. Collapse a call or its group independently; reopening the group keeps your expanded calls. Thinking, Conversation content and different tools end a group.
|
|
102
102
|
|
|
103
103
|
Group and call headers show `▸` when collapsed and `▾` when expanded. Each call row has a one-cell left gutter, a colored status dot, its tool name and a short argument description. A group shows its shared running or successful state. Failed calls expose their own status and argument preview without opening a group. Long descriptions are truncated, not the saved calls. Verified local MCP forwarding aliases use their native tool's name; foreign, ambiguous and unknown tools keep their original identity.
|
|
104
104
|
|
|
105
|
-
Search and `/stereo-view copy` still include full saved results and linked output. A search match opens its group and call temporarily; clearing the search restores your previous expansion. You can also click `[ ⊞ ]` or `[
|
|
105
|
+
Search and `/stereo-view copy` still include full saved results and linked output. A search match opens its group and call temporarily; clearing the search restores your previous expansion. You can also click `[ ⊞ ]` or `[Full tools]` in the Activity header to restore full tools. Conversation and combined history keep their normal display.
|
|
106
106
|
|
|
107
107
|
Compact tools work in columns, rows and zoomed Activity. The choice survives restart and defaults to off. For keyboard access, run `/stereo-view settings` and change **Compact Activity tools**.
|
|
108
108
|
|
package/package.json
CHANGED
package/src/compact-tools.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { stripTerminalSequences, truncateToWidth, visibleWidth, type Component, type TuiMouseEvent } from "@earendil-works/pi-tui";
|
|
3
|
-
import type { ToolSummary } from "./content.
|
|
3
|
+
import type { ToolSummary } from "./content.ts";
|
|
4
4
|
|
|
5
5
|
const singleLine = (text: string): string => stripTerminalSequences(text).replace(/[\x00-\x1f\x7f-\x9f]/g, " ").replace(/\s+/g, " ").trim();
|
|
6
6
|
|
package/src/content.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Container, Markdown, Text, stripTerminalSequences, type Component } from "@earendil-works/pi-tui";
|
|
2
|
-
import { searchText, type SearchEntry } from "./search.
|
|
3
|
-
import { NestedCalls } from "./nested-calls.
|
|
2
|
+
import { searchText, type SearchEntry } from "./search.ts";
|
|
3
|
+
import { NestedCalls } from "./nested-calls.ts";
|
|
4
4
|
|
|
5
5
|
export type Pane = "activity" | "chat";
|
|
6
6
|
export type ContentKind = "dialogue" | "system" | "thinking" | "tool" | "shell";
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { copyToClipboard, getAgentDir, getSettingsListTheme, type ExtensionAPI, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import { Box, Container, isKeyRelease, matchesKey, SettingsList, Text, type TUI } from "@earendil-works/pi-tui";
|
|
4
|
-
import { TranscriptLayout } from "./layout.
|
|
5
|
-
import { TOOL_START_ENTRY, TranscriptTimestamps } from "./timestamps.
|
|
6
|
-
import { defaults, loadPreferences, savePreferences, type Preferences } from "./preferences.
|
|
7
|
-
import { beforeFirstFrame } from "./startup.
|
|
8
|
-
import { observeNativeEditor } from "./native-editor.
|
|
9
|
-
import { NestedCalls } from "./nested-calls.
|
|
3
|
+
import { Box, Container, isKeyRelease, matchesKey, SettingsList, Text, type OverlayHandle, type TUI, type TuiMouseEvent } from "@earendil-works/pi-tui";
|
|
4
|
+
import { TranscriptLayout } from "./layout.ts";
|
|
5
|
+
import { TOOL_START_ENTRY, TranscriptTimestamps } from "./timestamps.ts";
|
|
6
|
+
import { defaults, loadPreferences, savePreferences, type Preferences } from "./preferences.ts";
|
|
7
|
+
import { beforeFirstFrame } from "./startup.ts";
|
|
8
|
+
import { observeNativeEditor } from "./native-editor.ts";
|
|
9
|
+
import { NestedCalls } from "./nested-calls.ts";
|
|
10
10
|
|
|
11
11
|
/** Split native fullscreen history without changing message content or the input dock. */
|
|
12
12
|
export default async function transcript(pi: ExtensionAPI): Promise<void> {
|
|
@@ -37,7 +37,21 @@ export default async function transcript(pi: ExtensionAPI): Promise<void> {
|
|
|
37
37
|
settingsOpen = true;
|
|
38
38
|
closeSearch();
|
|
39
39
|
try {
|
|
40
|
+
let overlay: OverlayHandle | undefined;
|
|
40
41
|
await ui.custom<void>((tui, _theme, _keys, done) => {
|
|
42
|
+
// Pi dispatches outside clicks to the underlying layout, not the overlay.
|
|
43
|
+
const viewport = tui as unknown as { dispatchMouseToOverlay?: (event: TuiMouseEvent) => { hit: boolean } };
|
|
44
|
+
const dispatch = viewport.dispatchMouseToOverlay;
|
|
45
|
+
const ownDispatch = Object.hasOwn(viewport, "dispatchMouseToOverlay");
|
|
46
|
+
const dismissOutside = dispatch && function (event: TuiMouseEvent): { hit: boolean } {
|
|
47
|
+
const result = dispatch.call(viewport, event);
|
|
48
|
+
if (!result.hit && event.type === "press" && event.button === "left" && overlay?.isFocused()) {
|
|
49
|
+
done();
|
|
50
|
+
return { hit: true };
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
if (dismissOutside) viewport.dispatchMouseToOverlay = dismissOutside;
|
|
41
55
|
const list = new SettingsList([{
|
|
42
56
|
id: "timestamps", label: "Show timestamps",
|
|
43
57
|
description: "Hide clock rows without changing messages or recorded tool starts.",
|
|
@@ -78,12 +92,18 @@ export default async function transcript(pi: ExtensionAPI): Promise<void> {
|
|
|
78
92
|
render: (width: number) => box.render(width),
|
|
79
93
|
invalidate: () => box.invalidate(),
|
|
80
94
|
handleMouse: (event) => box.handleMouse(event),
|
|
95
|
+
dispose: () => {
|
|
96
|
+
if (viewport.dispatchMouseToOverlay === dismissOutside) {
|
|
97
|
+
if (ownDispatch) viewport.dispatchMouseToOverlay = dispatch;
|
|
98
|
+
else delete viewport.dispatchMouseToOverlay;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
81
101
|
handleInput: (data: string) => {
|
|
82
102
|
list.handleInput(data);
|
|
83
103
|
tui.requestRender();
|
|
84
104
|
},
|
|
85
105
|
};
|
|
86
|
-
}, { overlay: true, overlayOptions: { width: 60, margin: 1 } });
|
|
106
|
+
}, { overlay: true, overlayOptions: { width: 60, margin: 1 }, onHandle: handle => { overlay = handle; } });
|
|
87
107
|
} finally {
|
|
88
108
|
settingsOpen = false;
|
|
89
109
|
}
|
|
@@ -243,7 +263,7 @@ export default async function transcript(pi: ExtensionAPI): Promise<void> {
|
|
|
243
263
|
const choice = await ctx.ui.select("Copy a block from the active panel", blocks.map(block => block.label));
|
|
244
264
|
blocks.find(block => block.label === choice)?.copy();
|
|
245
265
|
} else if (action === "help") {
|
|
246
|
-
ctx.ui.notify("pi-stereo-view: choose icon or text buttons in /stereo-view settings. Buttons: ▣/
|
|
266
|
+
ctx.ui.notify("pi-stereo-view: choose icon or text buttons in /stereo-view settings. Buttons: ▣/Combine combines history, ◫/Split separates it, ▤/Rows and ▥/Columns change layout, ↕/↔/Swap exchanges panels, ↗/Maximize and ↙/Restore change panel size, ⌕/Find searches, ⊟/Compact tools and ⊞/Full tools toggle compact tools, ≡/Menu opens settings, ⧉/Copy copies a block. /stereo-view copy chooses a block with the keyboard. Ctrl+F searches and PgUp/PgDn scroll the active panel; Ctrl+Alt+Up/Down switches it. Drag the ═ or ║ divider to resize.", "info");
|
|
247
267
|
} else if (action === "swap") layout.swap();
|
|
248
268
|
else if (action === "width" && /^\d+$/.test(target ?? "")) layout.setWidth(Number(target));
|
|
249
269
|
else if (action === "height" && target === "auto") layout.setHeight(null);
|
package/src/layout.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { setImmediate } from "node:timers/promises";
|
|
2
2
|
import type { Theme, ToolInfo } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import {
|
|
4
|
-
Container, HStack, isViewportTUI, mixColors, MouseRegion, rgbColor, ScrollView, Text, truncateToWidth, VStack,
|
|
4
|
+
Container, HStack, isViewportTUI, mixColors, MouseRegion, rgbColor, ScrollView, Text, truncateToWidth, visibleWidth, VStack,
|
|
5
5
|
type Color, type Component, type ScrollViewOptions, type StackChild, type TUI, type TuiMouseEvent,
|
|
6
6
|
} from "@earendil-works/pi-tui";
|
|
7
|
-
import { NativeDocument, type Pane } from "./native.
|
|
8
|
-
import { NativeContentIndex } from "./content.
|
|
9
|
-
import { NestedCalls } from "./nested-calls.
|
|
10
|
-
import type { Preferences } from "./preferences.
|
|
11
|
-
import type { TranscriptTimestamps } from "./timestamps.
|
|
12
|
-
import { PANEL_SEARCH_ROWS, PanelSearch, PanelSearchShortcut, type SearchHit } from "./search.
|
|
7
|
+
import { NativeDocument, type Pane } from "./native.ts";
|
|
8
|
+
import { NativeContentIndex } from "./content.ts";
|
|
9
|
+
import { NestedCalls } from "./nested-calls.ts";
|
|
10
|
+
import type { Preferences } from "./preferences.ts";
|
|
11
|
+
import type { TranscriptTimestamps } from "./timestamps.ts";
|
|
12
|
+
import { PANEL_SEARCH_ROWS, PanelSearch, PanelSearchShortcut, type SearchHit } from "./search.ts";
|
|
13
13
|
|
|
14
14
|
type NativeTui = TUI & {
|
|
15
15
|
layoutRoot?: Container;
|
|
@@ -44,20 +44,72 @@ class NativeSurfaceScrollView extends ScrollView {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
class ButtonStack extends
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
class ButtonStack extends VStack {
|
|
48
|
+
private style: "icons" | "text" = "icons";
|
|
49
|
+
private lastLayout = "";
|
|
50
|
+
|
|
51
|
+
constructor(private readonly items: StackChild[], private readonly controls: { index: number; icon: number }[],
|
|
52
|
+
private readonly titleLength?: number, private readonly fill?: Component) {
|
|
53
|
+
super();
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
setStyle(style: "icons" | "text"): void {
|
|
54
|
-
if (this.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
if (this.style !== style) { this.style = style; this.lastLayout = ""; }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
override render(width: number): string[] {
|
|
61
|
+
const textWidth = (index: number): number => {
|
|
62
|
+
const item = this.items[index];
|
|
63
|
+
const component = "component" in item ? item.component : item;
|
|
64
|
+
return (component as Component & { textWidth(): number }).textWidth();
|
|
65
|
+
};
|
|
66
|
+
const layout = `${this.style}:${width}:${this.style === "text" ? this.controls.map(control => textWidth(control.index)).join(",") : ""}`;
|
|
67
|
+
if (layout !== this.lastLayout) {
|
|
68
|
+
this.lastLayout = layout;
|
|
69
|
+
this.clear();
|
|
70
|
+
const entries = this.items.map((item, index) => {
|
|
71
|
+
const entry = "component" in item ? { ...item } : { component: item };
|
|
72
|
+
const control = this.controls.find(candidate => candidate.index === index);
|
|
73
|
+
if (control) {
|
|
74
|
+
entry.basis = this.style === "icons" ? control.icon : textWidth(index);
|
|
75
|
+
entry.minSize = entry.basis;
|
|
76
|
+
entry.shrink = 0;
|
|
77
|
+
} else if (this.titleLength !== undefined) {
|
|
78
|
+
entry.minSize = this.style === "icons" ? 1 : this.titleLength;
|
|
79
|
+
}
|
|
80
|
+
return entry;
|
|
81
|
+
});
|
|
82
|
+
if (this.style === "icons") {
|
|
83
|
+
this.addChild(new HStack(entries), { basis: 1, shrink: 0 });
|
|
84
|
+
} else {
|
|
85
|
+
let row: StackChild[] = [];
|
|
86
|
+
let occupied = 0;
|
|
87
|
+
const flush = (): void => {
|
|
88
|
+
if (row.length) {
|
|
89
|
+
const spaced = row.map((item, index) => {
|
|
90
|
+
const entry = "component" in item ? { ...item } : { component: item };
|
|
91
|
+
if (index < row.length - 1) {
|
|
92
|
+
if (typeof entry.basis === "number" && !entry.grow) entry.basis++;
|
|
93
|
+
entry.minSize = (entry.minSize ?? 0) + 1;
|
|
94
|
+
}
|
|
95
|
+
return entry;
|
|
96
|
+
});
|
|
97
|
+
if (this.fill && !row.includes(entries[0])) spaced.push({ component: this.fill, basis: 0, grow: 1 });
|
|
98
|
+
this.addChild(new HStack(spaced), { basis: 1, shrink: 0 });
|
|
99
|
+
}
|
|
100
|
+
row = []; occupied = 0;
|
|
101
|
+
};
|
|
102
|
+
for (const [index, entry] of entries.entries()) {
|
|
103
|
+
const control = this.controls.find(candidate => candidate.index === index);
|
|
104
|
+
const size = control ? textWidth(index) : this.titleLength ?? 0;
|
|
105
|
+
if (row.length && occupied + 1 + size > width) flush();
|
|
106
|
+
occupied += (row.length ? 1 : 0) + size;
|
|
107
|
+
row.push(entry);
|
|
108
|
+
}
|
|
109
|
+
flush();
|
|
110
|
+
}
|
|
60
111
|
}
|
|
112
|
+
return super.render(width);
|
|
61
113
|
}
|
|
62
114
|
}
|
|
63
115
|
class TranscriptColumns extends HStack {
|
|
@@ -171,7 +223,7 @@ export class TranscriptLayout {
|
|
|
171
223
|
) {}
|
|
172
224
|
|
|
173
225
|
private button(label: () => string, action: () => void, enabled = (): boolean => true, background?: () => Color): Component {
|
|
174
|
-
|
|
226
|
+
const button = new MouseRegion({
|
|
175
227
|
render: width => new Text(this.theme().style((this.preferences.buttonStyle === "icons" ? "[ " + label() + " ]" : "[" + label() + "]").padEnd(width), {
|
|
176
228
|
fg: enabled() ? "accent" : "dim", bg: background?.(),
|
|
177
229
|
}), 0, 0).render(width),
|
|
@@ -185,6 +237,7 @@ export class TranscriptLayout {
|
|
|
185
237
|
}
|
|
186
238
|
return { handled: true };
|
|
187
239
|
});
|
|
240
|
+
return Object.assign(button, { textWidth: () => visibleWidth(label()) + 2 });
|
|
188
241
|
}
|
|
189
242
|
|
|
190
243
|
/** Mount controls only on a compatible native fullscreen history tree. */
|
|
@@ -285,6 +338,8 @@ export class TranscriptLayout {
|
|
|
285
338
|
() => this.searchPane() === "activity");
|
|
286
339
|
this.chat = new PanelScrollView(chatDocument, scrollOptions, () => this.activate("chat"), () => this.searchPane() === "chat");
|
|
287
340
|
let historyHeight = 0;
|
|
341
|
+
let chatHeader: Component;
|
|
342
|
+
let activityHeader: Component;
|
|
288
343
|
let projectSurface = false;
|
|
289
344
|
// Every root entry asks in turn during one visibility pass; evaluate the projection once.
|
|
290
345
|
let pass: { width: number; height: number; shown: boolean } | undefined;
|
|
@@ -298,16 +353,22 @@ export class TranscriptLayout {
|
|
|
298
353
|
const candidate = !!projectedDock && (widgetsPresent() || dialogPresent()) && dockUnchanged() && !this.failed &&
|
|
299
354
|
this.preferences.mode === "split" && this.preferences.zoom !== "chat";
|
|
300
355
|
projectDialog = candidate && dialogPresent();
|
|
301
|
-
historyHeight = Math.max(0, height - (candidate ? projectedDock : dock).render(width).length -
|
|
356
|
+
historyHeight = Math.max(0, height - (candidate ? projectedDock : dock).render(width).length - toolbar.render(width).length);
|
|
302
357
|
const search = this.search;
|
|
303
358
|
if (search && previousHeight !== historyHeight) queueMicrotask(() => {
|
|
304
359
|
if (this.search === search) search.bar.reposition();
|
|
305
360
|
});
|
|
306
361
|
this.automaticHeight = Math.max(MIN_ROWS, Math.floor(historyHeight / 2));
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
362
|
+
const chatWidth = this.preferences.zoom || this.preferences.layout === "rows" ? width : Math.min(width - MIN_ACTIVITY - 1,
|
|
363
|
+
Math.max(MIN_CHAT, this.preferences.chatWidth ?? this.defaultWidth(width)));
|
|
364
|
+
const activityWidth = this.preferences.zoom || this.preferences.layout === "rows" ? width : width - chatWidth - 1;
|
|
365
|
+
const chatSearch = this.search?.pane === "chat" ? PANEL_SEARCH_ROWS : 0;
|
|
366
|
+
const activitySearch = this.search?.pane === "activity" ? PANEL_SEARCH_ROWS : 0;
|
|
367
|
+
const chatMin = Math.max(MIN_ROWS + chatSearch, chatHeader.render(Math.max(1, chatWidth)).length + 1);
|
|
368
|
+
const activityMin = Math.max(MIN_ROWS + activitySearch, activityHeader.render(Math.max(1, activityWidth)).length + 1);
|
|
369
|
+
const fits = this.preferences.zoom ? width >= MIN_CHAT && historyHeight >= (this.preferences.zoom === "chat" ? chatMin : activityMin) :
|
|
370
|
+
this.preferences.layout === "columns" ? width >= MIN_CHAT + MIN_ACTIVITY + 1 && historyHeight >= Math.max(chatMin, activityMin) :
|
|
371
|
+
width >= MIN_CHAT && historyHeight >= chatMin + activityMin + 1;
|
|
311
372
|
this.fallback = this.preferences.mode === "split" && !fits;
|
|
312
373
|
projectSurface = candidate && fits;
|
|
313
374
|
if (this.search && (this.fallback || this.failed || this.preferences.mode !== "split" ||
|
|
@@ -319,21 +380,14 @@ export class TranscriptLayout {
|
|
|
319
380
|
// Both panels project the same native history and supported content kinds.
|
|
320
381
|
activityDocument.check();
|
|
321
382
|
if (projectSurface && surfaceTree && surfacePresent()) {
|
|
322
|
-
const
|
|
323
|
-
Math.max(MIN_CHAT, this.preferences.chatWidth ?? this.defaultWidth(width)));
|
|
324
|
-
const widgetWidth = this.preferences.zoom === "activity" || this.preferences.layout === "rows"
|
|
325
|
-
? width : width - chatWidth - 1;
|
|
326
|
-
const chatSearch = this.search?.pane === "chat" ? PANEL_SEARCH_ROWS : 0;
|
|
327
|
-
const activitySearch = this.search?.pane === "activity" ? PANEL_SEARCH_ROWS : 0;
|
|
328
|
-
const chatMin = MIN_ROWS + chatSearch;
|
|
329
|
-
const activityMin = MIN_ROWS + activitySearch;
|
|
383
|
+
const widgetWidth = activityWidth;
|
|
330
384
|
const chatLimit = Math.max(chatMin, Math.min((this.preferences.chatHeight ?? this.automaticHeight) + chatSearch,
|
|
331
385
|
historyHeight - activityMin - 1));
|
|
332
386
|
const activityHeight = this.preferences.zoom || this.preferences.layout === "columns" ? historyHeight :
|
|
333
387
|
historyHeight - 1 - Math.min(chatLimit, Math.max(chatMin, chatPane.render(width).length));
|
|
334
388
|
// Do not clip opaque interactive surfaces: their own wheel handlers may consume scrolling.
|
|
335
389
|
// If the entire surface cannot fit, leave Pi's original dock available instead.
|
|
336
|
-
const budget = Math.max(0, activityHeight -
|
|
390
|
+
const budget = Math.max(0, activityHeight - activityHeader.render(widgetWidth).length);
|
|
337
391
|
if (surfaceTree.render(widgetWidth).length > budget) {
|
|
338
392
|
projectSurface = false;
|
|
339
393
|
this.fallback = true;
|
|
@@ -344,12 +398,9 @@ export class TranscriptLayout {
|
|
|
344
398
|
this.chat?.setScrollbar(scroll.scrollbar);
|
|
345
399
|
columns.sizeConversation(chatPane, this.preferences.chatWidth ?? this.defaultWidth(width));
|
|
346
400
|
// Keep short Conversation intact; shrink Activity first when history fills up.
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
rows.limitConversation(chatPane, Math.max(chatMinimum,
|
|
351
|
-
Math.min((this.preferences.chatHeight ?? this.automaticHeight) + chatSearchRow,
|
|
352
|
-
historyHeight - activityMinimum - 1)), chatMinimum, activityMinimum);
|
|
401
|
+
rows.limitConversation(chatPane, Math.max(chatMin,
|
|
402
|
+
Math.min((this.preferences.chatHeight ?? this.automaticHeight) + chatSearch,
|
|
403
|
+
historyHeight - activityMin - 1)), chatMin, activityMin);
|
|
353
404
|
return true;
|
|
354
405
|
} catch (error) {
|
|
355
406
|
projectSurface = false;
|
|
@@ -363,11 +414,11 @@ export class TranscriptLayout {
|
|
|
363
414
|
const headers: ButtonStack[] = [];
|
|
364
415
|
const toolbar = new ButtonStack([
|
|
365
416
|
{ component: this.button(
|
|
366
|
-
() => this.preferences.mode === "combined" || this.fallback || this.failed ? (this.preferences.buttonStyle === "icons" ? "◫" : "
|
|
417
|
+
() => this.preferences.mode === "combined" || this.fallback || this.failed ? (this.preferences.buttonStyle === "icons" ? "◫" : "Split") : (this.preferences.buttonStyle === "icons" ? "▣" : "Combine"),
|
|
367
418
|
() => this.toggle(), () => !this.fallback && !this.failed,
|
|
368
419
|
), basis: TOOLBAR_BUTTON_WIDTH + 1, minSize: TOOLBAR_BUTTON_WIDTH, shrink: 1 },
|
|
369
420
|
{ component: this.button(
|
|
370
|
-
() => this.preferences.layout === "columns" ? (this.preferences.buttonStyle === "icons" ? "▤" : "Rows") : (this.preferences.buttonStyle === "icons" ? "▥" : "
|
|
421
|
+
() => this.preferences.layout === "columns" ? (this.preferences.buttonStyle === "icons" ? "▤" : "Rows") : (this.preferences.buttonStyle === "icons" ? "▥" : "Columns"),
|
|
371
422
|
() => this.setLayout(this.preferences.layout === "columns" ? "rows" : "columns"), () => !this.failed,
|
|
372
423
|
), basis: TOOLBAR_BUTTON_WIDTH + 1, minSize: TOOLBAR_BUTTON_WIDTH, shrink: 1 },
|
|
373
424
|
{ component: this.button(
|
|
@@ -375,7 +426,12 @@ export class TranscriptLayout {
|
|
|
375
426
|
() => this.preferences.mode === "split" && !this.preferences.zoom && !this.fallback && !this.failed,
|
|
376
427
|
), basis: TOOLBAR_BUTTON_WIDTH + 1, minSize: TOOLBAR_BUTTON_WIDTH, shrink: 1 },
|
|
377
428
|
{ component: this.button(() => this.preferences.buttonStyle === "icons" ? "≡" : "Menu", this.openSettings), basis: TOOLBAR_BUTTON_WIDTH, shrink: 0 },
|
|
378
|
-
], [
|
|
429
|
+
], [
|
|
430
|
+
{ index: 0, icon: 6 },
|
|
431
|
+
{ index: 1, icon: 6 },
|
|
432
|
+
{ index: 2, icon: 6 },
|
|
433
|
+
{ index: 3, icon: 5 },
|
|
434
|
+
]);
|
|
379
435
|
const pane = (title: string, target: Pane, view: ScrollView): Component => {
|
|
380
436
|
const hue = target === "chat" ? rgbColor(104, 158, 115) : rgbColor(107, 152, 190);
|
|
381
437
|
const palette = () => {
|
|
@@ -404,7 +460,7 @@ export class TranscriptLayout {
|
|
|
404
460
|
return undefined;
|
|
405
461
|
}), basis: 0, grow: 1, minSize: title.length },
|
|
406
462
|
...(target === "activity" ? [{ component: this.button(
|
|
407
|
-
() => this.preferences.compactTools ? (this.preferences.buttonStyle === "icons" ? "⊞" : "
|
|
463
|
+
() => this.preferences.compactTools ? (this.preferences.buttonStyle === "icons" ? "⊞" : "Full tools") : (this.preferences.buttonStyle === "icons" ? "⊟" : "Compact tools"),
|
|
408
464
|
() => {
|
|
409
465
|
this.activate("activity");
|
|
410
466
|
this.setCompactTools(!this.preferences.compactTools);
|
|
@@ -415,27 +471,32 @@ export class TranscriptLayout {
|
|
|
415
471
|
this.openSearch(target);
|
|
416
472
|
}, () => true, () => palette().fill), basis: TOOLBAR_BUTTON_WIDTH + 1, minSize: TOOLBAR_BUTTON_WIDTH, shrink: 1 },
|
|
417
473
|
{ component: this.button(
|
|
418
|
-
() => this.preferences.zoom === target ? (this.preferences.buttonStyle === "icons" ? "↙" : "
|
|
474
|
+
() => this.preferences.zoom === target ? (this.preferences.buttonStyle === "icons" ? "↙" : "Restore") : (this.preferences.buttonStyle === "icons" ? "↗" : "Maximize"),
|
|
419
475
|
() => this.maximize(target), () => true, () => palette().fill,
|
|
420
476
|
), basis: 5, shrink: 0 },
|
|
421
477
|
], target === "activity" ? [
|
|
422
|
-
{ index: 1, icon: 6
|
|
423
|
-
{ index: 2, icon: 6
|
|
424
|
-
{ index: 3, icon: 5
|
|
478
|
+
{ index: 1, icon: 6 },
|
|
479
|
+
{ index: 2, icon: 6 },
|
|
480
|
+
{ index: 3, icon: 5 },
|
|
425
481
|
] : [
|
|
426
|
-
{ index: 1, icon: 6
|
|
427
|
-
{ index: 2, icon: 5
|
|
428
|
-
], title.length
|
|
482
|
+
{ index: 1, icon: 6 },
|
|
483
|
+
{ index: 2, icon: 5 },
|
|
484
|
+
], title.length, {
|
|
485
|
+
render: width => [this.theme().style(" ".repeat(width), { bg: palette().fill })],
|
|
486
|
+
invalidate() {},
|
|
487
|
+
});
|
|
429
488
|
headers.push(label);
|
|
430
489
|
const header = new VStack([
|
|
431
490
|
{ component: line, basis: 1, shrink: 0, visible: () =>
|
|
432
491
|
this.preferences.zoom !== null || this.preferences.layout === "columns" ||
|
|
433
492
|
(this.preferences.side === "left" ? target === "chat" : target === "activity") },
|
|
434
|
-
{ component: label, basis:
|
|
493
|
+
{ component: label, basis: "auto", shrink: 0 },
|
|
435
494
|
{ component: line, basis: 1, shrink: 0 },
|
|
436
495
|
{ component: this.searchRows[target], basis: "auto", shrink: 0,
|
|
437
496
|
visible: () => this.search?.pane === target },
|
|
438
497
|
]);
|
|
498
|
+
if (target === "chat") chatHeader = header;
|
|
499
|
+
else activityHeader = header;
|
|
439
500
|
return new TranscriptPane(header, view, () => historyHeight,
|
|
440
501
|
target === "activity" ? surfaceView : undefined, () => projectSurface && surfacePresent());
|
|
441
502
|
};
|
|
@@ -499,7 +560,7 @@ export class TranscriptLayout {
|
|
|
499
560
|
};
|
|
500
561
|
this.rebuild();
|
|
501
562
|
const mounted = new TranscriptRoot([
|
|
502
|
-
{ component: toolbar, basis:
|
|
563
|
+
{ component: toolbar, basis: "auto", shrink: 0, visible: () => {
|
|
503
564
|
// Root visibility is evaluated once at the start of each native layout pass.
|
|
504
565
|
pass = undefined;
|
|
505
566
|
this.timestamps.beginFrame();
|
|
@@ -507,6 +568,10 @@ export class TranscriptLayout {
|
|
|
507
568
|
chatDocument.beginFrame();
|
|
508
569
|
return true;
|
|
509
570
|
} },
|
|
571
|
+
{ component: {
|
|
572
|
+
render: width => [this.theme().style("─".repeat(width), { fg: this.theme().colors.border })],
|
|
573
|
+
invalidate() {},
|
|
574
|
+
}, basis: 1, shrink: 0, visible: viewport => !shown(viewport) },
|
|
510
575
|
{ component: columns, basis: 0, grow: 1, minSize: 1,
|
|
511
576
|
visible: viewport => shown(viewport) && !this.preferences.zoom && this.preferences.layout === "columns" },
|
|
512
577
|
{ component: rows, basis: "auto", minSize: 1,
|
package/src/native.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { Theme, ToolInfo } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { Container, Spacer, Text, type Component, type TuiMouseEvent } from "@earendil-works/pi-tui";
|
|
3
|
-
import { searchText, type SearchEntry, type SearchHit } from "./search.
|
|
4
|
-
import { highlightSearchRows, searchHitRow, type SearchClock } from "./search-highlight.
|
|
5
|
-
import { CompactMessage, type TranscriptTimestamps } from "./timestamps.
|
|
6
|
-
import { NativeContentIndex, type ContentEntry, type Pane } from "./content.
|
|
7
|
-
import { CompactTool } from "./compact-tools.
|
|
8
|
-
import { toolPresentations, type ToolPresentation } from "./tool-presentation.
|
|
9
|
-
import { toolGroups, groupSummary, type ToolGroup } from "./tool-groups.
|
|
10
|
-
import { ToolIndent } from "./tool-indent.
|
|
11
|
-
import { NestedTree, type NativeTreeBody } from "./nested-tree.
|
|
12
|
-
export type { Pane } from "./content.
|
|
3
|
+
import { searchText, type SearchEntry, type SearchHit } from "./search.ts";
|
|
4
|
+
import { highlightSearchRows, searchHitRow, type SearchClock } from "./search-highlight.ts";
|
|
5
|
+
import { CompactMessage, type TranscriptTimestamps } from "./timestamps.ts";
|
|
6
|
+
import { NativeContentIndex, type ContentEntry, type Pane } from "./content.ts";
|
|
7
|
+
import { CompactTool } from "./compact-tools.ts";
|
|
8
|
+
import { toolPresentations, type ToolPresentation } from "./tool-presentation.ts";
|
|
9
|
+
import { toolGroups, groupSummary, type ToolGroup } from "./tool-groups.ts";
|
|
10
|
+
import { ToolIndent } from "./tool-indent.ts";
|
|
11
|
+
import { NestedTree, type NativeTreeBody } from "./nested-tree.ts";
|
|
12
|
+
export type { Pane } from "./content.ts";
|
|
13
13
|
|
|
14
14
|
/** Decorate one selected block without changing native text or mouse coordinates. */
|
|
15
15
|
class SearchHighlight implements Component {
|
package/src/nested-calls.ts
CHANGED
package/src/nested-tree.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { Container, Text, type Component } from "@earendil-works/pi-tui";
|
|
3
|
-
import { componentTree, type ContentEntry, type ToolSummary } from "./content.
|
|
4
|
-
import { CompactTool } from "./compact-tools.
|
|
5
|
-
import type { SearchClock } from "./search-highlight.
|
|
6
|
-
import type { NestedCall, NestedCalls } from "./nested-calls.
|
|
7
|
-
import type { ToolPresentation } from "./tool-presentation.
|
|
8
|
-
import { ToolIndent } from "./tool-indent.
|
|
3
|
+
import { componentTree, type ContentEntry, type ToolSummary } from "./content.ts";
|
|
4
|
+
import { CompactTool } from "./compact-tools.ts";
|
|
5
|
+
import type { SearchClock } from "./search-highlight.ts";
|
|
6
|
+
import type { NestedCall, NestedCalls } from "./nested-calls.ts";
|
|
7
|
+
import type { ToolPresentation } from "./tool-presentation.ts";
|
|
8
|
+
import { ToolIndent } from "./tool-indent.ts";
|
|
9
9
|
|
|
10
10
|
export interface NativeTreeBody { entry: ContentEntry; component: Component; excerpt?: Component; clock?(): SearchClock | undefined }
|
|
11
11
|
interface Node { key: string; summary: ToolSummary; children: Node[]; count?: number }
|
package/src/search-highlight.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { sliceByColumn, stripTerminalSequences } from "@earendil-works/pi-tui";
|
|
3
|
-
import type { SearchHit } from "./search.
|
|
3
|
+
import type { SearchHit } from "./search.ts";
|
|
4
4
|
|
|
5
5
|
// Pi maps the public host package, not its private subpaths, in installed extensions.
|
|
6
6
|
// Keep CSI styles and OSC/APC markers intact without importing a private utility.
|
package/src/search-matcher.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { createInterface } from "node:readline";
|
|
3
|
-
import { compileSearchCondition, compileSearchQuery, satisfiesSearchCondition, type SearchCondition } from "./search-query.
|
|
3
|
+
import { compileSearchCondition, compileSearchQuery, satisfiesSearchCondition, type SearchCondition } from "./search-query.ts";
|
|
4
4
|
|
|
5
5
|
/** A matched UTF-16 span in the saved line, before native wrapping and decoration. */
|
|
6
6
|
export interface SearchRange { start: number; end: number }
|
package/src/search.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type Component, type TUI,
|
|
5
5
|
} from "@earendil-works/pi-tui";
|
|
6
6
|
|
|
7
|
-
import { matchSearchLines, type LineMatch, type SearchRange } from "./search-matcher.
|
|
7
|
+
import { matchSearchLines, type LineMatch, type SearchRange } from "./search-matcher.ts";
|
|
8
8
|
const NATIVE_SEARCH = "tui.altScreen.search";
|
|
9
9
|
|
|
10
10
|
/** Reserve Ctrl+F in split mode without changing any saved keyboard settings. */
|
package/src/timestamps.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type Component, type TuiMouseEvent,
|
|
5
5
|
} from "@earendil-works/pi-tui";
|
|
6
6
|
|
|
7
|
-
import { NativeRenderCache } from "./render-cache.
|
|
7
|
+
import { NativeRenderCache } from "./render-cache.ts";
|
|
8
8
|
type Message = ReturnType<typeof sessionEntryToContextMessages>[number];
|
|
9
9
|
type TimedSource = { message: Message; time: unknown };
|
|
10
10
|
type UserSlot = { kind: string; text?: string; time: unknown };
|
package/src/tool-groups.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from "@earendil-works/pi-tui";
|
|
2
|
-
import type { ContentEntry, ToolSummary } from "./content.
|
|
2
|
+
import type { ContentEntry, ToolSummary } from "./content.ts";
|
|
3
3
|
|
|
4
4
|
export interface ToolGroup { calls: ContentEntry[]; key: string; name: string; status: ToolSummary["status"] }
|
|
5
5
|
|