@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/apps/ps-top.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { type Component, TUI } from "../tui";
|
|
|
17
17
|
import type { TspSpan, TspText, TspTone } from "@linxiraos/pi-wire";
|
|
18
18
|
import { col, compact, elapsed, keyed, node, row, span, stableKey, text } from "../native/describe";
|
|
19
19
|
import type { NativeNode, NativeUiEvent } from "../native/node";
|
|
20
|
-
import { actionBar, actionButton } from "../native/overlay";
|
|
20
|
+
import { actionBar, actionButton, iconButton, segmentedTabs } from "../native/overlay";
|
|
21
21
|
import { Memo } from "../native/memo";
|
|
22
22
|
import { truncateToWidth } from "../utils";
|
|
23
23
|
import { formatDuration } from "@linxiraos/pi-utils";
|
|
@@ -410,13 +410,7 @@ export class PsTopComponent implements Component {
|
|
|
410
410
|
);
|
|
411
411
|
} else {
|
|
412
412
|
left.push(
|
|
413
|
-
|
|
414
|
-
name: "back",
|
|
415
|
-
role: "zeta.app.ibtn",
|
|
416
|
-
title: "Back esc",
|
|
417
|
-
aria: "Back",
|
|
418
|
-
actions: { click: "back" },
|
|
419
|
-
}),
|
|
413
|
+
iconButton("back", "back", "Back esc", { aria: "Back" }),
|
|
420
414
|
text(
|
|
421
415
|
this.#view === "logs" ? `Logs · ${entry?.row.snapshot.name ?? "?"}` : (entry?.row.snapshot.name ?? "?"),
|
|
422
416
|
{
|
|
@@ -432,8 +426,7 @@ export class PsTopComponent implements Component {
|
|
|
432
426
|
const right: NativeNode[] = [];
|
|
433
427
|
if (this.#view === "table") {
|
|
434
428
|
right.push(
|
|
435
|
-
|
|
436
|
-
"tabs",
|
|
429
|
+
segmentedTabs(
|
|
437
430
|
{
|
|
438
431
|
items: [
|
|
439
432
|
{
|
|
@@ -448,7 +441,6 @@ export class PsTopComponent implements Component {
|
|
|
448
441
|
active: this.#all ? "all" : "current",
|
|
449
442
|
role: "zeta.app.seg",
|
|
450
443
|
},
|
|
451
|
-
undefined,
|
|
452
444
|
"scope",
|
|
453
445
|
),
|
|
454
446
|
);
|
|
@@ -468,7 +460,7 @@ export class PsTopComponent implements Component {
|
|
|
468
460
|
align: "center",
|
|
469
461
|
role: "zeta.app.fresh",
|
|
470
462
|
}),
|
|
471
|
-
|
|
463
|
+
iconButton("x", "quit", "Quit q", { aria: "Quit" }),
|
|
472
464
|
);
|
|
473
465
|
return keyed(
|
|
474
466
|
row(
|
package/src/charts/chart-plan.ts
CHANGED
|
@@ -1523,10 +1523,6 @@ export function buildChart(table: TableAnalysis, plan: ChartPlan): ChartSpec | u
|
|
|
1523
1523
|
// its rows are in different units.
|
|
1524
1524
|
if (arrows.length === 1 && plan.kind !== "paired" && plan.kind !== "range" && !plan.transpose)
|
|
1525
1525
|
return buildChart(table, { ...plan, kind: arrows[0]!.mixed ? "change" : "paired", series: [arrows[0]!.index] });
|
|
1526
|
-
// A dumbbell of two measures beside their ratio (`pi-walker | Go | Speedup`): the ratio restates the gap the
|
|
1527
|
-
// dumbbell draws (on a log axis its length), so the pair draws alone.
|
|
1528
|
-
const pair = plan.kind === "paired" && !plan.transpose ? ratioPair(table, columns) : undefined;
|
|
1529
|
-
if (pair) return buildChart(table, { ...plan, series: pair.map(column => column.index) });
|
|
1530
1526
|
// Unitless before/after values spanning decades are rows of different quantities, and rows of very different
|
|
1531
1527
|
// sizes beside a baseline column share no readable axis; their factors do (`3.95M → 190k` is 21× less).
|
|
1532
1528
|
// Intervals keep their values: a range chart prints the factor between a pair's midpoints beside both.
|
|
@@ -2810,31 +2806,6 @@ function againstBaseline(
|
|
|
2810
2806
|
return [baseline, ...columns.filter(column => column !== baseline)];
|
|
2811
2807
|
}
|
|
2812
2808
|
|
|
2813
|
-
/** Relative slack within which a ratio column restates the ratio of two others (`4.1×` for 75.3 / 18.2). */
|
|
2814
|
-
const RATIO_SLACK = 0.05;
|
|
2815
|
-
|
|
2816
|
-
/**
|
|
2817
|
-
* Of three plotted columns, the two same-unit measures when the third is their ratio (`Speedup`
|
|
2818
|
-
* `4.1×`, a `ratio` column) matching `a ÷ b` or `b ÷ a` within {@link RATIO_SLACK}
|
|
2819
|
-
* in every row holding all three, two rows at least; else `undefined`.
|
|
2820
|
-
*/
|
|
2821
|
-
function ratioPair(table: TableAnalysis, columns: readonly TableColumn[]): [TableColumn, TableColumn] | undefined {
|
|
2822
|
-
if (columns.length !== 3) return undefined;
|
|
2823
|
-
const ratio = columns.find(column => column.dim === "ratio");
|
|
2824
|
-
const rest = columns.filter(column => column !== ratio);
|
|
2825
|
-
const [a, b] = rest;
|
|
2826
|
-
if (!ratio || !a || !b || a.dim !== b.dim || a.unit !== b.unit || a.dim === "ratio") return undefined;
|
|
2827
|
-
const near = (value: number, target: number) => Math.abs(value - target) <= RATIO_SLACK * target;
|
|
2828
|
-
let matched = 0;
|
|
2829
|
-
for (const row of table.rows) {
|
|
2830
|
-
const [x, y, r] = [a.cells[row], b.cells[row], ratio.cells[row]];
|
|
2831
|
-
if (!isNumber(x) || !isNumber(y) || !isNumber(r) || x.value <= 0 || y.value <= 0) continue;
|
|
2832
|
-
if (!near(r.value, x.value / y.value) && !near(r.value, y.value / x.value)) return undefined;
|
|
2833
|
-
matched++;
|
|
2834
|
-
}
|
|
2835
|
-
return matched >= 2 ? [a, b] : undefined;
|
|
2836
|
-
}
|
|
2837
|
-
|
|
2838
2809
|
/**
|
|
2839
2810
|
* Measure columns pairing a before condition with another over the same
|
|
2840
2811
|
* metric (`Baseline Turns` → `Iter1 Turns`, `Baseline Tokens In` → `Iter1
|
|
@@ -101,8 +101,10 @@ export interface TableColumn {
|
|
|
101
101
|
/**
|
|
102
102
|
* Index of the measure column this one restates, read from the values: a
|
|
103
103
|
* proportional copy (`pass` 33/38 beside `pass%` 87%, `Samples` beside `% of
|
|
104
|
-
* Total`, `Leverage vs $200` beside the cost)
|
|
105
|
-
* (`Offset` summing `Verts`)
|
|
104
|
+
* Total`, `Leverage vs $200` beside the cost), a running total of it
|
|
105
|
+
* (`Offset` summing `Verts`), or its ratio to another column of its unit
|
|
106
|
+
* (`ratio` 0.997 for `Python (ms)` ÷ `C++ (ms)`, `Speedup` 4.1×: the
|
|
107
|
+
* numerator's index). Such a column is never a measure of its own.
|
|
106
108
|
*/
|
|
107
109
|
readonly restates?: number;
|
|
108
110
|
}
|
package/src/charts/table-data.ts
CHANGED
|
@@ -108,8 +108,10 @@ export interface TableColumn {
|
|
|
108
108
|
/**
|
|
109
109
|
* Index of the measure column this one restates, read from the values: a
|
|
110
110
|
* proportional copy (`pass` 33/38 beside `pass%` 87%, `Samples` beside `% of
|
|
111
|
-
* Total`, `Leverage vs $200` beside the cost)
|
|
112
|
-
* (`Offset` summing `Verts`)
|
|
111
|
+
* Total`, `Leverage vs $200` beside the cost), a running total of it
|
|
112
|
+
* (`Offset` summing `Verts`), or its ratio to another column of its unit
|
|
113
|
+
* (`ratio` 0.997 for `Python (ms)` ÷ `C++ (ms)`, `Speedup` 4.1×: the
|
|
114
|
+
* numerator's index). Such a column is never a measure of its own.
|
|
113
115
|
*/
|
|
114
116
|
readonly restates?: number;
|
|
115
117
|
}
|
|
@@ -906,10 +908,11 @@ function plainValue(column: TableColumn, row: number): NumberCell | undefined {
|
|
|
906
908
|
|
|
907
909
|
/**
|
|
908
910
|
* Columns restating another column's values: `y = k·x` within the written
|
|
909
|
-
* precision over three or more rows where `x` varies,
|
|
910
|
-
* (`Offset` stepping by `Verts`)
|
|
911
|
-
* stays, unless the second is a share
|
|
912
|
-
* table bolded more of its cells
|
|
911
|
+
* precision over three or more rows where `x` varies, a running total
|
|
912
|
+
* (`Offset` stepping by `Verts`), or the ratio of two others ({@link quotient}).
|
|
913
|
+
* Of a proportional pair the first column stays, unless the second is a share
|
|
914
|
+
* summing to 100% beside counts or the table bolded more of its cells
|
|
915
|
+
* (`**87%**` beside `33/38`).
|
|
913
916
|
*/
|
|
914
917
|
function restatedColumns(measures: readonly TableColumn[], rows: readonly number[]): Map<number, number> {
|
|
915
918
|
const restated = new Map<number, number>();
|
|
@@ -931,9 +934,55 @@ function restatedColumns(measures: readonly TableColumn[], rows: readonly number
|
|
|
931
934
|
const source = measures.find(other => other !== column && runningTotal(column, other, rows));
|
|
932
935
|
if (source) restated.set(column.index, source.index);
|
|
933
936
|
}
|
|
937
|
+
const kept = measures.filter(column => !restated.has(column.index));
|
|
938
|
+
for (const ratio of kept) {
|
|
939
|
+
if (restated.has(ratio.index)) continue;
|
|
940
|
+
const terms = kept.filter(column => column !== ratio && !restated.has(column.index));
|
|
941
|
+
const over = terms
|
|
942
|
+
.flatMap(a => terms.map(b => [a, b] as const))
|
|
943
|
+
.find(([a, b]) => a !== b && quotient(ratio, a, b, rows));
|
|
944
|
+
if (over) restated.set(ratio.index, over[0].index);
|
|
945
|
+
}
|
|
934
946
|
return restated;
|
|
935
947
|
}
|
|
936
948
|
|
|
949
|
+
/** Most relative rounding a row's quotient may carry to count toward proving it (`2×` beside its terms proves little). */
|
|
950
|
+
const LOOSE_QUOTIENT = 0.05;
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* `ratio = a ÷ b` in every row holding all three, `a` and `b` in one unit
|
|
954
|
+
* (`Python (ms)` ÷ `old C++ (ms)` = `0.997`; `Go` ÷ `pi-walker` = `4.1×`),
|
|
955
|
+
* within the precision each figure is written to, over three or more rows
|
|
956
|
+
* pinned to {@link LOOSE_QUOTIENT}. Percent columns are left alone: a part's
|
|
957
|
+
* share of a whole (`Share` = `Tokens` ÷ `Total`) is a measure the table states.
|
|
958
|
+
*
|
|
959
|
+
* Bare numbers all read as counts, and of three columns related so each is
|
|
960
|
+
* the others' quotient or product (`C++ = Python ÷ ratio` holds too), the
|
|
961
|
+
* ratio is the one that varies less from row to row than both its terms:
|
|
962
|
+
* workloads of different sizes move both timings, not their ratio. Where none
|
|
963
|
+
* does, none is taken for the ratio.
|
|
964
|
+
*/
|
|
965
|
+
function quotient(ratio: TableColumn, a: TableColumn, b: TableColumn, rows: readonly number[]): boolean {
|
|
966
|
+
if ((ratio.dim !== "count" && ratio.dim !== "ratio") || a.dim !== b.dim || a.unit !== b.unit) return false;
|
|
967
|
+
let tight = 0;
|
|
968
|
+
const matched: (readonly [number, number, number])[] = [];
|
|
969
|
+
for (const row of rows) {
|
|
970
|
+
const [r, x, y] = [plainValue(ratio, row), plainValue(a, row), plainValue(b, row)];
|
|
971
|
+
if (!r || !x || !y) continue;
|
|
972
|
+
if (x.value <= 0 || y.value <= 0 || r.value <= 0) return false;
|
|
973
|
+
const exact = x.value / y.value;
|
|
974
|
+
const slack = writtenSlack(r) + exact * (writtenSlack(x) / x.value + writtenSlack(y) / y.value) + 1e-9 * exact;
|
|
975
|
+
if (Math.abs(r.value - exact) > slack) return false;
|
|
976
|
+
if (slack <= LOOSE_QUOTIENT * exact) tight++;
|
|
977
|
+
matched.push([r.value, x.value, y.value]);
|
|
978
|
+
}
|
|
979
|
+
if (tight < 3) return false;
|
|
980
|
+
if (ratio.dim !== a.dim) return true;
|
|
981
|
+
const spread = (at: 0 | 1 | 2) =>
|
|
982
|
+
Math.max(...matched.map(values => values[at])) / Math.min(...matched.map(values => values[at]));
|
|
983
|
+
return spread(0) < spread(1) && spread(0) < spread(2);
|
|
984
|
+
}
|
|
985
|
+
|
|
937
986
|
/** How many of `rows` the table bolded in `column`. */
|
|
938
987
|
function emphasized(column: TableColumn, rows: readonly number[]): number {
|
|
939
988
|
return rows.filter(row => column.cells[row]?.emphasis).length;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { ImageContent } from "@linxiraos/pi-ai";
|
|
5
5
|
import { Container, type TUI } from "../tui";
|
|
6
6
|
import type { OutputArtifactError } from "../tools/streaming-output";
|
|
7
|
-
import type { TruncationMeta } from "../tools/output-meta";
|
|
7
|
+
import type { MinimizedMeta, TruncationMeta } from "../tools/output-meta";
|
|
8
8
|
import { type DescribeContext, type NativeNode, type NativeUiEvent } from "../native/node";
|
|
9
9
|
/** PTY size for `!` commands: the execution frame's inner content area. */
|
|
10
10
|
export declare function bashPtyViewport(ui: TUI): {
|
|
@@ -43,9 +43,12 @@ export declare class BashExecutionComponent extends Container {
|
|
|
43
43
|
output?: string;
|
|
44
44
|
truncation?: TruncationMeta;
|
|
45
45
|
artifactError?: OutputArtifactError;
|
|
46
|
+
minimized?: MinimizedMeta;
|
|
46
47
|
images?: readonly ImageContent[];
|
|
47
48
|
showImages?: boolean;
|
|
48
49
|
}): void;
|
|
50
|
+
/** The loader animates the bottom border from outside the child tree, so teardown stops it here. */
|
|
51
|
+
dispose(): void;
|
|
49
52
|
render(width: number): readonly string[];
|
|
50
53
|
/**
|
|
51
54
|
* Get the raw output for creating BashExecutionMessage.
|
|
@@ -12,7 +12,7 @@ import { sanitizeText } from "@linxiraos/pi-utils";
|
|
|
12
12
|
import type { Terminal as XtermTerminalType } from "@linxiraos/pi-utils/vterm";
|
|
13
13
|
import { theme } from "../theme/theme";
|
|
14
14
|
import type { OutputArtifactError } from "../tools/streaming-output";
|
|
15
|
-
import type { TruncationMeta } from "../tools/output-meta";
|
|
15
|
+
import type { MinimizedMeta, TruncationMeta } from "../tools/output-meta";
|
|
16
16
|
import { resolveImageOptions } from "../render/render-utils";
|
|
17
17
|
import { OutputPane } from "../render/output-pane";
|
|
18
18
|
import { loadXtermTerminal, readTerminalRows, styleTerminalRow } from "../tools/terminal-output";
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
describeExecutionTool,
|
|
27
27
|
type ExecutionColorKey,
|
|
28
28
|
type ExecutionStatus,
|
|
29
|
+
executionStatusLabel,
|
|
29
30
|
PREVIEW_LINES,
|
|
30
31
|
resolveExecutionStatus,
|
|
31
32
|
} from "./execution-shared";
|
|
@@ -34,6 +35,7 @@ import { type DescribeContext, type NativeNode, type NativeUiEvent, rootToggleEx
|
|
|
34
35
|
import { NativeImageCache } from "../native/blobs";
|
|
35
36
|
import { imageLinksEnabled, linkedImageSpan, linkedImageText } from "../prompt/image-references";
|
|
36
37
|
import { Memo } from "../native/memo";
|
|
38
|
+
import type { DynamicBorder } from "../chrome/dynamic-border";
|
|
37
39
|
|
|
38
40
|
const STREAMING_LINE_CAP = PREVIEW_LINES * 5;
|
|
39
41
|
// Minimum interval between processing incoming chunks for display (ms).
|
|
@@ -59,8 +61,10 @@ export class BashExecutionComponent extends Container {
|
|
|
59
61
|
#status: ExecutionStatus = "running";
|
|
60
62
|
#exitCode: number | undefined = undefined;
|
|
61
63
|
#loader: Loader;
|
|
64
|
+
readonly #bottomBorder: DynamicBorder;
|
|
62
65
|
#truncation?: TruncationMeta;
|
|
63
66
|
#artifactError?: OutputArtifactError;
|
|
67
|
+
#minimized?: MinimizedMeta;
|
|
64
68
|
#expanded = false;
|
|
65
69
|
// Post-finalize mutation counter (FinalizableBlock.getTranscriptBlockVersion):
|
|
66
70
|
// a completed command's block still mutates on expansion toggles, and the
|
|
@@ -103,9 +107,10 @@ export class BashExecutionComponent extends Container {
|
|
|
103
107
|
// Use dim border for excluded-from-context commands (!! prefix)
|
|
104
108
|
const colorKey = excludeFromContext ? "dim" : "bashMode";
|
|
105
109
|
this.#colorKey = colorKey;
|
|
106
|
-
const { contentContainer, loader } = buildExecutionFrame(this, ui, colorKey);
|
|
110
|
+
const { contentContainer, loader, bottomBorder } = buildExecutionFrame(this, ui, colorKey);
|
|
107
111
|
this.#contentContainer = contentContainer;
|
|
108
112
|
this.#loader = loader;
|
|
113
|
+
this.#bottomBorder = bottomBorder;
|
|
109
114
|
this.#outputPane = new OutputPane(theme, {
|
|
110
115
|
expanded: false,
|
|
111
116
|
collapsedMaxLines: PREVIEW_LINES,
|
|
@@ -121,7 +126,6 @@ export class BashExecutionComponent extends Container {
|
|
|
121
126
|
// Command header
|
|
122
127
|
this.#headerText = new Text(theme.fg(colorKey, theme.bold(`$ ${command}`)), 1, 0);
|
|
123
128
|
this.#contentContainer.addChild(this.#headerText);
|
|
124
|
-
this.#contentContainer.addChild(this.#loader);
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
/**
|
|
@@ -200,6 +204,7 @@ export class BashExecutionComponent extends Container {
|
|
|
200
204
|
exitCode: this.#exitCode,
|
|
201
205
|
truncation: this.#truncation,
|
|
202
206
|
artifactError: this.#artifactError,
|
|
207
|
+
minimized: this.#minimized,
|
|
203
208
|
};
|
|
204
209
|
return dataFirst
|
|
205
210
|
? describeExecutionTool({
|
|
@@ -358,6 +363,7 @@ export class BashExecutionComponent extends Container {
|
|
|
358
363
|
output?: string;
|
|
359
364
|
truncation?: TruncationMeta;
|
|
360
365
|
artifactError?: OutputArtifactError;
|
|
366
|
+
minimized?: MinimizedMeta;
|
|
361
367
|
images?: readonly ImageContent[];
|
|
362
368
|
showImages?: boolean;
|
|
363
369
|
},
|
|
@@ -367,6 +373,7 @@ export class BashExecutionComponent extends Container {
|
|
|
367
373
|
this.#endedAt ??= performance.now();
|
|
368
374
|
this.#truncation = options?.truncation;
|
|
369
375
|
this.#artifactError = options?.artifactError;
|
|
376
|
+
this.#minimized = options?.minimized;
|
|
370
377
|
this.#images = options?.images ?? [];
|
|
371
378
|
this.#showImages = options?.showImages ?? true;
|
|
372
379
|
if (options?.output !== undefined && !this.#ptyMode) {
|
|
@@ -383,6 +390,12 @@ export class BashExecutionComponent extends Container {
|
|
|
383
390
|
this.#updateDisplay();
|
|
384
391
|
}
|
|
385
392
|
|
|
393
|
+
/** The loader animates the bottom border from outside the child tree, so teardown stops it here. */
|
|
394
|
+
override dispose(): void {
|
|
395
|
+
this.#loader.dispose();
|
|
396
|
+
super.dispose();
|
|
397
|
+
}
|
|
398
|
+
|
|
386
399
|
override render(width: number): readonly string[] {
|
|
387
400
|
if (this.#displayDirty) {
|
|
388
401
|
this.#displayDirty = false;
|
|
@@ -440,15 +453,13 @@ export class BashExecutionComponent extends Container {
|
|
|
440
453
|
}
|
|
441
454
|
}
|
|
442
455
|
|
|
443
|
-
//
|
|
444
|
-
if (this.#status
|
|
445
|
-
this.#
|
|
446
|
-
} else {
|
|
456
|
+
// The bottom border keeps the live loader until the run settles, then its exit/cancel marker.
|
|
457
|
+
if (this.#status !== "running") {
|
|
458
|
+
this.#bottomBorder.setLabel(executionStatusLabel(this.#status, this.#exitCode));
|
|
447
459
|
const footer = buildStatusFooter({
|
|
448
|
-
status: this.#status,
|
|
449
|
-
exitCode: this.#exitCode,
|
|
450
460
|
truncation: this.#truncation,
|
|
451
461
|
artifactError: this.#artifactError,
|
|
462
|
+
minimized: this.#minimized,
|
|
452
463
|
hiddenLineCount,
|
|
453
464
|
suppressHiddenCount: hasSixelOutput,
|
|
454
465
|
});
|
|
@@ -37,7 +37,7 @@ import { theme } from "../theme";
|
|
|
37
37
|
import {
|
|
38
38
|
assistantHasVisibleContent,
|
|
39
39
|
assistantUsageIsBilled,
|
|
40
|
-
|
|
40
|
+
buildAsyncResultComponent,
|
|
41
41
|
buildFileMentionBlock,
|
|
42
42
|
buildIrcMessageCard,
|
|
43
43
|
buildLaunchCompletionBlock,
|
|
@@ -356,6 +356,7 @@ export class ChatTranscriptBuilder {
|
|
|
356
356
|
component.setComplete(message.exitCode, message.cancelled, {
|
|
357
357
|
truncation: message.meta?.truncation,
|
|
358
358
|
artifactError: message.meta?.artifactError,
|
|
359
|
+
minimized: message.meta?.minimized,
|
|
359
360
|
images: message.images,
|
|
360
361
|
showImages: displayPreferences.showImages,
|
|
361
362
|
});
|
|
@@ -599,7 +600,9 @@ export class ChatTranscriptBuilder {
|
|
|
599
600
|
#appendCustomMessage(message: Extract<AgentMessage, { role: "custom" | "hookMessage" }>): void {
|
|
600
601
|
if (!message.display) return;
|
|
601
602
|
if (message.customType === "async-result") {
|
|
602
|
-
const
|
|
603
|
+
const renderer = this.#deps.getMessageRenderer?.(message.customType);
|
|
604
|
+
const component = buildAsyncResultComponent(message, renderer);
|
|
605
|
+
this.#trackExpandable(component);
|
|
603
606
|
this.container.addChild(component);
|
|
604
607
|
return;
|
|
605
608
|
}
|
|
@@ -32,6 +32,8 @@ export declare class EvalExecutionComponent extends Container {
|
|
|
32
32
|
truncation?: TruncationMeta;
|
|
33
33
|
artifactError?: OutputArtifactError;
|
|
34
34
|
}): void;
|
|
35
|
+
/** The loader animates the bottom border from outside the child tree, so teardown stops it here. */
|
|
36
|
+
dispose(): void;
|
|
35
37
|
getOutput(): string;
|
|
36
38
|
getCode(): string;
|
|
37
39
|
}
|
|
@@ -19,12 +19,14 @@ import {
|
|
|
19
19
|
describeExecutionTool,
|
|
20
20
|
type ExecutionColorKey,
|
|
21
21
|
type ExecutionStatus,
|
|
22
|
+
executionStatusLabel,
|
|
22
23
|
PREVIEW_LINES,
|
|
23
24
|
resolveExecutionStatus,
|
|
24
25
|
} from "./execution-shared";
|
|
25
26
|
import { code, span } from "../native/describe";
|
|
26
27
|
import { type DescribeContext, type NativeNode, type NativeUiEvent, rootToggleExpanded } from "../native/node";
|
|
27
28
|
import { Memo } from "../native/memo";
|
|
29
|
+
import type { DynamicBorder } from "../chrome/dynamic-border";
|
|
28
30
|
|
|
29
31
|
export type EvalExecutionLanguage = "python" | "js";
|
|
30
32
|
|
|
@@ -32,6 +34,7 @@ export class EvalExecutionComponent extends Container {
|
|
|
32
34
|
#status: ExecutionStatus = "running";
|
|
33
35
|
#exitCode: number | undefined = undefined;
|
|
34
36
|
#loader: Loader;
|
|
37
|
+
readonly #bottomBorder: DynamicBorder;
|
|
35
38
|
#truncation?: TruncationMeta;
|
|
36
39
|
#artifactError?: OutputArtifactError;
|
|
37
40
|
#expanded = false;
|
|
@@ -72,9 +75,10 @@ export class EvalExecutionComponent extends Container {
|
|
|
72
75
|
this.#language = language;
|
|
73
76
|
|
|
74
77
|
const colorKey: ExecutionColorKey = this.#excludeFromContext ? "dim" : "pythonMode";
|
|
75
|
-
const { contentContainer, loader } = buildExecutionFrame(this, ui, colorKey);
|
|
78
|
+
const { contentContainer, loader, bottomBorder } = buildExecutionFrame(this, ui, colorKey);
|
|
76
79
|
this.#contentContainer = contentContainer;
|
|
77
80
|
this.#loader = loader;
|
|
81
|
+
this.#bottomBorder = bottomBorder;
|
|
78
82
|
this.#outputPane = new OutputPane(theme, {
|
|
79
83
|
expanded: false,
|
|
80
84
|
collapsedMaxLines: PREVIEW_LINES,
|
|
@@ -89,7 +93,6 @@ export class EvalExecutionComponent extends Container {
|
|
|
89
93
|
});
|
|
90
94
|
|
|
91
95
|
this.#contentContainer.addChild(this.#formatHeader(colorKey));
|
|
92
|
-
this.#contentContainer.addChild(this.#loader);
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
/**
|
|
@@ -188,6 +191,12 @@ export class EvalExecutionComponent extends Container {
|
|
|
188
191
|
this.#updateDisplay();
|
|
189
192
|
}
|
|
190
193
|
|
|
194
|
+
/** The loader animates the bottom border from outside the child tree, so teardown stops it here. */
|
|
195
|
+
override dispose(): void {
|
|
196
|
+
this.#loader.dispose();
|
|
197
|
+
super.dispose();
|
|
198
|
+
}
|
|
199
|
+
|
|
191
200
|
#updateDisplay(): void {
|
|
192
201
|
// Only the collapsed preview hides lines; when expanded the footer must
|
|
193
202
|
// not keep advertising hidden lines / ctrl+o.
|
|
@@ -200,12 +209,10 @@ export class EvalExecutionComponent extends Container {
|
|
|
200
209
|
|
|
201
210
|
if (this.#outputPane.lineCount > 0) this.#contentContainer.addChild(this.#outputPane);
|
|
202
211
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
212
|
+
// The bottom border keeps the live loader until the run settles, then its exit/cancel marker.
|
|
213
|
+
if (this.#status !== "running") {
|
|
214
|
+
this.#bottomBorder.setLabel(executionStatusLabel(this.#status, this.#exitCode));
|
|
206
215
|
const footer = buildStatusFooter({
|
|
207
|
-
status: this.#status,
|
|
208
|
-
exitCode: this.#exitCode,
|
|
209
216
|
truncation: this.#truncation,
|
|
210
217
|
artifactError: this.#artifactError,
|
|
211
218
|
hiddenLineCount,
|
|
@@ -10,7 +10,8 @@ import { Loader } from "../components/loader";
|
|
|
10
10
|
import { Text } from "../components/text";
|
|
11
11
|
import { Container, type TUI } from "../tui";
|
|
12
12
|
import type { OutputArtifactError } from "../tools/streaming-output";
|
|
13
|
-
import { type TruncationMeta } from "../tools/output-meta";
|
|
13
|
+
import { type MinimizedMeta, type TruncationMeta } from "../tools/output-meta";
|
|
14
|
+
import { DynamicBorder } from "../chrome/dynamic-border";
|
|
14
15
|
import type { TspText } from "@linxiraos/pi-wire";
|
|
15
16
|
import type { NativeChild, NativeNode } from "../native/node";
|
|
16
17
|
/** Output rows shown while an execution is collapsed. */
|
|
@@ -25,23 +26,26 @@ export type ExecutionColorKey = "dim" | "bashMode" | "pythonMode";
|
|
|
25
26
|
/**
|
|
26
27
|
* Build the spacer + top border + content container + bottom border scaffold
|
|
27
28
|
* that bash and eval execution components share. The caller appends the
|
|
28
|
-
* header (command vs `>>>` prompt) and the
|
|
29
|
-
* `
|
|
29
|
+
* header (command vs `>>>` prompt) to `contentContainer` and keeps the run's
|
|
30
|
+
* state in `bottomBorder` ({@link executionStatusLabel}); the returned loader
|
|
31
|
+
* animates that label rather than taking a row of its own.
|
|
30
32
|
*/
|
|
31
33
|
export declare function buildExecutionFrame(parent: Container, ui: TUI, colorKey: ExecutionColorKey): {
|
|
32
34
|
contentContainer: Container;
|
|
33
35
|
loader: Loader;
|
|
36
|
+
bottomBorder: DynamicBorder;
|
|
34
37
|
};
|
|
38
|
+
/** The bottom-border marker of a settled run: `exit N` for a failure, `cancelled` for a cancel. */
|
|
39
|
+
export declare function executionStatusLabel(status: Exclude<ExecutionStatus, "running">, exitCode: number | undefined): string | undefined;
|
|
35
40
|
/**
|
|
36
|
-
* Build the post-run status block (hidden-line hint,
|
|
37
|
-
*
|
|
38
|
-
*
|
|
41
|
+
* Build the post-run status block (hidden-line hint, truncation notice).
|
|
42
|
+
* Returns undefined when there is nothing to display so callers can skip
|
|
43
|
+
* appending a stray Text child.
|
|
39
44
|
*/
|
|
40
45
|
export declare function buildStatusFooter(opts: {
|
|
41
|
-
status: ExecutionStatus;
|
|
42
|
-
exitCode: number | undefined;
|
|
43
46
|
truncation: TruncationMeta | undefined;
|
|
44
47
|
artifactError?: OutputArtifactError;
|
|
48
|
+
minimized?: MinimizedMeta;
|
|
45
49
|
hiddenLineCount: number;
|
|
46
50
|
/** Suppress the "… N more lines" hint (used when sixel passthrough renders the full output). */
|
|
47
51
|
suppressHiddenCount?: boolean;
|
|
@@ -64,6 +68,7 @@ export interface ExecutionCardInput {
|
|
|
64
68
|
readonly exitCode: number | undefined;
|
|
65
69
|
readonly truncation: TruncationMeta | undefined;
|
|
66
70
|
readonly artifactError?: OutputArtifactError;
|
|
71
|
+
readonly minimized?: MinimizedMeta;
|
|
67
72
|
}
|
|
68
73
|
/**
|
|
69
74
|
* Native card shared by user bash/eval runs: the head with a live `elapsed`
|
|
@@ -94,6 +99,7 @@ export interface ExecutionToolInput {
|
|
|
94
99
|
readonly exitCode: number | undefined;
|
|
95
100
|
readonly truncation: TruncationMeta | undefined;
|
|
96
101
|
readonly artifactError?: OutputArtifactError;
|
|
102
|
+
readonly minimized?: MinimizedMeta;
|
|
97
103
|
}
|
|
98
104
|
/**
|
|
99
105
|
* A user `!`/`$` run as the agent's `tool` frame (§6.6): a head with a `you`
|
|
@@ -10,9 +10,15 @@
|
|
|
10
10
|
import { Loader } from "../components/loader";
|
|
11
11
|
import { Text } from "../components/text";
|
|
12
12
|
import { Container, type TUI } from "../tui";
|
|
13
|
-
import {
|
|
13
|
+
import { theme } from "../theme/theme";
|
|
14
14
|
import type { OutputArtifactError } from "../tools/streaming-output";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
formatArtifactErrorNotice,
|
|
17
|
+
formatMinimizedMeta,
|
|
18
|
+
formatTruncationMetaNotice,
|
|
19
|
+
type MinimizedMeta,
|
|
20
|
+
type TruncationMeta,
|
|
21
|
+
} from "../tools/output-meta";
|
|
16
22
|
import { DynamicBorder } from "../chrome/dynamic-border";
|
|
17
23
|
import { Ellipsis, truncateToWidth, visibleWidth } from "../utils";
|
|
18
24
|
import { interruptKey } from "../chrome/keybinding-hints";
|
|
@@ -46,14 +52,15 @@ export type ExecutionColorKey = "dim" | "bashMode" | "pythonMode";
|
|
|
46
52
|
/**
|
|
47
53
|
* Build the spacer + top border + content container + bottom border scaffold
|
|
48
54
|
* that bash and eval execution components share. The caller appends the
|
|
49
|
-
* header (command vs `>>>` prompt) and the
|
|
50
|
-
* `
|
|
55
|
+
* header (command vs `>>>` prompt) to `contentContainer` and keeps the run's
|
|
56
|
+
* state in `bottomBorder` ({@link executionStatusLabel}); the returned loader
|
|
57
|
+
* animates that label rather than taking a row of its own.
|
|
51
58
|
*/
|
|
52
59
|
export function buildExecutionFrame(
|
|
53
60
|
parent: Container,
|
|
54
61
|
ui: TUI,
|
|
55
62
|
colorKey: ExecutionColorKey,
|
|
56
|
-
): { contentContainer: Container; loader: Loader } {
|
|
63
|
+
): { contentContainer: Container; loader: Loader; bottomBorder: DynamicBorder } {
|
|
57
64
|
const borderColor = (str: string) => theme.fg(colorKey, str);
|
|
58
65
|
|
|
59
66
|
parent.addChild(new DynamicBorder(borderColor));
|
|
@@ -66,23 +73,35 @@ export function buildExecutionFrame(
|
|
|
66
73
|
spinner => theme.fg(colorKey, spinner),
|
|
67
74
|
text => theme.fg("muted", text),
|
|
68
75
|
`Running… (${interruptKey()} to cancel)`,
|
|
69
|
-
|
|
76
|
+
// The status spinner, as on a running tool card's header.
|
|
77
|
+
theme.spinnerFrames,
|
|
70
78
|
);
|
|
71
79
|
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
const bottomBorder = new DynamicBorder(borderColor);
|
|
81
|
+
bottomBorder.setLabel(() => loader.inlineText());
|
|
82
|
+
parent.addChild(bottomBorder);
|
|
83
|
+
return { contentContainer, loader, bottomBorder };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** The bottom-border marker of a settled run: `exit N` for a failure, `cancelled` for a cancel. */
|
|
87
|
+
export function executionStatusLabel(
|
|
88
|
+
status: Exclude<ExecutionStatus, "running">,
|
|
89
|
+
exitCode: number | undefined,
|
|
90
|
+
): string | undefined {
|
|
91
|
+
if (status === "cancelled") return theme.fg("warning", "cancelled");
|
|
92
|
+
if (status === "error") return theme.fg("error", `exit ${exitCode}`);
|
|
93
|
+
return undefined;
|
|
74
94
|
}
|
|
75
95
|
|
|
76
96
|
/**
|
|
77
|
-
* Build the post-run status block (hidden-line hint,
|
|
78
|
-
*
|
|
79
|
-
*
|
|
97
|
+
* Build the post-run status block (hidden-line hint, truncation notice).
|
|
98
|
+
* Returns undefined when there is nothing to display so callers can skip
|
|
99
|
+
* appending a stray Text child.
|
|
80
100
|
*/
|
|
81
101
|
export function buildStatusFooter(opts: {
|
|
82
|
-
status: ExecutionStatus;
|
|
83
|
-
exitCode: number | undefined;
|
|
84
102
|
truncation: TruncationMeta | undefined;
|
|
85
103
|
artifactError?: OutputArtifactError;
|
|
104
|
+
minimized?: MinimizedMeta;
|
|
86
105
|
hiddenLineCount: number;
|
|
87
106
|
/** Suppress the "… N more lines" hint (used when sixel passthrough renders the full output). */
|
|
88
107
|
suppressHiddenCount?: boolean;
|
|
@@ -92,17 +111,15 @@ export function buildStatusFooter(opts: {
|
|
|
92
111
|
if (opts.hiddenLineCount > 0 && !opts.suppressHiddenCount) {
|
|
93
112
|
parts.push(theme.fg("dim", `… ${opts.hiddenLineCount} more lines (${expandKeyHint()} to expand)`));
|
|
94
113
|
}
|
|
95
|
-
if (opts.status === "cancelled") {
|
|
96
|
-
parts.push(theme.fg("warning", "(cancelled)"));
|
|
97
|
-
} else if (opts.status === "error") {
|
|
98
|
-
parts.push(theme.fg("error", `(exit ${opts.exitCode})`));
|
|
99
|
-
}
|
|
100
114
|
if (opts.truncation) {
|
|
101
115
|
parts.push(theme.fg("warning", formatTruncationMetaNotice(opts.truncation)));
|
|
102
116
|
}
|
|
103
117
|
if (opts.artifactError) {
|
|
104
118
|
parts.push(theme.fg("warning", formatArtifactErrorNotice(opts.artifactError)));
|
|
105
119
|
}
|
|
120
|
+
if (opts.minimized) {
|
|
121
|
+
parts.push(theme.fg("dim", `Minimized: ${formatMinimizedMeta(opts.minimized)}`));
|
|
122
|
+
}
|
|
106
123
|
|
|
107
124
|
if (parts.length === 0) return undefined;
|
|
108
125
|
return new Text(`\n${parts.join("\n")}`, 1, 0);
|
|
@@ -133,6 +150,7 @@ export interface ExecutionCardInput {
|
|
|
133
150
|
readonly exitCode: number | undefined;
|
|
134
151
|
readonly truncation: TruncationMeta | undefined;
|
|
135
152
|
readonly artifactError?: OutputArtifactError;
|
|
153
|
+
readonly minimized?: MinimizedMeta;
|
|
136
154
|
}
|
|
137
155
|
|
|
138
156
|
/**
|
|
@@ -170,6 +188,7 @@ export function describeExecutionCard(input: ExecutionCardInput): NativeNode {
|
|
|
170
188
|
if (input.status === "cancelled") note("(cancelled)", "warning");
|
|
171
189
|
else if (input.status === "error") note(`(exit ${input.exitCode})`, "error");
|
|
172
190
|
if (input.truncation) note(formatTruncationMetaNotice(input.truncation), "warning");
|
|
191
|
+
if (input.minimized) note(`Minimized: ${formatMinimizedMeta(input.minimized)}`, "muted");
|
|
173
192
|
if (input.artifactError) note(formatArtifactErrorNotice(input.artifactError), "warning");
|
|
174
193
|
if (notes.length > 0) children.push(text(notes, { wrap: "word", key: "notes" }));
|
|
175
194
|
return card(
|
|
@@ -207,6 +226,7 @@ export interface ExecutionToolInput {
|
|
|
207
226
|
readonly exitCode: number | undefined;
|
|
208
227
|
readonly truncation: TruncationMeta | undefined;
|
|
209
228
|
readonly artifactError?: OutputArtifactError;
|
|
229
|
+
readonly minimized?: MinimizedMeta;
|
|
210
230
|
}
|
|
211
231
|
|
|
212
232
|
const EXECUTION_RUN_STATE: Record<ExecutionStatus, RunState> = {
|
|
@@ -244,6 +264,7 @@ export function describeExecutionTool(input: ExecutionToolInput): NativeNode {
|
|
|
244
264
|
state,
|
|
245
265
|
exitCode: input.exitCode,
|
|
246
266
|
elapsedMs: ms,
|
|
267
|
+
facts: input.minimized ? [`Minimized ${formatMinimizedMeta(input.minimized)}`] : undefined,
|
|
247
268
|
meta: { truncation: input.truncation, artifactError: input.artifactError },
|
|
248
269
|
}),
|
|
249
270
|
],
|
|
@@ -8,6 +8,8 @@ export interface FigureMarkdownOptions {
|
|
|
8
8
|
charts: boolean;
|
|
9
9
|
/** Shared inline-image budget for the figures. */
|
|
10
10
|
budget?: ImageBudget;
|
|
11
|
+
/** Rows each figure may fill, read on every render; callers reserve prose, chrome and separators themselves. Unset or `undefined` takes a share of the terminal viewport. */
|
|
12
|
+
maxRows?: () => number | undefined;
|
|
11
13
|
/** A figure's rows changed outside a text update (raster landed, fell back to code). */
|
|
12
14
|
onChange: () => void;
|
|
13
15
|
}
|