@dexto/tui 1.15.0-beta.0 → 1.15.0-beta.1
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/InkCLIRefactored.cjs +30 -24
- package/dist/InkCLIRefactored.d.ts.map +1 -1
- package/dist/InkCLIRefactored.js +30 -24
- package/dist/components/ApprovalPrompt.cjs +128 -40
- package/dist/components/ApprovalPrompt.d.ts +2 -0
- package/dist/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/components/ApprovalPrompt.js +128 -41
- package/dist/components/CustomInput.cjs +4 -3
- package/dist/components/CustomInput.d.ts.map +1 -1
- package/dist/components/CustomInput.js +4 -3
- package/dist/components/DeckArea.cjs +43 -0
- package/dist/components/DeckArea.d.ts +14 -0
- package/dist/components/DeckArea.d.ts.map +1 -0
- package/dist/components/DeckArea.js +19 -0
- package/dist/components/EditableMultiLineInput.cjs +9 -8
- package/dist/components/EditableMultiLineInput.d.ts.map +1 -1
- package/dist/components/EditableMultiLineInput.js +9 -8
- package/dist/components/ElicitationForm.cjs +78 -18
- package/dist/components/ElicitationForm.d.ts.map +1 -1
- package/dist/components/ElicitationForm.js +78 -18
- package/dist/components/ErrorBoundary.cjs +15 -5
- package/dist/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/components/ErrorBoundary.js +15 -5
- package/dist/components/Footer.cjs +37 -113
- package/dist/components/Footer.d.ts +2 -2
- package/dist/components/Footer.d.ts.map +1 -1
- package/dist/components/Footer.js +40 -119
- package/dist/components/HistorySearchBar.cjs +6 -5
- package/dist/components/HistorySearchBar.d.ts.map +1 -1
- package/dist/components/HistorySearchBar.js +6 -5
- package/dist/components/MultiLineInput.cjs +6 -5
- package/dist/components/MultiLineInput.d.ts.map +1 -1
- package/dist/components/MultiLineInput.js +6 -5
- package/dist/components/ResourceAutocomplete.cjs +5 -4
- package/dist/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/components/ResourceAutocomplete.js +5 -4
- package/dist/components/SignalGates.test.cjs +215 -0
- package/dist/components/SignalGates.test.d.ts +2 -0
- package/dist/components/SignalGates.test.d.ts.map +1 -0
- package/dist/components/SignalGates.test.js +217 -0
- package/dist/components/SlashCommandAutocomplete.cjs +4 -3
- package/dist/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/components/SlashCommandAutocomplete.js +4 -3
- package/dist/components/StatusBar.cjs +13 -30
- package/dist/components/StatusBar.d.ts +1 -3
- package/dist/components/StatusBar.d.ts.map +1 -1
- package/dist/components/StatusBar.js +13 -30
- package/dist/components/TextBufferInput.cjs +13 -12
- package/dist/components/TextBufferInput.d.ts.map +1 -1
- package/dist/components/TextBufferInput.js +13 -12
- package/dist/components/TodoPanel.cjs +23 -16
- package/dist/components/TodoPanel.d.ts.map +1 -1
- package/dist/components/TodoPanel.js +23 -16
- package/dist/components/base/BaseAutocomplete.cjs +7 -6
- package/dist/components/base/BaseAutocomplete.d.ts.map +1 -1
- package/dist/components/base/BaseAutocomplete.js +7 -6
- package/dist/components/base/BaseSelector.cjs +5 -4
- package/dist/components/base/BaseSelector.d.ts.map +1 -1
- package/dist/components/base/BaseSelector.js +5 -4
- package/dist/components/chat/Footer.cjs +2 -1
- package/dist/components/chat/Footer.d.ts.map +1 -1
- package/dist/components/chat/Footer.js +2 -1
- package/dist/components/chat/Header.cjs +20 -16
- package/dist/components/chat/Header.d.ts.map +1 -1
- package/dist/components/chat/Header.js +20 -16
- package/dist/components/chat/MessageItem.cjs +47 -30
- package/dist/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/components/chat/MessageItem.js +52 -29
- package/dist/components/chat/MessageList.cjs +3 -2
- package/dist/components/chat/MessageList.d.ts.map +1 -1
- package/dist/components/chat/MessageList.js +3 -2
- package/dist/components/chat/QueuedMessagesDisplay.cjs +17 -5
- package/dist/components/chat/QueuedMessagesDisplay.d.ts.map +1 -1
- package/dist/components/chat/QueuedMessagesDisplay.js +18 -6
- package/dist/components/chat/SignalMessage.cjs +116 -0
- package/dist/components/chat/SignalMessage.d.ts +18 -0
- package/dist/components/chat/SignalMessage.d.ts.map +1 -0
- package/dist/components/chat/SignalMessage.js +96 -0
- package/dist/components/chat/SignalMessage.test.cjs +112 -0
- package/dist/components/chat/SignalMessage.test.d.ts +2 -0
- package/dist/components/chat/SignalMessage.test.d.ts.map +1 -0
- package/dist/components/chat/SignalMessage.test.js +116 -0
- package/dist/components/chat/ToolIcon.cjs +6 -5
- package/dist/components/chat/ToolIcon.d.ts.map +1 -1
- package/dist/components/chat/ToolIcon.js +6 -5
- package/dist/components/chat/styled-boxes/ConfigBox.cjs +8 -7
- package/dist/components/chat/styled-boxes/ConfigBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/ConfigBox.js +8 -7
- package/dist/components/chat/styled-boxes/HelpBox.cjs +4 -3
- package/dist/components/chat/styled-boxes/HelpBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/HelpBox.js +4 -3
- package/dist/components/chat/styled-boxes/LogConfigBox.cjs +11 -3
- package/dist/components/chat/styled-boxes/LogConfigBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/LogConfigBox.js +11 -3
- package/dist/components/chat/styled-boxes/SessionHistoryBox.cjs +8 -7
- package/dist/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/SessionHistoryBox.js +8 -7
- package/dist/components/chat/styled-boxes/SessionListBox.cjs +19 -11
- package/dist/components/chat/styled-boxes/SessionListBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/SessionListBox.js +19 -11
- package/dist/components/chat/styled-boxes/ShortcutsBox.cjs +4 -3
- package/dist/components/chat/styled-boxes/ShortcutsBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/ShortcutsBox.js +4 -3
- package/dist/components/chat/styled-boxes/StatsBox.cjs +13 -5
- package/dist/components/chat/styled-boxes/StatsBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/StatsBox.js +13 -5
- package/dist/components/chat/styled-boxes/StyledBox.cjs +7 -6
- package/dist/components/chat/styled-boxes/StyledBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/StyledBox.js +7 -6
- package/dist/components/chat/styled-boxes/SyspromptBox.cjs +2 -1
- package/dist/components/chat/styled-boxes/SyspromptBox.d.ts.map +1 -1
- package/dist/components/chat/styled-boxes/SyspromptBox.js +2 -1
- package/dist/components/modes/AlternateBufferCLI.cjs +53 -43
- package/dist/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/components/modes/AlternateBufferCLI.js +53 -43
- package/dist/components/modes/StaticCLI.cjs +53 -42
- package/dist/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/components/modes/StaticCLI.js +53 -42
- package/dist/components/overlays/ApiKeyInput.cjs +12 -11
- package/dist/components/overlays/ApiKeyInput.d.ts.map +1 -1
- package/dist/components/overlays/ApiKeyInput.js +12 -11
- package/dist/components/overlays/ChatGPTUsageCapOverlay.cjs +7 -6
- package/dist/components/overlays/ChatGPTUsageCapOverlay.d.ts.map +1 -1
- package/dist/components/overlays/ChatGPTUsageCapOverlay.js +7 -6
- package/dist/components/overlays/CommandOutputOverlay.cjs +2 -1
- package/dist/components/overlays/CommandOutputOverlay.d.ts.map +1 -1
- package/dist/components/overlays/CommandOutputOverlay.js +2 -1
- package/dist/components/overlays/ConnectOverlay.cjs +10 -9
- package/dist/components/overlays/ConnectOverlay.d.ts.map +1 -1
- package/dist/components/overlays/ConnectOverlay.js +10 -9
- package/dist/components/overlays/ContextStatsOverlay.cjs +48 -37
- package/dist/components/overlays/ContextStatsOverlay.d.ts.map +1 -1
- package/dist/components/overlays/ContextStatsOverlay.js +48 -37
- package/dist/components/overlays/CustomModelWizard.cjs +5 -4
- package/dist/components/overlays/CustomModelWizard.d.ts.map +1 -1
- package/dist/components/overlays/CustomModelWizard.js +5 -4
- package/dist/components/overlays/ExportWizard.cjs +28 -27
- package/dist/components/overlays/ExportWizard.d.ts.map +1 -1
- package/dist/components/overlays/ExportWizard.js +28 -27
- package/dist/components/overlays/InsufficientCreditsOverlay.cjs +8 -7
- package/dist/components/overlays/InsufficientCreditsOverlay.d.ts.map +1 -1
- package/dist/components/overlays/InsufficientCreditsOverlay.js +8 -7
- package/dist/components/overlays/LogLevelSelector.cjs +6 -5
- package/dist/components/overlays/LogLevelSelector.d.ts.map +1 -1
- package/dist/components/overlays/LogLevelSelector.js +6 -5
- package/dist/components/overlays/LoginOverlay.cjs +7 -6
- package/dist/components/overlays/LoginOverlay.d.ts.map +1 -1
- package/dist/components/overlays/LoginOverlay.js +7 -6
- package/dist/components/overlays/LogoutOverlay.cjs +10 -9
- package/dist/components/overlays/LogoutOverlay.d.ts.map +1 -1
- package/dist/components/overlays/LogoutOverlay.js +10 -9
- package/dist/components/overlays/MarketplaceAddPrompt.cjs +12 -11
- package/dist/components/overlays/MarketplaceAddPrompt.d.ts.map +1 -1
- package/dist/components/overlays/MarketplaceAddPrompt.js +12 -11
- package/dist/components/overlays/MarketplaceBrowser.cjs +27 -26
- package/dist/components/overlays/MarketplaceBrowser.d.ts.map +1 -1
- package/dist/components/overlays/MarketplaceBrowser.js +27 -26
- package/dist/components/overlays/McpAddChoice.cjs +4 -3
- package/dist/components/overlays/McpAddChoice.d.ts.map +1 -1
- package/dist/components/overlays/McpAddChoice.js +4 -3
- package/dist/components/overlays/McpAddSelector.cjs +4 -3
- package/dist/components/overlays/McpAddSelector.d.ts.map +1 -1
- package/dist/components/overlays/McpAddSelector.js +4 -3
- package/dist/components/overlays/McpCustomTypeSelector.cjs +4 -3
- package/dist/components/overlays/McpCustomTypeSelector.d.ts.map +1 -1
- package/dist/components/overlays/McpCustomTypeSelector.js +4 -3
- package/dist/components/overlays/McpCustomWizard.cjs +9 -8
- package/dist/components/overlays/McpCustomWizard.d.ts.map +1 -1
- package/dist/components/overlays/McpCustomWizard.js +9 -8
- package/dist/components/overlays/McpRemoveSelector.cjs +5 -4
- package/dist/components/overlays/McpRemoveSelector.d.ts.map +1 -1
- package/dist/components/overlays/McpRemoveSelector.js +5 -4
- package/dist/components/overlays/McpSelector.cjs +4 -3
- package/dist/components/overlays/McpSelector.d.ts.map +1 -1
- package/dist/components/overlays/McpSelector.js +4 -3
- package/dist/components/overlays/McpServerActions.cjs +7 -6
- package/dist/components/overlays/McpServerActions.d.ts.map +1 -1
- package/dist/components/overlays/McpServerActions.js +7 -6
- package/dist/components/overlays/McpServerList.cjs +6 -5
- package/dist/components/overlays/McpServerList.d.ts.map +1 -1
- package/dist/components/overlays/McpServerList.js +6 -5
- package/dist/components/overlays/ModelSelectorRefactored.cjs +32 -17
- package/dist/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/components/overlays/ModelSelectorRefactored.js +32 -17
- package/dist/components/overlays/PermissionsSelector.cjs +6 -5
- package/dist/components/overlays/PermissionsSelector.d.ts.map +1 -1
- package/dist/components/overlays/PermissionsSelector.js +6 -5
- package/dist/components/overlays/PluginActions.cjs +7 -6
- package/dist/components/overlays/PluginActions.d.ts.map +1 -1
- package/dist/components/overlays/PluginActions.js +7 -6
- package/dist/components/overlays/PluginList.cjs +12 -11
- package/dist/components/overlays/PluginList.d.ts.map +1 -1
- package/dist/components/overlays/PluginList.js +12 -11
- package/dist/components/overlays/PluginManager.cjs +13 -5
- package/dist/components/overlays/PluginManager.d.ts.map +1 -1
- package/dist/components/overlays/PluginManager.js +13 -5
- package/dist/components/overlays/PromptAddChoice.cjs +5 -4
- package/dist/components/overlays/PromptAddChoice.d.ts.map +1 -1
- package/dist/components/overlays/PromptAddChoice.js +5 -4
- package/dist/components/overlays/PromptAddWizard.cjs +10 -9
- package/dist/components/overlays/PromptAddWizard.d.ts.map +1 -1
- package/dist/components/overlays/PromptAddWizard.js +10 -9
- package/dist/components/overlays/PromptDeleteSelector.cjs +6 -5
- package/dist/components/overlays/PromptDeleteSelector.d.ts.map +1 -1
- package/dist/components/overlays/PromptDeleteSelector.js +6 -5
- package/dist/components/overlays/PromptList.cjs +10 -9
- package/dist/components/overlays/PromptList.d.ts.map +1 -1
- package/dist/components/overlays/PromptList.js +10 -9
- package/dist/components/overlays/ReasoningOverlay.cjs +30 -23
- package/dist/components/overlays/ReasoningOverlay.d.ts.map +1 -1
- package/dist/components/overlays/ReasoningOverlay.js +30 -23
- package/dist/components/overlays/SearchOverlay.cjs +15 -14
- package/dist/components/overlays/SearchOverlay.d.ts.map +1 -1
- package/dist/components/overlays/SearchOverlay.js +15 -14
- package/dist/components/overlays/SessionRenameOverlay.cjs +9 -8
- package/dist/components/overlays/SessionRenameOverlay.d.ts.map +1 -1
- package/dist/components/overlays/SessionRenameOverlay.js +9 -8
- package/dist/components/overlays/SessionSelectorRefactored.cjs +4 -3
- package/dist/components/overlays/SessionSelectorRefactored.d.ts.map +1 -1
- package/dist/components/overlays/SessionSelectorRefactored.js +4 -3
- package/dist/components/overlays/SessionSubcommandSelector.cjs +4 -3
- package/dist/components/overlays/SessionSubcommandSelector.d.ts.map +1 -1
- package/dist/components/overlays/SessionSubcommandSelector.js +4 -3
- package/dist/components/overlays/SoundsSelector.cjs +15 -7
- package/dist/components/overlays/SoundsSelector.d.ts.map +1 -1
- package/dist/components/overlays/SoundsSelector.js +15 -7
- package/dist/components/overlays/StreamSelector.cjs +5 -4
- package/dist/components/overlays/StreamSelector.d.ts.map +1 -1
- package/dist/components/overlays/StreamSelector.js +5 -4
- package/dist/components/overlays/ToolBrowser.cjs +73 -56
- package/dist/components/overlays/ToolBrowser.d.ts.map +1 -1
- package/dist/components/overlays/ToolBrowser.js +73 -56
- package/dist/components/overlays/custom-model-wizard/LocalModelWizard.cjs +103 -69
- package/dist/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/LocalModelWizard.js +103 -69
- package/dist/components/overlays/custom-model-wizard/shared/ApiKeyStep.cjs +3 -2
- package/dist/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +3 -2
- package/dist/components/overlays/custom-model-wizard/shared/ProviderSelector.cjs +5 -4
- package/dist/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/shared/ProviderSelector.js +5 -4
- package/dist/components/overlays/custom-model-wizard/shared/SetupInfoBanner.cjs +4 -3
- package/dist/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +4 -3
- package/dist/components/overlays/custom-model-wizard/shared/WizardStepInput.cjs +7 -6
- package/dist/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/shared/WizardStepInput.js +7 -6
- package/dist/components/renderers/DiffRenderer.cjs +5 -4
- package/dist/components/renderers/DiffRenderer.d.ts.map +1 -1
- package/dist/components/renderers/DiffRenderer.js +5 -4
- package/dist/components/renderers/FilePreviewRenderer.cjs +23 -13
- package/dist/components/renderers/FilePreviewRenderer.d.ts.map +1 -1
- package/dist/components/renderers/FilePreviewRenderer.js +23 -13
- package/dist/components/renderers/FileRenderer.cjs +9 -8
- package/dist/components/renderers/FileRenderer.d.ts.map +1 -1
- package/dist/components/renderers/FileRenderer.js +9 -8
- package/dist/components/renderers/GenericRenderer.cjs +5 -4
- package/dist/components/renderers/GenericRenderer.d.ts.map +1 -1
- package/dist/components/renderers/GenericRenderer.js +5 -4
- package/dist/components/renderers/SearchRenderer.cjs +4 -3
- package/dist/components/renderers/SearchRenderer.d.ts.map +1 -1
- package/dist/components/renderers/SearchRenderer.js +4 -3
- package/dist/components/renderers/ShellRenderer.cjs +6 -5
- package/dist/components/renderers/ShellRenderer.d.ts.map +1 -1
- package/dist/components/renderers/ShellRenderer.js +6 -5
- package/dist/components/renderers/SignalDiff.cjs +139 -0
- package/dist/components/renderers/SignalDiff.d.ts +21 -0
- package/dist/components/renderers/SignalDiff.d.ts.map +1 -0
- package/dist/components/renderers/SignalDiff.js +106 -0
- package/dist/components/renderers/SignalDiff.test.cjs +78 -0
- package/dist/components/renderers/SignalDiff.test.d.ts +2 -0
- package/dist/components/renderers/SignalDiff.test.d.ts.map +1 -0
- package/dist/components/renderers/SignalDiff.test.js +77 -0
- package/dist/components/renderers/diff-shared.cjs +13 -7
- package/dist/components/renderers/diff-shared.d.ts +5 -0
- package/dist/components/renderers/diff-shared.d.ts.map +1 -1
- package/dist/components/renderers/diff-shared.js +12 -7
- package/dist/components/shared/FocusOverlayFrame.cjs +3 -2
- package/dist/components/shared/FocusOverlayFrame.d.ts.map +1 -1
- package/dist/components/shared/FocusOverlayFrame.js +3 -2
- package/dist/components/shared/HintBar.cjs +2 -1
- package/dist/components/shared/HintBar.d.ts.map +1 -1
- package/dist/components/shared/HintBar.js +2 -1
- package/dist/components/shared/MarkdownText.cjs +36 -53
- package/dist/components/shared/MarkdownText.d.ts +2 -0
- package/dist/components/shared/MarkdownText.d.ts.map +1 -1
- package/dist/components/shared/MarkdownText.js +36 -54
- package/dist/components/shared/VirtualizedList.cjs +2 -1
- package/dist/components/shared/VirtualizedList.d.ts.map +1 -1
- package/dist/components/shared/VirtualizedList.js +2 -1
- package/dist/containers/OverlayContainer.cjs +2 -4
- package/dist/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/containers/OverlayContainer.js +2 -4
- package/dist/contexts/KeypressContext.cjs +7 -1
- package/dist/contexts/KeypressContext.d.ts.map +1 -1
- package/dist/contexts/KeypressContext.js +7 -1
- package/dist/contexts/KeypressContext.test.cjs +82 -0
- package/dist/contexts/KeypressContext.test.d.ts +2 -0
- package/dist/contexts/KeypressContext.test.d.ts.map +1 -0
- package/dist/contexts/KeypressContext.test.js +81 -0
- package/dist/hooks/useAgentEvents.cjs +1 -74
- package/dist/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/hooks/useAgentEvents.js +1 -74
- package/dist/hooks/useCLIState.cjs +0 -3
- package/dist/hooks/useCLIState.d.ts.map +1 -1
- package/dist/hooks/useCLIState.js +0 -3
- package/dist/hooks/useContextStats.cjs +91 -0
- package/dist/hooks/useContextStats.d.ts +13 -0
- package/dist/hooks/useContextStats.d.ts.map +1 -0
- package/dist/hooks/useContextStats.js +67 -0
- package/dist/hooks/useDeckState.cjs +140 -0
- package/dist/hooks/useDeckState.d.ts +20 -0
- package/dist/hooks/useDeckState.d.ts.map +1 -0
- package/dist/hooks/useDeckState.js +123 -0
- package/dist/hooks/useDextoCredits.cjs +81 -0
- package/dist/hooks/useDextoCredits.d.ts +14 -0
- package/dist/hooks/useDextoCredits.d.ts.map +1 -0
- package/dist/hooks/useDextoCredits.js +56 -0
- package/dist/hooks/useDextoCredits.test.cjs +73 -0
- package/dist/hooks/useDextoCredits.test.d.ts +2 -0
- package/dist/hooks/useDextoCredits.test.d.ts.map +1 -0
- package/dist/hooks/useDextoCredits.test.js +72 -0
- package/dist/hooks/useElapsedTime.cjs +13 -24
- package/dist/hooks/useElapsedTime.d.ts +3 -1
- package/dist/hooks/useElapsedTime.d.ts.map +1 -1
- package/dist/hooks/useElapsedTime.js +13 -24
- package/dist/hooks/useElapsedTime.test.cjs +35 -0
- package/dist/hooks/useElapsedTime.test.d.ts +2 -0
- package/dist/hooks/useElapsedTime.test.d.ts.map +1 -0
- package/dist/hooks/useElapsedTime.test.js +34 -0
- package/dist/hooks/useGitDirtyFiles.cjs +59 -0
- package/dist/hooks/useGitDirtyFiles.d.ts +5 -0
- package/dist/hooks/useGitDirtyFiles.d.ts.map +1 -0
- package/dist/hooks/useGitDirtyFiles.js +34 -0
- package/dist/hooks/useGitDirtyFiles.test.cjs +9 -0
- package/dist/hooks/useGitDirtyFiles.test.d.ts +2 -0
- package/dist/hooks/useGitDirtyFiles.test.d.ts.map +1 -0
- package/dist/hooks/useGitDirtyFiles.test.js +8 -0
- package/dist/hooks/useHeldValue.cjs +33 -0
- package/dist/hooks/useHeldValue.d.ts +3 -0
- package/dist/hooks/useHeldValue.d.ts.map +1 -0
- package/dist/hooks/useHeldValue.js +9 -0
- package/dist/hooks/useHeldValue.test.cjs +31 -0
- package/dist/hooks/useHeldValue.test.d.ts +2 -0
- package/dist/hooks/useHeldValue.test.d.ts.map +1 -0
- package/dist/hooks/useHeldValue.test.js +30 -0
- package/dist/hooks/useInputOrchestrator.cjs +22 -30
- package/dist/hooks/useInputOrchestrator.d.ts +2 -0
- package/dist/hooks/useInputOrchestrator.d.ts.map +1 -1
- package/dist/hooks/useInputOrchestrator.js +21 -30
- package/dist/hooks/useInputOrchestrator.test.cjs +24 -0
- package/dist/hooks/useInputOrchestrator.test.d.ts +2 -0
- package/dist/hooks/useInputOrchestrator.test.d.ts.map +1 -0
- package/dist/hooks/useInputOrchestrator.test.js +23 -0
- package/dist/interactive-commands/command-parser.cjs +13 -21
- package/dist/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/interactive-commands/command-parser.js +13 -11
- package/dist/interactive-commands/general-commands.cjs +8 -7
- package/dist/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/interactive-commands/general-commands.js +8 -7
- package/dist/services/processStream.cjs +31 -19
- package/dist/services/processStream.d.ts.map +1 -1
- package/dist/services/processStream.js +32 -20
- package/dist/services/processStream.test.cjs +51 -3
- package/dist/services/processStream.test.js +51 -3
- package/dist/signal/background.cjs +154 -0
- package/dist/signal/background.d.ts +43 -0
- package/dist/signal/background.d.ts.map +1 -0
- package/dist/signal/background.js +124 -0
- package/dist/signal/background.test.cjs +186 -0
- package/dist/signal/background.test.d.ts +2 -0
- package/dist/signal/background.test.d.ts.map +1 -0
- package/dist/signal/background.test.js +192 -0
- package/dist/signal/caps.cjs +100 -0
- package/dist/signal/caps.d.ts +23 -0
- package/dist/signal/caps.d.ts.map +1 -0
- package/dist/signal/caps.js +73 -0
- package/dist/signal/caps.test.cjs +56 -0
- package/dist/signal/caps.test.d.ts +2 -0
- package/dist/signal/caps.test.d.ts.map +1 -0
- package/dist/signal/caps.test.js +55 -0
- package/dist/signal/components.cjs +257 -0
- package/dist/signal/components.d.ts +120 -0
- package/dist/signal/components.d.ts.map +1 -0
- package/dist/signal/components.js +226 -0
- package/dist/signal/components.test.cjs +156 -0
- package/dist/signal/components.test.d.ts +2 -0
- package/dist/signal/components.test.d.ts.map +1 -0
- package/dist/signal/components.test.js +133 -0
- package/dist/signal/cut.cjs +103 -0
- package/dist/signal/cut.d.ts +11 -0
- package/dist/signal/cut.d.ts.map +1 -0
- package/dist/signal/cut.js +77 -0
- package/dist/signal/cut.test.cjs +20 -0
- package/dist/signal/cut.test.d.ts +2 -0
- package/dist/signal/cut.test.d.ts.map +1 -0
- package/dist/signal/cut.test.js +19 -0
- package/dist/signal/deck-layout.cjs +57 -0
- package/dist/signal/deck-layout.d.ts +29 -0
- package/dist/signal/deck-layout.d.ts.map +1 -0
- package/dist/signal/deck-layout.js +30 -0
- package/dist/signal/deck-parts.cjs +243 -0
- package/dist/signal/deck-parts.d.ts +55 -0
- package/dist/signal/deck-parts.d.ts.map +1 -0
- package/dist/signal/deck-parts.js +205 -0
- package/dist/signal/deck.test.cjs +311 -0
- package/dist/signal/deck.test.d.ts +2 -0
- package/dist/signal/deck.test.d.ts.map +1 -0
- package/dist/signal/deck.test.js +288 -0
- package/dist/signal/glyphs.cjs +195 -0
- package/dist/signal/glyphs.d.ts +8 -0
- package/dist/signal/glyphs.d.ts.map +1 -0
- package/dist/signal/glyphs.js +171 -0
- package/dist/signal/glyphs.test.cjs +17 -0
- package/dist/signal/glyphs.test.d.ts +2 -0
- package/dist/signal/glyphs.test.d.ts.map +1 -0
- package/dist/signal/glyphs.test.js +16 -0
- package/dist/signal/harness.cjs +103 -0
- package/dist/signal/harness.d.ts +70 -0
- package/dist/signal/harness.d.ts.map +1 -0
- package/dist/signal/harness.js +67 -0
- package/dist/signal/harness.test.cjs +84 -0
- package/dist/signal/harness.test.d.ts +2 -0
- package/dist/signal/harness.test.d.ts.map +1 -0
- package/dist/signal/harness.test.js +61 -0
- package/dist/signal/index.cjs +76 -0
- package/dist/signal/index.d.ts +8 -0
- package/dist/signal/index.d.ts.map +1 -0
- package/dist/signal/index.js +45 -0
- package/dist/signal/kit.snapshot.test.cjs +56 -0
- package/dist/signal/kit.snapshot.test.d.ts +2 -0
- package/dist/signal/kit.snapshot.test.d.ts.map +1 -0
- package/dist/signal/kit.snapshot.test.js +55 -0
- package/dist/signal/no-raw-colours.test.cjs +32 -0
- package/dist/signal/no-raw-colours.test.d.ts +2 -0
- package/dist/signal/no-raw-colours.test.d.ts.map +1 -0
- package/dist/signal/no-raw-colours.test.js +30 -0
- package/dist/signal/paint.cjs +76 -0
- package/dist/signal/paint.d.ts +15 -0
- package/dist/signal/paint.d.ts.map +1 -0
- package/dist/signal/paint.js +41 -0
- package/dist/signal/paint.test.cjs +98 -0
- package/dist/signal/paint.test.d.ts +2 -0
- package/dist/signal/paint.test.d.ts.map +1 -0
- package/dist/signal/paint.test.js +75 -0
- package/dist/signal/tone.cjs +109 -0
- package/dist/signal/tone.d.ts +17 -0
- package/dist/signal/tone.d.ts.map +1 -0
- package/dist/signal/tone.js +83 -0
- package/dist/signal/tone.test.cjs +70 -0
- package/dist/signal/tone.test.d.ts +2 -0
- package/dist/signal/tone.test.d.ts.map +1 -0
- package/dist/signal/tone.test.js +69 -0
- package/dist/signal/trace.cjs +142 -0
- package/dist/signal/trace.d.ts +41 -0
- package/dist/signal/trace.d.ts.map +1 -0
- package/dist/signal/trace.js +113 -0
- package/dist/signal/trace.test.cjs +50 -0
- package/dist/signal/trace.test.d.ts +2 -0
- package/dist/signal/trace.test.d.ts.map +1 -0
- package/dist/signal/trace.test.js +49 -0
- package/dist/signal/use-trace.cjs +73 -0
- package/dist/signal/use-trace.d.ts +5 -0
- package/dist/signal/use-trace.d.ts.map +1 -0
- package/dist/signal/use-trace.js +48 -0
- package/dist/signal/wordmark-art.generated.cjs +375 -0
- package/dist/signal/wordmark-art.generated.d.ts +3 -0
- package/dist/signal/wordmark-art.generated.d.ts.map +1 -0
- package/dist/signal/wordmark-art.generated.js +351 -0
- package/dist/signal/wordmark.cjs +60 -0
- package/dist/signal/wordmark.d.ts +23 -0
- package/dist/signal/wordmark.d.ts.map +1 -0
- package/dist/signal/wordmark.js +34 -0
- package/dist/signal/wordmark.test.cjs +71 -0
- package/dist/signal/wordmark.test.d.ts +2 -0
- package/dist/signal/wordmark.test.d.ts.map +1 -0
- package/dist/signal/wordmark.test.js +70 -0
- package/dist/state/initialState.cjs +0 -3
- package/dist/state/initialState.d.ts.map +1 -1
- package/dist/state/initialState.js +0 -3
- package/dist/state/types.d.ts +13 -7
- package/dist/state/types.d.ts.map +1 -1
- package/dist/utils/approval-response.cjs +45 -0
- package/dist/utils/approval-response.d.ts +14 -0
- package/dist/utils/approval-response.d.ts.map +1 -0
- package/dist/utils/approval-response.js +21 -0
- package/dist/utils/approval-response.test.cjs +49 -0
- package/dist/utils/approval-response.test.d.ts +2 -0
- package/dist/utils/approval-response.test.d.ts.map +1 -0
- package/dist/utils/approval-response.test.js +55 -0
- package/dist/utils/approvalScope.cjs +12 -0
- package/dist/utils/approvalScope.d.ts.map +1 -1
- package/dist/utils/approvalScope.js +12 -0
- package/dist/utils/approvalScope.test.cjs +23 -0
- package/dist/utils/approvalScope.test.d.ts +2 -0
- package/dist/utils/approvalScope.test.d.ts.map +1 -0
- package/dist/utils/approvalScope.test.js +22 -0
- package/dist/utils/background-failure.cjs +51 -0
- package/dist/utils/background-failure.d.ts +12 -0
- package/dist/utils/background-failure.d.ts.map +1 -0
- package/dist/utils/background-failure.js +26 -0
- package/dist/utils/chatgpt-rate-limit.cjs +10 -0
- package/dist/utils/chatgpt-rate-limit.d.ts +9 -0
- package/dist/utils/chatgpt-rate-limit.d.ts.map +1 -1
- package/dist/utils/chatgpt-rate-limit.js +9 -0
- package/dist/utils/chatgpt-rate-limit.test.cjs +10 -0
- package/dist/utils/chatgpt-rate-limit.test.js +11 -0
- package/dist/utils/deck-state.cjs +107 -0
- package/dist/utils/deck-state.d.ts +79 -0
- package/dist/utils/deck-state.d.ts.map +1 -0
- package/dist/utils/deck-state.js +76 -0
- package/dist/utils/deck-state.test.cjs +208 -0
- package/dist/utils/deck-state.test.d.ts +2 -0
- package/dist/utils/deck-state.test.d.ts.map +1 -0
- package/dist/utils/deck-state.test.js +216 -0
- package/dist/utils/fault-block.cjs +37 -0
- package/dist/utils/fault-block.d.ts +13 -0
- package/dist/utils/fault-block.d.ts.map +1 -0
- package/dist/utils/fault-block.js +13 -0
- package/dist/utils/fault-block.test.cjs +23 -0
- package/dist/utils/fault-block.test.d.ts +2 -0
- package/dist/utils/fault-block.test.d.ts.map +1 -0
- package/dist/utils/fault-block.test.js +22 -0
- package/dist/utils/messageFormatting.cjs +26 -23
- package/dist/utils/messageFormatting.d.ts +5 -2
- package/dist/utils/messageFormatting.d.ts.map +1 -1
- package/dist/utils/messageFormatting.js +25 -21
- package/dist/utils/messageFormatting.test.cjs +34 -0
- package/dist/utils/messageFormatting.test.js +35 -1
- package/dist/utils/reasoning-variant.cjs +35 -0
- package/dist/utils/reasoning-variant.d.ts +13 -0
- package/dist/utils/reasoning-variant.d.ts.map +1 -0
- package/dist/utils/reasoning-variant.js +11 -0
- package/dist/utils/resize-reflow.cjs +119 -0
- package/dist/utils/resize-reflow.d.ts +18 -0
- package/dist/utils/resize-reflow.d.ts.map +1 -0
- package/dist/utils/resize-reflow.js +83 -0
- package/dist/utils/resize-reflow.test.cjs +100 -0
- package/dist/utils/resize-reflow.test.d.ts +2 -0
- package/dist/utils/resize-reflow.test.d.ts.map +1 -0
- package/dist/utils/resize-reflow.test.js +99 -0
- package/dist/utils/tool-step.cjs +183 -0
- package/dist/utils/tool-step.d.ts +28 -0
- package/dist/utils/tool-step.d.ts.map +1 -0
- package/dist/utils/tool-step.js +156 -0
- package/dist/utils/tool-step.test.cjs +263 -0
- package/dist/utils/tool-step.test.d.ts +2 -0
- package/dist/utils/tool-step.test.d.ts.map +1 -0
- package/dist/utils/tool-step.test.js +262 -0
- package/package.json +7 -3
- package/dist/components/BackgroundTasksPanel.cjs +0 -117
- package/dist/components/BackgroundTasksPanel.d.ts +0 -18
- package/dist/components/BackgroundTasksPanel.d.ts.map +0 -1
- package/dist/components/BackgroundTasksPanel.js +0 -93
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { formatToolHeader } from "./messageFormatting.js";
|
|
2
|
+
import { convertHistoryToUIMessages, formatToolHeader } from "./messageFormatting.js";
|
|
3
|
+
import { toolOutput, toolStep } from "./tool-step.js";
|
|
3
4
|
describe("formatToolHeader fallback args", () => {
|
|
4
5
|
it("truncates from the start (not mid-string)", () => {
|
|
5
6
|
const long = "with base path set to packages/server (or absolute if needed). Summarize key directories and notable config/source files.";
|
|
@@ -13,3 +14,36 @@ describe("formatToolHeader fallback args", () => {
|
|
|
13
14
|
expect(header).toContain("...");
|
|
14
15
|
});
|
|
15
16
|
});
|
|
17
|
+
describe("convertHistoryToUIMessages for a background command read back", () => {
|
|
18
|
+
function resumed(text) {
|
|
19
|
+
const history = [
|
|
20
|
+
{
|
|
21
|
+
role: "tool",
|
|
22
|
+
name: "bash_output",
|
|
23
|
+
toolCallId: "c1",
|
|
24
|
+
success: true,
|
|
25
|
+
content: [{ type: "text", text }],
|
|
26
|
+
timestamp: 1
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
const message = convertHistoryToUIMessages(history, "s1")[0];
|
|
30
|
+
if (message === void 0) throw new Error("expected a tool message");
|
|
31
|
+
return message;
|
|
32
|
+
}
|
|
33
|
+
it("shows a failed command as failed, with its output", () => {
|
|
34
|
+
const message = resumed(
|
|
35
|
+
JSON.stringify({ status: "failed", stderr: "boom", stdout: "", exit_code: 2 })
|
|
36
|
+
);
|
|
37
|
+
expect(toolStep(message).state).toBe("fail");
|
|
38
|
+
expect(toolOutput(message)).toEqual(["boom"]);
|
|
39
|
+
});
|
|
40
|
+
it("leaves a completed command as it was", () => {
|
|
41
|
+
const message = resumed(JSON.stringify({ status: "completed", stdout: "done" }));
|
|
42
|
+
expect(toolStep(message).state).toBe("ok");
|
|
43
|
+
});
|
|
44
|
+
it("leaves a row as it was when the stored text cannot be parsed", () => {
|
|
45
|
+
const message = resumed('{"status":"failed","stderr":"bo\n\n[Output truncated: ...]');
|
|
46
|
+
expect(toolStep(message).state).toBe("ok");
|
|
47
|
+
expect(message.toolOutcome).toBeUndefined();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var reasoning_variant_exports = {};
|
|
20
|
+
__export(reasoning_variant_exports, {
|
|
21
|
+
displayedReasoningVariant: () => displayedReasoningVariant
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(reasoning_variant_exports);
|
|
24
|
+
var import_llm = require("@dexto/llm");
|
|
25
|
+
function displayedReasoningVariant(llmConfig) {
|
|
26
|
+
if (llmConfig === null) return null;
|
|
27
|
+
const profile = (0, import_llm.getReasoningProfile)(llmConfig.provider, llmConfig.model);
|
|
28
|
+
if (profile.capable !== true) return null;
|
|
29
|
+
const variant = llmConfig.reasoning?.variant ?? profile.defaultVariant;
|
|
30
|
+
return typeof variant === "string" ? variant : null;
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
displayedReasoningVariant
|
|
35
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getReasoningProfile } from '@dexto/llm';
|
|
2
|
+
/**
|
|
3
|
+
* The reasoning variant to show beside the model: the one picked for the session, else the
|
|
4
|
+
* model's default. Null when the model doesn't reason or has no variant.
|
|
5
|
+
*/
|
|
6
|
+
export declare function displayedReasoningVariant(llmConfig: {
|
|
7
|
+
provider: Parameters<typeof getReasoningProfile>[0];
|
|
8
|
+
model: string;
|
|
9
|
+
reasoning?: {
|
|
10
|
+
variant?: string | undefined;
|
|
11
|
+
} | undefined;
|
|
12
|
+
} | null): string | null;
|
|
13
|
+
//# sourceMappingURL=reasoning-variant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reasoning-variant.d.ts","sourceRoot":"","sources":["../../src/utils/reasoning-variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,yBAAyB,CACrC,SAAS,EAAE;IACP,QAAQ,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,GAAG,SAAS,CAAC;CAC5D,GAAG,IAAI,GACT,MAAM,GAAG,IAAI,CAMf"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getReasoningProfile } from "@dexto/llm";
|
|
2
|
+
function displayedReasoningVariant(llmConfig) {
|
|
3
|
+
if (llmConfig === null) return null;
|
|
4
|
+
const profile = getReasoningProfile(llmConfig.provider, llmConfig.model);
|
|
5
|
+
if (profile.capable !== true) return null;
|
|
6
|
+
const variant = llmConfig.reasoning?.variant ?? profile.defaultVariant;
|
|
7
|
+
return typeof variant === "string" ? variant : null;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
displayedReasoningVariant
|
|
11
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var resize_reflow_exports = {};
|
|
30
|
+
__export(resize_reflow_exports, {
|
|
31
|
+
keepScrollbackOnResize: () => keepScrollbackOnResize,
|
|
32
|
+
reflowedRows: () => reflowedRows,
|
|
33
|
+
shrinkRepair: () => shrinkRepair
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(resize_reflow_exports);
|
|
36
|
+
var import_string_width = __toESM(require("string-width"), 1);
|
|
37
|
+
var import_strip_ansi = __toESM(require("strip-ansi"), 1);
|
|
38
|
+
const CSI = "\x1B[";
|
|
39
|
+
const ERASE_LINE = `${CSI}2K`;
|
|
40
|
+
const CURSOR_UP = `${CSI}1A`;
|
|
41
|
+
const CURSOR_LEFT = `${CSI}G`;
|
|
42
|
+
const ERASE_PARTS = [ERASE_LINE, CURSOR_UP, CURSOR_LEFT];
|
|
43
|
+
function stripLeadingErase(chunk) {
|
|
44
|
+
let rest = chunk;
|
|
45
|
+
for (; ; ) {
|
|
46
|
+
const part = ERASE_PARTS.find((p) => rest.startsWith(p));
|
|
47
|
+
if (part === void 0) return rest;
|
|
48
|
+
rest = rest.slice(part.length);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function eraseLines(count) {
|
|
52
|
+
let out = "";
|
|
53
|
+
for (let i = 0; i < count; i++) out += ERASE_LINE + (i < count - 1 ? CURSOR_UP : "");
|
|
54
|
+
return count > 0 ? out + CURSOR_LEFT : "";
|
|
55
|
+
}
|
|
56
|
+
const graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
57
|
+
function lineRows(line, columns) {
|
|
58
|
+
let rows = 1;
|
|
59
|
+
let col = 0;
|
|
60
|
+
for (const { segment } of graphemes.segment((0, import_strip_ansi.default)(line))) {
|
|
61
|
+
const width = (0, import_string_width.default)(segment);
|
|
62
|
+
if (width === 0) continue;
|
|
63
|
+
if (col + width > columns) {
|
|
64
|
+
rows++;
|
|
65
|
+
col = 0;
|
|
66
|
+
}
|
|
67
|
+
col += width;
|
|
68
|
+
}
|
|
69
|
+
return rows;
|
|
70
|
+
}
|
|
71
|
+
function reflowedRows(frame, columns) {
|
|
72
|
+
const cols = Math.max(1, columns);
|
|
73
|
+
return frame.split("\n").reduce((rows, line) => rows + lineRows(line, cols), 0);
|
|
74
|
+
}
|
|
75
|
+
function shrinkRepair(frame, columns) {
|
|
76
|
+
const inkRows = frame.split("\n").length;
|
|
77
|
+
const rows = reflowedRows(frame, columns);
|
|
78
|
+
if (rows <= inkRows) return "";
|
|
79
|
+
return eraseLines(rows) + (inkRows > 1 ? `${CSI}${inkRows - 1}B` : "");
|
|
80
|
+
}
|
|
81
|
+
function keepScrollbackOnResize(real) {
|
|
82
|
+
let lastFrame = "";
|
|
83
|
+
let columns = real.columns || 80;
|
|
84
|
+
const write = (chunk, ...rest) => {
|
|
85
|
+
if (typeof chunk === "string" && chunk !== "") lastFrame = stripLeadingErase(chunk);
|
|
86
|
+
return real.write(chunk, ...rest);
|
|
87
|
+
};
|
|
88
|
+
const onResize = () => {
|
|
89
|
+
const next = real.columns || 80;
|
|
90
|
+
if (next < columns && lastFrame !== "") {
|
|
91
|
+
const repair = shrinkRepair(lastFrame, next);
|
|
92
|
+
if (repair !== "") {
|
|
93
|
+
real.write(repair);
|
|
94
|
+
lastFrame = "";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
columns = next;
|
|
98
|
+
};
|
|
99
|
+
real.prependListener("resize", onResize);
|
|
100
|
+
const stdout = new Proxy(real, {
|
|
101
|
+
get(target, prop, receiver) {
|
|
102
|
+
if (prop === "write") return write;
|
|
103
|
+
const value = Reflect.get(target, prop, receiver);
|
|
104
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return {
|
|
108
|
+
stdout,
|
|
109
|
+
dispose: () => {
|
|
110
|
+
real.off("resize", onResize);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
115
|
+
0 && (module.exports = {
|
|
116
|
+
keepScrollbackOnResize,
|
|
117
|
+
reflowedRows,
|
|
118
|
+
shrinkRepair
|
|
119
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Rows `frame` (ending in a newline, as Ink writes it) takes at `columns` once rewrapped. */
|
|
2
|
+
export declare function reflowedRows(frame: string, columns: number): number;
|
|
3
|
+
/**
|
|
4
|
+
* Escape sequence that clears `frame` after a shrink to `columns`, leaving the cursor where
|
|
5
|
+
* Ink's next erase of the frame's own row count ends on the frame's top row. '' if nothing wraps.
|
|
6
|
+
*/
|
|
7
|
+
export declare function shrinkRepair(frame: string, columns: number): string;
|
|
8
|
+
export interface KeptScrollback {
|
|
9
|
+
/** Hand this to Ink's render() as `stdout`. */
|
|
10
|
+
stdout: NodeJS.WriteStream;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Wrap `real` so the last frame written through it is remembered, and repair shrinks before
|
|
15
|
+
* any other resize listener (Ink's) runs.
|
|
16
|
+
*/
|
|
17
|
+
export declare function keepScrollbackOnResize(real: NodeJS.WriteStream): KeptScrollback;
|
|
18
|
+
//# sourceMappingURL=resize-reflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize-reflow.d.ts","sourceRoot":"","sources":["../../src/utils/resize-reflow.ts"],"names":[],"mappings":"AA8DA,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGnE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAKnE;AAED,MAAM,WAAW,cAAc;IAC3B,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,GAAG,cAAc,CAqC/E"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import stringWidth from "string-width";
|
|
2
|
+
import stripAnsi from "strip-ansi";
|
|
3
|
+
const CSI = "\x1B[";
|
|
4
|
+
const ERASE_LINE = `${CSI}2K`;
|
|
5
|
+
const CURSOR_UP = `${CSI}1A`;
|
|
6
|
+
const CURSOR_LEFT = `${CSI}G`;
|
|
7
|
+
const ERASE_PARTS = [ERASE_LINE, CURSOR_UP, CURSOR_LEFT];
|
|
8
|
+
function stripLeadingErase(chunk) {
|
|
9
|
+
let rest = chunk;
|
|
10
|
+
for (; ; ) {
|
|
11
|
+
const part = ERASE_PARTS.find((p) => rest.startsWith(p));
|
|
12
|
+
if (part === void 0) return rest;
|
|
13
|
+
rest = rest.slice(part.length);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function eraseLines(count) {
|
|
17
|
+
let out = "";
|
|
18
|
+
for (let i = 0; i < count; i++) out += ERASE_LINE + (i < count - 1 ? CURSOR_UP : "");
|
|
19
|
+
return count > 0 ? out + CURSOR_LEFT : "";
|
|
20
|
+
}
|
|
21
|
+
const graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
22
|
+
function lineRows(line, columns) {
|
|
23
|
+
let rows = 1;
|
|
24
|
+
let col = 0;
|
|
25
|
+
for (const { segment } of graphemes.segment(stripAnsi(line))) {
|
|
26
|
+
const width = stringWidth(segment);
|
|
27
|
+
if (width === 0) continue;
|
|
28
|
+
if (col + width > columns) {
|
|
29
|
+
rows++;
|
|
30
|
+
col = 0;
|
|
31
|
+
}
|
|
32
|
+
col += width;
|
|
33
|
+
}
|
|
34
|
+
return rows;
|
|
35
|
+
}
|
|
36
|
+
function reflowedRows(frame, columns) {
|
|
37
|
+
const cols = Math.max(1, columns);
|
|
38
|
+
return frame.split("\n").reduce((rows, line) => rows + lineRows(line, cols), 0);
|
|
39
|
+
}
|
|
40
|
+
function shrinkRepair(frame, columns) {
|
|
41
|
+
const inkRows = frame.split("\n").length;
|
|
42
|
+
const rows = reflowedRows(frame, columns);
|
|
43
|
+
if (rows <= inkRows) return "";
|
|
44
|
+
return eraseLines(rows) + (inkRows > 1 ? `${CSI}${inkRows - 1}B` : "");
|
|
45
|
+
}
|
|
46
|
+
function keepScrollbackOnResize(real) {
|
|
47
|
+
let lastFrame = "";
|
|
48
|
+
let columns = real.columns || 80;
|
|
49
|
+
const write = (chunk, ...rest) => {
|
|
50
|
+
if (typeof chunk === "string" && chunk !== "") lastFrame = stripLeadingErase(chunk);
|
|
51
|
+
return real.write(chunk, ...rest);
|
|
52
|
+
};
|
|
53
|
+
const onResize = () => {
|
|
54
|
+
const next = real.columns || 80;
|
|
55
|
+
if (next < columns && lastFrame !== "") {
|
|
56
|
+
const repair = shrinkRepair(lastFrame, next);
|
|
57
|
+
if (repair !== "") {
|
|
58
|
+
real.write(repair);
|
|
59
|
+
lastFrame = "";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
columns = next;
|
|
63
|
+
};
|
|
64
|
+
real.prependListener("resize", onResize);
|
|
65
|
+
const stdout = new Proxy(real, {
|
|
66
|
+
get(target, prop, receiver) {
|
|
67
|
+
if (prop === "write") return write;
|
|
68
|
+
const value = Reflect.get(target, prop, receiver);
|
|
69
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
stdout,
|
|
74
|
+
dispose: () => {
|
|
75
|
+
real.off("resize", onResize);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
keepScrollbackOnResize,
|
|
81
|
+
reflowedRows,
|
|
82
|
+
shrinkRepair
|
|
83
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_node_events = require("node:events");
|
|
3
|
+
var import_vitest = require("vitest");
|
|
4
|
+
var import_resize_reflow = require("./resize-reflow.js");
|
|
5
|
+
const ESC = "\x1B[";
|
|
6
|
+
(0, import_vitest.describe)("reflowedRows", () => {
|
|
7
|
+
(0, import_vitest.it)("counts the rows a frame takes once the terminal rewraps it", () => {
|
|
8
|
+
(0, import_vitest.expect)((0, import_resize_reflow.reflowedRows)(`${"a".repeat(100)}
|
|
9
|
+
|
|
10
|
+
bb
|
|
11
|
+
`, 40)).toBe(3 + 1 + 1 + 1);
|
|
12
|
+
});
|
|
13
|
+
(0, import_vitest.it)("wraps a wide character that would straddle the right margin", () => {
|
|
14
|
+
(0, import_vitest.expect)((0, import_resize_reflow.reflowedRows)(`${"\u754C".repeat(49)}
|
|
15
|
+
`, 49)).toBe(3 + 1);
|
|
16
|
+
});
|
|
17
|
+
(0, import_vitest.it)("ignores colour codes when measuring", () => {
|
|
18
|
+
(0, import_vitest.expect)((0, import_resize_reflow.reflowedRows)(`${ESC}31m${"a".repeat(40)}${ESC}39m
|
|
19
|
+
`, 40)).toBe(1 + 1);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
(0, import_vitest.describe)("shrinkRepair", () => {
|
|
23
|
+
(0, import_vitest.it)("does nothing when no line wraps", () => {
|
|
24
|
+
(0, import_vitest.expect)((0, import_resize_reflow.shrinkRepair)("short\nlines\n", 40)).toBe("");
|
|
25
|
+
});
|
|
26
|
+
(0, import_vitest.it)("erases the rewrapped frame and leaves the cursor where the next erase expects it", () => {
|
|
27
|
+
const repair = (0, import_resize_reflow.shrinkRepair)(`${"a".repeat(60)}
|
|
28
|
+
b
|
|
29
|
+
`, 40);
|
|
30
|
+
(0, import_vitest.expect)(repair).toBe(`${ESC}2K${ESC}1A`.repeat(3) + `${ESC}2K${ESC}G${ESC}2B`);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
class FakeStdout extends import_node_events.EventEmitter {
|
|
34
|
+
columns = 80;
|
|
35
|
+
rows = 24;
|
|
36
|
+
isTTY = true;
|
|
37
|
+
written = [];
|
|
38
|
+
write(chunk) {
|
|
39
|
+
this.written.push(chunk);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
(0, import_vitest.describe)("keepScrollbackOnResize", () => {
|
|
44
|
+
(0, import_vitest.it)("remembers the last frame Ink wrote and repairs it before Ink redraws", () => {
|
|
45
|
+
const real = new FakeStdout();
|
|
46
|
+
const order = [];
|
|
47
|
+
const kept = (0, import_resize_reflow.keepScrollbackOnResize)(real);
|
|
48
|
+
const stdout = kept.stdout;
|
|
49
|
+
stdout.on("resize", () => order.push("ink"));
|
|
50
|
+
stdout.write(`${ESC}2K${ESC}G${"x".repeat(70)}
|
|
51
|
+
ok
|
|
52
|
+
`);
|
|
53
|
+
real.written = [];
|
|
54
|
+
real.columns = 40;
|
|
55
|
+
real.emit("resize");
|
|
56
|
+
(0, import_vitest.expect)(real.written).toHaveLength(1);
|
|
57
|
+
(0, import_vitest.expect)(real.written[0]).toContain(`${ESC}2K`);
|
|
58
|
+
(0, import_vitest.expect)(order).toEqual(["ink"]);
|
|
59
|
+
kept.dispose();
|
|
60
|
+
});
|
|
61
|
+
(0, import_vitest.it)("repairs a frame only once when two shrinks arrive before Ink redraws", () => {
|
|
62
|
+
const real = new FakeStdout();
|
|
63
|
+
const kept = (0, import_resize_reflow.keepScrollbackOnResize)(real);
|
|
64
|
+
kept.stdout.write(`${"x".repeat(70)}
|
|
65
|
+
ok
|
|
66
|
+
`);
|
|
67
|
+
real.written = [];
|
|
68
|
+
real.columns = 60;
|
|
69
|
+
real.emit("resize");
|
|
70
|
+
real.columns = 40;
|
|
71
|
+
real.emit("resize");
|
|
72
|
+
(0, import_vitest.expect)(real.written).toHaveLength(1);
|
|
73
|
+
kept.stdout.write(`${"y".repeat(70)}
|
|
74
|
+
ok
|
|
75
|
+
`);
|
|
76
|
+
real.written = [];
|
|
77
|
+
real.columns = 30;
|
|
78
|
+
real.emit("resize");
|
|
79
|
+
(0, import_vitest.expect)(real.written).toHaveLength(1);
|
|
80
|
+
kept.dispose();
|
|
81
|
+
});
|
|
82
|
+
(0, import_vitest.it)("leaves a growing terminal alone", () => {
|
|
83
|
+
const real = new FakeStdout();
|
|
84
|
+
const kept = (0, import_resize_reflow.keepScrollbackOnResize)(real);
|
|
85
|
+
kept.stdout.write(`${"x".repeat(70)}
|
|
86
|
+
`);
|
|
87
|
+
real.written = [];
|
|
88
|
+
real.columns = 120;
|
|
89
|
+
real.emit("resize");
|
|
90
|
+
(0, import_vitest.expect)(real.written).toEqual([]);
|
|
91
|
+
kept.dispose();
|
|
92
|
+
});
|
|
93
|
+
(0, import_vitest.it)("passes everything else through to the real stream", () => {
|
|
94
|
+
const real = new FakeStdout();
|
|
95
|
+
const kept = (0, import_resize_reflow.keepScrollbackOnResize)(real);
|
|
96
|
+
(0, import_vitest.expect)(kept.stdout.columns).toBe(80);
|
|
97
|
+
(0, import_vitest.expect)(kept.stdout.isTTY).toBe(true);
|
|
98
|
+
kept.dispose();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize-reflow.test.d.ts","sourceRoot":"","sources":["../../src/utils/resize-reflow.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { keepScrollbackOnResize, reflowedRows, shrinkRepair } from "./resize-reflow.js";
|
|
4
|
+
const ESC = "\x1B[";
|
|
5
|
+
describe("reflowedRows", () => {
|
|
6
|
+
it("counts the rows a frame takes once the terminal rewraps it", () => {
|
|
7
|
+
expect(reflowedRows(`${"a".repeat(100)}
|
|
8
|
+
|
|
9
|
+
bb
|
|
10
|
+
`, 40)).toBe(3 + 1 + 1 + 1);
|
|
11
|
+
});
|
|
12
|
+
it("wraps a wide character that would straddle the right margin", () => {
|
|
13
|
+
expect(reflowedRows(`${"\u754C".repeat(49)}
|
|
14
|
+
`, 49)).toBe(3 + 1);
|
|
15
|
+
});
|
|
16
|
+
it("ignores colour codes when measuring", () => {
|
|
17
|
+
expect(reflowedRows(`${ESC}31m${"a".repeat(40)}${ESC}39m
|
|
18
|
+
`, 40)).toBe(1 + 1);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe("shrinkRepair", () => {
|
|
22
|
+
it("does nothing when no line wraps", () => {
|
|
23
|
+
expect(shrinkRepair("short\nlines\n", 40)).toBe("");
|
|
24
|
+
});
|
|
25
|
+
it("erases the rewrapped frame and leaves the cursor where the next erase expects it", () => {
|
|
26
|
+
const repair = shrinkRepair(`${"a".repeat(60)}
|
|
27
|
+
b
|
|
28
|
+
`, 40);
|
|
29
|
+
expect(repair).toBe(`${ESC}2K${ESC}1A`.repeat(3) + `${ESC}2K${ESC}G${ESC}2B`);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
class FakeStdout extends EventEmitter {
|
|
33
|
+
columns = 80;
|
|
34
|
+
rows = 24;
|
|
35
|
+
isTTY = true;
|
|
36
|
+
written = [];
|
|
37
|
+
write(chunk) {
|
|
38
|
+
this.written.push(chunk);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
describe("keepScrollbackOnResize", () => {
|
|
43
|
+
it("remembers the last frame Ink wrote and repairs it before Ink redraws", () => {
|
|
44
|
+
const real = new FakeStdout();
|
|
45
|
+
const order = [];
|
|
46
|
+
const kept = keepScrollbackOnResize(real);
|
|
47
|
+
const stdout = kept.stdout;
|
|
48
|
+
stdout.on("resize", () => order.push("ink"));
|
|
49
|
+
stdout.write(`${ESC}2K${ESC}G${"x".repeat(70)}
|
|
50
|
+
ok
|
|
51
|
+
`);
|
|
52
|
+
real.written = [];
|
|
53
|
+
real.columns = 40;
|
|
54
|
+
real.emit("resize");
|
|
55
|
+
expect(real.written).toHaveLength(1);
|
|
56
|
+
expect(real.written[0]).toContain(`${ESC}2K`);
|
|
57
|
+
expect(order).toEqual(["ink"]);
|
|
58
|
+
kept.dispose();
|
|
59
|
+
});
|
|
60
|
+
it("repairs a frame only once when two shrinks arrive before Ink redraws", () => {
|
|
61
|
+
const real = new FakeStdout();
|
|
62
|
+
const kept = keepScrollbackOnResize(real);
|
|
63
|
+
kept.stdout.write(`${"x".repeat(70)}
|
|
64
|
+
ok
|
|
65
|
+
`);
|
|
66
|
+
real.written = [];
|
|
67
|
+
real.columns = 60;
|
|
68
|
+
real.emit("resize");
|
|
69
|
+
real.columns = 40;
|
|
70
|
+
real.emit("resize");
|
|
71
|
+
expect(real.written).toHaveLength(1);
|
|
72
|
+
kept.stdout.write(`${"y".repeat(70)}
|
|
73
|
+
ok
|
|
74
|
+
`);
|
|
75
|
+
real.written = [];
|
|
76
|
+
real.columns = 30;
|
|
77
|
+
real.emit("resize");
|
|
78
|
+
expect(real.written).toHaveLength(1);
|
|
79
|
+
kept.dispose();
|
|
80
|
+
});
|
|
81
|
+
it("leaves a growing terminal alone", () => {
|
|
82
|
+
const real = new FakeStdout();
|
|
83
|
+
const kept = keepScrollbackOnResize(real);
|
|
84
|
+
kept.stdout.write(`${"x".repeat(70)}
|
|
85
|
+
`);
|
|
86
|
+
real.written = [];
|
|
87
|
+
real.columns = 120;
|
|
88
|
+
real.emit("resize");
|
|
89
|
+
expect(real.written).toEqual([]);
|
|
90
|
+
kept.dispose();
|
|
91
|
+
});
|
|
92
|
+
it("passes everything else through to the real stream", () => {
|
|
93
|
+
const real = new FakeStdout();
|
|
94
|
+
const kept = keepScrollbackOnResize(real);
|
|
95
|
+
expect(kept.stdout.columns).toBe(80);
|
|
96
|
+
expect(kept.stdout.isTTY).toBe(true);
|
|
97
|
+
kept.dispose();
|
|
98
|
+
});
|
|
99
|
+
});
|