dexto 1.3.0 → 1.5.0
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/README.md +87 -22
- package/dist/agents/agent-registry.json +9 -0
- package/dist/agents/agent-template.yml +2 -2
- package/dist/agents/coding-agent/coding-agent.yml +27 -16
- package/dist/agents/database-agent/database-agent.yml +2 -2
- package/dist/agents/default-agent.yml +9 -7
- package/dist/agents/github-agent/github-agent.yml +2 -2
- package/dist/agents/product-name-researcher/product-name-researcher.yml +2 -2
- package/dist/agents/talk2pdf-agent/talk2pdf-agent.yml +2 -2
- package/dist/analytics/events.d.ts +13 -6
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/analytics/index.d.ts +1 -1
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +6 -2
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +65 -9
- package/dist/cli/cli-subscriber.d.ts +4 -0
- package/dist/cli/cli-subscriber.d.ts.map +1 -1
- package/dist/cli/cli-subscriber.js +47 -3
- package/dist/cli/commands/create-app.d.ts +16 -14
- package/dist/cli/commands/create-app.d.ts.map +1 -1
- package/dist/cli/commands/create-app.js +626 -102
- package/dist/cli/commands/create-image.d.ts +7 -0
- package/dist/cli/commands/create-image.d.ts.map +1 -0
- package/dist/cli/commands/create-image.js +201 -0
- package/dist/cli/commands/helpers/formatters.d.ts.map +1 -1
- package/dist/cli/commands/helpers/formatters.js +9 -8
- package/dist/cli/commands/index.d.ts +2 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -1
- package/dist/cli/commands/init-app.js +7 -7
- package/dist/cli/commands/install.d.ts +0 -3
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +19 -70
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +17 -14
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +7 -22
- package/dist/cli/commands/interactive-commands/commands.d.ts +4 -4
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.js +34 -42
- package/dist/cli/commands/interactive-commands/documentation-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/documentation-commands.js +4 -7
- package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/general-commands.js +159 -117
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts +9 -3
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/mcp/index.js +18 -3
- package/dist/cli/commands/interactive-commands/model/index.d.ts +8 -6
- package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/model/index.js +18 -6
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -2
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +77 -60
- package/dist/cli/commands/interactive-commands/session/index.d.ts +7 -12
- package/dist/cli/commands/interactive-commands/session/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/index.js +7 -14
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +10 -24
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/session-commands.js +16 -371
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts +1 -0
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +106 -77
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts +1 -1
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/tool-commands.js +5 -62
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts +13 -17
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/utils/command-output.js +18 -37
- package/dist/cli/commands/list-agents.d.ts +2 -2
- package/dist/cli/commands/list-agents.d.ts.map +1 -1
- package/dist/cli/commands/list-agents.js +38 -34
- package/dist/cli/commands/session-commands.js +16 -16
- package/dist/cli/commands/setup.d.ts +13 -5
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +860 -65
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/commands/uninstall.js +4 -6
- package/dist/cli/commands/which.d.ts.map +1 -1
- package/dist/cli/commands/which.js +18 -4
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts +9 -22
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +50 -133
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +26 -3
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +182 -45
- package/dist/cli/ink-cli/components/CustomInput.js +1 -1
- package/dist/cli/ink-cli/components/EditableMultiLineInput.js +4 -4
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts +22 -0
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/ElicitationForm.js +358 -0
- package/dist/cli/ink-cli/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ErrorBoundary.js +1 -1
- package/dist/cli/ink-cli/components/Footer.d.ts +16 -0
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/Footer.js +27 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts +17 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.js +8 -0
- package/dist/cli/ink-cli/components/MultiLineInput.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/MultiLineInput.js +3 -3
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts +15 -2
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +126 -82
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts +15 -2
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +228 -122
- package/dist/cli/ink-cli/components/StatusBar.d.ts +15 -2
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +50 -10
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts +52 -0
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/TextBufferInput.js +471 -0
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.js +4 -4
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts +11 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.js +90 -49
- package/dist/cli/ink-cli/components/chat/Footer.js +1 -1
- package/dist/cli/ink-cli/components/chat/Header.d.ts +1 -0
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/Header.js +6 -3
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts +3 -0
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +95 -9
- package/dist/cli/ink-cli/components/chat/MessageList.js +1 -1
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts +16 -0
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +27 -0
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +5 -3
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +21 -7
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +15 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +9 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +37 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +9 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +29 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts +45 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +38 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts +13 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.js +12 -0
- package/dist/cli/ink-cli/components/input/InputArea.d.ts +36 -8
- package/dist/cli/ink-cli/components/input/InputArea.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/input/InputArea.js +3 -3
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +25 -0
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +166 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +27 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +95 -0
- package/dist/cli/ink-cli/components/modes/index.d.ts +10 -0
- package/dist/cli/ink-cli/components/modes/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/index.js +9 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts +26 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +92 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +286 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +59 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +59 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts +26 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +73 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +51 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +215 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +74 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.js +52 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +28 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +84 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +109 -0
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +15 -8
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +400 -23
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +52 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +166 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts +27 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +119 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.js +144 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts +23 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +189 -0
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts +7 -2
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.js +19 -5
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +42 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.js +58 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +400 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.js +609 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts +15 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.js +14 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +419 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +29 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts +17 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.js +11 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +10 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts +30 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.js +13 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts +8 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.js +7 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts +79 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.js +38 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +65 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +28 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +66 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts +19 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.js +26 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +26 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts +20 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +12 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +25 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts +61 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.js +158 -0
- package/dist/cli/ink-cli/components/renderers/index.d.ts +28 -0
- package/dist/cli/ink-cli/components/renderers/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/index.js +36 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts +38 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.js +362 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts +44 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.js +300 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts +185 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.js +1338 -0
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts +10 -0
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/processingPhrases.js +64 -0
- package/dist/cli/ink-cli/constants/tips.d.ts +15 -0
- package/dist/cli/ink-cli/constants/tips.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/tips.js +53 -0
- package/dist/cli/ink-cli/containers/InputContainer.d.ts +42 -8
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +513 -85
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +23 -5
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +1214 -132
- package/dist/cli/ink-cli/containers/index.d.ts +1 -1
- package/dist/cli/ink-cli/containers/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts +36 -0
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/KeypressContext.js +461 -0
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts +27 -0
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/MouseContext.js +102 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts +33 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.js +170 -0
- package/dist/cli/ink-cli/contexts/index.d.ts +7 -0
- package/dist/cli/ink-cli/contexts/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/index.js +6 -0
- package/dist/cli/ink-cli/hooks/index.d.ts +5 -0
- package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/index.js +6 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +26 -9
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +90 -198
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts +14 -0
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useBatchedScroll.js +25 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts +50 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useCLIState.js +190 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts +24 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.js +69 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts +61 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.js +210 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts +136 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +663 -0
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.js +7 -26
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts +18 -0
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useKeypress.js +26 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts +30 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.js +68 -0
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts +19 -0
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useStreaming.js +26 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts +14 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.js +31 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts +42 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.js +96 -0
- package/dist/cli/ink-cli/services/CommandService.d.ts +32 -1
- package/dist/cli/ink-cli/services/CommandService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/CommandService.js +36 -5
- package/dist/cli/ink-cli/services/InputService.d.ts +1 -5
- package/dist/cli/ink-cli/services/InputService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/InputService.js +1 -8
- package/dist/cli/ink-cli/services/index.d.ts +2 -1
- package/dist/cli/ink-cli/services/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/index.js +2 -1
- package/dist/cli/ink-cli/services/processStream.d.ts +69 -0
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -0
- package/dist/cli/ink-cli/services/processStream.js +742 -0
- package/dist/cli/ink-cli/state/actions.d.ts +30 -60
- package/dist/cli/ink-cli/state/actions.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/actions.js +3 -0
- package/dist/cli/ink-cli/state/index.d.ts +5 -3
- package/dist/cli/ink-cli/state/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/index.js +4 -3
- package/dist/cli/ink-cli/state/initialState.d.ts +4 -3
- package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/initialState.js +20 -4
- package/dist/cli/ink-cli/state/reducer.d.ts +3 -0
- package/dist/cli/ink-cli/state/reducer.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/reducer.js +62 -168
- package/dist/cli/ink-cli/state/streaming-state.d.ts +27 -0
- package/dist/cli/ink-cli/state/streaming-state.d.ts.map +1 -0
- package/dist/cli/ink-cli/state/streaming-state.js +39 -0
- package/dist/cli/ink-cli/state/types.d.ts +223 -6
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts +22 -0
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/bracketedPaste.js +27 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts +49 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.js +356 -0
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts +33 -0
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/commandOverlays.js +78 -0
- package/dist/cli/ink-cli/utils/debugLog.d.ts +38 -0
- package/dist/cli/ink-cli/utils/debugLog.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/debugLog.js +66 -0
- package/dist/cli/ink-cli/utils/index.d.ts +2 -1
- package/dist/cli/ink-cli/utils/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/index.js +3 -1
- package/dist/cli/ink-cli/utils/input.d.ts +25 -0
- package/dist/cli/ink-cli/utils/input.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/input.js +56 -0
- package/dist/cli/ink-cli/utils/inputParsing.d.ts +0 -9
- package/dist/cli/ink-cli/utils/inputParsing.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/inputParsing.js +0 -27
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +59 -3
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +348 -20
- package/dist/cli/ink-cli/utils/mouse.d.ts +61 -0
- package/dist/cli/ink-cli/utils/mouse.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/mouse.js +209 -0
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts +44 -0
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/streamSplitter.js +154 -0
- package/dist/cli/ink-cli/utils/textUtils.d.ts +63 -0
- package/dist/cli/ink-cli/utils/textUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/textUtils.js +248 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts +9 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/toolUtils.js +15 -0
- package/dist/cli/utils/api-key-setup.d.ts +54 -4
- package/dist/cli/utils/api-key-setup.d.ts.map +1 -1
- package/dist/cli/utils/api-key-setup.js +433 -107
- package/dist/cli/utils/api-key-verification.d.ts +17 -0
- package/dist/cli/utils/api-key-verification.d.ts.map +1 -0
- package/dist/cli/utils/api-key-verification.js +211 -0
- package/dist/cli/utils/config-validation.d.ts +22 -2
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +354 -25
- package/dist/cli/utils/local-model-setup.d.ts +46 -0
- package/dist/cli/utils/local-model-setup.d.ts.map +1 -0
- package/dist/cli/utils/local-model-setup.js +662 -0
- package/dist/cli/utils/options.d.ts.map +1 -1
- package/dist/cli/utils/options.js +1 -3
- package/dist/cli/utils/prompt-helpers.d.ts +47 -0
- package/dist/cli/utils/prompt-helpers.d.ts.map +1 -0
- package/dist/cli/utils/prompt-helpers.js +66 -0
- package/dist/cli/utils/provider-setup.d.ts +66 -8
- package/dist/cli/utils/provider-setup.d.ts.map +1 -1
- package/dist/cli/utils/provider-setup.js +324 -84
- package/dist/cli/utils/scaffolding-utils.d.ts +76 -0
- package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -0
- package/dist/cli/utils/scaffolding-utils.js +246 -0
- package/dist/cli/utils/setup-utils.d.ts +16 -0
- package/dist/cli/utils/setup-utils.d.ts.map +1 -1
- package/dist/cli/utils/setup-utils.js +72 -21
- package/dist/cli/utils/template-engine.d.ts +65 -0
- package/dist/cli/utils/template-engine.d.ts.map +1 -0
- package/dist/cli/utils/template-engine.js +1089 -0
- package/dist/config/cli-overrides.d.ts +45 -2
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +107 -10
- package/dist/index.js +379 -99
- package/dist/utils/agent-helpers.d.ts +95 -0
- package/dist/utils/agent-helpers.d.ts.map +1 -0
- package/dist/utils/agent-helpers.js +117 -0
- package/dist/webui/assets/index-8j-KMkX1.js +2054 -0
- package/dist/webui/assets/index-c_AX24V4.css +1 -0
- package/dist/webui/assets/{tanstack-DgxBONJY.js → tanstack-Br79RQ-n.js} +1 -1
- package/dist/webui/index.html +4 -10
- package/dist/webui/logos/aws-color.svg +1 -0
- package/dist/webui/logos/dexto/dexto_logo.svg +1 -1
- package/dist/webui/logos/dexto/dexto_logo_light.svg +6 -6
- package/dist/webui/logos/glama.svg +7 -0
- package/dist/webui/logos/litellm.svg +7 -0
- package/dist/webui/logos/openrouter.svg +1 -0
- package/package.json +18 -15
- package/dist/cli/commands/interactive-commands/index.d.ts +0 -63
- package/dist/cli/commands/interactive-commands/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/index.js +0 -73
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts +0 -34
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.js +0 -178
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts +0 -9
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.js +0 -325
- package/dist/cli/commands/interactive-commands/model/model-commands.d.ts +0 -21
- package/dist/cli/commands/interactive-commands/model/model-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/model/model-commands.js +0 -190
- package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts +0 -26
- package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/MultiLineTextInput.js +0 -220
- package/dist/discord/bot.d.ts +0 -4
- package/dist/discord/bot.d.ts.map +0 -1
- package/dist/discord/bot.js +0 -193
- package/dist/telegram/bot.d.ts +0 -5
- package/dist/telegram/bot.d.ts.map +0 -1
- package/dist/telegram/bot.js +0 -251
- package/dist/webui/assets/index-DKq5Xng1.js +0 -687
- package/dist/webui/assets/index-D_0_GBu5.css +0 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useStdout } from 'ink';
|
|
3
|
+
import { diffWords } from 'diff';
|
|
4
|
+
// =============================================================================
|
|
5
|
+
// Diff Parsing
|
|
6
|
+
// =============================================================================
|
|
7
|
+
/**
|
|
8
|
+
* Parse unified diff into structured hunks
|
|
9
|
+
*/
|
|
10
|
+
export function parseUnifiedDiff(unified) {
|
|
11
|
+
const lines = unified.split('\n');
|
|
12
|
+
const hunks = [];
|
|
13
|
+
let currentHunk = null;
|
|
14
|
+
let oldLine = 0;
|
|
15
|
+
let newLine = 0;
|
|
16
|
+
for (const line of lines) {
|
|
17
|
+
if (line.startsWith('---') || line.startsWith('+++') || line.startsWith('Index:')) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const hunkMatch = line.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
|
|
21
|
+
if (hunkMatch) {
|
|
22
|
+
if (currentHunk) {
|
|
23
|
+
hunks.push(currentHunk);
|
|
24
|
+
}
|
|
25
|
+
oldLine = parseInt(hunkMatch[1], 10);
|
|
26
|
+
newLine = parseInt(hunkMatch[3], 10);
|
|
27
|
+
currentHunk = {
|
|
28
|
+
oldStart: oldLine,
|
|
29
|
+
newStart: newLine,
|
|
30
|
+
lines: [],
|
|
31
|
+
};
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (!currentHunk)
|
|
35
|
+
continue;
|
|
36
|
+
if (line.startsWith('+')) {
|
|
37
|
+
currentHunk.lines.push({
|
|
38
|
+
type: 'addition',
|
|
39
|
+
content: line.slice(1),
|
|
40
|
+
lineNum: newLine++,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else if (line.startsWith('-')) {
|
|
44
|
+
currentHunk.lines.push({
|
|
45
|
+
type: 'deletion',
|
|
46
|
+
content: line.slice(1),
|
|
47
|
+
lineNum: oldLine++,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
else if (line.startsWith(' ') || line === '') {
|
|
51
|
+
currentHunk.lines.push({
|
|
52
|
+
type: 'context',
|
|
53
|
+
content: line.startsWith(' ') ? line.slice(1) : line,
|
|
54
|
+
lineNum: newLine,
|
|
55
|
+
});
|
|
56
|
+
oldLine++;
|
|
57
|
+
newLine++;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (currentHunk) {
|
|
61
|
+
hunks.push(currentHunk);
|
|
62
|
+
}
|
|
63
|
+
return hunks;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Find paired deletion/addition lines for word-level diff
|
|
67
|
+
*/
|
|
68
|
+
export function findLinePairs(lines) {
|
|
69
|
+
const pairs = new Map();
|
|
70
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
|
71
|
+
const current = lines[i];
|
|
72
|
+
const next = lines[i + 1];
|
|
73
|
+
if (current.type === 'deletion' && next.type === 'addition') {
|
|
74
|
+
pairs.set(i, { del: current, add: next });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return pairs;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Compute word-level diff between two strings
|
|
81
|
+
*/
|
|
82
|
+
export function computeWordDiff(oldStr, newStr) {
|
|
83
|
+
const changes = diffWords(oldStr, newStr);
|
|
84
|
+
const oldParts = [];
|
|
85
|
+
const newParts = [];
|
|
86
|
+
for (const change of changes) {
|
|
87
|
+
if (change.added) {
|
|
88
|
+
newParts.push({ value: change.value, added: true });
|
|
89
|
+
}
|
|
90
|
+
else if (change.removed) {
|
|
91
|
+
oldParts.push({ value: change.value, removed: true });
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
oldParts.push({ value: change.value });
|
|
95
|
+
newParts.push({ value: change.value });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { oldParts, newParts };
|
|
99
|
+
}
|
|
100
|
+
// =============================================================================
|
|
101
|
+
// Line Number Formatting
|
|
102
|
+
// =============================================================================
|
|
103
|
+
export function getLineNumWidth(maxLineNum) {
|
|
104
|
+
return Math.max(3, String(maxLineNum).length);
|
|
105
|
+
}
|
|
106
|
+
export function formatLineNum(num, width) {
|
|
107
|
+
return String(num).padStart(width, ' ');
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Render a single diff line with true 2-column layout.
|
|
111
|
+
* Column 1: Fixed-width gutter (line number + symbol)
|
|
112
|
+
* Column 2: Fixed-width content area (remaining terminal width)
|
|
113
|
+
* This prevents content/backgrounds from leaking beyond boundaries.
|
|
114
|
+
*/
|
|
115
|
+
export function DiffLine({ type, lineNum, lineNumWidth, content, wordDiffParts }) {
|
|
116
|
+
const { stdout } = useStdout();
|
|
117
|
+
const terminalWidth = stdout?.columns ?? 80;
|
|
118
|
+
const lineNumStr = formatLineNum(lineNum, lineNumWidth);
|
|
119
|
+
// Gutter: line number + space + symbol + space (e.g., " 42 - ")
|
|
120
|
+
const gutterWidth = lineNumWidth + 3;
|
|
121
|
+
// Content column width - remaining space after gutter and padding
|
|
122
|
+
// Account for padding (2 chars from DiffRenderer's paddingLeft)
|
|
123
|
+
const contentWidth = Math.max(20, terminalWidth - gutterWidth - 4);
|
|
124
|
+
// Get colors based on type
|
|
125
|
+
const getColors = () => {
|
|
126
|
+
switch (type) {
|
|
127
|
+
case 'deletion':
|
|
128
|
+
return { bg: '#662222', fg: 'white', symbol: '-', symbolColor: 'red' };
|
|
129
|
+
case 'addition':
|
|
130
|
+
return { bg: '#224466', fg: 'white', symbol: '+', symbolColor: 'blue' };
|
|
131
|
+
default:
|
|
132
|
+
return { bg: undefined, fg: undefined, symbol: ' ', symbolColor: undefined };
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const colors = getColors();
|
|
136
|
+
// Render content with word-level diff highlighting if available
|
|
137
|
+
const renderContent = () => {
|
|
138
|
+
if (wordDiffParts && wordDiffParts.length > 0) {
|
|
139
|
+
return wordDiffParts.map((part, i) => {
|
|
140
|
+
if (type === 'deletion' && part.removed) {
|
|
141
|
+
return (_jsx(Text, { backgroundColor: "#882222", children: part.value }, i));
|
|
142
|
+
}
|
|
143
|
+
else if (type === 'addition' && part.added) {
|
|
144
|
+
return (_jsx(Text, { backgroundColor: "#224488", children: part.value }, i));
|
|
145
|
+
}
|
|
146
|
+
return _jsx(Text, { children: part.value }, i);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return content;
|
|
150
|
+
};
|
|
151
|
+
return (_jsxs(Box, { children: [_jsxs(Box, { width: gutterWidth, flexShrink: 0, children: [_jsx(Text, { color: "gray", children: lineNumStr }), _jsxs(Text, { color: colors.symbolColor, children: [" ", colors.symbol, " "] })] }), _jsx(Box, { width: contentWidth, flexShrink: 0, children: _jsx(Text, { backgroundColor: colors.bg, color: colors.fg, wrap: "wrap", children: renderContent() }) })] }));
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Hunk separator component
|
|
155
|
+
*/
|
|
156
|
+
export function HunkSeparator() {
|
|
157
|
+
return (_jsx(Box, { children: _jsx(Text, { color: "gray", children: "..." }) }));
|
|
158
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Result Renderers
|
|
3
|
+
*
|
|
4
|
+
* Dispatch component that renders tool results based on display type.
|
|
5
|
+
* Uses discriminated union from ToolDisplayData for type-safe rendering.
|
|
6
|
+
*/
|
|
7
|
+
import type { ContentPart, ToolDisplayData } from '@dexto/core';
|
|
8
|
+
export { DiffRenderer } from './DiffRenderer.js';
|
|
9
|
+
export { ShellRenderer } from './ShellRenderer.js';
|
|
10
|
+
export { SearchRenderer } from './SearchRenderer.js';
|
|
11
|
+
export { FileRenderer } from './FileRenderer.js';
|
|
12
|
+
export { GenericRenderer } from './GenericRenderer.js';
|
|
13
|
+
export { DiffPreview, CreateFilePreview } from './FilePreviewRenderer.js';
|
|
14
|
+
interface ToolResultRendererProps {
|
|
15
|
+
/** Display data from SanitizedToolResult.meta.display */
|
|
16
|
+
display?: ToolDisplayData;
|
|
17
|
+
/** Content parts from SanitizedToolResult.content */
|
|
18
|
+
content: ContentPart[];
|
|
19
|
+
/** Maximum lines/matches to display */
|
|
20
|
+
maxLines?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Renders tool results based on display type.
|
|
24
|
+
* Falls back to GenericRenderer for unknown types or missing display data.
|
|
25
|
+
* Each renderer uses its own default limits - only pass maxLines to override.
|
|
26
|
+
*/
|
|
27
|
+
export declare function ToolResultRenderer({ display, content, maxLines }: ToolResultRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/renderers/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAQhE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,UAAU,uBAAuB;IAC7B,yDAAyD;IACzD,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,qDAAqD;IACrD,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,uBAAuB,2CAgCzF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DiffRenderer } from './DiffRenderer.js';
|
|
3
|
+
import { ShellRenderer } from './ShellRenderer.js';
|
|
4
|
+
import { SearchRenderer } from './SearchRenderer.js';
|
|
5
|
+
import { FileRenderer } from './FileRenderer.js';
|
|
6
|
+
import { GenericRenderer } from './GenericRenderer.js';
|
|
7
|
+
// Re-export individual renderers for direct use
|
|
8
|
+
export { DiffRenderer } from './DiffRenderer.js';
|
|
9
|
+
export { ShellRenderer } from './ShellRenderer.js';
|
|
10
|
+
export { SearchRenderer } from './SearchRenderer.js';
|
|
11
|
+
export { FileRenderer } from './FileRenderer.js';
|
|
12
|
+
export { GenericRenderer } from './GenericRenderer.js';
|
|
13
|
+
// File preview renderers for approval prompts (full content, no truncation)
|
|
14
|
+
export { DiffPreview, CreateFilePreview } from './FilePreviewRenderer.js';
|
|
15
|
+
/**
|
|
16
|
+
* Renders tool results based on display type.
|
|
17
|
+
* Falls back to GenericRenderer for unknown types or missing display data.
|
|
18
|
+
* Each renderer uses its own default limits - only pass maxLines to override.
|
|
19
|
+
*/
|
|
20
|
+
export function ToolResultRenderer({ display, content, maxLines }) {
|
|
21
|
+
// Default to generic if no display data
|
|
22
|
+
const displayData = display ?? { type: 'generic' };
|
|
23
|
+
switch (displayData.type) {
|
|
24
|
+
case 'diff':
|
|
25
|
+
return (_jsx(DiffRenderer, { data: displayData, ...(maxLines !== undefined && { maxLines }) }));
|
|
26
|
+
case 'shell':
|
|
27
|
+
return (_jsx(ShellRenderer, { data: displayData, ...(maxLines !== undefined && { maxLines }) }));
|
|
28
|
+
case 'search':
|
|
29
|
+
return (_jsx(SearchRenderer, { data: displayData, ...(maxLines !== undefined && { maxMatches: maxLines }) }));
|
|
30
|
+
case 'file':
|
|
31
|
+
return _jsx(FileRenderer, { data: displayData });
|
|
32
|
+
case 'generic':
|
|
33
|
+
default:
|
|
34
|
+
return (_jsx(GenericRenderer, { content: content, ...(maxLines !== undefined && { maxLines }) }));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MarkdownText Component
|
|
3
|
+
*
|
|
4
|
+
* Renders markdown text with terminal-appropriate styling.
|
|
5
|
+
* Handles both inline markdown (bold, code, italic) and block elements (headers, code blocks, lists).
|
|
6
|
+
*
|
|
7
|
+
* Uses wrap-ansi for proper word wrapping to avoid mid-word splits.
|
|
8
|
+
* Streaming-safe: incomplete markdown tokens won't match regex patterns,
|
|
9
|
+
* so they render as plain text until complete.
|
|
10
|
+
*/
|
|
11
|
+
import React from 'react';
|
|
12
|
+
interface InlineSegment {
|
|
13
|
+
type: 'text' | 'bold' | 'code' | 'italic' | 'strikethrough' | 'link' | 'url';
|
|
14
|
+
content: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Parse inline markdown and return segments.
|
|
19
|
+
* Uses a single regex to find all inline patterns, processes in order.
|
|
20
|
+
*/
|
|
21
|
+
declare function parseInlineMarkdown(text: string): InlineSegment[];
|
|
22
|
+
interface RenderInlineProps {
|
|
23
|
+
text: string;
|
|
24
|
+
defaultColor?: string;
|
|
25
|
+
/** Apply bold styling to all text segments (used for headers) */
|
|
26
|
+
bold?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare const RenderInline: React.NamedExoticComponent<RenderInlineProps>;
|
|
29
|
+
interface MarkdownTextProps {
|
|
30
|
+
children: string;
|
|
31
|
+
/** Default text color */
|
|
32
|
+
color?: string;
|
|
33
|
+
/** Optional prefix for first line (e.g., "⏺ " for assistant messages) */
|
|
34
|
+
bulletPrefix?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare const MarkdownText: React.NamedExoticComponent<MarkdownTextProps>;
|
|
37
|
+
export { RenderInline, parseInlineMarkdown };
|
|
38
|
+
//# sourceMappingURL=MarkdownText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownText.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/shared/MarkdownText.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAwB,MAAM,OAAO,CAAC;AAU7C,UAAU,aAAa;IACnB,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,iBAAS,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAuE1D;AA0ID,UAAU,iBAAiB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAkED,QAAA,MAAM,YAAY,+CAA6B,CAAC;AAMhD,UAAU,iBAAiB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AA4RD,eAAO,MAAM,YAAY,+CAA6B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* MarkdownText Component
|
|
4
|
+
*
|
|
5
|
+
* Renders markdown text with terminal-appropriate styling.
|
|
6
|
+
* Handles both inline markdown (bold, code, italic) and block elements (headers, code blocks, lists).
|
|
7
|
+
*
|
|
8
|
+
* Uses wrap-ansi for proper word wrapping to avoid mid-word splits.
|
|
9
|
+
* Streaming-safe: incomplete markdown tokens won't match regex patterns,
|
|
10
|
+
* so they render as plain text until complete.
|
|
11
|
+
*/
|
|
12
|
+
import { memo, useMemo } from 'react';
|
|
13
|
+
import { Text, Box, useStdout } from 'ink';
|
|
14
|
+
import chalk from 'chalk';
|
|
15
|
+
import wrapAnsi from 'wrap-ansi';
|
|
16
|
+
import stringWidth from 'string-width';
|
|
17
|
+
/**
|
|
18
|
+
* Parse inline markdown and return segments.
|
|
19
|
+
* Uses a single regex to find all inline patterns, processes in order.
|
|
20
|
+
*/
|
|
21
|
+
function parseInlineMarkdown(text) {
|
|
22
|
+
// Early return for plain text without markdown indicators
|
|
23
|
+
if (!/[*_~`\[<]|https?:\/\//.test(text)) {
|
|
24
|
+
return [{ type: 'text', content: text }];
|
|
25
|
+
}
|
|
26
|
+
const segments = [];
|
|
27
|
+
let lastIndex = 0;
|
|
28
|
+
// Combined regex for all inline patterns
|
|
29
|
+
// Order matters: longer/more specific patterns first
|
|
30
|
+
const inlineRegex = /(\*\*[^*]+\*\*|__[^_]+__|`[^`]+`|\*[^*]+\*|_[^_]+_|~~[^~]+~~|\[[^\]]+\]\([^)]+\)|https?:\/\/[^\s<]+)/g;
|
|
31
|
+
let match;
|
|
32
|
+
while ((match = inlineRegex.exec(text)) !== null) {
|
|
33
|
+
// Add text before the match
|
|
34
|
+
if (match.index > lastIndex) {
|
|
35
|
+
segments.push({ type: 'text', content: text.slice(lastIndex, match.index) });
|
|
36
|
+
}
|
|
37
|
+
const fullMatch = match[0];
|
|
38
|
+
// Determine the type and extract content
|
|
39
|
+
if (fullMatch.startsWith('**') && fullMatch.endsWith('**') && fullMatch.length > 4) {
|
|
40
|
+
// Bold: **text**
|
|
41
|
+
segments.push({ type: 'bold', content: fullMatch.slice(2, -2) });
|
|
42
|
+
}
|
|
43
|
+
else if (fullMatch.startsWith('__') && fullMatch.endsWith('__') && fullMatch.length > 4) {
|
|
44
|
+
// Bold: __text__
|
|
45
|
+
segments.push({ type: 'bold', content: fullMatch.slice(2, -2) });
|
|
46
|
+
}
|
|
47
|
+
else if (fullMatch.startsWith('`') && fullMatch.endsWith('`') && fullMatch.length > 2) {
|
|
48
|
+
// Inline code: `code`
|
|
49
|
+
segments.push({ type: 'code', content: fullMatch.slice(1, -1) });
|
|
50
|
+
}
|
|
51
|
+
else if (fullMatch.startsWith('~~') && fullMatch.endsWith('~~') && fullMatch.length > 4) {
|
|
52
|
+
// Strikethrough: ~~text~~
|
|
53
|
+
segments.push({ type: 'strikethrough', content: fullMatch.slice(2, -2) });
|
|
54
|
+
}
|
|
55
|
+
else if (fullMatch.startsWith('*') && fullMatch.endsWith('*') && fullMatch.length > 2) {
|
|
56
|
+
// Italic: *text*
|
|
57
|
+
segments.push({ type: 'italic', content: fullMatch.slice(1, -1) });
|
|
58
|
+
}
|
|
59
|
+
else if (fullMatch.startsWith('_') && fullMatch.endsWith('_') && fullMatch.length > 2) {
|
|
60
|
+
// Italic: _text_
|
|
61
|
+
segments.push({ type: 'italic', content: fullMatch.slice(1, -1) });
|
|
62
|
+
}
|
|
63
|
+
else if (fullMatch.startsWith('[') &&
|
|
64
|
+
fullMatch.includes('](') &&
|
|
65
|
+
fullMatch.endsWith(')')) {
|
|
66
|
+
// Link: [text](url)
|
|
67
|
+
const linkMatch = fullMatch.match(/\[([^\]]+)\]\(([^)]+)\)/);
|
|
68
|
+
if (linkMatch && linkMatch[1] && linkMatch[2]) {
|
|
69
|
+
segments.push({ type: 'link', content: linkMatch[1], url: linkMatch[2] });
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
segments.push({ type: 'text', content: fullMatch });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else if (/^https?:\/\//.test(fullMatch)) {
|
|
76
|
+
// Raw URL
|
|
77
|
+
segments.push({ type: 'url', content: fullMatch });
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// Fallback: render as plain text
|
|
81
|
+
segments.push({ type: 'text', content: fullMatch });
|
|
82
|
+
}
|
|
83
|
+
lastIndex = inlineRegex.lastIndex;
|
|
84
|
+
}
|
|
85
|
+
// Add remaining text after last match
|
|
86
|
+
if (lastIndex < text.length) {
|
|
87
|
+
segments.push({ type: 'text', content: text.slice(lastIndex) });
|
|
88
|
+
}
|
|
89
|
+
return segments;
|
|
90
|
+
}
|
|
91
|
+
// ============================================================================
|
|
92
|
+
// ANSI String Conversion (for wrap-ansi compatibility)
|
|
93
|
+
// ============================================================================
|
|
94
|
+
/**
|
|
95
|
+
* Convert parsed markdown segments to an ANSI-escaped string.
|
|
96
|
+
* This allows wrap-ansi to properly handle styled text while word-wrapping.
|
|
97
|
+
*/
|
|
98
|
+
function segmentsToAnsi(segments, defaultColor) {
|
|
99
|
+
const colorFn = getChalkColor(defaultColor);
|
|
100
|
+
return segments
|
|
101
|
+
.map((segment) => {
|
|
102
|
+
switch (segment.type) {
|
|
103
|
+
case 'bold':
|
|
104
|
+
return colorFn.bold(segment.content);
|
|
105
|
+
case 'code':
|
|
106
|
+
return chalk.cyan(segment.content);
|
|
107
|
+
case 'italic':
|
|
108
|
+
return chalk.gray(segment.content);
|
|
109
|
+
case 'strikethrough':
|
|
110
|
+
return colorFn.strikethrough(segment.content);
|
|
111
|
+
case 'link':
|
|
112
|
+
return colorFn(segment.content) + chalk.blue(` (${segment.url})`);
|
|
113
|
+
case 'url':
|
|
114
|
+
return chalk.blue(segment.content);
|
|
115
|
+
default:
|
|
116
|
+
return colorFn(segment.content);
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
.join('');
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get chalk color function from color name
|
|
123
|
+
*/
|
|
124
|
+
function getChalkColor(color) {
|
|
125
|
+
switch (color) {
|
|
126
|
+
case 'white':
|
|
127
|
+
return chalk.white;
|
|
128
|
+
case 'gray':
|
|
129
|
+
return chalk.gray;
|
|
130
|
+
case 'blue':
|
|
131
|
+
return chalk.blue;
|
|
132
|
+
case 'cyan':
|
|
133
|
+
return chalk.cyan;
|
|
134
|
+
case 'green':
|
|
135
|
+
return chalk.green;
|
|
136
|
+
case 'yellow':
|
|
137
|
+
return chalk.rgb(255, 165, 0);
|
|
138
|
+
case 'orange':
|
|
139
|
+
return chalk.rgb(255, 165, 0);
|
|
140
|
+
case 'red':
|
|
141
|
+
return chalk.red;
|
|
142
|
+
case 'magenta':
|
|
143
|
+
return chalk.green;
|
|
144
|
+
default:
|
|
145
|
+
return chalk.white;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Renders a paragraph with proper word wrapping using wrap-ansi.
|
|
150
|
+
* Handles bullet prefix with continuation line indentation.
|
|
151
|
+
*/
|
|
152
|
+
const WrappedParagraphInternal = ({ text, defaultColor, bulletPrefix, isFirstParagraph = false, }) => {
|
|
153
|
+
const { stdout } = useStdout();
|
|
154
|
+
const terminalWidth = stdout?.columns ?? 80;
|
|
155
|
+
const wrappedLines = useMemo(() => {
|
|
156
|
+
// Parse markdown and convert to ANSI string
|
|
157
|
+
const segments = parseInlineMarkdown(text);
|
|
158
|
+
const ansiString = segmentsToAnsi(segments, defaultColor);
|
|
159
|
+
// Calculate available width
|
|
160
|
+
const prefixWidth = bulletPrefix && isFirstParagraph ? stringWidth(bulletPrefix) : 0;
|
|
161
|
+
const availableWidth = Math.max(20, terminalWidth - prefixWidth);
|
|
162
|
+
// Word-wrap the ANSI string
|
|
163
|
+
const wrapped = wrapAnsi(ansiString, availableWidth, {
|
|
164
|
+
hard: false, // Don't break in the middle of words
|
|
165
|
+
wordWrap: true, // Enable word wrapping
|
|
166
|
+
trim: false, // Don't trim whitespace
|
|
167
|
+
});
|
|
168
|
+
return wrapped.split('\n');
|
|
169
|
+
}, [text, defaultColor, bulletPrefix, isFirstParagraph, terminalWidth]);
|
|
170
|
+
// Calculate indent for continuation lines (spaces to align with first line content)
|
|
171
|
+
const continuationIndent = bulletPrefix && isFirstParagraph ? ' '.repeat(stringWidth(bulletPrefix)) : '';
|
|
172
|
+
return (_jsx(_Fragment, { children: wrappedLines.map((line, i) => {
|
|
173
|
+
const isFirstLine = i === 0;
|
|
174
|
+
const prefix = isFirstLine && bulletPrefix && isFirstParagraph
|
|
175
|
+
? bulletPrefix
|
|
176
|
+
: continuationIndent;
|
|
177
|
+
return (_jsx(Box, { children: _jsxs(Text, { children: [prefix, line] }) }, i));
|
|
178
|
+
}) }));
|
|
179
|
+
};
|
|
180
|
+
const WrappedParagraph = memo(WrappedParagraphInternal);
|
|
181
|
+
/**
|
|
182
|
+
* Renders inline markdown segments with appropriate styling.
|
|
183
|
+
* Used for headers and other content that doesn't need word wrapping.
|
|
184
|
+
*/
|
|
185
|
+
const RenderInlineInternal = ({ text, defaultColor = 'white', bold: baseBold = false, }) => {
|
|
186
|
+
const segments = parseInlineMarkdown(text);
|
|
187
|
+
return (_jsx(_Fragment, { children: segments.map((segment, i) => {
|
|
188
|
+
switch (segment.type) {
|
|
189
|
+
case 'bold':
|
|
190
|
+
return (_jsx(Text, { bold: true, color: defaultColor, children: segment.content }, i));
|
|
191
|
+
case 'code':
|
|
192
|
+
return (_jsx(Text, { bold: baseBold, color: "cyan", children: segment.content }, i));
|
|
193
|
+
case 'italic':
|
|
194
|
+
return (_jsx(Text, { bold: baseBold, color: "gray", children: segment.content }, i));
|
|
195
|
+
case 'strikethrough':
|
|
196
|
+
return (_jsx(Text, { bold: baseBold, strikethrough: true, color: defaultColor, children: segment.content }, i));
|
|
197
|
+
case 'link':
|
|
198
|
+
return (_jsxs(Text, { bold: baseBold, color: defaultColor, children: [segment.content, _jsxs(Text, { color: "blue", children: [" (", segment.url, ")"] })] }, i));
|
|
199
|
+
case 'url':
|
|
200
|
+
return (_jsx(Text, { bold: baseBold, color: "blue", children: segment.content }, i));
|
|
201
|
+
default:
|
|
202
|
+
return (_jsx(Text, { bold: baseBold, color: defaultColor, children: segment.content }, i));
|
|
203
|
+
}
|
|
204
|
+
}) }));
|
|
205
|
+
};
|
|
206
|
+
const RenderInline = memo(RenderInlineInternal);
|
|
207
|
+
/**
|
|
208
|
+
* Main MarkdownText component.
|
|
209
|
+
* Handles block-level elements (headers, code blocks, lists) and delegates
|
|
210
|
+
* paragraph rendering to WrappedParagraph for proper word wrapping.
|
|
211
|
+
*/
|
|
212
|
+
const MarkdownTextInternal = ({ children, color = 'white', bulletPrefix, }) => {
|
|
213
|
+
if (!children)
|
|
214
|
+
return null;
|
|
215
|
+
const defaultColor = color;
|
|
216
|
+
const lines = children.split('\n');
|
|
217
|
+
let isFirstContentLine = true; // Track first actual content for bullet prefix
|
|
218
|
+
// Regex patterns for block elements
|
|
219
|
+
const headerRegex = /^(#{1,6})\s+(.*)$/;
|
|
220
|
+
const codeFenceRegex = /^(`{3,}|~{3,})(\w*)$/;
|
|
221
|
+
const ulItemRegex = /^(\s*)([-*+])\s+(.*)$/;
|
|
222
|
+
const olItemRegex = /^(\s*)(\d+)\.\s+(.*)$/;
|
|
223
|
+
// CommonMark allows spaces between HR characters (e.g., "- - -" or "* * *")
|
|
224
|
+
const hrRegex = /^(\s*[-*_]\s*){3,}$/;
|
|
225
|
+
const blocks = [];
|
|
226
|
+
let inCodeBlock = false;
|
|
227
|
+
let codeBlockLines = [];
|
|
228
|
+
let codeBlockLang = '';
|
|
229
|
+
let codeBlockFence = '';
|
|
230
|
+
lines.forEach((line, index) => {
|
|
231
|
+
const key = `line-${index}`;
|
|
232
|
+
const trimmedLine = line.trim();
|
|
233
|
+
// Handle code block state
|
|
234
|
+
if (inCodeBlock) {
|
|
235
|
+
const fenceMatch = trimmedLine.match(codeFenceRegex);
|
|
236
|
+
// Per CommonMark spec, closing fence must use same character and be at least as long
|
|
237
|
+
if (fenceMatch &&
|
|
238
|
+
fenceMatch[1] &&
|
|
239
|
+
codeBlockFence[0] &&
|
|
240
|
+
fenceMatch[1][0] === codeBlockFence[0] &&
|
|
241
|
+
fenceMatch[1].length >= codeBlockFence.length) {
|
|
242
|
+
// End of code block
|
|
243
|
+
blocks.push(_jsx(RenderCodeBlock, { lines: codeBlockLines, language: codeBlockLang }, key));
|
|
244
|
+
inCodeBlock = false;
|
|
245
|
+
codeBlockLines = [];
|
|
246
|
+
codeBlockLang = '';
|
|
247
|
+
codeBlockFence = '';
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
codeBlockLines.push(line);
|
|
251
|
+
}
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
// Check for code fence start
|
|
255
|
+
const codeFenceMatch = trimmedLine.match(codeFenceRegex);
|
|
256
|
+
if (codeFenceMatch && codeFenceMatch[1]) {
|
|
257
|
+
inCodeBlock = true;
|
|
258
|
+
codeBlockFence = codeFenceMatch[1];
|
|
259
|
+
codeBlockLang = codeFenceMatch[2] || '';
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
// Headers
|
|
263
|
+
const headerMatch = line.match(headerRegex);
|
|
264
|
+
if (headerMatch && headerMatch[1] && headerMatch[2] !== undefined) {
|
|
265
|
+
const level = headerMatch[1].length;
|
|
266
|
+
const headerText = headerMatch[2];
|
|
267
|
+
blocks.push(_jsx(RenderHeader, { level: level, text: headerText }, key));
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
// Horizontal rule
|
|
271
|
+
if (hrRegex.test(trimmedLine)) {
|
|
272
|
+
blocks.push(_jsx(Box, { children: _jsx(Text, { color: "gray", children: '─'.repeat(40) }) }, key));
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
// Unordered list
|
|
276
|
+
const ulMatch = line.match(ulItemRegex);
|
|
277
|
+
if (ulMatch && ulMatch[1] !== undefined && ulMatch[3] !== undefined) {
|
|
278
|
+
const indent = ulMatch[1].length;
|
|
279
|
+
const itemText = ulMatch[3];
|
|
280
|
+
blocks.push(_jsx(RenderListItem, { indent: indent, marker: "-", text: itemText, defaultColor: defaultColor }, key));
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
// Ordered list
|
|
284
|
+
const olMatch = line.match(olItemRegex);
|
|
285
|
+
if (olMatch && olMatch[1] !== undefined && olMatch[2] && olMatch[3] !== undefined) {
|
|
286
|
+
const indent = olMatch[1].length;
|
|
287
|
+
const number = olMatch[2];
|
|
288
|
+
const itemText = olMatch[3];
|
|
289
|
+
blocks.push(_jsx(RenderListItem, { indent: indent, marker: `${number}.`, text: itemText, defaultColor: defaultColor }, key));
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
// Empty line - add spacing
|
|
293
|
+
if (trimmedLine.length === 0) {
|
|
294
|
+
blocks.push(_jsx(Box, { height: 1 }, key));
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
// Regular paragraph line - use WrappedParagraph for proper word wrapping
|
|
298
|
+
const usePrefix = isFirstContentLine && bulletPrefix;
|
|
299
|
+
blocks.push(_jsx(WrappedParagraph, { text: line, defaultColor: defaultColor, ...(bulletPrefix && { bulletPrefix }), isFirstParagraph: usePrefix ? true : false }, key));
|
|
300
|
+
if (usePrefix) {
|
|
301
|
+
isFirstContentLine = false;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
// Handle unclosed code block (streaming case)
|
|
305
|
+
if (inCodeBlock && codeBlockLines.length > 0) {
|
|
306
|
+
blocks.push(_jsx(RenderCodeBlock, { lines: codeBlockLines, language: codeBlockLang, isPending: true }, "code-pending"));
|
|
307
|
+
}
|
|
308
|
+
// Wrap in column layout
|
|
309
|
+
return _jsx(Box, { flexDirection: "column", children: blocks });
|
|
310
|
+
};
|
|
311
|
+
const RenderHeaderInternal = ({ level, text }) => {
|
|
312
|
+
// Color based on header level
|
|
313
|
+
const headerColors = {
|
|
314
|
+
1: 'blue',
|
|
315
|
+
2: 'cyan',
|
|
316
|
+
3: 'white',
|
|
317
|
+
4: 'gray',
|
|
318
|
+
5: 'gray',
|
|
319
|
+
6: 'gray',
|
|
320
|
+
};
|
|
321
|
+
const headerColor = headerColors[level] || 'white';
|
|
322
|
+
return (_jsx(Box, { marginTop: level <= 2 ? 1 : 0, children: _jsx(RenderInline, { text: text, defaultColor: headerColor, bold: true }) }));
|
|
323
|
+
};
|
|
324
|
+
const RenderHeader = memo(RenderHeaderInternal);
|
|
325
|
+
/**
|
|
326
|
+
* List item with proper word wrapping using wrap-ansi.
|
|
327
|
+
* Continuation lines are indented to align with the first line content.
|
|
328
|
+
*/
|
|
329
|
+
const RenderListItemInternal = ({ indent, marker, text, defaultColor, }) => {
|
|
330
|
+
const { stdout } = useStdout();
|
|
331
|
+
const terminalWidth = stdout?.columns ?? 80;
|
|
332
|
+
const paddingLeft = Math.floor(indent / 2);
|
|
333
|
+
const markerWithSpace = `${marker} `;
|
|
334
|
+
const markerWidth = stringWidth(markerWithSpace);
|
|
335
|
+
const wrappedLines = useMemo(() => {
|
|
336
|
+
// Parse markdown and convert to ANSI string
|
|
337
|
+
const segments = parseInlineMarkdown(text);
|
|
338
|
+
const ansiString = segmentsToAnsi(segments, defaultColor);
|
|
339
|
+
// Available width = terminal - padding - marker
|
|
340
|
+
const availableWidth = Math.max(20, terminalWidth - paddingLeft - markerWidth);
|
|
341
|
+
// Word-wrap the ANSI string
|
|
342
|
+
const wrapped = wrapAnsi(ansiString, availableWidth, {
|
|
343
|
+
hard: false,
|
|
344
|
+
wordWrap: true,
|
|
345
|
+
trim: false,
|
|
346
|
+
});
|
|
347
|
+
return wrapped.split('\n');
|
|
348
|
+
}, [text, defaultColor, terminalWidth, paddingLeft, markerWidth]);
|
|
349
|
+
const continuationIndent = ' '.repeat(markerWidth);
|
|
350
|
+
return (_jsx(Box, { paddingLeft: paddingLeft, flexDirection: "column", children: wrappedLines.map((line, i) => (_jsxs(Box, { flexDirection: "row", children: [_jsx(Text, { color: defaultColor, children: i === 0 ? markerWithSpace : continuationIndent }), _jsx(Text, { children: line })] }, i))) }));
|
|
351
|
+
};
|
|
352
|
+
const RenderListItem = memo(RenderListItemInternal);
|
|
353
|
+
const RenderCodeBlockInternal = ({ lines, language, isPending, }) => {
|
|
354
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: [language && _jsx(Text, { color: "gray", children: language }), _jsxs(Box, { flexDirection: "column", paddingLeft: 1, children: [lines.map((line, i) => (_jsx(Text, { color: "cyan", children: line }, i))), isPending && _jsx(Text, { color: "gray", children: "..." })] })] }));
|
|
355
|
+
};
|
|
356
|
+
const RenderCodeBlock = memo(RenderCodeBlockInternal);
|
|
357
|
+
// ============================================================================
|
|
358
|
+
// Exports
|
|
359
|
+
// ============================================================================
|
|
360
|
+
export const MarkdownText = memo(MarkdownTextInternal);
|
|
361
|
+
// Also export inline renderer for use in other components
|
|
362
|
+
export { RenderInline, parseInlineMarkdown };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VirtualizedList Component
|
|
3
|
+
* Only renders items visible in the viewport for performance.
|
|
4
|
+
*/
|
|
5
|
+
import type React from 'react';
|
|
6
|
+
export declare const SCROLL_TO_ITEM_END: number;
|
|
7
|
+
type VirtualizedListProps<T> = {
|
|
8
|
+
data: T[];
|
|
9
|
+
renderItem: (info: {
|
|
10
|
+
item: T;
|
|
11
|
+
index: number;
|
|
12
|
+
}) => React.ReactElement;
|
|
13
|
+
estimatedItemHeight: (index: number) => number;
|
|
14
|
+
keyExtractor: (item: T, index: number) => string;
|
|
15
|
+
initialScrollIndex?: number;
|
|
16
|
+
initialScrollOffsetInIndex?: number;
|
|
17
|
+
scrollbarThumbColor?: string;
|
|
18
|
+
};
|
|
19
|
+
export type VirtualizedListRef<T> = {
|
|
20
|
+
scrollBy: (delta: number) => void;
|
|
21
|
+
scrollTo: (offset: number) => void;
|
|
22
|
+
scrollToEnd: () => void;
|
|
23
|
+
scrollToIndex: (params: {
|
|
24
|
+
index: number;
|
|
25
|
+
viewOffset?: number;
|
|
26
|
+
viewPosition?: number;
|
|
27
|
+
}) => void;
|
|
28
|
+
scrollToItem: (params: {
|
|
29
|
+
item: T;
|
|
30
|
+
viewOffset?: number;
|
|
31
|
+
viewPosition?: number;
|
|
32
|
+
}) => void;
|
|
33
|
+
getScrollIndex: () => number;
|
|
34
|
+
getScrollState: () => {
|
|
35
|
+
scrollTop: number;
|
|
36
|
+
scrollHeight: number;
|
|
37
|
+
innerHeight: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export declare const VirtualizedList: <T>(props: VirtualizedListProps<T> & {
|
|
41
|
+
ref?: React.Ref<VirtualizedListRef<T>>;
|
|
42
|
+
}) => React.ReactElement;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=VirtualizedList.d.ts.map
|