pi-stereo-view 0.1.18 → 0.1.20
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 +17 -5
- package/package.json +5 -3
- package/src/content.ts +145 -67
- package/src/index.ts +13 -3
- package/src/layout.ts +94 -41
- package/src/native.ts +415 -67
- package/src/preferences.ts +14 -5
- package/src/render-cache.ts +19 -5
- package/src/surface.ts +875 -0
- package/src/timestamps.ts +41 -5
- package/src/tool-streaming.ts +31 -13
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.1.20 - 2026-11-19
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Group Activity tools** and **Nested call tree** settings. Compact rows, `read ×3` groups and the nested call tree of tools such as Codemode now turn on and off independently. With only grouping on, a group opens into full cards; with only compact on, every call keeps its own row; with the tree off, a tool keeps its own output panel. Thanks to Oula Kuuva for the idea and the first implementation (#100).
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Stream latest tools also works with grouping alone: a new call stays a full card for the collapse delay before it joins its group.
|
|
14
|
+
- Saved settings keep their look: grouping follows your saved Compact Activity tools choice until you change it.
|
|
15
|
+
|
|
16
|
+
## 0.1.19 - 2026-11-19
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Split view uses much less CPU while an agent works: the panels are drawn as one full-width block instead of being merged cell by cell, and only history near each panel's viewport is rendered on every frame.
|
|
21
|
+
- Split view's per-frame work no longer grows with session length: content classification, tool grouping and timestamp checks reuse their results for history that did not change.
|
|
22
|
+
|
|
5
23
|
## 0.1.18 - 2026-11-09
|
|
6
24
|
|
|
7
25
|
### Added
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Unrecognized content stays in Conversation unless its metadata links it to a kno
|
|
|
27
27
|
|
|
28
28
|
Late output linked to a tool call appears directly below that call in Activity, even if other work has happened since. Combined history keeps its original order.
|
|
29
29
|
|
|
30
|
-
Expand a parent tool such as Codemode to browse its nested call tree. Adjacent calls of the same tool form a group with individual call headers. Each independent native result opens under its call. A combined result covering several calls stays whole inside their group. Panels without child execution identities remain available inside the parent's output disclosure. Session restoration uses Pi's saved nested-call metadata and the original saved panels.
|
|
30
|
+
Expand a parent tool such as Codemode to browse its nested call tree. To keep the parent's own output panel instead, turn off **Nested call tree** in Settings. Adjacent calls of the same tool form a group with individual call headers. Each independent native result opens under its call. A combined result covering several calls stays whole inside their group. Panels without child execution identities remain available inside the parent's output disclosure. Session restoration uses Pi's saved nested-call metadata and the original saved panels.
|
|
31
31
|
|
|
32
32
|
Messages and tools keep their familiar appearance. Extension widgets and inline dialogs appear at the bottom of Activity, below its independently scrolling history. Standard select, confirm, input and editor dialogs and non-overlay custom components keep Pi's native input, focus and completion behavior. The message editor, including extension-provided replacements, stays full width whenever Pi displays it. Explicit overlays keep their native placement.
|
|
33
33
|
|
|
@@ -98,17 +98,29 @@ 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
|
-
|
|
101
|
+
Three independent settings in `/stereo-view settings` control how Activity shows tool calls. All three are on by default and survive restart.
|
|
102
|
+
|
|
103
|
+
| Setting | On | Off |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| **Compact Activity tools** | Each call is a one-line row; click it to open its full card and linked output. | Calls show their full cards. |
|
|
106
|
+
| **Group Activity tools** | Adjacent calls to the same tool in the same state share one header with a count, such as `read ×3`. | Every call stands alone. |
|
|
107
|
+
| **Nested call tree** | Calls made by a tool such as Codemode appear as a tree under it. | The tool keeps its own output panel. |
|
|
108
|
+
|
|
109
|
+
Compact and Group combine freely. With both on, a group opens into compact rows, and each row opens its card. With only Group on, a group opens straight into the members' full cards. With only Compact on, every call keeps its own row. With both off, Activity shows the original cards; this suits other extensions that draw their own tool cards.
|
|
110
|
+
|
|
111
|
+
Click `[ ⊟ ]` or `[Compact tools]` beside Find and Maximize in the Activity header to turn compact rows on, and `[ ⊞ ]` or `[Full tools]` to turn them off. The button changes only **Compact Activity tools**.
|
|
112
|
+
|
|
113
|
+
Every failed call stays separate, even beside another failure. 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, and so does turning grouping off and on again. Thinking, Conversation content and different tools end a group.
|
|
102
114
|
|
|
103
115
|
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
116
|
|
|
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.
|
|
117
|
+
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. Conversation and combined history keep their normal display.
|
|
106
118
|
|
|
107
|
-
Compact
|
|
119
|
+
Compact rows and groups work in columns, rows and zoomed Activity. Settings saved before grouping was a separate setting keep their look: grouping follows the saved compact choice.
|
|
108
120
|
|
|
109
121
|
### Stream latest tools
|
|
110
122
|
|
|
111
|
-
**Stream latest tools** (on by default, in Settings) lets you watch the current work while keeping history short.
|
|
123
|
+
**Stream latest tools** (on by default, in Settings) lets you watch the current work while keeping history short. While Compact or Group is on, a new tool call appears as its full card and updates live. When it finishes, it stays fully visible for the **Collapse delay** (1, 2, 3, 5, 10 or 30 seconds; default 5), then collapses in place: into a compact row with Compact on, and into the adjacent identical calls' group (`read ×3`) with Group on. With both off, every call already shows in full, so streaming changes nothing.
|
|
112
124
|
|
|
113
125
|
Calls that are still running or waiting to collapse are never grouped. Thinking, answers and other content between calls appear as usual and end a group. Several calls running together collapse separately, each after its own delay. A call you opened yourself stays open. Scroll position is not changed when a call collapses; if you are at the end of Activity, you stay there. A reopened session shows all its calls collapsed. Both options survive restart; streaming defaults to on.
|
|
114
126
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-stereo-view",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Keep Pi conversation separate from tool output and agent activity.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,10 +52,12 @@
|
|
|
52
52
|
"@earendil-works/pi-tui": "*"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@earendil-works/pi-
|
|
56
|
-
"@earendil-works/pi-
|
|
55
|
+
"@earendil-works/pi-ai": "1.5.2",
|
|
56
|
+
"@earendil-works/pi-coding-agent": "1.5.2",
|
|
57
|
+
"@earendil-works/pi-tui": "1.5.2",
|
|
57
58
|
"@types/node": "^24.0.4",
|
|
58
59
|
"pi-coding-agent-test": "0.1.3",
|
|
60
|
+
"typebox": "1.3.27",
|
|
59
61
|
"typescript": "5.9.3",
|
|
60
62
|
"vitest": "4.1.11"
|
|
61
63
|
},
|
package/src/content.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Container, Markdown, Text, stripTerminalSequences, type Component } from "@earendil-works/pi-tui";
|
|
2
2
|
import { searchText, type SearchEntry } from "./search.ts";
|
|
3
3
|
import { NestedCalls } from "./nested-calls.ts";
|
|
4
|
+
import { sameValues } from "./render-cache.ts";
|
|
4
5
|
|
|
5
6
|
export type Pane = "activity" | "chat";
|
|
6
7
|
export type ContentKind = "dialogue" | "system" | "thinking" | "tool" | "shell";
|
|
@@ -49,6 +50,11 @@ export interface ContentEntry {
|
|
|
49
50
|
/** Live execution metadata exists only on calls, never on linked output. */
|
|
50
51
|
tool?(): ToolSummary;
|
|
51
52
|
}
|
|
53
|
+
/** A call's status from Pi's result fields, which Pi updates in place without invalidating the call. */
|
|
54
|
+
export function callStatus(call: Component): ToolSummary["status"] {
|
|
55
|
+
const { result, isPartial } = call as NativeContent;
|
|
56
|
+
return !result || isPartial !== false ? "running" : result.isError ? "error" : "success";
|
|
57
|
+
}
|
|
52
58
|
|
|
53
59
|
const nameOf = (component: Component): string => component.constructor.name;
|
|
54
60
|
const contentText = (content: unknown): string => typeof content === "string" ? content :
|
|
@@ -91,7 +97,31 @@ function forEachRun(source: NativeAssistant, visit: (kind: ContentKind) => void)
|
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
}
|
|
94
|
-
|
|
100
|
+
/** One non-spacer native history child, its spacing and the entries projected from it. */
|
|
101
|
+
interface Classified {
|
|
102
|
+
component: Component;
|
|
103
|
+
spacing: Component[];
|
|
104
|
+
entries: ContentEntry[];
|
|
105
|
+
/** Native identities that ownership depends on; Pi sets them at construction. */
|
|
106
|
+
toolCallId: unknown;
|
|
107
|
+
parentId: unknown;
|
|
108
|
+
custom: unknown;
|
|
109
|
+
/** Assistant inputs: Pi replaces the content array whenever it rebuilds the message's blocks. */
|
|
110
|
+
content?: Component[];
|
|
111
|
+
contentLength?: number;
|
|
112
|
+
message?: unknown;
|
|
113
|
+
/** Linked panel inputs: its resolved owner and the panel parts shown as nested calls. */
|
|
114
|
+
parent?: { id: string; owner?: NativeContent; parts?: Component[] };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const parentOf = (component: NativeContent): unknown => component.entry?.data?.parentToolCallId ?? component.message?.details?.parentToolCallId;
|
|
118
|
+
|
|
119
|
+
/** The previous entry for the same native block, when every field that renders or searches it is equal. */
|
|
120
|
+
function reuse(entry: ContentEntry, previous: readonly ContentEntry[]): ContentEntry {
|
|
121
|
+
const match = previous.find(candidate => candidate.source === entry.source && candidate.component === entry.component);
|
|
122
|
+
return match && match.owner === entry.owner && match.kind === entry.kind && match.compact === entry.compact &&
|
|
123
|
+
sameValues(match.spacing, entry.spacing) ? match : entry;
|
|
124
|
+
}
|
|
95
125
|
|
|
96
126
|
/** Read supported native execution identities; unrecognized content is system information. */
|
|
97
127
|
const nativeKinds: Record<string, { kind: ContentKind; accepts(content: NativeContent): boolean }> = {
|
|
@@ -139,15 +169,25 @@ function nativePanelParts(source: NativeContent): Component[] | undefined {
|
|
|
139
169
|
}
|
|
140
170
|
/** Shared semantic index for painting and search, independent of wording, severity and lifecycle. */
|
|
141
171
|
export class NativeContentIndex {
|
|
142
|
-
private signature: unknown[] = [];
|
|
143
172
|
private content: ContentEntry[] = [];
|
|
173
|
+
/** History children, source parts and per-block classification from the last verification. */
|
|
174
|
+
private history: Component[] = [];
|
|
175
|
+
private head: Component[] = [];
|
|
176
|
+
private headEntries: ContentEntry[] = [];
|
|
177
|
+
private blocks: Classified[] = [];
|
|
178
|
+
private readonly owners = new Map<string, NativeContent>();
|
|
144
179
|
private panes: Partial<Record<Pane, ContentEntry[]>> = {};
|
|
145
180
|
private readonly expandedPanels = new WeakMap<Component, Component>();
|
|
146
181
|
private readonly views = new WeakMap<NativeAssistant, Partial<Record<Pane, Container>>>();
|
|
182
|
+
private readonly diagnostics = new WeakMap<NativeAssistant, Component[]>();
|
|
147
183
|
|
|
148
|
-
private pass?: { active: boolean; verified?: { children: Component[]; length: number; last?: Component; parts: number; revision: number } };
|
|
184
|
+
private pass?: { active: boolean; verified?: { children: Component[]; length: number; last?: Component; parts: number; revision: number; trees: boolean } };
|
|
149
185
|
|
|
150
|
-
|
|
186
|
+
/**
|
|
187
|
+
* With `nestedTrees` on, a parented output panel is split into the native parts of its nested calls, which Activity
|
|
188
|
+
* shows as the caller's tree. Off, the panel stays one original entry beside its owner.
|
|
189
|
+
*/
|
|
190
|
+
constructor(private readonly source: Container, readonly nested = new NestedCalls(), readonly nestedTrees: () => boolean = () => true) {}
|
|
151
191
|
|
|
152
192
|
/**
|
|
153
193
|
* Native history cannot change while Pi lays out one frame, so the panes of a pass
|
|
@@ -185,29 +225,6 @@ export class NativeContentIndex {
|
|
|
185
225
|
return group.map(candidate => stripTerminalSequences(candidate.search(width).text)).filter(Boolean).join("\n\n");
|
|
186
226
|
}
|
|
187
227
|
|
|
188
|
-
/** Visit every native identity that classification depends on, in a fixed order. */
|
|
189
|
-
private visitSignature(history: Container, visit: (value: unknown) => boolean): boolean {
|
|
190
|
-
if (!visit(this.nested.revision)) return false;
|
|
191
|
-
for (const component of this.source.children) if (!visit(component)) return false;
|
|
192
|
-
for (const component of history.children) if (!visit(component)) return false;
|
|
193
|
-
for (const component of history.children) {
|
|
194
|
-
const metadata = component as NativeContent;
|
|
195
|
-
if (!visit(metadata.toolCallId) || !visit(metadata.entry?.data?.parentToolCallId) ||
|
|
196
|
-
!visit(metadata.message?.details?.parentToolCallId) || !visit(metadata.customComponent)) return false;
|
|
197
|
-
if (metadata.entry?.data?.parentToolCallId || metadata.message?.details?.parentToolCallId)
|
|
198
|
-
for (const part of nativePanelParts(metadata) ?? []) if (!visit(part)) return false;
|
|
199
|
-
const native = assistant(component);
|
|
200
|
-
if (native) {
|
|
201
|
-
// Streaming replaces the message on every delta; only its block layout affects routing.
|
|
202
|
-
let changed = false;
|
|
203
|
-
forEachRun(native, kind => { if (!changed && !visit(kind)) changed = true; });
|
|
204
|
-
if (changed || !visit(runsEnd)) return false;
|
|
205
|
-
for (const child of native.contentContainer.children) if (!visit(child)) return false;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return true;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
228
|
private refresh(): void {
|
|
212
229
|
const history = this.source.children[2] as Container;
|
|
213
230
|
if (!Array.isArray(history?.children)) throw new Error("Pi's history document is not supported");
|
|
@@ -215,57 +232,78 @@ export class NativeContentIndex {
|
|
|
215
232
|
const children = history.children;
|
|
216
233
|
const verified = pass?.verified;
|
|
217
234
|
if (verified && verified.children === children && verified.length === children.length && verified.last === children.at(-1) &&
|
|
218
|
-
verified.parts === this.source.children.length && verified.revision === this.nested.revision) return;
|
|
235
|
+
verified.parts === this.source.children.length && verified.revision === this.nested.revision && verified.trees === this.nestedTrees()) return;
|
|
219
236
|
this.verify(history);
|
|
220
|
-
if (pass) pass.verified = { children, length: children.length, last: children.at(-1), parts: this.source.children.length, revision: this.nested.revision };
|
|
237
|
+
if (pass) pass.verified = { children, length: children.length, last: children.at(-1), parts: this.source.children.length, revision: this.nested.revision, trees: this.nestedTrees() };
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** Whether a classified block still has the native inputs its entries were built from. */
|
|
241
|
+
private unchanged(block: Classified): boolean {
|
|
242
|
+
const component = block.component as NativeAssistant & NativeContent;
|
|
243
|
+
if (component.toolCallId !== block.toolCallId || parentOf(component) !== block.parentId || component.customComponent !== block.custom) return false;
|
|
244
|
+
if (block.content) {
|
|
245
|
+
const children = component.contentContainer?.children;
|
|
246
|
+
if (component.contentIsStale === true || children !== block.content || children.length !== block.contentLength ||
|
|
247
|
+
component.lastMessage !== block.message) return false;
|
|
248
|
+
}
|
|
249
|
+
if (block.parent) {
|
|
250
|
+
const owner = this.owners.get(block.parent.id);
|
|
251
|
+
if (owner !== block.parent.owner) return false;
|
|
252
|
+
const parts = owner?.toolCallId ? this.panelParts(component, owner.toolCallId) : undefined;
|
|
253
|
+
if (parts ? !sameValues(block.parent.parts, parts) : block.parent.parts) return false;
|
|
254
|
+
}
|
|
255
|
+
return true;
|
|
221
256
|
}
|
|
222
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Reclassify only blocks whose native inputs changed: new or moved children, rebuilt assistant content,
|
|
260
|
+
* and parented panels whose owner or parts changed. Unchanged blocks keep their entry objects, and the
|
|
261
|
+
* content array keeps its identity while no entry changed, so streaming does not rebuild the index.
|
|
262
|
+
*/
|
|
223
263
|
private verify(history: Container): void {
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const owners = new Map<string, NativeContent>();
|
|
234
|
-
for (const component of history.children) {
|
|
264
|
+
const children = history.children;
|
|
265
|
+
const head = this.source.children;
|
|
266
|
+
let same = 0;
|
|
267
|
+
const limit = Math.min(children.length, this.history.length);
|
|
268
|
+
while (same < limit && children[same] === this.history[same]) same++;
|
|
269
|
+
const structural = same !== children.length || same !== this.history.length;
|
|
270
|
+
if (!structural && sameValues(this.head, head) && this.blocks.every(block => this.unchanged(block))) return;
|
|
271
|
+
this.owners.clear();
|
|
272
|
+
for (const component of children) {
|
|
235
273
|
const adapter = nativeKinds[nameOf(component)];
|
|
236
274
|
const native = component as NativeContent;
|
|
237
275
|
if (adapter?.kind === "tool" && adapter.accepts(native) && typeof native.toolCallId === "string") {
|
|
238
|
-
owners.set(native.toolCallId, native);
|
|
276
|
+
this.owners.set(native.toolCallId, native);
|
|
239
277
|
}
|
|
240
278
|
}
|
|
241
|
-
|
|
279
|
+
// Blocks of the unchanged prefix keep their positions; later children may have moved.
|
|
280
|
+
let previous: Map<Component, Classified> | undefined;
|
|
281
|
+
const find = (component: Component, index: number): Classified | undefined => {
|
|
282
|
+
if (this.blocks[index]?.component === component) return this.blocks[index];
|
|
283
|
+
previous ??= new Map(this.blocks.map(block => [block.component, block]));
|
|
284
|
+
return previous.get(component);
|
|
285
|
+
};
|
|
286
|
+
const blocks: Classified[] = [];
|
|
287
|
+
const entries = head.slice(0, 2).map(component => reuse(this.entry(component, "system", [], false), this.headEntries));
|
|
288
|
+
this.headEntries = entries.slice();
|
|
242
289
|
let spacing: Component[] = [];
|
|
243
|
-
for (
|
|
290
|
+
for (let position = 0; position < children.length; position++) {
|
|
291
|
+
const component = children[position];
|
|
244
292
|
if (nameOf(component) === "Spacer") {
|
|
245
293
|
spacing.push(component);
|
|
246
294
|
continue;
|
|
247
295
|
}
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const parentId = native.entry?.data?.parentToolCallId ?? native.message?.details?.parentToolCallId;
|
|
255
|
-
const owner = kind === "system" && typeof parentId === "string" ? owners.get(parentId) : undefined;
|
|
256
|
-
if (owner && this.expandedPanels.get(component) !== owner) {
|
|
257
|
-
native.setExpanded?.(true);
|
|
258
|
-
this.expandedPanels.set(component, owner);
|
|
259
|
-
} else if (!owner) this.expandedPanels.delete(component);
|
|
260
|
-
const parts = owner && this.nested.entries(owner.toolCallId!).length ? nativePanelParts(native) : undefined;
|
|
261
|
-
if (parts) for (const part of parts) {
|
|
262
|
-
const adapter = nativeKinds[nameOf(part)];
|
|
263
|
-
const partKind = adapter?.accepts(part as NativeContent) ? adapter.kind : "system";
|
|
264
|
-
entries.push(this.entry(part, partKind, [], true, owner));
|
|
265
|
-
} else entries.push(this.entry(component, kind, spacing, true, owner));
|
|
266
|
-
}
|
|
296
|
+
const old = find(component, blocks.length);
|
|
297
|
+
// Spacing before a block in the unchanged prefix lies in that prefix too.
|
|
298
|
+
const sameSpacing = old !== undefined && (position < same || sameValues(old.spacing, spacing));
|
|
299
|
+
const block = old && sameSpacing && this.unchanged(old) ? old : this.classify(component, sameSpacing ? old!.spacing : spacing, old);
|
|
300
|
+
blocks.push(block);
|
|
301
|
+
for (const entry of block.entries) entries.push(entry);
|
|
267
302
|
spacing = [];
|
|
268
303
|
}
|
|
304
|
+
this.blocks = blocks;
|
|
305
|
+
this.history = children.slice();
|
|
306
|
+
this.head = head.slice();
|
|
269
307
|
// Project late execution output beside its owner, never reorder native history.
|
|
270
308
|
const linked = new Map<Component, ContentEntry[]>();
|
|
271
309
|
for (const entry of entries) {
|
|
@@ -274,18 +312,56 @@ export class NativeContentIndex {
|
|
|
274
312
|
group.push(entry);
|
|
275
313
|
linked.set(entry.owner, group);
|
|
276
314
|
}
|
|
277
|
-
|
|
278
|
-
? [entry, ...(linked.get(entry.source) ?? [])] : []);
|
|
279
|
-
this.
|
|
315
|
+
const content = linked.size ? entries.flatMap(entry => entry.owner === entry.source
|
|
316
|
+
? [entry, ...(linked.get(entry.source) ?? [])] : []) : entries;
|
|
317
|
+
if (sameValues(this.content, content)) return;
|
|
318
|
+
this.content = content;
|
|
280
319
|
this.panes = {};
|
|
281
320
|
}
|
|
282
321
|
|
|
322
|
+
/** The parts a nested-call tree shows for an owner's linked panel, or none to keep the panel whole. */
|
|
323
|
+
private panelParts(panel: NativeContent, owner: string): Component[] | undefined {
|
|
324
|
+
return this.nestedTrees() && this.nested.entries(owner).length ? nativePanelParts(panel) : undefined;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/** Build the entries of one native history block, keeping previous entry objects that did not change. */
|
|
328
|
+
private classify(component: Component, spacing: Component[], old: Classified | undefined): Classified {
|
|
329
|
+
const native = component as NativeContent;
|
|
330
|
+
const block: Classified = { component, spacing, entries: [], toolCallId: native.toolCallId, parentId: parentOf(native), custom: native.customComponent };
|
|
331
|
+
const message = assistant(component);
|
|
332
|
+
if (message) {
|
|
333
|
+
block.entries = this.assistantEntries(message, spacing);
|
|
334
|
+
block.content = message.contentContainer.children;
|
|
335
|
+
block.contentLength = block.content.length;
|
|
336
|
+
block.message = message.lastMessage;
|
|
337
|
+
} else {
|
|
338
|
+
const adapter = nativeKinds[nameOf(component)];
|
|
339
|
+
const content = component as NativeContent;
|
|
340
|
+
const kind = adapter?.accepts(content) ? adapter.kind : "system";
|
|
341
|
+
const parentId = block.parentId;
|
|
342
|
+
const owner = kind === "system" && typeof parentId === "string" ? this.owners.get(parentId) : undefined;
|
|
343
|
+
if (owner && this.expandedPanels.get(component) !== owner) {
|
|
344
|
+
content.setExpanded?.(true);
|
|
345
|
+
this.expandedPanels.set(component, owner);
|
|
346
|
+
} else if (!owner) this.expandedPanels.delete(component);
|
|
347
|
+
const parts = owner ? this.panelParts(content, owner.toolCallId!) : undefined;
|
|
348
|
+
if (kind === "system" && typeof parentId === "string") block.parent = { id: parentId, owner, parts };
|
|
349
|
+
if (parts) for (const part of parts) {
|
|
350
|
+
const adapter = nativeKinds[nameOf(part)];
|
|
351
|
+
const partKind = adapter?.accepts(part as NativeContent) ? adapter.kind : "system";
|
|
352
|
+
block.entries.push(this.entry(part, partKind, [], true, owner));
|
|
353
|
+
} else block.entries.push(this.entry(component, kind, spacing, true, owner));
|
|
354
|
+
}
|
|
355
|
+
if (old) block.entries = block.entries.map(entry => reuse(entry, old.entries));
|
|
356
|
+
return block;
|
|
357
|
+
}
|
|
358
|
+
|
|
283
359
|
private entry(source: Component, kind: ContentKind, spacing: Component[], compact: boolean, owner?: NativeContent): ContentEntry {
|
|
284
360
|
const tool = kind === "tool" ? (): ToolSummary => {
|
|
285
361
|
const native = source as NativeContent;
|
|
286
362
|
return {
|
|
287
363
|
name: native.toolName!, args: native.args,
|
|
288
|
-
status:
|
|
364
|
+
status: callStatus(native),
|
|
289
365
|
};
|
|
290
366
|
} : undefined;
|
|
291
367
|
return { source, owner: owner ?? source, component: source, kind: owner ? "tool" : kind, spacing, compact, tool, search: width => {
|
|
@@ -343,6 +419,8 @@ export class NativeContentIndex {
|
|
|
343
419
|
padding = [];
|
|
344
420
|
}
|
|
345
421
|
if (slot < runs.length) throw new Error("Pi's assistant content layout is not supported");
|
|
422
|
+
// Entries outlive one classification; search reads the current diagnostics.
|
|
423
|
+
this.diagnostics.set(source, diagnostics);
|
|
346
424
|
const views = this.views.get(source) ?? {};
|
|
347
425
|
this.views.set(source, views);
|
|
348
426
|
const result: ContentEntry[] = [];
|
|
@@ -371,7 +449,7 @@ export class NativeContentIndex {
|
|
|
371
449
|
.map(block => kind === "text" ? block.text ?? "" : block.thinking ?? "").join("\n\n");
|
|
372
450
|
return {
|
|
373
451
|
label: pane === "activity" ? "Thinking" : "Assistant",
|
|
374
|
-
text: [saved, ...(pane === "chat" ? diagnostics.map(child => searchText(child.render(width).join("\n"))) : [])].filter(Boolean).join("\n\n"),
|
|
452
|
+
text: [saved, ...(pane === "chat" ? (this.diagnostics.get(source) ?? []).map(child => searchText(child.render(width).join("\n"))) : [])].filter(Boolean).join("\n\n"),
|
|
375
453
|
reveal: pane === "activity" ? () => source.setHideThinkingBlock(false) : undefined,
|
|
376
454
|
};
|
|
377
455
|
},
|
package/src/index.ts
CHANGED
|
@@ -68,11 +68,19 @@ export default async function transcript(pi: ExtensionAPI): Promise<void> {
|
|
|
68
68
|
currentValue: preferences.buttonStyle, values: ["icons", "text"],
|
|
69
69
|
}, {
|
|
70
70
|
id: "compactTools", label: "Compact Activity tools",
|
|
71
|
-
description: "
|
|
71
|
+
description: "Show each finished call as one row that opens its full card. Full text stays searchable and copyable.",
|
|
72
72
|
currentValue: preferences.compactTools ? "on" : "off", values: ["on", "off"],
|
|
73
|
+
}, {
|
|
74
|
+
id: "groupTools", label: "Group Activity tools",
|
|
75
|
+
description: "Merge adjacent calls of the same tool and state under one counted header.",
|
|
76
|
+
currentValue: preferences.groupTools ? "on" : "off", values: ["on", "off"],
|
|
77
|
+
}, {
|
|
78
|
+
id: "nestedTree", label: "Nested call tree",
|
|
79
|
+
description: "Show the calls a tool makes, such as Codemode's, as a tree. Off keeps the tool's own output panel.",
|
|
80
|
+
currentValue: preferences.nestedTree ? "on" : "off", values: ["on", "off"],
|
|
73
81
|
}, {
|
|
74
82
|
id: "streamTools", label: "Stream latest tools",
|
|
75
|
-
description: "
|
|
83
|
+
description: "While compact or grouped, show new tool calls in full and collapse them after the delay.",
|
|
76
84
|
currentValue: preferences.streamTools ? "on" : "off", values: ["on", "off"],
|
|
77
85
|
}, {
|
|
78
86
|
id: "streamDelay", label: "Collapse delay",
|
|
@@ -82,11 +90,13 @@ export default async function transcript(pi: ExtensionAPI): Promise<void> {
|
|
|
82
90
|
id: "height", label: "Conversation height",
|
|
83
91
|
description: "Auto grows to half the history area. Drag sets a manual maximum.",
|
|
84
92
|
currentValue: preferences.chatHeight === null ? "auto" : "manual", values: ["auto", "manual"],
|
|
85
|
-
}],
|
|
93
|
+
}], 9, getSettingsListTheme(), (id, value) => {
|
|
86
94
|
if (id === "timestamps") layout?.setTimestamps(value === "on");
|
|
87
95
|
else if (id === "copyButtons") layout?.setCopyButtons(value === "on");
|
|
88
96
|
else if (id === "buttonStyle") layout?.setButtonStyle(value === "text" ? "text" : "icons");
|
|
89
97
|
else if (id === "compactTools") layout?.setCompactTools(value === "on");
|
|
98
|
+
else if (id === "groupTools") layout?.setGroupTools(value === "on");
|
|
99
|
+
else if (id === "nestedTree") layout?.setNestedTree(value === "on");
|
|
90
100
|
else if (id === "streamTools") layout?.setStreamTools(value === "on");
|
|
91
101
|
else if (id === "streamDelay") layout?.setStreamDelay(Number.parseInt(value, 10));
|
|
92
102
|
else if (id === "height") layout?.setAutomaticHeight(value === "auto");
|