@deepseek-harness-tui/dsh-tui 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -23
- package/bin/dsh-tui.js +132 -25
- package/cordis.patch.yml +69 -17
- package/cordis.yml +50 -12
- package/lib/types/activityPrefs.d.ts +1 -1
- package/lib/types/activityPrefs.js +3 -3
- package/lib/types/cc/figures.d.ts +27 -20
- package/lib/types/cc/figures.d.ts.map +1 -1
- package/lib/types/cc/figures.js +43 -34
- package/lib/types/cc/format.d.ts +18 -9
- package/lib/types/cc/format.d.ts.map +1 -1
- package/lib/types/cc/format.js +26 -18
- package/lib/types/cc/markdown.d.ts +31 -16
- package/lib/types/cc/markdown.d.ts.map +1 -1
- package/lib/types/cc/markdown.js +283 -260
- package/lib/types/cc/terminal.d.ts +10 -7
- package/lib/types/cc/terminal.d.ts.map +1 -1
- package/lib/types/cc/terminal.js +62 -50
- package/lib/types/command-trees.d.ts +3 -0
- package/lib/types/command-trees.d.ts.map +1 -0
- package/lib/types/command-trees.js +4 -0
- package/lib/types/commands.d.ts +37 -1
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +68 -3
- package/lib/types/components/ActivityLine.d.ts +1 -1
- package/lib/types/components/ActivityLine.d.ts.map +1 -1
- package/lib/types/components/ActivityPicker.d.ts.map +1 -1
- package/lib/types/components/ActivityPicker.js +3 -4
- package/lib/types/components/BtwPanel.d.ts +16 -0
- package/lib/types/components/BtwPanel.d.ts.map +1 -0
- package/lib/types/components/BtwPanel.js +47 -0
- package/lib/types/components/CommandSuggestions.d.ts +4 -2
- package/lib/types/components/CommandSuggestions.d.ts.map +1 -1
- package/lib/types/components/CommandSuggestions.js +2 -2
- package/lib/types/components/EffortSlider.d.ts +15 -0
- package/lib/types/components/EffortSlider.d.ts.map +1 -0
- package/lib/types/components/EffortSlider.js +17 -0
- package/lib/types/components/GoalTodoPanel.d.ts +1 -1
- package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
- package/lib/types/components/HelpMenu.d.ts +5 -2
- package/lib/types/components/HelpMenu.d.ts.map +1 -1
- package/lib/types/components/HelpMenu.js +8 -3
- package/lib/types/components/HistorySearchDialog.d.ts +1 -1
- package/lib/types/components/HistorySearchDialog.d.ts.map +1 -1
- package/lib/types/components/HistorySearchDialog.js +21 -10
- package/lib/types/components/InterruptedByUser.d.ts +2 -2
- package/lib/types/components/InterruptedByUser.d.ts.map +1 -1
- package/lib/types/components/InterruptedByUser.js +4 -3
- package/lib/types/components/LoadedContextPanel.d.ts +1 -1
- package/lib/types/components/LoadedContextPanel.d.ts.map +1 -1
- package/lib/types/components/LogoV2.d.ts.map +1 -1
- package/lib/types/components/LogoV2.js +2 -1
- package/lib/types/components/Markdown.d.ts +11 -11
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +63 -57
- package/lib/types/components/MarkdownTable.d.ts +1 -1
- package/lib/types/components/MarkdownTable.js +2 -2
- package/lib/types/components/MessageList.d.ts +10 -2
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +17 -10
- package/lib/types/components/ModelPicker.d.ts +4 -1
- package/lib/types/components/ModelPicker.d.ts.map +1 -1
- package/lib/types/components/ModelPicker.js +16 -4
- package/lib/types/components/OverlayAbove.d.ts +20 -0
- package/lib/types/components/OverlayAbove.d.ts.map +1 -0
- package/lib/types/components/OverlayAbove.js +18 -0
- package/lib/types/components/PresetPicker.d.ts +1 -1
- package/lib/types/components/PresetPicker.d.ts.map +1 -1
- package/lib/types/components/PresetPicker.js +2 -3
- package/lib/types/components/PromptInput.d.ts +5 -4
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +186 -39
- package/lib/types/components/ResumePicker.d.ts +15 -4
- package/lib/types/components/ResumePicker.d.ts.map +1 -1
- package/lib/types/components/ResumePicker.js +25 -9
- package/lib/types/components/RewindPicker.d.ts +1 -1
- package/lib/types/components/RewindPicker.d.ts.map +1 -1
- package/lib/types/components/RewindPicker.js +14 -5
- package/lib/types/components/SearchBox.d.ts +1 -1
- package/lib/types/components/SearchBox.js +1 -1
- package/lib/types/components/Spinner/GlimmerMessage.d.ts +1 -2
- package/lib/types/components/Spinner/GlimmerMessage.d.ts.map +1 -1
- package/lib/types/components/Spinner/GlimmerMessage.js +1 -2
- package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts +1 -1
- package/lib/types/components/Spinner/SpinnerAnimationRow.js +2 -2
- package/lib/types/components/Spinner/SpinnerGlyph.d.ts +1 -1
- package/lib/types/components/Spinner/SpinnerGlyph.js +1 -1
- package/lib/types/components/Spinner/spinnerUtils.d.ts +13 -18
- package/lib/types/components/Spinner/spinnerUtils.d.ts.map +1 -1
- package/lib/types/components/Spinner/spinnerUtils.js +67 -71
- package/lib/types/components/Spinner/useStalledAnimation.d.ts +1 -2
- package/lib/types/components/Spinner/useStalledAnimation.d.ts.map +1 -1
- package/lib/types/components/Spinner/useStalledAnimation.js +1 -2
- package/lib/types/components/StreamingMarkdown.d.ts +1 -1
- package/lib/types/components/StreamingMarkdown.js +1 -1
- package/lib/types/components/ThemePicker.d.ts +13 -9
- package/lib/types/components/ThemePicker.d.ts.map +1 -1
- package/lib/types/components/ThemePicker.js +21 -15
- package/lib/types/components/ThinkingToggle.d.ts +1 -1
- package/lib/types/components/ThinkingToggle.d.ts.map +1 -1
- package/lib/types/components/ThinkingToggle.js +8 -8
- package/lib/types/components/ToolUseLoader.d.ts +1 -1
- package/lib/types/components/ToolUseLoader.js +1 -1
- package/lib/types/components/WorkingSpinner.d.ts +2 -2
- package/lib/types/components/WorkingSpinner.js +2 -2
- package/lib/types/components/WorkspaceFlowPicker.d.ts +15 -0
- package/lib/types/components/WorkspaceFlowPicker.d.ts.map +1 -0
- package/lib/types/components/WorkspaceFlowPicker.js +19 -0
- package/lib/types/components/WorkspacePicker.d.ts +9 -0
- package/lib/types/components/WorkspacePicker.d.ts.map +1 -0
- package/lib/types/components/WorkspacePicker.js +13 -0
- package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
- package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
- package/lib/types/components/approvals/ApprovalPanel.js +2 -1
- package/lib/types/components/design-system/Byline.d.ts +1 -1
- package/lib/types/components/design-system/Byline.js +1 -1
- package/lib/types/components/design-system/Divider.d.ts +1 -1
- package/lib/types/components/design-system/Divider.js +1 -1
- package/lib/types/components/design-system/HintLine.d.ts +12 -0
- package/lib/types/components/design-system/HintLine.d.ts.map +1 -0
- package/lib/types/components/design-system/HintLine.js +15 -0
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +1 -1
- package/lib/types/components/design-system/KeyboardShortcutHint.js +1 -1
- package/lib/types/components/design-system/ListItem.d.ts +2 -2
- package/lib/types/components/design-system/ListItem.d.ts.map +1 -1
- package/lib/types/components/design-system/ListItem.js +35 -3
- package/lib/types/components/design-system/LoadingState.d.ts +1 -2
- package/lib/types/components/design-system/LoadingState.d.ts.map +1 -1
- package/lib/types/components/design-system/LoadingState.js +1 -2
- package/lib/types/components/design-system/Pane.d.ts +2 -2
- package/lib/types/components/design-system/Pane.js +2 -2
- package/lib/types/components/design-system/ProgressBar.d.ts +1 -2
- package/lib/types/components/design-system/ProgressBar.d.ts.map +1 -1
- package/lib/types/components/design-system/ProgressBar.js +1 -2
- package/lib/types/components/design-system/StatusIcon.d.ts +2 -2
- package/lib/types/components/design-system/StatusIcon.js +2 -2
- package/lib/types/components/design-system/ThemeProvider.d.ts +1 -1
- package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
- package/lib/types/components/design-system/ThemeProvider.js +87 -26
- package/lib/types/components/design-system/ThemedBox.d.ts +1 -1
- package/lib/types/components/design-system/ThemedBox.js +1 -1
- package/lib/types/components/design-system/ThemedText.d.ts +2 -2
- package/lib/types/components/design-system/ThemedText.js +2 -2
- package/lib/types/components/listWindow.d.ts +26 -0
- package/lib/types/components/listWindow.d.ts.map +1 -0
- package/lib/types/components/listWindow.js +47 -0
- package/lib/types/components/messages/AssistantTextMessage.d.ts +1 -2
- package/lib/types/components/messages/AssistantTextMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantTextMessage.js +1 -2
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts +2 -2
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantThinkingMessage.js +6 -6
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +12 -4
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +9 -5
- package/lib/types/components/messages/MessageMetadata.d.ts +1 -1
- package/lib/types/components/messages/MessageMetadata.js +1 -1
- package/lib/types/components/messages/UserPromptMessage.d.ts +1 -1
- package/lib/types/components/messages/UserPromptMessage.js +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +5 -1
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +11 -9
- package/lib/types/components/questions/PlanReviewPanel.d.ts +1 -1
- package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
- package/lib/types/components/questions/PlanReviewPanel.js +3 -2
- package/lib/types/components/trajectory/HotspotView.d.ts +14 -0
- package/lib/types/components/trajectory/HotspotView.d.ts.map +1 -0
- package/lib/types/components/trajectory/HotspotView.js +83 -0
- package/lib/types/components/trajectory/Inspector.d.ts +31 -0
- package/lib/types/components/trajectory/Inspector.d.ts.map +1 -0
- package/lib/types/components/trajectory/Inspector.js +67 -0
- package/lib/types/components/trajectory/Ledger.d.ts +20 -0
- package/lib/types/components/trajectory/Ledger.d.ts.map +1 -0
- package/lib/types/components/trajectory/Ledger.js +112 -0
- package/lib/types/components/trajectory/MiniWake.d.ts +24 -0
- package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -0
- package/lib/types/components/trajectory/MiniWake.js +99 -0
- package/lib/types/components/trajectory/WaveBand.d.ts +33 -0
- package/lib/types/components/trajectory/WaveBand.d.ts.map +1 -0
- package/lib/types/components/trajectory/WaveBand.js +145 -0
- package/lib/types/customTheme.d.ts +6 -6
- package/lib/types/customTheme.d.ts.map +1 -1
- package/lib/types/customTheme.js +15 -12
- package/lib/types/dsh-adapter/approvals.d.ts.map +1 -0
- package/lib/types/{channel.d.ts → dsh-adapter/channel.d.ts} +198 -43
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -0
- package/lib/types/{channel.js → dsh-adapter/channel.js} +1129 -201
- package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -0
- package/lib/types/{childStderr.js → dsh-adapter/childStderr.js} +1 -1
- package/lib/types/dsh-adapter/command-trees.d.ts +27 -0
- package/lib/types/dsh-adapter/command-trees.d.ts.map +1 -0
- package/lib/types/dsh-adapter/command-trees.js +42 -0
- package/lib/types/dsh-adapter/compat/index.d.ts +22 -0
- package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -0
- package/lib/types/{compat → dsh-adapter/compat}/index.js +7 -4
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts +86 -0
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -0
- package/lib/types/dsh-adapter/compat/sessionLog.js +347 -0
- package/lib/types/dsh-adapter/contract.d.ts +20 -0
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -0
- package/lib/types/dsh-adapter/contract.js +109 -0
- package/lib/types/dsh-adapter/index.d.ts +80 -0
- package/lib/types/dsh-adapter/index.d.ts.map +1 -0
- package/lib/types/dsh-adapter/index.js +45 -0
- package/lib/types/dsh-adapter/invariant.d.ts.map +1 -0
- package/lib/types/dsh-adapter/packaged-skills.d.ts.map +1 -0
- package/lib/types/{plugin.d.ts → dsh-adapter/plugin.d.ts} +17 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -0
- package/lib/types/{plugin.js → dsh-adapter/plugin.js} +294 -80
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -0
- package/lib/types/dsh-adapter/providerWizard.d.ts +91 -0
- package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -0
- package/lib/types/dsh-adapter/providerWizard.js +332 -0
- package/lib/types/{questions.d.ts → dsh-adapter/questions.d.ts} +7 -2
- package/lib/types/dsh-adapter/questions.d.ts.map +1 -0
- package/lib/types/{questions.js → dsh-adapter/questions.js} +15 -7
- package/lib/types/dsh-adapter/sideQuestion.d.ts +38 -0
- package/lib/types/dsh-adapter/sideQuestion.d.ts.map +1 -0
- package/lib/types/dsh-adapter/sideQuestion.js +69 -0
- package/lib/types/dsh-adapter/trajectory/aggregate.d.ts +46 -0
- package/lib/types/dsh-adapter/trajectory/aggregate.d.ts.map +1 -0
- package/lib/types/dsh-adapter/trajectory/aggregate.js +207 -0
- package/lib/types/dsh-adapter/trajectory/guards.d.ts +177 -0
- package/lib/types/dsh-adapter/trajectory/guards.d.ts.map +1 -0
- package/lib/types/dsh-adapter/trajectory/guards.js +235 -0
- package/lib/types/dsh-adapter/trajectory/index.d.ts +16 -0
- package/lib/types/dsh-adapter/trajectory/index.d.ts.map +1 -0
- package/lib/types/dsh-adapter/trajectory/index.js +15 -0
- package/lib/types/dsh-adapter/trajectory/inspect.d.ts +40 -0
- package/lib/types/dsh-adapter/trajectory/inspect.d.ts.map +1 -0
- package/lib/types/dsh-adapter/trajectory/inspect.js +160 -0
- package/lib/types/dsh-adapter/trajectory/projection.d.ts +128 -0
- package/lib/types/dsh-adapter/trajectory/projection.d.ts.map +1 -0
- package/lib/types/dsh-adapter/trajectory/projection.js +653 -0
- package/lib/types/dsh-adapter/trajectory/types.d.ts +232 -0
- package/lib/types/dsh-adapter/trajectory/types.d.ts.map +1 -0
- package/lib/types/dsh-adapter/trajectory/types.js +70 -0
- package/lib/types/dsh-adapter/trajectory/wave.d.ts +45 -0
- package/lib/types/dsh-adapter/trajectory/wave.d.ts.map +1 -0
- package/lib/types/dsh-adapter/trajectory/wave.js +210 -0
- package/lib/types/dsh-adapter/types.d.ts +23 -0
- package/lib/types/dsh-adapter/types.d.ts.map +1 -0
- package/lib/types/dsh-adapter/types.js +1 -0
- package/lib/types/dsh-adapter/workspace.d.ts +22 -0
- package/lib/types/dsh-adapter/workspace.d.ts.map +1 -0
- package/lib/types/dsh-adapter/workspace.js +16 -0
- package/lib/types/dsh-adapter/workspaces.d.ts +118 -0
- package/lib/types/dsh-adapter/workspaces.d.ts.map +1 -0
- package/lib/types/dsh-adapter/workspaces.js +290 -0
- package/lib/types/effortPrefs.d.ts +1 -1
- package/lib/types/effortPrefs.js +3 -3
- package/lib/types/history.js +2 -2
- package/lib/types/hooks/useBlink.d.ts +1 -1
- package/lib/types/hooks/useBlink.js +1 -1
- package/lib/types/i18n.d.ts +981 -36
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +308 -30
- package/lib/types/index.d.ts +1 -69
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +3 -31
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +33 -19
- package/lib/types/ink/dom.d.ts +15 -0
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/dom.js +32 -0
- package/lib/types/ink/hooks/use-input.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-input.js +8 -0
- package/lib/types/ink/hooks/use-terminal-size.d.ts +1 -1
- package/lib/types/ink/hooks/use-terminal-size.js +1 -1
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +109 -28
- package/lib/types/ink/input-suppression.d.ts +20 -0
- package/lib/types/ink/input-suppression.d.ts.map +1 -0
- package/lib/types/ink/input-suppression.js +26 -0
- package/lib/types/ink/log-update.js +21 -6
- package/lib/types/ink/parse-keypress.d.ts +31 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +442 -8
- package/lib/types/ink/terminal-querier.d.ts +5 -1
- package/lib/types/ink/terminal-querier.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.js +27 -3
- package/lib/types/ink/terminal.d.ts +18 -0
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +32 -4
- package/lib/types/ink/termio/csi.d.ts +10 -0
- package/lib/types/ink/termio/csi.d.ts.map +1 -1
- package/lib/types/ink/termio/csi.js +20 -0
- package/lib/types/ink/termio/tokenize.js +10 -0
- package/lib/types/modelPrefs.d.ts +1 -1
- package/lib/types/modelPrefs.js +3 -3
- package/lib/types/presetPrefs.d.ts +1 -1
- package/lib/types/presetPrefs.js +3 -3
- package/lib/types/screens/Chat.d.ts +20 -4
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +655 -55
- package/lib/types/screens/StatusLine.d.ts +17 -2
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +12 -4
- package/lib/types/screens/TrajectoryScene.d.ts +16 -0
- package/lib/types/screens/TrajectoryScene.d.ts.map +1 -0
- package/lib/types/screens/TrajectoryScene.js +305 -0
- package/lib/types/sessionHistory.d.ts +9 -1
- package/lib/types/sessionHistory.d.ts.map +1 -1
- package/lib/types/sessionHistory.js +56 -16
- package/lib/types/sessionModes.d.ts +29 -0
- package/lib/types/sessionModes.d.ts.map +1 -0
- package/lib/types/sessionModes.js +45 -0
- package/lib/types/theme.d.ts +27 -3
- package/lib/types/theme.d.ts.map +1 -1
- package/lib/types/theme.js +48 -4
- package/lib/types/themePrefs.d.ts +3 -3
- package/lib/types/themePrefs.js +5 -5
- package/lib/types/trajectory/format.d.ts +100 -0
- package/lib/types/trajectory/format.d.ts.map +1 -0
- package/lib/types/trajectory/format.js +213 -0
- package/lib/types/trajectory/motion.d.ts +99 -0
- package/lib/types/trajectory/motion.d.ts.map +1 -0
- package/lib/types/trajectory/motion.js +143 -0
- package/lib/types/trajectory/query.d.ts +83 -0
- package/lib/types/trajectory/query.d.ts.map +1 -0
- package/lib/types/trajectory/query.js +187 -0
- package/lib/types/trajectoryPrefs.d.ts +36 -0
- package/lib/types/trajectoryPrefs.d.ts.map +1 -0
- package/lib/types/trajectoryPrefs.js +65 -0
- package/lib/types/update.d.ts +3 -3
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +18 -7
- package/lib/types/utils/clipboard.d.ts +101 -29
- package/lib/types/utils/clipboard.d.ts.map +1 -1
- package/lib/types/utils/clipboard.js +533 -55
- package/lib/types/utils/debug.d.ts +1 -1
- package/lib/types/utils/debug.js +2 -2
- package/lib/types/utils/execFileNoThrow.d.ts.map +1 -1
- package/lib/types/utils/execFileNoThrow.js +16 -6
- package/lib/types/utils/externalEditor.d.ts +115 -0
- package/lib/types/utils/externalEditor.d.ts.map +1 -0
- package/lib/types/utils/externalEditor.js +270 -0
- package/lib/types/utils/fullscreen.d.ts +2 -2
- package/lib/types/utils/fullscreen.js +3 -3
- package/lib/types/utils/loaded-context.d.ts +1 -1
- package/lib/types/utils/loaded-context.d.ts.map +1 -1
- package/lib/types/utils/modifiers.d.ts +24 -0
- package/lib/types/utils/modifiers.d.ts.map +1 -1
- package/lib/types/utils/modifiers.js +27 -0
- package/lib/types/utils/paths.d.ts +45 -0
- package/lib/types/utils/paths.d.ts.map +1 -0
- package/lib/types/utils/paths.js +69 -0
- package/lib/types/utils/shellQuote.d.ts +14 -0
- package/lib/types/utils/shellQuote.d.ts.map +1 -0
- package/lib/types/utils/shellQuote.js +39 -0
- package/lib/types/utils/workspaceRoot.d.ts +21 -0
- package/lib/types/utils/workspaceRoot.d.ts.map +1 -0
- package/lib/types/utils/workspaceRoot.js +47 -0
- package/lib/types/workspaces.d.ts +3 -0
- package/lib/types/workspaces.d.ts.map +1 -0
- package/lib/types/workspaces.js +4 -0
- package/package.json +31 -10
- package/lib/invariant.js +0 -28
- package/lib/types/approvals.d.ts.map +0 -1
- package/lib/types/channel.d.ts.map +0 -1
- package/lib/types/childStderr.d.ts.map +0 -1
- package/lib/types/compat/index.d.ts +0 -20
- package/lib/types/compat/index.d.ts.map +0 -1
- package/lib/types/compat/sessionLog.d.ts +0 -40
- package/lib/types/compat/sessionLog.d.ts.map +0 -1
- package/lib/types/compat/sessionLog.js +0 -226
- package/lib/types/invariant.d.ts.map +0 -1
- package/lib/types/packaged-skills.d.ts.map +0 -1
- package/lib/types/plugin.d.ts.map +0 -1
- package/lib/types/presets.d.ts.map +0 -1
- package/lib/types/questions.d.ts.map +0 -1
- /package/lib/types/{approvals.d.ts → dsh-adapter/approvals.d.ts} +0 -0
- /package/lib/types/{approvals.js → dsh-adapter/approvals.js} +0 -0
- /package/lib/types/{childStderr.d.ts → dsh-adapter/childStderr.d.ts} +0 -0
- /package/lib/types/{invariant.d.ts → dsh-adapter/invariant.d.ts} +0 -0
- /package/lib/types/{invariant.js → dsh-adapter/invariant.js} +0 -0
- /package/lib/types/{packaged-skills.d.ts → dsh-adapter/packaged-skills.d.ts} +0 -0
- /package/lib/types/{packaged-skills.js → dsh-adapter/packaged-skills.js} +0 -0
- /package/lib/types/{presets.d.ts → dsh-adapter/presets.d.ts} +0 -0
- /package/lib/types/{presets.js → dsh-adapter/presets.js} +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trajectory motion — five verbs, one shared clock, one hard rule.
|
|
3
|
+
*
|
|
4
|
+
* ## The rule: SGR-only
|
|
5
|
+
*
|
|
6
|
+
* The renderer diffs frames cell by cell and emits the smallest patch that
|
|
7
|
+
* reconciles them. A cell whose *style* changed costs a few bytes of SGR; a
|
|
8
|
+
* row whose *layout* changed costs a full row rewrite, and in inline mode a
|
|
9
|
+
* frame that got shorter takes the full-reset path that once deposited a copy
|
|
10
|
+
* of the whole UI into scrollback on every repaint (issues #38/#39/#19/#10).
|
|
11
|
+
*
|
|
12
|
+
* So every verb below animates colour and colour only. Nothing here changes a
|
|
13
|
+
* glyph count, a row count, or a box dimension. `verify-trace-motion` asserts
|
|
14
|
+
* this mechanically by capturing the write stream across a hundred ticks and
|
|
15
|
+
* failing on any row-level escape — the rule is machine-enforced, not a
|
|
16
|
+
* convention someone has to remember.
|
|
17
|
+
*
|
|
18
|
+
* ## The verbs
|
|
19
|
+
*
|
|
20
|
+
* | verb | shape | used for |
|
|
21
|
+
* |-------------|----------------------------|---------------------------------|
|
|
22
|
+
* | `arrive` | one bright frame, settle | a row or wave column just landed |
|
|
23
|
+
* | `reproject` | dim → bright, two frames | the same data, re-sorted/filtered |
|
|
24
|
+
* | `alert` | two flashes, then steady | an error, a retry, a pending ask |
|
|
25
|
+
* | `alive` | slow breath, loops | the running edge (1–2 cells max) |
|
|
26
|
+
* | `navigate` | *nothing* | cursor, viewport, inspector |
|
|
27
|
+
*
|
|
28
|
+
* `navigate` having no animation is a decision, not an omission: easing on a
|
|
29
|
+
* cursor is latency you can feel, and key auto-repeat already supplies the
|
|
30
|
+
* sense of continuity.
|
|
31
|
+
*
|
|
32
|
+
* ## Cost
|
|
33
|
+
*
|
|
34
|
+
* No timer is created here. The scene subscribes once to the Ink core's
|
|
35
|
+
* shared animation clock, which already pauses when the terminal loses focus
|
|
36
|
+
* or the view scrolls offscreen — so an idle session animates nothing.
|
|
37
|
+
*/
|
|
38
|
+
import { interpolateColor, parseRGB } from '../components/Spinner/spinnerUtils.js';
|
|
39
|
+
/** Scene clock period. One tick drives every verb below. */
|
|
40
|
+
export const MOTION_TICK_MS = 100;
|
|
41
|
+
/** Ticks a one-shot verb runs for before settling. */
|
|
42
|
+
export const MOTION_SPANS = {
|
|
43
|
+
arrive: 2,
|
|
44
|
+
reproject: 3,
|
|
45
|
+
/** Two flashes: bright, dim, bright, dim, then steady. */
|
|
46
|
+
alert: 8,
|
|
47
|
+
};
|
|
48
|
+
/** Ticks per half-breath of the `alive` verb (~600 ms in, 600 ms out). */
|
|
49
|
+
const BREATH_TICKS = 6;
|
|
50
|
+
/** Format an RGB triple the way the theme and `<Text color>` expect. */
|
|
51
|
+
export function rgbString(color) {
|
|
52
|
+
return `rgb(${color.r},${color.g},${color.b})`;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Blend two colours, accepting either theme values (`rgb(r,g,b)`) or hex.
|
|
56
|
+
*
|
|
57
|
+
* @param base - Colour at `t = 0`.
|
|
58
|
+
* @param highlight - Colour at `t = 1`.
|
|
59
|
+
* @param t - Blend position, clamped into [0, 1].
|
|
60
|
+
* @returns A colour string `<Text color>` accepts, or `base` when either
|
|
61
|
+
* input could not be parsed (a custom theme may carry an ANSI name).
|
|
62
|
+
*/
|
|
63
|
+
export function mix(base, highlight, t) {
|
|
64
|
+
const from = parseRGB(base);
|
|
65
|
+
const to = parseRGB(highlight);
|
|
66
|
+
// An unparseable input (a custom theme may carry an ANSI name, which has no
|
|
67
|
+
// channels to interpolate) falls back to the base rather than to grey.
|
|
68
|
+
if (from === null || to === null)
|
|
69
|
+
return base;
|
|
70
|
+
return rgbString(interpolateColor(from, to, Math.min(1, Math.max(0, t))));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The `alive` verb: a triangular breath in [0, 1], synchronized across every
|
|
74
|
+
* caller because they all read the same clock.
|
|
75
|
+
*
|
|
76
|
+
* @param tick - Current scene tick.
|
|
77
|
+
* @returns Blend position for {@link mix}.
|
|
78
|
+
*/
|
|
79
|
+
export function alive(tick) {
|
|
80
|
+
const phase = ((tick % (BREATH_TICKS * 2)) + BREATH_TICKS * 2) % (BREATH_TICKS * 2);
|
|
81
|
+
return phase < BREATH_TICKS ? phase / BREATH_TICKS : (BREATH_TICKS * 2 - phase) / BREATH_TICKS;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Progress of a one-shot verb.
|
|
85
|
+
*
|
|
86
|
+
* @param tick - Current scene tick.
|
|
87
|
+
* @param startTick - Tick the verb was triggered on.
|
|
88
|
+
* @param span - Duration in ticks.
|
|
89
|
+
* @returns Elapsed ticks, or `null` once the verb has settled (or when
|
|
90
|
+
* `startTick` is in the future, which happens for one frame after a reset).
|
|
91
|
+
*/
|
|
92
|
+
function elapsed(tick, startTick, span) {
|
|
93
|
+
const age = tick - startTick;
|
|
94
|
+
return age < 0 || age >= span ? null : age;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The `arrive` verb: one bright frame, then settle.
|
|
98
|
+
*
|
|
99
|
+
* @returns Blend position, or 0 once settled.
|
|
100
|
+
*/
|
|
101
|
+
export function arrive(tick, startTick) {
|
|
102
|
+
const age = elapsed(tick, startTick, MOTION_SPANS.arrive);
|
|
103
|
+
if (age === null)
|
|
104
|
+
return 0;
|
|
105
|
+
return 1 - age / MOTION_SPANS.arrive;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The `reproject` verb: the view dims, then comes back up. Used when the same
|
|
109
|
+
* rows are re-ordered or re-filtered, so the eye is told "this is the same
|
|
110
|
+
* data, rearranged" rather than "this is a new screen".
|
|
111
|
+
*
|
|
112
|
+
* @returns Dim factor in [0, 1] where 1 is fully dimmed, 0 fully settled.
|
|
113
|
+
*/
|
|
114
|
+
export function reproject(tick, startTick) {
|
|
115
|
+
const age = elapsed(tick, startTick, MOTION_SPANS.reproject);
|
|
116
|
+
if (age === null)
|
|
117
|
+
return 0;
|
|
118
|
+
return 1 - (age + 1) / MOTION_SPANS.reproject;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The `alert` verb: two flashes, then steady. Deliberately one-shot — a
|
|
122
|
+
* looping alarm is noise, and an error that keeps blinking after you have
|
|
123
|
+
* seen it trains you to ignore it.
|
|
124
|
+
*
|
|
125
|
+
* @returns Blend position toward the highlight, or 0 once steady.
|
|
126
|
+
*/
|
|
127
|
+
export function alert(tick, startTick) {
|
|
128
|
+
const age = elapsed(tick, startTick, MOTION_SPANS.alert);
|
|
129
|
+
if (age === null)
|
|
130
|
+
return 0;
|
|
131
|
+
// 8 ticks: on, off, on, off — each phase two ticks wide.
|
|
132
|
+
return Math.floor(age / 2) % 2 === 0 ? 1 : 0;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Colour for a running cell (the `alive` verb applied to a theme pair).
|
|
136
|
+
*
|
|
137
|
+
* @param tick - Current scene tick.
|
|
138
|
+
* @param base - Settled colour.
|
|
139
|
+
* @param highlight - Peak-of-breath colour.
|
|
140
|
+
*/
|
|
141
|
+
export function aliveColor(tick, base, highlight) {
|
|
142
|
+
return mix(base, highlight, alive(tick));
|
|
143
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trajectory query — whole-session structured filtering.
|
|
3
|
+
*
|
|
4
|
+
* The official web trajectory is paged, and its own documentation is explicit
|
|
5
|
+
* that search covers only the currently loaded window. In the terminal the
|
|
6
|
+
* entire event log is already resident, so filtering can be exhaustive — and
|
|
7
|
+
* once it is exhaustive, plain substring search stops being enough. This is a
|
|
8
|
+
* small field language instead:
|
|
9
|
+
*
|
|
10
|
+
* ```
|
|
11
|
+
* tool:web_search name equals (case-insensitive)
|
|
12
|
+
* kind:retry row kind
|
|
13
|
+
* turn:9 owning turn
|
|
14
|
+
* err: failed rows only
|
|
15
|
+
* run: still-running rows only
|
|
16
|
+
* >10s <500ms own duration bounds (ms / s / m suffixes)
|
|
17
|
+
* tok>1k token bounds
|
|
18
|
+
* anything else free text over label, detail and outcome
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Everything is AND-ed. An unparseable term degrades to free text rather than
|
|
22
|
+
* erroring, so a half-typed query still narrows sensibly while you type.
|
|
23
|
+
*/
|
|
24
|
+
import type { TrajKind, TrajNode } from '../dsh-adapter/types.js';
|
|
25
|
+
/** One parsed predicate. */
|
|
26
|
+
type Term = {
|
|
27
|
+
readonly kind: 'text';
|
|
28
|
+
readonly value: string;
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: 'tool';
|
|
31
|
+
readonly value: string;
|
|
32
|
+
} | {
|
|
33
|
+
readonly kind: 'rowKind';
|
|
34
|
+
readonly value: string;
|
|
35
|
+
} | {
|
|
36
|
+
readonly kind: 'turn';
|
|
37
|
+
readonly value: number;
|
|
38
|
+
} | {
|
|
39
|
+
readonly kind: 'error';
|
|
40
|
+
} | {
|
|
41
|
+
readonly kind: 'running';
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: 'duration';
|
|
44
|
+
readonly op: '>' | '<';
|
|
45
|
+
readonly ms: number;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: 'tokens';
|
|
48
|
+
readonly op: '>' | '<';
|
|
49
|
+
readonly count: number;
|
|
50
|
+
};
|
|
51
|
+
/** A compiled query: the parsed terms plus the raw text they came from. */
|
|
52
|
+
export interface TrajQuery {
|
|
53
|
+
readonly raw: string;
|
|
54
|
+
readonly terms: readonly Term[];
|
|
55
|
+
/** True when the query selects everything (empty or whitespace only). */
|
|
56
|
+
readonly empty: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** Field prefixes offered in the query hint line. */
|
|
59
|
+
export declare const QUERY_FIELDS: readonly ["tool:", "kind:", "turn:", "err:", "run:", ">10s", "<1s", "tok>1k"];
|
|
60
|
+
/**
|
|
61
|
+
* Compile a query string.
|
|
62
|
+
*
|
|
63
|
+
* @param raw - The user's query text.
|
|
64
|
+
* @returns A query that {@link matchesQuery} can evaluate. Never throws.
|
|
65
|
+
*/
|
|
66
|
+
export declare function parseQuery(raw: string): TrajQuery;
|
|
67
|
+
/** True when a row satisfies every term (an empty query matches everything). */
|
|
68
|
+
export declare function matchesQuery(node: TrajNode, query: TrajQuery): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Apply a query to the ledger.
|
|
71
|
+
*
|
|
72
|
+
* @returns The matching rows and, in parallel, their original ledger indexes —
|
|
73
|
+
* the wave band highlights matches in place, so it needs the positions the
|
|
74
|
+
* rows had before filtering, not after.
|
|
75
|
+
*/
|
|
76
|
+
export declare function applyQuery(nodes: readonly TrajNode[], query: TrajQuery): {
|
|
77
|
+
rows: TrajNode[];
|
|
78
|
+
indexes: number[];
|
|
79
|
+
};
|
|
80
|
+
/** Row kinds offered as `kind:` completions, in ledger-usefulness order. */
|
|
81
|
+
export declare const QUERY_KINDS: readonly TrajKind[];
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/trajectory/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEjE,4BAA4B;AAC5B,KAAK,IAAI,GACL;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,GAAG,GAAG,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC1E;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,GAAG,GAAG,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/E,2EAA2E;AAC3E,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAA;IAC/B,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB;AAED,qDAAqD;AACrD,eAAO,MAAM,YAAY,+EAAgF,CAAA;AA2BzG;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAoCjD;AA8CD,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAItE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,KAAK,EAAE,SAAS,GACf;IAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAYzC;AAED,4EAA4E;AAC5E,eAAO,MAAM,WAAW,EAAE,SAAS,QAAQ,EAG1C,CAAA"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trajectory query — whole-session structured filtering.
|
|
3
|
+
*
|
|
4
|
+
* The official web trajectory is paged, and its own documentation is explicit
|
|
5
|
+
* that search covers only the currently loaded window. In the terminal the
|
|
6
|
+
* entire event log is already resident, so filtering can be exhaustive — and
|
|
7
|
+
* once it is exhaustive, plain substring search stops being enough. This is a
|
|
8
|
+
* small field language instead:
|
|
9
|
+
*
|
|
10
|
+
* ```
|
|
11
|
+
* tool:web_search name equals (case-insensitive)
|
|
12
|
+
* kind:retry row kind
|
|
13
|
+
* turn:9 owning turn
|
|
14
|
+
* err: failed rows only
|
|
15
|
+
* run: still-running rows only
|
|
16
|
+
* >10s <500ms own duration bounds (ms / s / m suffixes)
|
|
17
|
+
* tok>1k token bounds
|
|
18
|
+
* anything else free text over label, detail and outcome
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Everything is AND-ed. An unparseable term degrades to free text rather than
|
|
22
|
+
* erroring, so a half-typed query still narrows sensibly while you type.
|
|
23
|
+
*/
|
|
24
|
+
import { burstErrors, burstRunning, previewText } from '../dsh-adapter/trajectory/index.js';
|
|
25
|
+
/** Field prefixes offered in the query hint line. */
|
|
26
|
+
export const QUERY_FIELDS = ['tool:', 'kind:', 'turn:', 'err:', 'run:', '>10s', '<1s', 'tok>1k'];
|
|
27
|
+
/** Parse a duration literal (`500ms`, `2s`, `3m`) into milliseconds. */
|
|
28
|
+
function parseDuration(text) {
|
|
29
|
+
const match = /^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(text);
|
|
30
|
+
if (match === null)
|
|
31
|
+
return undefined;
|
|
32
|
+
const value = Number(match[1]);
|
|
33
|
+
if (!Number.isFinite(value))
|
|
34
|
+
return undefined;
|
|
35
|
+
switch (match[2]) {
|
|
36
|
+
case 'm': return value * 60_000;
|
|
37
|
+
case 'ms': return value;
|
|
38
|
+
// A bare number is seconds: `>10` reads as ten seconds, which is what a
|
|
39
|
+
// user scanning for slow calls means.
|
|
40
|
+
default: return value * 1000;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Parse a token literal (`1k`, `20000`, `1.5M`). */
|
|
44
|
+
function parseCount(text) {
|
|
45
|
+
const match = /^(\d+(?:\.\d+)?)([km])?$/i.exec(text);
|
|
46
|
+
if (match === null)
|
|
47
|
+
return undefined;
|
|
48
|
+
const value = Number(match[1]);
|
|
49
|
+
if (!Number.isFinite(value))
|
|
50
|
+
return undefined;
|
|
51
|
+
const unit = match[2]?.toLowerCase();
|
|
52
|
+
return unit === 'k' ? value * 1000 : unit === 'm' ? value * 1_000_000 : value;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Compile a query string.
|
|
56
|
+
*
|
|
57
|
+
* @param raw - The user's query text.
|
|
58
|
+
* @returns A query that {@link matchesQuery} can evaluate. Never throws.
|
|
59
|
+
*/
|
|
60
|
+
export function parseQuery(raw) {
|
|
61
|
+
const trimmed = raw.trim();
|
|
62
|
+
if (trimmed === '')
|
|
63
|
+
return { raw, terms: [], empty: true };
|
|
64
|
+
const terms = [];
|
|
65
|
+
for (const token of trimmed.split(/\s+/)) {
|
|
66
|
+
const lower = token.toLowerCase();
|
|
67
|
+
if (lower === 'err:' || lower === 'error:') {
|
|
68
|
+
terms.push({ kind: 'error' });
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (lower === 'run:' || lower === 'running:') {
|
|
72
|
+
terms.push({ kind: 'running' });
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const tool = /^tool:(.+)$/.exec(lower);
|
|
76
|
+
if (tool !== null) {
|
|
77
|
+
terms.push({ kind: 'tool', value: tool[1] });
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const rowKind = /^kind:(.+)$/.exec(lower);
|
|
81
|
+
if (rowKind !== null) {
|
|
82
|
+
terms.push({ kind: 'rowKind', value: rowKind[1] });
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const turn = /^turn:(\d+)$/.exec(lower);
|
|
86
|
+
if (turn !== null) {
|
|
87
|
+
terms.push({ kind: 'turn', value: Number(turn[1]) });
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const tokens = /^tok([<>])(.+)$/.exec(lower);
|
|
91
|
+
if (tokens !== null) {
|
|
92
|
+
const count = parseCount(tokens[2]);
|
|
93
|
+
if (count !== undefined) {
|
|
94
|
+
terms.push({ kind: 'tokens', op: tokens[1], count });
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const duration = /^([<>])(.+)$/.exec(lower);
|
|
99
|
+
if (duration !== null) {
|
|
100
|
+
const ms = parseDuration(duration[2]);
|
|
101
|
+
if (ms !== undefined) {
|
|
102
|
+
terms.push({ kind: 'duration', op: duration[1], ms });
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Anything unrecognized — including a half-typed `tool:` — is free text.
|
|
107
|
+
terms.push({ kind: 'text', value: lower });
|
|
108
|
+
}
|
|
109
|
+
return { raw, terms, empty: false };
|
|
110
|
+
}
|
|
111
|
+
/** Total tokens attributed to a row. */
|
|
112
|
+
function tokenTotal(node) {
|
|
113
|
+
const t = node.tokens;
|
|
114
|
+
return t === undefined ? 0 : t.input + t.output + t.think;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Free-text haystack for one row.
|
|
118
|
+
*
|
|
119
|
+
* Bounded on purpose: a 200 KB tool result must not cost a full scan per row
|
|
120
|
+
* per keystroke, and a match beyond the first few hundred characters is not
|
|
121
|
+
* something the one-line ledger could show anyway.
|
|
122
|
+
*/
|
|
123
|
+
function haystack(node) {
|
|
124
|
+
return `${node.label} ${previewText(node.detail ?? '', 200)} ${previewText(node.outcome ?? '', 200)}`.toLowerCase();
|
|
125
|
+
}
|
|
126
|
+
/** Evaluate one row against one term. */
|
|
127
|
+
function matchesTerm(node, term) {
|
|
128
|
+
switch (term.kind) {
|
|
129
|
+
case 'text':
|
|
130
|
+
return haystack(node).includes(term.value);
|
|
131
|
+
case 'tool':
|
|
132
|
+
return (node.kind === 'tool' || node.kind === 'subtool') && node.label.toLowerCase() === term.value;
|
|
133
|
+
case 'rowKind':
|
|
134
|
+
return node.kind === term.value;
|
|
135
|
+
case 'turn':
|
|
136
|
+
return node.turn === term.value;
|
|
137
|
+
case 'error':
|
|
138
|
+
return node.status === 'error' || (node.burst !== undefined && burstErrors(node.burst) > 0);
|
|
139
|
+
case 'running':
|
|
140
|
+
return node.status === 'running' || (node.burst !== undefined && burstRunning(node.burst));
|
|
141
|
+
case 'duration': {
|
|
142
|
+
const ms = node.durationMs;
|
|
143
|
+
if (ms === undefined)
|
|
144
|
+
return false;
|
|
145
|
+
return term.op === '>' ? ms > term.ms : ms < term.ms;
|
|
146
|
+
}
|
|
147
|
+
case 'tokens': {
|
|
148
|
+
const count = tokenTotal(node);
|
|
149
|
+
return term.op === '>' ? count > term.count : count < term.count;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** True when a row satisfies every term (an empty query matches everything). */
|
|
154
|
+
export function matchesQuery(node, query) {
|
|
155
|
+
if (query.empty)
|
|
156
|
+
return true;
|
|
157
|
+
for (const term of query.terms)
|
|
158
|
+
if (!matchesTerm(node, term))
|
|
159
|
+
return false;
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Apply a query to the ledger.
|
|
164
|
+
*
|
|
165
|
+
* @returns The matching rows and, in parallel, their original ledger indexes —
|
|
166
|
+
* the wave band highlights matches in place, so it needs the positions the
|
|
167
|
+
* rows had before filtering, not after.
|
|
168
|
+
*/
|
|
169
|
+
export function applyQuery(nodes, query) {
|
|
170
|
+
if (query.empty)
|
|
171
|
+
return { rows: [...nodes], indexes: nodes.map((_, index) => index) };
|
|
172
|
+
const rows = [];
|
|
173
|
+
const indexes = [];
|
|
174
|
+
for (let index = 0; index < nodes.length; index++) {
|
|
175
|
+
const node = nodes[index];
|
|
176
|
+
if (matchesQuery(node, query)) {
|
|
177
|
+
rows.push(node);
|
|
178
|
+
indexes.push(index);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return { rows, indexes };
|
|
182
|
+
}
|
|
183
|
+
/** Row kinds offered as `kind:` completions, in ledger-usefulness order. */
|
|
184
|
+
export const QUERY_KINDS = [
|
|
185
|
+
'tool', 'subtool', 'retry', 'assistant', 'thinking', 'user',
|
|
186
|
+
'approval', 'system', 'context', 'compaction', 'turn', 'step', 'todo',
|
|
187
|
+
];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persisted "the user has seen the trajectory" flag, at
|
|
3
|
+
* `~/.dsh-tui/trajectory.json`.
|
|
4
|
+
*
|
|
5
|
+
* It exists so the key hint beside the status-line wake can retire itself.
|
|
6
|
+
* A permanent `ctrl+t` printed on every frame forever is the classic symptom
|
|
7
|
+
* of an affordance that does not carry its own meaning — it is read once and
|
|
8
|
+
* then becomes furniture. Showing it only until the feature has actually been
|
|
9
|
+
* opened keeps the teaching where teaching belongs (the first minute) and
|
|
10
|
+
* leaves the steady state clean.
|
|
11
|
+
*
|
|
12
|
+
* Best effort, like every other pref here: a missing, unreadable or corrupt
|
|
13
|
+
* file simply means "not seen yet", which fails toward showing the hint.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Parse a persisted `{ seen }` value.
|
|
17
|
+
*
|
|
18
|
+
* @param text - Raw file contents.
|
|
19
|
+
* @returns True only for an explicit `seen: true`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseTrajectorySeen(text: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the trajectory scene has ever been opened on this machine.
|
|
24
|
+
*
|
|
25
|
+
* @param dir - Prefs directory (injectable for tests).
|
|
26
|
+
* @returns True when the flag is set.
|
|
27
|
+
*/
|
|
28
|
+
export declare function readTrajectorySeen(dir?: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Record that the trajectory has been opened (best effort).
|
|
31
|
+
*
|
|
32
|
+
* @param dir - Prefs directory (injectable for tests).
|
|
33
|
+
* @returns True when the file was written.
|
|
34
|
+
*/
|
|
35
|
+
export declare function writeTrajectorySeen(dir?: string): boolean;
|
|
36
|
+
//# sourceMappingURL=trajectoryPrefs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trajectoryPrefs.d.ts","sourceRoot":"","sources":["../../src/trajectoryPrefs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQzD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAiB,GAAG,OAAO,CAMlE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAiB,GAAG,OAAO,CAQnE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persisted "the user has seen the trajectory" flag, at
|
|
3
|
+
* `~/.dsh-tui/trajectory.json`.
|
|
4
|
+
*
|
|
5
|
+
* It exists so the key hint beside the status-line wake can retire itself.
|
|
6
|
+
* A permanent `ctrl+t` printed on every frame forever is the classic symptom
|
|
7
|
+
* of an affordance that does not carry its own meaning — it is read once and
|
|
8
|
+
* then becomes furniture. Showing it only until the feature has actually been
|
|
9
|
+
* opened keeps the teaching where teaching belongs (the first minute) and
|
|
10
|
+
* leaves the steady state clean.
|
|
11
|
+
*
|
|
12
|
+
* Best effort, like every other pref here: a missing, unreadable or corrupt
|
|
13
|
+
* file simply means "not seen yet", which fails toward showing the hint.
|
|
14
|
+
*/
|
|
15
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
import { DATA_DIR } from './utils/paths.js';
|
|
18
|
+
const FILE = 'trajectory.json';
|
|
19
|
+
/**
|
|
20
|
+
* Parse a persisted `{ seen }` value.
|
|
21
|
+
*
|
|
22
|
+
* @param text - Raw file contents.
|
|
23
|
+
* @returns True only for an explicit `seen: true`.
|
|
24
|
+
*/
|
|
25
|
+
export function parseTrajectorySeen(text) {
|
|
26
|
+
try {
|
|
27
|
+
const parsed = JSON.parse(text);
|
|
28
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
29
|
+
return false;
|
|
30
|
+
return parsed.seen === true;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether the trajectory scene has ever been opened on this machine.
|
|
38
|
+
*
|
|
39
|
+
* @param dir - Prefs directory (injectable for tests).
|
|
40
|
+
* @returns True when the flag is set.
|
|
41
|
+
*/
|
|
42
|
+
export function readTrajectorySeen(dir = DATA_DIR) {
|
|
43
|
+
try {
|
|
44
|
+
return parseTrajectorySeen(readFileSync(join(dir, FILE), 'utf8'));
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Record that the trajectory has been opened (best effort).
|
|
52
|
+
*
|
|
53
|
+
* @param dir - Prefs directory (injectable for tests).
|
|
54
|
+
* @returns True when the file was written.
|
|
55
|
+
*/
|
|
56
|
+
export function writeTrajectorySeen(dir = DATA_DIR) {
|
|
57
|
+
try {
|
|
58
|
+
mkdirSync(dir, { recursive: true });
|
|
59
|
+
writeFileSync(join(dir, FILE), JSON.stringify({ seen: true }, null, 2));
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
package/lib/types/update.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { shellQuote } from './utils/shellQuote.js';
|
|
2
|
+
export { shellQuote };
|
|
1
3
|
export interface TuiUpdateInfo {
|
|
2
4
|
current: string;
|
|
3
5
|
latest: string;
|
|
@@ -53,8 +55,6 @@ export declare function resolveTuiUpdateTarget(): Promise<TuiUpdateTarget>;
|
|
|
53
55
|
* or blocks the interactive TUI.
|
|
54
56
|
*/
|
|
55
57
|
export declare function checkForTuiUpdate(): Promise<TuiUpdateInfo | undefined>;
|
|
56
|
-
/** cmd.exe joins spawn arguments with spaces; quote anything that could split. */
|
|
57
|
-
export declare function shellQuote(args: readonly string[]): string[];
|
|
58
58
|
/**
|
|
59
59
|
* Update the installed dsh-tui package and restart the same launcher while
|
|
60
60
|
* preserving the active session. The TUI must already be unmounted before
|
|
@@ -63,7 +63,7 @@ export declare function shellQuote(args: readonly string[]): string[];
|
|
|
63
63
|
* `--latest` is required: `pnpm add` writes a caret range into the profile
|
|
64
64
|
* manifest, and a plain `pnpm update` stays inside that range — with this
|
|
65
65
|
* project's minor-per-release cadence the TUI would restart unchanged while
|
|
66
|
-
* reporting success. The restart carries `
|
|
66
|
+
* reporting success. The restart carries `DSH_TUI_UPDATED_FROM` so the new
|
|
67
67
|
* process can warn when the version did not actually move (e.g. a mirror
|
|
68
68
|
* registry still serving the old `latest`).
|
|
69
69
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAIlD,OAAO,EAAE,UAAU,EAAE,CAAA;AAQrB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf;AAED,4DAA4D;AAC5D,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAEvB,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAiBxD;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,GAAE,SAAS,MAAM,EAAiB,GAAG,MAAM,GAAG,SAAS,CAahG;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAW5C;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAIzE;AA4BD;;;;GAIG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,eAAe,CAAC,CASvE;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAG5E;AAgDD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAuBtG"}
|
package/lib/types/update.js
CHANGED
|
@@ -4,11 +4,15 @@ import { homedir } from 'node:os';
|
|
|
4
4
|
import { dirname, join } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { gt, valid } from 'semver';
|
|
7
|
+
import { shellQuote } from './utils/shellQuote.js';
|
|
8
|
+
// Re-exported for scripts/verify-update.mjs and the bin launcher, which reads
|
|
9
|
+
// the compiled copy at lib/types/utils/shellQuote.js.
|
|
10
|
+
export { shellQuote };
|
|
7
11
|
const PACKAGE_NAME = '@deepseek-harness-tui/dsh-tui';
|
|
8
12
|
const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
|
|
9
13
|
const UPDATE_CHECK_TIMEOUT_MS = 4000;
|
|
10
14
|
/** env marker set on the /update restart; the new process verifies it at boot. */
|
|
11
|
-
const UPDATED_FROM_ENV = '
|
|
15
|
+
const UPDATED_FROM_ENV = 'DSH_TUI_UPDATED_FROM';
|
|
12
16
|
/** Read the version from either the compiled package or the source checkout. */
|
|
13
17
|
export function installedTuiVersion() {
|
|
14
18
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
@@ -130,10 +134,6 @@ export async function checkForTuiUpdate() {
|
|
|
130
134
|
const target = await resolveTuiUpdateTarget();
|
|
131
135
|
return target.kind === 'update' ? { current: target.current, latest: target.latest } : undefined;
|
|
132
136
|
}
|
|
133
|
-
/** cmd.exe joins spawn arguments with spaces; quote anything that could split. */
|
|
134
|
-
export function shellQuote(args) {
|
|
135
|
-
return args.map(arg => (/[ \t"^&|<>()]/.test(arg) ? `"${arg.replace(/"/g, '""')}"` : arg));
|
|
136
|
-
}
|
|
137
137
|
/**
|
|
138
138
|
* Run a child process with its output attached to the user's terminal. The
|
|
139
139
|
* shell is opt-in per call: `dsh.cmd` needs it, but the node restart must
|
|
@@ -145,7 +145,15 @@ function runProcess(command, args, options = {}) {
|
|
|
145
145
|
return new Promise(resolve => {
|
|
146
146
|
let settled = false;
|
|
147
147
|
const useShell = options.shell === true && process.platform === 'win32';
|
|
148
|
-
|
|
148
|
+
// DEP0190 (issue #148): Node ≥22 warns on `shell: true` with a non-empty
|
|
149
|
+
// args array even when every arg is escaped — the check is syntactic.
|
|
150
|
+
// Fold the shell-quoted args into the command string instead (an empty
|
|
151
|
+
// args array does not trigger the warning); future Node majors may turn
|
|
152
|
+
// the deprecation into a hard error.
|
|
153
|
+
const [runCommand, runArgs] = useShell
|
|
154
|
+
? [`${command} ${shellQuote(args).join(' ')}`, []]
|
|
155
|
+
: [command, args];
|
|
156
|
+
const child = spawn(runCommand, runArgs, {
|
|
149
157
|
env: options.env,
|
|
150
158
|
stdio: 'inherit',
|
|
151
159
|
shell: useShell,
|
|
@@ -171,7 +179,7 @@ function runProcess(command, args, options = {}) {
|
|
|
171
179
|
* `--latest` is required: `pnpm add` writes a caret range into the profile
|
|
172
180
|
* manifest, and a plain `pnpm update` stays inside that range — with this
|
|
173
181
|
* project's minor-per-release cadence the TUI would restart unchanged while
|
|
174
|
-
* reporting success. The restart carries `
|
|
182
|
+
* reporting success. The restart carries `DSH_TUI_UPDATED_FROM` so the new
|
|
175
183
|
* process can warn when the version did not actually move (e.g. a mirror
|
|
176
184
|
* registry still serving the old `latest`).
|
|
177
185
|
*
|
|
@@ -195,6 +203,9 @@ export async function updateTuiAndRestart(sessionId, profile) {
|
|
|
195
203
|
const restartCode = await runProcess(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
196
204
|
env: {
|
|
197
205
|
...process.env,
|
|
206
|
+
// Dual-write the resume contract (issue #120): the cordis layer of a
|
|
207
|
+
// still-old TUI build reads only DSH_CC_RESUME_SESSION.
|
|
208
|
+
DSH_TUI_RESUME_SESSION: sessionId,
|
|
198
209
|
DSH_CC_RESUME_SESSION: sessionId,
|
|
199
210
|
[UPDATED_FROM_ENV]: installedTuiVersion() ?? '',
|
|
200
211
|
},
|