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,471 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* TextBufferInput Component
|
|
4
|
+
*
|
|
5
|
+
* Buffer is passed as prop from parent.
|
|
6
|
+
* Uses direct useKeypress for input handling (no ref chain).
|
|
7
|
+
* Parent owns the buffer and can read values directly.
|
|
8
|
+
*/
|
|
9
|
+
import { useCallback, useRef, useEffect } from 'react';
|
|
10
|
+
import { Box, Text, useStdout } from 'ink';
|
|
11
|
+
import { useKeypress } from '../hooks/useKeypress.js';
|
|
12
|
+
import { readClipboardImage } from '../utils/clipboardUtils.js';
|
|
13
|
+
/** Threshold for collapsing pasted content */
|
|
14
|
+
const PASTE_COLLAPSE_LINE_THRESHOLD = 3;
|
|
15
|
+
const PASTE_COLLAPSE_CHAR_THRESHOLD = 150;
|
|
16
|
+
/** Platform-aware keyboard shortcut labels */
|
|
17
|
+
const isMac = process.platform === 'darwin';
|
|
18
|
+
const KEY_LABELS = {
|
|
19
|
+
ctrlT: isMac ? '⌃T' : 'Ctrl+T',
|
|
20
|
+
altUp: isMac ? '⌥↑' : 'Alt+Up',
|
|
21
|
+
altDown: isMac ? '⌥↓' : 'Alt+Down',
|
|
22
|
+
};
|
|
23
|
+
function isBackspaceKey(key) {
|
|
24
|
+
return key.name === 'backspace' || key.sequence === '\x7f' || key.sequence === '\x08';
|
|
25
|
+
}
|
|
26
|
+
function isForwardDeleteKey(key) {
|
|
27
|
+
return key.name === 'delete';
|
|
28
|
+
}
|
|
29
|
+
/** Renders text with optional query highlighting in green */
|
|
30
|
+
function HighlightedText({ text, query }) {
|
|
31
|
+
if (!query || !text) {
|
|
32
|
+
return _jsx(Text, { children: text });
|
|
33
|
+
}
|
|
34
|
+
const lowerText = text.toLowerCase();
|
|
35
|
+
const lowerQuery = query.toLowerCase();
|
|
36
|
+
const matchIndex = lowerText.indexOf(lowerQuery);
|
|
37
|
+
if (matchIndex === -1) {
|
|
38
|
+
return _jsx(Text, { children: text });
|
|
39
|
+
}
|
|
40
|
+
const before = text.slice(0, matchIndex);
|
|
41
|
+
const match = text.slice(matchIndex, matchIndex + query.length);
|
|
42
|
+
const after = text.slice(matchIndex + query.length);
|
|
43
|
+
return (_jsxs(Text, { children: [before, _jsx(Text, { color: "green", bold: true, children: match }), after] }));
|
|
44
|
+
}
|
|
45
|
+
export function TextBufferInput({ buffer, onSubmit, placeholder, isDisabled = false, onHistoryNavigate, onTriggerOverlay, maxViewportLines = 10, isActive, onKeyboardScroll, imageCount = 0, onImagePaste, images = [], onImageRemove, pastedBlocks = [], onPasteBlock, onPasteBlockUpdate, onPasteBlockRemove, highlightQuery, }) {
|
|
46
|
+
const { stdout } = useStdout();
|
|
47
|
+
const terminalWidth = stdout?.columns || 80;
|
|
48
|
+
// Use ref to track imageCount to avoid stale closure in async paste handler
|
|
49
|
+
const imageCountRef = useRef(imageCount);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
imageCountRef.current = imageCount;
|
|
52
|
+
}, [imageCount]);
|
|
53
|
+
// Use ref to track paste number for generating sequential IDs
|
|
54
|
+
const pasteCounterRef = useRef(pastedBlocks.length);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
// Update counter to be at least the current number of blocks
|
|
57
|
+
pasteCounterRef.current = Math.max(pasteCounterRef.current, pastedBlocks.length);
|
|
58
|
+
}, [pastedBlocks.length]);
|
|
59
|
+
// Check for removed image placeholders after text changes
|
|
60
|
+
const checkRemovedImages = useCallback(() => {
|
|
61
|
+
if (!onImageRemove || images.length === 0)
|
|
62
|
+
return;
|
|
63
|
+
const currentText = buffer.text;
|
|
64
|
+
for (const img of images) {
|
|
65
|
+
if (!currentText.includes(img.placeholder)) {
|
|
66
|
+
onImageRemove(img.id);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, [buffer, images, onImageRemove]);
|
|
70
|
+
// Check for removed paste block placeholders after text changes
|
|
71
|
+
const checkRemovedPasteBlocks = useCallback(() => {
|
|
72
|
+
if (!onPasteBlockRemove || pastedBlocks.length === 0)
|
|
73
|
+
return;
|
|
74
|
+
const currentText = buffer.text;
|
|
75
|
+
for (const block of pastedBlocks) {
|
|
76
|
+
// Check if either the placeholder or the full text (when expanded) is present
|
|
77
|
+
const textToFind = block.isCollapsed ? block.placeholder : block.fullText;
|
|
78
|
+
if (!currentText.includes(textToFind)) {
|
|
79
|
+
onPasteBlockRemove(block.id);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}, [buffer, pastedBlocks, onPasteBlockRemove]);
|
|
83
|
+
// Find the currently expanded paste block (only one can be expanded at a time)
|
|
84
|
+
const findExpandedBlock = useCallback(() => {
|
|
85
|
+
return pastedBlocks.find((block) => !block.isCollapsed) || null;
|
|
86
|
+
}, [pastedBlocks]);
|
|
87
|
+
// Find which collapsed paste block the cursor is on (by placeholder)
|
|
88
|
+
const findCollapsedBlockAtCursor = useCallback(() => {
|
|
89
|
+
if (pastedBlocks.length === 0)
|
|
90
|
+
return null;
|
|
91
|
+
const currentText = buffer.text;
|
|
92
|
+
const [cursorRow, cursorCol] = buffer.cursor;
|
|
93
|
+
const cursorOffset = getCursorPosition(buffer.lines, cursorRow, cursorCol);
|
|
94
|
+
for (const block of pastedBlocks) {
|
|
95
|
+
if (!block.isCollapsed)
|
|
96
|
+
continue; // Skip expanded blocks
|
|
97
|
+
const startIdx = currentText.indexOf(block.placeholder);
|
|
98
|
+
if (startIdx === -1)
|
|
99
|
+
continue;
|
|
100
|
+
const endIdx = startIdx + block.placeholder.length;
|
|
101
|
+
if (cursorOffset >= startIdx && cursorOffset <= endIdx) {
|
|
102
|
+
return block;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}, [buffer, pastedBlocks]);
|
|
107
|
+
// Handle Ctrl+T toggle:
|
|
108
|
+
// - If something is expanded: collapse it
|
|
109
|
+
// - If cursor is on a collapsed paste: expand it
|
|
110
|
+
const handlePasteToggle = useCallback(() => {
|
|
111
|
+
if (!onPasteBlockUpdate)
|
|
112
|
+
return;
|
|
113
|
+
const expandedBlock = findExpandedBlock();
|
|
114
|
+
const currentText = buffer.text;
|
|
115
|
+
// If something is expanded, collapse it
|
|
116
|
+
if (expandedBlock) {
|
|
117
|
+
// Normalize for comparison (buffer might have different line endings)
|
|
118
|
+
const normalizedCurrent = currentText.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
119
|
+
const normalizedFullText = expandedBlock.fullText
|
|
120
|
+
.replace(/\r\n/g, '\n')
|
|
121
|
+
.replace(/\r/g, '\n');
|
|
122
|
+
const startIdx = normalizedCurrent.indexOf(normalizedFullText);
|
|
123
|
+
if (startIdx === -1) {
|
|
124
|
+
// Fallback: just mark as collapsed without text replacement
|
|
125
|
+
// This handles edge cases where text was modified
|
|
126
|
+
onPasteBlockUpdate(expandedBlock.id, { isCollapsed: true });
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
// Replace full text with placeholder
|
|
130
|
+
const before = currentText.slice(0, startIdx);
|
|
131
|
+
const after = currentText.slice(startIdx + normalizedFullText.length);
|
|
132
|
+
const newText = before + expandedBlock.placeholder + after;
|
|
133
|
+
// Adjust cursor
|
|
134
|
+
const [cursorRow, cursorCol] = buffer.cursor;
|
|
135
|
+
const cursorOffset = getCursorPosition(buffer.lines, cursorRow, cursorCol);
|
|
136
|
+
let newCursorOffset = cursorOffset;
|
|
137
|
+
if (cursorOffset > startIdx) {
|
|
138
|
+
// Cursor is after the start of expanded block - adjust
|
|
139
|
+
const lengthDiff = expandedBlock.placeholder.length - normalizedFullText.length;
|
|
140
|
+
newCursorOffset = Math.max(startIdx, cursorOffset + lengthDiff);
|
|
141
|
+
}
|
|
142
|
+
buffer.setText(newText);
|
|
143
|
+
buffer.moveToOffset(Math.min(newCursorOffset, newText.length));
|
|
144
|
+
onPasteBlockUpdate(expandedBlock.id, { isCollapsed: true });
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// Otherwise, check if cursor is on a collapsed paste to expand
|
|
148
|
+
const collapsedBlock = findCollapsedBlockAtCursor();
|
|
149
|
+
if (collapsedBlock) {
|
|
150
|
+
const startIdx = currentText.indexOf(collapsedBlock.placeholder);
|
|
151
|
+
if (startIdx === -1)
|
|
152
|
+
return;
|
|
153
|
+
// Replace placeholder with full text
|
|
154
|
+
const before = currentText.slice(0, startIdx);
|
|
155
|
+
const after = currentText.slice(startIdx + collapsedBlock.placeholder.length);
|
|
156
|
+
const newText = before + collapsedBlock.fullText + after;
|
|
157
|
+
buffer.setText(newText);
|
|
158
|
+
// Move cursor to start of expanded content
|
|
159
|
+
buffer.moveToOffset(startIdx);
|
|
160
|
+
onPasteBlockUpdate(collapsedBlock.id, { isCollapsed: false });
|
|
161
|
+
}
|
|
162
|
+
}, [buffer, findExpandedBlock, findCollapsedBlockAtCursor, onPasteBlockUpdate]);
|
|
163
|
+
// Handle keyboard input directly - reads buffer state fresh each time
|
|
164
|
+
const handleKeypress = useCallback((key) => {
|
|
165
|
+
if (isDisabled)
|
|
166
|
+
return;
|
|
167
|
+
// Read buffer state directly - always fresh, no stale closures
|
|
168
|
+
const currentText = buffer.text;
|
|
169
|
+
const cursorVisualRow = buffer.visualCursor[0];
|
|
170
|
+
const visualLines = buffer.allVisualLines;
|
|
171
|
+
// === KEYBOARD SCROLL (PageUp/PageDown, Shift+arrows) ===
|
|
172
|
+
if (onKeyboardScroll) {
|
|
173
|
+
if (key.name === 'pageup' || (key.shift && key.name === 'up')) {
|
|
174
|
+
onKeyboardScroll('up');
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (key.name === 'pagedown' || (key.shift && key.name === 'down')) {
|
|
178
|
+
onKeyboardScroll('down');
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// === IMAGE PASTE (Ctrl+V) ===
|
|
183
|
+
// Check clipboard for image before letting normal paste through
|
|
184
|
+
if (key.ctrl && key.name === 'v' && onImagePaste) {
|
|
185
|
+
// Async clipboard check - fire and forget, don't block input
|
|
186
|
+
void (async () => {
|
|
187
|
+
try {
|
|
188
|
+
const clipboardImage = await readClipboardImage();
|
|
189
|
+
if (clipboardImage) {
|
|
190
|
+
// Use ref to get current count (avoids stale closure issue)
|
|
191
|
+
const currentCount = imageCountRef.current;
|
|
192
|
+
const imageNumber = currentCount + 1;
|
|
193
|
+
// Immediately increment ref to handle rapid pastes
|
|
194
|
+
imageCountRef.current = imageNumber;
|
|
195
|
+
const placeholder = `[Image ${imageNumber}]`;
|
|
196
|
+
const pendingImage = {
|
|
197
|
+
id: `img-${Date.now()}-${imageNumber}`,
|
|
198
|
+
data: clipboardImage.data,
|
|
199
|
+
mimeType: clipboardImage.mimeType,
|
|
200
|
+
placeholder,
|
|
201
|
+
};
|
|
202
|
+
onImagePaste(pendingImage);
|
|
203
|
+
buffer.insert(placeholder);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
// Clipboard read failed, ignore
|
|
208
|
+
}
|
|
209
|
+
})();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
// === NEWLINE DETECTION ===
|
|
213
|
+
const isCtrlJ = key.sequence === '\n';
|
|
214
|
+
const isShiftEnter = key.sequence === '\\\r' ||
|
|
215
|
+
(key.name === 'return' && key.shift) ||
|
|
216
|
+
key.sequence === '\x1b[13;2u' ||
|
|
217
|
+
key.sequence === '\x1bOM';
|
|
218
|
+
const isPasteReturn = key.name === 'return' && key.paste;
|
|
219
|
+
const wantsNewline = isCtrlJ || isShiftEnter || (key.name === 'return' && key.meta) || isPasteReturn;
|
|
220
|
+
if (wantsNewline) {
|
|
221
|
+
buffer.newline();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
// === SUBMIT (Enter) ===
|
|
225
|
+
if (key.name === 'return' && !key.paste) {
|
|
226
|
+
if (currentText.trim()) {
|
|
227
|
+
onSubmit(currentText);
|
|
228
|
+
}
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
// === UNDO/REDO ===
|
|
232
|
+
if (key.ctrl && key.name === 'z' && !key.shift) {
|
|
233
|
+
buffer.undo();
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if ((key.ctrl && key.name === 'y') || (key.ctrl && key.shift && key.name === 'z')) {
|
|
237
|
+
buffer.redo();
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
// === PASTE BLOCK TOGGLE (Ctrl+T) ===
|
|
241
|
+
if (key.ctrl && key.name === 't') {
|
|
242
|
+
handlePasteToggle();
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
// === BACKSPACE ===
|
|
246
|
+
if (isBackspaceKey(key) && !key.meta) {
|
|
247
|
+
const prevText = buffer.text;
|
|
248
|
+
const [cursorRow, cursorCol] = buffer.cursor;
|
|
249
|
+
const cursorPos = getCursorPosition(buffer.lines, cursorRow, cursorCol);
|
|
250
|
+
buffer.backspace();
|
|
251
|
+
checkRemovedImages();
|
|
252
|
+
checkRemovedPasteBlocks();
|
|
253
|
+
if (onTriggerOverlay && cursorPos > 0) {
|
|
254
|
+
const deletedChar = prevText[cursorPos - 1];
|
|
255
|
+
const newText = buffer.text;
|
|
256
|
+
if (deletedChar === '/' && cursorPos === 1) {
|
|
257
|
+
onTriggerOverlay('close');
|
|
258
|
+
}
|
|
259
|
+
else if (deletedChar === '@' && !newText.includes('@')) {
|
|
260
|
+
onTriggerOverlay('close');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
// === FORWARD DELETE ===
|
|
266
|
+
if (isForwardDeleteKey(key)) {
|
|
267
|
+
buffer.del();
|
|
268
|
+
checkRemovedImages();
|
|
269
|
+
checkRemovedPasteBlocks();
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
// === WORD DELETE ===
|
|
273
|
+
if (key.ctrl && key.name === 'w') {
|
|
274
|
+
buffer.deleteWordLeft();
|
|
275
|
+
checkRemovedImages();
|
|
276
|
+
checkRemovedPasteBlocks();
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (key.meta && isBackspaceKey(key)) {
|
|
280
|
+
buffer.deleteWordLeft();
|
|
281
|
+
checkRemovedImages();
|
|
282
|
+
checkRemovedPasteBlocks();
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
// === ARROW NAVIGATION ===
|
|
286
|
+
if (key.name === 'left') {
|
|
287
|
+
buffer.move(key.meta || key.ctrl ? 'wordLeft' : 'left');
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (key.name === 'right') {
|
|
291
|
+
buffer.move(key.meta || key.ctrl ? 'wordRight' : 'right');
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
// Cmd+Up: Move to start of input
|
|
295
|
+
if (key.meta && key.name === 'up') {
|
|
296
|
+
buffer.moveToOffset(0);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
// Cmd+Down: Move to end of input
|
|
300
|
+
if (key.meta && key.name === 'down') {
|
|
301
|
+
buffer.moveToOffset(currentText.length);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
if (key.name === 'up') {
|
|
305
|
+
// Only trigger history navigation when at top visual line
|
|
306
|
+
if (cursorVisualRow === 0 && onHistoryNavigate) {
|
|
307
|
+
onHistoryNavigate('up');
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
buffer.move('up');
|
|
311
|
+
}
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (key.name === 'down') {
|
|
315
|
+
// Only trigger history navigation when at bottom visual line
|
|
316
|
+
if (cursorVisualRow >= visualLines.length - 1 && onHistoryNavigate) {
|
|
317
|
+
onHistoryNavigate('down');
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
buffer.move('down');
|
|
321
|
+
}
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
// === LINE NAVIGATION ===
|
|
325
|
+
if (key.ctrl && key.name === 'a') {
|
|
326
|
+
buffer.move('home');
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (key.ctrl && key.name === 'e') {
|
|
330
|
+
buffer.move('end');
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (key.ctrl && key.name === 'k') {
|
|
334
|
+
buffer.killLineRight();
|
|
335
|
+
checkRemovedImages();
|
|
336
|
+
checkRemovedPasteBlocks();
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (key.ctrl && key.name === 'u') {
|
|
340
|
+
buffer.killLineLeft();
|
|
341
|
+
checkRemovedImages();
|
|
342
|
+
checkRemovedPasteBlocks();
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
// === WORD NAVIGATION ===
|
|
346
|
+
if (key.meta && key.name === 'b') {
|
|
347
|
+
buffer.move('wordLeft');
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (key.meta && key.name === 'f') {
|
|
351
|
+
buffer.move('wordRight');
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
// === CHARACTER INPUT ===
|
|
355
|
+
if (key.insertable && !key.ctrl && !key.meta) {
|
|
356
|
+
const [cursorRow, cursorCol] = buffer.cursor;
|
|
357
|
+
const cursorPos = getCursorPosition(buffer.lines, cursorRow, cursorCol);
|
|
358
|
+
// Check if this is a large paste that should be collapsed
|
|
359
|
+
if (key.paste && onPasteBlock) {
|
|
360
|
+
// Normalize line endings to \n for consistent handling
|
|
361
|
+
const pastedText = key.sequence.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
362
|
+
const lineCount = (pastedText.match(/\n/g)?.length ?? 0) + 1;
|
|
363
|
+
if (lineCount >= PASTE_COLLAPSE_LINE_THRESHOLD ||
|
|
364
|
+
pastedText.length > PASTE_COLLAPSE_CHAR_THRESHOLD) {
|
|
365
|
+
// Create collapsed paste block
|
|
366
|
+
pasteCounterRef.current += 1;
|
|
367
|
+
const pasteNumber = pasteCounterRef.current;
|
|
368
|
+
const placeholder = `[Paste ${pasteNumber}: ~${lineCount} lines]`;
|
|
369
|
+
const pasteBlock = {
|
|
370
|
+
id: `paste-${Date.now()}-${pasteNumber}`,
|
|
371
|
+
number: pasteNumber,
|
|
372
|
+
fullText: pastedText,
|
|
373
|
+
lineCount,
|
|
374
|
+
isCollapsed: true,
|
|
375
|
+
placeholder,
|
|
376
|
+
};
|
|
377
|
+
// Insert placeholder instead of full text
|
|
378
|
+
buffer.insert(placeholder);
|
|
379
|
+
onPasteBlock(pasteBlock);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
buffer.insert(key.sequence, { paste: key.paste });
|
|
384
|
+
if (onTriggerOverlay) {
|
|
385
|
+
if (key.sequence === '/' && cursorPos === 0) {
|
|
386
|
+
onTriggerOverlay('slash-autocomplete');
|
|
387
|
+
}
|
|
388
|
+
else if (key.sequence === '@') {
|
|
389
|
+
onTriggerOverlay('resource-autocomplete');
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}, [
|
|
394
|
+
buffer,
|
|
395
|
+
isDisabled,
|
|
396
|
+
onSubmit,
|
|
397
|
+
onHistoryNavigate,
|
|
398
|
+
onTriggerOverlay,
|
|
399
|
+
onKeyboardScroll,
|
|
400
|
+
// imageCount intentionally omitted - callback uses imageCountRef which is synced via useEffect
|
|
401
|
+
onImagePaste,
|
|
402
|
+
checkRemovedImages,
|
|
403
|
+
checkRemovedPasteBlocks,
|
|
404
|
+
handlePasteToggle,
|
|
405
|
+
onPasteBlock,
|
|
406
|
+
]);
|
|
407
|
+
// Subscribe to keypress events when active
|
|
408
|
+
useKeypress(handleKeypress, { isActive: isActive && !isDisabled });
|
|
409
|
+
// === RENDERING ===
|
|
410
|
+
// Read buffer state for rendering
|
|
411
|
+
const bufferText = buffer.text;
|
|
412
|
+
const visualCursor = buffer.visualCursor;
|
|
413
|
+
const visualLines = buffer.allVisualLines;
|
|
414
|
+
const cursorVisualRow = visualCursor[0];
|
|
415
|
+
const cursorVisualCol = visualCursor[1];
|
|
416
|
+
const separator = '─'.repeat(terminalWidth);
|
|
417
|
+
const totalLines = visualLines.length;
|
|
418
|
+
// Calculate visible window
|
|
419
|
+
let startLine = 0;
|
|
420
|
+
let endLine = totalLines;
|
|
421
|
+
if (totalLines > maxViewportLines) {
|
|
422
|
+
const halfViewport = Math.floor(maxViewportLines / 2);
|
|
423
|
+
startLine = Math.max(0, cursorVisualRow - halfViewport);
|
|
424
|
+
endLine = Math.min(totalLines, startLine + maxViewportLines);
|
|
425
|
+
if (endLine === totalLines) {
|
|
426
|
+
startLine = Math.max(0, totalLines - maxViewportLines);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
const visibleLines = visualLines.slice(startLine, endLine);
|
|
430
|
+
// Empty state
|
|
431
|
+
if (bufferText === '') {
|
|
432
|
+
return (_jsxs(Box, { flexDirection: "column", width: terminalWidth, children: [_jsx(Text, { color: "gray", children: separator }), _jsxs(Box, { width: terminalWidth, children: [_jsx(Text, { color: "green", bold: true, children: '> ' }), _jsx(Text, { inverse: true, children: " " }), placeholder && _jsx(Text, { color: "gray", children: placeholder }), _jsx(Text, { children: ' '.repeat(Math.max(0, terminalWidth - 3 - (placeholder?.length || 0))) })] }), _jsx(Text, { color: "gray", children: separator })] }));
|
|
433
|
+
}
|
|
434
|
+
return (_jsxs(Box, { flexDirection: "column", width: terminalWidth, children: [_jsx(Text, { color: "gray", children: separator }), startLine > 0 && (_jsxs(Text, { color: "gray", children: [' ', "\u2191 ", startLine, " more line", startLine > 1 ? 's' : '', " above (", KEY_LABELS.altUp, " to jump)"] })), visibleLines.map((line, idx) => {
|
|
435
|
+
const absoluteRow = startLine + idx;
|
|
436
|
+
const isFirst = absoluteRow === 0;
|
|
437
|
+
const prefix = isFirst ? '> ' : ' ';
|
|
438
|
+
const isCursorLine = absoluteRow === cursorVisualRow;
|
|
439
|
+
if (!isCursorLine) {
|
|
440
|
+
return (_jsxs(Box, { width: terminalWidth, children: [_jsx(Text, { color: "green", bold: isFirst, children: prefix }), _jsx(HighlightedText, { text: line, query: highlightQuery }), _jsx(Text, { children: ' '.repeat(Math.max(0, terminalWidth - prefix.length - line.length)) })] }, absoluteRow));
|
|
441
|
+
}
|
|
442
|
+
const before = line.slice(0, cursorVisualCol);
|
|
443
|
+
const atCursor = line.charAt(cursorVisualCol) || ' ';
|
|
444
|
+
const after = line.slice(cursorVisualCol + 1);
|
|
445
|
+
return (_jsxs(Box, { width: terminalWidth, children: [_jsx(Text, { color: "green", bold: isFirst, children: prefix }), _jsx(HighlightedText, { text: before, query: highlightQuery }), _jsx(Text, { inverse: true, children: atCursor }), _jsx(HighlightedText, { text: after, query: highlightQuery }), _jsx(Text, { children: ' '.repeat(Math.max(0, terminalWidth - prefix.length - before.length - 1 - after.length)) })] }, absoluteRow));
|
|
446
|
+
}), endLine < totalLines && (_jsxs(Text, { color: "gray", children: [' ', "\u2193 ", totalLines - endLine, " more line", totalLines - endLine > 1 ? 's' : '', ' ', "below (", KEY_LABELS.altDown, " to jump)"] })), pastedBlocks.length > 0 && (_jsx(PasteBlockHint, { pastedBlocks: pastedBlocks, expandedBlock: findExpandedBlock(), cursorOnCollapsed: findCollapsedBlockAtCursor() })), _jsx(Text, { color: "gray", children: separator })] }));
|
|
447
|
+
}
|
|
448
|
+
/** Hint component for paste blocks */
|
|
449
|
+
function PasteBlockHint({ pastedBlocks, expandedBlock, cursorOnCollapsed, }) {
|
|
450
|
+
const collapsedCount = pastedBlocks.filter((b) => b.isCollapsed).length;
|
|
451
|
+
// If something is expanded, always show collapse hint
|
|
452
|
+
if (expandedBlock) {
|
|
453
|
+
return (_jsxs(Text, { color: "cyan", children: [' ', KEY_LABELS.ctrlT, " to collapse expanded paste"] }));
|
|
454
|
+
}
|
|
455
|
+
// If cursor is on a collapsed paste, show expand hint
|
|
456
|
+
if (cursorOnCollapsed) {
|
|
457
|
+
return (_jsxs(Text, { color: "cyan", children: [' ', KEY_LABELS.ctrlT, " to expand paste"] }));
|
|
458
|
+
}
|
|
459
|
+
// Otherwise show count of collapsed pastes
|
|
460
|
+
if (collapsedCount > 0) {
|
|
461
|
+
return (_jsxs(Text, { color: "gray", children: [' ', collapsedCount, " collapsed paste", collapsedCount > 1 ? 's' : '', " (", KEY_LABELS.ctrlT, ' ', "on placeholder to expand)"] }));
|
|
462
|
+
}
|
|
463
|
+
return null;
|
|
464
|
+
}
|
|
465
|
+
function getCursorPosition(lines, cursorRow, cursorCol) {
|
|
466
|
+
let pos = 0;
|
|
467
|
+
for (let i = 0; i < cursorRow; i++) {
|
|
468
|
+
pos += (lines[i]?.length ?? 0) + 1;
|
|
469
|
+
}
|
|
470
|
+
return pos + cursorCol;
|
|
471
|
+
}
|
|
@@ -82,17 +82,17 @@ export function BaseAutocomplete({ items, query, isVisible, isLoading = false, o
|
|
|
82
82
|
if (!isVisible)
|
|
83
83
|
return null;
|
|
84
84
|
if (isLoading) {
|
|
85
|
-
return (_jsx(Box, { borderStyle: "single", borderColor: "gray", paddingX: 1, paddingY: 1, children: _jsx(Text, {
|
|
85
|
+
return (_jsx(Box, { borderStyle: "single", borderColor: "gray", paddingX: 1, paddingY: 1, children: _jsx(Text, { color: "gray", children: loadingMessage }) }));
|
|
86
86
|
}
|
|
87
87
|
if (filteredItems.length === 0) {
|
|
88
|
-
return (_jsx(Box, { borderStyle: "single", borderColor: "gray", paddingX: 1, paddingY: 1, children: _jsx(Text, {
|
|
88
|
+
return (_jsx(Box, { borderStyle: "single", borderColor: "gray", paddingX: 1, paddingY: 1, children: _jsx(Text, { color: "gray", children: emptyMessage }) }));
|
|
89
89
|
}
|
|
90
90
|
const hasMoreAbove = scrollOffset > 0;
|
|
91
91
|
const hasMoreBelow = scrollOffset + maxVisibleItems < filteredItems.length;
|
|
92
92
|
const totalItems = filteredItems.length;
|
|
93
|
-
return (_jsxs(Box, { borderStyle: "single", borderColor: borderColor, flexDirection: "column", height: Math.min(maxVisibleItems + 3, totalItems + 3), children: [_jsx(Box, { paddingX: 1, paddingY: 0, children: _jsxs(Text, {
|
|
93
|
+
return (_jsxs(Box, { borderStyle: "single", borderColor: borderColor, flexDirection: "column", height: Math.min(maxVisibleItems + 3, totalItems + 3), children: [_jsx(Box, { paddingX: 1, paddingY: 0, children: _jsxs(Text, { color: "gray", children: [title, " (", selectedIndex + 1, "/", totalItems, ") - \u2191\u2193 navigate", onLoadIntoInput && ', Tab load', ', Enter select, Esc close'] }) }), hasMoreAbove && (_jsx(Box, { paddingX: 1, paddingY: 0, children: _jsxs(Text, { color: "gray", children: ["... \u2191 (", scrollOffset, " more above)"] }) })), visibleItems.map((item, visibleIndex) => {
|
|
94
94
|
const actualIndex = scrollOffset + visibleIndex;
|
|
95
95
|
const isSelected = actualIndex === selectedIndex;
|
|
96
96
|
return (_jsx(Box, { paddingX: 1, paddingY: 0, children: formatItem(item, isSelected) }, actualIndex));
|
|
97
|
-
}), hasMoreBelow && (_jsx(Box, { paddingX: 1, paddingY: 0, children: _jsxs(Text, {
|
|
97
|
+
}), hasMoreBelow && (_jsx(Box, { paddingX: 1, paddingY: 0, children: _jsxs(Text, { color: "gray", children: ["... \u2193 (", totalItems - scrollOffset - maxVisibleItems, " more below)"] }) }))] }));
|
|
98
98
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Used by ModelSelector and SessionSelector
|
|
5
5
|
*/
|
|
6
6
|
import { type ReactNode } from 'react';
|
|
7
|
+
import type { Key } from '../../hooks/useInputOrchestrator.js';
|
|
7
8
|
export interface BaseSelectorProps<T> {
|
|
8
9
|
items: T[];
|
|
9
10
|
isVisible: boolean;
|
|
@@ -18,9 +19,18 @@ export interface BaseSelectorProps<T> {
|
|
|
18
19
|
loadingMessage?: string;
|
|
19
20
|
emptyMessage?: string;
|
|
20
21
|
borderColor?: string;
|
|
22
|
+
onTab?: (item: T) => void;
|
|
23
|
+
supportsTab?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface BaseSelectorHandle {
|
|
26
|
+
handleInput: (input: string, key: Key) => boolean;
|
|
21
27
|
}
|
|
22
28
|
/**
|
|
23
29
|
* Generic selector component with keyboard navigation and scrolling
|
|
24
30
|
*/
|
|
25
|
-
|
|
31
|
+
declare function BaseSelectorInner<T>({ items, isVisible, isLoading, selectedIndex, onSelectIndex, onSelect, onClose, formatItem, title, maxVisibleItems, loadingMessage, emptyMessage, borderColor, onTab, supportsTab, }: BaseSelectorProps<T>, ref: React.Ref<BaseSelectorHandle>): import("react/jsx-runtime").JSX.Element | null;
|
|
32
|
+
export declare const BaseSelector: <T>(props: BaseSelectorProps<T> & {
|
|
33
|
+
ref?: React.Ref<BaseSelectorHandle>;
|
|
34
|
+
}) => ReturnType<typeof BaseSelectorInner>;
|
|
35
|
+
export {};
|
|
26
36
|
//# sourceMappingURL=BaseSelector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSelector.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/base/BaseSelector.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"BaseSelector.d.ts","sourceRoot":"","sources":["../../../../../src/cli/ink-cli/components/base/BaseSelector.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAQH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAE/D,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAChC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,KAAK,SAAS,CAAC;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IAC/B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;CACrD;AAED;;GAEG;AACH,iBAAS,iBAAiB,CAAC,CAAC,EACxB,EACI,KAAK,EACL,SAAS,EACT,SAAiB,EACjB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,OAAO,EACP,UAAU,EACV,KAAK,EACL,eAAmB,EACnB,cAA6B,EAC7B,YAA+B,EAC/B,WAAoB,EACpB,KAAK,EACL,WAAmB,GACtB,EAAE,iBAAiB,CAAC,CAAC,CAAC,EACvB,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,kDAyJrC;AAGD,eAAO,MAAM,YAAY,EAAoC,CAAC,CAAC,EAC3D,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;CAAE,KACpE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|