@linxiraos/pi-tui 1.4.6 → 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 +162 -244
- package/README.md +41 -35
- package/dist/types/app-keybindings.d.ts +20 -0
- package/dist/types/apps/session-picker.d.ts +5 -0
- package/dist/types/charts/chart-plan.d.ts +9 -7
- package/dist/types/charts/table-data.d.ts +4 -2
- package/dist/types/chat/assistant-message.d.ts +15 -3
- package/dist/types/chat/bash-execution.d.ts +6 -1
- package/dist/types/chat/display-preferences.d.ts +2 -0
- package/dist/types/chat/eval-execution.d.ts +2 -0
- package/dist/types/chat/execution-shared.d.ts +14 -8
- package/dist/types/chat/extension-types.d.ts +31 -0
- package/dist/types/chat/figure-markdown.d.ts +2 -0
- package/dist/types/chat/reply-write.d.ts +48 -0
- package/dist/types/chat/svg-figure.d.ts +5 -0
- package/dist/types/chat/table-chart.d.ts +6 -3
- package/dist/types/chat/tool-execution.d.ts +1 -2
- package/dist/types/chat/transcript-outline.d.ts +7 -0
- package/dist/types/chat/transcript-render-helpers.d.ts +13 -3
- package/dist/types/chrome/dynamic-border.d.ts +6 -0
- package/dist/types/chrome/index.d.ts +1 -0
- package/dist/types/chrome/transcript-notice.d.ts +35 -0
- package/dist/types/chrome/transcript-status.d.ts +21 -9
- package/dist/types/components/editor.d.ts +23 -6
- package/dist/types/components/image.d.ts +6 -0
- package/dist/types/components/loader.d.ts +2 -0
- package/dist/types/components/markdown.d.ts +7 -0
- package/dist/types/keybinding-matchers.d.ts +7 -0
- package/dist/types/native/blobs.d.ts +2 -1
- 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/picker.d.ts +4 -4
- package/dist/types/native/state.d.ts +4 -0
- package/dist/types/overlays/annotation-overlay.d.ts +7 -1
- package/dist/types/overlays/annotation-types.d.ts +28 -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/login-dialog.d.ts +5 -1
- package/dist/types/overlays/model-browser.d.ts +11 -2
- package/dist/types/overlays/oauth-selector.d.ts +23 -0
- package/dist/types/overlays/plan-review-overlay.d.ts +2 -0
- package/dist/types/overlays/rewind-selector.d.ts +1 -1
- package/dist/types/overlays/session-selector.d.ts +33 -4
- package/dist/types/prompt/composer.d.ts +56 -5
- package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
- package/dist/types/render/extension-links.d.ts +65 -0
- package/dist/types/render/hyperlink.d.ts +25 -7
- package/dist/types/render/index.d.ts +1 -0
- package/dist/types/render/render-utils.d.ts +23 -1
- package/dist/types/setup/scenes/glyph.d.ts +1 -1
- package/dist/types/setup/scenes/model.d.ts +1 -1
- package/dist/types/setup/scenes/outro.d.ts +5 -4
- package/dist/types/setup/scenes/sign-in.d.ts +13 -8
- package/dist/types/setup/scenes/types.d.ts +16 -1
- package/dist/types/setup/startup-splash.d.ts +1 -1
- package/dist/types/setup/wizard-overlay.d.ts +11 -7
- package/dist/types/setup/wizard.d.ts +5 -1
- package/dist/types/status-line/component.d.ts +1 -1
- package/dist/types/status-line/context-usage.d.ts +28 -6
- package/dist/types/status-line/host.d.ts +6 -2
- 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 -24
- 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/bash-interactive.d.ts +6 -0
- package/dist/types/tools/bash.d.ts +2 -0
- package/dist/types/tools/default-renderer.d.ts +6 -4
- 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/irc.d.ts +6 -0
- package/dist/types/tools/json-tree.d.ts +23 -4
- package/dist/types/tools/lsp.d.ts +2 -0
- package/dist/types/tools/mcp.d.ts +6 -5
- package/dist/types/tools/native-view.d.ts +3 -1
- package/dist/types/tools/output-meta.d.ts +27 -0
- package/dist/types/tools/read.d.ts +14 -4
- package/dist/types/tools/renderer.d.ts +2 -0
- package/dist/types/tools/streaming-output.d.ts +11 -0
- package/dist/types/tools/task.d.ts +13 -4
- package/dist/types/tools/url-scheme-host.d.ts +17 -0
- package/dist/types/tools/wait.d.ts +2 -0
- package/dist/types/tools/yield.d.ts +1 -1
- package/dist/types/tui.d.ts +19 -2
- package/dist/types/utils.d.ts +4 -0
- package/package.json +10 -14
- package/src/app-keybindings.d.ts +20 -0
- package/src/app-keybindings.ts +20 -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/apps/session-picker.ts +7 -0
- package/src/charts/chart-plan.d.ts +9 -7
- package/src/charts/chart-plan.ts +20 -79
- package/src/charts/table-data.d.ts +4 -2
- package/src/charts/table-data.ts +55 -6
- package/src/chat/advisor-message.ts +2 -0
- package/src/chat/assistant-message.d.ts +15 -3
- package/src/chat/assistant-message.ts +137 -19
- package/src/chat/background-tan-message.ts +4 -0
- package/src/chat/bash-execution.d.ts +6 -1
- package/src/chat/bash-execution.ts +26 -9
- package/src/chat/chat-transcript-builder.ts +63 -30
- package/src/chat/compaction-summary-message.ts +2 -1
- package/src/chat/display-preferences.d.ts +2 -0
- package/src/chat/display-preferences.ts +3 -0
- 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/extension-types.d.ts +31 -0
- package/src/chat/extension-types.ts +34 -0
- 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/reply-write.d.ts +48 -0
- package/src/chat/reply-write.ts +127 -0
- package/src/chat/svg-figure.d.ts +5 -0
- package/src/chat/svg-figure.ts +55 -16
- package/src/chat/table-chart.d.ts +6 -3
- package/src/chat/table-chart.ts +29 -6
- package/src/chat/tool-execution.d.ts +1 -2
- package/src/chat/tool-execution.ts +20 -13
- package/src/chat/transcript-outline.d.ts +7 -0
- package/src/chat/transcript-outline.ts +27 -0
- package/src/chat/transcript-render-helpers.d.ts +13 -3
- package/src/chat/transcript-render-helpers.ts +134 -44
- package/src/chrome/dynamic-border.d.ts +6 -0
- package/src/chrome/dynamic-border.ts +28 -2
- package/src/chrome/index.ts +1 -0
- package/src/chrome/transcript-notice.d.ts +35 -0
- package/src/chrome/transcript-notice.ts +83 -0
- package/src/chrome/transcript-status.d.ts +21 -9
- package/src/chrome/transcript-status.ts +32 -30
- package/src/components/editor.d.ts +23 -6
- package/src/components/editor.ts +133 -25
- 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/markdown.d.ts +7 -0
- package/src/components/markdown.ts +116 -6
- package/src/components/section.ts +1 -9
- package/src/components/table.ts +1 -9
- package/src/hotkeys-markdown.ts +1 -0
- package/src/keybinding-matchers.d.ts +7 -0
- package/src/keybinding-matchers.ts +13 -0
- package/src/native/backend.ts +10 -67
- package/src/native/blobs.d.ts +2 -1
- package/src/native/blobs.ts +3 -2
- 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/picker.d.ts +4 -4
- package/src/native/picker.ts +4 -4
- package/src/native/state.d.ts +4 -0
- package/src/native/state.ts +25 -5
- package/src/overlays/advisor-config.ts +1 -10
- package/src/overlays/annotation-overlay.ts +125 -37
- package/src/overlays/annotation-types.ts +24 -0
- 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/hook-selector.ts +2 -2
- package/src/overlays/jobs-panel.ts +82 -22
- package/src/overlays/login-dialog.ts +39 -31
- package/src/overlays/mcp-add-wizard.ts +1 -1
- package/src/overlays/model-browser.ts +106 -10
- package/src/overlays/model-hub.ts +1 -7
- package/src/overlays/model-picker.ts +1 -10
- package/src/overlays/oauth-selector.ts +44 -6
- package/src/overlays/plan-review-overlay.ts +13 -2
- package/src/overlays/rewind-selector.ts +29 -12
- package/src/overlays/session-selector.ts +338 -47
- package/src/overlays/settings-defs.ts +2 -2
- package/src/overlays/tree-selector.ts +83 -27
- package/src/overlays/usage-dashboard.ts +9 -18
- package/src/prompt/composer.ts +233 -6
- package/src/prompt/custom-editor.ts +6 -1
- package/src/prompt/emoji-autocomplete.ts +0 -2
- package/src/prompt/interactive-context-helpers.ts +29 -4
- package/src/render/code-cell.ts +1 -1
- package/src/render/extension-links.d.ts +65 -0
- package/src/render/extension-links.ts +214 -0
- package/src/render/file-list.ts +4 -7
- package/src/render/hyperlink.d.ts +25 -7
- package/src/render/hyperlink.ts +65 -9
- package/src/render/index.d.ts +1 -0
- package/src/render/index.ts +1 -0
- package/src/render/render-utils.d.ts +23 -1
- package/src/render/render-utils.ts +38 -6
- package/src/setup/scenes/composer.ts +2 -0
- package/src/setup/scenes/glyph.ts +4 -2
- package/src/setup/scenes/model.ts +192 -29
- package/src/setup/scenes/outro.ts +33 -15
- package/src/setup/scenes/sign-in.ts +196 -400
- package/src/setup/scenes/theme.ts +2 -0
- package/src/setup/scenes/types.ts +18 -1
- package/src/setup/startup-splash.ts +8 -7
- package/src/setup/wizard-overlay.ts +164 -35
- package/src/setup/wizard.ts +11 -2
- package/src/status-line/component.ts +4 -10
- package/src/status-line/context-usage.ts +72 -21
- package/src/status-line/host.ts +6 -2
- 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/terminal.ts +24 -2
- package/src/theme/defaults.json +1 -0
- package/src/theme/loader.ts +1 -1
- 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 -24
- package/src/theme/theme.ts +3 -75
- 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-interactive.d.ts +49 -0
- package/src/tools/bash-interactive.ts +6 -1
- package/src/tools/bash.d.ts +2 -0
- package/src/tools/bash.ts +9 -0
- package/src/tools/default-renderer.d.ts +6 -4
- package/src/tools/default-renderer.ts +10 -7
- package/src/tools/edit.ts +50 -43
- package/src/tools/eval.d.ts +2 -0
- package/src/tools/eval.ts +16 -4
- 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/irc.d.ts +6 -0
- package/src/tools/irc.ts +6 -0
- package/src/tools/job-widget.ts +13 -1
- package/src/tools/json-tree.d.ts +23 -4
- package/src/tools/json-tree.ts +132 -46
- package/src/tools/lsp.d.ts +2 -0
- package/src/tools/lsp.ts +246 -47
- package/src/tools/mcp.d.ts +6 -5
- package/src/tools/mcp.ts +20 -12
- package/src/tools/native-view.d.ts +3 -1
- package/src/tools/native-view.ts +12 -6
- 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/renderer.d.ts +2 -0
- package/src/tools/renderer.ts +2 -0
- package/src/tools/streaming-output.d.ts +11 -0
- package/src/tools/streaming-output.ts +41 -0
- package/src/tools/task.d.ts +13 -4
- package/src/tools/task.ts +100 -97
- package/src/tools/url-scheme-host.d.ts +17 -0
- package/src/tools/url-scheme-host.ts +21 -0
- 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.d.ts +1 -1
- package/src/tools/yield.ts +19 -10
- package/src/tui.d.ts +19 -2
- package/src/tui.ts +134 -24
- package/src/utils.d.ts +4 -0
- package/src/utils.ts +10 -0
- package/dist/types/theme/defaults/index.d.ts +0 -10289
- package/src/theme/defaults/alabaster.json +0 -103
- package/src/theme/defaults/amethyst.json +0 -106
- package/src/theme/defaults/anthracite.json +0 -103
- package/src/theme/defaults/basalt.json +0 -101
- package/src/theme/defaults/birch.json +0 -105
- package/src/theme/defaults/dark-abyss.json +0 -101
- package/src/theme/defaults/dark-arctic.json +0 -114
- package/src/theme/defaults/dark-aurora.json +0 -105
- package/src/theme/defaults/dark-catppuccin.json +0 -117
- package/src/theme/defaults/dark-cavern.json +0 -101
- package/src/theme/defaults/dark-celestial.json +0 -116
- package/src/theme/defaults/dark-copper.json +0 -105
- package/src/theme/defaults/dark-cosmos.json +0 -100
- package/src/theme/defaults/dark-cyberpunk.json +0 -112
- package/src/theme/defaults/dark-dracula.json +0 -108
- package/src/theme/defaults/dark-eclipse.json +0 -101
- package/src/theme/defaults/dark-ember.json +0 -105
- package/src/theme/defaults/dark-equinox.json +0 -100
- package/src/theme/defaults/dark-forest.json +0 -106
- package/src/theme/defaults/dark-github.json +0 -115
- package/src/theme/defaults/dark-gruvbox.json +0 -122
- package/src/theme/defaults/dark-lavender.json +0 -105
- package/src/theme/defaults/dark-lunar.json +0 -99
- package/src/theme/defaults/dark-midnight.json +0 -105
- package/src/theme/defaults/dark-monochrome.json +0 -104
- package/src/theme/defaults/dark-monokai.json +0 -108
- package/src/theme/defaults/dark-nebula.json +0 -100
- package/src/theme/defaults/dark-neon-noir.json +0 -110
- package/src/theme/defaults/dark-nord.json +0 -108
- package/src/theme/defaults/dark-ocean.json +0 -111
- package/src/theme/defaults/dark-one.json +0 -110
- package/src/theme/defaults/dark-poimandres.json +0 -125
- package/src/theme/defaults/dark-rainforest.json +0 -101
- package/src/theme/defaults/dark-reef.json +0 -101
- package/src/theme/defaults/dark-retro.json +0 -102
- package/src/theme/defaults/dark-rose-pine.json +0 -106
- package/src/theme/defaults/dark-sakura.json +0 -105
- package/src/theme/defaults/dark-slate.json +0 -105
- package/src/theme/defaults/dark-solarized.json +0 -107
- package/src/theme/defaults/dark-solstice.json +0 -100
- package/src/theme/defaults/dark-starfall.json +0 -101
- package/src/theme/defaults/dark-sunset.json +0 -109
- package/src/theme/defaults/dark-swamp.json +0 -100
- package/src/theme/defaults/dark-synthwave.json +0 -113
- package/src/theme/defaults/dark-taiga.json +0 -101
- package/src/theme/defaults/dark-terminal.json +0 -105
- package/src/theme/defaults/dark-tokyo-night.json +0 -111
- package/src/theme/defaults/dark-tundra.json +0 -101
- package/src/theme/defaults/dark-twilight.json +0 -101
- package/src/theme/defaults/dark-volcanic.json +0 -101
- package/src/theme/defaults/graphite.json +0 -102
- package/src/theme/defaults/index.d.ts +0 -10289
- package/src/theme/defaults/index.ts +0 -203
- package/src/theme/defaults/light-arctic.json +0 -117
- package/src/theme/defaults/light-aurora-day.json +0 -101
- package/src/theme/defaults/light-canyon.json +0 -101
- package/src/theme/defaults/light-catppuccin.json +0 -116
- package/src/theme/defaults/light-cirrus.json +0 -100
- package/src/theme/defaults/light-coral.json +0 -105
- package/src/theme/defaults/light-cyberpunk.json +0 -106
- package/src/theme/defaults/light-dawn.json +0 -100
- package/src/theme/defaults/light-dunes.json +0 -101
- package/src/theme/defaults/light-eucalyptus.json +0 -105
- package/src/theme/defaults/light-forest.json +0 -110
- package/src/theme/defaults/light-frost.json +0 -105
- package/src/theme/defaults/light-github.json +0 -125
- package/src/theme/defaults/light-glacier.json +0 -101
- package/src/theme/defaults/light-gruvbox.json +0 -118
- package/src/theme/defaults/light-haze.json +0 -100
- package/src/theme/defaults/light-honeycomb.json +0 -105
- package/src/theme/defaults/light-lagoon.json +0 -101
- package/src/theme/defaults/light-lavender.json +0 -105
- package/src/theme/defaults/light-meadow.json +0 -101
- package/src/theme/defaults/light-mint.json +0 -105
- package/src/theme/defaults/light-monochrome.json +0 -111
- package/src/theme/defaults/light-ocean.json +0 -109
- package/src/theme/defaults/light-one.json +0 -109
- package/src/theme/defaults/light-opal.json +0 -101
- package/src/theme/defaults/light-orchard.json +0 -101
- package/src/theme/defaults/light-paper.json +0 -105
- package/src/theme/defaults/light-poimandres.json +0 -125
- package/src/theme/defaults/light-prism.json +0 -100
- package/src/theme/defaults/light-retro.json +0 -108
- package/src/theme/defaults/light-sand.json +0 -105
- package/src/theme/defaults/light-savanna.json +0 -101
- package/src/theme/defaults/light-solarized.json +0 -112
- package/src/theme/defaults/light-soleil.json +0 -100
- package/src/theme/defaults/light-sunset.json +0 -109
- package/src/theme/defaults/light-synthwave.json +0 -108
- package/src/theme/defaults/light-tokyo-night.json +0 -121
- package/src/theme/defaults/light-wetland.json +0 -101
- package/src/theme/defaults/light-zenith.json +0 -99
- package/src/theme/defaults/limestone.json +0 -104
- package/src/theme/defaults/mahogany.json +0 -107
- package/src/theme/defaults/marble.json +0 -103
- package/src/theme/defaults/obsidian.json +0 -101
- package/src/theme/defaults/onyx.json +0 -101
- package/src/theme/defaults/pearl.json +0 -103
- package/src/theme/defaults/porcelain.json +0 -101
- package/src/theme/defaults/quartz.json +0 -106
- package/src/theme/defaults/sandstone.json +0 -105
- package/src/theme/defaults/titanium.json +0 -100
|
@@ -19,10 +19,11 @@ export interface TableChartRequest {
|
|
|
19
19
|
readonly guess: ChartPlan;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Picks the chart for a
|
|
23
|
-
*
|
|
22
|
+
* Picks the chart for a table under `smart`: a plan, or `null` for no chart.
|
|
23
|
+
* A rejection falls back to the local guess; `undefined` (no judge to ask
|
|
24
|
+
* right now) keeps the guess at once, exactly as `always` would draw it.
|
|
24
25
|
*/
|
|
25
|
-
export type TableChartPlanner = (request: TableChartRequest) => Promise<ChartPlan | null
|
|
26
|
+
export type TableChartPlanner = (request: TableChartRequest) => Promise<ChartPlan | null> | undefined;
|
|
26
27
|
/**
|
|
27
28
|
* The chart under a table: its SVG, colored with figure tokens (`var(--accent)`, …)
|
|
28
29
|
* still to resolve; none; or a smart pick on its way (the promise settles once the cache holds it).
|
|
@@ -63,6 +64,8 @@ export declare function chartFence(svg: string): string;
|
|
|
63
64
|
export interface TableChartFigureOptions {
|
|
64
65
|
/** Shared inline-image budget. */
|
|
65
66
|
budget?: ImageBudget;
|
|
67
|
+
/** Rows the chart may fill, its separator included, read on every render; under two hides it. Unset or `undefined` takes a share of the terminal viewport. */
|
|
68
|
+
maxRows?: () => number | undefined;
|
|
66
69
|
/** The chart's rows changed outside a text update: its pick or raster landed. */
|
|
67
70
|
onChange: () => void;
|
|
68
71
|
}
|
package/src/chat/table-chart.ts
CHANGED
|
@@ -37,10 +37,11 @@ export interface TableChartRequest {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* Picks the chart for a
|
|
41
|
-
*
|
|
40
|
+
* Picks the chart for a table under `smart`: a plan, or `null` for no chart.
|
|
41
|
+
* A rejection falls back to the local guess; `undefined` (no judge to ask
|
|
42
|
+
* right now) keeps the guess at once, exactly as `always` would draw it.
|
|
42
43
|
*/
|
|
43
|
-
export type TableChartPlanner = (request: TableChartRequest) => Promise<ChartPlan | null
|
|
44
|
+
export type TableChartPlanner = (request: TableChartRequest) => Promise<ChartPlan | null> | undefined;
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* The chart under a table: its SVG, colored with figure tokens (`var(--accent)`, …)
|
|
@@ -126,7 +127,12 @@ export function lookupTableChart(table: Tokens.Table): ChartLookup {
|
|
|
126
127
|
if (entry.chart !== undefined) return entry.chart;
|
|
127
128
|
if (entry.pending) return entry.pending;
|
|
128
129
|
const { analysis, guess } = entry;
|
|
129
|
-
|
|
130
|
+
const pick = chartPlanner!({ markdown: table.raw, table: analysis, guess: guess! });
|
|
131
|
+
if (!pick) {
|
|
132
|
+
entry.chart = drawChart(analysis, guess!, true);
|
|
133
|
+
return entry.chart;
|
|
134
|
+
}
|
|
135
|
+
entry.pending = pick.then(
|
|
130
136
|
plan => {
|
|
131
137
|
entry.chart = plan ? drawChart(analysis, plan) : null;
|
|
132
138
|
},
|
|
@@ -188,6 +194,8 @@ export function chartFence(svg: string): string {
|
|
|
188
194
|
export interface TableChartFigureOptions {
|
|
189
195
|
/** Shared inline-image budget. */
|
|
190
196
|
budget?: ImageBudget;
|
|
197
|
+
/** Rows the chart may fill, its separator included, read on every render; under two hides it. Unset or `undefined` takes a share of the terminal viewport. */
|
|
198
|
+
maxRows?: () => number | undefined;
|
|
191
199
|
/** The chart's rows changed outside a text update: its pick or raster landed. */
|
|
192
200
|
onChange: () => void;
|
|
193
201
|
}
|
|
@@ -209,7 +217,17 @@ export class TableChartFigure implements Component {
|
|
|
209
217
|
|
|
210
218
|
constructor(options: TableChartFigureOptions) {
|
|
211
219
|
this.#options = options;
|
|
212
|
-
this.#figure = new SvgFigure({
|
|
220
|
+
this.#figure = new SvgFigure({
|
|
221
|
+
budget: options.budget,
|
|
222
|
+
maxRows: () => this.#figureRows(),
|
|
223
|
+
onChange: options.onChange,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** The image's share of the caller's ceiling: all but the separator row. */
|
|
228
|
+
#figureRows(): number | undefined {
|
|
229
|
+
const rows = this.#options.maxRows?.();
|
|
230
|
+
return rows === undefined ? undefined : Math.max(0, Math.floor(rows) - 1);
|
|
213
231
|
}
|
|
214
232
|
|
|
215
233
|
/** Point the figure at `table`. */
|
|
@@ -222,10 +240,15 @@ export class TableChartFigure implements Component {
|
|
|
222
240
|
|
|
223
241
|
/** Whether the chart is still being looked up, picked or drawn. */
|
|
224
242
|
get pending(): boolean {
|
|
225
|
-
return
|
|
243
|
+
return (
|
|
244
|
+
this.#figureRows() !== 0 &&
|
|
245
|
+
this.#table !== undefined &&
|
|
246
|
+
(this.#chart === undefined || (this.#chart !== null && this.#figure.pending))
|
|
247
|
+
);
|
|
226
248
|
}
|
|
227
249
|
|
|
228
250
|
render(width: number): readonly string[] {
|
|
251
|
+
if (this.#figureRows() === 0) return [];
|
|
229
252
|
if (this.#chart === undefined && !this.#waiting) this.#resolve();
|
|
230
253
|
if (!this.#chart) return [];
|
|
231
254
|
const rows = this.#figure.render(width);
|
|
@@ -35,7 +35,6 @@ export interface ToolExecutionHandle extends Component {
|
|
|
35
35
|
setArgsComplete(toolCallId?: string): void;
|
|
36
36
|
setExecutionStarted(toolCallId?: string): void;
|
|
37
37
|
setExpanded(expanded: boolean): void;
|
|
38
|
-
setToolActivityVisible(visible: boolean): void;
|
|
39
38
|
/** Mark the call parked: it returned, but stays tracked for async job frames. */
|
|
40
39
|
parkAsBackground(): void;
|
|
41
40
|
/** Seal the block as final history and stop its animations. */
|
|
@@ -102,7 +101,7 @@ export declare class ToolExecutionComponent extends Container {
|
|
|
102
101
|
* component-scoped so the TUI reuses every other root subtree (issue #4377).
|
|
103
102
|
*/
|
|
104
103
|
tickSpinner(frame: number): void;
|
|
105
|
-
/**
|
|
104
|
+
/** Hold visible results until their figures and Kitty images are ready for immutable scrollback. */
|
|
106
105
|
isTranscriptBlockPending(): boolean;
|
|
107
106
|
/**
|
|
108
107
|
* Whether this block is ready to retire as immutable history. Partial
|
|
@@ -126,6 +126,9 @@ function cardPreview(preview: NativeToolView["preview"]): TspPreview | undefined
|
|
|
126
126
|
/** The describe hooks of a registry renderer or of a custom tool object. */
|
|
127
127
|
type ToolDescriber = Pick<ToolRenderer, "describeCall" | "describeResult" | "mergeCallAndResult">;
|
|
128
128
|
|
|
129
|
+
/** Optional kinds of the host's vocabulary the describe hooks branch on. */
|
|
130
|
+
type NativeHostKinds = Required<Pick<RenderResultContextOptions, "media" | "json">>;
|
|
131
|
+
|
|
129
132
|
class SafeToolRendererComponent implements Component {
|
|
130
133
|
#toolName: string;
|
|
131
134
|
#stage: ToolRendererStage;
|
|
@@ -233,7 +236,6 @@ export interface ToolExecutionHandle extends Component {
|
|
|
233
236
|
setArgsComplete(toolCallId?: string): void;
|
|
234
237
|
setExecutionStarted(toolCallId?: string): void;
|
|
235
238
|
setExpanded(expanded: boolean): void;
|
|
236
|
-
setToolActivityVisible(visible: boolean): void;
|
|
237
239
|
/** Mark the call parked: it returned, but stays tracked for async job frames. */
|
|
238
240
|
parkAsBackground(): void;
|
|
239
241
|
/** Seal the block as final history and stop its animations. */
|
|
@@ -711,14 +713,15 @@ export class ToolExecutionComponent extends Container {
|
|
|
711
713
|
// Convert async - catch errors from processing
|
|
712
714
|
convertImageToPngShared(image)
|
|
713
715
|
.then(converted => {
|
|
716
|
+
this.#kittyConversionsAwaited.delete(key);
|
|
714
717
|
this.#kittyConverted.set(key, converted);
|
|
715
718
|
this.#displayInputVersion++;
|
|
716
719
|
this.#updateDisplay();
|
|
717
720
|
this.#ui.requestRender();
|
|
718
721
|
})
|
|
719
722
|
.catch(() => {
|
|
720
|
-
// Ignore conversion failures - display will use original image format
|
|
721
723
|
this.#kittyConversionsAwaited.delete(key);
|
|
724
|
+
this.#ui.requestRender();
|
|
722
725
|
});
|
|
723
726
|
}
|
|
724
727
|
}
|
|
@@ -859,9 +862,12 @@ export class ToolExecutionComponent extends Container {
|
|
|
859
862
|
}
|
|
860
863
|
}
|
|
861
864
|
|
|
862
|
-
/**
|
|
865
|
+
/** Hold visible results until their figures and Kitty images are ready for immutable scrollback. */
|
|
863
866
|
isTranscriptBlockPending(): boolean {
|
|
864
|
-
return
|
|
867
|
+
return (
|
|
868
|
+
this.#toolActivityVisible &&
|
|
869
|
+
((this.#showImages && this.#kittyConversionsAwaited.size > 0) || this.#figure?.pending === true)
|
|
870
|
+
);
|
|
865
871
|
}
|
|
866
872
|
|
|
867
873
|
/**
|
|
@@ -1018,7 +1024,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
1018
1024
|
override describe(cx?: DescribeContext): NativeNode {
|
|
1019
1025
|
if (this.#toolName === "wait" && this.#isBenignSkip()) return EMPTY_NODE;
|
|
1020
1026
|
const dataFirst = cx?.supports("tool") === true;
|
|
1021
|
-
const
|
|
1027
|
+
const host: NativeHostKinds = { media: cx?.supports("media") === true, json: cx?.supports("json") === true };
|
|
1022
1028
|
const key = [
|
|
1023
1029
|
dataFirst,
|
|
1024
1030
|
this.#resultVersion,
|
|
@@ -1031,11 +1037,12 @@ export class ToolExecutionComponent extends Container {
|
|
|
1031
1037
|
this.#showImages,
|
|
1032
1038
|
this.#displayInputVersion,
|
|
1033
1039
|
this.#toolActivityVisible,
|
|
1034
|
-
media,
|
|
1040
|
+
host.media,
|
|
1041
|
+
host.json,
|
|
1035
1042
|
getThemeEpoch(),
|
|
1036
1043
|
];
|
|
1037
1044
|
return this.#native.get(key, () =>
|
|
1038
|
-
withHidden(dataFirst ? this.#describeTool(
|
|
1045
|
+
withHidden(dataFirst ? this.#describeTool(host) : this.#describeCard(host), !this.#toolActivityVisible),
|
|
1039
1046
|
);
|
|
1040
1047
|
}
|
|
1041
1048
|
|
|
@@ -1081,8 +1088,8 @@ export class ToolExecutionComponent extends Container {
|
|
|
1081
1088
|
* The data-first `tool` node (§7.2): the renderer's head data, status,
|
|
1082
1089
|
* timer, exit and intent as props; its body as borderless children.
|
|
1083
1090
|
*/
|
|
1084
|
-
#describeTool(
|
|
1085
|
-
const view = this.#nativeView(
|
|
1091
|
+
#describeTool(host: NativeHostKinds): NativeNode {
|
|
1092
|
+
const view = this.#nativeView(host);
|
|
1086
1093
|
const status = this.#nativeStatus();
|
|
1087
1094
|
const head = view.tool;
|
|
1088
1095
|
const late = this.#lateDiagnosticsParts();
|
|
@@ -1151,8 +1158,8 @@ export class ToolExecutionComponent extends Container {
|
|
|
1151
1158
|
return spans;
|
|
1152
1159
|
}
|
|
1153
1160
|
|
|
1154
|
-
#describeCard(
|
|
1155
|
-
const view = this.#nativeView(
|
|
1161
|
+
#describeCard(host: NativeHostKinds): NativeNode {
|
|
1162
|
+
const view = this.#nativeView(host);
|
|
1156
1163
|
const status = this.#nativeStatus();
|
|
1157
1164
|
const late = this.#lateDiagnosticsParts();
|
|
1158
1165
|
const fallbackHead = this.#fallbackHead(view);
|
|
@@ -1206,10 +1213,10 @@ export class ToolExecutionComponent extends Container {
|
|
|
1206
1213
|
* the result view (merged renderers) or the call head over both bodies.
|
|
1207
1214
|
* A renderer that throws falls back to the generic card.
|
|
1208
1215
|
*/
|
|
1209
|
-
#nativeView(
|
|
1216
|
+
#nativeView(host: NativeHostKinds): NativeToolView {
|
|
1210
1217
|
const status = this.#nativeStatus();
|
|
1211
1218
|
const options: RenderResultContextOptions = {
|
|
1212
|
-
|
|
1219
|
+
...host,
|
|
1213
1220
|
expanded: this.#expanded,
|
|
1214
1221
|
isPartial: this.#isPartial,
|
|
1215
1222
|
argsComplete: this.#argsComplete,
|
|
@@ -9,6 +9,7 @@ import { type TranscriptEntryLike as TranscriptEntry } from "./transcript-entry"
|
|
|
9
9
|
import type { SessionMessageEntryLike as SessionMessageEntry } from "./transcript-entry";
|
|
10
10
|
import { type ThemeColor } from "../theme";
|
|
11
11
|
import type { ChatTranscriptBuilder } from "./chat-transcript-builder";
|
|
12
|
+
import type { DescribeContext } from "../native/node";
|
|
12
13
|
/** One selectable transcript item: a message entry plus its rendered block range. */
|
|
13
14
|
export interface OutlineTarget {
|
|
14
15
|
/** Entry the selection resolves to; extended over trailing componentless tool results. */
|
|
@@ -63,6 +64,12 @@ export declare class OutlineRowCache {
|
|
|
63
64
|
export declare function appendOutlineEntries(builder: ChatTranscriptBuilder, entries: TranscriptEntry[]): OutlineTarget[];
|
|
64
65
|
/** Per-target "renders at least one non-blank row" flags at the given rows. */
|
|
65
66
|
export declare function outlineVisibility(childRows: readonly (readonly string[])[], targets: readonly OutlineTarget[]): boolean[];
|
|
67
|
+
/**
|
|
68
|
+
* Per-target "describes something that shows" flags: {@link outlineVisibility}
|
|
69
|
+
* for a TSP page, where blocks describe nodes instead of rendering rows. An
|
|
70
|
+
* empty `col`/`row` (an interrupted turn with no output) shows nothing.
|
|
71
|
+
*/
|
|
72
|
+
export declare function describedVisibility(blocks: readonly Component[], targets: readonly OutlineTarget[], cx: DescribeContext): boolean[];
|
|
66
73
|
/** Dotted horizontal rule with rounded corners, spanning the outline width. */
|
|
67
74
|
export declare function outlineRule(left: string, right: string, innerWidth: number, color?: ThemeColor, caption?: string): string;
|
|
68
75
|
/** Wrap pre-rendered rows in the dotted outline (rules above/below, `┆` sides). */
|
|
@@ -17,6 +17,7 @@ import { type ThemeColor, theme } from "../theme";
|
|
|
17
17
|
import type { ChatTranscriptBuilder } from "./chat-transcript-builder";
|
|
18
18
|
import { padToWidth } from "../render/utils";
|
|
19
19
|
import { isUsageRowBlock } from "../overlays/usage-row";
|
|
20
|
+
import type { DescribeContext, NativeChild } from "../native/node";
|
|
20
21
|
|
|
21
22
|
/** One selectable transcript item: a message entry plus its rendered block range. */
|
|
22
23
|
export interface OutlineTarget {
|
|
@@ -148,6 +149,32 @@ export function outlineVisibility(
|
|
|
148
149
|
});
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Per-target "describes something that shows" flags: {@link outlineVisibility}
|
|
154
|
+
* for a TSP page, where blocks describe nodes instead of rendering rows. An
|
|
155
|
+
* empty `col`/`row` (an interrupted turn with no output) shows nothing.
|
|
156
|
+
*/
|
|
157
|
+
export function describedVisibility(
|
|
158
|
+
blocks: readonly Component[],
|
|
159
|
+
targets: readonly OutlineTarget[],
|
|
160
|
+
cx: DescribeContext,
|
|
161
|
+
): boolean[] {
|
|
162
|
+
return targets.map(target => {
|
|
163
|
+
for (let index = target.start; index < target.end; index++) {
|
|
164
|
+
if (shows(blocks[index]!, cx)) return true;
|
|
165
|
+
}
|
|
166
|
+
return false;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Whether `child` describes a node that shows: a layout `col`/`row` only through a child that does. */
|
|
171
|
+
function shows(child: NativeChild, cx: DescribeContext): boolean {
|
|
172
|
+
const node = "k" in child ? child : child.describe?.(cx);
|
|
173
|
+
if (!node) return false;
|
|
174
|
+
if (node.k !== "col" && node.k !== "row") return true;
|
|
175
|
+
return (node.c ?? []).some(grandchild => shows(grandchild, cx));
|
|
176
|
+
}
|
|
177
|
+
|
|
151
178
|
/** Dotted horizontal rule with rounded corners, spanning the outline width. */
|
|
152
179
|
export function outlineRule(
|
|
153
180
|
left: string,
|
|
@@ -8,6 +8,7 @@ import type { AgentMessage } from "@linxiraos/pi-agent-core";
|
|
|
8
8
|
import { type Component } from "../tui";
|
|
9
9
|
import { type FileMentionMessage } from "./messages";
|
|
10
10
|
import { ToolActivityContainer } from "../chrome/tool-activity";
|
|
11
|
+
import type { MessageRenderer } from "./extension-types";
|
|
11
12
|
import { type TranscriptBlock } from "../chrome/transcript-container";
|
|
12
13
|
type CustomOrHookMessage = Extract<AgentMessage, {
|
|
13
14
|
role: "custom" | "hookMessage";
|
|
@@ -21,6 +22,13 @@ type AssistantAgentMessage = Extract<AgentMessage, {
|
|
|
21
22
|
* row per job.
|
|
22
23
|
*/
|
|
23
24
|
export declare function buildAsyncResultBlock(message: CustomOrHookMessage): ToolActivityContainer;
|
|
25
|
+
/**
|
|
26
|
+
* The `async-result` card for both transcript surfaces: a registered renderer owns it (#14131);
|
|
27
|
+
* the built-in block covers no renderer, a declining renderer, and a throwing one.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildAsyncResultComponent(message: CustomOrHookMessage, renderer: MessageRenderer | undefined): Component & {
|
|
30
|
+
setExpanded(expanded: boolean): void;
|
|
31
|
+
};
|
|
24
32
|
/**
|
|
25
33
|
* Render a `launch-completion` custom message (terminal supervised-process
|
|
26
34
|
* exits from the launch broker) as a transcript block of one compact
|
|
@@ -28,9 +36,9 @@ export declare function buildAsyncResultBlock(message: CustomOrHookMessage): Too
|
|
|
28
36
|
*/
|
|
29
37
|
export declare function buildLaunchCompletionBlock(message: CustomOrHookMessage): ToolActivityContainer;
|
|
30
38
|
/**
|
|
31
|
-
* Render
|
|
32
|
-
* `irc:relay`) as a
|
|
33
|
-
* expanded-state getter for the cached card.
|
|
39
|
+
* Render an IRC coordination custom message (`irc:incoming` / `irc:autoreply` /
|
|
40
|
+
* `irc:relay` / `irc:workpool`) as a tool-activity card. `getExpanded` supplies
|
|
41
|
+
* the live expanded-state getter for the cached card.
|
|
34
42
|
*/
|
|
35
43
|
export declare function buildIrcMessageCard(message: CustomOrHookMessage, getExpanded: () => boolean): Component;
|
|
36
44
|
/**
|
|
@@ -55,6 +63,8 @@ export declare function assistantHasVisibleContent(message: AssistantAgentMessag
|
|
|
55
63
|
export declare function splitAssistantMessageToolTimeline(message: AssistantAgentMessage): {
|
|
56
64
|
beforeTools: AssistantAgentMessage;
|
|
57
65
|
afterToolCalls: ReadonlyMap<string, AssistantAgentMessage>;
|
|
66
|
+
/** Index in `message.content` of each after-tool segment's first block, by tool-call id. */
|
|
67
|
+
contentOffsets: ReadonlyMap<string, number>;
|
|
58
68
|
hasToolCalls: boolean;
|
|
59
69
|
lastToolCallId?: string;
|
|
60
70
|
};
|
|
@@ -5,16 +5,26 @@
|
|
|
5
5
|
* here keeps the two byte-for-byte identical.
|
|
6
6
|
*/
|
|
7
7
|
import type { AgentMessage } from "@linxiraos/pi-agent-core";
|
|
8
|
+
import type { TspSpan } from "@linxiraos/pi-wire";
|
|
8
9
|
import { type Component } from "../tui";
|
|
9
|
-
import { formatBytes, formatDuration } from "@linxiraos/pi-utils";
|
|
10
|
+
import { formatBytes, formatCount, formatDuration } from "@linxiraos/pi-utils";
|
|
11
|
+
import { span } from "../native/describe";
|
|
10
12
|
import type { JobSnapshot } from "../tools/wait";
|
|
11
13
|
import type { DaemonSnapshot } from "../tools/daemon";
|
|
12
14
|
import { type CustomMessage, type FileMentionMessage, resolveAbortLabel, shouldRenderAbortReason } from "./messages";
|
|
13
15
|
import { createIrcMessageCard } from "../tools/wait";
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
+
import {
|
|
17
|
+
formatArtifactErrorNotice,
|
|
18
|
+
formatMinimizedMeta,
|
|
19
|
+
type MinimizedMeta,
|
|
20
|
+
type OutputMeta,
|
|
21
|
+
} from "../tools/output-meta";
|
|
22
|
+
import type { OutputArtifactError } from "../tools/streaming-output";
|
|
23
|
+
import { formatStyledPath, replaceTabs, TRUNCATE_LENGTHS, truncateToWidth } from "../render/render-utils";
|
|
16
24
|
import { canonicalizeMessage } from "./thinking-display";
|
|
17
25
|
import { ToolActivityContainer } from "../chrome/tool-activity";
|
|
26
|
+
import { CustomMessageComponent } from "./custom-message";
|
|
27
|
+
import type { MessageRenderer } from "./extension-types";
|
|
18
28
|
import { type TranscriptBlock } from "../chrome/transcript-container";
|
|
19
29
|
import { TranscriptStatusBlock, type TranscriptStatusRow } from "../chrome/transcript-status";
|
|
20
30
|
import { theme } from "../theme";
|
|
@@ -58,26 +68,79 @@ export function buildAsyncResultBlock(message: CustomOrHookMessage): ToolActivit
|
|
|
58
68
|
const rows: TranscriptStatusRow[] = [];
|
|
59
69
|
for (const job of jobs) {
|
|
60
70
|
const jobId = job.jobId ?? "unknown";
|
|
61
|
-
const
|
|
71
|
+
const type = job.type ?? "job";
|
|
62
72
|
const duration = typeof job.durationMs === "number" ? formatDuration(job.durationMs) : undefined;
|
|
63
73
|
rows.push({
|
|
64
74
|
parts: [
|
|
65
|
-
{ text: `${theme.status.
|
|
66
|
-
{ text:
|
|
75
|
+
{ text: `${theme.status.success} Background job completed`, color: "success" },
|
|
76
|
+
{ text: `[${type}]`, color: "dim" },
|
|
67
77
|
{ text: jobId, color: "accent" },
|
|
68
78
|
duration ? { text: `(${duration})`, color: "dim" } : undefined,
|
|
69
79
|
],
|
|
80
|
+
native: {
|
|
81
|
+
tone: "success",
|
|
82
|
+
message: [span("Background job completed"), ...facts([type, jobId, duration])],
|
|
83
|
+
},
|
|
70
84
|
});
|
|
71
|
-
if (job.meta?.artifactError)
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (details?.meta?.artifactError) {
|
|
76
|
-
rows.push({ parts: [{ text: formatArtifactErrorNotice(details.meta.artifactError), color: "warning" }] });
|
|
85
|
+
if (job.meta?.artifactError) rows.push(artifactErrorRow(job.meta.artifactError));
|
|
86
|
+
if (job.meta?.minimized) rows.push(minimizedRow(job.meta.minimized));
|
|
77
87
|
}
|
|
88
|
+
if (details?.meta?.artifactError) rows.push(artifactErrorRow(details.meta.artifactError));
|
|
78
89
|
return new ToolActivityContainer(new TranscriptStatusBlock(rows));
|
|
79
90
|
}
|
|
80
91
|
|
|
92
|
+
/** Hosts an extension renderer; relays `display.hideToolActivity` to the nested built-in fallback block. */
|
|
93
|
+
class AsyncResultCard extends CustomMessageComponent {
|
|
94
|
+
readonly #block: ToolActivityContainer;
|
|
95
|
+
|
|
96
|
+
constructor(message: CustomOrHookMessage, renderer: MessageRenderer, block: ToolActivityContainer) {
|
|
97
|
+
super(message as CustomMessage<unknown>, (delegate, options, rendererTheme) => {
|
|
98
|
+
try {
|
|
99
|
+
return renderer(delegate, options, rendererTheme) ?? block;
|
|
100
|
+
} catch {
|
|
101
|
+
return block;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
this.#block = block;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
setToolActivityVisible(visible: boolean): void {
|
|
108
|
+
this.#block.setToolActivityVisible(visible);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The `async-result` card for both transcript surfaces: a registered renderer owns it (#14131);
|
|
114
|
+
* the built-in block covers no renderer, a declining renderer, and a throwing one.
|
|
115
|
+
*/
|
|
116
|
+
export function buildAsyncResultComponent(
|
|
117
|
+
message: CustomOrHookMessage,
|
|
118
|
+
renderer: MessageRenderer | undefined,
|
|
119
|
+
): Component & { setExpanded(expanded: boolean): void } {
|
|
120
|
+
const block = buildAsyncResultBlock(message);
|
|
121
|
+
return renderer ? new AsyncResultCard(message, renderer, block) : block;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** The warning row under a background job whose output artifact could not be saved. */
|
|
125
|
+
function artifactErrorRow(error: OutputArtifactError): TranscriptStatusRow {
|
|
126
|
+
const notice = formatArtifactErrorNotice(error);
|
|
127
|
+
return { parts: [{ text: notice, color: "warning" }], native: { tone: "warning", message: [span(notice)] } };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** The dim row under a background job whose output the minimizer shortened. */
|
|
131
|
+
function minimizedRow(minimized: MinimizedMeta): TranscriptStatusRow {
|
|
132
|
+
const fact = `Minimized: ${formatMinimizedMeta(minimized)}`;
|
|
133
|
+
return { parts: [{ text: fact, color: "dim" }], native: { tone: "info", message: [span(fact, "dim")] } };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Native notice spans for a row's trailing facts (kind, id, duration): each
|
|
138
|
+
* after a dim ` · `, absent ones skipped.
|
|
139
|
+
*/
|
|
140
|
+
function facts(values: readonly (string | undefined)[]): TspSpan[] {
|
|
141
|
+
return values.flatMap(value => (value ? [span(" · ", "dim"), span(value, "dim")] : []));
|
|
142
|
+
}
|
|
143
|
+
|
|
81
144
|
/**
|
|
82
145
|
* Render a `launch-completion` custom message (terminal supervised-process
|
|
83
146
|
* exits from the launch broker) as a transcript block of one compact
|
|
@@ -88,10 +151,15 @@ export function buildLaunchCompletionBlock(message: CustomOrHookMessage): ToolAc
|
|
|
88
151
|
const rows: TranscriptStatusRow[] = [];
|
|
89
152
|
const daemons = details?.daemons ?? [];
|
|
90
153
|
if (daemons.length === 0 && typeof message.content === "string") {
|
|
91
|
-
rows.push({
|
|
154
|
+
rows.push({
|
|
155
|
+
parts: [{ text: `${theme.status.success} ${message.content}`, color: "dim" }],
|
|
156
|
+
native: { tone: "success", message: [span(message.content)] },
|
|
157
|
+
});
|
|
92
158
|
}
|
|
93
159
|
for (const daemon of daemons) {
|
|
94
160
|
const failed = daemon.state === "failed" || (daemon.exitCode !== undefined && daemon.exitCode !== 0);
|
|
161
|
+
const label = failed ? "Supervised process failed" : "Supervised process completed";
|
|
162
|
+
const exit = daemon.exitCode !== undefined ? `exit ${daemon.exitCode}` : undefined;
|
|
95
163
|
const duration =
|
|
96
164
|
daemon.exitedAt !== undefined && daemon.startedAt !== undefined
|
|
97
165
|
? formatDuration(daemon.exitedAt - daemon.startedAt)
|
|
@@ -99,21 +167,25 @@ export function buildLaunchCompletionBlock(message: CustomOrHookMessage): ToolAc
|
|
|
99
167
|
rows.push({
|
|
100
168
|
parts: [
|
|
101
169
|
failed
|
|
102
|
-
? { text: `${theme.status.error}
|
|
103
|
-
: { text: `${theme.status.
|
|
170
|
+
? { text: `${theme.status.error} ${label}`, color: "error" }
|
|
171
|
+
: { text: `${theme.status.success} ${label}`, color: "success" },
|
|
104
172
|
{ text: daemon.name, color: "accent" },
|
|
105
|
-
|
|
173
|
+
exit ? { text: `(${exit})`, color: "dim" } : undefined,
|
|
106
174
|
duration ? { text: `(${duration})`, color: "dim" } : undefined,
|
|
107
175
|
],
|
|
176
|
+
native: {
|
|
177
|
+
tone: failed ? "error" : "success",
|
|
178
|
+
message: [span(label), span(" "), span(daemon.name, "mono"), ...facts([exit, duration])],
|
|
179
|
+
},
|
|
108
180
|
});
|
|
109
181
|
}
|
|
110
182
|
return new ToolActivityContainer(new TranscriptStatusBlock(rows));
|
|
111
183
|
}
|
|
112
184
|
|
|
113
185
|
/**
|
|
114
|
-
* Render
|
|
115
|
-
* `irc:relay`) as a
|
|
116
|
-
* expanded-state getter for the cached card.
|
|
186
|
+
* Render an IRC coordination custom message (`irc:incoming` / `irc:autoreply` /
|
|
187
|
+
* `irc:relay` / `irc:workpool`) as a tool-activity card. `getExpanded` supplies
|
|
188
|
+
* the live expanded-state getter for the cached card.
|
|
117
189
|
*/
|
|
118
190
|
export function buildIrcMessageCard(message: CustomOrHookMessage, getExpanded: () => boolean): Component {
|
|
119
191
|
const details = (
|
|
@@ -135,19 +207,21 @@ export function buildIrcMessageCard(message: CustomOrHookMessage, getExpanded: (
|
|
|
135
207
|
: message.customType === "irc:workpool"
|
|
136
208
|
? ("workpool" as const)
|
|
137
209
|
: ("relay" as const);
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
210
|
+
return new ToolActivityContainer(
|
|
211
|
+
createIrcMessageCard(
|
|
212
|
+
{
|
|
213
|
+
kind,
|
|
214
|
+
from: details?.from,
|
|
215
|
+
to: details?.to,
|
|
216
|
+
body: kind === "incoming" ? details?.message : details?.body,
|
|
217
|
+
replyTo: details?.replyTo,
|
|
218
|
+
timestamp: message.timestamp,
|
|
219
|
+
pool: details?.pool,
|
|
220
|
+
mode: details?.mode,
|
|
221
|
+
},
|
|
222
|
+
getExpanded,
|
|
223
|
+
theme,
|
|
224
|
+
),
|
|
151
225
|
);
|
|
152
226
|
}
|
|
153
227
|
|
|
@@ -160,25 +234,30 @@ export function buildIrcMessageCard(message: CustomOrHookMessage, getExpanded: (
|
|
|
160
234
|
export function buildFileMentionBlock(files: FileMentionMessage["files"], indent: number): TranscriptBlock {
|
|
161
235
|
const rows: TranscriptStatusRow[] = [];
|
|
162
236
|
for (const file of files) {
|
|
163
|
-
let
|
|
237
|
+
let detail: string;
|
|
164
238
|
if (file.skippedReason === "tooLarge" || file.skippedReason === "binary") {
|
|
165
239
|
const size = typeof file.byteSize === "number" ? formatBytes(file.byteSize) : "unknown size";
|
|
166
|
-
|
|
240
|
+
detail = file.skippedReason === "binary" ? `skipped: binary, ${size}` : `skipped: ${size}`;
|
|
167
241
|
} else {
|
|
168
|
-
|
|
169
|
-
? "
|
|
242
|
+
detail = file.image
|
|
243
|
+
? "image"
|
|
170
244
|
: file.lineCount === undefined
|
|
171
|
-
? "
|
|
172
|
-
:
|
|
245
|
+
? "unknown lines"
|
|
246
|
+
: formatCount("line", file.lineCount);
|
|
173
247
|
}
|
|
174
248
|
rows.push({
|
|
175
249
|
parts: [
|
|
176
|
-
{ text: theme.tree.last, color: "dim"
|
|
250
|
+
{ text: theme.tree.last, color: "dim" },
|
|
177
251
|
{ text: "Read", color: "muted" },
|
|
178
|
-
{ text: file.path,
|
|
179
|
-
{ text:
|
|
252
|
+
{ text: formatStyledPath(file.path, theme) },
|
|
253
|
+
{ text: `(${detail})`, color: "dim" },
|
|
180
254
|
],
|
|
181
255
|
indent,
|
|
256
|
+
native: {
|
|
257
|
+
tone: "info",
|
|
258
|
+
icon: "read",
|
|
259
|
+
message: [span("Read"), span(" "), span(file.path, "path"), ...facts([detail])],
|
|
260
|
+
},
|
|
182
261
|
});
|
|
183
262
|
}
|
|
184
263
|
return new TranscriptStatusBlock(rows);
|
|
@@ -207,11 +286,14 @@ export function assistantHasVisibleContent(message: AssistantAgentMessage): bool
|
|
|
207
286
|
export function splitAssistantMessageToolTimeline(message: AssistantAgentMessage): {
|
|
208
287
|
beforeTools: AssistantAgentMessage;
|
|
209
288
|
afterToolCalls: ReadonlyMap<string, AssistantAgentMessage>;
|
|
289
|
+
/** Index in `message.content` of each after-tool segment's first block, by tool-call id. */
|
|
290
|
+
contentOffsets: ReadonlyMap<string, number>;
|
|
210
291
|
hasToolCalls: boolean;
|
|
211
292
|
lastToolCallId?: string;
|
|
212
293
|
} {
|
|
213
294
|
const beforeTools: AssistantAgentMessage["content"] = [];
|
|
214
295
|
const afterToolCalls = new Map<string, AssistantAgentMessage>();
|
|
296
|
+
const contentOffsets = new Map<string, number>();
|
|
215
297
|
let pendingAfterTool: AssistantAgentMessage["content"] = [];
|
|
216
298
|
let lastToolCallId: string | undefined;
|
|
217
299
|
let sawToolCall = false;
|
|
@@ -230,11 +312,13 @@ export function splitAssistantMessageToolTimeline(message: AssistantAgentMessage
|
|
|
230
312
|
pendingAfterTool = [];
|
|
231
313
|
};
|
|
232
314
|
|
|
233
|
-
for (
|
|
315
|
+
for (let index = 0; index < message.content.length; index++) {
|
|
316
|
+
const content = message.content[index]!;
|
|
234
317
|
if (content.type === "toolCall") {
|
|
235
318
|
flushPendingAfterTool();
|
|
236
319
|
sawToolCall = true;
|
|
237
320
|
lastToolCallId = content.id;
|
|
321
|
+
contentOffsets.set(content.id, index + 1);
|
|
238
322
|
continue;
|
|
239
323
|
}
|
|
240
324
|
if (sawToolCall) {
|
|
@@ -246,10 +330,16 @@ export function splitAssistantMessageToolTimeline(message: AssistantAgentMessage
|
|
|
246
330
|
flushPendingAfterTool();
|
|
247
331
|
|
|
248
332
|
if (!sawToolCall) {
|
|
249
|
-
return { beforeTools: message, afterToolCalls, hasToolCalls: false };
|
|
333
|
+
return { beforeTools: message, afterToolCalls, contentOffsets, hasToolCalls: false };
|
|
250
334
|
}
|
|
251
335
|
|
|
252
|
-
return {
|
|
336
|
+
return {
|
|
337
|
+
beforeTools: displaySegment(beforeTools),
|
|
338
|
+
afterToolCalls,
|
|
339
|
+
contentOffsets,
|
|
340
|
+
hasToolCalls: true,
|
|
341
|
+
lastToolCallId,
|
|
342
|
+
};
|
|
253
343
|
}
|
|
254
344
|
|
|
255
345
|
/**
|
|
@@ -13,6 +13,12 @@ export declare class DynamicBorder implements Component {
|
|
|
13
13
|
#private;
|
|
14
14
|
constructor(color?: (str: string) => string);
|
|
15
15
|
invalidate(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Pre-styled text set into the rule after a short lead (`─── label ────`);
|
|
18
|
+
* undefined draws a plain rule. A function label is re-read every render,
|
|
19
|
+
* for live text such as a spinner.
|
|
20
|
+
*/
|
|
21
|
+
setLabel(label: string | (() => string) | undefined): void;
|
|
16
22
|
/** Native terminals draw their own chrome; a border rule describes nothing. */
|
|
17
23
|
describe(): NativeNode;
|
|
18
24
|
render(width: number): readonly string[];
|