@linxiraos/pi-tui 1.4.7 → 1.4.10
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 +154 -231
- 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/setup/scenes/language.d.ts +3 -0
- package/dist/types/setup/scenes/types.d.ts +5 -0
- package/dist/types/setup/setup-version.d.ts +1 -1
- package/dist/types/setup/wizard.d.ts +1 -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/settings-selector.ts +113 -11
- 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/setup/scenes/language.ts +122 -0
- package/src/setup/scenes/types.ts +6 -0
- package/src/setup/setup-version.ts +1 -1
- package/src/setup/wizard.ts +2 -0
- 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/theme/theme-class.ts
CHANGED
|
@@ -138,6 +138,15 @@ const LANG_BRAND_COLORS: Partial<Record<SymbolKey, string>> = {
|
|
|
138
138
|
const BACKGROUND_RESET_PATTERN = /\x1b\[(?:0|49)m/g;
|
|
139
139
|
const FOREGROUND_RESET_PATTERN = /\x1b\[(?:0|39)m/g;
|
|
140
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Color `text` with the foreground `ansi`, restoring it after every nested reset so the rest of `text`
|
|
143
|
+
* keeps it (`fg("dim", `${fg("success", "+2")} more`)`); only the foreground is reset at the end.
|
|
144
|
+
*/
|
|
145
|
+
function wrapForeground(ansi: string, text: string): string {
|
|
146
|
+
const body = text.includes("\x1b[") ? text.replace(FOREGROUND_RESET_PATTERN, `$&${ansi}`) : text;
|
|
147
|
+
return `${ansi}${body}\x1b[39m`;
|
|
148
|
+
}
|
|
149
|
+
|
|
141
150
|
// Prebuilt stylers: each `chalk.<style>` access builds a fresh builder. Builders share the
|
|
142
151
|
// root chalk context, so later `chalk.level` changes still apply.
|
|
143
152
|
const boldStyler = chalk.bold;
|
|
@@ -234,6 +243,8 @@ export class Theme {
|
|
|
234
243
|
logger.debug("Invalid symbol key in override", { key, availableKeys: Object.keys(this.#symbols) });
|
|
235
244
|
}
|
|
236
245
|
}
|
|
246
|
+
// `status.done` aliases `status.success` unless a theme overrides it explicitly.
|
|
247
|
+
if (!("status.done" in symbolOverrides)) this.#symbols["status.done"] = this.#symbols["status.success"];
|
|
237
248
|
this.#spinnerFramesOverrides = spinnerFramesOverrides;
|
|
238
249
|
}
|
|
239
250
|
|
|
@@ -350,7 +361,7 @@ export class Theme {
|
|
|
350
361
|
fg(color: ThemeColor, text: string): string {
|
|
351
362
|
const ansi = this.#fgColors[color];
|
|
352
363
|
if (!ansi) throw new Error(`Unknown theme color: ${color}`);
|
|
353
|
-
return
|
|
364
|
+
return wrapForeground(ansi, text);
|
|
354
365
|
}
|
|
355
366
|
|
|
356
367
|
/** Apply a foreground, replacing terminal-default tokens with the theme's contrast-safe fallback. */
|
|
@@ -362,7 +373,7 @@ export class Theme {
|
|
|
362
373
|
resolved = ansi === "\x1b[39m" ? colorToAnsi(this.getColorHex(color), this.mode) : ansi;
|
|
363
374
|
this.#resolvedFgColors.set(color, resolved);
|
|
364
375
|
}
|
|
365
|
-
return
|
|
376
|
+
return wrapForeground(resolved, text);
|
|
366
377
|
}
|
|
367
378
|
|
|
368
379
|
bg(color: ThemeBg, text: string): string {
|
|
@@ -390,7 +401,7 @@ export class Theme {
|
|
|
390
401
|
*/
|
|
391
402
|
fgOnBg(color: ThemeColor, background: ThemeBg, text: string): string {
|
|
392
403
|
const ansi = this.getFgOnBgAnsi(color, background);
|
|
393
|
-
return
|
|
404
|
+
return wrapForeground(ansi, text);
|
|
394
405
|
}
|
|
395
406
|
|
|
396
407
|
bold(text: string): string {
|
|
@@ -519,6 +530,7 @@ export class Theme {
|
|
|
519
530
|
running: this.#symbols["status.running"],
|
|
520
531
|
shadowed: this.#symbols["status.shadowed"],
|
|
521
532
|
aborted: this.#symbols["status.aborted"],
|
|
533
|
+
/** @deprecated Alias of `success`. */
|
|
522
534
|
done: this.#symbols["status.done"],
|
|
523
535
|
};
|
|
524
536
|
}
|
package/src/theme/theme.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { getAvailableThemes, getAvailableThemesWithPaths, getThemeByName, type T
|
|
|
6
6
|
export { isValidThemeColor, type ThemeBg, type ThemeColor } from "./schema";
|
|
7
7
|
export { getAvailableSymbolPresets, isValidSymbolPreset, type SpinnerType, type SymbolKey, type SymbolPreset, } from "./symbols";
|
|
8
8
|
export { Theme } from "./theme-class";
|
|
9
|
-
export { createHighlightStream, getEditorTheme, getMarkdownTheme, getMarkdownThemeWithLinkTargets, getSelectListTheme, getSettingsListTheme, getSymbolTheme, highlightCode, setMarkdownMermaidRendering, warmHighlighter, } from "./tui-adapters";
|
|
9
|
+
export { createHighlightStream, getEditorTheme, getMarkdownTheme, getMarkdownThemeWithLinkTargets, getSelectListTheme, getSettingsListTheme, getSymbolTheme, highlightCode, isHighlightLanguage, setMarkdownMermaidRendering, warmHighlighter, } from "./tui-adapters";
|
|
10
10
|
/**
|
|
11
11
|
* Subscribe to native fallback appearance changes independently of theme changes.
|
|
12
12
|
* Consumers must re-check the effective background: COLORFGBG can override it.
|
package/src/theme/theme.ts
CHANGED
|
@@ -6,6 +6,8 @@ import type { SettingsListTheme } from "../components/settings-list";
|
|
|
6
6
|
import type { SymbolTheme } from "../symbols";
|
|
7
7
|
import type { SlashCommandIconName } from "./symbols";
|
|
8
8
|
import type { Theme } from "./theme-class";
|
|
9
|
+
/** Whether {@link highlightCode} colors `lang`; text in any other language comes back unstyled. */
|
|
10
|
+
export declare function isHighlightLanguage(lang: string | undefined): lang is string;
|
|
9
11
|
/**
|
|
10
12
|
* Highlight code with syntax coloring based on file extension or language.
|
|
11
13
|
* Returns array of highlighted lines.
|
|
@@ -96,12 +96,17 @@ function highlightCached(code: string, validLang: string | undefined, highlightT
|
|
|
96
96
|
return highlighted;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/** Whether {@link highlightCode} colors `lang`; text in any other language comes back unstyled. */
|
|
100
|
+
export function isHighlightLanguage(lang: string | undefined): lang is string {
|
|
101
|
+
return lang !== undefined && nativeSupportsLanguage(lang);
|
|
102
|
+
}
|
|
103
|
+
|
|
99
104
|
/**
|
|
100
105
|
* Highlight code with syntax coloring based on file extension or language.
|
|
101
106
|
* Returns array of highlighted lines.
|
|
102
107
|
*/
|
|
103
108
|
export function highlightCode(code: string, lang?: string, highlightTheme: Theme = theme): string[] {
|
|
104
|
-
const validLang =
|
|
109
|
+
const validLang = isHighlightLanguage(lang) ? lang : undefined;
|
|
105
110
|
const highlighted = highlightCached(code, validLang, highlightTheme);
|
|
106
111
|
// Always return a fresh array: callers (e.g. renderCodeCell) push extra lines
|
|
107
112
|
// onto the result, which would corrupt the cached string otherwise.
|
|
@@ -110,7 +115,7 @@ export function highlightCode(code: string, lang?: string, highlightTheme: Theme
|
|
|
110
115
|
|
|
111
116
|
/** Create a stateful highlighter for progressive terminal rendering. */
|
|
112
117
|
export function createHighlightStream(lang?: string, highlightTheme: Theme = theme): NativeHighlightStream | null {
|
|
113
|
-
const validLang =
|
|
118
|
+
const validLang = isHighlightLanguage(lang) ? lang : undefined;
|
|
114
119
|
if (!validLang) return null;
|
|
115
120
|
// Workspace loads skip the natives version sentinel, so a stale local
|
|
116
121
|
// `.node` can omit `HighlightStream` after a pull. Napi constructors can
|
|
@@ -305,7 +310,7 @@ export function getMarkdownTheme(): MarkdownTheme {
|
|
|
305
310
|
})
|
|
306
311
|
: undefined,
|
|
307
312
|
highlightCode: (code: string, lang?: string): string[] => {
|
|
308
|
-
const validLang =
|
|
313
|
+
const validLang = isHighlightLanguage(lang) ? lang : undefined;
|
|
309
314
|
const highlighted = highlightCached(code, validLang, theme);
|
|
310
315
|
if (highlighted !== null) return highlighted.split("\n");
|
|
311
316
|
return code.split("\n").map(line => theme.fg("mdCodeBlock", line));
|
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: {
|