dexto 1.6.1 → 1.6.2
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/dist/analytics/wrapper.js +1 -1
- package/dist/cli/auth/dexto-api-key.d.ts +34 -0
- package/dist/cli/auth/dexto-api-key.d.ts.map +1 -0
- package/dist/cli/auth/dexto-api-key.js +161 -0
- package/dist/cli/auth/index.d.ts +2 -1
- package/dist/cli/auth/index.d.ts.map +1 -1
- package/dist/cli/auth/index.js +2 -1
- package/dist/cli/auth/oauth.d.ts +10 -0
- package/dist/cli/auth/oauth.d.ts.map +1 -1
- package/dist/cli/auth/oauth.js +113 -36
- package/dist/cli/auth/service.d.ts +1 -0
- package/dist/cli/auth/service.d.ts.map +1 -1
- package/dist/cli/auth/service.js +1 -0
- package/dist/cli/commands/auth/login.d.ts.map +1 -1
- package/dist/cli/commands/auth/login.js +40 -105
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +157 -120
- package/dist/cli/utils/config-validation.js +3 -3
- package/dist/cli/utils/options.d.ts.map +1 -1
- package/dist/cli/utils/options.js +6 -0
- package/dist/index-main.js +36 -2
- package/dist/webui/assets/index-BPlk2Wbt.css +1 -0
- package/dist/webui/assets/index-BZvrpxyh.js +2059 -0
- package/dist/webui/index.html +2 -2
- package/package.json +12 -22
- package/dist/cli/assets/sounds/SOURCES.md +0 -35
- package/dist/cli/assets/sounds/boot.wav +0 -0
- package/dist/cli/assets/sounds/chime.wav +0 -0
- package/dist/cli/assets/sounds/coin.wav +0 -0
- package/dist/cli/assets/sounds/confirm.wav +0 -0
- package/dist/cli/assets/sounds/levelup.wav +0 -0
- package/dist/cli/assets/sounds/ping.wav +0 -0
- package/dist/cli/assets/sounds/powerup.wav +0 -0
- package/dist/cli/assets/sounds/startup.wav +0 -0
- package/dist/cli/assets/sounds/success.wav +0 -0
- package/dist/cli/assets/sounds/treasure.wav +0 -0
- package/dist/cli/assets/sounds/win.wav +0 -0
- package/dist/cli/commands/interactive-commands/auth/index.d.ts +0 -12
- package/dist/cli/commands/interactive-commands/auth/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/auth/index.js +0 -20
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +0 -56
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +0 -173
- package/dist/cli/commands/interactive-commands/commands.d.ts +0 -52
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/commands.js +0 -142
- package/dist/cli/commands/interactive-commands/documentation-commands.d.ts +0 -15
- package/dist/cli/commands/interactive-commands/documentation-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/documentation-commands.js +0 -39
- package/dist/cli/commands/interactive-commands/exit-handler.d.ts +0 -12
- package/dist/cli/commands/interactive-commands/exit-handler.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/exit-handler.js +0 -20
- package/dist/cli/commands/interactive-commands/exit-stats.d.ts +0 -24
- package/dist/cli/commands/interactive-commands/exit-stats.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/exit-stats.js +0 -17
- package/dist/cli/commands/interactive-commands/export/index.d.ts +0 -13
- package/dist/cli/commands/interactive-commands/export/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/export/index.js +0 -21
- package/dist/cli/commands/interactive-commands/general-commands.d.ts +0 -22
- package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/general-commands.js +0 -508
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts +0 -13
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/index.js +0 -18
- package/dist/cli/commands/interactive-commands/model/index.d.ts +0 -13
- package/dist/cli/commands/interactive-commands/model/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/model/index.js +0 -19
- package/dist/cli/commands/interactive-commands/plugin/index.d.ts +0 -13
- package/dist/cli/commands/interactive-commands/plugin/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/plugin/index.js +0 -18
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +0 -25
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +0 -284
- package/dist/cli/commands/interactive-commands/session/index.d.ts +0 -16
- package/dist/cli/commands/interactive-commands/session/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/session/index.js +0 -15
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +0 -32
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/session/session-commands.js +0 -65
- package/dist/cli/commands/interactive-commands/system/index.d.ts +0 -13
- package/dist/cli/commands/interactive-commands/system/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/system/index.js +0 -12
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts +0 -6
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +0 -188
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts +0 -15
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/tool-commands.js +0 -24
- package/dist/cli/commands/interactive-commands/utils/arg-parser.d.ts +0 -57
- package/dist/cli/commands/interactive-commands/utils/arg-parser.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/utils/arg-parser.js +0 -81
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts +0 -40
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/utils/command-output.js +0 -56
- package/dist/cli/commands/interactive-commands/utils/format-output.d.ts +0 -14
- package/dist/cli/commands/interactive-commands/utils/format-output.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/utils/format-output.js +0 -18
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts +0 -52
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +0 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +0 -231
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +0 -44
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +0 -323
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.d.ts +0 -18
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.js +0 -48
- package/dist/cli/ink-cli/components/CustomInput.d.ts +0 -17
- package/dist/cli/ink-cli/components/CustomInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/CustomInput.js +0 -51
- package/dist/cli/ink-cli/components/CustomTextInput.d.ts +0 -16
- package/dist/cli/ink-cli/components/CustomTextInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/CustomTextInput.js +0 -36
- package/dist/cli/ink-cli/components/EditableMultiLineInput.d.ts +0 -19
- package/dist/cli/ink-cli/components/EditableMultiLineInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/EditableMultiLineInput.js +0 -120
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts +0 -24
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/ElicitationForm.js +0 -592
- package/dist/cli/ink-cli/components/ErrorBoundary.d.ts +0 -20
- package/dist/cli/ink-cli/components/ErrorBoundary.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/ErrorBoundary.js +0 -29
- package/dist/cli/ink-cli/components/Footer.d.ts +0 -22
- package/dist/cli/ink-cli/components/Footer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/Footer.js +0 -76
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts +0 -17
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/HistorySearchBar.js +0 -8
- package/dist/cli/ink-cli/components/MultiLineInput.d.ts +0 -12
- package/dist/cli/ink-cli/components/MultiLineInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/MultiLineInput.js +0 -27
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts +0 -26
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +0 -385
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts +0 -28
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +0 -412
- package/dist/cli/ink-cli/components/StatusBar.d.ts +0 -41
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/StatusBar.js +0 -116
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts +0 -52
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/TextBufferInput.js +0 -490
- package/dist/cli/ink-cli/components/TodoPanel.d.ts +0 -26
- package/dist/cli/ink-cli/components/TodoPanel.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/TodoPanel.js +0 -62
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.d.ts +0 -29
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.js +0 -98
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts +0 -37
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.js +0 -128
- package/dist/cli/ink-cli/components/base/index.d.ts +0 -6
- package/dist/cli/ink-cli/components/base/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/base/index.js +0 -5
- package/dist/cli/ink-cli/components/chat/ChatView.d.ts +0 -19
- package/dist/cli/ink-cli/components/chat/ChatView.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/ChatView.js +0 -11
- package/dist/cli/ink-cli/components/chat/Footer.d.ts +0 -9
- package/dist/cli/ink-cli/components/chat/Footer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/Footer.js +0 -8
- package/dist/cli/ink-cli/components/chat/Header.d.ts +0 -18
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/Header.js +0 -16
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts +0 -21
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +0 -182
- package/dist/cli/ink-cli/components/chat/MessageList.d.ts +0 -16
- package/dist/cli/ink-cli/components/chat/MessageList.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/MessageList.js +0 -20
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts +0 -16
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +0 -27
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +0 -18
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +0 -36
- package/dist/cli/ink-cli/components/chat/index.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/index.js +0 -9
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +0 -6
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +0 -15
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +0 -9
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +0 -37
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +0 -9
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +0 -6
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +0 -29
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts +0 -45
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +0 -38
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.js +0 -6
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts +0 -13
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.js +0 -12
- package/dist/cli/ink-cli/components/input/InputArea.d.ts +0 -46
- package/dist/cli/ink-cli/components/input/InputArea.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/input/InputArea.js +0 -6
- package/dist/cli/ink-cli/components/input/index.d.ts +0 -5
- package/dist/cli/ink-cli/components/input/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/input/index.js +0 -4
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +0 -27
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +0 -182
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +0 -29
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +0 -114
- package/dist/cli/ink-cli/components/modes/index.d.ts +0 -10
- package/dist/cli/ink-cli/components/modes/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/modes/index.js +0 -9
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts +0 -26
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +0 -92
- package/dist/cli/ink-cli/components/overlays/CommandOutputOverlay.d.ts +0 -13
- package/dist/cli/ink-cli/components/overlays/CommandOutputOverlay.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/CommandOutputOverlay.js +0 -60
- package/dist/cli/ink-cli/components/overlays/ContextStatsOverlay.d.ts +0 -26
- package/dist/cli/ink-cli/components/overlays/ContextStatsOverlay.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/ContextStatsOverlay.js +0 -241
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +0 -29
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +0 -301
- package/dist/cli/ink-cli/components/overlays/ExportWizard.d.ts +0 -22
- package/dist/cli/ink-cli/components/overlays/ExportWizard.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/ExportWizard.js +0 -308
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +0 -23
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +0 -70
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts +0 -20
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.js +0 -81
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts +0 -31
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.js +0 -297
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts +0 -22
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +0 -59
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts +0 -26
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +0 -73
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +0 -51
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts +0 -29
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +0 -215
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts +0 -22
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +0 -80
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpSelector.js +0 -52
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +0 -28
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +0 -93
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts +0 -29
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +0 -116
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +0 -28
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +0 -743
- package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts +0 -27
- package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PluginActions.js +0 -66
- package/dist/cli/ink-cli/components/overlays/PluginList.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/PluginList.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PluginList.js +0 -70
- package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PluginManager.js +0 -63
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts +0 -22
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +0 -52
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts +0 -29
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +0 -166
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts +0 -27
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +0 -119
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts +0 -33
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PromptList.js +0 -143
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts +0 -23
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +0 -189
- package/dist/cli/ink-cli/components/overlays/SessionRenameOverlay.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/SessionRenameOverlay.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/SessionRenameOverlay.js +0 -63
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts +0 -26
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.js +0 -126
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +0 -42
- package/dist/cli/ink-cli/components/overlays/SoundsSelector.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/SoundsSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/SoundsSelector.js +0 -566
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts +0 -20
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/StreamSelector.js +0 -58
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +0 -26
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +0 -697
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts +0 -25
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.js +0 -604
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts +0 -15
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.js +0 -14
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +0 -42
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +0 -547
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts +0 -25
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +0 -29
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts +0 -17
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.js +0 -11
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts +0 -20
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +0 -10
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts +0 -30
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.js +0 -13
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts +0 -8
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.js +0 -7
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts +0 -85
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.js +0 -38
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts +0 -21
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +0 -65
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +0 -30
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +0 -67
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts +0 -21
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/FileRenderer.js +0 -37
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts +0 -21
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +0 -26
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts +0 -20
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +0 -26
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts +0 -21
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +0 -15
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts +0 -61
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/diff-shared.js +0 -158
- package/dist/cli/ink-cli/components/renderers/index.d.ts +0 -28
- package/dist/cli/ink-cli/components/renderers/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/index.js +0 -36
- package/dist/cli/ink-cli/components/shared/FocusOverlayFrame.d.ts +0 -7
- package/dist/cli/ink-cli/components/shared/FocusOverlayFrame.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/shared/FocusOverlayFrame.js +0 -8
- package/dist/cli/ink-cli/components/shared/HintBar.d.ts +0 -6
- package/dist/cli/ink-cli/components/shared/HintBar.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/shared/HintBar.js +0 -6
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts +0 -38
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/shared/MarkdownText.js +0 -389
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts +0 -44
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/shared/VirtualizedList.js +0 -300
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts +0 -185
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/shared/text-buffer.js +0 -1338
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts +0 -10
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts.map +0 -1
- package/dist/cli/ink-cli/constants/processingPhrases.js +0 -92
- package/dist/cli/ink-cli/constants/spinnerFrames.d.ts +0 -2
- package/dist/cli/ink-cli/constants/spinnerFrames.d.ts.map +0 -1
- package/dist/cli/ink-cli/constants/spinnerFrames.js +0 -1
- package/dist/cli/ink-cli/constants/tips.d.ts +0 -15
- package/dist/cli/ink-cli/constants/tips.d.ts.map +0 -1
- package/dist/cli/ink-cli/constants/tips.js +0 -58
- package/dist/cli/ink-cli/containers/InputContainer.d.ts +0 -62
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +0 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +0 -643
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +0 -42
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +0 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +0 -1840
- package/dist/cli/ink-cli/containers/index.d.ts +0 -6
- package/dist/cli/ink-cli/containers/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/containers/index.js +0 -5
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts +0 -36
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts.map +0 -1
- package/dist/cli/ink-cli/contexts/KeypressContext.js +0 -461
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts +0 -27
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts.map +0 -1
- package/dist/cli/ink-cli/contexts/MouseContext.js +0 -102
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts +0 -33
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts.map +0 -1
- package/dist/cli/ink-cli/contexts/ScrollProvider.js +0 -170
- package/dist/cli/ink-cli/contexts/SoundContext.d.ts +0 -23
- package/dist/cli/ink-cli/contexts/SoundContext.d.ts.map +0 -1
- package/dist/cli/ink-cli/contexts/SoundContext.js +0 -22
- package/dist/cli/ink-cli/contexts/index.d.ts +0 -8
- package/dist/cli/ink-cli/contexts/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/contexts/index.js +0 -7
- package/dist/cli/ink-cli/hooks/index.d.ts +0 -12
- package/dist/cli/ink-cli/hooks/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/index.js +0 -14
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +0 -49
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +0 -369
- package/dist/cli/ink-cli/hooks/useAnimationTick.d.ts +0 -11
- package/dist/cli/ink-cli/hooks/useAnimationTick.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useAnimationTick.js +0 -54
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts +0 -14
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useBatchedScroll.js +0 -25
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts +0 -52
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useCLIState.js +0 -224
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts +0 -24
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useElapsedTime.js +0 -69
- package/dist/cli/ink-cli/hooks/useGitBranch.d.ts +0 -13
- package/dist/cli/ink-cli/hooks/useGitBranch.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useGitBranch.js +0 -35
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts +0 -61
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useHistorySearch.js +0 -210
- package/dist/cli/ink-cli/hooks/useInputHistory.d.ts +0 -18
- package/dist/cli/ink-cli/hooks/useInputHistory.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useInputHistory.js +0 -26
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts +0 -136
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +0 -715
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts +0 -21
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.js +0 -80
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts +0 -18
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useKeypress.js +0 -26
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts +0 -30
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/usePhraseCycler.js +0 -68
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts +0 -19
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useStreaming.js +0 -26
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts +0 -14
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useTerminalSize.js +0 -31
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts +0 -46
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useTokenCounter.js +0 -122
- package/dist/cli/ink-cli/services/CommandService.d.ts +0 -58
- package/dist/cli/ink-cli/services/CommandService.d.ts.map +0 -1
- package/dist/cli/ink-cli/services/CommandService.js +0 -64
- package/dist/cli/ink-cli/services/InputService.d.ts +0 -40
- package/dist/cli/ink-cli/services/InputService.d.ts.map +0 -1
- package/dist/cli/ink-cli/services/InputService.js +0 -87
- package/dist/cli/ink-cli/services/MessageService.d.ts +0 -35
- package/dist/cli/ink-cli/services/MessageService.d.ts.map +0 -1
- package/dist/cli/ink-cli/services/MessageService.js +0 -49
- package/dist/cli/ink-cli/services/index.d.ts +0 -8
- package/dist/cli/ink-cli/services/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/services/index.js +0 -7
- package/dist/cli/ink-cli/services/processStream.d.ts +0 -75
- package/dist/cli/ink-cli/services/processStream.d.ts.map +0 -1
- package/dist/cli/ink-cli/services/processStream.js +0 -951
- package/dist/cli/ink-cli/state/actions.d.ts +0 -124
- package/dist/cli/ink-cli/state/actions.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/actions.js +0 -8
- package/dist/cli/ink-cli/state/index.d.ts +0 -10
- package/dist/cli/ink-cli/state/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/index.js +0 -8
- package/dist/cli/ink-cli/state/initialState.d.ts +0 -12
- package/dist/cli/ink-cli/state/initialState.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/initialState.js +0 -58
- package/dist/cli/ink-cli/state/reducer.d.ts +0 -15
- package/dist/cli/ink-cli/state/reducer.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/reducer.js +0 -341
- package/dist/cli/ink-cli/state/streaming-state.d.ts +0 -27
- package/dist/cli/ink-cli/state/streaming-state.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/streaming-state.js +0 -39
- package/dist/cli/ink-cli/state/types.d.ts +0 -378
- package/dist/cli/ink-cli/state/types.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/types.js +0 -5
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts +0 -22
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/bracketedPaste.js +0 -27
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts +0 -49
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/clipboardUtils.js +0 -356
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts +0 -33
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/commandOverlays.js +0 -85
- package/dist/cli/ink-cli/utils/debugLog.d.ts +0 -38
- package/dist/cli/ink-cli/utils/debugLog.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/debugLog.js +0 -66
- package/dist/cli/ink-cli/utils/elicitationSchema.d.ts +0 -11
- package/dist/cli/ink-cli/utils/elicitationSchema.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/elicitationSchema.js +0 -80
- package/dist/cli/ink-cli/utils/idGenerator.d.ts +0 -10
- package/dist/cli/ink-cli/utils/idGenerator.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/idGenerator.js +0 -12
- package/dist/cli/ink-cli/utils/index.d.ts +0 -9
- package/dist/cli/ink-cli/utils/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/index.js +0 -13
- package/dist/cli/ink-cli/utils/input.d.ts +0 -25
- package/dist/cli/ink-cli/utils/input.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/input.js +0 -56
- package/dist/cli/ink-cli/utils/inputParsing.d.ts +0 -31
- package/dist/cli/ink-cli/utils/inputParsing.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/inputParsing.js +0 -70
- package/dist/cli/ink-cli/utils/llm-provider-display.d.ts +0 -3
- package/dist/cli/ink-cli/utils/llm-provider-display.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/llm-provider-display.js +0 -22
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +0 -125
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +0 -485
- package/dist/cli/ink-cli/utils/mouse.d.ts +0 -61
- package/dist/cli/ink-cli/utils/mouse.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/mouse.js +0 -209
- package/dist/cli/ink-cli/utils/overlayPresentation.d.ts +0 -19
- package/dist/cli/ink-cli/utils/overlayPresentation.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/overlayPresentation.js +0 -33
- package/dist/cli/ink-cli/utils/overlaySizing.d.ts +0 -19
- package/dist/cli/ink-cli/utils/overlaySizing.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/overlaySizing.js +0 -11
- package/dist/cli/ink-cli/utils/soundNotification.d.ts +0 -77
- package/dist/cli/ink-cli/utils/soundNotification.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/soundNotification.js +0 -226
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts +0 -44
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/streamSplitter.js +0 -154
- package/dist/cli/ink-cli/utils/textUtils.d.ts +0 -63
- package/dist/cli/ink-cli/utils/textUtils.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/textUtils.js +0 -248
- package/dist/cli/ink-cli/utils/toolUtils.d.ts +0 -20
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/toolUtils.js +0 -25
- package/dist/webui/assets/index-C9JXwpvo.css +0 -1
- package/dist/webui/assets/index-CKhumsZA.js +0 -2059
|
@@ -1,697 +0,0 @@
|
|
|
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 Local)
|
|
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
|
-
import { getMaxVisibleItemsForTerminalRows } from '../../utils/overlaySizing.js';
|
|
15
|
-
import { HintBar } from '../shared/HintBar.js';
|
|
16
|
-
const LIST_ACTIONS = ['view', 'config', 'back'];
|
|
17
|
-
/**
|
|
18
|
-
* Tool browser with search and detail views
|
|
19
|
-
*/
|
|
20
|
-
const ToolBrowser = forwardRef(function ToolBrowser({ isVisible, onClose, agent, sessionId }, ref) {
|
|
21
|
-
const { columns, rows } = useTerminalSize();
|
|
22
|
-
const maxVisibleTools = useMemo(() => {
|
|
23
|
-
return getMaxVisibleItemsForTerminalRows({
|
|
24
|
-
rows,
|
|
25
|
-
hardCap: 10,
|
|
26
|
-
reservedRows: 16,
|
|
27
|
-
});
|
|
28
|
-
}, [rows]);
|
|
29
|
-
const [tools, setTools] = useState([]);
|
|
30
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
31
|
-
const [loadError, setLoadError] = useState(null);
|
|
32
|
-
const [selection, setSelection] = useState({ index: 0, offset: 0 });
|
|
33
|
-
const [searchQuery, setSearchQuery] = useState('');
|
|
34
|
-
const [viewMode, setViewMode] = useState('list');
|
|
35
|
-
const [selectedTool, setSelectedTool] = useState(null);
|
|
36
|
-
const [detailScrollOffset, setDetailScrollOffset] = useState(0);
|
|
37
|
-
const [copyFeedback, setCopyFeedback] = useState(null);
|
|
38
|
-
const [listActionsIndex, setListActionsIndex] = useState(0);
|
|
39
|
-
const [configIndex, setConfigIndex] = useState(0);
|
|
40
|
-
const [scopeToolName, setScopeToolName] = useState(null);
|
|
41
|
-
const [scopeNextEnabled, setScopeNextEnabled] = useState(true);
|
|
42
|
-
const [scopeTarget, setScopeTarget] = useState('session');
|
|
43
|
-
const selectedIndexRef = useRef(0);
|
|
44
|
-
const viewModeRef = useRef(viewMode);
|
|
45
|
-
const detailScrollOffsetRef = useRef(detailScrollOffset);
|
|
46
|
-
const detailMaxScrollOffsetRef = useRef(0);
|
|
47
|
-
const selectedToolRef = useRef(null);
|
|
48
|
-
const toolsRef = useRef([]);
|
|
49
|
-
const listActionsIndexRef = useRef(listActionsIndex);
|
|
50
|
-
const configIndexRef = useRef(configIndex);
|
|
51
|
-
const scopeTargetRef = useRef(scopeTarget);
|
|
52
|
-
const scopeNextEnabledRef = useRef(scopeNextEnabled);
|
|
53
|
-
const scopeToolNameRef = useRef(scopeToolName);
|
|
54
|
-
// Keep refs in sync
|
|
55
|
-
selectedIndexRef.current = selection.index;
|
|
56
|
-
viewModeRef.current = viewMode;
|
|
57
|
-
detailScrollOffsetRef.current = detailScrollOffset;
|
|
58
|
-
selectedToolRef.current = selectedTool;
|
|
59
|
-
toolsRef.current = tools;
|
|
60
|
-
listActionsIndexRef.current = listActionsIndex;
|
|
61
|
-
configIndexRef.current = configIndex;
|
|
62
|
-
scopeTargetRef.current = scopeTarget;
|
|
63
|
-
scopeNextEnabledRef.current = scopeNextEnabled;
|
|
64
|
-
scopeToolNameRef.current = scopeToolName;
|
|
65
|
-
// Fetch tools from agent
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (!isVisible)
|
|
68
|
-
return;
|
|
69
|
-
let cancelled = false;
|
|
70
|
-
setIsLoading(true);
|
|
71
|
-
setSearchQuery('');
|
|
72
|
-
setSelection({ index: 0, offset: 0 });
|
|
73
|
-
setViewMode('list');
|
|
74
|
-
setSelectedTool(null);
|
|
75
|
-
setListActionsIndex(0);
|
|
76
|
-
setConfigIndex(0);
|
|
77
|
-
setLoadError(null);
|
|
78
|
-
const fetchTools = async () => {
|
|
79
|
-
try {
|
|
80
|
-
const [allTools, mcpTools, enabledTools, autoApprovedTools] = await Promise.all([
|
|
81
|
-
agent.getAllTools(),
|
|
82
|
-
agent.getAllMcpTools(),
|
|
83
|
-
agent.getEnabledTools(sessionId || undefined),
|
|
84
|
-
sessionId ? agent.getSessionAutoApproveTools(sessionId) : Promise.resolve([]),
|
|
85
|
-
]);
|
|
86
|
-
const toolList = [];
|
|
87
|
-
const mcpToolNames = new Set(Object.keys(mcpTools));
|
|
88
|
-
const enabledToolNames = new Set(Object.keys(enabledTools));
|
|
89
|
-
const autoApprovedToolNames = new Set(autoApprovedTools ?? []);
|
|
90
|
-
for (const [toolName, toolInfo] of Object.entries(allTools)) {
|
|
91
|
-
const isMcpTool = mcpToolNames.has(toolName) || toolName.startsWith('mcp--');
|
|
92
|
-
// Extract server name from MCP tool name (format: mcp--serverName--toolName)
|
|
93
|
-
let serverName;
|
|
94
|
-
if (toolName.startsWith('mcp--')) {
|
|
95
|
-
const parts = toolName.split('--');
|
|
96
|
-
if (parts.length >= 2) {
|
|
97
|
-
serverName = parts[1];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
toolList.push({
|
|
101
|
-
name: toolName,
|
|
102
|
-
description: toolInfo.description || 'No description available',
|
|
103
|
-
source: isMcpTool ? 'mcp' : 'local',
|
|
104
|
-
serverName,
|
|
105
|
-
inputSchema: toolInfo.parameters,
|
|
106
|
-
isEnabled: enabledToolNames.has(toolName),
|
|
107
|
-
isAutoApproved: autoApprovedToolNames.has(toolName),
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
// Sort: local tools first, then MCP tools
|
|
111
|
-
toolList.sort((a, b) => {
|
|
112
|
-
if (a.source !== b.source) {
|
|
113
|
-
return a.source === 'local' ? -1 : 1;
|
|
114
|
-
}
|
|
115
|
-
return a.name.localeCompare(b.name);
|
|
116
|
-
});
|
|
117
|
-
if (!cancelled) {
|
|
118
|
-
setTools(toolList);
|
|
119
|
-
setIsLoading(false);
|
|
120
|
-
setLoadError(null);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
if (!cancelled) {
|
|
125
|
-
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
126
|
-
setTools([]);
|
|
127
|
-
setIsLoading(false);
|
|
128
|
-
setLoadError(`Failed to load tools: ${message}`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
void fetchTools();
|
|
133
|
-
return () => {
|
|
134
|
-
cancelled = true;
|
|
135
|
-
};
|
|
136
|
-
}, [isVisible, agent, sessionId]);
|
|
137
|
-
// Filter tools based on search query
|
|
138
|
-
const filteredTools = useMemo(() => {
|
|
139
|
-
if (!searchQuery.trim()) {
|
|
140
|
-
return tools;
|
|
141
|
-
}
|
|
142
|
-
const query = searchQuery.toLowerCase();
|
|
143
|
-
return tools.filter((tool) => {
|
|
144
|
-
const name = tool.name.toLowerCase();
|
|
145
|
-
const desc = tool.description.toLowerCase();
|
|
146
|
-
const server = (tool.serverName || '').toLowerCase();
|
|
147
|
-
return name.includes(query) || desc.includes(query) || server.includes(query);
|
|
148
|
-
});
|
|
149
|
-
}, [tools, searchQuery]);
|
|
150
|
-
// Keep selection valid and visible when filtering or terminal height changes.
|
|
151
|
-
useEffect(() => {
|
|
152
|
-
setSelection((prev) => {
|
|
153
|
-
const maxIndex = Math.max(0, filteredTools.length - 1);
|
|
154
|
-
const nextIndex = Math.min(prev.index, maxIndex);
|
|
155
|
-
let nextOffset = prev.offset;
|
|
156
|
-
if (nextIndex < nextOffset) {
|
|
157
|
-
nextOffset = nextIndex;
|
|
158
|
-
}
|
|
159
|
-
else if (nextIndex >= nextOffset + maxVisibleTools) {
|
|
160
|
-
nextOffset = Math.max(0, nextIndex - maxVisibleTools + 1);
|
|
161
|
-
}
|
|
162
|
-
const maxOffset = Math.max(0, filteredTools.length - maxVisibleTools);
|
|
163
|
-
nextOffset = Math.min(maxOffset, Math.max(0, nextOffset));
|
|
164
|
-
if (nextIndex === prev.index && nextOffset === prev.offset) {
|
|
165
|
-
return prev;
|
|
166
|
-
}
|
|
167
|
-
selectedIndexRef.current = nextIndex;
|
|
168
|
-
return { index: nextIndex, offset: nextOffset };
|
|
169
|
-
});
|
|
170
|
-
}, [filteredTools.length, maxVisibleTools]);
|
|
171
|
-
const openListActions = (tool) => {
|
|
172
|
-
setSelectedTool(tool);
|
|
173
|
-
setListActionsIndex(0);
|
|
174
|
-
setViewMode('list-actions');
|
|
175
|
-
};
|
|
176
|
-
const openToolDetails = (tool) => {
|
|
177
|
-
setSelectedTool(tool);
|
|
178
|
-
setViewMode('detail');
|
|
179
|
-
setDetailScrollOffset(0);
|
|
180
|
-
};
|
|
181
|
-
const openConfigMenu = (tool) => {
|
|
182
|
-
setSelectedTool(tool);
|
|
183
|
-
setConfigIndex(0);
|
|
184
|
-
setViewMode('config');
|
|
185
|
-
};
|
|
186
|
-
const openScopePrompt = (tool) => {
|
|
187
|
-
const nextEnabled = !tool.isEnabled;
|
|
188
|
-
const nextScope = sessionId ? 'session' : 'global';
|
|
189
|
-
setSelectedTool(tool);
|
|
190
|
-
setScopeToolName(tool.name);
|
|
191
|
-
setScopeNextEnabled(nextEnabled);
|
|
192
|
-
setScopeTarget(nextScope);
|
|
193
|
-
setViewMode('scope');
|
|
194
|
-
scopeToolNameRef.current = tool.name;
|
|
195
|
-
scopeNextEnabledRef.current = nextEnabled;
|
|
196
|
-
scopeTargetRef.current = nextScope;
|
|
197
|
-
};
|
|
198
|
-
const closeScopePrompt = () => {
|
|
199
|
-
setViewMode('config');
|
|
200
|
-
setScopeToolName(null);
|
|
201
|
-
};
|
|
202
|
-
const applyToolToggle = async (overrideTarget) => {
|
|
203
|
-
const targetToolName = scopeToolNameRef.current ?? scopeToolName ?? selectedToolRef.current?.name;
|
|
204
|
-
if (!targetToolName)
|
|
205
|
-
return;
|
|
206
|
-
const effectiveTarget = overrideTarget ?? scopeTargetRef.current;
|
|
207
|
-
const nextEnabled = scopeNextEnabledRef.current;
|
|
208
|
-
const previousTools = toolsRef.current;
|
|
209
|
-
const updatedTools = previousTools.map((tool) => {
|
|
210
|
-
if (tool.name !== targetToolName) {
|
|
211
|
-
return tool;
|
|
212
|
-
}
|
|
213
|
-
const updatedTool = { ...tool, isEnabled: nextEnabled };
|
|
214
|
-
if (!nextEnabled && tool.isAutoApproved) {
|
|
215
|
-
updatedTool.isAutoApproved = false;
|
|
216
|
-
}
|
|
217
|
-
return updatedTool;
|
|
218
|
-
});
|
|
219
|
-
setTools(updatedTools);
|
|
220
|
-
const updatedSelected = updatedTools.find((tool) => tool.name === targetToolName) ?? null;
|
|
221
|
-
setSelectedTool(updatedSelected);
|
|
222
|
-
const autoApprovedTools = updatedTools
|
|
223
|
-
.filter((tool) => tool.isAutoApproved)
|
|
224
|
-
.map((tool) => tool.name);
|
|
225
|
-
if (sessionId) {
|
|
226
|
-
agent.setSessionAutoApproveTools(sessionId, autoApprovedTools);
|
|
227
|
-
}
|
|
228
|
-
const disabledTools = updatedTools
|
|
229
|
-
.filter((tool) => !tool.isEnabled)
|
|
230
|
-
.map((tool) => tool.name);
|
|
231
|
-
if (effectiveTarget === 'session' && sessionId) {
|
|
232
|
-
agent.setSessionDisabledTools(sessionId, disabledTools);
|
|
233
|
-
}
|
|
234
|
-
else if (effectiveTarget === 'global') {
|
|
235
|
-
try {
|
|
236
|
-
const { updateAgentPreferences, saveAgentPreferences, agentPreferencesExist } = await import('@dexto/agent-management');
|
|
237
|
-
if (agentPreferencesExist(agent.config.agentId)) {
|
|
238
|
-
await updateAgentPreferences(agent.config.agentId, {
|
|
239
|
-
tools: { disabled: disabledTools },
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
await saveAgentPreferences(agent.config.agentId, {
|
|
244
|
-
tools: { disabled: disabledTools },
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
agent.setGlobalDisabledTools(disabledTools);
|
|
248
|
-
}
|
|
249
|
-
catch (_error) {
|
|
250
|
-
// If we can't persist, still keep session state so user sees effect
|
|
251
|
-
if (sessionId) {
|
|
252
|
-
agent.setSessionDisabledTools(sessionId, disabledTools);
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
setTools(previousTools);
|
|
256
|
-
setSelectedTool(previousTools.find((tool) => tool.name === targetToolName) ?? null);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
closeScopePrompt();
|
|
261
|
-
};
|
|
262
|
-
const toggleAutoApprove = () => {
|
|
263
|
-
if (!sessionId)
|
|
264
|
-
return;
|
|
265
|
-
const updatedTools = toolsRef.current.map((tool) => tool.name === selectedToolRef.current?.name
|
|
266
|
-
? { ...tool, isAutoApproved: !tool.isAutoApproved }
|
|
267
|
-
: tool);
|
|
268
|
-
const updatedSelected = updatedTools.find((tool) => tool.name === selectedToolRef.current?.name);
|
|
269
|
-
setTools(updatedTools);
|
|
270
|
-
setSelectedTool(updatedSelected ?? null);
|
|
271
|
-
const autoApprovedTools = updatedTools
|
|
272
|
-
.filter((tool) => tool.isAutoApproved)
|
|
273
|
-
.map((tool) => tool.name);
|
|
274
|
-
agent.setSessionAutoApproveTools(sessionId, autoApprovedTools);
|
|
275
|
-
};
|
|
276
|
-
const closeConfigMenu = () => {
|
|
277
|
-
setViewMode('list-actions');
|
|
278
|
-
};
|
|
279
|
-
const closeDetailView = () => {
|
|
280
|
-
setViewMode('list-actions');
|
|
281
|
-
};
|
|
282
|
-
const closeListActions = () => {
|
|
283
|
-
setViewMode('list');
|
|
284
|
-
setSelectedTool(null);
|
|
285
|
-
};
|
|
286
|
-
// Expose handleInput method via ref
|
|
287
|
-
useImperativeHandle(ref, () => ({
|
|
288
|
-
handleInput: (input, key) => {
|
|
289
|
-
if (!isVisible)
|
|
290
|
-
return false;
|
|
291
|
-
if (isLoading) {
|
|
292
|
-
if (key.escape) {
|
|
293
|
-
onClose();
|
|
294
|
-
}
|
|
295
|
-
return true;
|
|
296
|
-
}
|
|
297
|
-
// Scope selection view
|
|
298
|
-
if (viewModeRef.current === 'scope') {
|
|
299
|
-
if (key.escape || key.backspace || key.delete) {
|
|
300
|
-
closeScopePrompt();
|
|
301
|
-
return true;
|
|
302
|
-
}
|
|
303
|
-
if (key.upArrow || key.downArrow) {
|
|
304
|
-
setScopeTarget((prev) => (prev === 'session' ? 'global' : 'session'));
|
|
305
|
-
return true;
|
|
306
|
-
}
|
|
307
|
-
if (key.return) {
|
|
308
|
-
if (scopeTargetRef.current === 'session' && !sessionId) {
|
|
309
|
-
setScopeTarget('global');
|
|
310
|
-
scopeTargetRef.current = 'global';
|
|
311
|
-
void applyToolToggle('global');
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
void applyToolToggle();
|
|
315
|
-
return true;
|
|
316
|
-
}
|
|
317
|
-
return true;
|
|
318
|
-
}
|
|
319
|
-
// Config menu view
|
|
320
|
-
if (viewModeRef.current === 'config') {
|
|
321
|
-
if (key.escape || key.backspace || key.delete) {
|
|
322
|
-
closeConfigMenu();
|
|
323
|
-
return true;
|
|
324
|
-
}
|
|
325
|
-
if (key.upArrow) {
|
|
326
|
-
const nextIndex = (configIndexRef.current - 1 + 3) % 3;
|
|
327
|
-
setConfigIndex(nextIndex);
|
|
328
|
-
return true;
|
|
329
|
-
}
|
|
330
|
-
if (key.downArrow) {
|
|
331
|
-
const nextIndex = (configIndexRef.current + 1) % 3;
|
|
332
|
-
setConfigIndex(nextIndex);
|
|
333
|
-
return true;
|
|
334
|
-
}
|
|
335
|
-
if (key.return) {
|
|
336
|
-
const tool = selectedToolRef.current;
|
|
337
|
-
if (tool) {
|
|
338
|
-
if (configIndexRef.current === 0) {
|
|
339
|
-
openScopePrompt(tool);
|
|
340
|
-
}
|
|
341
|
-
else if (configIndexRef.current === 1) {
|
|
342
|
-
if (sessionId && tool.isEnabled) {
|
|
343
|
-
toggleAutoApprove();
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
closeConfigMenu();
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return true;
|
|
351
|
-
}
|
|
352
|
-
return true;
|
|
353
|
-
}
|
|
354
|
-
// Detail view
|
|
355
|
-
if (viewModeRef.current === 'detail') {
|
|
356
|
-
if (key.escape || key.backspace || key.delete) {
|
|
357
|
-
closeDetailView();
|
|
358
|
-
return true;
|
|
359
|
-
}
|
|
360
|
-
if (key.upArrow) {
|
|
361
|
-
if (detailScrollOffsetRef.current > 0) {
|
|
362
|
-
setDetailScrollOffset((prev) => prev - 1);
|
|
363
|
-
}
|
|
364
|
-
return true;
|
|
365
|
-
}
|
|
366
|
-
if (key.downArrow) {
|
|
367
|
-
if (detailScrollOffsetRef.current < detailMaxScrollOffsetRef.current) {
|
|
368
|
-
setDetailScrollOffset((prev) => prev + 1);
|
|
369
|
-
}
|
|
370
|
-
return true;
|
|
371
|
-
}
|
|
372
|
-
// Copy schema to clipboard
|
|
373
|
-
if (input === 'c' || input === 'C') {
|
|
374
|
-
const tool = selectedToolRef.current;
|
|
375
|
-
if (tool) {
|
|
376
|
-
const schema = {
|
|
377
|
-
type: 'function',
|
|
378
|
-
name: tool.name,
|
|
379
|
-
description: tool.description,
|
|
380
|
-
parameters: tool.inputSchema || {},
|
|
381
|
-
};
|
|
382
|
-
void writeToClipboard(JSON.stringify(schema, null, 2)).then((success) => {
|
|
383
|
-
setCopyFeedback(success ? 'Copied!' : 'Copy failed');
|
|
384
|
-
setTimeout(() => setCopyFeedback(null), 1500);
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
return true;
|
|
388
|
-
}
|
|
389
|
-
if (key.return) {
|
|
390
|
-
const tool = selectedToolRef.current;
|
|
391
|
-
if (tool) {
|
|
392
|
-
openConfigMenu(tool);
|
|
393
|
-
}
|
|
394
|
-
return true;
|
|
395
|
-
}
|
|
396
|
-
return true;
|
|
397
|
-
}
|
|
398
|
-
// List action menu view
|
|
399
|
-
if (viewModeRef.current === 'list-actions') {
|
|
400
|
-
if (key.escape || key.backspace || key.delete) {
|
|
401
|
-
closeListActions();
|
|
402
|
-
return true;
|
|
403
|
-
}
|
|
404
|
-
if (key.upArrow) {
|
|
405
|
-
const nextIndex = (listActionsIndexRef.current - 1 + LIST_ACTIONS.length) %
|
|
406
|
-
LIST_ACTIONS.length;
|
|
407
|
-
setListActionsIndex(nextIndex);
|
|
408
|
-
return true;
|
|
409
|
-
}
|
|
410
|
-
if (key.downArrow) {
|
|
411
|
-
const nextIndex = (listActionsIndexRef.current + 1) % LIST_ACTIONS.length;
|
|
412
|
-
setListActionsIndex(nextIndex);
|
|
413
|
-
return true;
|
|
414
|
-
}
|
|
415
|
-
if (key.return) {
|
|
416
|
-
const tool = selectedToolRef.current;
|
|
417
|
-
const action = LIST_ACTIONS[listActionsIndexRef.current];
|
|
418
|
-
if (!tool) {
|
|
419
|
-
closeListActions();
|
|
420
|
-
return true;
|
|
421
|
-
}
|
|
422
|
-
if (action === 'view') {
|
|
423
|
-
openToolDetails(tool);
|
|
424
|
-
}
|
|
425
|
-
else if (action === 'config') {
|
|
426
|
-
openConfigMenu(tool);
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
closeListActions();
|
|
430
|
-
}
|
|
431
|
-
return true;
|
|
432
|
-
}
|
|
433
|
-
return true;
|
|
434
|
-
}
|
|
435
|
-
// In list view
|
|
436
|
-
if (key.escape) {
|
|
437
|
-
onClose();
|
|
438
|
-
return true;
|
|
439
|
-
}
|
|
440
|
-
// Handle character input for search
|
|
441
|
-
if (input && !key.return && !key.upArrow && !key.downArrow && !key.tab) {
|
|
442
|
-
// Backspace
|
|
443
|
-
if (key.backspace || key.delete) {
|
|
444
|
-
setSearchQuery((prev) => prev.slice(0, -1));
|
|
445
|
-
return true;
|
|
446
|
-
}
|
|
447
|
-
// Regular character - add to search
|
|
448
|
-
if (input.length === 1 && input.charCodeAt(0) >= 32) {
|
|
449
|
-
setSearchQuery((prev) => prev + input);
|
|
450
|
-
selectedIndexRef.current = 0;
|
|
451
|
-
setSelection({ index: 0, offset: 0 });
|
|
452
|
-
return true;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
// Backspace when no other input
|
|
456
|
-
if (key.backspace || key.delete) {
|
|
457
|
-
setSearchQuery((prev) => prev.slice(0, -1));
|
|
458
|
-
return true;
|
|
459
|
-
}
|
|
460
|
-
const itemsLength = filteredTools.length;
|
|
461
|
-
if (itemsLength === 0)
|
|
462
|
-
return false;
|
|
463
|
-
if (key.upArrow) {
|
|
464
|
-
const nextIndex = (selectedIndexRef.current - 1 + itemsLength) % itemsLength;
|
|
465
|
-
selectedIndexRef.current = nextIndex;
|
|
466
|
-
setSelection((prev) => {
|
|
467
|
-
let nextOffset = prev.offset;
|
|
468
|
-
if (nextIndex < prev.offset) {
|
|
469
|
-
nextOffset = nextIndex;
|
|
470
|
-
}
|
|
471
|
-
else if (nextIndex >= prev.offset + maxVisibleTools) {
|
|
472
|
-
nextOffset = Math.max(0, nextIndex - maxVisibleTools + 1);
|
|
473
|
-
}
|
|
474
|
-
const maxOffset = Math.max(0, itemsLength - maxVisibleTools);
|
|
475
|
-
nextOffset = Math.min(maxOffset, Math.max(0, nextOffset));
|
|
476
|
-
return { index: nextIndex, offset: nextOffset };
|
|
477
|
-
});
|
|
478
|
-
return true;
|
|
479
|
-
}
|
|
480
|
-
if (key.downArrow) {
|
|
481
|
-
const nextIndex = (selectedIndexRef.current + 1) % itemsLength;
|
|
482
|
-
selectedIndexRef.current = nextIndex;
|
|
483
|
-
setSelection((prev) => {
|
|
484
|
-
let nextOffset = prev.offset;
|
|
485
|
-
if (nextIndex < prev.offset) {
|
|
486
|
-
nextOffset = nextIndex;
|
|
487
|
-
}
|
|
488
|
-
else if (nextIndex >= prev.offset + maxVisibleTools) {
|
|
489
|
-
nextOffset = Math.max(0, nextIndex - maxVisibleTools + 1);
|
|
490
|
-
}
|
|
491
|
-
const maxOffset = Math.max(0, itemsLength - maxVisibleTools);
|
|
492
|
-
nextOffset = Math.min(maxOffset, Math.max(0, nextOffset));
|
|
493
|
-
return { index: nextIndex, offset: nextOffset };
|
|
494
|
-
});
|
|
495
|
-
return true;
|
|
496
|
-
}
|
|
497
|
-
if (key.return && itemsLength > 0) {
|
|
498
|
-
const tool = filteredTools[selectedIndexRef.current];
|
|
499
|
-
if (tool) {
|
|
500
|
-
openListActions(tool);
|
|
501
|
-
return true;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
return false;
|
|
505
|
-
},
|
|
506
|
-
}), [isVisible, isLoading, filteredTools, maxVisibleTools, onClose, sessionId]);
|
|
507
|
-
if (!isVisible)
|
|
508
|
-
return null;
|
|
509
|
-
if (viewMode === 'list-actions' && selectedTool) {
|
|
510
|
-
return (_jsx(ToolActionsMenu, { tool: selectedTool, columns: columns, listActionsIndex: listActionsIndex }));
|
|
511
|
-
}
|
|
512
|
-
if (viewMode === 'detail' && selectedTool) {
|
|
513
|
-
const maxVisibleLines = Math.min(18, Math.max(5, rows - 6));
|
|
514
|
-
return (_jsx(ToolDetailView, { tool: selectedTool, columns: columns, scrollOffset: detailScrollOffset, maxVisibleLines: maxVisibleLines, maxScrollOffsetRef: detailMaxScrollOffsetRef, copyFeedback: copyFeedback }));
|
|
515
|
-
}
|
|
516
|
-
if (viewMode === 'config' && selectedTool) {
|
|
517
|
-
return (_jsx(ToolSettingsView, { tool: selectedTool, columns: columns, configIndex: configIndex, sessionAvailable: Boolean(sessionId) }));
|
|
518
|
-
}
|
|
519
|
-
if (viewMode === 'scope' && selectedTool) {
|
|
520
|
-
return (_jsx(ToolScopeView, { tool: selectedTool, columns: columns, scopeTarget: scopeTarget, scopeNextEnabled: scopeNextEnabled, sessionAvailable: Boolean(sessionId) }));
|
|
521
|
-
}
|
|
522
|
-
// List view
|
|
523
|
-
const selectedIndex = selection.index;
|
|
524
|
-
const scrollOffset = selection.offset;
|
|
525
|
-
const visibleTools = filteredTools.slice(scrollOffset, scrollOffset + maxVisibleTools);
|
|
526
|
-
const filteredLocalCount = filteredTools.filter((t) => t.source === 'local').length;
|
|
527
|
-
const filteredMcpCount = filteredTools.filter((t) => t.source === 'mcp').length;
|
|
528
|
-
const selectedToolInList = filteredTools[selectedIndex];
|
|
529
|
-
let detailLine = '';
|
|
530
|
-
if (isLoading) {
|
|
531
|
-
detailLine = 'Loading tools…';
|
|
532
|
-
}
|
|
533
|
-
else if (loadError) {
|
|
534
|
-
detailLine = loadError;
|
|
535
|
-
}
|
|
536
|
-
else if (searchQuery.trim() && filteredTools.length === 0) {
|
|
537
|
-
detailLine = 'No tools match your search';
|
|
538
|
-
}
|
|
539
|
-
else if (selectedToolInList) {
|
|
540
|
-
detailLine = selectedToolInList.description;
|
|
541
|
-
}
|
|
542
|
-
return (_jsxs(Box, { flexDirection: "column", width: columns, children: [_jsxs(Box, { paddingX: 0, paddingY: 0, children: [_jsx(Text, { color: "cyan", bold: true, children: "Tools" }), _jsxs(Text, { color: "gray", children: [' ', "(", filteredTools.length, " tools: ", filteredLocalCount, " local, ", filteredMcpCount, ' ', "MCP)"] })] }), _jsxs(Box, { paddingX: 0, paddingY: 0, marginTop: 1, children: [_jsx(Text, { color: "gray", children: "Search: " }), _jsx(Text, { color: searchQuery ? 'white' : 'gray', wrap: "truncate-end", children: searchQuery || 'Type to filter tools…' })] }), _jsx(Box, { flexDirection: "column", height: maxVisibleTools, marginTop: 1, children: isLoading || filteredTools.length === 0
|
|
543
|
-
? Array.from({ length: maxVisibleTools }, (_, index) => (_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { children: " " }) }, `tool-empty-${index}`)))
|
|
544
|
-
: Array.from({ length: maxVisibleTools }, (_, rowIndex) => {
|
|
545
|
-
const tool = visibleTools[rowIndex];
|
|
546
|
-
if (!tool) {
|
|
547
|
-
return (_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { children: " " }) }, `tool-empty-${rowIndex}`));
|
|
548
|
-
}
|
|
549
|
-
const actualIndex = scrollOffset + rowIndex;
|
|
550
|
-
const isSelected = actualIndex === selectedIndex;
|
|
551
|
-
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 === 'local' ? 'magenta' : 'blue', children: [' ', "[", tool.source === 'local' ? 'Local' : 'MCP', "]"] }), tool.serverName && (_jsxs(Text, { color: "gray", children: [" (", tool.serverName, ")"] })), _jsxs(Text, { color: tool.isEnabled ? 'green' : 'red', children: [' ', tool.isEnabled ? 'Enabled' : 'Disabled'] }), tool.isAutoApproved && (_jsx(Text, { color: "yellow", children: " [auto-approved]" }))] }, tool.name));
|
|
552
|
-
}) }), _jsx(Box, { paddingX: 0, paddingY: 0, marginTop: 1, children: _jsx(Text, { color: loadError ? 'red' : 'gray', wrap: "truncate-end", children: detailLine }) }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(HintBar, { hints: ['↑↓ navigate', 'Enter options', 'Esc close'] }) })] }));
|
|
553
|
-
});
|
|
554
|
-
/**
|
|
555
|
-
* Build detail line data for a tool (plain data, not React elements)
|
|
556
|
-
*/
|
|
557
|
-
function buildDetailLineData(tool, maxWidth) {
|
|
558
|
-
const lines = [];
|
|
559
|
-
// Tool name
|
|
560
|
-
lines.push({ type: 'title', text: tool.name });
|
|
561
|
-
// Source
|
|
562
|
-
lines.push({ type: 'source', source: tool.source, serverName: tool.serverName });
|
|
563
|
-
// Empty line before description
|
|
564
|
-
lines.push({ type: 'empty' });
|
|
565
|
-
// Description header
|
|
566
|
-
lines.push({ type: 'header', text: 'Description:' });
|
|
567
|
-
// Description content (wrapped)
|
|
568
|
-
const descriptionLines = wrapText(tool.description, maxWidth - 2).split('\n');
|
|
569
|
-
for (const descLine of descriptionLines) {
|
|
570
|
-
lines.push({ type: 'description', text: descLine });
|
|
571
|
-
}
|
|
572
|
-
// Parameters section
|
|
573
|
-
if (tool.inputSchema) {
|
|
574
|
-
const properties = tool.inputSchema.properties;
|
|
575
|
-
const required = tool.inputSchema.required || [];
|
|
576
|
-
if (properties && Object.keys(properties).length > 0) {
|
|
577
|
-
// Empty line before parameters
|
|
578
|
-
lines.push({ type: 'empty' });
|
|
579
|
-
// Parameters header
|
|
580
|
-
lines.push({ type: 'header', text: 'Parameters:' });
|
|
581
|
-
// Each parameter
|
|
582
|
-
for (const [propName, propSchema] of Object.entries(properties)) {
|
|
583
|
-
const paramType = propSchema.type || 'any';
|
|
584
|
-
const description = propSchema.description;
|
|
585
|
-
const isRequired = required.includes(propName);
|
|
586
|
-
const enumValues = propSchema.enum;
|
|
587
|
-
// Parameter name line
|
|
588
|
-
lines.push({
|
|
589
|
-
type: 'param-name',
|
|
590
|
-
name: propName,
|
|
591
|
-
paramType,
|
|
592
|
-
required: isRequired,
|
|
593
|
-
});
|
|
594
|
-
// Parameter description (wrapped)
|
|
595
|
-
if (description) {
|
|
596
|
-
const descLines = wrapText(description, maxWidth - 2).split('\n');
|
|
597
|
-
for (const descLine of descLines) {
|
|
598
|
-
lines.push({ type: 'param-desc', text: descLine });
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
// Enum values
|
|
602
|
-
if (enumValues && enumValues.length > 0) {
|
|
603
|
-
lines.push({ type: 'param-enum', values: enumValues });
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
return lines;
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* Render a detail line based on type
|
|
612
|
-
*/
|
|
613
|
-
function renderDetailLine(line, _index) {
|
|
614
|
-
switch (line.type) {
|
|
615
|
-
case 'title':
|
|
616
|
-
return (_jsx(Text, { color: "cyan", bold: true, children: line.text }));
|
|
617
|
-
case 'source':
|
|
618
|
-
return (_jsxs(Text, { color: line.source === 'local' ? 'magenta' : 'blue', children: [line.source === 'local' ? 'Local Tool' : 'MCP Tool', line.serverName ? ` (${line.serverName})` : ''] }));
|
|
619
|
-
case 'empty':
|
|
620
|
-
return _jsx(Text, { children: " " });
|
|
621
|
-
case 'header':
|
|
622
|
-
return _jsx(Text, { color: "gray", children: line.text });
|
|
623
|
-
case 'description':
|
|
624
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsx(Text, { children: line.text })] }));
|
|
625
|
-
case 'param-name':
|
|
626
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsx(Text, { color: "cyan", children: line.name }), _jsxs(Text, { color: "gray", children: [" (", line.paramType, ")"] }), line.required && _jsx(Text, { color: "red", children: " *required" })] }));
|
|
627
|
-
case 'param-desc':
|
|
628
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsx(Text, { color: "gray", children: line.text })] }));
|
|
629
|
-
case 'param-enum':
|
|
630
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsxs(Text, { color: "gray", children: ["Allowed: ", line.values.join(' | ')] })] }));
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
function ToolActionsMenu({ tool, columns, listActionsIndex, }) {
|
|
634
|
-
return (_jsxs(Box, { flexDirection: "column", width: columns, children: [_jsxs(Box, { paddingX: 0, paddingY: 0, children: [_jsx(Text, { color: "cyan", bold: true, children: "Tool Options" }), _jsxs(Text, { color: "gray", children: [" ", tool.name] })] }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsxs(Text, { color: listActionsIndex === 0 ? 'cyan' : 'gray', children: [listActionsIndex === 0 ? '▶ ' : ' ', "View details"] }) }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsxs(Text, { color: listActionsIndex === 1 ? 'cyan' : 'gray', children: [listActionsIndex === 1 ? '▶ ' : ' ', "Edit tool settings"] }) }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsxs(Text, { color: listActionsIndex === 2 ? 'cyan' : 'gray', children: [listActionsIndex === 2 ? '▶ ' : ' ', "Back"] }) }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "gray", children: "\u2191\u2193 select \u00B7 Enter confirm \u00B7 Esc back" }) })] }));
|
|
635
|
-
}
|
|
636
|
-
function ToolDetailView({ tool, columns, scrollOffset, maxVisibleLines, maxScrollOffsetRef, copyFeedback, }) {
|
|
637
|
-
const maxWidth = Math.min(80, columns - 4);
|
|
638
|
-
// Build plain data for lines (memoized)
|
|
639
|
-
const lineData = useMemo(() => buildDetailLineData(tool, maxWidth), [tool, maxWidth]);
|
|
640
|
-
// Calculate visible range and update max scroll offset ref
|
|
641
|
-
const totalLines = lineData.length;
|
|
642
|
-
const maxScrollOffset = Math.max(0, totalLines - maxVisibleLines);
|
|
643
|
-
maxScrollOffsetRef.current = maxScrollOffset;
|
|
644
|
-
const clampedOffset = Math.min(scrollOffset, maxScrollOffset);
|
|
645
|
-
// Calculate scroll indicators
|
|
646
|
-
const hasMoreAbove = clampedOffset > 0;
|
|
647
|
-
const hasMoreBelow = clampedOffset + maxVisibleLines < totalLines;
|
|
648
|
-
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, { color: "gray", children: " - \u2191\u2193 scroll, c copy schema, Enter settings, Esc back" }), copyFeedback && (_jsxs(Text, { color: "green", bold: true, children: [' ', copyFeedback] }))] }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "gray", children: '─'.repeat(Math.min(60, columns - 2)) }) }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "gray", children: hasMoreAbove ? `↑ ${clampedOffset} more above` : ' ' }) }), Array.from({ length: maxVisibleLines }, (_, i) => {
|
|
649
|
-
const absoluteIndex = clampedOffset + i;
|
|
650
|
-
const line = lineData[absoluteIndex];
|
|
651
|
-
return (_jsx(Box, { paddingX: 0, paddingY: 0, children: line ? renderDetailLine(line, absoluteIndex) : _jsx(Text, { children: " " }) }, i));
|
|
652
|
-
}), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "gray", children: hasMoreBelow
|
|
653
|
-
? `↓ ${totalLines - clampedOffset - maxVisibleLines} more below`
|
|
654
|
-
: ' ' }) })] }));
|
|
655
|
-
}
|
|
656
|
-
function ToolSettingsView({ tool, columns, configIndex, sessionAvailable, }) {
|
|
657
|
-
const autoApproveDisabled = !tool.isEnabled;
|
|
658
|
-
const autoApproveUnavailable = !sessionAvailable || autoApproveDisabled;
|
|
659
|
-
return (_jsxs(Box, { flexDirection: "column", width: columns, children: [_jsxs(Box, { paddingX: 0, paddingY: 0, children: [_jsx(Text, { color: "cyan", bold: true, children: "Tool Settings" }), _jsxs(Text, { color: "gray", children: [" ", tool.name] })] }), _jsxs(Box, { paddingX: 0, paddingY: 0, children: [_jsx(Text, { color: "gray", children: "Status: " }), _jsx(Text, { color: tool.isEnabled ? 'green' : 'red', children: tool.isEnabled ? 'Enabled' : 'Disabled' }), _jsx(Text, { color: "gray", children: " \u00B7 Auto-approve: " }), _jsx(Text, { color: tool.isAutoApproved ? 'green' : 'red', children: tool.isAutoApproved ? 'On' : 'Off' }), _jsx(Text, { color: "gray", children: " (session)" })] }), autoApproveDisabled && (_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "yellow", children: "Enable the tool to allow auto-approve." }) })), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsxs(Text, { color: configIndex === 0 ? 'cyan' : 'gray', children: [configIndex === 0 ? '▶ ' : ' ', tool.isEnabled ? 'Disable tool' : 'Enable tool'] }) }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsxs(Text, { color: configIndex === 1 ? (autoApproveUnavailable ? 'yellow' : 'cyan') : 'gray', children: [configIndex === 1 ? '▶ ' : ' ', tool.isAutoApproved
|
|
660
|
-
? 'Disable auto-approve (session)'
|
|
661
|
-
: 'Enable auto-approve (session)'] }) }), !sessionAvailable && (_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "yellow", children: "Auto-approve requires an active session." }) })), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsxs(Text, { color: configIndex === 2 ? 'cyan' : 'gray', children: [configIndex === 2 ? '▶ ' : ' ', "Back"] }) }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "gray", children: "\u2191\u2193 select \u00B7 Enter confirm \u00B7 Esc back" }) })] }));
|
|
662
|
-
}
|
|
663
|
-
function ToolScopeView({ tool, columns, scopeTarget, scopeNextEnabled, sessionAvailable, }) {
|
|
664
|
-
return (_jsxs(Box, { flexDirection: "column", width: columns, children: [_jsxs(Box, { paddingX: 0, paddingY: 0, children: [_jsx(Text, { color: "cyan", bold: true, children: scopeNextEnabled ? 'Enable Tool' : 'Disable Tool' }), _jsxs(Text, { color: "gray", children: [" ", tool.name] })] }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "gray", children: "Apply to:" }) }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsxs(Text, { color: scopeTarget === 'session' ? 'cyan' : 'gray', children: [scopeTarget === 'session' ? '▶ ' : ' ', "Session (default)"] }) }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsxs(Text, { color: scopeTarget === 'global' ? 'cyan' : 'gray', children: [scopeTarget === 'global' ? '▶ ' : ' ', "Global (persisted)"] }) }), !sessionAvailable && scopeTarget === 'session' && (_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "yellow", children: "No active session; switching to global." }) })), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "gray", children: "\u2191\u2193 choose scope \u00B7 Enter confirm \u00B7 Esc back" }) })] }));
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* Truncate text to max length with ellipsis
|
|
668
|
-
*/
|
|
669
|
-
function truncateText(text, maxLength) {
|
|
670
|
-
if (text.length <= maxLength)
|
|
671
|
-
return text;
|
|
672
|
-
return text.slice(0, maxLength - 1) + '…';
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* Wrap text to fit within max width
|
|
676
|
-
*/
|
|
677
|
-
function wrapText(text, maxWidth) {
|
|
678
|
-
if (text.length <= maxWidth)
|
|
679
|
-
return text;
|
|
680
|
-
const words = text.split(' ');
|
|
681
|
-
const lines = [];
|
|
682
|
-
let currentLine = '';
|
|
683
|
-
for (const word of words) {
|
|
684
|
-
if (currentLine.length + word.length + 1 <= maxWidth) {
|
|
685
|
-
currentLine += (currentLine ? ' ' : '') + word;
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
if (currentLine)
|
|
689
|
-
lines.push(currentLine);
|
|
690
|
-
currentLine = word;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
if (currentLine)
|
|
694
|
-
lines.push(currentLine);
|
|
695
|
-
return lines.join('\n');
|
|
696
|
-
}
|
|
697
|
-
export default ToolBrowser;
|