@deepseek-harness-tui/dsh-tui 0.11.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -20
- package/assets/whale-girl/whale-girl-dark.png +0 -0
- package/assets/whale-girl/whale-girl-happy.png +0 -0
- package/assets/whale-girl/whale-girl.png +0 -0
- package/bin/dsh-tui.js +63 -3
- package/cordis.patch.yml +43 -20
- package/cordis.yml +6 -4
- package/lib/settings.json +1272 -0
- package/lib/types/activityPrefs.d.ts +24 -0
- package/lib/types/activityPrefs.d.ts.map +1 -1
- package/lib/types/activityPrefs.js +50 -1
- package/lib/types/adapter/channel/state.d.ts.map +1 -1
- package/lib/types/adapter/channel/state.js +3 -1
- package/lib/types/adapter/channel/ui-policy.d.ts +9 -2
- package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
- package/lib/types/adapter/channel/ui-policy.js +14 -1
- package/lib/types/adapter/kernel/replay.d.ts.map +1 -1
- package/lib/types/adapter/kernel/replay.js +2 -0
- package/lib/types/adapter/ports/channel-display.d.ts +12 -0
- package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-session.d.ts +38 -0
- package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-settings.d.ts +12 -0
- package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-ui.d.ts +53 -7
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +43 -12
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel.d.ts +4 -1
- package/lib/types/adapter/ports/channel.d.ts.map +1 -1
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +2 -0
- package/lib/types/components/ActivityLine.d.ts +7 -2
- package/lib/types/components/ActivityLine.d.ts.map +1 -1
- package/lib/types/components/ActivityLine.js +0 -8
- package/lib/types/components/BalanceReportRow.d.ts +10 -2
- package/lib/types/components/BalanceReportRow.d.ts.map +1 -1
- package/lib/types/components/BalanceReportRow.js +18 -4
- package/lib/types/components/CompactionStatusRow.d.ts +24 -0
- package/lib/types/components/CompactionStatusRow.d.ts.map +1 -0
- package/lib/types/components/CompactionStatusRow.js +72 -0
- package/lib/types/components/GoalTodoPanel.js +2 -2
- package/lib/types/components/HelpMenu.d.ts +2 -2
- package/lib/types/components/HelpMenu.d.ts.map +1 -1
- package/lib/types/components/HelpMenu.js +5 -4
- package/lib/types/components/InlineMathParagraph.d.ts +22 -0
- package/lib/types/components/InlineMathParagraph.d.ts.map +1 -0
- package/lib/types/components/InlineMathParagraph.js +178 -0
- package/lib/types/components/LogoV2.d.ts +41 -3
- package/lib/types/components/LogoV2.d.ts.map +1 -1
- package/lib/types/components/LogoV2.js +148 -24
- package/lib/types/components/Markdown.d.ts +10 -3
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +47 -14
- package/lib/types/components/MathBlock.d.ts +13 -0
- package/lib/types/components/MathBlock.d.ts.map +1 -0
- package/lib/types/components/MathBlock.js +136 -0
- package/lib/types/components/MessageList.d.ts +10 -1
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +15 -5
- package/lib/types/components/MigratePicker.d.ts +30 -0
- package/lib/types/components/MigratePicker.d.ts.map +1 -0
- package/lib/types/components/MigratePicker.js +38 -0
- package/lib/types/components/PromptInput.d.ts +17 -0
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +96 -9
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +3 -1
- package/lib/types/components/StarPrompt.d.ts +53 -0
- package/lib/types/components/StarPrompt.d.ts.map +1 -0
- package/lib/types/components/StarPrompt.js +281 -0
- package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
- package/lib/types/components/StreamingMarkdown.js +20 -3
- package/lib/types/components/SubagentCard.d.ts.map +1 -1
- package/lib/types/components/SubagentCard.js +12 -6
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +8 -3
- package/lib/types/components/TimelineRail.d.ts.map +1 -1
- package/lib/types/components/TimelineRail.js +9 -1
- package/lib/types/components/Whale.d.ts +17 -8
- package/lib/types/components/Whale.d.ts.map +1 -1
- package/lib/types/components/Whale.js +25 -15
- package/lib/types/components/WhaleGirl.d.ts +29 -0
- package/lib/types/components/WhaleGirl.d.ts.map +1 -0
- package/lib/types/components/WhaleGirl.js +32 -0
- package/lib/types/components/WorkingSpinner.d.ts +4 -1
- package/lib/types/components/WorkingSpinner.d.ts.map +1 -1
- package/lib/types/components/WorkingSpinner.js +2 -2
- package/lib/types/components/bigfont.d.ts +47 -18
- package/lib/types/components/bigfont.d.ts.map +1 -1
- package/lib/types/components/bigfont.js +55 -40
- package/lib/types/components/design-system/HintLine.d.ts +1 -2
- package/lib/types/components/design-system/HintLine.d.ts.map +1 -1
- package/lib/types/components/design-system/HintLine.js +1 -2
- package/lib/types/components/design-system/ThemeProvider.d.ts +6 -0
- package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
- package/lib/types/components/design-system/ThemeProvider.js +40 -1
- package/lib/types/components/maidPortrait.d.ts +44 -0
- package/lib/types/components/maidPortrait.d.ts.map +1 -0
- package/lib/types/components/maidPortrait.js +178 -0
- package/lib/types/components/mathPreview.d.ts +25 -0
- package/lib/types/components/mathPreview.d.ts.map +1 -0
- package/lib/types/components/mathPreview.js +48 -0
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts +2 -1
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantThinkingMessage.js +4 -2
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -2
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +31 -26
- package/lib/types/components/messages/TranscriptImages.d.ts.map +1 -1
- package/lib/types/components/messages/TranscriptImages.js +11 -1
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +14 -2
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +80 -38
- package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
- package/lib/types/components/questions/PlanReviewPanel.js +3 -3
- package/lib/types/components/sessions/ForeignSessionRow.d.ts +34 -0
- package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -0
- package/lib/types/components/sessions/ForeignSessionRow.js +43 -0
- package/lib/types/components/sessions/SourceTabs.d.ts +52 -0
- package/lib/types/components/sessions/SourceTabs.d.ts.map +1 -0
- package/lib/types/components/sessions/SourceTabs.js +70 -0
- package/lib/types/components/splashEggs.d.ts +56 -0
- package/lib/types/components/splashEggs.d.ts.map +1 -0
- package/lib/types/components/splashEggs.js +67 -0
- package/lib/types/components/splashFonts.d.ts +119 -0
- package/lib/types/components/splashFonts.d.ts.map +1 -0
- package/lib/types/components/splashFonts.js +267 -0
- package/lib/types/components/splashLayout.d.ts +41 -0
- package/lib/types/components/splashLayout.d.ts.map +1 -0
- package/lib/types/components/splashLayout.js +40 -0
- package/lib/types/components/whaleGirlSprite.d.ts +17 -0
- package/lib/types/components/whaleGirlSprite.d.ts.map +1 -0
- package/lib/types/components/whaleGirlSprite.js +47 -0
- package/lib/types/deepseekPricing.d.ts +74 -0
- package/lib/types/deepseekPricing.d.ts.map +1 -1
- package/lib/types/deepseekPricing.js +110 -11
- package/lib/types/dsh-adapter/activity-store.d.ts +221 -0
- package/lib/types/dsh-adapter/activity-store.d.ts.map +1 -0
- package/lib/types/dsh-adapter/activity-store.js +359 -0
- package/lib/types/dsh-adapter/channel/action-readiness.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/action-readiness.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/action-readiness.js +6 -1
- package/lib/types/dsh-adapter/channel/background-action.d.ts +2 -1
- package/lib/types/dsh-adapter/channel/background-action.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/background-action.js +2 -0
- package/lib/types/dsh-adapter/channel/binding-events.d.ts +15 -14
- package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +70 -21
- package/lib/types/dsh-adapter/channel/compaction.d.ts +2 -2
- package/lib/types/dsh-adapter/channel/compaction.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/compaction.js +35 -4
- package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/local-actions.js +6 -1
- package/lib/types/dsh-adapter/channel/model-switch.d.ts +1 -2
- package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-switch.js +6 -2
- package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/paths.js +7 -1
- package/lib/types/dsh-adapter/channel/preferences.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/preferences.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/preferences.js +16 -0
- package/lib/types/dsh-adapter/channel/projection.d.ts +1 -2
- package/lib/types/dsh-adapter/channel/projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection.js +127 -17
- package/lib/types/dsh-adapter/channel/question-record.d.ts +76 -0
- package/lib/types/dsh-adapter/channel/question-record.d.ts.map +1 -0
- package/lib/types/dsh-adapter/channel/question-record.js +107 -0
- package/lib/types/dsh-adapter/channel/session-adoption.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-adoption.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-adoption.js +1 -0
- package/lib/types/dsh-adapter/channel/session-lineage.d.ts +42 -0
- package/lib/types/dsh-adapter/channel/session-lineage.d.ts.map +1 -0
- package/lib/types/dsh-adapter/channel/session-lineage.js +51 -0
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +3 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.js +10 -3
- package/lib/types/dsh-adapter/channel/session-metadata.d.ts +2 -1
- package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-metadata.js +43 -9
- package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.js +7 -1
- package/lib/types/dsh-adapter/channel/session-resume.d.ts +2 -1
- package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.js +5 -2
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +8 -0
- package/lib/types/dsh-adapter/channel/state.d.ts +19 -1
- package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/state.js +8 -3
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +32 -17
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-projection.js +309 -8
- package/lib/types/dsh-adapter/channel/types.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.d.ts +1 -1
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +34 -18
- package/lib/types/dsh-adapter/compat/index.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/index.js +1 -1
- package/lib/types/dsh-adapter/compat/messages.d.ts +6 -0
- package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/messages.js +9 -0
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts +18 -0
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.js +18 -3
- package/lib/types/dsh-adapter/compat/settings.d.ts +2 -0
- package/lib/types/dsh-adapter/compat/settings.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/settings.js +14 -0
- package/lib/types/dsh-adapter/contract.d.ts +5 -4
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +9 -5
- package/lib/types/dsh-adapter/index.d.ts +36 -1
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +22 -6
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.d.ts +3 -0
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.js +131 -0
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.d.ts +17 -0
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.js +329 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.d.ts +3 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.js +102 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.parse.d.ts +16 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.parse.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/codex.parse.js +289 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.d.ts +3 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.js +117 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.d.ts +13 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.js +178 -0
- package/lib/types/dsh-adapter/migrate/adapters/omp.d.ts +3 -0
- package/lib/types/dsh-adapter/migrate/adapters/omp.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/omp.js +133 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan-fs.d.ts +60 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan-fs.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan-fs.js +178 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan.d.ts +8 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/scan.js +40 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.d.ts +3 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.js +93 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.d.ts +9 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.js +89 -0
- package/lib/types/dsh-adapter/migrate/bin-path.d.ts +6 -0
- package/lib/types/dsh-adapter/migrate/bin-path.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/bin-path.js +30 -0
- package/lib/types/dsh-adapter/migrate/browse.d.ts +42 -0
- package/lib/types/dsh-adapter/migrate/browse.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/browse.js +90 -0
- package/lib/types/dsh-adapter/migrate/cli.d.ts +9 -0
- package/lib/types/dsh-adapter/migrate/cli.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/cli.js +106 -0
- package/lib/types/dsh-adapter/migrate/import-one.d.ts +89 -0
- package/lib/types/dsh-adapter/migrate/import-one.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/import-one.js +133 -0
- package/lib/types/dsh-adapter/migrate/index.d.ts +35 -0
- package/lib/types/dsh-adapter/migrate/index.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/index.js +107 -0
- package/lib/types/dsh-adapter/migrate/parse/injection.d.ts +40 -0
- package/lib/types/dsh-adapter/migrate/parse/injection.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/parse/injection.js +127 -0
- package/lib/types/dsh-adapter/migrate/parse/jsonl.d.ts +28 -0
- package/lib/types/dsh-adapter/migrate/parse/jsonl.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/parse/jsonl.js +40 -0
- package/lib/types/dsh-adapter/migrate/parse/role-turns.d.ts +28 -0
- package/lib/types/dsh-adapter/migrate/parse/role-turns.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/parse/role-turns.js +50 -0
- package/lib/types/dsh-adapter/migrate/parse/title.d.ts +18 -0
- package/lib/types/dsh-adapter/migrate/parse/title.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/parse/title.js +29 -0
- package/lib/types/dsh-adapter/migrate/parse/tools.d.ts +62 -0
- package/lib/types/dsh-adapter/migrate/parse/tools.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/parse/tools.js +110 -0
- package/lib/types/dsh-adapter/migrate/picker.d.ts +64 -0
- package/lib/types/dsh-adapter/migrate/picker.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/picker.js +86 -0
- package/lib/types/dsh-adapter/migrate/recent-agents.d.ts +40 -0
- package/lib/types/dsh-adapter/migrate/recent-agents.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/recent-agents.js +100 -0
- package/lib/types/dsh-adapter/migrate/sessionize.d.ts +39 -0
- package/lib/types/dsh-adapter/migrate/sessionize.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/sessionize.js +271 -0
- package/lib/types/dsh-adapter/migrate/types.d.ts +176 -0
- package/lib/types/dsh-adapter/migrate/types.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/types.js +11 -0
- package/lib/types/dsh-adapter/migrate/uuid.d.ts +7 -0
- package/lib/types/dsh-adapter/migrate/uuid.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/uuid.js +25 -0
- package/lib/types/dsh-adapter/plugin.d.ts +5 -3
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +168 -372
- package/lib/types/dsh-adapter/providerWizard.d.ts +17 -0
- package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
- package/lib/types/dsh-adapter/providerWizard.js +254 -66
- package/lib/types/dsh-adapter/questions.d.ts +22 -15
- package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/questions.js +47 -45
- package/lib/types/dsh-adapter/sessions/digest.d.ts +11 -6
- package/lib/types/dsh-adapter/sessions/digest.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessions/digest.js +20 -13
- package/lib/types/dsh-adapter/sessions/frames.d.ts +3 -1
- package/lib/types/dsh-adapter/sessions/frames.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessions/frames.js +5 -4
- package/lib/types/dsh-adapter/sessions/list.d.ts +6 -1
- package/lib/types/dsh-adapter/sessions/list.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessions/list.js +188 -164
- package/lib/types/dsh-adapter/sessions/recovery.d.ts +16 -0
- package/lib/types/dsh-adapter/sessions/recovery.d.ts.map +1 -0
- package/lib/types/dsh-adapter/sessions/recovery.js +108 -0
- package/lib/types/dsh-adapter/sessions/snapshot.d.ts +7 -0
- package/lib/types/dsh-adapter/sessions/snapshot.d.ts.map +1 -0
- package/lib/types/dsh-adapter/sessions/snapshot.js +90 -0
- package/lib/types/dsh-adapter/sessions/store.d.ts +10 -4
- package/lib/types/dsh-adapter/sessions/store.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessions/store.js +62 -25
- package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +7 -4
- package/lib/types/dsh-adapter/sideQuestion.d.ts +41 -2
- package/lib/types/dsh-adapter/sideQuestion.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sideQuestion.js +98 -2
- package/lib/types/dsh-adapter/subagents.d.ts +44 -6
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +163 -26
- package/lib/types/herdr.d.ts +2 -0
- package/lib/types/herdr.d.ts.map +1 -1
- package/lib/types/herdr.js +9 -3
- package/lib/types/history.d.ts +13 -1
- package/lib/types/history.d.ts.map +1 -1
- package/lib/types/history.js +15 -2
- package/lib/types/i18n.d.ts +512 -41
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +199 -20
- package/lib/types/ink/components/App.d.ts +2 -2
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +5 -1
- package/lib/types/ink/components/Image.d.ts +14 -1
- package/lib/types/ink/components/Image.d.ts.map +1 -1
- package/lib/types/ink/components/Image.js +2 -2
- package/lib/types/ink/events/input-event.js +3 -3
- package/lib/types/ink/hooks/use-terminal-images.d.ts +12 -0
- package/lib/types/ink/hooks/use-terminal-images.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-terminal-images.js +13 -0
- package/lib/types/ink/ink.d.ts +6 -0
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +16 -1
- package/lib/types/ink/kitty-graphics.d.ts +44 -3
- package/lib/types/ink/kitty-graphics.d.ts.map +1 -1
- package/lib/types/ink/kitty-graphics.js +184 -23
- package/lib/types/ink/log-update.d.ts.map +1 -1
- package/lib/types/ink/log-update.js +19 -1
- package/lib/types/ink/output.d.ts +24 -2
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +83 -5
- package/lib/types/ink/parse-keypress.d.ts +26 -1
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +156 -13
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +8 -1
- package/lib/types/ink/screen.d.ts +24 -0
- package/lib/types/ink/screen.d.ts.map +1 -1
- package/lib/types/ink/screen.js +89 -0
- package/lib/types/ink/selection.d.ts +68 -18
- package/lib/types/ink/selection.d.ts.map +1 -1
- package/lib/types/ink/selection.js +178 -31
- package/lib/types/ink/sixel-codec.d.ts +12 -1
- package/lib/types/ink/sixel-codec.d.ts.map +1 -1
- package/lib/types/ink/sixel-codec.js +29 -5
- package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
- package/lib/types/ink/sixel-graphics.js +5 -3
- package/lib/types/ink/styles.d.ts +9 -0
- package/lib/types/ink/styles.d.ts.map +1 -1
- package/lib/types/ink/terminal-image.d.ts +8 -0
- package/lib/types/ink/terminal-image.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.d.ts +7 -1
- package/lib/types/ink/terminal-querier.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.js +12 -2
- package/lib/types/ink/timeline-rail.d.ts +5 -0
- package/lib/types/ink/timeline-rail.d.ts.map +1 -1
- package/lib/types/math/inline-layout.d.ts +29 -0
- package/lib/types/math/inline-layout.d.ts.map +1 -0
- package/lib/types/math/inline-layout.js +106 -0
- package/lib/types/math/layout.d.ts +58 -0
- package/lib/types/math/layout.d.ts.map +1 -0
- package/lib/types/math/layout.js +59 -0
- package/lib/types/math/renderer.d.ts +64 -0
- package/lib/types/math/renderer.d.ts.map +1 -0
- package/lib/types/math/renderer.js +256 -0
- package/lib/types/screens/Chat.d.ts +17 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +618 -57
- package/lib/types/screens/SessionSupervisor.d.ts +2 -1
- package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/SessionSupervisor.js +156 -19
- package/lib/types/screens/Settings.d.ts.map +1 -1
- package/lib/types/screens/Settings.js +49 -11
- package/lib/types/screens/StatusLine.d.ts +5 -1
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +47 -17
- package/lib/types/screens/chatOverlay.d.ts +5 -0
- package/lib/types/screens/chatOverlay.d.ts.map +1 -1
- package/lib/types/screens/chatOverlay.js +1 -0
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +47 -0
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -0
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +65 -0
- package/lib/types/screens/sessionSupervisor/model.d.ts +12 -0
- package/lib/types/screens/sessionSupervisor/model.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/model.js +26 -0
- package/lib/types/screens/sessionSupervisor/useForeignSessions.d.ts +107 -0
- package/lib/types/screens/sessionSupervisor/useForeignSessions.d.ts.map +1 -0
- package/lib/types/screens/sessionSupervisor/useForeignSessions.js +312 -0
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +4 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +97 -14
- package/lib/types/sessionHistory.d.ts +2 -2
- package/lib/types/sessionHistory.d.ts.map +1 -1
- package/lib/types/sessionHistory.js +31 -5
- package/lib/types/settings/definitions.d.ts +681 -0
- package/lib/types/settings/definitions.d.ts.map +1 -0
- package/lib/types/settings/definitions.js +511 -0
- package/lib/types/starAction.d.ts +44 -0
- package/lib/types/starAction.d.ts.map +1 -0
- package/lib/types/starAction.js +52 -0
- package/lib/types/terminal-utils/latex.d.ts +10 -0
- package/lib/types/terminal-utils/latex.d.ts.map +1 -0
- package/lib/types/terminal-utils/latex.js +1417 -0
- package/lib/types/terminal-utils/markdown.d.ts +3 -1
- package/lib/types/terminal-utils/markdown.d.ts.map +1 -1
- package/lib/types/terminal-utils/markdown.js +26 -1
- package/lib/types/terminal-utils/math.d.ts +66 -0
- package/lib/types/terminal-utils/math.d.ts.map +1 -0
- package/lib/types/terminal-utils/math.js +337 -0
- package/lib/types/tips.d.ts.map +1 -1
- package/lib/types/tips.js +6 -0
- package/lib/types/tuiDisplayPrefs.d.ts +67 -0
- package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
- package/lib/types/tuiDisplayPrefs.js +59 -0
- package/lib/types/ui.d.ts +1 -1
- package/lib/types/ui.d.ts.map +1 -1
- package/lib/types/ui.js +1 -1
- package/lib/types/usageStats.d.ts +98 -0
- package/lib/types/usageStats.d.ts.map +1 -0
- package/lib/types/usageStats.js +169 -0
- package/lib/types/utils/bmp.d.ts +17 -0
- package/lib/types/utils/bmp.d.ts.map +1 -0
- package/lib/types/utils/bmp.js +154 -0
- package/lib/types/utils/clipboard.d.ts +14 -2
- package/lib/types/utils/clipboard.d.ts.map +1 -1
- package/lib/types/utils/clipboard.js +143 -8
- package/lib/types/utils/fold-long-lines.d.ts +1 -1
- package/lib/types/utils/fold-long-lines.d.ts.map +1 -1
- package/lib/types/utils/fold-long-lines.js +3 -2
- package/lib/types/utils/keymap.d.ts +4 -1
- package/lib/types/utils/keymap.d.ts.map +1 -1
- package/lib/types/utils/keymap.js +8 -0
- package/lib/types/utils/modifiers.d.ts +4 -3
- package/lib/types/utils/modifiers.d.ts.map +1 -1
- package/lib/types/utils/modifiers.js +4 -3
- package/lib/types/working-activity.d.ts +10 -9
- package/lib/types/working-activity.d.ts.map +1 -1
- package/lib/types/working-activity.js +17 -10
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/LICENSE +202 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/NOTICE +20 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/index.d.ts +16 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/bundled-packages.json +4 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/index.mjs +20 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/index.mjs.LEGAL.txt +35 -0
- package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/package.json +29 -0
- package/package.json +117 -99
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +0 -19
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts.map +0 -1
- package/lib/types/components/design-system/KeyboardShortcutHint.js +0 -14
- package/lib/types/dsh-adapter/channel/activity.d.ts +0 -20
- package/lib/types/dsh-adapter/channel/activity.d.ts.map +0 -1
- package/lib/types/dsh-adapter/channel/activity.js +0 -113
- package/lib/types/terminal-utils/terminal.d.ts +0 -18
- package/lib/types/terminal-utils/terminal.d.ts.map +0 -1
- package/lib/types/terminal-utils/terminal.js +0 -96
|
@@ -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"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex adapter: `~/.codex/sessions/YYYY/MM/DD/rollout-<id>.jsonl`. File
|
|
3
|
+
* discovery lives here; the rollout format is parsed by the pure
|
|
4
|
+
* codex.parse.ts. The browse scan runs the same parser over the rollout's
|
|
5
|
+
* head: the first session_meta, the first real prompt and the sub-agent
|
|
6
|
+
* marker all sit there.
|
|
7
|
+
*
|
|
8
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/adapters/codex
|
|
9
|
+
*/
|
|
10
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
11
|
+
import { homedir } from 'node:os';
|
|
12
|
+
import { basename, join } from 'node:path';
|
|
13
|
+
import { parseCodexRollout } from './codex.parse.js';
|
|
14
|
+
import { countEntries } from './scan.js';
|
|
15
|
+
import { fingerprintOf, loadText, runScan, walkFiles, withHead } from './scan-fs.js';
|
|
16
|
+
const isRollout = (name) => name.startsWith('rollout-') && name.endsWith('.jsonl');
|
|
17
|
+
const WALK = { maxDepth: 5, match: isRollout };
|
|
18
|
+
/** The rollout's stable source id: the uuid in its file name. */
|
|
19
|
+
function sourceIdOf(path) {
|
|
20
|
+
const match = /rollout-.*-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/u.exec(path);
|
|
21
|
+
// Fallback is the bare file name, never the whole path: the id is the dedupe
|
|
22
|
+
// key, so an absolute path would make it depend on where the store lives.
|
|
23
|
+
return match?.[1] ?? basename(path);
|
|
24
|
+
}
|
|
25
|
+
function readOne(path) {
|
|
26
|
+
let raw;
|
|
27
|
+
try {
|
|
28
|
+
raw = readFileSync(path, 'utf8');
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return parseCodexRollout({ raw, sourceId: sourceIdOf(path) });
|
|
34
|
+
}
|
|
35
|
+
async function summarize({ ref, fp }) {
|
|
36
|
+
const session = await withHead(ref, fp.size, raw => parseCodexRollout({ raw, sourceId: sourceIdOf(ref) }));
|
|
37
|
+
if (session === undefined)
|
|
38
|
+
return null;
|
|
39
|
+
return {
|
|
40
|
+
agentId: 'codex',
|
|
41
|
+
sessionKey: session.sourceId,
|
|
42
|
+
ref,
|
|
43
|
+
title: session.title ?? '',
|
|
44
|
+
cwd: session.cwd,
|
|
45
|
+
lastMessageAt: fp.mtimeMs,
|
|
46
|
+
createdAt: session.startedAt || fp.mtimeMs,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export const codexAdapter = {
|
|
50
|
+
id: 'codex',
|
|
51
|
+
label: 'Codex',
|
|
52
|
+
roots: () => [join(homedir(), '.codex', 'sessions')],
|
|
53
|
+
discover() {
|
|
54
|
+
const roots = this.roots();
|
|
55
|
+
const sessions = [];
|
|
56
|
+
const walk = (dir, depth) => {
|
|
57
|
+
if (depth > 5)
|
|
58
|
+
return;
|
|
59
|
+
let entries;
|
|
60
|
+
try {
|
|
61
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
for (const entry of entries) {
|
|
67
|
+
const path = join(dir, entry.name);
|
|
68
|
+
if (entry.isDirectory())
|
|
69
|
+
walk(path, depth + 1);
|
|
70
|
+
else if (entry.isFile() && isRollout(entry.name)) {
|
|
71
|
+
try {
|
|
72
|
+
if (statSync(path).size > 64 * 1024 * 1024)
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const session = readOne(path);
|
|
79
|
+
if (session !== undefined)
|
|
80
|
+
sessions.push(session);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
for (const root of roots)
|
|
85
|
+
walk(root, 0);
|
|
86
|
+
return { roots, sessions };
|
|
87
|
+
},
|
|
88
|
+
count() {
|
|
89
|
+
return countEntries(this.roots(), { maxDepth: WALK.maxDepth, fileMatch: WALK.match });
|
|
90
|
+
},
|
|
91
|
+
walk: WALK,
|
|
92
|
+
async scan(options) {
|
|
93
|
+
const files = walkFiles(this.roots(), { ...WALK, signal: options?.signal });
|
|
94
|
+
return runScan(files, file => file.path, fingerprintOf, options, summarize);
|
|
95
|
+
},
|
|
96
|
+
async load(ref) {
|
|
97
|
+
const raw = await loadText(ref);
|
|
98
|
+
if (typeof raw !== 'string')
|
|
99
|
+
return raw;
|
|
100
|
+
return parseCodexRollout({ raw, sourceId: sourceIdOf(ref) }) ?? { skip: 'not-a-session' };
|
|
101
|
+
},
|
|
102
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MigrationSession } from '../types.js';
|
|
2
|
+
/** What the adapter knows about a rollout besides its text. */
|
|
3
|
+
export interface CodexRolloutInput {
|
|
4
|
+
readonly raw: string;
|
|
5
|
+
/** The rollout's stable source id (the uuid in its file name). */
|
|
6
|
+
readonly sourceId: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Parse one Codex rollout.
|
|
10
|
+
* @returns The session, or undefined when it records no cwd or no prompt, or
|
|
11
|
+
* is a sub-agent thread (`thread_source: 'subagent'` / `source.subagent`):
|
|
12
|
+
* those are spawned by a main session and are not conversations of their
|
|
13
|
+
* own. Forks (`forked_from_id` without the sub-agent marker) are kept.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseCodexRollout(input: CodexRolloutInput): MigrationSession | undefined;
|
|
16
|
+
//# sourceMappingURL=codex.parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.parse.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/codex.parse.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAA4C,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE7F,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AA4ED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAkKxF"}
|