@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,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SGR (Select Graphic Rendition) Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses SGR parameters and applies them to a TextStyle.
|
|
5
|
+
* Handles both semicolon (;) and colon (:) separated parameters.
|
|
6
|
+
*/
|
|
7
|
+
import { defaultStyle } from './types.js';
|
|
8
|
+
const NAMED_COLORS = [
|
|
9
|
+
'black',
|
|
10
|
+
'red',
|
|
11
|
+
'green',
|
|
12
|
+
'yellow',
|
|
13
|
+
'blue',
|
|
14
|
+
'magenta',
|
|
15
|
+
'cyan',
|
|
16
|
+
'white',
|
|
17
|
+
'brightBlack',
|
|
18
|
+
'brightRed',
|
|
19
|
+
'brightGreen',
|
|
20
|
+
'brightYellow',
|
|
21
|
+
'brightBlue',
|
|
22
|
+
'brightMagenta',
|
|
23
|
+
'brightCyan',
|
|
24
|
+
'brightWhite',
|
|
25
|
+
];
|
|
26
|
+
const UNDERLINE_STYLES = [
|
|
27
|
+
'none',
|
|
28
|
+
'single',
|
|
29
|
+
'double',
|
|
30
|
+
'curly',
|
|
31
|
+
'dotted',
|
|
32
|
+
'dashed',
|
|
33
|
+
];
|
|
34
|
+
function parseParams(str) {
|
|
35
|
+
if (str === '')
|
|
36
|
+
return [{ value: 0, subparams: [], colon: false }];
|
|
37
|
+
const result = [];
|
|
38
|
+
let current = { value: null, subparams: [], colon: false };
|
|
39
|
+
let num = '';
|
|
40
|
+
let inSub = false;
|
|
41
|
+
for (let i = 0; i <= str.length; i++) {
|
|
42
|
+
const c = str[i];
|
|
43
|
+
if (c === ';' || c === undefined) {
|
|
44
|
+
const n = num === '' ? null : parseInt(num, 10);
|
|
45
|
+
if (inSub) {
|
|
46
|
+
if (n !== null)
|
|
47
|
+
current.subparams.push(n);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
current.value = n;
|
|
51
|
+
}
|
|
52
|
+
result.push(current);
|
|
53
|
+
current = { value: null, subparams: [], colon: false };
|
|
54
|
+
num = '';
|
|
55
|
+
inSub = false;
|
|
56
|
+
}
|
|
57
|
+
else if (c === ':') {
|
|
58
|
+
const n = num === '' ? null : parseInt(num, 10);
|
|
59
|
+
if (!inSub) {
|
|
60
|
+
current.value = n;
|
|
61
|
+
current.colon = true;
|
|
62
|
+
inSub = true;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
if (n !== null)
|
|
66
|
+
current.subparams.push(n);
|
|
67
|
+
}
|
|
68
|
+
num = '';
|
|
69
|
+
}
|
|
70
|
+
else if (c >= '0' && c <= '9') {
|
|
71
|
+
num += c;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
function parseExtendedColor(params, idx) {
|
|
77
|
+
const p = params[idx];
|
|
78
|
+
if (!p)
|
|
79
|
+
return null;
|
|
80
|
+
if (p.colon && p.subparams.length >= 1) {
|
|
81
|
+
if (p.subparams[0] === 5 && p.subparams.length >= 2) {
|
|
82
|
+
return { index: p.subparams[1] };
|
|
83
|
+
}
|
|
84
|
+
if (p.subparams[0] === 2 && p.subparams.length >= 4) {
|
|
85
|
+
const off = p.subparams.length >= 5 ? 1 : 0;
|
|
86
|
+
return {
|
|
87
|
+
r: p.subparams[1 + off],
|
|
88
|
+
g: p.subparams[2 + off],
|
|
89
|
+
b: p.subparams[3 + off],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const next = params[idx + 1];
|
|
94
|
+
if (!next)
|
|
95
|
+
return null;
|
|
96
|
+
if (next.value === 5 &&
|
|
97
|
+
params[idx + 2]?.value !== null &&
|
|
98
|
+
params[idx + 2]?.value !== undefined) {
|
|
99
|
+
return { index: params[idx + 2].value };
|
|
100
|
+
}
|
|
101
|
+
if (next.value === 2) {
|
|
102
|
+
const r = params[idx + 2]?.value;
|
|
103
|
+
const g = params[idx + 3]?.value;
|
|
104
|
+
const b = params[idx + 4]?.value;
|
|
105
|
+
if (r !== null &&
|
|
106
|
+
r !== undefined &&
|
|
107
|
+
g !== null &&
|
|
108
|
+
g !== undefined &&
|
|
109
|
+
b !== null &&
|
|
110
|
+
b !== undefined) {
|
|
111
|
+
return { r, g, b };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Apply an SGR parameter string to a text style.
|
|
118
|
+
* Handles both semicolon (;) and colon (:) separated parameters.
|
|
119
|
+
* @param paramStr - the SGR parameter string (without the CSI prefix or final m).
|
|
120
|
+
* @param style - the style to apply the parameters to.
|
|
121
|
+
* @returns the resulting style; code 0 resets to the default style, other
|
|
122
|
+
* codes update the corresponding attribute of a copy.
|
|
123
|
+
*/
|
|
124
|
+
export function applySGR(paramStr, style) {
|
|
125
|
+
const params = parseParams(paramStr);
|
|
126
|
+
let s = { ...style };
|
|
127
|
+
let i = 0;
|
|
128
|
+
while (i < params.length) {
|
|
129
|
+
const p = params[i];
|
|
130
|
+
const code = p.value ?? 0;
|
|
131
|
+
if (code === 0) {
|
|
132
|
+
s = defaultStyle();
|
|
133
|
+
i++;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (code === 1) {
|
|
137
|
+
s.bold = true;
|
|
138
|
+
i++;
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (code === 2) {
|
|
142
|
+
s.dim = true;
|
|
143
|
+
i++;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (code === 3) {
|
|
147
|
+
s.italic = true;
|
|
148
|
+
i++;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (code === 4) {
|
|
152
|
+
s.underline = p.colon
|
|
153
|
+
? (UNDERLINE_STYLES[p.subparams[0]] ?? 'single')
|
|
154
|
+
: 'single';
|
|
155
|
+
i++;
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (code === 5 || code === 6) {
|
|
159
|
+
s.blink = true;
|
|
160
|
+
i++;
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (code === 7) {
|
|
164
|
+
s.inverse = true;
|
|
165
|
+
i++;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (code === 8) {
|
|
169
|
+
s.hidden = true;
|
|
170
|
+
i++;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (code === 9) {
|
|
174
|
+
s.strikethrough = true;
|
|
175
|
+
i++;
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (code === 21) {
|
|
179
|
+
s.underline = 'double';
|
|
180
|
+
i++;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (code === 22) {
|
|
184
|
+
s.bold = false;
|
|
185
|
+
s.dim = false;
|
|
186
|
+
i++;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (code === 23) {
|
|
190
|
+
s.italic = false;
|
|
191
|
+
i++;
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (code === 24) {
|
|
195
|
+
s.underline = 'none';
|
|
196
|
+
i++;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (code === 25) {
|
|
200
|
+
s.blink = false;
|
|
201
|
+
i++;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (code === 27) {
|
|
205
|
+
s.inverse = false;
|
|
206
|
+
i++;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (code === 28) {
|
|
210
|
+
s.hidden = false;
|
|
211
|
+
i++;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (code === 29) {
|
|
215
|
+
s.strikethrough = false;
|
|
216
|
+
i++;
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
if (code === 53) {
|
|
220
|
+
s.overline = true;
|
|
221
|
+
i++;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (code === 55) {
|
|
225
|
+
s.overline = false;
|
|
226
|
+
i++;
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (code >= 30 && code <= 37) {
|
|
230
|
+
s.fg = { type: 'named', name: NAMED_COLORS[code - 30] };
|
|
231
|
+
i++;
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
if (code === 39) {
|
|
235
|
+
s.fg = { type: 'default' };
|
|
236
|
+
i++;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
if (code >= 40 && code <= 47) {
|
|
240
|
+
s.bg = { type: 'named', name: NAMED_COLORS[code - 40] };
|
|
241
|
+
i++;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (code === 49) {
|
|
245
|
+
s.bg = { type: 'default' };
|
|
246
|
+
i++;
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
if (code >= 90 && code <= 97) {
|
|
250
|
+
s.fg = { type: 'named', name: NAMED_COLORS[code - 90 + 8] };
|
|
251
|
+
i++;
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (code >= 100 && code <= 107) {
|
|
255
|
+
s.bg = { type: 'named', name: NAMED_COLORS[code - 100 + 8] };
|
|
256
|
+
i++;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (code === 38) {
|
|
260
|
+
const c = parseExtendedColor(params, i);
|
|
261
|
+
if (c) {
|
|
262
|
+
s.fg =
|
|
263
|
+
'index' in c
|
|
264
|
+
? { type: 'indexed', index: c.index }
|
|
265
|
+
: { type: 'rgb', ...c };
|
|
266
|
+
i += p.colon ? 1 : 'index' in c ? 3 : 5;
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (code === 48) {
|
|
271
|
+
const c = parseExtendedColor(params, i);
|
|
272
|
+
if (c) {
|
|
273
|
+
s.bg =
|
|
274
|
+
'index' in c
|
|
275
|
+
? { type: 'indexed', index: c.index }
|
|
276
|
+
: { type: 'rgb', ...c };
|
|
277
|
+
i += p.colon ? 1 : 'index' in c ? 3 : 5;
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (code === 58) {
|
|
282
|
+
const c = parseExtendedColor(params, i);
|
|
283
|
+
if (c) {
|
|
284
|
+
s.underlineColor =
|
|
285
|
+
'index' in c
|
|
286
|
+
? { type: 'indexed', index: c.index }
|
|
287
|
+
: { type: 'rgb', ...c };
|
|
288
|
+
i += p.colon ? 1 : 'index' in c ? 3 : 5;
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (code === 59) {
|
|
293
|
+
s.underlineColor = { type: 'default' };
|
|
294
|
+
i++;
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
i++;
|
|
298
|
+
}
|
|
299
|
+
return s;
|
|
300
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input Tokenizer - Escape sequence boundary detection
|
|
3
|
+
*
|
|
4
|
+
* Splits terminal input into tokens: text chunks and raw escape sequences.
|
|
5
|
+
* Unlike the Parser which interprets sequences semantically, this just
|
|
6
|
+
* identifies boundaries for use by keyboard input parsing.
|
|
7
|
+
*/
|
|
8
|
+
/** A chunk of terminal input: plain text or a raw escape sequence. */
|
|
9
|
+
export type Token = {
|
|
10
|
+
type: 'text';
|
|
11
|
+
value: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'sequence';
|
|
14
|
+
value: string;
|
|
15
|
+
};
|
|
16
|
+
/** Streaming tokenizer for terminal input, buffering incomplete sequences. */
|
|
17
|
+
export type Tokenizer = {
|
|
18
|
+
/** Feed input and get resulting tokens */
|
|
19
|
+
feed(input: string): Token[];
|
|
20
|
+
/** Flush any buffered incomplete sequences */
|
|
21
|
+
flush(): Token[];
|
|
22
|
+
/** Reset tokenizer state */
|
|
23
|
+
reset(): void;
|
|
24
|
+
/** Get any buffered incomplete sequence */
|
|
25
|
+
buffer(): string;
|
|
26
|
+
};
|
|
27
|
+
type TokenizerOptions = {
|
|
28
|
+
/**
|
|
29
|
+
* Treat `CSI M` as an X10 mouse event prefix and consume 3 payload bytes.
|
|
30
|
+
* Only enable for stdin input — `\x1b[M` is also CSI DL (Delete Lines) in
|
|
31
|
+
* output streams, and enabling this there swallows display text. Default false.
|
|
32
|
+
*/
|
|
33
|
+
x10Mouse?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Create a streaming tokenizer for terminal input.
|
|
37
|
+
*
|
|
38
|
+
* Usage:
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const tokenizer = createTokenizer()
|
|
41
|
+
* const tokens1 = tokenizer.feed('hello\x1b[')
|
|
42
|
+
* const tokens2 = tokenizer.feed('A') // completes the escape sequence
|
|
43
|
+
* const remaining = tokenizer.flush() // force output incomplete sequences
|
|
44
|
+
* ```
|
|
45
|
+
* @param options - tokenizer options; when omitted all defaults apply.
|
|
46
|
+
* @returns the tokenizer instance.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createTokenizer(options?: TokenizerOptions): Tokenizer;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=tokenize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenize.d.ts","sourceRoot":"","sources":["../../../../src/ink/termio/tokenize.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,sEAAsE;AACtE,MAAM,MAAM,KAAK,GACb;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAYvC,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG;IACtB,0CAA0C;IAC1C,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,CAAA;IAC5B,8CAA8C;IAC9C,KAAK,IAAI,KAAK,EAAE,CAAA;IAChB,4BAA4B;IAC5B,KAAK,IAAI,IAAI,CAAA;IACb,2CAA2C;IAC3C,MAAM,IAAI,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAmCrE"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input Tokenizer - Escape sequence boundary detection
|
|
3
|
+
*
|
|
4
|
+
* Splits terminal input into tokens: text chunks and raw escape sequences.
|
|
5
|
+
* Unlike the Parser which interprets sequences semantically, this just
|
|
6
|
+
* identifies boundaries for use by keyboard input parsing.
|
|
7
|
+
*/
|
|
8
|
+
import { C0, ESC_TYPE, isEscFinal } from './ansi.js';
|
|
9
|
+
import { isCSIFinal, isCSIIntermediate, isCSIParam } from './csi.js';
|
|
10
|
+
/**
|
|
11
|
+
* Create a streaming tokenizer for terminal input.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const tokenizer = createTokenizer()
|
|
16
|
+
* const tokens1 = tokenizer.feed('hello\x1b[')
|
|
17
|
+
* const tokens2 = tokenizer.feed('A') // completes the escape sequence
|
|
18
|
+
* const remaining = tokenizer.flush() // force output incomplete sequences
|
|
19
|
+
* ```
|
|
20
|
+
* @param options - tokenizer options; when omitted all defaults apply.
|
|
21
|
+
* @returns the tokenizer instance.
|
|
22
|
+
*/
|
|
23
|
+
export function createTokenizer(options) {
|
|
24
|
+
let currentState = 'ground';
|
|
25
|
+
let currentBuffer = '';
|
|
26
|
+
const x10Mouse = options?.x10Mouse ?? false;
|
|
27
|
+
return {
|
|
28
|
+
feed(input) {
|
|
29
|
+
const result = tokenize(input, currentState, currentBuffer, false, x10Mouse);
|
|
30
|
+
currentState = result.state.state;
|
|
31
|
+
currentBuffer = result.state.buffer;
|
|
32
|
+
return result.tokens;
|
|
33
|
+
},
|
|
34
|
+
flush() {
|
|
35
|
+
const result = tokenize('', currentState, currentBuffer, true, x10Mouse);
|
|
36
|
+
currentState = result.state.state;
|
|
37
|
+
currentBuffer = result.state.buffer;
|
|
38
|
+
return result.tokens;
|
|
39
|
+
},
|
|
40
|
+
reset() {
|
|
41
|
+
currentState = 'ground';
|
|
42
|
+
currentBuffer = '';
|
|
43
|
+
},
|
|
44
|
+
buffer() {
|
|
45
|
+
return currentBuffer;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function tokenize(input, initialState, initialBuffer, flush, x10Mouse) {
|
|
50
|
+
const tokens = [];
|
|
51
|
+
const result = {
|
|
52
|
+
state: initialState,
|
|
53
|
+
buffer: '',
|
|
54
|
+
};
|
|
55
|
+
const data = initialBuffer + input;
|
|
56
|
+
let i = 0;
|
|
57
|
+
let textStart = 0;
|
|
58
|
+
let seqStart = 0;
|
|
59
|
+
const flushText = () => {
|
|
60
|
+
if (i > textStart) {
|
|
61
|
+
const text = data.slice(textStart, i);
|
|
62
|
+
if (text) {
|
|
63
|
+
tokens.push({ type: 'text', value: text });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
textStart = i;
|
|
67
|
+
};
|
|
68
|
+
const emitSequence = (seq) => {
|
|
69
|
+
if (seq) {
|
|
70
|
+
tokens.push({ type: 'sequence', value: seq });
|
|
71
|
+
}
|
|
72
|
+
result.state = 'ground';
|
|
73
|
+
textStart = i;
|
|
74
|
+
};
|
|
75
|
+
while (i < data.length) {
|
|
76
|
+
const code = data.charCodeAt(i);
|
|
77
|
+
switch (result.state) {
|
|
78
|
+
case 'ground':
|
|
79
|
+
if (code === C0.ESC) {
|
|
80
|
+
flushText();
|
|
81
|
+
seqStart = i;
|
|
82
|
+
result.state = 'escape';
|
|
83
|
+
i++;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
i++;
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case 'escape':
|
|
90
|
+
if (code === ESC_TYPE.CSI) {
|
|
91
|
+
result.state = 'csi';
|
|
92
|
+
i++;
|
|
93
|
+
}
|
|
94
|
+
else if (code === ESC_TYPE.OSC) {
|
|
95
|
+
result.state = 'osc';
|
|
96
|
+
i++;
|
|
97
|
+
}
|
|
98
|
+
else if (code === ESC_TYPE.DCS) {
|
|
99
|
+
result.state = 'dcs';
|
|
100
|
+
i++;
|
|
101
|
+
}
|
|
102
|
+
else if (code === ESC_TYPE.APC) {
|
|
103
|
+
result.state = 'apc';
|
|
104
|
+
i++;
|
|
105
|
+
}
|
|
106
|
+
else if (code === 0x4f) {
|
|
107
|
+
// 'O' - SS3
|
|
108
|
+
result.state = 'ss3';
|
|
109
|
+
i++;
|
|
110
|
+
}
|
|
111
|
+
else if (isCSIIntermediate(code)) {
|
|
112
|
+
// Intermediate byte (e.g., ESC ( for charset) - continue buffering
|
|
113
|
+
result.state = 'escapeIntermediate';
|
|
114
|
+
i++;
|
|
115
|
+
}
|
|
116
|
+
else if (isEscFinal(code)) {
|
|
117
|
+
// Two-character escape sequence
|
|
118
|
+
i++;
|
|
119
|
+
emitSequence(data.slice(seqStart, i));
|
|
120
|
+
}
|
|
121
|
+
else if (code === C0.ESC) {
|
|
122
|
+
// Double escape - emit first, start new
|
|
123
|
+
emitSequence(data.slice(seqStart, i));
|
|
124
|
+
seqStart = i;
|
|
125
|
+
result.state = 'escape';
|
|
126
|
+
i++;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
// Invalid - treat ESC as text
|
|
130
|
+
result.state = 'ground';
|
|
131
|
+
textStart = seqStart;
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
case 'escapeIntermediate':
|
|
135
|
+
// After intermediate byte(s), wait for final byte
|
|
136
|
+
if (isCSIIntermediate(code)) {
|
|
137
|
+
// More intermediate bytes
|
|
138
|
+
i++;
|
|
139
|
+
}
|
|
140
|
+
else if (isEscFinal(code)) {
|
|
141
|
+
// Final byte - complete the sequence
|
|
142
|
+
i++;
|
|
143
|
+
emitSequence(data.slice(seqStart, i));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
// Invalid - treat as text
|
|
147
|
+
result.state = 'ground';
|
|
148
|
+
textStart = seqStart;
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
151
|
+
case 'csi':
|
|
152
|
+
// X10 mouse: CSI M + 3 raw payload bytes (Cb+32, Cx+32, Cy+32).
|
|
153
|
+
// M immediately after [ (offset 2) means no params — SGR mouse
|
|
154
|
+
// (CSI < … M) has a `<` param byte first and reaches M at offset > 2.
|
|
155
|
+
// Terminals that ignore DECSET 1006 but honor 1000/1002 emit this
|
|
156
|
+
// legacy encoding; without this branch the 3 payload bytes leak
|
|
157
|
+
// through as text (`` `rK `` / `arK` garbage in the prompt).
|
|
158
|
+
//
|
|
159
|
+
// Gated on x10Mouse — `\x1b[M` is also CSI DL (Delete Lines) and
|
|
160
|
+
// blindly consuming 3 chars corrupts output rendering (Parser/Ansi)
|
|
161
|
+
// and fragments bracketed-paste PASTE_END. Only stdin enables this.
|
|
162
|
+
// The ≥0x20 check on each payload slot is belt-and-suspenders: X10
|
|
163
|
+
// guarantees Cb≥32, Cx≥33, Cy≥33, so a control byte (ESC=0x1B) in
|
|
164
|
+
// any slot means this is CSI DL adjacent to another sequence, not a
|
|
165
|
+
// mouse event. Checking all three slots prevents PASTE_END's ESC
|
|
166
|
+
// from being consumed when paste content ends in `\x1b[M`+0-2 chars.
|
|
167
|
+
//
|
|
168
|
+
// Known limitation: this counts JS string chars, but X10 is byte-
|
|
169
|
+
// oriented and stdin uses utf8 encoding (App.tsx). At col 162-191 ×
|
|
170
|
+
// row 96-159 the two coord bytes (0xC2-0xDF, 0x80-0xBF) form a valid
|
|
171
|
+
// UTF-8 2-byte sequence and collapse to one char — the length check
|
|
172
|
+
// fails and the event buffers until the next keypress absorbs it.
|
|
173
|
+
// Fixing this requires latin1 stdin; X10's 223-coord cap is exactly
|
|
174
|
+
// why SGR was invented, and no-SGR terminals at 162+ cols are rare.
|
|
175
|
+
if (x10Mouse &&
|
|
176
|
+
code === 0x4d /* M */ &&
|
|
177
|
+
i - seqStart === 2 &&
|
|
178
|
+
(i + 1 >= data.length || data.charCodeAt(i + 1) >= 0x20) &&
|
|
179
|
+
(i + 2 >= data.length || data.charCodeAt(i + 2) >= 0x20) &&
|
|
180
|
+
(i + 3 >= data.length || data.charCodeAt(i + 3) >= 0x20)) {
|
|
181
|
+
if (i + 4 <= data.length) {
|
|
182
|
+
i += 4;
|
|
183
|
+
emitSequence(data.slice(seqStart, i));
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
// Incomplete — exit loop; end-of-input buffers from seqStart.
|
|
187
|
+
// Re-entry re-tokenizes from ground via the invalid-CSI fallthrough.
|
|
188
|
+
i = data.length;
|
|
189
|
+
}
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
if (isCSIFinal(code)) {
|
|
193
|
+
i++;
|
|
194
|
+
emitSequence(data.slice(seqStart, i));
|
|
195
|
+
}
|
|
196
|
+
else if (isCSIParam(code) || isCSIIntermediate(code)) {
|
|
197
|
+
i++;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
// Invalid CSI - abort, treat as text
|
|
201
|
+
result.state = 'ground';
|
|
202
|
+
textStart = seqStart;
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
case 'ss3':
|
|
206
|
+
// SS3 sequences: ESC O followed by a single final byte
|
|
207
|
+
if (code >= 0x40 && code <= 0x7e) {
|
|
208
|
+
i++;
|
|
209
|
+
emitSequence(data.slice(seqStart, i));
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
// Invalid - treat as text
|
|
213
|
+
result.state = 'ground';
|
|
214
|
+
textStart = seqStart;
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
case 'osc':
|
|
218
|
+
if (code === C0.BEL) {
|
|
219
|
+
i++;
|
|
220
|
+
emitSequence(data.slice(seqStart, i));
|
|
221
|
+
}
|
|
222
|
+
else if (code === C0.ESC &&
|
|
223
|
+
i + 1 < data.length &&
|
|
224
|
+
data.charCodeAt(i + 1) === ESC_TYPE.ST) {
|
|
225
|
+
i += 2;
|
|
226
|
+
emitSequence(data.slice(seqStart, i));
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
i++;
|
|
230
|
+
}
|
|
231
|
+
break;
|
|
232
|
+
case 'dcs':
|
|
233
|
+
case 'apc':
|
|
234
|
+
if (code === C0.BEL) {
|
|
235
|
+
i++;
|
|
236
|
+
emitSequence(data.slice(seqStart, i));
|
|
237
|
+
}
|
|
238
|
+
else if (code === C0.ESC &&
|
|
239
|
+
i + 1 < data.length &&
|
|
240
|
+
data.charCodeAt(i + 1) === ESC_TYPE.ST) {
|
|
241
|
+
i += 2;
|
|
242
|
+
emitSequence(data.slice(seqStart, i));
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
i++;
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// Handle end of input
|
|
251
|
+
if (result.state === 'ground') {
|
|
252
|
+
flushText();
|
|
253
|
+
}
|
|
254
|
+
else if (flush) {
|
|
255
|
+
// Force output incomplete sequence
|
|
256
|
+
const remaining = data.slice(seqStart);
|
|
257
|
+
if (remaining)
|
|
258
|
+
tokens.push({ type: 'sequence', value: remaining });
|
|
259
|
+
result.state = 'ground';
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
// Buffer incomplete sequence for next call
|
|
263
|
+
result.buffer = data.slice(seqStart);
|
|
264
|
+
}
|
|
265
|
+
return { tokens, state: result };
|
|
266
|
+
}
|