@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
package/lib/types/ui.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export { default as useStdin } from './ink/hooks/use-stdin.js';
|
|
|
22
22
|
export { default as useApp } from './ink/hooks/use-app.js';
|
|
23
23
|
export { useAnimationFrame } from './ink/hooks/use-animation-frame.js';
|
|
24
24
|
export { useTerminalSize } from './ink/hooks/use-terminal-size.js';
|
|
25
|
-
export { useTerminalImages, useTerminalImageCellSize } from './ink/hooks/use-terminal-images.js';
|
|
25
|
+
export { useTerminalImages, useTerminalImageCellSize, useTerminalImageProtocol } from './ink/hooks/use-terminal-images.js';
|
|
26
26
|
export { useBlink } from './hooks/useBlink.js';
|
|
27
27
|
export { Ansi } from './ink/Ansi.js';
|
|
28
28
|
export type { Key } from './ink/events/input-event.js';
|
package/lib/types/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/ui.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACzE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAA;AACrF,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,0CAA0C,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,KAAK,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC7E,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/ui.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACzE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAA;AACrF,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,0CAA0C,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,KAAK,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC7E,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAA;AAC1H,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,YAAY,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAA"}
|
package/lib/types/ui.js
CHANGED
|
@@ -20,6 +20,6 @@ export { default as useStdin } from './ink/hooks/use-stdin.js';
|
|
|
20
20
|
export { default as useApp } from './ink/hooks/use-app.js';
|
|
21
21
|
export { useAnimationFrame } from './ink/hooks/use-animation-frame.js';
|
|
22
22
|
export { useTerminalSize } from './ink/hooks/use-terminal-size.js';
|
|
23
|
-
export { useTerminalImages, useTerminalImageCellSize } from './ink/hooks/use-terminal-images.js';
|
|
23
|
+
export { useTerminalImages, useTerminalImageCellSize, useTerminalImageProtocol } from './ink/hooks/use-terminal-images.js';
|
|
24
24
|
export { useBlink } from './hooks/useBlink.js';
|
|
25
25
|
export { Ansi } from './ink/Ansi.js';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本机使用统计(`~/.dsh-tui/usage.json`):累计启动次数与累计在线时长,只服务
|
|
3
|
+
* 开屏那句"里程碑求 star"。三条硬约束:
|
|
4
|
+
*
|
|
5
|
+
* 1. **绝不影响开屏**:文件缺失/损坏/字段类型不对一律当 0,读不到就重写;
|
|
6
|
+
* 2. **一次进程只记一次**:`recordLaunch()` 有模块级闸门,LogoV2 反复挂载也只 +1;
|
|
7
|
+
* 3. **崩溃不丢太多**:启动时记 `startedAt`,每 5 分钟兜底落盘一次,退出时再补最后一段
|
|
8
|
+
* (定时器 `unref()`,不拖着进程不退)。
|
|
9
|
+
*
|
|
10
|
+
* 里程碑是**一条有序阶梯**(次数与时长按"1 次 ≈ 1 小时"的体感交错),跨档时只报
|
|
11
|
+
* 最高那一档,且每档只报一次——所以 `celebrated` 记的是"已报到第几档"。
|
|
12
|
+
*/
|
|
13
|
+
/** 一档里程碑:次数或时长(小时)二者取一。 */
|
|
14
|
+
export interface StarMilestone {
|
|
15
|
+
/** 累计启动次数门槛。 */
|
|
16
|
+
readonly launches?: number;
|
|
17
|
+
/** 累计在线小时门槛。 */
|
|
18
|
+
readonly hours?: number;
|
|
19
|
+
/**
|
|
20
|
+
* 这一档配不配"弹一次窗"。给**值得停下来看一眼**的档用(`24h` / `99h` /
|
|
21
|
+
* `999 次`)——其余档只在开屏出那行标语 + 一条非阻塞提示,绝不拦路。
|
|
22
|
+
* 弹窗一次只弹一档、只弹一次。(24h 是"第一次陪你一整天",比 99h 早得多,
|
|
23
|
+
* 用户实机反馈 99h 等太久。)
|
|
24
|
+
*/
|
|
25
|
+
readonly modal?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 求 star 的里程碑阶梯(有序)。次数档:100 / 500 / **999** / 5000 / 10000;
|
|
29
|
+
* 时长档:**24 / 50 / 99 / 200 / 500** 小时。两套按体感交错成一条线;
|
|
30
|
+
* 其中 `24h`、`99h` 与 `999 次` 会**弹一次窗**(可关,只在开屏)。
|
|
31
|
+
*/
|
|
32
|
+
export declare const STAR_MILESTONES: readonly StarMilestone[];
|
|
33
|
+
/**
|
|
34
|
+
* 这一档是不是"历史性时刻"(值得弹窗)。
|
|
35
|
+
* @param index - `STAR_MILESTONES` 的下标。
|
|
36
|
+
* @returns 该档是否配弹窗(未知下标一律 false)。
|
|
37
|
+
*/
|
|
38
|
+
export declare const isHistoricMilestone: (index: number) => boolean;
|
|
39
|
+
/** 本机累计用量。 */
|
|
40
|
+
export interface UsageStats {
|
|
41
|
+
/** 累计启动次数。 */
|
|
42
|
+
readonly launches: number;
|
|
43
|
+
/** 累计在线毫秒。 */
|
|
44
|
+
readonly totalMs: number;
|
|
45
|
+
/** 已报到第几档里程碑(`STAR_MILESTONES` 的下标 +1;0 = 从没报过)。 */
|
|
46
|
+
readonly celebrated: number;
|
|
47
|
+
}
|
|
48
|
+
/** 空账本(文件缺失/损坏时的回落)。 */
|
|
49
|
+
export declare const EMPTY_USAGE: UsageStats;
|
|
50
|
+
/**
|
|
51
|
+
* 读取本机用量;任何异常与非法形状都回落成 0(开屏不许因为统计文件挂掉)。
|
|
52
|
+
* @param dir - 数据目录(测试可注入)。
|
|
53
|
+
* @returns 归一化后的用量。
|
|
54
|
+
*/
|
|
55
|
+
export declare function readUsage(dir?: string): UsageStats;
|
|
56
|
+
/**
|
|
57
|
+
* 写回本机用量(先写临时文件再改名,避免半截文件)。
|
|
58
|
+
* @param stats - 要落盘的用量。
|
|
59
|
+
* @param dir - 数据目录(测试可注入)。
|
|
60
|
+
* @returns 是否写成功(失败只是不记账,不影响任何功能)。
|
|
61
|
+
*/
|
|
62
|
+
export declare function writeUsage(stats: UsageStats, dir?: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* 该不该在这台机器上求一次 star,以及报到第几档。
|
|
65
|
+
* @param stats - 当前用量。
|
|
66
|
+
* @returns 未报过的、已达成的**最高**那一档的下标;没有则 `null`。
|
|
67
|
+
*/
|
|
68
|
+
export declare function pendingStarMilestone(stats: UsageStats): number | null;
|
|
69
|
+
/**
|
|
70
|
+
* 开屏弹窗判定:启动时由 Chat 调一次——账本文件里未报过的最高一档若
|
|
71
|
+
* 配弹窗(`99h` / `999 次`),返回其下标;其余情况(没有待报档、或待报档
|
|
72
|
+
* 是只出标语行的普通档)一律 `null`。读**文件**而不是进程缓存:LogoV2
|
|
73
|
+
* 的 `recordLaunch` 与本函数分属不同挂载层,文件是两者一致的真相源。
|
|
74
|
+
* 弹窗真正展示时由调用方 `markStarAsked` 记账,本函数只读不写。
|
|
75
|
+
* @param dir - 数据目录(测试可注入)。
|
|
76
|
+
* @returns 配弹窗且已达成的档位下标;没有则 `null`。
|
|
77
|
+
*/
|
|
78
|
+
export declare function dueStarModal(dir?: string): number | null;
|
|
79
|
+
/**
|
|
80
|
+
* 记一次启动:累计次数 +1、开始计时,并挂上兜底落盘与退出补记。
|
|
81
|
+
* 同一进程里对同一目录重复调用只生效一次(LogoV2 反复挂载也只 +1)。
|
|
82
|
+
* @param dir - 数据目录(测试可注入)。
|
|
83
|
+
* @returns 记完之后的用量(开屏拿它判里程碑)。
|
|
84
|
+
*/
|
|
85
|
+
export declare function recordLaunch(dir?: string): UsageStats;
|
|
86
|
+
/**
|
|
87
|
+
* 当前缓存的用量(没记过启动就是空账本)。
|
|
88
|
+
* @param dir - 数据目录(测试可注入)。
|
|
89
|
+
* @returns 该目录下的用量。
|
|
90
|
+
*/
|
|
91
|
+
export declare function usageSnapshot(dir?: string): UsageStats;
|
|
92
|
+
/**
|
|
93
|
+
* 把某一档标记为"已求过"(开屏决定显示之后调用一次)。
|
|
94
|
+
* @param index - `STAR_MILESTONES` 的下标。
|
|
95
|
+
* @param dir - 数据目录(测试可注入)。
|
|
96
|
+
*/
|
|
97
|
+
export declare function markStarAsked(index: number, dir?: string): void;
|
|
98
|
+
//# sourceMappingURL=usageStats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usageStats.d.ts","sourceRoot":"","sources":["../../src/usageStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,2BAA2B;AAC3B,MAAM,WAAW,aAAa;IAC5B,gBAAgB;IAChB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,gBAAgB;IAChB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAWnD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,KAAG,OAAiD,CAAA;AAErG,cAAc;AACd,MAAM,WAAW,UAAU;IACzB,cAAc;IACd,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,cAAc;IACd,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED,wBAAwB;AACxB,eAAO,MAAM,WAAW,EAAE,UAAuD,CAAA;AAKjF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,GAAE,MAAiB,GAAG,UAAU,CAS5D;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,GAAE,MAAiB,GAAG,OAAO,CAW7E;AAOD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAKrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAiB,GAAG,MAAM,GAAG,IAAI,CAGlE;AAwBD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAiB,GAAG,UAAU,CAe/D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAiB,GAAG,UAAU,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,MAAiB,GAAG,IAAI,CAKzE"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本机使用统计(`~/.dsh-tui/usage.json`):累计启动次数与累计在线时长,只服务
|
|
3
|
+
* 开屏那句"里程碑求 star"。三条硬约束:
|
|
4
|
+
*
|
|
5
|
+
* 1. **绝不影响开屏**:文件缺失/损坏/字段类型不对一律当 0,读不到就重写;
|
|
6
|
+
* 2. **一次进程只记一次**:`recordLaunch()` 有模块级闸门,LogoV2 反复挂载也只 +1;
|
|
7
|
+
* 3. **崩溃不丢太多**:启动时记 `startedAt`,每 5 分钟兜底落盘一次,退出时再补最后一段
|
|
8
|
+
* (定时器 `unref()`,不拖着进程不退)。
|
|
9
|
+
*
|
|
10
|
+
* 里程碑是**一条有序阶梯**(次数与时长按"1 次 ≈ 1 小时"的体感交错),跨档时只报
|
|
11
|
+
* 最高那一档,且每档只报一次——所以 `celebrated` 记的是"已报到第几档"。
|
|
12
|
+
*/
|
|
13
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
14
|
+
import { join } from 'node:path';
|
|
15
|
+
import { DATA_DIR } from './utils/paths.js';
|
|
16
|
+
/** 兜底落盘间隔(毫秒):被杀进程最多丢这么久。 */
|
|
17
|
+
const FLUSH_MS = 5 * 60 * 1000;
|
|
18
|
+
/**
|
|
19
|
+
* 求 star 的里程碑阶梯(有序)。次数档:100 / 500 / **999** / 5000 / 10000;
|
|
20
|
+
* 时长档:**24 / 50 / 99 / 200 / 500** 小时。两套按体感交错成一条线;
|
|
21
|
+
* 其中 `24h`、`99h` 与 `999 次` 会**弹一次窗**(可关,只在开屏)。
|
|
22
|
+
*/
|
|
23
|
+
export const STAR_MILESTONES = [
|
|
24
|
+
{ hours: 24, modal: true },
|
|
25
|
+
{ hours: 50 },
|
|
26
|
+
{ hours: 99, modal: true },
|
|
27
|
+
{ launches: 100 },
|
|
28
|
+
{ hours: 200 },
|
|
29
|
+
{ hours: 500 },
|
|
30
|
+
{ launches: 500 },
|
|
31
|
+
{ launches: 999, modal: true },
|
|
32
|
+
{ launches: 5000 },
|
|
33
|
+
{ launches: 10000 },
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* 这一档是不是"历史性时刻"(值得弹窗)。
|
|
37
|
+
* @param index - `STAR_MILESTONES` 的下标。
|
|
38
|
+
* @returns 该档是否配弹窗(未知下标一律 false)。
|
|
39
|
+
*/
|
|
40
|
+
export const isHistoricMilestone = (index) => STAR_MILESTONES[index]?.modal === true;
|
|
41
|
+
/** 空账本(文件缺失/损坏时的回落)。 */
|
|
42
|
+
export const EMPTY_USAGE = { launches: 0, totalMs: 0, celebrated: 0 };
|
|
43
|
+
const positive = (value) => typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.floor(value) : 0;
|
|
44
|
+
/**
|
|
45
|
+
* 读取本机用量;任何异常与非法形状都回落成 0(开屏不许因为统计文件挂掉)。
|
|
46
|
+
* @param dir - 数据目录(测试可注入)。
|
|
47
|
+
* @returns 归一化后的用量。
|
|
48
|
+
*/
|
|
49
|
+
export function readUsage(dir = DATA_DIR) {
|
|
50
|
+
try {
|
|
51
|
+
const parsed = JSON.parse(readFileSync(join(dir, 'usage.json'), 'utf8'));
|
|
52
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
53
|
+
return EMPTY_USAGE;
|
|
54
|
+
const raw = parsed;
|
|
55
|
+
return { launches: positive(raw.launches), totalMs: positive(raw.totalMs), celebrated: positive(raw.celebrated) };
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return EMPTY_USAGE;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 写回本机用量(先写临时文件再改名,避免半截文件)。
|
|
63
|
+
* @param stats - 要落盘的用量。
|
|
64
|
+
* @param dir - 数据目录(测试可注入)。
|
|
65
|
+
* @returns 是否写成功(失败只是不记账,不影响任何功能)。
|
|
66
|
+
*/
|
|
67
|
+
export function writeUsage(stats, dir = DATA_DIR) {
|
|
68
|
+
try {
|
|
69
|
+
mkdirSync(dir, { recursive: true });
|
|
70
|
+
const target = join(dir, 'usage.json');
|
|
71
|
+
const temp = `${target}.tmp`;
|
|
72
|
+
writeFileSync(temp, JSON.stringify(stats, null, 2));
|
|
73
|
+
renameSync(temp, target);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** 一档里程碑是否已经达到。 */
|
|
81
|
+
const reached = (milestone, stats) => (milestone.launches !== undefined && stats.launches >= milestone.launches) ||
|
|
82
|
+
(milestone.hours !== undefined && stats.totalMs >= milestone.hours * 3_600_000);
|
|
83
|
+
/**
|
|
84
|
+
* 该不该在这台机器上求一次 star,以及报到第几档。
|
|
85
|
+
* @param stats - 当前用量。
|
|
86
|
+
* @returns 未报过的、已达成的**最高**那一档的下标;没有则 `null`。
|
|
87
|
+
*/
|
|
88
|
+
export function pendingStarMilestone(stats) {
|
|
89
|
+
for (let index = STAR_MILESTONES.length - 1; index >= Math.max(0, stats.celebrated); index--) {
|
|
90
|
+
if (reached(STAR_MILESTONES[index], stats))
|
|
91
|
+
return index;
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* 开屏弹窗判定:启动时由 Chat 调一次——账本文件里未报过的最高一档若
|
|
97
|
+
* 配弹窗(`99h` / `999 次`),返回其下标;其余情况(没有待报档、或待报档
|
|
98
|
+
* 是只出标语行的普通档)一律 `null`。读**文件**而不是进程缓存:LogoV2
|
|
99
|
+
* 的 `recordLaunch` 与本函数分属不同挂载层,文件是两者一致的真相源。
|
|
100
|
+
* 弹窗真正展示时由调用方 `markStarAsked` 记账,本函数只读不写。
|
|
101
|
+
* @param dir - 数据目录(测试可注入)。
|
|
102
|
+
* @returns 配弹窗且已达成的档位下标;没有则 `null`。
|
|
103
|
+
*/
|
|
104
|
+
export function dueStarModal(dir = DATA_DIR) {
|
|
105
|
+
const pending = pendingStarMilestone(readUsage(dir));
|
|
106
|
+
return pending !== null && isHistoricMilestone(pending) ? pending : null;
|
|
107
|
+
}
|
|
108
|
+
/** 进程内闸门:一次进程、一个数据目录只记一次启动。 */ const recorded = new Set();
|
|
109
|
+
/** 进程内缓存的账本(按目录分开存,生产只有一个目录;测试可注入不同目录)。 */
|
|
110
|
+
const caches = new Map();
|
|
111
|
+
/** 本次进程开始计时的时刻(按目录)。 */
|
|
112
|
+
const startedAt = new Map();
|
|
113
|
+
/** 把"本段时长"并进账本并落盘(幂等:`startedAt` 会被推进)。 */
|
|
114
|
+
const flush = (dir, extraIndex) => {
|
|
115
|
+
const cached = caches.get(dir);
|
|
116
|
+
if (cached === undefined)
|
|
117
|
+
return;
|
|
118
|
+
const now = Date.now();
|
|
119
|
+
const since = startedAt.get(dir) ?? now;
|
|
120
|
+
startedAt.set(dir, now);
|
|
121
|
+
const next = {
|
|
122
|
+
...cached,
|
|
123
|
+
totalMs: cached.totalMs + Math.max(0, now - since),
|
|
124
|
+
celebrated: extraIndex === undefined ? cached.celebrated : extraIndex + 1,
|
|
125
|
+
};
|
|
126
|
+
caches.set(dir, next);
|
|
127
|
+
writeUsage(next, dir);
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* 记一次启动:累计次数 +1、开始计时,并挂上兜底落盘与退出补记。
|
|
131
|
+
* 同一进程里对同一目录重复调用只生效一次(LogoV2 反复挂载也只 +1)。
|
|
132
|
+
* @param dir - 数据目录(测试可注入)。
|
|
133
|
+
* @returns 记完之后的用量(开屏拿它判里程碑)。
|
|
134
|
+
*/
|
|
135
|
+
export function recordLaunch(dir = DATA_DIR) {
|
|
136
|
+
const cached = caches.get(dir);
|
|
137
|
+
if (recorded.has(dir) && cached !== undefined)
|
|
138
|
+
return cached;
|
|
139
|
+
recorded.add(dir);
|
|
140
|
+
startedAt.set(dir, Date.now());
|
|
141
|
+
const previous = readUsage(dir);
|
|
142
|
+
const next = { ...previous, launches: previous.launches + 1 };
|
|
143
|
+
caches.set(dir, next);
|
|
144
|
+
writeUsage(next, dir);
|
|
145
|
+
const timer = setInterval(() => flush(dir), FLUSH_MS);
|
|
146
|
+
// 定时器不拖着进程:TUI 退出时不该因为统计而多活 5 分钟。
|
|
147
|
+
timer.unref?.();
|
|
148
|
+
process.once('exit', () => flush(dir));
|
|
149
|
+
return next;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 当前缓存的用量(没记过启动就是空账本)。
|
|
153
|
+
* @param dir - 数据目录(测试可注入)。
|
|
154
|
+
* @returns 该目录下的用量。
|
|
155
|
+
*/
|
|
156
|
+
export function usageSnapshot(dir = DATA_DIR) {
|
|
157
|
+
return caches.get(dir) ?? EMPTY_USAGE;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* 把某一档标记为"已求过"(开屏决定显示之后调用一次)。
|
|
161
|
+
* @param index - `STAR_MILESTONES` 的下标。
|
|
162
|
+
* @param dir - 数据目录(测试可注入)。
|
|
163
|
+
*/
|
|
164
|
+
export function markStarAsked(index, dir = DATA_DIR) {
|
|
165
|
+
const cached = caches.get(dir) ?? readUsage(dir);
|
|
166
|
+
const next = { ...cached, celebrated: Math.max(cached.celebrated, index + 1) };
|
|
167
|
+
caches.set(dir, next);
|
|
168
|
+
writeUsage(next, dir);
|
|
169
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency-free BMP → PNG conversion for clipboard screenshots. WSLg (and
|
|
3
|
+
* some X11 owners) expose a Windows bitmap copy as `image/bmp`, a format the
|
|
4
|
+
* attachment profile does not accept and that `sharp`'s prebuilt libvips
|
|
5
|
+
* cannot decode. Only the shapes a screenshot tool produces are handled:
|
|
6
|
+
* uncompressed 24/32-bit pixels (BI_RGB, BI_BITFIELDS, BI_ALPHABITFIELDS),
|
|
7
|
+
* bottom-up or top-down. Anything else returns null and the caller keeps its
|
|
8
|
+
* "format unsupported" path.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Convert BMP bytes (a `BM` file, or a headerless DIB) to PNG.
|
|
12
|
+
* @param bmp - Raw clipboard bytes.
|
|
13
|
+
* @returns PNG bytes, or null when the bitmap is malformed or uses an
|
|
14
|
+
* unsupported layout (palettes, RLE, 16-bit, OS/2 core header).
|
|
15
|
+
*/
|
|
16
|
+
export declare function bmpToPng(bmp: Buffer): Promise<Buffer | null>;
|
|
17
|
+
//# sourceMappingURL=bmp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bmp.d.ts","sourceRoot":"","sources":["../../../src/utils/bmp.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8DH;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuFlE"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency-free BMP → PNG conversion for clipboard screenshots. WSLg (and
|
|
3
|
+
* some X11 owners) expose a Windows bitmap copy as `image/bmp`, a format the
|
|
4
|
+
* attachment profile does not accept and that `sharp`'s prebuilt libvips
|
|
5
|
+
* cannot decode. Only the shapes a screenshot tool produces are handled:
|
|
6
|
+
* uncompressed 24/32-bit pixels (BI_RGB, BI_BITFIELDS, BI_ALPHABITFIELDS),
|
|
7
|
+
* bottom-up or top-down. Anything else returns null and the caller keeps its
|
|
8
|
+
* "format unsupported" path.
|
|
9
|
+
*/
|
|
10
|
+
import { crc32, deflate, constants } from 'node:zlib';
|
|
11
|
+
import { promisify } from 'node:util';
|
|
12
|
+
const deflateAsync = promisify(deflate);
|
|
13
|
+
/** Refuse absurd dimensions before allocating the pixel buffer. */
|
|
14
|
+
const MAX_PIXELS = 100_000_000;
|
|
15
|
+
const BI_RGB = 0;
|
|
16
|
+
const BI_BITFIELDS = 3;
|
|
17
|
+
const BI_ALPHABITFIELDS = 6;
|
|
18
|
+
function channel(mask) {
|
|
19
|
+
if (mask === 0)
|
|
20
|
+
return { mask: 0, shift: 0, max: 0 };
|
|
21
|
+
let shift = 0;
|
|
22
|
+
while (((mask >>> shift) & 1) === 0)
|
|
23
|
+
shift += 1;
|
|
24
|
+
return { mask, shift, max: mask >>> shift };
|
|
25
|
+
}
|
|
26
|
+
function scale(px, c) {
|
|
27
|
+
if (c.max === 0)
|
|
28
|
+
return 0;
|
|
29
|
+
const v = (px & c.mask) >>> c.shift;
|
|
30
|
+
return c.max === 255 ? v : Math.round((v * 255) / c.max);
|
|
31
|
+
}
|
|
32
|
+
function pngChunk(type, data) {
|
|
33
|
+
const out = Buffer.alloc(12 + data.length);
|
|
34
|
+
out.writeUInt32BE(data.length, 0);
|
|
35
|
+
out.write(type, 4, 'ascii');
|
|
36
|
+
data.copy(out, 8);
|
|
37
|
+
out.writeUInt32BE(crc32(out.subarray(4, 8 + data.length)), 8 + data.length);
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
async function encodePng(width, height, channels, pixels) {
|
|
41
|
+
const ihdr = Buffer.alloc(13);
|
|
42
|
+
ihdr.writeUInt32BE(width, 0);
|
|
43
|
+
ihdr.writeUInt32BE(height, 4);
|
|
44
|
+
ihdr[8] = 8;
|
|
45
|
+
ihdr[9] = channels === 4 ? 6 : 2;
|
|
46
|
+
const idat = await deflateAsync(pixels, { level: constants.Z_BEST_SPEED });
|
|
47
|
+
return Buffer.concat([
|
|
48
|
+
Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]),
|
|
49
|
+
pngChunk('IHDR', ihdr),
|
|
50
|
+
pngChunk('IDAT', idat),
|
|
51
|
+
pngChunk('IEND', Buffer.alloc(0)),
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Convert BMP bytes (a `BM` file, or a headerless DIB) to PNG.
|
|
56
|
+
* @param bmp - Raw clipboard bytes.
|
|
57
|
+
* @returns PNG bytes, or null when the bitmap is malformed or uses an
|
|
58
|
+
* unsupported layout (palettes, RLE, 16-bit, OS/2 core header).
|
|
59
|
+
*/
|
|
60
|
+
export async function bmpToPng(bmp) {
|
|
61
|
+
const hasFileHeader = bmp.length >= 14 && bmp[0] === 0x42 && bmp[1] === 0x4d;
|
|
62
|
+
const dib = hasFileHeader ? 14 : 0;
|
|
63
|
+
if (bmp.length < dib + 40)
|
|
64
|
+
return null;
|
|
65
|
+
const headerSize = bmp.readUInt32LE(dib);
|
|
66
|
+
if (headerSize < 40 || bmp.length < dib + headerSize)
|
|
67
|
+
return null;
|
|
68
|
+
const width = bmp.readInt32LE(dib + 4);
|
|
69
|
+
const rawHeight = bmp.readInt32LE(dib + 8);
|
|
70
|
+
const bpp = bmp.readUInt16LE(dib + 14);
|
|
71
|
+
const compression = bmp.readUInt32LE(dib + 16);
|
|
72
|
+
const height = Math.abs(rawHeight);
|
|
73
|
+
if (width <= 0 || height === 0 || width * height > MAX_PIXELS)
|
|
74
|
+
return null;
|
|
75
|
+
if (bpp !== 24 && bpp !== 32)
|
|
76
|
+
return null;
|
|
77
|
+
if (compression !== BI_RGB && compression !== BI_BITFIELDS && compression !== BI_ALPHABITFIELDS)
|
|
78
|
+
return null;
|
|
79
|
+
if (bpp === 24 && compression !== BI_RGB)
|
|
80
|
+
return null;
|
|
81
|
+
// Channel masks: defaults for BI_RGB, else the three (or four) DWORDs that
|
|
82
|
+
// follow a 40-byte header or sit inside V4/V5 headers at the same offset.
|
|
83
|
+
let redMask = 0x00ff0000;
|
|
84
|
+
let greenMask = 0x0000ff00;
|
|
85
|
+
let blueMask = 0x000000ff;
|
|
86
|
+
let alphaMask = 0;
|
|
87
|
+
let maskBytes = 0;
|
|
88
|
+
if (bpp === 32 && compression !== BI_RGB) {
|
|
89
|
+
const masksEnd = dib + 40 + (compression === BI_ALPHABITFIELDS ? 16 : 12);
|
|
90
|
+
if (bmp.length < masksEnd)
|
|
91
|
+
return null;
|
|
92
|
+
redMask = bmp.readUInt32LE(dib + 40);
|
|
93
|
+
greenMask = bmp.readUInt32LE(dib + 44);
|
|
94
|
+
blueMask = bmp.readUInt32LE(dib + 48);
|
|
95
|
+
if (headerSize >= 56 || compression === BI_ALPHABITFIELDS)
|
|
96
|
+
alphaMask = bmp.readUInt32LE(dib + 52);
|
|
97
|
+
if (headerSize === 40)
|
|
98
|
+
maskBytes = compression === BI_ALPHABITFIELDS ? 16 : 12;
|
|
99
|
+
}
|
|
100
|
+
if (bpp === 32 && (redMask === 0 || greenMask === 0 || blueMask === 0))
|
|
101
|
+
return null;
|
|
102
|
+
const declaredOffset = hasFileHeader ? bmp.readUInt32LE(10) : 0;
|
|
103
|
+
const pixelOffset = declaredOffset > 0 ? declaredOffset : dib + headerSize + maskBytes;
|
|
104
|
+
const stride = Math.floor((bpp * width + 31) / 32) * 4;
|
|
105
|
+
if (pixelOffset + stride * height > bmp.length)
|
|
106
|
+
return null;
|
|
107
|
+
const red = channel(redMask);
|
|
108
|
+
const green = channel(greenMask);
|
|
109
|
+
const blue = channel(blueMask);
|
|
110
|
+
const alpha = channel(alphaMask);
|
|
111
|
+
const bottomUp = rawHeight > 0;
|
|
112
|
+
// Alpha only counts when the mask exists AND at least one pixel uses it:
|
|
113
|
+
// clipboard DIBs routinely carry a dead alpha byte of 0 that would turn the
|
|
114
|
+
// whole screenshot transparent.
|
|
115
|
+
let useAlpha = false;
|
|
116
|
+
if (bpp === 32 && alpha.max !== 0) {
|
|
117
|
+
scan: for (let y = 0; y < height; y += 1) {
|
|
118
|
+
const row = pixelOffset + y * stride;
|
|
119
|
+
for (let x = 0; x < width; x += 1) {
|
|
120
|
+
if (scale(bmp.readUInt32LE(row + x * 4), alpha) !== 0) {
|
|
121
|
+
useAlpha = true;
|
|
122
|
+
break scan;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const channels = useAlpha ? 4 : 3;
|
|
128
|
+
const rowBytes = width * channels;
|
|
129
|
+
const out = Buffer.alloc((rowBytes + 1) * height);
|
|
130
|
+
for (let y = 0; y < height; y += 1) {
|
|
131
|
+
const src = pixelOffset + (bottomUp ? height - 1 - y : y) * stride;
|
|
132
|
+
let dst = y * (rowBytes + 1);
|
|
133
|
+
out[dst++] = 0;
|
|
134
|
+
if (bpp === 24) {
|
|
135
|
+
for (let x = 0; x < width; x += 1) {
|
|
136
|
+
const p = src + x * 3;
|
|
137
|
+
out[dst++] = bmp[p + 2];
|
|
138
|
+
out[dst++] = bmp[p + 1];
|
|
139
|
+
out[dst++] = bmp[p];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
for (let x = 0; x < width; x += 1) {
|
|
144
|
+
const px = bmp.readUInt32LE(src + x * 4);
|
|
145
|
+
out[dst++] = scale(px, red);
|
|
146
|
+
out[dst++] = scale(px, green);
|
|
147
|
+
out[dst++] = scale(px, blue);
|
|
148
|
+
if (useAlpha)
|
|
149
|
+
out[dst++] = scale(px, alpha);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return encodePng(width, height, channels, out);
|
|
154
|
+
}
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
* connects — an installed tool whose session is unreachable (stale
|
|
14
14
|
* WAYLAND_DISPLAY/DISPLAY) falls through to the next candidate.
|
|
15
15
|
* `text/uri-list` offers become file paths, `image/*` offers are
|
|
16
|
-
* exported to a temp file whose path is inserted.
|
|
16
|
+
* exported to a temp file whose path is inserted. A Windows bitmap copy
|
|
17
|
+
* offered as `image/bmp` (WSLg) is converted to PNG first.
|
|
18
|
+
* - **WSL**: when the Linux tools find nothing usable, `powershell.exe`
|
|
19
|
+
* reads the Windows clipboard (Explorer files → `wslpath`, bitmaps → PNG
|
|
20
|
+
* over stdout, else text).
|
|
17
21
|
*
|
|
18
22
|
* Priority is always files → image → text (a screenshot copy offers only an
|
|
19
23
|
* image; a file-manager copy offers a file list; everything else falls
|
|
@@ -53,10 +57,12 @@ export type ClipboardContent = {
|
|
|
53
57
|
* `null` when the clipboard holds nothing usable (empty or read failure),
|
|
54
58
|
* or `{ kind: 'unavailable' }` when no clipboard backend can be reached at
|
|
55
59
|
* all (Linux/Unix without wl-paste/xclip/xsel, or none of the installed
|
|
56
|
-
* ones connecting to a live session).
|
|
60
|
+
* ones connecting to a live session). `wsl` marks the WSL flavour, where
|
|
61
|
+
* the Windows-side PowerShell fallback was also unreachable.
|
|
57
62
|
*/
|
|
58
63
|
export type ClipboardRead = ClipboardContent | {
|
|
59
64
|
kind: 'unavailable';
|
|
65
|
+
wsl?: boolean;
|
|
60
66
|
} | null;
|
|
61
67
|
/**
|
|
62
68
|
* Parse `text/uri-list` clipboard content into local file paths. Lines are
|
|
@@ -110,6 +116,12 @@ export declare function readClipboard(): Promise<ClipboardRead>;
|
|
|
110
116
|
* @internal test-only
|
|
111
117
|
*/
|
|
112
118
|
export declare function _resetLinuxPasteCache(): void;
|
|
119
|
+
/**
|
|
120
|
+
* Force the WSL detection result (undefined restores real detection). Kept
|
|
121
|
+
* apart from {@link _resetLinuxPasteCache} so a cache reset never drops it.
|
|
122
|
+
* @internal test-only
|
|
123
|
+
*/
|
|
124
|
+
export declare function _setWslOverride(value: boolean | undefined): void;
|
|
113
125
|
/**
|
|
114
126
|
* Render pasted clipboard content for insertion into the prompt. Image files
|
|
115
127
|
* become `@` references so the send pipeline can attach their bytes; ordinary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAeH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAElC;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAAA;AAE5F;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA6BtD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAIvE;AAWD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAYtE;AAiDD;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAS9C;AAoeD;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,CAStD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAEhE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAcvE"}
|