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,170 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
|
+
import { getBoundingBox } from 'ink';
|
|
4
|
+
import { useMouse } from './MouseContext.js';
|
|
5
|
+
const ScrollContext = createContext(null);
|
|
6
|
+
/**
|
|
7
|
+
* Find scrollable components under the mouse cursor
|
|
8
|
+
*/
|
|
9
|
+
const findScrollableCandidates = (mouseEvent, scrollables) => {
|
|
10
|
+
const candidates = [];
|
|
11
|
+
for (const entry of scrollables.values()) {
|
|
12
|
+
if (!entry.ref.current || !entry.hasFocus()) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const boundingBox = getBoundingBox(entry.ref.current);
|
|
16
|
+
if (!boundingBox)
|
|
17
|
+
continue;
|
|
18
|
+
const { x, y, width, height } = boundingBox;
|
|
19
|
+
// Check if mouse is inside this component
|
|
20
|
+
// Add 1 to width to include scrollbar column
|
|
21
|
+
const isInside = mouseEvent.col >= x &&
|
|
22
|
+
mouseEvent.col < x + width + 1 &&
|
|
23
|
+
mouseEvent.row >= y &&
|
|
24
|
+
mouseEvent.row < y + height;
|
|
25
|
+
if (isInside) {
|
|
26
|
+
candidates.push({ ...entry, area: width * height });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Sort by smallest area first (innermost component)
|
|
30
|
+
candidates.sort((a, b) => a.area - b.area);
|
|
31
|
+
return candidates;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Hook to detect text selection attempts (click + drag)
|
|
35
|
+
* Returns a handler to process mouse events for drag detection
|
|
36
|
+
*/
|
|
37
|
+
function useDragDetection(onSelectionAttempt) {
|
|
38
|
+
const isLeftButtonDownRef = useRef(false);
|
|
39
|
+
const selectionHintShownRef = useRef(false);
|
|
40
|
+
const handleDragDetection = useCallback((event) => {
|
|
41
|
+
if (event.name === 'left-press') {
|
|
42
|
+
isLeftButtonDownRef.current = true;
|
|
43
|
+
selectionHintShownRef.current = false;
|
|
44
|
+
}
|
|
45
|
+
else if (event.name === 'left-release') {
|
|
46
|
+
isLeftButtonDownRef.current = false;
|
|
47
|
+
}
|
|
48
|
+
else if (event.name === 'move' && isLeftButtonDownRef.current) {
|
|
49
|
+
// User is dragging (trying to select text)
|
|
50
|
+
// Only show hint once per drag operation
|
|
51
|
+
if (!selectionHintShownRef.current && onSelectionAttempt) {
|
|
52
|
+
selectionHintShownRef.current = true;
|
|
53
|
+
onSelectionAttempt();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, [onSelectionAttempt]);
|
|
57
|
+
return handleDragDetection;
|
|
58
|
+
}
|
|
59
|
+
export const ScrollProvider = ({ children, onSelectionAttempt }) => {
|
|
60
|
+
const [scrollables, setScrollables] = useState(new Map());
|
|
61
|
+
// Drag detection for selection hint
|
|
62
|
+
const handleDragDetection = useDragDetection(onSelectionAttempt);
|
|
63
|
+
const register = useCallback((entry) => {
|
|
64
|
+
setScrollables((prev) => new Map(prev).set(entry.id, entry));
|
|
65
|
+
}, []);
|
|
66
|
+
const unregister = useCallback((id) => {
|
|
67
|
+
setScrollables((prev) => {
|
|
68
|
+
const next = new Map(prev);
|
|
69
|
+
next.delete(id);
|
|
70
|
+
return next;
|
|
71
|
+
});
|
|
72
|
+
}, []);
|
|
73
|
+
const scrollablesRef = useRef(scrollables);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
scrollablesRef.current = scrollables;
|
|
76
|
+
}, [scrollables]);
|
|
77
|
+
// Batch scroll events to prevent jitter
|
|
78
|
+
const pendingScrollsRef = useRef(new Map());
|
|
79
|
+
const flushScheduledRef = useRef(false);
|
|
80
|
+
const scheduleFlush = useCallback(() => {
|
|
81
|
+
if (!flushScheduledRef.current) {
|
|
82
|
+
flushScheduledRef.current = true;
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
flushScheduledRef.current = false;
|
|
85
|
+
for (const [id, delta] of pendingScrollsRef.current.entries()) {
|
|
86
|
+
const entry = scrollablesRef.current.get(id);
|
|
87
|
+
if (entry) {
|
|
88
|
+
entry.scrollBy(delta);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
pendingScrollsRef.current.clear();
|
|
92
|
+
}, 0);
|
|
93
|
+
}
|
|
94
|
+
}, []);
|
|
95
|
+
const handleScroll = useCallback((direction, mouseEvent) => {
|
|
96
|
+
const delta = direction === 'up' ? -1 : 1;
|
|
97
|
+
const candidates = findScrollableCandidates(mouseEvent, scrollablesRef.current);
|
|
98
|
+
for (const candidate of candidates) {
|
|
99
|
+
const { scrollTop, scrollHeight, innerHeight } = candidate.getScrollState();
|
|
100
|
+
const pendingDelta = pendingScrollsRef.current.get(candidate.id) || 0;
|
|
101
|
+
const effectiveScrollTop = scrollTop + pendingDelta;
|
|
102
|
+
// Epsilon for floating point comparison
|
|
103
|
+
const canScrollUp = effectiveScrollTop > 0.001;
|
|
104
|
+
const canScrollDown = effectiveScrollTop < scrollHeight - innerHeight - 0.001;
|
|
105
|
+
if (direction === 'up' && canScrollUp) {
|
|
106
|
+
pendingScrollsRef.current.set(candidate.id, pendingDelta + delta);
|
|
107
|
+
scheduleFlush();
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
if (direction === 'down' && canScrollDown) {
|
|
111
|
+
pendingScrollsRef.current.set(candidate.id, pendingDelta + delta);
|
|
112
|
+
scheduleFlush();
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}, [scheduleFlush]);
|
|
118
|
+
// Subscribe to mouse events
|
|
119
|
+
useMouse(useCallback((event) => {
|
|
120
|
+
// Handle scroll events
|
|
121
|
+
if (event.name === 'scroll-up') {
|
|
122
|
+
return handleScroll('up', event);
|
|
123
|
+
}
|
|
124
|
+
else if (event.name === 'scroll-down') {
|
|
125
|
+
return handleScroll('down', event);
|
|
126
|
+
}
|
|
127
|
+
// Detect selection attempts (click + drag)
|
|
128
|
+
handleDragDetection(event);
|
|
129
|
+
return false;
|
|
130
|
+
}, [handleScroll, handleDragDetection]), { isActive: true });
|
|
131
|
+
const contextValue = useMemo(() => ({ register, unregister }), [register, unregister]);
|
|
132
|
+
return _jsx(ScrollContext.Provider, { value: contextValue, children: children });
|
|
133
|
+
};
|
|
134
|
+
let nextId = 0;
|
|
135
|
+
/**
|
|
136
|
+
* Hook to register a component as scrollable
|
|
137
|
+
*/
|
|
138
|
+
export const useScrollable = (entry, isActive) => {
|
|
139
|
+
const context = useContext(ScrollContext);
|
|
140
|
+
if (!context) {
|
|
141
|
+
throw new Error('useScrollable must be used within a ScrollProvider');
|
|
142
|
+
}
|
|
143
|
+
const [id] = useState(() => `scrollable-${nextId++}`);
|
|
144
|
+
// Store entry in ref to avoid re-registration on every render
|
|
145
|
+
// when callers don't memoize the entry object
|
|
146
|
+
const entryRef = useRef(entry);
|
|
147
|
+
entryRef.current = entry;
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (isActive) {
|
|
150
|
+
// Build entry object, conditionally including scrollTo to satisfy exactOptionalPropertyTypes
|
|
151
|
+
const registrationEntry = {
|
|
152
|
+
id,
|
|
153
|
+
ref: entryRef.current.ref,
|
|
154
|
+
getScrollState: () => entryRef.current.getScrollState(),
|
|
155
|
+
scrollBy: (delta) => entryRef.current.scrollBy(delta),
|
|
156
|
+
hasFocus: () => entryRef.current.hasFocus(),
|
|
157
|
+
};
|
|
158
|
+
if (entryRef.current.scrollTo) {
|
|
159
|
+
registrationEntry.scrollTo = (scrollTop, duration) => {
|
|
160
|
+
entryRef.current.scrollTo?.(scrollTop, duration);
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
context.register(registrationEntry);
|
|
164
|
+
return () => {
|
|
165
|
+
context.unregister(id);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return;
|
|
169
|
+
}, [context, id, isActive]);
|
|
170
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context providers for ink-cli
|
|
3
|
+
*/
|
|
4
|
+
export { KeypressProvider, useKeypressContext, type Key, type KeypressHandler, type KeypressProviderProps, } from './KeypressContext.js';
|
|
5
|
+
export { MouseProvider, useMouseContext, useMouse, type MouseEvent, type MouseEventName, type MouseHandler, type MouseProviderProps, } from './MouseContext.js';
|
|
6
|
+
export { ScrollProvider, useScrollable, type ScrollState, type ScrollableEntry, } from './ScrollProvider.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/contexts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,GAAG,EACR,KAAK,eAAe,EACpB,KAAK,qBAAqB,GAC7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,aAAa,EACb,eAAe,EACf,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,kBAAkB,GAC1B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACH,cAAc,EACd,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,eAAe,GACvB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context providers for ink-cli
|
|
3
|
+
*/
|
|
4
|
+
export { KeypressProvider, useKeypressContext, } from './KeypressContext.js';
|
|
5
|
+
export { MouseProvider, useMouseContext, useMouse, } from './MouseContext.js';
|
|
6
|
+
export { ScrollProvider, useScrollable, } from './ScrollProvider.js';
|
|
@@ -3,4 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { useAgentEvents } from './useAgentEvents.js';
|
|
5
5
|
export { useKeyboardShortcuts } from './useKeyboardShortcuts.js';
|
|
6
|
+
export { useInputOrchestrator, createApprovalInputHandler, createSelectorInputHandler, createAutocompleteInputHandler, createMainInputHandler, type InputHandler, type InputHandlers, type UseInputOrchestratorProps, type ApprovalHandlerProps, type SelectorHandlerProps, type AutocompleteHandlerProps, type MainInputHandlerProps, } from './useInputOrchestrator.js';
|
|
7
|
+
export { useKeypress } from './useKeypress.js';
|
|
8
|
+
export { useTerminalSize, type TerminalSize } from './useTerminalSize.js';
|
|
9
|
+
export { useCLIState, type UseCLIStateProps, type CLIStateReturn, type UIState, type InputState, type SessionState, } from './useCLIState.js';
|
|
10
|
+
export type { Key } from './useInputOrchestrator.js';
|
|
6
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACH,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,8BAA8B,EAC9B,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EACH,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,YAAY,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { useAgentEvents } from './useAgentEvents.js';
|
|
5
5
|
export { useKeyboardShortcuts } from './useKeyboardShortcuts.js';
|
|
6
|
-
|
|
6
|
+
export { useInputOrchestrator, createApprovalInputHandler, createSelectorInputHandler, createAutocompleteInputHandler, createMainInputHandler, } from './useInputOrchestrator.js';
|
|
7
|
+
export { useKeypress } from './useKeypress.js';
|
|
8
|
+
export { useTerminalSize } from './useTerminalSize.js';
|
|
9
|
+
export { useCLIState, } from './useCLIState.js';
|
|
10
|
+
// useMouseScroll removed - mouse events now handled by MouseProvider/ScrollProvider
|
|
11
|
+
// useInputHistory removed - history navigation now handled by TextBufferInput
|
|
7
12
|
// useOverlayManager removed - overlay management now done via dispatch directly
|
|
8
13
|
// useSessionSync removed - sessionId now managed in state directly
|
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook for managing agent event bus subscriptions
|
|
3
|
-
*
|
|
2
|
+
* Hook for managing agent event bus subscriptions for NON-STREAMING events.
|
|
3
|
+
*
|
|
4
|
+
* Streaming events (llm:thinking, llm:chunk, llm:response, llm:tool-call, llm:tool-result,
|
|
5
|
+
* llm:error, run:complete, message:dequeued) are handled via agent.stream() iterator in processStream.
|
|
6
|
+
*
|
|
7
|
+
* This hook handles:
|
|
8
|
+
* - approval:request - Tool/command confirmation requests
|
|
9
|
+
* - llm:switched - Model change notifications
|
|
10
|
+
* - session:reset - Conversation reset
|
|
11
|
+
* - session:created - New session creation (e.g., from /clear)
|
|
12
|
+
* - message:queued - New message added to queue
|
|
13
|
+
* - message:removed - Message removed from queue (e.g., up arrow edit)
|
|
14
|
+
*
|
|
15
|
+
* Uses AbortController pattern for cleanup.
|
|
4
16
|
*/
|
|
5
17
|
import type React from 'react';
|
|
6
|
-
import type
|
|
7
|
-
import type {
|
|
18
|
+
import { type DextoAgent, type QueuedMessage } from '@dexto/core';
|
|
19
|
+
import type { Message, UIState, SessionState } from '../state/types.js';
|
|
20
|
+
import type { ApprovalRequest } from '../components/ApprovalPrompt.js';
|
|
8
21
|
interface UseAgentEventsProps {
|
|
9
22
|
agent: DextoAgent;
|
|
10
|
-
|
|
11
|
-
|
|
23
|
+
setMessages: React.Dispatch<React.SetStateAction<Message[]>>;
|
|
24
|
+
setUi: React.Dispatch<React.SetStateAction<UIState>>;
|
|
25
|
+
setSession: React.Dispatch<React.SetStateAction<SessionState>>;
|
|
26
|
+
setApproval: React.Dispatch<React.SetStateAction<ApprovalRequest | null>>;
|
|
27
|
+
setApprovalQueue: React.Dispatch<React.SetStateAction<ApprovalRequest[]>>;
|
|
28
|
+
setQueuedMessages: React.Dispatch<React.SetStateAction<QueuedMessage[]>>;
|
|
12
29
|
}
|
|
13
30
|
/**
|
|
14
|
-
* Subscribes to agent event bus
|
|
15
|
-
*
|
|
31
|
+
* Subscribes to agent event bus for non-streaming events only.
|
|
32
|
+
* Streaming events are handled via agent.stream() iterator.
|
|
16
33
|
*/
|
|
17
|
-
export declare function useAgentEvents({ agent,
|
|
34
|
+
export declare function useAgentEvents({ agent, setMessages, setUi, setSession, setApproval, setApprovalQueue, setQueuedMessages, }: UseAgentEventsProps): void;
|
|
18
35
|
export {};
|
|
19
36
|
//# sourceMappingURL=useAgentEvents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgentEvents.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useAgentEvents.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useAgentEvents.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useAgentEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAuB,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,UAAU,mBAAmB;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7D,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/D,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1E,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;IAC1E,iBAAiB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;CAC5E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,KAAK,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,GACpB,EAAE,mBAAmB,GAAG,IAAI,CAqH5B"}
|
|
@@ -1,213 +1,105 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook for managing agent event bus subscriptions
|
|
3
|
-
*
|
|
2
|
+
* Hook for managing agent event bus subscriptions for NON-STREAMING events.
|
|
3
|
+
*
|
|
4
|
+
* Streaming events (llm:thinking, llm:chunk, llm:response, llm:tool-call, llm:tool-result,
|
|
5
|
+
* llm:error, run:complete, message:dequeued) are handled via agent.stream() iterator in processStream.
|
|
6
|
+
*
|
|
7
|
+
* This hook handles:
|
|
8
|
+
* - approval:request - Tool/command confirmation requests
|
|
9
|
+
* - llm:switched - Model change notifications
|
|
10
|
+
* - session:reset - Conversation reset
|
|
11
|
+
* - session:created - New session creation (e.g., from /clear)
|
|
12
|
+
* - message:queued - New message added to queue
|
|
13
|
+
* - message:removed - Message removed from queue (e.g., up arrow edit)
|
|
14
|
+
*
|
|
15
|
+
* Uses AbortController pattern for cleanup.
|
|
4
16
|
*/
|
|
5
|
-
import { useEffect
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
17
|
+
import { useEffect } from 'react';
|
|
18
|
+
import { setMaxListeners } from 'events';
|
|
19
|
+
import { getModelDisplayName } from '@dexto/core';
|
|
8
20
|
/**
|
|
9
|
-
* Subscribes to agent event bus
|
|
10
|
-
*
|
|
21
|
+
* Subscribes to agent event bus for non-streaming events only.
|
|
22
|
+
* Streaming events are handled via agent.stream() iterator.
|
|
11
23
|
*/
|
|
12
|
-
export function useAgentEvents({ agent,
|
|
13
|
-
// Use ref for isCancelling to avoid re-registering event handlers on every state change
|
|
14
|
-
// This prevents race conditions where events could be lost during handler re-registration
|
|
15
|
-
const isCancellingRef = useRef(isCancelling);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
isCancellingRef.current = isCancelling;
|
|
18
|
-
}, [isCancelling]);
|
|
24
|
+
export function useAgentEvents({ agent, setMessages, setUi, setSession, setApproval, setApprovalQueue, setQueuedMessages, }) {
|
|
19
25
|
useEffect(() => {
|
|
20
26
|
const bus = agent.agentEventBus;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
dispatch({ type: 'THINKING_START' });
|
|
29
|
-
};
|
|
30
|
-
// Handle streaming chunks
|
|
31
|
-
const handleChunk = (payload) => {
|
|
32
|
-
if (isCancellingRef.current)
|
|
33
|
-
return; // Ignore events during cancellation
|
|
34
|
-
// End thinking state when first chunk arrives
|
|
35
|
-
dispatch({ type: 'THINKING_END' });
|
|
36
|
-
if (payload.chunkType === 'text') {
|
|
37
|
-
dispatch({
|
|
38
|
-
type: 'STREAMING_CHUNK',
|
|
39
|
-
content: payload.content,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
// Handle response completion
|
|
44
|
-
const handleResponse = (payload) => {
|
|
45
|
-
if (isCancellingRef.current)
|
|
46
|
-
return; // Ignore events during cancellation
|
|
47
|
-
dispatch({
|
|
48
|
-
type: 'STREAMING_END',
|
|
49
|
-
content: payload.content,
|
|
50
|
-
});
|
|
51
|
-
dispatch({
|
|
52
|
-
type: 'PROCESSING_END',
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
// Handle errors
|
|
56
|
-
const handleError = (payload) => {
|
|
57
|
-
dispatch({
|
|
58
|
-
type: 'STREAMING_CANCEL',
|
|
59
|
-
});
|
|
60
|
-
dispatch({
|
|
61
|
-
type: 'SUBMIT_ERROR',
|
|
62
|
-
errorMessage: payload.error.message,
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
// Handle tool calls
|
|
66
|
-
const handleToolCall = (payload) => {
|
|
67
|
-
if (isCancellingRef.current)
|
|
68
|
-
return; // Ignore events during cancellation
|
|
69
|
-
// Format args for display (compact, one-line)
|
|
70
|
-
let argsPreview = '';
|
|
71
|
-
try {
|
|
72
|
-
const argsStr = JSON.stringify(payload.args);
|
|
73
|
-
// Remove outer braces and limit length
|
|
74
|
-
const cleanArgs = argsStr.replace(/^\{|\}$/g, '').trim();
|
|
75
|
-
if (cleanArgs.length > 80) {
|
|
76
|
-
argsPreview = ` • ${cleanArgs.slice(0, 80)}...`;
|
|
77
|
-
}
|
|
78
|
-
else if (cleanArgs.length > 0) {
|
|
79
|
-
argsPreview = ` • ${cleanArgs}`;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
argsPreview = '';
|
|
84
|
-
}
|
|
85
|
-
// Insert before streaming message so tools appear in correct order
|
|
86
|
-
// Use callId if available for matching with result later
|
|
87
|
-
const toolMessageId = payload.callId
|
|
88
|
-
? `tool-${payload.callId}`
|
|
89
|
-
: generateMessageId('tool');
|
|
90
|
-
dispatch({
|
|
91
|
-
type: 'MESSAGE_INSERT_BEFORE_STREAMING',
|
|
92
|
-
message: {
|
|
93
|
-
id: toolMessageId,
|
|
94
|
-
role: 'tool',
|
|
95
|
-
content: `${payload.toolName}${argsPreview}`,
|
|
96
|
-
timestamp: new Date(),
|
|
97
|
-
toolStatus: 'running',
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
// Handle tool results
|
|
102
|
-
const handleToolResult = (payload) => {
|
|
103
|
-
if (isCancellingRef.current)
|
|
104
|
-
return; // Ignore events during cancellation
|
|
105
|
-
// Format result preview (4-5 CLI lines, ~400 chars accounting for wrapping)
|
|
106
|
-
let resultPreview = '';
|
|
107
|
-
try {
|
|
108
|
-
const result = payload.sanitized || payload.rawResult;
|
|
109
|
-
if (result) {
|
|
110
|
-
const resultStr = typeof result === 'string' ? result : JSON.stringify(result, null, 2);
|
|
111
|
-
// Limit to ~400 chars (roughly 4-5 terminal lines at 80-100 chars width)
|
|
112
|
-
const maxChars = 400;
|
|
113
|
-
if (resultStr.length > maxChars) {
|
|
114
|
-
resultPreview = resultStr.slice(0, maxChars) + '\n...';
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
resultPreview = resultStr;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
resultPreview = '';
|
|
123
|
-
}
|
|
124
|
-
// Update the tool message with result preview and mark as finished
|
|
125
|
-
if (payload.callId) {
|
|
126
|
-
const toolMessageId = `tool-${payload.callId}`;
|
|
127
|
-
dispatch({
|
|
128
|
-
type: 'MESSAGE_UPDATE',
|
|
129
|
-
id: toolMessageId,
|
|
130
|
-
update: {
|
|
131
|
-
toolResult: resultPreview,
|
|
132
|
-
toolStatus: 'finished',
|
|
133
|
-
},
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
// Handle approval requests
|
|
138
|
-
const handleApprovalRequest = (event) => {
|
|
139
|
-
// Handle both tool confirmation and command confirmation approvals in ink-cli
|
|
140
|
-
if (event.type === ApprovalTypeEnum.TOOL_CONFIRMATION ||
|
|
141
|
-
event.type === ApprovalTypeEnum.COMMAND_CONFIRMATION) {
|
|
142
|
-
const approval = {
|
|
143
|
-
approvalId: event.approvalId,
|
|
144
|
-
type: event.type,
|
|
145
|
-
timestamp: event.timestamp,
|
|
146
|
-
metadata: event.metadata,
|
|
147
|
-
};
|
|
148
|
-
// Only include optional properties if they're defined
|
|
149
|
-
if (event.sessionId !== undefined) {
|
|
150
|
-
approval.sessionId = event.sessionId;
|
|
151
|
-
}
|
|
152
|
-
if (event.timeout !== undefined) {
|
|
153
|
-
approval.timeout = event.timeout;
|
|
154
|
-
}
|
|
155
|
-
dispatch({
|
|
156
|
-
type: 'APPROVAL_REQUEST',
|
|
157
|
-
approval,
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
// Subscribe to events
|
|
162
|
-
bus.on('llm:thinking', handleThinking);
|
|
163
|
-
bus.on('llm:chunk', handleChunk);
|
|
164
|
-
bus.on('llm:response', handleResponse);
|
|
165
|
-
bus.on('llm:error', handleError);
|
|
166
|
-
bus.on('llm:tool-call', handleToolCall);
|
|
167
|
-
bus.on('llm:tool-result', handleToolResult);
|
|
168
|
-
bus.on('approval:request', handleApprovalRequest);
|
|
27
|
+
const controller = new AbortController();
|
|
28
|
+
const { signal } = controller;
|
|
29
|
+
// Increase listener limit for safety
|
|
30
|
+
setMaxListeners(15, signal);
|
|
31
|
+
// NOTE: approval:request is now handled in processStream (via iterator) for proper
|
|
32
|
+
// event ordering. Direct bus subscription here caused a race condition where
|
|
33
|
+
// approval UI showed before text messages were added.
|
|
169
34
|
// Handle model switch
|
|
170
|
-
|
|
35
|
+
bus.on('llm:switched', (payload) => {
|
|
171
36
|
if (payload.newConfig?.model) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
modelName: payload.newConfig.model,
|
|
175
|
-
});
|
|
37
|
+
setSession((prev) => ({
|
|
38
|
+
...prev,
|
|
39
|
+
modelName: getModelDisplayName(payload.newConfig.model, payload.newConfig.provider),
|
|
40
|
+
}));
|
|
176
41
|
}
|
|
177
|
-
};
|
|
42
|
+
}, { signal });
|
|
178
43
|
// Handle conversation reset
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
44
|
+
bus.on('session:reset', () => {
|
|
45
|
+
setMessages([]);
|
|
46
|
+
setApproval(null);
|
|
47
|
+
setApprovalQueue([]);
|
|
48
|
+
setQueuedMessages([]);
|
|
49
|
+
setUi((prev) => ({ ...prev, activeOverlay: 'none' }));
|
|
50
|
+
}, { signal });
|
|
51
|
+
// Handle session creation (e.g., from /new command if we add one)
|
|
52
|
+
bus.on('session:created', (payload) => {
|
|
185
53
|
if (payload.switchTo) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
hasActiveSession:
|
|
192
|
-
}
|
|
54
|
+
setMessages([]);
|
|
55
|
+
setApproval(null);
|
|
56
|
+
setApprovalQueue([]);
|
|
57
|
+
setQueuedMessages([]);
|
|
58
|
+
if (payload.sessionId === null) {
|
|
59
|
+
setSession((prev) => ({ ...prev, id: null, hasActiveSession: false }));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
setSession((prev) => ({
|
|
63
|
+
...prev,
|
|
64
|
+
id: payload.sessionId,
|
|
65
|
+
hasActiveSession: true,
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
setUi((prev) => ({ ...prev, activeOverlay: 'none' }));
|
|
193
69
|
}
|
|
194
|
-
};
|
|
195
|
-
//
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
bus.on('
|
|
199
|
-
|
|
70
|
+
}, { signal });
|
|
71
|
+
// Handle context cleared (from /clear command)
|
|
72
|
+
// Keep messages visible for user reference - only context sent to LLM is cleared
|
|
73
|
+
// Just clean up any pending approvals/overlays/queued messages
|
|
74
|
+
bus.on('context:cleared', () => {
|
|
75
|
+
setApproval(null);
|
|
76
|
+
setApprovalQueue([]);
|
|
77
|
+
setQueuedMessages([]);
|
|
78
|
+
setUi((prev) => ({ ...prev, activeOverlay: 'none' }));
|
|
79
|
+
}, { signal });
|
|
80
|
+
// Handle message queued - fetch full queue state from agent
|
|
81
|
+
bus.on('message:queued', (payload) => {
|
|
82
|
+
if (!payload.sessionId)
|
|
83
|
+
return;
|
|
84
|
+
// Fetch fresh queue state from agent to ensure consistency
|
|
85
|
+
agent
|
|
86
|
+
.getQueuedMessages(payload.sessionId)
|
|
87
|
+
.then((messages) => {
|
|
88
|
+
setQueuedMessages(messages);
|
|
89
|
+
})
|
|
90
|
+
.catch(() => {
|
|
91
|
+
// Silently ignore - queue state will sync on next event
|
|
92
|
+
});
|
|
93
|
+
}, { signal });
|
|
94
|
+
// Handle message removed from queue
|
|
95
|
+
bus.on('message:removed', (payload) => {
|
|
96
|
+
setQueuedMessages((prev) => prev.filter((m) => m.id !== payload.id));
|
|
97
|
+
}, { signal });
|
|
98
|
+
// Note: message:dequeued is handled in processStream (via iterator) for proper synchronization
|
|
99
|
+
// with streaming events. Don't handle it here via event bus.
|
|
100
|
+
// Cleanup: abort controller removes all listeners at once
|
|
200
101
|
return () => {
|
|
201
|
-
|
|
202
|
-
bus.off('llm:chunk', handleChunk);
|
|
203
|
-
bus.off('llm:response', handleResponse);
|
|
204
|
-
bus.off('llm:error', handleError);
|
|
205
|
-
bus.off('llm:tool-call', handleToolCall);
|
|
206
|
-
bus.off('llm:tool-result', handleToolResult);
|
|
207
|
-
bus.off('approval:request', handleApprovalRequest);
|
|
208
|
-
bus.off('llm:switched', handleModelSwitch);
|
|
209
|
-
bus.off('session:reset', handleConversationReset);
|
|
210
|
-
bus.off('session:created', handleSessionCreated);
|
|
102
|
+
controller.abort();
|
|
211
103
|
};
|
|
212
|
-
}, [agent,
|
|
104
|
+
}, [agent, setMessages, setUi, setSession, setApproval, setApprovalQueue, setQueuedMessages]);
|
|
213
105
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useBatchedScroll Hook
|
|
3
|
+
* Prevents scroll jitter by batching multiple scroll updates in the same frame.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A hook to manage batched scroll state updates.
|
|
7
|
+
* It allows multiple scroll operations within the same tick to accumulate
|
|
8
|
+
* by keeping track of a 'pending' state that resets after render.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useBatchedScroll(currentScrollTop: number): {
|
|
11
|
+
getScrollTop: () => number;
|
|
12
|
+
setPendingScrollTop: (newScrollTop: number) => void;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useBatchedScroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBatchedScroll.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useBatchedScroll.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,MAAM;;wCAgBE,MAAM;EAKhE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useBatchedScroll Hook
|
|
3
|
+
* Prevents scroll jitter by batching multiple scroll updates in the same frame.
|
|
4
|
+
*/
|
|
5
|
+
import { useRef, useEffect, useCallback } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* A hook to manage batched scroll state updates.
|
|
8
|
+
* It allows multiple scroll operations within the same tick to accumulate
|
|
9
|
+
* by keeping track of a 'pending' state that resets after render.
|
|
10
|
+
*/
|
|
11
|
+
export function useBatchedScroll(currentScrollTop) {
|
|
12
|
+
const pendingScrollTopRef = useRef(null);
|
|
13
|
+
// We use a ref for currentScrollTop to allow getScrollTop to be stable
|
|
14
|
+
// and not depend on the currentScrollTop value directly in its dependency array.
|
|
15
|
+
const currentScrollTopRef = useRef(currentScrollTop);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
currentScrollTopRef.current = currentScrollTop;
|
|
18
|
+
pendingScrollTopRef.current = null;
|
|
19
|
+
});
|
|
20
|
+
const getScrollTop = useCallback(() => pendingScrollTopRef.current ?? currentScrollTopRef.current, []);
|
|
21
|
+
const setPendingScrollTop = useCallback((newScrollTop) => {
|
|
22
|
+
pendingScrollTopRef.current = newScrollTop;
|
|
23
|
+
}, []);
|
|
24
|
+
return { getScrollTop, setPendingScrollTop };
|
|
25
|
+
}
|