@oh-my-pi/pi-tui 18.4.2 → 18.4.4
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 +56 -0
- package/dist/types/apps/cleanse-board.d.ts +17 -0
- package/dist/types/apps/git/help.d.ts +16 -0
- package/dist/types/apps/git/sidebar.d.ts +18 -0
- package/dist/types/apps/live-visualizer.d.ts +10 -0
- package/dist/types/apps/ps-top.d.ts +15 -0
- package/dist/types/apps/standalone-picker.d.ts +3 -0
- package/dist/types/autocomplete.d.ts +8 -0
- package/dist/types/chat/advisor-message.d.ts +12 -2
- package/dist/types/chat/assistant-message.d.ts +20 -0
- package/dist/types/chat/bash-execution.d.ts +9 -0
- package/dist/types/chat/chat-transcript-builder.d.ts +6 -1
- package/dist/types/chat/collab-prompt-message.d.ts +4 -0
- package/dist/types/chat/compaction-summary-message.d.ts +15 -0
- package/dist/types/chat/eval-execution.d.ts +8 -0
- package/dist/types/chat/execution-shared.d.ts +58 -0
- package/dist/types/chat/late-diagnostics-message.d.ts +15 -1
- package/dist/types/chat/read-tool-group.d.ts +15 -0
- package/dist/types/chat/skill-message.d.ts +9 -0
- package/dist/types/chat/stripped-tool-calls-placeholder.d.ts +3 -0
- package/dist/types/chat/thinking-display.d.ts +2 -0
- package/dist/types/chat/todo-reminder.d.ts +4 -1
- package/dist/types/chat/tool-execution.d.ts +25 -1
- package/dist/types/chat/transcript-actions.d.ts +37 -0
- package/dist/types/chat/transcript-entry.d.ts +3 -1
- package/dist/types/chat/user-message.d.ts +25 -0
- package/dist/types/chrome/collab-qrcode.d.ts +7 -0
- package/dist/types/chrome/context-thresholds.d.ts +11 -0
- package/dist/types/chrome/countdown-timer.d.ts +9 -3
- package/dist/types/chrome/diff.d.ts +12 -0
- package/dist/types/chrome/dynamic-border.d.ts +3 -0
- package/dist/types/chrome/format.d.ts +6 -0
- package/dist/types/chrome/message-divider.d.ts +13 -0
- package/dist/types/chrome/message-frame.d.ts +10 -0
- package/dist/types/chrome/message-notice.d.ts +23 -0
- package/dist/types/chrome/overlay-box.d.ts +11 -2
- package/dist/types/chrome/qrcode.d.ts +7 -0
- package/dist/types/chrome/segment-track.d.ts +7 -0
- package/dist/types/chrome/selector-helpers.d.ts +0 -6
- package/dist/types/chrome/status-notice.d.ts +14 -0
- package/dist/types/chrome/streaming-panel.d.ts +3 -0
- package/dist/types/chrome/tool-activity.d.ts +3 -0
- package/dist/types/chrome/transcript-container.d.ts +13 -0
- package/dist/types/chrome/transcript-status.d.ts +15 -3
- package/dist/types/components/box.d.ts +7 -0
- package/dist/types/components/disclosure.d.ts +9 -0
- package/dist/types/components/editor.d.ts +42 -0
- package/dist/types/components/form.d.ts +14 -0
- package/dist/types/components/image.d.ts +7 -0
- package/dist/types/components/input.d.ts +20 -1
- package/dist/types/components/key-value-list.d.ts +3 -0
- package/dist/types/components/layout/geometry.d.ts +16 -0
- package/dist/types/components/layout/row.d.ts +7 -0
- package/dist/types/components/layout/split-pane.d.ts +8 -0
- package/dist/types/components/layout/stack.d.ts +6 -0
- package/dist/types/components/loader.d.ts +48 -0
- package/dist/types/components/markdown.d.ts +8 -0
- package/dist/types/components/metric.d.ts +7 -0
- package/dist/types/components/progress-bar.d.ts +3 -0
- package/dist/types/components/scroll-view.d.ts +6 -0
- package/dist/types/components/section.d.ts +3 -0
- package/dist/types/components/select-list.d.ts +33 -0
- package/dist/types/components/settings-list.d.ts +68 -0
- package/dist/types/components/spacer.d.ts +4 -0
- package/dist/types/components/tab-bar.d.ts +9 -0
- package/dist/types/components/table.d.ts +7 -0
- package/dist/types/components/text.d.ts +6 -0
- package/dist/types/components/tree-view.d.ts +9 -0
- package/dist/types/components/truncated-text.d.ts +3 -0
- package/dist/types/components/wizard-step.d.ts +6 -0
- package/dist/types/hotkeys-markdown.d.ts +24 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/latex-block.d.ts +7 -0
- package/dist/types/loop-watchdog.d.ts +9 -0
- package/dist/types/native/apply.d.ts +39 -0
- package/dist/types/native/backend.d.ts +94 -0
- package/dist/types/native/blobs.d.ts +29 -0
- package/dist/types/native/describe.d.ts +56 -0
- package/dist/types/native/encode.d.ts +50 -0
- package/dist/types/native/icons.d.ts +18 -0
- package/dist/types/native/memo.d.ts +27 -0
- package/dist/types/native/node.d.ts +107 -0
- package/dist/types/native/overlay.d.ts +64 -0
- package/dist/types/native/picker.d.ts +124 -0
- package/dist/types/native/reconcile.d.ts +41 -0
- package/dist/types/native/settle.d.ts +11 -0
- package/dist/types/native/spans.d.ts +21 -0
- package/dist/types/native/state.d.ts +6 -0
- package/dist/types/native/tone.d.ts +24 -0
- package/dist/types/overlays/advisor-config.d.ts +20 -0
- package/dist/types/overlays/agent-hub-renderer.d.ts +27 -11
- package/dist/types/overlays/agent-hub.d.ts +10 -0
- package/dist/types/overlays/agent-transcript-viewer.d.ts +7 -0
- package/dist/types/overlays/agents-hub.d.ts +8 -0
- package/dist/types/overlays/annotation-overlay.d.ts +3 -0
- package/dist/types/overlays/ask-dialog.d.ts +23 -0
- package/dist/types/overlays/bordered-loader.d.ts +3 -0
- package/dist/types/overlays/btw-history-panel.d.ts +9 -0
- package/dist/types/overlays/btw-panel.d.ts +3 -0
- package/dist/types/overlays/cleanse-panel.d.ts +5 -2
- package/dist/types/overlays/composer-shape-preview.d.ts +7 -1
- package/dist/types/overlays/copy-selector.d.ts +38 -0
- package/dist/types/overlays/error-banner.d.ts +9 -0
- package/dist/types/overlays/extensions/extension-list.d.ts +1 -0
- package/dist/types/overlays/history-search.d.ts +18 -0
- package/dist/types/overlays/hook-editor.d.ts +28 -1
- package/dist/types/overlays/hook-input.d.ts +3 -0
- package/dist/types/overlays/hook-selector.d.ts +10 -0
- package/dist/types/overlays/hub-frame.d.ts +18 -0
- package/dist/types/overlays/jobs-panel.d.ts +24 -0
- package/dist/types/overlays/login-dialog.d.ts +10 -0
- package/dist/types/overlays/logout-account-selector.d.ts +4 -0
- package/dist/types/overlays/mcp-add-wizard.d.ts +4 -0
- package/dist/types/overlays/model-browser.d.ts +69 -0
- package/dist/types/overlays/model-hub.d.ts +7 -0
- package/dist/types/overlays/model-picker.d.ts +9 -1
- package/dist/types/overlays/move-overlay.d.ts +3 -0
- package/dist/types/overlays/oauth-selector.d.ts +4 -0
- package/dist/types/overlays/omfg-panel.d.ts +3 -0
- package/dist/types/overlays/pause-screen.d.ts +12 -0
- package/dist/types/overlays/plan-review-overlay.d.ts +5 -0
- package/dist/types/overlays/plan-save-overlay.d.ts +10 -0
- package/dist/types/overlays/plugin-selector.d.ts +4 -0
- package/dist/types/overlays/plugin-settings.d.ts +30 -0
- package/dist/types/overlays/queue-mode-selector.d.ts +4 -0
- package/dist/types/overlays/reset-usage-selector.d.ts +8 -0
- package/dist/types/overlays/rewind-selector.d.ts +5 -0
- package/dist/types/overlays/session-info-overlay.d.ts +19 -1
- package/dist/types/overlays/session-selector.d.ts +64 -1
- package/dist/types/overlays/settings-defs.d.ts +14 -0
- package/dist/types/overlays/settings-selector.d.ts +21 -0
- package/dist/types/overlays/show-images-selector.d.ts +4 -0
- package/dist/types/overlays/snapcompact-shape-preview.d.ts +2 -0
- package/dist/types/overlays/stats-notice.d.ts +8 -0
- package/dist/types/overlays/theme-selector.d.ts +11 -0
- package/dist/types/overlays/thinking-selector.d.ts +4 -0
- package/dist/types/overlays/tree-selector.d.ts +60 -2
- package/dist/types/overlays/usage-dashboard.d.ts +26 -3
- package/dist/types/overlays/usage-row.d.ts +36 -2
- package/dist/types/prompt/attachment-chips.d.ts +8 -0
- package/dist/types/prompt/composer-attachments.d.ts +15 -3
- package/dist/types/prompt/composer.d.ts +18 -1
- package/dist/types/prompt/custom-editor.d.ts +48 -2
- package/dist/types/prompt/editor-top-gap.d.ts +2 -0
- package/dist/types/prompt/macos-spelling.d.ts +6 -0
- package/dist/types/prompt/magic-keywords.d.ts +9 -0
- package/dist/types/prompt/queued-messages.d.ts +23 -0
- package/dist/types/prompt/skill-tokens.d.ts +4 -2
- package/dist/types/prompt/welcome.d.ts +16 -0
- package/dist/types/render/code-cell.d.ts +10 -0
- package/dist/types/render/file-list.d.ts +8 -0
- package/dist/types/render/hyperlink.d.ts +14 -0
- package/dist/types/render/output-block.d.ts +43 -0
- package/dist/types/render/output-pane.d.ts +17 -0
- package/dist/types/render/tool-card.d.ts +8 -0
- package/dist/types/render/tree-list.d.ts +8 -0
- package/dist/types/render/width-aware-text.d.ts +7 -0
- package/dist/types/setup/scenes/outro.d.ts +7 -0
- package/dist/types/setup/scenes/sign-in.d.ts +16 -9
- package/dist/types/setup/scenes/splash.d.ts +8 -0
- package/dist/types/setup/scenes/types.d.ts +6 -27
- package/dist/types/setup/wizard-overlay.d.ts +9 -0
- package/dist/types/status-line/component.d.ts +49 -5
- package/dist/types/status-line/context-usage.d.ts +20 -0
- package/dist/types/status-line/footer.d.ts +8 -0
- package/dist/types/status-line/metrics.d.ts +1 -2
- package/dist/types/status-line/segments.d.ts +10 -1
- package/dist/types/status-line/types.d.ts +40 -1
- package/dist/types/stdin-buffer.d.ts +10 -7
- package/dist/types/terminal-capabilities.d.ts +1 -1
- package/dist/types/terminal.d.ts +36 -0
- package/dist/types/theme/defaults/index.d.ts +100 -0
- package/dist/types/theme/schema.d.ts +2 -0
- package/dist/types/theme/shimmer.d.ts +8 -0
- package/dist/types/theme/theme-class.d.ts +2 -0
- package/dist/types/theme/theme.d.ts +33 -1
- package/dist/types/tools/ask.d.ts +3 -0
- package/dist/types/tools/ast-edit.d.ts +10 -1
- package/dist/types/tools/ast-grep.d.ts +10 -1
- package/dist/types/tools/autoresearch.d.ts +21 -4
- package/dist/types/tools/bash.d.ts +30 -1
- package/dist/types/tools/cfg-render.d.ts +5 -1
- package/dist/types/tools/debug.d.ts +3 -1
- package/dist/types/tools/default-renderer.d.ts +6 -1
- package/dist/types/tools/edit.d.ts +14 -1
- package/dist/types/tools/eval.d.ts +12 -1
- package/dist/types/tools/fetch.d.ts +16 -1
- package/dist/types/tools/find.d.ts +15 -1
- package/dist/types/tools/github.d.ts +3 -0
- package/dist/types/tools/glob.d.ts +14 -1
- package/dist/types/tools/goal.d.ts +3 -1
- package/dist/types/tools/grep.d.ts +14 -1
- package/dist/types/tools/grouped-file-output.d.ts +58 -0
- package/dist/types/tools/json-tree.d.ts +20 -0
- package/dist/types/tools/lsp.d.ts +3 -10
- package/dist/types/tools/mcp.d.ts +16 -1
- package/dist/types/tools/memory.d.ts +26 -0
- package/dist/types/tools/native-view.d.ts +90 -0
- package/dist/types/tools/proc-render.d.ts +7 -1
- package/dist/types/tools/read.d.ts +23 -1
- package/dist/types/tools/renderer.d.ts +57 -0
- package/dist/types/tools/report-tool-issue.d.ts +3 -0
- package/dist/types/tools/resolve.d.ts +14 -1
- package/dist/types/tools/task.d.ts +3 -0
- package/dist/types/tools/think.d.ts +3 -0
- package/dist/types/tools/todo.d.ts +12 -0
- package/dist/types/tools/vibe.d.ts +3 -1
- package/dist/types/tools/wait.d.ts +3 -0
- package/dist/types/tools/web-search-types.d.ts +90 -0
- package/dist/types/tools/web-search.d.ts +9 -168
- package/dist/types/tools/write.d.ts +14 -1
- package/dist/types/tools/xdev.d.ts +13 -0
- package/dist/types/tui.d.ts +49 -0
- package/package.json +9 -9
- package/src/apps/autoresearch-dashboard.ts +362 -4
- package/src/apps/cleanse-board.ts +219 -1
- package/src/apps/cleanse-picker.ts +9 -1
- package/src/apps/debug/log-viewer.ts +15 -15
- package/src/apps/debug/protocol-probe.ts +2 -20
- package/src/apps/git/avatar.ts +2 -22
- package/src/apps/git/git-tui.ts +406 -59
- package/src/apps/git/help.ts +130 -0
- package/src/apps/git/sidebar.ts +491 -0
- package/src/apps/live-visualizer.ts +65 -0
- package/src/apps/ps-top.ts +448 -17
- package/src/apps/session-picker.ts +1 -0
- package/src/apps/setup-model-picker.ts +5 -1
- package/src/apps/standalone-picker.ts +55 -1
- package/src/autocomplete.ts +44 -1
- package/src/chat/advisor-message.ts +72 -3
- package/src/chat/assistant-message.ts +538 -51
- package/src/chat/background-tan-message.ts +4 -4
- package/src/chat/bash-execution.ts +81 -0
- package/src/chat/cache-invalidation-marker.ts +8 -0
- package/src/chat/chat-transcript-builder.ts +37 -6
- package/src/chat/collab-prompt-message.ts +15 -3
- package/src/chat/compaction-summary-message.ts +74 -1
- package/src/chat/custom-message.ts +3 -1
- package/src/chat/eval-execution.ts +57 -0
- package/src/chat/execution-shared.ts +153 -1
- package/src/chat/hook-message.ts +1 -0
- package/src/chat/late-diagnostics-message.ts +85 -2
- package/src/chat/read-tool-group.ts +341 -1
- package/src/chat/served-model-marker.ts +8 -0
- package/src/chat/skill-message.ts +63 -0
- package/src/chat/stripped-tool-calls-placeholder.ts +18 -10
- package/src/chat/thinking-display.ts +73 -11
- package/src/chat/todo-reminder.ts +34 -4
- package/src/chat/tool-execution.ts +385 -10
- package/src/chat/transcript-actions.ts +38 -0
- package/src/chat/transcript-browser.ts +2 -9
- package/src/chat/transcript-entry.ts +10 -1
- package/src/chat/transcript-render-helpers.ts +16 -15
- package/src/chat/ttsr-notification.ts +38 -1
- package/src/chat/user-message.ts +167 -4
- package/src/chrome/collab-qrcode.ts +27 -2
- package/src/chrome/context-thresholds.ts +34 -0
- package/src/chrome/countdown-timer.ts +24 -1
- package/src/chrome/diff.ts +60 -1
- package/src/chrome/dynamic-border.ts +7 -0
- package/src/chrome/format.ts +12 -0
- package/src/chrome/message-divider.ts +33 -1
- package/src/chrome/message-frame.ts +53 -10
- package/src/chrome/message-notice.ts +71 -0
- package/src/chrome/overlay-box.ts +45 -2
- package/src/chrome/qrcode.ts +28 -0
- package/src/chrome/segment-track.ts +26 -0
- package/src/chrome/selector-helpers.ts +1 -17
- package/src/chrome/status-notice.ts +46 -0
- package/src/chrome/streaming-panel.ts +25 -1
- package/src/chrome/tool-activity.ts +20 -0
- package/src/chrome/transcript-container.ts +139 -17
- package/src/chrome/transcript-status.ts +40 -11
- package/src/components/box.ts +51 -0
- package/src/components/disclosure.ts +33 -0
- package/src/components/editor.ts +239 -36
- package/src/components/form.ts +93 -9
- package/src/components/image.ts +30 -0
- package/src/components/input.ts +77 -26
- package/src/components/key-value-list.ts +18 -0
- package/src/components/layout/geometry.ts +44 -0
- package/src/components/layout/row.ts +30 -0
- package/src/components/layout/split-pane.ts +65 -0
- package/src/components/layout/stack.ts +27 -0
- package/src/components/loader.ts +183 -1
- package/src/components/markdown.ts +131 -56
- package/src/components/metric.ts +39 -0
- package/src/components/progress-bar.ts +28 -0
- package/src/components/scroll-view.ts +23 -0
- package/src/components/section.ts +16 -0
- package/src/components/select-list.ts +174 -25
- package/src/components/settings-list.ts +264 -7
- package/src/components/spacer.ts +17 -0
- package/src/components/tab-bar.ts +42 -0
- package/src/components/table.ts +34 -0
- package/src/components/text.ts +23 -0
- package/src/components/tree-view.ts +65 -0
- package/src/components/truncated-text.ts +14 -0
- package/src/components/wizard-step.ts +18 -9
- package/src/debug-server.ts +14 -7
- package/src/hotkeys-markdown.ts +251 -69
- package/src/index.ts +6 -0
- package/src/latex-block.ts +11 -0
- package/src/loop-watchdog.ts +38 -10
- package/src/native/apply.ts +275 -0
- package/src/native/backend.ts +682 -0
- package/src/native/blobs.ts +70 -0
- package/src/native/describe.ts +124 -0
- package/src/native/encode.ts +233 -0
- package/src/native/icons.ts +184 -0
- package/src/native/memo.ts +64 -0
- package/src/native/node.ts +112 -0
- package/src/native/overlay.ts +131 -0
- package/src/native/picker.ts +333 -0
- package/src/native/reconcile.ts +1063 -0
- package/src/native/settle.ts +23 -0
- package/src/native/spans.ts +308 -0
- package/src/native/state.ts +28 -0
- package/src/native/tone.ts +79 -0
- package/src/overlays/advisor-config.ts +420 -0
- package/src/overlays/agent-hub-renderer.ts +155 -18
- package/src/overlays/agent-hub.ts +1037 -44
- package/src/overlays/agent-transcript-viewer.ts +129 -0
- package/src/overlays/agents-hub.ts +688 -53
- package/src/overlays/annotation-overlay.ts +391 -52
- package/src/overlays/ask-dialog.ts +435 -24
- package/src/overlays/bordered-loader.ts +17 -0
- package/src/overlays/btw-history-panel.ts +182 -0
- package/src/overlays/btw-panel.ts +68 -2
- package/src/overlays/cleanse-panel.ts +105 -15
- package/src/overlays/codex-reset-fireworks.ts +65 -5
- package/src/overlays/composer-shape-preview.ts +26 -1
- package/src/overlays/copy-selector.ts +545 -23
- package/src/overlays/error-banner.ts +44 -0
- package/src/overlays/extensions/extension-list.ts +23 -17
- package/src/overlays/history-search.ts +175 -33
- package/src/overlays/hook-editor.ts +113 -6
- package/src/overlays/hook-input.ts +22 -1
- package/src/overlays/hook-selector.ts +311 -22
- package/src/overlays/hub-frame.ts +80 -0
- package/src/overlays/jobs-panel.ts +112 -0
- package/src/overlays/login-dialog.ts +183 -1
- package/src/overlays/logout-account-selector.ts +102 -4
- package/src/overlays/mcp-add-wizard.ts +232 -53
- package/src/overlays/model-browser.ts +681 -22
- package/src/overlays/model-hub.ts +1402 -78
- package/src/overlays/model-picker.ts +184 -7
- package/src/overlays/move-overlay.ts +45 -0
- package/src/overlays/oauth-selector.ts +227 -23
- package/src/overlays/omfg-panel.ts +86 -2
- package/src/overlays/pause-screen.ts +55 -4
- package/src/overlays/plan-review-overlay.ts +352 -0
- package/src/overlays/plan-save-overlay.ts +45 -0
- package/src/overlays/plugin-selector.ts +21 -1
- package/src/overlays/plugin-settings.ts +195 -5
- package/src/overlays/queue-mode-selector.ts +19 -1
- package/src/overlays/reset-usage-selector.ts +110 -40
- package/src/overlays/rewind-selector.ts +458 -44
- package/src/overlays/session-account-selector.ts +1 -1
- package/src/overlays/session-info-overlay.ts +137 -1
- package/src/overlays/session-selector.ts +807 -46
- package/src/overlays/settings-defs.ts +41 -0
- package/src/overlays/settings-selector.ts +585 -33
- package/src/overlays/show-images-selector.ts +18 -1
- package/src/overlays/snapcompact-shape-preview.ts +48 -3
- package/src/overlays/stats-notice.ts +31 -0
- package/src/overlays/theme-selector.ts +31 -1
- package/src/overlays/thinking-selector.ts +22 -1
- package/src/overlays/tree-selector.ts +570 -110
- package/src/overlays/usage-dashboard.ts +587 -12
- package/src/overlays/usage-row.ts +161 -25
- package/src/prompt/attachment-chips.ts +60 -0
- package/src/prompt/composer-attachments.ts +31 -9
- package/src/prompt/composer.ts +55 -2
- package/src/prompt/custom-editor.ts +302 -4
- package/src/prompt/editor-top-gap.ts +8 -0
- package/src/prompt/macos-spelling.ts +24 -9
- package/src/prompt/magic-keywords.ts +22 -1
- package/src/prompt/model-mention-autocomplete.ts +1 -0
- package/src/prompt/queued-messages.ts +101 -0
- package/src/prompt/skill-tokens.ts +5 -3
- package/src/prompt/welcome.ts +213 -6
- package/src/render/code-cell.ts +103 -2
- package/src/render/file-list.ts +29 -0
- package/src/render/hyperlink.ts +32 -0
- package/src/render/output-block.ts +110 -0
- package/src/render/output-pane.ts +37 -0
- package/src/render/tool-card.ts +137 -0
- package/src/render/tree-list.ts +39 -0
- package/src/render/width-aware-text.ts +20 -0
- package/src/setup/scenes/composer.ts +29 -0
- package/src/setup/scenes/glyph.ts +15 -0
- package/src/setup/scenes/model.ts +36 -8
- package/src/setup/scenes/outro.ts +28 -1
- package/src/setup/scenes/sign-in.ts +138 -24
- package/src/setup/scenes/splash.ts +28 -1
- package/src/setup/scenes/theme.ts +88 -3
- package/src/setup/scenes/types.ts +7 -28
- package/src/setup/startup-splash.ts +46 -9
- package/src/setup/wizard-overlay.ts +140 -23
- package/src/setup/wizard.ts +1 -1
- package/src/status-line/component.ts +414 -18
- package/src/status-line/context-usage.ts +279 -50
- package/src/status-line/footer.ts +94 -1
- package/src/status-line/metrics.ts +3 -6
- package/src/status-line/segments.ts +463 -97
- package/src/status-line/separators.ts +3 -16
- package/src/status-line/types.ts +43 -1
- package/src/stdin-buffer.ts +27 -21
- package/src/terminal-capabilities.ts +7 -0
- package/src/terminal.ts +153 -11
- package/src/theme/defaults/dark-neon-noir.json +100 -0
- package/src/theme/defaults/index.ts +2 -0
- package/src/theme/defaults/light-prism.json +5 -5
- package/src/theme/defaults/onyx.json +62 -62
- package/src/theme/mermaid-cache.ts +10 -1
- package/src/theme/schema.ts +15 -0
- package/src/theme/shimmer.ts +33 -0
- package/src/theme/theme-class.ts +24 -19
- package/src/theme/theme.ts +111 -9
- package/src/theme/tui-adapters.ts +14 -1
- package/src/tools/ask.ts +157 -1
- package/src/tools/ast-edit.ts +174 -1
- package/src/tools/ast-grep.ts +82 -2
- package/src/tools/autoresearch.ts +149 -1
- package/src/tools/bash.ts +233 -62
- package/src/tools/cfg-render.ts +66 -1
- package/src/tools/debug.ts +78 -1
- package/src/tools/default-renderer.ts +35 -1
- package/src/tools/edit.ts +357 -31
- package/src/tools/eval.ts +257 -1
- package/src/tools/fetch.ts +102 -3
- package/src/tools/find.ts +127 -1
- package/src/tools/github.ts +119 -10
- package/src/tools/glob.ts +116 -1
- package/src/tools/goal.ts +56 -1
- package/src/tools/grep.ts +83 -2
- package/src/tools/grouped-file-output.ts +205 -0
- package/src/tools/json-tree.ts +116 -1
- package/src/tools/lsp.ts +318 -1
- package/src/tools/mcp.ts +80 -1
- package/src/tools/memory.ts +93 -11
- package/src/tools/native-view.ts +292 -0
- package/src/tools/proc-render.ts +221 -1
- package/src/tools/read.ts +199 -4
- package/src/tools/renderer.ts +61 -0
- package/src/tools/report-tool-issue.ts +7 -1
- package/src/tools/resolve.ts +63 -1
- package/src/tools/streaming-output.ts +79 -16
- package/src/tools/task.ts +406 -4
- package/src/tools/think.ts +19 -1
- package/src/tools/todo.ts +89 -0
- package/src/tools/vibe.ts +230 -2
- package/src/tools/wait.ts +181 -1
- package/src/tools/web-search-types.ts +99 -0
- package/src/tools/web-search.ts +111 -170
- package/src/tools/write.ts +144 -5
- package/src/tools/xdev.ts +64 -1
- package/src/tui.ts +295 -4
- package/dist/types/setup/scenes/providers.d.ts +0 -3
- package/dist/types/setup/scenes/web-search.d.ts +0 -22
- package/src/setup/scenes/providers.ts +0 -110
- package/src/setup/scenes/web-search.ts +0 -165
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settling: the frame provider marks finalized transcript blocks so the
|
|
3
|
+
* native reconciler stops keeping their description (spec §12 "Settling and
|
|
4
|
+
* program memory"). A settled block stays editable: a later change is sent as
|
|
5
|
+
* targeted ops by id, followed by a fresh `settle` hint.
|
|
6
|
+
*/
|
|
7
|
+
import type { Component } from "../tui";
|
|
8
|
+
|
|
9
|
+
const kSettled = Symbol("native.settled");
|
|
10
|
+
|
|
11
|
+
interface SettleTagged {
|
|
12
|
+
[kSettled]?: true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Mark `component` (and everything it describes) as finalized. Idempotent; a no-op outside a TSP terminal. */
|
|
16
|
+
export function settleNative(component: Component): void {
|
|
17
|
+
(component as SettleTagged)[kSettled] = true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Whether {@link settleNative} was called for `component`. */
|
|
21
|
+
export function isNativeSettled(component: Component): boolean {
|
|
22
|
+
return (component as SettleTagged)[kSettled] === true;
|
|
23
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI-styled text → escape-free spans and plain text.
|
|
3
|
+
*
|
|
4
|
+
* Most components receive text that callers already styled for the ANSI
|
|
5
|
+
* renderer (`theme.fg("toolTitle", x)`, opaque `(text) => string` stylers).
|
|
6
|
+
* The native path must not carry escapes, so {@link styledSpans} parses SGR
|
|
7
|
+
* and OSC 8 back into spans whose `s` tokens are the omp theme colour names
|
|
8
|
+
* the escapes came from (reverse-mapped through the active theme), plus the
|
|
9
|
+
* semantic attribute tokens (`strong`, `em`, `dim`, `del`, `mark`).
|
|
10
|
+
*
|
|
11
|
+
* Every described string is sanitized the same way: escapes dropped (one
|
|
12
|
+
* escape grammar for spans and plain text), control characters and lone
|
|
13
|
+
* surrogates removed, tabs expanded.
|
|
14
|
+
*/
|
|
15
|
+
import { sanitizeText } from "@oh-my-pi/pi-utils";
|
|
16
|
+
import type { TspSpan, TspText } from "@oh-my-pi/pi-wire";
|
|
17
|
+
import darkThemeJson from "../theme/dark.json" with { type: "json" };
|
|
18
|
+
import { isValidThemeColor, type Theme, type ThemeBg, type ThemeColor, theme } from "../theme/theme";
|
|
19
|
+
import { replaceTabs } from "../utils";
|
|
20
|
+
import { span, text } from "./describe";
|
|
21
|
+
import type { NativeNode } from "./node";
|
|
22
|
+
|
|
23
|
+
/** Theme colour names in schema order; basic tokens (`accent`, `success`, …) precede derived ones, so they win ties. */
|
|
24
|
+
const THEME_COLOR_NAMES: readonly ThemeColor[] = Object.keys(darkThemeJson.colors).filter(isValidThemeColor);
|
|
25
|
+
|
|
26
|
+
/** Background tokens in tie-breaking priority. */
|
|
27
|
+
const THEME_BG_NAMES: readonly ThemeBg[] = [
|
|
28
|
+
"userMessageBg",
|
|
29
|
+
"toolErrorBg",
|
|
30
|
+
"toolSuccessBg",
|
|
31
|
+
"toolPendingBg",
|
|
32
|
+
"customMessageBg",
|
|
33
|
+
"selectedBg",
|
|
34
|
+
"statusLineBg",
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
/** Basic 16-colour SGR foregrounds mapped to semantic tokens. */
|
|
38
|
+
const BASIC_FG_TOKENS: Readonly<Record<number, string>> = {
|
|
39
|
+
31: "error",
|
|
40
|
+
32: "success",
|
|
41
|
+
33: "warning",
|
|
42
|
+
34: "info",
|
|
43
|
+
35: "accent",
|
|
44
|
+
36: "info",
|
|
45
|
+
90: "dim",
|
|
46
|
+
91: "error",
|
|
47
|
+
92: "success",
|
|
48
|
+
93: "warning",
|
|
49
|
+
94: "info",
|
|
50
|
+
95: "accent",
|
|
51
|
+
96: "info",
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* CSI, OSC and DCS/APC/PM/SOS strings (BEL or ST terminated: the TUI's cursor
|
|
56
|
+
* marker is a BEL-terminated APC), and two-byte escapes.
|
|
57
|
+
*/
|
|
58
|
+
const ESCAPE_PATTERN =
|
|
59
|
+
/\x1b(?:\[([0-?]*)[ -/]*([@-~])|\]([^\x07\x1b]*)(?:\x07|\x1b\\)|[P_^X][^\x07\x1b]*(?:\x07|\x1b\\)|[@-Z\\-_])/g;
|
|
60
|
+
|
|
61
|
+
interface ThemeReverse {
|
|
62
|
+
fg: Map<string, ThemeColor>;
|
|
63
|
+
bg: Map<string, ThemeBg>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Reverse map of the last theme seen; one theme is active at a time. */
|
|
67
|
+
let reverseCache: { theme: Theme; reverse: ThemeReverse } | undefined;
|
|
68
|
+
|
|
69
|
+
function parseParams(raw: string): number[] {
|
|
70
|
+
if (raw === "") return [0];
|
|
71
|
+
return raw.split(/[;:]/).map(part => (part === "" ? 0 : Number.parseInt(part, 10)));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Canonical colour key of an SGR colour selector (`38`/`48` extended or a basic code). */
|
|
75
|
+
function colorKey(params: readonly number[], index: number): { key: string; consumed: number } | undefined {
|
|
76
|
+
const mode = params[index + 1];
|
|
77
|
+
if (mode === 5 && params[index + 2] !== undefined) return { key: `5;${params[index + 2]}`, consumed: 2 };
|
|
78
|
+
if (mode === 2 && params[index + 4] !== undefined) {
|
|
79
|
+
return { key: `2;${params[index + 2]};${params[index + 3]};${params[index + 4]}`, consumed: 4 };
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Colour key of a single-colour escape like `\x1b[38;2;1;2;3m`; undefined for default/reset escapes. */
|
|
85
|
+
function escapeColorKey(escape: string): string | undefined {
|
|
86
|
+
const match = /^\x1b\[([0-9;:]*)m$/.exec(escape);
|
|
87
|
+
if (!match) return undefined;
|
|
88
|
+
const params = parseParams(match[1]!);
|
|
89
|
+
const first = params[0];
|
|
90
|
+
if (first === 38 || first === 48) return colorKey(params, 0)?.key;
|
|
91
|
+
if (first !== undefined && ((first >= 30 && first <= 37) || (first >= 90 && first <= 97))) return `b;${first}`;
|
|
92
|
+
if (first !== undefined && ((first >= 40 && first <= 47) || (first >= 100 && first <= 107))) {
|
|
93
|
+
return `b;${first - 10}`;
|
|
94
|
+
}
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function reverseFor(active: Theme): ThemeReverse {
|
|
99
|
+
if (reverseCache?.theme === active) return reverseCache.reverse;
|
|
100
|
+
const reverse: ThemeReverse = { fg: new Map(), bg: new Map() };
|
|
101
|
+
for (const name of THEME_COLOR_NAMES) {
|
|
102
|
+
let escape: string;
|
|
103
|
+
try {
|
|
104
|
+
escape = active.getFgAnsi(name);
|
|
105
|
+
} catch {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const key = escapeColorKey(escape);
|
|
109
|
+
if (key !== undefined && !reverse.fg.has(key)) reverse.fg.set(key, name);
|
|
110
|
+
}
|
|
111
|
+
for (const name of THEME_BG_NAMES) {
|
|
112
|
+
let escape: string;
|
|
113
|
+
try {
|
|
114
|
+
escape = active.getBgAnsi(name);
|
|
115
|
+
} catch {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const key = escapeColorKey(escape);
|
|
119
|
+
if (key !== undefined && !reverse.bg.has(key)) reverse.bg.set(key, name);
|
|
120
|
+
}
|
|
121
|
+
reverseCache = { theme: active, reverse };
|
|
122
|
+
return reverse;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The active theme's reverse map, or undefined before a theme is initialized. */
|
|
126
|
+
function activeReverse(): ThemeReverse | undefined {
|
|
127
|
+
// `theme` is a live binding that stays undefined until initTheme runs.
|
|
128
|
+
const active: Theme | undefined = theme;
|
|
129
|
+
return active ? reverseFor(active) : undefined;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface SgrState {
|
|
133
|
+
bold: boolean;
|
|
134
|
+
dim: boolean;
|
|
135
|
+
italic: boolean;
|
|
136
|
+
strike: boolean;
|
|
137
|
+
inverse: boolean;
|
|
138
|
+
fg: string | undefined;
|
|
139
|
+
bg: string | undefined;
|
|
140
|
+
href: string | undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function initialState(): SgrState {
|
|
144
|
+
return {
|
|
145
|
+
bold: false,
|
|
146
|
+
dim: false,
|
|
147
|
+
italic: false,
|
|
148
|
+
strike: false,
|
|
149
|
+
inverse: false,
|
|
150
|
+
fg: undefined,
|
|
151
|
+
bg: undefined,
|
|
152
|
+
href: undefined,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function resetState(state: SgrState): void {
|
|
157
|
+
state.bold = false;
|
|
158
|
+
state.dim = false;
|
|
159
|
+
state.italic = false;
|
|
160
|
+
state.strike = false;
|
|
161
|
+
state.inverse = false;
|
|
162
|
+
state.fg = undefined;
|
|
163
|
+
state.bg = undefined;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function applySgr(state: SgrState, raw: string): void {
|
|
167
|
+
const params = parseParams(raw);
|
|
168
|
+
for (let i = 0; i < params.length; i++) {
|
|
169
|
+
const code = params[i]!;
|
|
170
|
+
if (code === 0) resetState(state);
|
|
171
|
+
else if (code === 1) state.bold = true;
|
|
172
|
+
else if (code === 2) state.dim = true;
|
|
173
|
+
else if (code === 3) state.italic = true;
|
|
174
|
+
else if (code === 7) state.inverse = true;
|
|
175
|
+
else if (code === 9) state.strike = true;
|
|
176
|
+
else if (code === 22) {
|
|
177
|
+
state.bold = false;
|
|
178
|
+
state.dim = false;
|
|
179
|
+
} else if (code === 23) state.italic = false;
|
|
180
|
+
else if (code === 27) state.inverse = false;
|
|
181
|
+
else if (code === 29) state.strike = false;
|
|
182
|
+
else if ((code >= 30 && code <= 37) || (code >= 90 && code <= 97)) state.fg = `b;${code}`;
|
|
183
|
+
else if (code === 39) state.fg = undefined;
|
|
184
|
+
else if ((code >= 40 && code <= 47) || (code >= 100 && code <= 107)) state.bg = `b;${code - 10}`;
|
|
185
|
+
else if (code === 49) state.bg = undefined;
|
|
186
|
+
else if (code === 38 || code === 48) {
|
|
187
|
+
const color = colorKey(params, i);
|
|
188
|
+
if (color) {
|
|
189
|
+
if (code === 38) state.fg = color.key;
|
|
190
|
+
else state.bg = color.key;
|
|
191
|
+
i += color.consumed;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function fgToken(key: string | undefined, reverse: ThemeReverse | undefined): string | undefined {
|
|
198
|
+
if (key === undefined) return undefined;
|
|
199
|
+
const named = reverse?.fg.get(key);
|
|
200
|
+
// `text` is the terminal's own foreground: no information on the native path.
|
|
201
|
+
if (named !== undefined) return named === "text" ? undefined : named;
|
|
202
|
+
if (key.startsWith("b;")) return BASIC_FG_TOKENS[Number(key.slice(2))];
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function styleTokens(state: SgrState, reverse: ThemeReverse | undefined): string | undefined {
|
|
207
|
+
const tokens: string[] = [];
|
|
208
|
+
const fg = fgToken(state.fg, reverse);
|
|
209
|
+
if (fg !== undefined) tokens.push(fg);
|
|
210
|
+
if (state.bold) tokens.push("strong");
|
|
211
|
+
if (state.dim) tokens.push("dim");
|
|
212
|
+
if (state.italic) tokens.push("em");
|
|
213
|
+
if (state.strike) tokens.push("del");
|
|
214
|
+
if (state.inverse || (state.bg !== undefined && reverse?.bg.get(state.bg) === "selectedBg")) tokens.push("mark");
|
|
215
|
+
return tokens.length > 0 ? tokens.join(" ") : undefined;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** Escape-free display text: control characters and lone surrogates removed, tabs expanded. */
|
|
219
|
+
function clean(content: string): string {
|
|
220
|
+
return replaceTabs(sanitizeText(content));
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function pushSpan(spans: TspSpan[], content: string, s: string | undefined, href: string | undefined): void {
|
|
224
|
+
const cleaned = clean(content);
|
|
225
|
+
if (cleaned === "") return;
|
|
226
|
+
const last = spans[spans.length - 1];
|
|
227
|
+
if (last !== undefined && last.s === s && last.href === href) {
|
|
228
|
+
last.t += cleaned;
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
spans.push(href === undefined ? span(cleaned, s) : span(cleaned, s, { href }));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Convert ANSI-styled text into escape-free spans. SGR colours map back to
|
|
236
|
+
* the omp theme tokens that produced them; OSC 8 becomes `href`; every other
|
|
237
|
+
* escape (cursor moves, APC markers) is dropped.
|
|
238
|
+
*/
|
|
239
|
+
export function styledSpans(styled: string): TspSpan[] {
|
|
240
|
+
const spans: TspSpan[] = [];
|
|
241
|
+
if (!styled.includes("\x1b")) {
|
|
242
|
+
pushSpan(spans, styled, undefined, undefined);
|
|
243
|
+
return spans;
|
|
244
|
+
}
|
|
245
|
+
const reverse = activeReverse();
|
|
246
|
+
const state = initialState();
|
|
247
|
+
let cursor = 0;
|
|
248
|
+
ESCAPE_PATTERN.lastIndex = 0;
|
|
249
|
+
for (let match = ESCAPE_PATTERN.exec(styled); match !== null; match = ESCAPE_PATTERN.exec(styled)) {
|
|
250
|
+
if (match.index > cursor) {
|
|
251
|
+
pushSpan(spans, styled.slice(cursor, match.index), styleTokens(state, reverse), state.href);
|
|
252
|
+
}
|
|
253
|
+
cursor = match.index + match[0].length;
|
|
254
|
+
if (match[2] === "m") applySgr(state, match[1] ?? "");
|
|
255
|
+
else if (match[3]?.startsWith("8;")) {
|
|
256
|
+
const uri = match[3].slice(match[3].indexOf(";", 2) + 1);
|
|
257
|
+
state.href = uri === "" ? undefined : uri;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (cursor < styled.length) pushSpan(spans, styled.slice(cursor), styleTokens(state, reverse), state.href);
|
|
261
|
+
return spans;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** The visible characters of ANSI-styled text: every escape dropped, sanitized like {@link styledSpans}. */
|
|
265
|
+
export function plainText(styled: string): string {
|
|
266
|
+
return clean(styled.includes("\x1b") ? styled.replace(ESCAPE_PATTERN, "") : styled);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** {@link plainText} as a single-line label: line breaks and whitespace runs collapse to one space. */
|
|
270
|
+
export function plainLine(styled: string): string {
|
|
271
|
+
return plainText(styled)
|
|
272
|
+
.replace(/[\r\n]+/g, " ")
|
|
273
|
+
.replace(/\s+/g, " ")
|
|
274
|
+
.trim();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** Spans for plain text passed through an optional ANSI styler. */
|
|
278
|
+
export function styleSpans(content: string, style?: (text: string) => string): TspSpan[] {
|
|
279
|
+
return styledSpans(style ? style(content) : content);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** Collapse unstyled single-span text to a plain string (smaller frames). */
|
|
283
|
+
export function compactText(spans: readonly TspSpan[]): TspText {
|
|
284
|
+
if (spans.length === 0) return "";
|
|
285
|
+
if (spans.length === 1 && spans[0]!.s === undefined && spans[0]!.href === undefined && spans[0]!.fx === undefined) {
|
|
286
|
+
return spans[0]!.t;
|
|
287
|
+
}
|
|
288
|
+
return spans;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Pre-rendered ANSI rows as one unwrapped text block (rows already carry their line breaks). */
|
|
292
|
+
export function rowsText(lines: readonly string[]): NativeNode {
|
|
293
|
+
return text(compactText(styledSpans(lines.join("\n"))), { wrap: "none" });
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** Theme background token of the first SGR background in ANSI-styled text. */
|
|
297
|
+
export function styledBackground(styled: string): ThemeBg | undefined {
|
|
298
|
+
const reverse = activeReverse();
|
|
299
|
+
if (!reverse) return undefined;
|
|
300
|
+
ESCAPE_PATTERN.lastIndex = 0;
|
|
301
|
+
for (let match = ESCAPE_PATTERN.exec(styled); match !== null; match = ESCAPE_PATTERN.exec(styled)) {
|
|
302
|
+
if (match[2] !== "m") continue;
|
|
303
|
+
const state = initialState();
|
|
304
|
+
applySgr(state, match[1] ?? "");
|
|
305
|
+
if (state.bg !== undefined) return reverse.bg.get(state.bg);
|
|
306
|
+
}
|
|
307
|
+
return undefined;
|
|
308
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-wide flag: a Tern Surface Protocol backend is rendering.
|
|
3
|
+
*
|
|
4
|
+
* Components that animate by re-rendering on a timer (spinners, shimmer,
|
|
5
|
+
* thinking frames, countdowns) check it and skip scheduling, because the
|
|
6
|
+
* terminal clocks motion from the described nodes. Set only by the native
|
|
7
|
+
* backend when a surface opens and cleared when it closes.
|
|
8
|
+
*/
|
|
9
|
+
let active = false;
|
|
10
|
+
const listeners = new Set<(on: boolean) => void>();
|
|
11
|
+
|
|
12
|
+
/** Whether a TSP surface is live in this process. */
|
|
13
|
+
export function isNativeRendering(): boolean {
|
|
14
|
+
return active;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Called by the native backend on surface open and close. */
|
|
18
|
+
export function setNativeRendering(on: boolean): void {
|
|
19
|
+
if (active === on) return;
|
|
20
|
+
active = on;
|
|
21
|
+
for (const listener of listeners) listener(on);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Call `listener` whenever native rendering starts or stops; returns the unsubscribe. */
|
|
25
|
+
export function onNativeRenderingChange(listener: (on: boolean) => void): () => void {
|
|
26
|
+
listeners.add(listener);
|
|
27
|
+
return () => listeners.delete(listener);
|
|
28
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* omp theme colours → TSP tones. Components that only hold ANSI stylers
|
|
3
|
+
* (`(text) => string`) sample them with a probe string to recover the theme
|
|
4
|
+
* token behind the escape, then map the token to a card/text tone.
|
|
5
|
+
*/
|
|
6
|
+
import type { TspTone } from "@oh-my-pi/pi-wire";
|
|
7
|
+
import { isValidThemeColor, type ThemeBg, type ThemeColor } from "../theme/theme";
|
|
8
|
+
import { styledBackground, styledSpans } from "./spans";
|
|
9
|
+
|
|
10
|
+
/** Theme background token of an ANSI background styler, sampled with a probe string. */
|
|
11
|
+
export function sampleBackground(bgFn: ((text: string) => string) | undefined): ThemeBg | undefined {
|
|
12
|
+
return bgFn ? styledBackground(bgFn("x")) : undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Theme foreground token of an ANSI colour styler, sampled with a probe string. */
|
|
16
|
+
export function sampleForeground(color: ((text: string) => string) | undefined): ThemeColor | undefined {
|
|
17
|
+
if (!color) return undefined;
|
|
18
|
+
const first = styledSpans(color("x"))[0]?.s;
|
|
19
|
+
if (first === undefined) return undefined;
|
|
20
|
+
const token = first.split(" ")[0]!;
|
|
21
|
+
return isValidThemeColor(token) ? token : undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Card chrome derived from a background fill. */
|
|
25
|
+
export interface BackgroundChrome {
|
|
26
|
+
tone?: TspTone;
|
|
27
|
+
role?: string;
|
|
28
|
+
selected?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Map an omp background token to card tone/role. */
|
|
32
|
+
export function backgroundChrome(bg: ThemeBg | undefined): BackgroundChrome {
|
|
33
|
+
switch (bg) {
|
|
34
|
+
case "userMessageBg":
|
|
35
|
+
return { tone: "user", role: "omp.user" };
|
|
36
|
+
case "customMessageBg":
|
|
37
|
+
return { tone: "info", role: "omp.custom" };
|
|
38
|
+
case "toolPendingBg":
|
|
39
|
+
return { tone: "pending", role: "omp.tool" };
|
|
40
|
+
case "toolSuccessBg":
|
|
41
|
+
return { tone: "success", role: "omp.tool" };
|
|
42
|
+
case "toolErrorBg":
|
|
43
|
+
return { tone: "error", role: "omp.tool" };
|
|
44
|
+
case "selectedBg":
|
|
45
|
+
return { tone: "accent", selected: true };
|
|
46
|
+
case "statusLineBg":
|
|
47
|
+
return { tone: "neutral", role: "omp.status" };
|
|
48
|
+
default:
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Tone of an omp colour used as a severity or border colour; undefined for
|
|
55
|
+
* colours that carry no tone (callers pick their own fallback).
|
|
56
|
+
*/
|
|
57
|
+
export function colorTone(color: ThemeColor | undefined): TspTone | undefined {
|
|
58
|
+
switch (color) {
|
|
59
|
+
case undefined:
|
|
60
|
+
return undefined;
|
|
61
|
+
case "border":
|
|
62
|
+
return "neutral";
|
|
63
|
+
case "borderAccent":
|
|
64
|
+
case "accent":
|
|
65
|
+
return "accent";
|
|
66
|
+
case "borderMuted":
|
|
67
|
+
case "muted":
|
|
68
|
+
case "dim":
|
|
69
|
+
return "muted";
|
|
70
|
+
case "success":
|
|
71
|
+
return "success";
|
|
72
|
+
case "error":
|
|
73
|
+
return "error";
|
|
74
|
+
case "warning":
|
|
75
|
+
return "warning";
|
|
76
|
+
default:
|
|
77
|
+
return color.startsWith("thinking") ? "accent" : undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|