@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
|
@@ -8,17 +8,11 @@ const STATUS_SUFFIX_PATTERN = /^\s*\[status:\s/;
|
|
|
8
8
|
function isTerminal(status) {
|
|
9
9
|
return status === 'completed' || status === 'killed' || status === 'failed';
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Ordered store of the current conversation's background jobs. Fed by
|
|
13
|
-
* {@link BackgroundJobStore.replace} with a fresh `list()` after every
|
|
14
|
-
* `onJobsChanged` commit, and by {@link BackgroundJobStore.onOutputSeen}
|
|
15
|
-
* with the tail of every `job_output` tool result. Emits no React state of
|
|
16
|
-
* its own — the channel wires the events into its version bump, exactly
|
|
17
|
-
* like the subagent projection.
|
|
18
|
-
*/
|
|
19
11
|
export class BackgroundJobStore {
|
|
20
12
|
events;
|
|
21
13
|
jobs = new Map();
|
|
14
|
+
/** Kernel-ring read state per job id (own cursor — never the model's). */
|
|
15
|
+
kernelReads = new Map();
|
|
22
16
|
/** Commands captured from start acks that arrived before the registry
|
|
23
17
|
* registered the job (the tool/result stream and the registry commit can
|
|
24
18
|
* race); consumed on registration. */
|
|
@@ -52,16 +46,24 @@ export class BackgroundJobStore {
|
|
|
52
46
|
...(command === undefined ? {} : { command }),
|
|
53
47
|
status: snap.status,
|
|
54
48
|
...(snap.detail === undefined ? {} : { detail: snap.detail }),
|
|
49
|
+
...(snap.progress === undefined ? {} : { progress: snap.progress }),
|
|
55
50
|
startedAt: snap.startedAt,
|
|
56
51
|
...(snap.finishedAt === undefined ? {} : { finishedAt: snap.finishedAt }),
|
|
57
52
|
outputLines: [],
|
|
53
|
+
...(snap.output === undefined ? {} : {
|
|
54
|
+
outputTotalBytes: snap.output.total,
|
|
55
|
+
...(snap.output.spillPaths === undefined || snap.output.spillPaths.length === 0 ? {} : { spillPaths: [...snap.output.spillPaths] }),
|
|
56
|
+
}),
|
|
58
57
|
});
|
|
58
|
+
if (snap.output !== undefined)
|
|
59
|
+
this.seedKernelRead(snap.id, snap.output.earliest);
|
|
59
60
|
changed = true;
|
|
60
61
|
continue;
|
|
61
62
|
}
|
|
62
63
|
if (prev.status === snap.status &&
|
|
63
64
|
prev.detail === snap.detail &&
|
|
64
65
|
prev.label === snap.label &&
|
|
66
|
+
prev.progress === snap.progress &&
|
|
65
67
|
prev.finishedAt === snap.finishedAt)
|
|
66
68
|
continue;
|
|
67
69
|
const wasLive = !isTerminal(prev.status);
|
|
@@ -71,10 +73,20 @@ export class BackgroundJobStore {
|
|
|
71
73
|
delete prev.detail;
|
|
72
74
|
else
|
|
73
75
|
prev.detail = snap.detail;
|
|
76
|
+
if (snap.progress === undefined)
|
|
77
|
+
delete prev.progress;
|
|
78
|
+
else
|
|
79
|
+
prev.progress = snap.progress;
|
|
74
80
|
if (snap.finishedAt === undefined)
|
|
75
81
|
delete prev.finishedAt;
|
|
76
82
|
else
|
|
77
83
|
prev.finishedAt = snap.finishedAt;
|
|
84
|
+
if (snap.output !== undefined) {
|
|
85
|
+
prev.outputTotalBytes = snap.output.total;
|
|
86
|
+
if (snap.output.spillPaths !== undefined && snap.output.spillPaths.length > 0)
|
|
87
|
+
prev.spillPaths = [...snap.output.spillPaths];
|
|
88
|
+
this.seedKernelRead(snap.id, snap.output.earliest);
|
|
89
|
+
}
|
|
78
90
|
changed = true;
|
|
79
91
|
if (wasLive && isTerminal(snap.status))
|
|
80
92
|
this.events.onSettled?.(prev);
|
|
@@ -132,13 +144,95 @@ export class BackgroundJobStore {
|
|
|
132
144
|
const lines = text
|
|
133
145
|
.split(/\r?\n/)
|
|
134
146
|
.map(line => line.replace(/\s+$/, ''))
|
|
135
|
-
.filter(line => line !== '' && !STATUS_SUFFIX_PATTERN.test(line))
|
|
147
|
+
.filter(line => line !== '' && !STATUS_SUFFIX_PATTERN.test(line))
|
|
148
|
+
.map(text => ({ text }));
|
|
136
149
|
if (lines.length === 0)
|
|
137
150
|
return;
|
|
138
151
|
job.outputLines = [...job.outputLines, ...lines].slice(-JOBS_MAX_OUTPUT_LINES);
|
|
139
152
|
job.lastOutputAt = at;
|
|
140
153
|
this.events.onChanged?.();
|
|
141
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Seed the kernel-ring cursor for one job at its retained head. Called from
|
|
157
|
+
* replace() whenever a snapshot carries ring facts — before any output
|
|
158
|
+
* pull — so the first readAt starts at `earliest`, never at 0 (bytes
|
|
159
|
+
* before `earliest` are already evicted).
|
|
160
|
+
*/
|
|
161
|
+
seedKernelRead(id, earliest) {
|
|
162
|
+
const read = this.kernelReads.get(id);
|
|
163
|
+
if (read === undefined)
|
|
164
|
+
this.kernelReads.set(id, { cursor: earliest, partial: '' });
|
|
165
|
+
else if (read.cursor < earliest) {
|
|
166
|
+
// Ring evicted past our cursor: resync and mark the discontinuity.
|
|
167
|
+
read.cursor = earliest;
|
|
168
|
+
read.partial = '';
|
|
169
|
+
const job = this.jobs.get(id);
|
|
170
|
+
if (job !== undefined)
|
|
171
|
+
job.outputDropped = true;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Pull one non-consuming increment from the kernel ring after an `output`
|
|
176
|
+
* event. Chunks split into lines; a chunk without a trailing newline parks
|
|
177
|
+
* its tail until the next pull (producers append streaming bytes, so line
|
|
178
|
+
* boundaries routinely straddle chunks). `gapBefore`/`lossy` mark bytes
|
|
179
|
+
* lost before the retained tail — surfaced as the dropped banner.
|
|
180
|
+
*/
|
|
181
|
+
onKernelOutput(id, read, at = Date.now()) {
|
|
182
|
+
const job = this.jobs.get(id);
|
|
183
|
+
if (job === undefined)
|
|
184
|
+
return;
|
|
185
|
+
const state = this.kernelReads.get(id) ?? { cursor: 0, partial: '' };
|
|
186
|
+
this.kernelReads.set(id, state);
|
|
187
|
+
const appended = [];
|
|
188
|
+
let gapPending = read.lossy === true;
|
|
189
|
+
let gapSeen = read.lossy === true;
|
|
190
|
+
for (const chunk of read.chunks) {
|
|
191
|
+
if (chunk.gapBefore === true) {
|
|
192
|
+
gapPending = true;
|
|
193
|
+
gapSeen = true;
|
|
194
|
+
}
|
|
195
|
+
let text = state.partial + chunk.text;
|
|
196
|
+
state.partial = '';
|
|
197
|
+
// A \r not followed by \n is a same-line rewrite (progress spinners);
|
|
198
|
+
// keep the tail after the last one so the panel shows the newest form.
|
|
199
|
+
const lines = text.split(/\r?\n/);
|
|
200
|
+
if (!text.endsWith('\n')) {
|
|
201
|
+
state.partial = lines.pop() ?? '';
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
lines.pop();
|
|
205
|
+
}
|
|
206
|
+
for (const raw of lines) {
|
|
207
|
+
const trimmed = raw.replace(/\s+$/, '');
|
|
208
|
+
if (trimmed === '')
|
|
209
|
+
continue;
|
|
210
|
+
appended.push({ text: trimmed, ...(chunk.channel === undefined ? {} : { channel: chunk.channel }), ...(gapPending ? { gapBefore: true } : {}) });
|
|
211
|
+
gapPending = false;
|
|
212
|
+
}
|
|
213
|
+
if (state.partial !== '') {
|
|
214
|
+
// Re-split parked tail the same way so an embedded \r refreshes it.
|
|
215
|
+
const parts = state.partial.split(/\r(?!\n)/);
|
|
216
|
+
state.partial = parts[parts.length - 1];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
state.cursor = read.next;
|
|
220
|
+
if (gapSeen)
|
|
221
|
+
job.outputDropped = true;
|
|
222
|
+
if (appended.length > 0) {
|
|
223
|
+
job.outputLines = [...job.outputLines, ...appended].slice(-JOBS_MAX_OUTPUT_LINES);
|
|
224
|
+
job.lastOutputAt = at;
|
|
225
|
+
this.events.onChanged?.();
|
|
226
|
+
}
|
|
227
|
+
else if (job.outputTotalBytes !== read.next) {
|
|
228
|
+
this.events.onChanged?.();
|
|
229
|
+
}
|
|
230
|
+
job.outputTotalBytes = Math.max(job.outputTotalBytes ?? 0, read.next);
|
|
231
|
+
}
|
|
232
|
+
/** Kernel read state accessor for tests and cursor diagnostics. */
|
|
233
|
+
kernelCursorOf(id) {
|
|
234
|
+
return this.kernelReads.get(id)?.cursor;
|
|
235
|
+
}
|
|
142
236
|
/** A fresh snapshot in registration order (newest tracked job last). */
|
|
143
237
|
snapshot() {
|
|
144
238
|
return [...this.jobs.values()];
|
|
@@ -160,6 +254,7 @@ export class BackgroundJobStore {
|
|
|
160
254
|
if (this.jobs.size === 0)
|
|
161
255
|
return;
|
|
162
256
|
this.jobs.clear();
|
|
257
|
+
this.kernelReads.clear();
|
|
163
258
|
this.events.onChanged?.();
|
|
164
259
|
}
|
|
165
260
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/claude-code.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAmC,gBAAgB,EAA+D,MAAM,aAAa,CAAA;AA8DjJ,eAAO,MAAM,iBAAiB,EAAE,gBA8C/B,CAAA"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code adapter: `~/.claude/projects/<munged-cwd>/<session>.jsonl`.
|
|
3
|
+
* File discovery lives here; the line format is parsed by the pure
|
|
4
|
+
* claude-code.parse.ts. The browse scan derives each summary from the same
|
|
5
|
+
* parser run over the file's head, plus a tail window for the /rename title
|
|
6
|
+
* (renames append, the last one wins).
|
|
7
|
+
*
|
|
8
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/adapters/claude-code
|
|
9
|
+
*/
|
|
10
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
11
|
+
import { homedir } from 'node:os';
|
|
12
|
+
import { basename, dirname, join } from 'node:path';
|
|
13
|
+
import { parseJsonl } from '../parse/jsonl.js';
|
|
14
|
+
import { normalizeTitle } from '../parse/title.js';
|
|
15
|
+
import { parseClaudeTranscript } from './claude-code.parse.js';
|
|
16
|
+
import { countEntries } from './scan.js';
|
|
17
|
+
import { fingerprintOf, loadText, readTail, runScan, walkFiles, withHead } from './scan-fs.js';
|
|
18
|
+
/** Sub-agent transcripts (`<session>/subagents/*.jsonl`) belong to their
|
|
19
|
+
* parent session; they are never conversations of their own. */
|
|
20
|
+
const SUBAGENT_DIR = 'subagents';
|
|
21
|
+
const WALK = { maxDepth: 3, match: name => name.endsWith('.jsonl'), skipDirs: [SUBAGENT_DIR] };
|
|
22
|
+
/** Tail window searched for the latest /rename title. */
|
|
23
|
+
const TITLE_TAIL_BYTES = 64 * 1024;
|
|
24
|
+
/** File name without `.jsonl`: the session's stable source id. */
|
|
25
|
+
const fileStemOf = (path) => basename(path).replace(/\.jsonl$/u, '');
|
|
26
|
+
/** cwd guessed from the project directory name, for logs whose lines record none. */
|
|
27
|
+
const fallbackCwdOf = (path) => unmunge(basename(dirname(path))) ?? homedir();
|
|
28
|
+
/** The last /rename title in a tail window, when there is one. */
|
|
29
|
+
function tailRenameTitle(tail) {
|
|
30
|
+
let title;
|
|
31
|
+
for (const record of parseJsonl(tail).records) {
|
|
32
|
+
if (record.type === 'custom-title' && typeof record.customTitle === 'string' && record.customTitle.trim() !== '')
|
|
33
|
+
title = record.customTitle;
|
|
34
|
+
}
|
|
35
|
+
return title;
|
|
36
|
+
}
|
|
37
|
+
async function summarize({ ref, fp }) {
|
|
38
|
+
const input = { fileStem: fileStemOf(ref), fallbackCwd: fallbackCwdOf(ref) };
|
|
39
|
+
const found = await withHead(ref, fp.size, (raw, whole) => {
|
|
40
|
+
const session = parseClaudeTranscript({ ...input, raw });
|
|
41
|
+
return session === undefined ? undefined : { session, whole };
|
|
42
|
+
});
|
|
43
|
+
if (found === undefined)
|
|
44
|
+
return null;
|
|
45
|
+
const { session, whole } = found;
|
|
46
|
+
const renamed = whole ? undefined : tailRenameTitle(await readTail(ref, TITLE_TAIL_BYTES, fp.size));
|
|
47
|
+
return {
|
|
48
|
+
agentId: 'claude-code',
|
|
49
|
+
sessionKey: session.sourceId,
|
|
50
|
+
ref,
|
|
51
|
+
title: renamed === undefined ? session.title ?? '' : normalizeTitle(renamed),
|
|
52
|
+
cwd: session.cwd,
|
|
53
|
+
lastMessageAt: fp.mtimeMs,
|
|
54
|
+
createdAt: session.startedAt || fp.mtimeMs,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function readOne(path, fallbackCwd) {
|
|
58
|
+
let raw;
|
|
59
|
+
try {
|
|
60
|
+
raw = readFileSync(path, 'utf8');
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
// basename(), not split('/'): join() produces `\` separators on Windows, so
|
|
66
|
+
// splitting on '/' would leave the WHOLE absolute path as the id — and the
|
|
67
|
+
// id is the dedupe key (moving the source store would re-import everything).
|
|
68
|
+
return parseClaudeTranscript({ raw, fileStem: fileStemOf(path), fallbackCwd });
|
|
69
|
+
}
|
|
70
|
+
export const claudeCodeAdapter = {
|
|
71
|
+
id: 'claude-code',
|
|
72
|
+
label: 'Claude Code',
|
|
73
|
+
roots: () => [join(homedir(), '.claude', 'projects')],
|
|
74
|
+
discover() {
|
|
75
|
+
const roots = this.roots();
|
|
76
|
+
const sessions = [];
|
|
77
|
+
const walk = (dir, depth, fallbackCwd) => {
|
|
78
|
+
if (depth > 3)
|
|
79
|
+
return;
|
|
80
|
+
let entries;
|
|
81
|
+
try {
|
|
82
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
for (const entry of entries) {
|
|
88
|
+
const path = join(dir, entry.name);
|
|
89
|
+
if (entry.isDirectory()) {
|
|
90
|
+
if (entry.name !== SUBAGENT_DIR)
|
|
91
|
+
walk(path, depth + 1, unmunge(entry.name) ?? fallbackCwd);
|
|
92
|
+
}
|
|
93
|
+
else if (entry.isFile() && entry.name.endsWith('.jsonl')) {
|
|
94
|
+
try {
|
|
95
|
+
if (statSync(path).size > 64 * 1024 * 1024)
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const session = readOne(path, fallbackCwd);
|
|
102
|
+
if (session !== undefined)
|
|
103
|
+
sessions.push(session);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
for (const root of roots)
|
|
108
|
+
walk(root, 0, homedir());
|
|
109
|
+
return { roots, sessions };
|
|
110
|
+
},
|
|
111
|
+
count() {
|
|
112
|
+
return countEntries(this.roots(), { maxDepth: WALK.maxDepth, fileMatch: WALK.match, skipDirs: WALK.skipDirs });
|
|
113
|
+
},
|
|
114
|
+
walk: WALK,
|
|
115
|
+
async scan(options) {
|
|
116
|
+
const files = walkFiles(this.roots(), { ...WALK, signal: options?.signal });
|
|
117
|
+
return runScan(files, file => file.path, fingerprintOf, options, summarize);
|
|
118
|
+
},
|
|
119
|
+
async load(ref) {
|
|
120
|
+
const raw = await loadText(ref);
|
|
121
|
+
if (typeof raw !== 'string')
|
|
122
|
+
return raw;
|
|
123
|
+
return parseClaudeTranscript({ raw, fileStem: fileStemOf(ref), fallbackCwd: fallbackCwdOf(ref) }) ?? { skip: 'not-a-session' };
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
/** Best-effort inverse of Claude Code's dash-munged directory names. */
|
|
127
|
+
function unmunge(name) {
|
|
128
|
+
if (!name.startsWith('-'))
|
|
129
|
+
return undefined;
|
|
130
|
+
return `/${name.split('-').filter(Boolean).join('/')}`;
|
|
131
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MigrationSession } from '../types.js';
|
|
2
|
+
/** What the adapter knows about a transcript besides its text. */
|
|
3
|
+
export interface ClaudeTranscriptInput {
|
|
4
|
+
readonly raw: string;
|
|
5
|
+
/** File name without `.jsonl` — the session's stable source id. */
|
|
6
|
+
readonly fileStem: string;
|
|
7
|
+
/** cwd derived from the project directory name, used when no line records one. */
|
|
8
|
+
readonly fallbackCwd: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parse one Claude Code transcript.
|
|
12
|
+
* @returns The session, or undefined when it holds no human prompt or is an
|
|
13
|
+
* auxiliary transcript (its records name another session: only the main
|
|
14
|
+
* `<sessionId>.jsonl` is a conversation of its own).
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseClaudeTranscript(input: ClaudeTranscriptInput): MigrationSession | undefined;
|
|
17
|
+
//# sourceMappingURL=claude-code.parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.parse.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/claude-code.parse.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAA4C,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE7F,kEAAkE;AAClE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,kFAAkF;IAClF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAwFD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,qBAAqB,GAAG,gBAAgB,GAAG,SAAS,CA+KhG"}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code transcript parsing (pure): one `<session>.jsonl` → one
|
|
3
|
+
* {@link MigrationSession}.
|
|
4
|
+
*
|
|
5
|
+
* Lines are self-describing (`type`). A human prompt is a `user` line whose
|
|
6
|
+
* content is a string or text blocks; an assistant line carries ONE content
|
|
7
|
+
* block of a model response, and one response spans several lines sharing
|
|
8
|
+
* `message.id` (thinking, text, each tool_use — tool results can land
|
|
9
|
+
* between them). Those lines are merged back into one step: one step is one
|
|
10
|
+
* model call.
|
|
11
|
+
*
|
|
12
|
+
* Tool results arrive as `user` lines of `tool_result` blocks, usually
|
|
13
|
+
* after every tool_use of the response has been written; each is paired to
|
|
14
|
+
* the step that made the call by `tool_use_id` (never to the newest step).
|
|
15
|
+
*
|
|
16
|
+
* Machine text in the user role: `isMeta` lines are context the model saw
|
|
17
|
+
* mid-turn and become the next step's inputs (never a turn); slash-command
|
|
18
|
+
* echoes become `/name args` prompts, dropped when the model never answered
|
|
19
|
+
* them (local commands); local-command output and other injection is
|
|
20
|
+
* dropped. Everything dropped is counted in `stats.filtered`.
|
|
21
|
+
*
|
|
22
|
+
* A `user` line flagged `isCompactSummary` is a compaction boundary: its
|
|
23
|
+
* text becomes the checkpoint in front of the next turn (sessionize writes
|
|
24
|
+
* the native compaction transaction). The legacy 2.0.x `summary` record is
|
|
25
|
+
* a one-line leaf title written at the head of a file, not a boundary.
|
|
26
|
+
*
|
|
27
|
+
* Title authority: `custom-title` (the user's /rename; the LAST one wins —
|
|
28
|
+
* renames append) > legacy `summary` > `ai-title` (the FIRST one; later
|
|
29
|
+
* ones are rewritten per turn and drift) > the first real prompt as a
|
|
30
|
+
* fallback that is not written to the log.
|
|
31
|
+
*
|
|
32
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/adapters/claude-code.parse
|
|
33
|
+
*/
|
|
34
|
+
import { isRecord, parseJsonl } from '../parse/jsonl.js';
|
|
35
|
+
import { isInjectedText, stripSystemReminders, unwrapUserText } from '../parse/injection.js';
|
|
36
|
+
import { emptyStats } from '../parse/role-turns.js';
|
|
37
|
+
import { normalizeTitle } from '../parse/title.js';
|
|
38
|
+
import { CallIndex, IMAGE_PLACEHOLDER, closeToolPairs, newStep } from '../parse/tools.js';
|
|
39
|
+
function toMillis(iso) {
|
|
40
|
+
return typeof iso === 'string' ? Date.parse(iso) || 0 : 0;
|
|
41
|
+
}
|
|
42
|
+
/** Text of a string or block-array content; each image becomes a placeholder. */
|
|
43
|
+
function textOf(content) {
|
|
44
|
+
if (typeof content === 'string')
|
|
45
|
+
return content;
|
|
46
|
+
if (!Array.isArray(content))
|
|
47
|
+
return '';
|
|
48
|
+
const parts = [];
|
|
49
|
+
for (const block of content) {
|
|
50
|
+
if (!isRecord(block))
|
|
51
|
+
continue;
|
|
52
|
+
if (block.type === 'text' && typeof block.text === 'string' && block.text !== '')
|
|
53
|
+
parts.push(block.text);
|
|
54
|
+
else if (block.type === 'image')
|
|
55
|
+
parts.push(IMAGE_PLACEHOLDER);
|
|
56
|
+
}
|
|
57
|
+
return parts.join('\n\n');
|
|
58
|
+
}
|
|
59
|
+
/** Model-facing text of a tool_result's content: a string, or text blocks
|
|
60
|
+
* with each image replaced by a placeholder. */
|
|
61
|
+
function toolResultText(content) {
|
|
62
|
+
if (typeof content === 'string')
|
|
63
|
+
return content;
|
|
64
|
+
if (!Array.isArray(content))
|
|
65
|
+
return '';
|
|
66
|
+
const parts = [];
|
|
67
|
+
for (const block of content) {
|
|
68
|
+
if (!isRecord(block))
|
|
69
|
+
continue;
|
|
70
|
+
if (block.type === 'text' && typeof block.text === 'string')
|
|
71
|
+
parts.push(block.text);
|
|
72
|
+
else if (block.type === 'image')
|
|
73
|
+
parts.push(IMAGE_PLACEHOLDER);
|
|
74
|
+
}
|
|
75
|
+
return parts.join('\n');
|
|
76
|
+
}
|
|
77
|
+
/** Whether a user text is Claude Code's echo of a slash command. */
|
|
78
|
+
function isCommandEcho(text) {
|
|
79
|
+
return text.startsWith('<command-name>') || text.startsWith('<command-message>');
|
|
80
|
+
}
|
|
81
|
+
/** Body of the first `<tag>…</tag>` in text, or ''. */
|
|
82
|
+
function tagBody(text, tag) {
|
|
83
|
+
const open = `<${tag}>`;
|
|
84
|
+
const start = text.indexOf(open);
|
|
85
|
+
if (start === -1)
|
|
86
|
+
return '';
|
|
87
|
+
const end = text.indexOf(`</${tag}>`, start + open.length);
|
|
88
|
+
return text.slice(start + open.length, end === -1 ? undefined : end).trim();
|
|
89
|
+
}
|
|
90
|
+
/** A slash-command echo as the user typed it: `/name args`. */
|
|
91
|
+
function commandPrompt(text) {
|
|
92
|
+
const name = tagBody(text, 'command-name');
|
|
93
|
+
const args = tagBody(text, 'command-args');
|
|
94
|
+
return `${name} ${args}`.trim() || text;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Drop failed-dispatch ghosts: when a response's tool calls got no result,
|
|
98
|
+
* Claude Code re-sends the SAME calls (same ids, same arguments) in the next
|
|
99
|
+
* response. Kept, the id would appear twice in the log. A step is a ghost
|
|
100
|
+
* when it holds only tool calls, none answered, and the very next step
|
|
101
|
+
* re-sends every one of them verbatim; its inputs move to the retry.
|
|
102
|
+
* @returns How many steps were dropped.
|
|
103
|
+
*/
|
|
104
|
+
function dropGhostRetries(steps) {
|
|
105
|
+
let dropped = 0;
|
|
106
|
+
for (let i = 0; i < steps.length - 1;) {
|
|
107
|
+
const ghost = steps[i];
|
|
108
|
+
const retry = steps[i + 1];
|
|
109
|
+
const isGhost = ghost.blocks.length > 0 && ghost.results.length === 0
|
|
110
|
+
&& ghost.blocks.every(block => block.type === 'tool-call'
|
|
111
|
+
&& retry.blocks.some(again => again.type === 'tool-call' && again.id === block.id
|
|
112
|
+
&& again.name === block.name && again.arguments === block.arguments));
|
|
113
|
+
if (!isGhost) {
|
|
114
|
+
i += 1;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
retry.inputs = [...ghost.inputs, ...retry.inputs];
|
|
118
|
+
steps.splice(i, 1);
|
|
119
|
+
dropped += 1;
|
|
120
|
+
// Stay at i: the retry may itself be a ghost of the step after it.
|
|
121
|
+
}
|
|
122
|
+
return dropped;
|
|
123
|
+
}
|
|
124
|
+
/** Whether a user line is a tool-result carrier rather than a prompt. */
|
|
125
|
+
function isToolResultLine(content) {
|
|
126
|
+
return Array.isArray(content) && content.some(block => isRecord(block) && block.type === 'tool_result');
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Parse one Claude Code transcript.
|
|
130
|
+
* @returns The session, or undefined when it holds no human prompt or is an
|
|
131
|
+
* auxiliary transcript (its records name another session: only the main
|
|
132
|
+
* `<sessionId>.jsonl` is a conversation of its own).
|
|
133
|
+
*/
|
|
134
|
+
export function parseClaudeTranscript(input) {
|
|
135
|
+
const { records, badLines } = parseJsonl(input.raw);
|
|
136
|
+
const owner = records.find(record => typeof record.sessionId === 'string' && record.sessionId !== '')?.sessionId;
|
|
137
|
+
if (owner !== undefined && owner !== input.fileStem)
|
|
138
|
+
return undefined;
|
|
139
|
+
const stats = { ...emptyStats(), badLines };
|
|
140
|
+
let turns = [];
|
|
141
|
+
let current;
|
|
142
|
+
/** message.id → its step, within the current turn. */
|
|
143
|
+
let stepOfMessage = new Map();
|
|
144
|
+
let startedAt = 0;
|
|
145
|
+
let lineCwd;
|
|
146
|
+
const calls = new CallIndex();
|
|
147
|
+
/** A compaction summary waiting for the turn that follows the boundary. */
|
|
148
|
+
let pendingCompaction;
|
|
149
|
+
let lastModel;
|
|
150
|
+
let renamedTitle;
|
|
151
|
+
let legacyTitle;
|
|
152
|
+
let aiTitle;
|
|
153
|
+
/** isMeta texts waiting for the next step of the current turn. */
|
|
154
|
+
let pendingInputs = [];
|
|
155
|
+
/** Turns opened by a slash-command echo rather than typed words. */
|
|
156
|
+
const commandTurns = new Set();
|
|
157
|
+
const openTurn = (prompt) => {
|
|
158
|
+
current = pendingCompaction === undefined ? { prompt, steps: [] } : { prompt, compaction: pendingCompaction, steps: [] };
|
|
159
|
+
pendingCompaction = undefined;
|
|
160
|
+
turns.push(current);
|
|
161
|
+
stepOfMessage = new Map();
|
|
162
|
+
};
|
|
163
|
+
const appendAssistant = (message) => {
|
|
164
|
+
if (current === undefined)
|
|
165
|
+
openTurn('');
|
|
166
|
+
const turn = current;
|
|
167
|
+
const messageId = typeof message.id === 'string' && message.id !== '' ? message.id : undefined;
|
|
168
|
+
let step = messageId === undefined ? undefined : stepOfMessage.get(messageId);
|
|
169
|
+
if (typeof message.model === 'string' && message.model !== '')
|
|
170
|
+
lastModel = message.model;
|
|
171
|
+
if (step === undefined) {
|
|
172
|
+
step = newStep(typeof message.model === 'string' && message.model !== '' ? message.model : undefined);
|
|
173
|
+
step.inputs = pendingInputs;
|
|
174
|
+
pendingInputs = [];
|
|
175
|
+
turn.steps.push(step);
|
|
176
|
+
if (messageId !== undefined)
|
|
177
|
+
stepOfMessage.set(messageId, step);
|
|
178
|
+
}
|
|
179
|
+
const content = message.content;
|
|
180
|
+
if (typeof content === 'string') {
|
|
181
|
+
if (content !== '')
|
|
182
|
+
step.blocks.push({ type: 'text', text: content });
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (!Array.isArray(content))
|
|
186
|
+
return;
|
|
187
|
+
for (const block of content) {
|
|
188
|
+
if (!isRecord(block))
|
|
189
|
+
continue;
|
|
190
|
+
if (block.type === 'text' && typeof block.text === 'string' && block.text !== '') {
|
|
191
|
+
step.blocks.push({ type: 'text', text: block.text });
|
|
192
|
+
}
|
|
193
|
+
else if (block.type === 'thinking') {
|
|
194
|
+
// The trace lives in `thinking` (not `text`); accept both.
|
|
195
|
+
const text = typeof block.thinking === 'string' ? block.thinking : typeof block.text === 'string' ? block.text : '';
|
|
196
|
+
if (text !== '')
|
|
197
|
+
step.blocks.push({ type: 'reasoning', text });
|
|
198
|
+
}
|
|
199
|
+
else if (block.type === 'tool_use' && typeof block.id === 'string' && block.id !== '') {
|
|
200
|
+
const name = typeof block.name === 'string' && block.name !== '' ? block.name : 'unknown';
|
|
201
|
+
step.blocks.push({ type: 'tool-call', id: block.id, name, arguments: JSON.stringify(block.input ?? {}) });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
calls.register(step);
|
|
205
|
+
};
|
|
206
|
+
const attachResults = (content) => {
|
|
207
|
+
for (const block of content) {
|
|
208
|
+
if (!isRecord(block) || block.type !== 'tool_result' || typeof block.tool_use_id !== 'string')
|
|
209
|
+
continue;
|
|
210
|
+
calls.attach(block.tool_use_id, toolResultText(block.content), block.is_error === true);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
const acceptUserText = (record, content) => {
|
|
214
|
+
const raw = textOf(content);
|
|
215
|
+
const text = stripSystemReminders(raw);
|
|
216
|
+
if (record.isMeta === true) {
|
|
217
|
+
// Machine context the model saw mid-turn (skill bodies, image notes,
|
|
218
|
+
// "Continue from where you left off."): it enters the NEXT step as a
|
|
219
|
+
// user input instead of opening a turn. Local-command caveats carry
|
|
220
|
+
// no model reply and are dropped.
|
|
221
|
+
if (text === '' || isInjectedText(raw)) {
|
|
222
|
+
stats.filtered += 1;
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
pendingInputs.push(text);
|
|
226
|
+
stats.meta += 1;
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (isCommandEcho(text)) {
|
|
230
|
+
openTurn(commandPrompt(text));
|
|
231
|
+
commandTurns.add(current);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (text === '')
|
|
235
|
+
return;
|
|
236
|
+
if (isInjectedText(text)) {
|
|
237
|
+
stats.filtered += 1;
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
// Mid-turn context that no step consumed before the next prompt is
|
|
241
|
+
// stale; the prompt starts over.
|
|
242
|
+
stats.filtered += pendingInputs.length;
|
|
243
|
+
pendingInputs = [];
|
|
244
|
+
openTurn(text);
|
|
245
|
+
};
|
|
246
|
+
for (const record of records) {
|
|
247
|
+
const type = record.type;
|
|
248
|
+
if (type === 'custom-title' && typeof record.customTitle === 'string' && record.customTitle.trim() !== '')
|
|
249
|
+
renamedTitle = record.customTitle;
|
|
250
|
+
else if (type === 'summary' && typeof record.summary === 'string' && record.summary.trim() !== '')
|
|
251
|
+
legacyTitle = record.summary;
|
|
252
|
+
else if (type === 'ai-title' && typeof record.aiTitle === 'string' && record.aiTitle.trim() !== '')
|
|
253
|
+
aiTitle ??= record.aiTitle;
|
|
254
|
+
if (type !== 'user' && type !== 'assistant')
|
|
255
|
+
continue;
|
|
256
|
+
if (record.isSidechain === true)
|
|
257
|
+
continue;
|
|
258
|
+
const message = record.message;
|
|
259
|
+
if (!isRecord(message))
|
|
260
|
+
continue;
|
|
261
|
+
// Claude Code writes the authoritative cwd on every message line; the
|
|
262
|
+
// dash-munged directory name cannot preserve `_`/`.`/`-`.
|
|
263
|
+
if (typeof record.cwd === 'string' && record.cwd !== '')
|
|
264
|
+
lineCwd = record.cwd;
|
|
265
|
+
if (startedAt === 0)
|
|
266
|
+
startedAt = toMillis(record.timestamp);
|
|
267
|
+
if (type === 'user') {
|
|
268
|
+
if (isToolResultLine(message.content)) {
|
|
269
|
+
attachResults(message.content);
|
|
270
|
+
}
|
|
271
|
+
else if (record.isCompactSummary === true) {
|
|
272
|
+
// Compaction boundary: the summary becomes a native checkpoint in
|
|
273
|
+
// front of the next turn; the turn in progress is over.
|
|
274
|
+
const summary = stripSystemReminders(textOf(message.content));
|
|
275
|
+
if (summary !== '') {
|
|
276
|
+
pendingCompaction = lastModel === undefined ? { summary } : { summary, model: lastModel };
|
|
277
|
+
current = undefined;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
acceptUserText(record, message.content);
|
|
282
|
+
}
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
appendAssistant(message);
|
|
286
|
+
}
|
|
287
|
+
stats.filtered += pendingInputs.length;
|
|
288
|
+
// The transcript stopped right at a boundary: keep the checkpoint.
|
|
289
|
+
if (pendingCompaction !== undefined)
|
|
290
|
+
turns.push({ prompt: '', compaction: pendingCompaction, steps: [] });
|
|
291
|
+
// A response that produced nothing importable leaves no step behind, and
|
|
292
|
+
// a slash command the model never answered (/model, /clear, …) is local
|
|
293
|
+
// housekeeping, not conversation.
|
|
294
|
+
for (const turn of turns)
|
|
295
|
+
turn.steps = turn.steps.filter(step => step.blocks.length > 0 || step.inputs.length > 0);
|
|
296
|
+
turns = turns.filter(turn => {
|
|
297
|
+
if (commandTurns.has(turn) && turn.steps.length === 0 && turn.compaction === undefined) {
|
|
298
|
+
stats.filtered += 1;
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
return turn.prompt !== '' || turn.steps.length > 0 || turn.compaction !== undefined;
|
|
302
|
+
});
|
|
303
|
+
for (const turn of turns)
|
|
304
|
+
dropGhostRetries(turn.steps);
|
|
305
|
+
stats.droppedToolResults = calls.orphans + closeToolPairs(turns);
|
|
306
|
+
if (!turns.some(turn => turn.prompt !== ''))
|
|
307
|
+
return undefined;
|
|
308
|
+
// cwd precedence: the per-line `cwd` field → the first prompt's
|
|
309
|
+
// "Primary working directory:" note → the unmunged directory name.
|
|
310
|
+
let cwd = lineCwd ?? input.fallbackCwd;
|
|
311
|
+
if (lineCwd === undefined) {
|
|
312
|
+
const noted = turns.find(turn => turn.prompt.includes('Primary working directory:'));
|
|
313
|
+
const match = noted === undefined ? null : /Primary working directory: (\S+)/u.exec(noted.prompt);
|
|
314
|
+
if (match !== null)
|
|
315
|
+
cwd = match[1];
|
|
316
|
+
}
|
|
317
|
+
const explicit = normalizeTitle(renamedTitle ?? legacyTitle ?? aiTitle);
|
|
318
|
+
const firstPrompt = turns.find(turn => turn.prompt !== '' && !commandTurns.has(turn))?.prompt;
|
|
319
|
+
const title = explicit !== '' ? explicit : normalizeTitle(firstPrompt === undefined ? undefined : unwrapUserText(firstPrompt));
|
|
320
|
+
return {
|
|
321
|
+
sourceId: input.fileStem,
|
|
322
|
+
cwd,
|
|
323
|
+
...(title === '' ? {} : { title }),
|
|
324
|
+
titleExplicit: explicit !== '',
|
|
325
|
+
startedAt,
|
|
326
|
+
turns,
|
|
327
|
+
stats,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/codex.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAmC,gBAAgB,EAA+D,MAAM,aAAa,CAAA;AAyCjJ,eAAO,MAAM,YAAY,EAAE,gBA6C1B,CAAA"}
|