dexto 1.6.0 → 1.6.2
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/dist/agents/coding-agent/coding-agent.yml +3 -1
- package/dist/analytics/wrapper.js +1 -1
- package/dist/cli/auth/dexto-api-key.d.ts +34 -0
- package/dist/cli/auth/dexto-api-key.d.ts.map +1 -0
- package/dist/cli/auth/dexto-api-key.js +161 -0
- package/dist/cli/auth/index.d.ts +2 -1
- package/dist/cli/auth/index.d.ts.map +1 -1
- package/dist/cli/auth/index.js +2 -1
- package/dist/cli/auth/oauth.d.ts +10 -0
- package/dist/cli/auth/oauth.d.ts.map +1 -1
- package/dist/cli/auth/oauth.js +113 -36
- package/dist/cli/auth/service.d.ts +1 -0
- package/dist/cli/auth/service.d.ts.map +1 -1
- package/dist/cli/auth/service.js +1 -0
- package/dist/cli/commands/auth/login.d.ts.map +1 -1
- package/dist/cli/commands/auth/login.js +40 -105
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +157 -120
- package/dist/cli/utils/config-validation.js +3 -3
- package/dist/cli/utils/options.d.ts.map +1 -1
- package/dist/cli/utils/options.js +6 -0
- package/dist/index-main.js +36 -2
- package/dist/utils/session-logger-factory.d.ts.map +1 -1
- package/dist/utils/session-logger-factory.js +17 -2
- package/dist/webui/assets/index-BPlk2Wbt.css +1 -0
- package/dist/webui/assets/index-BZvrpxyh.js +2059 -0
- package/dist/webui/index.html +2 -2
- package/package.json +13 -23
- package/dist/cli/commands/interactive-commands/auth/index.d.ts +0 -12
- package/dist/cli/commands/interactive-commands/auth/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/auth/index.js +0 -20
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +0 -56
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +0 -173
- package/dist/cli/commands/interactive-commands/commands.d.ts +0 -52
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/commands.js +0 -142
- package/dist/cli/commands/interactive-commands/documentation-commands.d.ts +0 -15
- package/dist/cli/commands/interactive-commands/documentation-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/documentation-commands.js +0 -39
- package/dist/cli/commands/interactive-commands/export/index.d.ts +0 -13
- package/dist/cli/commands/interactive-commands/export/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/export/index.js +0 -21
- package/dist/cli/commands/interactive-commands/general-commands.d.ts +0 -22
- package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/general-commands.js +0 -458
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts +0 -13
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/index.js +0 -18
- package/dist/cli/commands/interactive-commands/model/index.d.ts +0 -13
- package/dist/cli/commands/interactive-commands/model/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/model/index.js +0 -19
- package/dist/cli/commands/interactive-commands/plugin/index.d.ts +0 -13
- package/dist/cli/commands/interactive-commands/plugin/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/plugin/index.js +0 -18
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +0 -25
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +0 -339
- package/dist/cli/commands/interactive-commands/session/index.d.ts +0 -16
- package/dist/cli/commands/interactive-commands/session/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/session/index.js +0 -15
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +0 -32
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/session/session-commands.js +0 -67
- package/dist/cli/commands/interactive-commands/system/index.d.ts +0 -13
- package/dist/cli/commands/interactive-commands/system/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/system/index.js +0 -12
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts +0 -18
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +0 -197
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts +0 -15
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/tool-commands.js +0 -24
- package/dist/cli/commands/interactive-commands/utils/arg-parser.d.ts +0 -57
- package/dist/cli/commands/interactive-commands/utils/arg-parser.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/utils/arg-parser.js +0 -81
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts +0 -40
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/utils/command-output.js +0 -56
- package/dist/cli/commands/interactive-commands/utils/format-output.d.ts +0 -14
- package/dist/cli/commands/interactive-commands/utils/format-output.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/utils/format-output.js +0 -18
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts +0 -52
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +0 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +0 -120
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +0 -44
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +0 -269
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.d.ts +0 -18
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.js +0 -48
- package/dist/cli/ink-cli/components/CustomInput.d.ts +0 -17
- package/dist/cli/ink-cli/components/CustomInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/CustomInput.js +0 -51
- package/dist/cli/ink-cli/components/CustomTextInput.d.ts +0 -16
- package/dist/cli/ink-cli/components/CustomTextInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/CustomTextInput.js +0 -36
- package/dist/cli/ink-cli/components/EditableMultiLineInput.d.ts +0 -19
- package/dist/cli/ink-cli/components/EditableMultiLineInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/EditableMultiLineInput.js +0 -120
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts +0 -22
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/ElicitationForm.js +0 -358
- package/dist/cli/ink-cli/components/ErrorBoundary.d.ts +0 -20
- package/dist/cli/ink-cli/components/ErrorBoundary.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/ErrorBoundary.js +0 -29
- package/dist/cli/ink-cli/components/Footer.d.ts +0 -22
- package/dist/cli/ink-cli/components/Footer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/Footer.js +0 -76
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts +0 -17
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/HistorySearchBar.js +0 -8
- package/dist/cli/ink-cli/components/MultiLineInput.d.ts +0 -12
- package/dist/cli/ink-cli/components/MultiLineInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/MultiLineInput.js +0 -27
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts +0 -26
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +0 -376
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts +0 -28
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +0 -432
- package/dist/cli/ink-cli/components/StatusBar.d.ts +0 -41
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/StatusBar.js +0 -110
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts +0 -52
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/TextBufferInput.js +0 -490
- package/dist/cli/ink-cli/components/TodoPanel.d.ts +0 -26
- package/dist/cli/ink-cli/components/TodoPanel.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/TodoPanel.js +0 -62
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.d.ts +0 -29
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.js +0 -98
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts +0 -36
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.js +0 -118
- package/dist/cli/ink-cli/components/base/index.d.ts +0 -6
- package/dist/cli/ink-cli/components/base/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/base/index.js +0 -5
- package/dist/cli/ink-cli/components/chat/ChatView.d.ts +0 -19
- package/dist/cli/ink-cli/components/chat/ChatView.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/ChatView.js +0 -11
- package/dist/cli/ink-cli/components/chat/Footer.d.ts +0 -9
- package/dist/cli/ink-cli/components/chat/Footer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/Footer.js +0 -8
- package/dist/cli/ink-cli/components/chat/Header.d.ts +0 -18
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/Header.js +0 -16
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts +0 -21
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +0 -180
- package/dist/cli/ink-cli/components/chat/MessageList.d.ts +0 -16
- package/dist/cli/ink-cli/components/chat/MessageList.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/MessageList.js +0 -20
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts +0 -16
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +0 -27
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +0 -18
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +0 -46
- package/dist/cli/ink-cli/components/chat/index.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/index.js +0 -9
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +0 -6
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +0 -15
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +0 -9
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +0 -37
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +0 -9
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +0 -6
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +0 -29
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts +0 -45
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +0 -38
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts +0 -10
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.js +0 -6
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts +0 -13
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.js +0 -12
- package/dist/cli/ink-cli/components/input/InputArea.d.ts +0 -46
- package/dist/cli/ink-cli/components/input/InputArea.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/input/InputArea.js +0 -6
- package/dist/cli/ink-cli/components/input/index.d.ts +0 -5
- package/dist/cli/ink-cli/components/input/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/input/index.js +0 -4
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +0 -27
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +0 -180
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +0 -29
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +0 -107
- package/dist/cli/ink-cli/components/modes/index.d.ts +0 -10
- package/dist/cli/ink-cli/components/modes/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/modes/index.js +0 -9
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts +0 -26
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +0 -92
- package/dist/cli/ink-cli/components/overlays/ContextStatsOverlay.d.ts +0 -26
- package/dist/cli/ink-cli/components/overlays/ContextStatsOverlay.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/ContextStatsOverlay.js +0 -241
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +0 -29
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +0 -301
- package/dist/cli/ink-cli/components/overlays/ExportWizard.d.ts +0 -22
- package/dist/cli/ink-cli/components/overlays/ExportWizard.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/ExportWizard.js +0 -308
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +0 -23
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +0 -70
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts +0 -20
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.js +0 -81
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts +0 -31
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.js +0 -297
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts +0 -22
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +0 -59
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts +0 -26
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +0 -73
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +0 -51
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts +0 -29
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +0 -215
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts +0 -22
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +0 -80
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpSelector.js +0 -52
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +0 -28
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +0 -93
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts +0 -29
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +0 -116
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +0 -28
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +0 -630
- package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts +0 -27
- package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PluginActions.js +0 -66
- package/dist/cli/ink-cli/components/overlays/PluginList.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/PluginList.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PluginList.js +0 -70
- package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PluginManager.js +0 -63
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts +0 -22
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +0 -52
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts +0 -29
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +0 -166
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts +0 -27
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +0 -119
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts +0 -33
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/PromptList.js +0 -147
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts +0 -23
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +0 -189
- package/dist/cli/ink-cli/components/overlays/SessionRenameOverlay.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/SessionRenameOverlay.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/SessionRenameOverlay.js +0 -63
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts +0 -26
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.js +0 -126
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts +0 -21
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +0 -42
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts +0 -20
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/StreamSelector.js +0 -58
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +0 -26
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +0 -642
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts +0 -25
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.js +0 -609
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts +0 -15
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.js +0 -14
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +0 -42
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +0 -547
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts +0 -25
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +0 -29
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts +0 -17
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.js +0 -11
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts +0 -20
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +0 -10
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts +0 -30
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.js +0 -13
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts +0 -8
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.js +0 -7
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts +0 -85
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.js +0 -38
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts +0 -21
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +0 -65
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +0 -30
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +0 -66
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts +0 -19
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/FileRenderer.js +0 -26
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts +0 -21
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +0 -26
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts +0 -20
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +0 -26
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts +0 -21
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +0 -25
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts +0 -61
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/diff-shared.js +0 -158
- package/dist/cli/ink-cli/components/renderers/index.d.ts +0 -28
- package/dist/cli/ink-cli/components/renderers/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/renderers/index.js +0 -36
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts +0 -38
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/shared/MarkdownText.js +0 -389
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts +0 -44
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/shared/VirtualizedList.js +0 -300
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts +0 -185
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/shared/text-buffer.js +0 -1338
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts +0 -10
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts.map +0 -1
- package/dist/cli/ink-cli/constants/processingPhrases.js +0 -92
- package/dist/cli/ink-cli/constants/tips.d.ts +0 -15
- package/dist/cli/ink-cli/constants/tips.d.ts.map +0 -1
- package/dist/cli/ink-cli/constants/tips.js +0 -57
- package/dist/cli/ink-cli/containers/InputContainer.d.ts +0 -62
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +0 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +0 -639
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +0 -42
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +0 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +0 -1824
- package/dist/cli/ink-cli/containers/index.d.ts +0 -6
- package/dist/cli/ink-cli/containers/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/containers/index.js +0 -5
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts +0 -36
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts.map +0 -1
- package/dist/cli/ink-cli/contexts/KeypressContext.js +0 -461
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts +0 -27
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts.map +0 -1
- package/dist/cli/ink-cli/contexts/MouseContext.js +0 -102
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts +0 -33
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts.map +0 -1
- package/dist/cli/ink-cli/contexts/ScrollProvider.js +0 -170
- package/dist/cli/ink-cli/contexts/SoundContext.d.ts +0 -23
- package/dist/cli/ink-cli/contexts/SoundContext.d.ts.map +0 -1
- package/dist/cli/ink-cli/contexts/SoundContext.js +0 -22
- package/dist/cli/ink-cli/contexts/index.d.ts +0 -8
- package/dist/cli/ink-cli/contexts/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/contexts/index.js +0 -7
- package/dist/cli/ink-cli/hooks/index.d.ts +0 -12
- package/dist/cli/ink-cli/hooks/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/index.js +0 -14
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +0 -49
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +0 -369
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts +0 -14
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useBatchedScroll.js +0 -25
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts +0 -52
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useCLIState.js +0 -223
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts +0 -24
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useElapsedTime.js +0 -69
- package/dist/cli/ink-cli/hooks/useGitBranch.d.ts +0 -13
- package/dist/cli/ink-cli/hooks/useGitBranch.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useGitBranch.js +0 -35
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts +0 -61
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useHistorySearch.js +0 -210
- package/dist/cli/ink-cli/hooks/useInputHistory.d.ts +0 -18
- package/dist/cli/ink-cli/hooks/useInputHistory.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useInputHistory.js +0 -26
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts +0 -136
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +0 -715
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts +0 -21
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.js +0 -80
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts +0 -18
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useKeypress.js +0 -26
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts +0 -30
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/usePhraseCycler.js +0 -68
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts +0 -19
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useStreaming.js +0 -26
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts +0 -14
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useTerminalSize.js +0 -31
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts +0 -46
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +0 -1
- package/dist/cli/ink-cli/hooks/useTokenCounter.js +0 -122
- package/dist/cli/ink-cli/services/CommandService.d.ts +0 -58
- package/dist/cli/ink-cli/services/CommandService.d.ts.map +0 -1
- package/dist/cli/ink-cli/services/CommandService.js +0 -64
- package/dist/cli/ink-cli/services/InputService.d.ts +0 -40
- package/dist/cli/ink-cli/services/InputService.d.ts.map +0 -1
- package/dist/cli/ink-cli/services/InputService.js +0 -87
- package/dist/cli/ink-cli/services/MessageService.d.ts +0 -35
- package/dist/cli/ink-cli/services/MessageService.d.ts.map +0 -1
- package/dist/cli/ink-cli/services/MessageService.js +0 -49
- package/dist/cli/ink-cli/services/index.d.ts +0 -8
- package/dist/cli/ink-cli/services/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/services/index.js +0 -7
- package/dist/cli/ink-cli/services/processStream.d.ts +0 -75
- package/dist/cli/ink-cli/services/processStream.d.ts.map +0 -1
- package/dist/cli/ink-cli/services/processStream.js +0 -942
- package/dist/cli/ink-cli/state/actions.d.ts +0 -124
- package/dist/cli/ink-cli/state/actions.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/actions.js +0 -8
- package/dist/cli/ink-cli/state/index.d.ts +0 -10
- package/dist/cli/ink-cli/state/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/index.js +0 -8
- package/dist/cli/ink-cli/state/initialState.d.ts +0 -12
- package/dist/cli/ink-cli/state/initialState.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/initialState.js +0 -57
- package/dist/cli/ink-cli/state/reducer.d.ts +0 -15
- package/dist/cli/ink-cli/state/reducer.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/reducer.js +0 -341
- package/dist/cli/ink-cli/state/streaming-state.d.ts +0 -27
- package/dist/cli/ink-cli/state/streaming-state.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/streaming-state.js +0 -39
- package/dist/cli/ink-cli/state/types.d.ts +0 -366
- package/dist/cli/ink-cli/state/types.d.ts.map +0 -1
- package/dist/cli/ink-cli/state/types.js +0 -5
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts +0 -22
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/bracketedPaste.js +0 -27
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts +0 -49
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/clipboardUtils.js +0 -356
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts +0 -33
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/commandOverlays.js +0 -84
- package/dist/cli/ink-cli/utils/debugLog.d.ts +0 -38
- package/dist/cli/ink-cli/utils/debugLog.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/debugLog.js +0 -66
- package/dist/cli/ink-cli/utils/idGenerator.d.ts +0 -10
- package/dist/cli/ink-cli/utils/idGenerator.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/idGenerator.js +0 -12
- package/dist/cli/ink-cli/utils/index.d.ts +0 -9
- package/dist/cli/ink-cli/utils/index.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/index.js +0 -13
- package/dist/cli/ink-cli/utils/input.d.ts +0 -25
- package/dist/cli/ink-cli/utils/input.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/input.js +0 -56
- package/dist/cli/ink-cli/utils/inputParsing.d.ts +0 -31
- package/dist/cli/ink-cli/utils/inputParsing.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/inputParsing.js +0 -70
- package/dist/cli/ink-cli/utils/llm-provider-display.d.ts +0 -3
- package/dist/cli/ink-cli/utils/llm-provider-display.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/llm-provider-display.js +0 -22
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +0 -140
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +0 -591
- package/dist/cli/ink-cli/utils/mouse.d.ts +0 -61
- package/dist/cli/ink-cli/utils/mouse.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/mouse.js +0 -209
- package/dist/cli/ink-cli/utils/soundNotification.d.ts +0 -71
- package/dist/cli/ink-cli/utils/soundNotification.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/soundNotification.js +0 -203
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts +0 -44
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/streamSplitter.js +0 -154
- package/dist/cli/ink-cli/utils/textUtils.d.ts +0 -63
- package/dist/cli/ink-cli/utils/textUtils.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/textUtils.js +0 -248
- package/dist/cli/ink-cli/utils/toolUtils.d.ts +0 -20
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +0 -1
- package/dist/cli/ink-cli/utils/toolUtils.js +0 -25
- package/dist/webui/assets/index-C9JXwpvo.css +0 -1
- package/dist/webui/assets/index-DwtueA8l.js +0 -2059
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared CLI State Hook
|
|
3
|
-
*
|
|
4
|
-
* Contains all common state and logic shared between rendering modes.
|
|
5
|
-
* Both AlternateBufferCLI and StaticCLI use this hook.
|
|
6
|
-
*/
|
|
7
|
-
import { useState, useMemo, useEffect, useRef, useCallback } from 'react';
|
|
8
|
-
import { useStdout } from 'ink';
|
|
9
|
-
import { getModelDisplayName, isUserMessage, } from '@dexto/core';
|
|
10
|
-
import { useAgentEvents } from './useAgentEvents.js';
|
|
11
|
-
import { useInputOrchestrator } from './useInputOrchestrator.js';
|
|
12
|
-
import { InputService, MessageService } from '../services/index.js';
|
|
13
|
-
import { convertHistoryToUIMessages } from '../utils/messageFormatting.js';
|
|
14
|
-
import { useTextBuffer } from '../components/shared/text-buffer.js';
|
|
15
|
-
export function useCLIState({ agent, initialSessionId, startupInfo, onKeyboardScroll: _onKeyboardScroll, }) {
|
|
16
|
-
// Messages state - finalized messages (rendered in <Static>)
|
|
17
|
-
const [messages, setMessages] = useState([]);
|
|
18
|
-
// Pending messages - streaming/in-progress (rendered dynamically outside <Static>)
|
|
19
|
-
const [pendingMessages, setPendingMessages] = useState([]);
|
|
20
|
-
// Dequeued buffer - user messages rendered after pending (guarantees visual order)
|
|
21
|
-
const [dequeuedBuffer, setDequeuedBuffer] = useState([]);
|
|
22
|
-
// Queued messages - messages waiting to be processed (uses core type)
|
|
23
|
-
const [queuedMessages, setQueuedMessages] = useState([]);
|
|
24
|
-
// Todo items for workflow tracking (populated via service:event from todo tools)
|
|
25
|
-
const [todos, setTodos] = useState([]);
|
|
26
|
-
// UI state
|
|
27
|
-
const [ui, setUi] = useState({
|
|
28
|
-
isProcessing: false,
|
|
29
|
-
isCancelling: false,
|
|
30
|
-
isThinking: false,
|
|
31
|
-
isCompacting: false,
|
|
32
|
-
activeOverlay: 'none',
|
|
33
|
-
exitWarningShown: false,
|
|
34
|
-
exitWarningTimestamp: null,
|
|
35
|
-
mcpWizardServerType: null,
|
|
36
|
-
copyModeEnabled: false,
|
|
37
|
-
pendingModelSwitch: null,
|
|
38
|
-
selectedMcpServer: null,
|
|
39
|
-
historySearch: {
|
|
40
|
-
isActive: false,
|
|
41
|
-
query: '',
|
|
42
|
-
matchIndex: 0,
|
|
43
|
-
originalInput: '',
|
|
44
|
-
lastMatch: '',
|
|
45
|
-
},
|
|
46
|
-
promptAddWizard: null,
|
|
47
|
-
autoApproveEdits: false,
|
|
48
|
-
todoExpanded: true, // Default to expanded to show full todo list
|
|
49
|
-
backgroundTasksRunning: 0,
|
|
50
|
-
backgroundTasksExpanded: false,
|
|
51
|
-
backgroundTasks: [],
|
|
52
|
-
planModeActive: false,
|
|
53
|
-
planModeInitialized: false,
|
|
54
|
-
});
|
|
55
|
-
// Input state
|
|
56
|
-
const [input, setInput] = useState({
|
|
57
|
-
value: '',
|
|
58
|
-
history: [],
|
|
59
|
-
historyIndex: -1,
|
|
60
|
-
draftBeforeHistory: '',
|
|
61
|
-
images: [],
|
|
62
|
-
pastedBlocks: [],
|
|
63
|
-
pasteCounter: 0,
|
|
64
|
-
});
|
|
65
|
-
// Session state - use display name for built-in models at startup
|
|
66
|
-
const initialConfig = agent.getCurrentLLMConfig();
|
|
67
|
-
const [session, setSession] = useState({
|
|
68
|
-
id: initialSessionId,
|
|
69
|
-
hasActiveSession: initialSessionId !== null,
|
|
70
|
-
modelName: getModelDisplayName(initialConfig.model, initialConfig.provider),
|
|
71
|
-
});
|
|
72
|
-
// Approval state
|
|
73
|
-
const [approval, setApproval] = useState(null);
|
|
74
|
-
const [approvalQueue, setApprovalQueue] = useState([]);
|
|
75
|
-
// Initialize services (memoized)
|
|
76
|
-
const inputService = useMemo(() => new InputService(), []);
|
|
77
|
-
const messageService = useMemo(() => new MessageService(), []);
|
|
78
|
-
// Get terminal dimensions for buffer
|
|
79
|
-
const { stdout } = useStdout();
|
|
80
|
-
const terminalWidth = stdout?.columns || 80;
|
|
81
|
-
const inputWidth = Math.max(20, terminalWidth - 4);
|
|
82
|
-
// Memoize onChange to prevent infinite loops (useTextBuffer has onChange in deps)
|
|
83
|
-
const handleBufferChange = useCallback((text) => {
|
|
84
|
-
setInput((prev) => ({ ...prev, value: text }));
|
|
85
|
-
}, []);
|
|
86
|
-
// Create text buffer (source of truth for input)
|
|
87
|
-
const buffer = useTextBuffer({
|
|
88
|
-
initialText: '',
|
|
89
|
-
viewport: { width: inputWidth, height: 10 },
|
|
90
|
-
onChange: handleBufferChange,
|
|
91
|
-
});
|
|
92
|
-
// Update viewport on terminal resize
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
buffer.setViewport(inputWidth, 10);
|
|
95
|
-
}, [inputWidth, buffer.setViewport]);
|
|
96
|
-
// Ref for overlay container (input no longer needs ref)
|
|
97
|
-
const overlayContainerRef = useRef(null);
|
|
98
|
-
// Setup event bus subscriptions for non-streaming events
|
|
99
|
-
// (streaming events are handled directly via agent.stream() iterator in InputContainer)
|
|
100
|
-
// Also handles external triggers (run:invoke) from scheduler, A2A, API
|
|
101
|
-
useAgentEvents({
|
|
102
|
-
agent,
|
|
103
|
-
setMessages,
|
|
104
|
-
setPendingMessages,
|
|
105
|
-
setUi,
|
|
106
|
-
setSession,
|
|
107
|
-
setInput,
|
|
108
|
-
setApproval,
|
|
109
|
-
setApprovalQueue,
|
|
110
|
-
setQueuedMessages,
|
|
111
|
-
currentSessionId: session.id,
|
|
112
|
-
buffer,
|
|
113
|
-
});
|
|
114
|
-
// Create input handlers for the orchestrator
|
|
115
|
-
// Note: Main input is NOT routed through orchestrator - TextBufferInput handles it directly
|
|
116
|
-
const approvalHandler = useCallback((inputStr, key) => {
|
|
117
|
-
return overlayContainerRef.current?.handleInput(inputStr, key) ?? false;
|
|
118
|
-
}, []);
|
|
119
|
-
const overlayHandler = useCallback((inputStr, key) => {
|
|
120
|
-
return overlayContainerRef.current?.handleInput(inputStr, key) ?? false;
|
|
121
|
-
}, []);
|
|
122
|
-
// Setup unified input orchestrator (handles global shortcuts, approval, overlay only)
|
|
123
|
-
useInputOrchestrator({
|
|
124
|
-
ui,
|
|
125
|
-
approval,
|
|
126
|
-
input,
|
|
127
|
-
session,
|
|
128
|
-
queuedMessages,
|
|
129
|
-
buffer,
|
|
130
|
-
setUi,
|
|
131
|
-
setInput,
|
|
132
|
-
setMessages,
|
|
133
|
-
setPendingMessages,
|
|
134
|
-
setQueuedMessages,
|
|
135
|
-
agent,
|
|
136
|
-
handlers: {
|
|
137
|
-
approval: approvalHandler,
|
|
138
|
-
overlay: overlayHandler,
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
// Clear todos when session changes (todos are per-session)
|
|
142
|
-
useEffect(() => {
|
|
143
|
-
setTodos([]);
|
|
144
|
-
}, [session.id]);
|
|
145
|
-
// Hydrate conversation history when resuming a session
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
if (!initialSessionId || !session.hasActiveSession || messages.length > 0) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
let cancelled = false;
|
|
151
|
-
(async () => {
|
|
152
|
-
try {
|
|
153
|
-
const history = await agent.getSessionHistory(initialSessionId);
|
|
154
|
-
if (!history?.length || cancelled)
|
|
155
|
-
return;
|
|
156
|
-
const historyMessages = convertHistoryToUIMessages(history, initialSessionId);
|
|
157
|
-
setMessages(historyMessages);
|
|
158
|
-
// Extract user messages for input history (arrow up navigation)
|
|
159
|
-
const userInputHistory = history
|
|
160
|
-
.filter(isUserMessage)
|
|
161
|
-
.map((msg) => msg.content
|
|
162
|
-
.filter((part) => part.type === 'text')
|
|
163
|
-
.map((part) => part.text)
|
|
164
|
-
.join('\n'))
|
|
165
|
-
.filter((text) => text.trim().length > 0);
|
|
166
|
-
setInput((prev) => ({
|
|
167
|
-
...prev,
|
|
168
|
-
history: userInputHistory,
|
|
169
|
-
historyIndex: -1,
|
|
170
|
-
}));
|
|
171
|
-
}
|
|
172
|
-
catch (error) {
|
|
173
|
-
if (cancelled)
|
|
174
|
-
return;
|
|
175
|
-
setMessages((prev) => [
|
|
176
|
-
...prev,
|
|
177
|
-
{
|
|
178
|
-
id: `error-${Date.now()}`,
|
|
179
|
-
role: 'system',
|
|
180
|
-
content: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
181
|
-
timestamp: new Date(),
|
|
182
|
-
},
|
|
183
|
-
]);
|
|
184
|
-
}
|
|
185
|
-
})();
|
|
186
|
-
return () => {
|
|
187
|
-
cancelled = true;
|
|
188
|
-
};
|
|
189
|
-
}, [agent, initialSessionId, messages.length, session.hasActiveSession]);
|
|
190
|
-
// Get visible messages - no limit needed
|
|
191
|
-
// Static mode: items are permanent in terminal scrollback, Ink only renders NEW keys
|
|
192
|
-
// AlternateBuffer mode: VirtualizedList handles its own virtualization
|
|
193
|
-
const visibleMessages = messages;
|
|
194
|
-
return {
|
|
195
|
-
messages,
|
|
196
|
-
setMessages,
|
|
197
|
-
pendingMessages,
|
|
198
|
-
setPendingMessages,
|
|
199
|
-
dequeuedBuffer,
|
|
200
|
-
setDequeuedBuffer,
|
|
201
|
-
queuedMessages,
|
|
202
|
-
setQueuedMessages,
|
|
203
|
-
todos,
|
|
204
|
-
setTodos,
|
|
205
|
-
ui,
|
|
206
|
-
setUi,
|
|
207
|
-
input,
|
|
208
|
-
setInput,
|
|
209
|
-
session,
|
|
210
|
-
setSession,
|
|
211
|
-
approval,
|
|
212
|
-
setApproval,
|
|
213
|
-
approvalQueue,
|
|
214
|
-
setApprovalQueue,
|
|
215
|
-
buffer,
|
|
216
|
-
inputService,
|
|
217
|
-
messageService,
|
|
218
|
-
overlayContainerRef,
|
|
219
|
-
visibleMessages,
|
|
220
|
-
agent,
|
|
221
|
-
startupInfo,
|
|
222
|
-
};
|
|
223
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useElapsedTime Hook
|
|
3
|
-
* Tracks elapsed time during processing with live updates
|
|
4
|
-
*/
|
|
5
|
-
export interface ElapsedTimeOptions {
|
|
6
|
-
/** Whether timing is active (should only run during processing) */
|
|
7
|
-
isActive: boolean;
|
|
8
|
-
/** Update interval in milliseconds (default: 100ms) */
|
|
9
|
-
intervalMs?: number;
|
|
10
|
-
}
|
|
11
|
-
export interface ElapsedTimeResult {
|
|
12
|
-
/** Elapsed time in milliseconds */
|
|
13
|
-
elapsedMs: number;
|
|
14
|
-
/** Formatted elapsed time string (e.g., "1.2s", "1m 23s") */
|
|
15
|
-
formatted: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Hook that tracks elapsed time during processing
|
|
19
|
-
*
|
|
20
|
-
* @param options - Configuration options
|
|
21
|
-
* @returns Elapsed time in ms and formatted string
|
|
22
|
-
*/
|
|
23
|
-
export declare function useElapsedTime({ isActive, intervalMs, }: ElapsedTimeOptions): ElapsedTimeResult;
|
|
24
|
-
//# sourceMappingURL=useElapsedTime.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useElapsedTime.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useElapsedTime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,kBAAkB;IAC/B,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAC9B,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;CACrB;AA4BD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC3B,QAAQ,EACR,UAAgB,GACnB,EAAE,kBAAkB,GAAG,iBAAiB,CAuCxC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useElapsedTime Hook
|
|
3
|
-
* Tracks elapsed time during processing with live updates
|
|
4
|
-
*/
|
|
5
|
-
import { useState, useEffect, useRef } from 'react';
|
|
6
|
-
/**
|
|
7
|
-
* Format milliseconds into a human-readable string
|
|
8
|
-
* - Under 1 minute: "1.2s"
|
|
9
|
-
* - 1+ minutes: "1m 23s"
|
|
10
|
-
* - 1+ hours: "1h 2m 3s"
|
|
11
|
-
*/
|
|
12
|
-
function formatElapsedTime(ms) {
|
|
13
|
-
const seconds = Math.floor(ms / 1000);
|
|
14
|
-
const tenths = Math.floor((ms % 1000) / 100);
|
|
15
|
-
if (seconds < 60) {
|
|
16
|
-
return `${seconds}.${tenths}s`;
|
|
17
|
-
}
|
|
18
|
-
const minutes = Math.floor(seconds / 60);
|
|
19
|
-
const remainingSeconds = seconds % 60;
|
|
20
|
-
if (minutes < 60) {
|
|
21
|
-
return `${minutes}m ${remainingSeconds}s`;
|
|
22
|
-
}
|
|
23
|
-
const hours = Math.floor(minutes / 60);
|
|
24
|
-
const remainingMinutes = minutes % 60;
|
|
25
|
-
return `${hours}h ${remainingMinutes}m ${remainingSeconds}s`;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Hook that tracks elapsed time during processing
|
|
29
|
-
*
|
|
30
|
-
* @param options - Configuration options
|
|
31
|
-
* @returns Elapsed time in ms and formatted string
|
|
32
|
-
*/
|
|
33
|
-
export function useElapsedTime({ isActive, intervalMs = 100, }) {
|
|
34
|
-
const [elapsedMs, setElapsedMs] = useState(0);
|
|
35
|
-
const startTimeRef = useRef(null);
|
|
36
|
-
const intervalRef = useRef(null);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (isActive) {
|
|
39
|
-
// Start timing
|
|
40
|
-
startTimeRef.current = Date.now();
|
|
41
|
-
setElapsedMs(0);
|
|
42
|
-
// Update elapsed time at regular intervals
|
|
43
|
-
intervalRef.current = setInterval(() => {
|
|
44
|
-
if (startTimeRef.current !== null) {
|
|
45
|
-
setElapsedMs(Date.now() - startTimeRef.current);
|
|
46
|
-
}
|
|
47
|
-
}, intervalMs);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
// Stop timing
|
|
51
|
-
if (intervalRef.current) {
|
|
52
|
-
clearInterval(intervalRef.current);
|
|
53
|
-
intervalRef.current = null;
|
|
54
|
-
}
|
|
55
|
-
startTimeRef.current = null;
|
|
56
|
-
setElapsedMs(0);
|
|
57
|
-
}
|
|
58
|
-
return () => {
|
|
59
|
-
if (intervalRef.current) {
|
|
60
|
-
clearInterval(intervalRef.current);
|
|
61
|
-
intervalRef.current = null;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}, [isActive, intervalMs]);
|
|
65
|
-
return {
|
|
66
|
-
elapsedMs,
|
|
67
|
-
formatted: formatElapsedTime(elapsedMs),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useGitBranch Hook
|
|
3
|
-
*
|
|
4
|
-
* Detects the current git branch name for the working directory.
|
|
5
|
-
* Returns undefined if not in a git repository or if git command fails.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Hook that returns the current git branch name
|
|
9
|
-
* @param cwd - Working directory to check (defaults to process.cwd())
|
|
10
|
-
* @returns Branch name string or undefined if not in git repo or command fails
|
|
11
|
-
*/
|
|
12
|
-
export declare function useGitBranch(cwd?: string): string | undefined;
|
|
13
|
-
//# sourceMappingURL=useGitBranch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGitBranch.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useGitBranch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAuB7D"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useGitBranch Hook
|
|
3
|
-
*
|
|
4
|
-
* Detects the current git branch name for the working directory.
|
|
5
|
-
* Returns undefined if not in a git repository or if git command fails.
|
|
6
|
-
*/
|
|
7
|
-
import { useState, useEffect } from 'react';
|
|
8
|
-
import { execSync } from 'child_process';
|
|
9
|
-
/**
|
|
10
|
-
* Hook that returns the current git branch name
|
|
11
|
-
* @param cwd - Working directory to check (defaults to process.cwd())
|
|
12
|
-
* @returns Branch name string or undefined if not in git repo or command fails
|
|
13
|
-
*/
|
|
14
|
-
export function useGitBranch(cwd) {
|
|
15
|
-
const [branchName, setBranchName] = useState(undefined);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const workingDir = cwd || process.cwd();
|
|
18
|
-
try {
|
|
19
|
-
// Get current branch name using git rev-parse --abbrev-ref HEAD
|
|
20
|
-
// This is faster and more reliable than parsing git branch output
|
|
21
|
-
const result = execSync('git rev-parse --abbrev-ref HEAD', {
|
|
22
|
-
cwd: workingDir,
|
|
23
|
-
encoding: 'utf-8',
|
|
24
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
25
|
-
});
|
|
26
|
-
const branch = result.trim();
|
|
27
|
-
setBranchName(branch || undefined);
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
// Not in a git repo, git not installed, or command failed
|
|
31
|
-
setBranchName(undefined);
|
|
32
|
-
}
|
|
33
|
-
}, [cwd]);
|
|
34
|
-
return branchName;
|
|
35
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useHistorySearch - Hook for Ctrl+R reverse history search
|
|
3
|
-
*
|
|
4
|
-
* Manages search state and provides handlers for search operations.
|
|
5
|
-
*/
|
|
6
|
-
import { type Dispatch, type SetStateAction } from 'react';
|
|
7
|
-
import type { InputState, UIState } from '../state/types.js';
|
|
8
|
-
import type { TextBuffer } from '../components/shared/text-buffer.js';
|
|
9
|
-
interface UseHistorySearchProps {
|
|
10
|
-
ui: UIState;
|
|
11
|
-
input: InputState;
|
|
12
|
-
buffer: TextBuffer;
|
|
13
|
-
setUi: Dispatch<SetStateAction<UIState>>;
|
|
14
|
-
setInput: Dispatch<SetStateAction<InputState>>;
|
|
15
|
-
}
|
|
16
|
-
interface UseHistorySearchReturn {
|
|
17
|
-
/** Whether search mode is active */
|
|
18
|
-
isActive: boolean;
|
|
19
|
-
/** Current search query */
|
|
20
|
-
query: string;
|
|
21
|
-
/** Current match (or last valid match if no current results) */
|
|
22
|
-
currentMatch: string | null;
|
|
23
|
-
/** Whether there's a match for the current query */
|
|
24
|
-
hasMatch: boolean;
|
|
25
|
-
/** Original input to potentially restore */
|
|
26
|
-
originalInput: string;
|
|
27
|
-
/** Enter search mode */
|
|
28
|
-
enter: () => void;
|
|
29
|
-
/** Exit search mode (keep current input) */
|
|
30
|
-
exit: (showRestoreHint?: boolean) => void;
|
|
31
|
-
/** Cancel search mode (restore original - used by Escape) */
|
|
32
|
-
cancel: () => void;
|
|
33
|
-
/** Update search query */
|
|
34
|
-
updateQuery: (query: string) => void;
|
|
35
|
-
/** Add character to query */
|
|
36
|
-
appendToQuery: (char: string) => void;
|
|
37
|
-
/** Remove last character from query */
|
|
38
|
-
backspace: () => void;
|
|
39
|
-
/** Cycle to next (older) match - Ctrl+R */
|
|
40
|
-
cycleNext: () => void;
|
|
41
|
-
/** Cycle to previous (newer) match - Ctrl+Shift+R */
|
|
42
|
-
cyclePrev: () => void;
|
|
43
|
-
/** Accept current match (for Enter - also exits search mode) */
|
|
44
|
-
accept: () => void;
|
|
45
|
-
/** Handle a keypress - returns true if consumed */
|
|
46
|
-
handleKey: (inputStr: string, key: {
|
|
47
|
-
ctrl: boolean;
|
|
48
|
-
shift: boolean;
|
|
49
|
-
return: boolean;
|
|
50
|
-
backspace: boolean;
|
|
51
|
-
delete: boolean;
|
|
52
|
-
escape: boolean;
|
|
53
|
-
meta: boolean;
|
|
54
|
-
}) => boolean;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Hook for managing reverse history search
|
|
58
|
-
*/
|
|
59
|
-
export declare function useHistorySearch({ ui, input, buffer, setUi, setInput, }: UseHistorySearchProps): UseHistorySearchReturn;
|
|
60
|
-
export {};
|
|
61
|
-
//# sourceMappingURL=useHistorySearch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHistorySearch.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useHistorySearch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAwB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEtE,UAAU,qBAAqB;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACzC,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;CAClD;AAED,UAAU,sBAAsB;IAC5B,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oDAAoD;IACpD,QAAQ,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,wBAAwB;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,4CAA4C;IAC5C,IAAI,EAAE,CAAC,eAAe,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,6DAA6D;IAC7D,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,0BAA0B;IAC1B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,6BAA6B;IAC7B,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,uCAAuC;IACvC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,qDAAqD;IACrD,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,gEAAgE;IAChE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,mDAAmD;IACnD,SAAS,EAAE,CACP,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE;QACD,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,EAAE,OAAO,CAAC;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,MAAM,EAAE,OAAO,CAAC;QAChB,MAAM,EAAE,OAAO,CAAC;QAChB,IAAI,EAAE,OAAO,CAAC;KACjB,KACA,OAAO,CAAC;CAChB;AAWD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAC7B,EAAE,EACF,KAAK,EACL,MAAM,EACN,KAAK,EACL,QAAQ,GACX,EAAE,qBAAqB,GAAG,sBAAsB,CAqPhD"}
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useHistorySearch - Hook for Ctrl+R reverse history search
|
|
3
|
-
*
|
|
4
|
-
* Manages search state and provides handlers for search operations.
|
|
5
|
-
*/
|
|
6
|
-
import { useCallback, useMemo } from 'react';
|
|
7
|
-
/**
|
|
8
|
-
* Find matches in history for a query (reversed so newest is first)
|
|
9
|
-
*/
|
|
10
|
-
function findMatches(history, query) {
|
|
11
|
-
if (!query)
|
|
12
|
-
return [];
|
|
13
|
-
const lowerQuery = query.toLowerCase();
|
|
14
|
-
return history.filter((item) => item.toLowerCase().includes(lowerQuery)).reverse();
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Hook for managing reverse history search
|
|
18
|
-
*/
|
|
19
|
-
export function useHistorySearch({ ui, input, buffer, setUi, setInput, }) {
|
|
20
|
-
const { historySearch } = ui;
|
|
21
|
-
const { history } = input;
|
|
22
|
-
// Compute current matches and whether we have a match
|
|
23
|
-
const matches = useMemo(() => findMatches(history, historySearch.query), [history, historySearch.query]);
|
|
24
|
-
const hasMatch = matches.length > 0;
|
|
25
|
-
const currentMatch = hasMatch
|
|
26
|
-
? matches[Math.min(historySearch.matchIndex, matches.length - 1)] || null
|
|
27
|
-
: historySearch.lastMatch || null;
|
|
28
|
-
// Enter search mode
|
|
29
|
-
const enter = useCallback(() => {
|
|
30
|
-
const currentText = buffer.text;
|
|
31
|
-
setUi((prev) => ({
|
|
32
|
-
...prev,
|
|
33
|
-
historySearch: {
|
|
34
|
-
isActive: true,
|
|
35
|
-
query: '',
|
|
36
|
-
matchIndex: 0,
|
|
37
|
-
originalInput: currentText,
|
|
38
|
-
lastMatch: '',
|
|
39
|
-
},
|
|
40
|
-
}));
|
|
41
|
-
}, [buffer, setUi]);
|
|
42
|
-
// Exit search mode (keep current input)
|
|
43
|
-
const exit = useCallback(() => {
|
|
44
|
-
setUi((prev) => ({
|
|
45
|
-
...prev,
|
|
46
|
-
historySearch: {
|
|
47
|
-
isActive: false,
|
|
48
|
-
query: '',
|
|
49
|
-
matchIndex: 0,
|
|
50
|
-
originalInput: '',
|
|
51
|
-
lastMatch: '',
|
|
52
|
-
},
|
|
53
|
-
}));
|
|
54
|
-
}, [setUi]);
|
|
55
|
-
// Cancel search mode (restore original) - kept for potential future use
|
|
56
|
-
const cancel = useCallback(() => {
|
|
57
|
-
const originalInput = historySearch.originalInput;
|
|
58
|
-
buffer.setText(originalInput);
|
|
59
|
-
setInput((prev) => ({ ...prev, value: originalInput }));
|
|
60
|
-
exit();
|
|
61
|
-
}, [historySearch.originalInput, buffer, setInput, exit]);
|
|
62
|
-
// Apply a match to the input buffer
|
|
63
|
-
const applyMatch = useCallback((match) => {
|
|
64
|
-
if (match) {
|
|
65
|
-
buffer.setText(match);
|
|
66
|
-
setInput((prev) => ({ ...prev, value: match }));
|
|
67
|
-
}
|
|
68
|
-
}, [buffer, setInput]);
|
|
69
|
-
// Update query and apply resulting match
|
|
70
|
-
const updateQuery = useCallback((newQuery) => {
|
|
71
|
-
const newMatches = findMatches(history, newQuery);
|
|
72
|
-
const newHasMatch = newMatches.length > 0;
|
|
73
|
-
const newMatch = newHasMatch ? newMatches[0] : null;
|
|
74
|
-
setUi((prev) => ({
|
|
75
|
-
...prev,
|
|
76
|
-
historySearch: {
|
|
77
|
-
...prev.historySearch,
|
|
78
|
-
query: newQuery,
|
|
79
|
-
matchIndex: 0,
|
|
80
|
-
// Update lastMatch only if we have a new match
|
|
81
|
-
lastMatch: newMatch || prev.historySearch.lastMatch,
|
|
82
|
-
},
|
|
83
|
-
}));
|
|
84
|
-
// Apply match (or keep last match if no new match)
|
|
85
|
-
if (newMatch) {
|
|
86
|
-
applyMatch(newMatch);
|
|
87
|
-
}
|
|
88
|
-
// If no match, keep whatever is currently in input (the last match)
|
|
89
|
-
}, [history, setUi, applyMatch]);
|
|
90
|
-
// Append character to query
|
|
91
|
-
const appendToQuery = useCallback((char) => {
|
|
92
|
-
updateQuery(historySearch.query + char);
|
|
93
|
-
}, [historySearch.query, updateQuery]);
|
|
94
|
-
// Backspace - remove last character
|
|
95
|
-
const backspace = useCallback(() => {
|
|
96
|
-
if (historySearch.query.length > 0) {
|
|
97
|
-
updateQuery(historySearch.query.slice(0, -1));
|
|
98
|
-
}
|
|
99
|
-
}, [historySearch.query, updateQuery]);
|
|
100
|
-
// Cycle to next (older) match - Ctrl+R
|
|
101
|
-
const cycleNext = useCallback(() => {
|
|
102
|
-
if (matches.length === 0)
|
|
103
|
-
return;
|
|
104
|
-
const newIndex = Math.min(historySearch.matchIndex + 1, matches.length - 1);
|
|
105
|
-
const newMatch = matches[newIndex];
|
|
106
|
-
setUi((prev) => ({
|
|
107
|
-
...prev,
|
|
108
|
-
historySearch: {
|
|
109
|
-
...prev.historySearch,
|
|
110
|
-
matchIndex: newIndex,
|
|
111
|
-
lastMatch: newMatch || prev.historySearch.lastMatch,
|
|
112
|
-
},
|
|
113
|
-
}));
|
|
114
|
-
if (newMatch) {
|
|
115
|
-
applyMatch(newMatch);
|
|
116
|
-
}
|
|
117
|
-
}, [matches, historySearch.matchIndex, setUi, applyMatch]);
|
|
118
|
-
// Cycle to previous (newer) match - Ctrl+Shift+R
|
|
119
|
-
const cyclePrev = useCallback(() => {
|
|
120
|
-
if (matches.length === 0)
|
|
121
|
-
return;
|
|
122
|
-
const newIndex = Math.max(0, historySearch.matchIndex - 1);
|
|
123
|
-
const newMatch = matches[newIndex];
|
|
124
|
-
setUi((prev) => ({
|
|
125
|
-
...prev,
|
|
126
|
-
historySearch: {
|
|
127
|
-
...prev.historySearch,
|
|
128
|
-
matchIndex: newIndex,
|
|
129
|
-
lastMatch: newMatch || prev.historySearch.lastMatch,
|
|
130
|
-
},
|
|
131
|
-
}));
|
|
132
|
-
if (newMatch) {
|
|
133
|
-
applyMatch(newMatch);
|
|
134
|
-
}
|
|
135
|
-
}, [matches, historySearch.matchIndex, setUi, applyMatch]);
|
|
136
|
-
// Accept current match and exit
|
|
137
|
-
const accept = useCallback(() => {
|
|
138
|
-
// Input already has the match, just exit
|
|
139
|
-
exit();
|
|
140
|
-
}, [exit]);
|
|
141
|
-
// Handle keypress - returns true if consumed
|
|
142
|
-
const handleKey = useCallback((inputStr, key) => {
|
|
143
|
-
if (!historySearch.isActive) {
|
|
144
|
-
// Not in search mode - check if Ctrl+R to enter
|
|
145
|
-
if (key.ctrl && inputStr === 'r') {
|
|
146
|
-
enter();
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
// In search mode - handle all keys
|
|
152
|
-
// Ctrl+E: cycle to previous (newer) match
|
|
153
|
-
if (key.ctrl && inputStr === 'e') {
|
|
154
|
-
cyclePrev();
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
// Ctrl+R: cycle to next (older) match
|
|
158
|
-
if (key.ctrl && inputStr === 'r') {
|
|
159
|
-
cycleNext();
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
// Enter: accept match and exit (keep matched text, don't submit)
|
|
163
|
-
if (key.return) {
|
|
164
|
-
accept();
|
|
165
|
-
return true; // Consume - don't submit
|
|
166
|
-
}
|
|
167
|
-
// Escape: restore original and exit
|
|
168
|
-
if (key.escape) {
|
|
169
|
-
cancel();
|
|
170
|
-
return true;
|
|
171
|
-
}
|
|
172
|
-
// Backspace: remove character from query
|
|
173
|
-
if (key.backspace || key.delete) {
|
|
174
|
-
backspace();
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
// Regular typing: add to query
|
|
178
|
-
if (inputStr && !key.ctrl && !key.meta) {
|
|
179
|
-
appendToQuery(inputStr);
|
|
180
|
-
return true;
|
|
181
|
-
}
|
|
182
|
-
return true; // Consume other keys while in search mode
|
|
183
|
-
}, [
|
|
184
|
-
historySearch.isActive,
|
|
185
|
-
enter,
|
|
186
|
-
cycleNext,
|
|
187
|
-
cyclePrev,
|
|
188
|
-
accept,
|
|
189
|
-
cancel,
|
|
190
|
-
backspace,
|
|
191
|
-
appendToQuery,
|
|
192
|
-
]);
|
|
193
|
-
return {
|
|
194
|
-
isActive: historySearch.isActive,
|
|
195
|
-
query: historySearch.query,
|
|
196
|
-
currentMatch,
|
|
197
|
-
hasMatch,
|
|
198
|
-
originalInput: historySearch.originalInput,
|
|
199
|
-
enter,
|
|
200
|
-
exit,
|
|
201
|
-
cancel,
|
|
202
|
-
updateQuery,
|
|
203
|
-
appendToQuery,
|
|
204
|
-
backspace,
|
|
205
|
-
cycleNext,
|
|
206
|
-
cyclePrev,
|
|
207
|
-
accept,
|
|
208
|
-
handleKey,
|
|
209
|
-
};
|
|
210
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook for managing input history navigation
|
|
3
|
-
* Handles keyboard shortcuts for history traversal
|
|
4
|
-
*/
|
|
5
|
-
import type React from 'react';
|
|
6
|
-
import type { CLIAction } from '../state/actions.js';
|
|
7
|
-
import type { InputState } from '../state/types.js';
|
|
8
|
-
interface UseInputHistoryProps {
|
|
9
|
-
inputState: InputState;
|
|
10
|
-
dispatch: React.Dispatch<CLIAction>;
|
|
11
|
-
isActive: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Manages input history navigation with arrow keys
|
|
15
|
-
*/
|
|
16
|
-
export declare function useInputHistory({ inputState, dispatch, isActive }: UseInputHistoryProps): void;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=useInputHistory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInputHistory.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useInputHistory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,UAAU,oBAAoB;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAAG,IAAI,CAmB9F"}
|