@oh-my-pi/pi-tui 18.2.3 → 18.2.5
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 +29 -0
- package/README.md +43 -0
- package/dist/types/app-keybindings.d.ts +395 -0
- package/dist/types/apps/autoresearch-dashboard.d.ts +43 -0
- package/dist/types/apps/autoresearch-data.d.ts +15 -0
- package/dist/types/apps/cleanse-board.d.ts +66 -0
- package/dist/types/apps/cleanse-picker.d.ts +23 -0
- package/dist/types/apps/debug/log-formatting.d.ts +6 -0
- package/dist/types/apps/debug/log-viewer.d.ts +81 -0
- package/dist/types/apps/debug/protocol-probe.d.ts +42 -0
- package/dist/types/apps/debug/raw-sse-buffer.d.ts +58 -0
- package/dist/types/apps/debug/raw-sse.d.ts +26 -0
- package/dist/types/apps/debug/terminal-info.d.ts +34 -0
- package/dist/types/apps/debug/viewer-frame.d.ts +52 -0
- package/dist/types/apps/git/avatar.d.ts +9 -0
- package/dist/types/apps/git/colors.d.ts +49 -0
- package/dist/types/apps/git/diff-pane.d.ts +188 -0
- package/dist/types/apps/git/git-tui.d.ts +66 -0
- package/dist/types/apps/git/sidebar.d.ts +149 -0
- package/dist/types/apps/git/state.d.ts +117 -0
- package/dist/types/apps/if-bench-board.d.ts +75 -0
- package/dist/types/apps/live-visualizer.d.ts +33 -0
- package/dist/types/apps/ps-data.d.ts +51 -0
- package/dist/types/apps/ps-top.d.ts +33 -0
- package/dist/types/apps/session-picker.d.ts +26 -0
- package/dist/types/apps/setup-model-picker.d.ts +13 -0
- package/dist/types/apps/standalone-picker.d.ts +42 -0
- package/dist/types/autocomplete.d.ts +4 -0
- package/dist/types/chat/advisor-message.d.ts +11 -0
- package/dist/types/chat/assistant-message.d.ts +106 -0
- package/dist/types/chat/background-tan-message.d.ts +9 -0
- package/dist/types/chat/bash-execution.d.ts +47 -0
- package/dist/types/chat/cache-invalidation-marker.d.ts +50 -0
- package/dist/types/chat/chat-transcript-builder.d.ts +50 -0
- package/dist/types/chat/collab-prompt-message.d.ts +10 -0
- package/dist/types/chat/compaction-summary-message.d.ts +54 -0
- package/dist/types/chat/custom-message.d.ts +10 -0
- package/dist/types/chat/display-preferences.d.ts +13 -0
- package/dist/types/chat/eval-execution.d.ts +29 -0
- package/dist/types/chat/execution-shared.d.ts +51 -0
- package/dist/types/chat/extension-types.d.ts +28 -0
- package/dist/types/chat/hook-message.d.ts +10 -0
- package/dist/types/chat/image-loading.d.ts +46 -0
- package/dist/types/chat/late-diagnostics-message.d.ts +21 -0
- package/dist/types/chat/messages.d.ts +189 -0
- package/dist/types/chat/reaction.d.ts +30 -0
- package/dist/types/chat/read-target.d.ts +4 -0
- package/dist/types/chat/read-tool-group.d.ts +67 -0
- package/dist/types/chat/served-model-marker.d.ts +47 -0
- package/dist/types/chat/skill-message.d.ts +33 -0
- package/dist/types/chat/skill-title-input.d.ts +14 -0
- package/dist/types/chat/stripped-tool-calls-placeholder.d.ts +12 -0
- package/dist/types/chat/thinking-display.d.ts +12 -0
- package/dist/types/chat/todo-reminder.d.ts +13 -0
- package/dist/types/chat/tool-execution.d.ts +138 -0
- package/dist/types/chat/transcript-browser.d.ts +93 -0
- package/dist/types/chat/transcript-entry.d.ts +45 -0
- package/dist/types/chat/transcript-outline.d.ts +86 -0
- package/dist/types/chat/transcript-render-helpers.d.ts +92 -0
- package/dist/types/chat/ttsr-notification.d.ts +23 -0
- package/dist/types/chat/user-message.d.ts +52 -0
- package/dist/types/chrome/chat-block.d.ts +64 -0
- package/dist/types/chrome/collab-qrcode.d.ts +28 -0
- package/dist/types/chrome/context-thresholds.d.ts +10 -0
- package/dist/types/chrome/countdown-timer.d.ts +14 -0
- package/dist/types/chrome/diff.d.ts +14 -0
- package/dist/types/chrome/dynamic-border.d.ts +16 -0
- package/dist/types/chrome/error-block.d.ts +17 -0
- package/dist/types/chrome/form-theme.d.ts +3 -0
- package/dist/types/chrome/format.d.ts +12 -0
- package/dist/types/chrome/index.d.ts +20 -0
- package/dist/types/chrome/keybinding-hints.d.ts +40 -0
- package/dist/types/chrome/live-board.d.ts +23 -0
- package/dist/types/chrome/local-date.d.ts +4 -0
- package/dist/types/chrome/message-divider.d.ts +22 -0
- package/dist/types/chrome/message-frame.d.ts +52 -0
- package/dist/types/chrome/message-notice.d.ts +35 -0
- package/dist/types/chrome/overlay-box.d.ts +74 -0
- package/dist/types/chrome/qrcode.d.ts +48 -0
- package/dist/types/chrome/segment-track.d.ts +27 -0
- package/dist/types/chrome/select-list-mouse-routing.d.ts +4 -0
- package/dist/types/chrome/selector-helpers.d.ts +52 -0
- package/dist/types/chrome/shared.d.ts +5 -0
- package/dist/types/chrome/streaming-panel.d.ts +19 -0
- package/dist/types/chrome/tool-activity.d.ts +17 -0
- package/dist/types/chrome/transcript-container.d.ts +129 -0
- package/dist/types/chrome/transcript-status.d.ts +12 -0
- package/dist/types/chrome/visual-truncate.d.ts +19 -0
- package/dist/types/components/disclosure.d.ts +42 -0
- package/dist/types/components/form.d.ts +130 -0
- package/dist/types/components/image.d.ts +18 -16
- package/dist/types/components/key-value-list.d.ts +24 -0
- package/dist/types/components/layout/geometry.d.ts +73 -0
- package/dist/types/components/layout/row.d.ts +55 -0
- package/dist/types/components/layout/split-pane.d.ts +80 -0
- package/dist/types/components/layout/stack.d.ts +50 -0
- package/dist/types/components/menu-selection.d.ts +71 -0
- package/dist/types/components/metric.d.ts +44 -0
- package/dist/types/components/progress-bar.d.ts +36 -0
- package/dist/types/components/scroll-view.d.ts +53 -19
- package/dist/types/components/scroll-viewport.d.ts +46 -0
- package/dist/types/components/section.d.ts +19 -0
- package/dist/types/components/select-list.d.ts +46 -2
- package/dist/types/components/settings-list.d.ts +20 -0
- package/dist/types/components/table.d.ts +32 -0
- package/dist/types/components/tree-view.d.ts +130 -0
- package/dist/types/components/wizard-step.d.ts +60 -0
- package/dist/types/hotkeys-markdown.d.ts +7 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/keybinding-matchers.d.ts +35 -0
- package/dist/types/keys.d.ts +2 -2
- package/dist/types/lang-from-path.d.ts +9 -0
- package/dist/types/overlays/advisor-config.d.ts +114 -0
- package/dist/types/overlays/agent-activity.d.ts +41 -0
- package/dist/types/overlays/agent-hub-projection.d.ts +33 -0
- package/dist/types/overlays/agent-hub-renderer.d.ts +53 -0
- package/dist/types/overlays/agent-hub-types.d.ts +99 -0
- package/dist/types/overlays/agent-hub.d.ts +126 -0
- package/dist/types/overlays/agent-transcript-viewer.d.ts +71 -0
- package/dist/types/overlays/agents-hub.d.ts +72 -0
- package/dist/types/overlays/ask-dialog.d.ts +88 -0
- package/dist/types/overlays/bordered-loader.d.ts +11 -0
- package/dist/types/overlays/btw-history-panel.d.ts +29 -0
- package/dist/types/overlays/btw-history.d.ts +17 -0
- package/dist/types/overlays/btw-panel.d.ts +26 -0
- package/dist/types/overlays/cleanse-panel.d.ts +36 -0
- package/dist/types/overlays/codex-reset-fireworks.d.ts +52 -0
- package/dist/types/overlays/composer-shape-preview.d.ts +47 -0
- package/dist/types/overlays/composer-shape-registry.d.ts +50 -0
- package/dist/types/overlays/copy-selector.d.ts +48 -0
- package/dist/types/overlays/copy-targets.d.ts +63 -0
- package/dist/types/overlays/error-banner.d.ts +13 -0
- package/dist/types/overlays/extensions/display-text.d.ts +10 -0
- package/dist/types/overlays/extensions/extension-dashboard.d.ts +63 -0
- package/dist/types/overlays/extensions/extension-list.d.ts +54 -0
- package/dist/types/overlays/extensions/inspector-model.d.ts +109 -0
- package/dist/types/overlays/extensions/inspector-panel.d.ts +17 -0
- package/dist/types/overlays/extensions/live-tool-session.d.ts +28 -0
- package/dist/types/overlays/extensions/mcp-runtime.d.ts +107 -0
- package/dist/types/overlays/extensions/state-manager.d.ts +42 -0
- package/dist/types/overlays/extensions/types.d.ts +165 -0
- package/dist/types/overlays/history-search.d.ts +16 -0
- package/dist/types/overlays/hook-editor.d.ts +44 -0
- package/dist/types/overlays/hook-input.d.ts +20 -0
- package/dist/types/overlays/hook-selector.d.ts +71 -0
- package/dist/types/overlays/hub-frame.d.ts +77 -0
- package/dist/types/overlays/login-dialog.d.ts +43 -0
- package/dist/types/overlays/logout-account-selector.d.ts +15 -0
- package/dist/types/overlays/mcp-add-wizard.d.ts +87 -0
- package/dist/types/overlays/model-browser.d.ts +213 -0
- package/dist/types/overlays/model-hub.d.ts +72 -0
- package/dist/types/overlays/model-picker.d.ts +74 -0
- package/dist/types/overlays/model-selector.d.ts +52 -0
- package/dist/types/overlays/move-overlay.d.ts +39 -0
- package/dist/types/overlays/oauth-selector.d.ts +41 -0
- package/dist/types/overlays/omfg-panel.d.ts +20 -0
- package/dist/types/overlays/pause-screen.d.ts +43 -0
- package/dist/types/overlays/plan-review-overlay.d.ts +89 -0
- package/dist/types/overlays/plan-save-overlay.d.ts +19 -0
- package/dist/types/overlays/plan-toc.d.ts +41 -0
- package/dist/types/overlays/plugin-selector.d.ts +28 -0
- package/dist/types/overlays/plugin-settings.d.ts +180 -0
- package/dist/types/overlays/queue-mode-selector.d.ts +11 -0
- package/dist/types/overlays/reset-usage-selector.d.ts +23 -0
- package/dist/types/overlays/rewind-selector.d.ts +61 -0
- package/dist/types/overlays/running-subagent-badge.d.ts +6 -0
- package/dist/types/overlays/session-account-selector.d.ts +24 -0
- package/dist/types/overlays/session-info-overlay.d.ts +17 -0
- package/dist/types/overlays/session-observer-registry.d.ts +77 -0
- package/dist/types/overlays/session-selector.d.ts +131 -0
- package/dist/types/overlays/settings-defs.d.ts +119 -0
- package/dist/types/overlays/settings-selector.d.ts +73 -0
- package/dist/types/overlays/show-images-selector.d.ts +11 -0
- package/dist/types/overlays/snapcompact-shape-preview.d.ts +31 -0
- package/dist/types/overlays/theme-selector.d.ts +12 -0
- package/dist/types/overlays/thinking-selector.d.ts +12 -0
- package/dist/types/overlays/tiny-title-download-progress.d.ts +21 -0
- package/dist/types/overlays/tree-selector.d.ts +92 -0
- package/dist/types/overlays/usage-dashboard.d.ts +94 -0
- package/dist/types/overlays/usage-display.d.ts +5 -0
- package/dist/types/overlays/usage-row.d.ts +17 -0
- package/dist/types/prompt/attachment-chips.d.ts +19 -0
- package/dist/types/prompt/composer-attachments.d.ts +71 -0
- package/dist/types/prompt/composer-cache.d.ts +37 -0
- package/dist/types/prompt/composer.d.ts +159 -0
- package/dist/types/prompt/custom-editor.d.ts +261 -0
- package/dist/types/prompt/editor-top-gap.d.ts +18 -0
- package/dist/types/prompt/emoji-autocomplete.d.ts +16 -0
- package/dist/types/prompt/github-ref-autocomplete.d.ts +35 -0
- package/dist/types/prompt/gradient-highlight.d.ts +32 -0
- package/dist/types/prompt/image-format.d.ts +4 -0
- package/dist/types/prompt/image-references.d.ts +26 -0
- package/dist/types/prompt/interactive-context-helpers.d.ts +43 -0
- package/dist/types/prompt/internal-url-autocomplete.d.ts +56 -0
- package/dist/types/prompt/macos-spelling.d.ts +44 -0
- package/dist/types/prompt/magic-keyword-boundary.d.ts +9 -0
- package/dist/types/prompt/magic-keywords.d.ts +26 -0
- package/dist/types/prompt/markdown-prose.d.ts +15 -0
- package/dist/types/prompt/model-mention-autocomplete.d.ts +25 -0
- package/dist/types/prompt/model-mention-syntax.d.ts +24 -0
- package/dist/types/prompt/orchestrate.d.ts +13 -0
- package/dist/types/prompt/prompt-action-autocomplete.d.ts +56 -0
- package/dist/types/prompt/queue-input.d.ts +8 -0
- package/dist/types/prompt/skill-tokens.d.ts +13 -0
- package/dist/types/prompt/tools-markdown.d.ts +12 -0
- package/dist/types/prompt/ultrathink.d.ts +13 -0
- package/dist/types/prompt/usage-amounts.d.ts +26 -0
- package/dist/types/prompt/video.d.ts +18 -0
- package/dist/types/prompt/welcome.d.ts +83 -0
- package/dist/types/prompt/workflow.d.ts +13 -0
- package/dist/types/render/code-cell.d.ts +51 -0
- package/dist/types/render/file-list.d.ts +22 -0
- package/dist/types/render/hyperlink.d.ts +80 -0
- package/dist/types/render/index.d.ts +16 -0
- package/dist/types/render/output-block.d.ts +54 -0
- package/dist/types/render/output-pane.d.ts +80 -0
- package/dist/types/render/render-utils.d.ts +312 -0
- package/dist/types/render/sixel.d.ts +21 -0
- package/dist/types/render/status-line.d.ts +23 -0
- package/dist/types/render/tool-card.d.ts +71 -0
- package/dist/types/render/tree-list.d.ts +29 -0
- package/dist/types/render/types.d.ts +17 -0
- package/dist/types/render/utils.d.ts +43 -0
- package/dist/types/render/width-aware-text.d.ts +23 -0
- package/dist/types/setup/lazy.d.ts +3 -0
- package/dist/types/setup/scenes/composer.d.ts +3 -0
- package/dist/types/setup/scenes/glyph.d.ts +3 -0
- package/dist/types/setup/scenes/model.d.ts +3 -0
- package/dist/types/setup/scenes/outro.d.ts +2 -0
- package/dist/types/setup/scenes/providers.d.ts +3 -0
- package/dist/types/setup/scenes/sign-in.d.ts +21 -0
- package/dist/types/setup/scenes/splash.d.ts +11 -0
- package/dist/types/setup/scenes/theme.d.ts +3 -0
- package/dist/types/setup/scenes/types.d.ts +110 -0
- package/dist/types/setup/scenes/web-search.d.ts +22 -0
- package/dist/types/setup/setup-version.d.ts +11 -0
- package/dist/types/setup/startup-splash.d.ts +9 -0
- package/dist/types/setup/wizard-overlay.d.ts +16 -0
- package/dist/types/setup/wizard.d.ts +25 -0
- package/dist/types/status-line/component.d.ts +182 -0
- package/dist/types/status-line/context-usage.d.ts +156 -0
- package/dist/types/status-line/footer.d.ts +30 -0
- package/dist/types/status-line/git-utils.d.ts +22 -0
- package/dist/types/status-line/host.d.ts +129 -0
- package/dist/types/status-line/index.d.ts +6 -0
- package/dist/types/status-line/loop.d.ts +18 -0
- package/dist/types/status-line/metrics.d.ts +21 -0
- package/dist/types/status-line/presets.d.ts +3 -0
- package/dist/types/status-line/schema.d.ts +15 -0
- package/dist/types/status-line/segments.d.ts +5 -0
- package/dist/types/status-line/separators.d.ts +3 -0
- package/dist/types/status-line/types.d.ts +236 -0
- package/dist/types/stdin-buffer.d.ts +4 -0
- package/dist/types/theme/color.d.ts +24 -0
- package/dist/types/theme/defaults/index.d.ts +9489 -0
- package/dist/types/theme/index.d.ts +4 -0
- package/dist/types/theme/loader.d.ts +23 -0
- package/dist/types/theme/mermaid-cache.d.ts +26 -0
- package/dist/types/theme/schema-validation.d.ts +3 -0
- package/dist/types/theme/schema.d.ts +25 -0
- package/dist/types/theme/session-color.d.ts +43 -0
- package/dist/types/theme/shimmer.d.ts +44 -0
- package/dist/types/theme/symbols.d.ts +34 -0
- package/dist/types/theme/theme-class.d.ts +299 -0
- package/dist/types/theme/theme.d.ts +111 -0
- package/dist/types/theme/tui-adapters.d.ts +30 -0
- package/dist/types/thinking.d.ts +165 -0
- package/dist/types/tools/agent-tree.d.ts +36 -0
- package/dist/types/tools/ask.d.ts +67 -0
- package/dist/types/tools/ast-edit.d.ts +53 -0
- package/dist/types/tools/ast-grep.d.ts +52 -0
- package/dist/types/tools/autoresearch.d.ts +156 -0
- package/dist/types/tools/bash-interactive.d.ts +28 -0
- package/dist/types/tools/bash.d.ts +103 -0
- package/dist/types/tools/conflict-detect.d.ts +43 -0
- package/dist/types/tools/debug.d.ts +60 -0
- package/dist/types/tools/default-renderer.d.ts +24 -0
- package/dist/types/tools/edit.d.ts +158 -0
- package/dist/types/tools/eval-format/code-mode-declarations.d.ts +5 -0
- package/dist/types/tools/eval-format/index.d.ts +5 -0
- package/dist/types/tools/eval-format/javascript.d.ts +2 -0
- package/dist/types/tools/eval-format/python.d.ts +2 -0
- package/dist/types/tools/eval.d.ts +94 -0
- package/dist/types/tools/fetch.d.ts +42 -0
- package/dist/types/tools/gh-format.d.ts +8 -0
- package/dist/types/tools/github.d.ts +144 -0
- package/dist/types/tools/glob.d.ts +44 -0
- package/dist/types/tools/goal.d.ts +42 -0
- package/dist/types/tools/grep.d.ts +64 -0
- package/dist/types/tools/grouped-file-output.d.ts +71 -0
- package/dist/types/tools/hashline-format.d.ts +28 -0
- package/dist/types/tools/hub.d.ts +340 -0
- package/dist/types/tools/index.d.ts +4 -0
- package/dist/types/tools/json-tree.d.ts +59 -0
- package/dist/types/tools/line-ranges.d.ts +29 -0
- package/dist/types/tools/list-limit.d.ts +15 -0
- package/dist/types/tools/lsp.d.ts +72 -0
- package/dist/types/tools/match-line-format.d.ts +11 -0
- package/dist/types/tools/mcp.d.ts +81 -0
- package/dist/types/tools/memory.d.ts +67 -0
- package/dist/types/tools/output-meta.d.ts +151 -0
- package/dist/types/tools/read.d.ts +139 -0
- package/dist/types/tools/renderer.d.ts +98 -0
- package/dist/types/tools/report-tool-issue.d.ts +8 -0
- package/dist/types/tools/resolve.d.ts +47 -0
- package/dist/types/tools/streaming-output.d.ts +282 -0
- package/dist/types/tools/subprocess.d.ts +24 -0
- package/dist/types/tools/task-repair-args.d.ts +53 -0
- package/dist/types/tools/task-yield-assembly.d.ts +20 -0
- package/dist/types/tools/task.d.ts +425 -0
- package/dist/types/tools/terminal-output.d.ts +8 -0
- package/dist/types/tools/think.d.ts +13 -0
- package/dist/types/tools/todo.d.ts +118 -0
- package/dist/types/tools/tool-errors.d.ts +7 -0
- package/dist/types/tools/vibe.d.ts +120 -0
- package/dist/types/tools/web-search.d.ts +195 -0
- package/dist/types/tools/write.d.ts +76 -0
- package/dist/types/tools/xd-url.d.ts +13 -0
- package/dist/types/tools/xdev.d.ts +52 -0
- package/dist/types/tui.d.ts +18 -0
- package/dist/types/utils.d.ts +2 -0
- package/package.json +37 -3
- package/src/app-keybindings.ts +760 -0
- package/src/apps/autoresearch-dashboard.ts +500 -0
- package/src/apps/autoresearch-data.ts +64 -0
- package/src/apps/cleanse-board.ts +341 -0
- package/src/apps/cleanse-picker.ts +57 -0
- package/src/apps/debug/log-formatting.ts +53 -0
- package/src/apps/debug/log-viewer.ts +868 -0
- package/src/apps/debug/protocol-probe.ts +267 -0
- package/src/apps/debug/raw-sse-buffer.ts +449 -0
- package/src/apps/debug/raw-sse.ts +282 -0
- package/src/apps/debug/terminal-info.ts +115 -0
- package/src/apps/debug/viewer-frame.ts +174 -0
- package/src/apps/git/avatar.ts +52 -0
- package/src/apps/git/colors.ts +109 -0
- package/src/apps/git/diff-pane.ts +1512 -0
- package/src/apps/git/git-tui.ts +889 -0
- package/src/apps/git/sidebar.ts +1204 -0
- package/src/apps/git/state.ts +113 -0
- package/src/apps/if-bench-board.ts +324 -0
- package/src/apps/live-visualizer.ts +238 -0
- package/src/apps/ps-data.ts +116 -0
- package/src/apps/ps-top.ts +422 -0
- package/src/apps/session-picker.ts +95 -0
- package/src/apps/setup-model-picker.ts +21 -0
- package/src/apps/standalone-picker.ts +111 -0
- package/src/autocomplete.ts +9 -13
- package/src/chat/advisor-message.ts +175 -0
- package/src/chat/assistant-message.ts +1214 -0
- package/src/chat/background-tan-message.ts +35 -0
- package/src/chat/bash-execution.ts +394 -0
- package/src/chat/cache-invalidation-marker.ts +94 -0
- package/src/chat/chat-transcript-builder.ts +593 -0
- package/src/chat/collab-prompt-message.ts +34 -0
- package/src/chat/compaction-summary-message.ts +261 -0
- package/src/chat/custom-message.ts +23 -0
- package/src/chat/display-preferences.ts +24 -0
- package/src/chat/eval-execution.ts +172 -0
- package/src/chat/execution-shared.ts +113 -0
- package/src/chat/extension-types.ts +46 -0
- package/src/chat/hook-message.ts +20 -0
- package/src/chat/image-loading.ts +122 -0
- package/src/chat/late-diagnostics-message.ts +92 -0
- package/src/chat/messages.ts +305 -0
- package/src/chat/reaction.ts +65 -0
- package/src/chat/read-target.ts +7 -0
- package/src/chat/read-tool-group.ts +873 -0
- package/src/chat/served-model-marker.ts +91 -0
- package/src/chat/skill-message.ts +220 -0
- package/src/chat/skill-title-input.ts +41 -0
- package/src/chat/stripped-tool-calls-placeholder.ts +35 -0
- package/src/chat/thinking-display.ts +312 -0
- package/src/chat/todo-reminder.ts +33 -0
- package/src/chat/tool-execution.ts +1395 -0
- package/src/chat/transcript-browser.ts +268 -0
- package/src/chat/transcript-entry.ts +96 -0
- package/src/chat/transcript-outline.ts +260 -0
- package/src/chat/transcript-render-helpers.ts +315 -0
- package/src/chat/ttsr-notification.ts +123 -0
- package/src/chat/user-message.ts +287 -0
- package/src/chrome/chat-block.ts +110 -0
- package/src/chrome/collab-qrcode.ts +74 -0
- package/src/chrome/context-thresholds.ts +85 -0
- package/src/chrome/countdown-timer.ts +74 -0
- package/src/chrome/diff.ts +266 -0
- package/src/chrome/dynamic-border.ts +36 -0
- package/src/chrome/error-block.ts +63 -0
- package/src/chrome/form-theme.ts +10 -0
- package/src/chrome/format.ts +66 -0
- package/src/chrome/index.ts +21 -0
- package/src/chrome/keybinding-hints.ts +55 -0
- package/src/chrome/live-board.ts +123 -0
- package/src/chrome/local-date.ts +20 -0
- package/src/chrome/message-divider.ts +51 -0
- package/src/chrome/message-frame.ts +164 -0
- package/src/chrome/message-notice.ts +103 -0
- package/src/chrome/overlay-box.ts +301 -0
- package/src/chrome/qrcode.ts +539 -0
- package/src/chrome/segment-track.ts +86 -0
- package/src/chrome/select-list-mouse-routing.ts +11 -0
- package/src/chrome/selector-helpers.ts +119 -0
- package/src/chrome/shared.ts +27 -0
- package/src/chrome/streaming-panel.ts +72 -0
- package/src/chrome/tool-activity.ts +44 -0
- package/src/chrome/transcript-container.ts +902 -0
- package/src/chrome/transcript-status.ts +27 -0
- package/src/chrome/visual-truncate.ts +70 -0
- package/src/components/disclosure.ts +235 -0
- package/src/components/editor.ts +10 -12
- package/src/components/form.ts +566 -0
- package/src/components/image.ts +80 -53
- package/src/components/input.ts +6 -27
- package/src/components/key-value-list.ts +88 -0
- package/src/components/layout/geometry.ts +202 -0
- package/src/components/layout/row.ts +283 -0
- package/src/components/layout/split-pane.ts +349 -0
- package/src/components/layout/stack.ts +261 -0
- package/src/components/markdown.ts +16 -12
- package/src/components/menu-selection.ts +248 -0
- package/src/components/metric.ts +132 -0
- package/src/components/progress-bar.ts +140 -0
- package/src/components/scroll-view.ts +372 -70
- package/src/components/scroll-viewport.ts +154 -0
- package/src/components/section.ts +77 -0
- package/src/components/select-list.ts +238 -159
- package/src/components/settings-list.ts +103 -80
- package/src/components/table.ts +127 -0
- package/src/components/tree-view.ts +481 -0
- package/src/components/wizard-step.ts +229 -0
- package/src/deccara.ts +1 -3
- package/src/hotkeys-markdown.ts +100 -0
- package/src/index.ts +18 -0
- package/src/keybinding-matchers.ts +99 -0
- package/src/keys.ts +2 -2
- package/src/lang-from-path.ts +252 -0
- package/src/overlays/advisor-config.ts +761 -0
- package/src/overlays/agent-activity.ts +113 -0
- package/src/overlays/agent-hub-projection.ts +250 -0
- package/src/overlays/agent-hub-renderer.ts +281 -0
- package/src/overlays/agent-hub-types.ts +74 -0
- package/src/overlays/agent-hub.ts +1562 -0
- package/src/overlays/agent-transcript-viewer.ts +669 -0
- package/src/overlays/agents-hub.ts +1203 -0
- package/src/overlays/ask-dialog.ts +1202 -0
- package/src/overlays/bordered-loader.ts +41 -0
- package/src/overlays/btw-history-panel.ts +591 -0
- package/src/overlays/btw-history.ts +33 -0
- package/src/overlays/btw-panel.ts +167 -0
- package/src/overlays/cleanse-panel.ts +167 -0
- package/src/overlays/codex-reset-fireworks.ts +375 -0
- package/src/overlays/composer-shape-preview.ts +137 -0
- package/src/overlays/composer-shape-registry.ts +82 -0
- package/src/overlays/copy-selector.ts +618 -0
- package/src/overlays/copy-targets.ts +210 -0
- package/src/overlays/error-banner.ts +39 -0
- package/src/overlays/extensions/display-text.ts +39 -0
- package/src/overlays/extensions/extension-dashboard.ts +645 -0
- package/src/overlays/extensions/extension-list.ts +667 -0
- package/src/overlays/extensions/inspector-model.ts +484 -0
- package/src/overlays/extensions/inspector-panel.ts +669 -0
- package/src/overlays/extensions/live-tool-session.ts +67 -0
- package/src/overlays/extensions/mcp-runtime.ts +289 -0
- package/src/overlays/extensions/state-manager.ts +337 -0
- package/src/overlays/extensions/types.ts +208 -0
- package/src/overlays/history-search.ts +268 -0
- package/src/overlays/hook-editor.ts +272 -0
- package/src/overlays/hook-input.ts +84 -0
- package/src/overlays/hook-selector.ts +635 -0
- package/src/overlays/hub-frame.ts +262 -0
- package/src/overlays/login-dialog.ts +231 -0
- package/src/overlays/logout-account-selector.ts +115 -0
- package/src/overlays/mcp-add-wizard.ts +1436 -0
- package/src/overlays/model-browser.ts +1176 -0
- package/src/overlays/model-hub.ts +2279 -0
- package/src/overlays/model-picker.ts +285 -0
- package/src/overlays/model-selector.ts +107 -0
- package/src/overlays/move-overlay.ts +197 -0
- package/src/overlays/oauth-selector.ts +446 -0
- package/src/overlays/omfg-panel.ts +136 -0
- package/src/overlays/pause-screen.ts +198 -0
- package/src/overlays/plan-review-overlay.ts +1227 -0
- package/src/overlays/plan-save-overlay.ts +74 -0
- package/src/overlays/plan-toc.ts +139 -0
- package/src/overlays/plugin-selector.ts +97 -0
- package/src/overlays/plugin-settings.ts +839 -0
- package/src/overlays/queue-mode-selector.ts +55 -0
- package/src/overlays/reset-usage-selector.ts +170 -0
- package/src/overlays/rewind-selector.ts +499 -0
- package/src/overlays/running-subagent-badge.ts +19 -0
- package/src/overlays/session-account-selector.ts +68 -0
- package/src/overlays/session-info-overlay.ts +96 -0
- package/src/overlays/session-observer-registry.ts +289 -0
- package/src/overlays/session-selector.ts +1137 -0
- package/src/overlays/settings-defs.ts +315 -0
- package/src/overlays/settings-selector.ts +1415 -0
- package/src/overlays/show-images-selector.ts +44 -0
- package/src/overlays/snapcompact-shape-preview-doc.md +14 -0
- package/src/overlays/snapcompact-shape-preview.ts +192 -0
- package/src/overlays/theme-selector.ts +62 -0
- package/src/overlays/thinking-selector.ts +51 -0
- package/src/overlays/tiny-title-download-progress.ts +102 -0
- package/src/overlays/tree-selector.ts +1121 -0
- package/src/overlays/usage-dashboard.ts +629 -0
- package/src/overlays/usage-display.ts +45 -0
- package/src/overlays/usage-row.ts +118 -0
- package/src/prompt/attachment-chips.ts +201 -0
- package/src/prompt/composer-attachments.ts +280 -0
- package/src/prompt/composer-cache.ts +304 -0
- package/src/prompt/composer.ts +934 -0
- package/src/prompt/custom-editor.ts +1392 -0
- package/src/prompt/data/emojis.json +1 -0
- package/src/prompt/editor-top-gap.ts +28 -0
- package/src/prompt/emoji-autocomplete.ts +285 -0
- package/src/prompt/github-ref-autocomplete.ts +75 -0
- package/src/prompt/gradient-highlight.ts +101 -0
- package/src/prompt/image-format.ts +28 -0
- package/src/prompt/image-references.ts +102 -0
- package/src/prompt/interactive-context-helpers.ts +126 -0
- package/src/prompt/internal-url-autocomplete.ts +155 -0
- package/src/prompt/macos-spelling.ts +456 -0
- package/src/prompt/magic-keyword-boundary.ts +23 -0
- package/src/prompt/magic-keywords.ts +42 -0
- package/src/prompt/markdown-prose.ts +245 -0
- package/src/prompt/model-mention-autocomplete.ts +94 -0
- package/src/prompt/model-mention-syntax.ts +41 -0
- package/src/prompt/orchestrate.ts +26 -0
- package/src/prompt/prompt-action-autocomplete.ts +337 -0
- package/src/prompt/queue-input.ts +132 -0
- package/src/prompt/skill-tokens.ts +36 -0
- package/src/prompt/tips.txt +27 -0
- package/src/prompt/tools-markdown.ts +29 -0
- package/src/prompt/ultrathink.ts +26 -0
- package/src/prompt/usage-amounts.ts +99 -0
- package/src/prompt/video.ts +47 -0
- package/src/prompt/welcome.ts +605 -0
- package/src/prompt/workflow.ts +26 -0
- package/src/render/code-cell.ts +244 -0
- package/src/render/file-list.ts +58 -0
- package/src/render/hyperlink.ts +192 -0
- package/src/render/index.ts +17 -0
- package/src/render/output-block.ts +267 -0
- package/src/render/output-pane.ts +299 -0
- package/src/render/render-utils.ts +1182 -0
- package/src/render/sixel.ts +69 -0
- package/src/render/status-line.ts +55 -0
- package/src/render/tool-card.ts +272 -0
- package/src/render/tree-list.ts +188 -0
- package/src/render/types.ts +19 -0
- package/src/render/utils.ts +109 -0
- package/src/render/width-aware-text.ts +60 -0
- package/src/setup/lazy.ts +17 -0
- package/src/setup/scenes/composer.ts +127 -0
- package/src/setup/scenes/glyph.ts +120 -0
- package/src/setup/scenes/model.ts +138 -0
- package/src/setup/scenes/outro.ts +24 -0
- package/src/setup/scenes/providers.ts +107 -0
- package/src/setup/scenes/sign-in.ts +373 -0
- package/src/setup/scenes/splash.ts +192 -0
- package/src/setup/scenes/theme.ts +343 -0
- package/src/setup/scenes/types.ts +111 -0
- package/src/setup/scenes/web-search.ts +165 -0
- package/src/setup/setup-version.ts +11 -0
- package/src/setup/startup-splash.ts +107 -0
- package/src/setup/wizard-overlay.ts +319 -0
- package/src/setup/wizard.ts +101 -0
- package/src/status-line/component.ts +3003 -0
- package/src/status-line/context-usage.ts +688 -0
- package/src/status-line/footer.ts +323 -0
- package/src/status-line/git-utils.ts +42 -0
- package/src/status-line/host.ts +97 -0
- package/src/status-line/index.ts +6 -0
- package/src/status-line/loop.ts +28 -0
- package/src/status-line/metrics.ts +94 -0
- package/src/status-line/presets.ts +107 -0
- package/src/status-line/schema.ts +57 -0
- package/src/status-line/segments.ts +934 -0
- package/src/status-line/separators.ts +55 -0
- package/src/status-line/types.ts +227 -0
- package/src/stdin-buffer.ts +4 -2
- package/src/theme/color.ts +95 -0
- package/src/theme/dark.json +95 -0
- package/src/theme/defaults/alabaster.json +93 -0
- package/src/theme/defaults/amethyst.json +96 -0
- package/src/theme/defaults/anthracite.json +93 -0
- package/src/theme/defaults/basalt.json +91 -0
- package/src/theme/defaults/birch.json +95 -0
- package/src/theme/defaults/dark-abyss.json +91 -0
- package/src/theme/defaults/dark-arctic.json +104 -0
- package/src/theme/defaults/dark-aurora.json +95 -0
- package/src/theme/defaults/dark-catppuccin.json +107 -0
- package/src/theme/defaults/dark-cavern.json +91 -0
- package/src/theme/defaults/dark-celestial.json +106 -0
- package/src/theme/defaults/dark-copper.json +95 -0
- package/src/theme/defaults/dark-cosmos.json +90 -0
- package/src/theme/defaults/dark-cyberpunk.json +102 -0
- package/src/theme/defaults/dark-dracula.json +98 -0
- package/src/theme/defaults/dark-eclipse.json +91 -0
- package/src/theme/defaults/dark-ember.json +95 -0
- package/src/theme/defaults/dark-equinox.json +90 -0
- package/src/theme/defaults/dark-forest.json +96 -0
- package/src/theme/defaults/dark-github.json +105 -0
- package/src/theme/defaults/dark-gruvbox.json +112 -0
- package/src/theme/defaults/dark-lavender.json +95 -0
- package/src/theme/defaults/dark-lunar.json +89 -0
- package/src/theme/defaults/dark-midnight.json +95 -0
- package/src/theme/defaults/dark-monochrome.json +94 -0
- package/src/theme/defaults/dark-monokai.json +98 -0
- package/src/theme/defaults/dark-nebula.json +90 -0
- package/src/theme/defaults/dark-nord.json +98 -0
- package/src/theme/defaults/dark-ocean.json +101 -0
- package/src/theme/defaults/dark-one.json +100 -0
- package/src/theme/defaults/dark-poimandres.json +115 -0
- package/src/theme/defaults/dark-rainforest.json +91 -0
- package/src/theme/defaults/dark-reef.json +91 -0
- package/src/theme/defaults/dark-retro.json +92 -0
- package/src/theme/defaults/dark-rose-pine.json +96 -0
- package/src/theme/defaults/dark-sakura.json +95 -0
- package/src/theme/defaults/dark-slate.json +95 -0
- package/src/theme/defaults/dark-solarized.json +97 -0
- package/src/theme/defaults/dark-solstice.json +90 -0
- package/src/theme/defaults/dark-starfall.json +91 -0
- package/src/theme/defaults/dark-sunset.json +99 -0
- package/src/theme/defaults/dark-swamp.json +90 -0
- package/src/theme/defaults/dark-synthwave.json +103 -0
- package/src/theme/defaults/dark-taiga.json +91 -0
- package/src/theme/defaults/dark-terminal.json +95 -0
- package/src/theme/defaults/dark-tokyo-night.json +101 -0
- package/src/theme/defaults/dark-tundra.json +91 -0
- package/src/theme/defaults/dark-twilight.json +91 -0
- package/src/theme/defaults/dark-volcanic.json +91 -0
- package/src/theme/defaults/graphite.json +92 -0
- package/src/theme/defaults/index.ts +201 -0
- package/src/theme/defaults/light-arctic.json +107 -0
- package/src/theme/defaults/light-aurora-day.json +91 -0
- package/src/theme/defaults/light-canyon.json +91 -0
- package/src/theme/defaults/light-catppuccin.json +106 -0
- package/src/theme/defaults/light-cirrus.json +90 -0
- package/src/theme/defaults/light-coral.json +95 -0
- package/src/theme/defaults/light-cyberpunk.json +96 -0
- package/src/theme/defaults/light-dawn.json +90 -0
- package/src/theme/defaults/light-dunes.json +91 -0
- package/src/theme/defaults/light-eucalyptus.json +95 -0
- package/src/theme/defaults/light-forest.json +100 -0
- package/src/theme/defaults/light-frost.json +95 -0
- package/src/theme/defaults/light-github.json +115 -0
- package/src/theme/defaults/light-glacier.json +91 -0
- package/src/theme/defaults/light-gruvbox.json +108 -0
- package/src/theme/defaults/light-haze.json +90 -0
- package/src/theme/defaults/light-honeycomb.json +95 -0
- package/src/theme/defaults/light-lagoon.json +91 -0
- package/src/theme/defaults/light-lavender.json +95 -0
- package/src/theme/defaults/light-meadow.json +91 -0
- package/src/theme/defaults/light-mint.json +95 -0
- package/src/theme/defaults/light-monochrome.json +101 -0
- package/src/theme/defaults/light-ocean.json +99 -0
- package/src/theme/defaults/light-one.json +99 -0
- package/src/theme/defaults/light-opal.json +91 -0
- package/src/theme/defaults/light-orchard.json +91 -0
- package/src/theme/defaults/light-paper.json +95 -0
- package/src/theme/defaults/light-poimandres.json +115 -0
- package/src/theme/defaults/light-prism.json +90 -0
- package/src/theme/defaults/light-retro.json +98 -0
- package/src/theme/defaults/light-sand.json +95 -0
- package/src/theme/defaults/light-savanna.json +91 -0
- package/src/theme/defaults/light-solarized.json +102 -0
- package/src/theme/defaults/light-soleil.json +90 -0
- package/src/theme/defaults/light-sunset.json +99 -0
- package/src/theme/defaults/light-synthwave.json +98 -0
- package/src/theme/defaults/light-tokyo-night.json +111 -0
- package/src/theme/defaults/light-wetland.json +91 -0
- package/src/theme/defaults/light-zenith.json +89 -0
- package/src/theme/defaults/limestone.json +94 -0
- package/src/theme/defaults/mahogany.json +97 -0
- package/src/theme/defaults/marble.json +93 -0
- package/src/theme/defaults/obsidian.json +91 -0
- package/src/theme/defaults/onyx.json +91 -0
- package/src/theme/defaults/pearl.json +93 -0
- package/src/theme/defaults/porcelain.json +91 -0
- package/src/theme/defaults/quartz.json +96 -0
- package/src/theme/defaults/sandstone.json +95 -0
- package/src/theme/defaults/titanium.json +90 -0
- package/src/theme/index.ts +5 -0
- package/src/theme/light.json +93 -0
- package/src/theme/loader.ts +200 -0
- package/src/theme/mermaid-cache.ts +92 -0
- package/src/theme/schema-validation.ts +119 -0
- package/src/theme/schema.ts +168 -0
- package/src/theme/session-color.ts +253 -0
- package/src/theme/shimmer.ts +307 -0
- package/src/theme/symbols.ts +1433 -0
- package/src/theme/theme-class.ts +787 -0
- package/src/theme/theme-schema.json +463 -0
- package/src/theme/theme.ts +810 -0
- package/src/theme/tui-adapters.ts +339 -0
- package/src/thinking.ts +380 -0
- package/src/tools/agent-tree.ts +128 -0
- package/src/tools/ask.ts +482 -0
- package/src/tools/ast-edit.ts +210 -0
- package/src/tools/ast-grep.ts +171 -0
- package/src/tools/autoresearch.ts +287 -0
- package/src/tools/bash-interactive.ts +295 -0
- package/src/tools/bash.ts +468 -0
- package/src/tools/conflict-detect.ts +77 -0
- package/src/tools/debug.ts +167 -0
- package/src/tools/default-renderer.ts +172 -0
- package/src/tools/edit.ts +1258 -0
- package/src/tools/eval-format/code-mode-declarations.ts +61 -0
- package/src/tools/eval-format/index.ts +16 -0
- package/src/tools/eval-format/javascript.ts +952 -0
- package/src/tools/eval-format/python.ts +544 -0
- package/src/tools/eval.ts +835 -0
- package/src/tools/fetch.ts +226 -0
- package/src/tools/gh-format.ts +18 -0
- package/src/tools/github.ts +686 -0
- package/src/tools/glob.ts +213 -0
- package/src/tools/goal.ts +153 -0
- package/src/tools/grep.ts +385 -0
- package/src/tools/grouped-file-output.ts +211 -0
- package/src/tools/hashline-format.ts +59 -0
- package/src/tools/hub.ts +1488 -0
- package/src/tools/index.ts +71 -0
- package/src/tools/json-tree.ts +388 -0
- package/src/tools/line-ranges.ts +98 -0
- package/src/tools/list-limit.ts +43 -0
- package/src/tools/lsp.ts +702 -0
- package/src/tools/match-line-format.ts +20 -0
- package/src/tools/mcp.ts +309 -0
- package/src/tools/memory.ts +220 -0
- package/src/tools/output-meta.ts +367 -0
- package/src/tools/read.ts +628 -0
- package/src/tools/renderer.ts +107 -0
- package/src/tools/report-tool-issue.ts +13 -0
- package/src/tools/resolve.ts +139 -0
- package/src/tools/streaming-output.ts +1576 -0
- package/src/tools/subprocess.ts +39 -0
- package/src/tools/task-repair-args.ts +118 -0
- package/src/tools/task-yield-assembly.ts +147 -0
- package/src/tools/task.ts +2110 -0
- package/src/tools/terminal-output.ts +153 -0
- package/src/tools/think.ts +28 -0
- package/src/tools/todo.ts +580 -0
- package/src/tools/tool-errors.ts +15 -0
- package/src/tools/vibe.ts +420 -0
- package/src/tools/web-search.ts +409 -0
- package/src/tools/write.ts +511 -0
- package/src/tools/xd-url.ts +28 -0
- package/src/tools/xdev.ts +201 -0
- package/src/tui.ts +70 -8
- package/src/utils.ts +8 -0
|
@@ -0,0 +1,835 @@
|
|
|
1
|
+
import type { Component } from "../index";
|
|
2
|
+
import { Markdown, Text } from "../index";
|
|
3
|
+
import { sanitizeText } from "@oh-my-pi/pi-utils";
|
|
4
|
+
import type { RenderResultOptions, ToolRenderer } from "./renderer";
|
|
5
|
+
import { renderAgentTreeRow } from "./agent-tree";
|
|
6
|
+
import { truncateToVisualLines } from "../chrome/visual-truncate";
|
|
7
|
+
import { getMarkdownTheme, type Theme } from "../theme/theme";
|
|
8
|
+
import { markFramedBlockComponent, outputBlockContentWidth, renderCodeCell } from "../render/index";
|
|
9
|
+
import { formatOutputPaneLines } from "../render/output-pane";
|
|
10
|
+
import { formatEvalCodeForDisplay } from "./eval-format/index";
|
|
11
|
+
import {
|
|
12
|
+
JSON_TREE_MAX_DEPTH_COLLAPSED,
|
|
13
|
+
JSON_TREE_MAX_DEPTH_EXPANDED,
|
|
14
|
+
JSON_TREE_MAX_LINES_COLLAPSED,
|
|
15
|
+
JSON_TREE_MAX_LINES_EXPANDED,
|
|
16
|
+
JSON_TREE_SCALAR_LEN_COLLAPSED,
|
|
17
|
+
JSON_TREE_SCALAR_LEN_EXPANDED,
|
|
18
|
+
renderJsonTreeLines,
|
|
19
|
+
} from "./json-tree";
|
|
20
|
+
import { formatStyledTruncationWarning, stripOutputNotice } from "./output-meta";
|
|
21
|
+
import {
|
|
22
|
+
DEFAULT_TERMINAL_PREVIEW_LINES,
|
|
23
|
+
cappedHeadLines,
|
|
24
|
+
formatTitle,
|
|
25
|
+
previewWindowRows,
|
|
26
|
+
replaceTabs,
|
|
27
|
+
shortenPath,
|
|
28
|
+
truncateToWidth,
|
|
29
|
+
wrapBrackets,
|
|
30
|
+
} from "../render/render-utils";
|
|
31
|
+
import type { ImageContent } from "@oh-my-pi/pi-ai";
|
|
32
|
+
import type { OutputMeta } from "./output-meta";
|
|
33
|
+
import type { ConfiguredThinkingLevel } from "../render/render-utils";
|
|
34
|
+
|
|
35
|
+
/** Runtime backend that an eval cell dispatches to. */
|
|
36
|
+
export type EvalLanguage = "python" | "js";
|
|
37
|
+
|
|
38
|
+
/** Status event emitted by eval prelude helpers for TUI rendering. */
|
|
39
|
+
export interface EvalStatusEvent {
|
|
40
|
+
op: string;
|
|
41
|
+
/** Validated thinking level supplied by the execution layer. */
|
|
42
|
+
resolvedThinkingLevel?: ConfiguredThinkingLevel;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Per-cell execution result for transcript rendering. */
|
|
47
|
+
export interface EvalCellResult {
|
|
48
|
+
index: number;
|
|
49
|
+
title?: string;
|
|
50
|
+
code: string;
|
|
51
|
+
language?: EvalLanguage;
|
|
52
|
+
output: string;
|
|
53
|
+
status: "pending" | "running" | "complete" | "error";
|
|
54
|
+
durationMs?: number;
|
|
55
|
+
exitCode?: number;
|
|
56
|
+
statusEvents?: EvalStatusEvent[];
|
|
57
|
+
hasMarkdown?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Tool result detail object surfaced to the UI/transcript. */
|
|
61
|
+
export interface EvalToolDetails {
|
|
62
|
+
cells?: EvalCellResult[];
|
|
63
|
+
jsonOutputs?: unknown[];
|
|
64
|
+
images?: ImageContent[];
|
|
65
|
+
statusEvents?: EvalStatusEvent[];
|
|
66
|
+
isError?: boolean;
|
|
67
|
+
meta?: OutputMeta;
|
|
68
|
+
/** First backend that produced cells. Kept for transcript compatibility. */
|
|
69
|
+
language?: EvalLanguage;
|
|
70
|
+
/** Backends that produced cells in this call, in first-use order. */
|
|
71
|
+
languages?: EvalLanguage[];
|
|
72
|
+
/** Optional human-readable notice (e.g. fallback explanation). */
|
|
73
|
+
notice?: string;
|
|
74
|
+
/** Present when the cell was auto-backgrounded as an async job. */
|
|
75
|
+
async?: {
|
|
76
|
+
state: "running" | "completed" | "failed";
|
|
77
|
+
jobId: string;
|
|
78
|
+
type: "eval";
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Default collapsed eval output preview height; kept as a named alias (consumed by chat/tool-execution). */
|
|
83
|
+
export const EVAL_DEFAULT_PREVIEW_LINES: number = DEFAULT_TERMINAL_PREVIEW_LINES;
|
|
84
|
+
|
|
85
|
+
function languageForHighlighter(language: EvalLanguage | undefined): "python" | "javascript" {
|
|
86
|
+
if (language === "js") return "javascript";
|
|
87
|
+
return "python";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface EvalRenderCellArg {
|
|
91
|
+
language?: string;
|
|
92
|
+
code?: string;
|
|
93
|
+
title?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface EvalRenderArgs {
|
|
97
|
+
language?: string;
|
|
98
|
+
code?: string;
|
|
99
|
+
title?: string;
|
|
100
|
+
cells?: EvalRenderCellArg[];
|
|
101
|
+
__partialJson?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface EvalRenderContext {
|
|
105
|
+
output?: string;
|
|
106
|
+
expanded?: boolean;
|
|
107
|
+
previewLines?: number;
|
|
108
|
+
timeout?: number;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface EvalRenderCell {
|
|
112
|
+
language: EvalLanguage;
|
|
113
|
+
code: string;
|
|
114
|
+
title?: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function normalizeRenderLanguage(value: string | undefined): EvalLanguage {
|
|
118
|
+
if (value === "js") return "js";
|
|
119
|
+
return "python";
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function getRenderCells(args: EvalRenderArgs | undefined): EvalRenderCell[] {
|
|
123
|
+
if (!args) return [];
|
|
124
|
+
const raw = Array.isArray(args.cells) ? args.cells : typeof args.code === "string" ? [args] : [];
|
|
125
|
+
const out: EvalRenderCell[] = [];
|
|
126
|
+
for (const cell of raw) {
|
|
127
|
+
if (!cell || typeof cell !== "object") continue;
|
|
128
|
+
const language = normalizeRenderLanguage(typeof cell.language === "string" ? cell.language : undefined);
|
|
129
|
+
const code = typeof cell.code === "string" ? cell.code : "";
|
|
130
|
+
out.push({
|
|
131
|
+
language,
|
|
132
|
+
code: formatEvalCodeForDisplay(code, language),
|
|
133
|
+
title: typeof cell.title === "string" ? cell.title : undefined,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
type AgentEventStatus = "pending" | "running" | "completed" | "failed" | "aborted";
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Append or replace a status event. `agent` events are progress snapshots keyed
|
|
143
|
+
* by `id`, so they coalesce in place (preserving first-seen order); every other
|
|
144
|
+
* op is a discrete action and simply appends. Keeps the persisted event list
|
|
145
|
+
* bounded even when a subagent emits hundreds of throttled progress ticks.
|
|
146
|
+
*/
|
|
147
|
+
export function upsertStatusEvent(events: EvalStatusEvent[], event: EvalStatusEvent): void {
|
|
148
|
+
if (event.op === "agent" && typeof event.id === "string") {
|
|
149
|
+
const id = event.id;
|
|
150
|
+
const idx = events.findIndex(e => e.op === "agent" && e.id === id);
|
|
151
|
+
if (idx >= 0) {
|
|
152
|
+
events[idx] = event;
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
events.push(event);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function eventString(value: unknown): string | undefined {
|
|
160
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function eventNumber(value: unknown): number {
|
|
164
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function agentEventStatus(value: unknown): AgentEventStatus {
|
|
168
|
+
switch (value) {
|
|
169
|
+
case "pending":
|
|
170
|
+
case "running":
|
|
171
|
+
case "completed":
|
|
172
|
+
case "failed":
|
|
173
|
+
case "aborted":
|
|
174
|
+
return value;
|
|
175
|
+
default:
|
|
176
|
+
return "running";
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Render coalesced `agent()` progress as a Task-tool-style tree, one entry per
|
|
182
|
+
* subagent: a status line (icon · id · stats) plus, while running, the current
|
|
183
|
+
* tool/intent. Drawn below the cell box so progress streams live.
|
|
184
|
+
*/
|
|
185
|
+
function renderAgentProgressEvents(
|
|
186
|
+
events: EvalStatusEvent[],
|
|
187
|
+
theme: Theme,
|
|
188
|
+
width: number,
|
|
189
|
+
spinnerFrame?: number,
|
|
190
|
+
): string[] {
|
|
191
|
+
const lines: string[] = [];
|
|
192
|
+
for (let i = 0; i < events.length; i++) {
|
|
193
|
+
const event = events[i];
|
|
194
|
+
const isLast = i === events.length - 1;
|
|
195
|
+
const prefix = theme.fg("dim", isLast ? theme.tree.last : theme.tree.branch);
|
|
196
|
+
const cont = isLast ? " " : `${theme.fg("dim", theme.tree.vertical)} `;
|
|
197
|
+
|
|
198
|
+
const status = agentEventStatus(event.status);
|
|
199
|
+
const currentTool = eventString(event.currentTool);
|
|
200
|
+
const lastIntent = eventString(event.lastIntent);
|
|
201
|
+
const preview = status === "running" && !currentTool && !lastIntent ? eventString(event.taskPreview) : undefined;
|
|
202
|
+
const toolCount = eventNumber(event.toolCount);
|
|
203
|
+
lines.push(
|
|
204
|
+
renderAgentTreeRow(
|
|
205
|
+
{
|
|
206
|
+
presentation: "eval",
|
|
207
|
+
status,
|
|
208
|
+
prefix,
|
|
209
|
+
id: sanitizeText(eventString(event.id) ?? "agent").replace(/\s+/g, " "),
|
|
210
|
+
width,
|
|
211
|
+
model: eventString(event.resolvedModelIdentity ?? event.model ?? event.resolvedModel),
|
|
212
|
+
thinkingLevel: event.resolvedThinkingLevel,
|
|
213
|
+
advisor: event.advisor === true,
|
|
214
|
+
spinnerFrame,
|
|
215
|
+
preview: preview ? ` ${theme.fg("muted", truncateToWidth(replaceTabs(preview), 48))}` : undefined,
|
|
216
|
+
stats: {
|
|
217
|
+
toolCount: toolCount > 0 ? toolCount : 0,
|
|
218
|
+
contextTokens: eventNumber(event.contextTokens),
|
|
219
|
+
contextWindow: eventNumber(event.contextWindow),
|
|
220
|
+
cost: eventNumber(event.cost),
|
|
221
|
+
},
|
|
222
|
+
durationMs:
|
|
223
|
+
status === "completed" || status === "failed" || status === "aborted"
|
|
224
|
+
? eventNumber(event.durationMs)
|
|
225
|
+
: undefined,
|
|
226
|
+
},
|
|
227
|
+
theme,
|
|
228
|
+
).line,
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
if (status === "running") {
|
|
232
|
+
if (currentTool) {
|
|
233
|
+
let toolLine = `${cont}${theme.tree.hook} ${theme.fg("muted", currentTool)}`;
|
|
234
|
+
const detail = lastIntent ?? eventString(event.currentToolArgs);
|
|
235
|
+
if (detail) toolLine += `: ${theme.fg("dim", truncateToWidth(replaceTabs(detail), 48))}`;
|
|
236
|
+
lines.push(truncateToWidth(toolLine, width));
|
|
237
|
+
} else if (lastIntent) {
|
|
238
|
+
lines.push(
|
|
239
|
+
truncateToWidth(
|
|
240
|
+
`${cont}${theme.tree.hook} ${theme.fg("dim", truncateToWidth(replaceTabs(lastIntent), 48))}`,
|
|
241
|
+
width,
|
|
242
|
+
),
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return lines;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** Format a status event as a single line for display. */
|
|
251
|
+
function formatStatusEvent(event: EvalStatusEvent, theme: Theme): string {
|
|
252
|
+
const { op, ...data } = event;
|
|
253
|
+
|
|
254
|
+
type AvailableIcon = "icon.file" | "icon.folder" | "icon.git" | "icon.package" | "cmd.globe" | "cmd.computer";
|
|
255
|
+
const opIcons: Record<string, AvailableIcon> = {
|
|
256
|
+
browser: "cmd.globe",
|
|
257
|
+
computer: "cmd.computer",
|
|
258
|
+
read: "icon.file",
|
|
259
|
+
write: "icon.file",
|
|
260
|
+
cat: "icon.file",
|
|
261
|
+
touch: "icon.file",
|
|
262
|
+
ls: "icon.folder",
|
|
263
|
+
cd: "icon.folder",
|
|
264
|
+
pwd: "icon.folder",
|
|
265
|
+
mkdir: "icon.folder",
|
|
266
|
+
git_status: "icon.git",
|
|
267
|
+
git_diff: "icon.git",
|
|
268
|
+
git_log: "icon.git",
|
|
269
|
+
git_show: "icon.git",
|
|
270
|
+
git_branch: "icon.git",
|
|
271
|
+
git_file_at: "icon.git",
|
|
272
|
+
git_has_changes: "icon.git",
|
|
273
|
+
run: "icon.package",
|
|
274
|
+
sh: "icon.package",
|
|
275
|
+
env: "icon.package",
|
|
276
|
+
batch: "icon.package",
|
|
277
|
+
completion: "icon.package",
|
|
278
|
+
tool_define: "icon.package",
|
|
279
|
+
workpool: "icon.package",
|
|
280
|
+
log: "icon.package",
|
|
281
|
+
phase: "icon.package",
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const iconKey = opIcons[op] ?? "icon.file";
|
|
285
|
+
const icon = theme.styledSymbol(iconKey, "muted");
|
|
286
|
+
|
|
287
|
+
const parts: string[] = [];
|
|
288
|
+
|
|
289
|
+
if (data.error) {
|
|
290
|
+
return `${icon} ${theme.fg("warning", op)}: ${theme.fg("dim", String(data.error))}`;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
switch (op) {
|
|
294
|
+
case "read":
|
|
295
|
+
parts.push(`${data.chars ?? data.bytes ?? 0} chars`);
|
|
296
|
+
if (data.path) parts.push(`from ${shortenPath(String(data.path))}`);
|
|
297
|
+
break;
|
|
298
|
+
case "write":
|
|
299
|
+
parts.push(`${data.chars ?? data.bytes ?? 0} chars`);
|
|
300
|
+
if (data.path) parts.push(`to ${shortenPath(String(data.path))}`);
|
|
301
|
+
break;
|
|
302
|
+
case "cat":
|
|
303
|
+
parts.push(`${data.files} file${(data.files as number) !== 1 ? "s" : ""}`);
|
|
304
|
+
parts.push(`${data.chars} chars`);
|
|
305
|
+
break;
|
|
306
|
+
case "ls":
|
|
307
|
+
parts.push(`${data.count} entr${(data.count as number) !== 1 ? "ies" : "y"}`);
|
|
308
|
+
break;
|
|
309
|
+
case "env":
|
|
310
|
+
if (data.action === "set") {
|
|
311
|
+
parts.push(`set ${data.key}=${truncateToWidth(String(data.value ?? ""), 30)}`);
|
|
312
|
+
} else if (data.action === "get") {
|
|
313
|
+
parts.push(`${data.key}=${truncateToWidth(String(data.value ?? ""), 30)}`);
|
|
314
|
+
} else {
|
|
315
|
+
parts.push(`${data.count} variable${(data.count as number) !== 1 ? "s" : ""}`);
|
|
316
|
+
}
|
|
317
|
+
break;
|
|
318
|
+
case "git_status":
|
|
319
|
+
if (data.clean) {
|
|
320
|
+
parts.push("clean");
|
|
321
|
+
} else {
|
|
322
|
+
const statusParts: string[] = [];
|
|
323
|
+
if (data.staged) statusParts.push(`${data.staged} staged`);
|
|
324
|
+
if (data.modified) statusParts.push(`${data.modified} modified`);
|
|
325
|
+
if (data.untracked) statusParts.push(`${data.untracked} untracked`);
|
|
326
|
+
parts.push(statusParts.join(", ") || "unknown");
|
|
327
|
+
}
|
|
328
|
+
if (data.branch) parts.push(`on ${data.branch}`);
|
|
329
|
+
break;
|
|
330
|
+
case "git_log":
|
|
331
|
+
parts.push(`${data.commits} commit${(data.commits as number) !== 1 ? "s" : ""}`);
|
|
332
|
+
break;
|
|
333
|
+
case "git_diff":
|
|
334
|
+
parts.push(`${data.lines} line${(data.lines as number) !== 1 ? "s" : ""}`);
|
|
335
|
+
if (data.staged) parts.push("(staged)");
|
|
336
|
+
break;
|
|
337
|
+
case "batch":
|
|
338
|
+
parts.push(`${data.files} file${(data.files as number) !== 1 ? "s" : ""} processed`);
|
|
339
|
+
break;
|
|
340
|
+
case "completion":
|
|
341
|
+
if (data.model) parts.push(String(data.model));
|
|
342
|
+
if (data.tier && data.tier !== data.model) parts.push(`(${data.tier})`);
|
|
343
|
+
parts.push(`${data.chars ?? 0} chars`);
|
|
344
|
+
break;
|
|
345
|
+
case "tool_define":
|
|
346
|
+
parts.push(`${data.name}(${(Array.isArray(data.params) ? data.params : []).join(", ")})`);
|
|
347
|
+
break;
|
|
348
|
+
case "workpool":
|
|
349
|
+
parts.push(`${data.action} ${data.pool}`);
|
|
350
|
+
if (data.count !== undefined) {
|
|
351
|
+
parts.push(data.action === "create" ? `${data.count} agent(s)` : `${data.count} item(s)`);
|
|
352
|
+
}
|
|
353
|
+
break;
|
|
354
|
+
case "wc":
|
|
355
|
+
parts.push(`${data.lines}L ${data.words}W ${data.chars}C`);
|
|
356
|
+
break;
|
|
357
|
+
case "cd":
|
|
358
|
+
case "pwd":
|
|
359
|
+
case "mkdir":
|
|
360
|
+
case "touch":
|
|
361
|
+
if (data.path) parts.push(shortenPath(String(data.path)));
|
|
362
|
+
break;
|
|
363
|
+
case "log":
|
|
364
|
+
parts.push(String(data.message ?? ""));
|
|
365
|
+
break;
|
|
366
|
+
case "phase":
|
|
367
|
+
parts.push(String(data.title ?? ""));
|
|
368
|
+
break;
|
|
369
|
+
default:
|
|
370
|
+
if (data.detail !== undefined) {
|
|
371
|
+
parts.push(truncateToWidth(replaceTabs(String(data.detail)), 80));
|
|
372
|
+
}
|
|
373
|
+
if (data.count !== undefined) {
|
|
374
|
+
parts.push(String(data.count));
|
|
375
|
+
}
|
|
376
|
+
if (data.path) {
|
|
377
|
+
parts.push(shortenPath(String(data.path)));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const desc = parts.length > 0 ? parts.join(" · ") : "";
|
|
382
|
+
return `${icon} ${theme.fg("muted", op)}${desc ? ` ${theme.fg("dim", desc)}` : ""}`;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/** Format status event with expanded detail lines. */
|
|
386
|
+
function formatStatusEventExpanded(event: EvalStatusEvent, theme: Theme): string[] {
|
|
387
|
+
const lines: string[] = [];
|
|
388
|
+
const { op, ...data } = event;
|
|
389
|
+
|
|
390
|
+
lines.push(formatStatusEvent(event, theme));
|
|
391
|
+
|
|
392
|
+
const addItems = (items: unknown[], formatter: (item: unknown) => string, max = 5) => {
|
|
393
|
+
const arr = Array.isArray(items) ? items : [];
|
|
394
|
+
for (let i = 0; i < Math.min(arr.length, max); i++) {
|
|
395
|
+
lines.push(` ${theme.fg("dim", formatter(arr[i]))}`);
|
|
396
|
+
}
|
|
397
|
+
if (arr.length > max) {
|
|
398
|
+
lines.push(` ${theme.fg("dim", `… ${arr.length - max} more`)}`);
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
const addPreview = (preview: string, maxLines = 3) => {
|
|
403
|
+
const previewLines = cappedHeadLines(String(preview).split("\n"), maxLines);
|
|
404
|
+
for (const line of previewLines.lines) {
|
|
405
|
+
lines.push(` ${theme.fg("toolOutput", truncateToWidth(replaceTabs(line), 80))}`);
|
|
406
|
+
}
|
|
407
|
+
if (previewLines.hidden > 0) {
|
|
408
|
+
lines.push(` ${theme.fg("dim", `… ${previewLines.hidden} more lines`)}`);
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
switch (op) {
|
|
413
|
+
case "ls":
|
|
414
|
+
if (data.items) addItems(data.items as unknown[], m => String(m));
|
|
415
|
+
break;
|
|
416
|
+
case "env":
|
|
417
|
+
if (data.keys) addItems(data.keys as unknown[], k => String(k), 10);
|
|
418
|
+
break;
|
|
419
|
+
case "git_log":
|
|
420
|
+
if (data.entries) {
|
|
421
|
+
addItems(data.entries as unknown[], e => {
|
|
422
|
+
const entry = e as { sha: string; subject: string };
|
|
423
|
+
return `${entry.sha} ${truncateToWidth(entry.subject, 50)}`;
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
break;
|
|
427
|
+
case "git_status":
|
|
428
|
+
if (data.files) addItems(data.files as unknown[], f => String(f));
|
|
429
|
+
break;
|
|
430
|
+
case "git_branch":
|
|
431
|
+
if (data.branches) addItems(data.branches as unknown[], b => String(b));
|
|
432
|
+
break;
|
|
433
|
+
case "read":
|
|
434
|
+
case "cat":
|
|
435
|
+
case "head":
|
|
436
|
+
case "tail":
|
|
437
|
+
case "git_diff":
|
|
438
|
+
case "sh":
|
|
439
|
+
if (data.preview) addPreview(String(data.preview));
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
return lines;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Render status events as tree lines. Shows a tail window (newest events are
|
|
448
|
+
* the live edge for `log()` progress loops) behind an "… N earlier" marker,
|
|
449
|
+
* matching the code/output tail-window convention. Collapsed keeps a small
|
|
450
|
+
* fixed window; expanded widens to the viewport-sized preview window.
|
|
451
|
+
*/
|
|
452
|
+
function renderStatusEvents(events: EvalStatusEvent[], theme: Theme, expanded: boolean): string[] {
|
|
453
|
+
if (events.length === 0) return [];
|
|
454
|
+
|
|
455
|
+
const max = expanded ? Math.max(10, previewWindowRows()) : 3;
|
|
456
|
+
const hidden = Math.max(0, events.length - max);
|
|
457
|
+
const visible = hidden > 0 ? events.slice(hidden) : events;
|
|
458
|
+
|
|
459
|
+
const lines: string[] = [];
|
|
460
|
+
if (hidden > 0) {
|
|
461
|
+
lines.push(`${theme.fg("dim", theme.tree.branch)} ${theme.fg("dim", `… ${hidden} earlier`)}`);
|
|
462
|
+
}
|
|
463
|
+
for (let i = 0; i < visible.length; i++) {
|
|
464
|
+
const isLast = i === visible.length - 1;
|
|
465
|
+
const branch = isLast ? theme.tree.last : theme.tree.branch;
|
|
466
|
+
|
|
467
|
+
if (expanded) {
|
|
468
|
+
const eventLines = formatStatusEventExpanded(visible[i], theme);
|
|
469
|
+
lines.push(`${theme.fg("dim", branch)} ${eventLines[0]}`);
|
|
470
|
+
const continueBranch = isLast ? " " : `${theme.tree.vertical} `;
|
|
471
|
+
for (let j = 1; j < eventLines.length; j++) {
|
|
472
|
+
lines.push(`${theme.fg("dim", continueBranch)}${eventLines[j]}`);
|
|
473
|
+
}
|
|
474
|
+
} else {
|
|
475
|
+
lines.push(`${theme.fg("dim", branch)} ${formatStatusEvent(visible[i], theme)}`);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
return lines;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function formatCellOutputLines(
|
|
483
|
+
cell: EvalCellResult,
|
|
484
|
+
expanded: boolean,
|
|
485
|
+
previewLines: number,
|
|
486
|
+
theme: Theme,
|
|
487
|
+
width: number,
|
|
488
|
+
): { lines: readonly string[]; hiddenCount: number } {
|
|
489
|
+
if (!cell.output) {
|
|
490
|
+
return { lines: [], hiddenCount: 0 };
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// Cell output lands in renderCodeCell → renderOutputBlock, which re-wraps it
|
|
494
|
+
// at the box's inner content width. Bound the collapsed tail by VISUAL rows
|
|
495
|
+
// at that width so a long-line tail can't wrap into more rows than budgeted
|
|
496
|
+
// and scroll its mutating preview above the live-region window — the
|
|
497
|
+
// duplicate "ctrl+o to expand" scrollback spray. The caller appends its own
|
|
498
|
+
// exact hidden-count row, so the pane marker stays off here.
|
|
499
|
+
const innerWidth = outputBlockContentWidth(width);
|
|
500
|
+
|
|
501
|
+
if (cell.hasMarkdown && cell.status !== "error") {
|
|
502
|
+
const md = new Markdown(cell.output, 0, 0, getMarkdownTheme());
|
|
503
|
+
const allLines = md.render(innerWidth);
|
|
504
|
+
const formatted = formatOutputPaneLines(
|
|
505
|
+
{
|
|
506
|
+
lines: allLines,
|
|
507
|
+
expanded,
|
|
508
|
+
collapsedMaxLines: previewLines,
|
|
509
|
+
edge: "tail",
|
|
510
|
+
showHiddenMarker: false,
|
|
511
|
+
},
|
|
512
|
+
theme,
|
|
513
|
+
);
|
|
514
|
+
return { lines: formatted.lines, hiddenCount: formatted.hiddenCount };
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
const isError = cell.status === "error";
|
|
518
|
+
const formatted = formatOutputPaneLines(
|
|
519
|
+
{
|
|
520
|
+
lines: cell.output.split("\n"),
|
|
521
|
+
expanded,
|
|
522
|
+
collapsedMaxLines: previewLines,
|
|
523
|
+
edge: "tail",
|
|
524
|
+
visual: true,
|
|
525
|
+
width: innerWidth,
|
|
526
|
+
styleLine: line => theme.fg(isError ? "error" : "toolOutput", replaceTabs(line)),
|
|
527
|
+
showHiddenMarker: false,
|
|
528
|
+
},
|
|
529
|
+
theme,
|
|
530
|
+
);
|
|
531
|
+
return { lines: formatted.lines, hiddenCount: formatted.hiddenCount };
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/** Render eval code cells, structured display output, and progress events. */
|
|
535
|
+
export const evalToolRenderer = {
|
|
536
|
+
animatedPendingPreview: true,
|
|
537
|
+
animatedPartialResult: true,
|
|
538
|
+
renderCall(args: EvalRenderArgs, options: RenderResultOptions, uiTheme: Theme): Component {
|
|
539
|
+
const cells = getRenderCells(args);
|
|
540
|
+
|
|
541
|
+
if (cells.length === 0) {
|
|
542
|
+
const promptSym = uiTheme.fg("accent", ">>>");
|
|
543
|
+
const text = formatTitle(`${promptSym} …`, uiTheme);
|
|
544
|
+
return new Text(text, 0, 0);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
let cached: { key: string; width: number; result: string[] } | undefined;
|
|
548
|
+
|
|
549
|
+
return markFramedBlockComponent({
|
|
550
|
+
render: (width: number): readonly string[] => {
|
|
551
|
+
const key = `${options.expanded ? 1 : 0}|${options.spinnerFrame ?? "-"}|${previewWindowRows()}|${cells.map(c => `${c.language}:${c.title ?? ""}:${c.code.length}`).join("|")}`;
|
|
552
|
+
if (cached && cached.key === key && cached.width === width) {
|
|
553
|
+
return cached.result;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const lines: string[] = [];
|
|
557
|
+
for (let i = 0; i < cells.length; i++) {
|
|
558
|
+
const cell = cells[i];
|
|
559
|
+
const cellLines = renderCodeCell(
|
|
560
|
+
{
|
|
561
|
+
code: cell.code,
|
|
562
|
+
language: languageForHighlighter(cell.language),
|
|
563
|
+
showLanguage: true,
|
|
564
|
+
index: i,
|
|
565
|
+
total: cells.length,
|
|
566
|
+
title: cell.title,
|
|
567
|
+
status: options.spinnerFrame !== undefined ? "running" : "pending",
|
|
568
|
+
spinnerFrame: options.spinnerFrame,
|
|
569
|
+
width,
|
|
570
|
+
// Viewport-sized tail window following the newest streamed code
|
|
571
|
+
// line; renderResult keeps the same cap so the cell never snaps
|
|
572
|
+
// open on completion. Only ctrl+o uncaps.
|
|
573
|
+
codeTail: true,
|
|
574
|
+
codeMaxLines: previewWindowRows(),
|
|
575
|
+
expanded: options.expanded,
|
|
576
|
+
},
|
|
577
|
+
uiTheme,
|
|
578
|
+
);
|
|
579
|
+
lines.push(...cellLines);
|
|
580
|
+
if (i < cells.length - 1) {
|
|
581
|
+
lines.push("");
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
cached = { key, width, result: lines };
|
|
585
|
+
return lines;
|
|
586
|
+
},
|
|
587
|
+
invalidate: () => {
|
|
588
|
+
cached = undefined;
|
|
589
|
+
},
|
|
590
|
+
});
|
|
591
|
+
},
|
|
592
|
+
|
|
593
|
+
renderResult(
|
|
594
|
+
result: { content: Array<{ type: string; text?: string }>; details?: EvalToolDetails },
|
|
595
|
+
options: RenderResultOptions & { renderContext?: EvalRenderContext },
|
|
596
|
+
uiTheme: Theme,
|
|
597
|
+
_args?: EvalRenderArgs,
|
|
598
|
+
): Component {
|
|
599
|
+
const details = result.details;
|
|
600
|
+
|
|
601
|
+
const rawOutput =
|
|
602
|
+
options.renderContext?.output ?? (result.content?.find(c => c.type === "text")?.text ?? "").trimEnd();
|
|
603
|
+
// Strip the LLM-facing notice (appended by wrappedExecute) before display;
|
|
604
|
+
// the styled `warningLine` below carries the same text in ⟨…⟩ form.
|
|
605
|
+
const output = stripOutputNotice(rawOutput, details?.meta).trimEnd();
|
|
606
|
+
|
|
607
|
+
const jsonOutputs = details?.jsonOutputs ?? [];
|
|
608
|
+
const treeExpanded = options.renderContext?.expanded ?? options.expanded;
|
|
609
|
+
const treeDepth = treeExpanded ? JSON_TREE_MAX_DEPTH_EXPANDED : JSON_TREE_MAX_DEPTH_COLLAPSED;
|
|
610
|
+
const treeLineCap = treeExpanded ? JSON_TREE_MAX_LINES_EXPANDED : JSON_TREE_MAX_LINES_COLLAPSED;
|
|
611
|
+
const treeScalarLen = treeExpanded ? JSON_TREE_SCALAR_LEN_EXPANDED : JSON_TREE_SCALAR_LEN_COLLAPSED;
|
|
612
|
+
const labelOutputs = jsonOutputs.length > 1;
|
|
613
|
+
const jsonLines = jsonOutputs.flatMap((value, index) => {
|
|
614
|
+
const tree = renderJsonTreeLines(value, uiTheme, treeDepth, treeLineCap, treeScalarLen);
|
|
615
|
+
const body = tree.truncated ? [...tree.lines, uiTheme.fg("dim", "…")] : tree.lines;
|
|
616
|
+
return labelOutputs ? [uiTheme.fg("dim", `display[${index + 1}]`), ...body] : body;
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
const timeoutSeconds = options.renderContext?.timeout;
|
|
620
|
+
const timeoutLine =
|
|
621
|
+
typeof timeoutSeconds === "number"
|
|
622
|
+
? uiTheme.fg("dim", wrapBrackets(`Timeout: ${timeoutSeconds}s`, uiTheme))
|
|
623
|
+
: undefined;
|
|
624
|
+
let warningLine: string | undefined;
|
|
625
|
+
if (details?.meta?.truncation || details?.meta?.artifactError) {
|
|
626
|
+
warningLine = formatStyledTruncationWarning(details.meta, uiTheme) ?? undefined;
|
|
627
|
+
}
|
|
628
|
+
const noticeLine = details?.notice ? uiTheme.fg("dim", wrapBrackets(details.notice, uiTheme)) : undefined;
|
|
629
|
+
const asyncLine =
|
|
630
|
+
details?.async?.state === "running"
|
|
631
|
+
? uiTheme.fg("dim", wrapBrackets(`Backgrounded: ${details.async.jobId}`, uiTheme))
|
|
632
|
+
: undefined;
|
|
633
|
+
|
|
634
|
+
const cellResults = details?.cells;
|
|
635
|
+
if (cellResults && cellResults.length > 0) {
|
|
636
|
+
const displayCells = cellResults.map(cell => {
|
|
637
|
+
const language = cell.language ?? details?.language ?? "python";
|
|
638
|
+
return { cell, code: formatEvalCodeForDisplay(cell.code, language), language };
|
|
639
|
+
});
|
|
640
|
+
let cached: { key: string; width: number; result: string[] } | undefined;
|
|
641
|
+
|
|
642
|
+
return markFramedBlockComponent({
|
|
643
|
+
render: (width: number): readonly string[] => {
|
|
644
|
+
const expanded = options.renderContext?.expanded ?? options.expanded;
|
|
645
|
+
const previewLines = Math.min(
|
|
646
|
+
options.renderContext?.previewLines ?? EVAL_DEFAULT_PREVIEW_LINES,
|
|
647
|
+
previewWindowRows(),
|
|
648
|
+
);
|
|
649
|
+
const key = `${expanded}|${previewLines}|${options.spinnerFrame}|${previewWindowRows()}`;
|
|
650
|
+
if (cached && cached.key === key && cached.width === width) {
|
|
651
|
+
return cached.result;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
const lines: string[] = [];
|
|
655
|
+
for (let i = 0; i < displayCells.length; i++) {
|
|
656
|
+
const { cell, code, language } = displayCells[i];
|
|
657
|
+
const allEvents = cell.statusEvents ?? [];
|
|
658
|
+
const agentEvents = allEvents.filter(e => e.op === "agent");
|
|
659
|
+
const otherEvents = agentEvents.length > 0 ? allEvents.filter(e => e.op !== "agent") : allEvents;
|
|
660
|
+
const statusLines = renderStatusEvents(otherEvents, uiTheme, expanded);
|
|
661
|
+
const outputContent = formatCellOutputLines(cell, expanded, previewLines, uiTheme, width);
|
|
662
|
+
const outputLines = [...outputContent.lines];
|
|
663
|
+
if (!expanded && outputContent.hiddenCount > 0) {
|
|
664
|
+
outputLines.push(
|
|
665
|
+
uiTheme.fg("dim", `… ${outputContent.hiddenCount} more lines (ctrl+o to expand)`),
|
|
666
|
+
);
|
|
667
|
+
}
|
|
668
|
+
if (statusLines.length > 0) {
|
|
669
|
+
if (outputLines.length > 0) {
|
|
670
|
+
outputLines.push(uiTheme.fg("dim", "Status"));
|
|
671
|
+
}
|
|
672
|
+
outputLines.push(...statusLines);
|
|
673
|
+
}
|
|
674
|
+
const cellLines = renderCodeCell(
|
|
675
|
+
{
|
|
676
|
+
code,
|
|
677
|
+
language: languageForHighlighter(language),
|
|
678
|
+
showLanguage: true,
|
|
679
|
+
index: i,
|
|
680
|
+
total: cellResults.length,
|
|
681
|
+
title: cell.title,
|
|
682
|
+
status: cell.status,
|
|
683
|
+
spinnerFrame: options.spinnerFrame,
|
|
684
|
+
duration: cell.durationMs,
|
|
685
|
+
output: outputLines.length > 0 ? outputLines.join("\n") : undefined,
|
|
686
|
+
outputMaxLines: outputLines.length,
|
|
687
|
+
// Same viewport-sized tail window as the pending preview so the
|
|
688
|
+
// cell never snaps open on completion; only ctrl+o uncaps.
|
|
689
|
+
// `output` keeps its own preview cap from above.
|
|
690
|
+
codeTail: true,
|
|
691
|
+
codeMaxLines: previewWindowRows(),
|
|
692
|
+
expanded,
|
|
693
|
+
width,
|
|
694
|
+
},
|
|
695
|
+
uiTheme,
|
|
696
|
+
);
|
|
697
|
+
lines.push(...cellLines);
|
|
698
|
+
if (agentEvents.length > 0) {
|
|
699
|
+
lines.push(...renderAgentProgressEvents(agentEvents, uiTheme, width, options.spinnerFrame));
|
|
700
|
+
}
|
|
701
|
+
if (i < cellResults.length - 1) {
|
|
702
|
+
lines.push("");
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
lines.push(...jsonLines);
|
|
706
|
+
if (timeoutLine) {
|
|
707
|
+
lines.push(timeoutLine);
|
|
708
|
+
}
|
|
709
|
+
if (noticeLine) {
|
|
710
|
+
lines.push(noticeLine);
|
|
711
|
+
}
|
|
712
|
+
if (asyncLine) {
|
|
713
|
+
lines.push(asyncLine);
|
|
714
|
+
}
|
|
715
|
+
if (warningLine) {
|
|
716
|
+
lines.push(warningLine);
|
|
717
|
+
}
|
|
718
|
+
cached = { key, width, result: lines };
|
|
719
|
+
return lines;
|
|
720
|
+
},
|
|
721
|
+
invalidate: () => {
|
|
722
|
+
cached = undefined;
|
|
723
|
+
},
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
const displayOutput = output;
|
|
728
|
+
const combinedOutput = [displayOutput, ...jsonLines].filter(Boolean).join("\n");
|
|
729
|
+
|
|
730
|
+
const statusEvents = details?.statusEvents ?? [];
|
|
731
|
+
const statusLines = renderStatusEvents(
|
|
732
|
+
statusEvents,
|
|
733
|
+
uiTheme,
|
|
734
|
+
options.renderContext?.expanded ?? options.expanded,
|
|
735
|
+
);
|
|
736
|
+
|
|
737
|
+
if (!combinedOutput && statusLines.length === 0) {
|
|
738
|
+
const lines = [timeoutLine, noticeLine, asyncLine, warningLine].filter(Boolean) as string[];
|
|
739
|
+
return new Text(lines.join("\n"), 0, 0);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
if (!combinedOutput && statusLines.length > 0) {
|
|
743
|
+
const lines = [
|
|
744
|
+
uiTheme.fg("dim", "Status"),
|
|
745
|
+
...statusLines,
|
|
746
|
+
timeoutLine,
|
|
747
|
+
noticeLine,
|
|
748
|
+
asyncLine,
|
|
749
|
+
warningLine,
|
|
750
|
+
].filter(Boolean) as string[];
|
|
751
|
+
return new Text(lines.join("\n"), 0, 0);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
if (options.renderContext?.expanded ?? options.expanded) {
|
|
755
|
+
const styledOutput = combinedOutput
|
|
756
|
+
.split("\n")
|
|
757
|
+
.map(line => uiTheme.fg("toolOutput", line))
|
|
758
|
+
.join("\n");
|
|
759
|
+
const lines = [
|
|
760
|
+
styledOutput,
|
|
761
|
+
...(statusLines.length > 0 ? [uiTheme.fg("dim", "Status"), ...statusLines] : []),
|
|
762
|
+
timeoutLine,
|
|
763
|
+
noticeLine,
|
|
764
|
+
asyncLine,
|
|
765
|
+
warningLine,
|
|
766
|
+
].filter(Boolean) as string[];
|
|
767
|
+
return new Text(lines.join("\n"), 0, 0);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
const styledOutput = combinedOutput
|
|
771
|
+
.split("\n")
|
|
772
|
+
.map(line => uiTheme.fg("toolOutput", line))
|
|
773
|
+
.join("\n");
|
|
774
|
+
const textContent = `\n${styledOutput}`;
|
|
775
|
+
|
|
776
|
+
let cachedWidth: number | undefined;
|
|
777
|
+
let cachedLines: readonly string[] | undefined;
|
|
778
|
+
let cachedSkipped: number | undefined;
|
|
779
|
+
let cachedPreviewLines: number | undefined;
|
|
780
|
+
|
|
781
|
+
return {
|
|
782
|
+
render: (width: number): readonly string[] => {
|
|
783
|
+
const previewLines = Math.min(
|
|
784
|
+
options.renderContext?.previewLines ?? EVAL_DEFAULT_PREVIEW_LINES,
|
|
785
|
+
previewWindowRows(),
|
|
786
|
+
);
|
|
787
|
+
if (cachedLines === undefined || cachedWidth !== width || cachedPreviewLines !== previewLines) {
|
|
788
|
+
const result = truncateToVisualLines(textContent, previewLines, width);
|
|
789
|
+
cachedLines = result.visualLines;
|
|
790
|
+
cachedSkipped = result.skippedCount;
|
|
791
|
+
cachedWidth = width;
|
|
792
|
+
cachedPreviewLines = previewLines;
|
|
793
|
+
}
|
|
794
|
+
const outputLines: string[] = [];
|
|
795
|
+
if (cachedSkipped && cachedSkipped > 0) {
|
|
796
|
+
outputLines.push("");
|
|
797
|
+
const skippedLine = uiTheme.fg(
|
|
798
|
+
"dim",
|
|
799
|
+
`… (${cachedSkipped} earlier lines, showing ${cachedLines.length} of ${cachedSkipped + cachedLines.length}) (ctrl+o to expand)`,
|
|
800
|
+
);
|
|
801
|
+
outputLines.push(truncateToWidth(skippedLine, width));
|
|
802
|
+
}
|
|
803
|
+
outputLines.push(...cachedLines);
|
|
804
|
+
if (statusLines.length > 0) {
|
|
805
|
+
outputLines.push(truncateToWidth(uiTheme.fg("dim", "Status"), width));
|
|
806
|
+
for (const statusLine of statusLines) {
|
|
807
|
+
outputLines.push(truncateToWidth(statusLine, width));
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
if (timeoutLine) {
|
|
811
|
+
outputLines.push(truncateToWidth(timeoutLine, width));
|
|
812
|
+
}
|
|
813
|
+
if (noticeLine) {
|
|
814
|
+
outputLines.push(truncateToWidth(noticeLine, width));
|
|
815
|
+
}
|
|
816
|
+
if (asyncLine) {
|
|
817
|
+
outputLines.push(truncateToWidth(asyncLine, width));
|
|
818
|
+
}
|
|
819
|
+
if (warningLine) {
|
|
820
|
+
outputLines.push(truncateToWidth(warningLine, width));
|
|
821
|
+
}
|
|
822
|
+
return outputLines;
|
|
823
|
+
},
|
|
824
|
+
invalidate: () => {
|
|
825
|
+
cachedWidth = undefined;
|
|
826
|
+
cachedLines = undefined;
|
|
827
|
+
cachedSkipped = undefined;
|
|
828
|
+
cachedPreviewLines = undefined;
|
|
829
|
+
},
|
|
830
|
+
};
|
|
831
|
+
},
|
|
832
|
+
|
|
833
|
+
mergeCallAndResult: true,
|
|
834
|
+
inline: true,
|
|
835
|
+
} satisfies ToolRenderer<EvalRenderArgs, EvalToolDetails>;
|