@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,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI Parser - Semantic Action Generator
|
|
3
|
+
*
|
|
4
|
+
* A streaming parser for ANSI escape sequences that produces semantic actions.
|
|
5
|
+
* Uses the tokenizer for escape sequence boundary detection, then interprets
|
|
6
|
+
* each sequence to produce structured actions.
|
|
7
|
+
*
|
|
8
|
+
* Key design decisions:
|
|
9
|
+
* - Streaming: can process input incrementally
|
|
10
|
+
* - Semantic output: produces structured actions, not string tokens
|
|
11
|
+
* - Style tracking: maintains current text style state
|
|
12
|
+
*/
|
|
13
|
+
import type { Action, TextStyle } from './types.js';
|
|
14
|
+
/**
|
|
15
|
+
* Parser class - maintains state for streaming/incremental parsing
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const parser = new Parser()
|
|
20
|
+
* const actions1 = parser.feed('partial\x1b[')
|
|
21
|
+
* const actions2 = parser.feed('31mred') // state maintained internally
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class Parser {
|
|
25
|
+
private tokenizer;
|
|
26
|
+
/** Current text style, updated as SGR sequences are applied. */
|
|
27
|
+
style: TextStyle;
|
|
28
|
+
/** Whether the parser is currently inside an OSC 8 hyperlink. */
|
|
29
|
+
inLink: boolean;
|
|
30
|
+
/** URL of the active OSC 8 hyperlink; undefined when not in a link. */
|
|
31
|
+
linkUrl: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Reset all parser state: tokenizer buffer, text style, and link state.
|
|
34
|
+
*/
|
|
35
|
+
reset(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Feed input and get the resulting actions.
|
|
38
|
+
* @param input - the input chunk to process.
|
|
39
|
+
* @returns the semantic actions produced by this chunk.
|
|
40
|
+
*/
|
|
41
|
+
feed(input: string): Action[];
|
|
42
|
+
private processToken;
|
|
43
|
+
private processText;
|
|
44
|
+
private processSequence;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/ink/termio/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,OAAO,KAAK,EAAE,MAAM,EAAY,SAAS,EAAE,MAAM,YAAY,CAAA;AAgP7D;;;;;;;;;GASG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,SAAS,CAA+B;IAEhD,gEAAgE;IAChE,KAAK,EAAE,SAAS,CAAiB;IAEjC,iEAAiE;IACjE,MAAM,UAAQ;IAEd,uEAAuE;IACvE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAE3B;;OAEG;IACH,KAAK,IAAI,IAAI;IAOb;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAY7B,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,WAAW;IA8BnB,OAAO,CAAC,eAAe;CAuDxB"}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI Parser - Semantic Action Generator
|
|
3
|
+
*
|
|
4
|
+
* A streaming parser for ANSI escape sequences that produces semantic actions.
|
|
5
|
+
* Uses the tokenizer for escape sequence boundary detection, then interprets
|
|
6
|
+
* each sequence to produce structured actions.
|
|
7
|
+
*
|
|
8
|
+
* Key design decisions:
|
|
9
|
+
* - Streaming: can process input incrementally
|
|
10
|
+
* - Semantic output: produces structured actions, not string tokens
|
|
11
|
+
* - Style tracking: maintains current text style state
|
|
12
|
+
*/
|
|
13
|
+
import { getGraphemeSegmenter } from '../../utils/intl.js';
|
|
14
|
+
import { C0 } from './ansi.js';
|
|
15
|
+
import { CSI, CURSOR_STYLES, ERASE_DISPLAY, ERASE_LINE_REGION } from './csi.js';
|
|
16
|
+
import { DEC } from './dec.js';
|
|
17
|
+
import { parseEsc } from './esc.js';
|
|
18
|
+
import { parseOSC } from './osc.js';
|
|
19
|
+
import { applySGR } from './sgr.js';
|
|
20
|
+
import { createTokenizer } from './tokenize.js';
|
|
21
|
+
import { defaultStyle } from './types.js';
|
|
22
|
+
// =============================================================================
|
|
23
|
+
// Grapheme Utilities
|
|
24
|
+
// =============================================================================
|
|
25
|
+
function isEmoji(codePoint) {
|
|
26
|
+
return ((codePoint >= 0x2600 && codePoint <= 0x26ff) ||
|
|
27
|
+
(codePoint >= 0x2700 && codePoint <= 0x27bf) ||
|
|
28
|
+
(codePoint >= 0x1f300 && codePoint <= 0x1f9ff) ||
|
|
29
|
+
(codePoint >= 0x1fa00 && codePoint <= 0x1faff) ||
|
|
30
|
+
(codePoint >= 0x1f1e0 && codePoint <= 0x1f1ff));
|
|
31
|
+
}
|
|
32
|
+
function isEastAsianWide(codePoint) {
|
|
33
|
+
return ((codePoint >= 0x1100 && codePoint <= 0x115f) ||
|
|
34
|
+
(codePoint >= 0x2e80 && codePoint <= 0x9fff) ||
|
|
35
|
+
(codePoint >= 0xac00 && codePoint <= 0xd7a3) ||
|
|
36
|
+
(codePoint >= 0xf900 && codePoint <= 0xfaff) ||
|
|
37
|
+
(codePoint >= 0xfe10 && codePoint <= 0xfe1f) ||
|
|
38
|
+
(codePoint >= 0xfe30 && codePoint <= 0xfe6f) ||
|
|
39
|
+
(codePoint >= 0xff00 && codePoint <= 0xff60) ||
|
|
40
|
+
(codePoint >= 0xffe0 && codePoint <= 0xffe6) ||
|
|
41
|
+
(codePoint >= 0x20000 && codePoint <= 0x2fffd) ||
|
|
42
|
+
(codePoint >= 0x30000 && codePoint <= 0x3fffd));
|
|
43
|
+
}
|
|
44
|
+
function hasMultipleCodepoints(str) {
|
|
45
|
+
let count = 0;
|
|
46
|
+
for (const _ of str) {
|
|
47
|
+
count++;
|
|
48
|
+
if (count > 1)
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
function graphemeWidth(grapheme) {
|
|
54
|
+
if (hasMultipleCodepoints(grapheme))
|
|
55
|
+
return 2;
|
|
56
|
+
const codePoint = grapheme.codePointAt(0);
|
|
57
|
+
if (codePoint === undefined)
|
|
58
|
+
return 1;
|
|
59
|
+
if (isEmoji(codePoint) || isEastAsianWide(codePoint))
|
|
60
|
+
return 2;
|
|
61
|
+
return 1;
|
|
62
|
+
}
|
|
63
|
+
function* segmentGraphemes(str) {
|
|
64
|
+
for (const { segment } of getGraphemeSegmenter().segment(str)) {
|
|
65
|
+
yield { value: segment, width: graphemeWidth(segment) };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// =============================================================================
|
|
69
|
+
// Sequence Parsing
|
|
70
|
+
// =============================================================================
|
|
71
|
+
function parseCSIParams(paramStr) {
|
|
72
|
+
if (paramStr === '')
|
|
73
|
+
return [];
|
|
74
|
+
return paramStr.split(/[;:]/).map(s => (s === '' ? 0 : parseInt(s, 10)));
|
|
75
|
+
}
|
|
76
|
+
/** Parse a raw CSI sequence (e.g., "\x1b[31m") into an action */
|
|
77
|
+
function parseCSI(rawSequence) {
|
|
78
|
+
const inner = rawSequence.slice(2);
|
|
79
|
+
if (inner.length === 0)
|
|
80
|
+
return null;
|
|
81
|
+
const finalByte = inner.charCodeAt(inner.length - 1);
|
|
82
|
+
const beforeFinal = inner.slice(0, -1);
|
|
83
|
+
let privateMode = '';
|
|
84
|
+
let paramStr = beforeFinal;
|
|
85
|
+
let intermediate = '';
|
|
86
|
+
if (beforeFinal.length > 0 && '?>='.includes(beforeFinal[0])) {
|
|
87
|
+
privateMode = beforeFinal[0];
|
|
88
|
+
paramStr = beforeFinal.slice(1);
|
|
89
|
+
}
|
|
90
|
+
const intermediateMatch = paramStr.match(/([^0-9;:]+)$/);
|
|
91
|
+
if (intermediateMatch) {
|
|
92
|
+
intermediate = intermediateMatch[1];
|
|
93
|
+
paramStr = paramStr.slice(0, -intermediate.length);
|
|
94
|
+
}
|
|
95
|
+
const params = parseCSIParams(paramStr);
|
|
96
|
+
const p0 = params[0] ?? 1;
|
|
97
|
+
const p1 = params[1] ?? 1;
|
|
98
|
+
// SGR (Select Graphic Rendition)
|
|
99
|
+
if (finalByte === CSI.SGR && privateMode === '') {
|
|
100
|
+
return { type: 'sgr', params: paramStr };
|
|
101
|
+
}
|
|
102
|
+
// Cursor movement
|
|
103
|
+
if (finalByte === CSI.CUU) {
|
|
104
|
+
return {
|
|
105
|
+
type: 'cursor',
|
|
106
|
+
action: { type: 'move', direction: 'up', count: p0 },
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (finalByte === CSI.CUD) {
|
|
110
|
+
return {
|
|
111
|
+
type: 'cursor',
|
|
112
|
+
action: { type: 'move', direction: 'down', count: p0 },
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (finalByte === CSI.CUF) {
|
|
116
|
+
return {
|
|
117
|
+
type: 'cursor',
|
|
118
|
+
action: { type: 'move', direction: 'forward', count: p0 },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (finalByte === CSI.CUB) {
|
|
122
|
+
return {
|
|
123
|
+
type: 'cursor',
|
|
124
|
+
action: { type: 'move', direction: 'back', count: p0 },
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (finalByte === CSI.CNL) {
|
|
128
|
+
return { type: 'cursor', action: { type: 'nextLine', count: p0 } };
|
|
129
|
+
}
|
|
130
|
+
if (finalByte === CSI.CPL) {
|
|
131
|
+
return { type: 'cursor', action: { type: 'prevLine', count: p0 } };
|
|
132
|
+
}
|
|
133
|
+
if (finalByte === CSI.CHA) {
|
|
134
|
+
return { type: 'cursor', action: { type: 'column', col: p0 } };
|
|
135
|
+
}
|
|
136
|
+
if (finalByte === CSI.CUP || finalByte === CSI.HVP) {
|
|
137
|
+
return { type: 'cursor', action: { type: 'position', row: p0, col: p1 } };
|
|
138
|
+
}
|
|
139
|
+
if (finalByte === CSI.VPA) {
|
|
140
|
+
return { type: 'cursor', action: { type: 'row', row: p0 } };
|
|
141
|
+
}
|
|
142
|
+
// Erase
|
|
143
|
+
if (finalByte === CSI.ED) {
|
|
144
|
+
const region = ERASE_DISPLAY[params[0] ?? 0] ?? 'toEnd';
|
|
145
|
+
return { type: 'erase', action: { type: 'display', region } };
|
|
146
|
+
}
|
|
147
|
+
if (finalByte === CSI.EL) {
|
|
148
|
+
const region = ERASE_LINE_REGION[params[0] ?? 0] ?? 'toEnd';
|
|
149
|
+
return { type: 'erase', action: { type: 'line', region } };
|
|
150
|
+
}
|
|
151
|
+
if (finalByte === CSI.ECH) {
|
|
152
|
+
return { type: 'erase', action: { type: 'chars', count: p0 } };
|
|
153
|
+
}
|
|
154
|
+
// Scroll
|
|
155
|
+
if (finalByte === CSI.SU) {
|
|
156
|
+
return { type: 'scroll', action: { type: 'up', count: p0 } };
|
|
157
|
+
}
|
|
158
|
+
if (finalByte === CSI.SD) {
|
|
159
|
+
return { type: 'scroll', action: { type: 'down', count: p0 } };
|
|
160
|
+
}
|
|
161
|
+
if (finalByte === CSI.DECSTBM) {
|
|
162
|
+
return {
|
|
163
|
+
type: 'scroll',
|
|
164
|
+
action: { type: 'setRegion', top: p0, bottom: p1 },
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
// Cursor save/restore
|
|
168
|
+
if (finalByte === CSI.SCOSC) {
|
|
169
|
+
return { type: 'cursor', action: { type: 'save' } };
|
|
170
|
+
}
|
|
171
|
+
if (finalByte === CSI.SCORC) {
|
|
172
|
+
return { type: 'cursor', action: { type: 'restore' } };
|
|
173
|
+
}
|
|
174
|
+
// Cursor style
|
|
175
|
+
if (finalByte === CSI.DECSCUSR && intermediate === ' ') {
|
|
176
|
+
const styleInfo = CURSOR_STYLES[p0] ?? CURSOR_STYLES[0];
|
|
177
|
+
return { type: 'cursor', action: { type: 'style', ...styleInfo } };
|
|
178
|
+
}
|
|
179
|
+
// Private modes
|
|
180
|
+
if (privateMode === '?' && (finalByte === CSI.SM || finalByte === CSI.RM)) {
|
|
181
|
+
const enabled = finalByte === CSI.SM;
|
|
182
|
+
if (p0 === DEC.CURSOR_VISIBLE) {
|
|
183
|
+
return {
|
|
184
|
+
type: 'cursor',
|
|
185
|
+
action: enabled ? { type: 'show' } : { type: 'hide' },
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
if (p0 === DEC.ALT_SCREEN_CLEAR || p0 === DEC.ALT_SCREEN) {
|
|
189
|
+
return { type: 'mode', action: { type: 'alternateScreen', enabled } };
|
|
190
|
+
}
|
|
191
|
+
if (p0 === DEC.BRACKETED_PASTE) {
|
|
192
|
+
return { type: 'mode', action: { type: 'bracketedPaste', enabled } };
|
|
193
|
+
}
|
|
194
|
+
if (p0 === DEC.MOUSE_NORMAL) {
|
|
195
|
+
return {
|
|
196
|
+
type: 'mode',
|
|
197
|
+
action: { type: 'mouseTracking', mode: enabled ? 'normal' : 'off' },
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
if (p0 === DEC.MOUSE_BUTTON) {
|
|
201
|
+
return {
|
|
202
|
+
type: 'mode',
|
|
203
|
+
action: { type: 'mouseTracking', mode: enabled ? 'button' : 'off' },
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
if (p0 === DEC.MOUSE_ANY) {
|
|
207
|
+
return {
|
|
208
|
+
type: 'mode',
|
|
209
|
+
action: { type: 'mouseTracking', mode: enabled ? 'any' : 'off' },
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
if (p0 === DEC.FOCUS_EVENTS) {
|
|
213
|
+
return { type: 'mode', action: { type: 'focusEvents', enabled } };
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return { type: 'unknown', sequence: rawSequence };
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Identify the type of escape sequence from its raw form.
|
|
220
|
+
*/
|
|
221
|
+
function identifySequence(seq) {
|
|
222
|
+
if (seq.length < 2)
|
|
223
|
+
return 'unknown';
|
|
224
|
+
if (seq.charCodeAt(0) !== C0.ESC)
|
|
225
|
+
return 'unknown';
|
|
226
|
+
const second = seq.charCodeAt(1);
|
|
227
|
+
if (second === 0x5b)
|
|
228
|
+
return 'csi'; // [
|
|
229
|
+
if (second === 0x5d)
|
|
230
|
+
return 'osc'; // ]
|
|
231
|
+
if (second === 0x4f)
|
|
232
|
+
return 'ss3'; // O
|
|
233
|
+
return 'esc';
|
|
234
|
+
}
|
|
235
|
+
// =============================================================================
|
|
236
|
+
// Main Parser
|
|
237
|
+
// =============================================================================
|
|
238
|
+
/**
|
|
239
|
+
* Parser class - maintains state for streaming/incremental parsing
|
|
240
|
+
*
|
|
241
|
+
* Usage:
|
|
242
|
+
* ```typescript
|
|
243
|
+
* const parser = new Parser()
|
|
244
|
+
* const actions1 = parser.feed('partial\x1b[')
|
|
245
|
+
* const actions2 = parser.feed('31mred') // state maintained internally
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
export class Parser {
|
|
249
|
+
tokenizer = createTokenizer();
|
|
250
|
+
/** Current text style, updated as SGR sequences are applied. */
|
|
251
|
+
style = defaultStyle();
|
|
252
|
+
/** Whether the parser is currently inside an OSC 8 hyperlink. */
|
|
253
|
+
inLink = false;
|
|
254
|
+
/** URL of the active OSC 8 hyperlink; undefined when not in a link. */
|
|
255
|
+
linkUrl;
|
|
256
|
+
/**
|
|
257
|
+
* Reset all parser state: tokenizer buffer, text style, and link state.
|
|
258
|
+
*/
|
|
259
|
+
reset() {
|
|
260
|
+
this.tokenizer.reset();
|
|
261
|
+
this.style = defaultStyle();
|
|
262
|
+
this.inLink = false;
|
|
263
|
+
this.linkUrl = undefined;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Feed input and get the resulting actions.
|
|
267
|
+
* @param input - the input chunk to process.
|
|
268
|
+
* @returns the semantic actions produced by this chunk.
|
|
269
|
+
*/
|
|
270
|
+
feed(input) {
|
|
271
|
+
const tokens = this.tokenizer.feed(input);
|
|
272
|
+
const actions = [];
|
|
273
|
+
for (const token of tokens) {
|
|
274
|
+
const tokenActions = this.processToken(token);
|
|
275
|
+
actions.push(...tokenActions);
|
|
276
|
+
}
|
|
277
|
+
return actions;
|
|
278
|
+
}
|
|
279
|
+
processToken(token) {
|
|
280
|
+
switch (token.type) {
|
|
281
|
+
case 'text':
|
|
282
|
+
return this.processText(token.value);
|
|
283
|
+
case 'sequence':
|
|
284
|
+
return this.processSequence(token.value);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
processText(text) {
|
|
288
|
+
// Handle BEL characters embedded in text
|
|
289
|
+
const actions = [];
|
|
290
|
+
let current = '';
|
|
291
|
+
for (const char of text) {
|
|
292
|
+
if (char.charCodeAt(0) === C0.BEL) {
|
|
293
|
+
if (current) {
|
|
294
|
+
const graphemes = [...segmentGraphemes(current)];
|
|
295
|
+
if (graphemes.length > 0) {
|
|
296
|
+
actions.push({ type: 'text', graphemes, style: { ...this.style } });
|
|
297
|
+
}
|
|
298
|
+
current = '';
|
|
299
|
+
}
|
|
300
|
+
actions.push({ type: 'bell' });
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
current += char;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (current) {
|
|
307
|
+
const graphemes = [...segmentGraphemes(current)];
|
|
308
|
+
if (graphemes.length > 0) {
|
|
309
|
+
actions.push({ type: 'text', graphemes, style: { ...this.style } });
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return actions;
|
|
313
|
+
}
|
|
314
|
+
processSequence(seq) {
|
|
315
|
+
const seqType = identifySequence(seq);
|
|
316
|
+
switch (seqType) {
|
|
317
|
+
case 'csi': {
|
|
318
|
+
const action = parseCSI(seq);
|
|
319
|
+
if (!action)
|
|
320
|
+
return [];
|
|
321
|
+
if (action.type === 'sgr') {
|
|
322
|
+
this.style = applySGR(action.params, this.style);
|
|
323
|
+
return [];
|
|
324
|
+
}
|
|
325
|
+
return [action];
|
|
326
|
+
}
|
|
327
|
+
case 'osc': {
|
|
328
|
+
// Extract OSC content (between ESC ] and terminator)
|
|
329
|
+
let content = seq.slice(2);
|
|
330
|
+
// Remove terminator (BEL or ESC \)
|
|
331
|
+
if (content.endsWith('\x07')) {
|
|
332
|
+
content = content.slice(0, -1);
|
|
333
|
+
}
|
|
334
|
+
else if (content.endsWith('\x1b\\')) {
|
|
335
|
+
content = content.slice(0, -2);
|
|
336
|
+
}
|
|
337
|
+
const action = parseOSC(content);
|
|
338
|
+
if (action) {
|
|
339
|
+
if (action.type === 'link') {
|
|
340
|
+
if (action.action.type === 'start') {
|
|
341
|
+
this.inLink = true;
|
|
342
|
+
this.linkUrl = action.action.url;
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
this.inLink = false;
|
|
346
|
+
this.linkUrl = undefined;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return [action];
|
|
350
|
+
}
|
|
351
|
+
return [];
|
|
352
|
+
}
|
|
353
|
+
case 'esc': {
|
|
354
|
+
const escContent = seq.slice(1);
|
|
355
|
+
const action = parseEsc(escContent);
|
|
356
|
+
return action ? [action] : [];
|
|
357
|
+
}
|
|
358
|
+
case 'ss3':
|
|
359
|
+
// SS3 sequences are typically cursor keys in application mode
|
|
360
|
+
// For output parsing, treat as unknown
|
|
361
|
+
return [{ type: 'unknown', sequence: seq }];
|
|
362
|
+
default:
|
|
363
|
+
return [{ type: 'unknown', sequence: seq }];
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 type { TextStyle } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Apply an SGR parameter string to a text style.
|
|
10
|
+
* Handles both semicolon (;) and colon (:) separated parameters.
|
|
11
|
+
* @param paramStr - the SGR parameter string (without the CSI prefix or final m).
|
|
12
|
+
* @param style - the style to apply the parameters to.
|
|
13
|
+
* @returns the resulting style; code 0 resets to the default style, other
|
|
14
|
+
* codes update the corresponding attribute of a copy.
|
|
15
|
+
*/
|
|
16
|
+
export declare function applySGR(paramStr: string, style: TextStyle): TextStyle;
|
|
17
|
+
//# sourceMappingURL=sgr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sgr.d.ts","sourceRoot":"","sources":["../../../../src/ink/termio/sgr.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAc,SAAS,EAAkB,MAAM,YAAY,CAAA;AAuHvE;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,CAqLtE"}
|