@deepseek-harness-tui/dsh-tui 0.11.1 → 0.11.2
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 +50 -20
- package/assets/whale-girl/whale-girl-dark.png +0 -0
- package/assets/whale-girl/whale-girl-happy.png +0 -0
- package/assets/whale-girl/whale-girl.png +0 -0
- package/bin/dsh-tui.js +63 -3
- package/cordis.patch.yml +39 -17
- package/cordis.yml +3 -2
- package/lib/settings.json +1272 -0
- package/lib/types/adapter/channel/ui-policy.d.ts +9 -2
- package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
- package/lib/types/adapter/channel/ui-policy.js +13 -0
- package/lib/types/adapter/kernel/replay.d.ts.map +1 -1
- package/lib/types/adapter/kernel/replay.js +2 -0
- package/lib/types/adapter/ports/channel-display.d.ts +12 -0
- package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-session.d.ts +38 -0
- package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-settings.d.ts +12 -0
- package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-ui.d.ts +46 -4
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +43 -0
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +2 -0
- package/lib/types/components/BalanceReportRow.d.ts +10 -2
- package/lib/types/components/BalanceReportRow.d.ts.map +1 -1
- package/lib/types/components/BalanceReportRow.js +18 -4
- package/lib/types/components/CompactionStatusRow.d.ts +24 -0
- package/lib/types/components/CompactionStatusRow.d.ts.map +1 -0
- package/lib/types/components/CompactionStatusRow.js +72 -0
- package/lib/types/components/GoalTodoPanel.js +2 -2
- package/lib/types/components/HelpMenu.d.ts +2 -2
- package/lib/types/components/HelpMenu.d.ts.map +1 -1
- package/lib/types/components/HelpMenu.js +5 -4
- package/lib/types/components/InlineMathParagraph.d.ts +22 -0
- package/lib/types/components/InlineMathParagraph.d.ts.map +1 -0
- package/lib/types/components/InlineMathParagraph.js +178 -0
- package/lib/types/components/LogoV2.d.ts +41 -3
- package/lib/types/components/LogoV2.d.ts.map +1 -1
- package/lib/types/components/LogoV2.js +148 -24
- package/lib/types/components/Markdown.d.ts +10 -3
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +47 -14
- package/lib/types/components/MathBlock.d.ts +13 -0
- package/lib/types/components/MathBlock.d.ts.map +1 -0
- package/lib/types/components/MathBlock.js +136 -0
- package/lib/types/components/MessageList.d.ts +10 -1
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +13 -4
- package/lib/types/components/MigratePicker.d.ts +30 -0
- package/lib/types/components/MigratePicker.d.ts.map +1 -0
- package/lib/types/components/MigratePicker.js +38 -0
- package/lib/types/components/PromptInput.d.ts +17 -0
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +48 -7
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +2 -1
- package/lib/types/components/StarPrompt.d.ts +53 -0
- package/lib/types/components/StarPrompt.d.ts.map +1 -0
- package/lib/types/components/StarPrompt.js +281 -0
- package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
- package/lib/types/components/StreamingMarkdown.js +20 -3
- package/lib/types/components/TimelineRail.d.ts.map +1 -1
- package/lib/types/components/TimelineRail.js +9 -1
- package/lib/types/components/Whale.d.ts +17 -8
- package/lib/types/components/Whale.d.ts.map +1 -1
- package/lib/types/components/Whale.js +25 -15
- package/lib/types/components/WhaleGirl.d.ts +29 -0
- package/lib/types/components/WhaleGirl.d.ts.map +1 -0
- package/lib/types/components/WhaleGirl.js +32 -0
- package/lib/types/components/WorkingSpinner.d.ts +4 -1
- package/lib/types/components/WorkingSpinner.d.ts.map +1 -1
- package/lib/types/components/WorkingSpinner.js +2 -2
- package/lib/types/components/bigfont.d.ts +47 -18
- package/lib/types/components/bigfont.d.ts.map +1 -1
- package/lib/types/components/bigfont.js +55 -40
- package/lib/types/components/design-system/ThemeProvider.d.ts +6 -0
- package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
- package/lib/types/components/design-system/ThemeProvider.js +40 -1
- package/lib/types/components/maidPortrait.d.ts +44 -0
- package/lib/types/components/maidPortrait.d.ts.map +1 -0
- package/lib/types/components/maidPortrait.js +178 -0
- package/lib/types/components/mathPreview.d.ts +25 -0
- package/lib/types/components/mathPreview.d.ts.map +1 -0
- package/lib/types/components/mathPreview.js +48 -0
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantThinkingMessage.js +2 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +3 -2
- package/lib/types/components/messages/TranscriptImages.d.ts.map +1 -1
- package/lib/types/components/messages/TranscriptImages.js +11 -1
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +14 -2
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +80 -38
- package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
- package/lib/types/components/questions/PlanReviewPanel.js +3 -3
- package/lib/types/components/sessions/ForeignSessionRow.d.ts +34 -0
- package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -0
- package/lib/types/components/sessions/ForeignSessionRow.js +43 -0
- package/lib/types/components/sessions/SourceTabs.d.ts +52 -0
- package/lib/types/components/sessions/SourceTabs.d.ts.map +1 -0
- package/lib/types/components/sessions/SourceTabs.js +70 -0
- package/lib/types/components/splashEggs.d.ts +56 -0
- package/lib/types/components/splashEggs.d.ts.map +1 -0
- package/lib/types/components/splashEggs.js +67 -0
- package/lib/types/components/splashFonts.d.ts +119 -0
- package/lib/types/components/splashFonts.d.ts.map +1 -0
- package/lib/types/components/splashFonts.js +267 -0
- package/lib/types/components/splashLayout.d.ts +41 -0
- package/lib/types/components/splashLayout.d.ts.map +1 -0
- package/lib/types/components/splashLayout.js +40 -0
- package/lib/types/components/whaleGirlSprite.d.ts +17 -0
- package/lib/types/components/whaleGirlSprite.d.ts.map +1 -0
- package/lib/types/components/whaleGirlSprite.js +47 -0
- package/lib/types/deepseekPricing.d.ts +74 -0
- package/lib/types/deepseekPricing.d.ts.map +1 -1
- package/lib/types/deepseekPricing.js +110 -11
- package/lib/types/dsh-adapter/channel/action-readiness.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/action-readiness.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/action-readiness.js +6 -1
- package/lib/types/dsh-adapter/channel/background-action.d.ts +1 -0
- package/lib/types/dsh-adapter/channel/background-action.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/background-action.js +1 -0
- package/lib/types/dsh-adapter/channel/binding-events.d.ts +8 -9
- package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +69 -21
- package/lib/types/dsh-adapter/channel/compaction.d.ts +2 -1
- package/lib/types/dsh-adapter/channel/compaction.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/compaction.js +35 -2
- package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/local-actions.js +6 -1
- package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-switch.js +5 -1
- package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/paths.js +7 -1
- package/lib/types/dsh-adapter/channel/preferences.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/preferences.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/preferences.js +16 -0
- package/lib/types/dsh-adapter/channel/projection.d.ts +1 -2
- package/lib/types/dsh-adapter/channel/projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection.js +127 -17
- package/lib/types/dsh-adapter/channel/question-record.d.ts +76 -0
- package/lib/types/dsh-adapter/channel/question-record.d.ts.map +1 -0
- package/lib/types/dsh-adapter/channel/question-record.js +107 -0
- package/lib/types/dsh-adapter/channel/session-lineage.d.ts +42 -0
- package/lib/types/dsh-adapter/channel/session-lineage.d.ts.map +1 -0
- package/lib/types/dsh-adapter/channel/session-lineage.js +51 -0
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +2 -0
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.js +9 -3
- package/lib/types/dsh-adapter/channel/session-metadata.d.ts +2 -1
- package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-metadata.js +39 -7
- package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.js +7 -0
- package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -0
- package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.js +4 -2
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +8 -0
- package/lib/types/dsh-adapter/channel/state.d.ts +14 -1
- package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/state.js +6 -1
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +30 -35
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-projection.js +138 -4
- package/lib/types/dsh-adapter/channel/types.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +19 -4
- package/lib/types/dsh-adapter/compat/messages.d.ts +6 -0
- package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/messages.js +9 -0
- package/lib/types/dsh-adapter/contract.d.ts +5 -5
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +8 -6
- package/lib/types/dsh-adapter/index.d.ts +36 -1
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +22 -6
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.d.ts +3 -0
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.js +131 -0
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.d.ts +17 -0
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.js +329 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.d.ts +3 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.js +102 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.parse.d.ts +16 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.parse.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.parse.js +289 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.d.ts +3 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.js +117 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.d.ts +13 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.js +178 -0
- package/lib/types/dsh-adapter/migrate/adapters/omp.d.ts +3 -0
- package/lib/types/dsh-adapter/migrate/adapters/omp.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/omp.js +133 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan-fs.d.ts +60 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan-fs.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan-fs.js +178 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan.d.ts +8 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan.js +40 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.d.ts +3 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.js +93 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.d.ts +9 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.js +89 -0
- package/lib/types/dsh-adapter/migrate/bin-path.d.ts +6 -0
- package/lib/types/dsh-adapter/migrate/bin-path.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/bin-path.js +30 -0
- package/lib/types/dsh-adapter/migrate/browse.d.ts +42 -0
- package/lib/types/dsh-adapter/migrate/browse.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/browse.js +90 -0
- package/lib/types/dsh-adapter/migrate/cli.d.ts +9 -0
- package/lib/types/dsh-adapter/migrate/cli.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/cli.js +106 -0
- package/lib/types/dsh-adapter/migrate/import-one.d.ts +89 -0
- package/lib/types/dsh-adapter/migrate/import-one.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/import-one.js +133 -0
- package/lib/types/dsh-adapter/migrate/index.d.ts +35 -0
- package/lib/types/dsh-adapter/migrate/index.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/index.js +107 -0
- package/lib/types/dsh-adapter/migrate/parse/injection.d.ts +40 -0
- package/lib/types/dsh-adapter/migrate/parse/injection.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/parse/injection.js +127 -0
- package/lib/types/dsh-adapter/migrate/parse/jsonl.d.ts +28 -0
- package/lib/types/dsh-adapter/migrate/parse/jsonl.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/parse/jsonl.js +40 -0
- package/lib/types/dsh-adapter/migrate/parse/role-turns.d.ts +28 -0
- package/lib/types/dsh-adapter/migrate/parse/role-turns.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/parse/role-turns.js +50 -0
- package/lib/types/dsh-adapter/migrate/parse/title.d.ts +18 -0
- package/lib/types/dsh-adapter/migrate/parse/title.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/parse/title.js +29 -0
- package/lib/types/dsh-adapter/migrate/parse/tools.d.ts +62 -0
- package/lib/types/dsh-adapter/migrate/parse/tools.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/parse/tools.js +110 -0
- package/lib/types/dsh-adapter/migrate/picker.d.ts +64 -0
- package/lib/types/dsh-adapter/migrate/picker.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/picker.js +86 -0
- package/lib/types/dsh-adapter/migrate/recent-agents.d.ts +40 -0
- package/lib/types/dsh-adapter/migrate/recent-agents.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/recent-agents.js +100 -0
- package/lib/types/dsh-adapter/migrate/sessionize.d.ts +39 -0
- package/lib/types/dsh-adapter/migrate/sessionize.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/sessionize.js +271 -0
- package/lib/types/dsh-adapter/migrate/types.d.ts +176 -0
- package/lib/types/dsh-adapter/migrate/types.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/types.js +11 -0
- package/lib/types/dsh-adapter/migrate/uuid.d.ts +7 -0
- package/lib/types/dsh-adapter/migrate/uuid.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/uuid.js +25 -0
- package/lib/types/dsh-adapter/plugin.d.ts +4 -2
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +143 -364
- package/lib/types/dsh-adapter/providerWizard.d.ts +17 -0
- package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
- package/lib/types/dsh-adapter/providerWizard.js +254 -66
- package/lib/types/dsh-adapter/questions.d.ts +22 -15
- package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/questions.js +47 -45
- package/lib/types/dsh-adapter/sessions/digest.d.ts +11 -6
- package/lib/types/dsh-adapter/sessions/digest.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessions/digest.js +20 -13
- package/lib/types/dsh-adapter/sessions/frames.d.ts +3 -1
- package/lib/types/dsh-adapter/sessions/frames.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessions/frames.js +5 -4
- package/lib/types/dsh-adapter/sessions/list.d.ts +6 -1
- package/lib/types/dsh-adapter/sessions/list.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessions/list.js +188 -164
- package/lib/types/dsh-adapter/sessions/recovery.d.ts +16 -0
- package/lib/types/dsh-adapter/sessions/recovery.d.ts.map +1 -0
- package/lib/types/dsh-adapter/sessions/recovery.js +108 -0
- package/lib/types/dsh-adapter/sessions/snapshot.d.ts +7 -0
- package/lib/types/dsh-adapter/sessions/snapshot.d.ts.map +1 -0
- package/lib/types/dsh-adapter/sessions/snapshot.js +90 -0
- package/lib/types/dsh-adapter/sessions/store.d.ts +10 -4
- package/lib/types/dsh-adapter/sessions/store.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessions/store.js +62 -25
- package/lib/types/dsh-adapter/sideQuestion.d.ts +41 -2
- package/lib/types/dsh-adapter/sideQuestion.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sideQuestion.js +98 -2
- package/lib/types/dsh-adapter/subagents.d.ts +28 -3
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +77 -2
- package/lib/types/herdr.d.ts +2 -0
- package/lib/types/herdr.d.ts.map +1 -1
- package/lib/types/herdr.js +9 -3
- package/lib/types/i18n.d.ts +424 -42
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +145 -20
- package/lib/types/ink/components/App.d.ts +2 -2
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +5 -1
- package/lib/types/ink/components/Image.d.ts +14 -1
- package/lib/types/ink/components/Image.d.ts.map +1 -1
- package/lib/types/ink/components/Image.js +2 -2
- package/lib/types/ink/events/input-event.js +3 -3
- package/lib/types/ink/hooks/use-terminal-images.d.ts +12 -0
- package/lib/types/ink/hooks/use-terminal-images.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-terminal-images.js +13 -0
- package/lib/types/ink/ink.d.ts +6 -0
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +16 -1
- package/lib/types/ink/kitty-graphics.d.ts +44 -3
- package/lib/types/ink/kitty-graphics.d.ts.map +1 -1
- package/lib/types/ink/kitty-graphics.js +184 -23
- package/lib/types/ink/output.d.ts +24 -2
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +83 -5
- package/lib/types/ink/parse-keypress.d.ts +26 -1
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +156 -13
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +8 -1
- package/lib/types/ink/screen.d.ts +24 -0
- package/lib/types/ink/screen.d.ts.map +1 -1
- package/lib/types/ink/screen.js +89 -0
- package/lib/types/ink/selection.d.ts +40 -18
- package/lib/types/ink/selection.d.ts.map +1 -1
- package/lib/types/ink/selection.js +142 -30
- package/lib/types/ink/sixel-codec.d.ts +12 -1
- package/lib/types/ink/sixel-codec.d.ts.map +1 -1
- package/lib/types/ink/sixel-codec.js +29 -5
- package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
- package/lib/types/ink/sixel-graphics.js +5 -3
- package/lib/types/ink/styles.d.ts +9 -0
- package/lib/types/ink/styles.d.ts.map +1 -1
- package/lib/types/ink/terminal-image.d.ts +8 -0
- package/lib/types/ink/terminal-image.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.d.ts +7 -1
- package/lib/types/ink/terminal-querier.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.js +12 -2
- package/lib/types/ink/timeline-rail.d.ts +5 -0
- package/lib/types/ink/timeline-rail.d.ts.map +1 -1
- package/lib/types/math/inline-layout.d.ts +29 -0
- package/lib/types/math/inline-layout.d.ts.map +1 -0
- package/lib/types/math/inline-layout.js +106 -0
- package/lib/types/math/layout.d.ts +58 -0
- package/lib/types/math/layout.d.ts.map +1 -0
- package/lib/types/math/layout.js +59 -0
- package/lib/types/math/renderer.d.ts +64 -0
- package/lib/types/math/renderer.d.ts.map +1 -0
- package/lib/types/math/renderer.js +256 -0
- package/lib/types/screens/Chat.d.ts +14 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +606 -53
- package/lib/types/screens/SessionSupervisor.d.ts +2 -1
- package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/SessionSupervisor.js +156 -19
- package/lib/types/screens/Settings.d.ts.map +1 -1
- package/lib/types/screens/Settings.js +49 -11
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +45 -15
- package/lib/types/screens/chatOverlay.d.ts +5 -0
- package/lib/types/screens/chatOverlay.d.ts.map +1 -1
- package/lib/types/screens/chatOverlay.js +1 -0
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +47 -0
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -0
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +65 -0
- package/lib/types/screens/sessionSupervisor/model.d.ts +12 -0
- package/lib/types/screens/sessionSupervisor/model.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/model.js +26 -0
- package/lib/types/screens/sessionSupervisor/useForeignSessions.d.ts +107 -0
- package/lib/types/screens/sessionSupervisor/useForeignSessions.d.ts.map +1 -0
- package/lib/types/screens/sessionSupervisor/useForeignSessions.js +312 -0
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +4 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +97 -14
- package/lib/types/sessionHistory.d.ts +2 -2
- package/lib/types/sessionHistory.d.ts.map +1 -1
- package/lib/types/sessionHistory.js +31 -5
- package/lib/types/settings/definitions.d.ts +681 -0
- package/lib/types/settings/definitions.d.ts.map +1 -0
- package/lib/types/settings/definitions.js +511 -0
- package/lib/types/starAction.d.ts +44 -0
- package/lib/types/starAction.d.ts.map +1 -0
- package/lib/types/starAction.js +52 -0
- package/lib/types/terminal-utils/latex.d.ts +10 -0
- package/lib/types/terminal-utils/latex.d.ts.map +1 -0
- package/lib/types/terminal-utils/latex.js +1417 -0
- package/lib/types/terminal-utils/markdown.d.ts +3 -1
- package/lib/types/terminal-utils/markdown.d.ts.map +1 -1
- package/lib/types/terminal-utils/markdown.js +26 -1
- package/lib/types/terminal-utils/math.d.ts +66 -0
- package/lib/types/terminal-utils/math.d.ts.map +1 -0
- package/lib/types/terminal-utils/math.js +337 -0
- package/lib/types/tips.d.ts.map +1 -1
- package/lib/types/tips.js +6 -0
- package/lib/types/tuiDisplayPrefs.d.ts +67 -0
- package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
- package/lib/types/tuiDisplayPrefs.js +59 -0
- package/lib/types/ui.d.ts +1 -1
- package/lib/types/ui.d.ts.map +1 -1
- package/lib/types/ui.js +1 -1
- package/lib/types/usageStats.d.ts +98 -0
- package/lib/types/usageStats.d.ts.map +1 -0
- package/lib/types/usageStats.js +169 -0
- package/lib/types/utils/bmp.d.ts +17 -0
- package/lib/types/utils/bmp.d.ts.map +1 -0
- package/lib/types/utils/bmp.js +154 -0
- package/lib/types/utils/clipboard.d.ts +14 -2
- package/lib/types/utils/clipboard.d.ts.map +1 -1
- package/lib/types/utils/clipboard.js +143 -8
- package/lib/types/utils/fold-long-lines.d.ts.map +1 -1
- package/lib/types/utils/fold-long-lines.js +2 -1
- package/lib/types/utils/keymap.d.ts +4 -1
- package/lib/types/utils/keymap.d.ts.map +1 -1
- package/lib/types/utils/keymap.js +8 -0
- package/lib/types/utils/modifiers.d.ts +4 -3
- package/lib/types/utils/modifiers.d.ts.map +1 -1
- package/lib/types/utils/modifiers.js +4 -3
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/LICENSE +202 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/NOTICE +20 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/index.d.ts +16 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/bundled-packages.json +4 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/index.mjs +20 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/index.mjs.LEGAL.txt +35 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/package.json +29 -0
- package/package.json +111 -97
|
@@ -169,6 +169,11 @@ export declare class TerminalQuerier {
|
|
|
169
169
|
}): Promise<Da1Response | undefined>;
|
|
170
170
|
/** Resolve and release all pending queries when their owning app unmounts. */
|
|
171
171
|
dispose(): void;
|
|
172
|
+
/**
|
|
173
|
+
* Receives responses that answer no pending query — e.g. a Kitty graphics
|
|
174
|
+
* error for a placement command sent without suppressing failures.
|
|
175
|
+
*/
|
|
176
|
+
onUnsolicited: ((r: TerminalResponse) => void) | undefined;
|
|
172
177
|
/**
|
|
173
178
|
* Dispatch a response parsed from stdin. Called by App.tsx's
|
|
174
179
|
* processKeysInBatch for every `kind: 'response'` item.
|
|
@@ -185,7 +190,8 @@ export declare class TerminalQuerier {
|
|
|
185
190
|
* and signal its flush() completion. Only draining up to the first
|
|
186
191
|
* sentinel keeps later batches intact when multiple callers have
|
|
187
192
|
* concurrent queries in flight.
|
|
188
|
-
* - Unsolicited responses (no match, no sentinel)
|
|
193
|
+
* - Unsolicited responses (no match, no sentinel) go to
|
|
194
|
+
* {@link onUnsolicited} when set, and are dropped otherwise.
|
|
189
195
|
* @param r - the response parsed from stdin.
|
|
190
196
|
*/
|
|
191
197
|
onResponse(r: TerminalResponse): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-querier.d.ts","sourceRoot":"","sources":["../../../src/ink/terminal-querier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAI3D;;4CAE4C;AAC5C,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,IAAI;IACzE,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,6DAA6D;IAC7D,KAAK,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,CAAC,IAAI,CAAC,CAAA;CACvC,CAAA;AAED,KAAK,cAAc,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAA;AACnE,KAAK,WAAW,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CAAA;AAC7D,KAAK,WAAW,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CAAA;AAC7D,KAAK,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC,CAAA;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AG,SAAS,CAAC;IAatE,8EAA8E;IAC9E,OAAO,IAAI,IAAI;IAMf;;;OAGG;IACH,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAY;IAEtE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,UAAU,CAAC,CAAC,EAAE,gBAAgB,GAAG,IAAI;IA4BrC;;;;OAIG;IACH,OAAO,IAAI,IAAI;IAMf,6EAA6E;IAC7E,MAAM,IAAI,IAAI;IAId,OAAO,CAAC,YAAY;CAOrB"}
|
|
@@ -214,6 +214,11 @@ export class TerminalQuerier {
|
|
|
214
214
|
this.suspended = true;
|
|
215
215
|
this.drainPending();
|
|
216
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Receives responses that answer no pending query — e.g. a Kitty graphics
|
|
219
|
+
* error for a placement command sent without suppressing failures.
|
|
220
|
+
*/
|
|
221
|
+
onUnsolicited = undefined;
|
|
217
222
|
/**
|
|
218
223
|
* Dispatch a response parsed from stdin. Called by App.tsx's
|
|
219
224
|
* processKeysInBatch for every `kind: 'response'` item.
|
|
@@ -230,7 +235,8 @@ export class TerminalQuerier {
|
|
|
230
235
|
* and signal its flush() completion. Only draining up to the first
|
|
231
236
|
* sentinel keeps later batches intact when multiple callers have
|
|
232
237
|
* concurrent queries in flight.
|
|
233
|
-
* - Unsolicited responses (no match, no sentinel)
|
|
238
|
+
* - Unsolicited responses (no match, no sentinel) go to
|
|
239
|
+
* {@link onUnsolicited} when set, and are dropped otherwise.
|
|
234
240
|
* @param r - the response parsed from stdin.
|
|
235
241
|
*/
|
|
236
242
|
onResponse(r) {
|
|
@@ -247,8 +253,10 @@ export class TerminalQuerier {
|
|
|
247
253
|
}
|
|
248
254
|
if (r.type === 'da1') {
|
|
249
255
|
const s = this.queue.findIndex(p => p.kind === 'sentinel');
|
|
250
|
-
if (s === -1)
|
|
256
|
+
if (s === -1) {
|
|
257
|
+
this.onUnsolicited?.(r);
|
|
251
258
|
return;
|
|
259
|
+
}
|
|
252
260
|
for (const p of this.queue.splice(0, s + 1)) {
|
|
253
261
|
if (p.kind === 'query')
|
|
254
262
|
p.resolve(undefined);
|
|
@@ -256,7 +264,9 @@ export class TerminalQuerier {
|
|
|
256
264
|
p.resolve(r);
|
|
257
265
|
p.releaseRawMode();
|
|
258
266
|
}
|
|
267
|
+
return;
|
|
259
268
|
}
|
|
269
|
+
this.onUnsolicited?.(r);
|
|
260
270
|
}
|
|
261
271
|
/**
|
|
262
272
|
* Resolve outstanding queries before stdin is handed to another process.
|
|
@@ -63,6 +63,11 @@ export interface TimelineSnapshot {
|
|
|
63
63
|
/** Turn owning the viewport top row; first turn while pre-turn content
|
|
64
64
|
* owns the top; null only when there are no turns. */
|
|
65
65
|
activeId: number | null;
|
|
66
|
+
/** Turn the sticky header names: the active turn once its prompt has
|
|
67
|
+
* scrolled out above the viewport top (or is folded away); null while
|
|
68
|
+
* that prompt, or pre-turn content such as the logo, is still on the
|
|
69
|
+
* top row, where naming it would repeat text already on screen. */
|
|
70
|
+
pinnedId: number | null;
|
|
66
71
|
/** ▲ target (strictly above the top), null at the first turn. */
|
|
67
72
|
upId: number | null;
|
|
68
73
|
/** ▼ target (below the top and reachable), null at the end. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-rail.d.ts","sourceRoot":"","sources":["../../../src/ink/timeline-rail.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,qDAAqD;AACrD,eAAO,MAAM,UAAU,IAAI,CAAA;AAE3B,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,KAAK,CAAA;AAEzC,mDAAmD;AACnD,eAAO,MAAM,cAAc,IAAI,CAAA;AAE/B,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC;uEACuE;AACvE,MAAM,WAAW,YAAY;IAC3B,4DAA4D;IAC5D,EAAE,EAAE,MAAM,CAAA;IACV;6BAC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|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Formulas one paragraph may lay out as images; the rest keep Unicode. */
|
|
2
|
+
export declare const INLINE_MEDIA_MAX = 4096;
|
|
3
|
+
export type InlinePiece = {
|
|
4
|
+
readonly kind: 'text';
|
|
5
|
+
readonly text: string;
|
|
6
|
+
readonly width: number;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'media';
|
|
9
|
+
readonly index: number;
|
|
10
|
+
readonly columns: number;
|
|
11
|
+
};
|
|
12
|
+
export type InlineRow = {
|
|
13
|
+
readonly pieces: readonly InlinePiece[];
|
|
14
|
+
/** Columns the row's content spans. */
|
|
15
|
+
readonly width: number;
|
|
16
|
+
/** The row continues the previous one (a wrap, not a source newline). */
|
|
17
|
+
readonly continuation: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** The placeholder run standing in for formula `index`, `columns` cells wide. */
|
|
20
|
+
export declare function inlineMediaPlaceholder(index: number, columns: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* Wrap `formatted` (ANSI text containing placeholder runs for `columns.length`
|
|
23
|
+
* formulas) to `width` and split every row into text and media pieces.
|
|
24
|
+
* Returns undefined when a formula could not be kept whole on one row — its
|
|
25
|
+
* run was split by a hard wrap (wider than the row) or appears more than once
|
|
26
|
+
* — so the caller keeps the plain text rendering instead.
|
|
27
|
+
*/
|
|
28
|
+
export declare function layoutInlineMedia(formatted: string, width: number, columns: readonly number[]): InlineRow[] | undefined;
|
|
29
|
+
//# sourceMappingURL=inline-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-layout.d.ts","sourceRoot":"","sources":["../../../src/math/inline-layout.ts"],"names":[],"mappings":"AAoBA,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,OAAS,CAAA;AAItC,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACxE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAA;IACvC,uCAAuC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,yEAAyE;IACzE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;CAC/B,CAAA;AAED,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAK7E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,SAAS,EAAE,GAAG,SAAS,CA2CzB"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Line layout for a paragraph whose inline formulas are terminal images.
|
|
3
|
+
*
|
|
4
|
+
* Each formula is stood in for by a run of placeholder characters as wide as
|
|
5
|
+
* its image (one private-use code point per formula, so neighbouring
|
|
6
|
+
* formulas stay distinguishable), and the formatted paragraph is wrapped by
|
|
7
|
+
* the same `wrapText` that <Text> uses. A run holds no spaces, so it wraps
|
|
8
|
+
* as one unbreakable word: a formula never splits across rows, and a
|
|
9
|
+
* paragraph with no formulas lays out exactly as it does in <Text>. Each
|
|
10
|
+
* wrapped row is then cut into ANSI-balanced text pieces (sliceAnsi re-opens
|
|
11
|
+
* the styles and links a cut crosses) and the image slots between them.
|
|
12
|
+
* Pure: no React, no terminal.
|
|
13
|
+
*/
|
|
14
|
+
import stripAnsi from 'strip-ansi';
|
|
15
|
+
import { stringWidth } from '../ink/stringWidth.js';
|
|
16
|
+
import wrapText from '../ink/wrap-text.js';
|
|
17
|
+
import sliceAnsi from '../utils/sliceAnsi.js';
|
|
18
|
+
/** First placeholder code point (Private Use Area, width 1). */
|
|
19
|
+
const PLACEHOLDER_BASE = 0xe000;
|
|
20
|
+
/** Formulas one paragraph may lay out as images; the rest keep Unicode. */
|
|
21
|
+
export const INLINE_MEDIA_MAX = 0x1000;
|
|
22
|
+
const graphemes = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
|
|
23
|
+
/** The placeholder run standing in for formula `index`, `columns` cells wide. */
|
|
24
|
+
export function inlineMediaPlaceholder(index, columns) {
|
|
25
|
+
if (!Number.isInteger(index) || index < 0 || index >= INLINE_MEDIA_MAX) {
|
|
26
|
+
throw new RangeError(`inline media index out of range: ${index}`);
|
|
27
|
+
}
|
|
28
|
+
return String.fromCodePoint(PLACEHOLDER_BASE + index).repeat(Math.max(1, columns));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Wrap `formatted` (ANSI text containing placeholder runs for `columns.length`
|
|
32
|
+
* formulas) to `width` and split every row into text and media pieces.
|
|
33
|
+
* Returns undefined when a formula could not be kept whole on one row — its
|
|
34
|
+
* run was split by a hard wrap (wider than the row) or appears more than once
|
|
35
|
+
* — so the caller keeps the plain text rendering instead.
|
|
36
|
+
*/
|
|
37
|
+
export function layoutInlineMedia(formatted, width, columns) {
|
|
38
|
+
if (width < 1)
|
|
39
|
+
return undefined;
|
|
40
|
+
const seen = new Set();
|
|
41
|
+
const rows = [];
|
|
42
|
+
const wrapped = wrapText(formatted, width, 'wrap');
|
|
43
|
+
const continuations = wrapContinuations(stripAnsi(formatted), stripAnsi(wrapped));
|
|
44
|
+
for (const [lineIndex, line] of wrapped.split('\n').entries()) {
|
|
45
|
+
const pieces = [];
|
|
46
|
+
const plain = stripAnsi(line);
|
|
47
|
+
let column = 0;
|
|
48
|
+
let textStart = 0;
|
|
49
|
+
let run;
|
|
50
|
+
const flushText = (end) => {
|
|
51
|
+
if (end <= textStart)
|
|
52
|
+
return;
|
|
53
|
+
const text = sliceAnsi(line, textStart, end);
|
|
54
|
+
pieces.push({ kind: 'text', text, width: end - textStart });
|
|
55
|
+
};
|
|
56
|
+
const closeRun = () => {
|
|
57
|
+
if (run === undefined)
|
|
58
|
+
return true;
|
|
59
|
+
const length = column - run.start;
|
|
60
|
+
if (seen.has(run.index) || length !== columns[run.index])
|
|
61
|
+
return false;
|
|
62
|
+
seen.add(run.index);
|
|
63
|
+
pieces.push({ kind: 'media', index: run.index, columns: length });
|
|
64
|
+
textStart = column;
|
|
65
|
+
run = undefined;
|
|
66
|
+
return true;
|
|
67
|
+
};
|
|
68
|
+
for (const { segment: char } of graphemes.segment(plain)) {
|
|
69
|
+
const code = char.codePointAt(0);
|
|
70
|
+
const index = code - PLACEHOLDER_BASE;
|
|
71
|
+
const isMedia = index >= 0 && index < columns.length;
|
|
72
|
+
if (run !== undefined && (!isMedia || index !== run.index) && !closeRun())
|
|
73
|
+
return undefined;
|
|
74
|
+
if (isMedia && run === undefined) {
|
|
75
|
+
flushText(column);
|
|
76
|
+
run = { index, start: column };
|
|
77
|
+
}
|
|
78
|
+
column += isMedia ? 1 : stringWidth(char);
|
|
79
|
+
}
|
|
80
|
+
if (!closeRun())
|
|
81
|
+
return undefined;
|
|
82
|
+
flushText(column);
|
|
83
|
+
rows.push({ pieces, width: column, continuation: continuations[lineIndex] === true });
|
|
84
|
+
}
|
|
85
|
+
return seen.size === columns.length ? rows : undefined;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* For each line of `wrapped`, whether the newline before it was inserted by
|
|
89
|
+
* wrapping (true) or was in `source` (false). wrapAnsi (trim off) only
|
|
90
|
+
* inserts newlines, so walking both plain strings in step finds them.
|
|
91
|
+
*/
|
|
92
|
+
function wrapContinuations(source, wrapped) {
|
|
93
|
+
const result = [false];
|
|
94
|
+
let at = 0;
|
|
95
|
+
for (const char of wrapped) {
|
|
96
|
+
if (char === '\n') {
|
|
97
|
+
const inSource = source[at] === '\n';
|
|
98
|
+
result.push(!inSource);
|
|
99
|
+
if (inSource)
|
|
100
|
+
at += 1;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
at += char.length;
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal-cell geometry for a typeset formula. Pure: no rasterization.
|
|
3
|
+
*
|
|
4
|
+
* MathJax reports a formula's size in ex. A formula starts at one base scale
|
|
5
|
+
* tied to the terminal's physical cell height (so every formula reads at the
|
|
6
|
+
* same size, like text), shrinks uniformly only when it would exceed the
|
|
7
|
+
* width or height it may occupy, and is never enlarged. The canvas is padded,
|
|
8
|
+
* never stretched, to a whole number of cells.
|
|
9
|
+
*/
|
|
10
|
+
import type { TerminalCellSize } from '../ink/terminal-image.js';
|
|
11
|
+
/** Pixels per ex at the base scale, as a fraction of the cell height. */
|
|
12
|
+
export declare const BASE_EX_TO_CELL_HEIGHT = 0.5;
|
|
13
|
+
/**
|
|
14
|
+
* Display formulas set larger than the body text, like LaTeX (settings
|
|
15
|
+
* `mathImageScale`): at one ex per 0.72 cell heights the glyph strokes get
|
|
16
|
+
* roughly 45% more device pixels, which is what a terminal-drawn ink mask
|
|
17
|
+
* needs to read as clean rather than thin. Inline formulas keep the base
|
|
18
|
+
* scale — their single row of cells clamps the resolution anyway.
|
|
19
|
+
*/
|
|
20
|
+
export declare const LARGE_DISPLAY_EX_TO_CELL_HEIGHT = 0.72;
|
|
21
|
+
/** The next step up: about 80% more pixels than the base scale. */
|
|
22
|
+
export declare const XLARGE_DISPLAY_EX_TO_CELL_HEIGHT = 0.9;
|
|
23
|
+
/**
|
|
24
|
+
* Below this fraction of the base scale the formula is unreadable as an
|
|
25
|
+
* image; the caller keeps the Unicode rendering instead of shrinking further.
|
|
26
|
+
*/
|
|
27
|
+
export declare const MIN_SCALE_FRACTION = 0.5;
|
|
28
|
+
export interface FormulaSize {
|
|
29
|
+
readonly widthEx: number;
|
|
30
|
+
readonly heightEx: number;
|
|
31
|
+
}
|
|
32
|
+
export interface FormulaConstraints {
|
|
33
|
+
readonly cellSize: TerminalCellSize;
|
|
34
|
+
/** Pixels per ex as a fraction of the cell height; defaults to the base scale. */
|
|
35
|
+
readonly baseExToCellHeight?: number;
|
|
36
|
+
readonly maxColumns: number;
|
|
37
|
+
readonly maxRows: number;
|
|
38
|
+
/** Transparent margin around the ink, in device-independent pixels. */
|
|
39
|
+
readonly bleed: number;
|
|
40
|
+
/** Largest canvas edge and RGBA byte size the raster may use. */
|
|
41
|
+
readonly maxEdge: number;
|
|
42
|
+
readonly maxBytes: number;
|
|
43
|
+
}
|
|
44
|
+
export interface FormulaLayoutPlan {
|
|
45
|
+
readonly columns: number;
|
|
46
|
+
readonly rows: number;
|
|
47
|
+
/** Canvas size in device pixels (cells × cell size × deviceScale). */
|
|
48
|
+
readonly canvasWidth: number;
|
|
49
|
+
readonly canvasHeight: number;
|
|
50
|
+
/** Ink box size in device pixels, centered in the canvas. */
|
|
51
|
+
readonly contentWidth: number;
|
|
52
|
+
readonly contentHeight: number;
|
|
53
|
+
readonly pixelsPerEx: number;
|
|
54
|
+
readonly deviceScale: 1 | 2;
|
|
55
|
+
}
|
|
56
|
+
export type FormulaLayoutFailure = 'invalid-dimensions' | 'too-small' | 'raster-limit';
|
|
57
|
+
export declare function planFormulaLayout(size: FormulaSize, constraints: FormulaConstraints): FormulaLayoutPlan | FormulaLayoutFailure;
|
|
58
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/math/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,MAAM,CAAA;AACzC;;;;;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kB,GAC9B,iBAAiB,GAAG,oBAAoB,CA6C1C"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Pixels per ex at the base scale, as a fraction of the cell height. */
|
|
2
|
+
export const BASE_EX_TO_CELL_HEIGHT = 0.5;
|
|
3
|
+
/**
|
|
4
|
+
* Display formulas set larger than the body text, like LaTeX (settings
|
|
5
|
+
* `mathImageScale`): at one ex per 0.72 cell heights the glyph strokes get
|
|
6
|
+
* roughly 45% more device pixels, which is what a terminal-drawn ink mask
|
|
7
|
+
* needs to read as clean rather than thin. Inline formulas keep the base
|
|
8
|
+
* scale — their single row of cells clamps the resolution anyway.
|
|
9
|
+
*/
|
|
10
|
+
export const LARGE_DISPLAY_EX_TO_CELL_HEIGHT = 0.72;
|
|
11
|
+
/** The next step up: about 80% more pixels than the base scale. */
|
|
12
|
+
export const XLARGE_DISPLAY_EX_TO_CELL_HEIGHT = 0.9;
|
|
13
|
+
/**
|
|
14
|
+
* Below this fraction of the base scale the formula is unreadable as an
|
|
15
|
+
* image; the caller keeps the Unicode rendering instead of shrinking further.
|
|
16
|
+
*/
|
|
17
|
+
export const MIN_SCALE_FRACTION = 0.5;
|
|
18
|
+
export function planFormulaLayout(size, constraints) {
|
|
19
|
+
const { cellSize, maxColumns, maxRows, bleed } = constraints;
|
|
20
|
+
if (!(size.widthEx > 0) || !(size.heightEx > 0) ||
|
|
21
|
+
!Number.isFinite(size.widthEx) || !Number.isFinite(size.heightEx) ||
|
|
22
|
+
maxColumns < 1 || maxRows < 1) {
|
|
23
|
+
return 'invalid-dimensions';
|
|
24
|
+
}
|
|
25
|
+
const basePixelsPerEx = cellSize.height * (constraints.baseExToCellHeight ?? BASE_EX_TO_CELL_HEIGHT);
|
|
26
|
+
const availableWidth = maxColumns * cellSize.width - bleed * 2;
|
|
27
|
+
const availableHeight = maxRows * cellSize.height - bleed * 2;
|
|
28
|
+
if (availableWidth <= 0 || availableHeight <= 0)
|
|
29
|
+
return 'too-small';
|
|
30
|
+
const pixelsPerEx = Math.min(basePixelsPerEx, availableWidth / size.widthEx, availableHeight / size.heightEx);
|
|
31
|
+
// Legibility is absolute, not relative to what the caller asked for: the
|
|
32
|
+
// floor stays on the base scale so a larger display request shrinks back to
|
|
33
|
+
// a readable size instead of flipping formulas to the Unicode fallback.
|
|
34
|
+
if (pixelsPerEx < cellSize.height * BASE_EX_TO_CELL_HEIGHT * MIN_SCALE_FRACTION)
|
|
35
|
+
return 'too-small';
|
|
36
|
+
const contentWidth = size.widthEx * pixelsPerEx;
|
|
37
|
+
const contentHeight = size.heightEx * pixelsPerEx;
|
|
38
|
+
const columns = Math.min(maxColumns, Math.ceil((contentWidth + bleed * 2) / cellSize.width));
|
|
39
|
+
const rows = Math.min(maxRows, Math.ceil((contentHeight + bleed * 2) / cellSize.height));
|
|
40
|
+
const fits = (scale) => {
|
|
41
|
+
const width = columns * cellSize.width * scale;
|
|
42
|
+
const height = rows * cellSize.height * scale;
|
|
43
|
+
return width <= constraints.maxEdge && height <= constraints.maxEdge &&
|
|
44
|
+
width * height * 4 <= constraints.maxBytes;
|
|
45
|
+
};
|
|
46
|
+
const deviceScale = fits(2) ? 2 : fits(1) ? 1 : undefined;
|
|
47
|
+
if (deviceScale === undefined)
|
|
48
|
+
return 'raster-limit';
|
|
49
|
+
return {
|
|
50
|
+
columns,
|
|
51
|
+
rows,
|
|
52
|
+
canvasWidth: columns * cellSize.width * deviceScale,
|
|
53
|
+
canvasHeight: rows * cellSize.height * deviceScale,
|
|
54
|
+
contentWidth: contentWidth * deviceScale,
|
|
55
|
+
contentHeight: contentHeight * deviceScale,
|
|
56
|
+
pixelsPerEx: pixelsPerEx * deviceScale,
|
|
57
|
+
deviceScale,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type TerminalCellSize, type TerminalImageSource } from '../ink/terminal-image.js';
|
|
2
|
+
/** Same budget as the Unicode renderer: longer input is a paste, not math. */
|
|
3
|
+
export declare const MATH_SOURCE_LIMIT = 4096;
|
|
4
|
+
export type MathFailureCode = 'empty' | 'input-too-long' | 'tex-error' | 'invalid-dimensions' | 'too-small' | 'raster-limit' | 'empty-raster' | 'clipped-raster' | 'backend-unavailable';
|
|
5
|
+
export interface MathRenderRequest {
|
|
6
|
+
/** TeX without delimiters. */
|
|
7
|
+
readonly tex: string;
|
|
8
|
+
readonly display: boolean;
|
|
9
|
+
/** Ink color as `#rrggbb` (the theme's text color). */
|
|
10
|
+
readonly color: string;
|
|
11
|
+
readonly cellSize: TerminalCellSize;
|
|
12
|
+
/** Largest cell box the formula may occupy; it shrinks to fit, never grows. */
|
|
13
|
+
readonly maxColumns: number;
|
|
14
|
+
readonly maxRows: number;
|
|
15
|
+
/**
|
|
16
|
+
* Pixels per ex as a fraction of the cell height. Display formulas pass
|
|
17
|
+
* {@link DISPLAY_EX_TO_CELL_HEIGHT} so they are set larger than the body
|
|
18
|
+
* text; inline formulas keep the base scale.
|
|
19
|
+
*/
|
|
20
|
+
readonly baseExToCellHeight?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface MathRaster {
|
|
23
|
+
/** Stable identity of this raster (formula, color, geometry). */
|
|
24
|
+
readonly key: string;
|
|
25
|
+
readonly source: TerminalImageSource;
|
|
26
|
+
readonly columns: number;
|
|
27
|
+
readonly rows: number;
|
|
28
|
+
/** Half-open pixel box of visible ink inside the canvas. */
|
|
29
|
+
readonly inkBounds: {
|
|
30
|
+
readonly left: number;
|
|
31
|
+
readonly top: number;
|
|
32
|
+
readonly right: number;
|
|
33
|
+
readonly bottom: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export type MathRenderResult = {
|
|
37
|
+
readonly ok: true;
|
|
38
|
+
readonly raster: MathRaster;
|
|
39
|
+
} | {
|
|
40
|
+
readonly ok: false;
|
|
41
|
+
readonly failure: MathFailureCode;
|
|
42
|
+
};
|
|
43
|
+
/** Cache counters, for tests and debug output. */
|
|
44
|
+
export declare const mathRenderStats: {
|
|
45
|
+
vectorHits: number;
|
|
46
|
+
vectorMisses: number;
|
|
47
|
+
rasterHits: number;
|
|
48
|
+
rasterMisses: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The settled result for this request if one is cached, without rendering.
|
|
52
|
+
* Lets a remounted view (scrolled back into the viewport) paint its image on
|
|
53
|
+
* the first frame instead of flashing the Unicode fallback.
|
|
54
|
+
*/
|
|
55
|
+
export declare function peekMathRaster(request: MathRenderRequest): MathRenderResult | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Typeset and rasterize one formula. Results (including failures) are cached
|
|
58
|
+
* by formula, color and geometry; concurrent requests for the same key share
|
|
59
|
+
* one render.
|
|
60
|
+
*/
|
|
61
|
+
export declare function renderMathRaster(request: MathRenderRequest): Promise<MathRenderResult>;
|
|
62
|
+
/** Drop every cached vector and raster (tests; a future debug command). */
|
|
63
|
+
export declare function clearMathRenderCaches(): void;
|
|
64
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/math/renderer.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAA;AAGjC,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,OAAO,CAAA;AASrC,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,gBAAgB,GAChB,WAAW,GACX,oBAAoB,GACpB,WAAW,GACX,cAAc,GACd,cAAc,GACd,gBAAgB,GAChB,qBAAqB,CAAA;AAEzB,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,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