@deepseek-harness-tui/dsh-tui 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +235 -0
- package/bin/dsh-tui.js +95 -0
- package/cordis.patch.yml +218 -0
- package/cordis.yml +185 -0
- package/lib/invariant.js +28 -0
- package/lib/types/activityPrefs.d.ts +29 -0
- package/lib/types/activityPrefs.d.ts.map +1 -0
- package/lib/types/activityPrefs.js +60 -0
- package/lib/types/bootstrap/state.d.ts +13 -0
- package/lib/types/bootstrap/state.d.ts.map +1 -0
- package/lib/types/bootstrap/state.js +12 -0
- package/lib/types/cc/cliHighlight.d.ts +20 -0
- package/lib/types/cc/cliHighlight.d.ts.map +1 -0
- package/lib/types/cc/cliHighlight.js +53 -0
- package/lib/types/cc/figures.d.ts +59 -0
- package/lib/types/cc/figures.d.ts.map +1 -0
- package/lib/types/cc/figures.js +69 -0
- package/lib/types/cc/format.d.ts +26 -0
- package/lib/types/cc/format.d.ts.map +1 -0
- package/lib/types/cc/format.js +55 -0
- package/lib/types/cc/hash.d.ts +25 -0
- package/lib/types/cc/hash.d.ts.map +1 -0
- package/lib/types/cc/hash.js +41 -0
- package/lib/types/cc/hyperlink.d.ts +21 -0
- package/lib/types/cc/hyperlink.d.ts.map +1 -0
- package/lib/types/cc/hyperlink.js +31 -0
- package/lib/types/cc/markdown.d.ts +43 -0
- package/lib/types/cc/markdown.d.ts.map +1 -0
- package/lib/types/cc/markdown.js +345 -0
- package/lib/types/cc/spinnerVerbs.d.ts +3 -0
- package/lib/types/cc/spinnerVerbs.d.ts.map +1 -0
- package/lib/types/cc/spinnerVerbs.js +190 -0
- package/lib/types/cc/terminal.d.ts +15 -0
- package/lib/types/cc/terminal.d.ts.map +1 -0
- package/lib/types/cc/terminal.js +84 -0
- package/lib/types/channel.d.ts +672 -0
- package/lib/types/channel.d.ts.map +1 -0
- package/lib/types/channel.js +2427 -0
- package/lib/types/childStderr.d.ts +63 -0
- package/lib/types/childStderr.d.ts.map +1 -0
- package/lib/types/childStderr.js +161 -0
- package/lib/types/commands.d.ts +55 -0
- package/lib/types/commands.d.ts.map +1 -0
- package/lib/types/commands.js +101 -0
- package/lib/types/components/ActivityLine.d.ts +29 -0
- package/lib/types/components/ActivityLine.d.ts.map +1 -0
- package/lib/types/components/ActivityLine.js +47 -0
- package/lib/types/components/ActivityPicker.d.ts +13 -0
- package/lib/types/components/ActivityPicker.d.ts.map +1 -0
- package/lib/types/components/ActivityPicker.js +24 -0
- package/lib/types/components/CommandSuggestions.d.ts +14 -0
- package/lib/types/components/CommandSuggestions.d.ts.map +1 -0
- package/lib/types/components/CommandSuggestions.js +33 -0
- package/lib/types/components/FileSuggestions.d.ts +12 -0
- package/lib/types/components/FileSuggestions.d.ts.map +1 -0
- package/lib/types/components/FileSuggestions.js +26 -0
- package/lib/types/components/GoalTodoPanel.d.ts +13 -0
- package/lib/types/components/GoalTodoPanel.d.ts.map +1 -0
- package/lib/types/components/GoalTodoPanel.js +57 -0
- package/lib/types/components/HelpMenu.d.ts +12 -0
- package/lib/types/components/HelpMenu.d.ts.map +1 -0
- package/lib/types/components/HelpMenu.js +12 -0
- package/lib/types/components/HistorySearchDialog.d.ts +16 -0
- package/lib/types/components/HistorySearchDialog.d.ts.map +1 -0
- package/lib/types/components/HistorySearchDialog.js +31 -0
- package/lib/types/components/InterruptedByUser.d.ts +7 -0
- package/lib/types/components/InterruptedByUser.d.ts.map +1 -0
- package/lib/types/components/InterruptedByUser.js +9 -0
- package/lib/types/components/LoadedContextPanel.d.ts +20 -0
- package/lib/types/components/LoadedContextPanel.d.ts.map +1 -0
- package/lib/types/components/LoadedContextPanel.js +30 -0
- package/lib/types/components/LogoV2.d.ts +23 -0
- package/lib/types/components/LogoV2.d.ts.map +1 -0
- package/lib/types/components/LogoV2.js +95 -0
- package/lib/types/components/Markdown.d.ts +24 -0
- package/lib/types/components/Markdown.d.ts.map +1 -0
- package/lib/types/components/Markdown.js +106 -0
- package/lib/types/components/MarkdownTable.d.ts +17 -0
- package/lib/types/components/MarkdownTable.d.ts.map +1 -0
- package/lib/types/components/MarkdownTable.js +272 -0
- package/lib/types/components/MessageList.d.ts +41 -0
- package/lib/types/components/MessageList.d.ts.map +1 -0
- package/lib/types/components/MessageList.js +303 -0
- package/lib/types/components/ModelPicker.d.ts +14 -0
- package/lib/types/components/ModelPicker.d.ts.map +1 -0
- package/lib/types/components/ModelPicker.js +15 -0
- package/lib/types/components/PresetPicker.d.ts +17 -0
- package/lib/types/components/PresetPicker.d.ts.map +1 -0
- package/lib/types/components/PresetPicker.js +25 -0
- package/lib/types/components/PromptInput.d.ts +67 -0
- package/lib/types/components/PromptInput.d.ts.map +1 -0
- package/lib/types/components/PromptInput.js +778 -0
- package/lib/types/components/ResumePicker.d.ts +15 -0
- package/lib/types/components/ResumePicker.d.ts.map +1 -0
- package/lib/types/components/ResumePicker.js +34 -0
- package/lib/types/components/RewindPicker.d.ts +14 -0
- package/lib/types/components/RewindPicker.d.ts.map +1 -0
- package/lib/types/components/RewindPicker.js +23 -0
- package/lib/types/components/SearchBox.d.ts +20 -0
- package/lib/types/components/SearchBox.d.ts.map +1 -0
- package/lib/types/components/SearchBox.js +33 -0
- package/lib/types/components/Select.d.ts +22 -0
- package/lib/types/components/Select.d.ts.map +1 -0
- package/lib/types/components/Select.js +19 -0
- package/lib/types/components/Spinner/GlimmerMessage.d.ts +19 -0
- package/lib/types/components/Spinner/GlimmerMessage.d.ts.map +1 -0
- package/lib/types/components/Spinner/GlimmerMessage.js +78 -0
- package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts +31 -0
- package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts.map +1 -0
- package/lib/types/components/Spinner/SpinnerAnimationRow.js +162 -0
- package/lib/types/components/Spinner/SpinnerGlyph.d.ts +16 -0
- package/lib/types/components/Spinner/SpinnerGlyph.d.ts.map +1 -0
- package/lib/types/components/Spinner/SpinnerGlyph.js +36 -0
- package/lib/types/components/Spinner/spinnerMode.d.ts +6 -0
- package/lib/types/components/Spinner/spinnerMode.d.ts.map +1 -0
- package/lib/types/components/Spinner/spinnerMode.js +1 -0
- package/lib/types/components/Spinner/spinnerUtils.d.ts +41 -0
- package/lib/types/components/Spinner/spinnerUtils.d.ts.map +1 -0
- package/lib/types/components/Spinner/spinnerUtils.js +104 -0
- package/lib/types/components/Spinner/useStalledAnimation.d.ts +16 -0
- package/lib/types/components/Spinner/useStalledAnimation.d.ts.map +1 -0
- package/lib/types/components/Spinner/useStalledAnimation.js +71 -0
- package/lib/types/components/StreamingMarkdown.d.ts +12 -0
- package/lib/types/components/StreamingMarkdown.d.ts.map +1 -0
- package/lib/types/components/StreamingMarkdown.js +39 -0
- package/lib/types/components/ThemePicker.d.ts +22 -0
- package/lib/types/components/ThemePicker.d.ts.map +1 -0
- package/lib/types/components/ThemePicker.js +51 -0
- package/lib/types/components/ThinkingToggle.d.ts +17 -0
- package/lib/types/components/ThinkingToggle.d.ts.map +1 -0
- package/lib/types/components/ThinkingToggle.js +30 -0
- package/lib/types/components/ToolUseLoader.d.ts +13 -0
- package/lib/types/components/ToolUseLoader.d.ts.map +1 -0
- package/lib/types/components/ToolUseLoader.js +17 -0
- package/lib/types/components/Whale.d.ts +22 -0
- package/lib/types/components/Whale.d.ts.map +1 -0
- package/lib/types/components/Whale.js +78 -0
- package/lib/types/components/WorkingSpinner.d.ts +26 -0
- package/lib/types/components/WorkingSpinner.d.ts.map +1 -0
- package/lib/types/components/WorkingSpinner.js +68 -0
- package/lib/types/components/activityFrames.d.ts +31 -0
- package/lib/types/components/activityFrames.d.ts.map +1 -0
- package/lib/types/components/activityFrames.js +83 -0
- package/lib/types/components/bigfont.d.ts +28 -0
- package/lib/types/components/bigfont.d.ts.map +1 -0
- package/lib/types/components/bigfont.js +91 -0
- package/lib/types/components/design-system/Byline.d.ts +14 -0
- package/lib/types/components/design-system/Byline.d.ts.map +1 -0
- package/lib/types/components/design-system/Byline.js +17 -0
- package/lib/types/components/design-system/Divider.d.ts +40 -0
- package/lib/types/components/design-system/Divider.d.ts.map +1 -0
- package/lib/types/components/design-system/Divider.js +24 -0
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +19 -0
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts.map +1 -0
- package/lib/types/components/design-system/KeyboardShortcutHint.js +14 -0
- package/lib/types/components/design-system/ListItem.d.ts +36 -0
- package/lib/types/components/design-system/ListItem.d.ts.map +1 -0
- package/lib/types/components/design-system/ListItem.js +48 -0
- package/lib/types/components/design-system/LoadingState.d.ts +19 -0
- package/lib/types/components/design-system/LoadingState.d.ts.map +1 -0
- package/lib/types/components/design-system/LoadingState.js +22 -0
- package/lib/types/components/design-system/Pane.d.ts +17 -0
- package/lib/types/components/design-system/Pane.d.ts.map +1 -0
- package/lib/types/components/design-system/Pane.js +15 -0
- package/lib/types/components/design-system/ProgressBar.d.ts +22 -0
- package/lib/types/components/design-system/ProgressBar.d.ts.map +1 -0
- package/lib/types/components/design-system/ProgressBar.js +27 -0
- package/lib/types/components/design-system/StatusIcon.d.ts +15 -0
- package/lib/types/components/design-system/StatusIcon.d.ts.map +1 -0
- package/lib/types/components/design-system/StatusIcon.js +20 -0
- package/lib/types/components/design-system/ThemeProvider.d.ts +11 -0
- package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -0
- package/lib/types/components/design-system/ThemeProvider.js +135 -0
- package/lib/types/components/design-system/ThemedBox.d.ts +37 -0
- package/lib/types/components/design-system/ThemedBox.d.ts.map +1 -0
- package/lib/types/components/design-system/ThemedBox.js +26 -0
- package/lib/types/components/design-system/ThemedText.d.ts +56 -0
- package/lib/types/components/design-system/ThemedText.d.ts.map +1 -0
- package/lib/types/components/design-system/ThemedText.js +45 -0
- package/lib/types/components/messages/AssistantTextMessage.d.ts +18 -0
- package/lib/types/components/messages/AssistantTextMessage.d.ts.map +1 -0
- package/lib/types/components/messages/AssistantTextMessage.js +15 -0
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts +23 -0
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -0
- package/lib/types/components/messages/AssistantThinkingMessage.js +23 -0
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +23 -0
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -0
- package/lib/types/components/messages/AssistantToolUseMessage.js +220 -0
- package/lib/types/components/messages/MessageMetadata.d.ts +15 -0
- package/lib/types/components/messages/MessageMetadata.d.ts.map +1 -0
- package/lib/types/components/messages/MessageMetadata.js +20 -0
- package/lib/types/components/messages/UserPromptMessage.d.ts +19 -0
- package/lib/types/components/messages/UserPromptMessage.d.ts.map +1 -0
- package/lib/types/components/messages/UserPromptMessage.js +15 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +39 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -0
- package/lib/types/components/questions/AskUserQuestionPanel.js +228 -0
- package/lib/types/components/shimmer.d.ts +35 -0
- package/lib/types/components/shimmer.d.ts.map +1 -0
- package/lib/types/components/shimmer.js +43 -0
- package/lib/types/components/whaleFrames.d.ts +25 -0
- package/lib/types/components/whaleFrames.d.ts.map +1 -0
- package/lib/types/components/whaleFrames.js +419 -0
- package/lib/types/customTheme.d.ts +104 -0
- package/lib/types/customTheme.d.ts.map +1 -0
- package/lib/types/customTheme.js +268 -0
- package/lib/types/effortPrefs.d.ts +22 -0
- package/lib/types/effortPrefs.d.ts.map +1 -0
- package/lib/types/effortPrefs.js +45 -0
- package/lib/types/history.d.ts +24 -0
- package/lib/types/history.d.ts.map +1 -0
- package/lib/types/history.js +75 -0
- package/lib/types/hooks/useBlink.d.ts +11 -0
- package/lib/types/hooks/useBlink.d.ts.map +1 -0
- package/lib/types/hooks/useBlink.js +20 -0
- package/lib/types/i18n.d.ts +926 -0
- package/lib/types/i18n.d.ts.map +1 -0
- package/lib/types/i18n.js +356 -0
- package/lib/types/index.d.ts +70 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +31 -0
- package/lib/types/ink/Ansi.d.ts +11 -0
- package/lib/types/ink/Ansi.d.ts.map +1 -0
- package/lib/types/ink/Ansi.js +269 -0
- package/lib/types/ink/bidi.d.ts +18 -0
- package/lib/types/ink/bidi.d.ts.map +1 -0
- package/lib/types/ink/bidi.js +119 -0
- package/lib/types/ink/clearTerminal.d.ts +22 -0
- package/lib/types/ink/clearTerminal.d.ts.map +1 -0
- package/lib/types/ink/clearTerminal.js +72 -0
- package/lib/types/ink/colorize.d.ts +33 -0
- package/lib/types/ink/colorize.d.ts.map +1 -0
- package/lib/types/ink/colorize.js +213 -0
- package/lib/types/ink/components/AlternateScreen.d.ts +22 -0
- package/lib/types/ink/components/AlternateScreen.d.ts.map +1 -0
- package/lib/types/ink/components/AlternateScreen.js +74 -0
- package/lib/types/ink/components/App.d.ts +73 -0
- package/lib/types/ink/components/App.d.ts.map +1 -0
- package/lib/types/ink/components/App.js +597 -0
- package/lib/types/ink/components/AppContext.d.ts +15 -0
- package/lib/types/ink/components/AppContext.d.ts.map +1 -0
- package/lib/types/ink/components/AppContext.js +11 -0
- package/lib/types/ink/components/Box.d.ts +49 -0
- package/lib/types/ink/components/Box.d.ts.map +1 -0
- package/lib/types/ink/components/Box.js +153 -0
- package/lib/types/ink/components/Button.d.ts +37 -0
- package/lib/types/ink/components/Button.d.ts.map +1 -0
- package/lib/types/ink/components/Button.js +166 -0
- package/lib/types/ink/components/ClockContext.d.ts +10 -0
- package/lib/types/ink/components/ClockContext.d.ts.map +1 -0
- package/lib/types/ink/components/ClockContext.js +108 -0
- package/lib/types/ink/components/CursorDeclarationContext.d.ts +30 -0
- package/lib/types/ink/components/CursorDeclarationContext.d.ts.map +1 -0
- package/lib/types/ink/components/CursorDeclarationContext.js +6 -0
- package/lib/types/ink/components/ErrorOverview.d.ts +7 -0
- package/lib/types/ink/components/ErrorOverview.d.ts.map +1 -0
- package/lib/types/ink/components/ErrorOverview.js +49 -0
- package/lib/types/ink/components/Link.d.ts +8 -0
- package/lib/types/ink/components/Link.d.ts.map +1 -0
- package/lib/types/ink/components/Link.js +33 -0
- package/lib/types/ink/components/Newline.d.ts +13 -0
- package/lib/types/ink/components/Newline.d.ts.map +1 -0
- package/lib/types/ink/components/Newline.js +29 -0
- package/lib/types/ink/components/NoSelect.d.ts +20 -0
- package/lib/types/ink/components/NoSelect.d.ts.map +1 -0
- package/lib/types/ink/components/NoSelect.js +56 -0
- package/lib/types/ink/components/RawAnsi.d.ts +17 -0
- package/lib/types/ink/components/RawAnsi.d.ts.map +1 -0
- package/lib/types/ink/components/RawAnsi.js +45 -0
- package/lib/types/ink/components/ScrollBox.d.ts +78 -0
- package/lib/types/ink/components/ScrollBox.d.ts.map +1 -0
- package/lib/types/ink/components/ScrollBox.js +174 -0
- package/lib/types/ink/components/Spacer.d.ts +6 -0
- package/lib/types/ink/components/Spacer.d.ts.map +1 -0
- package/lib/types/ink/components/Spacer.js +19 -0
- package/lib/types/ink/components/StdinContext.d.ts +32 -0
- package/lib/types/ink/components/StdinContext.d.ts.map +1 -0
- package/lib/types/ink/components/StdinContext.js +16 -0
- package/lib/types/ink/components/TerminalFocusContext.d.ts +11 -0
- package/lib/types/ink/components/TerminalFocusContext.d.ts.map +1 -0
- package/lib/types/ink/components/TerminalFocusContext.js +45 -0
- package/lib/types/ink/components/TerminalSizeContext.d.ts +6 -0
- package/lib/types/ink/components/TerminalSizeContext.d.ts.map +1 -0
- package/lib/types/ink/components/TerminalSizeContext.js +3 -0
- package/lib/types/ink/components/Text.d.ts +56 -0
- package/lib/types/ink/components/Text.d.ts.map +1 -0
- package/lib/types/ink/components/Text.js +194 -0
- package/lib/types/ink/constants.d.ts +3 -0
- package/lib/types/ink/constants.d.ts.map +1 -0
- package/lib/types/ink/constants.js +2 -0
- package/lib/types/ink/cursor.d.ts +11 -0
- package/lib/types/ink/cursor.d.ts.map +1 -0
- package/lib/types/ink/cursor.js +1 -0
- package/lib/types/ink/devtools.d.ts +7 -0
- package/lib/types/ink/devtools.d.ts.map +1 -0
- package/lib/types/ink/devtools.js +1 -0
- package/lib/types/ink/dom.d.ts +178 -0
- package/lib/types/ink/dom.d.ts.map +1 -0
- package/lib/types/ink/dom.js +424 -0
- package/lib/types/ink/events/click-event.d.ts +32 -0
- package/lib/types/ink/events/click-event.d.ts.map +1 -0
- package/lib/types/ink/events/click-event.js +36 -0
- package/lib/types/ink/events/dispatcher.d.ts +63 -0
- package/lib/types/ink/events/dispatcher.d.ts.map +1 -0
- package/lib/types/ink/events/dispatcher.js +194 -0
- package/lib/types/ink/events/emitter.d.ts +20 -0
- package/lib/types/ink/events/emitter.d.ts.map +1 -0
- package/lib/types/ink/events/emitter.js +43 -0
- package/lib/types/ink/events/event-handlers.d.ts +47 -0
- package/lib/types/ink/events/event-handlers.d.ts.map +1 -0
- package/lib/types/ink/events/event-handlers.js +30 -0
- package/lib/types/ink/events/event.d.ts +19 -0
- package/lib/types/ink/events/event.d.ts.map +1 -0
- package/lib/types/ink/events/event.js +22 -0
- package/lib/types/ink/events/focus-event.d.ts +19 -0
- package/lib/types/ink/events/focus-event.d.ts.map +1 -0
- package/lib/types/ink/events/focus-event.js +21 -0
- package/lib/types/ink/events/input-event.d.ts +53 -0
- package/lib/types/ink/events/input-event.d.ts.map +1 -0
- package/lib/types/ink/events/input-event.js +180 -0
- package/lib/types/ink/events/keyboard-event.d.ts +40 -0
- package/lib/types/ink/events/keyboard-event.d.ts.map +1 -0
- package/lib/types/ink/events/keyboard-event.js +65 -0
- package/lib/types/ink/events/paste-event.d.ts +11 -0
- package/lib/types/ink/events/paste-event.d.ts.map +1 -0
- package/lib/types/ink/events/paste-event.js +13 -0
- package/lib/types/ink/events/resize-event.d.ts +13 -0
- package/lib/types/ink/events/resize-event.d.ts.map +1 -0
- package/lib/types/ink/events/resize-event.js +16 -0
- package/lib/types/ink/events/terminal-event.d.ts +112 -0
- package/lib/types/ink/events/terminal-event.d.ts.map +1 -0
- package/lib/types/ink/events/terminal-event.js +131 -0
- package/lib/types/ink/events/terminal-focus-event.d.ts +21 -0
- package/lib/types/ink/events/terminal-focus-event.d.ts.map +1 -0
- package/lib/types/ink/events/terminal-focus-event.js +18 -0
- package/lib/types/ink/focus.d.ts +74 -0
- package/lib/types/ink/focus.d.ts.map +1 -0
- package/lib/types/ink/focus.js +188 -0
- package/lib/types/ink/frame.d.ts +119 -0
- package/lib/types/ink/frame.d.ts.map +1 -0
- package/lib/types/ink/frame.js +43 -0
- package/lib/types/ink/get-max-width.d.ts +20 -0
- package/lib/types/ink/get-max-width.d.ts.map +1 -0
- package/lib/types/ink/get-max-width.js +25 -0
- package/lib/types/ink/hit-test.d.ts +47 -0
- package/lib/types/ink/hit-test.d.ts.map +1 -0
- package/lib/types/ink/hit-test.js +126 -0
- package/lib/types/ink/hooks/use-animation-frame.d.ts +27 -0
- package/lib/types/ink/hooks/use-animation-frame.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-animation-frame.js +48 -0
- package/lib/types/ink/hooks/use-app.d.ts +8 -0
- package/lib/types/ink/hooks/use-app.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-app.js +8 -0
- package/lib/types/ink/hooks/use-copy-on-select.d.ts +22 -0
- package/lib/types/ink/hooks/use-copy-on-select.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-copy-on-select.js +40 -0
- package/lib/types/ink/hooks/use-declared-cursor.d.ts +31 -0
- package/lib/types/ink/hooks/use-declared-cursor.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-declared-cursor.js +65 -0
- package/lib/types/ink/hooks/use-input.d.ts +41 -0
- package/lib/types/ink/hooks/use-input.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-input.js +73 -0
- package/lib/types/ink/hooks/use-interval.d.ts +23 -0
- package/lib/types/ink/hooks/use-interval.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-interval.js +58 -0
- package/lib/types/ink/hooks/use-search-highlight.d.ts +34 -0
- package/lib/types/ink/hooks/use-search-highlight.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-search-highlight.js +35 -0
- package/lib/types/ink/hooks/use-selection.d.ts +44 -0
- package/lib/types/ink/hooks/use-selection.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-selection.js +64 -0
- package/lib/types/ink/hooks/use-stdin.d.ts +8 -0
- package/lib/types/ink/hooks/use-stdin.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-stdin.js +8 -0
- package/lib/types/ink/hooks/use-tab-status.d.ts +18 -0
- package/lib/types/ink/hooks/use-tab-status.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-tab-status.js +58 -0
- package/lib/types/ink/hooks/use-terminal-focus.d.ts +11 -0
- package/lib/types/ink/hooks/use-terminal-focus.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-focus.js +15 -0
- package/lib/types/ink/hooks/use-terminal-size.d.ts +6 -0
- package/lib/types/ink/hooks/use-terminal-size.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-size.js +12 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts +14 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-title.js +30 -0
- package/lib/types/ink/hooks/use-terminal-viewport.d.ts +32 -0
- package/lib/types/ink/hooks/use-terminal-viewport.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-viewport.js +79 -0
- package/lib/types/ink/ink.d.ts +370 -0
- package/lib/types/ink/ink.d.ts.map +1 -0
- package/lib/types/ink/ink.js +1665 -0
- package/lib/types/ink/instances.d.ts +10 -0
- package/lib/types/ink/instances.d.ts.map +1 -0
- package/lib/types/ink/instances.js +13 -0
- package/lib/types/ink/layout/engine.d.ts +7 -0
- package/lib/types/ink/layout/engine.d.ts.map +1 -0
- package/lib/types/ink/layout/engine.js +8 -0
- package/lib/types/ink/layout/geometry.d.ts +86 -0
- package/lib/types/ink/layout/geometry.d.ts.map +1 -0
- package/lib/types/ink/layout/geometry.js +95 -0
- package/lib/types/ink/layout/node.d.ts +151 -0
- package/lib/types/ink/layout/node.d.ts.map +1 -0
- package/lib/types/ink/layout/node.js +72 -0
- package/lib/types/ink/layout/yoga.d.ts +69 -0
- package/lib/types/ink/layout/yoga.d.ts.map +1 -0
- package/lib/types/ink/layout/yoga.js +249 -0
- package/lib/types/ink/line-width-cache.d.ts +9 -0
- package/lib/types/ink/line-width-cache.d.ts.map +1 -0
- package/lib/types/ink/line-width-cache.js +45 -0
- package/lib/types/ink/log-update.d.ts +57 -0
- package/lib/types/ink/log-update.d.ts.map +1 -0
- package/lib/types/ink/log-update.js +710 -0
- package/lib/types/ink/measure-element.d.ts +19 -0
- package/lib/types/ink/measure-element.d.ts.map +1 -0
- package/lib/types/ink/measure-element.js +10 -0
- package/lib/types/ink/measure-text.d.ts +13 -0
- package/lib/types/ink/measure-text.d.ts.map +1 -0
- package/lib/types/ink/measure-text.js +38 -0
- package/lib/types/ink/node-cache.d.ts +33 -0
- package/lib/types/ink/node-cache.d.ts.map +1 -0
- package/lib/types/ink/node-cache.js +42 -0
- package/lib/types/ink/optimizer.d.ts +18 -0
- package/lib/types/ink/optimizer.d.ts.map +1 -0
- package/lib/types/ink/optimizer.js +83 -0
- package/lib/types/ink/output.d.ts +200 -0
- package/lib/types/ink/output.d.ts.map +1 -0
- package/lib/types/ink/output.js +663 -0
- package/lib/types/ink/parse-keypress.d.ts +132 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -0
- package/lib/types/ink/parse-keypress.js +707 -0
- package/lib/types/ink/reconciler.d.ts +43 -0
- package/lib/types/ink/reconciler.d.ts.map +1 -0
- package/lib/types/ink/reconciler.js +413 -0
- package/lib/types/ink/render-border.d.ts +36 -0
- package/lib/types/ink/render-border.d.ts.map +1 -0
- package/lib/types/ink/render-border.js +143 -0
- package/lib/types/ink/render-node-to-output.d.ts +93 -0
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -0
- package/lib/types/ink/render-node-to-output.js +1290 -0
- package/lib/types/ink/render-to-screen.d.ts +65 -0
- package/lib/types/ink/render-to-screen.d.ts.map +1 -0
- package/lib/types/ink/render-to-screen.js +189 -0
- package/lib/types/ink/renderer.d.ts +24 -0
- package/lib/types/ink/renderer.d.ts.map +1 -0
- package/lib/types/ink/renderer.js +136 -0
- package/lib/types/ink/root.d.ts +91 -0
- package/lib/types/ink/root.d.ts.map +1 -0
- package/lib/types/ink/root.js +93 -0
- package/lib/types/ink/screen.d.ts +443 -0
- package/lib/types/ink/screen.d.ts.map +1 -0
- package/lib/types/ink/screen.js +1295 -0
- package/lib/types/ink/searchHighlight.d.ts +25 -0
- package/lib/types/ink/searchHighlight.d.ts.map +1 -0
- package/lib/types/ink/searchHighlight.js +82 -0
- package/lib/types/ink/selection.d.ts +323 -0
- package/lib/types/ink/selection.d.ts.map +1 -0
- package/lib/types/ink/selection.js +881 -0
- package/lib/types/ink/squash-text-nodes.d.ts +30 -0
- package/lib/types/ink/squash-text-nodes.d.ts.map +1 -0
- package/lib/types/ink/squash-text-nodes.js +63 -0
- package/lib/types/ink/stringWidth.d.ts +11 -0
- package/lib/types/ink/stringWidth.d.ts.map +1 -0
- package/lib/types/ink/stringWidth.js +209 -0
- package/lib/types/ink/styles.d.ts +324 -0
- package/lib/types/ink/styles.d.ts.map +1 -0
- package/lib/types/ink/styles.js +307 -0
- package/lib/types/ink/supports-hyperlinks.d.ts +20 -0
- package/lib/types/ink/supports-hyperlinks.d.ts.map +1 -0
- package/lib/types/ink/supports-hyperlinks.js +44 -0
- package/lib/types/ink/tabstops.d.ts +9 -0
- package/lib/types/ink/tabstops.d.ts.map +1 -0
- package/lib/types/ink/tabstops.js +46 -0
- package/lib/types/ink/terminal-focus-state.d.ts +35 -0
- package/lib/types/ink/terminal-focus-state.d.ts.map +1 -0
- package/lib/types/ink/terminal-focus-state.js +57 -0
- package/lib/types/ink/terminal-querier.d.ts +161 -0
- package/lib/types/ink/terminal-querier.d.ts.map +1 -0
- package/lib/types/ink/terminal-querier.js +204 -0
- package/lib/types/ink/terminal.d.ts +80 -0
- package/lib/types/ink/terminal.d.ts.map +1 -0
- package/lib/types/ink/terminal.js +268 -0
- package/lib/types/ink/termio/ansi.d.ts +75 -0
- package/lib/types/ink/termio/ansi.d.ts.map +1 -0
- package/lib/types/ink/termio/ansi.js +79 -0
- package/lib/types/ink/termio/csi.d.ts +253 -0
- package/lib/types/ink/termio/csi.d.ts.map +1 -0
- package/lib/types/ink/termio/csi.js +347 -0
- package/lib/types/ink/termio/dec.d.ts +61 -0
- package/lib/types/ink/termio/dec.d.ts.map +1 -0
- package/lib/types/ink/termio/dec.js +76 -0
- package/lib/types/ink/termio/esc.d.ts +15 -0
- package/lib/types/ink/termio/esc.d.ts.map +1 -0
- package/lib/types/ink/termio/esc.js +57 -0
- package/lib/types/ink/termio/osc.d.ts +208 -0
- package/lib/types/ink/termio/osc.d.ts.map +1 -0
- package/lib/types/ink/termio/osc.js +466 -0
- package/lib/types/ink/termio/parser.d.ts +46 -0
- package/lib/types/ink/termio/parser.d.ts.map +1 -0
- package/lib/types/ink/termio/parser.js +366 -0
- package/lib/types/ink/termio/sgr.d.ts +17 -0
- package/lib/types/ink/termio/sgr.d.ts.map +1 -0
- package/lib/types/ink/termio/sgr.js +300 -0
- package/lib/types/ink/termio/tokenize.d.ts +50 -0
- package/lib/types/ink/termio/tokenize.d.ts.map +1 -0
- package/lib/types/ink/termio/tokenize.js +266 -0
- package/lib/types/ink/termio/types.d.ts +211 -0
- package/lib/types/ink/termio/types.d.ts.map +1 -0
- package/lib/types/ink/termio/types.js +68 -0
- package/lib/types/ink/termio.d.ts +25 -0
- package/lib/types/ink/termio.d.ts.map +1 -0
- package/lib/types/ink/termio.js +24 -0
- package/lib/types/ink/truncateToWidth.d.ts +7 -0
- package/lib/types/ink/truncateToWidth.d.ts.map +1 -0
- package/lib/types/ink/truncateToWidth.js +18 -0
- package/lib/types/ink/useTerminalNotification.d.ts +45 -0
- package/lib/types/ink/useTerminalNotification.d.ts.map +1 -0
- package/lib/types/ink/useTerminalNotification.js +70 -0
- package/lib/types/ink/warn.d.ts +7 -0
- package/lib/types/ink/warn.d.ts.map +1 -0
- package/lib/types/ink/warn.js +15 -0
- package/lib/types/ink/widest-line.d.ts +7 -0
- package/lib/types/ink/widest-line.d.ts.map +1 -0
- package/lib/types/ink/widest-line.js +19 -0
- package/lib/types/ink/wrap-text.d.ts +10 -0
- package/lib/types/ink/wrap-text.d.ts.map +1 -0
- package/lib/types/ink/wrap-text.js +61 -0
- package/lib/types/ink/wrapAnsi.d.ts +18 -0
- package/lib/types/ink/wrapAnsi.d.ts.map +1 -0
- package/lib/types/ink/wrapAnsi.js +16 -0
- package/lib/types/invariant.d.ts +20 -0
- package/lib/types/invariant.d.ts.map +1 -0
- package/lib/types/invariant.js +26 -0
- package/lib/types/modelPrefs.d.ts +37 -0
- package/lib/types/modelPrefs.d.ts.map +1 -0
- package/lib/types/modelPrefs.js +66 -0
- package/lib/types/modelRoute.d.ts +79 -0
- package/lib/types/modelRoute.d.ts.map +1 -0
- package/lib/types/modelRoute.js +96 -0
- package/lib/types/native-ts/yoga-layout/enums.d.ts +183 -0
- package/lib/types/native-ts/yoga-layout/enums.d.ts.map +1 -0
- package/lib/types/native-ts/yoga-layout/enums.js +150 -0
- package/lib/types/native-ts/yoga-layout/index.d.ts +788 -0
- package/lib/types/native-ts/yoga-layout/index.d.ts.map +1 -0
- package/lib/types/native-ts/yoga-layout/index.js +2571 -0
- package/lib/types/packaged-skills.d.ts +10 -0
- package/lib/types/packaged-skills.d.ts.map +1 -0
- package/lib/types/packaged-skills.js +63 -0
- package/lib/types/plugin.d.ts +33 -0
- package/lib/types/plugin.d.ts.map +1 -0
- package/lib/types/plugin.js +454 -0
- package/lib/types/presetPrefs.d.ts +29 -0
- package/lib/types/presetPrefs.d.ts.map +1 -0
- package/lib/types/presetPrefs.js +61 -0
- package/lib/types/presets.d.ts +110 -0
- package/lib/types/presets.d.ts.map +1 -0
- package/lib/types/presets.js +114 -0
- package/lib/types/questions.d.ts +97 -0
- package/lib/types/questions.d.ts.map +1 -0
- package/lib/types/questions.js +201 -0
- package/lib/types/screens/Chat.d.ts +23 -0
- package/lib/types/screens/Chat.d.ts.map +1 -0
- package/lib/types/screens/Chat.js +1263 -0
- package/lib/types/screens/StatusLine.d.ts +16 -0
- package/lib/types/screens/StatusLine.d.ts.map +1 -0
- package/lib/types/screens/StatusLine.js +105 -0
- package/lib/types/screens/StatusMetrics.d.ts +87 -0
- package/lib/types/screens/StatusMetrics.d.ts.map +1 -0
- package/lib/types/screens/StatusMetrics.js +252 -0
- package/lib/types/sessionHistory.d.ts +32 -0
- package/lib/types/sessionHistory.d.ts.map +1 -0
- package/lib/types/sessionHistory.js +87 -0
- package/lib/types/theme.d.ts +115 -0
- package/lib/types/theme.d.ts.map +1 -0
- package/lib/types/theme.js +300 -0
- package/lib/types/themePrefs.d.ts +28 -0
- package/lib/types/themePrefs.d.ts.map +1 -0
- package/lib/types/themePrefs.js +59 -0
- package/lib/types/ui.d.ts +28 -0
- package/lib/types/ui.d.ts.map +1 -0
- package/lib/types/ui.js +25 -0
- package/lib/types/update.d.ts +76 -0
- package/lib/types/update.d.ts.map +1 -0
- package/lib/types/update.js +203 -0
- package/lib/types/utils/clipboard.d.ts +43 -0
- package/lib/types/utils/clipboard.d.ts.map +1 -0
- package/lib/types/utils/clipboard.js +82 -0
- package/lib/types/utils/debug.d.ts +8 -0
- package/lib/types/utils/debug.d.ts.map +1 -0
- package/lib/types/utils/debug.js +12 -0
- package/lib/types/utils/earlyInput.d.ts +7 -0
- package/lib/types/utils/earlyInput.d.ts.map +1 -0
- package/lib/types/utils/earlyInput.js +6 -0
- package/lib/types/utils/env.d.ts +10 -0
- package/lib/types/utils/env.d.ts.map +1 -0
- package/lib/types/utils/env.js +9 -0
- package/lib/types/utils/envUtils.d.ts +8 -0
- package/lib/types/utils/envUtils.d.ts.map +1 -0
- package/lib/types/utils/envUtils.js +13 -0
- package/lib/types/utils/execFileNoThrow.d.ts +34 -0
- package/lib/types/utils/execFileNoThrow.d.ts.map +1 -0
- package/lib/types/utils/execFileNoThrow.js +31 -0
- package/lib/types/utils/fullscreen.d.ts +8 -0
- package/lib/types/utils/fullscreen.d.ts.map +1 -0
- package/lib/types/utils/fullscreen.js +10 -0
- package/lib/types/utils/intl.d.ts +7 -0
- package/lib/types/utils/intl.d.ts.map +1 -0
- package/lib/types/utils/intl.js +9 -0
- package/lib/types/utils/loaded-context.d.ts +20 -0
- package/lib/types/utils/loaded-context.d.ts.map +1 -0
- package/lib/types/utils/loaded-context.js +36 -0
- package/lib/types/utils/log.d.ts +7 -0
- package/lib/types/utils/log.d.ts.map +1 -0
- package/lib/types/utils/log.js +9 -0
- package/lib/types/utils/mentions.d.ts +30 -0
- package/lib/types/utils/mentions.d.ts.map +1 -0
- package/lib/types/utils/mentions.js +72 -0
- package/lib/types/utils/narration.d.ts +11 -0
- package/lib/types/utils/narration.d.ts.map +1 -0
- package/lib/types/utils/narration.js +16 -0
- package/lib/types/utils/semver.d.ts +9 -0
- package/lib/types/utils/semver.d.ts.map +1 -0
- package/lib/types/utils/semver.js +24 -0
- package/lib/types/utils/sliceAnsi.d.ts +12 -0
- package/lib/types/utils/sliceAnsi.d.ts.map +1 -0
- package/lib/types/utils/sliceAnsi.js +79 -0
- package/lib/types/working-activity.d.ts +19 -0
- package/lib/types/working-activity.d.ts.map +1 -0
- package/lib/types/working-activity.js +18 -0
- package/package.json +141 -0
- package/skills/audit/SKILL.md +24 -0
- package/skills/bug/SKILL.md +27 -0
- package/skills/pr-comments/SKILL.md +20 -0
- package/skills/practice/SKILL.md +22 -0
- package/skills/release-notes/SKILL.md +25 -0
- package/skills/review/SKILL.md +25 -0
- package/skills/vuln-check/SKILL.md +25 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Channel } from '../channel.js';
|
|
3
|
+
/**
|
|
4
|
+
* The footer under the prompt input, in Claude Code's PromptInputFooter
|
|
5
|
+
* layout: the segmented context progress bar on its own first line, the
|
|
6
|
+
* status line below (left group: model · tokens · think level · cache · tps
|
|
7
|
+
* gauge/sparkline; right group: git · cwd · title, right-aligned), and the
|
|
8
|
+
* mode/hint line last. The right side of the footer shows the latest
|
|
9
|
+
* transient notification (errors in red, warnings in amber — CC style).
|
|
10
|
+
*/
|
|
11
|
+
export declare function StatusLine({ channel, selectionActive, helpOpen, }: {
|
|
12
|
+
channel: Channel;
|
|
13
|
+
selectionActive?: boolean;
|
|
14
|
+
helpOpen?: boolean;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
//# sourceMappingURL=StatusLine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusLine.d.ts","sourceRoot":"","sources":["../../../src/screens/StatusLine.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAQ5C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,eAAuB,EACvB,QAAgB,GACjB,EAAE;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,qBAkLA"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useTerminalSize, useTheme } from '../ui.js';
|
|
3
|
+
import { formatTokens } from '../cc/format.js';
|
|
4
|
+
import { Byline } from '../components/design-system/Byline.js';
|
|
5
|
+
import { ActivityLine, contextPressurePct } from '../components/ActivityLine.js';
|
|
6
|
+
import { renderContextBar, renderTpsGauge, renderTpsSparkline, speedColor, } from './StatusMetrics.js';
|
|
7
|
+
/**
|
|
8
|
+
* The footer under the prompt input, in Claude Code's PromptInputFooter
|
|
9
|
+
* layout: the segmented context progress bar on its own first line, the
|
|
10
|
+
* status line below (left group: model · tokens · think level · cache · tps
|
|
11
|
+
* gauge/sparkline; right group: git · cwd · title, right-aligned), and the
|
|
12
|
+
* mode/hint line last. The right side of the footer shows the latest
|
|
13
|
+
* transient notification (errors in red, warnings in amber — CC style).
|
|
14
|
+
*/
|
|
15
|
+
export function StatusLine({ channel, selectionActive = false, helpOpen = false, }) {
|
|
16
|
+
const { columns } = useTerminalSize();
|
|
17
|
+
const [themeName] = useTheme();
|
|
18
|
+
const usage = channel.lastUsage;
|
|
19
|
+
const contextParts = [];
|
|
20
|
+
if (channel.reasoningEffort !== undefined) {
|
|
21
|
+
contextParts.push(_jsx(Text, { color: "inactiveShimmer", children: channel.reasoningEffort }, "effort"));
|
|
22
|
+
}
|
|
23
|
+
if (usage !== undefined && usage.cacheRead > 0) {
|
|
24
|
+
// Cache hit rate of the context fed to the model (read / total), one
|
|
25
|
+
// decimal — the absolute read count lives in the context bar's system
|
|
26
|
+
// segment, the rate is the glanceable health signal.
|
|
27
|
+
const total = usage.input + usage.cacheRead + usage.cacheWrite;
|
|
28
|
+
const rate = total > 0 ? (usage.cacheRead / total) * 100 : 0;
|
|
29
|
+
contextParts.push(_jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "cache " }), _jsxs(Text, { color: "inactiveShimmer", children: [rate.toFixed(1), "%"] })] }, "cache"));
|
|
30
|
+
}
|
|
31
|
+
// TPS readout sits right after the model so a crowded footer truncates
|
|
32
|
+
// the trailing fields (tokens/think/cache), never the speedometer. One
|
|
33
|
+
// number only: the live value (gauge while streaming, sparkline of past
|
|
34
|
+
// turns once samples exist) — no μ/p95 clutter.
|
|
35
|
+
const tpsParts = [];
|
|
36
|
+
if (channel.tps !== undefined) {
|
|
37
|
+
if (channel.working && channel.tpsSamples.length === 0) {
|
|
38
|
+
tpsParts.push(_jsxs(Text, { children: [renderTpsGauge(channel.tps, channel.tps), ' ', _jsxs(Text, { dimColor: true, children: [Math.round(channel.tps), " tps"] })] }, "tps"));
|
|
39
|
+
}
|
|
40
|
+
else if (channel.tpsSamples.length > 0) {
|
|
41
|
+
const peak = Math.max(...channel.tpsSamples.map(sample => sample.tps), channel.tps);
|
|
42
|
+
tpsParts.push(_jsxs(Text, { children: [channel.working
|
|
43
|
+
? renderTpsGauge(channel.tps, peak)
|
|
44
|
+
: renderTpsSparkline(channel.tpsSamples), ' ', speedColor(channel.tps, `${Math.round(channel.tps)}`), " tps"] }, "tps"));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
tpsParts.push(_jsxs(Text, { dimColor: true, children: [Math.round(channel.tps), " t/s"] }, "tps"));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Left group: every field sits at soft white (inactiveShimmer) instead of
|
|
51
|
+
// the previous uniform dim grey — readable against dark terminals.
|
|
52
|
+
const leftParts = [
|
|
53
|
+
_jsx(Text, { color: "inactiveShimmer", children: channel.model }, "model"),
|
|
54
|
+
...tpsParts,
|
|
55
|
+
...contextParts,
|
|
56
|
+
_jsxs(Text, { color: "inactiveShimmer", children: [formatTokens(channel.tokens.input), "\u2192", formatTokens(channel.tokens.output)] }, "tokens"),
|
|
57
|
+
];
|
|
58
|
+
// Right group: git branch in muted steel blue, cwd a soft white, the
|
|
59
|
+
// session title dimmest (it truncates first anyway).
|
|
60
|
+
const rightParts = [
|
|
61
|
+
...(channel.gitBranch
|
|
62
|
+
? [
|
|
63
|
+
_jsx(Text, { color: "professionalBlue", children: channel.gitBranch }, "git"),
|
|
64
|
+
]
|
|
65
|
+
: []),
|
|
66
|
+
_jsx(Text, { color: "inactiveShimmer", children: basename(channel.cwd) }, "cwd"),
|
|
67
|
+
...(channel.sessionTitle
|
|
68
|
+
? [
|
|
69
|
+
_jsx(Text, { dimColor: true, children: channel.sessionTitle }, "title"),
|
|
70
|
+
]
|
|
71
|
+
: []),
|
|
72
|
+
];
|
|
73
|
+
// Row 3: the mode hint — and, while idle, the working-activity turn
|
|
74
|
+
// summary (the live working line itself moves to the spinner slot above
|
|
75
|
+
// the input while a turn runs, so the two never duplicate).
|
|
76
|
+
const hint = selectionActive
|
|
77
|
+
? 'esc to return to input'
|
|
78
|
+
: channel.working
|
|
79
|
+
? 'esc to interrupt'
|
|
80
|
+
: !helpOpen
|
|
81
|
+
? '? for shortcuts'
|
|
82
|
+
: '';
|
|
83
|
+
const activity = channel.workingActivity;
|
|
84
|
+
const showActivity = !channel.working &&
|
|
85
|
+
activity !== undefined &&
|
|
86
|
+
activity.line !== '' &&
|
|
87
|
+
activity.phase !== 'idle';
|
|
88
|
+
const barWidth = columns - 4;
|
|
89
|
+
let bar = null;
|
|
90
|
+
// Theme-aware free segment: the light palette's near-white fill (#E8E8E8)
|
|
91
|
+
// reads as a glaring white band on dark terminals — swap it for a deep
|
|
92
|
+
// blue-gray there while keeping the light palette as-is (dark-ansi carries
|
|
93
|
+
// `ansi:` color names, so map by theme name rather than palette tokens).
|
|
94
|
+
const barColors = themeName === 'light'
|
|
95
|
+
? undefined
|
|
96
|
+
: { freeFill: '#2E3440', freeText: '#8D95A6' };
|
|
97
|
+
if (channel.contextBarEnabled && barWidth >= 14 && channel.contextWindow !== undefined) {
|
|
98
|
+
bar = renderContextBar(channel.contextSegments, usage !== undefined ? usage.input + usage.cacheRead + usage.cacheWrite : 0, channel.contextWindow, barWidth, barColors);
|
|
99
|
+
}
|
|
100
|
+
return (_jsx(Box, { paddingX: 2, children: _jsxs(Box, { flexDirection: "column", width: "100%", children: [bar ? _jsx(Text, { children: bar }) : null, _jsxs(Box, { flexDirection: "row", justifyContent: "space-between", gap: 2, children: [_jsx(Text, { wrap: "truncate", children: _jsx(Byline, { children: leftParts }) }), _jsx(Box, { justifyContent: "flex-end", flexShrink: 2, children: _jsx(Text, { wrap: "truncate", children: _jsx(Byline, { children: rightParts }) }) })] }), _jsxs(Box, { height: 1, overflow: "hidden", flexDirection: "row", justifyContent: "space-between", gap: 2, children: [showActivity && activity !== undefined ? (_jsx(ActivityLine, { activity: activity, activityFrames: channel.activityFrames, warnPct: contextPressurePct(usage, channel.contextWindow), warnDanger: (contextPressurePct(usage, channel.contextWindow) ?? 0) >= 95 })) : hint ? (_jsx(Text, { color: "inactiveShimmer", children: hint })) : null, showActivity && hint ? (_jsx(Text, { color: "inactiveShimmer", wrap: "truncate", children: hint })) : null] })] }) }));
|
|
101
|
+
}
|
|
102
|
+
function basename(path) {
|
|
103
|
+
const parts = path.split(/[\\/]/);
|
|
104
|
+
return parts[parts.length - 1] ?? path;
|
|
105
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status-line metric renderers, ported from two pi extensions:
|
|
3
|
+
* - `pi-nano-context`: segmented context progress bar (morandi pastel
|
|
4
|
+
* segments by content type, free space right-aligned with the usage
|
|
5
|
+
* readout, largest-remainder column allocation).
|
|
6
|
+
* - `pi-tps-meter`: live 1/8-cell gauge while streaming and a min-max
|
|
7
|
+
* normalized sparkline after each completed turn; colors green ≥ 50 tps,
|
|
8
|
+
* yellow ≥ 20, red below.
|
|
9
|
+
*/
|
|
10
|
+
/** Context bar segments — DeepSeek blue family (dark-theme friendly: deep
|
|
11
|
+
* navy → brand blue, neutral grey free segment; labels adapt to width). */
|
|
12
|
+
declare const USED_SEGMENTS: readonly [{
|
|
13
|
+
readonly key: "system";
|
|
14
|
+
readonly color: "#22305F";
|
|
15
|
+
readonly labels: readonly ["system", "sys", "s"];
|
|
16
|
+
}, {
|
|
17
|
+
readonly key: "prompt";
|
|
18
|
+
readonly color: "#2B3D78";
|
|
19
|
+
readonly labels: readonly ["prompt", "pr", "p"];
|
|
20
|
+
}, {
|
|
21
|
+
readonly key: "assistant";
|
|
22
|
+
readonly color: "#344A92";
|
|
23
|
+
readonly labels: readonly ["assistant", "ast", "a"];
|
|
24
|
+
}, {
|
|
25
|
+
readonly key: "thinking";
|
|
26
|
+
readonly color: "#4D6BFE";
|
|
27
|
+
readonly labels: readonly ["think", "th", "t"];
|
|
28
|
+
}, {
|
|
29
|
+
readonly key: "tools";
|
|
30
|
+
readonly color: "#5A7CFF";
|
|
31
|
+
readonly labels: readonly ["tools", "tl", "x"];
|
|
32
|
+
}];
|
|
33
|
+
/** Used tokens per context content type (system, prompt, assistant, thinking, tools). */
|
|
34
|
+
export type ContextSegments = Record<(typeof USED_SEGMENTS)[number]['key'], number>;
|
|
35
|
+
/** Compact token count like pi's: `988`, `3.4k`, `12k`, `1.0M`.
|
|
36
|
+
* @param count - The raw token count; negative values clamp to zero.
|
|
37
|
+
* @returns The compact count string.
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatTokens(count: number): string;
|
|
40
|
+
/**
|
|
41
|
+
* The segmented context bar: used segments by content type, the remainder as
|
|
42
|
+
* a light free segment whose right edge carries the usage readout
|
|
43
|
+
* (`ctx 12.3k/1.0M 1.2% 988.9k`, shrinking as width allows).
|
|
44
|
+
* @param segments - Used tokens per content type.
|
|
45
|
+
* @param usedTokens - Total used tokens, driving the usage readout.
|
|
46
|
+
* @param contextWindow - The context window size in tokens.
|
|
47
|
+
* @param width - Total bar width in terminal columns.
|
|
48
|
+
* @returns The ANSI-styled segmented bar, or '' when `width` or `contextWindow` is non-positive.
|
|
49
|
+
*/
|
|
50
|
+
export declare function renderContextBar(segments: ContextSegments, usedTokens: number, contextWindow: number, width: number, colors?: {
|
|
51
|
+
freeFill: string;
|
|
52
|
+
freeText: string;
|
|
53
|
+
}): string;
|
|
54
|
+
/** Speed color: green ≥ 50, yellow ≥ 20, red below (pi-tps-meter).
|
|
55
|
+
* @param tps - Tokens per second; selects the color threshold.
|
|
56
|
+
* @param text - Text to color.
|
|
57
|
+
* @returns The ANSI 24-bit color-wrapped text.
|
|
58
|
+
*/
|
|
59
|
+
export declare function speedColor(tps: number, text: string): string;
|
|
60
|
+
/** Live 1/8-cell horizontal gauge: `▕███████▋···▏`.
|
|
61
|
+
* @param tps - Current tokens per second.
|
|
62
|
+
* @param peak - Scaling peak; values below 40 scale against the floor instead.
|
|
63
|
+
* @returns The ANSI gauge string.
|
|
64
|
+
*/
|
|
65
|
+
export declare function renderTpsGauge(tps: number, peak: number): string;
|
|
66
|
+
/** Min-max normalized 12-sample sparkline: `▁▄▇▅▂▁▇█▅▃▆▇`.
|
|
67
|
+
* @param samples - Turn TPS samples; only the last 12 are rendered.
|
|
68
|
+
* @returns The ANSI sparkline string.
|
|
69
|
+
*/
|
|
70
|
+
export declare function renderTpsSparkline(samples: readonly {
|
|
71
|
+
tps: number;
|
|
72
|
+
}[]): string;
|
|
73
|
+
/** Rolling stats: 60s average, all-time mean and p95.
|
|
74
|
+
* @param samples - Turn TPS samples with their timestamps in milliseconds.
|
|
75
|
+
* @param nowMs - Current time in milliseconds; the 60s rolling window keeps samples with `nowMs - at <= 60_000`.
|
|
76
|
+
* @returns The 60s average, all-time mean, and all-time p95 (all zero for an empty sample list).
|
|
77
|
+
*/
|
|
78
|
+
export declare function tpsStats(samples: readonly {
|
|
79
|
+
tps: number;
|
|
80
|
+
at: number;
|
|
81
|
+
}[], nowMs: number): {
|
|
82
|
+
avg: number;
|
|
83
|
+
mean: number;
|
|
84
|
+
p95: number;
|
|
85
|
+
};
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=StatusMetrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusMetrics.d.ts","sourceRoot":"","sources":["../../../src/screens/StatusMetrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;4EAC4E;AAC5E,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;EAMT,CAAA;AAEV,yFAAyF;AACzF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAA;AAsBnF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOlD;AA+GD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC9C,MAAM,CAkBR;AAYD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5D;AAYD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAYhE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,CAqB9E;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG;IACxF,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ,CAUA"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status-line metric renderers, ported from two pi extensions:
|
|
3
|
+
* - `pi-nano-context`: segmented context progress bar (morandi pastel
|
|
4
|
+
* segments by content type, free space right-aligned with the usage
|
|
5
|
+
* readout, largest-remainder column allocation).
|
|
6
|
+
* - `pi-tps-meter`: live 1/8-cell gauge while streaming and a min-max
|
|
7
|
+
* normalized sparkline after each completed turn; colors green ≥ 50 tps,
|
|
8
|
+
* yellow ≥ 20, red below.
|
|
9
|
+
*/
|
|
10
|
+
/** Context bar segments — DeepSeek blue family (dark-theme friendly: deep
|
|
11
|
+
* navy → brand blue, neutral grey free segment; labels adapt to width). */
|
|
12
|
+
const USED_SEGMENTS = [
|
|
13
|
+
{ key: 'system', color: '#22305F', labels: ['system', 'sys', 's'] }, // deep navy
|
|
14
|
+
{ key: 'prompt', color: '#2B3D78', labels: ['prompt', 'pr', 'p'] }, // navy
|
|
15
|
+
{ key: 'assistant', color: '#344A92', labels: ['assistant', 'ast', 'a'] }, // indigo
|
|
16
|
+
{ key: 'thinking', color: '#4D6BFE', labels: ['think', 'th', 't'] }, // DeepSeek brand blue
|
|
17
|
+
{ key: 'tools', color: '#5A7CFF', labels: ['tools', 'tl', 'x'] }, // lighter blue
|
|
18
|
+
];
|
|
19
|
+
const USED_SEGMENT_TEXT = '#FFFFFF';
|
|
20
|
+
const FREE_SEGMENT_FILL = '#E8E8E8';
|
|
21
|
+
const FREE_SEGMENT_TEXT = '#4A4A4A';
|
|
22
|
+
const FREE_SEGMENT_LABELS = ['free', 'fr', 'f'];
|
|
23
|
+
const ANSI_RE = /\x1b\[[0-9;]*m/g;
|
|
24
|
+
const stripAnsi = (text) => text.replace(ANSI_RE, '');
|
|
25
|
+
const plainWidth = (text) => Array.from(stripAnsi(text)).length;
|
|
26
|
+
function ansiColor(mode, hex, text) {
|
|
27
|
+
const value = Number.parseInt(hex.replace(/^#/, ''), 16);
|
|
28
|
+
const red = (value >> 16) & 0xff;
|
|
29
|
+
const green = (value >> 8) & 0xff;
|
|
30
|
+
const blue = value & 0xff;
|
|
31
|
+
return `\x1b[${mode};2;${red};${green};${blue}m${text}\x1b[${mode === 38 ? 39 : 49}m`;
|
|
32
|
+
}
|
|
33
|
+
const foreground = (hex, text) => ansiColor(38, hex, text);
|
|
34
|
+
const background = (hex, text) => ansiColor(48, hex, text);
|
|
35
|
+
/** Compact token count like pi's: `988`, `3.4k`, `12k`, `1.0M`.
|
|
36
|
+
* @param count - The raw token count; negative values clamp to zero.
|
|
37
|
+
* @returns The compact count string.
|
|
38
|
+
*/
|
|
39
|
+
export function formatTokens(count) {
|
|
40
|
+
const value = Math.max(0, Math.round(count));
|
|
41
|
+
if (value < 1000)
|
|
42
|
+
return String(value);
|
|
43
|
+
if (value < 10000)
|
|
44
|
+
return `${(value / 1000).toFixed(1)}k`;
|
|
45
|
+
if (value < 1000000)
|
|
46
|
+
return `${Math.round(value / 1000)}k`;
|
|
47
|
+
if (value < 10000000)
|
|
48
|
+
return `${(value / 1000000).toFixed(1)}M`;
|
|
49
|
+
return `${Math.round(value / 1000000)}M`;
|
|
50
|
+
}
|
|
51
|
+
// --- Context bar (pi-nano-context) ---
|
|
52
|
+
function centeredText(text, width) {
|
|
53
|
+
const textWidth = plainWidth(text);
|
|
54
|
+
if (textWidth > width)
|
|
55
|
+
return ' '.repeat(width);
|
|
56
|
+
const left = Math.floor((width - textWidth) / 2);
|
|
57
|
+
const right = width - textWidth - left;
|
|
58
|
+
return `${' '.repeat(left)}${text}${' '.repeat(right)}`;
|
|
59
|
+
}
|
|
60
|
+
function chooseLabel(labels, width) {
|
|
61
|
+
for (const label of labels) {
|
|
62
|
+
if (plainWidth(label) <= width)
|
|
63
|
+
return label;
|
|
64
|
+
}
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
function renderUsedSegment(labels, color, width) {
|
|
68
|
+
if (width <= 0)
|
|
69
|
+
return '';
|
|
70
|
+
const label = chooseLabel(labels, width);
|
|
71
|
+
const text = label.length > 0
|
|
72
|
+
? foreground(USED_SEGMENT_TEXT, centeredText(label, width))
|
|
73
|
+
: ' '.repeat(width);
|
|
74
|
+
return background(color, text);
|
|
75
|
+
}
|
|
76
|
+
function chooseRightAlignedText(options, width, blockedUntil) {
|
|
77
|
+
for (const option of options) {
|
|
78
|
+
const start = width - plainWidth(option);
|
|
79
|
+
if (start > blockedUntil)
|
|
80
|
+
return option;
|
|
81
|
+
}
|
|
82
|
+
return '';
|
|
83
|
+
}
|
|
84
|
+
function renderFreeSegment(options, width, fill, text) {
|
|
85
|
+
if (width <= 0)
|
|
86
|
+
return '';
|
|
87
|
+
const content = Array.from({ length: width }, () => ' ');
|
|
88
|
+
const label = chooseLabel(FREE_SEGMENT_LABELS, width);
|
|
89
|
+
const labelStart = Math.max(0, Math.floor((width - plainWidth(label)) / 2));
|
|
90
|
+
const labelEnd = label.length > 0 ? labelStart + plainWidth(label) : -1;
|
|
91
|
+
const rightText = chooseRightAlignedText(options, width, labelEnd);
|
|
92
|
+
if (rightText) {
|
|
93
|
+
const start = width - plainWidth(rightText);
|
|
94
|
+
for (const [offset, char] of Array.from(rightText).entries()) {
|
|
95
|
+
content[start + offset] = char;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (label) {
|
|
99
|
+
for (const [offset, char] of Array.from(label).entries()) {
|
|
100
|
+
content[labelStart + offset] = char;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return background(fill, foreground(text, content.join('')));
|
|
104
|
+
}
|
|
105
|
+
/** Largest-remainder column allocation (pi-nano-context). */
|
|
106
|
+
function allocateProportionally(values, columns) {
|
|
107
|
+
if (columns <= 0)
|
|
108
|
+
return values.map(() => 0);
|
|
109
|
+
const total = values.reduce((sum, value) => sum + value, 0);
|
|
110
|
+
if (total <= 0)
|
|
111
|
+
return values.map(() => 0);
|
|
112
|
+
const rawColumns = values.map(value => (value / total) * columns);
|
|
113
|
+
const allocatedColumns = rawColumns.map(Math.floor);
|
|
114
|
+
let remaining = columns - allocatedColumns.reduce((sum, value) => sum + value, 0);
|
|
115
|
+
const largestRemainders = rawColumns
|
|
116
|
+
.map((value, index) => ({ index, remainder: value - Math.floor(value) }))
|
|
117
|
+
.sort((left, right) => right.remainder - left.remainder);
|
|
118
|
+
for (const slot of largestRemainders) {
|
|
119
|
+
if (remaining <= 0)
|
|
120
|
+
break;
|
|
121
|
+
allocatedColumns[slot.index] = (allocatedColumns[slot.index] ?? 0) + 1;
|
|
122
|
+
remaining--;
|
|
123
|
+
}
|
|
124
|
+
return allocatedColumns;
|
|
125
|
+
}
|
|
126
|
+
/** Give every visible used segment at least one column before sharing the rest. */
|
|
127
|
+
function allocateBarColumns(values, width) {
|
|
128
|
+
const visibleUsedSegments = USED_SEGMENTS
|
|
129
|
+
.map((_, index) => index)
|
|
130
|
+
.filter(index => (values[index] ?? 0) > 0);
|
|
131
|
+
if (visibleUsedSegments.length === 0 || visibleUsedSegments.length >= width) {
|
|
132
|
+
return allocateProportionally(values, width);
|
|
133
|
+
}
|
|
134
|
+
const minimumColumns = Array.from({ length: values.length }, () => 0);
|
|
135
|
+
for (const index of visibleUsedSegments) {
|
|
136
|
+
minimumColumns[index] = 1;
|
|
137
|
+
}
|
|
138
|
+
const remainingColumns = allocateProportionally(values, width - visibleUsedSegments.length);
|
|
139
|
+
return minimumColumns.map((minimum, index) => minimum + (remainingColumns[index] ?? 0));
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The segmented context bar: used segments by content type, the remainder as
|
|
143
|
+
* a light free segment whose right edge carries the usage readout
|
|
144
|
+
* (`ctx 12.3k/1.0M 1.2% 988.9k`, shrinking as width allows).
|
|
145
|
+
* @param segments - Used tokens per content type.
|
|
146
|
+
* @param usedTokens - Total used tokens, driving the usage readout.
|
|
147
|
+
* @param contextWindow - The context window size in tokens.
|
|
148
|
+
* @param width - Total bar width in terminal columns.
|
|
149
|
+
* @returns The ANSI-styled segmented bar, or '' when `width` or `contextWindow` is non-positive.
|
|
150
|
+
*/
|
|
151
|
+
export function renderContextBar(segments, usedTokens, contextWindow, width, colors) {
|
|
152
|
+
if (width <= 0 || contextWindow <= 0)
|
|
153
|
+
return '';
|
|
154
|
+
const freeTokens = Math.max(0, contextWindow - usedTokens);
|
|
155
|
+
const values = [...USED_SEGMENTS.map(segment => segments[segment.key]), freeTokens];
|
|
156
|
+
const columns = allocateBarColumns(values, width);
|
|
157
|
+
const used = USED_SEGMENTS.map((segment, index) => renderUsedSegment(segment.labels, segment.color, columns[index] ?? 0)).join('');
|
|
158
|
+
const freeWidth = columns[USED_SEGMENTS.length] ?? 0;
|
|
159
|
+
const percent = `${((usedTokens / contextWindow) * 100).toFixed(1)}%`;
|
|
160
|
+
const total = `${formatTokens(usedTokens)}/${formatTokens(contextWindow)}`;
|
|
161
|
+
const free = formatTokens(contextWindow - usedTokens);
|
|
162
|
+
return `${used}${renderFreeSegment([`ctx ${total} ${percent} ${free}`, `${total} ${percent} ${free}`, `${total} ${percent}`, percent], freeWidth, colors?.freeFill ?? FREE_SEGMENT_FILL, colors?.freeText ?? FREE_SEGMENT_TEXT)}`;
|
|
163
|
+
}
|
|
164
|
+
// --- TPS gauge + sparkline (pi-tps-meter) ---
|
|
165
|
+
const BLOCKS = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];
|
|
166
|
+
const HBLOCKS = [' ', '▏', '▎', '▍', '▌', '▋', '▊', '▉'];
|
|
167
|
+
const GAUGE_LEN = 11;
|
|
168
|
+
const GAUGE_FLOOR = 40;
|
|
169
|
+
const TRACK = '·';
|
|
170
|
+
const FAST = 50;
|
|
171
|
+
const MED = 20;
|
|
172
|
+
/** Speed color: green ≥ 50, yellow ≥ 20, red below (pi-tps-meter).
|
|
173
|
+
* @param tps - Tokens per second; selects the color threshold.
|
|
174
|
+
* @param text - Text to color.
|
|
175
|
+
* @returns The ANSI 24-bit color-wrapped text.
|
|
176
|
+
*/
|
|
177
|
+
export function speedColor(tps, text) {
|
|
178
|
+
const color = tps >= FAST ? 'success' : tps >= MED ? 'warning' : 'error';
|
|
179
|
+
return `\x1b[38;2;${colorHex(color)}m${text}\x1b[39m`;
|
|
180
|
+
}
|
|
181
|
+
function colorHex(key) {
|
|
182
|
+
// dsh-tui dark theme values (theme.ts), semicolon-separated for raw ANSI.
|
|
183
|
+
const palette = {
|
|
184
|
+
success: '78;186;101',
|
|
185
|
+
warning: '202;138;4',
|
|
186
|
+
error: '255;107;128',
|
|
187
|
+
};
|
|
188
|
+
return palette[key] ?? '255;255;255';
|
|
189
|
+
}
|
|
190
|
+
/** Live 1/8-cell horizontal gauge: `▕███████▋···▏`.
|
|
191
|
+
* @param tps - Current tokens per second.
|
|
192
|
+
* @param peak - Scaling peak; values below 40 scale against the floor instead.
|
|
193
|
+
* @returns The ANSI gauge string.
|
|
194
|
+
*/
|
|
195
|
+
export function renderTpsGauge(tps, peak) {
|
|
196
|
+
const scale = Math.max(peak, GAUGE_FLOOR);
|
|
197
|
+
const frac = Math.min(1, Math.max(0, scale > 0 ? tps / scale : 0));
|
|
198
|
+
const eighths = Math.round(frac * GAUGE_LEN * 8);
|
|
199
|
+
const full = Math.floor(eighths / 8);
|
|
200
|
+
const rem = eighths % 8;
|
|
201
|
+
let fill = '█'.repeat(full);
|
|
202
|
+
if (full < GAUGE_LEN && rem > 0) {
|
|
203
|
+
fill += HBLOCKS[rem];
|
|
204
|
+
}
|
|
205
|
+
const track = TRACK.repeat(Math.max(0, GAUGE_LEN - fill.length));
|
|
206
|
+
return `▕${speedColor(tps, fill)}${`\x1b[2m${track}\x1b[22m`}▏`;
|
|
207
|
+
}
|
|
208
|
+
/** Min-max normalized 12-sample sparkline: `▁▄▇▅▂▁▇█▅▃▆▇`.
|
|
209
|
+
* @param samples - Turn TPS samples; only the last 12 are rendered.
|
|
210
|
+
* @returns The ANSI sparkline string.
|
|
211
|
+
*/
|
|
212
|
+
export function renderTpsSparkline(samples) {
|
|
213
|
+
const vals = samples.slice(-12);
|
|
214
|
+
if (vals.length === 0)
|
|
215
|
+
return '\x1b[2m' + TRACK.repeat(12) + '\x1b[22m';
|
|
216
|
+
let min = Infinity;
|
|
217
|
+
let max = 0;
|
|
218
|
+
for (const { tps } of vals) {
|
|
219
|
+
if (tps < min)
|
|
220
|
+
min = tps;
|
|
221
|
+
if (tps > max)
|
|
222
|
+
max = tps;
|
|
223
|
+
}
|
|
224
|
+
const range = max - min;
|
|
225
|
+
return vals
|
|
226
|
+
.map(({ tps }) => {
|
|
227
|
+
const norm = range < 1e-6
|
|
228
|
+
? max > 0
|
|
229
|
+
? 4
|
|
230
|
+
: 0
|
|
231
|
+
: Math.min(7, Math.max(0, Math.round(((tps - min) / range) * 7)));
|
|
232
|
+
return speedColor(tps, BLOCKS[norm] ?? '▁');
|
|
233
|
+
})
|
|
234
|
+
.join('');
|
|
235
|
+
}
|
|
236
|
+
/** Rolling stats: 60s average, all-time mean and p95.
|
|
237
|
+
* @param samples - Turn TPS samples with their timestamps in milliseconds.
|
|
238
|
+
* @param nowMs - Current time in milliseconds; the 60s rolling window keeps samples with `nowMs - at <= 60_000`.
|
|
239
|
+
* @returns The 60s average, all-time mean, and all-time p95 (all zero for an empty sample list).
|
|
240
|
+
*/
|
|
241
|
+
export function tpsStats(samples, nowMs) {
|
|
242
|
+
if (samples.length === 0)
|
|
243
|
+
return { avg: 0, mean: 0, p95: 0 };
|
|
244
|
+
const window = samples.filter(sample => nowMs - sample.at <= 60_000);
|
|
245
|
+
const avg = window.length > 0
|
|
246
|
+
? window.reduce((sum, sample) => sum + sample.tps, 0) / window.length
|
|
247
|
+
: 0;
|
|
248
|
+
const mean = samples.reduce((sum, sample) => sum + sample.tps, 0) / samples.length;
|
|
249
|
+
const sorted = [...samples].map(sample => sample.tps).sort((a, b) => a - b);
|
|
250
|
+
const p95 = sorted[Math.min(sorted.length - 1, Math.ceil(sorted.length * 0.95) - 1)] ?? 0;
|
|
251
|
+
return { avg, mean, p95 };
|
|
252
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** One persisted session as the `/resume` picker lists it. */
|
|
2
|
+
export interface SessionRecord {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
cwd: string;
|
|
6
|
+
createdAt: number;
|
|
7
|
+
updatedAt: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Store the session to resume and report the launcher invocation.
|
|
11
|
+
* @param sessionId - Session id for `dsh-tui --resume` on the next launch.
|
|
12
|
+
*/
|
|
13
|
+
export declare function writeResumeTarget(sessionId: string): void;
|
|
14
|
+
/** Forget the resume marker (`/new` starts a fresh conversation). */
|
|
15
|
+
export declare function clearResumeTarget(): void;
|
|
16
|
+
/**
|
|
17
|
+
* The session id requested by `dsh-tui --resume`, if any.
|
|
18
|
+
* @returns The stored session id, or undefined when none is set.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readResumeTarget(): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Session-id → last-used epoch ms map for MRU ordering.
|
|
23
|
+
* @returns The parsed map; best effort, an unreadable file yields {}.
|
|
24
|
+
*/
|
|
25
|
+
export declare function readLastUsed(): Readonly<Record<string, number>>;
|
|
26
|
+
/**
|
|
27
|
+
* Record that a session was just used (resumed or written to) so `/resume`
|
|
28
|
+
* can sort most-recently-used first. Best effort — never throws.
|
|
29
|
+
* @param sessionId - Session id to touch.
|
|
30
|
+
*/
|
|
31
|
+
export declare function touchSession(sessionId: string): void;
|
|
32
|
+
//# sourceMappingURL=sessionHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionHistory.d.ts","sourceRoot":"","sources":["../../src/sessionHistory.ts"],"names":[],"mappings":"AAcA,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAUD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGzD;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAOrD;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAiB/D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAQpD"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Launcher contract for `dsh-tui --resume`: the TUI writes the chosen session
|
|
3
|
+
* id to `~/.dsh-cc/resume.txt`, and the launcher feeds it back as
|
|
4
|
+
* `DSH_CC_RESUME_SESSION`. Session *records* live in DSH's own persistence
|
|
5
|
+
* backend (dsh-session-persistence-jsonl) — `/resume` lists those via
|
|
6
|
+
* `sessionPersistence.list()`, this file only carries the id across
|
|
7
|
+
* processes. It also keeps a small `last-used.json` of session-id → epoch-ms
|
|
8
|
+
* touches so `/resume` can sort most-recently-used first (DSH session
|
|
9
|
+
* headers carry only `createdAt`).
|
|
10
|
+
*/
|
|
11
|
+
import { homedir } from 'node:os';
|
|
12
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import { join } from 'node:path';
|
|
14
|
+
const DIR = join(homedir(), '.dsh-cc');
|
|
15
|
+
const RESUME_FILE = join(DIR, 'resume.txt');
|
|
16
|
+
const LAST_USED_FILE = join(DIR, 'last-used.json');
|
|
17
|
+
function ensureDir() {
|
|
18
|
+
mkdirSync(DIR, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Store the session to resume and report the launcher invocation.
|
|
22
|
+
* @param sessionId - Session id for `dsh-tui --resume` on the next launch.
|
|
23
|
+
*/
|
|
24
|
+
export function writeResumeTarget(sessionId) {
|
|
25
|
+
ensureDir();
|
|
26
|
+
writeFileSync(RESUME_FILE, sessionId);
|
|
27
|
+
}
|
|
28
|
+
/** Forget the resume marker (`/new` starts a fresh conversation). */
|
|
29
|
+
export function clearResumeTarget() {
|
|
30
|
+
try {
|
|
31
|
+
writeFileSync(RESUME_FILE, '');
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// Best effort — the marker is a launcher nicety.
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The session id requested by `dsh-tui --resume`, if any.
|
|
39
|
+
* @returns The stored session id, or undefined when none is set.
|
|
40
|
+
*/
|
|
41
|
+
export function readResumeTarget() {
|
|
42
|
+
try {
|
|
43
|
+
const value = readFileSync(RESUME_FILE, 'utf8').trim();
|
|
44
|
+
return value || undefined;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Session-id → last-used epoch ms map for MRU ordering.
|
|
52
|
+
* @returns The parsed map; best effort, an unreadable file yields {}.
|
|
53
|
+
*/
|
|
54
|
+
export function readLastUsed() {
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(readFileSync(LAST_USED_FILE, 'utf8'));
|
|
57
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
const record = parsed;
|
|
61
|
+
const result = {};
|
|
62
|
+
for (const [id, value] of Object.entries(record)) {
|
|
63
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
64
|
+
result[id] = value;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Record that a session was just used (resumed or written to) so `/resume`
|
|
75
|
+
* can sort most-recently-used first. Best effort — never throws.
|
|
76
|
+
* @param sessionId - Session id to touch.
|
|
77
|
+
*/
|
|
78
|
+
export function touchSession(sessionId) {
|
|
79
|
+
try {
|
|
80
|
+
ensureDir();
|
|
81
|
+
const lastUsed = { ...readLastUsed(), [sessionId]: Date.now() };
|
|
82
|
+
writeFileSync(LAST_USED_FILE, JSON.stringify(lastUsed));
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Best effort — MRU ordering is a nicety.
|
|
86
|
+
}
|
|
87
|
+
}
|