@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,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zcode adapter: `~/.zcode/v2/sessions/<dir>/<taskId>.json`, one JSON object
|
|
3
|
+
* per conversation. Discovery lives here; the document is parsed by the pure
|
|
4
|
+
* zcode.parse.ts. A JSON document has no usable head, so the browse scan
|
|
5
|
+
* parses each changed file whole (they are small; unchanged ones are reused
|
|
6
|
+
* by fingerprint).
|
|
7
|
+
*
|
|
8
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/adapters/zcode
|
|
9
|
+
*/
|
|
10
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
11
|
+
import { homedir } from 'node:os';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { countEntries } from './scan.js';
|
|
14
|
+
import { fingerprintOf, loadText, runScan, walkFiles } from './scan-fs.js';
|
|
15
|
+
import { parseZcodeSession } from './zcode.parse.js';
|
|
16
|
+
const WALK = { maxDepth: 3, match: name => name.endsWith('.json') };
|
|
17
|
+
async function summarize({ ref, fp }) {
|
|
18
|
+
const raw = await loadText(ref);
|
|
19
|
+
const session = typeof raw === 'string' ? parseZcodeSession(raw) : undefined;
|
|
20
|
+
if (session === undefined)
|
|
21
|
+
return null;
|
|
22
|
+
return {
|
|
23
|
+
agentId: 'zcode',
|
|
24
|
+
sessionKey: session.sourceId,
|
|
25
|
+
ref,
|
|
26
|
+
title: session.title ?? '',
|
|
27
|
+
cwd: session.cwd,
|
|
28
|
+
lastMessageAt: fp.mtimeMs,
|
|
29
|
+
createdAt: session.startedAt || fp.mtimeMs,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function readOne(path) {
|
|
33
|
+
try {
|
|
34
|
+
return parseZcodeSession(readFileSync(path, 'utf8'));
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const zcodeAdapter = {
|
|
41
|
+
id: 'zcode',
|
|
42
|
+
label: 'zcode',
|
|
43
|
+
roots: () => [join(homedir(), '.zcode', 'v2', 'sessions')],
|
|
44
|
+
discover() {
|
|
45
|
+
const roots = this.roots();
|
|
46
|
+
const sessions = [];
|
|
47
|
+
const walk = (dir, depth) => {
|
|
48
|
+
if (depth > 3)
|
|
49
|
+
return;
|
|
50
|
+
let entries;
|
|
51
|
+
try {
|
|
52
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
for (const entry of entries) {
|
|
58
|
+
const path = join(dir, entry.name);
|
|
59
|
+
if (entry.isDirectory())
|
|
60
|
+
walk(path, depth + 1);
|
|
61
|
+
else if (entry.isFile() && entry.name.endsWith('.json')) {
|
|
62
|
+
try {
|
|
63
|
+
if (statSync(path).size > 64 * 1024 * 1024)
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const session = readOne(path);
|
|
70
|
+
if (session !== undefined)
|
|
71
|
+
sessions.push(session);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
for (const root of roots)
|
|
76
|
+
walk(root, 0);
|
|
77
|
+
return { roots, sessions };
|
|
78
|
+
},
|
|
79
|
+
count() {
|
|
80
|
+
return countEntries(this.roots(), { maxDepth: WALK.maxDepth, fileMatch: WALK.match });
|
|
81
|
+
},
|
|
82
|
+
walk: WALK,
|
|
83
|
+
async scan(options) {
|
|
84
|
+
const files = walkFiles(this.roots(), { ...WALK, signal: options?.signal });
|
|
85
|
+
return runScan(files, file => file.path, fingerprintOf, options, summarize);
|
|
86
|
+
},
|
|
87
|
+
async load(ref) {
|
|
88
|
+
const raw = await loadText(ref);
|
|
89
|
+
if (typeof raw !== 'string')
|
|
90
|
+
return raw;
|
|
91
|
+
return parseZcodeSession(raw) ?? { skip: 'not-a-session' };
|
|
92
|
+
},
|
|
93
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MigrationSession } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse one zcode session document.
|
|
4
|
+
* @returns The session, or undefined when the document is not a
|
|
5
|
+
* `{ meta, messages }` object with a task id and workspace, or holds no
|
|
6
|
+
* prompt.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseZcodeSession(raw: string): MigrationSession | undefined;
|
|
9
|
+
//# sourceMappingURL=zcode.parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zcode.parse.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/zcode.parse.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAc,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE/D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAwD3E"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zcode session parsing (pure): one `<taskId>.json` → one
|
|
3
|
+
* {@link MigrationSession}.
|
|
4
|
+
*
|
|
5
|
+
* One JSON object per conversation (`{ meta, messages }`) with plain-string
|
|
6
|
+
* contents and epoch-millisecond timestamps. Only the text roles are mapped:
|
|
7
|
+
* no sample of this store with tool traffic or reasoning has been available,
|
|
8
|
+
* so no such field is guessed at.
|
|
9
|
+
*
|
|
10
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/adapters/zcode.parse
|
|
11
|
+
*/
|
|
12
|
+
import { isInjectedText, unwrapUserText } from '../parse/injection.js';
|
|
13
|
+
import { isRecord } from '../parse/jsonl.js';
|
|
14
|
+
import { emptyStats } from '../parse/role-turns.js';
|
|
15
|
+
import { normalizeTitle } from '../parse/title.js';
|
|
16
|
+
import { newStep } from '../parse/tools.js';
|
|
17
|
+
/**
|
|
18
|
+
* Parse one zcode session document.
|
|
19
|
+
* @returns The session, or undefined when the document is not a
|
|
20
|
+
* `{ meta, messages }` object with a task id and workspace, or holds no
|
|
21
|
+
* prompt.
|
|
22
|
+
*/
|
|
23
|
+
export function parseZcodeSession(raw) {
|
|
24
|
+
let doc;
|
|
25
|
+
try {
|
|
26
|
+
doc = JSON.parse(raw);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
if (!isRecord(doc) || !isRecord(doc.meta) || !Array.isArray(doc.messages))
|
|
32
|
+
return undefined;
|
|
33
|
+
const { taskId, workspacePath, title, createdAt } = doc.meta;
|
|
34
|
+
if (typeof taskId !== 'string' || taskId === '')
|
|
35
|
+
return undefined;
|
|
36
|
+
if (typeof workspacePath !== 'string' || workspacePath === '')
|
|
37
|
+
return undefined;
|
|
38
|
+
const stats = emptyStats();
|
|
39
|
+
let turns = [];
|
|
40
|
+
let current;
|
|
41
|
+
let firstTime = 0;
|
|
42
|
+
for (const message of doc.messages) {
|
|
43
|
+
if (!isRecord(message))
|
|
44
|
+
continue;
|
|
45
|
+
if (message.role !== 'user' && message.role !== 'assistant')
|
|
46
|
+
continue;
|
|
47
|
+
if (typeof message.content !== 'string' || message.content === '')
|
|
48
|
+
continue;
|
|
49
|
+
if (firstTime === 0 && typeof message.timestamp === 'number')
|
|
50
|
+
firstTime = message.timestamp;
|
|
51
|
+
if (message.role === 'user') {
|
|
52
|
+
// Shared injection rules: harness blocks open no turn, wrappers keep
|
|
53
|
+
// only the human words.
|
|
54
|
+
if (isInjectedText(message.content)) {
|
|
55
|
+
stats.filtered += 1;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const prompt = unwrapUserText(message.content);
|
|
59
|
+
if (prompt === '')
|
|
60
|
+
continue;
|
|
61
|
+
current = { prompt, steps: [] };
|
|
62
|
+
turns.push(current);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (current === undefined) {
|
|
66
|
+
current = { prompt: '', steps: [] };
|
|
67
|
+
turns.push(current);
|
|
68
|
+
}
|
|
69
|
+
const step = newStep();
|
|
70
|
+
step.blocks.push({ type: 'text', text: message.content });
|
|
71
|
+
current.steps.push(step);
|
|
72
|
+
}
|
|
73
|
+
turns = turns.filter(turn => turn.prompt !== '' || turn.steps.length > 0);
|
|
74
|
+
if (turns.length === 0)
|
|
75
|
+
return undefined;
|
|
76
|
+
// meta.title is the store's own title (written to the log); the first real
|
|
77
|
+
// prompt is only a fallback.
|
|
78
|
+
const ownTitle = normalizeTitle(typeof title === 'string' ? title : undefined);
|
|
79
|
+
const shownTitle = ownTitle !== '' ? ownTitle : normalizeTitle(turns.find(turn => turn.prompt !== '')?.prompt);
|
|
80
|
+
return {
|
|
81
|
+
sourceId: taskId,
|
|
82
|
+
cwd: workspacePath,
|
|
83
|
+
...(shownTitle === '' ? {} : { title: shownTitle }),
|
|
84
|
+
titleExplicit: ownTitle !== '',
|
|
85
|
+
startedAt: typeof createdAt === 'number' ? createdAt : firstTime,
|
|
86
|
+
turns,
|
|
87
|
+
stats,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin-path.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/migrate/bin-path.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMjE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locate this package's `bin/dsh-tui.js` from a module directory inside it.
|
|
3
|
+
*
|
|
4
|
+
* The TUI's `/migrate` spawns the CLI through the package bin so the import
|
|
5
|
+
* runs in a child process. Callers live at DIFFERENT depths per layout:
|
|
6
|
+
* `src/screens/` at dev time (three levels), `lib/types/screens/` when
|
|
7
|
+
* installed (four levels) — a fixed dirname count lands inside the tree and
|
|
8
|
+
* the spawn fails on every real install (the regression the probe-up walk
|
|
9
|
+
* below replaces; found by the independent test session on a real profile).
|
|
10
|
+
* Probing upward for `bin/dsh-tui.js` matches both layouts without knowing
|
|
11
|
+
* which one we are in — the same spirit as src/update.ts's manifest walk.
|
|
12
|
+
*
|
|
13
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/bin-path
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync } from 'node:fs';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
/** Upward probe bounds: covers src/screens and lib/types/screens layouts. */
|
|
18
|
+
const PROBE_UP = ['..', '../..', '../../..', '../../../..'];
|
|
19
|
+
/**
|
|
20
|
+
* Resolve `bin/dsh-tui.js` for the package that contains `fromDir`, or
|
|
21
|
+
* undefined when no ancestor within the probe bound carries it.
|
|
22
|
+
*/
|
|
23
|
+
export function resolveOwnBin(fromDir) {
|
|
24
|
+
for (const up of PROBE_UP) {
|
|
25
|
+
const candidate = join(fromDir, up, 'bin', 'dsh-tui.js');
|
|
26
|
+
if (existsSync(candidate))
|
|
27
|
+
return candidate;
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browsing other coding agents' conversations for the session screen's source
|
|
3
|
+
* tabs: which agents have any, what they are, and importing one.
|
|
4
|
+
*
|
|
5
|
+
* Everything that knows how a foreign agent stores its conversations stays in
|
|
6
|
+
* this directory. The channel forwards these three calls unchanged, and the UI
|
|
7
|
+
* sees rows whose `key` it only hands back — never a path, a fingerprint or a
|
|
8
|
+
* source id.
|
|
9
|
+
*
|
|
10
|
+
* Nothing is persisted, and the cost is paid only by the tab that needs it:
|
|
11
|
+
* - opening the session screen probes presence alone — each source's walk
|
|
12
|
+
* stops at its first candidate, a handful of directory reads;
|
|
13
|
+
* - a source is listed when its tab is opened, and within this run an
|
|
14
|
+
* unchanged conversation (same mtime and size) is not read a second time.
|
|
15
|
+
*
|
|
16
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/browse
|
|
17
|
+
*/
|
|
18
|
+
import type { ForeignImportOutcome, ForeignSessionRow, ForeignSource } from '../../adapter/ports/channel-session.js';
|
|
19
|
+
import type { MigrationAdapter } from './types.js';
|
|
20
|
+
/** Whether an adapter can be browsed (summary scan + full load). */
|
|
21
|
+
export declare function isBrowsable(adapter: MigrationAdapter): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The browser behind one channel.
|
|
24
|
+
* @param persistence - The host's session persistence (imports go through it,
|
|
25
|
+
* so an imported session is immediately visible to resume).
|
|
26
|
+
* @param signal - Aborts in-flight walks when the channel is torn down.
|
|
27
|
+
* @param adapters - Every registered adapter; only browsable ones are used.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createForeignBrowser(persistence: () => unknown, signal?: AbortSignal, adapters?: readonly MigrationAdapter[]): {
|
|
30
|
+
/** Sources with at least one candidate, in registry order. */
|
|
31
|
+
listSources(): Promise<readonly ForeignSource[]>;
|
|
32
|
+
/**
|
|
33
|
+
* One source's conversations, newest first. A listing superseded by a
|
|
34
|
+
* newer one of the same source resolves to what is known, without
|
|
35
|
+
* publishing its own result.
|
|
36
|
+
*/
|
|
37
|
+
listSessions(agentId: string, onRow?: (row: ForeignSessionRow) => void): Promise<readonly ForeignSessionRow[]>;
|
|
38
|
+
/** Import one listed conversation (or find the copy already imported). */
|
|
39
|
+
importSession(agentId: string, key: string): Promise<ForeignImportOutcome>;
|
|
40
|
+
};
|
|
41
|
+
export type ForeignBrowser = ReturnType<typeof createForeignBrowser>;
|
|
42
|
+
//# sourceMappingURL=browse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browse.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/migrate/browse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAIpH,OAAO,KAAK,EAAsC,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAStF,oEAAoE;AACpE,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAE9D;AAUD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,OAAO,EAC1B,MAAM,CAAC,EAAE,WAAW,EACpB,QAAQ,GAAE,SAAS,gBAAgB,EAAuB;IAqBxD,8DAA8D;mBACzC,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC;IAKtD;;;;OAIG;0BACyB,MAAM,UAAU,CAAC,GAAG,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC;IA2BpH,0EAA0E;2BACnD,MAAM,OAAO,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;EAS7E;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { walkFiles } from './adapters/scan-fs.js';
|
|
2
|
+
import { createForeignImporter } from './import-one.js';
|
|
3
|
+
import { MIGRATION_ADAPTERS } from './index.js';
|
|
4
|
+
/** Whether an adapter can be browsed (summary scan + full load). */
|
|
5
|
+
export function isBrowsable(adapter) {
|
|
6
|
+
return adapter.walk !== undefined && adapter.scan !== undefined && adapter.load !== undefined;
|
|
7
|
+
}
|
|
8
|
+
const isAbort = (error) => error instanceof Error && error.name === 'AbortError';
|
|
9
|
+
const newestFirst = (a, b) => b.updatedAt - a.updatedAt;
|
|
10
|
+
function toRow(summary) {
|
|
11
|
+
return { agentId: summary.agentId, key: summary.ref, title: summary.title, cwd: summary.cwd, updatedAt: summary.lastMessageAt };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The browser behind one channel.
|
|
15
|
+
* @param persistence - The host's session persistence (imports go through it,
|
|
16
|
+
* so an imported session is immediately visible to resume).
|
|
17
|
+
* @param signal - Aborts in-flight walks when the channel is torn down.
|
|
18
|
+
* @param adapters - Every registered adapter; only browsable ones are used.
|
|
19
|
+
*/
|
|
20
|
+
export function createForeignBrowser(persistence, signal, adapters = MIGRATION_ADAPTERS) {
|
|
21
|
+
const browsable = adapters.filter(isBrowsable);
|
|
22
|
+
const known = new Map();
|
|
23
|
+
const generations = new Map();
|
|
24
|
+
const importer = createForeignImporter(() => persistence());
|
|
25
|
+
const adapterOf = (agentId) => browsable.find(adapter => adapter.id === agentId);
|
|
26
|
+
const rowsOf = (agentId) => {
|
|
27
|
+
const rows = [];
|
|
28
|
+
for (const entry of known.get(agentId)?.values() ?? [])
|
|
29
|
+
if (entry.summary !== null)
|
|
30
|
+
rows.push(toRow(entry.summary));
|
|
31
|
+
return rows.sort(newestFirst);
|
|
32
|
+
};
|
|
33
|
+
/** Whether a source has at least one candidate; the walk stops at the first. */
|
|
34
|
+
const hasCandidate = async (adapter) => {
|
|
35
|
+
for await (const _file of walkFiles(adapter.roots(), { ...adapter.walk, signal }))
|
|
36
|
+
return true;
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
/** Sources with at least one candidate, in registry order. */
|
|
41
|
+
async listSources() {
|
|
42
|
+
const present = await Promise.all(browsable.map(adapter => hasCandidate(adapter).catch(() => false)));
|
|
43
|
+
return browsable.filter((_adapter, index) => present[index]).map(adapter => ({ agentId: adapter.id, label: adapter.label }));
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* One source's conversations, newest first. A listing superseded by a
|
|
47
|
+
* newer one of the same source resolves to what is known, without
|
|
48
|
+
* publishing its own result.
|
|
49
|
+
*/
|
|
50
|
+
async listSessions(agentId, onRow) {
|
|
51
|
+
const adapter = adapterOf(agentId);
|
|
52
|
+
if (adapter === undefined)
|
|
53
|
+
return [];
|
|
54
|
+
const generation = (generations.get(agentId) ?? 0) + 1;
|
|
55
|
+
generations.set(agentId, generation);
|
|
56
|
+
const previous = known.get(agentId);
|
|
57
|
+
let scanned;
|
|
58
|
+
try {
|
|
59
|
+
scanned = await adapter.scan({
|
|
60
|
+
signal,
|
|
61
|
+
cached: (ref, fp) => {
|
|
62
|
+
const entry = previous?.get(ref);
|
|
63
|
+
return entry !== undefined && entry.fp.mtimeMs === fp.mtimeMs && entry.fp.size === fp.size ? entry.summary : undefined;
|
|
64
|
+
},
|
|
65
|
+
onEntry: onRow === undefined ? undefined : summary => onRow(toRow(summary)),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
// Channel teardown mid-walk: what is known stands.
|
|
70
|
+
if (isAbort(error))
|
|
71
|
+
return rowsOf(agentId);
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
if (generations.get(agentId) === generation) {
|
|
75
|
+
known.set(agentId, new Map(scanned.map(entry => [entry.ref, { fp: entry.fp, summary: entry.summary }])));
|
|
76
|
+
}
|
|
77
|
+
return rowsOf(agentId);
|
|
78
|
+
},
|
|
79
|
+
/** Import one listed conversation (or find the copy already imported). */
|
|
80
|
+
importSession(agentId, key) {
|
|
81
|
+
const adapter = adapterOf(agentId);
|
|
82
|
+
if (adapter === undefined)
|
|
83
|
+
return Promise.resolve({ kind: 'failed', reason: 'unknown-source' });
|
|
84
|
+
// A key this run never listed still imports: with no known identity the
|
|
85
|
+
// existence check misses, and the id is derived from what is loaded.
|
|
86
|
+
const summary = known.get(agentId)?.get(key)?.summary ?? undefined;
|
|
87
|
+
return importer.import(adapter, { sessionKey: summary?.sessionKey ?? '', ref: key, cwd: summary?.cwd ?? '' });
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Exit code for "nothing to do / unknown agent". */
|
|
2
|
+
export declare const MIGRATE_CLI_USAGE_EXIT = 2;
|
|
3
|
+
/**
|
|
4
|
+
* Run one migration CLI invocation.
|
|
5
|
+
* @param argv - Arguments after the `migrate` word.
|
|
6
|
+
* @returns Process exit code.
|
|
7
|
+
*/
|
|
8
|
+
export declare function cliMigrate(argv: readonly string[]): Promise<number>;
|
|
9
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/migrate/cli.ts"],"names":[],"mappings":"AAwBA,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAQvC;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAUzE"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI surface for migration, reached via `dsh-tui migrate ...` (the bin
|
|
3
|
+
* launcher delegates here exactly like it delegates `update`; the TUI's
|
|
4
|
+
* `/migrate` command spawns this same CLI in a child process).
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* dsh-tui migrate # list agents and discoverable counts (writes nothing)
|
|
8
|
+
* dsh-tui migrate <agent> # import every conversation found from that agent
|
|
9
|
+
* dsh-tui migrate <agent> --dry-run # show what would land, write nothing
|
|
10
|
+
*
|
|
11
|
+
* One agent per run, and `--dry-run` always names one: both are usage errors
|
|
12
|
+
* rather than silent fallbacks, matching the TUI's `/migrate` entry points.
|
|
13
|
+
*
|
|
14
|
+
* Every string that originated OUTSIDE this machine (source ids, cwds, error
|
|
15
|
+
* text embedding them) passes through cleanRenderText before printing: a
|
|
16
|
+
* hostile session file must not be able to drive terminal escape sequences
|
|
17
|
+
* through the preview/report paths (deep-review M2).
|
|
18
|
+
*
|
|
19
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/cli
|
|
20
|
+
*/
|
|
21
|
+
import { cleanRenderText } from '../sanitize.js';
|
|
22
|
+
import { messageCount } from './parse/role-turns.js';
|
|
23
|
+
import { MIGRATION_ADAPTERS, defaultSessionRoot, importSessions } from './index.js';
|
|
24
|
+
/** Exit code for "nothing to do / unknown agent". */
|
|
25
|
+
export const MIGRATE_CLI_USAGE_EXIT = 2;
|
|
26
|
+
/** Bound for one cleaned external string in CLI output (display cells). */
|
|
27
|
+
const RENDER_CELL_BUDGET = 200;
|
|
28
|
+
/** One external-origin string, sanitized to display-safe text. */
|
|
29
|
+
const safe = (value) => cleanRenderText(value, RENDER_CELL_BUDGET);
|
|
30
|
+
/**
|
|
31
|
+
* Run one migration CLI invocation.
|
|
32
|
+
* @param argv - Arguments after the `migrate` word.
|
|
33
|
+
* @returns Process exit code.
|
|
34
|
+
*/
|
|
35
|
+
export async function cliMigrate(argv) {
|
|
36
|
+
try {
|
|
37
|
+
return await cliMigrateInner(argv);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
// A top-level failure (e.g. persistence never becomes ready because the
|
|
41
|
+
// target root is unwritable) must land as one CLI-style summary line,
|
|
42
|
+
// not a bare Node stack trace (deep-review i1).
|
|
43
|
+
process.stderr.write(`dsh-tui migrate: ${error instanceof Error ? safe(error.message) : String(error)}\n`);
|
|
44
|
+
return 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function cliMigrateInner(argv) {
|
|
48
|
+
const dryRun = argv.includes('--dry-run');
|
|
49
|
+
const words = argv.filter(word => word !== '--dry-run');
|
|
50
|
+
if (words.length > 1) {
|
|
51
|
+
process.stderr.write('usage: dsh-tui migrate [<agent>] [--dry-run]\n');
|
|
52
|
+
return MIGRATE_CLI_USAGE_EXIT;
|
|
53
|
+
}
|
|
54
|
+
const wanted = words[0];
|
|
55
|
+
if (wanted === undefined) {
|
|
56
|
+
// `--dry-run` previews ONE source, so it needs one named: without this the
|
|
57
|
+
// flag fell through to the listing below and was silently ignored (the
|
|
58
|
+
// TUI's `/migrate --dry-run` says the same thing).
|
|
59
|
+
if (dryRun) {
|
|
60
|
+
process.stderr.write('usage: dsh-tui migrate <agent> --dry-run\n');
|
|
61
|
+
return MIGRATE_CLI_USAGE_EXIT;
|
|
62
|
+
}
|
|
63
|
+
// Bare `migrate` only reports; importing requires an explicit agent.
|
|
64
|
+
for (const adapter of MIGRATION_ADAPTERS) {
|
|
65
|
+
// Name-only count when the adapter offers one: list mode must not pay
|
|
66
|
+
// a full parse of every foreign file (deep-review M3). The count is
|
|
67
|
+
// scan candidates; import filters unreadable/empty ones, so it may
|
|
68
|
+
// land slightly above the imported total.
|
|
69
|
+
const available = adapter.count !== undefined ? adapter.count() : adapter.discover().sessions.length;
|
|
70
|
+
console.log(`[${adapter.id}] ${available} session file(s) to scan (run \`dsh-tui migrate ${adapter.id}\` to import)`);
|
|
71
|
+
}
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
const agent = MIGRATION_ADAPTERS.find(adapter => adapter.id === wanted);
|
|
75
|
+
if (agent === undefined) {
|
|
76
|
+
process.stderr.write(`dsh-tui migrate: unknown agent "${safe(wanted)}"; known: ${MIGRATION_ADAPTERS.map(adapter => adapter.id).join(', ')}\n`);
|
|
77
|
+
return MIGRATE_CLI_USAGE_EXIT;
|
|
78
|
+
}
|
|
79
|
+
const found = agent.discover();
|
|
80
|
+
if (found.sessions.length === 0) {
|
|
81
|
+
console.log(`[${agent.id}] no conversations found`);
|
|
82
|
+
return 0;
|
|
83
|
+
}
|
|
84
|
+
if (dryRun) {
|
|
85
|
+
console.log(`[${agent.id}] ${found.sessions.length} conversation(s) would be imported into ${defaultSessionRoot()} (dry run)`);
|
|
86
|
+
for (const session of found.sessions.slice(0, 5)) {
|
|
87
|
+
console.log(` · ${safe(session.sourceId)} (${messageCount(session)} messages · cwd ${safe(session.cwd)})`);
|
|
88
|
+
}
|
|
89
|
+
if (found.sessions.length > 5)
|
|
90
|
+
console.log(` … and ${found.sessions.length - 5} more`);
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
console.log(`[${agent.id}] importing ${found.sessions.length} conversation(s) into ${defaultSessionRoot()}`);
|
|
94
|
+
const run = await importSessions(agent, defaultSessionRoot(), found.sessions);
|
|
95
|
+
const parts = [`imported ${run.imported}`];
|
|
96
|
+
if (run.existing > 0)
|
|
97
|
+
parts.push(`already present ${run.existing}`);
|
|
98
|
+
if (run.failed > 0)
|
|
99
|
+
parts.push(`failed ${run.failed}`);
|
|
100
|
+
console.log(`[${agent.id}] ${parts.join(' · ')}`);
|
|
101
|
+
for (const failure of run.failures.slice(0, 10))
|
|
102
|
+
console.log(` ✗ ${safe(failure)}`);
|
|
103
|
+
if (run.failures.length > 10)
|
|
104
|
+
console.log(` … and ${run.failures.length - 10} more`);
|
|
105
|
+
return run.failed > 0 ? 1 : 0;
|
|
106
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import ONE foreign conversation through the host's persistence service —
|
|
3
|
+
* the session screen's "select to start" path (the CLI batch keeps
|
|
4
|
+
* importSessions, which mounts its own backend).
|
|
5
|
+
*
|
|
6
|
+
* Order is chosen so a failure never leaves a half-written log that the
|
|
7
|
+
* next click would take for "already imported":
|
|
8
|
+
* 1. the deterministic id already exists → open it, nothing is written;
|
|
9
|
+
* 2. the working directory must exist (resuming into a missing cwd fails
|
|
10
|
+
* later and less clearly);
|
|
11
|
+
* 3. the whole conversation is parsed and sessionized in memory;
|
|
12
|
+
* 4. only then create → append → flush → close; a write failure removes
|
|
13
|
+
* what was written, best effort — except a create that lost to a
|
|
14
|
+
* concurrent writer of the same deterministic id: that log is the
|
|
15
|
+
* winner's, and the import simply opens it.
|
|
16
|
+
*
|
|
17
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/import-one
|
|
18
|
+
*/
|
|
19
|
+
import { SessionId, type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session';
|
|
20
|
+
import type { LoadSkip, MigrationAdapter, MigrationSession } from './types.js';
|
|
21
|
+
/** Structural slice of the persistence service a single import needs. */
|
|
22
|
+
export interface ImportPersistence {
|
|
23
|
+
create(header: SessionHeader): Promise<ImportWriteHandle>;
|
|
24
|
+
/** Present on current backends: one session's snapshot, undefined when absent. */
|
|
25
|
+
stat?(id: SessionId): Promise<unknown>;
|
|
26
|
+
list(): Promise<readonly {
|
|
27
|
+
header: {
|
|
28
|
+
id: string;
|
|
29
|
+
};
|
|
30
|
+
}[]>;
|
|
31
|
+
}
|
|
32
|
+
export interface ImportWriteHandle {
|
|
33
|
+
append(events: readonly SessionEvent[]): Promise<void>;
|
|
34
|
+
flush(): Promise<void>;
|
|
35
|
+
close(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/** Outcome of one import request. */
|
|
38
|
+
export type ForeignImportResult = {
|
|
39
|
+
readonly kind: 'ready';
|
|
40
|
+
readonly sessionId: string;
|
|
41
|
+
readonly created: boolean;
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: 'cwd-missing';
|
|
44
|
+
readonly cwd: string;
|
|
45
|
+
} | {
|
|
46
|
+
readonly kind: 'failed';
|
|
47
|
+
readonly reason: LoadSkip['skip'] | 'write-failed';
|
|
48
|
+
readonly detail?: string;
|
|
49
|
+
};
|
|
50
|
+
/** Deterministic DSH session id of one foreign conversation (same as /migrate). */
|
|
51
|
+
export declare function foreignSessionId(agentId: string, sourceId: string): SessionId;
|
|
52
|
+
/**
|
|
53
|
+
* Write one sessionized conversation (the CLI batch path; the single import
|
|
54
|
+
* phases create/append itself so a create race stays out of its cleanup).
|
|
55
|
+
* Both paths produce byte-identical logs: sessionize is deterministic in
|
|
56
|
+
* the id and the events.
|
|
57
|
+
*/
|
|
58
|
+
export declare function writeImportedSession(persistence: Pick<ImportPersistence, 'create'>, id: SessionId, agentId: string, session: MigrationSession): Promise<void>;
|
|
59
|
+
export interface ImportRequest {
|
|
60
|
+
/** The listed conversation's stable source id (ForeignSessionSummary.sessionKey). */
|
|
61
|
+
readonly sessionKey: string;
|
|
62
|
+
readonly ref: string;
|
|
63
|
+
/** The listed cwd; '' when the summary did not know it. */
|
|
64
|
+
readonly cwd: string;
|
|
65
|
+
}
|
|
66
|
+
export interface ImportDeps {
|
|
67
|
+
readonly cwdExists?: (path: string) => boolean;
|
|
68
|
+
/** Best-effort removal of a partially written log. */
|
|
69
|
+
readonly discard?: (sessionId: string) => void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Import one conversation unless it is already present.
|
|
73
|
+
* @returns ready (with whether it was written now), cwd-missing, or failed.
|
|
74
|
+
*/
|
|
75
|
+
export declare function importForeignSession(persistence: ImportPersistence, adapter: MigrationAdapter, request: ImportRequest, deps?: ImportDeps): Promise<ForeignImportResult>;
|
|
76
|
+
/**
|
|
77
|
+
* One importer per host: a second request for a conversation already being
|
|
78
|
+
* imported joins the running one instead of starting another write.
|
|
79
|
+
*
|
|
80
|
+
* Requests are keyed by the conversation's IDENTITY (the id it will be written
|
|
81
|
+
* under), not by its locator: two artifacts of one source can carry the same
|
|
82
|
+
* source id (a Claude session continued in another project directory), and
|
|
83
|
+
* two concurrent writes to one id would have the loser's cleanup delete the
|
|
84
|
+
* winner's log. The locator is the key only when the identity is not known yet.
|
|
85
|
+
*/
|
|
86
|
+
export declare function createForeignImporter(persistence: () => ImportPersistence | undefined, deps?: ImportDeps): {
|
|
87
|
+
import(adapter: MigrationAdapter, request: ImportRequest): Promise<ForeignImportResult>;
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=import-one.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-one.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/migrate/import-one.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAI3F,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAG9E,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACzD,kFAAkF;IAClF,IAAI,CAAC,CAAC,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC,IAAI,IAAI,OAAO,CAAC,SAAS;QAAE,MAAM,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,EAAE,CAAC,CAAA;CACvD;AACD,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvB;AAED,qCAAqC;AACrC,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACjF;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7G,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAE7E;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,EAC9C,EAAE,EAAE,SAAS,EACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAWf;AAOD,MAAM,WAAW,aAAa;IAC5B,qFAAqF;IACrF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,2DAA2D;IAC3D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IAC9C,sDAAsD;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/C;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,iBAAiB,EAC9B,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,aAAa,EACtB,IAAI,GAAE,UAAe,GACpB,OAAO,CAAC,mBAAmB,CAAC,CAqC9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,iBAAiB,GAAG,SAAS,EAAE,IAAI,GAAE,UAAe;oBAGzF,gBAAgB,WAAW,aAAa,GAAG,OAAO,CAAC,mBAAmB,CAAC;EAe1F"}
|