@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
package/src/tools/task.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { type } from "@linxiraos/pi-omptype";
|
|
1
2
|
import type { Usage } from "@linxiraos/pi-ai";
|
|
2
|
-
import { isRecord, sanitizeText } from "@linxiraos/pi-utils";
|
|
3
3
|
import type { ThemeColor } from "../theme/theme";
|
|
4
4
|
import type { ConfiguredThinkingLevel } from "../render/render-utils";
|
|
5
|
-
import type { ToolRenderer
|
|
5
|
+
import type { ToolRenderer } from "./renderer";
|
|
6
6
|
/**
|
|
7
7
|
* TUI rendering for task tool.
|
|
8
8
|
*
|
|
@@ -14,6 +14,8 @@ import { Container, type Component } from "../tui";
|
|
|
14
14
|
import { Markdown } from "../components/markdown";
|
|
15
15
|
import { Text } from "../components/text";
|
|
16
16
|
import { visibleWidth, wrapTextWithAnsi } from "../utils";
|
|
17
|
+
import { sanitizeText } from "@linxiraos/pi-utils";
|
|
18
|
+
import type { RenderResultOptions } from "./renderer";
|
|
17
19
|
import { formatAgentStatRun, renderAgentTreeRow } from "./agent-tree";
|
|
18
20
|
import { getMarkdownTheme, type Theme } from "../theme/theme";
|
|
19
21
|
import { stripGeneratedOutputNotice, stripRawOutputArtifactNotice, stripTrailingNotice } from "./output-meta";
|
|
@@ -26,6 +28,7 @@ import {
|
|
|
26
28
|
formatFeedModelBadge,
|
|
27
29
|
formatMoreItems,
|
|
28
30
|
formatNumber,
|
|
31
|
+
formatStatusIcon,
|
|
29
32
|
isFeedModelBadgeEnabled,
|
|
30
33
|
pluralize,
|
|
31
34
|
previewLine,
|
|
@@ -42,17 +45,19 @@ import {
|
|
|
42
45
|
} from "../render/render-utils";
|
|
43
46
|
import { renderStatusLine } from "../render/index";
|
|
44
47
|
import { framedToolCard } from "../render/tool-card";
|
|
45
|
-
import { formatOutputInline, renderJsonTreeLines
|
|
48
|
+
import { formatOutputInline, renderJsonTreeLines } from "./json-tree";
|
|
46
49
|
import { repairDoubleEncodedJsonString } from "./task-repair-args";
|
|
47
50
|
import { getSubprocessToolRenderer } from "./subprocess";
|
|
48
51
|
import { assembleYieldResult, type YieldSectionShapes } from "./task-yield-assembly";
|
|
49
|
-
import type { TspAgentProps, TspTone } from "@linxiraos/pi-wire";
|
|
50
|
-
import { compact, kv, md, node, span, text } from "../native/describe";
|
|
52
|
+
import type { TspAgentProps, TspProps, TspTone } from "@linxiraos/pi-wire";
|
|
53
|
+
import { compact, kv, md, node, propNode, span, text } from "../native/describe";
|
|
51
54
|
import type { NativeNode } from "../native/node";
|
|
52
55
|
import { OwnerMemo, sameItems } from "../native/memo";
|
|
53
56
|
import { plainText } from "../native/spans";
|
|
54
57
|
import { errorText, noteText, resultText } from "./native-view";
|
|
58
|
+
import { describeJsonValue } from "./json-tree";
|
|
55
59
|
import { taskSummary } from "../overlays/agent-hub-renderer";
|
|
60
|
+
import type { NativeToolView, ToolRenderResult } from "./renderer";
|
|
56
61
|
|
|
57
62
|
/** Render context threaded in from `ToolExecutionComponent.#buildRenderContext`. */
|
|
58
63
|
interface TaskRenderContext {
|
|
@@ -347,7 +352,7 @@ function renderOutputSection(
|
|
|
347
352
|
if (warning) {
|
|
348
353
|
lines.push(`${continuePrefix}${theme.fg("dim", "Output")}`);
|
|
349
354
|
lines.push(
|
|
350
|
-
`${continuePrefix} ${
|
|
355
|
+
`${continuePrefix} ${formatStatusIcon("warning", theme)} ${theme.fg(
|
|
351
356
|
"dim",
|
|
352
357
|
clipCollapsed(sanitizeText(warning), 80, expanded),
|
|
353
358
|
)}`,
|
|
@@ -479,6 +484,12 @@ function renderTaskSection(
|
|
|
479
484
|
return lines;
|
|
480
485
|
}
|
|
481
486
|
|
|
487
|
+
function taskPreviewText(task: unknown, taskFile: unknown): string {
|
|
488
|
+
if (typeof task === "string") return task;
|
|
489
|
+
if (typeof taskFile !== "string") return "";
|
|
490
|
+
return flattenLine(replaceTabs(shortenPath(sanitizeText(taskFile))));
|
|
491
|
+
}
|
|
492
|
+
|
|
482
493
|
/**
|
|
483
494
|
* First line of a streamed `task` brief, trimmed — a row's secondary text.
|
|
484
495
|
* The args stream in token by token, so non-string values fall through to "".
|
|
@@ -519,7 +530,7 @@ function renderTaskCallLines(args: Partial<TaskParams> | undefined, theme: Theme
|
|
|
519
530
|
|
|
520
531
|
const rawName = typeof args.name === "string" ? args.name.trim() : "";
|
|
521
532
|
const idLabel = rawName ? formatTaskId(rawName) : "";
|
|
522
|
-
const brief = taskFirstLine(args.task);
|
|
533
|
+
const brief = taskFirstLine(taskPreviewText(args.task, args.taskFile));
|
|
523
534
|
if (idLabel || brief) {
|
|
524
535
|
let line = `${bullet} ${theme.fg("accent", theme.bold(idLabel || "agent"))}`;
|
|
525
536
|
if (brief) {
|
|
@@ -555,7 +566,7 @@ function renderTaskItemLines(tasks: TaskItem[] | undefined, theme: Theme): strin
|
|
|
555
566
|
const rawName = typeof item?.name === "string" ? item.name.trim() : "";
|
|
556
567
|
const idLabel = rawName ? formatTaskId(rawName) : `#${i + 1}`;
|
|
557
568
|
let line = `${bullet} ${theme.fg("accent", theme.bold(idLabel))}`;
|
|
558
|
-
const brief = taskFirstLine(item?.task);
|
|
569
|
+
const brief = taskFirstLine(taskPreviewText(item?.task, item?.taskFile));
|
|
559
570
|
if (brief) {
|
|
560
571
|
line += `: ${theme.fg("muted", previewLine(brief, 64))}`;
|
|
561
572
|
}
|
|
@@ -948,9 +959,7 @@ function renderReviewResult(
|
|
|
948
959
|
// Verdict line
|
|
949
960
|
const verdictColor = summary.overall_correctness === "correct" ? "success" : "error";
|
|
950
961
|
const isCorrect = summary.overall_correctness === "correct";
|
|
951
|
-
const verdictIcon = isCorrect
|
|
952
|
-
? theme.styledSymbol("status.done", "accent")
|
|
953
|
-
: theme.fg(verdictColor, theme.status.error);
|
|
962
|
+
const verdictIcon = formatStatusIcon(isCorrect ? "success" : "error", theme);
|
|
954
963
|
lines.push(
|
|
955
964
|
`${continuePrefix} Patch is ${theme.fg(verdictColor, summary.overall_correctness)} ${verdictIcon} ${theme.fg(
|
|
956
965
|
"dim",
|
|
@@ -1049,13 +1058,15 @@ function renderAgentResult(
|
|
|
1049
1058
|
const mergeFailed = !aborted && result.exitCode === 0 && !!result.error;
|
|
1050
1059
|
const success = !aborted && result.exitCode === 0 && !result.error;
|
|
1051
1060
|
const needsWarning = Boolean(missingCompleteWarning) && success;
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1061
|
+
// A merge failure is a warning: the agent's work succeeded, only folding it back did not.
|
|
1062
|
+
const iconStatus: ToolUIStatus = aborted
|
|
1063
|
+
? "aborted"
|
|
1064
|
+
: needsWarning || mergeFailed
|
|
1065
|
+
? "warning"
|
|
1056
1066
|
: success
|
|
1057
|
-
?
|
|
1058
|
-
:
|
|
1067
|
+
? "success"
|
|
1068
|
+
: "error";
|
|
1069
|
+
const icon = formatStatusIcon(iconStatus, theme);
|
|
1059
1070
|
const iconColor = needsWarning ? "warning" : success ? "success" : mergeFailed ? "warning" : "error";
|
|
1060
1071
|
const statusText = aborted
|
|
1061
1072
|
? "aborted"
|
|
@@ -1099,7 +1110,7 @@ function renderAgentResult(
|
|
|
1099
1110
|
? fullDescription
|
|
1100
1111
|
: undefined;
|
|
1101
1112
|
const titlePart = description ? `${theme.bold(displayId)}: ${description}` : displayId;
|
|
1102
|
-
let statusLine = `${indent}${
|
|
1113
|
+
let statusLine = `${indent}${icon} ${modelLead}${theme.fg(
|
|
1103
1114
|
success && !needsWarning ? "text" : "accent",
|
|
1104
1115
|
titlePart,
|
|
1105
1116
|
)}${badges}`;
|
|
@@ -1128,7 +1139,7 @@ function renderAgentResult(
|
|
|
1128
1139
|
|
|
1129
1140
|
if (aborted && result.abortReason) {
|
|
1130
1141
|
lines.push(
|
|
1131
|
-
`${continuePrefix}${
|
|
1142
|
+
`${continuePrefix}${formatStatusIcon("aborted", theme)} ${theme.fg(
|
|
1132
1143
|
"dim",
|
|
1133
1144
|
clipCollapsed(flattenLine(sanitizeText(result.abortReason)), 80, expanded),
|
|
1134
1145
|
)}`,
|
|
@@ -1220,7 +1231,7 @@ function renderAgentResult(
|
|
|
1220
1231
|
|
|
1221
1232
|
if (hasCustomRendering && missingCompleteWarning) {
|
|
1222
1233
|
lines.push(
|
|
1223
|
-
`${continuePrefix}${
|
|
1234
|
+
`${continuePrefix}${formatStatusIcon("warning", theme)} ${theme.fg(
|
|
1224
1235
|
"dim",
|
|
1225
1236
|
clipCollapsed(sanitizeText(missingCompleteWarning), 80, expanded),
|
|
1226
1237
|
)}`,
|
|
@@ -1360,16 +1371,10 @@ export function renderResult(
|
|
|
1360
1371
|
if (!details) {
|
|
1361
1372
|
const text = result.content.find(c => c.type === "text")?.text || "";
|
|
1362
1373
|
const errored = result.isError === true;
|
|
1363
|
-
const header =
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
iconOverride: theme.styledSymbol("status.done", "accent"),
|
|
1368
|
-
title: "Task",
|
|
1369
|
-
description: agentLabel,
|
|
1370
|
-
},
|
|
1371
|
-
theme,
|
|
1372
|
-
);
|
|
1374
|
+
const header = renderStatusLine(
|
|
1375
|
+
{ icon: errored ? "error" : "success", title: "Task", description: agentLabel },
|
|
1376
|
+
theme,
|
|
1377
|
+
);
|
|
1373
1378
|
return framedToolCard(theme, ({ width }) => ({
|
|
1374
1379
|
header,
|
|
1375
1380
|
sections: [
|
|
@@ -1414,16 +1419,11 @@ export function renderResult(
|
|
|
1414
1419
|
const metaLabel = countLabel ?? agentLabel;
|
|
1415
1420
|
const header = renderStatusLine(
|
|
1416
1421
|
{
|
|
1417
|
-
icon: icon === "success" || icon === "running" ? undefined : icon,
|
|
1418
1422
|
// While agents are in flight the header shows the dispatch glyph, not a
|
|
1419
1423
|
// spinner: async spawns return immediately, so "running" means
|
|
1420
1424
|
// "delegated to peers", not "this call is blocking the turn".
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
? theme.styledSymbol("tool.task", "accent")
|
|
1424
|
-
: icon === "success"
|
|
1425
|
-
? theme.styledSymbol("status.done", "accent")
|
|
1426
|
-
: undefined,
|
|
1425
|
+
icon: icon === "running" ? undefined : icon,
|
|
1426
|
+
iconOverride: icon === "running" ? theme.styledSymbol("tool.task", "accent") : undefined,
|
|
1427
1427
|
title: "Task",
|
|
1428
1428
|
meta: metaLabel ? [metaLabel] : undefined,
|
|
1429
1429
|
},
|
|
@@ -1797,7 +1797,7 @@ function describeContext(raw: unknown): NativeNode | undefined {
|
|
|
1797
1797
|
return line ? text([span(line, "muted")], { wrap: "word", lines: 2, role: "zeta.tool.context" }) : undefined;
|
|
1798
1798
|
}
|
|
1799
1799
|
|
|
1800
|
-
/** The full assignment, markdown
|
|
1800
|
+
/** The full assignment, markdown: an agent's first expanded child and its row's hover card. */
|
|
1801
1801
|
function describeAssignment(raw: string | undefined): NativeNode | undefined {
|
|
1802
1802
|
const source = raw ? sanitizeText(repairDoubleEncodedJsonString(raw)).trim() : "";
|
|
1803
1803
|
return source ? md(source, { role: "zeta.task.assignment" }) : undefined;
|
|
@@ -1829,6 +1829,8 @@ interface AgentDescribeState {
|
|
|
1829
1829
|
readonly nowMs: number;
|
|
1830
1830
|
readonly expanded: boolean;
|
|
1831
1831
|
readonly background: boolean;
|
|
1832
|
+
/** The host draws the `json` kind. */
|
|
1833
|
+
readonly json: boolean;
|
|
1832
1834
|
}
|
|
1833
1835
|
|
|
1834
1836
|
/** Settled and in-flight child snapshots a subagent carries, as nested agent nodes. */
|
|
@@ -1858,8 +1860,26 @@ function describeNestedTasks(
|
|
|
1858
1860
|
return out;
|
|
1859
1861
|
}
|
|
1860
1862
|
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
+
/** Earliest start seen per running subagent (`nowMs - durationMs`), so a snapshot with a stale or zero `durationMs` can't restart its timer. */
|
|
1864
|
+
const runStartMs = new Map<string, number>();
|
|
1865
|
+
|
|
1866
|
+
function runningAge(progress: { id: string; durationMs: number }, nowMs: number): number {
|
|
1867
|
+
const start = nowMs - Math.max(0, progress.durationMs);
|
|
1868
|
+
const known = runStartMs.get(progress.id);
|
|
1869
|
+
const anchor = known === undefined ? start : Math.min(known, start);
|
|
1870
|
+
runStartMs.set(progress.id, anchor);
|
|
1871
|
+
return Math.max(0, nowMs - anchor);
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
/** An `agent` node; its row's hover card shows the whole `assignment` the row only summarizes. */
|
|
1875
|
+
function agentNode(
|
|
1876
|
+
p: TspAgentProps,
|
|
1877
|
+
assignment: NativeNode | undefined,
|
|
1878
|
+
children: readonly (NativeNode | undefined)[],
|
|
1879
|
+
key: string,
|
|
1880
|
+
): NativeNode {
|
|
1881
|
+
const props: TspProps<"agent"> = assignment ? { ...p, hovercard: propNode(assignment) } : p;
|
|
1882
|
+
return node("agent", props, compact(children), key);
|
|
1863
1883
|
}
|
|
1864
1884
|
|
|
1865
1885
|
function describeProgressAgent(progress: AgentProgress, state: AgentDescribeState, depth: number): NativeNode {
|
|
@@ -1881,6 +1901,7 @@ function describeProgressAgent(progress: AgentProgress, state: AgentDescribeStat
|
|
|
1881
1901
|
const summary = taskSummary(progress.description || progress.assignment || progress.task);
|
|
1882
1902
|
// The agent's own stage line (from its completion probe) rides beside the task while it runs.
|
|
1883
1903
|
const stage = running && progress.stage ? plainText(progress.stage) : "";
|
|
1904
|
+
const assignment = describeAssignment(progress.assignment ?? progress.task);
|
|
1884
1905
|
const retry =
|
|
1885
1906
|
running && progress.retryState
|
|
1886
1907
|
? {
|
|
@@ -1907,7 +1928,7 @@ function describeProgressAgent(progress: AgentProgress, state: AgentDescribeStat
|
|
|
1907
1928
|
...contextStats(progress.contextTokens, progress.contextWindow),
|
|
1908
1929
|
done: running && progress.completionPercent !== undefined ? progress.completionPercent / 100 : undefined,
|
|
1909
1930
|
cost: progress.cost > 0 ? progress.cost : undefined,
|
|
1910
|
-
...(running ? { age: progress
|
|
1931
|
+
...(running ? { age: runningAge(progress, nowMs) } : { took: progress.durationMs }),
|
|
1911
1932
|
},
|
|
1912
1933
|
retry,
|
|
1913
1934
|
badges: agentBadges(state.background, undefined),
|
|
@@ -1915,8 +1936,9 @@ function describeProgressAgent(progress: AgentProgress, state: AgentDescribeStat
|
|
|
1915
1936
|
collapsible: true,
|
|
1916
1937
|
collapsed: !state.expanded,
|
|
1917
1938
|
},
|
|
1939
|
+
assignment,
|
|
1918
1940
|
[
|
|
1919
|
-
|
|
1941
|
+
assignment,
|
|
1920
1942
|
progress.resolvedModelRoute ? noteText(progress.resolvedModelRoute, "dim") : undefined,
|
|
1921
1943
|
!running && progress.retryFailure
|
|
1922
1944
|
? text(
|
|
@@ -1950,6 +1972,7 @@ function describeResultAgent(result: SingleResult, state: AgentDescribeState, de
|
|
|
1950
1972
|
else if (warning && success) badges.push({ text: "warning", tone: "warning" });
|
|
1951
1973
|
if (result.truncated) badges.push({ text: "truncated", tone: "warning" });
|
|
1952
1974
|
const cost = result.usage?.cost.total ?? 0;
|
|
1975
|
+
const assignment = describeAssignment(result.assignment ?? result.task);
|
|
1953
1976
|
return agentNode(
|
|
1954
1977
|
{
|
|
1955
1978
|
name: formatTaskId(result.id),
|
|
@@ -1972,15 +1995,17 @@ function describeResultAgent(result: SingleResult, state: AgentDescribeState, de
|
|
|
1972
1995
|
collapsible: true,
|
|
1973
1996
|
collapsed: !state.expanded,
|
|
1974
1997
|
},
|
|
1998
|
+
assignment,
|
|
1975
1999
|
[
|
|
1976
|
-
|
|
2000
|
+
assignment,
|
|
1977
2001
|
result.resolvedModelRoute ? noteText(result.resolvedModelRoute, "dim") : undefined,
|
|
1978
2002
|
aborted && result.abortReason ? errorLine(result.abortReason) : undefined,
|
|
1979
2003
|
warning ? errorLine(warning, "warning") : undefined,
|
|
1980
2004
|
result.error ? errorLine(result.error) : undefined,
|
|
1981
2005
|
result.retryFailure ? errorLine(`auto-retry gave up: ${result.retryFailure.errorMessage}`) : undefined,
|
|
2006
|
+
// The structured result is the agent's answer: its containers open one level, as in the fallback tree.
|
|
1982
2007
|
structured !== undefined
|
|
1983
|
-
?
|
|
2008
|
+
? describeJsonValue(structured, { native: state.json, open: 1 })
|
|
1984
2009
|
: output
|
|
1985
2010
|
? md(output, { role: "zeta.task.output" })
|
|
1986
2011
|
: undefined,
|
|
@@ -2026,16 +2051,18 @@ function describeTaskCall(args: TaskParams | undefined): NativeToolView {
|
|
|
2026
2051
|
status: "pending",
|
|
2027
2052
|
badges: agentBadges(false, isolated === true),
|
|
2028
2053
|
},
|
|
2054
|
+
describeAssignment(typeof brief === "string" ? brief : undefined),
|
|
2029
2055
|
[],
|
|
2030
2056
|
key,
|
|
2031
2057
|
);
|
|
2032
2058
|
const flatName = typeof args?.name === "string" ? args.name.trim() : "";
|
|
2033
|
-
|
|
2059
|
+
const flatBrief = taskPreviewText(args?.task, args?.taskFile);
|
|
2060
|
+
if (flatName || taskFirstLine(flatBrief)) {
|
|
2034
2061
|
agents.push(
|
|
2035
2062
|
pending(
|
|
2036
2063
|
flatName ? formatTaskId(flatName) : "agent",
|
|
2037
2064
|
args?.agent,
|
|
2038
|
-
|
|
2065
|
+
flatBrief,
|
|
2039
2066
|
args?.isolated,
|
|
2040
2067
|
flatName || "agent",
|
|
2041
2068
|
),
|
|
@@ -2048,7 +2075,7 @@ function describeTaskCall(args: TaskParams | undefined): NativeToolView {
|
|
|
2048
2075
|
pending(
|
|
2049
2076
|
name ? formatTaskId(name) : `#${index + 1}`,
|
|
2050
2077
|
entry?.agent,
|
|
2051
|
-
entry?.task,
|
|
2078
|
+
taskPreviewText(entry?.task, entry?.taskFile),
|
|
2052
2079
|
entry?.isolated,
|
|
2053
2080
|
name || `#${index + 1}`,
|
|
2054
2081
|
),
|
|
@@ -2093,6 +2120,7 @@ function describeTaskResult(
|
|
|
2093
2120
|
nowMs: options.renderContext?.nowMs ?? Date.now(),
|
|
2094
2121
|
expanded: options.expanded,
|
|
2095
2122
|
background,
|
|
2123
|
+
json: options.json === true,
|
|
2096
2124
|
},
|
|
2097
2125
|
0,
|
|
2098
2126
|
);
|
|
@@ -2165,7 +2193,7 @@ export const taskToolRenderer = {
|
|
|
2165
2193
|
options: TaskRenderOptions,
|
|
2166
2194
|
args?: TaskParams,
|
|
2167
2195
|
): NativeToolView | undefined {
|
|
2168
|
-
return taskResultMemo.get(result, [options.renderContext?.nowMs, options.expanded], () =>
|
|
2196
|
+
return taskResultMemo.get(result, [options.renderContext?.nowMs, options.expanded, options.json], () =>
|
|
2169
2197
|
describeTaskResult(result, options, args),
|
|
2170
2198
|
);
|
|
2171
2199
|
},
|
|
@@ -2216,10 +2244,11 @@ export interface TaskItem {
|
|
|
2216
2244
|
agent?: string;
|
|
2217
2245
|
/** Historical source session selected by the bundled consult agent. */
|
|
2218
2246
|
sourceSession?: string;
|
|
2219
|
-
/**
|
|
2247
|
+
/** Bundled seance: override for the source session's saved model. Any other agent: one exact per-call model, gated by `task.perCallModel`. */
|
|
2220
2248
|
model?: string | string[];
|
|
2221
|
-
/**
|
|
2249
|
+
/** Inline instructions; exactly one of task or taskFile is required. */
|
|
2222
2250
|
task?: string;
|
|
2251
|
+
taskFile?: string;
|
|
2223
2252
|
/** How open-ended the work is; required by the schema and the child's sole `auto` thinking classification input. */
|
|
2224
2253
|
solutionSpace?: string;
|
|
2225
2254
|
/** Per-spawn thinking effort: lowest/middle/highest level the resolved model supports. Overrides the agent's default selector (e.g. `auto`). */
|
|
@@ -2247,10 +2276,12 @@ export interface TaskParams {
|
|
|
2247
2276
|
agent?: string;
|
|
2248
2277
|
/** Historical source session selected by the bundled consult agent. */
|
|
2249
2278
|
sourceSession?: string;
|
|
2250
|
-
/**
|
|
2279
|
+
/** See {@link TaskItem.model}. */
|
|
2251
2280
|
model?: string | string[];
|
|
2252
2281
|
/** The work (flat form). */
|
|
2253
2282
|
task?: string;
|
|
2283
|
+
/** Absolute path or local:// URL to a UTF-8 file (flat form), mutually exclusive with task. */
|
|
2284
|
+
taskFile?: string;
|
|
2254
2285
|
/** How open-ended the work is (flat form); see {@link TaskItem.solutionSpace}. */
|
|
2255
2286
|
solutionSpace?: string;
|
|
2256
2287
|
/** Per-spawn thinking effort (flat form): lowest/middle/highest level the resolved model supports. */
|
|
@@ -2339,6 +2370,9 @@ export interface AgentProgress {
|
|
|
2339
2370
|
status: "pending" | "running" | "completed" | "failed" | "aborted";
|
|
2340
2371
|
task: string;
|
|
2341
2372
|
assignment?: string;
|
|
2373
|
+
taskFile?: string;
|
|
2374
|
+
/** SHA-256 of the exact task file bytes before decoding and trimming. */
|
|
2375
|
+
taskFileSha256?: string;
|
|
2342
2376
|
description?: string;
|
|
2343
2377
|
lastIntent?: string;
|
|
2344
2378
|
currentTool?: string;
|
|
@@ -2447,6 +2481,8 @@ export interface SingleResult {
|
|
|
2447
2481
|
agentSource: AgentSource;
|
|
2448
2482
|
task: string;
|
|
2449
2483
|
assignment?: string;
|
|
2484
|
+
taskFile?: string;
|
|
2485
|
+
taskFileSha256?: string;
|
|
2450
2486
|
description?: string;
|
|
2451
2487
|
lastIntent?: string;
|
|
2452
2488
|
exitCode: number;
|
|
@@ -2620,55 +2656,22 @@ export interface FindingDetails {
|
|
|
2620
2656
|
line_end: number;
|
|
2621
2657
|
}
|
|
2622
2658
|
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2659
|
+
const FindingDetailsShape = type({
|
|
2660
|
+
"+": "delete",
|
|
2661
|
+
title: "string",
|
|
2662
|
+
body: "string",
|
|
2663
|
+
// Older reports wrote the severity as its ordinal.
|
|
2664
|
+
priority: type("'P0' | 'P1' | 'P2' | 'P3'").or(type("0 | 1 | 2 | 3").pipe(ordinal => PRIORITY_LABELS[ordinal])),
|
|
2665
|
+
confidence: "0 <= number <= 1",
|
|
2666
|
+
file_path: "string > 0",
|
|
2667
|
+
line_start: "number",
|
|
2668
|
+
line_end: "number",
|
|
2669
|
+
});
|
|
2631
2670
|
|
|
2632
2671
|
/** Validates and normalizes a persisted review finding. */
|
|
2633
2672
|
export function parseFindingDetails(value: unknown): FindingDetails | undefined {
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
const title = typeof value.title === "string" ? value.title : undefined;
|
|
2637
|
-
const body = typeof value.body === "string" ? value.body : undefined;
|
|
2638
|
-
const priority = normalizeFindingPriority(value.priority);
|
|
2639
|
-
const confidence =
|
|
2640
|
-
typeof value.confidence === "number" &&
|
|
2641
|
-
Number.isFinite(value.confidence) &&
|
|
2642
|
-
value.confidence >= 0 &&
|
|
2643
|
-
value.confidence <= 1
|
|
2644
|
-
? value.confidence
|
|
2645
|
-
: undefined;
|
|
2646
|
-
const filePath = typeof value.file_path === "string" && value.file_path.length > 0 ? value.file_path : undefined;
|
|
2647
|
-
const lineStart =
|
|
2648
|
-
typeof value.line_start === "number" && Number.isFinite(value.line_start) ? value.line_start : undefined;
|
|
2649
|
-
const lineEnd = typeof value.line_end === "number" && Number.isFinite(value.line_end) ? value.line_end : undefined;
|
|
2650
|
-
|
|
2651
|
-
if (
|
|
2652
|
-
title === undefined ||
|
|
2653
|
-
body === undefined ||
|
|
2654
|
-
priority === undefined ||
|
|
2655
|
-
confidence === undefined ||
|
|
2656
|
-
filePath === undefined ||
|
|
2657
|
-
lineStart === undefined ||
|
|
2658
|
-
lineEnd === undefined
|
|
2659
|
-
) {
|
|
2660
|
-
return undefined;
|
|
2661
|
-
}
|
|
2662
|
-
|
|
2663
|
-
return {
|
|
2664
|
-
title,
|
|
2665
|
-
body,
|
|
2666
|
-
priority,
|
|
2667
|
-
confidence,
|
|
2668
|
-
file_path: filePath,
|
|
2669
|
-
line_start: lineStart,
|
|
2670
|
-
line_end: lineEnd,
|
|
2671
|
-
};
|
|
2673
|
+
const details = FindingDetailsShape(value);
|
|
2674
|
+
return details instanceof type.errors ? undefined : details;
|
|
2672
2675
|
}
|
|
2673
2676
|
/** SubmitReviewDetails - used for rendering review results from yield tool */
|
|
2674
2677
|
export interface SubmitReviewDetails {
|
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
* selector peeling and transcript renderers consult it instead of hardcoding
|
|
5
5
|
* scheme names.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Mutation class of a writable scheme; drives plan-mode and device-only `write` gates.
|
|
9
|
+
* - `workspace`: mutates user/external state; blocked in plan mode and device-only sessions.
|
|
10
|
+
* - `sandbox`: session scratch space (local://); allowed in plan mode and device-only sessions.
|
|
11
|
+
* - `coordination`: peer messaging (agent://); always allowed. `SchemeWritePolicy.cancels` grants the same per URL.
|
|
12
|
+
* - `device`: tool-device dispatch (xd://); always allowed, the device enforces its own policy.
|
|
13
|
+
* - `reply`: a message to the user (out://); always allowed, and transcripts draw the content as assistant prose.
|
|
14
|
+
*/
|
|
15
|
+
export type SchemeWriteScope = "workspace" | "sandbox" | "coordination" | "device" | "reply";
|
|
7
16
|
/** Renderer-relevant subset of a registered scheme's declared spec. */
|
|
8
17
|
export interface InternalUrlSchemeSpec {
|
|
9
18
|
/** `lines`: a trailing `:<selector>` chain is a read selector; `none`/`opaque`: never peel. */
|
|
@@ -12,16 +21,24 @@ export interface InternalUrlSchemeSpec {
|
|
|
12
21
|
readonly portAuthority?: boolean;
|
|
13
22
|
/** Read cards collapse into the compact read group like plain files instead of expanding. */
|
|
14
23
|
readonly compactTranscript?: boolean;
|
|
24
|
+
/** Write policy; absent on read-only schemes. Transcripts draw `reply`-scoped writes as assistant prose. */
|
|
25
|
+
readonly write?: {
|
|
26
|
+
readonly scope: SchemeWriteScope;
|
|
27
|
+
};
|
|
15
28
|
}
|
|
16
29
|
/** Scheme registry capabilities installed by the internal URL host. */
|
|
17
30
|
export interface InternalUrlSchemeHost {
|
|
18
31
|
/** Declared spec of a registered scheme (case-insensitive); undefined when unregistered. */
|
|
19
32
|
spec(scheme: string): InternalUrlSchemeSpec | undefined;
|
|
33
|
+
/** Declared specs of every registered scheme, keyed by lowercased scheme. */
|
|
34
|
+
specs(): ReadonlyMap<string, InternalUrlSchemeSpec>;
|
|
20
35
|
}
|
|
21
36
|
/** Install the scheme registry. Until one is installed, no URL counts as an internal scheme. */
|
|
22
37
|
export declare function setInternalUrlSchemeHost(host: InternalUrlSchemeHost): void;
|
|
23
38
|
/** Declared spec of `scheme`; undefined when it is unregistered or no host is installed. */
|
|
24
39
|
export declare function internalUrlSchemeSpec(scheme: string): InternalUrlSchemeSpec | undefined;
|
|
40
|
+
/** Declared specs of every registered scheme, keyed by lowercased scheme; empty when no host is installed. */
|
|
41
|
+
export declare function internalUrlSchemeSpecs(): ReadonlyMap<string, InternalUrlSchemeSpec>;
|
|
25
42
|
/** Split a hierarchical `scheme://rest` URL into its lowercased scheme and the text after `://`. */
|
|
26
43
|
export declare function splitUrlScheme(input: string): {
|
|
27
44
|
scheme: string;
|
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
* scheme names.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Mutation class of a writable scheme; drives plan-mode and device-only `write` gates.
|
|
10
|
+
* - `workspace`: mutates user/external state; blocked in plan mode and device-only sessions.
|
|
11
|
+
* - `sandbox`: session scratch space (local://); allowed in plan mode and device-only sessions.
|
|
12
|
+
* - `coordination`: peer messaging (agent://); always allowed. `SchemeWritePolicy.cancels` grants the same per URL.
|
|
13
|
+
* - `device`: tool-device dispatch (xd://); always allowed, the device enforces its own policy.
|
|
14
|
+
* - `reply`: a message to the user (out://); always allowed, and transcripts draw the content as assistant prose.
|
|
15
|
+
*/
|
|
16
|
+
export type SchemeWriteScope = "workspace" | "sandbox" | "coordination" | "device" | "reply";
|
|
17
|
+
|
|
8
18
|
/** Renderer-relevant subset of a registered scheme's declared spec. */
|
|
9
19
|
export interface InternalUrlSchemeSpec {
|
|
10
20
|
/** `lines`: a trailing `:<selector>` chain is a read selector; `none`/`opaque`: never peel. */
|
|
@@ -13,12 +23,16 @@ export interface InternalUrlSchemeSpec {
|
|
|
13
23
|
readonly portAuthority?: boolean;
|
|
14
24
|
/** Read cards collapse into the compact read group like plain files instead of expanding. */
|
|
15
25
|
readonly compactTranscript?: boolean;
|
|
26
|
+
/** Write policy; absent on read-only schemes. Transcripts draw `reply`-scoped writes as assistant prose. */
|
|
27
|
+
readonly write?: { readonly scope: SchemeWriteScope };
|
|
16
28
|
}
|
|
17
29
|
|
|
18
30
|
/** Scheme registry capabilities installed by the internal URL host. */
|
|
19
31
|
export interface InternalUrlSchemeHost {
|
|
20
32
|
/** Declared spec of a registered scheme (case-insensitive); undefined when unregistered. */
|
|
21
33
|
spec(scheme: string): InternalUrlSchemeSpec | undefined;
|
|
34
|
+
/** Declared specs of every registered scheme, keyed by lowercased scheme. */
|
|
35
|
+
specs(): ReadonlyMap<string, InternalUrlSchemeSpec>;
|
|
22
36
|
}
|
|
23
37
|
|
|
24
38
|
let schemeHost: InternalUrlSchemeHost | undefined;
|
|
@@ -33,6 +47,13 @@ export function internalUrlSchemeSpec(scheme: string): InternalUrlSchemeSpec | u
|
|
|
33
47
|
return schemeHost?.spec(scheme);
|
|
34
48
|
}
|
|
35
49
|
|
|
50
|
+
const NO_SPECS: ReadonlyMap<string, InternalUrlSchemeSpec> = new Map();
|
|
51
|
+
|
|
52
|
+
/** Declared specs of every registered scheme, keyed by lowercased scheme; empty when no host is installed. */
|
|
53
|
+
export function internalUrlSchemeSpecs(): ReadonlyMap<string, InternalUrlSchemeSpec> {
|
|
54
|
+
return schemeHost?.specs() ?? NO_SPECS;
|
|
55
|
+
}
|
|
56
|
+
|
|
36
57
|
const URL_SCHEME_RE = /^([a-z][a-z0-9+.-]*):\/\//i;
|
|
37
58
|
|
|
38
59
|
/** Split a hierarchical `scheme://rest` URL into its lowercased scheme and the text after `://`. */
|
package/src/tools/vibe.ts
CHANGED
|
@@ -129,7 +129,7 @@ function stateToIcon(state: VibeSessionState): ToolUIStatus {
|
|
|
129
129
|
case "starting":
|
|
130
130
|
return "pending";
|
|
131
131
|
case "idle":
|
|
132
|
-
return "
|
|
132
|
+
return "success";
|
|
133
133
|
case "dead":
|
|
134
134
|
return "aborted";
|
|
135
135
|
}
|
|
@@ -534,7 +534,7 @@ export function createVibeToolRenderer(op: VibeOp) {
|
|
|
534
534
|
if (!details || result.isError) {
|
|
535
535
|
const fallback = result.content.find(part => part.type === "text")?.text ?? "";
|
|
536
536
|
const header = renderStatusLine(
|
|
537
|
-
{ icon: result.isError ? "error" : "
|
|
537
|
+
{ icon: result.isError ? "error" : "success", title: `vibe ${describeCall(op, args)}` },
|
|
538
538
|
uiTheme,
|
|
539
539
|
);
|
|
540
540
|
const body = fallback
|
|
@@ -573,7 +573,7 @@ export function createVibeToolRenderer(op: VibeOp) {
|
|
|
573
573
|
const killedNote = details.killed?.cancelledTurn ? " (in-flight turn cancelled)" : "";
|
|
574
574
|
const header = renderStatusLine(
|
|
575
575
|
{
|
|
576
|
-
icon: "
|
|
576
|
+
icon: "success",
|
|
577
577
|
title: `vibe kill ${frameText(details.killed?.id ?? args?.session ?? "?", 40)}${killedNote}`,
|
|
578
578
|
},
|
|
579
579
|
uiTheme,
|
|
@@ -621,7 +621,7 @@ export function createVibeToolRenderer(op: VibeOp) {
|
|
|
621
621
|
: `vibe sessions (${screens.length})`;
|
|
622
622
|
const header = renderStatusLine(
|
|
623
623
|
{
|
|
624
|
-
icon: details.wait?.timedOut ? "warning" : running > 0 ? "info" : "
|
|
624
|
+
icon: details.wait?.timedOut ? "warning" : running > 0 ? "info" : "success",
|
|
625
625
|
spinnerFrame: running > 0 ? wallOptions.spinnerFrame : undefined,
|
|
626
626
|
title,
|
|
627
627
|
meta,
|
package/src/tools/wait.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface JobSnapshot {
|
|
|
17
17
|
type: "bash" | "task" | "eval";
|
|
18
18
|
status: "running" | "completed" | "failed" | "cancelled";
|
|
19
19
|
label: string;
|
|
20
|
+
/** What the job is for, in the model's words (a process job's `label` is its command line). */
|
|
21
|
+
intent?: string;
|
|
20
22
|
durationMs: number;
|
|
21
23
|
/** Process exit status when the job reports one. */
|
|
22
24
|
exitCode?: number;
|
package/src/tools/wait.ts
CHANGED
|
@@ -51,6 +51,8 @@ export interface JobSnapshot {
|
|
|
51
51
|
type: "bash" | "task" | "eval";
|
|
52
52
|
status: "running" | "completed" | "failed" | "cancelled";
|
|
53
53
|
label: string;
|
|
54
|
+
/** What the job is for, in the model's words (a process job's `label` is its command line). */
|
|
55
|
+
intent?: string;
|
|
54
56
|
durationMs: number;
|
|
55
57
|
/** Process exit status when the job reports one. */
|
|
56
58
|
exitCode?: number;
|
|
@@ -172,7 +174,7 @@ const PREVIEW_LINE_WIDTH = 80;
|
|
|
172
174
|
function statusToIcon(status: JobSnapshot["status"]): ToolUIStatus {
|
|
173
175
|
switch (status) {
|
|
174
176
|
case "completed":
|
|
175
|
-
return "
|
|
177
|
+
return "success";
|
|
176
178
|
case "failed":
|
|
177
179
|
return "error";
|
|
178
180
|
case "cancelled":
|
|
@@ -219,9 +221,10 @@ function flattenStructuredPreview(text: string): string {
|
|
|
219
221
|
return text.slice(0, PREVIEW_LINES_EXPANDED * PREVIEW_LINE_WIDTH * 2).replace(/\s+/g, " ");
|
|
220
222
|
}
|
|
221
223
|
|
|
222
|
-
/** The row label: a running task's own stage line when it reports one, else the job
|
|
224
|
+
/** The row label: a running task's own stage line when it reports one, else what the job is for, else its label. */
|
|
223
225
|
function jobRowLabel(job: JobSnapshot): string {
|
|
224
|
-
|
|
226
|
+
if (job.type === "task" && job.status === "running" && job.stage?.trim()) return job.stage;
|
|
227
|
+
return job.intent || job.label;
|
|
225
228
|
}
|
|
226
229
|
|
|
227
230
|
/** A job as its tile; `live` while the card's clocks run. */
|
|
@@ -230,7 +233,7 @@ function jobTile(job: JobSnapshot, live: boolean): JobTile {
|
|
|
230
233
|
id: job.id,
|
|
231
234
|
type: job.type,
|
|
232
235
|
status: job.status,
|
|
233
|
-
label: job.label,
|
|
236
|
+
label: job.intent || job.label,
|
|
234
237
|
durationMs: job.durationMs,
|
|
235
238
|
live: live && job.status === "running",
|
|
236
239
|
...(job.widget ? { widget: job.widget } : {}),
|
|
@@ -380,7 +383,7 @@ function jobsRenderResult(
|
|
|
380
383
|
const widgetJobs = sortedJobs.filter(job => job.status === "running" && job.widget?.state === "live");
|
|
381
384
|
const compactJobLines = (width: number, live: boolean): string[] => {
|
|
382
385
|
const lines: string[] = [];
|
|
383
|
-
const indent = " ".repeat(visibleWidth(formatStatusIcon("
|
|
386
|
+
const indent = " ".repeat(visibleWidth(formatStatusIcon("success", uiTheme)) + 1);
|
|
384
387
|
// Failures sort first, so the cap never hides one behind successes;
|
|
385
388
|
// Ctrl+O lists the rest.
|
|
386
389
|
for (const job of settledJobs.slice(0, PREVIEW_LIMITS.COLLAPSED_ITEMS)) {
|