@deepseek-harness-tui/dsh-tui 0.11.0 → 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 +55 -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 +43 -20
- package/cordis.yml +6 -4
- package/lib/settings.json +1272 -0
- package/lib/types/activityPrefs.d.ts +24 -0
- package/lib/types/activityPrefs.d.ts.map +1 -1
- package/lib/types/activityPrefs.js +50 -1
- package/lib/types/adapter/channel/state.d.ts.map +1 -1
- package/lib/types/adapter/channel/state.js +3 -1
- 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 +14 -1
- 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 +53 -7
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +43 -12
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel.d.ts +4 -1
- package/lib/types/adapter/ports/channel.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/ActivityLine.d.ts +7 -2
- package/lib/types/components/ActivityLine.d.ts.map +1 -1
- package/lib/types/components/ActivityLine.js +0 -8
- 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 +15 -5
- 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 +96 -9
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +3 -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/SubagentCard.d.ts.map +1 -1
- package/lib/types/components/SubagentCard.js +12 -6
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +8 -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/HintLine.d.ts +1 -2
- package/lib/types/components/design-system/HintLine.d.ts.map +1 -1
- package/lib/types/components/design-system/HintLine.js +1 -2
- 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 +2 -1
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantThinkingMessage.js +4 -2
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -2
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +31 -26
- 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/activity-store.d.ts +221 -0
- package/lib/types/dsh-adapter/activity-store.d.ts.map +1 -0
- package/lib/types/dsh-adapter/activity-store.js +359 -0
- 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 +2 -1
- package/lib/types/dsh-adapter/channel/background-action.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/background-action.js +2 -0
- package/lib/types/dsh-adapter/channel/binding-events.d.ts +15 -14
- package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +70 -21
- package/lib/types/dsh-adapter/channel/compaction.d.ts +2 -2
- package/lib/types/dsh-adapter/channel/compaction.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/compaction.js +35 -4
- 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 +1 -2
- package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-switch.js +6 -2
- 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-adoption.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-adoption.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-adoption.js +1 -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 +3 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.js +10 -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 +43 -9
- 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 -1
- package/lib/types/dsh-adapter/channel/session-resume.d.ts +2 -1
- package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.js +5 -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 +19 -1
- package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/state.js +8 -3
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +32 -17
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-projection.js +309 -8
- 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 +1 -1
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +34 -18
- package/lib/types/dsh-adapter/compat/index.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/index.js +1 -1
- 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/compat/sessionLog.d.ts +18 -0
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.js +18 -3
- package/lib/types/dsh-adapter/compat/settings.d.ts +2 -0
- package/lib/types/dsh-adapter/compat/settings.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/settings.js +14 -0
- package/lib/types/dsh-adapter/contract.d.ts +5 -4
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +9 -5
- 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 +5 -3
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +168 -372
- 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/settings-sections.d.ts.map +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +7 -4
- 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 +44 -6
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +163 -26
- 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/history.d.ts +13 -1
- package/lib/types/history.d.ts.map +1 -1
- package/lib/types/history.js +15 -2
- package/lib/types/i18n.d.ts +512 -41
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +199 -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/log-update.d.ts.map +1 -1
- package/lib/types/ink/log-update.js +19 -1
- 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 +68 -18
- package/lib/types/ink/selection.d.ts.map +1 -1
- package/lib/types/ink/selection.js +178 -31
- 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 +17 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +618 -57
- 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 +5 -1
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +47 -17
- 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 +1 -1
- package/lib/types/utils/fold-long-lines.d.ts.map +1 -1
- package/lib/types/utils/fold-long-lines.js +3 -2
- 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/working-activity.d.ts +10 -9
- package/lib/types/working-activity.d.ts.map +1 -1
- package/lib/types/working-activity.js +17 -10
- 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 +117 -99
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +0 -19
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts.map +0 -1
- package/lib/types/components/design-system/KeyboardShortcutHint.js +0 -14
- package/lib/types/dsh-adapter/channel/activity.d.ts +0 -20
- package/lib/types/dsh-adapter/channel/activity.d.ts.map +0 -1
- package/lib/types/dsh-adapter/channel/activity.js +0 -113
- package/lib/types/terminal-utils/terminal.d.ts +0 -18
- package/lib/types/terminal-utils/terminal.d.ts.map +0 -1
- package/lib/types/terminal-utils/terminal.js +0 -96
|
@@ -24,7 +24,9 @@ export declare function stripPromptXMLTags(content: string): string;
|
|
|
24
24
|
* Configure the shared `marked` instance once. Strikethrough parsing is
|
|
25
25
|
* disabled so that `~100` renders literally instead of as deleted text —
|
|
26
26
|
* models use `~` far more often for "approximate" than for real
|
|
27
|
-
* strikethrough.
|
|
27
|
+
* strikethrough. LaTeX math becomes `math`/`mathBlock` tokens (see
|
|
28
|
+
* math.ts). Every lexer caller — Markdown and StreamingMarkdown's boundary
|
|
29
|
+
* lex — must run this first so both agree on block boundaries.
|
|
28
30
|
*/
|
|
29
31
|
export declare function configureMarked(): void;
|
|
30
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/terminal-utils/markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAA4B,KAAK,KAAK,EAAe,MAAM,QAAQ,CAAA;AAO1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/terminal-utils/markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAA4B,KAAK,KAAK,EAAe,MAAM,QAAQ,CAAA;AAO1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAqCrD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAO1D;AAID;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAYtC;AA0ED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,EACZ,SAAS,SAAI,EACb,iBAAiB,GAAE,MAAM,GAAG,IAAW,EACvC,MAAM,GAAE,KAAK,GAAG,IAAW,EAC3B,SAAS,GAAE,YAAY,GAAG,IAAW,GACpC,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,YAAY,GAAG,IAAW,GACpC,MAAM,CAgBR;AA+TD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GACpD,MAAM,CAUR"}
|
|
@@ -22,6 +22,8 @@ import { buildSyntaxTheme } from './syntaxTheme.js';
|
|
|
22
22
|
import { logForDebugging } from '../utils/debug.js';
|
|
23
23
|
import { createHyperlink } from './hyperlink.js';
|
|
24
24
|
import { fileLinkUrl, linkifyFilePaths, looksLikeFilePath } from '../utils/fileTarget.js';
|
|
25
|
+
import { getMathRendering } from '../tuiDisplayPrefs.js';
|
|
26
|
+
import { isMathBlockToken, isMathToken, MATH_MARKDOWN_EXTENSIONS, renderInlineMath, } from './math.js';
|
|
25
27
|
// '\n' is used unconditionally — os.EOL is '\r\n' on Windows, and the stray
|
|
26
28
|
// '\r' breaks the character-to-segment mapping in applyStylesToWrappedText,
|
|
27
29
|
// shifting styled text to the right.
|
|
@@ -60,7 +62,9 @@ let markedInitialized = false;
|
|
|
60
62
|
* Configure the shared `marked` instance once. Strikethrough parsing is
|
|
61
63
|
* disabled so that `~100` renders literally instead of as deleted text —
|
|
62
64
|
* models use `~` far more often for "approximate" than for real
|
|
63
|
-
* strikethrough.
|
|
65
|
+
* strikethrough. LaTeX math becomes `math`/`mathBlock` tokens (see
|
|
66
|
+
* math.ts). Every lexer caller — Markdown and StreamingMarkdown's boundary
|
|
67
|
+
* lex — must run this first so both agree on block boundaries.
|
|
64
68
|
*/
|
|
65
69
|
export function configureMarked() {
|
|
66
70
|
if (markedInitialized)
|
|
@@ -72,6 +76,7 @@ export function configureMarked() {
|
|
|
72
76
|
return undefined;
|
|
73
77
|
},
|
|
74
78
|
},
|
|
79
|
+
extensions: [...MATH_MARKDOWN_EXTENSIONS],
|
|
75
80
|
});
|
|
76
81
|
}
|
|
77
82
|
/** Inline code is painted with the active theme's permission accent. */
|
|
@@ -201,6 +206,12 @@ function dispatch(token, state) {
|
|
|
201
206
|
return renderTable(token, state);
|
|
202
207
|
if (isToken(token, 'escape'))
|
|
203
208
|
return token.text;
|
|
209
|
+
if (isMathToken(token))
|
|
210
|
+
return renderInlineMathToken(token);
|
|
211
|
+
// Top-level math blocks are standalone MathBlock nodes; this path only
|
|
212
|
+
// sees blocks nested in list items / blockquotes (or formatToken callers).
|
|
213
|
+
if (isMathBlockToken(token))
|
|
214
|
+
return renderNestedMathBlock(token);
|
|
204
215
|
if (isToken(token, 'def') || isToken(token, 'del') || isToken(token, 'html')) {
|
|
205
216
|
// Link definitions, strikethrough, and raw HTML carry no ANSI
|
|
206
217
|
// representation.
|
|
@@ -209,6 +220,20 @@ function dispatch(token, state) {
|
|
|
209
220
|
// Unknown / extension token types render as nothing.
|
|
210
221
|
return '';
|
|
211
222
|
}
|
|
223
|
+
/** Inline math as single-line Unicode; the exact source when it has none
|
|
224
|
+
* or rendering is switched off. */
|
|
225
|
+
function renderInlineMathToken(token) {
|
|
226
|
+
return (getMathRendering() !== 'source' ? renderInlineMath(token.text) : undefined) ?? token.raw;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* A math block inside a list item or blockquote has no width of its own to
|
|
230
|
+
* lay out a 2D formula against (and would be cut by the container prefix),
|
|
231
|
+
* so it gets the single-line form, else its source.
|
|
232
|
+
*/
|
|
233
|
+
function renderNestedMathBlock(token) {
|
|
234
|
+
const rendered = getMathRendering() !== 'source' && !token.pending ? renderInlineMath(token.text) : undefined;
|
|
235
|
+
return (rendered ?? token.raw.trim()) + EOL;
|
|
236
|
+
}
|
|
212
237
|
function renderBlockquote(token, state) {
|
|
213
238
|
const inner = token.tokens.map(child => dispatch(child, fresh(state))).join('');
|
|
214
239
|
// Dim gutter bar per line; keep the text italic but at normal brightness —
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LaTeX math in replies: delimiter recognition for the shared `marked`
|
|
3
|
+
* instance and the render policy around the vendored Unicode renderer
|
|
4
|
+
* (./latex.ts).
|
|
5
|
+
*
|
|
6
|
+
* Math is recognized at lex time as its own token, before marked's escape
|
|
7
|
+
* handling can eat `\{`, `\,` or `\\` and before `*`/`_` inside a formula
|
|
8
|
+
* turn into emphasis. That keeps the exact source available for every
|
|
9
|
+
* fallback: a formula that is unsupported, too long, too wide, still
|
|
10
|
+
* streaming, or switched off in settings shows its original text, never a
|
|
11
|
+
* half-rendered or backslash-stripped one.
|
|
12
|
+
*
|
|
13
|
+
* Lexing does not depend on the settings switch — tokens are cached by
|
|
14
|
+
* content, so only rendering reads it.
|
|
15
|
+
*
|
|
16
|
+
* Delimiters: `$…$`, `\(…\)` inline; `$$…$$`, `\[…\]` as a block when the
|
|
17
|
+
* opener starts a line and the closer ends one, inline otherwise; a line
|
|
18
|
+
* opening a display environment (`\begin{align}` …) is a block too. The `$`
|
|
19
|
+
* rules follow Pi's markdown tokenizer and Codex's TUI math scanner so that
|
|
20
|
+
* prices, shell variables and PIDs stay prose.
|
|
21
|
+
*/
|
|
22
|
+
import type { TokenizerExtension, Tokens } from 'marked';
|
|
23
|
+
/** Which delimiter introduced a formula. */
|
|
24
|
+
export type MathDelimiter = 'dollar' | 'double-dollar' | 'paren' | 'bracket' | 'environment';
|
|
25
|
+
/** A recognized formula. `text` is the TeX between the delimiters (for an
|
|
26
|
+
* environment, the whole `\begin…\end`), `raw` the full source span. */
|
|
27
|
+
export interface MathToken extends Tokens.Generic {
|
|
28
|
+
type: 'math' | 'mathBlock';
|
|
29
|
+
raw: string;
|
|
30
|
+
text: string;
|
|
31
|
+
/** TeX display style (`$$`, `\[…\]`, environments) — how it typesets. */
|
|
32
|
+
display: boolean;
|
|
33
|
+
/** Owns its Markdown lines (a `mathBlock`) — how it lays out. `foo $$x$$
|
|
34
|
+
* bar` is display but not standalone. */
|
|
35
|
+
standalone: boolean;
|
|
36
|
+
delimiter: MathDelimiter;
|
|
37
|
+
/** Block only: the closer has not arrived yet (streaming, or an unclosed
|
|
38
|
+
* block at the end of a reply). Always shown as source. */
|
|
39
|
+
pending?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Single-line Unicode for a formula, or undefined when it has none. Inline
|
|
43
|
+
* math sits inside wrapped prose, so a multi-line result (cases, matrices,
|
|
44
|
+
* aligned rows) would be torn apart by wrapping — those keep their source.
|
|
45
|
+
*/
|
|
46
|
+
export declare function renderInlineMath(text: string): string | undefined;
|
|
47
|
+
/** Display-mode layout (stacked fractions, operator limits) as lines. */
|
|
48
|
+
export declare function renderDisplayMath(text: string): string[] | undefined;
|
|
49
|
+
export declare function isMathToken(token: {
|
|
50
|
+
type: string;
|
|
51
|
+
}): token is MathToken;
|
|
52
|
+
export declare function isMathBlockToken(token: {
|
|
53
|
+
type: string;
|
|
54
|
+
}): token is MathToken;
|
|
55
|
+
/**
|
|
56
|
+
* Whether a block formula lexed right after `paragraph` is still provisional
|
|
57
|
+
* in a streaming reply: the paragraph leaves a backtick run open, and no
|
|
58
|
+
* blank line in `following` (the source after the paragraph) has ended it
|
|
59
|
+
* yet, so a closer may still arrive and turn the paragraph, the formula and
|
|
60
|
+
* the text up to the closer into one code span. A streaming renderer must
|
|
61
|
+
* not seal the paragraph until this is false.
|
|
62
|
+
*/
|
|
63
|
+
export declare function mayBecomeCodeSpan(paragraph: string, following: string): boolean;
|
|
64
|
+
/** Tokenizer extensions for `marked.use({ extensions })`. */
|
|
65
|
+
export declare const MATH_MARKDOWN_EXTENSIONS: readonly TokenizerExtension[];
|
|
66
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../src/terminal-utils/math.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAGxD,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAA;AAE5F;yEACyE;AACzE,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,OAAO;IAC/C,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,yEAAyE;IACzE,OAAO,EAAE,OAAO,CAAA;IAChB;8CAC0C;IAC1C,UAAU,EAAE,OAAO,CAAA;IACnB,SAAS,EAAE,aAAa,CAAA;IACxB;gEAC4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAoBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGjE;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAEpE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,IAAI,SAAS,CAEvE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,IAAI,SAAS,CAE5E;AA6ND;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAK/E;AAED,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,EAAE,SAAS,kBAAkB,EAiCjE,CAAA"}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LaTeX math in replies: delimiter recognition for the shared `marked`
|
|
3
|
+
* instance and the render policy around the vendored Unicode renderer
|
|
4
|
+
* (./latex.ts).
|
|
5
|
+
*
|
|
6
|
+
* Math is recognized at lex time as its own token, before marked's escape
|
|
7
|
+
* handling can eat `\{`, `\,` or `\\` and before `*`/`_` inside a formula
|
|
8
|
+
* turn into emphasis. That keeps the exact source available for every
|
|
9
|
+
* fallback: a formula that is unsupported, too long, too wide, still
|
|
10
|
+
* streaming, or switched off in settings shows its original text, never a
|
|
11
|
+
* half-rendered or backslash-stripped one.
|
|
12
|
+
*
|
|
13
|
+
* Lexing does not depend on the settings switch — tokens are cached by
|
|
14
|
+
* content, so only rendering reads it.
|
|
15
|
+
*
|
|
16
|
+
* Delimiters: `$…$`, `\(…\)` inline; `$$…$$`, `\[…\]` as a block when the
|
|
17
|
+
* opener starts a line and the closer ends one, inline otherwise; a line
|
|
18
|
+
* opening a display environment (`\begin{align}` …) is a block too. The `$`
|
|
19
|
+
* rules follow Pi's markdown tokenizer and Codex's TUI math scanner so that
|
|
20
|
+
* prices, shell variables and PIDs stay prose.
|
|
21
|
+
*/
|
|
22
|
+
import { renderLatex } from './latex.js';
|
|
23
|
+
/**
|
|
24
|
+
* Formulas longer than this keep their source. Real equations are far
|
|
25
|
+
* shorter; anything this long is a paste, and the parser walks it
|
|
26
|
+
* recursively. Same order as Codex's 4096-byte budget.
|
|
27
|
+
*/
|
|
28
|
+
const MATH_SOURCE_LIMIT = 4096;
|
|
29
|
+
/** Render TeX through the vendored parser; any failure means "keep the source". */
|
|
30
|
+
function renderTex(text, display) {
|
|
31
|
+
if (text.length > MATH_SOURCE_LIMIT)
|
|
32
|
+
return undefined;
|
|
33
|
+
try {
|
|
34
|
+
const rendered = renderLatex(text, { display });
|
|
35
|
+
return rendered === undefined || rendered.trim() === '' ? undefined : rendered;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Single-line Unicode for a formula, or undefined when it has none. Inline
|
|
43
|
+
* math sits inside wrapped prose, so a multi-line result (cases, matrices,
|
|
44
|
+
* aligned rows) would be torn apart by wrapping — those keep their source.
|
|
45
|
+
*/
|
|
46
|
+
export function renderInlineMath(text) {
|
|
47
|
+
const rendered = renderTex(text, false);
|
|
48
|
+
return rendered === undefined || rendered.includes('\n') ? undefined : rendered;
|
|
49
|
+
}
|
|
50
|
+
/** Display-mode layout (stacked fractions, operator limits) as lines. */
|
|
51
|
+
export function renderDisplayMath(text) {
|
|
52
|
+
return renderTex(text, true)?.split('\n');
|
|
53
|
+
}
|
|
54
|
+
export function isMathToken(token) {
|
|
55
|
+
return token.type === 'math';
|
|
56
|
+
}
|
|
57
|
+
export function isMathBlockToken(token) {
|
|
58
|
+
return token.type === 'mathBlock';
|
|
59
|
+
}
|
|
60
|
+
function isEscaped(source, index) {
|
|
61
|
+
let backslashes = 0;
|
|
62
|
+
for (let position = index - 1; position >= 0 && source[position] === '\\'; position--) {
|
|
63
|
+
backslashes++;
|
|
64
|
+
}
|
|
65
|
+
return backslashes % 2 === 1;
|
|
66
|
+
}
|
|
67
|
+
function findClosingDelimiter(source, closing, start) {
|
|
68
|
+
let index = source.indexOf(closing, start);
|
|
69
|
+
while (index >= 0 && isEscaped(source, index)) {
|
|
70
|
+
// A literal \$ can sit directly before $$, so candidate pairs may overlap.
|
|
71
|
+
index = source.indexOf(closing, index + 1);
|
|
72
|
+
}
|
|
73
|
+
return index;
|
|
74
|
+
}
|
|
75
|
+
/** TeX commands or operators: what an unclosed `$$` block needs to hold
|
|
76
|
+
* before it is treated as a formula in progress rather than prose. */
|
|
77
|
+
function looksLikeMath(source) {
|
|
78
|
+
return /\\[A-Za-z]+|[_^=+*/<>()[\]|±≤≥≠≈∈→⇒∞∫∑√-]/.test(source);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Reasons a `$`/`$$` pair is prose, not math:
|
|
82
|
+
* - body starts or ends with whitespace (`$5 and $10`, `echo $$ … $$`);
|
|
83
|
+
* - `${…}` shell expansion;
|
|
84
|
+
* - closer glued to an ASCII letter or digit (`$x$y`, `$1$2`) — CJK text may
|
|
85
|
+
* touch the closer, since Chinese prose does not space around math;
|
|
86
|
+
* - a backtick inside (the pair straddles a code span);
|
|
87
|
+
* - a bare number or an all-caps word (`$5,$`, `$HOME$`);
|
|
88
|
+
* - an env-var-like body followed by another identifier (`$HOME/$USER`).
|
|
89
|
+
*/
|
|
90
|
+
function isDollarProse(body, after) {
|
|
91
|
+
if (/^\s|\s$/.test(body) || body.startsWith('{'))
|
|
92
|
+
return true;
|
|
93
|
+
if (/^[A-Za-z0-9]/.test(after))
|
|
94
|
+
return true;
|
|
95
|
+
if (body.includes('`'))
|
|
96
|
+
return true;
|
|
97
|
+
if (/^\d/.test(body) && !/[\\^_=+\-*/<>]/.test(body))
|
|
98
|
+
return true;
|
|
99
|
+
if (body.length > 1 && /^[A-Z]+$/.test(body))
|
|
100
|
+
return true;
|
|
101
|
+
return /^[A-Z_][A-Z0-9_]*[^A-Za-z0-9_\s]?$/.test(body) && /^[A-Za-z_]/.test(after);
|
|
102
|
+
}
|
|
103
|
+
const INLINE_DELIMITERS = [
|
|
104
|
+
['$$', '$$', 'double-dollar'],
|
|
105
|
+
['\\(', '\\)', 'paren'],
|
|
106
|
+
['\\[', '\\]', 'bracket'],
|
|
107
|
+
['$', '$', 'dollar'],
|
|
108
|
+
];
|
|
109
|
+
/**
|
|
110
|
+
* Inline math. Unlike Pi, an unclosed inline opener is NOT held as pending:
|
|
111
|
+
* doing so swallows the rest of the paragraph as source, and in a finished
|
|
112
|
+
* reply (`costs $5 + tax, **note**`) that silently drops real formatting.
|
|
113
|
+
* The only cost is that a formula's interior may briefly show as markdown
|
|
114
|
+
* while its closing `$` streams in.
|
|
115
|
+
*/
|
|
116
|
+
function tokenizeInlineMath(source) {
|
|
117
|
+
const delimiter = INLINE_DELIMITERS.find(([opening]) => source.startsWith(opening));
|
|
118
|
+
if (delimiter === undefined)
|
|
119
|
+
return undefined;
|
|
120
|
+
const [opening, closing, kind] = delimiter;
|
|
121
|
+
const closingIndex = findClosingDelimiter(source, closing, opening.length);
|
|
122
|
+
if (closingIndex < 0)
|
|
123
|
+
return undefined;
|
|
124
|
+
const text = source.slice(opening.length, closingIndex);
|
|
125
|
+
if (text.trim() === '' || text.includes('\n'))
|
|
126
|
+
return undefined;
|
|
127
|
+
if (opening.startsWith('$') && isDollarProse(text, source.slice(closingIndex + closing.length))) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
type: 'math',
|
|
132
|
+
raw: source.slice(0, closingIndex + closing.length),
|
|
133
|
+
text,
|
|
134
|
+
display: kind === 'double-dollar' || kind === 'bracket',
|
|
135
|
+
standalone: false,
|
|
136
|
+
delimiter: kind,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Block math: the opener starts a line (up to three spaces of indent, like
|
|
141
|
+
* any CommonMark block) and the closer ends one. An opener whose closer
|
|
142
|
+
* appears later on a line with trailing text is left to the inline rule; a
|
|
143
|
+
* block is pending only while no closer exists at all.
|
|
144
|
+
*/
|
|
145
|
+
const BLOCK_OPENER = /^ {0,3}(\$\$|\\\[)/;
|
|
146
|
+
/**
|
|
147
|
+
* Display environments models write without `$$` around them. Their bodies
|
|
148
|
+
* carry `\\` row breaks and `&` alignment that Markdown would otherwise
|
|
149
|
+
* mangle into prose, so a line opening one starts a block like `$$` does.
|
|
150
|
+
*/
|
|
151
|
+
const ENVIRONMENT_OPENER = /^ {0,3}\\begin\{((?:equation|align|alignat|gather|multline|flalign|eqnarray|displaymath|aligned|gathered)\*?)\}/;
|
|
152
|
+
function tokenizeEnvironmentBlock(source, opener) {
|
|
153
|
+
const name = opener[1];
|
|
154
|
+
const begin = `\\begin{${name}}`;
|
|
155
|
+
const end = `\\end{${name}}`;
|
|
156
|
+
let depth = 0;
|
|
157
|
+
let index = opener[0].length - begin.length;
|
|
158
|
+
while (index < source.length) {
|
|
159
|
+
const nextBegin = source.indexOf(begin, index);
|
|
160
|
+
const nextEnd = source.indexOf(end, index);
|
|
161
|
+
if (nextEnd < 0)
|
|
162
|
+
break;
|
|
163
|
+
if (nextBegin >= 0 && nextBegin < nextEnd) {
|
|
164
|
+
depth += 1;
|
|
165
|
+
index = nextBegin + begin.length;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
depth -= 1;
|
|
169
|
+
index = nextEnd + end.length;
|
|
170
|
+
if (depth > 0)
|
|
171
|
+
continue;
|
|
172
|
+
const trailing = /^[ \t]*(?:\n|$)/.exec(source.slice(index));
|
|
173
|
+
// Prose after the closing \end on the same line: not a block of its own.
|
|
174
|
+
if (trailing === null)
|
|
175
|
+
return undefined;
|
|
176
|
+
const raw = source.slice(0, index + trailing[0].length);
|
|
177
|
+
return { type: 'mathBlock', raw, text: raw.trim(), display: true, standalone: true, delimiter: 'environment' };
|
|
178
|
+
}
|
|
179
|
+
// No closing \end yet: a formula in progress (or never closed) stays source.
|
|
180
|
+
return { type: 'mathBlock', raw: source, text: source.trim(), display: true, standalone: true, delimiter: 'environment', pending: true };
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The source the block tokenizer last saw. marked tries block extensions at
|
|
184
|
+
* each block position before cutting a paragraph, then calls `start` with
|
|
185
|
+
* that same source minus its first character; `start` needs the whole
|
|
186
|
+
* paragraph (its first character may open a code span).
|
|
187
|
+
*/
|
|
188
|
+
let lastBlockSource = '';
|
|
189
|
+
function tokenizeBlockMath(source) {
|
|
190
|
+
lastBlockSource = source;
|
|
191
|
+
const environment = ENVIRONMENT_OPENER.exec(source);
|
|
192
|
+
if (environment !== null)
|
|
193
|
+
return tokenizeEnvironmentBlock(source, environment);
|
|
194
|
+
const opener = BLOCK_OPENER.exec(source);
|
|
195
|
+
if (opener === null)
|
|
196
|
+
return undefined;
|
|
197
|
+
const dollar = opener[1] === '$$';
|
|
198
|
+
const closing = dollar ? '$$' : '\\]';
|
|
199
|
+
const closingIndex = findClosingDelimiter(source, closing, opener[0].length);
|
|
200
|
+
if (closingIndex >= 0) {
|
|
201
|
+
const end = closingIndex + closing.length;
|
|
202
|
+
const trailing = /^[ \t]*(?:\n|$)/.exec(source.slice(end));
|
|
203
|
+
const text = source.slice(opener[0].length, closingIndex).trim();
|
|
204
|
+
// The first closer decides the boundary. Looking for a later line-ending
|
|
205
|
+
// closer would swallow intervening prose and the next formula.
|
|
206
|
+
if (trailing === null || text === '')
|
|
207
|
+
return undefined;
|
|
208
|
+
return {
|
|
209
|
+
type: 'mathBlock',
|
|
210
|
+
raw: source.slice(0, end + trailing[0].length),
|
|
211
|
+
text,
|
|
212
|
+
display: true,
|
|
213
|
+
standalone: true,
|
|
214
|
+
delimiter: dollar ? 'double-dollar' : 'bracket',
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
const body = source.slice(opener[0].length).replace(/^[ \t]*\n?/, '');
|
|
218
|
+
// An opener with nothing after it yet is held too, so a streaming block
|
|
219
|
+
// does not flip from prose to a block node when its first command arrives.
|
|
220
|
+
if (dollar && body.trim() !== '' && !looksLikeMath(body))
|
|
221
|
+
return undefined;
|
|
222
|
+
return {
|
|
223
|
+
type: 'mathBlock',
|
|
224
|
+
raw: source,
|
|
225
|
+
text: body,
|
|
226
|
+
display: true,
|
|
227
|
+
standalone: true,
|
|
228
|
+
delimiter: dollar ? 'double-dollar' : 'bracket',
|
|
229
|
+
pending: true,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Backtick runs that can act as CommonMark code-span delimiters, in order.
|
|
234
|
+
* A run preceded by an odd number of backslashes is escaped and stays literal
|
|
235
|
+
* text, so it neither opens nor closes a span.
|
|
236
|
+
*/
|
|
237
|
+
function backtickRuns(text) {
|
|
238
|
+
const runs = [];
|
|
239
|
+
for (const match of text.matchAll(/`+/g)) {
|
|
240
|
+
const start = match.index;
|
|
241
|
+
let backslashes = 0;
|
|
242
|
+
while (start - backslashes - 1 >= 0 && text[start - backslashes - 1] === '\\')
|
|
243
|
+
backslashes++;
|
|
244
|
+
if (backslashes % 2 === 0)
|
|
245
|
+
runs.push(match[0]);
|
|
246
|
+
}
|
|
247
|
+
return runs;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Lengths of the backtick runs in `text` that no later run of the same
|
|
251
|
+
* length closes (CommonMark: such a run is literal text, for now).
|
|
252
|
+
*/
|
|
253
|
+
function unmatchedBacktickRuns(text) {
|
|
254
|
+
const runs = backtickRuns(text);
|
|
255
|
+
const unmatched = [];
|
|
256
|
+
for (let open = 0; open < runs.length; open++) {
|
|
257
|
+
let close = open + 1;
|
|
258
|
+
while (close < runs.length && runs[close].length !== runs[open].length)
|
|
259
|
+
close++;
|
|
260
|
+
if (close < runs.length)
|
|
261
|
+
open = close;
|
|
262
|
+
else
|
|
263
|
+
unmatched.push(runs[open].length);
|
|
264
|
+
}
|
|
265
|
+
return unmatched;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Whether position `at` of `text` (a candidate block opener) lies inside a
|
|
269
|
+
* code span: a backtick run opens a span only when a run of exactly the same
|
|
270
|
+
* length closes it later in the same paragraph (CommonMark); a run with no
|
|
271
|
+
* closer is literal text and opens nothing.
|
|
272
|
+
*/
|
|
273
|
+
function insideOpenCodeSpan(text, at) {
|
|
274
|
+
const paragraphStart = text.lastIndexOf('\n\n', at);
|
|
275
|
+
const before = text.slice(paragraphStart < 0 ? 0 : paragraphStart + 2, at);
|
|
276
|
+
const open = unmatchedBacktickRuns(before);
|
|
277
|
+
if (open.length === 0)
|
|
278
|
+
return false;
|
|
279
|
+
const rest = text.slice(at);
|
|
280
|
+
const paragraphEnd = rest.search(/\n[ \t]*\n/);
|
|
281
|
+
const after = paragraphEnd < 0 ? rest : rest.slice(0, paragraphEnd);
|
|
282
|
+
const closers = new Set(backtickRuns(after).map(run => run.length));
|
|
283
|
+
return open.some(length => closers.has(length));
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Whether a block formula lexed right after `paragraph` is still provisional
|
|
287
|
+
* in a streaming reply: the paragraph leaves a backtick run open, and no
|
|
288
|
+
* blank line in `following` (the source after the paragraph) has ended it
|
|
289
|
+
* yet, so a closer may still arrive and turn the paragraph, the formula and
|
|
290
|
+
* the text up to the closer into one code span. A streaming renderer must
|
|
291
|
+
* not seal the paragraph until this is false.
|
|
292
|
+
*/
|
|
293
|
+
export function mayBecomeCodeSpan(paragraph, following) {
|
|
294
|
+
if (/\n[ \t]*\n\s*$/.test(paragraph))
|
|
295
|
+
return false;
|
|
296
|
+
const paragraphStart = paragraph.lastIndexOf('\n\n');
|
|
297
|
+
if (unmatchedBacktickRuns(paragraphStart < 0 ? paragraph : paragraph.slice(paragraphStart + 2)).length === 0)
|
|
298
|
+
return false;
|
|
299
|
+
return !/\n[ \t]*\n/.test(following);
|
|
300
|
+
}
|
|
301
|
+
/** Tokenizer extensions for `marked.use({ extensions })`. */
|
|
302
|
+
export const MATH_MARKDOWN_EXTENSIONS = [
|
|
303
|
+
{
|
|
304
|
+
name: 'mathBlock',
|
|
305
|
+
level: 'block',
|
|
306
|
+
start(source) {
|
|
307
|
+
// Same block position: exactly one character longer (a full string
|
|
308
|
+
// comparison here would cost O(remaining text) per paragraph).
|
|
309
|
+
const paragraph = lastBlockSource.length === source.length + 1 ? lastBlockSource : source;
|
|
310
|
+
const offset = paragraph.length - source.length;
|
|
311
|
+
const opener = /(?:^|\n) {0,3}(?:\$\$|\\\[|\\begin\{)/g;
|
|
312
|
+
for (let match = opener.exec(source); match !== null; match = opener.exec(source)) {
|
|
313
|
+
const index = match.index + (match[0].startsWith('\n') ? 1 : 0);
|
|
314
|
+
// A code span may run across lines; a block opener inside one is
|
|
315
|
+
// code, and cutting the paragraph there would split the span.
|
|
316
|
+
if (!insideOpenCodeSpan(paragraph, index + offset))
|
|
317
|
+
return index;
|
|
318
|
+
}
|
|
319
|
+
return undefined;
|
|
320
|
+
},
|
|
321
|
+
tokenizer: tokenizeBlockMath,
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
name: 'math',
|
|
325
|
+
level: 'inline',
|
|
326
|
+
start(source) {
|
|
327
|
+
let first = -1;
|
|
328
|
+
for (const marker of ['$', '\\(', '\\[']) {
|
|
329
|
+
const index = source.indexOf(marker);
|
|
330
|
+
if (index >= 0 && (first < 0 || index < first))
|
|
331
|
+
first = index;
|
|
332
|
+
}
|
|
333
|
+
return first >= 0 ? first : undefined;
|
|
334
|
+
},
|
|
335
|
+
tokenizer: tokenizeInlineMath,
|
|
336
|
+
},
|
|
337
|
+
];
|
package/lib/types/tips.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tips.d.ts","sourceRoot":"","sources":["../../src/tips.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAA;AAEhF,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,QAAQ,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;CACX;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAMzE,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"tips.d.ts","sourceRoot":"","sources":["../../src/tips.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAA;AAEhF,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,QAAQ,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;CACX;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAMzE,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,SAAS,GAAG,EAg3B9B,CAAA;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,GAAE,MAAM,MAAoB,GAAG,GAAG,CAErE;AAED,0CAA0C;AAC1C,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,GAAG,EAAE,CAElD"}
|
package/lib/types/tips.js
CHANGED
|
@@ -535,6 +535,12 @@ export const TIPS = [
|
|
|
535
535
|
zh: '问卷选项行直接打字 = 选项 + 自定义文本一起提交',
|
|
536
536
|
en: 'Typing on a question row submits option + custom text',
|
|
537
537
|
},
|
|
538
|
+
{
|
|
539
|
+
id: 'flow-question-arrows',
|
|
540
|
+
group: 'workflow',
|
|
541
|
+
zh: '多题问卷用 ←/→ 换题,不提交;输入行要先把光标移到行首或行尾',
|
|
542
|
+
en: 'In a multi-question ask, ←/→ switches questions without submitting; on the input row the caret must already be at the edge',
|
|
543
|
+
},
|
|
538
544
|
{
|
|
539
545
|
id: 'flow-question-fold',
|
|
540
546
|
group: 'workflow',
|
|
@@ -46,4 +46,71 @@ export declare const applyPageMargin: (value: unknown) => PageMarginSetting;
|
|
|
46
46
|
export declare const subscribeMermaidDiagrams: (listener: () => void) => () => void;
|
|
47
47
|
export declare const getMermaidDiagrams: () => boolean;
|
|
48
48
|
export declare const applyMermaidDiagrams: (value: unknown) => boolean;
|
|
49
|
+
/**
|
|
50
|
+
* How LaTeX math in replies renders (settings `dsh-tui.mathRendering`):
|
|
51
|
+
* `auto` picks the best available backend (today the Unicode renderer),
|
|
52
|
+
* `image` typesets complete block formulas as terminal images where the
|
|
53
|
+
* terminal supports graphics (Unicode everywhere else; opt-in until it has
|
|
54
|
+
* been validated across terminals, after which `auto` adopts it),
|
|
55
|
+
* `unicode` pins the Unicode renderer, `source` always shows the TeX.
|
|
56
|
+
*/
|
|
57
|
+
export type MathRendering = 'auto' | 'image' | 'unicode' | 'source';
|
|
58
|
+
export declare function normalizeMathRendering(value: unknown): MathRendering;
|
|
59
|
+
/**
|
|
60
|
+
* Resolve the effective mode across the settings user layer and cordis.yml.
|
|
61
|
+
* `latexMath` predates `mathRendering` (unreleased main builds wrote it): at a
|
|
62
|
+
* layer without `mathRendering`, `false` means `source` and `true` means
|
|
63
|
+
* `auto`, and either one overrides the layers below.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveMathRendering(user: {
|
|
66
|
+
mathRendering?: unknown;
|
|
67
|
+
latexMath?: unknown;
|
|
68
|
+
}, config: {
|
|
69
|
+
mathRendering?: unknown;
|
|
70
|
+
latexMath?: unknown;
|
|
71
|
+
}): MathRendering;
|
|
72
|
+
export declare const subscribeMathRendering: (listener: () => void) => () => void;
|
|
73
|
+
export declare const getMathRendering: () => MathRendering;
|
|
74
|
+
export declare const applyMathRendering: (value: unknown) => MathRendering;
|
|
75
|
+
/**
|
|
76
|
+
* How large a display formula is set when it renders as an image (settings
|
|
77
|
+
* `dsh-tui.mathImageScale`): `auto` matches the body text, `large` and
|
|
78
|
+
* `xlarge` set display math bigger. Size is the only sharpness lever a
|
|
79
|
+
* terminal image has — the raster is drawn one device pixel per pixel, so a
|
|
80
|
+
* larger formula is literally more pixels per stroke. Inline formulas keep the
|
|
81
|
+
* base scale: their single row of cells caps the resolution.
|
|
82
|
+
*/
|
|
83
|
+
export type MathImageScale = 'auto' | 'large' | 'xlarge';
|
|
84
|
+
export declare function normalizeMathImageScale(value: unknown): MathImageScale;
|
|
85
|
+
export declare const subscribeMathImageScale: (listener: () => void) => () => void;
|
|
86
|
+
export declare const getMathImageScale: () => MathImageScale;
|
|
87
|
+
export declare const applyMathImageScale: (value: unknown) => MathImageScale;
|
|
88
|
+
/**
|
|
89
|
+
* What sits behind a formula image (settings `dsh-tui.mathImageBacking`):
|
|
90
|
+
* `transparent` paints only the formula's own pixels, so the terminal
|
|
91
|
+
* background (a wallpaper included) shows through; `terminal` composites it
|
|
92
|
+
* onto the terminal's background colour first, which is the calmer choice on
|
|
93
|
+
* busy backgrounds and the only one that keeps soft anti-aliased edges smooth
|
|
94
|
+
* (Sixel has no partial alpha).
|
|
95
|
+
*/
|
|
96
|
+
export type MathImageBacking = 'transparent' | 'terminal';
|
|
97
|
+
export declare function normalizeMathImageBacking(value: unknown): MathImageBacking;
|
|
98
|
+
export declare const subscribeMathImageBacking: (listener: () => void) => () => void;
|
|
99
|
+
export declare const getMathImageBacking: () => MathImageBacking;
|
|
100
|
+
export declare const applyMathImageBacking: (value: unknown) => MathImageBacking;
|
|
101
|
+
/**
|
|
102
|
+
* What sits behind a transcript photo or illustration (settings
|
|
103
|
+
* `dsh-tui.imageBacking`): `transparent` paints only the raster's own
|
|
104
|
+
* pixels, so the terminal background (a wallpaper included) shows through
|
|
105
|
+
* at anti-aliased edges and transparent corners — Sixel's binary alpha
|
|
106
|
+
* drops their softest pixels, so edges trade a little smoothness for the
|
|
107
|
+
* float; `terminal` composites onto the terminal's background colour
|
|
108
|
+
* first (smooth edges on any background). Photographs are mostly opaque,
|
|
109
|
+
* so the visible difference lives at the edges.
|
|
110
|
+
*/
|
|
111
|
+
export type ImageBacking = 'transparent' | 'terminal';
|
|
112
|
+
export declare function normalizeImageBacking(value: unknown): ImageBacking;
|
|
113
|
+
export declare const subscribeImageBacking: (listener: () => void) => () => void;
|
|
114
|
+
export declare const getImageBacking: () => ImageBacking;
|
|
115
|
+
export declare const applyImageBacking: (value: unknown) => ImageBacking;
|
|
49
116
|
//# sourceMappingURL=tuiDisplayPrefs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuiDisplayPrefs.d.ts","sourceRoot":"","sources":["../../src/tuiDisplayPrefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAC9J,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAG9J,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,eAAe,CAuBvD,CAAA;AAMF,0EAA0E;AAC1E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAItE;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAItE;AAED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CASlE;AASD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,OAAO,UAAO,GACb,MAAM,GAAG,SAAS,CASpB;AAED;;4CAE4C;AAC5C,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAK3G,CAAA;AAEF,eAAO,MAAM,mBAAmB,EAAE,cAAyB,CAAA;AAE3D;4CAC4C;AAC5C,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAClC,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAQlC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEvE;AAED;wBACwB;AACxB,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAO5E;AAED;;kCAEkC;AAClC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAOrE;AAED;2EAC2E;AAC3E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAWxG;AAyCD,eAAO,MAAM,mBAAmB,aA5BR,MAAM,IAAI,KAAK,MAAM,IA4Be,CAAA;AAC5D,eAAO,MAAM,oBAAoB,yBAAsB,CAAA;AACvD,wFAAwF;AACxF,eAAO,MAAM,eAAe,UA3BX,OAAO,sBA2B4B,CAAA;AAMpD,eAAO,MAAM,wBAAwB,aArCb,MAAM,IAAI,KAAK,MAAM,IAqCyB,CAAA;AACtE,eAAO,MAAM,kBAAkB,eAA2B,CAAA;AAC1D,eAAO,MAAM,oBAAoB,UAnChB,OAAO,YAmCsC,CAAA"}
|
|
1
|
+
{"version":3,"file":"tuiDisplayPrefs.d.ts","sourceRoot":"","sources":["../../src/tuiDisplayPrefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAC9J,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAG9J,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,eAAe,CAuBvD,CAAA;AAMF,0EAA0E;AAC1E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAItE;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAItE;AAED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CASlE;AASD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,OAAO,UAAO,GACb,MAAM,GAAG,SAAS,CASpB;AAED;;4CAE4C;AAC5C,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAK3G,CAAA;AAEF,eAAO,MAAM,mBAAmB,EAAE,cAAyB,CAAA;AAE3D;4CAC4C;AAC5C,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAClC,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAQlC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEvE;AAED;wBACwB;AACxB,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAO5E;AAED;;kCAEkC;AAClC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAOrE;AAED;2EAC2E;AAC3E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAWxG;AAyCD,eAAO,MAAM,mBAAmB,aA5BR,MAAM,IAAI,KAAK,MAAM,IA4Be,CAAA;AAC5D,eAAO,MAAM,oBAAoB,yBAAsB,CAAA;AACvD,wFAAwF;AACxF,eAAO,MAAM,eAAe,UA3BX,OAAO,sBA2B4B,CAAA;AAMpD,eAAO,MAAM,wBAAwB,aArCb,MAAM,IAAI,KAAK,MAAM,IAqCyB,CAAA;AACtE,eAAO,MAAM,kBAAkB,eAA2B,CAAA;AAC1D,eAAO,MAAM,oBAAoB,UAnChB,OAAO,YAmCsC,CAAA;AAE9D;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAA;AAGnE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAIpE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,EACtD,MAAM,EAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACvD,aAAa,CAQf;AAID,eAAO,MAAM,sBAAsB,aA/EX,MAAM,IAAI,KAAK,MAAM,IA+EqB,CAAA;AAClE,eAAO,MAAM,gBAAgB,qBAAyB,CAAA;AACtD,eAAO,MAAM,kBAAkB,UA7Ed,OAAO,kBA6EkC,CAAA;AAE1D;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;AAGxD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAItE;AAID,eAAO,MAAM,uBAAuB,aAtGZ,MAAM,IAAI,KAAK,MAAM,IAsGuB,CAAA;AACpE,eAAO,MAAM,iBAAiB,sBAA0B,CAAA;AACxD,eAAO,MAAM,mBAAmB,UApGf,OAAO,mBAoGoC,CAAA;AAE5D;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,UAAU,CAAA;AAGzD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAI1E;AAGD,eAAO,MAAM,yBAAyB,aA5Hd,MAAM,IAAI,KAAK,MAAM,IA4H2B,CAAA;AACxE,eAAO,MAAM,mBAAmB,wBAA4B,CAAA;AAC5D,eAAO,MAAM,qBAAqB,UA1HjB,OAAO,qBA0HwC,CAAA;AAEhE;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,UAAU,CAAA;AAGrD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAIlE;AAGD,eAAO,MAAM,qBAAqB,aApJV,MAAM,IAAI,KAAK,MAAM,IAoJmB,CAAA;AAChE,eAAO,MAAM,eAAe,oBAAwB,CAAA;AACpD,eAAO,MAAM,iBAAiB,UAlJb,OAAO,iBAkJgC,CAAA"}
|
|
@@ -166,3 +166,62 @@ const mermaidDiagramsStore = createLiveSetting(true, value => value !== false);
|
|
|
166
166
|
export const subscribeMermaidDiagrams = mermaidDiagramsStore.subscribe;
|
|
167
167
|
export const getMermaidDiagrams = mermaidDiagramsStore.get;
|
|
168
168
|
export const applyMermaidDiagrams = mermaidDiagramsStore.apply;
|
|
169
|
+
const MATH_RENDERING_MODES = new Set(['auto', 'image', 'unicode', 'source']);
|
|
170
|
+
export function normalizeMathRendering(value) {
|
|
171
|
+
return typeof value === 'string' && MATH_RENDERING_MODES.has(value)
|
|
172
|
+
? value
|
|
173
|
+
: 'auto';
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Resolve the effective mode across the settings user layer and cordis.yml.
|
|
177
|
+
* `latexMath` predates `mathRendering` (unreleased main builds wrote it): at a
|
|
178
|
+
* layer without `mathRendering`, `false` means `source` and `true` means
|
|
179
|
+
* `auto`, and either one overrides the layers below.
|
|
180
|
+
*/
|
|
181
|
+
export function resolveMathRendering(user, config) {
|
|
182
|
+
for (const layer of [user, config]) {
|
|
183
|
+
if (layer.mathRendering !== undefined)
|
|
184
|
+
return normalizeMathRendering(layer.mathRendering);
|
|
185
|
+
// An explicit legacy switch overrides lower layers either way: a user who
|
|
186
|
+
// turned math back on over a cordis.yml `false` keeps it on.
|
|
187
|
+
if (typeof layer.latexMath === 'boolean')
|
|
188
|
+
return layer.latexMath ? 'auto' : 'source';
|
|
189
|
+
}
|
|
190
|
+
return 'auto';
|
|
191
|
+
}
|
|
192
|
+
/** Read at render time, so settled transcript blocks re-render on change. */
|
|
193
|
+
const mathRenderingStore = createLiveSetting('auto', normalizeMathRendering);
|
|
194
|
+
export const subscribeMathRendering = mathRenderingStore.subscribe;
|
|
195
|
+
export const getMathRendering = mathRenderingStore.get;
|
|
196
|
+
export const applyMathRendering = mathRenderingStore.apply;
|
|
197
|
+
const MATH_IMAGE_SCALES = new Set(['auto', 'large', 'xlarge']);
|
|
198
|
+
export function normalizeMathImageScale(value) {
|
|
199
|
+
return typeof value === 'string' && MATH_IMAGE_SCALES.has(value)
|
|
200
|
+
? value
|
|
201
|
+
: 'auto';
|
|
202
|
+
}
|
|
203
|
+
/** Read at render time, so settled transcript blocks re-render on change. */
|
|
204
|
+
const mathImageScaleStore = createLiveSetting('auto', normalizeMathImageScale);
|
|
205
|
+
export const subscribeMathImageScale = mathImageScaleStore.subscribe;
|
|
206
|
+
export const getMathImageScale = mathImageScaleStore.get;
|
|
207
|
+
export const applyMathImageScale = mathImageScaleStore.apply;
|
|
208
|
+
const MATH_IMAGE_BACKINGS = new Set(['transparent', 'terminal']);
|
|
209
|
+
export function normalizeMathImageBacking(value) {
|
|
210
|
+
return typeof value === 'string' && MATH_IMAGE_BACKINGS.has(value)
|
|
211
|
+
? value
|
|
212
|
+
: 'transparent';
|
|
213
|
+
}
|
|
214
|
+
const mathImageBackingStore = createLiveSetting('transparent', normalizeMathImageBacking);
|
|
215
|
+
export const subscribeMathImageBacking = mathImageBackingStore.subscribe;
|
|
216
|
+
export const getMathImageBacking = mathImageBackingStore.get;
|
|
217
|
+
export const applyMathImageBacking = mathImageBackingStore.apply;
|
|
218
|
+
const IMAGE_BACKINGS = new Set(['transparent', 'terminal']);
|
|
219
|
+
export function normalizeImageBacking(value) {
|
|
220
|
+
return typeof value === 'string' && IMAGE_BACKINGS.has(value)
|
|
221
|
+
? value
|
|
222
|
+
: 'transparent';
|
|
223
|
+
}
|
|
224
|
+
const imageBackingStore = createLiveSetting('transparent', normalizeImageBacking);
|
|
225
|
+
export const subscribeImageBacking = imageBackingStore.subscribe;
|
|
226
|
+
export const getImageBacking = imageBackingStore.get;
|
|
227
|
+
export const applyImageBacking = imageBackingStore.apply;
|