dal-code 0.1.10 → 1.0.7
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 +67 -1
- package/dist/core/auth-guidance.d.ts +1 -0
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js +6 -0
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +4 -7
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +13 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +47 -48
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +46 -43
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +10 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +13 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/tools/bash.d.ts +3 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +61 -8
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +43 -6
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/dal/builtins.d.ts.map +1 -1
- package/dist/dal/builtins.js +1 -0
- package/dist/dal/builtins.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +12 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +22 -1
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +2 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +24 -7
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +39 -2
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +200 -29
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +35 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +177 -23
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/light.json +1 -1
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/tui-renderer.js +2 -2
- package/dist/modes/interactive/tui-renderer.js.map +1 -1
- package/dist/node_modules/@dalcode/dal-bridge/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-gateway/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-halo/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/package.json +9 -6
- package/dist/node_modules/@dalcode/dal-mcp/src/add-wizard.ts +142 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/command-parser.ts +218 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/config-edit.ts +99 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/index.ts +161 -18
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.ts +8 -3
- package/dist/node_modules/@dalcode/dal-office/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-office/package.json +37 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/csv.ts +84 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/index.ts +111 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/ooxml.ts +109 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/pdf.ts +43 -0
- package/dist/node_modules/@dalcode/dal-office/src/index.ts +43 -0
- package/dist/node_modules/@dalcode/dal-office/src/paths.ts +107 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/chart.ts +111 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/docx.ts +155 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.ts +386 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.ts +99 -0
- package/dist/node_modules/@dalcode/dal-office/src/scenes.ts +197 -0
- package/dist/node_modules/@dalcode/dal-office/src/scratchpad.ts +49 -0
- package/dist/node_modules/@dalcode/dal-office/src/themes.ts +240 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/chart-generate.ts +122 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/doc-generate.ts +123 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/drawio-generate.ts +99 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/md-generate.ts +76 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-generate.ts +106 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-plan.ts +91 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/read-file.ts +71 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/shared.ts +54 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/sheet-generate.ts +101 -0
- package/dist/node_modules/@dalcode/dal-office/src/truncate.ts +27 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.d.ts.map +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +237 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js.map +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.ts +326 -0
- package/dist/node_modules/@dalcode/dal-skills/package.json +6 -5
- package/dist/node_modules/@dalcode/dal-skills/src/discover.ts +101 -0
- package/dist/node_modules/@dalcode/dal-skills/src/index.ts +100 -1
- package/dist/node_modules/@dalcode/dal-skills/src/install.ts +140 -0
- package/dist/node_modules/@dalcode/dal-skills/src/manage.ts +446 -0
- package/dist/node_modules/@dalcode/dal-skills/src/packages.ts +130 -0
- package/dist/node_modules/@dalcode/dal-subagent/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-subagent/src/index.ts +46 -4
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +3 -3
- package/dist/node_modules/@dalcode/deepailab/package.json +4 -4
- package/dist/node_modules/@dalcode/deepailab/src/index.ts +7 -1
- package/dist/node_modules/@dalcode/deepailab/src/model-defaults.ts +42 -6
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-client/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-protocol/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +3 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js +3 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +23 -22
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +4 -3
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +4 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/utils/changelog.d.ts +37 -4
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +80 -17
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +13 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/plugins/pi-example-plugin/package.json +1 -1
- package/npm-shrinkwrap.json +1489 -3
- package/package.json +8 -2
|
@@ -2,33 +2,84 @@ import { Box, Container, getCapabilities, Image, Spacer, Text, truncateToWidth,
|
|
|
2
2
|
import { createAllToolDefinitions } from "../../../core/tools/index.js";
|
|
3
3
|
import { compactToolArgHint, countOutputLines, formatCollapsedSummary, getTextOutput as getRenderedTextOutput, prettyToolLabel, } from "../../../core/tools/render-utils.js";
|
|
4
4
|
import { t } from "../../../dal/i18n.js";
|
|
5
|
+
import { stripAnsi } from "../../../utils/ansi.js";
|
|
5
6
|
import { convertToPng } from "../../../utils/image-convert.js";
|
|
6
7
|
import { theme } from "../theme/theme.js";
|
|
7
8
|
import { keyHint } from "./keybinding-hints.js";
|
|
8
9
|
import { PulseLabel } from "./status-indicator.js";
|
|
9
10
|
const FALLBACK_PREVIEW_LINES = 0;
|
|
11
|
+
/**
|
|
12
|
+
* Left gutter for tool rows.
|
|
13
|
+
*
|
|
14
|
+
* Two spaces, matching the width of the focus marker ("\u25b8 ") so a row does
|
|
15
|
+
* not shift sideways when the cursor lands on it — a transcript that twitches
|
|
16
|
+
* as you arrow through it is worse than one with no cursor at all.
|
|
17
|
+
*/
|
|
18
|
+
const TOOL_ROW_INDENT = " ";
|
|
10
19
|
/** Collapsed tools render as a single Claude-style row: call + muted stats. */
|
|
11
20
|
class CollapsedToolRow {
|
|
12
21
|
call;
|
|
13
22
|
result;
|
|
14
|
-
|
|
23
|
+
marker;
|
|
24
|
+
constructor(call, result, marker = "") {
|
|
15
25
|
this.call = call;
|
|
16
26
|
this.result = result;
|
|
27
|
+
this.marker = marker;
|
|
17
28
|
}
|
|
18
29
|
invalidate() {
|
|
19
30
|
this.call.invalidate?.();
|
|
20
31
|
this.result?.invalidate?.();
|
|
21
32
|
}
|
|
22
33
|
render(width) {
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
// Indent, so a run of tool calls reads as work done *under* the reply
|
|
35
|
+
// rather than as a peer of it. Without it the transcript is a flat wall
|
|
36
|
+
// of equally-weighted lines and the eye has nowhere to land.
|
|
37
|
+
const indent = this.marker ? "" : TOOL_ROW_INDENT;
|
|
38
|
+
const inner = Math.max(1, width - TOOL_ROW_INDENT.length);
|
|
39
|
+
const callLine = (this.call.render(inner)[0] ?? "").replace(/\s+$/, "");
|
|
40
|
+
// Stripped before recolouring: the result component already paints its
|
|
41
|
+
// summary "muted", and wrapping that in "dim" left the inner colour
|
|
42
|
+
// winning, so the stats came out the same brightness as the description
|
|
43
|
+
// and the row had two levels where it needs three.
|
|
44
|
+
const resultText = stripAnsi((this.result?.render(inner) ?? [])
|
|
25
45
|
.map((line) => line.trim())
|
|
26
46
|
.filter((line) => line.length > 0)
|
|
27
|
-
.join(" · ");
|
|
47
|
+
.join(" · "));
|
|
28
48
|
if (!callLine.trim() && !resultText)
|
|
29
49
|
return [];
|
|
30
50
|
const combined = resultText ? `${callLine} ${theme.fg("dim", resultText)}` : callLine;
|
|
31
|
-
|
|
51
|
+
const line = `${indent}${this.marker}${combined}`;
|
|
52
|
+
return [truncateToWidth(line, Math.max(1, width), theme.fg("dim", "..."))];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Prefixes one component's first line with the cursor marker.
|
|
57
|
+
*
|
|
58
|
+
* An expanded call is not a single row, so it cannot go through
|
|
59
|
+
* CollapsedToolRow — but the cursor still has to be visible on it, or moving
|
|
60
|
+
* onto something you already opened looks like the keypress did nothing.
|
|
61
|
+
*/
|
|
62
|
+
class FocusMarkerRow {
|
|
63
|
+
inner;
|
|
64
|
+
marker;
|
|
65
|
+
constructor(inner, marker) {
|
|
66
|
+
this.inner = inner;
|
|
67
|
+
this.marker = marker;
|
|
68
|
+
}
|
|
69
|
+
invalidate() {
|
|
70
|
+
this.inner.invalidate?.();
|
|
71
|
+
}
|
|
72
|
+
render(width) {
|
|
73
|
+
// The gutter has to come out of the child's width, not be added on top of
|
|
74
|
+
// it: prepending without shrinking pushed rendered lines past the
|
|
75
|
+
// terminal edge and tripped the TUI's own width assertion
|
|
76
|
+
// ("Rendered line 200 exceeds terminal width (82 > 80)").
|
|
77
|
+
const gutter = stripAnsi(this.marker).length;
|
|
78
|
+
const lines = this.inner.render(Math.max(1, width - gutter));
|
|
79
|
+
if (lines.length === 0)
|
|
80
|
+
return lines;
|
|
81
|
+
const pad = " ".repeat(gutter);
|
|
82
|
+
return [`${this.marker}${lines[0]}`, ...lines.slice(1).map((line) => `${pad}${line}`)];
|
|
32
83
|
}
|
|
33
84
|
}
|
|
34
85
|
export class ToolExecutionComponent extends Container {
|
|
@@ -58,6 +109,15 @@ export class ToolExecutionComponent extends Container {
|
|
|
58
109
|
hideComponent = false;
|
|
59
110
|
activityPulse;
|
|
60
111
|
collapsedAway = false;
|
|
112
|
+
/**
|
|
113
|
+
* Whether the transcript cursor is sitting on this call.
|
|
114
|
+
*
|
|
115
|
+
* Purely presentational — it draws the arrow that says "ctrl+o acts on this
|
|
116
|
+
* one". The transcript is an append-only log with no selection model of its
|
|
117
|
+
* own, so the cursor lives in interactive-mode and each component only
|
|
118
|
+
* needs to know whether it is the chosen one.
|
|
119
|
+
*/
|
|
120
|
+
focused = false;
|
|
61
121
|
leadingStreak = 0;
|
|
62
122
|
constructor(toolName, toolCallId, args, options = {}, toolDefinition, ui, cwd) {
|
|
63
123
|
super();
|
|
@@ -92,6 +152,23 @@ export class ToolExecutionComponent extends Container {
|
|
|
92
152
|
isQuietFoldable() {
|
|
93
153
|
return !this.expanded && !!this.result && !this.result.isError && !this.isPartial;
|
|
94
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* The arrow drawn at the head of a collapsed row.
|
|
157
|
+
*
|
|
158
|
+
* Only the focused row gets one, and unfocused rows keep their existing
|
|
159
|
+
* left edge: reserving a marker column on every row would shift the whole
|
|
160
|
+
* transcript two characters right to serve a cursor that is usually not
|
|
161
|
+
* even on screen.
|
|
162
|
+
*/
|
|
163
|
+
focusMarker() {
|
|
164
|
+
return this.focused ? theme.fg("accent", this.expanded ? "\u25be " : "\u25b8 ") : "";
|
|
165
|
+
}
|
|
166
|
+
setFocused(focused) {
|
|
167
|
+
if (this.focused === focused)
|
|
168
|
+
return;
|
|
169
|
+
this.focused = focused;
|
|
170
|
+
this.invalidate();
|
|
171
|
+
}
|
|
95
172
|
setStreakPresentation(collapsedAway, leadingStreak = 0) {
|
|
96
173
|
this.collapsedAway = collapsedAway;
|
|
97
174
|
this.leadingStreak = collapsedAway ? 0 : leadingStreak;
|
|
@@ -315,12 +392,14 @@ export class ToolExecutionComponent extends Container {
|
|
|
315
392
|
}
|
|
316
393
|
const foldCollapsed = !this.expanded && !this.result?.isError && !!callComponent && callComponent.render(240).length <= 1;
|
|
317
394
|
if (foldCollapsed && callComponent) {
|
|
318
|
-
renderContainer.addChild(new CollapsedToolRow(callComponent, resultComponent));
|
|
395
|
+
renderContainer.addChild(new CollapsedToolRow(callComponent, resultComponent, this.focusMarker()));
|
|
319
396
|
hasContent = true;
|
|
320
397
|
}
|
|
321
398
|
else {
|
|
322
399
|
if (callComponent) {
|
|
323
|
-
|
|
400
|
+
// Same gutter as the collapsed row, so expanding a call does not
|
|
401
|
+
// make it jump left out of the column its neighbours sit in.
|
|
402
|
+
renderContainer.addChild(new FocusMarkerRow(callComponent, this.focusMarker() || TOOL_ROW_INDENT));
|
|
324
403
|
hasContent = true;
|
|
325
404
|
}
|
|
326
405
|
if (resultComponent) {
|
|
@@ -411,32 +490,124 @@ export class ToolExecutionComponent extends Container {
|
|
|
411
490
|
}
|
|
412
491
|
const FOLD_STREAK_FROM = 3;
|
|
413
492
|
/** Collapse consecutive completed tool rows in place, keeping the last one. */
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
493
|
+
/**
|
|
494
|
+
* Whether a child puts nothing on screen.
|
|
495
|
+
*
|
|
496
|
+
* The transcript interleaves assistant messages with tool calls, and a message
|
|
497
|
+
* that is only hidden thinking draws nothing — but it is still a sibling. The
|
|
498
|
+
* streak scan used to stop at it, so a turn that alternated
|
|
499
|
+
* message/tool/message/tool never had three tool calls in a row by that
|
|
500
|
+
* measure and nothing ever folded. That is how a single turn filled the screen
|
|
501
|
+
* with thirty rows of finished work: the folding was written, wired to
|
|
502
|
+
* tool_execution_end, and silently doing nothing.
|
|
503
|
+
*
|
|
504
|
+
* Escape sequences are stripped before the check, so a child emitting only
|
|
505
|
+
* colour or terminal-integration codes still counts as invisible.
|
|
506
|
+
*/
|
|
507
|
+
function rendersNothing(child) {
|
|
508
|
+
// Asked, never measured. Laying the child out to find out cost 2.4s per
|
|
509
|
+
// call on a 200-component transcript — Markdown caches exactly one
|
|
510
|
+
// (text, width) pair, so probing at a width the real frame does not use
|
|
511
|
+
// threw that cache away and re-laid-out the whole history, on every single
|
|
512
|
+
// tool_execution_end. A component that cannot answer counts as visible:
|
|
513
|
+
// failing to fold is a cosmetic loss, guessing wrong is a correctness one.
|
|
514
|
+
const probe = child.isBlank;
|
|
515
|
+
if (typeof probe !== "function")
|
|
516
|
+
return false;
|
|
517
|
+
try {
|
|
518
|
+
return probe.call(child) === true;
|
|
519
|
+
}
|
|
520
|
+
catch {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Collapse a finished run of tool calls into one row plus a count.
|
|
526
|
+
*
|
|
527
|
+
* `scope` decides how far back it may reach, and that is a rendering concern,
|
|
528
|
+
* not a cosmetic one. The transcript renderer can only patch lines that were
|
|
529
|
+
* visible: when the first changed line sits above the viewport it clears the
|
|
530
|
+
* screen AND the scrollback and repaints everything (tui-main-screen.ts,
|
|
531
|
+
* `firstChanged < prevViewportTop`). Rewriting a streak that has already
|
|
532
|
+
* scrolled away therefore costs a full redraw — which looks like the screen
|
|
533
|
+
* jumping, destroys the user's scroll-back history, and on a long transcript
|
|
534
|
+
* fires on every single tool_execution_end.
|
|
535
|
+
*
|
|
536
|
+
* "tail" — only the run at the end of the document, which is the one still
|
|
537
|
+
* being extended and still on screen. Changes stay near the bottom, so the
|
|
538
|
+
* renderer patches instead of repainting. Use this while a turn is running.
|
|
539
|
+
* "all" — every run. Only safe when the frame is being drawn from scratch
|
|
540
|
+
* anyway, i.e. right after a session is rebuilt, where there is no previous
|
|
541
|
+
* viewport to disturb.
|
|
542
|
+
*/
|
|
543
|
+
export function foldQuietToolStreak(children, scope = "tail") {
|
|
544
|
+
if (scope === "all") {
|
|
545
|
+
for (const child of children) {
|
|
546
|
+
if (child instanceof ToolExecutionComponent)
|
|
547
|
+
child.setStreakPresentation(false, 0);
|
|
548
|
+
}
|
|
549
|
+
let index = 0;
|
|
550
|
+
while (index < children.length) {
|
|
551
|
+
const run = collectRunFrom(children, index);
|
|
552
|
+
if (run === null) {
|
|
553
|
+
index++;
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
applyRun(run.members);
|
|
557
|
+
index = Math.max(run.end, index + 1);
|
|
558
|
+
}
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
const run = collectTrailingRun(children);
|
|
562
|
+
if (run.length > 0)
|
|
563
|
+
applyRun(run);
|
|
564
|
+
}
|
|
565
|
+
/** Mark all but the last member of a run as folded away, with the count on the last. */
|
|
566
|
+
function applyRun(members) {
|
|
567
|
+
if (members.length < FOLD_STREAK_FROM)
|
|
568
|
+
return;
|
|
569
|
+
for (let i = 0; i < members.length - 1; i++) {
|
|
570
|
+
members[i].setStreakPresentation(true, 0);
|
|
571
|
+
}
|
|
572
|
+
members[members.length - 1].setStreakPresentation(false, members.length - 1);
|
|
573
|
+
}
|
|
574
|
+
/** The run starting at `index`, or null when nothing foldable starts there. */
|
|
575
|
+
function collectRunFrom(children, index) {
|
|
576
|
+
const child = children[index];
|
|
577
|
+
if (!(child instanceof ToolExecutionComponent) || !child.isQuietFoldable())
|
|
578
|
+
return null;
|
|
579
|
+
const members = [child];
|
|
580
|
+
let end = index + 1;
|
|
581
|
+
let cursor = index + 1;
|
|
582
|
+
while (cursor < children.length) {
|
|
583
|
+
const next = children[cursor];
|
|
584
|
+
if (next instanceof ToolExecutionComponent && next.isQuietFoldable()) {
|
|
585
|
+
members.push(next);
|
|
586
|
+
cursor++;
|
|
587
|
+
end = cursor;
|
|
424
588
|
continue;
|
|
425
589
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
children[end].isQuietFoldable()) {
|
|
430
|
-
end++;
|
|
590
|
+
if (!(next instanceof ToolExecutionComponent) && rendersNothing(next)) {
|
|
591
|
+
cursor++;
|
|
592
|
+
continue;
|
|
431
593
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
return { members, end };
|
|
597
|
+
}
|
|
598
|
+
/** The run at the very end of the document, stepping back over invisible siblings. */
|
|
599
|
+
function collectTrailingRun(children) {
|
|
600
|
+
const members = [];
|
|
601
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
602
|
+
const child = children[i];
|
|
603
|
+
if (child instanceof ToolExecutionComponent && child.isQuietFoldable()) {
|
|
604
|
+
members.unshift(child);
|
|
605
|
+
continue;
|
|
438
606
|
}
|
|
439
|
-
|
|
607
|
+
if (!(child instanceof ToolExecutionComponent) && rendersNothing(child))
|
|
608
|
+
continue;
|
|
609
|
+
break;
|
|
440
610
|
}
|
|
611
|
+
return members;
|
|
441
612
|
}
|
|
442
613
|
//# sourceMappingURL=tool-execution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-execution.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,GAAG,EAEH,SAAS,EACT,eAAe,EACf,KAAK,EACL,MAAM,EACN,IAAI,EAEJ,eAAe,GACf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,wBAAwB,EAAiB,MAAM,8BAA8B,CAAC;AACvF,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,IAAI,qBAAqB,EACtC,eAAe,GACf,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAEjC,+EAA+E;AAC/E,MAAM,gBAAgB;IACJ,IAAI,CAAY;IAChB,MAAM,CAAa;IAEpC,YAAY,IAAe,EAAE,MAAkB,EAAE;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IAAA,CACrB;IAED,UAAU,GAAS;QAClB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC;IAAA,CAC5B;IAED,MAAM,CAAC,KAAa,EAAY;QAC/B,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,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CAAC,eAAe,EAAE,EAAE,CAAC;YAC5E,KAAK,EAAE,CAAC;YACR,SAAS;QACV,CAAC;QACD,IAAI,GAAG,GAAG,KAAK,GAAG,CAAC,CAAC;QACpB,OACC,GAAG,GAAG,QAAQ,CAAC,MAAM;YACrB,QAAQ,CAAC,GAAG,CAAC,YAAY,sBAAsB;YAC9C,QAAQ,CAAC,GAAG,CAA4B,CAAC,eAAe,EAAE,EAC1D,CAAC;YACF,GAAG,EAAE,CAAC;QACP,CAAC;QACD,MAAM,KAAK,GAAG,GAAG,GAAG,KAAK,CAAC;QAC1B,IAAI,KAAK,IAAI,gBAAgB,EAAE,CAAC;YAC/B,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrC,QAAQ,CAAC,CAAC,CAA4B,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YACxE,CAAC;YACA,QAAQ,CAAC,GAAG,GAAG,CAAC,CAA4B,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACvF,CAAC;QACD,KAAK,GAAG,GAAG,CAAC;IACb,CAAC;AAAA,CACD","sourcesContent":["import {\n\tBox,\n\ttype Component,\n\tContainer,\n\tgetCapabilities,\n\tImage,\n\tSpacer,\n\tText,\n\ttype TUI,\n\ttruncateToWidth,\n} from \"@earendil-works/pi-tui\";\nimport type { ToolDefinition, ToolRenderContext } from \"../../../core/extensions/types.ts\";\nimport { createAllToolDefinitions, type ToolName } from \"../../../core/tools/index.ts\";\nimport {\n\tcompactToolArgHint,\n\tcountOutputLines,\n\tformatCollapsedSummary,\n\tgetTextOutput as getRenderedTextOutput,\n\tprettyToolLabel,\n} from \"../../../core/tools/render-utils.ts\";\nimport type { ToolRenderers } from \"../../../core/tools/renderers/index.ts\";\nimport { t } from \"../../../dal/i18n.ts\";\nimport { convertToPng } from \"../../../utils/image-convert.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { keyHint } from \"./keybinding-hints.ts\";\nimport { PulseLabel } from \"./status-indicator.ts\";\n\nexport type { ToolRenderers } from \"../../../core/tools/renderers/index.ts\";\n\nconst FALLBACK_PREVIEW_LINES = 0;\n\n/** Collapsed tools render as a single Claude-style row: call + muted stats. */\nclass CollapsedToolRow implements Component {\n\tprivate readonly call: Component;\n\tprivate readonly result?: Component;\n\n\tconstructor(call: Component, result?: Component) {\n\t\tthis.call = call;\n\t\tthis.result = result;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.call.invalidate?.();\n\t\tthis.result?.invalidate?.();\n\t}\n\n\trender(width: number): string[] {\n\t\tconst callLine = (this.call.render(width)[0] ?? \"\").replace(/\\s+$/, \"\");\n\t\tconst resultText = (this.result?.render(width) ?? [])\n\t\t\t.map((line) => line.trim())\n\t\t\t.filter((line) => line.length > 0)\n\t\t\t.join(\" · \");\n\t\tif (!callLine.trim() && !resultText) return [];\n\t\tconst combined = resultText ? `${callLine} ${theme.fg(\"dim\", resultText)}` : callLine;\n\t\treturn [truncateToWidth(combined, Math.max(1, width), theme.fg(\"dim\", \"...\"))];\n\t}\n}\n\nexport interface ToolExecutionOptions {\n\tshowImages?: boolean;\n\timageWidthCells?: number;\n}\n\nexport class ToolExecutionComponent extends Container {\n\tprivate contentBox: Box;\n\tprivate contentText: Text;\n\tprivate selfRenderContainer: Container;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\tprivate rendererState: any = {};\n\tprivate imageComponents: Image[] = [];\n\tprivate imageSpacers: Spacer[] = [];\n\tprivate toolName: string;\n\tprivate toolCallId: string;\n\tprivate args: any;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate imageWidthCells: number;\n\tprivate isPartial = true;\n\tprivate toolDefinition?: ToolRenderers;\n\tprivate builtInToolDefinition?: ToolRenderers;\n\tprivate ui: TUI;\n\tprivate cwd: string;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate result?: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: any;\n\t};\n\tprivate convertedImages: Map<number, { data: string; mimeType: string }> = new Map();\n\tprivate hideComponent = false;\n\tprivate activityPulse?: PulseLabel;\n\tprivate collapsedAway = false;\n\tprivate leadingStreak = 0;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: any,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolRenderers | ToolDefinition<any, any, any> | undefined,\n\t\tui: TUI,\n\t\tcwd: string,\n\t) {\n\t\tsuper();\n\t\tthis.toolName = toolName;\n\t\tthis.toolCallId = toolCallId;\n\t\tthis.args = args;\n\t\tthis.toolDefinition = toolDefinition;\n\t\tthis.builtInToolDefinition = createAllToolDefinitions(cwd)[toolName as ToolName];\n\t\tthis.showImages = options.showImages ?? true;\n\t\tthis.imageWidthCells = options.imageWidthCells ?? 60;\n\t\tthis.ui = ui;\n\t\tthis.cwd = cwd;\n\n\t\t// Always create all shell variants. contentBox is used for default renderer-based composition.\n\t\t// selfRenderContainer is used when the tool renders its own framing.\n\t\t// contentText is reserved for generic fallback rendering when no tool definition exists.\n\t\tthis.contentBox = new Box(0, 0);\n\t\tthis.contentText = new Text(\"\", 0, 0);\n\t\tthis.selfRenderContainer = new Container();\n\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tthis.addChild(this.getRenderShell() === \"self\" ? this.selfRenderContainer : this.contentBox);\n\t\t} else {\n\t\t\tthis.addChild(this.contentText);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tdispose(): void {\n\t\tthis.activityPulse?.dispose();\n\t\tthis.activityPulse = undefined;\n\t}\n\n\t/** Completed, collapsed, not an error — safe to fold into a streak. */\n\tisQuietFoldable(): boolean {\n\t\treturn !this.expanded && !!this.result && !this.result.isError && !this.isPartial;\n\t}\n\n\tsetStreakPresentation(collapsedAway: boolean, leadingStreak = 0): void {\n\t\tthis.collapsedAway = collapsedAway;\n\t\tthis.leadingStreak = collapsedAway ? 0 : leadingStreak;\n\t}\n\n\tprivate getCallRenderer(): ToolRenderers[\"renderCall\"] | undefined {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderCall;\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderCall;\n\t\t}\n\t\treturn this.toolDefinition.renderCall ?? this.builtInToolDefinition.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolRenderers[\"renderResult\"] | undefined {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderResult;\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderResult;\n\t\t}\n\t\treturn this.toolDefinition.renderResult ?? this.builtInToolDefinition.renderResult;\n\t}\n\n\tprivate hasRendererDefinition(): boolean {\n\t\treturn this.builtInToolDefinition !== undefined || this.toolDefinition !== undefined;\n\t}\n\n\tprivate getRenderShell(): \"default\" | \"self\" {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderShell ?? \"default\";\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderShell ?? \"default\";\n\t\t}\n\t\treturn this.toolDefinition.renderShell ?? this.builtInToolDefinition.renderShell ?? \"default\";\n\t}\n\n\tprivate getRenderContext(lastComponent: Component | undefined): ToolRenderContext {\n\t\treturn {\n\t\t\targs: this.args,\n\t\t\ttoolCallId: this.toolCallId,\n\t\t\tinvalidate: () => {\n\t\t\t\tthis.invalidate();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tlastComponent,\n\t\t\tstate: this.rendererState,\n\t\t\tcwd: this.cwd,\n\t\t\texecutionStarted: this.executionStarted,\n\t\t\targsComplete: this.argsComplete,\n\t\t\tisPartial: this.isPartial,\n\t\t\texpanded: this.expanded,\n\t\t\tshowImages: this.showImages,\n\t\t\tisError: this.result?.isError ?? false,\n\t\t};\n\t}\n\n\tprivate createCallFallback(): Component {\n\t\tconst label = prettyToolLabel(this.toolName);\n\t\tconst hint = compactToolArgHint(this.args);\n\t\tconst title = theme.fg(\"toolTitle\", theme.bold(label));\n\t\treturn new Text(hint ? `${title} ${theme.fg(\"dim\", hint)}` : title, 0, 0);\n\t}\n\n\tprivate createResultFallback(): Component | undefined {\n\t\tconst output = this.getTextOutput();\n\t\tif (!output) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (!this.expanded && !this.result?.isError) {\n\t\t\tconst n = countOutputLines(output);\n\t\t\tconst summary = formatCollapsedSummary(theme, n > 0 ? [`${n} lines`] : []);\n\t\t\treturn summary ? new Text(summary, 0, 0) : undefined;\n\t\t}\n\n\t\tconst lines = output.split(\"\\n\");\n\t\tconst displayLines = this.expanded ? lines : lines.slice(0, Math.max(FALLBACK_PREVIEW_LINES, 0));\n\t\tconst remaining = lines.length - displayLines.length;\n\t\tlet text = displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\");\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t\treturn text ? new Text(text, 0, 0) : undefined;\n\t}\n\n\tupdateArgs(args: any): void {\n\t\tthis.args = args;\n\t\tthis.updateDisplay();\n\t}\n\n\tmarkExecutionStarted(): void {\n\t\tthis.executionStarted = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tsetArgsComplete(): void {\n\t\tthis.argsComplete = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tupdateResult(\n\t\tresult: {\n\t\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\t\tdetails?: any;\n\t\t\tisError: boolean;\n\t\t},\n\t\tisPartial = false,\n\t): void {\n\t\tthis.result = result;\n\t\tthis.isPartial = isPartial;\n\t\tthis.updateDisplay();\n\t\tthis.maybeConvertImagesForKitty();\n\t}\n\n\tprivate maybeConvertImagesForKitty(): void {\n\t\tconst caps = getCapabilities();\n\t\tif (caps.images !== \"kitty\") return;\n\t\tif (!this.result) return;\n\n\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\tconst img = imageBlocks[i];\n\t\t\tif (!img.data || !img.mimeType) continue;\n\t\t\tif (img.mimeType === \"image/png\") continue;\n\t\t\tif (this.convertedImages.has(i)) continue;\n\n\t\t\tconst index = i;\n\t\t\tconvertToPng(img.data, img.mimeType).then((converted) => {\n\t\t\t\tif (converted) {\n\t\t\t\t\tthis.convertedImages.set(index, converted);\n\t\t\t\t\tthis.updateDisplay();\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tthis.showImages = show;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tthis.imageWidthCells = Math.max(1, Math.floor(width));\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.hideComponent || this.collapsedAway) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet lines: string[];\n\t\tif (this.hasRendererDefinition() && this.getRenderShell() === \"self\") {\n\t\t\tconst contentLines = this.selfRenderContainer.render(width);\n\t\t\tif (this.imageComponents.length === 0 && contentLines.every((line) => line.trim() === \"\")) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tlines = [];\n\t\t\tif (contentLines.length > 0) {\n\t\t\t\tlines.push(...contentLines);\n\t\t\t}\n\t\t\tfor (let i = 0; i < this.imageComponents.length; i++) {\n\t\t\t\tconst spacer = this.imageSpacers[i];\n\t\t\t\tif (spacer) {\n\t\t\t\t\tlines.push(...spacer.render(width));\n\t\t\t\t}\n\t\t\t\tconst imageComponent = this.imageComponents[i];\n\t\t\t\tif (imageComponent) {\n\t\t\t\t\tlines.push(...imageComponent.render(width));\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tlines = super.render(width);\n\t\t}\n\n\t\tif (this.activityPulse && lines.length > 0) {\n\t\t\tconst glyph = this.activityPulse.render(2)[0] ?? \"\";\n\t\t\tlines[0] = truncateToWidth(`${glyph} ${lines[0]}`, Math.max(1, width), theme.fg(\"dim\", \"...\"));\n\t\t}\n\t\tif (this.leadingStreak > 0) {\n\t\t\treturn [theme.fg(\"dim\", `${this.leadingStreak} ${t(\"个工具\")}`), ...lines];\n\t\t}\n\t\treturn lines;\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tconst bgFn =\n\t\t\tthis.result?.isError && !this.isPartial ? (text: string) => theme.bg(\"toolErrorBg\", text) : undefined;\n\n\t\tlet hasContent = false;\n\t\tthis.hideComponent = false;\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tconst renderContainer = this.getRenderShell() === \"self\" ? this.selfRenderContainer : this.contentBox;\n\t\t\tif (renderContainer instanceof Box) {\n\t\t\t\trenderContainer.setBgFn(bgFn);\n\t\t\t}\n\t\t\trenderContainer.clear();\n\n\t\t\tlet callComponent: Component | undefined;\n\t\t\tconst callRenderer = this.getCallRenderer();\n\t\t\tif (!callRenderer) {\n\t\t\t\tcallComponent = this.createCallFallback();\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tcallComponent = callRenderer(this.args, theme, this.getRenderContext(this.callRendererComponent));\n\t\t\t\t\tthis.callRendererComponent = callComponent;\n\t\t\t\t} catch {\n\t\t\t\t\tthis.callRendererComponent = undefined;\n\t\t\t\t\tcallComponent = this.createCallFallback();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet resultComponent: Component | undefined;\n\t\t\tif (this.result) {\n\t\t\t\tconst resultRenderer = this.getResultRenderer();\n\t\t\t\tif (!resultRenderer) {\n\t\t\t\t\tresultComponent = this.createResultFallback();\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresultComponent = resultRenderer(\n\t\t\t\t\t\t\t{ content: this.result.content as any, details: this.result.details },\n\t\t\t\t\t\t\t{ expanded: this.expanded, isPartial: this.isPartial },\n\t\t\t\t\t\t\ttheme,\n\t\t\t\t\t\t\tthis.getRenderContext(this.resultRendererComponent),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.resultRendererComponent = resultComponent;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tthis.resultRendererComponent = undefined;\n\t\t\t\t\t\tresultComponent = this.createResultFallback();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (resultComponent && this.isBlankComponent(resultComponent)) {\n\t\t\t\t\tresultComponent = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst foldCollapsed =\n\t\t\t\t!this.expanded && !this.result?.isError && !!callComponent && callComponent.render(240).length <= 1;\n\t\t\tif (foldCollapsed && callComponent) {\n\t\t\t\trenderContainer.addChild(new CollapsedToolRow(callComponent, resultComponent));\n\t\t\t\thasContent = true;\n\t\t\t} else {\n\t\t\t\tif (callComponent) {\n\t\t\t\t\trenderContainer.addChild(callComponent);\n\t\t\t\t\thasContent = true;\n\t\t\t\t}\n\t\t\t\tif (resultComponent) {\n\t\t\t\t\trenderContainer.addChild(resultComponent);\n\t\t\t\t\thasContent = true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.contentText.setCustomBgFn(bgFn);\n\t\t\tthis.contentText.setText(this.formatToolExecution());\n\t\t\thasContent = true;\n\t\t}\n\n\t\tfor (const img of this.imageComponents) {\n\t\t\tthis.removeChild(img);\n\t\t}\n\t\tthis.imageComponents = [];\n\t\tfor (const spacer of this.imageSpacers) {\n\t\t\tthis.removeChild(spacer);\n\t\t}\n\t\tthis.imageSpacers = [];\n\n\t\tif (this.result) {\n\t\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\t\tconst caps = getCapabilities();\n\t\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\t\tconst img = imageBlocks[i];\n\t\t\t\tif (caps.images && this.showImages && img.data && img.mimeType) {\n\t\t\t\t\tconst converted = this.convertedImages.get(i);\n\t\t\t\t\tconst imageData = converted?.data ?? img.data;\n\t\t\t\t\tconst imageMimeType = converted?.mimeType ?? img.mimeType;\n\t\t\t\t\tif (caps.images === \"kitty\" && imageMimeType !== \"image/png\") continue;\n\n\t\t\t\t\tconst spacer = new Spacer(1);\n\t\t\t\t\tthis.addChild(spacer);\n\t\t\t\t\tthis.imageSpacers.push(spacer);\n\t\t\t\t\tconst imageComponent = new Image(\n\t\t\t\t\t\timageData,\n\t\t\t\t\t\timageMimeType,\n\t\t\t\t\t\t{ fallbackColor: (s: string) => theme.fg(\"toolOutput\", s) },\n\t\t\t\t\t\t{ maxWidthCells: this.imageWidthCells },\n\t\t\t\t\t);\n\t\t\t\t\tthis.imageComponents.push(imageComponent);\n\t\t\t\t\tthis.addChild(imageComponent);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this.hasRendererDefinition() && !hasContent && this.imageComponents.length === 0) {\n\t\t\tthis.hideComponent = true;\n\t\t}\n\t\tthis.syncActivityPulse();\n\t}\n\n\tprivate syncActivityPulse(): void {\n\t\tconst live = (!this.result || this.isPartial) && !this.hideComponent;\n\t\tif (live) {\n\t\t\tif (!this.activityPulse) {\n\t\t\t\tthis.activityPulse = new PulseLabel(this.ui, \"\");\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tthis.activityPulse?.dispose();\n\t\tthis.activityPulse = undefined;\n\t}\n\n\tprivate getTextOutput(): string {\n\t\treturn getRenderedTextOutput(this.result, this.showImages);\n\t}\n\n\tprivate isBlankComponent(component: Component): boolean {\n\t\tif (!(component instanceof Text)) return false;\n\t\tconst lines = component.render(120);\n\t\treturn lines.every((line) => line.trim() === \"\");\n\t}\n\n\tprivate formatToolExecution(): string {\n\t\tconst label = prettyToolLabel(this.toolName);\n\t\tconst hint = compactToolArgHint(this.args);\n\t\tlet text = theme.fg(\"toolTitle\", theme.bold(label));\n\t\tif (hint) text += ` ${theme.fg(\"dim\", hint)}`;\n\t\tconst output = this.getTextOutput();\n\t\tif (this.expanded || this.result?.isError) {\n\t\t\tif (this.args && this.expanded) {\n\t\t\t\ttext += `\\n${theme.fg(\"dim\", JSON.stringify(this.args))}`;\n\t\t\t}\n\t\t\tif (output) text += `\\n${theme.fg(\"toolOutput\", output)}`;\n\t\t} else if (output) {\n\t\t\tconst n = countOutputLines(output);\n\t\t\tif (n > 0) text += formatCollapsedSummary(theme, [`${n} lines`]);\n\t\t}\n\t\treturn text;\n\t}\n}\n\nconst FOLD_STREAK_FROM = 3;\n\n/** Collapse consecutive completed tool rows in place, keeping the last one. */\nexport function foldQuietToolStreak(children: readonly Component[]): void {\n\tfor (const child of children) {\n\t\tif (child instanceof ToolExecutionComponent) child.setStreakPresentation(false, 0);\n\t}\n\tlet index = 0;\n\twhile (index < children.length) {\n\t\tconst child = children[index];\n\t\tif (!(child instanceof ToolExecutionComponent) || !child.isQuietFoldable()) {\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\t\tlet end = index + 1;\n\t\twhile (\n\t\t\tend < children.length &&\n\t\t\tchildren[end] instanceof ToolExecutionComponent &&\n\t\t\t(children[end] as ToolExecutionComponent).isQuietFoldable()\n\t\t) {\n\t\t\tend++;\n\t\t}\n\t\tconst count = end - index;\n\t\tif (count >= FOLD_STREAK_FROM) {\n\t\t\tfor (let i = index; i < end - 1; i++) {\n\t\t\t\t(children[i] as ToolExecutionComponent).setStreakPresentation(true, 0);\n\t\t\t}\n\t\t\t(children[end - 1] as ToolExecutionComponent).setStreakPresentation(false, count - 1);\n\t\t}\n\t\tindex = end;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-execution.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,GAAG,EAEH,SAAS,EACT,eAAe,EACf,KAAK,EACL,MAAM,EACN,IAAI,EAEJ,eAAe,GACf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,wBAAwB,EAAiB,MAAM,8BAA8B,CAAC;AACvF,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,IAAI,qBAAqB,EACtC,eAAe,GACf,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,+EAA+E;AAC/E,MAAM,gBAAgB;IACJ,IAAI,CAAY;IAChB,MAAM,CAAa;IACnB,MAAM,CAAS;IAEhC,YAAY,IAAe,EAAE,MAAkB,EAAE,MAAM,GAAG,EAAE,EAAE;QAC7D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IAAA,CACrB;IAED,UAAU,GAAS;QAClB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC;IAAA,CAC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\tImage,\n\tSpacer,\n\tText,\n\ttype TUI,\n\ttruncateToWidth,\n} from \"@earendil-works/pi-tui\";\nimport type { ToolDefinition, ToolRenderContext } from \"../../../core/extensions/types.ts\";\nimport { createAllToolDefinitions, type ToolName } from \"../../../core/tools/index.ts\";\nimport {\n\tcompactToolArgHint,\n\tcountOutputLines,\n\tformatCollapsedSummary,\n\tgetTextOutput as getRenderedTextOutput,\n\tprettyToolLabel,\n} from \"../../../core/tools/render-utils.ts\";\nimport type { ToolRenderers } from \"../../../core/tools/renderers/index.ts\";\nimport { t } from \"../../../dal/i18n.ts\";\nimport { stripAnsi } from \"../../../utils/ansi.ts\";\nimport { convertToPng } from \"../../../utils/image-convert.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { keyHint } from \"./keybinding-hints.ts\";\nimport { PulseLabel } from \"./status-indicator.ts\";\n\nexport type { ToolRenderers } from \"../../../core/tools/renderers/index.ts\";\n\nconst FALLBACK_PREVIEW_LINES = 0;\n\n/**\n * Left gutter for tool rows.\n *\n * Two spaces, matching the width of the focus marker (\"\\u25b8 \") so a row does\n * not shift sideways when the cursor lands on it — a transcript that twitches\n * as you arrow through it is worse than one with no cursor at all.\n */\nconst TOOL_ROW_INDENT = \" \";\n\n/** Collapsed tools render as a single Claude-style row: call + muted stats. */\nclass CollapsedToolRow implements Component {\n\tprivate readonly call: Component;\n\tprivate readonly result?: Component;\n\tprivate readonly marker: string;\n\n\tconstructor(call: Component, result?: Component, marker = \"\") {\n\t\tthis.call = call;\n\t\tthis.result = result;\n\t\tthis.marker = marker;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.call.invalidate?.();\n\t\tthis.result?.invalidate?.();\n\t}\n\n\trender(width: number): string[] {\n\t\t// Indent, so a run of tool calls reads as work done *under* the reply\n\t\t// rather than as a peer of it. Without it the transcript is a flat wall\n\t\t// of equally-weighted lines and the eye has nowhere to land.\n\t\tconst indent = this.marker ? \"\" : TOOL_ROW_INDENT;\n\t\tconst inner = Math.max(1, width - TOOL_ROW_INDENT.length);\n\t\tconst callLine = (this.call.render(inner)[0] ?? \"\").replace(/\\s+$/, \"\");\n\t\t// Stripped before recolouring: the result component already paints its\n\t\t// summary \"muted\", and wrapping that in \"dim\" left the inner colour\n\t\t// winning, so the stats came out the same brightness as the description\n\t\t// and the row had two levels where it needs three.\n\t\tconst resultText = stripAnsi(\n\t\t\t(this.result?.render(inner) ?? [])\n\t\t\t\t.map((line) => line.trim())\n\t\t\t\t.filter((line) => line.length > 0)\n\t\t\t\t.join(\" · \"),\n\t\t);\n\t\tif (!callLine.trim() && !resultText) return [];\n\t\tconst combined = resultText ? `${callLine} ${theme.fg(\"dim\", resultText)}` : callLine;\n\t\tconst line = `${indent}${this.marker}${combined}`;\n\t\treturn [truncateToWidth(line, Math.max(1, width), theme.fg(\"dim\", \"...\"))];\n\t}\n}\n\n/**\n * Prefixes one component's first line with the cursor marker.\n *\n * An expanded call is not a single row, so it cannot go through\n * CollapsedToolRow — but the cursor still has to be visible on it, or moving\n * onto something you already opened looks like the keypress did nothing.\n */\nclass FocusMarkerRow implements Component {\n\tprivate readonly inner: Component;\n\tprivate readonly marker: string;\n\n\tconstructor(inner: Component, marker: string) {\n\t\tthis.inner = inner;\n\t\tthis.marker = marker;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.inner.invalidate?.();\n\t}\n\n\trender(width: number): string[] {\n\t\t// The gutter has to come out of the child's width, not be added on top of\n\t\t// it: prepending without shrinking pushed rendered lines past the\n\t\t// terminal edge and tripped the TUI's own width assertion\n\t\t// (\"Rendered line 200 exceeds terminal width (82 > 80)\").\n\t\tconst gutter = stripAnsi(this.marker).length;\n\t\tconst lines = this.inner.render(Math.max(1, width - gutter));\n\t\tif (lines.length === 0) return lines;\n\t\tconst pad = \" \".repeat(gutter);\n\t\treturn [`${this.marker}${lines[0]}`, ...lines.slice(1).map((line) => `${pad}${line}`)];\n\t}\n}\n\nexport interface ToolExecutionOptions {\n\tshowImages?: boolean;\n\timageWidthCells?: number;\n}\n\nexport class ToolExecutionComponent extends Container {\n\tprivate contentBox: Box;\n\tprivate contentText: Text;\n\tprivate selfRenderContainer: Container;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\tprivate rendererState: any = {};\n\tprivate imageComponents: Image[] = [];\n\tprivate imageSpacers: Spacer[] = [];\n\tprivate toolName: string;\n\tprivate toolCallId: string;\n\tprivate args: any;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate imageWidthCells: number;\n\tprivate isPartial = true;\n\tprivate toolDefinition?: ToolRenderers;\n\tprivate builtInToolDefinition?: ToolRenderers;\n\tprivate ui: TUI;\n\tprivate cwd: string;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate result?: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: any;\n\t};\n\tprivate convertedImages: Map<number, { data: string; mimeType: string }> = new Map();\n\tprivate hideComponent = false;\n\tprivate activityPulse?: PulseLabel;\n\tprivate collapsedAway = false;\n\t/**\n\t * Whether the transcript cursor is sitting on this call.\n\t *\n\t * Purely presentational — it draws the arrow that says \"ctrl+o acts on this\n\t * one\". The transcript is an append-only log with no selection model of its\n\t * own, so the cursor lives in interactive-mode and each component only\n\t * needs to know whether it is the chosen one.\n\t */\n\tprivate focused = false;\n\tprivate leadingStreak = 0;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: any,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolRenderers | ToolDefinition<any, any, any> | undefined,\n\t\tui: TUI,\n\t\tcwd: string,\n\t) {\n\t\tsuper();\n\t\tthis.toolName = toolName;\n\t\tthis.toolCallId = toolCallId;\n\t\tthis.args = args;\n\t\tthis.toolDefinition = toolDefinition;\n\t\tthis.builtInToolDefinition = createAllToolDefinitions(cwd)[toolName as ToolName];\n\t\tthis.showImages = options.showImages ?? true;\n\t\tthis.imageWidthCells = options.imageWidthCells ?? 60;\n\t\tthis.ui = ui;\n\t\tthis.cwd = cwd;\n\n\t\t// Always create all shell variants. contentBox is used for default renderer-based composition.\n\t\t// selfRenderContainer is used when the tool renders its own framing.\n\t\t// contentText is reserved for generic fallback rendering when no tool definition exists.\n\t\tthis.contentBox = new Box(0, 0);\n\t\tthis.contentText = new Text(\"\", 0, 0);\n\t\tthis.selfRenderContainer = new Container();\n\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tthis.addChild(this.getRenderShell() === \"self\" ? this.selfRenderContainer : this.contentBox);\n\t\t} else {\n\t\t\tthis.addChild(this.contentText);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tdispose(): void {\n\t\tthis.activityPulse?.dispose();\n\t\tthis.activityPulse = undefined;\n\t}\n\n\t/** Completed, collapsed, not an error — safe to fold into a streak. */\n\tisQuietFoldable(): boolean {\n\t\treturn !this.expanded && !!this.result && !this.result.isError && !this.isPartial;\n\t}\n\n\t/**\n\t * The arrow drawn at the head of a collapsed row.\n\t *\n\t * Only the focused row gets one, and unfocused rows keep their existing\n\t * left edge: reserving a marker column on every row would shift the whole\n\t * transcript two characters right to serve a cursor that is usually not\n\t * even on screen.\n\t */\n\tprivate focusMarker(): string {\n\t\treturn this.focused ? theme.fg(\"accent\", this.expanded ? \"\\u25be \" : \"\\u25b8 \") : \"\";\n\t}\n\n\tsetFocused(focused: boolean): void {\n\t\tif (this.focused === focused) return;\n\t\tthis.focused = focused;\n\t\tthis.invalidate();\n\t}\n\n\tsetStreakPresentation(collapsedAway: boolean, leadingStreak = 0): void {\n\t\tthis.collapsedAway = collapsedAway;\n\t\tthis.leadingStreak = collapsedAway ? 0 : leadingStreak;\n\t}\n\n\tprivate getCallRenderer(): ToolRenderers[\"renderCall\"] | undefined {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderCall;\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderCall;\n\t\t}\n\t\treturn this.toolDefinition.renderCall ?? this.builtInToolDefinition.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolRenderers[\"renderResult\"] | undefined {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderResult;\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderResult;\n\t\t}\n\t\treturn this.toolDefinition.renderResult ?? this.builtInToolDefinition.renderResult;\n\t}\n\n\tprivate hasRendererDefinition(): boolean {\n\t\treturn this.builtInToolDefinition !== undefined || this.toolDefinition !== undefined;\n\t}\n\n\tprivate getRenderShell(): \"default\" | \"self\" {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderShell ?? \"default\";\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderShell ?? \"default\";\n\t\t}\n\t\treturn this.toolDefinition.renderShell ?? this.builtInToolDefinition.renderShell ?? \"default\";\n\t}\n\n\tprivate getRenderContext(lastComponent: Component | undefined): ToolRenderContext {\n\t\treturn {\n\t\t\targs: this.args,\n\t\t\ttoolCallId: this.toolCallId,\n\t\t\tinvalidate: () => {\n\t\t\t\tthis.invalidate();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tlastComponent,\n\t\t\tstate: this.rendererState,\n\t\t\tcwd: this.cwd,\n\t\t\texecutionStarted: this.executionStarted,\n\t\t\targsComplete: this.argsComplete,\n\t\t\tisPartial: this.isPartial,\n\t\t\texpanded: this.expanded,\n\t\t\tshowImages: this.showImages,\n\t\t\tisError: this.result?.isError ?? false,\n\t\t};\n\t}\n\n\tprivate createCallFallback(): Component {\n\t\tconst label = prettyToolLabel(this.toolName);\n\t\tconst hint = compactToolArgHint(this.args);\n\t\tconst title = theme.fg(\"toolTitle\", theme.bold(label));\n\t\treturn new Text(hint ? `${title} ${theme.fg(\"dim\", hint)}` : title, 0, 0);\n\t}\n\n\tprivate createResultFallback(): Component | undefined {\n\t\tconst output = this.getTextOutput();\n\t\tif (!output) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (!this.expanded && !this.result?.isError) {\n\t\t\tconst n = countOutputLines(output);\n\t\t\tconst summary = formatCollapsedSummary(theme, n > 0 ? [`${n} lines`] : []);\n\t\t\treturn summary ? new Text(summary, 0, 0) : undefined;\n\t\t}\n\n\t\tconst lines = output.split(\"\\n\");\n\t\tconst displayLines = this.expanded ? lines : lines.slice(0, Math.max(FALLBACK_PREVIEW_LINES, 0));\n\t\tconst remaining = lines.length - displayLines.length;\n\t\tlet text = displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\");\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t\treturn text ? new Text(text, 0, 0) : undefined;\n\t}\n\n\tupdateArgs(args: any): void {\n\t\tthis.args = args;\n\t\tthis.updateDisplay();\n\t}\n\n\tmarkExecutionStarted(): void {\n\t\tthis.executionStarted = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tsetArgsComplete(): void {\n\t\tthis.argsComplete = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tupdateResult(\n\t\tresult: {\n\t\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\t\tdetails?: any;\n\t\t\tisError: boolean;\n\t\t},\n\t\tisPartial = false,\n\t): void {\n\t\tthis.result = result;\n\t\tthis.isPartial = isPartial;\n\t\tthis.updateDisplay();\n\t\tthis.maybeConvertImagesForKitty();\n\t}\n\n\tprivate maybeConvertImagesForKitty(): void {\n\t\tconst caps = getCapabilities();\n\t\tif (caps.images !== \"kitty\") return;\n\t\tif (!this.result) return;\n\n\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\tconst img = imageBlocks[i];\n\t\t\tif (!img.data || !img.mimeType) continue;\n\t\t\tif (img.mimeType === \"image/png\") continue;\n\t\t\tif (this.convertedImages.has(i)) continue;\n\n\t\t\tconst index = i;\n\t\t\tconvertToPng(img.data, img.mimeType).then((converted) => {\n\t\t\t\tif (converted) {\n\t\t\t\t\tthis.convertedImages.set(index, converted);\n\t\t\t\t\tthis.updateDisplay();\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tthis.showImages = show;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tthis.imageWidthCells = Math.max(1, Math.floor(width));\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.hideComponent || this.collapsedAway) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet lines: string[];\n\t\tif (this.hasRendererDefinition() && this.getRenderShell() === \"self\") {\n\t\t\tconst contentLines = this.selfRenderContainer.render(width);\n\t\t\tif (this.imageComponents.length === 0 && contentLines.every((line) => line.trim() === \"\")) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tlines = [];\n\t\t\tif (contentLines.length > 0) {\n\t\t\t\tlines.push(...contentLines);\n\t\t\t}\n\t\t\tfor (let i = 0; i < this.imageComponents.length; i++) {\n\t\t\t\tconst spacer = this.imageSpacers[i];\n\t\t\t\tif (spacer) {\n\t\t\t\t\tlines.push(...spacer.render(width));\n\t\t\t\t}\n\t\t\t\tconst imageComponent = this.imageComponents[i];\n\t\t\t\tif (imageComponent) {\n\t\t\t\t\tlines.push(...imageComponent.render(width));\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tlines = super.render(width);\n\t\t}\n\n\t\tif (this.activityPulse && lines.length > 0) {\n\t\t\tconst glyph = this.activityPulse.render(2)[0] ?? \"\";\n\t\t\tlines[0] = truncateToWidth(`${glyph} ${lines[0]}`, Math.max(1, width), theme.fg(\"dim\", \"...\"));\n\t\t}\n\t\tif (this.leadingStreak > 0) {\n\t\t\treturn [theme.fg(\"dim\", `${this.leadingStreak} ${t(\"个工具\")}`), ...lines];\n\t\t}\n\t\treturn lines;\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tconst bgFn =\n\t\t\tthis.result?.isError && !this.isPartial ? (text: string) => theme.bg(\"toolErrorBg\", text) : undefined;\n\n\t\tlet hasContent = false;\n\t\tthis.hideComponent = false;\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tconst renderContainer = this.getRenderShell() === \"self\" ? this.selfRenderContainer : this.contentBox;\n\t\t\tif (renderContainer instanceof Box) {\n\t\t\t\trenderContainer.setBgFn(bgFn);\n\t\t\t}\n\t\t\trenderContainer.clear();\n\n\t\t\tlet callComponent: Component | undefined;\n\t\t\tconst callRenderer = this.getCallRenderer();\n\t\t\tif (!callRenderer) {\n\t\t\t\tcallComponent = this.createCallFallback();\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tcallComponent = callRenderer(this.args, theme, this.getRenderContext(this.callRendererComponent));\n\t\t\t\t\tthis.callRendererComponent = callComponent;\n\t\t\t\t} catch {\n\t\t\t\t\tthis.callRendererComponent = undefined;\n\t\t\t\t\tcallComponent = this.createCallFallback();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet resultComponent: Component | undefined;\n\t\t\tif (this.result) {\n\t\t\t\tconst resultRenderer = this.getResultRenderer();\n\t\t\t\tif (!resultRenderer) {\n\t\t\t\t\tresultComponent = this.createResultFallback();\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresultComponent = resultRenderer(\n\t\t\t\t\t\t\t{ content: this.result.content as any, details: this.result.details },\n\t\t\t\t\t\t\t{ expanded: this.expanded, isPartial: this.isPartial },\n\t\t\t\t\t\t\ttheme,\n\t\t\t\t\t\t\tthis.getRenderContext(this.resultRendererComponent),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.resultRendererComponent = resultComponent;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tthis.resultRendererComponent = undefined;\n\t\t\t\t\t\tresultComponent = this.createResultFallback();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (resultComponent && this.isBlankComponent(resultComponent)) {\n\t\t\t\t\tresultComponent = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst foldCollapsed =\n\t\t\t\t!this.expanded && !this.result?.isError && !!callComponent && callComponent.render(240).length <= 1;\n\t\t\tif (foldCollapsed && callComponent) {\n\t\t\t\trenderContainer.addChild(new CollapsedToolRow(callComponent, resultComponent, this.focusMarker()));\n\t\t\t\thasContent = true;\n\t\t\t} else {\n\t\t\t\tif (callComponent) {\n\t\t\t\t\t// Same gutter as the collapsed row, so expanding a call does not\n\t\t\t\t\t// make it jump left out of the column its neighbours sit in.\n\t\t\t\t\trenderContainer.addChild(new FocusMarkerRow(callComponent, this.focusMarker() || TOOL_ROW_INDENT));\n\t\t\t\t\thasContent = true;\n\t\t\t\t}\n\t\t\t\tif (resultComponent) {\n\t\t\t\t\trenderContainer.addChild(resultComponent);\n\t\t\t\t\thasContent = true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.contentText.setCustomBgFn(bgFn);\n\t\t\tthis.contentText.setText(this.formatToolExecution());\n\t\t\thasContent = true;\n\t\t}\n\n\t\tfor (const img of this.imageComponents) {\n\t\t\tthis.removeChild(img);\n\t\t}\n\t\tthis.imageComponents = [];\n\t\tfor (const spacer of this.imageSpacers) {\n\t\t\tthis.removeChild(spacer);\n\t\t}\n\t\tthis.imageSpacers = [];\n\n\t\tif (this.result) {\n\t\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\t\tconst caps = getCapabilities();\n\t\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\t\tconst img = imageBlocks[i];\n\t\t\t\tif (caps.images && this.showImages && img.data && img.mimeType) {\n\t\t\t\t\tconst converted = this.convertedImages.get(i);\n\t\t\t\t\tconst imageData = converted?.data ?? img.data;\n\t\t\t\t\tconst imageMimeType = converted?.mimeType ?? img.mimeType;\n\t\t\t\t\tif (caps.images === \"kitty\" && imageMimeType !== \"image/png\") continue;\n\n\t\t\t\t\tconst spacer = new Spacer(1);\n\t\t\t\t\tthis.addChild(spacer);\n\t\t\t\t\tthis.imageSpacers.push(spacer);\n\t\t\t\t\tconst imageComponent = new Image(\n\t\t\t\t\t\timageData,\n\t\t\t\t\t\timageMimeType,\n\t\t\t\t\t\t{ fallbackColor: (s: string) => theme.fg(\"toolOutput\", s) },\n\t\t\t\t\t\t{ maxWidthCells: this.imageWidthCells },\n\t\t\t\t\t);\n\t\t\t\t\tthis.imageComponents.push(imageComponent);\n\t\t\t\t\tthis.addChild(imageComponent);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this.hasRendererDefinition() && !hasContent && this.imageComponents.length === 0) {\n\t\t\tthis.hideComponent = true;\n\t\t}\n\t\tthis.syncActivityPulse();\n\t}\n\n\tprivate syncActivityPulse(): void {\n\t\tconst live = (!this.result || this.isPartial) && !this.hideComponent;\n\t\tif (live) {\n\t\t\tif (!this.activityPulse) {\n\t\t\t\tthis.activityPulse = new PulseLabel(this.ui, \"\");\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tthis.activityPulse?.dispose();\n\t\tthis.activityPulse = undefined;\n\t}\n\n\tprivate getTextOutput(): string {\n\t\treturn getRenderedTextOutput(this.result, this.showImages);\n\t}\n\n\tprivate isBlankComponent(component: Component): boolean {\n\t\tif (!(component instanceof Text)) return false;\n\t\tconst lines = component.render(120);\n\t\treturn lines.every((line) => line.trim() === \"\");\n\t}\n\n\tprivate formatToolExecution(): string {\n\t\tconst label = prettyToolLabel(this.toolName);\n\t\tconst hint = compactToolArgHint(this.args);\n\t\tlet text = theme.fg(\"toolTitle\", theme.bold(label));\n\t\tif (hint) text += ` ${theme.fg(\"dim\", hint)}`;\n\t\tconst output = this.getTextOutput();\n\t\tif (this.expanded || this.result?.isError) {\n\t\t\tif (this.args && this.expanded) {\n\t\t\t\ttext += `\\n${theme.fg(\"dim\", JSON.stringify(this.args))}`;\n\t\t\t}\n\t\t\tif (output) text += `\\n${theme.fg(\"toolOutput\", output)}`;\n\t\t} else if (output) {\n\t\t\tconst n = countOutputLines(output);\n\t\t\tif (n > 0) text += formatCollapsedSummary(theme, [`${n} lines`]);\n\t\t}\n\t\treturn text;\n\t}\n}\n\nconst FOLD_STREAK_FROM = 3;\n\n/** Collapse consecutive completed tool rows in place, keeping the last one. */\n/**\n * Whether a child puts nothing on screen.\n *\n * The transcript interleaves assistant messages with tool calls, and a message\n * that is only hidden thinking draws nothing — but it is still a sibling. The\n * streak scan used to stop at it, so a turn that alternated\n * message/tool/message/tool never had three tool calls in a row by that\n * measure and nothing ever folded. That is how a single turn filled the screen\n * with thirty rows of finished work: the folding was written, wired to\n * tool_execution_end, and silently doing nothing.\n *\n * Escape sequences are stripped before the check, so a child emitting only\n * colour or terminal-integration codes still counts as invisible.\n */\nfunction rendersNothing(child: Component): boolean {\n\t// Asked, never measured. Laying the child out to find out cost 2.4s per\n\t// call on a 200-component transcript — Markdown caches exactly one\n\t// (text, width) pair, so probing at a width the real frame does not use\n\t// threw that cache away and re-laid-out the whole history, on every single\n\t// tool_execution_end. A component that cannot answer counts as visible:\n\t// failing to fold is a cosmetic loss, guessing wrong is a correctness one.\n\tconst probe = (child as { isBlank?: () => boolean }).isBlank;\n\tif (typeof probe !== \"function\") return false;\n\ttry {\n\t\treturn probe.call(child) === true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Collapse a finished run of tool calls into one row plus a count.\n *\n * `scope` decides how far back it may reach, and that is a rendering concern,\n * not a cosmetic one. The transcript renderer can only patch lines that were\n * visible: when the first changed line sits above the viewport it clears the\n * screen AND the scrollback and repaints everything (tui-main-screen.ts,\n * `firstChanged < prevViewportTop`). Rewriting a streak that has already\n * scrolled away therefore costs a full redraw — which looks like the screen\n * jumping, destroys the user's scroll-back history, and on a long transcript\n * fires on every single tool_execution_end.\n *\n * \"tail\" — only the run at the end of the document, which is the one still\n * being extended and still on screen. Changes stay near the bottom, so the\n * renderer patches instead of repainting. Use this while a turn is running.\n * \"all\" — every run. Only safe when the frame is being drawn from scratch\n * anyway, i.e. right after a session is rebuilt, where there is no previous\n * viewport to disturb.\n */\nexport function foldQuietToolStreak(children: readonly Component[], scope: \"tail\" | \"all\" = \"tail\"): void {\n\tif (scope === \"all\") {\n\t\tfor (const child of children) {\n\t\t\tif (child instanceof ToolExecutionComponent) child.setStreakPresentation(false, 0);\n\t\t}\n\t\tlet index = 0;\n\t\twhile (index < children.length) {\n\t\t\tconst run = collectRunFrom(children, index);\n\t\t\tif (run === null) {\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tapplyRun(run.members);\n\t\t\tindex = Math.max(run.end, index + 1);\n\t\t}\n\t\treturn;\n\t}\n\n\tconst run = collectTrailingRun(children);\n\tif (run.length > 0) applyRun(run);\n}\n\n/** Mark all but the last member of a run as folded away, with the count on the last. */\nfunction applyRun(members: readonly ToolExecutionComponent[]): void {\n\tif (members.length < FOLD_STREAK_FROM) return;\n\tfor (let i = 0; i < members.length - 1; i++) {\n\t\tmembers[i]!.setStreakPresentation(true, 0);\n\t}\n\tmembers[members.length - 1]!.setStreakPresentation(false, members.length - 1);\n}\n\n/** The run starting at `index`, or null when nothing foldable starts there. */\nfunction collectRunFrom(\n\tchildren: readonly Component[],\n\tindex: number,\n): { members: ToolExecutionComponent[]; end: number } | null {\n\tconst child = children[index];\n\tif (!(child instanceof ToolExecutionComponent) || !child.isQuietFoldable()) return null;\n\tconst members: ToolExecutionComponent[] = [child];\n\tlet end = index + 1;\n\tlet cursor = index + 1;\n\twhile (cursor < children.length) {\n\t\tconst next = children[cursor];\n\t\tif (next instanceof ToolExecutionComponent && next.isQuietFoldable()) {\n\t\t\tmembers.push(next);\n\t\t\tcursor++;\n\t\t\tend = cursor;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!(next instanceof ToolExecutionComponent) && rendersNothing(next)) {\n\t\t\tcursor++;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\treturn { members, end };\n}\n\n/** The run at the very end of the document, stepping back over invisible siblings. */\nfunction collectTrailingRun(children: readonly Component[]): ToolExecutionComponent[] {\n\tconst members: ToolExecutionComponent[] = [];\n\tfor (let i = children.length - 1; i >= 0; i--) {\n\t\tconst child = children[i];\n\t\tif (child instanceof ToolExecutionComponent && child.isQuietFoldable()) {\n\t\t\tmembers.unshift(child);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!(child instanceof ToolExecutionComponent) && rendersNothing(child!)) continue;\n\t\tbreak;\n\t}\n\treturn members;\n}\n"]}
|
|
@@ -91,6 +91,19 @@ export declare class InteractiveMode {
|
|
|
91
91
|
private streamingMessage;
|
|
92
92
|
private pendingTools;
|
|
93
93
|
private toolOutputExpanded;
|
|
94
|
+
/**
|
|
95
|
+
* Which tool call the cursor is on, as an index into the transcript's
|
|
96
|
+
* focusable entries, or null when the cursor is parked.
|
|
97
|
+
*
|
|
98
|
+
* Stored as an index rather than a component reference because the
|
|
99
|
+
* transcript keeps growing underneath it; re-resolving against the current
|
|
100
|
+
* children each time is what keeps the cursor pointing at a live entry.
|
|
101
|
+
*/
|
|
102
|
+
private focusedToolIndex;
|
|
103
|
+
/** The startup wordmark, held so it can be taken back out once it is done. */
|
|
104
|
+
private splash?;
|
|
105
|
+
/** Indices the user expanded one at a time, so the global toggle does not undo them silently. */
|
|
106
|
+
private readonly expandedToolIds;
|
|
94
107
|
private hideThinkingBlock;
|
|
95
108
|
private outputPad;
|
|
96
109
|
private readonly mermaidMarkdownTransformer;
|
|
@@ -353,6 +366,28 @@ export declare class InteractiveMode {
|
|
|
353
366
|
private updateEditorBorderColor;
|
|
354
367
|
private cycleThinkingLevel;
|
|
355
368
|
private cycleModel;
|
|
369
|
+
/** The transcript's tool calls, in the order they were appended. */
|
|
370
|
+
private focusableTools;
|
|
371
|
+
/**
|
|
372
|
+
* Move the cursor across tool calls.
|
|
373
|
+
*
|
|
374
|
+
* Entering from nowhere lands on the most recent call rather than the first,
|
|
375
|
+
* because the thing a reader wants to open is almost always what just
|
|
376
|
+
* happened, and the transcript can be thousands of entries long.
|
|
377
|
+
*/
|
|
378
|
+
private focusTool;
|
|
379
|
+
/**
|
|
380
|
+
* Take the startup wordmark out of the document once there is a conversation.
|
|
381
|
+
*
|
|
382
|
+
* It was added at the top and never removed, so it stayed part of the
|
|
383
|
+
* rendered document forever — re-rendered on every frame, above a transcript
|
|
384
|
+
* that grows past the viewport. In VS Code's terminal that left the banner
|
|
385
|
+
* painted across the top of the screen with live output running underneath
|
|
386
|
+
* it. It has done its job by the time the first prompt is sent.
|
|
387
|
+
*/
|
|
388
|
+
private retireSplash;
|
|
389
|
+
/** Drop the cursor; ctrl+o goes back to meaning "all tool output". */
|
|
390
|
+
private clearToolFocus;
|
|
356
391
|
private toggleToolOutputExpansion;
|
|
357
392
|
private setToolsExpanded;
|
|
358
393
|
/** Update rendered assistant messages without rebuilding live tool components. */
|