@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
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-agent conversation migration: MigrationSession → official DSH events.
|
|
3
|
+
*
|
|
4
|
+
* The sessionize step owns NO storage decisions. It drives the official
|
|
5
|
+
* `Session` logical-event API (`Session.create` + `append`), so envelope
|
|
6
|
+
* fields (seq/time/id), surface contract and format version come from the
|
|
7
|
+
* upstream implementation — the part the first iteration of this feature got
|
|
8
|
+
* wrong by hand-crafting physical log rows. Physical encoding, project
|
|
9
|
+
* layout, zstd and atomic writes belong to JsonlSessionPersistence (see
|
|
10
|
+
* index.ts), exactly as scripts/migrate-sessions-to-jsonl.mts does for the
|
|
11
|
+
* retired sqlite store.
|
|
12
|
+
*
|
|
13
|
+
* Turn shape follows the live loop: `turn/start`, then one step per
|
|
14
|
+
* {@link ImportStep} with the turn's prompt as the first step's user message,
|
|
15
|
+
* then `turn/end`. A turn with no prompt (source lost its head) carries no
|
|
16
|
+
* user message; a turn with no step is a legal step-less turn whose prompt
|
|
17
|
+
* sits directly inside the turn.
|
|
18
|
+
*
|
|
19
|
+
* Inside a step, events follow the live loop too: the step's user inputs
|
|
20
|
+
* (mid-turn context), the assistant message whose content carries the
|
|
21
|
+
* tool-call blocks, one `tool/call` per call, then one `tool/result` per
|
|
22
|
+
* call citing its call event. Parsing already closed every call
|
|
23
|
+
* (closeToolPairs), so no step leaves a call unanswered — the invariant the
|
|
24
|
+
* wire needs on resume: every tool call is followed by its tool message
|
|
25
|
+
* before any later assistant message.
|
|
26
|
+
*
|
|
27
|
+
* System head: the live loop reserves surface node 0 for the system prompt
|
|
28
|
+
* (an empty `system/message` in the first step, before any user message).
|
|
29
|
+
* An imported log gets the same empty head: it projects to no message, so
|
|
30
|
+
* re-reading is unchanged, and when the session is resumed the loop REPLACES
|
|
31
|
+
* it with the rendered prompt. Without it the loop appends its prompt after
|
|
32
|
+
* the imported history, where adapters that only lift a LEADING system
|
|
33
|
+
* message (pi-ai) send it as one more user message.
|
|
34
|
+
*
|
|
35
|
+
* Compaction: a turn carrying {@link ImportTurn.compaction} is preceded by
|
|
36
|
+
* one native compaction transaction — `compaction/start` (standalone,
|
|
37
|
+
* `turn: null`), `compaction/summary`, the checkpoint `user/message` that
|
|
38
|
+
* REPLACES every surface node after the head, `compaction/end` — the same
|
|
39
|
+
* shape `/compact` writes. The raw log keeps the shadowed events (replay
|
|
40
|
+
* stays exact) while the model sees the checkpoint plus what follows, which
|
|
41
|
+
* is the context the source agent itself continued with. The upstream
|
|
42
|
+
* compaction package is not a dependency here, so its event and source
|
|
43
|
+
* shapes are written structurally (see compactionEvents below).
|
|
44
|
+
*
|
|
45
|
+
* Title: only a title the SOURCE owns (`titleExplicit`) is written, as one
|
|
46
|
+
* trailing `session/title` — a first-prompt fallback is left out so DSH
|
|
47
|
+
* derives it from the first user message exactly as for a native session.
|
|
48
|
+
*
|
|
49
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/sessionize
|
|
50
|
+
*/
|
|
51
|
+
import { ToolCallId, createAssistantMessage, createSystemMessage, createToolResultMessage, createUserMessage, } from '@deepseek-ai/dsh-llm';
|
|
52
|
+
import { SESSION_FORMAT_VERSION, Session, } from '@deepseek-ai/dsh-session';
|
|
53
|
+
import { userTitleData } from '../compat/sessionLog.js';
|
|
54
|
+
import { normalizeTitle } from './parse/title.js';
|
|
55
|
+
/** Rough token estimate for shadowed text (the compaction metering field). */
|
|
56
|
+
function estimateTokens(chars) {
|
|
57
|
+
return Math.ceil(chars / 4);
|
|
58
|
+
}
|
|
59
|
+
/** Blocks for one migrated step, in source order (reasoning before the text
|
|
60
|
+
* it explains, tool calls where the model made them). A step with no
|
|
61
|
+
* content keeps one empty text block so the assistant message stays
|
|
62
|
+
* well-formed. */
|
|
63
|
+
function assistantBlocks(step) {
|
|
64
|
+
const blocks = step.blocks.map(block => block.type === 'tool-call'
|
|
65
|
+
? { type: 'tool-call', id: ToolCallId(block.id), name: block.name, arguments: block.arguments }
|
|
66
|
+
: { type: block.type, text: block.text });
|
|
67
|
+
if (blocks.length === 0)
|
|
68
|
+
blocks.push({ type: 'text', text: '' });
|
|
69
|
+
return blocks;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The empty system head an imported log opens with, in whichever shape the
|
|
73
|
+
* installed harness writes. `createSystemMessage` changed arity between the
|
|
74
|
+
* validated lines: 0.1.5-alpha.2 takes the owning plugin and stamps a plugin
|
|
75
|
+
* source, later lines take the text alone and stamp `system-prompt`. Calling
|
|
76
|
+
* it with both arguments lets each line build its own native head (the later
|
|
77
|
+
* one ignores the extra argument) instead of this module hard-coding either.
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* The checkpoint framing the native compaction engine writes around a summary
|
|
81
|
+
* (dsh-compaction-basic `frameSummary`): a preamble, then the summary inside
|
|
82
|
+
* `<compacted-summary>` tags. The tags are how a LATER compaction recognises
|
|
83
|
+
* this node as a prior checkpoint and merges it instead of summarising the
|
|
84
|
+
* summary, so an imported checkpoint has to carry them exactly. The package
|
|
85
|
+
* does not export the constants; verify-migrate pins these against the
|
|
86
|
+
* installed engine's own source so a drift fails the regression.
|
|
87
|
+
*/
|
|
88
|
+
export const CHECKPOINT_PREAMBLE = 'This is an automatically generated checkpoint condensing an earlier span of the conversation to free up context. Treat the captured context as established background and build on it without restating it. Continue the task directly from the messages that follow, without acknowledging this checkpoint.';
|
|
89
|
+
export const SUMMARY_OPEN_TAG = '<compacted-summary>';
|
|
90
|
+
export const SUMMARY_CLOSE_TAG = '</compacted-summary>';
|
|
91
|
+
function frameCheckpoint(summary) {
|
|
92
|
+
return [
|
|
93
|
+
{ type: 'text', text: `${CHECKPOINT_PREAMBLE}\n\n${SUMMARY_OPEN_TAG}` },
|
|
94
|
+
{ type: 'text', text: summary },
|
|
95
|
+
{ type: 'text', text: SUMMARY_CLOSE_TAG },
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
function emptySystemHead() {
|
|
99
|
+
const create = createSystemMessage;
|
|
100
|
+
return create('', 'dsh-tui-migrate');
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Build one official DSH session log from a normalized foreign conversation.
|
|
104
|
+
*
|
|
105
|
+
* @param id - deterministic session id (see uuid.ts); the id IS the dedupe.
|
|
106
|
+
* @param agentId - source adapter id, stamped into assistant provenance as
|
|
107
|
+
* `migrated:<agentId>` so the transcript can name where text came from.
|
|
108
|
+
* @param session - the normalized foreign conversation.
|
|
109
|
+
* @returns the official header plus the full event log, exactly as the
|
|
110
|
+
* persistence backend expects them.
|
|
111
|
+
*/
|
|
112
|
+
export function sessionize(id, agentId, session) {
|
|
113
|
+
const header = {
|
|
114
|
+
version: SESSION_FORMAT_VERSION,
|
|
115
|
+
id,
|
|
116
|
+
createdAt: session.startedAt,
|
|
117
|
+
cwd: session.cwd,
|
|
118
|
+
isSeeded: false,
|
|
119
|
+
};
|
|
120
|
+
const model = Session.create(id, undefined, header);
|
|
121
|
+
// Collect each append()'s RETURN (a fully enveloped event) instead of the
|
|
122
|
+
// deprecated snapshotEvents() bulk read — upstream forbids NEW callers of
|
|
123
|
+
// the latter, and append already returns seq/time-stamped events.
|
|
124
|
+
const events = [];
|
|
125
|
+
let headWritten = false;
|
|
126
|
+
const writeHead = (turn, step) => {
|
|
127
|
+
events.push(model.append('system/message', { turn, step, message: emptySystemHead() }, { surfaceOp: 'append' }));
|
|
128
|
+
headWritten = true;
|
|
129
|
+
};
|
|
130
|
+
const writePrompt = (prompt) => {
|
|
131
|
+
if (prompt === '')
|
|
132
|
+
return;
|
|
133
|
+
surfaceChars += prompt.length;
|
|
134
|
+
events.push(model.append('user/message', createUserMessage({
|
|
135
|
+
content: [{ type: 'text', text: prompt }],
|
|
136
|
+
source: { kind: 'user' },
|
|
137
|
+
}), { surfaceOp: 'append' }));
|
|
138
|
+
};
|
|
139
|
+
const writeTools = (turn, step, imported) => {
|
|
140
|
+
const callSeqs = new Map();
|
|
141
|
+
for (const block of imported.blocks) {
|
|
142
|
+
if (block.type !== 'tool-call')
|
|
143
|
+
continue;
|
|
144
|
+
const call = model.append('tool/call', { turn, step, callId: ToolCallId(block.id), name: block.name, arguments: block.arguments });
|
|
145
|
+
events.push(call);
|
|
146
|
+
callSeqs.set(block.id, call.seq);
|
|
147
|
+
}
|
|
148
|
+
for (const result of imported.results) {
|
|
149
|
+
const callSeq = callSeqs.get(result.callId);
|
|
150
|
+
if (callSeq === undefined)
|
|
151
|
+
continue;
|
|
152
|
+
events.push(model.append('tool/result', {
|
|
153
|
+
turn,
|
|
154
|
+
step,
|
|
155
|
+
message: createToolResultMessage({
|
|
156
|
+
callId: ToolCallId(result.callId),
|
|
157
|
+
content: result.text === '' ? [] : [{ type: 'text', text: result.text }],
|
|
158
|
+
isError: result.isError,
|
|
159
|
+
}),
|
|
160
|
+
}, { surfaceOp: 'append', sourceEventSeqs: [callSeq] }));
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
let compactions = 0;
|
|
164
|
+
// Text volume on the surface since the last checkpoint, for the summary's
|
|
165
|
+
// shadowedTokenCount (an estimate, like the live engine's).
|
|
166
|
+
let surfaceChars = 0;
|
|
167
|
+
/** Fold every surface node after the head into one checkpoint; false when
|
|
168
|
+
* there is nothing to fold (the upstream contract needs a non-empty span). */
|
|
169
|
+
const writeCompaction = (summary, summaryModel) => {
|
|
170
|
+
const shadowed = model.surface.nodes.filter(seq => model.eventAt(seq)?.type !== 'system/message');
|
|
171
|
+
if (shadowed.length === 0)
|
|
172
|
+
return false;
|
|
173
|
+
compactions += 1;
|
|
174
|
+
const compactionId = `import:${id}:c${compactions}`;
|
|
175
|
+
const untyped = model;
|
|
176
|
+
const range = { start: shadowed[0], end: shadowed[shadowed.length - 1] };
|
|
177
|
+
events.push(untyped.append('compaction/start', { compactionId, turn: null }));
|
|
178
|
+
events.push(untyped.append('compaction/summary', {
|
|
179
|
+
compactionId,
|
|
180
|
+
summary: [{ type: 'text', text: summary }],
|
|
181
|
+
shadowedRange: range,
|
|
182
|
+
shadowedSeqs: shadowed,
|
|
183
|
+
shadowedTokenCount: estimateTokens(surfaceChars),
|
|
184
|
+
provider: `migrated:${agentId}`,
|
|
185
|
+
model: summaryModel ?? agentId,
|
|
186
|
+
}));
|
|
187
|
+
events.push(untyped.append('user/message', createUserMessage({
|
|
188
|
+
content: frameCheckpoint(summary),
|
|
189
|
+
// The compaction package's checkpoint marker (COMPACT_CHECKPOINT_MARKER).
|
|
190
|
+
source: { kind: 'compact-checkpoint', compactionId },
|
|
191
|
+
}), { surfaceOp: { op: 'replace', startSeq: range.start, endSeq: range.end }, sourceEventSeqs: shadowed }));
|
|
192
|
+
events.push(untyped.append('compaction/end', { compactionId, turn: null }));
|
|
193
|
+
surfaceChars = summary.length;
|
|
194
|
+
return true;
|
|
195
|
+
};
|
|
196
|
+
let turnIndex = 0;
|
|
197
|
+
for (const turn of session.turns) {
|
|
198
|
+
// A summary with nothing before it to fold still reaches the model: it
|
|
199
|
+
// opens the turn as a plain user message instead.
|
|
200
|
+
let preface = '';
|
|
201
|
+
if (turn.compaction !== undefined && turn.compaction.summary !== '') {
|
|
202
|
+
if (!writeCompaction(turn.compaction.summary, turn.compaction.model))
|
|
203
|
+
preface = turn.compaction.summary;
|
|
204
|
+
// A boundary with no prompt and no step (the source stopped right at
|
|
205
|
+
// the compaction) needs no turn of its own.
|
|
206
|
+
if (turn.prompt === '' && turn.steps.length === 0 && preface === '')
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
turnIndex += 1;
|
|
210
|
+
events.push(model.append('turn/start', { turn: turnIndex }));
|
|
211
|
+
if (turn.steps.length === 0) {
|
|
212
|
+
if (headWritten) {
|
|
213
|
+
writePrompt(preface);
|
|
214
|
+
writePrompt(turn.prompt);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
// The head needs an open step; a step-less first turn gets one that
|
|
218
|
+
// carries only the head and the prompt (no model call).
|
|
219
|
+
events.push(model.append('step/start', { turn: turnIndex, step: 1 }));
|
|
220
|
+
writeHead(turnIndex, 1);
|
|
221
|
+
writePrompt(preface);
|
|
222
|
+
writePrompt(turn.prompt);
|
|
223
|
+
events.push(model.append('step/end', { turn: turnIndex, step: 1 }));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
let step = 0;
|
|
227
|
+
for (const imported of turn.steps) {
|
|
228
|
+
step += 1;
|
|
229
|
+
events.push(model.append('step/start', { turn: turnIndex, step }));
|
|
230
|
+
if (!headWritten)
|
|
231
|
+
writeHead(turnIndex, step);
|
|
232
|
+
if (step === 1) {
|
|
233
|
+
writePrompt(preface);
|
|
234
|
+
writePrompt(turn.prompt);
|
|
235
|
+
}
|
|
236
|
+
for (const input of imported.inputs)
|
|
237
|
+
writePrompt(input);
|
|
238
|
+
for (const block of imported.blocks)
|
|
239
|
+
surfaceChars += block.type === 'tool-call' ? block.arguments.length : block.text.length;
|
|
240
|
+
for (const result of imported.results)
|
|
241
|
+
surfaceChars += result.text.length;
|
|
242
|
+
events.push(model.append('assistant/message', {
|
|
243
|
+
turn: turnIndex,
|
|
244
|
+
step,
|
|
245
|
+
message: createAssistantMessage({
|
|
246
|
+
content: assistantBlocks(imported),
|
|
247
|
+
// createAssistantMessage stamps `kind: 'model'` itself; the
|
|
248
|
+
// caller-visible provenance is provider + model only.
|
|
249
|
+
source: {
|
|
250
|
+
provider: `migrated:${agentId}`,
|
|
251
|
+
model: imported.model ?? agentId,
|
|
252
|
+
},
|
|
253
|
+
}),
|
|
254
|
+
stream: [],
|
|
255
|
+
}, { surfaceOp: 'append' }));
|
|
256
|
+
writeTools(turnIndex, step, imported);
|
|
257
|
+
events.push(model.append('step/end', { turn: turnIndex, step }));
|
|
258
|
+
}
|
|
259
|
+
// A source-recorded interruption keeps its meaning. Sources record it
|
|
260
|
+
// coarsely (no user/hook/dispose distinction), which is exactly what the
|
|
261
|
+
// `legacy` cancel cause exists for.
|
|
262
|
+
events.push(model.append('turn/end', {
|
|
263
|
+
turn: turnIndex,
|
|
264
|
+
reason: turn.aborted === true ? { kind: 'aborted', reason: { kind: 'legacy' } } : { kind: 'completed' },
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
const title = session.titleExplicit ? normalizeTitle(session.title) : '';
|
|
268
|
+
if (title !== '')
|
|
269
|
+
events.push(model.append('session/title', userTitleData(title)));
|
|
270
|
+
return { header: model.header, events };
|
|
271
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-agent conversation migration: shared types.
|
|
3
|
+
*
|
|
4
|
+
* An adapter turns one foreign agent's stored conversation into the neutral
|
|
5
|
+
* {@link MigrationSession} shape; the sessionizer (see sessionize.ts) then
|
|
6
|
+
* emits DSH session events. Adapters are read-only against their source and
|
|
7
|
+
* defensive by default: a malformed line costs that line, never the scan.
|
|
8
|
+
*
|
|
9
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/types
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* One message of a foreign conversation as a flat role list — the shape the
|
|
13
|
+
* omp adapter still produces; {@link fromRoleTurns} in parse/role-turns.ts
|
|
14
|
+
* folds it into {@link ImportTurn}s.
|
|
15
|
+
*/
|
|
16
|
+
export interface MigrationTurn {
|
|
17
|
+
readonly role: 'user' | 'assistant';
|
|
18
|
+
readonly text: string;
|
|
19
|
+
/** Assistant reasoning trace, when the source recorded one. */
|
|
20
|
+
readonly reasoning?: string;
|
|
21
|
+
/** Source-recorded model id for an assistant turn, when available. */
|
|
22
|
+
readonly model?: string;
|
|
23
|
+
/** Epoch milliseconds when the source recorded the turn. */
|
|
24
|
+
readonly time: number;
|
|
25
|
+
}
|
|
26
|
+
/** One assistant content block of an imported step. */
|
|
27
|
+
export type ImportBlock = {
|
|
28
|
+
readonly type: 'text';
|
|
29
|
+
readonly text: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly type: 'reasoning';
|
|
32
|
+
readonly text: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly type: 'tool-call';
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly arguments: string;
|
|
38
|
+
};
|
|
39
|
+
/** The model-facing result of one tool call, paired by call id. */
|
|
40
|
+
export interface ImportToolResult {
|
|
41
|
+
readonly callId: string;
|
|
42
|
+
/** Result text; images are replaced by a placeholder, oversize text is clamped. */
|
|
43
|
+
readonly text: string;
|
|
44
|
+
readonly isError: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** One model call and the tool executions it requested. */
|
|
47
|
+
export interface ImportStep {
|
|
48
|
+
/** User-role messages entering this step before the model answers (mid-turn
|
|
49
|
+
* context such as skill bodies or image notes — never the turn's prompt). */
|
|
50
|
+
inputs: string[];
|
|
51
|
+
blocks: ImportBlock[];
|
|
52
|
+
/** Results for this step's tool-call blocks; after closeToolPairs() exactly
|
|
53
|
+
* one per call, in call order. */
|
|
54
|
+
results: ImportToolResult[];
|
|
55
|
+
/** Source-recorded model id for this step, when available. */
|
|
56
|
+
model?: string;
|
|
57
|
+
}
|
|
58
|
+
/** A context-compaction boundary the source recorded before a turn. */
|
|
59
|
+
export interface ImportCompaction {
|
|
60
|
+
readonly summary: string;
|
|
61
|
+
readonly model?: string;
|
|
62
|
+
}
|
|
63
|
+
/** One imported turn: a human prompt and the steps that answered it. */
|
|
64
|
+
export interface ImportTurn {
|
|
65
|
+
/** The human prompt; '' when the turn has none (source lost its head, or
|
|
66
|
+
* the turn only carries a compaction checkpoint). */
|
|
67
|
+
prompt: string;
|
|
68
|
+
/** A compaction checkpoint emitted BEFORE this turn opens. */
|
|
69
|
+
compaction?: ImportCompaction;
|
|
70
|
+
steps: ImportStep[];
|
|
71
|
+
/** The source recorded this turn as interrupted. */
|
|
72
|
+
aborted?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** Per-conversation counters for what parsing had to leave out. */
|
|
75
|
+
export interface ImportStats {
|
|
76
|
+
/** Lines that were not valid JSON. */
|
|
77
|
+
badLines: number;
|
|
78
|
+
/** Tool results with no matching call, or a second result for one call. */
|
|
79
|
+
droppedToolResults: number;
|
|
80
|
+
/** Rows left out: harness injection in the user role, local-command
|
|
81
|
+
* echoes, provider-side tool rows with no harness counterpart. */
|
|
82
|
+
filtered: number;
|
|
83
|
+
/** Mid-turn machine context folded into a step's inputs (Claude isMeta, …). */
|
|
84
|
+
meta: number;
|
|
85
|
+
}
|
|
86
|
+
/** A discovered foreign conversation, ready for conversion. */
|
|
87
|
+
export interface MigrationSession {
|
|
88
|
+
/** Stable id in the SOURCE store (file uuid, rollout id, …). */
|
|
89
|
+
readonly sourceId: string;
|
|
90
|
+
/** Source working directory, when recorded; falls back to the scan root. */
|
|
91
|
+
readonly cwd: string;
|
|
92
|
+
/** Conversation title, when the source has one (possibly a first-prompt fallback). */
|
|
93
|
+
readonly title?: string;
|
|
94
|
+
/** Whether {@link title} is the source's own title (written to the log as
|
|
95
|
+
* `session/title`) rather than a first-prompt fallback (left for DSH to derive). */
|
|
96
|
+
readonly titleExplicit: boolean;
|
|
97
|
+
readonly startedAt: number;
|
|
98
|
+
readonly turns: readonly ImportTurn[];
|
|
99
|
+
readonly stats: ImportStats;
|
|
100
|
+
}
|
|
101
|
+
/** What one adapter found on disk. */
|
|
102
|
+
export interface MigrationDiscovery {
|
|
103
|
+
/** Absolute roots that were scanned (reported to the user). */
|
|
104
|
+
readonly roots: readonly string[];
|
|
105
|
+
readonly sessions: readonly MigrationSession[];
|
|
106
|
+
}
|
|
107
|
+
/** Change token of one source artifact: unchanged means reuse its summary. */
|
|
108
|
+
export interface Fingerprint {
|
|
109
|
+
readonly mtimeMs: number;
|
|
110
|
+
readonly size: number;
|
|
111
|
+
}
|
|
112
|
+
/** A foreign conversation as listed, derived from the head (and tail) of
|
|
113
|
+
* its artifact and stat alone — never from a full parse. */
|
|
114
|
+
export interface ForeignSessionSummary {
|
|
115
|
+
readonly agentId: string;
|
|
116
|
+
/** Stable source id; always equals the `sourceId` a full parse yields, so
|
|
117
|
+
* both import entries land on the same deterministic session id. */
|
|
118
|
+
readonly sessionKey: string;
|
|
119
|
+
/** Opaque locator of the full content (file path / session directory). */
|
|
120
|
+
readonly ref: string;
|
|
121
|
+
/** Normalized title; possibly the first-prompt fallback. */
|
|
122
|
+
readonly title: string;
|
|
123
|
+
/** '' when unknown. */
|
|
124
|
+
readonly cwd: string;
|
|
125
|
+
/** Sort key: when the conversation last changed. */
|
|
126
|
+
readonly lastMessageAt: number;
|
|
127
|
+
readonly createdAt: number;
|
|
128
|
+
}
|
|
129
|
+
/** One scanned artifact: its summary, or null when it is not a conversation
|
|
130
|
+
* of its own (sub-agent log, no prompt) — negative results are cached too. */
|
|
131
|
+
export interface ScanEntry {
|
|
132
|
+
readonly ref: string;
|
|
133
|
+
readonly fp: Fingerprint;
|
|
134
|
+
readonly summary: ForeignSessionSummary | null;
|
|
135
|
+
}
|
|
136
|
+
export interface ScanOptions {
|
|
137
|
+
readonly signal?: AbortSignal;
|
|
138
|
+
/** A previous result for an unchanged artifact: a summary, null (known not
|
|
139
|
+
* to be a conversation), or undefined (unknown — read it). */
|
|
140
|
+
cached?(ref: string, fp: Fingerprint): ForeignSessionSummary | null | undefined;
|
|
141
|
+
/** Called per conversation as the scan finds it. */
|
|
142
|
+
onEntry?(summary: ForeignSessionSummary): void;
|
|
143
|
+
}
|
|
144
|
+
/** Where a source's artifacts sit under its roots, by name alone. */
|
|
145
|
+
export interface WalkSpec {
|
|
146
|
+
readonly maxDepth: number;
|
|
147
|
+
readonly match: (name: string) => boolean;
|
|
148
|
+
/** Directory names never descended into. */
|
|
149
|
+
readonly skipDirs?: readonly string[];
|
|
150
|
+
}
|
|
151
|
+
/** Why a full load produced no session. */
|
|
152
|
+
export interface LoadSkip {
|
|
153
|
+
readonly skip: 'missing' | 'too-large' | 'not-a-session';
|
|
154
|
+
}
|
|
155
|
+
/** A migration adapter for one foreign agent. */
|
|
156
|
+
export interface MigrationAdapter {
|
|
157
|
+
readonly id: string;
|
|
158
|
+
readonly label: string;
|
|
159
|
+
/** Absolute source roots this adapter would scan on this machine. */
|
|
160
|
+
roots(): readonly string[];
|
|
161
|
+
/** Scan the roots and normalize every readable conversation. */
|
|
162
|
+
discover(): MigrationDiscovery;
|
|
163
|
+
/** Cheap per-root file count for list mode (no parsing). Implementations
|
|
164
|
+
* that cannot count by name alone may omit this and fall back to
|
|
165
|
+
* discover() — the count then equals the parsed session total. */
|
|
166
|
+
count?(): number;
|
|
167
|
+
/** The name-only walk scan() follows; lets a caller count candidates and
|
|
168
|
+
* find the newest activity without parsing. Present with scan(). */
|
|
169
|
+
readonly walk?: WalkSpec;
|
|
170
|
+
/** Asynchronous, abortable summary scan for browsing (head/tail reads,
|
|
171
|
+
* fingerprint reuse). Sources without it are not browsable. */
|
|
172
|
+
scan?(options?: ScanOptions): Promise<readonly ScanEntry[]>;
|
|
173
|
+
/** Full parse of one conversation found by scan(). */
|
|
174
|
+
load?(ref: string): Promise<MigrationSession | LoadSkip>;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/migrate/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,uDAAuD;AACvD,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1G,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAED,2DAA2D;AAC3D,MAAM,WAAW,UAAU;IACzB;kFAC8E;IAC9E,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB;uCACmC;IACnC,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,uEAAuE;AACvE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wEAAwE;AACxE,MAAM,WAAW,UAAU;IACzB;0DACsD;IACtD,MAAM,EAAE,MAAM,CAAA;IACd,8DAA8D;IAC9D,UAAU,CAAC,EAAE,gBAAgB,CAAA;IAC7B,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,mEAAmE;AACnE,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,2EAA2E;IAC3E,kBAAkB,EAAE,MAAM,CAAA;IAC1B;uEACmE;IACnE,QAAQ,EAAE,MAAM,CAAA;IAChB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAA;CACb;AAED,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,4EAA4E;IAC5E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,sFAAsF;IACtF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB;yFACqF;IACrF,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAA;IACrC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAC5B;AAED,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAA;CAC/C;AAED,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED;6DAC6D;AAC7D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB;yEACqE;IACrE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,uBAAuB;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,oDAAoD;IACpD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED;+EAC+E;AAC/E,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAA;CAC/C;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;IAC7B;mEAC+D;IAC/D,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,qBAAqB,GAAG,IAAI,GAAG,SAAS,CAAA;IAC/E,oDAAoD;IACpD,OAAO,CAAC,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAA;CAC/C;AAED,qEAAqE;AACrE,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IACzC,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACtC;AAED,2CAA2C;AAC3C,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,eAAe,CAAA;CACzD;AAED,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,qEAAqE;IACrE,KAAK,IAAI,SAAS,MAAM,EAAE,CAAA;IAC1B,gEAAgE;IAChE,QAAQ,IAAI,kBAAkB,CAAA;IAC9B;;uEAEmE;IACnE,KAAK,CAAC,IAAI,MAAM,CAAA;IAChB;yEACqE;IACrE,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAA;IACxB;oEACgE;IAChE,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAAA;IAC3D,sDAAsD;IACtD,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,QAAQ,CAAC,CAAA;CACzD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-agent conversation migration: shared types.
|
|
3
|
+
*
|
|
4
|
+
* An adapter turns one foreign agent's stored conversation into the neutral
|
|
5
|
+
* {@link MigrationSession} shape; the sessionizer (see sessionize.ts) then
|
|
6
|
+
* emits DSH session events. Adapters are read-only against their source and
|
|
7
|
+
* defensive by default: a malformed line costs that line, never the scan.
|
|
8
|
+
*
|
|
9
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/types
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC 4122 UUIDv5 over the migration namespace.
|
|
3
|
+
* @param name - The distinguishing name (e.g. `claude-code:<file uuid>`).
|
|
4
|
+
* @returns Dashed lowercase uuid v5.
|
|
5
|
+
*/
|
|
6
|
+
export declare function migrationUuid(name: string): string;
|
|
7
|
+
//# sourceMappingURL=uuid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/migrate/uuid.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic UUIDv5 for migration ids.
|
|
3
|
+
*
|
|
4
|
+
* Re-importing the same source conversation must land on the SAME DSH
|
|
5
|
+
* session id, so repeats overwrite their own copy instead of stacking
|
|
6
|
+
* duplicates — the id IS the dedupe. Inline SHA-1 RFC 4122 variant (no
|
|
7
|
+
* runtime dependency; node:crypto does the hashing).
|
|
8
|
+
*
|
|
9
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/uuid
|
|
10
|
+
*/
|
|
11
|
+
import { createHash } from 'node:crypto';
|
|
12
|
+
/** This project's migration namespace: dsh-tui-migrate as 16 fixed bytes. */
|
|
13
|
+
const NAMESPACE = Buffer.from([0x9f, 0x1d, 0x3a, 0x72, 0x6c, 0x55, 0x4c, 0x8e, 0xb0, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74]);
|
|
14
|
+
/**
|
|
15
|
+
* RFC 4122 UUIDv5 over the migration namespace.
|
|
16
|
+
* @param name - The distinguishing name (e.g. `claude-code:<file uuid>`).
|
|
17
|
+
* @returns Dashed lowercase uuid v5.
|
|
18
|
+
*/
|
|
19
|
+
export function migrationUuid(name) {
|
|
20
|
+
const hash = createHash('sha1').update(NAMESPACE).update(name, 'utf8').digest();
|
|
21
|
+
hash[6] = (hash[6] & 0x0f) | 0x50;
|
|
22
|
+
hash[8] = (hash[8] & 0x3f) | 0x80;
|
|
23
|
+
const hex = hash.subarray(0, 16).toString('hex');
|
|
24
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
|
|
25
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DeepSeekAccount, AccountBonusOrderId, AccountUserId } from '@deepseek-ai/dsh-deepseek-account';
|
|
2
|
+
export interface WhaleCouponNotice {
|
|
3
|
+
readonly accountId: AccountUserId;
|
|
4
|
+
readonly orderId: AccountBonusOrderId;
|
|
5
|
+
readonly amount: string;
|
|
6
|
+
readonly currency: 'CNY' | 'USD';
|
|
7
|
+
readonly expiresAt: string;
|
|
8
|
+
}
|
|
9
|
+
type BonusAccount = Pick<DeepSeekAccount, 'getUnnotifiedBonuses' | 'ackBonusNotified'>;
|
|
10
|
+
/** TUI-only presentation of a Platform-confirmed login grant. */
|
|
11
|
+
export declare class WhaleCouponStore {
|
|
12
|
+
private readonly listeners;
|
|
13
|
+
private readonly seen;
|
|
14
|
+
private notice;
|
|
15
|
+
private account;
|
|
16
|
+
private generation;
|
|
17
|
+
readonly subscribe: (listener: () => void) => (() => void);
|
|
18
|
+
readonly getSnapshot: () => WhaleCouponNotice | null;
|
|
19
|
+
refresh(account: BonusAccount): Promise<void>;
|
|
20
|
+
/** Called only after the modal has painted; a read alone never acknowledges. */
|
|
21
|
+
shown(orderId: AccountBonusOrderId): void;
|
|
22
|
+
dismiss(orderId: AccountBonusOrderId): void;
|
|
23
|
+
clear(): void;
|
|
24
|
+
private emit;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=bonus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bonus.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/oauth/bonus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAG5G,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,CAAA;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED,KAAK,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,sBAAsB,GAAG,kBAAkB,CAAC,CAAA;AAEtF,iEAAiE;AACjE,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAClD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,UAAU,CAAI;IAEtB,QAAQ,CAAC,SAAS,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CAGxD;IAED,QAAQ,CAAC,WAAW,QAAO,iBAAiB,GAAG,IAAI,CAAe;IAE5D,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBnD,gFAAgF;IAChF,KAAK,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI;IASzC,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI;IAS3C,KAAK,IAAI,IAAI;IAQb,OAAO,CAAC,IAAI;CACb"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { deepSeekClientMetadata } from './deepseek.js';
|
|
2
|
+
/** TUI-only presentation of a Platform-confirmed login grant. */
|
|
3
|
+
export class WhaleCouponStore {
|
|
4
|
+
listeners = new Set();
|
|
5
|
+
seen = new Set();
|
|
6
|
+
notice = null;
|
|
7
|
+
account;
|
|
8
|
+
generation = 0;
|
|
9
|
+
subscribe = (listener) => {
|
|
10
|
+
this.listeners.add(listener);
|
|
11
|
+
return () => { this.listeners.delete(listener); };
|
|
12
|
+
};
|
|
13
|
+
getSnapshot = () => this.notice;
|
|
14
|
+
async refresh(account) {
|
|
15
|
+
const generation = ++this.generation;
|
|
16
|
+
if (this.listeners.size === 0)
|
|
17
|
+
return;
|
|
18
|
+
let batch;
|
|
19
|
+
try {
|
|
20
|
+
batch = await account.getUnnotifiedBonuses(deepSeekClientMetadata());
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (generation !== this.generation || batch === null)
|
|
26
|
+
return;
|
|
27
|
+
const granted = batch.bonuses.find(bonus => bonus.campaign === 'dsh_login_bonus'
|
|
28
|
+
&& !this.seen.has(`${batch.accountId}:${bonus.orderId}`)
|
|
29
|
+
&& (Number.isNaN(Date.parse(bonus.expiresAt)) || Date.parse(bonus.expiresAt) > Date.now()));
|
|
30
|
+
if (granted === undefined)
|
|
31
|
+
return;
|
|
32
|
+
this.account = account;
|
|
33
|
+
this.notice = {
|
|
34
|
+
accountId: batch.accountId, orderId: granted.orderId,
|
|
35
|
+
amount: granted.amount, currency: granted.currency, expiresAt: granted.expiresAt,
|
|
36
|
+
};
|
|
37
|
+
this.emit();
|
|
38
|
+
}
|
|
39
|
+
/** Called only after the modal has painted; a read alone never acknowledges. */
|
|
40
|
+
shown(orderId) {
|
|
41
|
+
const notice = this.notice;
|
|
42
|
+
if (notice?.orderId !== orderId || this.account === undefined)
|
|
43
|
+
return;
|
|
44
|
+
const key = `${notice.accountId}:${notice.orderId}`;
|
|
45
|
+
if (this.seen.has(key))
|
|
46
|
+
return;
|
|
47
|
+
this.seen.add(key);
|
|
48
|
+
void this.account.ackBonusNotified(notice.accountId, orderId, deepSeekClientMetadata()).catch(() => false);
|
|
49
|
+
}
|
|
50
|
+
dismiss(orderId) {
|
|
51
|
+
if (this.notice?.orderId !== orderId)
|
|
52
|
+
return;
|
|
53
|
+
this.shown(orderId);
|
|
54
|
+
const account = this.account;
|
|
55
|
+
this.notice = null;
|
|
56
|
+
this.emit();
|
|
57
|
+
if (account !== undefined)
|
|
58
|
+
void this.refresh(account);
|
|
59
|
+
}
|
|
60
|
+
clear() {
|
|
61
|
+
this.generation++;
|
|
62
|
+
this.notice = null;
|
|
63
|
+
this.account = undefined;
|
|
64
|
+
this.seen.clear();
|
|
65
|
+
this.emit();
|
|
66
|
+
}
|
|
67
|
+
emit() { for (const listener of this.listeners)
|
|
68
|
+
listener(); }
|
|
69
|
+
}
|
package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/command.d.ts
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The `/auth` command: a textual veneer over the {@link DshAuthApi} — status
|
|
3
3
|
* listing, login (optionally picking the provider interactively), logout.
|
|
4
4
|
*
|
|
5
|
-
* @module dsh-
|
|
5
|
+
* @module @deepseek-harness-tui/dsh-tui/oauth/command
|
|
6
6
|
*/
|
|
7
7
|
import type { CommandInvocation, CommandResult } from '@deepseek-ai/dsh-commands';
|
|
8
8
|
import type { DshAuthApi } from './service.js';
|
|
@@ -12,3 +12,4 @@ import type { DshAuthApi } from './service.js';
|
|
|
12
12
|
* propagate for the host's own error surface.
|
|
13
13
|
*/
|
|
14
14
|
export declare function createAuthCommandHandler(api: DshAuthApi): (invocation: CommandInvocation) => Promise<CommandResult>;
|
|
15
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/oauth/command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACjF,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAA;AA0BnE;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC,UAAU,EAAE,iBAAiB,KAAK,OAAO,CAAC,aAAa,CAAC,CAiCnH"}
|
package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/command.js
RENAMED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
* The `/auth` command: a textual veneer over the {@link DshAuthApi} — status
|
|
3
3
|
* listing, login (optionally picking the provider interactively), logout.
|
|
4
4
|
*
|
|
5
|
-
* @module dsh-
|
|
5
|
+
* @module @deepseek-harness-tui/dsh-tui/oauth/command
|
|
6
6
|
*/
|
|
7
7
|
const USAGE = 'Usage: /auth [status] | /auth login [provider] | /auth logout <provider>';
|
|
8
8
|
function renderStatus(rows) {
|
|
9
9
|
const lines = rows.map(row => {
|
|
10
10
|
const state = row.signedIn
|
|
11
|
-
?
|
|
11
|
+
? row.expiresAt === undefined
|
|
12
|
+
? 'signed in'
|
|
13
|
+
: `signed in — token expires ${new Date(row.expiresAt).toISOString()}`
|
|
12
14
|
: row.expired
|
|
13
15
|
? 'signed in, token expired — /auth login to refresh'
|
|
14
16
|
: 'not signed in';
|
|
@@ -41,8 +43,9 @@ export function createAuthCommandHandler(api) {
|
|
|
41
43
|
const result = await api.login(target, invocation.signal);
|
|
42
44
|
return {
|
|
43
45
|
kind: 'success',
|
|
44
|
-
text: `Signed in to ${result.oauthLabel} (${result.provider})
|
|
45
|
-
+ `${new Date(result.expiresAt).toISOString()}.
|
|
46
|
+
text: `Signed in to ${result.oauthLabel} (${result.provider})`
|
|
47
|
+
+ `${result.expiresAt === undefined ? '' : `; token expires ${new Date(result.expiresAt).toISOString()}`}. `
|
|
48
|
+
+ 'Its models are selectable via /model.',
|
|
46
49
|
};
|
|
47
50
|
}
|
|
48
51
|
catch (error) {
|