@oh-my-pi/pi-tui 18.4.3 → 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 +36 -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/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 +37 -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/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 +7 -0
- 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 +7 -0
- package/dist/types/setup/scenes/splash.d.ts +8 -0
- package/dist/types/setup/scenes/types.d.ts +6 -1
- 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/terminal-capabilities.d.ts +1 -1
- package/dist/types/terminal.d.ts +27 -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.d.ts +8 -0
- 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 +346 -11
- 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/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 +37 -0
- 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 +216 -27
- 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 +21 -0
- 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/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 +175 -1
- 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 +583 -23
- 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 +122 -13
- package/src/setup/scenes/splash.ts +28 -1
- package/src/setup/scenes/theme.ts +88 -3
- package/src/setup/scenes/types.ts +7 -1
- package/src/setup/startup-splash.ts +46 -9
- package/src/setup/wizard-overlay.ts +140 -23
- package/src/status-line/component.ts +398 -16
- 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/terminal-capabilities.ts +7 -0
- package/src/terminal.ts +130 -2
- 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/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/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 +180 -49
- 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 +247 -2
- 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/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.ts +113 -1
- package/src/tools/write.ts +144 -5
- package/src/tools/xdev.ts +64 -1
- package/src/tui.ts +294 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DescribeContext, NativeNode } from "../native/node.js";
|
|
1
2
|
import type { Theme } from "../theme/theme.js";
|
|
2
3
|
import type { Component } from "../tui.js";
|
|
3
4
|
import { type ScrollViewTheme } from "./scroll-view.js";
|
|
@@ -125,6 +126,14 @@ export declare class TreeView<T, K extends TreeKey = string> implements Componen
|
|
|
125
126
|
/** Move to the next row in `direction` satisfying a domain predicate. */
|
|
126
127
|
moveSelectionWhere(predicate: (item: T, row: TreeRow<T, K>) => boolean, direction: -1 | 1): void;
|
|
127
128
|
render(width: number): readonly string[];
|
|
129
|
+
/**
|
|
130
|
+
* A native disclosure `tree` over the filtered rows, nested by hierarchy
|
|
131
|
+
* (a filtered-out ancestor lifts its visible descendants to the nearest
|
|
132
|
+
* visible one). Gutters, windowing and the scrollbar are the terminal's;
|
|
133
|
+
* the selected row is marked with the `mark` token. Rows whose body is a
|
|
134
|
+
* component can't be tree labels, so such a tree stays on `rows`.
|
|
135
|
+
*/
|
|
136
|
+
describe(_cx: DescribeContext): NativeNode | null;
|
|
128
137
|
/** Render lines plus budget/window metadata for adapters that append an ellipsis. */
|
|
129
138
|
renderWithState(width: number): TreeViewRenderResult;
|
|
130
139
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DescribeContext, NativeNode } from "../native/node.js";
|
|
1
2
|
import type { Component } from "../tui.js";
|
|
2
3
|
/**
|
|
3
4
|
* Text component that truncates to fit viewport width
|
|
@@ -8,5 +9,7 @@ export declare class TruncatedText implements Component {
|
|
|
8
9
|
/** Return bounded source text and the last-known truncation state. */
|
|
9
10
|
debugState(): Record<string, unknown>;
|
|
10
11
|
invalidate(): void;
|
|
12
|
+
/** First line only, clamped to one visual line with an end ellipsis. */
|
|
13
|
+
describe(_cx: DescribeContext): NativeNode;
|
|
11
14
|
render(width: number): readonly string[];
|
|
12
15
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MouseRoutable, SgrMouseEvent } from "../mouse.js";
|
|
2
|
+
import type { DescribeContext, NativeNode } from "../native/node.js";
|
|
2
3
|
import type { Component } from "../tui.js";
|
|
3
4
|
/** Semantic role of a wizard step's primary interactive content. */
|
|
4
5
|
export type WizardStepKind = "input" | "choice" | "confirm" | "async" | "custom";
|
|
@@ -56,5 +57,10 @@ export declare class WizardStep implements Component, MouseRoutable {
|
|
|
56
57
|
dispose(): void;
|
|
57
58
|
handleInput(data: string): void;
|
|
58
59
|
routeMouse(event: SgrMouseEvent, line: number, col: number): void;
|
|
60
|
+
/**
|
|
61
|
+
* The slots in order as a spaced `col`; the height budget and optional
|
|
62
|
+
* preview collapse are the terminal's (it scrolls instead of clipping).
|
|
63
|
+
*/
|
|
64
|
+
describe(_cx: DescribeContext): NativeNode;
|
|
59
65
|
render(width: number): readonly string[];
|
|
60
66
|
}
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
import { type KeybindingsManager } from "./app-keybindings.js";
|
|
2
|
+
import type { NativeNode, NativeUiEvent } from "./native/node.js";
|
|
3
|
+
import type { Component } from "./tui.js";
|
|
2
4
|
/** Effective keybinding operations used to render the hotkey reference. */
|
|
3
5
|
export interface HotkeysMarkdownBindings {
|
|
4
6
|
keybindings: Pick<KeybindingsManager, "getDisplayString" | "getKeys" | "matchesCanonical">;
|
|
5
7
|
}
|
|
6
8
|
/** Build the platform-aware Markdown reference for effective application hotkeys. */
|
|
7
9
|
export declare function buildHotkeysMarkdown(bindings: HotkeysMarkdownBindings): string;
|
|
10
|
+
/**
|
|
11
|
+
* `/hotkeys` under a native terminal: a large sheet "Keyboard shortcuts" with
|
|
12
|
+
* one section per group, each a two-column table whose key cells carry `key`
|
|
13
|
+
* spans (Tern draws them as keycaps). Esc (or Close) dismisses it. Terminals
|
|
14
|
+
* without the native surface get the transcript markdown panel instead.
|
|
15
|
+
*/
|
|
16
|
+
export declare class HotkeysSheetComponent implements Component {
|
|
17
|
+
#private;
|
|
18
|
+
readonly nativeOverlay: {
|
|
19
|
+
readonly role: "omp.overlay.hotkeys";
|
|
20
|
+
readonly size: "lg";
|
|
21
|
+
readonly head: "Keyboard shortcuts";
|
|
22
|
+
};
|
|
23
|
+
constructor(bindings: HotkeysMarkdownBindings, onClose: () => void);
|
|
24
|
+
describe(): NativeNode;
|
|
25
|
+
/** The markdown reference, for a terminal that falls back to rows. */
|
|
26
|
+
render(width: number): readonly string[];
|
|
27
|
+
invalidate(): void;
|
|
28
|
+
handleInput(data: string): void;
|
|
29
|
+
/** Close runs what Esc runs. */
|
|
30
|
+
handleNativeEvent(event: NativeUiEvent): void;
|
|
31
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -42,6 +42,11 @@ export * from "./kitty-graphics.js";
|
|
|
42
42
|
export * from "./latex-block.js";
|
|
43
43
|
export * from "./latex-to-unicode.js";
|
|
44
44
|
export * from "./mouse.js";
|
|
45
|
+
export * from "./native/blobs.js";
|
|
46
|
+
export * from "./native/describe.js";
|
|
47
|
+
export type * from "./native/node.js";
|
|
48
|
+
export * from "./native/settle.js";
|
|
49
|
+
export * from "./native/state.js";
|
|
45
50
|
export * from "./stdin-buffer.js";
|
|
46
51
|
export type * from "./symbols.js";
|
|
47
52
|
export * from "./terminal.js";
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import type { NativeNode } from "./native/node.js";
|
|
2
|
+
/**
|
|
3
|
+
* The native form of {@link latexToBlock}: the TeX source as a `math` node
|
|
4
|
+
* the terminal typesets (display style by default, `display: false` for
|
|
5
|
+
* inline `$…$` math).
|
|
6
|
+
*/
|
|
7
|
+
export declare function describeLatex(src: string, display?: boolean): NativeNode;
|
|
1
8
|
/**
|
|
2
9
|
* Render a display LaTeX math fragment to lines with full 2-D layout: stacked
|
|
3
10
|
* fractions, stretchy delimiters, matrix grids, operator limits, drawn
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference document applier: applies TSP frames to a node tree the way the
|
|
3
|
+
* spec says the terminal does (§5.1). Ops are validated and applied one by
|
|
4
|
+
* one; a rejected op is reported and skipped without affecting the rest of
|
|
5
|
+
* the frame. `settle` is recorded as a hint and never restricts later ops.
|
|
6
|
+
*
|
|
7
|
+
* Used by tests, the debug server's `doc` op, and the TSP test harness.
|
|
8
|
+
*/
|
|
9
|
+
import { type TspFrame, type TspNode } from "@oh-my-pi/pi-wire";
|
|
10
|
+
/** One rejected op. */
|
|
11
|
+
export interface TspApplyError {
|
|
12
|
+
/** Frame sequence number. */
|
|
13
|
+
s: number;
|
|
14
|
+
/** Op index inside the frame. */
|
|
15
|
+
op: number;
|
|
16
|
+
msg: string;
|
|
17
|
+
}
|
|
18
|
+
/** A surface document: the root (id = surface id) plus an id index. */
|
|
19
|
+
export declare class TspDocument {
|
|
20
|
+
#private;
|
|
21
|
+
readonly surface: string;
|
|
22
|
+
constructor(surface: string);
|
|
23
|
+
/** Currently focused node id. */
|
|
24
|
+
get focus(): string | null;
|
|
25
|
+
get suspended(): boolean;
|
|
26
|
+
/** Ids that received a `settle` hint and no later op. */
|
|
27
|
+
get settled(): ReadonlySet<string>;
|
|
28
|
+
/** Number of nodes, including the root. */
|
|
29
|
+
get size(): number;
|
|
30
|
+
has(id: string): boolean;
|
|
31
|
+
/** `x keep:true`: drop the live-only regions (`dock`, `layer`) and focus; `main` stays. */
|
|
32
|
+
close(): void;
|
|
33
|
+
/** Apply a frame op by op; returns the rejected ops. */
|
|
34
|
+
applyFrame(frame: TspFrame): TspApplyError[];
|
|
35
|
+
/** Snapshot of the whole document (root included) as wire nodes. */
|
|
36
|
+
snapshot(): TspNode;
|
|
37
|
+
/** Snapshot of one subtree, or undefined for an unknown id. */
|
|
38
|
+
get(id: string): TspNode | undefined;
|
|
39
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type TspFrame, type TspNode } from "@oh-my-pi/pi-wire";
|
|
2
|
+
import type { Terminal } from "../terminal.js";
|
|
3
|
+
import type { Component, OverlayOptions } from "../tui.js";
|
|
4
|
+
import { type TspHello } from "./encode.js";
|
|
5
|
+
import type { DescribeContext, NativeSurface } from "./node.js";
|
|
6
|
+
/** A visible TUI overlay, bottom to top. */
|
|
7
|
+
export interface NativeOverlay {
|
|
8
|
+
readonly component: Component;
|
|
9
|
+
readonly options: OverlayOptions | undefined;
|
|
10
|
+
/** Keyboard focus is inside this overlay. */
|
|
11
|
+
readonly focused: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** What the backend needs from the TUI. */
|
|
14
|
+
export interface NativeHost {
|
|
15
|
+
readonly terminal: Terminal;
|
|
16
|
+
/** `main`/`dock` content: the frame provider's surface, or the TUI children. */
|
|
17
|
+
describeSurface(cx: DescribeContext): NativeSurface;
|
|
18
|
+
/** Visible overlays, bottom to top. */
|
|
19
|
+
overlays(): readonly NativeOverlay[];
|
|
20
|
+
/** Component receiving keyboard input. */
|
|
21
|
+
focused(): Component | null;
|
|
22
|
+
requestRender(): void;
|
|
23
|
+
/** The terminal switched appearance. */
|
|
24
|
+
appearanceChanged(dark: boolean): void;
|
|
25
|
+
/** Reduce Motion toggled. */
|
|
26
|
+
motionChanged(reduce: boolean): void;
|
|
27
|
+
/** Theme-derived output changed (symbol preset): drop render and describe caches. */
|
|
28
|
+
invalidate(): void;
|
|
29
|
+
}
|
|
30
|
+
export interface NativeBackendOptions {
|
|
31
|
+
/** Keep the reference document and recent frames for debugging. */
|
|
32
|
+
readonly mirror?: boolean;
|
|
33
|
+
/** Append every TSP message to this JSONL file. Defaults to `PI_TUI_TSP_RECORD`. */
|
|
34
|
+
readonly recordPath?: string;
|
|
35
|
+
/** Log the `rows` fallback count per frame. Defaults to `PI_TUI_NATIVE_STATS=1`. */
|
|
36
|
+
readonly stats?: boolean;
|
|
37
|
+
readonly now?: () => number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The reply a v1 terminal is assumed to give before its real `hello` arrives
|
|
41
|
+
* (the `TERM_PROGRAM=tern` optimistic start): the whole vocabulary, the
|
|
42
|
+
* default APC limit and credits, the terminal's width, the appearance omp
|
|
43
|
+
* already detected, and full motion.
|
|
44
|
+
*/
|
|
45
|
+
export declare function assumedTspHello(terminal: Terminal): TspHello;
|
|
46
|
+
export declare class NativeBackend {
|
|
47
|
+
#private;
|
|
48
|
+
constructor(host: NativeHost, hello: TspHello, options?: NativeBackendOptions);
|
|
49
|
+
/** The terminal's hello reply. */
|
|
50
|
+
get hello(): TspHello;
|
|
51
|
+
/** Describe context shared by every surface. */
|
|
52
|
+
get context(): DescribeContext;
|
|
53
|
+
/** `rows` fallback nodes in the last frame. */
|
|
54
|
+
get fallbackCount(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Open the inline surface and send the first frame. Native rendering is
|
|
57
|
+
* announced only once the surface is open: Tern drops the shell's title
|
|
58
|
+
* when a command's first surface opens, so the tab title set on the change
|
|
59
|
+
* has to follow the `o`.
|
|
60
|
+
*/
|
|
61
|
+
start(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Close every surface. The inline transcript stays in scrollback unless
|
|
64
|
+
* `keep` is false (a revoked optimistic start: rows repaint from scratch).
|
|
65
|
+
*/
|
|
66
|
+
stop(keep?: boolean): void;
|
|
67
|
+
/**
|
|
68
|
+
* After a stop/start cycle (external editor, suspend): adopt the closed
|
|
69
|
+
* inline surface so the transcript continues in place instead of being
|
|
70
|
+
* printed again. A `gone` reply for it opens a fresh surface.
|
|
71
|
+
*/
|
|
72
|
+
resume(hello: TspHello): void;
|
|
73
|
+
/**
|
|
74
|
+
* The terminal's real `hello` reply after an optimistic start: adopt its
|
|
75
|
+
* APC limit, credits, cell size, kinds, appearance and motion preference.
|
|
76
|
+
* A width the terminal already reported in a `resize` event wins over the
|
|
77
|
+
* reply's. A different vocabulary or motion preference re-describes every
|
|
78
|
+
* component, so kinds the terminal lacks fall back.
|
|
79
|
+
*/
|
|
80
|
+
confirm(hello: TspHello): void;
|
|
81
|
+
/** SIGWINCH: refresh the width used for `rows` fallback until the terminal reports one. */
|
|
82
|
+
noteTerminalColumns(columns: number): void;
|
|
83
|
+
/** Reconcile and send a frame, unless the target surface is out of credits. */
|
|
84
|
+
render(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Handle one complete `ESC _ tsp;…` input string (events and late replies).
|
|
87
|
+
* Returns false when `sequence` isn't TSP.
|
|
88
|
+
*/
|
|
89
|
+
handleInput(sequence: string): boolean;
|
|
90
|
+
/** Reference document of the live surface (mirror mode only). */
|
|
91
|
+
document(): TspNode | undefined;
|
|
92
|
+
/** Last sent frames, oldest first (mirror mode only). */
|
|
93
|
+
recentFrames(count?: number): readonly TspFrame[];
|
|
94
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-addressed binary blobs (images) for `image` nodes.
|
|
3
|
+
*
|
|
4
|
+
* `describe()` registers the bytes and puts the returned id in `image.p.blob`;
|
|
5
|
+
* the native backend uploads each referenced blob once per surface with verb
|
|
6
|
+
* `b` before the frame that first references it.
|
|
7
|
+
*/
|
|
8
|
+
import type { TspProps } from "@oh-my-pi/pi-wire";
|
|
9
|
+
import type { NativeNode } from "./node.js";
|
|
10
|
+
export interface NativeBlob {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly mime: string;
|
|
13
|
+
readonly bytes: Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
/** Register `bytes` and return their content address (sha256 hex) for `image.p.blob`. */
|
|
16
|
+
export declare function registerNativeBlob(bytes: Uint8Array, mime: string): string;
|
|
17
|
+
/** A registered blob by id. */
|
|
18
|
+
export declare function getNativeBlob(id: string): NativeBlob | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* An `image` node for a base64 payload: the bytes are registered as a blob and
|
|
21
|
+
* the pixel size probed from the header. Decoding and hashing cost real time,
|
|
22
|
+
* so callers cache the node per payload ({@link NativeImageCache}).
|
|
23
|
+
*/
|
|
24
|
+
export declare function base64ImageNode(data: string, mimeType: string, p?: Omit<TspProps<"image">, "blob" | "w" | "h">, key?: string): NativeNode;
|
|
25
|
+
/** `image` nodes for base64 payloads, one per slot key, rebuilt only when the slot's payload changes. */
|
|
26
|
+
export declare class NativeImageCache {
|
|
27
|
+
#private;
|
|
28
|
+
get(key: string, data: string, mimeType: string): NativeNode;
|
|
29
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builders for {@link NativeNode}s, so `describe()` implementations read as
|
|
3
|
+
* a tree instead of object literals.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* describe() {
|
|
7
|
+
* return card({ role: "omp.tool.bash", status: "running", head: [span("Bash", "toolTitle")] }, [
|
|
8
|
+
* ansi(this.#output, { follow: true, preview: { lines: 10 } }),
|
|
9
|
+
* ]);
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
import type { TspKind, TspProps, TspSpan, TspText } from "@oh-my-pi/pi-wire";
|
|
13
|
+
import type { NativeChild, NativeNode } from "./node.js";
|
|
14
|
+
/** A node of any kind. */
|
|
15
|
+
export declare function node<K extends TspKind>(k: K, p?: TspProps<K>, c?: readonly NativeChild[], key?: string): NativeNode;
|
|
16
|
+
/** One styled span; `s` is a space-separated list of semantic or theme tokens. */
|
|
17
|
+
export declare function span(t: string, s?: string, extra?: Omit<TspSpan, "t" | "s">): TspSpan;
|
|
18
|
+
/** Plain or styled text. */
|
|
19
|
+
export declare function text(content: TspText, p?: Omit<TspProps<"text">, "text" | "spans">): NativeNode;
|
|
20
|
+
/** Vertical stack. */
|
|
21
|
+
export declare function col(c: readonly NativeChild[], p?: TspProps<"col">): NativeNode;
|
|
22
|
+
/** Horizontal flex row. */
|
|
23
|
+
export declare function row(c: readonly NativeChild[], p?: TspProps<"row">): NativeNode;
|
|
24
|
+
/** Card with an optional header, status and collapsible body. */
|
|
25
|
+
export declare function card(p: TspProps<"card">, c: readonly NativeChild[]): NativeNode;
|
|
26
|
+
/** Markdown source in omp's dialect. */
|
|
27
|
+
export declare function md(source: string, p?: Omit<TspProps<"md">, "text">): NativeNode;
|
|
28
|
+
/** Highlighted code. */
|
|
29
|
+
export declare function code(source: string, p?: Omit<TspProps<"code">, "text">): NativeNode;
|
|
30
|
+
/** Raw terminal output rendered as a mini terminal. */
|
|
31
|
+
export declare function ansi(output: string, p?: Omit<TspProps<"ansi">, "text">): NativeNode;
|
|
32
|
+
/** Unified diff. */
|
|
33
|
+
export declare function diff(unified: string, p?: Omit<TspProps<"diff">, "text">): NativeNode;
|
|
34
|
+
/** A mounted, empty, invisible node for components that describe nothing. */
|
|
35
|
+
export declare const EMPTY_NODE: NativeNode;
|
|
36
|
+
/** `described` with a sibling identity key (the layout builders only take props). */
|
|
37
|
+
export declare function keyed(described: NativeNode, key: string): NativeNode;
|
|
38
|
+
/** `described` mounted but not laid out when `hidden` (cheap visibility toggles keep ids and view state). */
|
|
39
|
+
export declare function withHidden(described: NativeNode, hidden: boolean): NativeNode;
|
|
40
|
+
/** Stable node key for an arbitrary identity string; keys join into `/` keypaths, so identities are hashed. */
|
|
41
|
+
export declare function stableKey(identity: string): string;
|
|
42
|
+
/** Drop absent entries (`undefined`, `null`, `false`) from a child list. */
|
|
43
|
+
export declare function compact<T>(items: readonly (T | undefined | null | false)[]): T[];
|
|
44
|
+
/** A `kv` grid from label/value pairs with muted labels, skipping empty values; undefined when nothing is left. */
|
|
45
|
+
export declare function kv(pairs: readonly (readonly [string, TspText | undefined])[]): NativeNode | undefined;
|
|
46
|
+
/** One list `item`, keyed by the value select/activate events report back. */
|
|
47
|
+
export declare function item(key: string, p: TspProps<"item">): NativeNode;
|
|
48
|
+
/** A `list` of items. */
|
|
49
|
+
export declare function list(items: readonly NativeChild[], p?: TspProps<"list">, key?: string): NativeNode;
|
|
50
|
+
/** Terminal-clocked elapsed counter: `age` ms already elapsed; `stopped` freezes it there. */
|
|
51
|
+
export declare function elapsed(age: number, stopped?: boolean): NativeNode;
|
|
52
|
+
/**
|
|
53
|
+
* Keycap for one key id (`"ctrl+o"` → keys `["ctrl", "o"]`); the terminal
|
|
54
|
+
* draws platform glyphs. A literal `+` key survives (`"+"`, `"ctrl++"`).
|
|
55
|
+
*/
|
|
56
|
+
export declare function kbd(key: string, nodeKey?: string): NativeNode;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type TspEvent, type TspReply, type TspVerb } from "@oh-my-pi/pi-wire";
|
|
2
|
+
/** Every TSP message starts with this. */
|
|
3
|
+
export declare const TSP_PREFIX = "\u001B_tsp;";
|
|
4
|
+
/** The terminal's hello reply. */
|
|
5
|
+
export type TspHello = Extract<TspReply, {
|
|
6
|
+
r: "hello";
|
|
7
|
+
}>;
|
|
8
|
+
/** A decoded terminal → program message. */
|
|
9
|
+
export type TspIncoming = {
|
|
10
|
+
verb: "r";
|
|
11
|
+
reply: TspReply;
|
|
12
|
+
} | {
|
|
13
|
+
verb: "e";
|
|
14
|
+
event: TspEvent;
|
|
15
|
+
};
|
|
16
|
+
/** Message parameters (`k=v`, ASCII, never containing `;`). */
|
|
17
|
+
export type TspParams = Readonly<Record<string, string | number>>;
|
|
18
|
+
/** Split `body` into pieces of at most `limit` UTF-8 bytes, never inside a code point. */
|
|
19
|
+
export declare function splitUtf8(body: string, limit: number): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Encode one logical message, chunked when `body` exceeds `limit` UTF-8 bytes.
|
|
22
|
+
* Returns the complete byte string to write (all chunks, in order).
|
|
23
|
+
*/
|
|
24
|
+
export declare function encodeTspMessage(verb: TspVerb, body: string, params?: TspParams, limit?: number): string;
|
|
25
|
+
/** Encode a JSON message body. */
|
|
26
|
+
export declare function encodeTspJson(verb: TspVerb, value: unknown, params?: TspParams, limit?: number): string;
|
|
27
|
+
/** The `hello` query; callers follow it with a DA1 sentinel. */
|
|
28
|
+
export declare function encodeTspHelloQuery(version?: string): string;
|
|
29
|
+
/** One decoded APC message: verb, parameters and raw body. */
|
|
30
|
+
export interface TspRawMessage {
|
|
31
|
+
verb: string;
|
|
32
|
+
params: Record<string, string>;
|
|
33
|
+
body: string;
|
|
34
|
+
}
|
|
35
|
+
/** Split a complete `ESC _ tsp;… ESC \` string into verb, parameters and body; null when it isn't one. */
|
|
36
|
+
export declare function splitTspMessage(sequence: string): TspRawMessage | null;
|
|
37
|
+
/**
|
|
38
|
+
* Reassembles chunked terminal → program messages and decodes replies and
|
|
39
|
+
* events. Unknown verbs, unknown events and unknown fields are tolerated
|
|
40
|
+
* (ignored or passed through); malformed input yields null.
|
|
41
|
+
*/
|
|
42
|
+
export declare class TspReader {
|
|
43
|
+
#private;
|
|
44
|
+
/** Feed one complete APC string. Returns the decoded message once complete, else null. */
|
|
45
|
+
feed(sequence: string): TspIncoming | null;
|
|
46
|
+
}
|
|
47
|
+
/** Decode an unchunked reply/event body. Null for malformed JSON, missing fields or program → terminal verbs. */
|
|
48
|
+
export declare function decodeTspBody(verb: string, body: string): TspIncoming | null;
|
|
49
|
+
/** Decode one complete, unchunked terminal → program message. */
|
|
50
|
+
export declare function parseTspMessage(sequence: string): TspIncoming | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon glyph normalization for native frames.
|
|
3
|
+
*
|
|
4
|
+
* Components style icons as Private Use Area codepoints (Nerd Font glyphs)
|
|
5
|
+
* baked into text with a padding space, e.g. `{t:"<glyph> Model", s:"statusLineModel"}`.
|
|
6
|
+
* The terminal draws icons and spaces them itself, so every PUA run becomes
|
|
7
|
+
* its own span carrying the `icon` token next to the original tokens (colour
|
|
8
|
+
* survives), and the single space that padded it from the neighbouring text
|
|
9
|
+
* is dropped. Applied once, centrally, to every `TspText` field of a node's
|
|
10
|
+
* props before they go on the wire.
|
|
11
|
+
*/
|
|
12
|
+
import type { TspKind, TspSpan, TspText } from "@oh-my-pi/pi-wire";
|
|
13
|
+
/** Spans with every PUA run split into an `icon` span; the same array when there is none. */
|
|
14
|
+
export declare function normalizeIconSpans(spans: readonly TspSpan[]): readonly TspSpan[];
|
|
15
|
+
/** A `TspText` with icons normalized; plain strings with icons become spans. */
|
|
16
|
+
export declare function normalizeIconText(text: TspText): TspText;
|
|
17
|
+
/** Props with every `TspText` field's icons normalized; the same object when nothing changed. */
|
|
18
|
+
export declare function normalizeIconProps(kind: TspKind, props: Readonly<Record<string, unknown>> | undefined): Readonly<Record<string, unknown>> | undefined;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memoization for `describe()`: an unchanged component must hand the
|
|
3
|
+
* reconciler the same node objects, so it can skip the subtree. {@link Memo}
|
|
4
|
+
* is the one primitive; {@link OwnerMemo} keys it by an object for stateless
|
|
5
|
+
* renderers (tool describe hooks) that re-describe the same args/result.
|
|
6
|
+
*/
|
|
7
|
+
import type { NativeNode } from "./node.js";
|
|
8
|
+
/** Element-wise identity (`Object.is`) of two arrays; `undefined` never matches. */
|
|
9
|
+
export declare function sameItems<T>(a: readonly T[] | undefined, b: readonly T[]): boolean;
|
|
10
|
+
/** Shallow equality of two flat prop bags built by successive describe calls. */
|
|
11
|
+
export declare function sameProps<T extends object>(a: T | undefined, b: T): boolean;
|
|
12
|
+
/** Keeps the last built value while every dependency is unchanged (`Object.is` per slot). */
|
|
13
|
+
export declare class Memo<T = NativeNode> {
|
|
14
|
+
#private;
|
|
15
|
+
get(deps: readonly unknown[], build: () => T): T;
|
|
16
|
+
/** Forget the cached value (theme, glyph preset or keybindings changed). */
|
|
17
|
+
clear(): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One {@link Memo} per owner object, kept in a symbol slot on the owner; each
|
|
21
|
+
* instance owns its own slot, so call and result views of one object don't
|
|
22
|
+
* collide. Builds uncached without an owner or when the owner is frozen.
|
|
23
|
+
*/
|
|
24
|
+
export declare class OwnerMemo<T> {
|
|
25
|
+
#private;
|
|
26
|
+
get(owner: object | undefined, deps: readonly unknown[], build: () => T): T;
|
|
27
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The describe contract: how components hand the Tern Surface Protocol (TSP)
|
|
3
|
+
* backend a semantic description instead of rendered rows.
|
|
4
|
+
*
|
|
5
|
+
* A component opts in with `describe(cx)`, returning a {@link NativeNode}: a
|
|
6
|
+
* wire node without ids. Children are either nested nodes or other
|
|
7
|
+
* components; a component child is a describe boundary the reconciler visits
|
|
8
|
+
* on its own, so each component owns a stable id prefix and can be skipped
|
|
9
|
+
* when it returns the same node object it returned last time (the same
|
|
10
|
+
* reference contract as `render()`). A component without `describe` becomes a
|
|
11
|
+
* `rows` fallback node rendered through `render(cx.cols)`.
|
|
12
|
+
*
|
|
13
|
+
* See `packages/wire/src/tsp.ts` for the wire vocabulary and
|
|
14
|
+
* `crates/tern/SURFACE_PROTOCOL.md` (Stencil repository) for the spec.
|
|
15
|
+
*/
|
|
16
|
+
import type { TspEvent, TspKind, TspProps, TspSpan } from "@oh-my-pi/pi-wire";
|
|
17
|
+
import type { Component } from "../tui.js";
|
|
18
|
+
/** A described node: a wire node minus its id, with components allowed as children. */
|
|
19
|
+
export type NativeNode = {
|
|
20
|
+
[K in TspKind]: {
|
|
21
|
+
readonly k: K;
|
|
22
|
+
readonly p?: TspProps<K>;
|
|
23
|
+
readonly c?: readonly NativeChild[];
|
|
24
|
+
/**
|
|
25
|
+
* Identity among its siblings inside the owning component (defaults to
|
|
26
|
+
* the child index). Give keys to children that can be inserted, removed
|
|
27
|
+
* or reordered so their ids and terminal-side view state survive.
|
|
28
|
+
*/
|
|
29
|
+
readonly key?: string;
|
|
30
|
+
};
|
|
31
|
+
}[TspKind];
|
|
32
|
+
/** A child slot: a described node, or a component that describes itself. */
|
|
33
|
+
export type NativeChild = NativeNode | Component;
|
|
34
|
+
/** What a component may consult while describing itself. Never a clock: motion is terminal-clocked. */
|
|
35
|
+
export interface DescribeContext {
|
|
36
|
+
/** Surface width in cells; only for `rows` fallback and ANSI wrap hints. */
|
|
37
|
+
readonly cols: number;
|
|
38
|
+
/** The terminal asked for reduced motion. */
|
|
39
|
+
readonly reduceMotion: boolean;
|
|
40
|
+
/** The terminal's appearance is dark. */
|
|
41
|
+
readonly dark: boolean;
|
|
42
|
+
/** Whether the terminal renders `kind` natively (else describe something simpler or let it fall back). */
|
|
43
|
+
supports(kind: TspKind): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the terminal's `hello` advertised protocol feature `name`
|
|
46
|
+
* (`aside`: a `prefs` page in `layer` docks as a sheet at the pane's right
|
|
47
|
+
* edge, the transcript narrowed beside it).
|
|
48
|
+
*/
|
|
49
|
+
feature(name: string): boolean;
|
|
50
|
+
}
|
|
51
|
+
/** The regions a frame provider fills when it describes a whole surface. */
|
|
52
|
+
export interface NativeSurface {
|
|
53
|
+
/** The flowing document (transcript). */
|
|
54
|
+
readonly main: readonly NativeChild[];
|
|
55
|
+
/** Sticky bottom chrome while live (editor, status line, HUDs). */
|
|
56
|
+
readonly dock: readonly NativeChild[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A user action on a node a component described, routed back to that
|
|
60
|
+
* component. `key` is the node's key path inside the component (`""` for the
|
|
61
|
+
* component's root node, `"body/3"` for a nested keyed child).
|
|
62
|
+
*/
|
|
63
|
+
export type NativeUiEvent = {
|
|
64
|
+
readonly type: "toggle";
|
|
65
|
+
readonly key: string;
|
|
66
|
+
readonly collapsed: boolean;
|
|
67
|
+
} | {
|
|
68
|
+
readonly type: "select";
|
|
69
|
+
readonly key: string;
|
|
70
|
+
readonly item: string;
|
|
71
|
+
} | {
|
|
72
|
+
readonly type: "activate";
|
|
73
|
+
readonly key: string;
|
|
74
|
+
readonly item: string;
|
|
75
|
+
} | {
|
|
76
|
+
readonly type: "action";
|
|
77
|
+
readonly key: string;
|
|
78
|
+
readonly act: string;
|
|
79
|
+
/** Scope/tab/strip id, sort column, or the prefs row an action control belongs to. */
|
|
80
|
+
readonly value?: string;
|
|
81
|
+
readonly mods: readonly string[];
|
|
82
|
+
}
|
|
83
|
+
/** A typed value changed by pointer (prefs rows, picker toggles); `null` resets to the default. */
|
|
84
|
+
| {
|
|
85
|
+
readonly type: "change";
|
|
86
|
+
readonly key: string;
|
|
87
|
+
readonly item: string;
|
|
88
|
+
readonly value: boolean | number | string | readonly string[] | null;
|
|
89
|
+
};
|
|
90
|
+
/** The expanded state a `toggle` on the component's root node asks for, else undefined. */
|
|
91
|
+
export declare function rootToggleExpanded(event: NativeUiEvent): boolean | undefined;
|
|
92
|
+
/** The last segment of an event keypath (`"split/sidebar/toc"` → `"toc"`). */
|
|
93
|
+
export declare function leafKey(path: string): string;
|
|
94
|
+
/** Terminal-level events the backend doesn't route to a single component. */
|
|
95
|
+
export type NativeTerminalEvent = Extract<TspEvent, {
|
|
96
|
+
ev: "theme" | "motion" | "visible" | "resize";
|
|
97
|
+
}>;
|
|
98
|
+
/** Implemented by components that react to user actions on their described nodes. */
|
|
99
|
+
export interface NativeEventTarget {
|
|
100
|
+
handleNativeEvent(event: NativeUiEvent): void;
|
|
101
|
+
}
|
|
102
|
+
/** Implemented by frame providers (the composer) that describe the whole surface. */
|
|
103
|
+
export interface NativeSurfaceProvider {
|
|
104
|
+
describeSurface(cx: DescribeContext): NativeSurface;
|
|
105
|
+
}
|
|
106
|
+
/** Re-exported for describe helpers. */
|
|
107
|
+
export type { TspSpan };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay chrome for `describe()`: root cards, key-hint footers, selectable
|
|
3
|
+
* lists and annotation callouts.
|
|
4
|
+
*
|
|
5
|
+
* The overlay frame itself (glass, ring, placement) is the terminal's: the
|
|
6
|
+
* engine wraps every overlay-stack component in an `overlay` node. An overlay
|
|
7
|
+
* component's root is a `card` whose `head` carries the title.
|
|
8
|
+
*/
|
|
9
|
+
import type { TspProps, TspSpan, TspText } from "@oh-my-pi/pi-wire";
|
|
10
|
+
import type { KeyName } from "../key-hint-format.js";
|
|
11
|
+
import { type Keybinding } from "../keybindings.js";
|
|
12
|
+
import type { NativeChild, NativeNode } from "./node.js";
|
|
13
|
+
/** One footer hint: the keys that trigger it and what it does. */
|
|
14
|
+
export interface NativeHint {
|
|
15
|
+
/** Key ids (`"ctrl+o"`, `"escape"`); alternatives render side by side. */
|
|
16
|
+
readonly keys: readonly KeyName[];
|
|
17
|
+
readonly label: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A hint for the primary keys of one or more keybinding actions
|
|
21
|
+
* (`actionHint(["tui.select.up", "tui.select.down"], "navigate")`);
|
|
22
|
+
* `undefined` when every action is unbound.
|
|
23
|
+
*/
|
|
24
|
+
export declare function actionHint(actions: Keybinding | readonly Keybinding[], label: string): NativeHint | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* A wrapping row of `kbd` keycaps with muted labels: the footer hint strip of
|
|
27
|
+
* a selector. `undefined` entries (unbound actions) are skipped. Build it once
|
|
28
|
+
* per hint-set change and reuse the node (memoization contract).
|
|
29
|
+
*/
|
|
30
|
+
export declare function hintsRow(hints: readonly (NativeHint | undefined)[], key?: string): NativeNode;
|
|
31
|
+
/** A wrapping footer: a status line (`✓ Clean`, `⚠ Cancelled`) followed by key hints. */
|
|
32
|
+
export declare function statusHintsRow(status: TspText, hints: readonly (NativeHint | undefined)[]): NativeNode;
|
|
33
|
+
/**
|
|
34
|
+
* Root card of an overlay. `head` is the overlay title (whitespace runs
|
|
35
|
+
* collapse; empty means no head); `role` is `omp.overlay.<name>`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function overlayCard(role: string, head: TspText | undefined, children: readonly NativeChild[], props?: Omit<TspProps<"card">, "head" | "role">): NativeNode;
|
|
38
|
+
/** A selectable list: click selects, double-click activates. */
|
|
39
|
+
export declare function selectList(key: string, items: readonly NativeChild[], p: TspProps<"list">): NativeNode;
|
|
40
|
+
/** The index encoded in an item key built as `<prefix><index>`, or -1 when it isn't one. */
|
|
41
|
+
export declare function itemIndex(item: string, prefix: string): number;
|
|
42
|
+
/** Options of an {@link actionButton}. */
|
|
43
|
+
export interface ActionButtonOptions {
|
|
44
|
+
/** Sibling identity key (defaults to the action id); `leafKey(event.key)` reports it back. */
|
|
45
|
+
readonly key?: string;
|
|
46
|
+
/** Key id of the keyboard path the button mirrors, drawn as a keycap inside it (`"r"`, `"ctrl+g"`). */
|
|
47
|
+
readonly keys?: string;
|
|
48
|
+
/** `accent` = the view's hero action, `error` = destructive. */
|
|
49
|
+
readonly tone?: "accent" | "error";
|
|
50
|
+
/** Tooltip; defaults to the label plus the keycap (`"Refresh r"`). */
|
|
51
|
+
readonly title?: string;
|
|
52
|
+
/** Target of an `open` action (URL or `file://` path). */
|
|
53
|
+
readonly href?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A native button (role `omp.btn`): a label plus an optional keycap. A click
|
|
57
|
+
* sends `act` back as an `action` event (or runs a terminal-local `open`/`copy`),
|
|
58
|
+
* which the component routes to the same code path as the key.
|
|
59
|
+
*/
|
|
60
|
+
export declare function actionButton(label: string, act: string, options?: ActionButtonOptions): NativeNode;
|
|
61
|
+
/** A row of {@link actionButton}s (role `omp.actions`); `null` entries become the spacer that end-aligns what follows. */
|
|
62
|
+
export declare function actionBar(buttons: readonly (NativeNode | null)[], key?: string): NativeNode;
|
|
63
|
+
/** Spans of an annotation callout: a dim `label:` then the note. */
|
|
64
|
+
export declare function noteSpans(label: string, note: string): TspSpan[];
|