@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
|
@@ -12,8 +12,21 @@ export interface ImageProps {
|
|
|
12
12
|
readonly height: number;
|
|
13
13
|
/** Text alternative. Use an empty string for a decorative image. */
|
|
14
14
|
readonly alt: string;
|
|
15
|
+
/**
|
|
16
|
+
* What a fullscreen copy yields for this image, e.g. a formula's source.
|
|
17
|
+
* Without it the image's cells are left out of copied text.
|
|
18
|
+
*/
|
|
19
|
+
readonly copyText?: string;
|
|
15
20
|
/** Opt into Sixel for a modal or scrollable transcript. Default keeps Kitty only. */
|
|
16
21
|
readonly presentation?: 'preview' | 'transcript';
|
|
22
|
+
/**
|
|
23
|
+
* Float on whatever the terminal shows behind the image: the raster is
|
|
24
|
+
* emitted without a backing colour and its coverage becomes a hard mask
|
|
25
|
+
* (Sixel has no partial alpha). Formulas and artwork with transparent
|
|
26
|
+
* margins use this; photographs and anything sitting on a painted surface
|
|
27
|
+
* leave it unset and composite onto that surface instead.
|
|
28
|
+
*/
|
|
29
|
+
readonly transparent?: boolean;
|
|
17
30
|
/** Same-size terminal-cell fallback rendered when graphics are unavailable. */
|
|
18
31
|
readonly children?: ReactNode;
|
|
19
32
|
}
|
|
@@ -24,5 +37,5 @@ export interface ImageProps {
|
|
|
24
37
|
* Yoga leaf; the Ink host decides after layout whether to paint its fallback
|
|
25
38
|
* children or attach a terminal-graphics placement over the same cells.
|
|
26
39
|
*/
|
|
27
|
-
export default function Image({ source, width, height, alt, presentation, children, }: ImageProps): React.ReactNode;
|
|
40
|
+
export default function Image({ source, width, height, alt, copyText, presentation, transparent, children, }: ImageProps): React.ReactNode;
|
|
28
41
|
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../src/ink/components/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAO/D,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAA;IACrC,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,wCAAwC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,oEAAoE;IACpE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,qFAAqF;IACrF,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,GAAG,YAAY,CAAA;IAChD,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,MAAM,EACN,GAAG,EACH,YAAY,EACZ,QAAQ,GACT,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../src/ink/components/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAO/D,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAA;IACrC,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,wCAAwC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,oEAAoE;IACpE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,GAAG,YAAY,CAAA;IAChD;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,MAAM,EACN,GAAG,EACH,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,QAAQ,GACT,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,CA8B9B"}
|
|
@@ -8,11 +8,11 @@ import Text from './Text.js';
|
|
|
8
8
|
* Yoga leaf; the Ink host decides after layout whether to paint its fallback
|
|
9
9
|
* children or attach a terminal-graphics placement over the same cells.
|
|
10
10
|
*/
|
|
11
|
-
export default function Image({ source, width, height, alt, presentation, children, }) {
|
|
11
|
+
export default function Image({ source, width, height, alt, copyText, presentation, transparent, children, }) {
|
|
12
12
|
const [columns, rows] = normalizeSize(width, height);
|
|
13
13
|
const image = isTerminalImageSource(source, presentation) ? source : undefined;
|
|
14
14
|
const alternative = cleanAlternative(alt);
|
|
15
|
-
return (_jsx("ink-image", { imageData: image?.data, imageWidth: image?.width, imageHeight: image?.height, imageAlt: alternative, imagePresentation: presentation, style: {
|
|
15
|
+
return (_jsx("ink-image", { imageData: image?.data, imageWidth: image?.width, imageHeight: image?.height, imageAlt: alternative, imagePresentation: presentation, imageCopyText: copyText, imageTransparent: transparent === true ? 'transparent' : undefined, style: {
|
|
16
16
|
width: columns,
|
|
17
17
|
height: rows,
|
|
18
18
|
flexGrow: 0,
|
|
@@ -47,9 +47,9 @@ function parseKey(keypress) {
|
|
|
47
47
|
if (keypress.ctrl && input === 'space') {
|
|
48
48
|
input = ' ';
|
|
49
49
|
}
|
|
50
|
-
// Suppress unrecognized
|
|
51
|
-
//
|
|
52
|
-
// Examples: ESC[25~ (F13/Right Alt on Windows), ESC[
|
|
50
|
+
// Suppress unrecognized function keys and other complete CSI sequences
|
|
51
|
+
// that have a protocol code but no mapped key name.
|
|
52
|
+
// Examples: ESC[25~ (F13/Right Alt on Windows), ESC[1;2;3;1A, etc.
|
|
53
53
|
// Without this, the ESC prefix is stripped below and the remainder (e.g.,
|
|
54
54
|
// "[25~") leaks into the input as literal text.
|
|
55
55
|
if (keypress.code && !keypress.name) {
|
|
@@ -3,8 +3,20 @@ interface TerminalImages {
|
|
|
3
3
|
subscribe(listener: () => void): () => void;
|
|
4
4
|
getSnapshot(): boolean;
|
|
5
5
|
getCellSize?(): TerminalCellSize | undefined;
|
|
6
|
+
getProtocol?(): TerminalImageProtocolName | undefined;
|
|
6
7
|
request(): () => void;
|
|
7
8
|
}
|
|
9
|
+
/** The graphics protocol the renderer paints images with. */
|
|
10
|
+
export type TerminalImageProtocolName = 'kitty' | 'sixel';
|
|
11
|
+
/**
|
|
12
|
+
* The protocol images are painted with, or undefined without graphics.
|
|
13
|
+
*
|
|
14
|
+
* Kitty provides persistent placements; Sixel paints rasters into the
|
|
15
|
+
* renderer-managed transcript surface. Both may host inline media as long as
|
|
16
|
+
* the placement joins the normal image lifecycle (a `presentation` of
|
|
17
|
+
* `'transcript'` or `'preview'`), which is the real capability boundary.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useTerminalImageProtocol(): TerminalImageProtocolName | undefined;
|
|
8
20
|
/** Only measured pixels qualify for an original-pixel (100%) image view. */
|
|
9
21
|
export declare function useTerminalImageCellSize(): TerminalCellSize | undefined;
|
|
10
22
|
export declare const TerminalImagesContext: import("react").Context<TerminalImages>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-terminal-images.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-terminal-images.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,UAAU,cAAc;IACtB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;IAC3C,WAAW,IAAI,OAAO,CAAA;IACtB,WAAW,CAAC,IAAI,gBAAgB,GAAG,SAAS,CAAA;IAC5C,OAAO,IAAI,MAAM,IAAI,CAAA;CACtB;
|
|
1
|
+
{"version":3,"file":"use-terminal-images.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-terminal-images.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,UAAU,cAAc;IACtB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;IAC3C,WAAW,IAAI,OAAO,CAAA;IACtB,WAAW,CAAC,IAAI,gBAAgB,GAAG,SAAS,CAAA;IAC5C,WAAW,CAAC,IAAI,yBAAyB,GAAG,SAAS,CAAA;IACrD,OAAO,IAAI,MAAM,IAAI,CAAA;CACtB;AAED,6DAA6D;AAC7D,MAAM,MAAM,yBAAyB,GAAG,OAAO,GAAG,OAAO,CAAA;AAKzD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,yBAAyB,GAAG,SAAS,CAGhF;AAED,4EAA4E;AAC5E,wBAAgB,wBAAwB,IAAI,gBAAgB,GAAG,SAAS,CAGvE;AAED,eAAO,MAAM,qBAAqB,yCAIhC,CAAA;AAEF,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,SAAS,UAAO,GAAG,OAAO,CAO3D"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { createContext, useContext, useEffect, useSyncExternalStore } from 'react';
|
|
2
2
|
const noCellSize = () => undefined;
|
|
3
|
+
const noProtocol = () => undefined;
|
|
4
|
+
/**
|
|
5
|
+
* The protocol images are painted with, or undefined without graphics.
|
|
6
|
+
*
|
|
7
|
+
* Kitty provides persistent placements; Sixel paints rasters into the
|
|
8
|
+
* renderer-managed transcript surface. Both may host inline media as long as
|
|
9
|
+
* the placement joins the normal image lifecycle (a `presentation` of
|
|
10
|
+
* `'transcript'` or `'preview'`), which is the real capability boundary.
|
|
11
|
+
*/
|
|
12
|
+
export function useTerminalImageProtocol() {
|
|
13
|
+
const images = useContext(TerminalImagesContext);
|
|
14
|
+
return useSyncExternalStore(images.subscribe, images.getProtocol ?? noProtocol);
|
|
15
|
+
}
|
|
3
16
|
/** Only measured pixels qualify for an original-pixel (100%) image view. */
|
|
4
17
|
export function useTerminalImageCellSize() {
|
|
5
18
|
const images = useContext(TerminalImagesContext);
|
package/lib/types/ink/ink.d.ts
CHANGED
|
@@ -518,6 +518,12 @@ export default class Ink {
|
|
|
518
518
|
private writeRaw;
|
|
519
519
|
private setCursorDeclaration;
|
|
520
520
|
private setAppRef;
|
|
521
|
+
/**
|
|
522
|
+
* Kitty placements report failures; an ENOENT means the terminal evicted a
|
|
523
|
+
* dormant image under a quota smaller than our retention budget. Repaint so
|
|
524
|
+
* the next reconcile uploads it again.
|
|
525
|
+
*/
|
|
526
|
+
private handleUnsolicitedResponse;
|
|
521
527
|
render(node: ReactNode): void;
|
|
522
528
|
unmount(error?: Error | number | null): void;
|
|
523
529
|
waitUntilExit(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink.d.ts","sourceRoot":"","sources":["../../../src/ink/ink.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAc9C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAIhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAA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G,IAAI;IAc9D;;;;;OAKG;IACH,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAanD,OAAO,CAAC,cAAc,CAGd;IACR,OAAO,CAAC,UAAU,CAAS;IAC3B,YAAY,IAAI,IAAI;IA8BpB,WAAW,IAAI,IAAI;IAoDnB,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,oBAAoB,CAK1B;IACF,OAAO,CAAC,SAAS;IAIjB;;;;OAIG;IACH,OAAO,CAAC,yBAAyB,CAK/B;IACF,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAe7B,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI;IAmHtC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAOpC,cAAc,IAAI,IAAI;IAYtB;;;;;;;OAOG;IACH,UAAU,IAAI,IAAI;IAalB,YAAY,IAAI,MAAM,IAAI;IAqB1B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,WAAW;CAmDpB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAAgB,UAAU,CAAC,KAAK,GAAE,MAAM,CAAC,UAA0B,GAAG,IAAI,CAsDzE"}
|
package/lib/types/ink/ink.js
CHANGED
|
@@ -97,6 +97,7 @@ export default class Ink {
|
|
|
97
97
|
getSnapshot: () => this.altScreenActive && (this.kittyGraphicsSupported || this.sixelGraphicsSupported) &&
|
|
98
98
|
!this.isPaused && !this.terminalQueriesSuspended && !this.isUnmounted,
|
|
99
99
|
getCellSize: () => this.measuredImageCellSize,
|
|
100
|
+
getProtocol: () => !this.terminalImages.getSnapshot() ? undefined : this.kittyGraphicsSupported ? 'kitty' : 'sixel',
|
|
100
101
|
request: () => {
|
|
101
102
|
if (this.isUnmounted)
|
|
102
103
|
return noop;
|
|
@@ -845,7 +846,7 @@ export default class Ink {
|
|
|
845
846
|
if (this.altScreenActive) {
|
|
846
847
|
selActive = hasSelection(this.selection);
|
|
847
848
|
if (selActive) {
|
|
848
|
-
applySelectionOverlay(frame.screen, this.selection, this.stylePool);
|
|
849
|
+
applySelectionOverlay(frame.screen, this.selection, this.stylePool, frame.images);
|
|
849
850
|
}
|
|
850
851
|
// Commit-consistency guard: hash the rows under the highlight on the
|
|
851
852
|
// frame the copy would actually read. An uncoordinated change since
|
|
@@ -2484,7 +2485,21 @@ export default class Ink {
|
|
|
2484
2485
|
};
|
|
2485
2486
|
setAppRef(app) {
|
|
2486
2487
|
this.app = app;
|
|
2488
|
+
if (app !== null)
|
|
2489
|
+
app.querier.onUnsolicited = this.handleUnsolicitedResponse;
|
|
2487
2490
|
}
|
|
2491
|
+
/**
|
|
2492
|
+
* Kitty placements report failures; an ENOENT means the terminal evicted a
|
|
2493
|
+
* dormant image under a quota smaller than our retention budget. Repaint so
|
|
2494
|
+
* the next reconcile uploads it again.
|
|
2495
|
+
*/
|
|
2496
|
+
handleUnsolicitedResponse = (response) => {
|
|
2497
|
+
if (response.type !== 'kittyGraphics' || this.isUnmounted)
|
|
2498
|
+
return;
|
|
2499
|
+
if (this.kittyGraphicsManager.handleResponse(response.imageId, response.status)) {
|
|
2500
|
+
this.scheduleRender();
|
|
2501
|
+
}
|
|
2502
|
+
};
|
|
2488
2503
|
render(node) {
|
|
2489
2504
|
this.currentNode = node;
|
|
2490
2505
|
const tree = _jsx(App, { ref: this.setAppRef, stdin: this.options.stdin, stdout: this.options.stdout, stderr: this.options.stderr, exitOnCtrlC: this.options.exitOnCtrlC, onExit: this.unmount, terminalColumns: this.terminalColumns, terminalRows: this.terminalRows, selection: this.selection, onSelectionChange: this.notifySelectionChange, onClickAt: this.dispatchClick, onContextMenuAt: this.dispatchContextMenu, onHoverAt: this.dispatchHover, onWheelAt: this.dispatchWheelAt, getHyperlinkAt: this.getHyperlinkAt, onOpenHyperlink: this.openHyperlink, onMultiClick: this.handleMultiClick, onSelectionDrag: this.handleSelectionDrag, onDragTargetAt: this.findDragTargetAt, onDragDispatch: this.dispatchDrag, onPointerGestureChange: this.setPointerGestureActive, onProtocolCandidateChange: this.setProtocolCandidateActive, onReleaseTail: this.drainReleaseTail, onClickProbe: this.clickProbeAtBatchTail, onStdinResume: this.reassertTerminalModes, onTerminalFocus: this.handleTerminalFocusProbe, onCursorDeclaration: this.setCursorDeclaration, dispatchKeyboardEvent: this.dispatchKeyboardEvent, children: _jsx(TerminalWriteProvider, { value: this.writeRaw, children: _jsx(TerminalImagesContext.Provider, { value: this.terminalImages, children: node }) }) });
|
|
@@ -1,29 +1,70 @@
|
|
|
1
1
|
import { type TerminalCellSize, type TerminalImagePlacement, type TerminalImageSource } from './terminal-image.js';
|
|
2
|
+
/** Pixel rectangle of the uploaded raster to show (Kitty `x,y,w,h`). */
|
|
3
|
+
export type KittySourceRect = {
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
readonly width: number;
|
|
7
|
+
readonly height: number;
|
|
8
|
+
};
|
|
2
9
|
export interface KittyGraphicsManagerOptions {
|
|
3
10
|
/** Deterministic seed used by protocol tests; production chooses a random range. */
|
|
4
11
|
readonly firstImageId?: number;
|
|
5
12
|
/** Physical pixels per cell; defaults to a conventional 8×16 cell. */
|
|
6
13
|
readonly cellSize?: TerminalCellSize;
|
|
14
|
+
/** Clock for the re-upload failure window; protocol tests pin it. */
|
|
15
|
+
readonly now?: () => number;
|
|
7
16
|
}
|
|
8
17
|
/**
|
|
9
18
|
* Reconcile renderer image requests with Kitty image/placement state.
|
|
10
19
|
*
|
|
11
20
|
* Pixel content owns an image id while each DOM node owns a placement id.
|
|
12
21
|
* Equal immutable RGBA content is uploaded once and can back several nodes;
|
|
13
|
-
* geometry changes replace only that node's placement without flicker.
|
|
22
|
+
* geometry changes replace only that node's placement without flicker. An
|
|
23
|
+
* image no node places stays uploaded (dormant) within the retention budget,
|
|
24
|
+
* so content that scrolls back into view is re-placed, not re-sent.
|
|
14
25
|
*/
|
|
15
26
|
export declare class KittyGraphicsManager {
|
|
16
27
|
private readonly images;
|
|
17
28
|
private readonly placements;
|
|
29
|
+
/**
|
|
30
|
+
* Ids given up by a re-upload. The ENOENT that triggered it may be stale
|
|
31
|
+
* (the id was re-sent in between), so the terminal can still hold data
|
|
32
|
+
* under the old id; it is deleted on the next frame (or at exit).
|
|
33
|
+
*/
|
|
34
|
+
private readonly retiredImageIds;
|
|
18
35
|
private readonly contentHashes;
|
|
19
36
|
private nextImageId;
|
|
20
37
|
private nextPlacementId;
|
|
21
38
|
private cellSize;
|
|
39
|
+
private pass;
|
|
40
|
+
private readonly now;
|
|
22
41
|
constructor(options?: KittyGraphicsManagerOptions);
|
|
23
42
|
/** Update the physical cell ratio used by future image variants. */
|
|
24
43
|
setCellSize(cellSize: TerminalCellSize): boolean;
|
|
25
44
|
reconcile(placements: readonly TerminalImagePlacement[]): string;
|
|
26
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Forget images no node placed this pass once they are unusable (fitted for
|
|
47
|
+
* another cell geometry) or past the retention budget, oldest first.
|
|
48
|
+
*/
|
|
49
|
+
private evictDormant;
|
|
50
|
+
/**
|
|
51
|
+
* Handle a Kitty graphics reply the renderer did not ask for. ENOENT for
|
|
52
|
+
* one of our images means the terminal evicted its data (its own quota is
|
|
53
|
+
* smaller than our retention budget): upload it again and re-place every
|
|
54
|
+
* node showing it on the next frame. A second ENOENT within
|
|
55
|
+
* REUPLOAD_FAILURE_WINDOW_MS of that re-upload means the terminal refuses
|
|
56
|
+
* the image outright, so it is left as is (never an upload loop); a new
|
|
57
|
+
* content or size variant is a new image and tries again. The re-upload
|
|
58
|
+
* takes a fresh image id: every placement of the old id may still answer
|
|
59
|
+
* ENOENT, and those late replies must not count as the re-upload failing.
|
|
60
|
+
* Returns whether a repaint is needed.
|
|
61
|
+
*/
|
|
62
|
+
handleResponse(imageId: number, status: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* A clear/screen swap invalidated terminal-side data; resend next frame.
|
|
65
|
+
* The terminal state an abandoned image was judged against is gone too, so
|
|
66
|
+
* it gets a fresh ENOENT budget; one clear still buys at most one retry.
|
|
67
|
+
*/
|
|
27
68
|
invalidateAll(): void;
|
|
28
69
|
/** Delete every image owned by this renderer and forget their ids. */
|
|
29
70
|
deleteAll(): string;
|
|
@@ -34,7 +75,7 @@ export declare class KittyGraphicsManager {
|
|
|
34
75
|
}
|
|
35
76
|
/** Zlib-compressed direct RGBA split into protocol-compliant base64 chunks. */
|
|
36
77
|
export declare function transmitKittyRgba(imageId: number, source: TerminalImageSource): string;
|
|
37
|
-
export declare function kittyPlacement(imageId: number, placementId: number, x: number, y: number, columns: number, rows: number, zIndex?: number): string;
|
|
78
|
+
export declare function kittyPlacement(imageId: number, placementId: number, x: number, y: number, columns: number, rows: number, zIndex?: number, source?: KittySourceRect): string;
|
|
38
79
|
export declare function deleteKittyPlacement(imageId: number, placementId: number): string;
|
|
39
80
|
export declare function deleteKittyImage(imageId: number): string;
|
|
40
81
|
export declare function kittyCommand(control: string, payload?: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kitty-graphics.d.ts","sourceRoot":"","sources":["../../../src/ink/kitty-graphics.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"kitty-graphics.d.ts","sourceRoot":"","sources":["../../../src/ink/kitty-graphics.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAA;AAmE5B,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ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AAM,EACf,MAAM,EAAE,mBAAmB,GAC1B,MAAM,CAER;AAoCD,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,SAAgB,EACtB,MAAM,CAAC,EAAE,eAAe,GACvB,MAAM,CAUR;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,MAAM,CAER;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAK,GAAG,MAAM,CAElE"}
|
|
@@ -9,23 +9,54 @@ const ID_MAX_EXCLUSIVE = 0x7fffffff;
|
|
|
9
9
|
const PLACEMENT_ID_MAX_EXCLUSIVE = 0x40000000;
|
|
10
10
|
// Keep raster content behind terminal text and explicit panel backgrounds.
|
|
11
11
|
const IMAGE_Z_INDEX = -0x80000000;
|
|
12
|
+
/**
|
|
13
|
+
* Retention for uploaded images that no node places this frame. Leaving the
|
|
14
|
+
* viewport deletes only the placement (`d=i`), so scrolling back re-places
|
|
15
|
+
* the terminal-side data with one `a=p` instead of re-fitting, re-compressing
|
|
16
|
+
* and re-sending the whole raster — the protocol's intended use, and what
|
|
17
|
+
* mature terminal UIs do. Dormant images are evicted least-recently-used past
|
|
18
|
+
* either bound. The byte bound counts decoded RGBA (what the terminal keeps)
|
|
19
|
+
* and stays a small fraction of default terminal image quotas. A terminal
|
|
20
|
+
* configured with a smaller quota may still evict a dormant image, so
|
|
21
|
+
* placements report failures (`q=1`): an ENOENT reply marks the image for
|
|
22
|
+
* re-upload (see handleResponse).
|
|
23
|
+
*/
|
|
24
|
+
const DORMANT_MAX_IMAGES = 128;
|
|
25
|
+
const RETAINED_MAX_BYTES = 64 * 1024 * 1024;
|
|
26
|
+
/**
|
|
27
|
+
* An ENOENT this soon after re-uploading the same image means the terminal
|
|
28
|
+
* cannot keep it at all (e.g. the image exceeds its whole quota and the
|
|
29
|
+
* upload was refused): stop re-uploading instead of looping.
|
|
30
|
+
*/
|
|
31
|
+
const REUPLOAD_FAILURE_WINDOW_MS = 5000;
|
|
12
32
|
/**
|
|
13
33
|
* Reconcile renderer image requests with Kitty image/placement state.
|
|
14
34
|
*
|
|
15
35
|
* Pixel content owns an image id while each DOM node owns a placement id.
|
|
16
36
|
* Equal immutable RGBA content is uploaded once and can back several nodes;
|
|
17
|
-
* geometry changes replace only that node's placement without flicker.
|
|
37
|
+
* geometry changes replace only that node's placement without flicker. An
|
|
38
|
+
* image no node places stays uploaded (dormant) within the retention budget,
|
|
39
|
+
* so content that scrolls back into view is re-placed, not re-sent.
|
|
18
40
|
*/
|
|
19
41
|
export class KittyGraphicsManager {
|
|
20
42
|
images = new Map();
|
|
21
43
|
placements = new Map();
|
|
44
|
+
/**
|
|
45
|
+
* Ids given up by a re-upload. The ENOENT that triggered it may be stale
|
|
46
|
+
* (the id was re-sent in between), so the terminal can still hold data
|
|
47
|
+
* under the old id; it is deleted on the next frame (or at exit).
|
|
48
|
+
*/
|
|
49
|
+
retiredImageIds = [];
|
|
22
50
|
contentHashes = new WeakMap();
|
|
23
51
|
nextImageId;
|
|
24
52
|
nextPlacementId = 1;
|
|
25
53
|
cellSize;
|
|
54
|
+
pass = 0;
|
|
55
|
+
now;
|
|
26
56
|
constructor(options = {}) {
|
|
27
57
|
this.nextImageId = normalizeFirstId(options.firstImageId ?? randomInt(ID_MIN, ID_MAX_EXCLUSIVE));
|
|
28
58
|
this.cellSize = normalizeTerminalCellSize(options.cellSize ?? DEFAULT_TERMINAL_CELL_SIZE);
|
|
59
|
+
this.now = options.now ?? Date.now;
|
|
29
60
|
}
|
|
30
61
|
/** Update the physical cell ratio used by future image variants. */
|
|
31
62
|
setCellSize(cellSize) {
|
|
@@ -38,15 +69,17 @@ export class KittyGraphicsManager {
|
|
|
38
69
|
return true;
|
|
39
70
|
}
|
|
40
71
|
reconcile(placements) {
|
|
72
|
+
this.pass += 1;
|
|
41
73
|
const desiredNodes = new Set();
|
|
42
74
|
const desiredImages = new Set();
|
|
43
75
|
const desired = [];
|
|
44
|
-
const output =
|
|
76
|
+
const output = this.retiredImageIds.splice(0).map(deleteKittyImage);
|
|
45
77
|
for (const placement of placements) {
|
|
46
78
|
if (desiredNodes.has(placement.node))
|
|
47
79
|
continue;
|
|
48
80
|
desiredNodes.add(placement.node);
|
|
49
81
|
const image = this.imageFor(placement);
|
|
82
|
+
image.lastUsed = this.pass;
|
|
50
83
|
desiredImages.add(image);
|
|
51
84
|
desired.push({ placement, image });
|
|
52
85
|
}
|
|
@@ -64,6 +97,7 @@ export class KittyGraphicsManager {
|
|
|
64
97
|
y: -1,
|
|
65
98
|
columns: 0,
|
|
66
99
|
rows: 0,
|
|
100
|
+
crop: '',
|
|
67
101
|
};
|
|
68
102
|
this.placements.set(placement.node, state);
|
|
69
103
|
}
|
|
@@ -79,16 +113,22 @@ export class KittyGraphicsManager {
|
|
|
79
113
|
output.push(transmitPreparedKittyRgba(image.imageId, image.payload));
|
|
80
114
|
image.uploaded = true;
|
|
81
115
|
}
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
116
|
+
const visible = visiblePlacement(placement, image.payload);
|
|
117
|
+
const crop = visible.source === undefined
|
|
118
|
+
? ''
|
|
119
|
+
: `${visible.source.x},${visible.source.y},${visible.source.width},${visible.source.height}`;
|
|
120
|
+
const moved = state.x !== visible.x ||
|
|
121
|
+
state.y !== visible.y ||
|
|
122
|
+
state.columns !== visible.columns ||
|
|
123
|
+
state.rows !== visible.rows ||
|
|
124
|
+
state.crop !== crop;
|
|
86
125
|
if (!state.placed || moved) {
|
|
87
|
-
output.push(kittyPlacement(image.imageId, state.placementId,
|
|
88
|
-
state.x =
|
|
89
|
-
state.y =
|
|
90
|
-
state.columns =
|
|
91
|
-
state.rows =
|
|
126
|
+
output.push(kittyPlacement(image.imageId, state.placementId, visible.x, visible.y, visible.columns, visible.rows, state.zIndex, visible.source));
|
|
127
|
+
state.x = visible.x;
|
|
128
|
+
state.y = visible.y;
|
|
129
|
+
state.columns = visible.columns;
|
|
130
|
+
state.rows = visible.rows;
|
|
131
|
+
state.crop = crop;
|
|
92
132
|
state.placed = true;
|
|
93
133
|
}
|
|
94
134
|
}
|
|
@@ -101,31 +141,111 @@ export class KittyGraphicsManager {
|
|
|
101
141
|
});
|
|
102
142
|
this.placements.delete(node);
|
|
103
143
|
}
|
|
144
|
+
// Deleting an image's data also removes its placements, so an evicted
|
|
145
|
+
// image needs no separate placement delete.
|
|
146
|
+
const evicted = this.evictDormant(desiredImages);
|
|
104
147
|
for (const obsolete of obsoletePlacements) {
|
|
105
|
-
if (
|
|
148
|
+
if (evicted.has(obsolete.image))
|
|
106
149
|
continue;
|
|
107
150
|
output.push(deleteKittyPlacement(obsolete.image.imageId, obsolete.placementId));
|
|
108
151
|
}
|
|
109
|
-
for (const
|
|
110
|
-
if (desiredImages.has(image))
|
|
111
|
-
continue;
|
|
152
|
+
for (const image of evicted)
|
|
112
153
|
output.push(deleteKittyImage(image.imageId));
|
|
113
|
-
this.images.delete(key);
|
|
114
|
-
}
|
|
115
154
|
return output.join('');
|
|
116
155
|
}
|
|
117
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Forget images no node placed this pass once they are unusable (fitted for
|
|
158
|
+
* another cell geometry) or past the retention budget, oldest first.
|
|
159
|
+
*/
|
|
160
|
+
evictDormant(desiredImages) {
|
|
161
|
+
const evicted = new Set();
|
|
162
|
+
const dormant = [];
|
|
163
|
+
let retainedBytes = 0;
|
|
164
|
+
for (const entry of this.images) {
|
|
165
|
+
const image = entry[1];
|
|
166
|
+
if (desiredImages.has(image)) {
|
|
167
|
+
retainedBytes += image.retainedBytes;
|
|
168
|
+
}
|
|
169
|
+
else if (image.cellSize.width !== this.cellSize.width ||
|
|
170
|
+
image.cellSize.height !== this.cellSize.height) {
|
|
171
|
+
evicted.add(image);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
retainedBytes += image.retainedBytes;
|
|
175
|
+
dormant.push(entry);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
dormant.sort((a, b) => a[1].lastUsed - b[1].lastUsed);
|
|
179
|
+
let index = 0;
|
|
180
|
+
while (index < dormant.length &&
|
|
181
|
+
(dormant.length - index > DORMANT_MAX_IMAGES || retainedBytes > RETAINED_MAX_BYTES)) {
|
|
182
|
+
const image = dormant[index][1];
|
|
183
|
+
evicted.add(image);
|
|
184
|
+
retainedBytes -= image.retainedBytes;
|
|
185
|
+
index += 1;
|
|
186
|
+
}
|
|
187
|
+
for (const [key, image] of this.images) {
|
|
188
|
+
if (evicted.has(image))
|
|
189
|
+
this.images.delete(key);
|
|
190
|
+
}
|
|
191
|
+
return evicted;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Handle a Kitty graphics reply the renderer did not ask for. ENOENT for
|
|
195
|
+
* one of our images means the terminal evicted its data (its own quota is
|
|
196
|
+
* smaller than our retention budget): upload it again and re-place every
|
|
197
|
+
* node showing it on the next frame. A second ENOENT within
|
|
198
|
+
* REUPLOAD_FAILURE_WINDOW_MS of that re-upload means the terminal refuses
|
|
199
|
+
* the image outright, so it is left as is (never an upload loop); a new
|
|
200
|
+
* content or size variant is a new image and tries again. The re-upload
|
|
201
|
+
* takes a fresh image id: every placement of the old id may still answer
|
|
202
|
+
* ENOENT, and those late replies must not count as the re-upload failing.
|
|
203
|
+
* Returns whether a repaint is needed.
|
|
204
|
+
*/
|
|
205
|
+
handleResponse(imageId, status) {
|
|
206
|
+
if (!status.startsWith('ENOENT'))
|
|
207
|
+
return false;
|
|
208
|
+
let image;
|
|
209
|
+
for (const candidate of this.images.values()) {
|
|
210
|
+
if (candidate.imageId === imageId)
|
|
211
|
+
image = candidate;
|
|
212
|
+
}
|
|
213
|
+
if (image === undefined || !image.uploaded || image.abandoned)
|
|
214
|
+
return false;
|
|
215
|
+
const now = this.now();
|
|
216
|
+
if (image.reuploadedAt !== 0 && now - image.reuploadedAt < REUPLOAD_FAILURE_WINDOW_MS) {
|
|
217
|
+
image.abandoned = true;
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
image.reuploadedAt = now;
|
|
221
|
+
this.retiredImageIds.push(image.imageId);
|
|
222
|
+
image.imageId = this.allocateImageId();
|
|
223
|
+
image.uploaded = false;
|
|
224
|
+
for (const state of this.placements.values()) {
|
|
225
|
+
if (state.image === image)
|
|
226
|
+
state.placed = false;
|
|
227
|
+
}
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* A clear/screen swap invalidated terminal-side data; resend next frame.
|
|
232
|
+
* The terminal state an abandoned image was judged against is gone too, so
|
|
233
|
+
* it gets a fresh ENOENT budget; one clear still buys at most one retry.
|
|
234
|
+
*/
|
|
118
235
|
invalidateAll() {
|
|
119
|
-
for (const image of this.images.values())
|
|
236
|
+
for (const image of this.images.values()) {
|
|
120
237
|
image.uploaded = false;
|
|
238
|
+
image.abandoned = false;
|
|
239
|
+
image.reuploadedAt = 0;
|
|
240
|
+
}
|
|
121
241
|
for (const state of this.placements.values()) {
|
|
122
242
|
state.placed = false;
|
|
123
243
|
}
|
|
124
244
|
}
|
|
125
245
|
/** Delete every image owned by this renderer and forget their ids. */
|
|
126
246
|
deleteAll() {
|
|
127
|
-
const output = [...this.images.values()]
|
|
128
|
-
.map(
|
|
247
|
+
const output = [...this.retiredImageIds.splice(0), ...[...this.images.values()].map(image => image.imageId)]
|
|
248
|
+
.map(deleteKittyImage)
|
|
129
249
|
.join('');
|
|
130
250
|
this.images.clear();
|
|
131
251
|
this.placements.clear();
|
|
@@ -150,7 +270,12 @@ export class KittyGraphicsManager {
|
|
|
150
270
|
const image = {
|
|
151
271
|
imageId: this.allocateImageId(),
|
|
152
272
|
payload: prepareKittyRgba(fitted),
|
|
273
|
+
retainedBytes: fitted.width * fitted.height * 4,
|
|
274
|
+
cellSize: this.cellSize,
|
|
153
275
|
uploaded: false,
|
|
276
|
+
lastUsed: this.pass,
|
|
277
|
+
reuploadedAt: 0,
|
|
278
|
+
abandoned: false,
|
|
154
279
|
};
|
|
155
280
|
this.images.set(key, image);
|
|
156
281
|
return image;
|
|
@@ -179,6 +304,39 @@ export class KittyGraphicsManager {
|
|
|
179
304
|
return id;
|
|
180
305
|
}
|
|
181
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* The cells a placement actually occupies and, when it is clipped, the part
|
|
309
|
+
* of the uploaded raster behind them. The raster has the full cell box's
|
|
310
|
+
* exact physical aspect (see fitTerminalImageSource), so a cell edge maps to
|
|
311
|
+
* a pixel edge proportionally; the start rounds down and the end up, so a
|
|
312
|
+
* partially covered pixel row is shown rather than dropped.
|
|
313
|
+
*/
|
|
314
|
+
function visiblePlacement(placement, payload) {
|
|
315
|
+
const clip = placement.clip;
|
|
316
|
+
if (clip === undefined ||
|
|
317
|
+
(clip.x === placement.x && clip.y === placement.y &&
|
|
318
|
+
clip.columns === placement.columns && clip.rows === placement.rows)) {
|
|
319
|
+
return { x: placement.x, y: placement.y, columns: placement.columns, rows: placement.rows };
|
|
320
|
+
}
|
|
321
|
+
const left = clip.x - placement.x;
|
|
322
|
+
const top = clip.y - placement.y;
|
|
323
|
+
const sourceX = Math.floor((payload.width * left) / placement.columns);
|
|
324
|
+
const sourceY = Math.floor((payload.height * top) / placement.rows);
|
|
325
|
+
const sourceRight = Math.min(payload.width, Math.ceil((payload.width * (left + clip.columns)) / placement.columns));
|
|
326
|
+
const sourceBottom = Math.min(payload.height, Math.ceil((payload.height * (top + clip.rows)) / placement.rows));
|
|
327
|
+
return {
|
|
328
|
+
x: clip.x,
|
|
329
|
+
y: clip.y,
|
|
330
|
+
columns: clip.columns,
|
|
331
|
+
rows: clip.rows,
|
|
332
|
+
source: {
|
|
333
|
+
x: sourceX,
|
|
334
|
+
y: sourceY,
|
|
335
|
+
width: Math.max(1, sourceRight - sourceX),
|
|
336
|
+
height: Math.max(1, sourceBottom - sourceY),
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
}
|
|
182
340
|
/** Zlib-compressed direct RGBA split into protocol-compliant base64 chunks. */
|
|
183
341
|
export function transmitKittyRgba(imageId, source) {
|
|
184
342
|
return transmitPreparedKittyRgba(imageId, prepareKittyRgba(source));
|
|
@@ -208,9 +366,12 @@ function transmitPreparedKittyRgba(imageId, payload) {
|
|
|
208
366
|
})
|
|
209
367
|
.join('');
|
|
210
368
|
}
|
|
211
|
-
export function kittyPlacement(imageId, placementId, x, y, columns, rows, zIndex = IMAGE_Z_INDEX) {
|
|
369
|
+
export function kittyPlacement(imageId, placementId, x, y, columns, rows, zIndex = IMAGE_Z_INDEX, source) {
|
|
370
|
+
const crop = source === undefined
|
|
371
|
+
? ''
|
|
372
|
+
: `,x=${source.x},y=${source.y},w=${source.width},h=${source.height}`;
|
|
212
373
|
return (`\u001b[${y + 1};${x + 1}H` +
|
|
213
|
-
kittyCommand(`a=p,i=${imageId},p=${placementId},c=${columns},r=${rows},z=${zIndex},C=1,q=
|
|
374
|
+
kittyCommand(`a=p,i=${imageId},p=${placementId},c=${columns},r=${rows}${crop},z=${zIndex},C=1,q=1`));
|
|
214
375
|
}
|
|
215
376
|
export function deleteKittyPlacement(imageId, placementId) {
|
|
216
377
|
return kittyCommand(`a=d,d=i,i=${imageId},p=${placementId},q=2`);
|