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,209 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mouse Event Utilities
|
|
3
|
-
* Provides trackpad/mouse scroll support.
|
|
4
|
-
*/
|
|
5
|
-
import { ESC, SGR_MOUSE_REGEX, X11_MOUSE_REGEX, SGR_EVENT_PREFIX, X11_EVENT_PREFIX, couldBeMouseSequence, } from './input.js';
|
|
6
|
-
/**
|
|
7
|
-
* Enable mouse events in the terminal.
|
|
8
|
-
* Uses SGR extended mouse mode for better coordinate handling.
|
|
9
|
-
*/
|
|
10
|
-
export function enableMouseEvents() {
|
|
11
|
-
// ?1002h = button event tracking (clicks + drags + scroll wheel)
|
|
12
|
-
// ?1006h = SGR extended mouse mode (better coordinate handling)
|
|
13
|
-
process.stdout.write('\u001b[?1002h\u001b[?1006h');
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Disable mouse events in the terminal.
|
|
17
|
-
*/
|
|
18
|
-
export function disableMouseEvents() {
|
|
19
|
-
process.stdout.write('\u001b[?1006l\u001b[?1002l');
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Get mouse event name from button code
|
|
23
|
-
*
|
|
24
|
-
* NOTE: X11 mouse protocol limitation - all button releases report the same code (3),
|
|
25
|
-
* so we cannot distinguish between left-release, middle-release, and right-release.
|
|
26
|
-
* This function returns 'left-release' for all releases in X11 mode.
|
|
27
|
-
* Consumers needing accurate release identification should track press state themselves.
|
|
28
|
-
*/
|
|
29
|
-
export function getMouseEventName(buttonCode, isRelease) {
|
|
30
|
-
const isMove = (buttonCode & 32) !== 0;
|
|
31
|
-
// Horizontal scroll (less common)
|
|
32
|
-
if (buttonCode === 66) {
|
|
33
|
-
return 'scroll-left';
|
|
34
|
-
}
|
|
35
|
-
else if (buttonCode === 67) {
|
|
36
|
-
return 'scroll-right';
|
|
37
|
-
}
|
|
38
|
-
// Vertical scroll
|
|
39
|
-
if ((buttonCode & 64) === 64) {
|
|
40
|
-
if ((buttonCode & 1) === 0) {
|
|
41
|
-
return 'scroll-up';
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return 'scroll-down';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (isMove) {
|
|
48
|
-
return 'move';
|
|
49
|
-
}
|
|
50
|
-
const button = buttonCode & 3;
|
|
51
|
-
const type = isRelease ? 'release' : 'press';
|
|
52
|
-
switch (button) {
|
|
53
|
-
case 0:
|
|
54
|
-
return `left-${type}`;
|
|
55
|
-
case 1:
|
|
56
|
-
return `middle-${type}`;
|
|
57
|
-
case 2:
|
|
58
|
-
return `right-${type}`;
|
|
59
|
-
default:
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Get button type from button code
|
|
65
|
-
*/
|
|
66
|
-
function getButtonFromCode(code) {
|
|
67
|
-
const button = code & 3;
|
|
68
|
-
switch (button) {
|
|
69
|
-
case 0:
|
|
70
|
-
return 'left';
|
|
71
|
-
case 1:
|
|
72
|
-
return 'middle';
|
|
73
|
-
case 2:
|
|
74
|
-
return 'right';
|
|
75
|
-
default:
|
|
76
|
-
return 'none';
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Parse SGR format mouse event
|
|
81
|
-
*/
|
|
82
|
-
export function parseSGRMouseEvent(buffer) {
|
|
83
|
-
const match = buffer.match(SGR_MOUSE_REGEX);
|
|
84
|
-
if (match) {
|
|
85
|
-
const buttonCode = parseInt(match[1], 10);
|
|
86
|
-
const col = parseInt(match[2], 10);
|
|
87
|
-
const row = parseInt(match[3], 10);
|
|
88
|
-
const action = match[4];
|
|
89
|
-
const isRelease = action === 'm';
|
|
90
|
-
const shift = (buttonCode & 4) !== 0;
|
|
91
|
-
const meta = (buttonCode & 8) !== 0;
|
|
92
|
-
const ctrl = (buttonCode & 16) !== 0;
|
|
93
|
-
const name = getMouseEventName(buttonCode, isRelease);
|
|
94
|
-
if (name) {
|
|
95
|
-
return {
|
|
96
|
-
event: {
|
|
97
|
-
name,
|
|
98
|
-
ctrl,
|
|
99
|
-
meta,
|
|
100
|
-
shift,
|
|
101
|
-
col,
|
|
102
|
-
row,
|
|
103
|
-
button: getButtonFromCode(buttonCode),
|
|
104
|
-
},
|
|
105
|
-
length: match[0].length,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Parse X11 format mouse event
|
|
113
|
-
*/
|
|
114
|
-
export function parseX11MouseEvent(buffer) {
|
|
115
|
-
const match = buffer.match(X11_MOUSE_REGEX);
|
|
116
|
-
if (!match)
|
|
117
|
-
return null;
|
|
118
|
-
const b = match[1].charCodeAt(0) - 32;
|
|
119
|
-
const col = match[1].charCodeAt(1) - 32;
|
|
120
|
-
const row = match[1].charCodeAt(2) - 32;
|
|
121
|
-
const shift = (b & 4) !== 0;
|
|
122
|
-
const meta = (b & 8) !== 0;
|
|
123
|
-
const ctrl = (b & 16) !== 0;
|
|
124
|
-
const isMove = (b & 32) !== 0;
|
|
125
|
-
const isWheel = (b & 64) !== 0;
|
|
126
|
-
let name = null;
|
|
127
|
-
if (isWheel) {
|
|
128
|
-
const button = b & 3;
|
|
129
|
-
switch (button) {
|
|
130
|
-
case 0:
|
|
131
|
-
name = 'scroll-up';
|
|
132
|
-
break;
|
|
133
|
-
case 1:
|
|
134
|
-
name = 'scroll-down';
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else if (isMove) {
|
|
139
|
-
name = 'move';
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
const button = b & 3;
|
|
143
|
-
if (button === 3) {
|
|
144
|
-
// X11 reports 'release' (3) for all button releases
|
|
145
|
-
name = 'left-release';
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
switch (button) {
|
|
149
|
-
case 0:
|
|
150
|
-
name = 'left-press';
|
|
151
|
-
break;
|
|
152
|
-
case 1:
|
|
153
|
-
name = 'middle-press';
|
|
154
|
-
break;
|
|
155
|
-
case 2:
|
|
156
|
-
name = 'right-press';
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (name) {
|
|
162
|
-
let button = getButtonFromCode(b);
|
|
163
|
-
if (name === 'left-release' && button === 'none') {
|
|
164
|
-
button = 'left';
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
event: {
|
|
168
|
-
name,
|
|
169
|
-
ctrl,
|
|
170
|
-
meta,
|
|
171
|
-
shift,
|
|
172
|
-
col,
|
|
173
|
-
row,
|
|
174
|
-
button,
|
|
175
|
-
},
|
|
176
|
-
length: match[0].length,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Parse mouse event from buffer (tries both SGR and X11 formats)
|
|
183
|
-
*/
|
|
184
|
-
export function parseMouseEvent(buffer) {
|
|
185
|
-
return parseSGRMouseEvent(buffer) || parseX11MouseEvent(buffer);
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Check if buffer could be an incomplete mouse sequence
|
|
189
|
-
*/
|
|
190
|
-
export function isIncompleteMouseSequence(buffer) {
|
|
191
|
-
if (!couldBeMouseSequence(buffer))
|
|
192
|
-
return false;
|
|
193
|
-
// If it matches a complete sequence, it's not incomplete
|
|
194
|
-
if (parseMouseEvent(buffer))
|
|
195
|
-
return false;
|
|
196
|
-
if (buffer.startsWith(X11_EVENT_PREFIX)) {
|
|
197
|
-
// X11 needs exactly 3 bytes after prefix
|
|
198
|
-
return buffer.length < X11_EVENT_PREFIX.length + 3;
|
|
199
|
-
}
|
|
200
|
-
if (buffer.startsWith(SGR_EVENT_PREFIX)) {
|
|
201
|
-
// SGR sequences end with 'm' or 'M'
|
|
202
|
-
// Add a reasonable max length check to fail early on garbage
|
|
203
|
-
return !/[mM]/.test(buffer) && buffer.length < 50;
|
|
204
|
-
}
|
|
205
|
-
// It's a prefix of the prefix (e.g. "ESC" or "ESC [")
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
// Re-export ESC for convenience
|
|
209
|
-
export { ESC };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sound Notification Utility
|
|
3
|
-
*
|
|
4
|
-
* Plays system sounds for CLI notifications like approval requests and task completion.
|
|
5
|
-
* Uses platform-specific commands with fallback to terminal bell.
|
|
6
|
-
*
|
|
7
|
-
* Sound files should be placed in ~/.dexto/sounds/ or use system defaults.
|
|
8
|
-
*/
|
|
9
|
-
export type SoundType = 'approval' | 'complete';
|
|
10
|
-
/**
|
|
11
|
-
* Play a notification sound
|
|
12
|
-
*
|
|
13
|
-
* @param soundType - Type of sound to play ('approval' or 'complete')
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* // Play approval required sound
|
|
18
|
-
* playNotificationSound('approval');
|
|
19
|
-
*
|
|
20
|
-
* // Play task complete sound
|
|
21
|
-
* playNotificationSound('complete');
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function playNotificationSound(soundType: SoundType): void;
|
|
25
|
-
/**
|
|
26
|
-
* Sound configuration interface
|
|
27
|
-
*
|
|
28
|
-
* Note: Default values are defined in PreferenceSoundsSchema (packages/agent-management/src/preferences/schemas.ts)
|
|
29
|
-
* which is the single source of truth for sound preferences.
|
|
30
|
-
*/
|
|
31
|
-
export interface SoundConfig {
|
|
32
|
-
enabled: boolean;
|
|
33
|
-
onApprovalRequired: boolean;
|
|
34
|
-
onTaskComplete: boolean;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Sound notification service that respects configuration
|
|
38
|
-
*
|
|
39
|
-
* All fields are required - callers should provide complete config from preferences.
|
|
40
|
-
* Default values come from PreferenceSoundsSchema in @dexto/agent-management.
|
|
41
|
-
*/
|
|
42
|
-
export declare class SoundNotificationService {
|
|
43
|
-
private config;
|
|
44
|
-
constructor(config: SoundConfig);
|
|
45
|
-
/**
|
|
46
|
-
* Update configuration
|
|
47
|
-
*/
|
|
48
|
-
setConfig(config: Partial<SoundConfig>): void;
|
|
49
|
-
/**
|
|
50
|
-
* Get current configuration
|
|
51
|
-
*/
|
|
52
|
-
getConfig(): SoundConfig;
|
|
53
|
-
/**
|
|
54
|
-
* Play approval required sound if enabled
|
|
55
|
-
*/
|
|
56
|
-
playApprovalSound(): void;
|
|
57
|
-
/**
|
|
58
|
-
* Play task complete sound if enabled
|
|
59
|
-
*/
|
|
60
|
-
playCompleteSound(): void;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Get the global sound notification service
|
|
64
|
-
* @returns The global service, or null if not initialized
|
|
65
|
-
*/
|
|
66
|
-
export declare function getSoundService(): SoundNotificationService | null;
|
|
67
|
-
/**
|
|
68
|
-
* Initialize the global sound service with configuration
|
|
69
|
-
*/
|
|
70
|
-
export declare function initializeSoundService(config: SoundConfig): SoundNotificationService;
|
|
71
|
-
//# sourceMappingURL=soundNotification.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"soundNotification.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/utils/soundNotification.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAqGhD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAiChE;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,qBAAa,wBAAwB;IACjC,OAAO,CAAC,MAAM,CAAc;gBAEhB,MAAM,EAAE,WAAW;IAI/B;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;IAI7C;;OAEG;IACH,SAAS,IAAI,WAAW;IAIxB;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAMzB;;OAEG;IACH,iBAAiB,IAAI,IAAI;CAK5B;AAQD;;;GAGG;AACH,wBAAgB,eAAe,IAAI,wBAAwB,GAAG,IAAI,CAEjE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG,wBAAwB,CAGpF"}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sound Notification Utility
|
|
3
|
-
*
|
|
4
|
-
* Plays system sounds for CLI notifications like approval requests and task completion.
|
|
5
|
-
* Uses platform-specific commands with fallback to terminal bell.
|
|
6
|
-
*
|
|
7
|
-
* Sound files should be placed in ~/.dexto/sounds/ or use system defaults.
|
|
8
|
-
*/
|
|
9
|
-
import { exec } from 'child_process';
|
|
10
|
-
import { existsSync } from 'fs';
|
|
11
|
-
import { join } from 'path';
|
|
12
|
-
import { homedir, platform } from 'os';
|
|
13
|
-
/**
|
|
14
|
-
* Platform-specific default sound paths
|
|
15
|
-
*/
|
|
16
|
-
const PLATFORM_SOUNDS = {
|
|
17
|
-
darwin: {
|
|
18
|
-
// macOS system sounds
|
|
19
|
-
approval: '/System/Library/Sounds/Blow.aiff',
|
|
20
|
-
complete: '/System/Library/Sounds/Glass.aiff',
|
|
21
|
-
},
|
|
22
|
-
linux: {
|
|
23
|
-
// Common Linux sound paths (freedesktop)
|
|
24
|
-
approval: '/usr/share/sounds/freedesktop/stereo/message-new-instant.oga',
|
|
25
|
-
complete: '/usr/share/sounds/freedesktop/stereo/complete.oga',
|
|
26
|
-
},
|
|
27
|
-
win32: {
|
|
28
|
-
// Windows system sounds (handled differently via PowerShell)
|
|
29
|
-
approval: 'SystemAsterisk',
|
|
30
|
-
complete: 'SystemHand',
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Get custom sound path from ~/.dexto/sounds/
|
|
35
|
-
*/
|
|
36
|
-
function getCustomSoundPath(soundType) {
|
|
37
|
-
const dextoSoundsDir = join(homedir(), '.dexto', 'sounds');
|
|
38
|
-
const extensions = ['.wav', '.mp3', '.ogg', '.aiff', '.m4a'];
|
|
39
|
-
for (const ext of extensions) {
|
|
40
|
-
const customPath = join(dextoSoundsDir, `${soundType}${ext}`);
|
|
41
|
-
if (existsSync(customPath)) {
|
|
42
|
-
return customPath;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Play a sound file using platform-specific command
|
|
49
|
-
*/
|
|
50
|
-
function playSound(soundPath) {
|
|
51
|
-
const currentPlatform = platform();
|
|
52
|
-
let command;
|
|
53
|
-
switch (currentPlatform) {
|
|
54
|
-
case 'darwin':
|
|
55
|
-
// macOS: use afplay
|
|
56
|
-
command = `afplay "${soundPath}"`;
|
|
57
|
-
break;
|
|
58
|
-
case 'linux':
|
|
59
|
-
// Linux: try paplay (PulseAudio), then aplay (ALSA)
|
|
60
|
-
if (soundPath.endsWith('.oga') || soundPath.endsWith('.ogg')) {
|
|
61
|
-
command = `paplay "${soundPath}" 2>/dev/null || ogg123 -q "${soundPath}" 2>/dev/null`;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
command = `paplay "${soundPath}" 2>/dev/null || aplay -q "${soundPath}" 2>/dev/null`;
|
|
65
|
-
}
|
|
66
|
-
break;
|
|
67
|
-
case 'win32':
|
|
68
|
-
// Windows: use PowerShell with System.Media.SystemSounds
|
|
69
|
-
// For Windows system sounds, soundPath is the sound name
|
|
70
|
-
if (['SystemAsterisk', 'SystemHand', 'SystemExclamation', 'SystemQuestion'].includes(soundPath)) {
|
|
71
|
-
command = `powershell -c "[System.Media.SystemSounds]::${soundPath.replace('System', '')}.Play()"`;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
// For custom files, use SoundPlayer
|
|
75
|
-
command = `powershell -c "(New-Object System.Media.SoundPlayer '${soundPath}').PlaySync()"`;
|
|
76
|
-
}
|
|
77
|
-
break;
|
|
78
|
-
default:
|
|
79
|
-
// Fallback: try to use terminal bell
|
|
80
|
-
playTerminalBell();
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
// Execute sound command asynchronously (fire and forget)
|
|
84
|
-
// Use 5s timeout to prevent hanging processes (e.g., audio device issues)
|
|
85
|
-
exec(command, { timeout: 5000 }, (error) => {
|
|
86
|
-
if (error) {
|
|
87
|
-
// Silently fall back to terminal bell on error
|
|
88
|
-
playTerminalBell();
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Play terminal bell (works in most terminals)
|
|
94
|
-
*/
|
|
95
|
-
function playTerminalBell() {
|
|
96
|
-
process.stdout.write('\x07');
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Play a notification sound
|
|
100
|
-
*
|
|
101
|
-
* @param soundType - Type of sound to play ('approval' or 'complete')
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```typescript
|
|
105
|
-
* // Play approval required sound
|
|
106
|
-
* playNotificationSound('approval');
|
|
107
|
-
*
|
|
108
|
-
* // Play task complete sound
|
|
109
|
-
* playNotificationSound('complete');
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
export function playNotificationSound(soundType) {
|
|
113
|
-
const currentPlatform = platform();
|
|
114
|
-
// Check for custom sound first
|
|
115
|
-
const customSound = getCustomSoundPath(soundType);
|
|
116
|
-
if (customSound) {
|
|
117
|
-
playSound(customSound);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
// Use platform default
|
|
121
|
-
const platformSounds = PLATFORM_SOUNDS[currentPlatform];
|
|
122
|
-
if (platformSounds) {
|
|
123
|
-
const defaultSound = platformSounds[soundType];
|
|
124
|
-
if (defaultSound) {
|
|
125
|
-
// For macOS and Linux, check if file exists
|
|
126
|
-
if (currentPlatform !== 'win32') {
|
|
127
|
-
if (existsSync(defaultSound)) {
|
|
128
|
-
playSound(defaultSound);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
// File doesn't exist, use bell
|
|
132
|
-
playTerminalBell();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
// Windows uses system sound names
|
|
137
|
-
playSound(defaultSound);
|
|
138
|
-
}
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// Fallback to terminal bell
|
|
143
|
-
playTerminalBell();
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Sound notification service that respects configuration
|
|
147
|
-
*
|
|
148
|
-
* All fields are required - callers should provide complete config from preferences.
|
|
149
|
-
* Default values come from PreferenceSoundsSchema in @dexto/agent-management.
|
|
150
|
-
*/
|
|
151
|
-
export class SoundNotificationService {
|
|
152
|
-
config;
|
|
153
|
-
constructor(config) {
|
|
154
|
-
this.config = { ...config };
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Update configuration
|
|
158
|
-
*/
|
|
159
|
-
setConfig(config) {
|
|
160
|
-
this.config = { ...this.config, ...config };
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Get current configuration
|
|
164
|
-
*/
|
|
165
|
-
getConfig() {
|
|
166
|
-
return { ...this.config };
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Play approval required sound if enabled
|
|
170
|
-
*/
|
|
171
|
-
playApprovalSound() {
|
|
172
|
-
if (this.config.enabled && this.config.onApprovalRequired) {
|
|
173
|
-
playNotificationSound('approval');
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Play task complete sound if enabled
|
|
178
|
-
*/
|
|
179
|
-
playCompleteSound() {
|
|
180
|
-
if (this.config.enabled && this.config.onTaskComplete) {
|
|
181
|
-
playNotificationSound('complete');
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Singleton instance for global use
|
|
187
|
-
* Initialize with loadGlobalPreferences() in CLI startup
|
|
188
|
-
*/
|
|
189
|
-
let globalSoundService = null;
|
|
190
|
-
/**
|
|
191
|
-
* Get the global sound notification service
|
|
192
|
-
* @returns The global service, or null if not initialized
|
|
193
|
-
*/
|
|
194
|
-
export function getSoundService() {
|
|
195
|
-
return globalSoundService;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Initialize the global sound service with configuration
|
|
199
|
-
*/
|
|
200
|
-
export function initializeSoundService(config) {
|
|
201
|
-
globalSoundService = new SoundNotificationService(config);
|
|
202
|
-
return globalSoundService;
|
|
203
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stream Splitter Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides markdown-aware splitting for streaming content to reduce flickering.
|
|
5
|
-
*
|
|
6
|
-
* Approach:
|
|
7
|
-
* - Find safe split points at paragraph boundaries (\n\n)
|
|
8
|
-
* - Protect code blocks from being split mid-block
|
|
9
|
-
* - Allow progressive finalization during streaming
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Find the last safe split point in the content.
|
|
13
|
-
*
|
|
14
|
-
* Safe split points are:
|
|
15
|
-
* 1. After paragraph breaks (\n\n) that are not inside code blocks
|
|
16
|
-
* 2. Before code blocks if we're inside one
|
|
17
|
-
*
|
|
18
|
-
* Returns the index to split at, or content.length if no split is needed.
|
|
19
|
-
*/
|
|
20
|
-
export declare function findLastSafeSplitPoint(content: string): number;
|
|
21
|
-
/**
|
|
22
|
-
* Find the last newline that's not inside a code block.
|
|
23
|
-
* Used for line-based batching.
|
|
24
|
-
*/
|
|
25
|
-
export declare function findLastSafeNewline(content: string): number;
|
|
26
|
-
/**
|
|
27
|
-
* Determines if content should be split for progressive finalization.
|
|
28
|
-
*
|
|
29
|
-
* Strategy:
|
|
30
|
-
* 1. First try paragraph splits (\n\n) for clean breaks
|
|
31
|
-
* 2. If content exceeds MAX_PENDING_LENGTH with no paragraph break,
|
|
32
|
-
* fall back to line-based splits (\n) to prevent flickering
|
|
33
|
-
*
|
|
34
|
-
* Returns:
|
|
35
|
-
* - { shouldSplit: false } if no split needed
|
|
36
|
-
* - { shouldSplit: true, splitIndex, before, after } if split found
|
|
37
|
-
*/
|
|
38
|
-
export declare function checkForSplit(content: string): {
|
|
39
|
-
shouldSplit: boolean;
|
|
40
|
-
splitIndex?: number;
|
|
41
|
-
before?: string;
|
|
42
|
-
after?: string;
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=streamSplitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streamSplitter.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/utils/streamSplitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmDH;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA2B9D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAiB3D;AAcD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG;IAC5C,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CA+BA"}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stream Splitter Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides markdown-aware splitting for streaming content to reduce flickering.
|
|
5
|
-
*
|
|
6
|
-
* Approach:
|
|
7
|
-
* - Find safe split points at paragraph boundaries (\n\n)
|
|
8
|
-
* - Protect code blocks from being split mid-block
|
|
9
|
-
* - Allow progressive finalization during streaming
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Checks if a given index is inside a fenced code block (``` ... ```)
|
|
13
|
-
*/
|
|
14
|
-
function isIndexInsideCodeBlock(content, indexToTest) {
|
|
15
|
-
let fenceCount = 0;
|
|
16
|
-
let searchPos = 0;
|
|
17
|
-
while (searchPos < content.length) {
|
|
18
|
-
const nextFence = content.indexOf('```', searchPos);
|
|
19
|
-
if (nextFence === -1 || nextFence >= indexToTest) {
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
fenceCount++;
|
|
23
|
-
searchPos = nextFence + 3;
|
|
24
|
-
}
|
|
25
|
-
return fenceCount % 2 === 1;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Finds the starting index of the code block that encloses the given index.
|
|
29
|
-
* Returns -1 if the index is not inside a code block.
|
|
30
|
-
*/
|
|
31
|
-
function findEnclosingCodeBlockStart(content, index) {
|
|
32
|
-
if (!isIndexInsideCodeBlock(content, index)) {
|
|
33
|
-
return -1;
|
|
34
|
-
}
|
|
35
|
-
let currentSearchPos = 0;
|
|
36
|
-
while (currentSearchPos < index) {
|
|
37
|
-
const blockStartIndex = content.indexOf('```', currentSearchPos);
|
|
38
|
-
if (blockStartIndex === -1 || blockStartIndex >= index) {
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
const blockEndIndex = content.indexOf('```', blockStartIndex + 3);
|
|
42
|
-
if (blockStartIndex < index) {
|
|
43
|
-
if (blockEndIndex === -1 || index < blockEndIndex + 3) {
|
|
44
|
-
return blockStartIndex;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (blockEndIndex === -1)
|
|
48
|
-
break;
|
|
49
|
-
currentSearchPos = blockEndIndex + 3;
|
|
50
|
-
}
|
|
51
|
-
return -1;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Find the last safe split point in the content.
|
|
55
|
-
*
|
|
56
|
-
* Safe split points are:
|
|
57
|
-
* 1. After paragraph breaks (\n\n) that are not inside code blocks
|
|
58
|
-
* 2. Before code blocks if we're inside one
|
|
59
|
-
*
|
|
60
|
-
* Returns the index to split at, or content.length if no split is needed.
|
|
61
|
-
*/
|
|
62
|
-
export function findLastSafeSplitPoint(content) {
|
|
63
|
-
// If we're inside a code block at the end, split before it
|
|
64
|
-
const enclosingBlockStart = findEnclosingCodeBlockStart(content, content.length);
|
|
65
|
-
if (enclosingBlockStart !== -1) {
|
|
66
|
-
return enclosingBlockStart;
|
|
67
|
-
}
|
|
68
|
-
// Search for the last double newline (\n\n) not in a code block
|
|
69
|
-
let searchStartIndex = content.length;
|
|
70
|
-
while (searchStartIndex >= 0) {
|
|
71
|
-
const dnlIndex = content.lastIndexOf('\n\n', searchStartIndex);
|
|
72
|
-
if (dnlIndex === -1) {
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
const potentialSplitPoint = dnlIndex + 2;
|
|
76
|
-
if (!isIndexInsideCodeBlock(content, potentialSplitPoint)) {
|
|
77
|
-
return potentialSplitPoint;
|
|
78
|
-
}
|
|
79
|
-
// If potentialSplitPoint was inside a code block,
|
|
80
|
-
// search before the \n\n we just found
|
|
81
|
-
searchStartIndex = dnlIndex - 1;
|
|
82
|
-
}
|
|
83
|
-
// No safe split point found, return full length
|
|
84
|
-
return content.length;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Find the last newline that's not inside a code block.
|
|
88
|
-
* Used for line-based batching.
|
|
89
|
-
*/
|
|
90
|
-
export function findLastSafeNewline(content) {
|
|
91
|
-
let searchPos = content.length;
|
|
92
|
-
while (searchPos > 0) {
|
|
93
|
-
const nlIndex = content.lastIndexOf('\n', searchPos - 1);
|
|
94
|
-
if (nlIndex === -1) {
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
if (!isIndexInsideCodeBlock(content, nlIndex)) {
|
|
98
|
-
return nlIndex + 1; // Return position after the newline
|
|
99
|
-
}
|
|
100
|
-
searchPos = nlIndex;
|
|
101
|
-
}
|
|
102
|
-
return -1; // No safe newline found
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Minimum content length before considering a paragraph split (\n\n).
|
|
106
|
-
*/
|
|
107
|
-
const MIN_PARAGRAPH_SPLIT_LENGTH = 200;
|
|
108
|
-
/**
|
|
109
|
-
* Maximum content length before forcing a line-based split.
|
|
110
|
-
* This prevents excessive accumulation that causes flickering.
|
|
111
|
-
* Roughly 3-4 lines of terminal width (~80 chars each).
|
|
112
|
-
*/
|
|
113
|
-
const MAX_PENDING_LENGTH = 300;
|
|
114
|
-
/**
|
|
115
|
-
* Determines if content should be split for progressive finalization.
|
|
116
|
-
*
|
|
117
|
-
* Strategy:
|
|
118
|
-
* 1. First try paragraph splits (\n\n) for clean breaks
|
|
119
|
-
* 2. If content exceeds MAX_PENDING_LENGTH with no paragraph break,
|
|
120
|
-
* fall back to line-based splits (\n) to prevent flickering
|
|
121
|
-
*
|
|
122
|
-
* Returns:
|
|
123
|
-
* - { shouldSplit: false } if no split needed
|
|
124
|
-
* - { shouldSplit: true, splitIndex, before, after } if split found
|
|
125
|
-
*/
|
|
126
|
-
export function checkForSplit(content) {
|
|
127
|
-
// Don't split very small content
|
|
128
|
-
if (content.length < MIN_PARAGRAPH_SPLIT_LENGTH) {
|
|
129
|
-
return { shouldSplit: false };
|
|
130
|
-
}
|
|
131
|
-
// Try paragraph-based split first (cleaner breaks)
|
|
132
|
-
const paragraphSplitPoint = findLastSafeSplitPoint(content);
|
|
133
|
-
if (paragraphSplitPoint > 80 && paragraphSplitPoint < content.length - 20) {
|
|
134
|
-
return {
|
|
135
|
-
shouldSplit: true,
|
|
136
|
-
splitIndex: paragraphSplitPoint,
|
|
137
|
-
before: content.substring(0, paragraphSplitPoint),
|
|
138
|
-
after: content.substring(paragraphSplitPoint),
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
// If content is getting too long, force a line-based split to reduce flickering
|
|
142
|
-
if (content.length > MAX_PENDING_LENGTH) {
|
|
143
|
-
const lineSplitPoint = findLastSafeNewline(content);
|
|
144
|
-
if (lineSplitPoint > 80 && lineSplitPoint < content.length - 20) {
|
|
145
|
-
return {
|
|
146
|
-
shouldSplit: true,
|
|
147
|
-
splitIndex: lineSplitPoint,
|
|
148
|
-
before: content.substring(0, lineSplitPoint),
|
|
149
|
-
after: content.substring(lineSplitPoint),
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return { shouldSplit: false };
|
|
154
|
-
}
|