dexto 1.3.0 → 1.4.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 +25 -15
- package/dist/agents/agent-registry.json +9 -0
- package/dist/agents/coding-agent/coding-agent.yml +5 -0
- package/dist/agents/default-agent.yml +2 -2
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +39 -5
- package/dist/cli/cli-subscriber.d.ts.map +1 -1
- package/dist/cli/cli-subscriber.js +7 -1
- package/dist/cli/commands/helpers/formatters.d.ts.map +1 -1
- package/dist/cli/commands/helpers/formatters.js +2 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +14 -40
- 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 +0 -15
- 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 +69 -52
- 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 +103 -74
- 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 +36 -32
- 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 +17 -3
- 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 +24 -3
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +160 -45
- 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/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/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 +46 -8
- 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/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/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 +7 -2
- 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 +4 -2
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +19 -5
- 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 +21 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +177 -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 +247 -24
- 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/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 +360 -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 +491 -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 +1156 -130
- 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 +86 -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 +188 -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 +674 -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 +222 -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 +54 -3
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +290 -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 +13 -0
- package/dist/cli/utils/options.d.ts.map +1 -1
- package/dist/cli/utils/options.js +0 -2
- package/dist/config/cli-overrides.d.ts +1 -1
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +5 -10
- package/dist/index.js +66 -48
- 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-BkwPkZpd.css +1 -0
- package/dist/webui/assets/index-D9u1XfyH.js +2025 -0
- package/dist/webui/assets/{tanstack-DgxBONJY.js → tanstack-Br79RQ-n.js} +1 -1
- package/dist/webui/index.html +3 -3
- package/package.json +16 -14
- 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,400 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ToolBrowser Component
|
|
4
|
+
* Interactive browser for exploring available tools
|
|
5
|
+
* Features:
|
|
6
|
+
* - Search/filter tools by name
|
|
7
|
+
* - View tool details (description, schema)
|
|
8
|
+
* - Shows source (MCP server or Internal)
|
|
9
|
+
*/
|
|
10
|
+
import { useState, useEffect, forwardRef, useRef, useImperativeHandle, useMemo, } from 'react';
|
|
11
|
+
import { Box, Text } from 'ink';
|
|
12
|
+
import { useTerminalSize } from '../../hooks/useTerminalSize.js';
|
|
13
|
+
import { writeToClipboard } from '../../utils/clipboardUtils.js';
|
|
14
|
+
const MAX_VISIBLE_ITEMS = 12;
|
|
15
|
+
const MAX_DETAIL_LINES = 15;
|
|
16
|
+
/**
|
|
17
|
+
* Tool browser with search and detail views
|
|
18
|
+
*/
|
|
19
|
+
const ToolBrowser = forwardRef(function ToolBrowser({ isVisible, onClose, agent }, ref) {
|
|
20
|
+
const { columns, rows } = useTerminalSize();
|
|
21
|
+
const [tools, setTools] = useState([]);
|
|
22
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
23
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
24
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
25
|
+
const [scrollOffset, setScrollOffset] = useState(0);
|
|
26
|
+
const [viewMode, setViewMode] = useState('list');
|
|
27
|
+
const [selectedTool, setSelectedTool] = useState(null);
|
|
28
|
+
const [detailScrollOffset, setDetailScrollOffset] = useState(0);
|
|
29
|
+
const [copyFeedback, setCopyFeedback] = useState(null);
|
|
30
|
+
const selectedIndexRef = useRef(selectedIndex);
|
|
31
|
+
const viewModeRef = useRef(viewMode);
|
|
32
|
+
const detailScrollOffsetRef = useRef(detailScrollOffset);
|
|
33
|
+
const detailMaxScrollOffsetRef = useRef(0);
|
|
34
|
+
const selectedToolRef = useRef(null);
|
|
35
|
+
// Keep refs in sync
|
|
36
|
+
selectedIndexRef.current = selectedIndex;
|
|
37
|
+
viewModeRef.current = viewMode;
|
|
38
|
+
detailScrollOffsetRef.current = detailScrollOffset;
|
|
39
|
+
selectedToolRef.current = selectedTool;
|
|
40
|
+
// Fetch tools from agent
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (!isVisible)
|
|
43
|
+
return;
|
|
44
|
+
let cancelled = false;
|
|
45
|
+
setIsLoading(true);
|
|
46
|
+
setSearchQuery('');
|
|
47
|
+
setSelectedIndex(0);
|
|
48
|
+
setScrollOffset(0);
|
|
49
|
+
setViewMode('list');
|
|
50
|
+
setSelectedTool(null);
|
|
51
|
+
const fetchTools = async () => {
|
|
52
|
+
try {
|
|
53
|
+
const [allTools, mcpTools] = await Promise.all([
|
|
54
|
+
agent.getAllTools(),
|
|
55
|
+
agent.getAllMcpTools(),
|
|
56
|
+
]);
|
|
57
|
+
const toolList = [];
|
|
58
|
+
const mcpToolNames = new Set(Object.keys(mcpTools));
|
|
59
|
+
for (const [toolName, toolInfo] of Object.entries(allTools)) {
|
|
60
|
+
const isMcpTool = mcpToolNames.has(toolName) || toolName.startsWith('mcp--');
|
|
61
|
+
// Extract server name from MCP tool name (format: mcp--serverName--toolName)
|
|
62
|
+
let serverName;
|
|
63
|
+
if (toolName.startsWith('mcp--')) {
|
|
64
|
+
const parts = toolName.split('--');
|
|
65
|
+
if (parts.length >= 2) {
|
|
66
|
+
serverName = parts[1];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
toolList.push({
|
|
70
|
+
name: toolName,
|
|
71
|
+
description: toolInfo.description || 'No description available',
|
|
72
|
+
source: isMcpTool ? 'mcp' : 'internal',
|
|
73
|
+
serverName,
|
|
74
|
+
inputSchema: toolInfo.parameters,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// Sort: internal tools first, then MCP tools
|
|
78
|
+
toolList.sort((a, b) => {
|
|
79
|
+
if (a.source !== b.source) {
|
|
80
|
+
return a.source === 'internal' ? -1 : 1;
|
|
81
|
+
}
|
|
82
|
+
return a.name.localeCompare(b.name);
|
|
83
|
+
});
|
|
84
|
+
if (!cancelled) {
|
|
85
|
+
setTools(toolList);
|
|
86
|
+
setIsLoading(false);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
if (!cancelled) {
|
|
91
|
+
setTools([]);
|
|
92
|
+
setIsLoading(false);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
void fetchTools();
|
|
97
|
+
return () => {
|
|
98
|
+
cancelled = true;
|
|
99
|
+
};
|
|
100
|
+
}, [isVisible, agent]);
|
|
101
|
+
// Filter tools based on search query
|
|
102
|
+
const filteredTools = useMemo(() => {
|
|
103
|
+
if (!searchQuery.trim()) {
|
|
104
|
+
return tools;
|
|
105
|
+
}
|
|
106
|
+
const query = searchQuery.toLowerCase();
|
|
107
|
+
return tools.filter((tool) => {
|
|
108
|
+
const name = tool.name.toLowerCase();
|
|
109
|
+
const desc = tool.description.toLowerCase();
|
|
110
|
+
const server = (tool.serverName || '').toLowerCase();
|
|
111
|
+
return name.includes(query) || desc.includes(query) || server.includes(query);
|
|
112
|
+
});
|
|
113
|
+
}, [tools, searchQuery]);
|
|
114
|
+
// Adjust selected index when filter changes
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (selectedIndex >= filteredTools.length) {
|
|
117
|
+
setSelectedIndex(Math.max(0, filteredTools.length - 1));
|
|
118
|
+
}
|
|
119
|
+
}, [filteredTools.length, selectedIndex]);
|
|
120
|
+
// Calculate scroll offset
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (selectedIndex < scrollOffset) {
|
|
123
|
+
setScrollOffset(selectedIndex);
|
|
124
|
+
}
|
|
125
|
+
else if (selectedIndex >= scrollOffset + MAX_VISIBLE_ITEMS) {
|
|
126
|
+
setScrollOffset(selectedIndex - MAX_VISIBLE_ITEMS + 1);
|
|
127
|
+
}
|
|
128
|
+
}, [selectedIndex, scrollOffset]);
|
|
129
|
+
// Handle showing tool details
|
|
130
|
+
const showToolDetails = (tool) => {
|
|
131
|
+
setSelectedTool(tool);
|
|
132
|
+
setViewMode('detail');
|
|
133
|
+
setDetailScrollOffset(0);
|
|
134
|
+
};
|
|
135
|
+
// Handle going back to list
|
|
136
|
+
const goBackToList = () => {
|
|
137
|
+
setViewMode('list');
|
|
138
|
+
setSelectedTool(null);
|
|
139
|
+
};
|
|
140
|
+
// Expose handleInput method via ref
|
|
141
|
+
useImperativeHandle(ref, () => ({
|
|
142
|
+
handleInput: (input, key) => {
|
|
143
|
+
if (!isVisible)
|
|
144
|
+
return false;
|
|
145
|
+
// In detail view (use ref to get latest value)
|
|
146
|
+
if (viewModeRef.current === 'detail') {
|
|
147
|
+
if (key.escape || key.backspace || key.delete) {
|
|
148
|
+
goBackToList();
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
// Handle scrolling in detail view - check refs before setState to avoid flicker
|
|
152
|
+
if (key.upArrow) {
|
|
153
|
+
if (detailScrollOffsetRef.current > 0) {
|
|
154
|
+
setDetailScrollOffset((prev) => prev - 1);
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
if (key.downArrow) {
|
|
159
|
+
if (detailScrollOffsetRef.current < detailMaxScrollOffsetRef.current) {
|
|
160
|
+
setDetailScrollOffset((prev) => prev + 1);
|
|
161
|
+
}
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
// Copy schema to clipboard
|
|
165
|
+
if (input === 'c' || input === 'C') {
|
|
166
|
+
const tool = selectedToolRef.current;
|
|
167
|
+
if (tool) {
|
|
168
|
+
const schema = {
|
|
169
|
+
type: 'function',
|
|
170
|
+
name: tool.name,
|
|
171
|
+
description: tool.description,
|
|
172
|
+
parameters: tool.inputSchema || {},
|
|
173
|
+
};
|
|
174
|
+
void writeToClipboard(JSON.stringify(schema, null, 2)).then((success) => {
|
|
175
|
+
setCopyFeedback(success ? 'Copied!' : 'Copy failed');
|
|
176
|
+
setTimeout(() => setCopyFeedback(null), 1500);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
return true; // Consume all input in detail view
|
|
182
|
+
}
|
|
183
|
+
// In list view
|
|
184
|
+
// Escape closes
|
|
185
|
+
if (key.escape) {
|
|
186
|
+
onClose();
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
// Handle character input for search
|
|
190
|
+
if (input && !key.return && !key.upArrow && !key.downArrow && !key.tab) {
|
|
191
|
+
// Backspace
|
|
192
|
+
if (key.backspace || key.delete) {
|
|
193
|
+
setSearchQuery((prev) => prev.slice(0, -1));
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
// Regular character - add to search
|
|
197
|
+
if (input.length === 1 && input.charCodeAt(0) >= 32) {
|
|
198
|
+
setSearchQuery((prev) => prev + input);
|
|
199
|
+
setSelectedIndex(0);
|
|
200
|
+
setScrollOffset(0);
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// Backspace when no other input
|
|
205
|
+
if (key.backspace || key.delete) {
|
|
206
|
+
setSearchQuery((prev) => prev.slice(0, -1));
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
const itemsLength = filteredTools.length;
|
|
210
|
+
if (itemsLength === 0)
|
|
211
|
+
return false;
|
|
212
|
+
if (key.upArrow) {
|
|
213
|
+
const nextIndex = (selectedIndexRef.current - 1 + itemsLength) % itemsLength;
|
|
214
|
+
setSelectedIndex(nextIndex);
|
|
215
|
+
selectedIndexRef.current = nextIndex;
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
if (key.downArrow) {
|
|
219
|
+
const nextIndex = (selectedIndexRef.current + 1) % itemsLength;
|
|
220
|
+
setSelectedIndex(nextIndex);
|
|
221
|
+
selectedIndexRef.current = nextIndex;
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
if (key.return && itemsLength > 0) {
|
|
225
|
+
const tool = filteredTools[selectedIndexRef.current];
|
|
226
|
+
if (tool) {
|
|
227
|
+
showToolDetails(tool);
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return false;
|
|
232
|
+
},
|
|
233
|
+
}), [isVisible, filteredTools, onClose, viewMode]);
|
|
234
|
+
if (!isVisible)
|
|
235
|
+
return null;
|
|
236
|
+
if (isLoading) {
|
|
237
|
+
return (_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { dimColor: true, children: "Loading tools..." }) }));
|
|
238
|
+
}
|
|
239
|
+
// Detail view
|
|
240
|
+
if (viewMode === 'detail' && selectedTool) {
|
|
241
|
+
// Calculate max visible lines based on terminal height
|
|
242
|
+
const maxVisibleLines = Math.min(18, Math.max(5, rows - 6)); // Cap at 18 to reduce flicker
|
|
243
|
+
return (_jsx(ToolDetailView, { tool: selectedTool, columns: columns, scrollOffset: detailScrollOffset, maxVisibleLines: maxVisibleLines, maxScrollOffsetRef: detailMaxScrollOffsetRef, copyFeedback: copyFeedback }));
|
|
244
|
+
}
|
|
245
|
+
// List view
|
|
246
|
+
const visibleTools = filteredTools.slice(scrollOffset, scrollOffset + MAX_VISIBLE_ITEMS);
|
|
247
|
+
// Show counts based on filtered results, not total
|
|
248
|
+
const filteredInternalCount = filteredTools.filter((t) => t.source === 'internal').length;
|
|
249
|
+
const filteredMcpCount = filteredTools.filter((t) => t.source === 'mcp').length;
|
|
250
|
+
return (_jsxs(Box, { flexDirection: "column", width: columns, children: [_jsxs(Box, { paddingX: 0, paddingY: 0, children: [_jsx(Text, { color: "cyan", bold: true, children: "Tool Browser" }), _jsxs(Text, { dimColor: true, children: [' ', "(", filteredTools.length, " tools: ", filteredInternalCount, " internal,", ' ', filteredMcpCount, " MCP)"] })] }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { dimColor: true, children: "\u2191\u2193 navigate, Enter view details, Esc close" }) }), _jsxs(Box, { paddingX: 0, paddingY: 0, marginTop: 1, children: [_jsx(Text, { color: "gray", children: "Search: " }), _jsx(Text, { color: searchQuery ? 'white' : 'gray', children: searchQuery || 'Type to filter...' }), _jsx(Text, { color: "cyan", children: "\u258C" })] }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { dimColor: true, children: '─'.repeat(Math.min(60, columns - 2)) }) }), filteredTools.length === 0 ? (_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { dimColor: true, children: "No tools match your search" }) })) : (visibleTools.map((tool, visibleIndex) => {
|
|
251
|
+
const actualIndex = scrollOffset + visibleIndex;
|
|
252
|
+
const isSelected = actualIndex === selectedIndex;
|
|
253
|
+
return (_jsxs(Box, { paddingX: 0, paddingY: 0, children: [_jsx(Text, { color: isSelected ? 'cyan' : 'white', children: isSelected ? '▶ ' : ' ' }), _jsx(Text, { color: isSelected ? 'cyan' : 'white', bold: isSelected, children: truncateText(tool.name, 35) }), _jsxs(Text, { color: tool.source === 'internal' ? 'magenta' : 'blue', children: [' ', "[", tool.source === 'internal' ? 'Internal' : 'MCP', "]"] }), tool.serverName && _jsxs(Text, { dimColor: true, children: [" (", tool.serverName, ")"] })] }, tool.name));
|
|
254
|
+
})), filteredTools.length > MAX_VISIBLE_ITEMS && (_jsx(Box, { paddingX: 0, paddingY: 0, marginTop: 1, children: _jsxs(Text, { dimColor: true, children: [scrollOffset > 0 ? '↑ more above' : '', scrollOffset > 0 && scrollOffset + MAX_VISIBLE_ITEMS < filteredTools.length
|
|
255
|
+
? ' | '
|
|
256
|
+
: '', scrollOffset + MAX_VISIBLE_ITEMS < filteredTools.length
|
|
257
|
+
? '↓ more below'
|
|
258
|
+
: ''] }) }))] }));
|
|
259
|
+
});
|
|
260
|
+
/**
|
|
261
|
+
* Build detail line data for a tool (plain data, not React elements)
|
|
262
|
+
*/
|
|
263
|
+
function buildDetailLineData(tool, maxWidth) {
|
|
264
|
+
const lines = [];
|
|
265
|
+
// Tool name
|
|
266
|
+
lines.push({ type: 'title', text: tool.name });
|
|
267
|
+
// Source
|
|
268
|
+
lines.push({ type: 'source', source: tool.source, serverName: tool.serverName });
|
|
269
|
+
// Empty line before description
|
|
270
|
+
lines.push({ type: 'empty' });
|
|
271
|
+
// Description header
|
|
272
|
+
lines.push({ type: 'header', text: 'Description:' });
|
|
273
|
+
// Description content (wrapped)
|
|
274
|
+
const descriptionLines = wrapText(tool.description, maxWidth - 2).split('\n');
|
|
275
|
+
for (const descLine of descriptionLines) {
|
|
276
|
+
lines.push({ type: 'description', text: descLine });
|
|
277
|
+
}
|
|
278
|
+
// Parameters section
|
|
279
|
+
if (tool.inputSchema) {
|
|
280
|
+
const properties = tool.inputSchema.properties;
|
|
281
|
+
const required = tool.inputSchema.required || [];
|
|
282
|
+
if (properties && Object.keys(properties).length > 0) {
|
|
283
|
+
// Empty line before parameters
|
|
284
|
+
lines.push({ type: 'empty' });
|
|
285
|
+
// Parameters header
|
|
286
|
+
lines.push({ type: 'header', text: 'Parameters:' });
|
|
287
|
+
// Each parameter
|
|
288
|
+
for (const [propName, propSchema] of Object.entries(properties)) {
|
|
289
|
+
const paramType = propSchema.type || 'any';
|
|
290
|
+
const description = propSchema.description;
|
|
291
|
+
const isRequired = required.includes(propName);
|
|
292
|
+
const enumValues = propSchema.enum;
|
|
293
|
+
// Parameter name line
|
|
294
|
+
lines.push({
|
|
295
|
+
type: 'param-name',
|
|
296
|
+
name: propName,
|
|
297
|
+
paramType,
|
|
298
|
+
required: isRequired,
|
|
299
|
+
});
|
|
300
|
+
// Parameter description (wrapped)
|
|
301
|
+
if (description) {
|
|
302
|
+
const paramDescLines = wrapText(description, maxWidth - 6).split('\n');
|
|
303
|
+
for (const paramDescLine of paramDescLines) {
|
|
304
|
+
lines.push({ type: 'param-desc', text: paramDescLine });
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
// Enum values
|
|
308
|
+
if (enumValues) {
|
|
309
|
+
lines.push({ type: 'param-enum', values: enumValues });
|
|
310
|
+
}
|
|
311
|
+
// Empty line between parameters
|
|
312
|
+
lines.push({ type: 'empty' });
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
// Empty line before "no parameters"
|
|
317
|
+
lines.push({ type: 'empty' });
|
|
318
|
+
lines.push({ type: 'param-desc', text: 'No parameters' });
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return lines;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Render a single detail line from data
|
|
325
|
+
*/
|
|
326
|
+
function renderDetailLine(line, index) {
|
|
327
|
+
switch (line.type) {
|
|
328
|
+
case 'title':
|
|
329
|
+
return (_jsx(Text, { color: "yellow", bold: true, children: line.text }));
|
|
330
|
+
case 'source':
|
|
331
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: "Source: " }), _jsx(Text, { color: line.source === 'internal' ? 'magenta' : 'blue', children: line.source === 'internal' ? 'Internal' : 'MCP' }), line.serverName && _jsxs(Text, { dimColor: true, children: [" (server: ", line.serverName, ")"] })] }));
|
|
332
|
+
case 'empty':
|
|
333
|
+
return _jsx(Text, { children: " " });
|
|
334
|
+
case 'header':
|
|
335
|
+
return _jsx(Text, { dimColor: true, children: line.text });
|
|
336
|
+
case 'description':
|
|
337
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsx(Text, { children: line.text })] }));
|
|
338
|
+
case 'param-name':
|
|
339
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsx(Text, { color: "yellow", children: line.name }), _jsxs(Text, { dimColor: true, children: [" (", line.paramType, ")"] }), line.required && _jsx(Text, { color: "red", children: " *required" })] }));
|
|
340
|
+
case 'param-desc':
|
|
341
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsx(Text, { dimColor: true, children: line.text })] }));
|
|
342
|
+
case 'param-enum':
|
|
343
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsxs(Text, { dimColor: true, children: ["Allowed: ", line.values.join(' | ')] })] }));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Tool detail view component with scrolling support
|
|
348
|
+
*/
|
|
349
|
+
function ToolDetailView({ tool, columns, scrollOffset, maxVisibleLines, maxScrollOffsetRef, copyFeedback, }) {
|
|
350
|
+
const maxWidth = Math.min(80, columns - 4);
|
|
351
|
+
// Build plain data for lines (memoized)
|
|
352
|
+
const lineData = useMemo(() => buildDetailLineData(tool, maxWidth), [tool, maxWidth]);
|
|
353
|
+
// Calculate visible range and update max scroll offset ref
|
|
354
|
+
const totalLines = lineData.length;
|
|
355
|
+
const maxScrollOffset = Math.max(0, totalLines - maxVisibleLines);
|
|
356
|
+
maxScrollOffsetRef.current = maxScrollOffset;
|
|
357
|
+
const clampedOffset = Math.min(scrollOffset, maxScrollOffset);
|
|
358
|
+
// Calculate scroll indicators
|
|
359
|
+
const hasMoreAbove = clampedOffset > 0;
|
|
360
|
+
const hasMoreBelow = clampedOffset + maxVisibleLines < totalLines;
|
|
361
|
+
return (_jsxs(Box, { flexDirection: "column", width: columns, children: [_jsxs(Box, { paddingX: 0, paddingY: 0, children: [_jsx(Text, { color: "cyan", bold: true, children: "Tool Details" }), _jsx(Text, { dimColor: true, children: " - \u2191\u2193 scroll, c copy schema, Esc back" }), copyFeedback && (_jsxs(Text, { color: "green", bold: true, children: [' ', copyFeedback] }))] }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { dimColor: true, children: '─'.repeat(Math.min(60, columns - 2)) }) }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { dimColor: true, children: hasMoreAbove ? `↑ ${clampedOffset} more above` : ' ' }) }), Array.from({ length: maxVisibleLines }, (_, i) => {
|
|
362
|
+
const absoluteIndex = clampedOffset + i;
|
|
363
|
+
const line = lineData[absoluteIndex];
|
|
364
|
+
return (_jsx(Box, { paddingX: 0, paddingY: 0, children: line ? renderDetailLine(line, absoluteIndex) : _jsx(Text, { children: " " }) }, i));
|
|
365
|
+
}), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { dimColor: true, children: hasMoreBelow
|
|
366
|
+
? `↓ ${totalLines - clampedOffset - maxVisibleLines} more below`
|
|
367
|
+
: ' ' }) })] }));
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Truncate text to max length with ellipsis
|
|
371
|
+
*/
|
|
372
|
+
function truncateText(text, maxLength) {
|
|
373
|
+
if (text.length <= maxLength)
|
|
374
|
+
return text;
|
|
375
|
+
return text.slice(0, maxLength - 1) + '…';
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Wrap text to fit within max width
|
|
379
|
+
*/
|
|
380
|
+
function wrapText(text, maxWidth) {
|
|
381
|
+
if (text.length <= maxWidth)
|
|
382
|
+
return text;
|
|
383
|
+
const words = text.split(' ');
|
|
384
|
+
const lines = [];
|
|
385
|
+
let currentLine = '';
|
|
386
|
+
for (const word of words) {
|
|
387
|
+
if (currentLine.length + word.length + 1 <= maxWidth) {
|
|
388
|
+
currentLine += (currentLine ? ' ' : '') + word;
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
if (currentLine)
|
|
392
|
+
lines.push(currentLine);
|
|
393
|
+
currentLine = word;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (currentLine)
|
|
397
|
+
lines.push(currentLine);
|
|
398
|
+
return lines.join('\n');
|
|
399
|
+
}
|
|
400
|
+
export default ToolBrowser;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiffRenderer Component
|
|
3
|
+
*
|
|
4
|
+
* Renders unified diff output with colored lines and line numbers.
|
|
5
|
+
* Used for edit_file and write_file (overwrite) tool results in message list.
|
|
6
|
+
* Matches the approval preview UX style.
|
|
7
|
+
*/
|
|
8
|
+
import type { DiffDisplayData } from '@dexto/core';
|
|
9
|
+
interface DiffRendererProps {
|
|
10
|
+
/** Diff display data from tool result */
|
|
11
|
+
data: DiffDisplayData;
|
|
12
|
+
/** Maximum lines to display before truncating */
|
|
13
|
+
maxLines?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Renders unified diff with colored lines, line numbers, and word-level highlighting.
|
|
17
|
+
* Matches the approval preview UX style. No truncation by default.
|
|
18
|
+
*/
|
|
19
|
+
export declare function DiffRenderer({ data, maxLines }: DiffRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=DiffRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiffRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/renderers/DiffRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAWnD,UAAU,iBAAiB;IACvB,yCAAyC;IACzC,IAAI,EAAE,eAAe,CAAC;IACtB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,QAAmB,EAAE,EAAE,iBAAiB,2CAkH5E"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* DiffRenderer Component
|
|
4
|
+
*
|
|
5
|
+
* Renders unified diff output with colored lines and line numbers.
|
|
6
|
+
* Used for edit_file and write_file (overwrite) tool results in message list.
|
|
7
|
+
* Matches the approval preview UX style.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Box, Text } from 'ink';
|
|
11
|
+
import { makeRelativePath } from '../../utils/messageFormatting.js';
|
|
12
|
+
import { parseUnifiedDiff, findLinePairs, computeWordDiff, getLineNumWidth, DiffLine, HunkSeparator, } from './diff-shared.js';
|
|
13
|
+
/**
|
|
14
|
+
* Renders unified diff with colored lines, line numbers, and word-level highlighting.
|
|
15
|
+
* Matches the approval preview UX style. No truncation by default.
|
|
16
|
+
*/
|
|
17
|
+
export function DiffRenderer({ data, maxLines = Infinity }) {
|
|
18
|
+
const { unified, filename, additions, deletions } = data;
|
|
19
|
+
const hunks = parseUnifiedDiff(unified);
|
|
20
|
+
// Calculate max line number for width
|
|
21
|
+
let maxLineNum = 1;
|
|
22
|
+
for (const hunk of hunks) {
|
|
23
|
+
for (const line of hunk.lines) {
|
|
24
|
+
maxLineNum = Math.max(maxLineNum, line.lineNum);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const lineNumWidth = getLineNumWidth(maxLineNum);
|
|
28
|
+
// Find line pairs for word-level diff
|
|
29
|
+
const allLinePairs = hunks.map((hunk) => findLinePairs(hunk.lines));
|
|
30
|
+
// Count total display lines and apply truncation
|
|
31
|
+
let totalLines = 0;
|
|
32
|
+
for (const hunk of hunks) {
|
|
33
|
+
totalLines += hunk.lines.length;
|
|
34
|
+
}
|
|
35
|
+
const shouldTruncate = totalLines > maxLines;
|
|
36
|
+
let linesRendered = 0;
|
|
37
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: ' ⎿ ' }), _jsx(Text, { children: makeRelativePath(filename) }), _jsxs(Text, { color: "green", children: [" +", additions] }), _jsxs(Text, { color: "red", children: [" -", deletions] })] }), _jsxs(Box, { flexDirection: "column", paddingLeft: 2, children: [hunks.map((hunk, hunkIndex) => {
|
|
38
|
+
if (shouldTruncate && linesRendered >= maxLines) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const linePairs = allLinePairs[hunkIndex];
|
|
42
|
+
const processedIndices = new Set();
|
|
43
|
+
return (_jsxs(React.Fragment, { children: [hunkIndex > 0 && _jsx(HunkSeparator, {}), hunk.lines.map((line, lineIndex) => {
|
|
44
|
+
if (shouldTruncate && linesRendered >= maxLines) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
if (processedIndices.has(lineIndex)) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const pair = linePairs.get(lineIndex);
|
|
51
|
+
if (pair) {
|
|
52
|
+
processedIndices.add(lineIndex + 1);
|
|
53
|
+
if (shouldTruncate && linesRendered + 2 > maxLines) {
|
|
54
|
+
linesRendered = maxLines;
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
linesRendered += 2;
|
|
58
|
+
const { oldParts, newParts } = computeWordDiff(pair.del.content, pair.add.content);
|
|
59
|
+
return (_jsxs(React.Fragment, { children: [_jsx(DiffLine, { type: "deletion", lineNum: pair.del.lineNum, lineNumWidth: lineNumWidth, content: pair.del.content, wordDiffParts: oldParts }), _jsx(DiffLine, { type: "addition", lineNum: pair.add.lineNum, lineNumWidth: lineNumWidth, content: pair.add.content, wordDiffParts: newParts })] }, lineIndex));
|
|
60
|
+
}
|
|
61
|
+
linesRendered++;
|
|
62
|
+
return (_jsx(DiffLine, { type: line.type, lineNum: line.lineNum, lineNumWidth: lineNumWidth, content: line.content }, lineIndex));
|
|
63
|
+
})] }, hunkIndex));
|
|
64
|
+
}), shouldTruncate && _jsxs(Text, { dimColor: true, children: ["... +", totalLines - maxLines, " lines"] })] })] }));
|
|
65
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Preview Renderers
|
|
3
|
+
*
|
|
4
|
+
* Preview renderers for edit_file and write_file approval prompts.
|
|
5
|
+
* - DiffPreview: for edit_file and write_file (overwrite)
|
|
6
|
+
* - CreateFilePreview: for write_file (new file)
|
|
7
|
+
*/
|
|
8
|
+
import type { DiffDisplayData, FileDisplayData } from '@dexto/core';
|
|
9
|
+
interface DiffPreviewProps {
|
|
10
|
+
data: DiffDisplayData;
|
|
11
|
+
/** Header text: "Edit file" or "Overwrite file" */
|
|
12
|
+
headerType: 'edit' | 'overwrite';
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Enhanced diff preview for edit_file and write_file (overwrite) approval
|
|
16
|
+
* Shows full diff with line backgrounds, hunk collapsing, and word-level highlighting
|
|
17
|
+
*/
|
|
18
|
+
export declare function DiffPreview({ data, headerType }: DiffPreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
interface CreateFilePreviewProps {
|
|
20
|
+
data: FileDisplayData;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Preview for write_file (new file creation)
|
|
24
|
+
* Shows full file content with line numbers, white text
|
|
25
|
+
*/
|
|
26
|
+
export declare function CreateFilePreview({ data }: CreateFilePreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=FilePreviewRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilePreviewRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/renderers/FilePreviewRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAgBpE,UAAU,gBAAgB;IACtB,IAAI,EAAE,eAAe,CAAC;IACtB,mDAAmD;IACnD,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,gBAAgB,2CAiGjE;AAMD,UAAU,sBAAsB;IAC5B,IAAI,EAAE,eAAe,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE,sBAAsB,2CAoDjE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* File Preview Renderers
|
|
4
|
+
*
|
|
5
|
+
* Preview renderers for edit_file and write_file approval prompts.
|
|
6
|
+
* - DiffPreview: for edit_file and write_file (overwrite)
|
|
7
|
+
* - CreateFilePreview: for write_file (new file)
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Box, Text } from 'ink';
|
|
11
|
+
import { makeRelativePath } from '../../utils/messageFormatting.js';
|
|
12
|
+
import { parseUnifiedDiff, findLinePairs, computeWordDiff, getLineNumWidth, formatLineNum, DiffLine, HunkSeparator, } from './diff-shared.js';
|
|
13
|
+
/**
|
|
14
|
+
* Enhanced diff preview for edit_file and write_file (overwrite) approval
|
|
15
|
+
* Shows full diff with line backgrounds, hunk collapsing, and word-level highlighting
|
|
16
|
+
*/
|
|
17
|
+
export function DiffPreview({ data, headerType }) {
|
|
18
|
+
const { unified, filename } = data;
|
|
19
|
+
const hunks = parseUnifiedDiff(unified);
|
|
20
|
+
// Calculate max line number for width
|
|
21
|
+
let maxLineNum = 1;
|
|
22
|
+
for (const hunk of hunks) {
|
|
23
|
+
for (const line of hunk.lines) {
|
|
24
|
+
maxLineNum = Math.max(maxLineNum, line.lineNum);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const lineNumWidth = getLineNumWidth(maxLineNum);
|
|
28
|
+
// Find line pairs for word-level diff
|
|
29
|
+
const allLinePairs = hunks.map((hunk) => findLinePairs(hunk.lines));
|
|
30
|
+
const headerText = headerType === 'edit' ? 'Edit file' : 'Overwrite file';
|
|
31
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Box, { marginBottom: 0, children: _jsx(Text, { color: "cyan", bold: true, children: headerText }) }), _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 1, children: [_jsx(Box, { marginBottom: 0, children: _jsx(Text, { children: makeRelativePath(filename) }) }), hunks.map((hunk, hunkIndex) => {
|
|
32
|
+
const linePairs = allLinePairs[hunkIndex];
|
|
33
|
+
const processedIndices = new Set();
|
|
34
|
+
return (_jsxs(React.Fragment, { children: [hunkIndex > 0 && _jsx(HunkSeparator, {}), hunk.lines.map((line, lineIndex) => {
|
|
35
|
+
// Skip if already processed as part of a pair
|
|
36
|
+
if (processedIndices.has(lineIndex)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
// Check if this is part of a deletion/addition pair
|
|
40
|
+
const pair = linePairs.get(lineIndex);
|
|
41
|
+
if (pair) {
|
|
42
|
+
// Mark the addition line as processed
|
|
43
|
+
processedIndices.add(lineIndex + 1);
|
|
44
|
+
// Compute word-level diff
|
|
45
|
+
const { oldParts, newParts } = computeWordDiff(pair.del.content, pair.add.content);
|
|
46
|
+
return (_jsxs(React.Fragment, { children: [_jsx(DiffLine, { type: "deletion", lineNum: pair.del.lineNum, lineNumWidth: lineNumWidth, content: pair.del.content, wordDiffParts: oldParts }), _jsx(DiffLine, { type: "addition", lineNum: pair.add.lineNum, lineNumWidth: lineNumWidth, content: pair.add.content, wordDiffParts: newParts })] }, lineIndex));
|
|
47
|
+
}
|
|
48
|
+
// Regular line (no word-level diff)
|
|
49
|
+
return (_jsx(DiffLine, { type: line.type, lineNum: line.lineNum, lineNumWidth: lineNumWidth, content: line.content }, lineIndex));
|
|
50
|
+
})] }, hunkIndex));
|
|
51
|
+
})] })] }));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Preview for write_file (new file creation)
|
|
55
|
+
* Shows full file content with line numbers, white text
|
|
56
|
+
*/
|
|
57
|
+
export function CreateFilePreview({ data }) {
|
|
58
|
+
const { path, content, lineCount } = data;
|
|
59
|
+
if (!content) {
|
|
60
|
+
// Fallback if content not provided
|
|
61
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Box, { marginBottom: 0, children: _jsx(Text, { color: "cyan", bold: true, children: "Create file" }) }), _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 1, children: [_jsx(Text, { children: makeRelativePath(path) }), lineCount && _jsxs(Text, { dimColor: true, children: [lineCount, " lines"] })] })] }));
|
|
62
|
+
}
|
|
63
|
+
const lines = content.split('\n');
|
|
64
|
+
const lineNumWidth = getLineNumWidth(lines.length);
|
|
65
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Box, { marginBottom: 0, children: _jsx(Text, { color: "cyan", bold: true, children: "Create file" }) }), _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 1, children: [_jsx(Box, { marginBottom: 0, children: _jsx(Text, { children: makeRelativePath(path) }) }), lines.map((line, index) => (_jsxs(Box, { children: [_jsx(Text, { color: "gray", children: formatLineNum(index + 1, lineNumWidth) }), _jsxs(Text, { children: [' ', line] })] }, index)))] })] }));
|
|
66
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FileRenderer Component
|
|
3
|
+
*
|
|
4
|
+
* Renders file operation status.
|
|
5
|
+
* - Read: "Read N lines"
|
|
6
|
+
* - Write/Create: "Wrote N lines to filename"
|
|
7
|
+
*/
|
|
8
|
+
import type { FileDisplayData } from '@dexto/core';
|
|
9
|
+
interface FileRendererProps {
|
|
10
|
+
/** File display data from tool result */
|
|
11
|
+
data: FileDisplayData;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Renders file operation status.
|
|
15
|
+
* Uses ⎿ character for continuation lines.
|
|
16
|
+
*/
|
|
17
|
+
export declare function FileRenderer({ data }: FileRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=FileRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/renderers/FileRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,UAAU,iBAAiB;IACvB,yCAAyC;IACzC,IAAI,EAAE,eAAe,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE,iBAAiB,2CAoCvD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
/**
|
|
4
|
+
* Renders file operation status.
|
|
5
|
+
* Uses ⎿ character for continuation lines.
|
|
6
|
+
*/
|
|
7
|
+
export function FileRenderer({ data }) {
|
|
8
|
+
const { operation, lineCount } = data;
|
|
9
|
+
// Format based on operation type
|
|
10
|
+
if (operation === 'read') {
|
|
11
|
+
// Format: "Read N lines"
|
|
12
|
+
const lineText = lineCount !== undefined ? `${lineCount} lines` : 'file';
|
|
13
|
+
return (_jsxs(Text, { dimColor: true, children: [' ⎿ ', "Read ", lineText] }));
|
|
14
|
+
}
|
|
15
|
+
// For write/create operations
|
|
16
|
+
if (operation === 'write' || operation === 'create') {
|
|
17
|
+
const lineText = lineCount !== undefined ? `${lineCount} lines` : 'content';
|
|
18
|
+
return (_jsxs(Text, { dimColor: true, children: [' ⎿ ', "Wrote ", lineText] }));
|
|
19
|
+
}
|
|
20
|
+
// Delete operation
|
|
21
|
+
if (operation === 'delete') {
|
|
22
|
+
return _jsxs(Text, { dimColor: true, children: [' ⎿ ', "Deleted file"] });
|
|
23
|
+
}
|
|
24
|
+
// Fallback
|
|
25
|
+
return (_jsxs(Text, { dimColor: true, children: [' ⎿ ', operation] }));
|
|
26
|
+
}
|