@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
|
@@ -3,6 +3,7 @@ import { replaceTabs } from "../render/render-utils";
|
|
|
3
3
|
import { theme } from "../theme";
|
|
4
4
|
import type { TranscriptBlock } from "../chrome/transcript-container";
|
|
5
5
|
import { TranscriptStatusBlock } from "../chrome/transcript-status";
|
|
6
|
+
import { span } from "../native/describe";
|
|
6
7
|
|
|
7
8
|
const TAN_WORK_PREVIEW_LENGTH = 56;
|
|
8
9
|
|
|
@@ -22,6 +23,8 @@ export function createBackgroundTanDispatchBlock(message: CustomMessage<unknown>
|
|
|
22
23
|
const details = (message as CustomMessage<Partial<BackgroundTanDispatchDetails>>).details;
|
|
23
24
|
const jobId = details?.jobId ?? "unknown";
|
|
24
25
|
const work = details?.work ? previewWork(details.work) : undefined;
|
|
26
|
+
const spans = [span("Tangent dispatched"), span(" · ", "dim"), span(`task ${jobId}`, "dim")];
|
|
27
|
+
if (work) spans.push(span(" · ", "dim"), span(work, "dim"));
|
|
25
28
|
return new TranscriptStatusBlock([
|
|
26
29
|
{
|
|
27
30
|
parts: [
|
|
@@ -30,6 +33,7 @@ export function createBackgroundTanDispatchBlock(message: CustomMessage<unknown>
|
|
|
30
33
|
{ text: jobId, color: "accent" },
|
|
31
34
|
work ? { text: `${theme.format.dash} ${work}`, color: "dim" } : undefined,
|
|
32
35
|
],
|
|
36
|
+
native: { tone: "info", icon: "output", message: spans },
|
|
33
37
|
},
|
|
34
38
|
]);
|
|
35
39
|
}
|
|
@@ -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): {
|
|
@@ -37,13 +37,18 @@ export declare class BashExecutionComponent extends Container {
|
|
|
37
37
|
appendOutput(chunk: string): void;
|
|
38
38
|
/** Switch to PTY rendering and feed raw terminal bytes through the vterm replay. */
|
|
39
39
|
appendPtyChunk(chunk: string): void;
|
|
40
|
+
/** Bytes a terminal would send for a key event, honoring the command's cursor-key mode; "" for key releases. */
|
|
41
|
+
encodePtyInput(data: string): string;
|
|
40
42
|
setComplete(exitCode: number | undefined, cancelled: boolean, options?: {
|
|
41
43
|
output?: string;
|
|
42
44
|
truncation?: TruncationMeta;
|
|
43
45
|
artifactError?: OutputArtifactError;
|
|
46
|
+
minimized?: MinimizedMeta;
|
|
44
47
|
images?: readonly ImageContent[];
|
|
45
48
|
showImages?: boolean;
|
|
46
49
|
}): void;
|
|
50
|
+
/** The loader animates the bottom border from outside the child tree, so teardown stops it here. */
|
|
51
|
+
dispose(): void;
|
|
47
52
|
render(width: number): readonly string[];
|
|
48
53
|
/**
|
|
49
54
|
* Get the raw output for creating BashExecutionMessage.
|
|
@@ -12,10 +12,11 @@ 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";
|
|
19
|
+
import { normalizeInputForPty } from "../tools/bash-interactive";
|
|
19
20
|
import { getSixelLineMask, isSixelPassthroughEnabled, sanitizeWithOptionalSixelPassthrough } from "../render/sixel";
|
|
20
21
|
import {
|
|
21
22
|
buildExecutionFrame,
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
describeExecutionTool,
|
|
26
27
|
type ExecutionColorKey,
|
|
27
28
|
type ExecutionStatus,
|
|
29
|
+
executionStatusLabel,
|
|
28
30
|
PREVIEW_LINES,
|
|
29
31
|
resolveExecutionStatus,
|
|
30
32
|
} from "./execution-shared";
|
|
@@ -33,6 +35,7 @@ import { type DescribeContext, type NativeNode, type NativeUiEvent, rootToggleEx
|
|
|
33
35
|
import { NativeImageCache } from "../native/blobs";
|
|
34
36
|
import { imageLinksEnabled, linkedImageSpan, linkedImageText } from "../prompt/image-references";
|
|
35
37
|
import { Memo } from "../native/memo";
|
|
38
|
+
import type { DynamicBorder } from "../chrome/dynamic-border";
|
|
36
39
|
|
|
37
40
|
const STREAMING_LINE_CAP = PREVIEW_LINES * 5;
|
|
38
41
|
// Minimum interval between processing incoming chunks for display (ms).
|
|
@@ -58,8 +61,10 @@ export class BashExecutionComponent extends Container {
|
|
|
58
61
|
#status: ExecutionStatus = "running";
|
|
59
62
|
#exitCode: number | undefined = undefined;
|
|
60
63
|
#loader: Loader;
|
|
64
|
+
readonly #bottomBorder: DynamicBorder;
|
|
61
65
|
#truncation?: TruncationMeta;
|
|
62
66
|
#artifactError?: OutputArtifactError;
|
|
67
|
+
#minimized?: MinimizedMeta;
|
|
63
68
|
#expanded = false;
|
|
64
69
|
// Post-finalize mutation counter (FinalizableBlock.getTranscriptBlockVersion):
|
|
65
70
|
// a completed command's block still mutates on expansion toggles, and the
|
|
@@ -102,9 +107,10 @@ export class BashExecutionComponent extends Container {
|
|
|
102
107
|
// Use dim border for excluded-from-context commands (!! prefix)
|
|
103
108
|
const colorKey = excludeFromContext ? "dim" : "bashMode";
|
|
104
109
|
this.#colorKey = colorKey;
|
|
105
|
-
const { contentContainer, loader } = buildExecutionFrame(this, ui, colorKey);
|
|
110
|
+
const { contentContainer, loader, bottomBorder } = buildExecutionFrame(this, ui, colorKey);
|
|
106
111
|
this.#contentContainer = contentContainer;
|
|
107
112
|
this.#loader = loader;
|
|
113
|
+
this.#bottomBorder = bottomBorder;
|
|
108
114
|
this.#outputPane = new OutputPane(theme, {
|
|
109
115
|
expanded: false,
|
|
110
116
|
collapsedMaxLines: PREVIEW_LINES,
|
|
@@ -120,7 +126,6 @@ export class BashExecutionComponent extends Container {
|
|
|
120
126
|
// Command header
|
|
121
127
|
this.#headerText = new Text(theme.fg(colorKey, theme.bold(`$ ${command}`)), 1, 0);
|
|
122
128
|
this.#contentContainer.addChild(this.#headerText);
|
|
123
|
-
this.#contentContainer.addChild(this.#loader);
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
/**
|
|
@@ -199,6 +204,7 @@ export class BashExecutionComponent extends Container {
|
|
|
199
204
|
exitCode: this.#exitCode,
|
|
200
205
|
truncation: this.#truncation,
|
|
201
206
|
artifactError: this.#artifactError,
|
|
207
|
+
minimized: this.#minimized,
|
|
202
208
|
};
|
|
203
209
|
return dataFirst
|
|
204
210
|
? describeExecutionTool({
|
|
@@ -286,6 +292,11 @@ export class BashExecutionComponent extends Container {
|
|
|
286
292
|
this.#drainPtyQueue();
|
|
287
293
|
}
|
|
288
294
|
|
|
295
|
+
/** Bytes a terminal would send for a key event, honoring the command's cursor-key mode; "" for key releases. */
|
|
296
|
+
encodePtyInput(data: string): string {
|
|
297
|
+
return normalizeInputForPty(data, this.#ptyTerminal?.modes.applicationCursorKeysMode ?? false);
|
|
298
|
+
}
|
|
299
|
+
|
|
289
300
|
#drainPtyQueue(): void {
|
|
290
301
|
const terminal = this.#ptyTerminal;
|
|
291
302
|
if (!terminal || this.#ptyWriting) return;
|
|
@@ -352,6 +363,7 @@ export class BashExecutionComponent extends Container {
|
|
|
352
363
|
output?: string;
|
|
353
364
|
truncation?: TruncationMeta;
|
|
354
365
|
artifactError?: OutputArtifactError;
|
|
366
|
+
minimized?: MinimizedMeta;
|
|
355
367
|
images?: readonly ImageContent[];
|
|
356
368
|
showImages?: boolean;
|
|
357
369
|
},
|
|
@@ -361,6 +373,7 @@ export class BashExecutionComponent extends Container {
|
|
|
361
373
|
this.#endedAt ??= performance.now();
|
|
362
374
|
this.#truncation = options?.truncation;
|
|
363
375
|
this.#artifactError = options?.artifactError;
|
|
376
|
+
this.#minimized = options?.minimized;
|
|
364
377
|
this.#images = options?.images ?? [];
|
|
365
378
|
this.#showImages = options?.showImages ?? true;
|
|
366
379
|
if (options?.output !== undefined && !this.#ptyMode) {
|
|
@@ -377,6 +390,12 @@ export class BashExecutionComponent extends Container {
|
|
|
377
390
|
this.#updateDisplay();
|
|
378
391
|
}
|
|
379
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
|
+
|
|
380
399
|
override render(width: number): readonly string[] {
|
|
381
400
|
if (this.#displayDirty) {
|
|
382
401
|
this.#displayDirty = false;
|
|
@@ -434,15 +453,13 @@ export class BashExecutionComponent extends Container {
|
|
|
434
453
|
}
|
|
435
454
|
}
|
|
436
455
|
|
|
437
|
-
//
|
|
438
|
-
if (this.#status
|
|
439
|
-
this.#
|
|
440
|
-
} 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));
|
|
441
459
|
const footer = buildStatusFooter({
|
|
442
|
-
status: this.#status,
|
|
443
|
-
exitCode: this.#exitCode,
|
|
444
460
|
truncation: this.#truncation,
|
|
445
461
|
artifactError: this.#artifactError,
|
|
462
|
+
minimized: this.#minimized,
|
|
446
463
|
hiddenLineCount,
|
|
447
464
|
suppressHiddenCount: hasSixelOutput,
|
|
448
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,
|
|
@@ -65,8 +65,9 @@ import {
|
|
|
65
65
|
routeLateDiagnostics,
|
|
66
66
|
} from "./late-diagnostics-message";
|
|
67
67
|
import { groupedReadUsageCallIds, ReadToolGroupComponent, readArgsCollapseIntoGroup } from "./read-tool-group";
|
|
68
|
+
import { isReplyWrite, ReplyWriteComponent, replyDisplayMessage, toolResultReplies } from "./reply-write";
|
|
68
69
|
import { SkillMessageComponent } from "./skill-message";
|
|
69
|
-
import { ToolExecutionComponent } from "./tool-execution";
|
|
70
|
+
import { ToolExecutionComponent, type ToolExecutionHandle } from "./tool-execution";
|
|
70
71
|
import { TranscriptContainer } from "../chrome/transcript-container";
|
|
71
72
|
import { createUsageRowBlock, TurnUsageTally, turnElapsedMs } from "../overlays/usage-row";
|
|
72
73
|
import { CollapsedSyntheticMessageComponent, UserMessageComponent } from "./user-message";
|
|
@@ -90,7 +91,7 @@ export interface ChatTranscriptBuilderDeps {
|
|
|
90
91
|
|
|
91
92
|
export class ChatTranscriptBuilder {
|
|
92
93
|
readonly container = new TranscriptContainer();
|
|
93
|
-
#pendingTools = new Map<string,
|
|
94
|
+
#pendingTools = new Map<string, ToolExecutionHandle>();
|
|
94
95
|
#readArgs = new Map<string, Record<string, unknown>>();
|
|
95
96
|
#readGroup: ReadToolGroupComponent | null = null;
|
|
96
97
|
#pendingUsage: Usage | undefined;
|
|
@@ -203,6 +204,15 @@ export class ChatTranscriptBuilder {
|
|
|
203
204
|
this.#expandables.push(component);
|
|
204
205
|
}
|
|
205
206
|
|
|
207
|
+
/** Append assistant prose (a reply, a post-tool segment, or an `out://` reply write) with the transcript's display preferences. */
|
|
208
|
+
#mountProse(component: AssistantMessageComponent): void {
|
|
209
|
+
component.setImagesVisible(displayPreferences.showImages);
|
|
210
|
+
component.setToolResultImagesVisible(!displayPreferences.hideToolActivity);
|
|
211
|
+
component.setTableChartsVisible(this.#deps.tableCharts !== false);
|
|
212
|
+
this.#trackExpandable(component);
|
|
213
|
+
this.container.addChild(component);
|
|
214
|
+
}
|
|
215
|
+
|
|
206
216
|
/** A `wait` showing all-running is displaced by the next `wait` call. */
|
|
207
217
|
#resolveWaitingPoll(nextToolName?: string): void {
|
|
208
218
|
const previous = this.#waitingPoll;
|
|
@@ -346,6 +356,7 @@ export class ChatTranscriptBuilder {
|
|
|
346
356
|
component.setComplete(message.exitCode, message.cancelled, {
|
|
347
357
|
truncation: message.meta?.truncation,
|
|
348
358
|
artifactError: message.meta?.artifactError,
|
|
359
|
+
minimized: message.meta?.minimized,
|
|
349
360
|
images: message.images,
|
|
350
361
|
showImages: displayPreferences.showImages,
|
|
351
362
|
});
|
|
@@ -417,12 +428,8 @@ export class ChatTranscriptBuilder {
|
|
|
417
428
|
this.#deps.linkTargets,
|
|
418
429
|
expandThinkingBlocks,
|
|
419
430
|
);
|
|
420
|
-
assistantComponent.setImagesVisible(displayPreferences.showImages);
|
|
421
|
-
assistantComponent.setToolResultImagesVisible(!displayPreferences.hideToolActivity);
|
|
422
|
-
assistantComponent.setTableChartsVisible(this.#deps.tableCharts !== false);
|
|
423
|
-
this.#trackExpandable(assistantComponent);
|
|
424
431
|
assistantComponent.pickReactionTarget(this.container.children);
|
|
425
|
-
this
|
|
432
|
+
this.#mountProse(assistantComponent);
|
|
426
433
|
let lastAssistantComponent = assistantComponent;
|
|
427
434
|
|
|
428
435
|
if (displayPreferences.cacheMissMarker) {
|
|
@@ -456,11 +463,7 @@ export class ChatTranscriptBuilder {
|
|
|
456
463
|
this.#deps.linkTargets,
|
|
457
464
|
expandThinkingBlocks,
|
|
458
465
|
);
|
|
459
|
-
component
|
|
460
|
-
component.setToolResultImagesVisible(!displayPreferences.hideToolActivity);
|
|
461
|
-
component.setTableChartsVisible(this.#deps.tableCharts !== false);
|
|
462
|
-
this.#trackExpandable(component);
|
|
463
|
-
this.container.addChild(component);
|
|
466
|
+
this.#mountProse(component);
|
|
464
467
|
lastAssistantComponent = component;
|
|
465
468
|
};
|
|
466
469
|
|
|
@@ -492,22 +495,37 @@ export class ChatTranscriptBuilder {
|
|
|
492
495
|
|
|
493
496
|
this.#readGroup?.seal();
|
|
494
497
|
this.#readGroup = null;
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
{
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
this.#
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
498
|
+
const builtIn = this.#deps.isBuiltInTool?.(content.name) ?? true;
|
|
499
|
+
let component: ToolExecutionHandle;
|
|
500
|
+
if (builtIn && isReplyWrite(content.name, content.arguments) === true) {
|
|
501
|
+
const reply = new ReplyWriteComponent({
|
|
502
|
+
requestRender: () => this.#deps.requestRender(),
|
|
503
|
+
imageBudget: this.#deps.ui.imageBudget,
|
|
504
|
+
linkTargets: this.#deps.linkTargets,
|
|
505
|
+
});
|
|
506
|
+
reply.updateArgs(content.arguments);
|
|
507
|
+
reply.setArgsComplete();
|
|
508
|
+
this.#mountProse(reply);
|
|
509
|
+
component = reply;
|
|
510
|
+
} else {
|
|
511
|
+
const card = new ToolExecutionComponent(
|
|
512
|
+
content.name,
|
|
513
|
+
content.arguments,
|
|
514
|
+
{
|
|
515
|
+
useBuiltInRenderer: builtIn,
|
|
516
|
+
// Stable ids and Kitty placeholder cells keep images anchored
|
|
517
|
+
// while the transcript viewport scrolls and reflows.
|
|
518
|
+
showImages: displayPreferences.showImages,
|
|
519
|
+
},
|
|
520
|
+
this.#deps.getTool?.(content.name),
|
|
521
|
+
this.#deps.ui,
|
|
522
|
+
this.#deps.cwd,
|
|
523
|
+
content.id,
|
|
524
|
+
);
|
|
525
|
+
this.#trackExpandable(card);
|
|
526
|
+
this.container.addChild(card);
|
|
527
|
+
component = card;
|
|
528
|
+
}
|
|
511
529
|
|
|
512
530
|
if (hasErrorStop && errorMessage) {
|
|
513
531
|
component.updateResult(
|
|
@@ -549,6 +567,19 @@ export class ChatTranscriptBuilder {
|
|
|
549
567
|
this.#readArgs.delete(message.toolCallId);
|
|
550
568
|
return;
|
|
551
569
|
}
|
|
570
|
+
for (const reply of toolResultReplies(message.details)) {
|
|
571
|
+
this.#mountProse(
|
|
572
|
+
new AssistantMessageComponent(
|
|
573
|
+
replyDisplayMessage(reply),
|
|
574
|
+
false,
|
|
575
|
+
() => this.#deps.requestRender(),
|
|
576
|
+
[],
|
|
577
|
+
this.#deps.ui.imageBudget,
|
|
578
|
+
true,
|
|
579
|
+
this.#deps.linkTargets,
|
|
580
|
+
),
|
|
581
|
+
);
|
|
582
|
+
}
|
|
552
583
|
if (!pending) return;
|
|
553
584
|
pending.updateResult(message, false, message.toolCallId);
|
|
554
585
|
this.#pendingTools.delete(message.toolCallId);
|
|
@@ -569,7 +600,9 @@ export class ChatTranscriptBuilder {
|
|
|
569
600
|
#appendCustomMessage(message: Extract<AgentMessage, { role: "custom" | "hookMessage" }>): void {
|
|
570
601
|
if (!message.display) return;
|
|
571
602
|
if (message.customType === "async-result") {
|
|
572
|
-
const
|
|
603
|
+
const renderer = this.#deps.getMessageRenderer?.(message.customType);
|
|
604
|
+
const component = buildAsyncResultComponent(message, renderer);
|
|
605
|
+
this.#trackExpandable(component);
|
|
573
606
|
this.container.addChild(component);
|
|
574
607
|
return;
|
|
575
608
|
}
|
|
@@ -10,6 +10,7 @@ import type { TspSpan } from "@linxiraos/pi-wire";
|
|
|
10
10
|
import { md, node, span, text } from "../native/describe";
|
|
11
11
|
import { type NativeChild, type NativeNode, type NativeUiEvent, rootToggleExpanded } from "../native/node";
|
|
12
12
|
import { Memo } from "../native/memo";
|
|
13
|
+
import { noticeRow } from "../chrome/transcript-notice";
|
|
13
14
|
|
|
14
15
|
/** Divider labels per compaction method; unknown/legacy methods fall back to "compacted". */
|
|
15
16
|
const COMPACTION_METHOD_LABELS: Record<string, string> = {
|
|
@@ -237,7 +238,7 @@ function compactionNativeDetail(message: CompactionSummaryMessage): NativeChild[
|
|
|
237
238
|
? `Summary · ${frames} snapcompact frame${frames === 1 ? "" : "s"} attached`
|
|
238
239
|
: "Summary of the earlier conversation";
|
|
239
240
|
const detail: NativeChild[] = [text([span(caption, "dim")], { role: "zeta.compaction.caption", key: "caption" })];
|
|
240
|
-
if (message.warning) detail.push(
|
|
241
|
+
if (message.warning) detail.push(noticeRow("warning", message.warning, { key: "warning" }));
|
|
241
242
|
detail.push(md(message.summary, { key: "summary" }));
|
|
242
243
|
return detail;
|
|
243
244
|
}
|
|
@@ -6,6 +6,8 @@ export interface ChatTranscriptDisplayPreferences {
|
|
|
6
6
|
cacheMissMarker: boolean;
|
|
7
7
|
showTokenUsage: boolean;
|
|
8
8
|
showTurnTime: boolean;
|
|
9
|
+
/** Max rows a collapsed advisor card shows below its header; 0 = no cap. */
|
|
10
|
+
advisorCollapsedLines: number;
|
|
9
11
|
}
|
|
10
12
|
/** Current transcript display preferences. */
|
|
11
13
|
export declare const chatTranscriptDisplayPreferences: ChatTranscriptDisplayPreferences;
|
|
@@ -6,6 +6,8 @@ export interface ChatTranscriptDisplayPreferences {
|
|
|
6
6
|
cacheMissMarker: boolean;
|
|
7
7
|
showTokenUsage: boolean;
|
|
8
8
|
showTurnTime: boolean;
|
|
9
|
+
/** Max rows a collapsed advisor card shows below its header; 0 = no cap. */
|
|
10
|
+
advisorCollapsedLines: number;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
/** Current transcript display preferences. */
|
|
@@ -16,6 +18,7 @@ export const chatTranscriptDisplayPreferences: ChatTranscriptDisplayPreferences
|
|
|
16
18
|
cacheMissMarker: false,
|
|
17
19
|
showTokenUsage: false,
|
|
18
20
|
showTurnTime: false,
|
|
21
|
+
advisorCollapsedLines: 0,
|
|
19
22
|
};
|
|
20
23
|
|
|
21
24
|
/** Apply host display preferences without pulling settings into the renderer. */
|
|
@@ -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
|
],
|