pi-stereo-view 0.1.14 → 0.1.15
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 +14 -0
- package/README.md +21 -21
- package/package.json +1 -1
- package/src/index.ts +8 -3
- package/src/layout.ts +58 -25
- package/src/native.ts +2 -1
- package/src/preferences.ts +8 -5
- package/src/search.ts +11 -8
- package/src/timestamps.ts +44 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.1.15 - 2026-11-08
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Choose icons or text for toolbar, panel, search and copy controls in Stereo View settings. The choice survives restart.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Use consistent spacing between adjacent buttons. In narrow search panels, hide the match counter when needed to keep the query editable.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Keep timestamps and copy controls on user messages when an extension replaces a message after it is displayed.
|
|
18
|
+
|
|
5
19
|
## 0.1.14 - 2026-11-07
|
|
6
20
|
|
|
7
21
|
### Fixed
|
package/README.md
CHANGED
|
@@ -74,23 +74,23 @@ pi --tui-mode fullscreen
|
|
|
74
74
|
|
|
75
75
|
## Use it
|
|
76
76
|
|
|
77
|
-
Click the toolbar and the buttons in each panel's header
|
|
78
|
-
|
|
79
|
-
|
|
|
80
|
-
| --- | --- |
|
|
81
|
-
| `[ ▣ ]` / `[ ◫ ]` | Turn split history off / on. |
|
|
82
|
-
| `[ ▤ ]` / `[ ▥ ]` | Switch between rows and columns. |
|
|
83
|
-
| `[ ↕ ]` / `[ ↔ ]` | Swap the panels. |
|
|
84
|
-
| `[ ↗ ]` / `[ ↙ ]` | Zoom a panel / restore the split. |
|
|
85
|
-
| `[ ≡ ]` | Open display and Conversation height settings. |
|
|
86
|
-
| `[ ⌕ ]` | Search this panel. |
|
|
87
|
-
| `[ ⊟ ]` / `[ ⊞ ]` | Compact Activity tools / restore full tools. |
|
|
77
|
+
Click the toolbar and the buttons in each panel's header. Buttons use icons by default. To use text instead, open **Stereo View settings** with `[ ≡ ]` or `/stereo-view settings`, then set **Button style** to `text`. The choice survives restart.
|
|
78
|
+
|
|
79
|
+
| Icons | Text | Action |
|
|
80
|
+
| --- | --- | --- |
|
|
81
|
+
| `[ ▣ ]` / `[ ◫ ]` | `[Join]` / `[Open]` | Turn split history off / on. |
|
|
82
|
+
| `[ ▤ ]` / `[ ▥ ]` | `[Rows]` / `[Cols]` | Switch between rows and columns. |
|
|
83
|
+
| `[ ↕ ]` / `[ ↔ ]` | `[Swap]` | Swap the panels. |
|
|
84
|
+
| `[ ↗ ]` / `[ ↙ ]` | `[Max]` / `[Out]` | Zoom a panel / restore the split. |
|
|
85
|
+
| `[ ≡ ]` | `[Menu]` | Open display and Conversation height settings. |
|
|
86
|
+
| `[ ⌕ ]` | `[Find]` | Search this panel. |
|
|
87
|
+
| `[ ⊟ ]` / `[ ⊞ ]` | `[Few]` / `[All]` | Compact Activity tools / restore full tools. |
|
|
88
88
|
|
|
89
89
|
**Resize:** drag the double line between the panels — `═` in rows, `║` in columns.
|
|
90
90
|
|
|
91
91
|
New installs start in Columns: Conversation gets 20% of the width on the left, and Activity gets 80% on the right. Drag the divider or use the size shortcuts to change this.
|
|
92
92
|
|
|
93
|
-
In Rows, Conversation grows with its messages up to half the available history area, then scrolls. Dragging the divider or setting a height changes that limit. Choose **Conversation height: auto** in
|
|
93
|
+
In Rows, Conversation grows with its messages up to half the available history area, then scrolls. Dragging the divider or setting a height changes that limit. Choose **Conversation height: auto** in settings, or run `/stereo-view height auto`, to restore automatic sizing.
|
|
94
94
|
|
|
95
95
|
Panels fit short content and scroll when history fills up. Each panel has its own scrolling, text selection and copy.
|
|
96
96
|
|
|
@@ -98,17 +98,17 @@ 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
|
|
101
|
+
Click `[ ⊟ ]` or `[Few]` beside Search 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
|
|
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 `[All]` 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
|
|
|
109
109
|
## Search history
|
|
110
110
|
|
|
111
|
-
Press **Ctrl+F** to search the last clicked or scrolled panel.
|
|
111
|
+
Press **Ctrl+F** to search the last clicked or scrolled panel. The active panel's header is highlighted and, when space permits, marked with a dot; Conversation is active initially. The `[ ⌕ ]` / `[Find]` button always searches its own panel.
|
|
112
112
|
|
|
113
113
|
Type a word or phrase to find it without case sensitivity. Combine terms with `AND`, `OR`, `NOT` and parentheses. Put phrases in quotes to keep them together, or start with `regex:` for a regular expression.
|
|
114
114
|
|
|
@@ -119,7 +119,7 @@ Type a word or phrase to find it without case sensitivity. Combine terms with `A
|
|
|
119
119
|
| `(worker OR server) AND "ready now"` | Lines containing either term and the phrase “ready now”. |
|
|
120
120
|
| `regex:worker_[0-9]+` | Names such as `worker_12`. |
|
|
121
121
|
|
|
122
|
-
Press **Enter
|
|
122
|
+
Press **Enter**, `[ ↓ ]` or `[Go]` for the next match, and **Shift+Enter** for the previous one. The counter shows your position and the total matches when space permits. Ctrl+F returns to the search field without clearing your query.
|
|
123
123
|
|
|
124
124
|
Search covers the whole current conversation branch, including off-screen messages, hidden thinking and collapsed tool output. It does not search other branches, sessions, attachments or files. Russian and English queries work.
|
|
125
125
|
|
|
@@ -127,11 +127,11 @@ A match is revealed in its own panel without moving the other one. If matching t
|
|
|
127
127
|
|
|
128
128
|
**Regex search requires ripgrep (`rg`) to be installed.** Invalid queries and search errors appear in the search field instead of showing incomplete results.
|
|
129
129
|
|
|
130
|
-
Press **Escape
|
|
130
|
+
Press **Escape**, `[ × ]` or `[Exit]` to close search and restore your previous scroll position. Your message draft stays unchanged. Close other dialogs before searching. Search is available in split fullscreen history; combined history and regular mode keep Pi's usual keyboard behaviour.
|
|
131
131
|
|
|
132
132
|
## Copy a block
|
|
133
133
|
|
|
134
|
-
Click
|
|
134
|
+
Click `[ ⧉ ]` or `[Copy]` below the right corner of a message, thinking, tool or other history block to copy its text. Blocks without a known time have no copy button. Copy buttons work in split and zoomed panels, even with timestamps hidden.
|
|
135
135
|
|
|
136
136
|
Messages and thinking keep their original text/Markdown, without terminal colours, clocks or copy buttons. Copying a tool includes its name, arguments, saved result and linked late output. A late-output block also has its own button to copy just that block. Collapsed and off-screen text is included.
|
|
137
137
|
|
|
@@ -139,17 +139,17 @@ During streaming, each click copies the content available at that moment. Copy u
|
|
|
139
139
|
|
|
140
140
|
For keyboard access, run `/stereo-view copy` and choose a numbered block from the active panel. It copies the same text as that block's button.
|
|
141
141
|
|
|
142
|
-
Use **Show copy buttons** in
|
|
142
|
+
Use **Show copy buttons** in Stereo View settings to hide the buttons and their rows. This choice survives restart. Keyboard copying stays available when the buttons are hidden.
|
|
143
143
|
|
|
144
144
|
## Timestamps
|
|
145
145
|
|
|
146
|
-
Conversation and Activity can show a dim local `HH:mm:ss` clock above each block on the left, with a small inset. The copy
|
|
146
|
+
Conversation and Activity can show a dim local `HH:mm:ss` clock above each block on the left, with a small inset. The copy button sits below the block on the right, so neither control takes width away from the text. New tool calls show their start time.
|
|
147
147
|
|
|
148
148
|
In compact Activity, clocks sit at the start of the same line on the left, before the status and tool name, when space permits. A group shows its first call's original time; expanded member rows show their own. Opening a full card does not repeat its clock.
|
|
149
149
|
|
|
150
150
|
Older tool calls may show `~HH:mm:ss` for an approximate time. Blocks without a known time show neither a clock nor a copy button; their content stays visible.
|
|
151
151
|
|
|
152
|
-
Use
|
|
152
|
+
Use Stereo View settings to hide or show clocks. This setting survives restart. Clocks appear in split and zoomed panels, not in combined history. They are display-only and are not added to the conversation sent to the model.
|
|
153
153
|
|
|
154
154
|
## Commands and shortcuts
|
|
155
155
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -44,8 +44,12 @@ export default async function transcript(pi: ExtensionAPI): Promise<void> {
|
|
|
44
44
|
currentValue: preferences.showTimestamps ? "on" : "off", values: ["on", "off"],
|
|
45
45
|
}, {
|
|
46
46
|
id: "copyButtons", label: "Show copy buttons",
|
|
47
|
-
description: "Hide copy
|
|
47
|
+
description: "Hide copy buttons and their rows; keyboard copying stays available.",
|
|
48
48
|
currentValue: preferences.showCopyButtons ? "on" : "off", values: ["on", "off"],
|
|
49
|
+
}, {
|
|
50
|
+
id: "buttonStyle", label: "Button style",
|
|
51
|
+
description: "Choose icons or text for toolbar, panel and copy controls.",
|
|
52
|
+
currentValue: preferences.buttonStyle, values: ["icons", "text"],
|
|
49
53
|
}, {
|
|
50
54
|
id: "compactTools", label: "Compact Activity tools",
|
|
51
55
|
description: "Group adjacent tools and expand individual calls inline. Full text stays searchable and copyable.",
|
|
@@ -54,9 +58,10 @@ export default async function transcript(pi: ExtensionAPI): Promise<void> {
|
|
|
54
58
|
id: "height", label: "Conversation height",
|
|
55
59
|
description: "Auto grows to half the history area. Drag sets a manual maximum.",
|
|
56
60
|
currentValue: preferences.chatHeight === null ? "auto" : "manual", values: ["auto", "manual"],
|
|
57
|
-
}],
|
|
61
|
+
}], 5, getSettingsListTheme(), (id, value) => {
|
|
58
62
|
if (id === "timestamps") layout?.setTimestamps(value === "on");
|
|
59
63
|
else if (id === "copyButtons") layout?.setCopyButtons(value === "on");
|
|
64
|
+
else if (id === "buttonStyle") layout?.setButtonStyle(value === "text" ? "text" : "icons");
|
|
60
65
|
else if (id === "compactTools") layout?.setCompactTools(value === "on");
|
|
61
66
|
else if (id === "height") layout?.setAutomaticHeight(value === "auto");
|
|
62
67
|
tui.requestRender();
|
|
@@ -238,7 +243,7 @@ export default async function transcript(pi: ExtensionAPI): Promise<void> {
|
|
|
238
243
|
const choice = await ctx.ui.select("Copy a block from the active panel", blocks.map(block => block.label));
|
|
239
244
|
blocks.find(block => block.label === choice)?.copy();
|
|
240
245
|
} else if (action === "help") {
|
|
241
|
-
ctx.ui.notify("pi-stereo-view
|
|
246
|
+
ctx.ui.notify("pi-stereo-view: choose icon or text buttons in /stereo-view settings. Buttons: ▣/Join combines history, ◫/Open splits it, ▤/Rows and ▥/Cols change layout, ↕/↔/Swap exchanges panels, ↗/Max and ↙/Out zoom and restore, ⌕/Find searches, ⊟/Few and ⊞/All 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");
|
|
242
247
|
} else if (action === "swap") layout.swap();
|
|
243
248
|
else if (action === "width" && /^\d+$/.test(target ?? "")) layout.setWidth(Number(target));
|
|
244
249
|
else if (action === "height" && target === "auto") layout.setHeight(null);
|
package/src/layout.ts
CHANGED
|
@@ -19,7 +19,7 @@ type NativeTui = TUI & {
|
|
|
19
19
|
const MIN_CHAT = 24;
|
|
20
20
|
const MIN_ACTIVITY = 40;
|
|
21
21
|
const MIN_ROWS = 4;
|
|
22
|
-
const
|
|
22
|
+
const TOOLBAR_BUTTON_WIDTH = 6;
|
|
23
23
|
|
|
24
24
|
class PanelScrollView extends ScrollView {
|
|
25
25
|
constructor(component: Component, options: ScrollViewOptions, private readonly interact: () => void, active: () => boolean) {
|
|
@@ -44,6 +44,22 @@ class NativeSurfaceScrollView extends ScrollView {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
class ButtonStack extends HStack {
|
|
48
|
+
constructor(children: StackChild[], private readonly controls: { index: number; icon: number; text: number; min: number }[],
|
|
49
|
+
private readonly titleLength?: number) {
|
|
50
|
+
super(children);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
setStyle(style: "icons" | "text"): void {
|
|
54
|
+
if (this.titleLength !== undefined) this.entries[0].minSize = style === "icons" ? 1 : this.titleLength;
|
|
55
|
+
for (const { index, icon, text, min } of this.controls) {
|
|
56
|
+
const entry = this.entries[index];
|
|
57
|
+
entry.basis = style === "icons" ? icon : text;
|
|
58
|
+
entry.minSize = style === "icons" ? icon : min;
|
|
59
|
+
entry.shrink = style === "icons" ? 0 : 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
47
63
|
class TranscriptColumns extends HStack {
|
|
48
64
|
/** Reserve a fixed width for Conversation, independent of its content. */
|
|
49
65
|
sizeConversation(component: Component, width: number): void {
|
|
@@ -154,9 +170,9 @@ export class TranscriptLayout {
|
|
|
154
170
|
private readonly getEditor: () => Component | undefined = () => undefined,
|
|
155
171
|
) {}
|
|
156
172
|
|
|
157
|
-
private button(
|
|
173
|
+
private button(label: () => string, action: () => void, enabled = (): boolean => true, background?: () => Color): Component {
|
|
158
174
|
return new MouseRegion({
|
|
159
|
-
render: width => new Text(this.theme().style("[ " +
|
|
175
|
+
render: width => new Text(this.theme().style((this.preferences.buttonStyle === "icons" ? "[ " + label() + " ]" : "[" + label() + "]").padEnd(width), {
|
|
160
176
|
fg: enabled() ? "accent" : "dim", bg: background?.(),
|
|
161
177
|
}), 0, 0).render(width),
|
|
162
178
|
invalidate() {},
|
|
@@ -249,9 +265,9 @@ export class TranscriptLayout {
|
|
|
249
265
|
const index = new NativeContentIndex(document, this.nested);
|
|
250
266
|
const activityDocument = new NativeDocument(document, "activity", this.timestamps, this.theme, timestampGutter, showTimestamps,
|
|
251
267
|
() => this.activate("activity"), false, index, this.copy, showCopyButtons, () => this.preferences.compactTools, this.getTools,
|
|
252
|
-
() => { if (this.activity) this.activity.scrollTo(this.activity.scrollTop, { disableFollow: true }); });
|
|
268
|
+
() => { if (this.activity) this.activity.scrollTo(this.activity.scrollTop, { disableFollow: true }); }, () => this.preferences.buttonStyle);
|
|
253
269
|
const chatDocument = new NativeDocument(document, "chat", this.timestamps, this.theme, timestampGutter, showTimestamps,
|
|
254
|
-
() => this.activate("chat"), false, index, this.copy, showCopyButtons);
|
|
270
|
+
() => this.activate("chat"), false, index, this.copy, showCopyButtons, undefined, undefined, undefined, () => this.preferences.buttonStyle);
|
|
255
271
|
this.documents = { activity: activityDocument, chat: chatDocument };
|
|
256
272
|
this.disposeDocuments = () => {
|
|
257
273
|
activityDocument.dispose();
|
|
@@ -344,21 +360,22 @@ export class TranscriptLayout {
|
|
|
344
360
|
return false;
|
|
345
361
|
}
|
|
346
362
|
};
|
|
347
|
-
const
|
|
363
|
+
const headers: ButtonStack[] = [];
|
|
364
|
+
const toolbar = new ButtonStack([
|
|
348
365
|
{ component: this.button(
|
|
349
|
-
() => this.preferences.mode === "combined" || this.fallback || this.failed ? "◫" : "▣",
|
|
366
|
+
() => this.preferences.mode === "combined" || this.fallback || this.failed ? (this.preferences.buttonStyle === "icons" ? "◫" : "Open") : (this.preferences.buttonStyle === "icons" ? "▣" : "Join"),
|
|
350
367
|
() => this.toggle(), () => !this.fallback && !this.failed,
|
|
351
|
-
), basis:
|
|
368
|
+
), basis: TOOLBAR_BUTTON_WIDTH + 1, minSize: TOOLBAR_BUTTON_WIDTH, shrink: 1 },
|
|
352
369
|
{ component: this.button(
|
|
353
|
-
() => this.preferences.layout === "columns" ? "▤" : "▥",
|
|
370
|
+
() => this.preferences.layout === "columns" ? (this.preferences.buttonStyle === "icons" ? "▤" : "Rows") : (this.preferences.buttonStyle === "icons" ? "▥" : "Cols"),
|
|
354
371
|
() => this.setLayout(this.preferences.layout === "columns" ? "rows" : "columns"), () => !this.failed,
|
|
355
|
-
), basis:
|
|
372
|
+
), basis: TOOLBAR_BUTTON_WIDTH + 1, minSize: TOOLBAR_BUTTON_WIDTH, shrink: 1 },
|
|
356
373
|
{ component: this.button(
|
|
357
|
-
() => this.preferences.layout === "columns" ? "↔" : "↕", () => this.swap(),
|
|
374
|
+
() => this.preferences.buttonStyle === "icons" ? (this.preferences.layout === "columns" ? "↔" : "↕") : "Swap", () => this.swap(),
|
|
358
375
|
() => this.preferences.mode === "split" && !this.preferences.zoom && !this.fallback && !this.failed,
|
|
359
|
-
), basis:
|
|
360
|
-
{ component: this.button(() => "≡", this.openSettings), basis:
|
|
361
|
-
], {
|
|
376
|
+
), basis: TOOLBAR_BUTTON_WIDTH + 1, minSize: TOOLBAR_BUTTON_WIDTH, shrink: 1 },
|
|
377
|
+
{ component: this.button(() => this.preferences.buttonStyle === "icons" ? "≡" : "Menu", this.openSettings), basis: TOOLBAR_BUTTON_WIDTH, shrink: 0 },
|
|
378
|
+
], [0, 1, 2, 3].map(index => ({ index, icon: index === 3 ? 5 : 6, text: index === 3 ? 6 : 7, min: 6 })));
|
|
362
379
|
const pane = (title: string, target: Pane, view: ScrollView): Component => {
|
|
363
380
|
const hue = target === "chat" ? rgbColor(104, 158, 115) : rgbColor(107, 152, 190);
|
|
364
381
|
const palette = () => {
|
|
@@ -373,9 +390,9 @@ export class TranscriptLayout {
|
|
|
373
390
|
render: width => [this.theme().style("─".repeat(width), { fg: palette().border })],
|
|
374
391
|
invalidate() {},
|
|
375
392
|
};
|
|
376
|
-
const label = new
|
|
393
|
+
const label = new ButtonStack([
|
|
377
394
|
{ component: new MouseRegion({
|
|
378
|
-
render: width => new Text(this.theme().style(truncateToWidth(" " + (this.searchPane() === target ? "● " : " ") + title, width, "").padEnd(width), {
|
|
395
|
+
render: width => new Text(this.theme().style(truncateToWidth(width < title.length + 3 ? title : " " + (this.searchPane() === target ? "● " : " ") + title, width, "").padEnd(width), {
|
|
379
396
|
fg: this.searchPane() === target ? "accent" : palette().text, bg: palette().fill,
|
|
380
397
|
}), 0, 0).render(width),
|
|
381
398
|
invalidate() {},
|
|
@@ -385,23 +402,31 @@ export class TranscriptLayout {
|
|
|
385
402
|
return { handled: true, render: true };
|
|
386
403
|
}
|
|
387
404
|
return undefined;
|
|
388
|
-
}), basis: 0, grow: 1, minSize:
|
|
405
|
+
}), basis: 0, grow: 1, minSize: title.length },
|
|
389
406
|
...(target === "activity" ? [{ component: this.button(
|
|
390
|
-
() => this.preferences.compactTools ? "⊞" : "⊟",
|
|
407
|
+
() => this.preferences.compactTools ? (this.preferences.buttonStyle === "icons" ? "⊞" : "All") : (this.preferences.buttonStyle === "icons" ? "⊟" : "Few"),
|
|
391
408
|
() => {
|
|
392
409
|
this.activate("activity");
|
|
393
410
|
this.setCompactTools(!this.preferences.compactTools);
|
|
394
411
|
}, () => true, () => palette().fill,
|
|
395
|
-
), basis:
|
|
396
|
-
{ component: this.button(() => "⌕", () => {
|
|
412
|
+
), basis: 6, minSize: 5, shrink: 1 }] : []),
|
|
413
|
+
{ component: this.button(() => this.preferences.buttonStyle === "icons" ? "⌕" : "Find", () => {
|
|
397
414
|
this.activate(target);
|
|
398
415
|
this.openSearch(target);
|
|
399
|
-
}, () => true, () => palette().fill), basis:
|
|
416
|
+
}, () => true, () => palette().fill), basis: TOOLBAR_BUTTON_WIDTH + 1, minSize: TOOLBAR_BUTTON_WIDTH, shrink: 1 },
|
|
400
417
|
{ component: this.button(
|
|
401
|
-
() => this.preferences.zoom === target ? "↙" : "↗",
|
|
418
|
+
() => this.preferences.zoom === target ? (this.preferences.buttonStyle === "icons" ? "↙" : "Out") : (this.preferences.buttonStyle === "icons" ? "↗" : "Max"),
|
|
402
419
|
() => this.maximize(target), () => true, () => palette().fill,
|
|
403
|
-
), basis:
|
|
404
|
-
]
|
|
420
|
+
), basis: 5, shrink: 0 },
|
|
421
|
+
], target === "activity" ? [
|
|
422
|
+
{ index: 1, icon: 6, text: 6, min: 5 },
|
|
423
|
+
{ index: 2, icon: 6, text: 7, min: 6 },
|
|
424
|
+
{ index: 3, icon: 5, text: 5, min: 5 },
|
|
425
|
+
] : [
|
|
426
|
+
{ index: 1, icon: 6, text: 7, min: 6 },
|
|
427
|
+
{ index: 2, icon: 5, text: 5, min: 5 },
|
|
428
|
+
], title.length);
|
|
429
|
+
headers.push(label);
|
|
405
430
|
const header = new VStack([
|
|
406
431
|
{ component: line, basis: 1, shrink: 0, visible: () =>
|
|
407
432
|
this.preferences.zoom !== null || this.preferences.layout === "columns" ||
|
|
@@ -451,6 +476,8 @@ export class TranscriptLayout {
|
|
|
451
476
|
const columns = new TranscriptColumns();
|
|
452
477
|
const rows = new TranscriptRows();
|
|
453
478
|
this.rebuild = (): void => {
|
|
479
|
+
toolbar.setStyle(this.preferences.buttonStyle);
|
|
480
|
+
for (const header of headers) header.setStyle(this.preferences.buttonStyle);
|
|
454
481
|
for (const [stack, axis] of [[columns, "columns"], [rows, "rows"]] as const) {
|
|
455
482
|
stack.clear();
|
|
456
483
|
const minimum = axis === "columns" ? MIN_CHAT : MIN_ROWS;
|
|
@@ -556,7 +583,7 @@ export class TranscriptLayout {
|
|
|
556
583
|
}
|
|
557
584
|
void this.jumpToSearch(pane, hit, query, () => this.search?.bar === bar && this.searchVersion === version)
|
|
558
585
|
.catch(error => this.warn("Could not navigate search: " + String(error)));
|
|
559
|
-
}, () => this.closeSearch());
|
|
586
|
+
}, () => this.closeSearch(), this.preferences.buttonStyle);
|
|
560
587
|
this.search = { pane, bar, document, view, top: view.scrollTop, following: view.isFollowingEnd,
|
|
561
588
|
focus: host.getFocusedComponent() };
|
|
562
589
|
this.searchRows[pane].addChild(bar);
|
|
@@ -641,6 +668,12 @@ export class TranscriptLayout {
|
|
|
641
668
|
this.changed();
|
|
642
669
|
}
|
|
643
670
|
|
|
671
|
+
/** Change the presentation of toolbar, header and copy controls. */
|
|
672
|
+
setButtonStyle(style: "icons" | "text"): void {
|
|
673
|
+
this.preferences.buttonStyle = style;
|
|
674
|
+
this.changed();
|
|
675
|
+
}
|
|
676
|
+
|
|
644
677
|
/** Project tool calls as dense rows while retaining their full search and copy text. */
|
|
645
678
|
setCompactTools(compact: boolean): void {
|
|
646
679
|
this.preferences.compactTools = compact;
|
package/src/native.ts
CHANGED
|
@@ -91,6 +91,7 @@ export class NativeDocument extends Container {
|
|
|
91
91
|
private readonly compactTools: () => boolean = () => false,
|
|
92
92
|
private readonly getTools: () => readonly ToolInfo[] = () => [],
|
|
93
93
|
private readonly beforeExpand: () => void = () => {},
|
|
94
|
+
private readonly buttonStyle: () => "icons" | "text" = () => "text",
|
|
94
95
|
) {
|
|
95
96
|
super();
|
|
96
97
|
}
|
|
@@ -277,7 +278,7 @@ export class NativeDocument extends Container {
|
|
|
277
278
|
if (!stamped) {
|
|
278
279
|
stamped = new CompactMessage(routed, () => this.timestamps.label(this.clockOwners.get(component) ?? component),
|
|
279
280
|
this.theme, this.timestampGutter, () => this.showTimestamps() && !(this.pane === "activity" && this.compactTools() && entry.kind === "tool"),
|
|
280
|
-
this.copy ? () => this.copyBlock(component) : undefined, this.showCopy);
|
|
281
|
+
this.copy ? () => this.copyBlock(component) : undefined, this.showCopy, this.buttonStyle);
|
|
281
282
|
this.stamped.set(routed, stamped);
|
|
282
283
|
}
|
|
283
284
|
this.compactBlocks.set(component, stamped);
|
package/src/preferences.ts
CHANGED
|
@@ -16,10 +16,11 @@ export interface Preferences {
|
|
|
16
16
|
showTimestamps: boolean;
|
|
17
17
|
showCopyButtons: boolean;
|
|
18
18
|
compactTools: boolean;
|
|
19
|
+
buttonStyle: "icons" | "text";
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export const defaults: Preferences = {
|
|
22
|
-
mode: "split", side: "left", chatWidth: null, layout: "columns", chatHeight: null, zoom: null, showTimestamps: true, showCopyButtons: true, compactTools: false,
|
|
23
|
+
mode: "split", side: "left", chatWidth: null, layout: "columns", chatHeight: null, zoom: null, showTimestamps: true, showCopyButtons: true, compactTools: false, buttonStyle: "icons",
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
/** Read display preferences, retaining the first version's saved arrangement. */
|
|
@@ -39,16 +40,18 @@ export async function loadPreferences(file: string): Promise<Preferences> {
|
|
|
39
40
|
const showTimestamps = record.showTimestamps === undefined ? defaults.showTimestamps : record.showTimestamps;
|
|
40
41
|
const showCopyButtons = record.showCopyButtons === undefined ? defaults.showCopyButtons : record.showCopyButtons;
|
|
41
42
|
const compactTools = record.compactTools === undefined ? defaults.compactTools : record.compactTools;
|
|
43
|
+
const buttonStyle = record.buttonStyle === undefined ? defaults.buttonStyle : record.buttonStyle;
|
|
42
44
|
if ((record.side !== "left" && record.side !== "right") ||
|
|
43
45
|
(record.chatWidth !== null && (typeof record.chatWidth !== "number" || !Number.isInteger(record.chatWidth) ||
|
|
44
46
|
record.chatWidth < 24 || record.chatWidth > 240)) ||
|
|
45
47
|
(layout !== "columns" && layout !== "rows") ||
|
|
46
48
|
(chatHeight !== null && (typeof chatHeight !== "number" || !Number.isInteger(chatHeight) || chatHeight < 4 || chatHeight > 240)) ||
|
|
47
|
-
typeof showTimestamps !== "boolean" || typeof showCopyButtons !== "boolean" || typeof compactTools !== "boolean"
|
|
49
|
+
typeof showTimestamps !== "boolean" || typeof showCopyButtons !== "boolean" || typeof compactTools !== "boolean" ||
|
|
50
|
+
(buttonStyle !== "icons" && buttonStyle !== "text")) {
|
|
48
51
|
throw new Error("Invalid pi-stereo-view preferences");
|
|
49
52
|
}
|
|
50
53
|
// Legacy files may contain mode/zoom. Every session starts with both panels visible.
|
|
51
|
-
return { mode: "split", side: record.side, chatWidth: record.chatWidth, layout, chatHeight, zoom: null, showTimestamps, showCopyButtons, compactTools };
|
|
54
|
+
return { mode: "split", side: record.side, chatWidth: record.chatWidth, layout, chatHeight, zoom: null, showTimestamps, showCopyButtons, compactTools, buttonStyle };
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
/** Atomically save only the display settings, never session messages. */
|
|
@@ -56,8 +59,8 @@ export async function savePreferences(file: string, preferences: Preferences): P
|
|
|
56
59
|
await mkdir(path.dirname(file), { recursive: true });
|
|
57
60
|
const temporary = file + "." + randomUUID() + ".tmp";
|
|
58
61
|
try {
|
|
59
|
-
const { side, chatWidth, layout, chatHeight, showTimestamps, showCopyButtons, compactTools } = preferences;
|
|
60
|
-
const saved = { side, chatWidth, layout, chatHeight, showTimestamps, showCopyButtons, compactTools };
|
|
62
|
+
const { side, chatWidth, layout, chatHeight, showTimestamps, showCopyButtons, compactTools, buttonStyle } = preferences;
|
|
63
|
+
const saved = { side, chatWidth, layout, chatHeight, showTimestamps, showCopyButtons, compactTools, buttonStyle };
|
|
61
64
|
await writeFile(temporary, JSON.stringify(saved, null, 2) + "\n", { mode: 0o600 });
|
|
62
65
|
await rename(temporary, file);
|
|
63
66
|
} finally {
|
package/src/search.ts
CHANGED
|
@@ -95,11 +95,11 @@ class SearchInput extends Input {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
class SearchControls extends HStack {
|
|
98
|
-
constructor(private readonly count: () => string) { super([]
|
|
98
|
+
constructor(private readonly count: () => string) { super([]); }
|
|
99
99
|
override render(width: number): string[] {
|
|
100
|
-
// Keep
|
|
101
|
-
this.entries[1].basis = Math.min(this.count().length,
|
|
102
|
-
|
|
100
|
+
// Keep room for at least one query character and the cursor.
|
|
101
|
+
this.entries[1].basis = Math.min(this.count().length + 2, Math.max(2, width - 22));
|
|
102
|
+
this.entries[1].visible = () => width >= 25;
|
|
103
103
|
return super.render(width);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -131,6 +131,7 @@ export class PanelSearch extends VStack {
|
|
|
131
131
|
private readonly theme: () => Theme,
|
|
132
132
|
private readonly match: (hit: SearchHit | undefined, query: string) => void,
|
|
133
133
|
private readonly close: () => void,
|
|
134
|
+
buttonStyle: "icons" | "text" = "icons",
|
|
134
135
|
) {
|
|
135
136
|
super();
|
|
136
137
|
this.input = new SearchInput(() => this.refresh(true), () => this.step(-1));
|
|
@@ -148,14 +149,16 @@ export class PanelSearch extends VStack {
|
|
|
148
149
|
}
|
|
149
150
|
return { handled: true };
|
|
150
151
|
});
|
|
151
|
-
this.controls.addChild(this.input, { basis: 0, grow: 1, minSize:
|
|
152
|
+
this.controls.addChild(this.input, { basis: 0, grow: 1, minSize: 11 });
|
|
152
153
|
this.controls.addChild({
|
|
153
154
|
render: width => new Text(this.theme().fg(this.hits.length ? "accent" : "dim",
|
|
154
|
-
truncateToWidth(this.count(), width, "…")), 0, 0).render(width),
|
|
155
|
+
truncateToWidth(" " + this.count() + " ", width, "…")), 0, 0).render(width),
|
|
155
156
|
invalidate() {},
|
|
156
157
|
}, { basis: 7, shrink: 0 });
|
|
157
|
-
this.controls.addChild(button("[↓]", () => { this.step(1); this.focus(); }),
|
|
158
|
-
|
|
158
|
+
this.controls.addChild(button(buttonStyle === "icons" ? "[ ↓ ]" : "[Go]", () => { this.step(1); this.focus(); }),
|
|
159
|
+
{ basis: buttonStyle === "icons" ? 6 : 5, shrink: 0 });
|
|
160
|
+
this.controls.addChild(button(buttonStyle === "icons" ? "[ × ]" : "[Exit]", close),
|
|
161
|
+
{ basis: buttonStyle === "icons" ? 5 : 6, shrink: 0 });
|
|
159
162
|
const border = (render: (width: number) => string): Component => ({
|
|
160
163
|
render: width => [this.theme().fg("border", render(width))], invalidate() {},
|
|
161
164
|
});
|
package/src/timestamps.ts
CHANGED
|
@@ -9,7 +9,7 @@ type Message = ReturnType<typeof sessionEntryToContextMessages>[number];
|
|
|
9
9
|
type TimedSource = { message: Message; time: unknown };
|
|
10
10
|
type UserSlot = { kind: string; text?: string; time: unknown };
|
|
11
11
|
interface BranchTimes {
|
|
12
|
-
messageTimes: WeakMap<object, unknown>; users: TimedSource[];
|
|
12
|
+
messageTimes: WeakMap<object, unknown>; users: TimedSource[]; bash: TimedSource[];
|
|
13
13
|
starts: Map<string, number>; owners: Map<string, unknown>;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -70,6 +70,7 @@ export class TranscriptTimestamps {
|
|
|
70
70
|
private owners = new Map<string, unknown>();
|
|
71
71
|
private readonly liveCalls = new Set<string>();
|
|
72
72
|
private pendingUser?: { source: TimedSource; before: number; ended: boolean };
|
|
73
|
+
private readonly liveUsers = new Map<number, TimedSource>();
|
|
73
74
|
private frameActive = false;
|
|
74
75
|
private preparedComponents?: Component[];
|
|
75
76
|
|
|
@@ -110,7 +111,7 @@ export class TranscriptTimestamps {
|
|
|
110
111
|
for (const block of message.content) if (block.type === "toolCall") owners.set(block.id, time);
|
|
111
112
|
}
|
|
112
113
|
const derived = {
|
|
113
|
-
messageTimes: new WeakMap(sources.map(source => [source.message, source.time])), users,
|
|
114
|
+
messageTimes: new WeakMap(sources.map(source => [source.message, source.time])), users,
|
|
114
115
|
bash: sources.filter(source => source.message.role === "bashExecution"), starts, owners,
|
|
115
116
|
};
|
|
116
117
|
if (this.branch?.sources === sources) this.branch.derived = derived;
|
|
@@ -123,10 +124,11 @@ export class TranscriptTimestamps {
|
|
|
123
124
|
if (message.role === "user") {
|
|
124
125
|
if (!ended) {
|
|
125
126
|
this.pendingUser = {
|
|
126
|
-
source: { message, time: message.timestamp },
|
|
127
|
+
source: { message: { ...message, content: typeof message.content === "string" ? message.content : message.content.map(block => ({ ...block })) }, time: message.timestamp },
|
|
127
128
|
before: this.sources().filter(source => source.message.role === "user").length,
|
|
128
129
|
ended: false,
|
|
129
130
|
};
|
|
131
|
+
this.liveUsers.set(this.pendingUser.before, this.pendingUser.source);
|
|
130
132
|
} else if (this.pendingUser) {
|
|
131
133
|
this.pendingUser.ended = true;
|
|
132
134
|
}
|
|
@@ -143,6 +145,7 @@ export class TranscriptTimestamps {
|
|
|
143
145
|
this.preparedComponents = undefined;
|
|
144
146
|
this.pendingUser = undefined;
|
|
145
147
|
this.liveCalls.clear();
|
|
148
|
+
this.liveUsers.clear();
|
|
146
149
|
this.orderedLabels = new WeakMap();
|
|
147
150
|
this.messageTimes = new WeakMap();
|
|
148
151
|
this.branch = undefined;
|
|
@@ -159,22 +162,36 @@ export class TranscriptTimestamps {
|
|
|
159
162
|
prepare(components: Component[]): void {
|
|
160
163
|
if (this.frameActive && this.preparedComponents === components) return;
|
|
161
164
|
this.preparedComponents = components;
|
|
162
|
-
const { messageTimes, users,
|
|
165
|
+
const { messageTimes, users, bash, starts, owners } = this.times();
|
|
163
166
|
this.messageTimes = messageTimes;
|
|
164
167
|
if (this.pendingUser?.ended && users.length > this.pendingUser.before) this.pendingUser = undefined;
|
|
165
|
-
const slots = saved.slice();
|
|
166
168
|
const nativeUsers = components.filter(component =>
|
|
167
169
|
component.constructor.name === "UserMessageComponent" || component.constructor.name === "SkillInvocationMessageComponent");
|
|
168
|
-
|
|
169
|
-
this.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
const sources = users.slice();
|
|
171
|
+
if (this.pendingUser && users.length === this.pendingUser.before) sources.push(this.pendingUser.source);
|
|
172
|
+
const associations: Array<{ component: Component; time: unknown }> = [];
|
|
173
|
+
let position = 0;
|
|
174
|
+
let matched = true;
|
|
175
|
+
for (const [index, source] of sources.entries()) {
|
|
176
|
+
const live = this.liveUsers.get(index);
|
|
177
|
+
// An extension may replace a message after Pi rendered it. Use the observed
|
|
178
|
+
// version only for the same timestamp and only if it matches native text.
|
|
179
|
+
const candidates = [userSlots(source)];
|
|
180
|
+
if (live && validTime(live.time) !== undefined && validTime(live.time) === validTime(source.time)) {
|
|
181
|
+
candidates.push(userSlots(live));
|
|
182
|
+
}
|
|
183
|
+
const slots = candidates.find(candidate => candidate.every((slot, offset) => {
|
|
184
|
+
const component = nativeUsers[position + offset];
|
|
185
|
+
return component?.constructor.name === slot.kind &&
|
|
175
186
|
(slot.text === undefined || (component as Component & { text?: unknown }).text === slot.text);
|
|
176
|
-
});
|
|
177
|
-
if (
|
|
187
|
+
}));
|
|
188
|
+
if (!slots) { matched = false; break; }
|
|
189
|
+
slots.forEach((slot, offset) => associations.push({ component: nativeUsers[position + offset], time: slot.time }));
|
|
190
|
+
position += slots.length;
|
|
191
|
+
}
|
|
192
|
+
this.orderedLabels = new WeakMap();
|
|
193
|
+
if (matched && position === nativeUsers.length) {
|
|
194
|
+
for (const { component, time } of associations) this.orderedLabels.set(component, timestampLabel(time));
|
|
178
195
|
}
|
|
179
196
|
const nativeBash = components.filter(component => component.constructor.name === "BashExecutionComponent");
|
|
180
197
|
if (nativeBash.length === bash.length && nativeBash.every((component, index) =>
|
|
@@ -226,10 +243,9 @@ export class TranscriptTimestamps {
|
|
|
226
243
|
}
|
|
227
244
|
}
|
|
228
245
|
|
|
229
|
-
|
|
230
|
-
//
|
|
231
|
-
const
|
|
232
|
-
const COPY_CONTROL_WIDTH = visibleWidth(COPY_CONTROL);
|
|
246
|
+
const TEXT_COPY_CONTROL = "[Copy]";
|
|
247
|
+
// CGJ avoids xterm's single-codepoint rescaling; the space reserves glyph overhang.
|
|
248
|
+
const ICON_COPY_CONTROL = "[ ⧉\u034f ]";
|
|
233
249
|
/** Keep message text full-width, with a clock above and copy action below. */
|
|
234
250
|
export class CompactMessage extends Container {
|
|
235
251
|
private top = 0;
|
|
@@ -240,6 +256,7 @@ export class CompactMessage extends Container {
|
|
|
240
256
|
private bodyRows = 0;
|
|
241
257
|
private copyRow?: number;
|
|
242
258
|
private copyColumn?: number;
|
|
259
|
+
private copyWidth = 0;
|
|
243
260
|
private copyPressed = false;
|
|
244
261
|
private leadingRows = 0;
|
|
245
262
|
private prepared?: { width: number; content: string[]; lines: string[] };
|
|
@@ -249,7 +266,8 @@ export class CompactMessage extends Container {
|
|
|
249
266
|
constructor(private readonly component: Component, private readonly label: () => string,
|
|
250
267
|
private readonly theme: () => Theme, private readonly gutter: () => number,
|
|
251
268
|
private readonly show: () => boolean, private readonly copy?: () => void,
|
|
252
|
-
private readonly showCopy: () => boolean = () => true
|
|
269
|
+
private readonly showCopy: () => boolean = () => true,
|
|
270
|
+
private readonly buttonStyle: () => "icons" | "text" = () => "text") {
|
|
253
271
|
super();
|
|
254
272
|
this.addChild(component);
|
|
255
273
|
this.nativeCache = new NativeRenderCache(component);
|
|
@@ -287,7 +305,9 @@ export class CompactMessage extends Container {
|
|
|
287
305
|
// Only the scrollbar needs a side gutter; controls have their own rows.
|
|
288
306
|
this.contentWidth = Math.max(1, width - gutter);
|
|
289
307
|
const time = label && this.show() && visibleWidth(label) + 1 <= this.contentWidth ? " " + label : "";
|
|
290
|
-
const
|
|
308
|
+
const control = this.buttonStyle() === "icons" ? ICON_COPY_CONTROL : TEXT_COPY_CONTROL;
|
|
309
|
+
const controlWidth = visibleWidth(control);
|
|
310
|
+
const copy = label && this.copy && this.showCopy() && this.contentWidth >= controlWidth ? control : "";
|
|
291
311
|
const content = this.nativeCache.render(this.contentWidth, theme);
|
|
292
312
|
this.contentHeight = content.length;
|
|
293
313
|
const cached = this.formatted;
|
|
@@ -323,8 +343,9 @@ export class CompactMessage extends Container {
|
|
|
323
343
|
const lines = time ? [theme.fg("dim", time), ...body] : body;
|
|
324
344
|
if (copy) {
|
|
325
345
|
this.copyRow = lines.length;
|
|
326
|
-
this.
|
|
327
|
-
|
|
346
|
+
this.copyWidth = controlWidth;
|
|
347
|
+
this.copyColumn = this.contentWidth - controlWidth;
|
|
348
|
+
lines.push(" ".repeat(this.copyColumn) + theme.style(copy, { fg: "dim", dim: this.buttonStyle() === "icons" }));
|
|
328
349
|
}
|
|
329
350
|
this.formatted = { width, time, copy, gutter, theme, version: this.nativeCache.version, top: this.top, lines };
|
|
330
351
|
return lines;
|
|
@@ -335,7 +356,7 @@ export class CompactMessage extends Container {
|
|
|
335
356
|
width: event.width, height: event.height };
|
|
336
357
|
const onCopy = this.copyColumn !== undefined && this.copyRow !== undefined &&
|
|
337
358
|
event.y === this.leadingRows + this.copyRow && event.x >= this.copyColumn &&
|
|
338
|
-
event.x < this.copyColumn +
|
|
359
|
+
event.x < this.copyColumn + this.copyWidth && event.button === "left";
|
|
339
360
|
if (onCopy && event.type === "press") {
|
|
340
361
|
this.copyPressed = true;
|
|
341
362
|
return { handled: true, capture: true, target };
|