dexto 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -22
- package/dist/agents/agent-registry.json +9 -0
- package/dist/agents/agent-template.yml +2 -2
- package/dist/agents/coding-agent/coding-agent.yml +27 -16
- package/dist/agents/database-agent/database-agent.yml +2 -2
- package/dist/agents/default-agent.yml +9 -7
- package/dist/agents/github-agent/github-agent.yml +2 -2
- package/dist/agents/product-name-researcher/product-name-researcher.yml +2 -2
- package/dist/agents/talk2pdf-agent/talk2pdf-agent.yml +2 -2
- package/dist/analytics/events.d.ts +13 -6
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/analytics/index.d.ts +1 -1
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +6 -2
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +65 -9
- package/dist/cli/cli-subscriber.d.ts +4 -0
- package/dist/cli/cli-subscriber.d.ts.map +1 -1
- package/dist/cli/cli-subscriber.js +47 -3
- package/dist/cli/commands/create-app.d.ts +16 -14
- package/dist/cli/commands/create-app.d.ts.map +1 -1
- package/dist/cli/commands/create-app.js +626 -102
- package/dist/cli/commands/create-image.d.ts +7 -0
- package/dist/cli/commands/create-image.d.ts.map +1 -0
- package/dist/cli/commands/create-image.js +201 -0
- package/dist/cli/commands/helpers/formatters.d.ts.map +1 -1
- package/dist/cli/commands/helpers/formatters.js +9 -8
- package/dist/cli/commands/index.d.ts +2 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -1
- package/dist/cli/commands/init-app.js +7 -7
- package/dist/cli/commands/install.d.ts +0 -3
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +19 -70
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +17 -14
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +7 -22
- package/dist/cli/commands/interactive-commands/commands.d.ts +4 -4
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.js +34 -42
- package/dist/cli/commands/interactive-commands/documentation-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/documentation-commands.js +4 -7
- package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/general-commands.js +159 -117
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts +9 -3
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/mcp/index.js +18 -3
- package/dist/cli/commands/interactive-commands/model/index.d.ts +8 -6
- package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/model/index.js +18 -6
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -2
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +77 -60
- package/dist/cli/commands/interactive-commands/session/index.d.ts +7 -12
- package/dist/cli/commands/interactive-commands/session/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/index.js +7 -14
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +10 -24
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/session-commands.js +16 -371
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts +1 -0
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +106 -77
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts +1 -1
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/tool-commands.js +5 -62
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts +13 -17
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/utils/command-output.js +18 -37
- package/dist/cli/commands/list-agents.d.ts +2 -2
- package/dist/cli/commands/list-agents.d.ts.map +1 -1
- package/dist/cli/commands/list-agents.js +38 -34
- package/dist/cli/commands/session-commands.js +16 -16
- package/dist/cli/commands/setup.d.ts +13 -5
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +860 -65
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/commands/uninstall.js +4 -6
- package/dist/cli/commands/which.d.ts.map +1 -1
- package/dist/cli/commands/which.js +18 -4
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts +9 -22
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +50 -133
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +26 -3
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +182 -45
- package/dist/cli/ink-cli/components/CustomInput.js +1 -1
- package/dist/cli/ink-cli/components/EditableMultiLineInput.js +4 -4
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts +22 -0
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/ElicitationForm.js +358 -0
- package/dist/cli/ink-cli/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ErrorBoundary.js +1 -1
- package/dist/cli/ink-cli/components/Footer.d.ts +16 -0
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/Footer.js +27 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts +17 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.js +8 -0
- package/dist/cli/ink-cli/components/MultiLineInput.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/MultiLineInput.js +3 -3
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts +15 -2
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +126 -82
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts +15 -2
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +228 -122
- package/dist/cli/ink-cli/components/StatusBar.d.ts +15 -2
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +50 -10
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts +52 -0
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/TextBufferInput.js +471 -0
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.js +4 -4
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts +11 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.js +90 -49
- package/dist/cli/ink-cli/components/chat/Footer.js +1 -1
- package/dist/cli/ink-cli/components/chat/Header.d.ts +1 -0
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/Header.js +6 -3
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts +3 -0
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +95 -9
- package/dist/cli/ink-cli/components/chat/MessageList.js +1 -1
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts +16 -0
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +27 -0
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +5 -3
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +21 -7
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +15 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +9 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +37 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +9 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +29 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts +45 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +38 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts +13 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.js +12 -0
- package/dist/cli/ink-cli/components/input/InputArea.d.ts +36 -8
- package/dist/cli/ink-cli/components/input/InputArea.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/input/InputArea.js +3 -3
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +25 -0
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +166 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +27 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +95 -0
- package/dist/cli/ink-cli/components/modes/index.d.ts +10 -0
- package/dist/cli/ink-cli/components/modes/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/index.js +9 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts +26 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +92 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +286 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +59 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +59 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts +26 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +73 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +51 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +215 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +74 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.js +52 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +28 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +84 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +109 -0
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +15 -8
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +400 -23
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +52 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +166 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts +27 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +119 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.js +144 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts +23 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +189 -0
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts +7 -2
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.js +19 -5
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +42 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.js +58 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +400 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.js +609 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts +15 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.js +14 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +419 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +29 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts +17 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.js +11 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +10 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts +30 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.js +13 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts +8 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.js +7 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts +79 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.js +38 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +65 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +28 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +66 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts +19 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.js +26 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +26 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts +20 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +12 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +25 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts +61 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.js +158 -0
- package/dist/cli/ink-cli/components/renderers/index.d.ts +28 -0
- package/dist/cli/ink-cli/components/renderers/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/index.js +36 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts +38 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.js +362 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts +44 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.js +300 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts +185 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.js +1338 -0
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts +10 -0
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/processingPhrases.js +64 -0
- package/dist/cli/ink-cli/constants/tips.d.ts +15 -0
- package/dist/cli/ink-cli/constants/tips.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/tips.js +53 -0
- package/dist/cli/ink-cli/containers/InputContainer.d.ts +42 -8
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +513 -85
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +23 -5
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +1214 -132
- package/dist/cli/ink-cli/containers/index.d.ts +1 -1
- package/dist/cli/ink-cli/containers/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts +36 -0
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/KeypressContext.js +461 -0
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts +27 -0
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/MouseContext.js +102 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts +33 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.js +170 -0
- package/dist/cli/ink-cli/contexts/index.d.ts +7 -0
- package/dist/cli/ink-cli/contexts/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/index.js +6 -0
- package/dist/cli/ink-cli/hooks/index.d.ts +5 -0
- package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/index.js +6 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +26 -9
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +90 -198
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts +14 -0
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useBatchedScroll.js +25 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts +50 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useCLIState.js +190 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts +24 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.js +69 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts +61 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.js +210 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts +136 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +663 -0
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.js +7 -26
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts +18 -0
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useKeypress.js +26 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts +30 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.js +68 -0
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts +19 -0
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useStreaming.js +26 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts +14 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.js +31 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts +42 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.js +96 -0
- package/dist/cli/ink-cli/services/CommandService.d.ts +32 -1
- package/dist/cli/ink-cli/services/CommandService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/CommandService.js +36 -5
- package/dist/cli/ink-cli/services/InputService.d.ts +1 -5
- package/dist/cli/ink-cli/services/InputService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/InputService.js +1 -8
- package/dist/cli/ink-cli/services/index.d.ts +2 -1
- package/dist/cli/ink-cli/services/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/index.js +2 -1
- package/dist/cli/ink-cli/services/processStream.d.ts +69 -0
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -0
- package/dist/cli/ink-cli/services/processStream.js +742 -0
- package/dist/cli/ink-cli/state/actions.d.ts +30 -60
- package/dist/cli/ink-cli/state/actions.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/actions.js +3 -0
- package/dist/cli/ink-cli/state/index.d.ts +5 -3
- package/dist/cli/ink-cli/state/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/index.js +4 -3
- package/dist/cli/ink-cli/state/initialState.d.ts +4 -3
- package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/initialState.js +20 -4
- package/dist/cli/ink-cli/state/reducer.d.ts +3 -0
- package/dist/cli/ink-cli/state/reducer.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/reducer.js +62 -168
- package/dist/cli/ink-cli/state/streaming-state.d.ts +27 -0
- package/dist/cli/ink-cli/state/streaming-state.d.ts.map +1 -0
- package/dist/cli/ink-cli/state/streaming-state.js +39 -0
- package/dist/cli/ink-cli/state/types.d.ts +223 -6
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts +22 -0
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/bracketedPaste.js +27 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts +49 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.js +356 -0
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts +33 -0
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/commandOverlays.js +78 -0
- package/dist/cli/ink-cli/utils/debugLog.d.ts +38 -0
- package/dist/cli/ink-cli/utils/debugLog.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/debugLog.js +66 -0
- package/dist/cli/ink-cli/utils/index.d.ts +2 -1
- package/dist/cli/ink-cli/utils/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/index.js +3 -1
- package/dist/cli/ink-cli/utils/input.d.ts +25 -0
- package/dist/cli/ink-cli/utils/input.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/input.js +56 -0
- package/dist/cli/ink-cli/utils/inputParsing.d.ts +0 -9
- package/dist/cli/ink-cli/utils/inputParsing.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/inputParsing.js +0 -27
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +59 -3
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +348 -20
- package/dist/cli/ink-cli/utils/mouse.d.ts +61 -0
- package/dist/cli/ink-cli/utils/mouse.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/mouse.js +209 -0
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts +44 -0
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/streamSplitter.js +154 -0
- package/dist/cli/ink-cli/utils/textUtils.d.ts +63 -0
- package/dist/cli/ink-cli/utils/textUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/textUtils.js +248 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts +9 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/toolUtils.js +15 -0
- package/dist/cli/utils/api-key-setup.d.ts +54 -4
- package/dist/cli/utils/api-key-setup.d.ts.map +1 -1
- package/dist/cli/utils/api-key-setup.js +433 -107
- package/dist/cli/utils/api-key-verification.d.ts +17 -0
- package/dist/cli/utils/api-key-verification.d.ts.map +1 -0
- package/dist/cli/utils/api-key-verification.js +211 -0
- package/dist/cli/utils/config-validation.d.ts +22 -2
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +354 -25
- package/dist/cli/utils/local-model-setup.d.ts +46 -0
- package/dist/cli/utils/local-model-setup.d.ts.map +1 -0
- package/dist/cli/utils/local-model-setup.js +662 -0
- package/dist/cli/utils/options.d.ts.map +1 -1
- package/dist/cli/utils/options.js +1 -3
- package/dist/cli/utils/prompt-helpers.d.ts +47 -0
- package/dist/cli/utils/prompt-helpers.d.ts.map +1 -0
- package/dist/cli/utils/prompt-helpers.js +66 -0
- package/dist/cli/utils/provider-setup.d.ts +66 -8
- package/dist/cli/utils/provider-setup.d.ts.map +1 -1
- package/dist/cli/utils/provider-setup.js +324 -84
- package/dist/cli/utils/scaffolding-utils.d.ts +76 -0
- package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -0
- package/dist/cli/utils/scaffolding-utils.js +246 -0
- package/dist/cli/utils/setup-utils.d.ts +16 -0
- package/dist/cli/utils/setup-utils.d.ts.map +1 -1
- package/dist/cli/utils/setup-utils.js +72 -21
- package/dist/cli/utils/template-engine.d.ts +65 -0
- package/dist/cli/utils/template-engine.d.ts.map +1 -0
- package/dist/cli/utils/template-engine.js +1089 -0
- package/dist/config/cli-overrides.d.ts +45 -2
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +107 -10
- package/dist/index.js +379 -99
- package/dist/utils/agent-helpers.d.ts +95 -0
- package/dist/utils/agent-helpers.d.ts.map +1 -0
- package/dist/utils/agent-helpers.js +117 -0
- package/dist/webui/assets/index-8j-KMkX1.js +2054 -0
- package/dist/webui/assets/index-c_AX24V4.css +1 -0
- package/dist/webui/assets/{tanstack-DgxBONJY.js → tanstack-Br79RQ-n.js} +1 -1
- package/dist/webui/index.html +4 -10
- package/dist/webui/logos/aws-color.svg +1 -0
- package/dist/webui/logos/dexto/dexto_logo.svg +1 -1
- package/dist/webui/logos/dexto/dexto_logo_light.svg +6 -6
- package/dist/webui/logos/glama.svg +7 -0
- package/dist/webui/logos/litellm.svg +7 -0
- package/dist/webui/logos/openrouter.svg +1 -0
- package/package.json +18 -15
- package/dist/cli/commands/interactive-commands/index.d.ts +0 -63
- package/dist/cli/commands/interactive-commands/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/index.js +0 -73
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts +0 -34
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.js +0 -178
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts +0 -9
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.js +0 -325
- package/dist/cli/commands/interactive-commands/model/model-commands.d.ts +0 -21
- package/dist/cli/commands/interactive-commands/model/model-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/model/model-commands.js +0 -190
- package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts +0 -26
- package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/MultiLineTextInput.js +0 -220
- package/dist/discord/bot.d.ts +0 -4
- package/dist/discord/bot.d.ts.map +0 -1
- package/dist/discord/bot.js +0 -193
- package/dist/telegram/bot.d.ts +0 -5
- package/dist/telegram/bot.d.ts.map +0 -1
- package/dist/telegram/bot.js +0 -251
- package/dist/webui/assets/index-DKq5Xng1.js +0 -687
- package/dist/webui/assets/index-D_0_GBu5.css +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* StaticCLI - Static pattern rendering mode
|
|
4
|
+
*
|
|
5
|
+
* Uses Ink's Static component for copy-friendly terminal output.
|
|
6
|
+
* Features:
|
|
7
|
+
* - Static component for finalized messages (rendered to terminal scrollback)
|
|
8
|
+
* - Native terminal scrolling and text selection
|
|
9
|
+
* - No mouse event interception
|
|
10
|
+
* - Simpler, more compatible with traditional terminal workflows
|
|
11
|
+
*
|
|
12
|
+
* Architecture:
|
|
13
|
+
* - `messages` = finalized messages → rendered in <Static> (permanent output)
|
|
14
|
+
* - `pendingMessages` = streaming/in-progress → rendered dynamically (redrawn)
|
|
15
|
+
* This prevents duplicate output when streaming completes.
|
|
16
|
+
*/
|
|
17
|
+
import { useMemo, useState, useEffect, useRef, useCallback } from 'react';
|
|
18
|
+
import { Box, Static, Text, useStdout } from 'ink';
|
|
19
|
+
// ANSI escape sequence to clear terminal (equivalent to ansiEscapes.clearTerminal)
|
|
20
|
+
const CLEAR_TERMINAL = '\x1B[2J\x1B[3J\x1B[H';
|
|
21
|
+
// Hooks
|
|
22
|
+
import { useCLIState } from '../../hooks/useCLIState.js';
|
|
23
|
+
import { useTerminalSize } from '../../hooks/useTerminalSize.js';
|
|
24
|
+
// Components
|
|
25
|
+
import { Header } from '../chat/Header.js';
|
|
26
|
+
import { MessageItem } from '../chat/MessageItem.js';
|
|
27
|
+
import { QueuedMessagesDisplay } from '../chat/QueuedMessagesDisplay.js';
|
|
28
|
+
import { StatusBar } from '../StatusBar.js';
|
|
29
|
+
import { HistorySearchBar } from '../HistorySearchBar.js';
|
|
30
|
+
import { Footer } from '../Footer.js';
|
|
31
|
+
// Containers
|
|
32
|
+
import { InputContainer } from '../../containers/InputContainer.js';
|
|
33
|
+
import { OverlayContainer } from '../../containers/OverlayContainer.js';
|
|
34
|
+
export function StaticCLI({ agent, initialSessionId, startupInfo, useStreaming = true, }) {
|
|
35
|
+
// Use shared CLI state (no keyboard scroll in Static mode)
|
|
36
|
+
const { messages, setMessages, pendingMessages, setPendingMessages, dequeuedBuffer, setDequeuedBuffer, queuedMessages, setQueuedMessages, ui, setUi, input, setInput, session, setSession, approval, setApproval, approvalQueue, setApprovalQueue, inputService, buffer, overlayContainerRef, visibleMessages, } = useCLIState({
|
|
37
|
+
agent,
|
|
38
|
+
initialSessionId,
|
|
39
|
+
startupInfo,
|
|
40
|
+
// No keyboard scroll handler - let terminal handle scrollback
|
|
41
|
+
});
|
|
42
|
+
// Terminal resize handling - clear and re-render Static content
|
|
43
|
+
const { write: stdoutWrite } = useStdout();
|
|
44
|
+
const { columns: terminalWidth } = useTerminalSize();
|
|
45
|
+
const [staticRemountKey, setStaticRemountKey] = useState(0);
|
|
46
|
+
const isInitialMount = useRef(true);
|
|
47
|
+
// Ref to InputContainer for programmatic submit
|
|
48
|
+
const inputContainerRef = useRef(null);
|
|
49
|
+
// Compute whether history search has a match (for HistorySearchBar indicator)
|
|
50
|
+
const historySearchHasMatch = useMemo(() => {
|
|
51
|
+
if (!ui.historySearch.isActive || !ui.historySearch.query)
|
|
52
|
+
return false;
|
|
53
|
+
const query = ui.historySearch.query.toLowerCase();
|
|
54
|
+
return input.history.some((item) => item.toLowerCase().includes(query));
|
|
55
|
+
}, [ui.historySearch.isActive, ui.historySearch.query, input.history]);
|
|
56
|
+
// Callback for OverlayContainer to submit prompt commands through InputContainer
|
|
57
|
+
const handleSubmitPromptCommand = useCallback(async (commandText) => {
|
|
58
|
+
try {
|
|
59
|
+
await inputContainerRef.current?.submit(commandText);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
agent.logger.error(`StaticCLI.handleSubmitPromptCommand failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
63
|
+
}
|
|
64
|
+
}, [agent]);
|
|
65
|
+
// Function to refresh static content (clear terminal and force re-render)
|
|
66
|
+
const refreshStatic = useCallback(() => {
|
|
67
|
+
stdoutWrite(CLEAR_TERMINAL);
|
|
68
|
+
setStaticRemountKey((prev) => prev + 1);
|
|
69
|
+
}, [stdoutWrite]);
|
|
70
|
+
// Handle terminal resize - debounced refresh of static content
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
// Skip initial mount to avoid unnecessary clear on startup
|
|
73
|
+
if (isInitialMount.current) {
|
|
74
|
+
isInitialMount.current = false;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
// Debounce resize handling (300ms)
|
|
78
|
+
const handler = setTimeout(() => {
|
|
79
|
+
refreshStatic();
|
|
80
|
+
}, 300);
|
|
81
|
+
return () => {
|
|
82
|
+
clearTimeout(handler);
|
|
83
|
+
};
|
|
84
|
+
}, [terminalWidth, refreshStatic]);
|
|
85
|
+
// Pre-render static items as JSX elements (Gemini pattern)
|
|
86
|
+
// Header + finalized messages go in <Static> (rendered once, permanent)
|
|
87
|
+
const staticItems = useMemo(() => {
|
|
88
|
+
const items = [
|
|
89
|
+
_jsx(Header, { modelName: session.modelName, sessionId: session.id || undefined, hasActiveSession: session.hasActiveSession, startupInfo: startupInfo }, "header"),
|
|
90
|
+
...visibleMessages.map((msg) => _jsx(MessageItem, { message: msg }, msg.id)),
|
|
91
|
+
];
|
|
92
|
+
return items;
|
|
93
|
+
}, [visibleMessages, session.modelName, session.id, session.hasActiveSession, startupInfo]);
|
|
94
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: staticItems, children: (item) => item }, staticRemountKey), pendingMessages.map((message) => (_jsx(MessageItem, { message: message }, message.id))), dequeuedBuffer.map((message) => (_jsx(MessageItem, { message: message }, message.id))), _jsxs(Box, { flexDirection: "column", flexShrink: 0, children: [_jsx(StatusBar, { agent: agent, isProcessing: ui.isProcessing, isThinking: ui.isThinking, approvalQueueCount: approvalQueue.length, copyModeEnabled: ui.copyModeEnabled, isAwaitingApproval: approval !== null }), _jsx(QueuedMessagesDisplay, { messages: queuedMessages }), _jsx(InputContainer, { ref: inputContainerRef, buffer: buffer, input: input, ui: ui, session: session, approval: approval, queuedMessages: queuedMessages, setInput: setInput, setUi: setUi, setSession: setSession, setMessages: setMessages, setPendingMessages: setPendingMessages, setDequeuedBuffer: setDequeuedBuffer, setQueuedMessages: setQueuedMessages, setApproval: setApproval, setApprovalQueue: setApprovalQueue, agent: agent, inputService: inputService, useStreaming: useStreaming }), _jsx(OverlayContainer, { ref: overlayContainerRef, ui: ui, input: input, session: session, approval: approval, setInput: setInput, setUi: setUi, setSession: setSession, setMessages: setMessages, setApproval: setApproval, setApprovalQueue: setApprovalQueue, agent: agent, inputService: inputService, buffer: buffer, refreshStatic: refreshStatic, onSubmitPromptCommand: handleSubmitPromptCommand }), ui.exitWarningShown && (_jsxs(Box, { paddingX: 1, children: [_jsx(Text, { color: "yellowBright", bold: true, children: "\u26A0 Press Ctrl+C again to exit" }), _jsx(Text, { color: "gray", children: " (or press any key to cancel)" })] })), _jsx(Footer, { modelName: session.modelName, cwd: process.cwd(), autoApproveEdits: ui.autoApproveEdits }), ui.historySearch.isActive && (_jsx(HistorySearchBar, { query: ui.historySearch.query, hasMatch: historySearchHasMatch }))] })] }));
|
|
95
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Rendering Modes
|
|
3
|
+
*
|
|
4
|
+
* Two rendering modes are available:
|
|
5
|
+
* - AlternateBufferCLI: VirtualizedList with mouse scroll, keyboard scroll, copy mode
|
|
6
|
+
* - StaticCLI: Static pattern with native terminal scrollback and selection
|
|
7
|
+
*/
|
|
8
|
+
export { AlternateBufferCLI } from './AlternateBufferCLI.js';
|
|
9
|
+
export { StaticCLI } from './StaticCLI.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/modes/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Rendering Modes
|
|
3
|
+
*
|
|
4
|
+
* Two rendering modes are available:
|
|
5
|
+
* - AlternateBufferCLI: VirtualizedList with mouse scroll, keyboard scroll, copy mode
|
|
6
|
+
* - StaticCLI: Static pattern with native terminal scrollback and selection
|
|
7
|
+
*/
|
|
8
|
+
export { AlternateBufferCLI } from './AlternateBufferCLI.js';
|
|
9
|
+
export { StaticCLI } from './StaticCLI.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ApiKeyInput Component
|
|
3
|
+
* Interactive overlay for entering API keys when switching to a provider without one
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { Key } from '../../hooks/useInputOrchestrator.js';
|
|
7
|
+
import type { LLMProvider } from '@dexto/core';
|
|
8
|
+
export interface ApiKeyInputProps {
|
|
9
|
+
isVisible: boolean;
|
|
10
|
+
provider: LLMProvider;
|
|
11
|
+
onSaved: (meta: {
|
|
12
|
+
provider: LLMProvider;
|
|
13
|
+
envVar: string;
|
|
14
|
+
}) => void;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
}
|
|
17
|
+
export interface ApiKeyInputHandle {
|
|
18
|
+
handleInput: (input: string, key: Key) => boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* API key input overlay - prompts user for API key when switching to a provider
|
|
22
|
+
* that doesn't have a configured key
|
|
23
|
+
*/
|
|
24
|
+
declare const ApiKeyInput: React.ForwardRefExoticComponent<ApiKeyInputProps & React.RefAttributes<ApiKeyInputHandle>>;
|
|
25
|
+
export default ApiKeyInput;
|
|
26
|
+
//# sourceMappingURL=ApiKeyInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiKeyInput.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/overlays/ApiKeyInput.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,WAAW,EAAE,MAAM,aAAa,CAAC;AAS/C,MAAM,WAAW,gBAAgB;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnE,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAC9B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;CACrD;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,4FA+Jf,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ApiKeyInput Component
|
|
4
|
+
* Interactive overlay for entering API keys when switching to a provider without one
|
|
5
|
+
*/
|
|
6
|
+
import { useState, useEffect, forwardRef, useImperativeHandle, useCallback } from 'react';
|
|
7
|
+
import { Box, Text } from 'ink';
|
|
8
|
+
import { getPrimaryApiKeyEnvVar, saveProviderApiKey } from '@dexto/agent-management';
|
|
9
|
+
import { applyLayeredEnvironmentLoading } from '../../../../utils/env.js';
|
|
10
|
+
import { getProviderDisplayName, isValidApiKeyFormat, getProviderInstructions, } from '../../../utils/provider-setup.js';
|
|
11
|
+
/**
|
|
12
|
+
* API key input overlay - prompts user for API key when switching to a provider
|
|
13
|
+
* that doesn't have a configured key
|
|
14
|
+
*/
|
|
15
|
+
const ApiKeyInput = forwardRef(function ApiKeyInput({ isVisible, provider, onSaved, onClose }, ref) {
|
|
16
|
+
const [apiKey, setApiKey] = useState('');
|
|
17
|
+
const [error, setError] = useState(null);
|
|
18
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
19
|
+
// Reset when becoming visible or provider changes
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (isVisible) {
|
|
22
|
+
setApiKey('');
|
|
23
|
+
setError(null);
|
|
24
|
+
setIsSaving(false);
|
|
25
|
+
}
|
|
26
|
+
}, [isVisible, provider]);
|
|
27
|
+
const handleSubmit = useCallback(async () => {
|
|
28
|
+
const trimmedKey = apiKey.trim();
|
|
29
|
+
// Validate
|
|
30
|
+
if (!trimmedKey) {
|
|
31
|
+
setError('API key is required');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!isValidApiKeyFormat(trimmedKey, provider)) {
|
|
35
|
+
setError(`Invalid ${getProviderDisplayName(provider)} API key format`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
setError(null);
|
|
39
|
+
setIsSaving(true);
|
|
40
|
+
try {
|
|
41
|
+
const meta = await saveProviderApiKey(provider, trimmedKey, process.cwd());
|
|
42
|
+
// Reload environment variables so the key is available
|
|
43
|
+
await applyLayeredEnvironmentLoading();
|
|
44
|
+
onSaved({ provider, envVar: meta.envVar });
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
setError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
|
|
48
|
+
setIsSaving(false);
|
|
49
|
+
}
|
|
50
|
+
}, [apiKey, provider, onSaved]);
|
|
51
|
+
// Handle keyboard input
|
|
52
|
+
useImperativeHandle(ref, () => ({
|
|
53
|
+
handleInput: (input, key) => {
|
|
54
|
+
if (!isVisible || isSaving)
|
|
55
|
+
return false;
|
|
56
|
+
// Escape to close
|
|
57
|
+
if (key.escape) {
|
|
58
|
+
onClose();
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
// Enter to submit
|
|
62
|
+
if (key.return) {
|
|
63
|
+
void handleSubmit();
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
// Backspace
|
|
67
|
+
if (key.backspace || key.delete) {
|
|
68
|
+
setApiKey((prev) => prev.slice(0, -1));
|
|
69
|
+
setError(null);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
// Regular character input
|
|
73
|
+
if (input && !key.ctrl && !key.meta) {
|
|
74
|
+
setApiKey((prev) => prev + input);
|
|
75
|
+
setError(null);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
},
|
|
80
|
+
}), [isVisible, isSaving, onClose, handleSubmit]);
|
|
81
|
+
if (!isVisible)
|
|
82
|
+
return null;
|
|
83
|
+
const providerName = getProviderDisplayName(provider);
|
|
84
|
+
const envVar = getPrimaryApiKeyEnvVar(provider);
|
|
85
|
+
const instructions = getProviderInstructions(provider);
|
|
86
|
+
// Mask the API key for display (show first 4 and last 4 chars)
|
|
87
|
+
const maskedKey = apiKey.length > 8
|
|
88
|
+
? `${apiKey.slice(0, 4)}${'*'.repeat(Math.min(apiKey.length - 8, 20))}${apiKey.slice(-4)}`
|
|
89
|
+
: '*'.repeat(apiKey.length);
|
|
90
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, marginTop: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { bold: true, color: "cyan", children: ["API Key Required for ", providerName] }) }), instructions && (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: _jsx(Text, { color: "gray", children: instructions.content }) })), _jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { color: "gray", children: "This key will be saved to " }), _jsx(Text, { color: "yellowBright", children: envVar }), _jsx(Text, { color: "gray", children: " in your .env file" })] }), _jsx(Box, { flexDirection: "column", children: _jsxs(Text, { bold: true, children: ["Enter your ", providerName, " API key:"] }) }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: "cyan", children: "> " }), _jsx(Text, { children: maskedKey }), !isSaving && _jsx(Text, { color: "cyan", children: "_" })] }), isSaving && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "yellowBright", children: "Saving API key..." }) })), error && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "red", children: error }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Enter to save \u2022 Esc to cancel" }) })] }));
|
|
91
|
+
});
|
|
92
|
+
export default ApiKeyInput;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CustomModelWizard Component
|
|
3
|
+
* Multi-step wizard for adding custom models (openai-compatible, openrouter, litellm, glama, bedrock)
|
|
4
|
+
*
|
|
5
|
+
* Architecture:
|
|
6
|
+
* - Provider configs centralized in ./custom-model-wizard/provider-config.ts
|
|
7
|
+
* - Shared UI components in ./custom-model-wizard/shared/
|
|
8
|
+
* - This file is the orchestrator - handles state, navigation, and keyboard input
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import type { Key } from '../../hooks/useInputOrchestrator.js';
|
|
12
|
+
import { type CustomModel } from '@dexto/agent-management';
|
|
13
|
+
interface CustomModelWizardProps {
|
|
14
|
+
isVisible: boolean;
|
|
15
|
+
onComplete: (model: CustomModel) => void;
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
/** Optional model to edit - if provided, form will be pre-populated */
|
|
18
|
+
initialModel?: CustomModel | null;
|
|
19
|
+
}
|
|
20
|
+
export interface CustomModelWizardHandle {
|
|
21
|
+
handleInput: (input: string, key: Key) => boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Multi-step wizard for custom model configuration.
|
|
25
|
+
* Uses data-driven provider configs instead of scattered conditionals.
|
|
26
|
+
*/
|
|
27
|
+
declare const CustomModelWizard: React.ForwardRefExoticComponent<CustomModelWizardProps & React.RefAttributes<CustomModelWizardHandle>>;
|
|
28
|
+
export default CustomModelWizard;
|
|
29
|
+
//# sourceMappingURL=CustomModelWizard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomModelWizard.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/overlays/CustomModelWizard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAIH,KAAK,WAAW,EAMnB,MAAM,yBAAyB,CAAC;AAmBjC,UAAU,sBAAsB;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,uEAAuE;IACvE,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB;IACpC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;CACrD;AAED;;;GAGG;AACH,QAAA,MAAM,iBAAiB,wGAqXtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* CustomModelWizard Component
|
|
4
|
+
* Multi-step wizard for adding custom models (openai-compatible, openrouter, litellm, glama, bedrock)
|
|
5
|
+
*
|
|
6
|
+
* Architecture:
|
|
7
|
+
* - Provider configs centralized in ./custom-model-wizard/provider-config.ts
|
|
8
|
+
* - Shared UI components in ./custom-model-wizard/shared/
|
|
9
|
+
* - This file is the orchestrator - handles state, navigation, and keyboard input
|
|
10
|
+
*/
|
|
11
|
+
import { useState, useEffect, forwardRef, useImperativeHandle, useCallback, useRef, } from 'react';
|
|
12
|
+
import { Box, Text } from 'ink';
|
|
13
|
+
import { saveCustomModel, deleteCustomModel, CUSTOM_MODEL_PROVIDERS, saveProviderApiKey, getProviderKeyStatus, resolveApiKeyForProvider, determineApiKeyStorage, } from '@dexto/agent-management';
|
|
14
|
+
import { logger } from '@dexto/core';
|
|
15
|
+
// Import from new modular architecture
|
|
16
|
+
import { getProviderConfig, getAvailableProviders, runAsyncValidation, } from './custom-model-wizard/provider-config.js';
|
|
17
|
+
import { ProviderSelector, WizardStepInput, SetupInfoBanner, ApiKeyStep, } from './custom-model-wizard/shared/index.js';
|
|
18
|
+
import LocalModelWizard from './custom-model-wizard/LocalModelWizard.js';
|
|
19
|
+
/**
|
|
20
|
+
* Multi-step wizard for custom model configuration.
|
|
21
|
+
* Uses data-driven provider configs instead of scattered conditionals.
|
|
22
|
+
*/
|
|
23
|
+
const CustomModelWizard = forwardRef(function CustomModelWizard({ isVisible, onComplete, onClose, initialModel }, ref) {
|
|
24
|
+
// Provider selection (step 0) then wizard steps
|
|
25
|
+
const [selectedProvider, setSelectedProvider] = useState(null);
|
|
26
|
+
const [providerIndex, setProviderIndex] = useState(0);
|
|
27
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
28
|
+
const [values, setValues] = useState({});
|
|
29
|
+
const [currentInput, setCurrentInput] = useState('');
|
|
30
|
+
const [error, setError] = useState(null);
|
|
31
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
32
|
+
const [isValidating, setIsValidating] = useState(false);
|
|
33
|
+
// Track original name when editing (to handle renames)
|
|
34
|
+
const [originalName, setOriginalName] = useState(null);
|
|
35
|
+
const isEditing = initialModel !== null && initialModel !== undefined;
|
|
36
|
+
// Ref for LocalModelWizard (specialized wizard for 'local' provider)
|
|
37
|
+
const localModelWizardRef = useRef(null);
|
|
38
|
+
// Get provider config (data-driven, no conditionals)
|
|
39
|
+
const providerConfig = selectedProvider ? getProviderConfig(selectedProvider) : null;
|
|
40
|
+
const wizardSteps = providerConfig?.steps ?? [];
|
|
41
|
+
const currentStepConfig = wizardSteps[currentStep];
|
|
42
|
+
// Reset when becoming visible
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (isVisible) {
|
|
45
|
+
if (initialModel) {
|
|
46
|
+
// Editing mode - pre-populate from initialModel
|
|
47
|
+
const provider = initialModel.provider ?? 'openai-compatible';
|
|
48
|
+
setSelectedProvider(provider);
|
|
49
|
+
setOriginalName(initialModel.name);
|
|
50
|
+
setValues({
|
|
51
|
+
name: initialModel.name,
|
|
52
|
+
baseURL: initialModel.baseURL ?? '',
|
|
53
|
+
displayName: initialModel.displayName ?? '',
|
|
54
|
+
maxInputTokens: initialModel.maxInputTokens?.toString() ?? '',
|
|
55
|
+
apiKey: initialModel.apiKey ?? '',
|
|
56
|
+
});
|
|
57
|
+
setCurrentStep(0);
|
|
58
|
+
setCurrentInput(initialModel.name);
|
|
59
|
+
setProviderIndex(CUSTOM_MODEL_PROVIDERS.indexOf(provider));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// Adding mode - reset everything
|
|
63
|
+
setSelectedProvider(null);
|
|
64
|
+
setOriginalName(null);
|
|
65
|
+
setProviderIndex(0);
|
|
66
|
+
setCurrentStep(0);
|
|
67
|
+
setValues({});
|
|
68
|
+
setCurrentInput('');
|
|
69
|
+
}
|
|
70
|
+
setError(null);
|
|
71
|
+
setIsSaving(false);
|
|
72
|
+
setIsValidating(false);
|
|
73
|
+
}
|
|
74
|
+
}, [isVisible, initialModel]);
|
|
75
|
+
const handleProviderSelect = useCallback(() => {
|
|
76
|
+
const provider = CUSTOM_MODEL_PROVIDERS[providerIndex];
|
|
77
|
+
if (provider) {
|
|
78
|
+
setSelectedProvider(provider);
|
|
79
|
+
setCurrentStep(0);
|
|
80
|
+
setCurrentInput('');
|
|
81
|
+
setError(null);
|
|
82
|
+
}
|
|
83
|
+
}, [providerIndex]);
|
|
84
|
+
const handleNext = useCallback(async () => {
|
|
85
|
+
if (!currentStepConfig || !selectedProvider || isSaving || isValidating)
|
|
86
|
+
return;
|
|
87
|
+
const value = currentInput.trim();
|
|
88
|
+
// Sync validation
|
|
89
|
+
if (currentStepConfig.validate) {
|
|
90
|
+
const validationError = currentStepConfig.validate(value);
|
|
91
|
+
if (validationError) {
|
|
92
|
+
setError(validationError);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else if (currentStepConfig.required && !value) {
|
|
97
|
+
setError(`${currentStepConfig.label} is required`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// Async validation (data-driven - no provider-specific conditionals)
|
|
101
|
+
const asyncError = await (async () => {
|
|
102
|
+
setIsValidating(true);
|
|
103
|
+
setError(null);
|
|
104
|
+
try {
|
|
105
|
+
return await runAsyncValidation(selectedProvider, currentStepConfig.field, value);
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
setIsValidating(false);
|
|
109
|
+
}
|
|
110
|
+
})();
|
|
111
|
+
if (asyncError) {
|
|
112
|
+
setError(asyncError);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// Save value
|
|
116
|
+
const newValues = { ...values, [currentStepConfig.field]: value };
|
|
117
|
+
setValues(newValues);
|
|
118
|
+
setError(null);
|
|
119
|
+
setCurrentInput('');
|
|
120
|
+
// Check if we're done
|
|
121
|
+
if (currentStep >= wizardSteps.length - 1) {
|
|
122
|
+
await saveModel(newValues);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const nextStep = currentStep + 1;
|
|
126
|
+
setCurrentStep(nextStep);
|
|
127
|
+
// Pre-populate next step from stored values (for edit mode)
|
|
128
|
+
const nextStepConfig = wizardSteps[nextStep];
|
|
129
|
+
const nextValue = nextStepConfig ? newValues[nextStepConfig.field] : undefined;
|
|
130
|
+
setCurrentInput(nextValue ?? '');
|
|
131
|
+
}
|
|
132
|
+
}, [
|
|
133
|
+
currentInput,
|
|
134
|
+
currentStep,
|
|
135
|
+
currentStepConfig,
|
|
136
|
+
isSaving,
|
|
137
|
+
isValidating,
|
|
138
|
+
selectedProvider,
|
|
139
|
+
values,
|
|
140
|
+
wizardSteps,
|
|
141
|
+
]);
|
|
142
|
+
/**
|
|
143
|
+
* Build and save the model using provider config's buildModel function.
|
|
144
|
+
*/
|
|
145
|
+
const saveModel = useCallback(async (finalValues) => {
|
|
146
|
+
if (!selectedProvider || !providerConfig)
|
|
147
|
+
return;
|
|
148
|
+
// Build model using provider config (no conditionals!)
|
|
149
|
+
const model = providerConfig.buildModel(finalValues, selectedProvider);
|
|
150
|
+
// Handle API key storage
|
|
151
|
+
const userEnteredKey = finalValues.apiKey?.trim();
|
|
152
|
+
const providerKeyStatus = getProviderKeyStatus(selectedProvider);
|
|
153
|
+
const existingProviderKey = resolveApiKeyForProvider(selectedProvider);
|
|
154
|
+
const keyStorage = determineApiKeyStorage(selectedProvider, userEnteredKey, providerKeyStatus.hasApiKey, existingProviderKey);
|
|
155
|
+
if (keyStorage.saveToProviderEnvVar && userEnteredKey) {
|
|
156
|
+
try {
|
|
157
|
+
await saveProviderApiKey(selectedProvider, userEnteredKey, process.cwd());
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
logger.warn(`Failed to save provider API key: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
161
|
+
// Fall back to per-model storage
|
|
162
|
+
keyStorage.saveAsPerModel = true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (keyStorage.saveAsPerModel && userEnteredKey) {
|
|
166
|
+
model.apiKey = userEnteredKey;
|
|
167
|
+
}
|
|
168
|
+
// Save to storage
|
|
169
|
+
setIsSaving(true);
|
|
170
|
+
try {
|
|
171
|
+
// If editing and name changed, delete the old model first
|
|
172
|
+
if (originalName && originalName !== model.name) {
|
|
173
|
+
try {
|
|
174
|
+
await deleteCustomModel(originalName);
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
// Log but continue - old model might already be deleted
|
|
178
|
+
logger.warn(`Failed to delete old model "${originalName}" during rename: ${err instanceof Error ? err.message : String(err)}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
await saveCustomModel(model);
|
|
182
|
+
onComplete(model);
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
logger.error(`Failed to save custom model: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
186
|
+
setError(`Failed to save: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
187
|
+
setIsSaving(false);
|
|
188
|
+
}
|
|
189
|
+
}, [selectedProvider, providerConfig, originalName, onComplete]);
|
|
190
|
+
const handleBack = useCallback(() => {
|
|
191
|
+
if (currentStep > 0) {
|
|
192
|
+
setCurrentStep(currentStep - 1);
|
|
193
|
+
// Restore previous value
|
|
194
|
+
const prevStep = wizardSteps[currentStep - 1];
|
|
195
|
+
if (prevStep) {
|
|
196
|
+
setCurrentInput(values[prevStep.field] || '');
|
|
197
|
+
}
|
|
198
|
+
setError(null);
|
|
199
|
+
}
|
|
200
|
+
else if (selectedProvider) {
|
|
201
|
+
// Go back to provider selection
|
|
202
|
+
setSelectedProvider(null);
|
|
203
|
+
setError(null);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
onClose();
|
|
207
|
+
}
|
|
208
|
+
}, [currentStep, onClose, selectedProvider, values, wizardSteps]);
|
|
209
|
+
// Handle keyboard input
|
|
210
|
+
useImperativeHandle(ref, () => ({
|
|
211
|
+
handleInput: (input, key) => {
|
|
212
|
+
if (!isVisible || isSaving || isValidating)
|
|
213
|
+
return false;
|
|
214
|
+
// Delegate to LocalModelWizard when local provider is selected
|
|
215
|
+
if (selectedProvider === 'local' && localModelWizardRef.current) {
|
|
216
|
+
return localModelWizardRef.current.handleInput(input, key);
|
|
217
|
+
}
|
|
218
|
+
// Escape to go back/close
|
|
219
|
+
if (key.escape) {
|
|
220
|
+
handleBack();
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
// Provider selection mode
|
|
224
|
+
if (!selectedProvider) {
|
|
225
|
+
const providers = getAvailableProviders();
|
|
226
|
+
if (key.upArrow) {
|
|
227
|
+
setProviderIndex((prev) => prev > 0 ? prev - 1 : providers.length - 1);
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
if (key.downArrow) {
|
|
231
|
+
setProviderIndex((prev) => prev < providers.length - 1 ? prev + 1 : 0);
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
if (key.return) {
|
|
235
|
+
handleProviderSelect();
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return true; // Consume all input during provider selection
|
|
239
|
+
}
|
|
240
|
+
// Wizard step mode
|
|
241
|
+
if (key.return) {
|
|
242
|
+
void handleNext();
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
// Backspace
|
|
246
|
+
if (key.backspace || key.delete) {
|
|
247
|
+
setCurrentInput((prev) => prev.slice(0, -1));
|
|
248
|
+
setError(null);
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
// Regular character input
|
|
252
|
+
if (input && !key.ctrl && !key.meta) {
|
|
253
|
+
setCurrentInput((prev) => prev + input);
|
|
254
|
+
setError(null);
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
return false;
|
|
258
|
+
},
|
|
259
|
+
}), [
|
|
260
|
+
isVisible,
|
|
261
|
+
isSaving,
|
|
262
|
+
isValidating,
|
|
263
|
+
handleBack,
|
|
264
|
+
handleNext,
|
|
265
|
+
handleProviderSelect,
|
|
266
|
+
selectedProvider,
|
|
267
|
+
]);
|
|
268
|
+
if (!isVisible)
|
|
269
|
+
return null;
|
|
270
|
+
// Provider selection screen (using shared component)
|
|
271
|
+
if (!selectedProvider) {
|
|
272
|
+
return _jsx(ProviderSelector, { selectedIndex: providerIndex, isEditing: isEditing });
|
|
273
|
+
}
|
|
274
|
+
// Local provider uses specialized wizard with download support
|
|
275
|
+
if (selectedProvider === 'local') {
|
|
276
|
+
return (_jsx(LocalModelWizard, { ref: localModelWizardRef, isVisible: isVisible, onComplete: onComplete, onClose: () => {
|
|
277
|
+
// Go back to provider selection instead of closing completely
|
|
278
|
+
setSelectedProvider(null);
|
|
279
|
+
} }));
|
|
280
|
+
}
|
|
281
|
+
// Wizard steps screen for other providers
|
|
282
|
+
if (!currentStepConfig || !providerConfig)
|
|
283
|
+
return null;
|
|
284
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "green", paddingX: 1, marginTop: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, color: "green", children: isEditing ? 'Edit Custom Model' : 'Add Custom Model' }), _jsxs(Text, { color: "gray", children: [' ', "(", providerConfig.displayName, ") Step ", currentStep + 1, "/", wizardSteps.length] })] }), providerConfig.setupInfo && currentStep === 0 && (_jsx(SetupInfoBanner, { title: providerConfig.setupInfo.title, description: providerConfig.setupInfo.description, docsUrl: providerConfig.setupInfo.docsUrl })), _jsx(WizardStepInput, { step: currentStepConfig, currentInput: currentInput, error: error, isValidating: isValidating, isSaving: isSaving, additionalContent: currentStepConfig.field === 'apiKey' ? (_jsx(ApiKeyStep, { provider: selectedProvider })) : undefined }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "gray", children: ["Enter to continue \u2022 Esc to", ' ', currentStep > 0 ? 'go back' : 'back to provider'] }) })] }));
|
|
285
|
+
});
|
|
286
|
+
export default CustomModelWizard;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LogLevelSelector Component
|
|
3
|
+
* Interactive selector for changing log level
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { Key } from '../../hooks/useInputOrchestrator.js';
|
|
7
|
+
import type { DextoAgent } from '@dexto/core';
|
|
8
|
+
interface LogLevelSelectorProps {
|
|
9
|
+
isVisible: boolean;
|
|
10
|
+
onSelect: (level: string) => void;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
agent: DextoAgent;
|
|
13
|
+
}
|
|
14
|
+
export interface LogLevelSelectorHandle {
|
|
15
|
+
handleInput: (input: string, key: Key) => boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Log level selector - thin wrapper around BaseSelector
|
|
19
|
+
*/
|
|
20
|
+
declare const LogLevelSelector: React.ForwardRefExoticComponent<LogLevelSelectorProps & React.RefAttributes<LogLevelSelectorHandle>>;
|
|
21
|
+
export default LogLevelSelector;
|
|
22
|
+
//# sourceMappingURL=LogLevelSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogLevelSelector.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/overlays/LogLevelSelector.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAuE,MAAM,OAAO,CAAC;AAE5F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,UAAU,qBAAqB;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACnC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;CACrD;AAkBD;;GAEG;AACH,QAAA,MAAM,gBAAgB,sGAyFrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* LogLevelSelector Component
|
|
4
|
+
* Interactive selector for changing log level
|
|
5
|
+
*/
|
|
6
|
+
import { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react';
|
|
7
|
+
import { Box, Text } from 'ink';
|
|
8
|
+
import { BaseSelector } from '../base/BaseSelector.js';
|
|
9
|
+
// Log levels matching DextoLogger's supported levels
|
|
10
|
+
const LOG_LEVELS = [
|
|
11
|
+
{ level: 'error', description: 'Errors only', icon: '❌' },
|
|
12
|
+
{ level: 'warn', description: 'Warnings and above', icon: '⚠️' },
|
|
13
|
+
{ level: 'info', description: 'Info and above (default)', icon: 'ℹ️' },
|
|
14
|
+
{ level: 'debug', description: 'Debug information', icon: '🔍' },
|
|
15
|
+
{ level: 'silly', description: 'Everything (most verbose)', icon: '🔬' },
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Log level selector - thin wrapper around BaseSelector
|
|
19
|
+
*/
|
|
20
|
+
const LogLevelSelector = forwardRef(function LogLevelSelector({ isVisible, onSelect, onClose, agent }, ref) {
|
|
21
|
+
const baseSelectorRef = useRef(null);
|
|
22
|
+
// Forward handleInput to BaseSelector
|
|
23
|
+
useImperativeHandle(ref, () => ({
|
|
24
|
+
handleInput: (input, key) => {
|
|
25
|
+
return baseSelectorRef.current?.handleInput(input, key) ?? false;
|
|
26
|
+
},
|
|
27
|
+
}), []);
|
|
28
|
+
const [levels, setLevels] = useState([]);
|
|
29
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
30
|
+
const [logFilePath, setLogFilePath] = useState(null);
|
|
31
|
+
// Build levels list with current indicator
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!isVisible) {
|
|
34
|
+
setLogFilePath(null);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Get current level from agent's logger (shared across all child loggers)
|
|
38
|
+
const currentLevel = agent.logger.getLevel();
|
|
39
|
+
const levelList = LOG_LEVELS.map((l) => ({
|
|
40
|
+
...l,
|
|
41
|
+
isCurrent: l.level === currentLevel,
|
|
42
|
+
}));
|
|
43
|
+
setLevels(levelList);
|
|
44
|
+
setLogFilePath(agent.logger.getLogFilePath());
|
|
45
|
+
// Set initial selection to current level
|
|
46
|
+
const currentIndex = levelList.findIndex((l) => l.isCurrent);
|
|
47
|
+
if (currentIndex >= 0) {
|
|
48
|
+
setSelectedIndex(currentIndex);
|
|
49
|
+
}
|
|
50
|
+
}, [isVisible, agent]);
|
|
51
|
+
// Format level item for display
|
|
52
|
+
const formatItem = (option, isSelected) => (_jsxs(_Fragment, { children: [_jsxs(Text, { children: [option.icon, " "] }), _jsx(Text, { color: isSelected ? 'cyan' : 'gray', bold: isSelected, children: option.level }), _jsxs(Text, { color: isSelected ? 'white' : 'gray', children: [" - ", option.description] }), option.isCurrent && (_jsxs(Text, { color: isSelected ? 'cyan' : 'gray', bold: isSelected, children: [' ', "\u2190 Current"] }))] }));
|
|
53
|
+
// Handle selection
|
|
54
|
+
const handleSelect = (option) => {
|
|
55
|
+
onSelect(option.level);
|
|
56
|
+
};
|
|
57
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(BaseSelector, { ref: baseSelectorRef, items: levels, isVisible: isVisible, isLoading: false, selectedIndex: selectedIndex, onSelectIndex: setSelectedIndex, onSelect: handleSelect, onClose: onClose, formatItem: formatItem, title: "Select Log Level", borderColor: "yellowBright", emptyMessage: "No log levels available" }), logFilePath && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "gray", children: ["\uD83D\uDCC1 Log file: ", logFilePath] }) }))] }));
|
|
58
|
+
});
|
|
59
|
+
export default LogLevelSelector;
|