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,663 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Input Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Single point of keyboard input handling for the entire ink-cli.
|
|
5
|
+
* Routes keystrokes based on focus state to prevent conflicts.
|
|
6
|
+
*
|
|
7
|
+
* Focus Priority (highest to lowest):
|
|
8
|
+
* 1. Approval prompt (when visible)
|
|
9
|
+
* 2. Active overlay (selector/autocomplete)
|
|
10
|
+
* 3. Global shortcuts (Ctrl+C, Escape - handled specially)
|
|
11
|
+
* 4. Main text input (default)
|
|
12
|
+
*
|
|
13
|
+
* Mouse scroll events are handled separately by ScrollProvider.
|
|
14
|
+
*/
|
|
15
|
+
import { useEffect, useRef, useCallback } from 'react';
|
|
16
|
+
import { useApp } from 'ink';
|
|
17
|
+
import { useKeypress } from './useKeypress.js';
|
|
18
|
+
import { enableMouseEvents, disableMouseEvents } from '../utils/mouse.js';
|
|
19
|
+
import { generateMessageId } from '../utils/idGenerator.js';
|
|
20
|
+
/** Time window for double Ctrl+C to exit (in milliseconds) */
|
|
21
|
+
const EXIT_WARNING_TIMEOUT = 3000;
|
|
22
|
+
/**
|
|
23
|
+
* Convert our KeypressContext Key to Ink-compatible Key
|
|
24
|
+
*/
|
|
25
|
+
function convertKey(rawKey) {
|
|
26
|
+
const key = {
|
|
27
|
+
upArrow: rawKey.name === 'up',
|
|
28
|
+
downArrow: rawKey.name === 'down',
|
|
29
|
+
leftArrow: rawKey.name === 'left',
|
|
30
|
+
rightArrow: rawKey.name === 'right',
|
|
31
|
+
pageUp: rawKey.name === 'pageup',
|
|
32
|
+
pageDown: rawKey.name === 'pagedown',
|
|
33
|
+
return: rawKey.name === 'return' || rawKey.name === 'enter',
|
|
34
|
+
escape: rawKey.name === 'escape',
|
|
35
|
+
ctrl: rawKey.ctrl,
|
|
36
|
+
shift: rawKey.shift,
|
|
37
|
+
meta: rawKey.meta,
|
|
38
|
+
tab: rawKey.name === 'tab',
|
|
39
|
+
backspace: rawKey.name === 'backspace',
|
|
40
|
+
delete: rawKey.name === 'delete',
|
|
41
|
+
paste: rawKey.paste,
|
|
42
|
+
};
|
|
43
|
+
// For insertable characters, use the sequence
|
|
44
|
+
// For named keys like 'a', 'b', use the name
|
|
45
|
+
let input = rawKey.sequence;
|
|
46
|
+
// For Ctrl+letter combinations, use the name (e.g., 'c' for Ctrl+C)
|
|
47
|
+
if (rawKey.ctrl && rawKey.name && rawKey.name.length === 1) {
|
|
48
|
+
input = rawKey.name;
|
|
49
|
+
}
|
|
50
|
+
// For paste events, use the full sequence
|
|
51
|
+
if (rawKey.paste) {
|
|
52
|
+
input = rawKey.sequence;
|
|
53
|
+
}
|
|
54
|
+
return { input, key };
|
|
55
|
+
}
|
|
56
|
+
function getFocusTarget(approval, activeOverlay) {
|
|
57
|
+
// Approval has highest priority
|
|
58
|
+
if (approval !== null) {
|
|
59
|
+
return 'approval';
|
|
60
|
+
}
|
|
61
|
+
// Active overlay has next priority
|
|
62
|
+
if (activeOverlay !== 'none' && activeOverlay !== 'approval') {
|
|
63
|
+
return 'overlay';
|
|
64
|
+
}
|
|
65
|
+
// Default to main input
|
|
66
|
+
return 'input';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Unified input orchestrator hook
|
|
70
|
+
*
|
|
71
|
+
* This is the ONLY keyboard input hook in the entire ink-cli.
|
|
72
|
+
* All keyboard handling is routed through this single point.
|
|
73
|
+
* Mouse events are handled separately by MouseProvider/ScrollProvider.
|
|
74
|
+
*/
|
|
75
|
+
export function useInputOrchestrator({ ui, approval, input, session, queuedMessages, buffer, setUi, setInput, setMessages, setPendingMessages, setQueuedMessages, agent, handlers, }) {
|
|
76
|
+
const { exit } = useApp();
|
|
77
|
+
// Use refs to avoid stale closures in the callback
|
|
78
|
+
const uiRef = useRef(ui);
|
|
79
|
+
const approvalRef = useRef(approval);
|
|
80
|
+
const inputRef = useRef(input);
|
|
81
|
+
const sessionRef = useRef(session);
|
|
82
|
+
const queuedMessagesRef = useRef(queuedMessages);
|
|
83
|
+
const bufferRef = useRef(buffer);
|
|
84
|
+
const handlersRef = useRef(handlers);
|
|
85
|
+
// Keep refs in sync
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
uiRef.current = ui;
|
|
88
|
+
approvalRef.current = approval;
|
|
89
|
+
inputRef.current = input;
|
|
90
|
+
sessionRef.current = session;
|
|
91
|
+
queuedMessagesRef.current = queuedMessages;
|
|
92
|
+
bufferRef.current = buffer;
|
|
93
|
+
handlersRef.current = handlers;
|
|
94
|
+
}, [ui, approval, input, session, queuedMessages, buffer, handlers]);
|
|
95
|
+
// Auto-clear exit warning after timeout
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (!ui.exitWarningShown || !ui.exitWarningTimestamp)
|
|
98
|
+
return;
|
|
99
|
+
const elapsed = Date.now() - ui.exitWarningTimestamp;
|
|
100
|
+
const remaining = EXIT_WARNING_TIMEOUT - elapsed;
|
|
101
|
+
if (remaining <= 0) {
|
|
102
|
+
setUi((prev) => ({ ...prev, exitWarningShown: false, exitWarningTimestamp: null }));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const timer = setTimeout(() => {
|
|
106
|
+
setUi((prev) => ({ ...prev, exitWarningShown: false, exitWarningTimestamp: null }));
|
|
107
|
+
}, remaining);
|
|
108
|
+
return () => clearTimeout(timer);
|
|
109
|
+
}, [ui.exitWarningShown, ui.exitWarningTimestamp, setUi]);
|
|
110
|
+
// Handle Ctrl+C (special case - handled globally regardless of focus)
|
|
111
|
+
// Priority: 1) Clear input if has text, 2) Exit warning/exit
|
|
112
|
+
// Note: Ctrl+C does NOT cancel processing - use Escape for that
|
|
113
|
+
const handleCtrlC = useCallback(() => {
|
|
114
|
+
const currentUi = uiRef.current;
|
|
115
|
+
const currentBuffer = bufferRef.current;
|
|
116
|
+
if (currentBuffer.text.length > 0) {
|
|
117
|
+
// Has input text - clear it AND show exit warning
|
|
118
|
+
// This way: first Ctrl+C clears, second Ctrl+C exits
|
|
119
|
+
currentBuffer.setText('');
|
|
120
|
+
setUi((prev) => ({
|
|
121
|
+
...prev,
|
|
122
|
+
exitWarningShown: true,
|
|
123
|
+
exitWarningTimestamp: Date.now(),
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// No text - handle exit with double-press safety
|
|
128
|
+
if (currentUi.exitWarningShown) {
|
|
129
|
+
// Second Ctrl+C within timeout - actually exit
|
|
130
|
+
exit();
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// First Ctrl+C - show warning
|
|
134
|
+
setUi((prev) => ({
|
|
135
|
+
...prev,
|
|
136
|
+
exitWarningShown: true,
|
|
137
|
+
exitWarningTimestamp: Date.now(),
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, [setUi, exit]);
|
|
142
|
+
// Handle Escape (context-aware)
|
|
143
|
+
const handleEscape = useCallback(() => {
|
|
144
|
+
const currentUi = uiRef.current;
|
|
145
|
+
const currentSession = sessionRef.current;
|
|
146
|
+
const currentQueuedMessages = queuedMessagesRef.current;
|
|
147
|
+
const currentBuffer = bufferRef.current;
|
|
148
|
+
// Exit history search mode if active - restore original input
|
|
149
|
+
if (currentUi.historySearch.isActive) {
|
|
150
|
+
const originalInput = currentUi.historySearch.originalInput;
|
|
151
|
+
currentBuffer.setText(originalInput);
|
|
152
|
+
setInput((prev) => ({ ...prev, value: originalInput }));
|
|
153
|
+
setUi((prev) => ({
|
|
154
|
+
...prev,
|
|
155
|
+
historySearch: {
|
|
156
|
+
isActive: false,
|
|
157
|
+
query: '',
|
|
158
|
+
matchIndex: 0,
|
|
159
|
+
originalInput: '',
|
|
160
|
+
lastMatch: '',
|
|
161
|
+
},
|
|
162
|
+
}));
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
// Clear exit warning if shown
|
|
166
|
+
if (currentUi.exitWarningShown) {
|
|
167
|
+
setUi((prev) => ({ ...prev, exitWarningShown: false, exitWarningTimestamp: null }));
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
// Cancel processing if active
|
|
171
|
+
if (currentUi.isProcessing) {
|
|
172
|
+
if (currentSession.id) {
|
|
173
|
+
// Cancel current run
|
|
174
|
+
void agent.cancel(currentSession.id).catch(() => { });
|
|
175
|
+
// Clear the queue on server (we'll bring messages to input for editing)
|
|
176
|
+
void agent.clearMessageQueue(currentSession.id).catch(() => { });
|
|
177
|
+
}
|
|
178
|
+
// Finalize any pending messages first (move to messages)
|
|
179
|
+
// Mark running tools as cancelled with error state
|
|
180
|
+
setPendingMessages((pending) => {
|
|
181
|
+
if (pending.length > 0) {
|
|
182
|
+
const updated = pending.map((msg) => {
|
|
183
|
+
// Mark running tools as cancelled
|
|
184
|
+
if (msg.role === 'tool' && msg.toolStatus === 'running') {
|
|
185
|
+
return {
|
|
186
|
+
...msg,
|
|
187
|
+
toolStatus: 'finished',
|
|
188
|
+
toolResult: 'Cancelled',
|
|
189
|
+
isError: true,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return msg;
|
|
193
|
+
});
|
|
194
|
+
setMessages((prev) => [...prev, ...updated]);
|
|
195
|
+
}
|
|
196
|
+
return [];
|
|
197
|
+
});
|
|
198
|
+
setUi((prev) => ({
|
|
199
|
+
...prev,
|
|
200
|
+
isCancelling: true,
|
|
201
|
+
isProcessing: false,
|
|
202
|
+
isThinking: false,
|
|
203
|
+
}));
|
|
204
|
+
// Add interrupted message
|
|
205
|
+
setMessages((prev) => [
|
|
206
|
+
...prev,
|
|
207
|
+
{
|
|
208
|
+
id: generateMessageId('system'),
|
|
209
|
+
role: 'system',
|
|
210
|
+
content: 'Interrupted - what should Dexto do next?',
|
|
211
|
+
timestamp: new Date(),
|
|
212
|
+
},
|
|
213
|
+
]);
|
|
214
|
+
// If there were queued messages, bring them back to input for editing
|
|
215
|
+
if (currentQueuedMessages.length > 0) {
|
|
216
|
+
// Extract and coalesce text content from all queued messages
|
|
217
|
+
const coalescedText = currentQueuedMessages
|
|
218
|
+
.map((msg) => msg.content
|
|
219
|
+
.filter((part) => part.type === 'text')
|
|
220
|
+
.map((part) => part.text)
|
|
221
|
+
.join('\n'))
|
|
222
|
+
.filter((text) => text.length > 0)
|
|
223
|
+
.join('\n\n');
|
|
224
|
+
if (coalescedText) {
|
|
225
|
+
currentBuffer.setText(coalescedText);
|
|
226
|
+
setInput((prev) => ({ ...prev, value: coalescedText }));
|
|
227
|
+
}
|
|
228
|
+
// Clear the queue state immediately (don't wait for server events)
|
|
229
|
+
setQueuedMessages([]);
|
|
230
|
+
}
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
// Close overlay if active (let the overlay handler deal with specifics)
|
|
234
|
+
if (currentUi.activeOverlay !== 'none') {
|
|
235
|
+
// Don't consume - let overlay handler close it with proper cleanup
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}, [agent, setUi, setMessages, setPendingMessages, setInput, setQueuedMessages]);
|
|
240
|
+
// The keypress handler for the entire application
|
|
241
|
+
const handleKeypress = useCallback((rawKey) => {
|
|
242
|
+
const currentUi = uiRef.current;
|
|
243
|
+
const currentApproval = approvalRef.current;
|
|
244
|
+
const currentHandlers = handlersRef.current;
|
|
245
|
+
// Convert to Ink-compatible format
|
|
246
|
+
const { input: inputStr, key } = convertKey(rawKey);
|
|
247
|
+
// === COPY MODE HANDLING ===
|
|
248
|
+
// When in copy mode, any key exits copy mode (mouse events re-enabled)
|
|
249
|
+
if (currentUi.copyModeEnabled) {
|
|
250
|
+
setUi((prev) => ({ ...prev, copyModeEnabled: false }));
|
|
251
|
+
enableMouseEvents(); // Re-enable mouse events
|
|
252
|
+
return; // Don't process any other keys while exiting copy mode
|
|
253
|
+
}
|
|
254
|
+
// === GLOBAL SHORTCUTS (always handled first) ===
|
|
255
|
+
// === HISTORY SEARCH MODE HANDLING ===
|
|
256
|
+
if (currentUi.historySearch.isActive) {
|
|
257
|
+
const currentInput = inputRef.current;
|
|
258
|
+
const currentBuffer = bufferRef.current;
|
|
259
|
+
// Helper to find matches (reversed so newest is first)
|
|
260
|
+
const findMatches = (query) => {
|
|
261
|
+
if (!query)
|
|
262
|
+
return [];
|
|
263
|
+
const lowerQuery = query.toLowerCase();
|
|
264
|
+
return currentInput.history
|
|
265
|
+
.filter((item) => item.toLowerCase().includes(lowerQuery))
|
|
266
|
+
.reverse();
|
|
267
|
+
};
|
|
268
|
+
// Helper to apply a match to the input buffer and track lastMatch
|
|
269
|
+
const applyMatchAndUpdateState = (query, matchIdx) => {
|
|
270
|
+
if (!query) {
|
|
271
|
+
// No query - restore original
|
|
272
|
+
const orig = currentUi.historySearch.originalInput;
|
|
273
|
+
currentBuffer.setText(orig);
|
|
274
|
+
setInput((prev) => ({ ...prev, value: orig }));
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const matches = findMatches(query);
|
|
278
|
+
if (matches.length > 0) {
|
|
279
|
+
const idx = Math.min(matchIdx, matches.length - 1);
|
|
280
|
+
const match = matches[idx];
|
|
281
|
+
if (match) {
|
|
282
|
+
currentBuffer.setText(match);
|
|
283
|
+
setInput((prev) => ({ ...prev, value: match }));
|
|
284
|
+
// Update lastMatch in state
|
|
285
|
+
setUi((prev) => ({
|
|
286
|
+
...prev,
|
|
287
|
+
historySearch: { ...prev.historySearch, lastMatch: match },
|
|
288
|
+
}));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// If no match, keep current buffer content (which has last valid match)
|
|
292
|
+
};
|
|
293
|
+
// Ctrl+E in search mode: cycle to previous (newer) match
|
|
294
|
+
if (key.ctrl && inputStr === 'e') {
|
|
295
|
+
const matches = findMatches(currentUi.historySearch.query);
|
|
296
|
+
if (matches.length > 0) {
|
|
297
|
+
const newIdx = Math.max(0, currentUi.historySearch.matchIndex - 1);
|
|
298
|
+
setUi((prev) => ({
|
|
299
|
+
...prev,
|
|
300
|
+
historySearch: { ...prev.historySearch, matchIndex: newIdx },
|
|
301
|
+
}));
|
|
302
|
+
applyMatchAndUpdateState(currentUi.historySearch.query, newIdx);
|
|
303
|
+
}
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
// Ctrl+R in search mode: cycle to next (older) match
|
|
307
|
+
if (key.ctrl && inputStr === 'r') {
|
|
308
|
+
const matches = findMatches(currentUi.historySearch.query);
|
|
309
|
+
if (matches.length > 0) {
|
|
310
|
+
const newIdx = Math.min(currentUi.historySearch.matchIndex + 1, matches.length - 1);
|
|
311
|
+
setUi((prev) => ({
|
|
312
|
+
...prev,
|
|
313
|
+
historySearch: { ...prev.historySearch, matchIndex: newIdx },
|
|
314
|
+
}));
|
|
315
|
+
applyMatchAndUpdateState(currentUi.historySearch.query, newIdx);
|
|
316
|
+
}
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
// Enter: Accept current match and exit search mode (input already has match)
|
|
320
|
+
if (key.return) {
|
|
321
|
+
setUi((prev) => ({
|
|
322
|
+
...prev,
|
|
323
|
+
historySearch: {
|
|
324
|
+
isActive: false,
|
|
325
|
+
query: '',
|
|
326
|
+
matchIndex: 0,
|
|
327
|
+
originalInput: '',
|
|
328
|
+
lastMatch: '',
|
|
329
|
+
},
|
|
330
|
+
}));
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
// Backspace: Remove last character from search query
|
|
334
|
+
if (key.backspace || key.delete) {
|
|
335
|
+
const newQuery = currentUi.historySearch.query.slice(0, -1);
|
|
336
|
+
setUi((prev) => ({
|
|
337
|
+
...prev,
|
|
338
|
+
historySearch: { ...prev.historySearch, query: newQuery, matchIndex: 0 },
|
|
339
|
+
}));
|
|
340
|
+
applyMatchAndUpdateState(newQuery, 0);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
// Regular typing: Add to search query
|
|
344
|
+
if (inputStr && !key.ctrl && !key.meta && !key.escape) {
|
|
345
|
+
const newQuery = currentUi.historySearch.query + inputStr;
|
|
346
|
+
setUi((prev) => ({
|
|
347
|
+
...prev,
|
|
348
|
+
historySearch: { ...prev.historySearch, query: newQuery, matchIndex: 0 },
|
|
349
|
+
}));
|
|
350
|
+
applyMatchAndUpdateState(newQuery, 0);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
// Escape is handled by handleEscape, so fall through
|
|
354
|
+
}
|
|
355
|
+
// Ctrl+R: Enter history search mode - save current input
|
|
356
|
+
if (key.ctrl && inputStr === 'r') {
|
|
357
|
+
const currentBuffer = bufferRef.current;
|
|
358
|
+
const currentText = currentBuffer.text;
|
|
359
|
+
setUi((prev) => ({
|
|
360
|
+
...prev,
|
|
361
|
+
historySearch: {
|
|
362
|
+
isActive: true,
|
|
363
|
+
query: '',
|
|
364
|
+
matchIndex: 0,
|
|
365
|
+
originalInput: currentText,
|
|
366
|
+
lastMatch: '',
|
|
367
|
+
},
|
|
368
|
+
}));
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
// Ctrl+S: Toggle copy mode (for text selection in alternate buffer)
|
|
372
|
+
if (key.ctrl && inputStr === 's') {
|
|
373
|
+
setUi((prev) => ({ ...prev, copyModeEnabled: true }));
|
|
374
|
+
disableMouseEvents(); // Disable mouse events so terminal can handle selection
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
// Shift+Tab: Toggle "accept all edits" mode (when not in approval modal)
|
|
378
|
+
// Note: When in approval modal for edit/write tools, ApprovalPrompt handles this
|
|
379
|
+
if (key.shift && key.tab && currentApproval === null) {
|
|
380
|
+
setUi((prev) => ({ ...prev, autoApproveEdits: !prev.autoApproveEdits }));
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
// Ctrl+C: Always handle globally for cancellation/exit
|
|
384
|
+
if (key.ctrl && inputStr === 'c') {
|
|
385
|
+
handleCtrlC();
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
// Escape: Try global handling first
|
|
389
|
+
if (key.escape) {
|
|
390
|
+
if (handleEscape()) {
|
|
391
|
+
return; // Consumed by global handler
|
|
392
|
+
}
|
|
393
|
+
// Fall through to focused component
|
|
394
|
+
}
|
|
395
|
+
// === ROUTE TO FOCUSED COMPONENT ===
|
|
396
|
+
// Only approval and overlay handlers are routed through the orchestrator.
|
|
397
|
+
// Main text input handles its own keypress directly (via TextBufferInput).
|
|
398
|
+
const focusTarget = getFocusTarget(currentApproval, currentUi.activeOverlay);
|
|
399
|
+
switch (focusTarget) {
|
|
400
|
+
case 'approval':
|
|
401
|
+
if (currentHandlers.approval) {
|
|
402
|
+
currentHandlers.approval(inputStr, key);
|
|
403
|
+
}
|
|
404
|
+
// Approval always consumes - main input won't see it
|
|
405
|
+
break;
|
|
406
|
+
case 'overlay':
|
|
407
|
+
if (currentHandlers.overlay) {
|
|
408
|
+
currentHandlers.overlay(inputStr, key);
|
|
409
|
+
}
|
|
410
|
+
// Overlay may or may not consume - main input handles independently
|
|
411
|
+
break;
|
|
412
|
+
case 'input':
|
|
413
|
+
// No routing needed - TextBufferInput handles its own input
|
|
414
|
+
// Clear exit warning on any typing (user changed their mind)
|
|
415
|
+
if (currentUi.exitWarningShown &&
|
|
416
|
+
!key.ctrl &&
|
|
417
|
+
!key.meta &&
|
|
418
|
+
!key.escape &&
|
|
419
|
+
inputStr.length > 0) {
|
|
420
|
+
setUi((prev) => ({
|
|
421
|
+
...prev,
|
|
422
|
+
exitWarningShown: false,
|
|
423
|
+
exitWarningTimestamp: null,
|
|
424
|
+
}));
|
|
425
|
+
}
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
}, [handleCtrlC, handleEscape, setUi]);
|
|
429
|
+
// Subscribe to keypress events
|
|
430
|
+
useKeypress(handleKeypress, { isActive: true });
|
|
431
|
+
}
|
|
432
|
+
export function createApprovalInputHandler({ onApprove, onDeny, onCancel, selectedOption, setSelectedOption, isCommandConfirmation, }) {
|
|
433
|
+
return (_input, key) => {
|
|
434
|
+
if (key.upArrow) {
|
|
435
|
+
// Move up (skip yes-session for command confirmations)
|
|
436
|
+
if (selectedOption === 'yes') {
|
|
437
|
+
setSelectedOption('no');
|
|
438
|
+
}
|
|
439
|
+
else if (selectedOption === 'yes-session') {
|
|
440
|
+
setSelectedOption('yes');
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
// no -> yes-session (or yes for command confirmations)
|
|
444
|
+
setSelectedOption(isCommandConfirmation ? 'yes' : 'yes-session');
|
|
445
|
+
}
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
if (key.downArrow) {
|
|
449
|
+
// Move down (skip yes-session for command confirmations)
|
|
450
|
+
if (selectedOption === 'yes') {
|
|
451
|
+
setSelectedOption(isCommandConfirmation ? 'no' : 'yes-session');
|
|
452
|
+
}
|
|
453
|
+
else if (selectedOption === 'yes-session') {
|
|
454
|
+
setSelectedOption('no');
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
setSelectedOption('yes'); // no -> yes (wrap)
|
|
458
|
+
}
|
|
459
|
+
return true;
|
|
460
|
+
}
|
|
461
|
+
if (key.return) {
|
|
462
|
+
// Enter key - confirm selection
|
|
463
|
+
if (selectedOption === 'yes') {
|
|
464
|
+
onApprove(false);
|
|
465
|
+
}
|
|
466
|
+
else if (selectedOption === 'yes-session') {
|
|
467
|
+
onApprove(true);
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
onDeny();
|
|
471
|
+
}
|
|
472
|
+
return true;
|
|
473
|
+
}
|
|
474
|
+
if (key.escape) {
|
|
475
|
+
onCancel();
|
|
476
|
+
return true;
|
|
477
|
+
}
|
|
478
|
+
return false;
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
export function createSelectorInputHandler({ itemsLength, selectedIndexRef, onSelectIndex, onSelect, onClose, }) {
|
|
482
|
+
return (_input, key) => {
|
|
483
|
+
if (itemsLength === 0)
|
|
484
|
+
return false;
|
|
485
|
+
if (key.upArrow) {
|
|
486
|
+
const currentIndex = selectedIndexRef.current ?? 0;
|
|
487
|
+
const nextIndex = (currentIndex - 1 + itemsLength) % itemsLength;
|
|
488
|
+
onSelectIndex(nextIndex);
|
|
489
|
+
return true;
|
|
490
|
+
}
|
|
491
|
+
if (key.downArrow) {
|
|
492
|
+
const currentIndex = selectedIndexRef.current ?? 0;
|
|
493
|
+
const nextIndex = (currentIndex + 1) % itemsLength;
|
|
494
|
+
onSelectIndex(nextIndex);
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
if (key.escape) {
|
|
498
|
+
onClose();
|
|
499
|
+
return true;
|
|
500
|
+
}
|
|
501
|
+
if (key.return) {
|
|
502
|
+
onSelect();
|
|
503
|
+
return true;
|
|
504
|
+
}
|
|
505
|
+
return false;
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
export function createAutocompleteInputHandler({ itemsLength, selectedIndexRef, onSelectIndex, onSelect, onClose, onTab, }) {
|
|
509
|
+
const baseHandler = createSelectorInputHandler({
|
|
510
|
+
itemsLength,
|
|
511
|
+
selectedIndexRef,
|
|
512
|
+
onSelectIndex,
|
|
513
|
+
onSelect,
|
|
514
|
+
onClose,
|
|
515
|
+
});
|
|
516
|
+
return (input, key) => {
|
|
517
|
+
// Handle Tab for "load into input" functionality
|
|
518
|
+
if (key.tab && onTab) {
|
|
519
|
+
onTab();
|
|
520
|
+
return true;
|
|
521
|
+
}
|
|
522
|
+
return baseHandler(input, key);
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
export function createMainInputHandler({ value, cursorPos, onChange, setCursorPos, onSubmit, isDisabled, history, historyIndex, onHistoryNavigate, getLineInfo, getLineStart, }) {
|
|
526
|
+
return (input, key) => {
|
|
527
|
+
if (isDisabled)
|
|
528
|
+
return false;
|
|
529
|
+
const lines = value.split('\n');
|
|
530
|
+
const isMultiLine = lines.length > 1;
|
|
531
|
+
const { lineIndex, colIndex } = getLineInfo(cursorPos);
|
|
532
|
+
// Newline detection based on actual terminal behavior
|
|
533
|
+
const isCtrlJ = input === '\n';
|
|
534
|
+
const isShiftEnter = input === '\\\r' ||
|
|
535
|
+
(key.return && key.shift) ||
|
|
536
|
+
input === '\x1b[13;2u' ||
|
|
537
|
+
input === '\x1bOM';
|
|
538
|
+
const wantsNewline = isCtrlJ || isShiftEnter || (key.return && key.meta);
|
|
539
|
+
if (wantsNewline) {
|
|
540
|
+
const newValue = value.slice(0, cursorPos) + '\n' + value.slice(cursorPos);
|
|
541
|
+
onChange(newValue);
|
|
542
|
+
setCursorPos(cursorPos + 1);
|
|
543
|
+
return true;
|
|
544
|
+
}
|
|
545
|
+
// Enter = submit
|
|
546
|
+
if (key.return) {
|
|
547
|
+
if (value.trim()) {
|
|
548
|
+
onSubmit(value);
|
|
549
|
+
}
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
// Backspace - delete character before cursor
|
|
553
|
+
const isBackspace = key.backspace || input === '\x7f' || input === '\x08';
|
|
554
|
+
if (isBackspace) {
|
|
555
|
+
if (cursorPos > 0) {
|
|
556
|
+
const newValue = value.slice(0, cursorPos - 1) + value.slice(cursorPos);
|
|
557
|
+
onChange(newValue);
|
|
558
|
+
setCursorPos(cursorPos - 1);
|
|
559
|
+
}
|
|
560
|
+
return true;
|
|
561
|
+
}
|
|
562
|
+
// Delete - delete character at cursor (forward delete)
|
|
563
|
+
if (key.delete) {
|
|
564
|
+
if (cursorPos < value.length) {
|
|
565
|
+
const newValue = value.slice(0, cursorPos) + value.slice(cursorPos + 1);
|
|
566
|
+
onChange(newValue);
|
|
567
|
+
}
|
|
568
|
+
return true;
|
|
569
|
+
}
|
|
570
|
+
// Left arrow
|
|
571
|
+
if (key.leftArrow) {
|
|
572
|
+
setCursorPos(Math.max(0, cursorPos - 1));
|
|
573
|
+
return true;
|
|
574
|
+
}
|
|
575
|
+
// Right arrow
|
|
576
|
+
if (key.rightArrow) {
|
|
577
|
+
setCursorPos(Math.min(value.length, cursorPos + 1));
|
|
578
|
+
return true;
|
|
579
|
+
}
|
|
580
|
+
// Up arrow
|
|
581
|
+
if (key.upArrow) {
|
|
582
|
+
if (isMultiLine && lineIndex > 0) {
|
|
583
|
+
const prevLineStart = getLineStart(lineIndex - 1);
|
|
584
|
+
const prevLineLength = lines[lineIndex - 1].length;
|
|
585
|
+
const newCol = Math.min(colIndex, prevLineLength);
|
|
586
|
+
setCursorPos(prevLineStart + newCol);
|
|
587
|
+
}
|
|
588
|
+
else if (onHistoryNavigate && history.length > 0) {
|
|
589
|
+
onHistoryNavigate('up');
|
|
590
|
+
}
|
|
591
|
+
return true;
|
|
592
|
+
}
|
|
593
|
+
// Down arrow
|
|
594
|
+
if (key.downArrow) {
|
|
595
|
+
if (isMultiLine && lineIndex < lines.length - 1) {
|
|
596
|
+
const nextLineStart = getLineStart(lineIndex + 1);
|
|
597
|
+
const nextLineLength = lines[lineIndex + 1].length;
|
|
598
|
+
const newCol = Math.min(colIndex, nextLineLength);
|
|
599
|
+
setCursorPos(nextLineStart + newCol);
|
|
600
|
+
}
|
|
601
|
+
else if (onHistoryNavigate && historyIndex >= 0) {
|
|
602
|
+
onHistoryNavigate('down');
|
|
603
|
+
}
|
|
604
|
+
return true;
|
|
605
|
+
}
|
|
606
|
+
// Ctrl+A - start of line
|
|
607
|
+
if (key.ctrl && input === 'a') {
|
|
608
|
+
setCursorPos(getLineStart(lineIndex));
|
|
609
|
+
return true;
|
|
610
|
+
}
|
|
611
|
+
// Ctrl+E - end of line
|
|
612
|
+
if (key.ctrl && input === 'e') {
|
|
613
|
+
const lineStart = getLineStart(lineIndex);
|
|
614
|
+
setCursorPos(lineStart + lines[lineIndex].length);
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
// Ctrl+K - delete to end of line
|
|
618
|
+
if (key.ctrl && input === 'k') {
|
|
619
|
+
const lineStart = getLineStart(lineIndex);
|
|
620
|
+
const lineEnd = lineStart + lines[lineIndex].length;
|
|
621
|
+
if (cursorPos < lineEnd) {
|
|
622
|
+
onChange(value.slice(0, cursorPos) + value.slice(lineEnd));
|
|
623
|
+
}
|
|
624
|
+
else if (cursorPos < value.length) {
|
|
625
|
+
onChange(value.slice(0, cursorPos) + value.slice(cursorPos + 1));
|
|
626
|
+
}
|
|
627
|
+
return true;
|
|
628
|
+
}
|
|
629
|
+
// Ctrl+U - delete to start of line
|
|
630
|
+
if (key.ctrl && input === 'u') {
|
|
631
|
+
const lineStart = getLineStart(lineIndex);
|
|
632
|
+
if (cursorPos > lineStart) {
|
|
633
|
+
onChange(value.slice(0, lineStart) + value.slice(cursorPos));
|
|
634
|
+
setCursorPos(lineStart);
|
|
635
|
+
}
|
|
636
|
+
return true;
|
|
637
|
+
}
|
|
638
|
+
// Ctrl+W - delete word
|
|
639
|
+
if (key.ctrl && input === 'w') {
|
|
640
|
+
if (cursorPos > 0) {
|
|
641
|
+
let wordStart = cursorPos - 1;
|
|
642
|
+
while (wordStart > 0 && value[wordStart] === ' ')
|
|
643
|
+
wordStart--;
|
|
644
|
+
while (wordStart > 0 &&
|
|
645
|
+
value[wordStart - 1] !== ' ' &&
|
|
646
|
+
value[wordStart - 1] !== '\n') {
|
|
647
|
+
wordStart--;
|
|
648
|
+
}
|
|
649
|
+
onChange(value.slice(0, wordStart) + value.slice(cursorPos));
|
|
650
|
+
setCursorPos(wordStart);
|
|
651
|
+
}
|
|
652
|
+
return true;
|
|
653
|
+
}
|
|
654
|
+
// Regular character input
|
|
655
|
+
if (input && !key.ctrl && !key.meta) {
|
|
656
|
+
const newValue = value.slice(0, cursorPos) + input + value.slice(cursorPos);
|
|
657
|
+
onChange(newValue);
|
|
658
|
+
setCursorPos(cursorPos + input.length);
|
|
659
|
+
return true;
|
|
660
|
+
}
|
|
661
|
+
return false;
|
|
662
|
+
};
|
|
663
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardShortcuts.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useKeyboardShortcuts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,UAAU,yBAAyB;IAC/B,KAAK,EAAE,QAAQ,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,KAAK,EAAE,UAAU,CAAC;CACrB;AAKD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,yBAAyB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"useKeyboardShortcuts.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useKeyboardShortcuts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,UAAU,yBAAyB;IAC/B,KAAK,EAAE,QAAQ,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,KAAK,EAAE,UAAU,CAAC;CACrB;AAKD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,yBAAyB,GAAG,IAAI,CA4EhG"}
|