dexto 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -22
- package/dist/agents/agent-registry.json +9 -0
- package/dist/agents/agent-template.yml +2 -2
- package/dist/agents/coding-agent/coding-agent.yml +27 -16
- package/dist/agents/database-agent/database-agent.yml +2 -2
- package/dist/agents/default-agent.yml +9 -7
- package/dist/agents/github-agent/github-agent.yml +2 -2
- package/dist/agents/product-name-researcher/product-name-researcher.yml +2 -2
- package/dist/agents/talk2pdf-agent/talk2pdf-agent.yml +2 -2
- package/dist/analytics/events.d.ts +13 -6
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/analytics/index.d.ts +1 -1
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +6 -2
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +65 -9
- package/dist/cli/cli-subscriber.d.ts +4 -0
- package/dist/cli/cli-subscriber.d.ts.map +1 -1
- package/dist/cli/cli-subscriber.js +47 -3
- package/dist/cli/commands/create-app.d.ts +16 -14
- package/dist/cli/commands/create-app.d.ts.map +1 -1
- package/dist/cli/commands/create-app.js +626 -102
- package/dist/cli/commands/create-image.d.ts +7 -0
- package/dist/cli/commands/create-image.d.ts.map +1 -0
- package/dist/cli/commands/create-image.js +201 -0
- package/dist/cli/commands/helpers/formatters.d.ts.map +1 -1
- package/dist/cli/commands/helpers/formatters.js +9 -8
- package/dist/cli/commands/index.d.ts +2 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -1
- package/dist/cli/commands/init-app.js +7 -7
- package/dist/cli/commands/install.d.ts +0 -3
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +19 -70
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +17 -14
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +7 -22
- package/dist/cli/commands/interactive-commands/commands.d.ts +4 -4
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.js +34 -42
- package/dist/cli/commands/interactive-commands/documentation-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/documentation-commands.js +4 -7
- package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/general-commands.js +159 -117
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts +9 -3
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/mcp/index.js +18 -3
- package/dist/cli/commands/interactive-commands/model/index.d.ts +8 -6
- package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/model/index.js +18 -6
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -2
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +77 -60
- package/dist/cli/commands/interactive-commands/session/index.d.ts +7 -12
- package/dist/cli/commands/interactive-commands/session/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/index.js +7 -14
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +10 -24
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/session-commands.js +16 -371
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts +1 -0
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +106 -77
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts +1 -1
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/tool-commands.js +5 -62
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts +13 -17
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/utils/command-output.js +18 -37
- package/dist/cli/commands/list-agents.d.ts +2 -2
- package/dist/cli/commands/list-agents.d.ts.map +1 -1
- package/dist/cli/commands/list-agents.js +38 -34
- package/dist/cli/commands/session-commands.js +16 -16
- package/dist/cli/commands/setup.d.ts +13 -5
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +860 -65
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/commands/uninstall.js +4 -6
- package/dist/cli/commands/which.d.ts.map +1 -1
- package/dist/cli/commands/which.js +18 -4
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts +9 -22
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +50 -133
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +26 -3
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +182 -45
- package/dist/cli/ink-cli/components/CustomInput.js +1 -1
- package/dist/cli/ink-cli/components/EditableMultiLineInput.js +4 -4
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts +22 -0
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/ElicitationForm.js +358 -0
- package/dist/cli/ink-cli/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ErrorBoundary.js +1 -1
- package/dist/cli/ink-cli/components/Footer.d.ts +16 -0
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/Footer.js +27 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts +17 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.js +8 -0
- package/dist/cli/ink-cli/components/MultiLineInput.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/MultiLineInput.js +3 -3
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts +15 -2
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +126 -82
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts +15 -2
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +228 -122
- package/dist/cli/ink-cli/components/StatusBar.d.ts +15 -2
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +50 -10
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts +52 -0
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/TextBufferInput.js +471 -0
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.js +4 -4
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts +11 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.js +90 -49
- package/dist/cli/ink-cli/components/chat/Footer.js +1 -1
- package/dist/cli/ink-cli/components/chat/Header.d.ts +1 -0
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/Header.js +6 -3
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts +3 -0
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +95 -9
- package/dist/cli/ink-cli/components/chat/MessageList.js +1 -1
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts +16 -0
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +27 -0
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +5 -3
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +21 -7
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +15 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +9 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +37 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +9 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +29 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts +45 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +38 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts +13 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.js +12 -0
- package/dist/cli/ink-cli/components/input/InputArea.d.ts +36 -8
- package/dist/cli/ink-cli/components/input/InputArea.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/input/InputArea.js +3 -3
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +25 -0
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +166 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +27 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +95 -0
- package/dist/cli/ink-cli/components/modes/index.d.ts +10 -0
- package/dist/cli/ink-cli/components/modes/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/index.js +9 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts +26 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +92 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +286 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +59 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +59 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts +26 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +73 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +51 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +215 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +74 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.js +52 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +28 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +84 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +109 -0
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +15 -8
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +400 -23
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +52 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +166 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts +27 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +119 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.js +144 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts +23 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +189 -0
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts +7 -2
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.js +19 -5
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +42 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.js +58 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +400 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.js +609 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts +15 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.js +14 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +419 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +29 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts +17 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.js +11 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +10 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts +30 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.js +13 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts +8 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.js +7 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts +79 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.js +38 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +65 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +28 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +66 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts +19 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.js +26 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +26 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts +20 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +12 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +25 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts +61 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.js +158 -0
- package/dist/cli/ink-cli/components/renderers/index.d.ts +28 -0
- package/dist/cli/ink-cli/components/renderers/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/index.js +36 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts +38 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.js +362 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts +44 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.js +300 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts +185 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.js +1338 -0
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts +10 -0
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/processingPhrases.js +64 -0
- package/dist/cli/ink-cli/constants/tips.d.ts +15 -0
- package/dist/cli/ink-cli/constants/tips.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/tips.js +53 -0
- package/dist/cli/ink-cli/containers/InputContainer.d.ts +42 -8
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +513 -85
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +23 -5
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +1214 -132
- package/dist/cli/ink-cli/containers/index.d.ts +1 -1
- package/dist/cli/ink-cli/containers/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts +36 -0
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/KeypressContext.js +461 -0
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts +27 -0
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/MouseContext.js +102 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts +33 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.js +170 -0
- package/dist/cli/ink-cli/contexts/index.d.ts +7 -0
- package/dist/cli/ink-cli/contexts/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/index.js +6 -0
- package/dist/cli/ink-cli/hooks/index.d.ts +5 -0
- package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/index.js +6 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +26 -9
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +90 -198
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts +14 -0
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useBatchedScroll.js +25 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts +50 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useCLIState.js +190 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts +24 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.js +69 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts +61 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.js +210 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts +136 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +663 -0
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.js +7 -26
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts +18 -0
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useKeypress.js +26 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts +30 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.js +68 -0
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts +19 -0
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useStreaming.js +26 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts +14 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.js +31 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts +42 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.js +96 -0
- package/dist/cli/ink-cli/services/CommandService.d.ts +32 -1
- package/dist/cli/ink-cli/services/CommandService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/CommandService.js +36 -5
- package/dist/cli/ink-cli/services/InputService.d.ts +1 -5
- package/dist/cli/ink-cli/services/InputService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/InputService.js +1 -8
- package/dist/cli/ink-cli/services/index.d.ts +2 -1
- package/dist/cli/ink-cli/services/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/index.js +2 -1
- package/dist/cli/ink-cli/services/processStream.d.ts +69 -0
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -0
- package/dist/cli/ink-cli/services/processStream.js +742 -0
- package/dist/cli/ink-cli/state/actions.d.ts +30 -60
- package/dist/cli/ink-cli/state/actions.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/actions.js +3 -0
- package/dist/cli/ink-cli/state/index.d.ts +5 -3
- package/dist/cli/ink-cli/state/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/index.js +4 -3
- package/dist/cli/ink-cli/state/initialState.d.ts +4 -3
- package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/initialState.js +20 -4
- package/dist/cli/ink-cli/state/reducer.d.ts +3 -0
- package/dist/cli/ink-cli/state/reducer.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/reducer.js +62 -168
- package/dist/cli/ink-cli/state/streaming-state.d.ts +27 -0
- package/dist/cli/ink-cli/state/streaming-state.d.ts.map +1 -0
- package/dist/cli/ink-cli/state/streaming-state.js +39 -0
- package/dist/cli/ink-cli/state/types.d.ts +223 -6
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts +22 -0
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/bracketedPaste.js +27 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts +49 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.js +356 -0
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts +33 -0
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/commandOverlays.js +78 -0
- package/dist/cli/ink-cli/utils/debugLog.d.ts +38 -0
- package/dist/cli/ink-cli/utils/debugLog.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/debugLog.js +66 -0
- package/dist/cli/ink-cli/utils/index.d.ts +2 -1
- package/dist/cli/ink-cli/utils/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/index.js +3 -1
- package/dist/cli/ink-cli/utils/input.d.ts +25 -0
- package/dist/cli/ink-cli/utils/input.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/input.js +56 -0
- package/dist/cli/ink-cli/utils/inputParsing.d.ts +0 -9
- package/dist/cli/ink-cli/utils/inputParsing.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/inputParsing.js +0 -27
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +59 -3
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +348 -20
- package/dist/cli/ink-cli/utils/mouse.d.ts +61 -0
- package/dist/cli/ink-cli/utils/mouse.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/mouse.js +209 -0
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts +44 -0
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/streamSplitter.js +154 -0
- package/dist/cli/ink-cli/utils/textUtils.d.ts +63 -0
- package/dist/cli/ink-cli/utils/textUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/textUtils.js +248 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts +9 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/toolUtils.js +15 -0
- package/dist/cli/utils/api-key-setup.d.ts +54 -4
- package/dist/cli/utils/api-key-setup.d.ts.map +1 -1
- package/dist/cli/utils/api-key-setup.js +433 -107
- package/dist/cli/utils/api-key-verification.d.ts +17 -0
- package/dist/cli/utils/api-key-verification.d.ts.map +1 -0
- package/dist/cli/utils/api-key-verification.js +211 -0
- package/dist/cli/utils/config-validation.d.ts +22 -2
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +354 -25
- package/dist/cli/utils/local-model-setup.d.ts +46 -0
- package/dist/cli/utils/local-model-setup.d.ts.map +1 -0
- package/dist/cli/utils/local-model-setup.js +662 -0
- package/dist/cli/utils/options.d.ts.map +1 -1
- package/dist/cli/utils/options.js +1 -3
- package/dist/cli/utils/prompt-helpers.d.ts +47 -0
- package/dist/cli/utils/prompt-helpers.d.ts.map +1 -0
- package/dist/cli/utils/prompt-helpers.js +66 -0
- package/dist/cli/utils/provider-setup.d.ts +66 -8
- package/dist/cli/utils/provider-setup.d.ts.map +1 -1
- package/dist/cli/utils/provider-setup.js +324 -84
- package/dist/cli/utils/scaffolding-utils.d.ts +76 -0
- package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -0
- package/dist/cli/utils/scaffolding-utils.js +246 -0
- package/dist/cli/utils/setup-utils.d.ts +16 -0
- package/dist/cli/utils/setup-utils.d.ts.map +1 -1
- package/dist/cli/utils/setup-utils.js +72 -21
- package/dist/cli/utils/template-engine.d.ts +65 -0
- package/dist/cli/utils/template-engine.d.ts.map +1 -0
- package/dist/cli/utils/template-engine.js +1089 -0
- package/dist/config/cli-overrides.d.ts +45 -2
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +107 -10
- package/dist/index.js +379 -99
- package/dist/utils/agent-helpers.d.ts +95 -0
- package/dist/utils/agent-helpers.d.ts.map +1 -0
- package/dist/utils/agent-helpers.js +117 -0
- package/dist/webui/assets/index-8j-KMkX1.js +2054 -0
- package/dist/webui/assets/index-c_AX24V4.css +1 -0
- package/dist/webui/assets/{tanstack-DgxBONJY.js → tanstack-Br79RQ-n.js} +1 -1
- package/dist/webui/index.html +4 -10
- package/dist/webui/logos/aws-color.svg +1 -0
- package/dist/webui/logos/dexto/dexto_logo.svg +1 -1
- package/dist/webui/logos/dexto/dexto_logo_light.svg +6 -6
- package/dist/webui/logos/glama.svg +7 -0
- package/dist/webui/logos/litellm.svg +7 -0
- package/dist/webui/logos/openrouter.svg +1 -0
- package/package.json +18 -15
- package/dist/cli/commands/interactive-commands/index.d.ts +0 -63
- package/dist/cli/commands/interactive-commands/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/index.js +0 -73
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts +0 -34
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.js +0 -178
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts +0 -9
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.js +0 -325
- package/dist/cli/commands/interactive-commands/model/model-commands.d.ts +0 -21
- package/dist/cli/commands/interactive-commands/model/model-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/model/model-commands.js +0 -190
- package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts +0 -26
- package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/MultiLineTextInput.js +0 -220
- package/dist/discord/bot.d.ts +0 -4
- package/dist/discord/bot.d.ts.map +0 -1
- package/dist/discord/bot.js +0 -193
- package/dist/telegram/bot.d.ts +0 -5
- package/dist/telegram/bot.d.ts.map +0 -1
- package/dist/telegram/bot.js +0 -251
- package/dist/webui/assets/index-DKq5Xng1.js +0 -687
- package/dist/webui/assets/index-D_0_GBu5.css +0 -1
|
@@ -1,34 +1,116 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* ModelSelector Component (Refactored)
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Search filtering
|
|
6
|
+
* - Custom models support (add/edit/delete via arrow navigation)
|
|
6
7
|
*/
|
|
7
|
-
import { useState, useEffect } from 'react';
|
|
8
|
-
import { Text } from 'ink';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { useState, useEffect, forwardRef, useRef, useImperativeHandle, useMemo, useCallback, } from 'react';
|
|
9
|
+
import { Box, Text } from 'ink';
|
|
10
|
+
import { listOllamaModels, DEFAULT_OLLAMA_URL, getLocalModelById } from '@dexto/core';
|
|
11
|
+
import { loadCustomModels, deleteCustomModel, getAllInstalledModels, } from '@dexto/agent-management';
|
|
12
|
+
function isAddCustomOption(item) {
|
|
13
|
+
return 'type' in item && item.type === 'add-custom';
|
|
14
|
+
}
|
|
15
|
+
const MAX_VISIBLE_ITEMS = 10;
|
|
11
16
|
/**
|
|
12
|
-
* Model selector
|
|
13
|
-
* Provides data fetching and formatting only
|
|
17
|
+
* Model selector with search and custom model support
|
|
14
18
|
*/
|
|
15
|
-
|
|
19
|
+
const ModelSelector = forwardRef(function ModelSelector({ isVisible, onSelectModel, onClose, onAddCustomModel, onEditCustomModel, agent }, ref) {
|
|
16
20
|
const [models, setModels] = useState([]);
|
|
21
|
+
const [customModels, setCustomModels] = useState([]);
|
|
17
22
|
const [isLoading, setIsLoading] = useState(false);
|
|
18
23
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
19
|
-
|
|
24
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
25
|
+
const [scrollOffset, setScrollOffset] = useState(0);
|
|
26
|
+
const [customModelAction, setCustomModelAction] = useState(null);
|
|
27
|
+
const [pendingDeleteConfirm, setPendingDeleteConfirm] = useState(false);
|
|
28
|
+
const selectedIndexRef = useRef(selectedIndex);
|
|
29
|
+
const deleteTimeoutRef = useRef(null);
|
|
30
|
+
// Keep ref in sync
|
|
31
|
+
selectedIndexRef.current = selectedIndex;
|
|
32
|
+
// Clear delete confirmation timeout on unmount
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
return () => {
|
|
35
|
+
if (deleteTimeoutRef.current) {
|
|
36
|
+
clearTimeout(deleteTimeoutRef.current);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
// Fetch models from agent and load custom models
|
|
20
41
|
useEffect(() => {
|
|
21
42
|
if (!isVisible)
|
|
22
43
|
return;
|
|
23
44
|
let cancelled = false;
|
|
24
45
|
setIsLoading(true);
|
|
46
|
+
setSearchQuery('');
|
|
47
|
+
setSelectedIndex(0);
|
|
48
|
+
setScrollOffset(0);
|
|
49
|
+
setCustomModelAction(null);
|
|
50
|
+
setPendingDeleteConfirm(false);
|
|
51
|
+
if (deleteTimeoutRef.current) {
|
|
52
|
+
clearTimeout(deleteTimeoutRef.current);
|
|
53
|
+
deleteTimeoutRef.current = null;
|
|
54
|
+
}
|
|
25
55
|
const fetchModels = async () => {
|
|
26
56
|
try {
|
|
27
|
-
const allModels =
|
|
28
|
-
|
|
29
|
-
|
|
57
|
+
const [allModels, providers, currentConfig, loadedCustomModels] = await Promise.all([
|
|
58
|
+
Promise.resolve(agent.getSupportedModels()),
|
|
59
|
+
Promise.resolve(agent.getSupportedProviders()),
|
|
60
|
+
Promise.resolve(agent.getCurrentLLMConfig()),
|
|
61
|
+
loadCustomModels(),
|
|
62
|
+
]);
|
|
30
63
|
const modelList = [];
|
|
64
|
+
// Fetch dynamic models for local providers
|
|
65
|
+
let ollamaModels = [];
|
|
66
|
+
let localModels = [];
|
|
67
|
+
try {
|
|
68
|
+
ollamaModels = await listOllamaModels(DEFAULT_OLLAMA_URL);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
// Ollama not available, skip
|
|
72
|
+
agent.logger.debug('Ollama not available for model listing');
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
localModels = await getAllInstalledModels();
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
// Local models not available, skip
|
|
79
|
+
agent.logger.debug('Local models not available for listing');
|
|
80
|
+
}
|
|
81
|
+
// Add custom models first
|
|
82
|
+
for (const custom of loadedCustomModels) {
|
|
83
|
+
// Use provider from custom model, default to openai-compatible for legacy models
|
|
84
|
+
const customProvider = (custom.provider ?? 'openai-compatible');
|
|
85
|
+
const modelOption = {
|
|
86
|
+
provider: customProvider,
|
|
87
|
+
name: custom.name,
|
|
88
|
+
displayName: custom.displayName || custom.name,
|
|
89
|
+
maxInputTokens: custom.maxInputTokens || 128000,
|
|
90
|
+
isDefault: false,
|
|
91
|
+
isCurrent: currentConfig.provider === customProvider &&
|
|
92
|
+
currentConfig.model === custom.name,
|
|
93
|
+
isCustom: true,
|
|
94
|
+
};
|
|
95
|
+
if (custom.baseURL) {
|
|
96
|
+
modelOption.baseURL = custom.baseURL;
|
|
97
|
+
}
|
|
98
|
+
modelList.push(modelOption);
|
|
99
|
+
}
|
|
100
|
+
// Add registry models
|
|
31
101
|
for (const provider of providers) {
|
|
102
|
+
// Skip custom-only providers that don't have a static model list
|
|
103
|
+
// These are only accessible via the "Add custom model" wizard
|
|
104
|
+
if (provider === 'openai-compatible' ||
|
|
105
|
+
provider === 'openrouter' ||
|
|
106
|
+
provider === 'litellm' ||
|
|
107
|
+
provider === 'glama' ||
|
|
108
|
+
provider === 'bedrock')
|
|
109
|
+
continue;
|
|
110
|
+
// Skip ollama, local, and vertex - they'll be added dynamically below
|
|
111
|
+
if (provider === 'ollama' || provider === 'local' || provider === 'vertex') {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
32
114
|
const providerModels = allModels[provider];
|
|
33
115
|
for (const model of providerModels) {
|
|
34
116
|
modelList.push({
|
|
@@ -39,22 +121,70 @@ export default function ModelSelector({ isVisible, onSelectModel, onClose, agent
|
|
|
39
121
|
isDefault: model.isDefault,
|
|
40
122
|
isCurrent: provider === currentConfig.provider &&
|
|
41
123
|
model.name === currentConfig.model,
|
|
124
|
+
isCustom: false,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// Add Ollama models dynamically
|
|
129
|
+
for (const ollamaModel of ollamaModels) {
|
|
130
|
+
modelList.push({
|
|
131
|
+
provider: 'ollama',
|
|
132
|
+
name: ollamaModel.name,
|
|
133
|
+
displayName: ollamaModel.name,
|
|
134
|
+
maxInputTokens: 128000, // Default, actual varies by model
|
|
135
|
+
isDefault: false,
|
|
136
|
+
isCurrent: currentConfig.provider === 'ollama' &&
|
|
137
|
+
currentConfig.model === ollamaModel.name,
|
|
138
|
+
isCustom: false,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
// Add local models dynamically
|
|
142
|
+
for (const localModel of localModels) {
|
|
143
|
+
// Get display name from registry if available
|
|
144
|
+
const modelInfo = getLocalModelById(localModel.id);
|
|
145
|
+
const displayName = modelInfo?.name || localModel.id;
|
|
146
|
+
const maxInputTokens = modelInfo?.contextLength || 128000;
|
|
147
|
+
modelList.push({
|
|
148
|
+
provider: 'local',
|
|
149
|
+
name: localModel.id,
|
|
150
|
+
displayName,
|
|
151
|
+
maxInputTokens,
|
|
152
|
+
isDefault: false,
|
|
153
|
+
isCurrent: currentConfig.provider === 'local' &&
|
|
154
|
+
currentConfig.model === localModel.id,
|
|
155
|
+
isCustom: false,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
// Add Vertex AI models from registry
|
|
159
|
+
const vertexModels = allModels['vertex'];
|
|
160
|
+
if (vertexModels) {
|
|
161
|
+
for (const model of vertexModels) {
|
|
162
|
+
modelList.push({
|
|
163
|
+
provider: 'vertex',
|
|
164
|
+
name: model.name,
|
|
165
|
+
displayName: model.displayName,
|
|
166
|
+
maxInputTokens: model.maxInputTokens,
|
|
167
|
+
isDefault: model.isDefault,
|
|
168
|
+
isCurrent: currentConfig.provider === 'vertex' &&
|
|
169
|
+
currentConfig.model === model.name,
|
|
170
|
+
isCustom: false,
|
|
42
171
|
});
|
|
43
172
|
}
|
|
44
173
|
}
|
|
45
174
|
if (!cancelled) {
|
|
46
175
|
setModels(modelList);
|
|
176
|
+
setCustomModels(loadedCustomModels);
|
|
47
177
|
setIsLoading(false);
|
|
48
|
-
// Set initial selection to current model
|
|
178
|
+
// Set initial selection to current model (offset by 1 for "Add custom" option)
|
|
49
179
|
const currentIndex = modelList.findIndex((m) => m.isCurrent);
|
|
50
180
|
if (currentIndex >= 0) {
|
|
51
|
-
setSelectedIndex(currentIndex);
|
|
181
|
+
setSelectedIndex(currentIndex + 1); // +1 for "Add custom" at top
|
|
52
182
|
}
|
|
53
183
|
}
|
|
54
184
|
}
|
|
55
185
|
catch (error) {
|
|
56
186
|
if (!cancelled) {
|
|
57
|
-
logger.error(`Failed to fetch models: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
187
|
+
agent.logger.error(`Failed to fetch models: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
58
188
|
setModels([]);
|
|
59
189
|
setIsLoading(false);
|
|
60
190
|
}
|
|
@@ -65,11 +195,258 @@ export default function ModelSelector({ isVisible, onSelectModel, onClose, agent
|
|
|
65
195
|
cancelled = true;
|
|
66
196
|
};
|
|
67
197
|
}, [isVisible, agent]);
|
|
68
|
-
//
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
198
|
+
// Filter models based on search query
|
|
199
|
+
const filteredItems = useMemo(() => {
|
|
200
|
+
const addCustomOption = { type: 'add-custom' };
|
|
201
|
+
if (!searchQuery.trim()) {
|
|
202
|
+
return [addCustomOption, ...models];
|
|
203
|
+
}
|
|
204
|
+
const query = searchQuery.toLowerCase();
|
|
205
|
+
const filtered = models.filter((model) => {
|
|
206
|
+
const name = model.name.toLowerCase();
|
|
207
|
+
const displayName = (model.displayName || '').toLowerCase();
|
|
208
|
+
const provider = model.provider.toLowerCase();
|
|
209
|
+
return name.includes(query) || displayName.includes(query) || provider.includes(query);
|
|
210
|
+
});
|
|
211
|
+
// Always show "Add custom" when searching (user might want to add what they're searching for)
|
|
212
|
+
return [addCustomOption, ...filtered];
|
|
213
|
+
}, [models, searchQuery]);
|
|
214
|
+
// Adjust selected index when filter changes
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (selectedIndex >= filteredItems.length) {
|
|
217
|
+
setSelectedIndex(Math.max(0, filteredItems.length - 1));
|
|
218
|
+
}
|
|
219
|
+
}, [filteredItems.length, selectedIndex]);
|
|
220
|
+
// Calculate scroll offset
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
if (selectedIndex < scrollOffset) {
|
|
223
|
+
setScrollOffset(selectedIndex);
|
|
224
|
+
}
|
|
225
|
+
else if (selectedIndex >= scrollOffset + MAX_VISIBLE_ITEMS) {
|
|
226
|
+
setScrollOffset(selectedIndex - MAX_VISIBLE_ITEMS + 1);
|
|
227
|
+
}
|
|
228
|
+
}, [selectedIndex, scrollOffset]);
|
|
229
|
+
// Handle delete custom model
|
|
230
|
+
const handleDeleteCustomModel = useCallback(async (model) => {
|
|
231
|
+
if (!model.isCustom)
|
|
232
|
+
return;
|
|
233
|
+
try {
|
|
234
|
+
await deleteCustomModel(model.name);
|
|
235
|
+
// Refresh the list
|
|
236
|
+
const updated = await loadCustomModels();
|
|
237
|
+
setCustomModels(updated);
|
|
238
|
+
// Update models list
|
|
239
|
+
setModels((prev) => prev.filter((m) => !(m.isCustom && m.name === model.name)));
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
agent.logger.error(`Failed to delete custom model: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
243
|
+
}
|
|
244
|
+
}, [agent]);
|
|
245
|
+
// Helper to clear action state
|
|
246
|
+
const clearActionState = () => {
|
|
247
|
+
setCustomModelAction(null);
|
|
248
|
+
setPendingDeleteConfirm(false);
|
|
249
|
+
if (deleteTimeoutRef.current) {
|
|
250
|
+
clearTimeout(deleteTimeoutRef.current);
|
|
251
|
+
deleteTimeoutRef.current = null;
|
|
252
|
+
}
|
|
73
253
|
};
|
|
74
|
-
|
|
75
|
-
|
|
254
|
+
// Expose handleInput method via ref
|
|
255
|
+
useImperativeHandle(ref, () => ({
|
|
256
|
+
handleInput: (input, key) => {
|
|
257
|
+
if (!isVisible)
|
|
258
|
+
return false;
|
|
259
|
+
// Escape always works
|
|
260
|
+
if (key.escape) {
|
|
261
|
+
// If in action mode, just clear it first
|
|
262
|
+
if (customModelAction) {
|
|
263
|
+
clearActionState();
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
onClose();
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
const itemsLength = filteredItems.length;
|
|
270
|
+
const currentItem = filteredItems[selectedIndexRef.current];
|
|
271
|
+
const isOnCustomModel = currentItem && !isAddCustomOption(currentItem) && currentItem.isCustom;
|
|
272
|
+
// Right arrow - enter/advance action mode for custom models
|
|
273
|
+
if (key.rightArrow) {
|
|
274
|
+
if (!isOnCustomModel)
|
|
275
|
+
return false;
|
|
276
|
+
if (customModelAction === null) {
|
|
277
|
+
// Enter edit mode
|
|
278
|
+
setCustomModelAction('edit');
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
else if (customModelAction === 'edit') {
|
|
282
|
+
// Advance to delete mode
|
|
283
|
+
setCustomModelAction('delete');
|
|
284
|
+
setPendingDeleteConfirm(false);
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
else if (customModelAction === 'delete') {
|
|
288
|
+
// In delete mode, right arrow confirms deletion
|
|
289
|
+
if (pendingDeleteConfirm) {
|
|
290
|
+
// Second press - actually delete
|
|
291
|
+
if (deleteTimeoutRef.current) {
|
|
292
|
+
clearTimeout(deleteTimeoutRef.current);
|
|
293
|
+
deleteTimeoutRef.current = null;
|
|
294
|
+
}
|
|
295
|
+
clearActionState();
|
|
296
|
+
void handleDeleteCustomModel(currentItem);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
// First press in delete mode - set pending confirmation
|
|
300
|
+
setPendingDeleteConfirm(true);
|
|
301
|
+
if (deleteTimeoutRef.current) {
|
|
302
|
+
clearTimeout(deleteTimeoutRef.current);
|
|
303
|
+
}
|
|
304
|
+
deleteTimeoutRef.current = setTimeout(() => {
|
|
305
|
+
setPendingDeleteConfirm(false);
|
|
306
|
+
deleteTimeoutRef.current = null;
|
|
307
|
+
}, 3000); // 3 second timeout
|
|
308
|
+
}
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
// Left arrow - go back in action mode
|
|
313
|
+
if (key.leftArrow) {
|
|
314
|
+
if (customModelAction === 'delete') {
|
|
315
|
+
setCustomModelAction('edit');
|
|
316
|
+
setPendingDeleteConfirm(false);
|
|
317
|
+
if (deleteTimeoutRef.current) {
|
|
318
|
+
clearTimeout(deleteTimeoutRef.current);
|
|
319
|
+
deleteTimeoutRef.current = null;
|
|
320
|
+
}
|
|
321
|
+
return true;
|
|
322
|
+
}
|
|
323
|
+
else if (customModelAction === 'edit') {
|
|
324
|
+
setCustomModelAction(null);
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
// Handle character input for search
|
|
330
|
+
if (input && !key.return && !key.upArrow && !key.downArrow && !key.tab) {
|
|
331
|
+
// Any character input clears action state and adds to search
|
|
332
|
+
if (customModelAction) {
|
|
333
|
+
clearActionState();
|
|
334
|
+
}
|
|
335
|
+
// Backspace
|
|
336
|
+
if (key.backspace || key.delete) {
|
|
337
|
+
setSearchQuery((prev) => prev.slice(0, -1));
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
// Regular character - add to search
|
|
341
|
+
if (input.length === 1 && input.charCodeAt(0) >= 32) {
|
|
342
|
+
setSearchQuery((prev) => prev + input);
|
|
343
|
+
setSelectedIndex(0);
|
|
344
|
+
setScrollOffset(0);
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
// Backspace when no other input
|
|
349
|
+
if (key.backspace || key.delete) {
|
|
350
|
+
setSearchQuery((prev) => prev.slice(0, -1));
|
|
351
|
+
return true;
|
|
352
|
+
}
|
|
353
|
+
if (itemsLength === 0)
|
|
354
|
+
return false;
|
|
355
|
+
if (key.upArrow) {
|
|
356
|
+
// Clear action state on vertical navigation
|
|
357
|
+
if (customModelAction) {
|
|
358
|
+
clearActionState();
|
|
359
|
+
}
|
|
360
|
+
const nextIndex = (selectedIndexRef.current - 1 + itemsLength) % itemsLength;
|
|
361
|
+
setSelectedIndex(nextIndex);
|
|
362
|
+
selectedIndexRef.current = nextIndex;
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
if (key.downArrow) {
|
|
366
|
+
// Clear action state on vertical navigation
|
|
367
|
+
if (customModelAction) {
|
|
368
|
+
clearActionState();
|
|
369
|
+
}
|
|
370
|
+
const nextIndex = (selectedIndexRef.current + 1) % itemsLength;
|
|
371
|
+
setSelectedIndex(nextIndex);
|
|
372
|
+
selectedIndexRef.current = nextIndex;
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
if (key.return && itemsLength > 0) {
|
|
376
|
+
const item = filteredItems[selectedIndexRef.current];
|
|
377
|
+
if (item) {
|
|
378
|
+
if (isAddCustomOption(item)) {
|
|
379
|
+
onAddCustomModel();
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
// Handle action mode confirmations
|
|
383
|
+
if (customModelAction === 'edit' && item.isCustom) {
|
|
384
|
+
// Find the full custom model data
|
|
385
|
+
const customModel = customModels.find((cm) => cm.name === item.name &&
|
|
386
|
+
(cm.provider ?? 'openai-compatible') === item.provider);
|
|
387
|
+
if (customModel) {
|
|
388
|
+
onEditCustomModel(customModel);
|
|
389
|
+
}
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
if (customModelAction === 'delete' && item.isCustom) {
|
|
393
|
+
if (pendingDeleteConfirm) {
|
|
394
|
+
// Already confirmed, delete
|
|
395
|
+
clearActionState();
|
|
396
|
+
void handleDeleteCustomModel(item);
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
// Set pending confirmation
|
|
400
|
+
setPendingDeleteConfirm(true);
|
|
401
|
+
if (deleteTimeoutRef.current) {
|
|
402
|
+
clearTimeout(deleteTimeoutRef.current);
|
|
403
|
+
}
|
|
404
|
+
deleteTimeoutRef.current = setTimeout(() => {
|
|
405
|
+
setPendingDeleteConfirm(false);
|
|
406
|
+
deleteTimeoutRef.current = null;
|
|
407
|
+
}, 3000);
|
|
408
|
+
}
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
// Normal selection
|
|
412
|
+
onSelectModel(item.provider, item.name, item.displayName, item.baseURL);
|
|
413
|
+
return true;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return false;
|
|
417
|
+
},
|
|
418
|
+
}), [
|
|
419
|
+
isVisible,
|
|
420
|
+
filteredItems,
|
|
421
|
+
onClose,
|
|
422
|
+
onSelectModel,
|
|
423
|
+
onAddCustomModel,
|
|
424
|
+
onEditCustomModel,
|
|
425
|
+
customModelAction,
|
|
426
|
+
pendingDeleteConfirm,
|
|
427
|
+
customModels,
|
|
428
|
+
handleDeleteCustomModel,
|
|
429
|
+
]);
|
|
430
|
+
if (!isVisible)
|
|
431
|
+
return null;
|
|
432
|
+
if (isLoading) {
|
|
433
|
+
return (_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "gray", children: "Loading models..." }) }));
|
|
434
|
+
}
|
|
435
|
+
const visibleItems = filteredItems.slice(scrollOffset, scrollOffset + MAX_VISIBLE_ITEMS);
|
|
436
|
+
const hasCustomModels = customModels.length > 0;
|
|
437
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsxs(Text, { color: "cyan", bold: true, children: ["Select Model (", selectedIndex + 1, "/", filteredItems.length, ")"] }) }), _jsxs(Box, { paddingX: 0, paddingY: 0, children: [_jsx(Text, { color: "gray", children: "\u2191\u2193 navigate, Enter select, Esc close" }), hasCustomModels && _jsx(Text, { color: "gray", children: ", \u2192\u2190 for custom actions" })] }), _jsxs(Box, { paddingX: 0, paddingY: 0, children: [_jsx(Text, { color: "gray", children: "\uD83D\uDD0D " }), _jsx(Text, { color: searchQuery ? 'white' : 'gray', children: searchQuery || 'Type to search...' }), _jsx(Text, { color: "cyan", children: "\u258C" })] }), _jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: "gray", children: '─'.repeat(50) }) }), visibleItems.map((item, visibleIndex) => {
|
|
438
|
+
const actualIndex = scrollOffset + visibleIndex;
|
|
439
|
+
const isSelected = actualIndex === selectedIndex;
|
|
440
|
+
if (isAddCustomOption(item)) {
|
|
441
|
+
return (_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsx(Text, { color: isSelected ? 'green' : 'gray', bold: isSelected, children: "\u2795 Add custom model..." }) }, "add-custom"));
|
|
442
|
+
}
|
|
443
|
+
// Show action buttons for selected custom models
|
|
444
|
+
const showActions = isSelected && item.isCustom;
|
|
445
|
+
return (_jsxs(Box, { paddingX: 0, paddingY: 0, children: [item.isCustom && _jsx(Text, { color: isSelected ? 'orange' : 'gray', children: "\u2605 " }), _jsx(Text, { color: isSelected ? 'cyan' : 'gray', bold: isSelected, children: item.displayName || item.name }), _jsxs(Text, { color: isSelected ? 'white' : 'gray', children: [" (", item.provider, ")"] }), _jsxs(Text, { color: isSelected ? 'white' : 'gray', children: [' ', "\u2022 ", item.maxInputTokens.toLocaleString(), " tokens"] }), item.isDefault && (_jsx(Text, { color: isSelected ? 'white' : 'gray', children: " [DEFAULT]" })), item.isCurrent && !showActions && (_jsxs(Text, { color: isSelected ? 'cyan' : 'gray', bold: isSelected, children: [' ', "\u2190 Current"] })), showActions && (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsxs(Text, { color: customModelAction === 'edit' ? 'green' : 'gray', bold: customModelAction === 'edit', inverse: customModelAction === 'edit', children: [' ', "Edit", ' '] }), _jsx(Text, { children: " " }), _jsxs(Text, { color: customModelAction === 'delete' ? 'red' : 'gray', bold: customModelAction === 'delete', inverse: customModelAction === 'delete', children: [' ', "Delete", ' '] })] }))] }, `${item.provider}-${item.name}`));
|
|
446
|
+
}), filteredItems.length > MAX_VISIBLE_ITEMS && (_jsx(Box, { paddingX: 0, paddingY: 0, children: _jsxs(Text, { color: "gray", children: [scrollOffset > 0 ? '↑ more above' : '', scrollOffset > 0 && scrollOffset + MAX_VISIBLE_ITEMS < filteredItems.length
|
|
447
|
+
? ' | '
|
|
448
|
+
: '', scrollOffset + MAX_VISIBLE_ITEMS < filteredItems.length
|
|
449
|
+
? '↓ more below'
|
|
450
|
+
: ''] }) })), customModelAction === 'delete' && pendingDeleteConfirm && (_jsx(Box, { paddingX: 0, paddingY: 0, marginTop: 1, children: _jsx(Text, { color: "yellowBright", children: "\u26A0\uFE0F Press \u2192 or Enter again to confirm delete" }) })), customModelAction && !pendingDeleteConfirm && (_jsx(Box, { paddingX: 0, paddingY: 0, marginTop: 1, children: _jsxs(Text, { color: "gray", children: ["\u2190 ", customModelAction === 'edit' ? 'deselect' : 'edit', " | \u2192", ' ', customModelAction === 'edit' ? 'delete' : 'confirm', " | Enter", ' ', customModelAction] }) }))] }));
|
|
451
|
+
});
|
|
452
|
+
export default ModelSelector;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PromptAddChoice Component
|
|
3
|
+
* Choose between adding a per-agent prompt or a shared prompt
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { Key } from '../../hooks/useInputOrchestrator.js';
|
|
7
|
+
import type { PromptAddScope } from '../../state/types.js';
|
|
8
|
+
export type PromptAddChoiceResult = PromptAddScope | 'back';
|
|
9
|
+
interface PromptAddChoiceProps {
|
|
10
|
+
isVisible: boolean;
|
|
11
|
+
onSelect: (choice: PromptAddChoiceResult) => void;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
export interface PromptAddChoiceHandle {
|
|
15
|
+
handleInput: (input: string, key: Key) => boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* PromptAddChoice - select scope for new prompt
|
|
19
|
+
*/
|
|
20
|
+
declare const PromptAddChoice: React.ForwardRefExoticComponent<PromptAddChoiceProps & React.RefAttributes<PromptAddChoiceHandle>>;
|
|
21
|
+
export default PromptAddChoice;
|
|
22
|
+
//# sourceMappingURL=PromptAddChoice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PromptAddChoice.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/overlays/PromptAddChoice.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAuE,MAAM,OAAO,CAAC;AAE5F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG,MAAM,CAAC;AAE5D,UAAU,oBAAoB;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAClD,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IAClC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;CACrD;AA0BD;;GAEG;AACH,QAAA,MAAM,eAAe,oGA2DpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* PromptAddChoice Component
|
|
4
|
+
* Choose between adding a per-agent prompt or a shared prompt
|
|
5
|
+
*/
|
|
6
|
+
import { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react';
|
|
7
|
+
import { Box, Text } from 'ink';
|
|
8
|
+
import { BaseSelector } from '../base/BaseSelector.js';
|
|
9
|
+
const CHOICES = [
|
|
10
|
+
{
|
|
11
|
+
id: 'agent',
|
|
12
|
+
scope: 'agent',
|
|
13
|
+
label: 'For this agent only',
|
|
14
|
+
description: 'Stored in agent config directory',
|
|
15
|
+
recommended: true,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: 'shared',
|
|
19
|
+
scope: 'shared',
|
|
20
|
+
label: 'For all agents (shared)',
|
|
21
|
+
description: 'Stored in ~/.dexto/commands/',
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* PromptAddChoice - select scope for new prompt
|
|
26
|
+
*/
|
|
27
|
+
const PromptAddChoice = forwardRef(function PromptAddChoice({ isVisible, onSelect, onClose }, ref) {
|
|
28
|
+
const baseSelectorRef = useRef(null);
|
|
29
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
30
|
+
// Reset selection when becoming visible
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (isVisible) {
|
|
33
|
+
setSelectedIndex(0);
|
|
34
|
+
}
|
|
35
|
+
}, [isVisible]);
|
|
36
|
+
// Forward handleInput to BaseSelector
|
|
37
|
+
useImperativeHandle(ref, () => ({
|
|
38
|
+
handleInput: (input, key) => {
|
|
39
|
+
return baseSelectorRef.current?.handleInput(input, key) ?? false;
|
|
40
|
+
},
|
|
41
|
+
}), []);
|
|
42
|
+
// Format item for display
|
|
43
|
+
const formatItem = (item, isSelected) => {
|
|
44
|
+
return (_jsxs(Box, { children: [_jsx(Text, { color: isSelected ? 'cyan' : 'white', bold: isSelected, children: item.label }), item.recommended && (_jsx(Text, { color: isSelected ? 'green' : 'gray', children: " (Recommended)" })), _jsxs(Text, { color: "gray", children: [" \u00B7 ", item.description] })] }));
|
|
45
|
+
};
|
|
46
|
+
// Handle selection
|
|
47
|
+
const handleSelect = (item) => {
|
|
48
|
+
onSelect(item.scope);
|
|
49
|
+
};
|
|
50
|
+
return (_jsx(BaseSelector, { ref: baseSelectorRef, items: CHOICES, isVisible: isVisible, selectedIndex: selectedIndex, onSelectIndex: setSelectedIndex, onSelect: handleSelect, onClose: onClose, formatItem: formatItem, title: "Add Prompt", borderColor: "yellowBright", emptyMessage: "No options available" }));
|
|
51
|
+
});
|
|
52
|
+
export default PromptAddChoice;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PromptAddWizard Component
|
|
3
|
+
* Multi-step wizard for creating a new prompt
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { Key } from '../../hooks/useInputOrchestrator.js';
|
|
7
|
+
import type { PromptAddScope } from '../../state/types.js';
|
|
8
|
+
export interface NewPromptData {
|
|
9
|
+
name: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
argumentHint?: string;
|
|
13
|
+
content: string;
|
|
14
|
+
}
|
|
15
|
+
interface PromptAddWizardProps {
|
|
16
|
+
isVisible: boolean;
|
|
17
|
+
scope: PromptAddScope;
|
|
18
|
+
onComplete: (data: NewPromptData) => void;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
}
|
|
21
|
+
export interface PromptAddWizardHandle {
|
|
22
|
+
handleInput: (input: string, key: Key) => boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Multi-step wizard for creating a new prompt
|
|
26
|
+
*/
|
|
27
|
+
declare const PromptAddWizard: React.ForwardRefExoticComponent<PromptAddWizardProps & React.RefAttributes<PromptAddWizardHandle>>;
|
|
28
|
+
export default PromptAddWizard;
|
|
29
|
+
//# sourceMappingURL=PromptAddWizard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PromptAddWizard.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/overlays/PromptAddWizard.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA4E,MAAM,OAAO,CAAC;AAEjG,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACnB;AAuDD,UAAU,oBAAoB;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IAClC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;CACrD;AAED;;GAEG;AACH,QAAA,MAAM,eAAe,oGAuLpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|