@linxiraos/pi-tui 1.4.7 → 1.4.9
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 +28 -109
- package/README.md +7 -1
- package/dist/types/app-keybindings.d.ts +5 -0
- package/dist/types/charts/table-data.d.ts +4 -2
- package/dist/types/chat/bash-execution.d.ts +4 -1
- package/dist/types/chat/eval-execution.d.ts +2 -0
- package/dist/types/chat/execution-shared.d.ts +14 -8
- package/dist/types/chat/figure-markdown.d.ts +2 -0
- package/dist/types/chat/svg-figure.d.ts +5 -0
- package/dist/types/chat/table-chart.d.ts +2 -0
- package/dist/types/chat/transcript-render-helpers.d.ts +11 -3
- package/dist/types/chrome/dynamic-border.d.ts +6 -0
- package/dist/types/chrome/transcript-status.d.ts +2 -2
- package/dist/types/components/editor.d.ts +15 -6
- package/dist/types/components/image.d.ts +6 -0
- package/dist/types/components/loader.d.ts +2 -0
- package/dist/types/keybinding-matchers.d.ts +7 -0
- package/dist/types/native/describe.d.ts +4 -2
- package/dist/types/native/node.d.ts +2 -3
- package/dist/types/native/overlay.d.ts +42 -2
- package/dist/types/native/state.d.ts +4 -0
- package/dist/types/overlays/btw-history-panel.d.ts +15 -0
- package/dist/types/overlays/btw-history.d.ts +24 -0
- package/dist/types/overlays/btw-inject.d.ts +22 -0
- package/dist/types/overlays/btw-panel.d.ts +7 -0
- package/dist/types/overlays/hook-editor.d.ts +2 -0
- package/dist/types/overlays/jobs-panel.d.ts +4 -0
- package/dist/types/overlays/model-browser.d.ts +1 -1
- package/dist/types/overlays/session-selector.d.ts +11 -2
- package/dist/types/prompt/composer.d.ts +13 -5
- package/dist/types/render/render-utils.d.ts +23 -1
- package/dist/types/status-line/startup.d.ts +0 -15
- package/dist/types/terminal-capabilities.d.ts +1 -1
- package/dist/types/theme/symbols.d.ts +3 -1
- package/dist/types/theme/theme-class.d.ts +1 -0
- package/dist/types/theme/theme.d.ts +1 -1
- package/dist/types/theme/tui-adapters.d.ts +2 -0
- package/dist/types/thinking.d.ts +8 -6
- package/dist/types/tools/ast-grep.d.ts +2 -0
- package/dist/types/tools/eval.d.ts +2 -0
- package/dist/types/tools/find.d.ts +1 -1
- package/dist/types/tools/grouped-file-output.d.ts +100 -19
- package/dist/types/tools/hashline-format.d.ts +5 -0
- package/dist/types/tools/native-view.d.ts +2 -0
- package/dist/types/tools/output-meta.d.ts +27 -0
- package/dist/types/tools/read.d.ts +14 -4
- package/dist/types/tools/task.d.ts +4 -3
- package/dist/types/tools/wait.d.ts +2 -0
- package/dist/types/tui.d.ts +12 -0
- package/dist/types/utils.d.ts +4 -0
- package/package.json +9 -9
- package/src/app-keybindings.d.ts +5 -0
- package/src/app-keybindings.ts +5 -0
- package/src/apps/git/git-tui.ts +10 -17
- package/src/apps/git/sidebar.ts +21 -35
- package/src/apps/ps-top.ts +4 -12
- package/src/charts/chart-plan.ts +0 -29
- package/src/charts/table-data.d.ts +4 -2
- package/src/charts/table-data.ts +55 -6
- package/src/chat/bash-execution.d.ts +4 -1
- package/src/chat/bash-execution.ts +20 -9
- package/src/chat/chat-transcript-builder.ts +5 -2
- package/src/chat/eval-execution.d.ts +2 -0
- package/src/chat/eval-execution.ts +14 -7
- package/src/chat/execution-shared.d.ts +14 -8
- package/src/chat/execution-shared.ts +39 -18
- package/src/chat/figure-markdown.d.ts +2 -0
- package/src/chat/figure-markdown.ts +6 -4
- package/src/chat/read-tool-group.ts +56 -36
- package/src/chat/svg-figure.d.ts +5 -0
- package/src/chat/svg-figure.ts +55 -16
- package/src/chat/table-chart.d.ts +2 -0
- package/src/chat/table-chart.ts +19 -2
- package/src/chat/transcript-render-helpers.d.ts +11 -3
- package/src/chat/transcript-render-helpers.ts +70 -22
- package/src/chrome/dynamic-border.d.ts +6 -0
- package/src/chrome/dynamic-border.ts +28 -2
- package/src/chrome/transcript-status.d.ts +2 -2
- package/src/chrome/transcript-status.ts +5 -3
- package/src/components/editor.d.ts +15 -6
- package/src/components/editor.ts +123 -24
- package/src/components/image.d.ts +6 -0
- package/src/components/image.ts +13 -0
- package/src/components/key-value-list.ts +9 -9
- package/src/components/loader.d.ts +2 -0
- package/src/components/loader.ts +7 -0
- package/src/components/section.ts +1 -9
- package/src/components/table.ts +1 -9
- package/src/keybinding-matchers.d.ts +7 -0
- package/src/keybinding-matchers.ts +13 -0
- package/src/native/backend.ts +7 -3
- package/src/native/describe.d.ts +4 -2
- package/src/native/describe.ts +9 -4
- package/src/native/node.d.ts +2 -3
- package/src/native/node.ts +2 -3
- package/src/native/overlay.d.ts +42 -2
- package/src/native/overlay.ts +124 -16
- package/src/native/state.d.ts +4 -0
- package/src/native/state.ts +25 -5
- package/src/overlays/btw-history-panel.ts +106 -14
- package/src/overlays/btw-history.ts +65 -0
- package/src/overlays/btw-inject.ts +91 -0
- package/src/overlays/btw-panel.ts +53 -12
- package/src/overlays/extensions/extension-dashboard.ts +7 -8
- package/src/overlays/hook-editor.ts +6 -0
- package/src/overlays/jobs-panel.ts +82 -22
- package/src/overlays/login-dialog.ts +8 -26
- package/src/overlays/model-browser.ts +69 -10
- package/src/overlays/session-selector.ts +25 -5
- package/src/overlays/settings-defs.ts +2 -2
- package/src/overlays/tree-selector.ts +83 -27
- package/src/overlays/usage-dashboard.ts +4 -6
- package/src/prompt/composer.ts +17 -5
- package/src/render/code-cell.ts +1 -1
- package/src/render/file-list.ts +4 -7
- package/src/render/render-utils.d.ts +23 -1
- package/src/render/render-utils.ts +38 -6
- package/src/setup/scenes/glyph.ts +1 -1
- package/src/status-line/startup.ts +36 -70
- package/src/terminal-capabilities.d.ts +1 -1
- package/src/terminal-capabilities.ts +5 -0
- package/src/theme/symbols.d.ts +3 -1
- package/src/theme/symbols.ts +16 -9
- package/src/theme/theme-class.d.ts +1 -0
- package/src/theme/theme-class.ts +15 -3
- package/src/theme/theme.d.ts +1 -1
- package/src/theme/theme.ts +1 -0
- package/src/theme/tui-adapters.d.ts +2 -0
- package/src/theme/tui-adapters.ts +8 -3
- package/src/thinking.d.ts +8 -6
- package/src/thinking.ts +17 -11
- package/src/tmux.ts +1 -0
- package/src/tools/agent-tree.ts +13 -11
- package/src/tools/ask.ts +24 -37
- package/src/tools/ast-edit.ts +48 -93
- package/src/tools/ast-grep.d.ts +2 -0
- package/src/tools/ast-grep.ts +31 -67
- package/src/tools/bash.ts +7 -0
- package/src/tools/default-renderer.ts +1 -1
- package/src/tools/edit.ts +50 -43
- package/src/tools/eval.d.ts +2 -0
- package/src/tools/eval.ts +2 -0
- package/src/tools/fetch.ts +2 -1
- package/src/tools/find.d.ts +1 -1
- package/src/tools/find.ts +13 -5
- package/src/tools/github.ts +14 -46
- package/src/tools/glob.ts +2 -1
- package/src/tools/grep.ts +47 -277
- package/src/tools/grouped-file-output.d.ts +100 -19
- package/src/tools/grouped-file-output.ts +414 -103
- package/src/tools/hashline-format.d.ts +5 -0
- package/src/tools/hashline-format.ts +5 -0
- package/src/tools/json-tree.ts +1 -5
- package/src/tools/lsp.ts +210 -32
- package/src/tools/native-view.d.ts +2 -0
- package/src/tools/native-view.ts +11 -5
- package/src/tools/output-meta.d.ts +27 -0
- package/src/tools/output-meta.ts +68 -4
- package/src/tools/proc-render.ts +3 -3
- package/src/tools/read.d.ts +14 -4
- package/src/tools/read.ts +20 -5
- package/src/tools/task.d.ts +4 -3
- package/src/tools/task.ts +41 -81
- package/src/tools/vibe.ts +4 -4
- package/src/tools/wait.d.ts +2 -0
- package/src/tools/wait.ts +8 -5
- package/src/tools/write.ts +17 -27
- package/src/tools/yield.ts +1 -1
- package/src/tui.d.ts +12 -0
- package/src/tui.ts +91 -9
- package/src/utils.d.ts +4 -0
- package/src/utils.ts +10 -0
package/src/thinking.d.ts
CHANGED
|
@@ -137,12 +137,12 @@ export type TaskEffort = (typeof TASK_EFFORTS)[number];
|
|
|
137
137
|
export declare function resolveTaskEffortLevel(model: Model | undefined, effort: TaskEffort, maxEffort?: Effort): Effort | undefined;
|
|
138
138
|
/**
|
|
139
139
|
* Clamps a concrete thinking selector to a per-session effort ceiling (e.g. a
|
|
140
|
-
* task spawn's `task.maxEffort
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
140
|
+
* task spawn's `task.maxEffort`). Unset/`inherit`/`off` retain their existing
|
|
141
|
+
* meaning, as do levels already at or below the ceiling. Levels above it snap
|
|
142
|
+
* to the highest model-supported effort at or below the ceiling. A model whose
|
|
143
|
+
* floor exceeds the ceiling has nothing valid to snap to; the requested level
|
|
144
|
+
* is returned unchanged and the caller must reject or skip such models (see
|
|
145
|
+
* {@link modelSupportsEffortCeiling}).
|
|
146
146
|
*/
|
|
147
147
|
export declare function clampThinkingLevelToCeiling(model: Model | undefined, level: Effort | undefined, ceiling: Effort | undefined): Effort | undefined;
|
|
148
148
|
export declare function clampThinkingLevelToCeiling(model: Model | undefined, level: ThinkingLevel | undefined, ceiling: Effort | undefined): ThinkingLevel | undefined;
|
|
@@ -153,6 +153,8 @@ export declare function clampThinkingLevelToCeiling(model: Model | undefined, le
|
|
|
153
153
|
* skip models whose floor would force the session above the ceiling.
|
|
154
154
|
*/
|
|
155
155
|
export declare function modelSupportsEffortCeiling(model: Model, ceiling: Effort): boolean;
|
|
156
|
+
/** Throws when `model` has no supported effort at or below `task.maxEffort`, so a capped spawn fails instead of running at its floor. */
|
|
157
|
+
export declare function assertModelSupportsEffortCeiling(model: Model, maxEffort: Effort): void;
|
|
156
158
|
/**
|
|
157
159
|
* The provisional concrete level shown while `auto` is configured but before a
|
|
158
160
|
* turn has been classified, and the fallback when classification fails. Prefers
|
package/src/thinking.ts
CHANGED
|
@@ -312,23 +312,21 @@ export function resolveTaskEffortLevel(
|
|
|
312
312
|
break;
|
|
313
313
|
}
|
|
314
314
|
if (maxEffort === undefined) return resolved;
|
|
315
|
+
if (model) assertModelSupportsEffortCeiling(model, maxEffort);
|
|
315
316
|
const maxIndex = THINKING_EFFORTS.indexOf(maxEffort);
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
const modelName = model ? `${model.provider}/${model.id}` : "Selected model";
|
|
319
|
-
throw new RangeError(`${modelName} has no supported thinking effort at or below task.maxEffort=${maxEffort}`);
|
|
320
|
-
}
|
|
317
|
+
// Without a model the full canonical range always holds `maxEffort` itself.
|
|
318
|
+
const ceiling = supported.findLast(candidate => THINKING_EFFORTS.indexOf(candidate) <= maxIndex) ?? maxEffort;
|
|
321
319
|
return THINKING_EFFORTS.indexOf(resolved) > THINKING_EFFORTS.indexOf(ceiling) ? ceiling : resolved;
|
|
322
320
|
}
|
|
323
321
|
|
|
324
322
|
/**
|
|
325
323
|
* Clamps a concrete thinking selector to a per-session effort ceiling (e.g. a
|
|
326
|
-
* task spawn's `task.maxEffort
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
324
|
+
* task spawn's `task.maxEffort`). Unset/`inherit`/`off` retain their existing
|
|
325
|
+
* meaning, as do levels already at or below the ceiling. Levels above it snap
|
|
326
|
+
* to the highest model-supported effort at or below the ceiling. A model whose
|
|
327
|
+
* floor exceeds the ceiling has nothing valid to snap to; the requested level
|
|
328
|
+
* is returned unchanged and the caller must reject or skip such models (see
|
|
329
|
+
* {@link modelSupportsEffortCeiling}).
|
|
332
330
|
*/
|
|
333
331
|
export function clampThinkingLevelToCeiling(
|
|
334
332
|
model: Model | undefined,
|
|
@@ -367,6 +365,14 @@ export function modelSupportsEffortCeiling(model: Model, ceiling: Effort): boole
|
|
|
367
365
|
return supported.some(candidate => THINKING_EFFORTS.indexOf(candidate) <= maxIndex);
|
|
368
366
|
}
|
|
369
367
|
|
|
368
|
+
/** Throws when `model` has no supported effort at or below `task.maxEffort`, so a capped spawn fails instead of running at its floor. */
|
|
369
|
+
export function assertModelSupportsEffortCeiling(model: Model, maxEffort: Effort): void {
|
|
370
|
+
if (modelSupportsEffortCeiling(model, maxEffort)) return;
|
|
371
|
+
throw new RangeError(
|
|
372
|
+
`${model.provider}/${model.id} has no supported thinking effort at or below task.maxEffort=${maxEffort}`,
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
|
|
370
376
|
/**
|
|
371
377
|
* The provisional concrete level shown while `auto` is configured but before a
|
|
372
378
|
* turn has been classified, and the fallback when classification fails. Prefers
|
package/src/tmux.ts
CHANGED
|
@@ -21,6 +21,7 @@ const CLIENT_TERMINAL_TIMEOUT_MS = 2_000;
|
|
|
21
21
|
const CLIENT_TERMNAME_PROGRAMS: ReadonlyArray<readonly [RegExp, string]> = [
|
|
22
22
|
[/^xterm-kitty$/u, "kitty"],
|
|
23
23
|
[/^xterm-ghostty$/u, "ghostty"],
|
|
24
|
+
[/^xterm-rex$/u, "rex"],
|
|
24
25
|
[/^wezterm$/u, "wezterm"],
|
|
25
26
|
];
|
|
26
27
|
let cachedClientTerminalNames: readonly string[] | undefined;
|
package/src/tools/agent-tree.ts
CHANGED
|
@@ -74,20 +74,22 @@ export function renderAgentTreeRow(
|
|
|
74
74
|
const task = options.presentation === "task";
|
|
75
75
|
const live = status === "pending" || status === "running";
|
|
76
76
|
const failed = status === "failed" || status === "aborted";
|
|
77
|
-
const iconColor = status === "completed" ? "success" : failed ? "error" : "accent";
|
|
78
77
|
const nameColor = task && live && options.frozen ? "dim" : task && status === "completed" ? "text" : "accent";
|
|
79
|
-
const iconStatus = status === "failed" ? "error" : status === "completed" ? "
|
|
78
|
+
const iconStatus = status === "failed" ? "error" : status === "completed" ? "success" : status;
|
|
79
|
+
// Task rows draw a static glyph, so their bytes hold across spinner frames; eval rows animate.
|
|
80
|
+
const spinnerFrame = !task && status === "running" ? options.spinnerFrame : undefined;
|
|
81
|
+
// formatStatusIcon colors every glyph except a raw spinner frame, which eval rows paint accent.
|
|
82
|
+
// A frozen snapshot of a live Task row dims its glyph with its name, so it stops reading as in flight.
|
|
80
83
|
const icon =
|
|
81
|
-
task &&
|
|
82
|
-
? theme.styledSymbol("
|
|
83
|
-
:
|
|
84
|
-
? theme.
|
|
85
|
-
:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
);
|
|
84
|
+
!task && status === "completed"
|
|
85
|
+
? theme.styledSymbol("tool.eval", "accent")
|
|
86
|
+
: task && live && options.frozen
|
|
87
|
+
? theme.fg("dim", status === "running" ? theme.status.running : theme.status.pending)
|
|
88
|
+
: spinnerFrame === undefined
|
|
89
|
+
? formatStatusIcon(iconStatus, theme)
|
|
90
|
+
: theme.fg("accent", formatStatusIcon(iconStatus, theme, spinnerFrame));
|
|
89
91
|
const lead = `${options.prefix}${options.prefix || !task ? " " : ""}${icon} `;
|
|
90
|
-
const statusBadge = options.statusBadge ?? (failed ? ` ${formatBadge(status,
|
|
92
|
+
const statusBadge = options.statusBadge ?? (failed ? ` ${formatBadge(status, "error", theme)}` : "");
|
|
91
93
|
const id = Number.isFinite(width)
|
|
92
94
|
? truncateToWidth(options.id, Math.max(0, width - visibleWidth(lead) - visibleWidth(statusBadge)))
|
|
93
95
|
: options.id;
|
package/src/tools/ask.ts
CHANGED
|
@@ -25,8 +25,13 @@ import { outputBlockContentWidth, renderStatusLine } from "../render";
|
|
|
25
25
|
import { framedToolCard } from "../render/tool-card";
|
|
26
26
|
import { wrapPrefixedLine } from "../render/hanging-wrap";
|
|
27
27
|
|
|
28
|
-
import {
|
|
29
|
-
|
|
28
|
+
import {
|
|
29
|
+
formatErrorMessage,
|
|
30
|
+
formatMeta,
|
|
31
|
+
formatStatusIcon,
|
|
32
|
+
formatTitle,
|
|
33
|
+
sanitizeCarriageReturns,
|
|
34
|
+
} from "../render/render-utils";
|
|
30
35
|
|
|
31
36
|
/** Result for a single question */
|
|
32
37
|
export interface QuestionResult {
|
|
@@ -177,10 +182,11 @@ function normalizeRenderQuestions(raw: unknown): NonNullable<AskRenderArgs["ques
|
|
|
177
182
|
/** Render a custom free-text answer as a status line plus indented continuation rows. */
|
|
178
183
|
function renderCustomInputLines(uiTheme: Theme, customInput: string): string[] {
|
|
179
184
|
const lines = customInput.split("\n");
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
185
|
+
const icon = formatStatusIcon("success", uiTheme);
|
|
186
|
+
// Continuation rows line up under the answer text, past the glyph's own width.
|
|
187
|
+
const indent = " ".repeat(visibleWidth(icon) + 2);
|
|
188
|
+
const out: string[] = [` ${icon} ${uiTheme.fg("toolOutput", lines[0] ?? "")}`];
|
|
189
|
+
for (let i = 1; i < lines.length; i++) out.push(`${indent}${uiTheme.fg("toolOutput", lines[i])}`);
|
|
184
190
|
return out;
|
|
185
191
|
}
|
|
186
192
|
|
|
@@ -283,9 +289,7 @@ function renderAnswerOptionLines(
|
|
|
283
289
|
|
|
284
290
|
// Nothing was chosen (and no custom answer) → a lone cancelled marker.
|
|
285
291
|
if (selected.size === 0 && customInput === undefined && note === undefined) {
|
|
286
|
-
return [
|
|
287
|
-
` ${uiTheme.styledSymbol("status.warning", "warning")} ${uiTheme.fg("warning", tuiText("askCancelledLabel", "Cancelled"))}`,
|
|
288
|
-
];
|
|
292
|
+
return [` ${formatStatusIcon("warning", uiTheme)} ${uiTheme.fg("warning", "Cancelled")}`];
|
|
289
293
|
}
|
|
290
294
|
|
|
291
295
|
const out: string[] = [];
|
|
@@ -457,7 +461,7 @@ export const askToolRenderer = {
|
|
|
457
461
|
},
|
|
458
462
|
mergeCallAndResult: true,
|
|
459
463
|
renderCall(args: AskRenderArgs, _options: RenderResultOptions, uiTheme: Theme): Component {
|
|
460
|
-
const label = formatTitle(
|
|
464
|
+
const label = formatTitle("Ask", uiTheme);
|
|
461
465
|
const mdTheme = getMarkdownTheme();
|
|
462
466
|
const accentStyle = { color: (t: string) => uiTheme.fg("accent", t) };
|
|
463
467
|
const md = (text: string, width: number) =>
|
|
@@ -468,16 +472,11 @@ export const askToolRenderer = {
|
|
|
468
472
|
// throw here takes down the whole TUI render loop — normalize first.
|
|
469
473
|
const questions = normalizeRenderQuestions(args.questions);
|
|
470
474
|
if (questions && questions.length > 0) {
|
|
471
|
-
const header = `${label} ${uiTheme.fg(
|
|
472
|
-
"muted",
|
|
473
|
-
questions.length === 1
|
|
474
|
-
? tuiText("askQuestionOne", "1 question")
|
|
475
|
-
: tuiTextFmt("askQuestionManyFmt", "%d questions", questions.length),
|
|
476
|
-
)}`;
|
|
475
|
+
const header = `${label} ${uiTheme.fg("muted", `${questions.length} questions`)}`;
|
|
477
476
|
return framedToolCard(uiTheme, ({ width, contentWidth }) => {
|
|
478
477
|
const sections = questions.map(q => {
|
|
479
478
|
const meta: string[] = [];
|
|
480
|
-
if (q.multi) meta.push(
|
|
479
|
+
if (q.multi) meta.push("multi");
|
|
481
480
|
if (q.options?.length) meta.push(`options:${q.options.length}`);
|
|
482
481
|
const metaStr = meta.length > 0 ? uiTheme.fg("dim", ` · ${meta.join(" · ")}`) : "";
|
|
483
482
|
// md() returns a shared cached array (module-level Markdown LRU) — copy before appending.
|
|
@@ -493,7 +492,7 @@ export const askToolRenderer = {
|
|
|
493
492
|
|
|
494
493
|
// Single question
|
|
495
494
|
if (typeof args.question !== "string" || !args.question) {
|
|
496
|
-
const errorLine = formatErrorMessage(
|
|
495
|
+
const errorLine = formatErrorMessage("No question provided", uiTheme);
|
|
497
496
|
return framedToolCard(uiTheme, () => ({
|
|
498
497
|
header: errorLine,
|
|
499
498
|
sections: [],
|
|
@@ -538,7 +537,7 @@ export const askToolRenderer = {
|
|
|
538
537
|
if (!rawDetails) {
|
|
539
538
|
const txt = result.content[0];
|
|
540
539
|
const fallback = txt?.type === "text" && txt.text ? sanitizeCarriageReturns(txt.text) : "";
|
|
541
|
-
const header = renderStatusLine({ icon: "warning", title:
|
|
540
|
+
const header = renderStatusLine({ icon: "warning", title: "Ask" }, uiTheme);
|
|
542
541
|
const body = fallback ? `\n${uiTheme.fg("dim", fallback)}` : "";
|
|
543
542
|
return new Text(`${header}${body}`, 0, 0);
|
|
544
543
|
}
|
|
@@ -546,14 +545,7 @@ export const askToolRenderer = {
|
|
|
546
545
|
|
|
547
546
|
// Chat redirect: user chose "Chat about this" instead of answering.
|
|
548
547
|
if (details.chatRedirect) {
|
|
549
|
-
const header = renderStatusLine(
|
|
550
|
-
{
|
|
551
|
-
icon: "info",
|
|
552
|
-
title: tuiText("askTitle", "Ask"),
|
|
553
|
-
meta: [tuiText("askChatRedirectMeta", "chat redirect")],
|
|
554
|
-
},
|
|
555
|
-
uiTheme,
|
|
556
|
-
);
|
|
548
|
+
const header = renderStatusLine({ icon: "info", title: "Ask", meta: ["chat redirect"] }, uiTheme);
|
|
557
549
|
const questions = details.questions ?? [];
|
|
558
550
|
return framedToolCard(uiTheme, ({ width }) => ({
|
|
559
551
|
header,
|
|
@@ -575,11 +567,8 @@ export const askToolRenderer = {
|
|
|
575
567
|
const header = renderStatusLine(
|
|
576
568
|
{
|
|
577
569
|
icon: hasAnySelection ? "success" : "warning",
|
|
578
|
-
title:
|
|
579
|
-
meta:
|
|
580
|
-
results.length === 1
|
|
581
|
-
? [tuiText("askQuestionOne", "1 question")]
|
|
582
|
-
: [tuiTextFmt("askQuestionManyFmt", "%d questions", results.length)],
|
|
570
|
+
title: "Ask",
|
|
571
|
+
meta: [`${results.length} questions`],
|
|
583
572
|
},
|
|
584
573
|
uiTheme,
|
|
585
574
|
);
|
|
@@ -629,8 +618,8 @@ export const askToolRenderer = {
|
|
|
629
618
|
(details.selectedOptions && details.selectedOptions.length > 0);
|
|
630
619
|
const header = renderStatusLine(
|
|
631
620
|
hasSelection
|
|
632
|
-
? { iconOverride: uiTheme.styledSymbol("tool.ask", "accent"), title:
|
|
633
|
-
: { icon: "warning", title:
|
|
621
|
+
? { iconOverride: uiTheme.styledSymbol("tool.ask", "accent"), title: "Ask" }
|
|
622
|
+
: { icon: "warning", title: "Ask" },
|
|
634
623
|
uiTheme,
|
|
635
624
|
);
|
|
636
625
|
const dOptions = details.options;
|
|
@@ -658,9 +647,7 @@ export const askToolRenderer = {
|
|
|
658
647
|
];
|
|
659
648
|
if (dTimedOut) {
|
|
660
649
|
// Distinguish auto-selection from a real user choice in the transcript.
|
|
661
|
-
bodyLines.push(
|
|
662
|
-
uiTheme.fg("dim", tuiText("askAutoSelected", "auto-selected after timeout — not a user choice")),
|
|
663
|
-
);
|
|
650
|
+
bodyLines.push(uiTheme.fg("dim", "auto-selected after timeout — not a user choice"));
|
|
664
651
|
}
|
|
665
652
|
return {
|
|
666
653
|
header,
|
package/src/tools/ast-edit.ts
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import { isRecord, sanitizeText } from "@linxiraos/pi-utils";
|
|
2
1
|
import type { Component } from "../tui";
|
|
3
2
|
import { Text } from "../components/text";
|
|
4
|
-
import { replaceTabs } from "../utils";
|
|
5
3
|
import type { Theme } from "../theme/theme";
|
|
6
|
-
import { Ellipsis,
|
|
4
|
+
import { Ellipsis, renderStatusLine, truncateToWidth } from "../render";
|
|
7
5
|
import { framedToolCard } from "../render/tool-card";
|
|
8
6
|
import {
|
|
9
7
|
appendParseErrorsBulletList,
|
|
10
8
|
formatCount,
|
|
11
9
|
formatErrorDetail,
|
|
12
|
-
formatMoreItems,
|
|
13
10
|
formatParseErrorsCountLabel,
|
|
14
11
|
PREVIEW_LIMITS,
|
|
15
12
|
} from "../render/render-utils";
|
|
16
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
classifyGroupedLines,
|
|
15
|
+
createGroupedRowStyler,
|
|
16
|
+
fitGroupsToBudget,
|
|
17
|
+
groupedLinkTargets,
|
|
18
|
+
groupLineIndicesByBlank,
|
|
19
|
+
groupsByFile,
|
|
20
|
+
walkGroupedOutput,
|
|
21
|
+
} from "./grouped-file-output";
|
|
17
22
|
import type { OutputMeta } from "./output-meta";
|
|
18
23
|
import type {
|
|
19
24
|
NativeToolHead,
|
|
@@ -59,34 +64,24 @@ interface AstEditRenderArgs {
|
|
|
59
64
|
const COLLAPSED_CHANGE_LIMIT = PREVIEW_LIMITS.COLLAPSED_LINES * 2;
|
|
60
65
|
|
|
61
66
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* noise. Collapsed mode always shows at least the first group, then fills up
|
|
66
|
-
* to `budget` lines before summarizing the rest as `… N more changes`.
|
|
67
|
+
* Frame body lines for per-file change groups, styled on demand: files apart by
|
|
68
|
+
* a blank line and without tree guides (the frame border is the container), fit
|
|
69
|
+
* to `budget` with the rest summarized as `… N more files`.
|
|
67
70
|
*/
|
|
68
71
|
function buildChangeBody(
|
|
69
72
|
groups: readonly (readonly number[])[],
|
|
70
73
|
styleLine: (index: number) => string,
|
|
71
|
-
|
|
74
|
+
isFileRow: (index: number) => boolean,
|
|
72
75
|
budget: number,
|
|
73
76
|
theme: Theme,
|
|
74
77
|
): string[] {
|
|
78
|
+
const { shown, summary } = fitGroupsToBudget(groups, budget, { isUnit: isFileRow, unit: "file", gap: 1 });
|
|
75
79
|
const lines: string[] = [];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const group = groups[i]!;
|
|
79
|
-
const separator = shown > 0 ? 1 : 0;
|
|
80
|
-
const remainingAfter = groups.length - (i + 1);
|
|
81
|
-
const reserved = !expanded && remainingAfter > 0 ? 1 : 0;
|
|
82
|
-
// Always emit the first group; budget only gates subsequent ones.
|
|
83
|
-
if (!expanded && shown > 0 && lines.length + separator + group.length + reserved > budget) break;
|
|
84
|
-
if (separator) lines.push("");
|
|
80
|
+
for (const group of shown) {
|
|
81
|
+
if (lines.length > 0) lines.push("");
|
|
85
82
|
for (const index of group) lines.push(styleLine(index));
|
|
86
|
-
shown++;
|
|
87
83
|
}
|
|
88
|
-
|
|
89
|
-
if (!expanded && remaining > 0) lines.push(theme.fg("muted", formatMoreItems(remaining, "change")));
|
|
84
|
+
if (summary) lines.push(theme.fg("muted", summary));
|
|
90
85
|
return lines;
|
|
91
86
|
}
|
|
92
87
|
|
|
@@ -98,9 +93,7 @@ function patternPreview(pat: string | undefined): string | undefined {
|
|
|
98
93
|
return collapsed || undefined;
|
|
99
94
|
}
|
|
100
95
|
|
|
101
|
-
const AST_EDIT_HEADER_RE = /^(#+)\s+(.*)$/;
|
|
102
96
|
const AST_EDIT_CHANGE_LINE_RE = /^([+\- ])\s*(\d+)(?:│|[:|])(.*)$/;
|
|
103
|
-
const AST_EDIT_HEADER_SUFFIX_RE = /\s+\([^)]*\)\s*$/;
|
|
104
97
|
|
|
105
98
|
/** One file's proposed rewrite: its unified diff text and change counts. */
|
|
106
99
|
interface AstEditFileDiff {
|
|
@@ -117,29 +110,15 @@ interface AstEditFileDiff {
|
|
|
117
110
|
*/
|
|
118
111
|
function parseAstEditChanges(lines: readonly string[]): AstEditFileDiff[] {
|
|
119
112
|
const files: AstEditFileDiff[] = [];
|
|
120
|
-
const dirs: string[] = [];
|
|
121
113
|
let file: AstEditFileDiff | undefined;
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
for (const line of lines) {
|
|
127
|
-
const header = AST_EDIT_HEADER_RE.exec(line);
|
|
128
|
-
if (header) {
|
|
129
|
-
flush();
|
|
130
|
-
const depth = header[1]!.length;
|
|
131
|
-
const rest = header[2]!.trimEnd().replace(AST_EDIT_HEADER_SUFFIX_RE, "");
|
|
132
|
-
dirs.length = depth - 1;
|
|
133
|
-
if (rest.endsWith("/")) {
|
|
134
|
-
dirs[depth - 1] = rest.slice(0, -1);
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
const prefix = dirs.filter(Boolean).join("/");
|
|
138
|
-
file = { path: prefix ? `${prefix}/${rest}` : rest, lines: [], added: 0, removed: 0 };
|
|
114
|
+
for (const event of walkGroupedOutput(lines)) {
|
|
115
|
+
if (event.kind !== "line") {
|
|
116
|
+
if (file && file.lines.length > 0) files.push(file);
|
|
117
|
+
file = event.kind === "file" ? { path: event.path, lines: [], added: 0, removed: 0 } : undefined;
|
|
139
118
|
continue;
|
|
140
119
|
}
|
|
141
|
-
if (!file
|
|
142
|
-
const change = AST_EDIT_CHANGE_LINE_RE.exec(
|
|
120
|
+
if (!file) continue;
|
|
121
|
+
const change = AST_EDIT_CHANGE_LINE_RE.exec(event.text);
|
|
143
122
|
if (!change) continue;
|
|
144
123
|
const lineNumber = Number.parseInt(change[2]!, 10);
|
|
145
124
|
if (file.lastOld === undefined || lineNumber > file.lastOld + 1 || lineNumber < file.lastOld) {
|
|
@@ -150,7 +129,7 @@ function parseAstEditChanges(lines: readonly string[]): AstEditFileDiff[] {
|
|
|
150
129
|
else if (change[1] === "-") file.removed++;
|
|
151
130
|
file.lines.push(`${change[1]}${change[3]}`);
|
|
152
131
|
}
|
|
153
|
-
|
|
132
|
+
if (file && file.lines.length > 0) files.push(file);
|
|
154
133
|
return files;
|
|
155
134
|
}
|
|
156
135
|
|
|
@@ -248,53 +227,23 @@ export const astEditToolRenderer = {
|
|
|
248
227
|
|
|
249
228
|
const textContent = result.details?.displayContent ?? result.content?.find(c => c.type === "text")?.text ?? "";
|
|
250
229
|
const allLines = textContent.split("\n");
|
|
251
|
-
//
|
|
252
|
-
// reconstruct across the blank-line groups the tree list collapses by.
|
|
230
|
+
// Classify the whole output so nested directory headers resolve across blank-line groups.
|
|
253
231
|
const contexts = classifyGroupedLines(allLines, details?.cwd ?? details?.searchPath, details?.searchPath);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
const styleLine = (index: number): string => {
|
|
270
|
-
const cached = styledLines[index];
|
|
271
|
-
if (cached !== undefined) return cached;
|
|
272
|
-
const ctx = contexts[index]!;
|
|
273
|
-
// Swap the inner code-frame gutter `│` for a space so it does not nest a
|
|
274
|
-
// second vertical bar inside the frame border.
|
|
275
|
-
const display = replaceTabs(allLines[index]!.replace("│", " "));
|
|
276
|
-
let styled: string;
|
|
277
|
-
const linkPath =
|
|
278
|
-
ctx.headerPath && rawContexts?.[index]?.kind === ctx.kind && rawContexts[index]?.depth === ctx.depth
|
|
279
|
-
? (rawContexts[index]?.headerPath ?? ctx.headerPath)
|
|
280
|
-
: ctx.headerPath;
|
|
281
|
-
if (ctx.kind === "dir") {
|
|
282
|
-
const accent = uiTheme.fg("accent", display);
|
|
283
|
-
styled = linkPath ? fileHyperlink(linkPath, accent) : accent;
|
|
284
|
-
} else if (ctx.kind === "file") {
|
|
285
|
-
const tinted = uiTheme.fg(ctx.depth === 1 ? "accent" : "dim", display);
|
|
286
|
-
styled = linkPath ? fileHyperlink(linkPath, tinted) : tinted;
|
|
287
|
-
} else if (display.startsWith("+")) {
|
|
288
|
-
styled = uiTheme.fg("toolDiffAdded", display);
|
|
289
|
-
} else if (display.startsWith("-")) {
|
|
290
|
-
styled = uiTheme.fg("toolDiffRemoved", display);
|
|
291
|
-
} else {
|
|
292
|
-
styled = uiTheme.fg("toolOutput", display);
|
|
293
|
-
}
|
|
294
|
-
styledLines[index] = styled;
|
|
295
|
-
return styled;
|
|
296
|
-
};
|
|
297
|
-
const changeGroups = groupLineIndicesByBlank(allLines).filter(indices => {
|
|
232
|
+
const styleLine = createGroupedRowStyler(allLines, contexts, uiTheme, {
|
|
233
|
+
linkTarget: groupedLinkTargets(contexts, textContent, details, options.renderContext?.rawDetails),
|
|
234
|
+
styleBody: index => {
|
|
235
|
+
// Swap the code-frame gutter `│` for a space so it does not nest a
|
|
236
|
+
// second vertical bar inside the frame border.
|
|
237
|
+
const line = allLines[index]!.replace("│", " ");
|
|
238
|
+
const color = line.startsWith("+")
|
|
239
|
+
? "toolDiffAdded"
|
|
240
|
+
: line.startsWith("-")
|
|
241
|
+
? "toolDiffRemoved"
|
|
242
|
+
: "toolOutput";
|
|
243
|
+
return uiTheme.fg(color, line);
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
const changeGroups = groupsByFile(groupLineIndicesByBlank(allLines), contexts).filter(indices => {
|
|
298
247
|
const first = allLines[indices[0]!]!;
|
|
299
248
|
return !first.startsWith("Safety cap reached") && !first.startsWith("Parse issues:");
|
|
300
249
|
});
|
|
@@ -321,7 +270,13 @@ export const astEditToolRenderer = {
|
|
|
321
270
|
({ contentWidth }) => {
|
|
322
271
|
const expanded = Boolean(options.expanded);
|
|
323
272
|
if (bodyMemo === undefined || bodyMemo.expanded !== expanded || bodyMemo.width !== contentWidth) {
|
|
324
|
-
const changeLines = buildChangeBody(
|
|
273
|
+
const changeLines = buildChangeBody(
|
|
274
|
+
changeGroups,
|
|
275
|
+
styleLine,
|
|
276
|
+
index => contexts[index]!.kind === "file",
|
|
277
|
+
expanded ? Number.POSITIVE_INFINITY : COLLAPSED_CHANGE_LIMIT,
|
|
278
|
+
uiTheme,
|
|
279
|
+
);
|
|
325
280
|
const lines = [...changeLines, ...extraLines].map(l => truncateToWidth(l, contentWidth, Ellipsis.Omit));
|
|
326
281
|
while (lines.length > 0 && lines[0].trim() === "") lines.shift();
|
|
327
282
|
bodyMemo = { expanded, width: contentWidth, lines };
|
package/src/tools/ast-grep.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ interface AstGrepRenderArgs {
|
|
|
34
34
|
/** Legacy pre-`path` argument name; kept so historical transcripts still render a scope. */
|
|
35
35
|
paths?: string[];
|
|
36
36
|
skip?: number;
|
|
37
|
+
/** Language the search parsed the files as; highlighting follows it over the file extension. */
|
|
38
|
+
lang?: string;
|
|
37
39
|
}
|
|
38
40
|
/** Render AST grep calls and results. */
|
|
39
41
|
export declare const astGrepToolRenderer: {
|
package/src/tools/ast-grep.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { isRecord, sanitizeText } from "@linxiraos/pi-utils";
|
|
2
1
|
import type { Component } from "../tui";
|
|
3
2
|
import { Text } from "../components/text";
|
|
4
3
|
import type { Theme } from "../theme/theme";
|
|
5
|
-
import {
|
|
4
|
+
import { renderStatusLine, renderTreeList } from "../render";
|
|
6
5
|
import {
|
|
7
6
|
appendParseErrorsBulletList,
|
|
8
7
|
createCachedComponent,
|
|
@@ -14,7 +13,17 @@ import {
|
|
|
14
13
|
PREVIEW_LIMITS,
|
|
15
14
|
toPathList,
|
|
16
15
|
} from "../render/render-utils";
|
|
17
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
classifyGroupedLines,
|
|
18
|
+
createCodeFrameStyler,
|
|
19
|
+
createGroupedRowStyler,
|
|
20
|
+
describeGroupedOutput,
|
|
21
|
+
fitGroupsToBudget,
|
|
22
|
+
groupedLinkTargets,
|
|
23
|
+
groupLineIndicesByBlank,
|
|
24
|
+
groupsByFile,
|
|
25
|
+
isMatchRow,
|
|
26
|
+
} from "./grouped-file-output";
|
|
18
27
|
import { code, compact, node, span } from "../native/describe";
|
|
19
28
|
import type { NativeChild } from "../native/node";
|
|
20
29
|
import { errorText, noteText, resultText, toolHead } from "./native-view";
|
|
@@ -51,6 +60,8 @@ interface AstGrepRenderArgs {
|
|
|
51
60
|
/** Legacy pre-`path` argument name; kept so historical transcripts still render a scope. */
|
|
52
61
|
paths?: string[];
|
|
53
62
|
skip?: number;
|
|
63
|
+
/** Language the search parsed the files as; highlighting follows it over the file extension. */
|
|
64
|
+
lang?: string;
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
const COLLAPSED_MATCH_LIMIT = PREVIEW_LIMITS.COLLAPSED_LINES * 2;
|
|
@@ -121,63 +132,21 @@ export const astGrepToolRenderer = {
|
|
|
121
132
|
|
|
122
133
|
const textContent = result.details?.displayContent ?? result.content?.find(c => c.type === "text")?.text ?? "";
|
|
123
134
|
const allLines = textContent.split("\n");
|
|
124
|
-
//
|
|
125
|
-
// reconstruct across the blank-line groups the tree list collapses by.
|
|
135
|
+
// Classify the whole output so nested directory headers resolve across blank-line groups.
|
|
126
136
|
const contexts = classifyGroupedLines(allLines, details?.cwd ?? details?.searchPath, details?.searchPath);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const rawContexts =
|
|
138
|
-
rawContent !== undefined && rawLines?.length === allLines.length && sanitizeText(rawContent) === textContent
|
|
139
|
-
? classifyGroupedLines(rawLines, rawCwd ?? rawSearchPath, rawSearchPath)
|
|
140
|
-
: undefined;
|
|
141
|
-
// Style lazily: the collapsed tree list only renders the first few groups,
|
|
142
|
-
// so a large result never styles/hyperlinks rows nobody sees.
|
|
143
|
-
const styledLines: (string | undefined)[] = Array.from({ length: allLines.length }, () => undefined);
|
|
144
|
-
const styleLine = (index: number): string => {
|
|
145
|
-
const cached = styledLines[index];
|
|
146
|
-
if (cached !== undefined) return cached;
|
|
147
|
-
const line = allLines[index]!;
|
|
148
|
-
const ctx = contexts[index]!;
|
|
149
|
-
const rawContext = rawContexts?.[index];
|
|
150
|
-
const target =
|
|
151
|
-
ctx.headerPath && rawContext?.kind === ctx.kind && rawContext.depth === ctx.depth
|
|
152
|
-
? (rawContext.headerPath ?? ctx.headerPath)
|
|
153
|
-
: ctx.headerPath;
|
|
154
|
-
let styled: string;
|
|
155
|
-
if (ctx.kind === "dir") {
|
|
156
|
-
const accent = uiTheme.fg("accent", line);
|
|
157
|
-
styled = target ? fileHyperlink(target, accent) : accent;
|
|
158
|
-
} else if (ctx.kind === "file") {
|
|
159
|
-
const tinted = uiTheme.fg(ctx.depth === 1 ? "accent" : "dim", line);
|
|
160
|
-
styled = target ? fileHyperlink(target, tinted) : tinted;
|
|
161
|
-
} else {
|
|
162
|
-
styled = uiTheme.fg(line.startsWith(" meta:") ? "dim" : "toolOutput", line);
|
|
163
|
-
}
|
|
164
|
-
styledLines[index] = styled;
|
|
165
|
-
return styled;
|
|
166
|
-
};
|
|
167
|
-
const matchGroups = groupLineIndicesByBlank(allLines).filter(indices => {
|
|
137
|
+
const styleCodeFrame = createCodeFrameStyler(allLines, contexts, "toolOutput", uiTheme, args?.lang);
|
|
138
|
+
const styleLine = createGroupedRowStyler(allLines, contexts, uiTheme, {
|
|
139
|
+
linkTarget: groupedLinkTargets(contexts, textContent, details, options.renderContext?.rawDetails),
|
|
140
|
+
styleBody: index => {
|
|
141
|
+
const line = allLines[index]!;
|
|
142
|
+
return styleCodeFrame(index) ?? uiTheme.fg(line.startsWith(" meta:") ? "dim" : "toolOutput", line);
|
|
143
|
+
},
|
|
144
|
+
linkLines: true,
|
|
145
|
+
});
|
|
146
|
+
const matchGroups = groupsByFile(groupLineIndicesByBlank(allLines), contexts).filter(indices => {
|
|
168
147
|
const first = allLines[indices[0]!]!;
|
|
169
148
|
return !first.startsWith("Result limit reached") && !first.startsWith("Parse issues:");
|
|
170
149
|
});
|
|
171
|
-
// Line offset at which each group starts. A collapsed tree list stops at the
|
|
172
|
-
// first group that overflows its line budget, so groups starting at or past
|
|
173
|
-
// the budget are never shown — hand it same-length placeholders instead of
|
|
174
|
-
// styling them (renderTreeList only needs their line counts).
|
|
175
|
-
const groupStarts: number[] = [];
|
|
176
|
-
let groupStart = 0;
|
|
177
|
-
for (const group of matchGroups) {
|
|
178
|
-
groupStarts.push(groupStart);
|
|
179
|
-
groupStart += group.length;
|
|
180
|
-
}
|
|
181
150
|
|
|
182
151
|
const extraLines: string[] = [];
|
|
183
152
|
if (limitReached) {
|
|
@@ -192,18 +161,13 @@ export const astGrepToolRenderer = {
|
|
|
192
161
|
return createCachedComponent(
|
|
193
162
|
() => options.expanded,
|
|
194
163
|
width => {
|
|
164
|
+
const { shown, summary } = fitGroupsToBudget(
|
|
165
|
+
matchGroups,
|
|
166
|
+
options.expanded ? Number.POSITIVE_INFINITY : COLLAPSED_MATCH_LIMIT,
|
|
167
|
+
{ isUnit: index => isMatchRow(allLines[index]!), unit: "match", total: matchCount },
|
|
168
|
+
);
|
|
195
169
|
const matchLines = renderTreeList(
|
|
196
|
-
{
|
|
197
|
-
items: matchGroups,
|
|
198
|
-
expanded: options.expanded,
|
|
199
|
-
maxCollapsed: matchGroups.length,
|
|
200
|
-
maxCollapsedLines: COLLAPSED_MATCH_LIMIT,
|
|
201
|
-
itemType: "match",
|
|
202
|
-
renderItem: (group, context) =>
|
|
203
|
-
!options.expanded && groupStarts[context.index]! >= COLLAPSED_MATCH_LIMIT
|
|
204
|
-
? Array.from({ length: group.length }, () => "")
|
|
205
|
-
: group.map(styleLine),
|
|
206
|
-
},
|
|
170
|
+
{ items: shown, trailingSummary: summary, renderItem: group => group.map(styleLine) },
|
|
207
171
|
uiTheme,
|
|
208
172
|
);
|
|
209
173
|
return fitHeaderedRows(header, [...matchLines, ...extraLines], width);
|
package/src/tools/bash.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
replaceTabs,
|
|
14
14
|
} from "../render/render-utils";
|
|
15
15
|
import {
|
|
16
|
+
formatMinimizedMeta,
|
|
16
17
|
formatStyledTruncationWarning,
|
|
17
18
|
type OutputMeta,
|
|
18
19
|
stripOutputNotice,
|
|
@@ -351,6 +352,10 @@ function bashStatsParts(
|
|
|
351
352
|
if (artifactId) {
|
|
352
353
|
statsParts.push(`Artifact: ${artifactId}`);
|
|
353
354
|
}
|
|
355
|
+
const minimized = details?.meta?.minimized;
|
|
356
|
+
if (minimized) {
|
|
357
|
+
statsParts.push(`Minimized: ${formatMinimizedMeta(minimized)}`);
|
|
358
|
+
}
|
|
354
359
|
if (isError && typeof details?.exitCode === "number") {
|
|
355
360
|
statsParts.push(`Exit: ${details.exitCode}`);
|
|
356
361
|
}
|
|
@@ -400,6 +405,8 @@ function shellFootParts(details: BashToolDetails | undefined, artifactId: string
|
|
|
400
405
|
if (service.pid !== undefined) parts.push(`PID ${service.pid}`);
|
|
401
406
|
}
|
|
402
407
|
if (artifactId) parts.push(`Artifact ${artifactId}`);
|
|
408
|
+
const minimized = details?.meta?.minimized;
|
|
409
|
+
if (minimized) parts.push(`Minimized ${formatMinimizedMeta(minimized)}`);
|
|
403
410
|
return parts;
|
|
404
411
|
}
|
|
405
412
|
|