@deepseek-harness-tui/dsh-tui 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -24
- 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 +93 -6
- package/cordis.patch.yml +63 -22
- package/cordis.yml +3 -2
- package/guide/dsh-tui-guide/SKILL.md +37 -0
- package/guide/dsh-tui-guide/configuration.en.md +410 -0
- package/guide/dsh-tui-guide/configuration.md +349 -0
- package/guide/dsh-tui-guide/getting-started.en.md +398 -0
- package/guide/dsh-tui-guide/getting-started.md +397 -0
- package/guide/dsh-tui-guide/interaction.en.md +674 -0
- package/guide/dsh-tui-guide/interaction.md +747 -0
- package/guide/dsh-tui-guide/migrate.en.md +166 -0
- package/guide/dsh-tui-guide/migrate.md +132 -0
- package/guide/dsh-tui-guide/plugins.en.md +68 -0
- package/guide/dsh-tui-guide/plugins.md +56 -0
- package/guide/dsh-tui-guide/themes.en.md +192 -0
- package/guide/dsh-tui-guide/themes.md +185 -0
- package/guide/dsh-tui-guide/user-guide.en.md +608 -0
- package/guide/dsh-tui-guide/user-guide.md +586 -0
- package/guide/dsh-tui-guide/vscode.en.md +301 -0
- package/guide/dsh-tui-guide/vscode.md +272 -0
- package/lib/settings.json +1272 -0
- package/lib/types/adapter/channel/ui-policy.d.ts +10 -2
- package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
- package/lib/types/adapter/channel/ui-policy.js +17 -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 +14 -1
- package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-ui.d.ts +75 -6
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +86 -9
- 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/Chat/JobCard.d.ts +9 -0
- package/lib/types/components/Chat/JobCard.d.ts.map +1 -1
- package/lib/types/components/Chat/JobCard.js +42 -15
- package/lib/types/components/Chat/SubagentMessage.js +6 -6
- 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/JobsPanel.d.ts.map +1 -1
- package/lib/types/components/JobsPanel.js +80 -33
- 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 +16 -7
- 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/PresetPicker.d.ts +4 -0
- package/lib/types/components/PresetPicker.d.ts.map +1 -1
- package/lib/types/components/PresetPicker.js +5 -1
- 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 +60 -8
- 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 +59 -0
- package/lib/types/components/StarPrompt.d.ts.map +1 -0
- package/lib/types/components/StarPrompt.js +326 -0
- package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
- package/lib/types/components/StreamingMarkdown.js +20 -3
- package/lib/types/components/SubagentCard.d.ts.map +1 -1
- package/lib/types/components/SubagentCard.js +8 -8
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +108 -10
- 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 +35 -0
- package/lib/types/components/WhaleGirl.d.ts.map +1 -0
- package/lib/types/components/WhaleGirl.js +50 -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 +6 -5
- 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/trajectory/MiniWake.d.ts +11 -1
- package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -1
- package/lib/types/components/trajectory/MiniWake.js +9 -3
- 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/external-commands.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/external-commands.js +8 -2
- package/lib/types/dsh-adapter/channel/job-projection.d.ts +1 -0
- package/lib/types/dsh-adapter/channel/job-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/job-projection.js +88 -3
- 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/mode-actions.d.ts +13 -0
- package/lib/types/dsh-adapter/channel/mode-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/mode-actions.js +48 -7
- package/lib/types/dsh-adapter/channel/mode-permission-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/mode-permission-actions.js +25 -9
- 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 +31 -5
- 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 +17 -2
- 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 +143 -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 +35 -5
- 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 +6 -5
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +14 -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/jobs.d.ts +82 -16
- package/lib/types/dsh-adapter/jobs.d.ts.map +1 -1
- package/lib/types/dsh-adapter/jobs.js +104 -9
- 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/oauth/bonus.d.ts +27 -0
- package/lib/types/dsh-adapter/oauth/bonus.d.ts.map +1 -0
- package/lib/types/dsh-adapter/oauth/bonus.js +69 -0
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/command.d.ts +2 -1
- package/lib/types/dsh-adapter/oauth/command.d.ts.map +1 -0
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/command.js +7 -4
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/credentials.d.ts +13 -10
- package/lib/types/dsh-adapter/oauth/credentials.d.ts.map +1 -0
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/credentials.js +61 -23
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts +39 -0
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts.map +1 -0
- package/lib/types/dsh-adapter/oauth/deepseek.js +189 -0
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/index.d.ts +24 -16
- package/lib/types/dsh-adapter/oauth/index.d.ts.map +1 -0
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/index.js +34 -20
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/interaction.d.ts +14 -12
- package/lib/types/dsh-adapter/oauth/interaction.d.ts.map +1 -0
- package/lib/types/dsh-adapter/oauth/interaction.js +283 -0
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/opener.d.ts +2 -1
- package/lib/types/dsh-adapter/oauth/opener.d.ts.map +1 -0
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/opener.js +1 -1
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/pi-ai.d.ts +10 -3
- package/lib/types/dsh-adapter/oauth/pi-ai.d.ts.map +1 -0
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/pi-ai.js +8 -3
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/profiles.d.ts +6 -3
- package/lib/types/dsh-adapter/oauth/profiles.d.ts.map +1 -0
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/profiles.js +11 -3
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/service.d.ts +14 -7
- package/lib/types/dsh-adapter/oauth/service.d.ts.map +1 -0
- package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/service.js +82 -17
- package/lib/types/dsh-adapter/plugin.d.ts +12 -3
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +215 -376
- package/lib/types/dsh-adapter/presets.d.ts +6 -4
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +6 -4
- 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 +260 -68
- 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 +29 -3
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +87 -3
- 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 +598 -60
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +198 -31
- 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 +15 -2
- 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 +61 -1
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +764 -93
- 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 +32 -1
- package/lib/types/ink/terminal-querier.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.js +54 -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/ink/update-overflow-guard.d.ts +24 -0
- package/lib/types/ink/update-overflow-guard.d.ts.map +1 -1
- package/lib/types/ink/update-overflow-guard.js +25 -3
- 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/minimalUiMode.d.ts +19 -0
- package/lib/types/minimalUiMode.d.ts.map +1 -0
- package/lib/types/minimalUiMode.js +23 -0
- package/lib/types/oauth.d.ts +5 -10
- package/lib/types/oauth.d.ts.map +1 -1
- package/lib/types/oauth.js +5 -10
- package/lib/types/screens/Chat.d.ts +17 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +627 -54
- 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 +4 -0
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +57 -27
- 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 +16 -4
- 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/update.js +2 -2
- 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/lib/types/utils/pastedImagePath.d.ts +8 -0
- package/lib/types/utils/pastedImagePath.d.ts.map +1 -1
- package/lib/types/utils/pastedImagePath.js +29 -5
- 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 +127 -102
- package/presets/liangshen/agent.cordis.yml +4 -1
- package/presets/liangshen/preset.yml +1 -1
- package/lib/types/minimalMode.d.ts +0 -13
- package/lib/types/minimalMode.d.ts.map +0 -1
- package/lib/types/minimalMode.js +0 -17
- package/node_modules/@deepseek-harness-tui/dsh-auth/LICENSE +0 -21
- package/node_modules/@deepseek-harness-tui/dsh-auth/README.md +0 -143
- package/node_modules/@deepseek-harness-tui/dsh-auth/cordis.patch.yml +0 -11
- package/node_modules/@deepseek-harness-tui/dsh-auth/dsh-plugin.json +0 -44
- package/node_modules/@deepseek-harness-tui/dsh-auth/lib/interaction.js +0 -193
- package/node_modules/@deepseek-harness-tui/dsh-auth/package.json +0 -69
|
@@ -32,6 +32,7 @@ export function decrqm(mode) {
|
|
|
32
32
|
return {
|
|
33
33
|
request: csi(`?${mode}$p`),
|
|
34
34
|
match: (r) => r.type === 'decrpm' && r.mode === mode,
|
|
35
|
+
responseType: 'decrpm',
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
@@ -44,6 +45,7 @@ export function da1() {
|
|
|
44
45
|
return {
|
|
45
46
|
request: csi('c'),
|
|
46
47
|
match: (r) => r.type === 'da1',
|
|
48
|
+
responseType: 'da1',
|
|
47
49
|
};
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
@@ -54,6 +56,7 @@ export function da2() {
|
|
|
54
56
|
return {
|
|
55
57
|
request: csi('>c'),
|
|
56
58
|
match: (r) => r.type === 'da2',
|
|
59
|
+
responseType: 'da2',
|
|
57
60
|
};
|
|
58
61
|
}
|
|
59
62
|
/**
|
|
@@ -65,6 +68,7 @@ export function kittyKeyboard() {
|
|
|
65
68
|
return {
|
|
66
69
|
request: csi('?u'),
|
|
67
70
|
match: (r) => r.type === 'kittyKeyboard',
|
|
71
|
+
responseType: 'kittyKeyboard',
|
|
68
72
|
};
|
|
69
73
|
}
|
|
70
74
|
/**
|
|
@@ -78,6 +82,7 @@ export function kittyGraphics(imageId) {
|
|
|
78
82
|
// same direct-data + compression path used by real renderer uploads.
|
|
79
83
|
request: `\u001b_Gi=${id},s=1,v=1,a=q,t=d,f=32,o=z;eAFjYGBgAAAABAAB\u001b\\`,
|
|
80
84
|
match: (r) => r.type === 'kittyGraphics' && r.imageId === id,
|
|
85
|
+
responseType: 'kittyGraphics',
|
|
81
86
|
};
|
|
82
87
|
}
|
|
83
88
|
/** XTWINOPS: query the physical pixel dimensions of one terminal cell. */
|
|
@@ -85,6 +90,7 @@ export function terminalCellSizePixels() {
|
|
|
85
90
|
return {
|
|
86
91
|
request: csi('16t'),
|
|
87
92
|
match: (r) => r.type === 'terminalPixelSize' && r.scope === 'cell',
|
|
93
|
+
responseType: 'terminalPixelSize',
|
|
88
94
|
};
|
|
89
95
|
}
|
|
90
96
|
/** XTWINOPS: query the terminal text area's physical pixel dimensions. */
|
|
@@ -92,6 +98,7 @@ export function terminalWindowSizePixels() {
|
|
|
92
98
|
return {
|
|
93
99
|
request: csi('14t'),
|
|
94
100
|
match: (r) => r.type === 'terminalPixelSize' && r.scope === 'window',
|
|
101
|
+
responseType: 'terminalPixelSize',
|
|
95
102
|
};
|
|
96
103
|
}
|
|
97
104
|
/**
|
|
@@ -105,6 +112,7 @@ export function cursorPosition() {
|
|
|
105
112
|
return {
|
|
106
113
|
request: csi('?6n'),
|
|
107
114
|
match: (r) => r.type === 'cursorPosition',
|
|
115
|
+
responseType: 'cursorPosition',
|
|
108
116
|
};
|
|
109
117
|
}
|
|
110
118
|
/**
|
|
@@ -117,6 +125,7 @@ export function oscColor(code) {
|
|
|
117
125
|
return {
|
|
118
126
|
request: osc(code, '?'),
|
|
119
127
|
match: (r) => r.type === 'osc' && r.code === code,
|
|
128
|
+
responseType: 'osc',
|
|
120
129
|
};
|
|
121
130
|
}
|
|
122
131
|
/**
|
|
@@ -131,6 +140,7 @@ export function xtversion() {
|
|
|
131
140
|
return {
|
|
132
141
|
request: csi('>0q'),
|
|
133
142
|
match: (r) => r.type === 'xtversion',
|
|
143
|
+
responseType: 'xtversion',
|
|
134
144
|
};
|
|
135
145
|
}
|
|
136
146
|
// -- Querier --
|
|
@@ -166,6 +176,37 @@ export class TerminalQuerier {
|
|
|
166
176
|
get isSuspended() {
|
|
167
177
|
return this.suspended;
|
|
168
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* In-flight evidence for the input parser (read-only observation): true
|
|
181
|
+
* while at least one query or flush sentinel is still waiting for its
|
|
182
|
+
* reply. Purely observational — queue semantics are untouched.
|
|
183
|
+
*/
|
|
184
|
+
get hasPending() {
|
|
185
|
+
return this.queue.length > 0;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* In-flight evidence for the input parser (read-only observation): the
|
|
189
|
+
* response types of the queries still awaiting a reply, plus `da1` when a
|
|
190
|
+
* flush() sentinel is still open (DA1 is the reply that resolves it).
|
|
191
|
+
*
|
|
192
|
+
* This is bound to the query lifecycle on purpose. A boolean "something
|
|
193
|
+
* was sent recently" lets any recent query authorize a claim for bytes
|
|
194
|
+
* that may belong to no query at all, so the parser receives the expected
|
|
195
|
+
* types instead: a reply tail is only claimed when its shape can complete
|
|
196
|
+
* into one of them, and a query resolved by a sentinel stops counting the
|
|
197
|
+
* moment its promise settles. Purely observational — queue semantics are
|
|
198
|
+
* untouched.
|
|
199
|
+
*/
|
|
200
|
+
get pendingResponseTypes() {
|
|
201
|
+
const types = new Set();
|
|
202
|
+
for (const pending of this.queue) {
|
|
203
|
+
if (pending.kind === 'query')
|
|
204
|
+
types.add(pending.responseType);
|
|
205
|
+
else
|
|
206
|
+
types.add('da1');
|
|
207
|
+
}
|
|
208
|
+
return types;
|
|
209
|
+
}
|
|
169
210
|
holdRawMode() {
|
|
170
211
|
this.setRawMode?.(true);
|
|
171
212
|
return () => this.setRawMode?.(false);
|
|
@@ -190,6 +231,7 @@ export class TerminalQuerier {
|
|
|
190
231
|
this.queue.push({
|
|
191
232
|
kind: 'query',
|
|
192
233
|
match: query.match,
|
|
234
|
+
responseType: query.responseType,
|
|
193
235
|
resolve: r => resolve(r),
|
|
194
236
|
releaseRawMode: this.holdRawMode(),
|
|
195
237
|
});
|
|
@@ -214,6 +256,11 @@ export class TerminalQuerier {
|
|
|
214
256
|
this.suspended = true;
|
|
215
257
|
this.drainPending();
|
|
216
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Receives responses that answer no pending query — e.g. a Kitty graphics
|
|
261
|
+
* error for a placement command sent without suppressing failures.
|
|
262
|
+
*/
|
|
263
|
+
onUnsolicited = undefined;
|
|
217
264
|
/**
|
|
218
265
|
* Dispatch a response parsed from stdin. Called by App.tsx's
|
|
219
266
|
* processKeysInBatch for every `kind: 'response'` item.
|
|
@@ -230,7 +277,8 @@ export class TerminalQuerier {
|
|
|
230
277
|
* and signal its flush() completion. Only draining up to the first
|
|
231
278
|
* sentinel keeps later batches intact when multiple callers have
|
|
232
279
|
* concurrent queries in flight.
|
|
233
|
-
* - Unsolicited responses (no match, no sentinel)
|
|
280
|
+
* - Unsolicited responses (no match, no sentinel) go to
|
|
281
|
+
* {@link onUnsolicited} when set, and are dropped otherwise.
|
|
234
282
|
* @param r - the response parsed from stdin.
|
|
235
283
|
*/
|
|
236
284
|
onResponse(r) {
|
|
@@ -247,8 +295,10 @@ export class TerminalQuerier {
|
|
|
247
295
|
}
|
|
248
296
|
if (r.type === 'da1') {
|
|
249
297
|
const s = this.queue.findIndex(p => p.kind === 'sentinel');
|
|
250
|
-
if (s === -1)
|
|
298
|
+
if (s === -1) {
|
|
299
|
+
this.onUnsolicited?.(r);
|
|
251
300
|
return;
|
|
301
|
+
}
|
|
252
302
|
for (const p of this.queue.splice(0, s + 1)) {
|
|
253
303
|
if (p.kind === 'query')
|
|
254
304
|
p.resolve(undefined);
|
|
@@ -256,7 +306,9 @@ export class TerminalQuerier {
|
|
|
256
306
|
p.resolve(r);
|
|
257
307
|
p.releaseRawMode();
|
|
258
308
|
}
|
|
309
|
+
return;
|
|
259
310
|
}
|
|
311
|
+
this.onUnsolicited?.(r);
|
|
260
312
|
}
|
|
261
313
|
/**
|
|
262
314
|
* 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;6BACyB;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAA;IACf;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;iEACiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;IAClC;2DACuD;IACvD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,iEAAiE;IACjE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,0BAA0B;AAC1B,MAAM,MAAM,OAAO,GACf;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GACd;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnC;0CAC0C;AAC1C,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB;;qBAEiB;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB,GAAG,OAAO,CAOV;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,QAAQ,EAAE,OAAO,GAChB,YAAY,GAAG,IAAI,CAuBrB;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAUtE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAoB,GAAG,MAAM,CAkB9E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CA+B5E"}
|
|
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;6BACyB;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAA;IACf;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;iEACiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;IAClC;2DACuD;IACvD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB;;;wEAGoE;IACpE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,iEAAiE;IACjE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,0BAA0B;AAC1B,MAAM,MAAM,OAAO,GACf;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GACd;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnC;0CAC0C;AAC1C,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB;;qBAEiB;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB,GAAG,OAAO,CAOV;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,QAAQ,EAAE,OAAO,GAChB,YAAY,GAAG,IAAI,CAuBrB;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAUtE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAoB,GAAG,MAAM,CAkB9E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CA+B5E"}
|
|
@@ -58,5 +58,29 @@ export declare function swallowNestedUpdateOverflow(error: unknown, source: stri
|
|
|
58
58
|
* @param onChange - The subscriber callback about to run.
|
|
59
59
|
*/
|
|
60
60
|
export declare function callWithUpdateOverflowGuard(source: string, onChange: () => void): void;
|
|
61
|
+
/**
|
|
62
|
+
* Origin of a process-level fatal error, as reported to the sink.
|
|
63
|
+
*/
|
|
64
|
+
export type ProcessGuardOrigin = 'uncaughtException' | 'unhandledRejection';
|
|
65
|
+
/**
|
|
66
|
+
* Fatal-error sink installed by the process owner (the dsh-tui runtime, which
|
|
67
|
+
* routes it into the TUI's single exit funnel). Returning true means the sink
|
|
68
|
+
* took ownership of the process — it runs the teardown (resume marker,
|
|
69
|
+
* terminal restore, `dsh-tui crashed: …`) and exits non-zero. Returning false
|
|
70
|
+
* leaves the error to Node's default crash, which keeps "fail loud, non-zero"
|
|
71
|
+
* true when no sink is registered or the tree is being torn down.
|
|
72
|
+
*/
|
|
73
|
+
export type ProcessGuardFatalSink = (error: unknown, origin: ProcessGuardOrigin) => boolean;
|
|
74
|
+
/** Register (or clear, with undefined) the fatal-error sink. */
|
|
75
|
+
export declare function registerProcessGuardFatalSink(sink: ProcessGuardFatalSink | undefined): void;
|
|
76
|
+
/**
|
|
77
|
+
* Normalize the reason handed to a fatal sink so the exit funnel can never
|
|
78
|
+
* mistake a fatal error for a clean user exit. `Promise.reject()` and
|
|
79
|
+
* `throw undefined` deliver `undefined`, and the funnel selects its crash path
|
|
80
|
+
* with `error !== undefined` — passing the raw reason through would run the
|
|
81
|
+
* zero-exit path while the sink reported that it owned the process. Defined
|
|
82
|
+
* reasons (including non-Error values) are returned unchanged.
|
|
83
|
+
*/
|
|
84
|
+
export declare function fatalReasonForExit(error: unknown, origin: ProcessGuardOrigin): unknown;
|
|
61
85
|
export declare function installNestedUpdateOverflowProcessGuard(): void;
|
|
62
86
|
//# sourceMappingURL=update-overflow-guard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-overflow-guard.d.ts","sourceRoot":"","sources":["../../../src/ink/update-overflow-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAoBH,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;AAOjD,+CAA+C;AAC/C,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAEnF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAmDnF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAOtF;
|
|
1
|
+
{"version":3,"file":"update-overflow-guard.d.ts","sourceRoot":"","sources":["../../../src/ink/update-overflow-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAoBH,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;AAOjD,+CAA+C;AAC/C,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAEnF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAmDnF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAOtF;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG,oBAAoB,CAAA;AAE3E;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAA;AAG3F,gEAAgE;AAChE,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,qBAAqB,GAAG,SAAS,GAAG,IAAI,CAE3F;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAEtF;AAiBD,wBAAgB,uCAAuC,IAAI,IAAI,CAgB9D"}
|
|
@@ -130,6 +130,22 @@ export function callWithUpdateOverflowGuard(source, onChange) {
|
|
|
130
130
|
throw error;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
+
let fatalSink;
|
|
134
|
+
/** Register (or clear, with undefined) the fatal-error sink. */
|
|
135
|
+
export function registerProcessGuardFatalSink(sink) {
|
|
136
|
+
fatalSink = sink;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Normalize the reason handed to a fatal sink so the exit funnel can never
|
|
140
|
+
* mistake a fatal error for a clean user exit. `Promise.reject()` and
|
|
141
|
+
* `throw undefined` deliver `undefined`, and the funnel selects its crash path
|
|
142
|
+
* with `error !== undefined` — passing the raw reason through would run the
|
|
143
|
+
* zero-exit path while the sink reported that it owned the process. Defined
|
|
144
|
+
* reasons (including non-Error values) are returned unchanged.
|
|
145
|
+
*/
|
|
146
|
+
export function fatalReasonForExit(error, origin) {
|
|
147
|
+
return error === undefined ? new Error(`${origin} with undefined reason`) : error;
|
|
148
|
+
}
|
|
133
149
|
/**
|
|
134
150
|
* Process-level backstop for the overflow error. The hotspot guards above
|
|
135
151
|
* cover the known enqueue sites (clock tick, reveal tick, channel emit,
|
|
@@ -138,9 +154,11 @@ export function callWithUpdateOverflowGuard(source, onChange) {
|
|
|
138
154
|
* feeder, a future timer, a plugin's store) would still kill the process.
|
|
139
155
|
* This installs uncaughtException/unhandledRejection handlers that absorb
|
|
140
156
|
* exactly the overflow error class (same self-healing contract: React
|
|
141
|
-
* already reset the counter before throwing) and
|
|
142
|
-
*
|
|
143
|
-
*
|
|
157
|
+
* already reset the counter before throwing) and hand everything else to the
|
|
158
|
+
* registered fatal sink — or rethrow it unchanged when there is none, so the
|
|
159
|
+
* process still fails loud with a non-zero exit rather than continuing in an
|
|
160
|
+
* unknown state. Idempotent; opt out with DSH_TUI_NO_185_PROCESS_GUARD=1 when
|
|
161
|
+
* a host owns process error policy.
|
|
144
162
|
*/
|
|
145
163
|
let processGuardInstalled = false;
|
|
146
164
|
export function installNestedUpdateOverflowProcessGuard() {
|
|
@@ -152,6 +170,8 @@ export function installNestedUpdateOverflowProcessGuard() {
|
|
|
152
170
|
process.on('uncaughtException', error => {
|
|
153
171
|
if (swallowNestedUpdateOverflow(error, 'process.uncaught'))
|
|
154
172
|
return;
|
|
173
|
+
if (fatalSink?.(error, 'uncaughtException') === true)
|
|
174
|
+
return;
|
|
155
175
|
// Unknown errors keep Node's default semantics: rethrowing from a
|
|
156
176
|
// listener crashes the process with the original error.
|
|
157
177
|
throw error;
|
|
@@ -159,6 +179,8 @@ export function installNestedUpdateOverflowProcessGuard() {
|
|
|
159
179
|
process.on('unhandledRejection', error => {
|
|
160
180
|
if (swallowNestedUpdateOverflow(error, 'process.rejection'))
|
|
161
181
|
return;
|
|
182
|
+
if (fatalSink?.(error, 'unhandledRejection') === true)
|
|
183
|
+
return;
|
|
162
184
|
throw error;
|
|
163
185
|
});
|
|
164
186
|
}
|
|
@@ -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;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,OAAO,CAAA;AACnD,mEAAmE;AACnE,eAAO,MAAM,gCAAgC,MAAM,CAAA;AACnD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAErC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,kFAAkF;IAClF,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAA;CAC5B;AAED,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG,WAAW,GAAG,cAAc,CAAA;AAEtF,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,kBAAkB,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,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CACrC;AAED,MAAM,WAAW,UAAU;IACzB,iEAAiE;IACjE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAA;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CACrH;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAE,CAAA;AAgE7D,kDAAkD;AAClD,eAAO,MAAM,eAAe;;;;;CAAqE,CAAA;AA+IjG;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAIvF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyBtF;AAED,2EAA2E;AAC3E,wBAAgB,qBAAqB,IAAI,IAAI,CAO5C"}
|