@dexto/tui 1.14.6 → 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 +41 -86
- package/dist/components/Footer.d.ts +2 -2
- package/dist/components/Footer.d.ts.map +1 -1
- package/dist/components/Footer.js +44 -92
- package/dist/components/Footer.test.cjs +44 -0
- package/dist/components/Footer.test.js +44 -0
- 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 +25 -9
- package/dist/components/overlays/InsufficientCreditsOverlay.d.ts +2 -0
- package/dist/components/overlays/InsufficientCreditsOverlay.d.ts.map +1 -1
- package/dist/components/overlays/InsufficientCreditsOverlay.js +25 -9
- 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 +31 -66
- package/dist/components/overlays/LoginOverlay.d.ts +1 -3
- package/dist/components/overlays/LoginOverlay.d.ts.map +1 -1
- package/dist/components/overlays/LoginOverlay.js +32 -71
- package/dist/components/overlays/LogoutOverlay.cjs +16 -24
- package/dist/components/overlays/LogoutOverlay.d.ts +1 -0
- package/dist/components/overlays/LogoutOverlay.d.ts.map +1 -1
- package/dist/components/overlays/LogoutOverlay.js +18 -38
- 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/provider-config.cjs +4 -4
- package/dist/components/overlays/custom-model-wizard/provider-config.js +4 -4
- 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 +32 -44
- package/dist/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/containers/OverlayContainer.js +32 -44
- 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/host/index.cjs +22 -49
- package/dist/host/index.d.ts +18 -72
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +18 -42
- package/dist/host/index.test.cjs +21 -35
- package/dist/host/index.test.js +22 -40
- package/dist/index.d.cts +13 -52
- 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 +33 -21
- package/dist/services/processStream.d.ts.map +1 -1
- package/dist/services/processStream.js +34 -22
- package/dist/services/processStream.test.cjs +52 -4
- package/dist/services/processStream.test.js +52 -4
- 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/llm-provider-display.cjs +1 -1
- package/dist/utils/llm-provider-display.js +1 -1
- 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 +9 -5
- 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
|
@@ -0,0 +1,156 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
var import_node_stream = require("node:stream");
|
|
26
|
+
var import_ink = require("ink");
|
|
27
|
+
var import_strip_ansi = __toESM(require("strip-ansi"), 1);
|
|
28
|
+
var import_vitest = require("vitest");
|
|
29
|
+
var import_caps = require("./caps.js");
|
|
30
|
+
var import_components = require("./components.js");
|
|
31
|
+
var import_wordmark = require("./wordmark.js");
|
|
32
|
+
function frame(element, columns) {
|
|
33
|
+
const stdout = Object.assign(new import_node_stream.PassThrough(), { columns, rows: 40, isTTY: false });
|
|
34
|
+
let output = "";
|
|
35
|
+
stdout.on("data", (chunk) => {
|
|
36
|
+
output += String(chunk);
|
|
37
|
+
});
|
|
38
|
+
const view = (0, import_ink.render)(element, {
|
|
39
|
+
stdout,
|
|
40
|
+
debug: true,
|
|
41
|
+
patchConsole: false,
|
|
42
|
+
exitOnCtrlC: false
|
|
43
|
+
});
|
|
44
|
+
view.unmount();
|
|
45
|
+
stdout.destroy();
|
|
46
|
+
return (0, import_strip_ansi.default)(output);
|
|
47
|
+
}
|
|
48
|
+
const step = {
|
|
49
|
+
state: "wait",
|
|
50
|
+
verb: "RUN",
|
|
51
|
+
target: "pnpm db:migrate --env staging",
|
|
52
|
+
detail: "+12 \u22123",
|
|
53
|
+
time: "0.4s",
|
|
54
|
+
cloud: false
|
|
55
|
+
};
|
|
56
|
+
(0, import_vitest.describe)("Signal kit parts", () => {
|
|
57
|
+
let saved;
|
|
58
|
+
(0, import_vitest.beforeEach)(() => {
|
|
59
|
+
saved = (0, import_caps.getCaps)();
|
|
60
|
+
(0, import_caps.setCaps)({ ...saved, color: "none", glyphs: "unicode", logo: "quadrant" });
|
|
61
|
+
});
|
|
62
|
+
(0, import_vitest.afterEach)(() => (0, import_caps.setCaps)(saved));
|
|
63
|
+
(0, import_vitest.it)("Wordmark draws the logo art that fits the rows", () => {
|
|
64
|
+
const out = frame((0, import_react.createElement)(import_components.Wordmark, { rows: 3 }), 80);
|
|
65
|
+
for (const line of (0, import_wordmark.pickWordmark)("quadrant", 3).text) (0, import_vitest.expect)(out).toContain(line.trimEnd());
|
|
66
|
+
});
|
|
67
|
+
(0, import_vitest.it)("Wordmark draws the ASCII art on terminals without UTF-8", () => {
|
|
68
|
+
(0, import_caps.setCaps)({ ...(0, import_caps.getCaps)(), glyphs: "ascii" });
|
|
69
|
+
const out = frame((0, import_react.createElement)(import_components.Wordmark, { rows: 4 }), 80);
|
|
70
|
+
for (const line of (0, import_wordmark.pickWordmark)("ascii", 4).text) (0, import_vitest.expect)(out).toContain(line.trimEnd());
|
|
71
|
+
});
|
|
72
|
+
(0, import_vitest.it)("CutText draws three rows of half blocks, or the plain word in ASCII", () => {
|
|
73
|
+
(0, import_vitest.expect)(frame((0, import_react.createElement)(import_components.CutText, { text: "de" }), 80)).toContain("\u2580\u2580\u2580\u2580\u2584 \u2580\u2580\u2580\u2580\u2580");
|
|
74
|
+
(0, import_caps.setCaps)({ ...(0, import_caps.getCaps)(), glyphs: "ascii" });
|
|
75
|
+
(0, import_vitest.expect)(frame((0, import_react.createElement)(import_components.CutText, { text: "usage" }), 80)).toContain("USAGE");
|
|
76
|
+
});
|
|
77
|
+
(0, import_vitest.it)("StepRow lays out verb, target, detail, time and the state word", () => {
|
|
78
|
+
const out = frame((0, import_react.createElement)(import_components.StepRow, { step }), 100);
|
|
79
|
+
(0, import_vitest.expect)(out).toMatch(/▸ RUN\s+pnpm db:migrate --env staging\s+\+12 −3 0\.4s\s+NEEDS YOU/);
|
|
80
|
+
});
|
|
81
|
+
(0, import_vitest.it)("StepRow draws ASCII glyphs on terminals without UTF-8", () => {
|
|
82
|
+
(0, import_caps.setCaps)({ ...(0, import_caps.getCaps)(), glyphs: "ascii" });
|
|
83
|
+
const out = frame((0, import_react.createElement)(import_components.StepRow, { step: { ...step, state: "ok" } }), 100);
|
|
84
|
+
(0, import_vitest.expect)(out).toMatch(/^\* RUN\s+pnpm db:migrate --env staging\s+\+12 -3 0\.4s/m);
|
|
85
|
+
(0, import_vitest.expect)(out).not.toMatch(/[▪▸▫◆−]/);
|
|
86
|
+
});
|
|
87
|
+
(0, import_vitest.it)("re-renders mounted parts when caps change", async () => {
|
|
88
|
+
const stdout = Object.assign(new import_node_stream.PassThrough(), { columns: 100, rows: 40, isTTY: false });
|
|
89
|
+
let output = "";
|
|
90
|
+
stdout.on("data", (chunk) => {
|
|
91
|
+
output += String(chunk);
|
|
92
|
+
});
|
|
93
|
+
const view = (0, import_ink.render)((0, import_react.createElement)(import_components.StepRow, { step }), {
|
|
94
|
+
stdout,
|
|
95
|
+
debug: true,
|
|
96
|
+
patchConsole: false,
|
|
97
|
+
exitOnCtrlC: false
|
|
98
|
+
});
|
|
99
|
+
try {
|
|
100
|
+
(0, import_vitest.expect)((0, import_strip_ansi.default)(output)).toContain("\u25B8 RUN");
|
|
101
|
+
(0, import_caps.setCaps)({ ...(0, import_caps.getCaps)(), glyphs: "ascii" });
|
|
102
|
+
await import_vitest.vi.waitFor(() => (0, import_vitest.expect)((0, import_strip_ansi.default)(output)).toContain("> RUN"));
|
|
103
|
+
} finally {
|
|
104
|
+
view.unmount();
|
|
105
|
+
stdout.destroy();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
(0, import_vitest.it)("ActorRow puts the actor in the margin, or a glyph when narrow", () => {
|
|
109
|
+
const child = (0, import_react.createElement)(import_ink.Text, null, "hello");
|
|
110
|
+
(0, import_vitest.expect)(frame((0, import_react.createElement)(import_components.ActorRow, { actor: "agent", children: child }), 80)).toMatch(
|
|
111
|
+
/ AGENT\s+hello/
|
|
112
|
+
);
|
|
113
|
+
(0, import_vitest.expect)(frame((0, import_react.createElement)(import_components.ActorRow, { actor: "you", children: child }), 40)).toMatch(
|
|
114
|
+
/› hello/
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
(0, import_vitest.it)("GateFrame shows its title, body and hint", () => {
|
|
118
|
+
const out = frame(
|
|
119
|
+
(0, import_react.createElement)(import_components.GateFrame, {
|
|
120
|
+
title: "NEEDS YOU \xB7 RUN A COMMAND",
|
|
121
|
+
hint: "y once \xB7 n deny",
|
|
122
|
+
children: (0, import_react.createElement)(import_ink.Text, null, "$ pnpm db:migrate")
|
|
123
|
+
}),
|
|
124
|
+
80
|
|
125
|
+
);
|
|
126
|
+
(0, import_vitest.expect)(out).toContain("NEEDS YOU \xB7 RUN A COMMAND");
|
|
127
|
+
(0, import_vitest.expect)(out).toContain("$ pnpm db:migrate");
|
|
128
|
+
(0, import_vitest.expect)(out).toContain("y once \xB7 n deny");
|
|
129
|
+
});
|
|
130
|
+
(0, import_vitest.it)("Deck shows the mode, the gate, then the input", () => {
|
|
131
|
+
const out = frame(
|
|
132
|
+
(0, import_react.createElement)(import_components.Deck, {
|
|
133
|
+
collapsed: false,
|
|
134
|
+
paused: false,
|
|
135
|
+
state: {
|
|
136
|
+
mode: "wait",
|
|
137
|
+
readout: "paused 0:14",
|
|
138
|
+
status: {
|
|
139
|
+
model: "dexto/sonnet-5.5",
|
|
140
|
+
contextUsedTokens: 46e3,
|
|
141
|
+
contextMaxTokens: 2e5,
|
|
142
|
+
where: { kind: "local" },
|
|
143
|
+
branch: "main",
|
|
144
|
+
dirtyFiles: 3,
|
|
145
|
+
credits: { kind: "balance", balance: 1284, spend: null }
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
gate: (0, import_react.createElement)(import_ink.Text, null, "GATE"),
|
|
149
|
+
children: (0, import_react.createElement)(import_ink.Text, null, "\u203A input")
|
|
150
|
+
}),
|
|
151
|
+
100
|
|
152
|
+
);
|
|
153
|
+
(0, import_vitest.expect)(out).toContain("NEEDS YOU \xB7 paused 0:14");
|
|
154
|
+
(0, import_vitest.expect)(out.indexOf("GATE")).toBeLessThan(out.indexOf("\u203A input"));
|
|
155
|
+
});
|
|
156
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.test.d.ts","sourceRoot":"","sources":["../../src/signal/components.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { PassThrough } from "node:stream";
|
|
3
|
+
import { render, Text } from "ink";
|
|
4
|
+
import stripAnsi from "strip-ansi";
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { getCaps, setCaps } from "./caps.js";
|
|
7
|
+
import { ActorRow, CutText, Deck, GateFrame, StepRow, Wordmark } from "./components.js";
|
|
8
|
+
import { pickWordmark } from "./wordmark.js";
|
|
9
|
+
function frame(element, columns) {
|
|
10
|
+
const stdout = Object.assign(new PassThrough(), { columns, rows: 40, isTTY: false });
|
|
11
|
+
let output = "";
|
|
12
|
+
stdout.on("data", (chunk) => {
|
|
13
|
+
output += String(chunk);
|
|
14
|
+
});
|
|
15
|
+
const view = render(element, {
|
|
16
|
+
stdout,
|
|
17
|
+
debug: true,
|
|
18
|
+
patchConsole: false,
|
|
19
|
+
exitOnCtrlC: false
|
|
20
|
+
});
|
|
21
|
+
view.unmount();
|
|
22
|
+
stdout.destroy();
|
|
23
|
+
return stripAnsi(output);
|
|
24
|
+
}
|
|
25
|
+
const step = {
|
|
26
|
+
state: "wait",
|
|
27
|
+
verb: "RUN",
|
|
28
|
+
target: "pnpm db:migrate --env staging",
|
|
29
|
+
detail: "+12 \u22123",
|
|
30
|
+
time: "0.4s",
|
|
31
|
+
cloud: false
|
|
32
|
+
};
|
|
33
|
+
describe("Signal kit parts", () => {
|
|
34
|
+
let saved;
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
saved = getCaps();
|
|
37
|
+
setCaps({ ...saved, color: "none", glyphs: "unicode", logo: "quadrant" });
|
|
38
|
+
});
|
|
39
|
+
afterEach(() => setCaps(saved));
|
|
40
|
+
it("Wordmark draws the logo art that fits the rows", () => {
|
|
41
|
+
const out = frame(createElement(Wordmark, { rows: 3 }), 80);
|
|
42
|
+
for (const line of pickWordmark("quadrant", 3).text) expect(out).toContain(line.trimEnd());
|
|
43
|
+
});
|
|
44
|
+
it("Wordmark draws the ASCII art on terminals without UTF-8", () => {
|
|
45
|
+
setCaps({ ...getCaps(), glyphs: "ascii" });
|
|
46
|
+
const out = frame(createElement(Wordmark, { rows: 4 }), 80);
|
|
47
|
+
for (const line of pickWordmark("ascii", 4).text) expect(out).toContain(line.trimEnd());
|
|
48
|
+
});
|
|
49
|
+
it("CutText draws three rows of half blocks, or the plain word in ASCII", () => {
|
|
50
|
+
expect(frame(createElement(CutText, { text: "de" }), 80)).toContain("\u2580\u2580\u2580\u2580\u2584 \u2580\u2580\u2580\u2580\u2580");
|
|
51
|
+
setCaps({ ...getCaps(), glyphs: "ascii" });
|
|
52
|
+
expect(frame(createElement(CutText, { text: "usage" }), 80)).toContain("USAGE");
|
|
53
|
+
});
|
|
54
|
+
it("StepRow lays out verb, target, detail, time and the state word", () => {
|
|
55
|
+
const out = frame(createElement(StepRow, { step }), 100);
|
|
56
|
+
expect(out).toMatch(/▸ RUN\s+pnpm db:migrate --env staging\s+\+12 −3 0\.4s\s+NEEDS YOU/);
|
|
57
|
+
});
|
|
58
|
+
it("StepRow draws ASCII glyphs on terminals without UTF-8", () => {
|
|
59
|
+
setCaps({ ...getCaps(), glyphs: "ascii" });
|
|
60
|
+
const out = frame(createElement(StepRow, { step: { ...step, state: "ok" } }), 100);
|
|
61
|
+
expect(out).toMatch(/^\* RUN\s+pnpm db:migrate --env staging\s+\+12 -3 0\.4s/m);
|
|
62
|
+
expect(out).not.toMatch(/[▪▸▫◆−]/);
|
|
63
|
+
});
|
|
64
|
+
it("re-renders mounted parts when caps change", async () => {
|
|
65
|
+
const stdout = Object.assign(new PassThrough(), { columns: 100, rows: 40, isTTY: false });
|
|
66
|
+
let output = "";
|
|
67
|
+
stdout.on("data", (chunk) => {
|
|
68
|
+
output += String(chunk);
|
|
69
|
+
});
|
|
70
|
+
const view = render(createElement(StepRow, { step }), {
|
|
71
|
+
stdout,
|
|
72
|
+
debug: true,
|
|
73
|
+
patchConsole: false,
|
|
74
|
+
exitOnCtrlC: false
|
|
75
|
+
});
|
|
76
|
+
try {
|
|
77
|
+
expect(stripAnsi(output)).toContain("\u25B8 RUN");
|
|
78
|
+
setCaps({ ...getCaps(), glyphs: "ascii" });
|
|
79
|
+
await vi.waitFor(() => expect(stripAnsi(output)).toContain("> RUN"));
|
|
80
|
+
} finally {
|
|
81
|
+
view.unmount();
|
|
82
|
+
stdout.destroy();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
it("ActorRow puts the actor in the margin, or a glyph when narrow", () => {
|
|
86
|
+
const child = createElement(Text, null, "hello");
|
|
87
|
+
expect(frame(createElement(ActorRow, { actor: "agent", children: child }), 80)).toMatch(
|
|
88
|
+
/ AGENT\s+hello/
|
|
89
|
+
);
|
|
90
|
+
expect(frame(createElement(ActorRow, { actor: "you", children: child }), 40)).toMatch(
|
|
91
|
+
/› hello/
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
it("GateFrame shows its title, body and hint", () => {
|
|
95
|
+
const out = frame(
|
|
96
|
+
createElement(GateFrame, {
|
|
97
|
+
title: "NEEDS YOU \xB7 RUN A COMMAND",
|
|
98
|
+
hint: "y once \xB7 n deny",
|
|
99
|
+
children: createElement(Text, null, "$ pnpm db:migrate")
|
|
100
|
+
}),
|
|
101
|
+
80
|
|
102
|
+
);
|
|
103
|
+
expect(out).toContain("NEEDS YOU \xB7 RUN A COMMAND");
|
|
104
|
+
expect(out).toContain("$ pnpm db:migrate");
|
|
105
|
+
expect(out).toContain("y once \xB7 n deny");
|
|
106
|
+
});
|
|
107
|
+
it("Deck shows the mode, the gate, then the input", () => {
|
|
108
|
+
const out = frame(
|
|
109
|
+
createElement(Deck, {
|
|
110
|
+
collapsed: false,
|
|
111
|
+
paused: false,
|
|
112
|
+
state: {
|
|
113
|
+
mode: "wait",
|
|
114
|
+
readout: "paused 0:14",
|
|
115
|
+
status: {
|
|
116
|
+
model: "dexto/sonnet-5.5",
|
|
117
|
+
contextUsedTokens: 46e3,
|
|
118
|
+
contextMaxTokens: 2e5,
|
|
119
|
+
where: { kind: "local" },
|
|
120
|
+
branch: "main",
|
|
121
|
+
dirtyFiles: 3,
|
|
122
|
+
credits: { kind: "balance", balance: 1284, spend: null }
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
gate: createElement(Text, null, "GATE"),
|
|
126
|
+
children: createElement(Text, null, "\u203A input")
|
|
127
|
+
}),
|
|
128
|
+
100
|
|
129
|
+
);
|
|
130
|
+
expect(out).toContain("NEEDS YOU \xB7 paused 0:14");
|
|
131
|
+
expect(out.indexOf("GATE")).toBeLessThan(out.indexOf("\u203A input"));
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
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 cut_exports = {};
|
|
20
|
+
__export(cut_exports, {
|
|
21
|
+
CUT_ROWS: () => CUT_ROWS,
|
|
22
|
+
cutLines: () => cutLines,
|
|
23
|
+
cutWidth: () => cutWidth
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(cut_exports);
|
|
26
|
+
const CUT = {
|
|
27
|
+
A: [".###.", "#...#", "#.###", "#...#", "#...#"],
|
|
28
|
+
B: ["####.", "#...#", "####.", "#...#", "####."],
|
|
29
|
+
C: [".####", "#....", "#....", "#....", ".####"],
|
|
30
|
+
D: ["####.", "....#", "....#", "....#", "####."],
|
|
31
|
+
E: ["#####", ".....", "####.", ".....", "#####"],
|
|
32
|
+
F: ["#####", ".....", "####.", "#....", "#...."],
|
|
33
|
+
G: [".####", "#....", "#..##", "#...#", ".####"],
|
|
34
|
+
H: ["#...#", "#...#", "##.##", "#...#", "#...#"],
|
|
35
|
+
I: ["###", "...", ".#.", ".#.", "###"],
|
|
36
|
+
J: ["....#", "....#", "....#", "#...#", ".###."],
|
|
37
|
+
K: ["#...#", "#..#.", "###..", "#..#.", "#...#"],
|
|
38
|
+
L: ["#....", "#....", "#....", ".....", "#####"],
|
|
39
|
+
M: ["#...#", "##.##", "#.#.#", "#...#", "#...#"],
|
|
40
|
+
N: ["#...#", "##..#", "#.#.#", "#..##", "#...#"],
|
|
41
|
+
O: ["##.##", "#...#", "#...#", "#...#", "##.##"],
|
|
42
|
+
P: ["####.", "....#", "####.", "#....", "#...."],
|
|
43
|
+
Q: [".###.", "#...#", "#...#", "#..#.", ".##.#"],
|
|
44
|
+
R: ["####.", "....#", "####.", "#..#.", "#...#"],
|
|
45
|
+
S: [".####", "#....", ".###.", "....#", "####."],
|
|
46
|
+
T: ["#####", ".....", "..#..", "..#..", "..#.."],
|
|
47
|
+
U: ["#...#", "#...#", "#...#", "#...#", ".###."],
|
|
48
|
+
V: ["#...#", "#...#", "#...#", ".#.#.", "..#.."],
|
|
49
|
+
W: ["#...#", "#...#", "#.#.#", "##.##", "#...#"],
|
|
50
|
+
X: ["#...#", ".#.#.", "..#..", ".#...", "#...#"],
|
|
51
|
+
Y: ["#...#", ".#.#.", "..#..", "..#..", "..#.."],
|
|
52
|
+
Z: ["#####", "...#.", "..#..", ".#...", "#####"],
|
|
53
|
+
"0": ["##.##", "#...#", "#.#.#", "#...#", "##.##"],
|
|
54
|
+
"1": [".##.", "..#.", "..#.", "..#.", ".###"],
|
|
55
|
+
"2": ["####.", "....#", ".###.", "#....", "#####"],
|
|
56
|
+
"3": ["####.", "....#", ".###.", "....#", "####."],
|
|
57
|
+
"4": ["#...#", "#...#", ".####", "....#", "....#"],
|
|
58
|
+
"5": ["#####", "#....", "####.", "....#", "####."],
|
|
59
|
+
"6": [".###.", "#....", "####.", "#...#", ".###."],
|
|
60
|
+
"7": ["#####", "....#", "...#.", "..#..", "..#.."],
|
|
61
|
+
"8": [".###.", "#...#", ".###.", "#...#", ".###."],
|
|
62
|
+
"9": [".###.", "#...#", ".####", "....#", ".###."],
|
|
63
|
+
" ": ["..", "..", "..", "..", ".."],
|
|
64
|
+
",": ["..", "..", "..", ".#", "#."],
|
|
65
|
+
".": [".", ".", ".", ".", "#"],
|
|
66
|
+
":": [".", "#", ".", "#", "."],
|
|
67
|
+
"-": ["...", "...", "###", "...", "..."],
|
|
68
|
+
"/": ["....#", "...#.", "..#..", ".#...", "#...."],
|
|
69
|
+
"%": ["#..#", "..#.", ".#..", "#..#", "...."],
|
|
70
|
+
$: [".####", "#.#..", ".###.", "..#.#", "####."]
|
|
71
|
+
};
|
|
72
|
+
const CUT_ROWS = 3;
|
|
73
|
+
function glyphFor(ch) {
|
|
74
|
+
return CUT[ch] ?? CUT[" "] ?? [];
|
|
75
|
+
}
|
|
76
|
+
function cutWidth(text) {
|
|
77
|
+
const chars = [...text.toUpperCase()];
|
|
78
|
+
if (chars.length === 0) return 0;
|
|
79
|
+
return chars.reduce((w, ch) => w + (glyphFor(ch)[0]?.length ?? 0) + 1, -1);
|
|
80
|
+
}
|
|
81
|
+
function cutLines(text) {
|
|
82
|
+
const lines = ["", "", ""];
|
|
83
|
+
[...text.toUpperCase()].forEach((ch, i) => {
|
|
84
|
+
const g = glyphFor(ch);
|
|
85
|
+
const gw = g[0]?.length ?? 0;
|
|
86
|
+
for (let r = 0; r < CUT_ROWS; r++) {
|
|
87
|
+
let row = i === 0 ? "" : " ";
|
|
88
|
+
for (let c = 0; c < gw; c++) {
|
|
89
|
+
const top = g[r * 2]?.[c] === "#";
|
|
90
|
+
const bottom = g[r * 2 + 1]?.[c] === "#";
|
|
91
|
+
row += top && bottom ? "\u2588" : top ? "\u2580" : bottom ? "\u2584" : " ";
|
|
92
|
+
}
|
|
93
|
+
lines[r] += row;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return lines;
|
|
97
|
+
}
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
CUT_ROWS,
|
|
101
|
+
cutLines,
|
|
102
|
+
cutWidth
|
|
103
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cut type: the display face. 5-pixel glyphs drawn with half blocks over 3 rows. The letters
|
|
3
|
+
* follow the wordmark and never join: open-left D, stemless E, floating T stem, split O.
|
|
4
|
+
*/
|
|
5
|
+
/** Rows of cut type, always 3 tall. */
|
|
6
|
+
export declare const CUT_ROWS = 3;
|
|
7
|
+
/** Cell width of `text` in cut type: glyphs plus one blank column between them. */
|
|
8
|
+
export declare function cutWidth(text: string): number;
|
|
9
|
+
/** The 3 text lines that draw `text` in cut type (half blocks, trailing spaces kept). */
|
|
10
|
+
export declare function cutLines(text: string): string[];
|
|
11
|
+
//# sourceMappingURL=cut.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cut.d.ts","sourceRoot":"","sources":["../../src/signal/cut.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiDH,uCAAuC;AACvC,eAAO,MAAM,QAAQ,IAAI,CAAC;AAM1B,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI7C;AAED,yFAAyF;AACzF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAgB/C"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const CUT = {
|
|
2
|
+
A: [".###.", "#...#", "#.###", "#...#", "#...#"],
|
|
3
|
+
B: ["####.", "#...#", "####.", "#...#", "####."],
|
|
4
|
+
C: [".####", "#....", "#....", "#....", ".####"],
|
|
5
|
+
D: ["####.", "....#", "....#", "....#", "####."],
|
|
6
|
+
E: ["#####", ".....", "####.", ".....", "#####"],
|
|
7
|
+
F: ["#####", ".....", "####.", "#....", "#...."],
|
|
8
|
+
G: [".####", "#....", "#..##", "#...#", ".####"],
|
|
9
|
+
H: ["#...#", "#...#", "##.##", "#...#", "#...#"],
|
|
10
|
+
I: ["###", "...", ".#.", ".#.", "###"],
|
|
11
|
+
J: ["....#", "....#", "....#", "#...#", ".###."],
|
|
12
|
+
K: ["#...#", "#..#.", "###..", "#..#.", "#...#"],
|
|
13
|
+
L: ["#....", "#....", "#....", ".....", "#####"],
|
|
14
|
+
M: ["#...#", "##.##", "#.#.#", "#...#", "#...#"],
|
|
15
|
+
N: ["#...#", "##..#", "#.#.#", "#..##", "#...#"],
|
|
16
|
+
O: ["##.##", "#...#", "#...#", "#...#", "##.##"],
|
|
17
|
+
P: ["####.", "....#", "####.", "#....", "#...."],
|
|
18
|
+
Q: [".###.", "#...#", "#...#", "#..#.", ".##.#"],
|
|
19
|
+
R: ["####.", "....#", "####.", "#..#.", "#...#"],
|
|
20
|
+
S: [".####", "#....", ".###.", "....#", "####."],
|
|
21
|
+
T: ["#####", ".....", "..#..", "..#..", "..#.."],
|
|
22
|
+
U: ["#...#", "#...#", "#...#", "#...#", ".###."],
|
|
23
|
+
V: ["#...#", "#...#", "#...#", ".#.#.", "..#.."],
|
|
24
|
+
W: ["#...#", "#...#", "#.#.#", "##.##", "#...#"],
|
|
25
|
+
X: ["#...#", ".#.#.", "..#..", ".#...", "#...#"],
|
|
26
|
+
Y: ["#...#", ".#.#.", "..#..", "..#..", "..#.."],
|
|
27
|
+
Z: ["#####", "...#.", "..#..", ".#...", "#####"],
|
|
28
|
+
"0": ["##.##", "#...#", "#.#.#", "#...#", "##.##"],
|
|
29
|
+
"1": [".##.", "..#.", "..#.", "..#.", ".###"],
|
|
30
|
+
"2": ["####.", "....#", ".###.", "#....", "#####"],
|
|
31
|
+
"3": ["####.", "....#", ".###.", "....#", "####."],
|
|
32
|
+
"4": ["#...#", "#...#", ".####", "....#", "....#"],
|
|
33
|
+
"5": ["#####", "#....", "####.", "....#", "####."],
|
|
34
|
+
"6": [".###.", "#....", "####.", "#...#", ".###."],
|
|
35
|
+
"7": ["#####", "....#", "...#.", "..#..", "..#.."],
|
|
36
|
+
"8": [".###.", "#...#", ".###.", "#...#", ".###."],
|
|
37
|
+
"9": [".###.", "#...#", ".####", "....#", ".###."],
|
|
38
|
+
" ": ["..", "..", "..", "..", ".."],
|
|
39
|
+
",": ["..", "..", "..", ".#", "#."],
|
|
40
|
+
".": [".", ".", ".", ".", "#"],
|
|
41
|
+
":": [".", "#", ".", "#", "."],
|
|
42
|
+
"-": ["...", "...", "###", "...", "..."],
|
|
43
|
+
"/": ["....#", "...#.", "..#..", ".#...", "#...."],
|
|
44
|
+
"%": ["#..#", "..#.", ".#..", "#..#", "...."],
|
|
45
|
+
$: [".####", "#.#..", ".###.", "..#.#", "####."]
|
|
46
|
+
};
|
|
47
|
+
const CUT_ROWS = 3;
|
|
48
|
+
function glyphFor(ch) {
|
|
49
|
+
return CUT[ch] ?? CUT[" "] ?? [];
|
|
50
|
+
}
|
|
51
|
+
function cutWidth(text) {
|
|
52
|
+
const chars = [...text.toUpperCase()];
|
|
53
|
+
if (chars.length === 0) return 0;
|
|
54
|
+
return chars.reduce((w, ch) => w + (glyphFor(ch)[0]?.length ?? 0) + 1, -1);
|
|
55
|
+
}
|
|
56
|
+
function cutLines(text) {
|
|
57
|
+
const lines = ["", "", ""];
|
|
58
|
+
[...text.toUpperCase()].forEach((ch, i) => {
|
|
59
|
+
const g = glyphFor(ch);
|
|
60
|
+
const gw = g[0]?.length ?? 0;
|
|
61
|
+
for (let r = 0; r < CUT_ROWS; r++) {
|
|
62
|
+
let row = i === 0 ? "" : " ";
|
|
63
|
+
for (let c = 0; c < gw; c++) {
|
|
64
|
+
const top = g[r * 2]?.[c] === "#";
|
|
65
|
+
const bottom = g[r * 2 + 1]?.[c] === "#";
|
|
66
|
+
row += top && bottom ? "\u2588" : top ? "\u2580" : bottom ? "\u2584" : " ";
|
|
67
|
+
}
|
|
68
|
+
lines[r] += row;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return lines;
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
CUT_ROWS,
|
|
75
|
+
cutLines,
|
|
76
|
+
cutWidth
|
|
77
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_vitest = require("vitest");
|
|
3
|
+
var import_cut = require("./cut.js");
|
|
4
|
+
(0, import_vitest.describe)("cut type", () => {
|
|
5
|
+
(0, import_vitest.it)("draws three rows as wide as cutWidth says", () => {
|
|
6
|
+
const lines = (0, import_cut.cutLines)("Usage 42%");
|
|
7
|
+
(0, import_vitest.expect)(lines).toHaveLength(3);
|
|
8
|
+
for (const line of lines) (0, import_vitest.expect)([...line]).toHaveLength((0, import_cut.cutWidth)("Usage 42%"));
|
|
9
|
+
});
|
|
10
|
+
(0, import_vitest.it)("keeps the wordmark cuts: open-left D, stemless E", () => {
|
|
11
|
+
(0, import_vitest.expect)((0, import_cut.cutLines)("DE")).toEqual(["\u2580\u2580\u2580\u2580\u2584 \u2580\u2580\u2580\u2580\u2580", " \u2588 \u2580\u2580\u2580\u2580 ", "\u2580\u2580\u2580\u2580 \u2580\u2580\u2580\u2580\u2580"]);
|
|
12
|
+
});
|
|
13
|
+
(0, import_vitest.it)("draws unknown characters as a space", () => {
|
|
14
|
+
(0, import_vitest.expect)((0, import_cut.cutWidth)("~")).toBe((0, import_cut.cutWidth)(" "));
|
|
15
|
+
});
|
|
16
|
+
(0, import_vitest.it)("is empty for empty text", () => {
|
|
17
|
+
(0, import_vitest.expect)((0, import_cut.cutWidth)("")).toBe(0);
|
|
18
|
+
(0, import_vitest.expect)((0, import_cut.cutLines)("")).toEqual(["", "", ""]);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cut.test.d.ts","sourceRoot":"","sources":["../../src/signal/cut.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { cutLines, cutWidth } from "./cut.js";
|
|
3
|
+
describe("cut type", () => {
|
|
4
|
+
it("draws three rows as wide as cutWidth says", () => {
|
|
5
|
+
const lines = cutLines("Usage 42%");
|
|
6
|
+
expect(lines).toHaveLength(3);
|
|
7
|
+
for (const line of lines) expect([...line]).toHaveLength(cutWidth("Usage 42%"));
|
|
8
|
+
});
|
|
9
|
+
it("keeps the wordmark cuts: open-left D, stemless E", () => {
|
|
10
|
+
expect(cutLines("DE")).toEqual(["\u2580\u2580\u2580\u2580\u2584 \u2580\u2580\u2580\u2580\u2580", " \u2588 \u2580\u2580\u2580\u2580 ", "\u2580\u2580\u2580\u2580 \u2580\u2580\u2580\u2580\u2580"]);
|
|
11
|
+
});
|
|
12
|
+
it("draws unknown characters as a space", () => {
|
|
13
|
+
expect(cutWidth("~")).toBe(cutWidth(" "));
|
|
14
|
+
});
|
|
15
|
+
it("is empty for empty text", () => {
|
|
16
|
+
expect(cutWidth("")).toBe(0);
|
|
17
|
+
expect(cutLines("")).toEqual(["", "", ""]);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
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 deck_layout_exports = {};
|
|
20
|
+
__export(deck_layout_exports, {
|
|
21
|
+
MID_READOUT_COLUMNS: () => MID_READOUT_COLUMNS,
|
|
22
|
+
WIDE_COLUMNS: () => WIDE_COLUMNS,
|
|
23
|
+
deckLayout: () => deckLayout,
|
|
24
|
+
formatTokens: () => formatTokens
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(deck_layout_exports);
|
|
27
|
+
const WIDE_COLUMNS = 100;
|
|
28
|
+
const MID_READOUT_COLUMNS = 24;
|
|
29
|
+
function deckLayout(columns, wordmarkColumns) {
|
|
30
|
+
if (columns >= WIDE_COLUMNS) {
|
|
31
|
+
return {
|
|
32
|
+
band: "wide",
|
|
33
|
+
bandRows: 3,
|
|
34
|
+
statusRow: false,
|
|
35
|
+
blockWidth: Math.min(36, Math.max(30, Math.floor(columns * 0.26)))
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (columns >= wordmarkColumns + MID_READOUT_COLUMNS) {
|
|
39
|
+
return { band: "mid", bandRows: 3, statusRow: true, blockWidth: 0 };
|
|
40
|
+
}
|
|
41
|
+
return { band: "bare", bandRows: 2, statusRow: true, blockWidth: 0 };
|
|
42
|
+
}
|
|
43
|
+
function formatTokens(tokens) {
|
|
44
|
+
if (tokens >= 1e6) return `${trimZero((tokens / 1e6).toFixed(1))}M`;
|
|
45
|
+
if (tokens >= 1e3) return `${Math.round(tokens / 1e3)}k`;
|
|
46
|
+
return String(tokens);
|
|
47
|
+
}
|
|
48
|
+
function trimZero(value) {
|
|
49
|
+
return value.endsWith(".0") ? value.slice(0, -2) : value;
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
MID_READOUT_COLUMNS,
|
|
54
|
+
WIDE_COLUMNS,
|
|
55
|
+
deckLayout,
|
|
56
|
+
formatTokens
|
|
57
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the deck steps down with width. Under 3 rows the wordmark stops being legible, so the
|
|
3
|
+
* narrowest step drops it and keeps the trace.
|
|
4
|
+
*
|
|
5
|
+
* ≥100 cols wide band with the status block on its right, then input = 4 rows
|
|
6
|
+
* mid band (wordmark, trace, mode · readout), input, status row = 5 rows
|
|
7
|
+
* bare trace only, input, status row led by the readout = 4 rows
|
|
8
|
+
*
|
|
9
|
+
* The middle step needs room for the mode and readout beside the wordmark (39 columns for the
|
|
10
|
+
* 3-row quadrant drawing, so from 66 columns); narrower than that the deck goes bare.
|
|
11
|
+
*/
|
|
12
|
+
export type DeckBand = 'wide' | 'mid' | 'bare';
|
|
13
|
+
export interface DeckLayout {
|
|
14
|
+
band: DeckBand;
|
|
15
|
+
/** Rows the band takes above the gate and input. */
|
|
16
|
+
bandRows: 2 | 3;
|
|
17
|
+
/** Whether the status sits in its own row under the input. */
|
|
18
|
+
statusRow: boolean;
|
|
19
|
+
/** Width of the status block beside the trace; 0 when there is none. */
|
|
20
|
+
blockWidth: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const WIDE_COLUMNS = 100;
|
|
23
|
+
/** Columns the mode and readout need beside the wordmark in the middle step. */
|
|
24
|
+
export declare const MID_READOUT_COLUMNS = 24;
|
|
25
|
+
/** `wordmarkColumns`: the 3-row wordmark's width plus its margins. */
|
|
26
|
+
export declare function deckLayout(columns: number, wordmarkColumns: number): DeckLayout;
|
|
27
|
+
/** 46k, 1.2M, 850. */
|
|
28
|
+
export declare function formatTokens(tokens: number): string;
|
|
29
|
+
//# sourceMappingURL=deck-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deck-layout.d.ts","sourceRoot":"","sources":["../../src/signal/deck-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,oDAAoD;IACpD,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,8DAA8D;IAC9D,SAAS,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,UAAU,CAa/E;AAED,sBAAsB;AACtB,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAInD"}
|