@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,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OMP adapter: `~/.omp/agent/sessions/--<munged-cwd>--/<timestamp>_<id>.jsonl`.
|
|
3
|
+
* OMP shares the DSH lineage: a `session` header line plus `message` lines
|
|
4
|
+
* whose `message.content` block shape is identical to ours, so this adapter
|
|
5
|
+
* is a near-direct mapping.
|
|
6
|
+
*
|
|
7
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/adapters/omp
|
|
8
|
+
*/
|
|
9
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
10
|
+
import { homedir } from 'node:os';
|
|
11
|
+
import { basename, join } from 'node:path';
|
|
12
|
+
import { emptyStats, fromRoleTurns } from '../parse/role-turns.js';
|
|
13
|
+
import { countEntries } from './scan.js';
|
|
14
|
+
function blocksText(content, want) {
|
|
15
|
+
if (!Array.isArray(content))
|
|
16
|
+
return '';
|
|
17
|
+
const parts = [];
|
|
18
|
+
for (const block of content) {
|
|
19
|
+
if (block !== null && typeof block === 'object' && want.includes(block.type) && typeof block.text === 'string' && block.text !== '') {
|
|
20
|
+
parts.push(block.text);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return parts.join('\n\n');
|
|
24
|
+
}
|
|
25
|
+
function toMillis(iso) {
|
|
26
|
+
return typeof iso === 'string' ? Date.parse(iso) || 0 : 0;
|
|
27
|
+
}
|
|
28
|
+
function readOne(path) {
|
|
29
|
+
let lines;
|
|
30
|
+
try {
|
|
31
|
+
lines = readFileSync(path, 'utf8').split('\n');
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
// basename(): join() is `\`-separated on Windows, where split('/') returned
|
|
37
|
+
// the whole path and the fallback id stopped being stable across moves.
|
|
38
|
+
const file = basename(path);
|
|
39
|
+
const nameMatch = /^[\dT:.Z-]*_([0-9a-zA-Z-]+)\.jsonl$/u.exec(file);
|
|
40
|
+
const sourceId = nameMatch?.[1] ?? file;
|
|
41
|
+
let cwd;
|
|
42
|
+
let startedAt = 0;
|
|
43
|
+
let title;
|
|
44
|
+
const turns = [];
|
|
45
|
+
for (const line of lines) {
|
|
46
|
+
if (line === '')
|
|
47
|
+
continue;
|
|
48
|
+
let entry;
|
|
49
|
+
try {
|
|
50
|
+
entry = JSON.parse(line);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
// A legal `null` (or scalar) line is not a record; reading .type on it
|
|
56
|
+
// would throw and kill the whole scan (codex adversarial review).
|
|
57
|
+
if (entry === null || typeof entry !== 'object')
|
|
58
|
+
continue;
|
|
59
|
+
const time = toMillis(entry.timestamp);
|
|
60
|
+
if (entry.type === 'session' || entry.type === 'title') {
|
|
61
|
+
if (typeof entry.cwd === 'string' && entry.cwd !== '')
|
|
62
|
+
cwd = entry.cwd;
|
|
63
|
+
if (typeof entry.title === 'string' && entry.title !== '')
|
|
64
|
+
title = entry.title;
|
|
65
|
+
startedAt = startedAt || toMillis(entry.timestamp);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (entry.type !== 'message')
|
|
69
|
+
continue;
|
|
70
|
+
const message = entry.message;
|
|
71
|
+
if (!message || typeof message !== 'object')
|
|
72
|
+
continue; // !x also rejects JSON null (typeof null === 'object')
|
|
73
|
+
if (message.role === 'user') {
|
|
74
|
+
const text = blocksText(message.content, ['text']);
|
|
75
|
+
if (text === '')
|
|
76
|
+
continue;
|
|
77
|
+
turns.push({ role: 'user', text, time });
|
|
78
|
+
}
|
|
79
|
+
else if (message.role === 'assistant') {
|
|
80
|
+
const text = blocksText(message.content, ['text']);
|
|
81
|
+
const reasoning = blocksText(message.content, ['reasoning', 'thinking']);
|
|
82
|
+
if (text === '' && reasoning === '')
|
|
83
|
+
continue;
|
|
84
|
+
turns.push({ role: 'assistant', text, reasoning: reasoning === '' ? undefined : reasoning, time });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (turns.length === 0 || cwd === undefined)
|
|
88
|
+
return undefined;
|
|
89
|
+
return { sourceId, cwd, title, titleExplicit: false, startedAt: startedAt || turns[0].time, turns: fromRoleTurns(turns), stats: emptyStats() };
|
|
90
|
+
}
|
|
91
|
+
export const ompAdapter = {
|
|
92
|
+
id: 'omp',
|
|
93
|
+
label: 'OMP',
|
|
94
|
+
roots: () => [join(homedir(), '.omp', 'agent', 'sessions')],
|
|
95
|
+
discover() {
|
|
96
|
+
const roots = this.roots();
|
|
97
|
+
const sessions = [];
|
|
98
|
+
const walk = (dir, depth) => {
|
|
99
|
+
if (depth > 3)
|
|
100
|
+
return;
|
|
101
|
+
let entries;
|
|
102
|
+
try {
|
|
103
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
for (const entry of entries) {
|
|
109
|
+
const path = join(dir, entry.name);
|
|
110
|
+
if (entry.isDirectory())
|
|
111
|
+
walk(path, depth + 1);
|
|
112
|
+
else if (entry.isFile() && entry.name.endsWith('.jsonl')) {
|
|
113
|
+
try {
|
|
114
|
+
if (statSync(path).size > 64 * 1024 * 1024)
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const session = readOne(path);
|
|
121
|
+
if (session !== undefined)
|
|
122
|
+
sessions.push(session);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
for (const root of roots)
|
|
127
|
+
walk(root, 0);
|
|
128
|
+
return { roots, sessions };
|
|
129
|
+
},
|
|
130
|
+
count() {
|
|
131
|
+
return countEntries(this.roots(), { maxDepth: 3, fileMatch: name => name.endsWith('.jsonl') });
|
|
132
|
+
},
|
|
133
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Fingerprint, ForeignSessionSummary, LoadSkip, ScanEntry, ScanOptions } from '../types.js';
|
|
2
|
+
/** Largest artifact a full load reads (a larger one is reported, not read). */
|
|
3
|
+
export declare const MAX_ARTIFACT_BYTES: number;
|
|
4
|
+
/** Head windows tried in order: most prompts sit in the first few KB, but a
|
|
5
|
+
* large preamble (Codex base instructions, Claude snapshots) can push the
|
|
6
|
+
* first prompt further. */
|
|
7
|
+
export declare const HEAD_WINDOWS: readonly number[];
|
|
8
|
+
/** One file the walk matched. */
|
|
9
|
+
export interface WalkedFile {
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly dir: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
}
|
|
14
|
+
export interface WalkOptions {
|
|
15
|
+
readonly maxDepth: number;
|
|
16
|
+
readonly match: (name: string) => boolean;
|
|
17
|
+
/** Directory names never descended into. */
|
|
18
|
+
readonly skipDirs?: readonly string[];
|
|
19
|
+
readonly signal?: AbortSignal;
|
|
20
|
+
}
|
|
21
|
+
/** Walk roots breadth-unbounded, depth-bounded; unreadable directories cost themselves only. */
|
|
22
|
+
export declare function walkFiles(roots: readonly string[], options: WalkOptions): AsyncGenerator<WalkedFile>;
|
|
23
|
+
/** mtime + size of one file, or undefined when it vanished. */
|
|
24
|
+
export declare function fingerprintOf(path: string): Promise<Fingerprint | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* The first `bytes` of a file as whole lines: a window that ends mid-line
|
|
27
|
+
* drops the partial line (the cut happens on bytes, before decoding, so no
|
|
28
|
+
* character is split either).
|
|
29
|
+
*/
|
|
30
|
+
export declare function readHead(path: string, bytes: number): Promise<string>;
|
|
31
|
+
/** The last `bytes` of a file as whole lines (the partial first line is dropped). */
|
|
32
|
+
export declare function readTail(path: string, bytes: number, size: number): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Read growing head windows until `accept` finds what it needs (or the whole
|
|
35
|
+
* file has been seen).
|
|
36
|
+
* @returns The first accepted result, or the result for the largest window.
|
|
37
|
+
*/
|
|
38
|
+
export declare function withHead<T>(path: string, size: number, accept: (head: string, whole: boolean) => T | undefined): Promise<T | undefined>;
|
|
39
|
+
/** Whole text of an artifact for a full load, or the reason it cannot be read. */
|
|
40
|
+
export declare function loadText(path: string): Promise<string | LoadSkip>;
|
|
41
|
+
/** One candidate artifact of a scan. */
|
|
42
|
+
export interface ScanCandidate {
|
|
43
|
+
readonly ref: string;
|
|
44
|
+
readonly fp: Fingerprint;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The shared scan loop: fingerprint every artifact the walk finds, reuse the
|
|
48
|
+
* cached result for an unchanged one, summarize the rest, and report
|
|
49
|
+
* conversations as they are found.
|
|
50
|
+
*
|
|
51
|
+
* Per-artifact work runs in a bounded pool: a stat or a head read is IO-bound,
|
|
52
|
+
* and doing them one after another made a scan's wall time the sum of
|
|
53
|
+
* thousands of round trips. Entries therefore arrive unordered.
|
|
54
|
+
* @param files - The walk.
|
|
55
|
+
* @param refOf - Locator of the artifact a walked file belongs to (the file
|
|
56
|
+
* itself, or its session directory); duplicates are scanned once.
|
|
57
|
+
* @param fingerprint - mtime + size of an artifact, undefined when it vanished.
|
|
58
|
+
*/
|
|
59
|
+
export declare function runScan(files: AsyncIterable<WalkedFile>, refOf: (file: WalkedFile) => string, fingerprint: (ref: string) => Promise<Fingerprint | undefined>, options: ScanOptions | undefined, summarize: (candidate: ScanCandidate) => Promise<ForeignSessionSummary | null>): Promise<ScanEntry[]>;
|
|
60
|
+
//# sourceMappingURL=scan-fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-fs.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/scan-fs.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEvG,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB,QAAmB,CAAA;AAElD;;4BAE4B;AAC5B,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAA4B,CAAA;AAOtE,iCAAiC;AACjC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IACzC,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC9B;AAED,gGAAgG;AAChG,wBAAuB,SAAS,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC,UAAU,CAAC,CAwB3G;AAED,+DAA+D;AAC/D,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAOlF;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAW3E;AAED,qFAAqF;AACrF,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAWzF;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAO7I;AAED,kFAAkF;AAClF,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,CASvE;AAED,wCAAwC;AACxC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAA;CACzB;AAKD;;;;;;;;;;;;GAYG;AACH,wBAAsB,OAAO,CAC3B,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,EAChC,KAAK,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,MAAM,EACnC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,EAC9D,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,SAAS,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,GAC7E,OAAO,CAAC,SAAS,EAAE,CAAC,CAgCtB"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asynchronous file IO shared by the adapters' summary scans.
|
|
3
|
+
*
|
|
4
|
+
* A browse scan runs while the session screen is on screen, so it never
|
|
5
|
+
* blocks the render loop: directory walks use `fs/promises` and yield to the
|
|
6
|
+
* event loop every few entries, artifacts are read by bounded head/tail
|
|
7
|
+
* windows instead of whole, and an unchanged artifact (same mtime and size)
|
|
8
|
+
* is not read at all when the caller already has its summary.
|
|
9
|
+
*
|
|
10
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/adapters/scan-fs
|
|
11
|
+
*/
|
|
12
|
+
import { open, readdir, readFile, stat } from 'node:fs/promises';
|
|
13
|
+
import { join } from 'node:path';
|
|
14
|
+
/** Largest artifact a full load reads (a larger one is reported, not read). */
|
|
15
|
+
export const MAX_ARTIFACT_BYTES = 64 * 1024 * 1024;
|
|
16
|
+
/** Head windows tried in order: most prompts sit in the first few KB, but a
|
|
17
|
+
* large preamble (Codex base instructions, Claude snapshots) can push the
|
|
18
|
+
* first prompt further. */
|
|
19
|
+
export const HEAD_WINDOWS = [32 * 1024, 256 * 1024];
|
|
20
|
+
/** Entries handled between two event-loop yields. */
|
|
21
|
+
const YIELD_EVERY = 32;
|
|
22
|
+
const yieldToLoop = () => new Promise(resolve => setImmediate(resolve));
|
|
23
|
+
/** Walk roots breadth-unbounded, depth-bounded; unreadable directories cost themselves only. */
|
|
24
|
+
export async function* walkFiles(roots, options) {
|
|
25
|
+
let handled = 0;
|
|
26
|
+
const walk = async function* (dir, depth) {
|
|
27
|
+
if (depth > options.maxDepth)
|
|
28
|
+
return;
|
|
29
|
+
options.signal?.throwIfAborted();
|
|
30
|
+
let entries;
|
|
31
|
+
try {
|
|
32
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
for (const entry of entries) {
|
|
38
|
+
if (++handled % YIELD_EVERY === 0) {
|
|
39
|
+
await yieldToLoop();
|
|
40
|
+
options.signal?.throwIfAborted();
|
|
41
|
+
}
|
|
42
|
+
if (entry.isDirectory()) {
|
|
43
|
+
if (options.skipDirs?.includes(entry.name) !== true)
|
|
44
|
+
yield* walk(join(dir, entry.name), depth + 1);
|
|
45
|
+
}
|
|
46
|
+
else if (entry.isFile() && options.match(entry.name)) {
|
|
47
|
+
yield { path: join(dir, entry.name), dir, name: entry.name };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
for (const root of roots)
|
|
52
|
+
yield* walk(root, 0);
|
|
53
|
+
}
|
|
54
|
+
/** mtime + size of one file, or undefined when it vanished. */
|
|
55
|
+
export async function fingerprintOf(path) {
|
|
56
|
+
try {
|
|
57
|
+
const info = await stat(path);
|
|
58
|
+
return { mtimeMs: info.mtimeMs, size: info.size };
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The first `bytes` of a file as whole lines: a window that ends mid-line
|
|
66
|
+
* drops the partial line (the cut happens on bytes, before decoding, so no
|
|
67
|
+
* character is split either).
|
|
68
|
+
*/
|
|
69
|
+
export async function readHead(path, bytes) {
|
|
70
|
+
const handle = await open(path, 'r');
|
|
71
|
+
try {
|
|
72
|
+
const buffer = Buffer.alloc(bytes);
|
|
73
|
+
const { bytesRead } = await handle.read(buffer, 0, bytes, 0);
|
|
74
|
+
if (bytesRead < bytes)
|
|
75
|
+
return buffer.subarray(0, bytesRead).toString('utf8');
|
|
76
|
+
const lastNewline = buffer.lastIndexOf(0x0a);
|
|
77
|
+
return buffer.subarray(0, lastNewline === -1 ? 0 : lastNewline + 1).toString('utf8');
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
await handle.close();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** The last `bytes` of a file as whole lines (the partial first line is dropped). */
|
|
84
|
+
export async function readTail(path, bytes, size) {
|
|
85
|
+
if (size <= bytes)
|
|
86
|
+
return readFile(path, 'utf8');
|
|
87
|
+
const handle = await open(path, 'r');
|
|
88
|
+
try {
|
|
89
|
+
const buffer = Buffer.alloc(bytes);
|
|
90
|
+
const { bytesRead } = await handle.read(buffer, 0, bytes, size - bytes);
|
|
91
|
+
const firstNewline = buffer.indexOf(0x0a);
|
|
92
|
+
return firstNewline === -1 ? '' : buffer.subarray(firstNewline + 1, bytesRead).toString('utf8');
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
await handle.close();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Read growing head windows until `accept` finds what it needs (or the whole
|
|
100
|
+
* file has been seen).
|
|
101
|
+
* @returns The first accepted result, or the result for the largest window.
|
|
102
|
+
*/
|
|
103
|
+
export async function withHead(path, size, accept) {
|
|
104
|
+
for (const window of HEAD_WINDOWS) {
|
|
105
|
+
const whole = size <= window;
|
|
106
|
+
const result = accept(whole ? await readFile(path, 'utf8') : await readHead(path, window), whole);
|
|
107
|
+
if (result !== undefined || whole)
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
/** Whole text of an artifact for a full load, or the reason it cannot be read. */
|
|
113
|
+
export async function loadText(path) {
|
|
114
|
+
const fp = await fingerprintOf(path);
|
|
115
|
+
if (fp === undefined)
|
|
116
|
+
return { skip: 'missing' };
|
|
117
|
+
if (fp.size > MAX_ARTIFACT_BYTES)
|
|
118
|
+
return { skip: 'too-large' };
|
|
119
|
+
try {
|
|
120
|
+
return await readFile(path, 'utf8');
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return { skip: 'missing' };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Artifacts stat-ed and summarized at once during a scan. */
|
|
127
|
+
const SCAN_CONCURRENCY = 16;
|
|
128
|
+
/**
|
|
129
|
+
* The shared scan loop: fingerprint every artifact the walk finds, reuse the
|
|
130
|
+
* cached result for an unchanged one, summarize the rest, and report
|
|
131
|
+
* conversations as they are found.
|
|
132
|
+
*
|
|
133
|
+
* Per-artifact work runs in a bounded pool: a stat or a head read is IO-bound,
|
|
134
|
+
* and doing them one after another made a scan's wall time the sum of
|
|
135
|
+
* thousands of round trips. Entries therefore arrive unordered.
|
|
136
|
+
* @param files - The walk.
|
|
137
|
+
* @param refOf - Locator of the artifact a walked file belongs to (the file
|
|
138
|
+
* itself, or its session directory); duplicates are scanned once.
|
|
139
|
+
* @param fingerprint - mtime + size of an artifact, undefined when it vanished.
|
|
140
|
+
*/
|
|
141
|
+
export async function runScan(files, refOf, fingerprint, options, summarize) {
|
|
142
|
+
const entries = [];
|
|
143
|
+
const seen = new Set();
|
|
144
|
+
const running = new Set();
|
|
145
|
+
const scanOne = async (ref) => {
|
|
146
|
+
const fp = await fingerprint(ref);
|
|
147
|
+
if (fp === undefined)
|
|
148
|
+
return;
|
|
149
|
+
let summary = options?.cached?.(ref, fp);
|
|
150
|
+
if (summary === undefined) {
|
|
151
|
+
try {
|
|
152
|
+
summary = await summarize({ ref, fp });
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
// An artifact that vanished or cannot be read mid-scan is skipped
|
|
156
|
+
// this pass; it is retried on the next one (nothing is cached).
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
entries.push({ ref, fp, summary });
|
|
161
|
+
if (summary !== null)
|
|
162
|
+
options?.onEntry?.(summary);
|
|
163
|
+
};
|
|
164
|
+
for await (const file of files) {
|
|
165
|
+
options?.signal?.throwIfAborted();
|
|
166
|
+
const ref = refOf(file);
|
|
167
|
+
if (seen.has(ref))
|
|
168
|
+
continue;
|
|
169
|
+
seen.add(ref);
|
|
170
|
+
const task = scanOne(ref).finally(() => running.delete(task));
|
|
171
|
+
running.add(task);
|
|
172
|
+
if (running.size >= SCAN_CONCURRENCY)
|
|
173
|
+
await Promise.race(running);
|
|
174
|
+
}
|
|
175
|
+
await Promise.all(running);
|
|
176
|
+
options?.signal?.throwIfAborted();
|
|
177
|
+
return entries;
|
|
178
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Walk-mode file/directory counter shared by every adapter's fast count. */
|
|
2
|
+
export declare function countEntries(roots: readonly string[], options: {
|
|
3
|
+
readonly maxDepth: number;
|
|
4
|
+
readonly fileMatch: (name: string) => boolean;
|
|
5
|
+
/** Directory names never descended into. */
|
|
6
|
+
readonly skipDirs?: readonly string[];
|
|
7
|
+
}): number;
|
|
8
|
+
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/scan.ts"],"names":[],"mappings":"AAcA,6EAA6E;AAC7E,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE;IACP,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IAC7C,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACtC,GACA,MAAM,CAmBR"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared lightweight counting for the migration adapters.
|
|
3
|
+
*
|
|
4
|
+
* Bare `dsh-tui migrate` (and the TUI's `/migrate`) only prints a per-agent
|
|
5
|
+
* count, but discover() parses EVERY file into memory (real-world scale:
|
|
6
|
+
* ~9600 files / 5.5GB → 49s and ~880MB just to print five numbers —
|
|
7
|
+
* deep-review M3). countSessions() walks the same trees matching only
|
|
8
|
+
* directory-entry NAMES: no file is opened, no line is parsed.
|
|
9
|
+
*
|
|
10
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/adapters/scan
|
|
11
|
+
*/
|
|
12
|
+
import { readdirSync } from 'node:fs';
|
|
13
|
+
import { join } from 'node:path';
|
|
14
|
+
/** Walk-mode file/directory counter shared by every adapter's fast count. */
|
|
15
|
+
export function countEntries(roots, options) {
|
|
16
|
+
let count = 0;
|
|
17
|
+
const walk = (dir, depth) => {
|
|
18
|
+
if (depth > options.maxDepth)
|
|
19
|
+
return;
|
|
20
|
+
let entries;
|
|
21
|
+
try {
|
|
22
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
for (const entry of entries) {
|
|
28
|
+
const path = join(dir, entry.name);
|
|
29
|
+
if (entry.isDirectory()) {
|
|
30
|
+
if (options.skipDirs?.includes(entry.name) !== true)
|
|
31
|
+
walk(path, depth + 1);
|
|
32
|
+
}
|
|
33
|
+
else if (entry.isFile() && options.fileMatch(entry.name))
|
|
34
|
+
count += 1;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
for (const root of roots)
|
|
38
|
+
walk(root, 0);
|
|
39
|
+
return count;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zcode.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/zcode.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAmC,gBAAgB,EAA+D,MAAM,aAAa,CAAA;AA8BjJ,eAAO,MAAM,YAAY,EAAE,gBA6C1B,CAAA"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zcode adapter: `~/.zcode/v2/sessions/<dir>/<taskId>.json`, one JSON object
|
|
3
|
+
* per conversation. Discovery lives here; the document is parsed by the pure
|
|
4
|
+
* zcode.parse.ts. A JSON document has no usable head, so the browse scan
|
|
5
|
+
* parses each changed file whole (they are small; unchanged ones are reused
|
|
6
|
+
* by fingerprint).
|
|
7
|
+
*
|
|
8
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/adapters/zcode
|
|
9
|
+
*/
|
|
10
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
11
|
+
import { homedir } from 'node:os';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { countEntries } from './scan.js';
|
|
14
|
+
import { fingerprintOf, loadText, runScan, walkFiles } from './scan-fs.js';
|
|
15
|
+
import { parseZcodeSession } from './zcode.parse.js';
|
|
16
|
+
const WALK = { maxDepth: 3, match: name => name.endsWith('.json') };
|
|
17
|
+
async function summarize({ ref, fp }) {
|
|
18
|
+
const raw = await loadText(ref);
|
|
19
|
+
const session = typeof raw === 'string' ? parseZcodeSession(raw) : undefined;
|
|
20
|
+
if (session === undefined)
|
|
21
|
+
return null;
|
|
22
|
+
return {
|
|
23
|
+
agentId: 'zcode',
|
|
24
|
+
sessionKey: session.sourceId,
|
|
25
|
+
ref,
|
|
26
|
+
title: session.title ?? '',
|
|
27
|
+
cwd: session.cwd,
|
|
28
|
+
lastMessageAt: fp.mtimeMs,
|
|
29
|
+
createdAt: session.startedAt || fp.mtimeMs,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function readOne(path) {
|
|
33
|
+
try {
|
|
34
|
+
return parseZcodeSession(readFileSync(path, 'utf8'));
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const zcodeAdapter = {
|
|
41
|
+
id: 'zcode',
|
|
42
|
+
label: 'zcode',
|
|
43
|
+
roots: () => [join(homedir(), '.zcode', 'v2', 'sessions')],
|
|
44
|
+
discover() {
|
|
45
|
+
const roots = this.roots();
|
|
46
|
+
const sessions = [];
|
|
47
|
+
const walk = (dir, depth) => {
|
|
48
|
+
if (depth > 3)
|
|
49
|
+
return;
|
|
50
|
+
let entries;
|
|
51
|
+
try {
|
|
52
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
for (const entry of entries) {
|
|
58
|
+
const path = join(dir, entry.name);
|
|
59
|
+
if (entry.isDirectory())
|
|
60
|
+
walk(path, depth + 1);
|
|
61
|
+
else if (entry.isFile() && entry.name.endsWith('.json')) {
|
|
62
|
+
try {
|
|
63
|
+
if (statSync(path).size > 64 * 1024 * 1024)
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const session = readOne(path);
|
|
70
|
+
if (session !== undefined)
|
|
71
|
+
sessions.push(session);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
for (const root of roots)
|
|
76
|
+
walk(root, 0);
|
|
77
|
+
return { roots, sessions };
|
|
78
|
+
},
|
|
79
|
+
count() {
|
|
80
|
+
return countEntries(this.roots(), { maxDepth: WALK.maxDepth, fileMatch: WALK.match });
|
|
81
|
+
},
|
|
82
|
+
walk: WALK,
|
|
83
|
+
async scan(options) {
|
|
84
|
+
const files = walkFiles(this.roots(), { ...WALK, signal: options?.signal });
|
|
85
|
+
return runScan(files, file => file.path, fingerprintOf, options, summarize);
|
|
86
|
+
},
|
|
87
|
+
async load(ref) {
|
|
88
|
+
const raw = await loadText(ref);
|
|
89
|
+
if (typeof raw !== 'string')
|
|
90
|
+
return raw;
|
|
91
|
+
return parseZcodeSession(raw) ?? { skip: 'not-a-session' };
|
|
92
|
+
},
|
|
93
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MigrationSession } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse one zcode session document.
|
|
4
|
+
* @returns The session, or undefined when the document is not a
|
|
5
|
+
* `{ meta, messages }` object with a task id and workspace, or holds no
|
|
6
|
+
* prompt.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseZcodeSession(raw: string): MigrationSession | undefined;
|
|
9
|
+
//# sourceMappingURL=zcode.parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zcode.parse.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/zcode.parse.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAc,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE/D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAwD3E"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zcode session parsing (pure): one `<taskId>.json` → one
|
|
3
|
+
* {@link MigrationSession}.
|
|
4
|
+
*
|
|
5
|
+
* One JSON object per conversation (`{ meta, messages }`) with plain-string
|
|
6
|
+
* contents and epoch-millisecond timestamps. Only the text roles are mapped:
|
|
7
|
+
* no sample of this store with tool traffic or reasoning has been available,
|
|
8
|
+
* so no such field is guessed at.
|
|
9
|
+
*
|
|
10
|
+
* @module @deepseek-harness-tui/dsh-tui/migrate/adapters/zcode.parse
|
|
11
|
+
*/
|
|
12
|
+
import { isInjectedText, unwrapUserText } from '../parse/injection.js';
|
|
13
|
+
import { isRecord } from '../parse/jsonl.js';
|
|
14
|
+
import { emptyStats } from '../parse/role-turns.js';
|
|
15
|
+
import { normalizeTitle } from '../parse/title.js';
|
|
16
|
+
import { newStep } from '../parse/tools.js';
|
|
17
|
+
/**
|
|
18
|
+
* Parse one zcode session document.
|
|
19
|
+
* @returns The session, or undefined when the document is not a
|
|
20
|
+
* `{ meta, messages }` object with a task id and workspace, or holds no
|
|
21
|
+
* prompt.
|
|
22
|
+
*/
|
|
23
|
+
export function parseZcodeSession(raw) {
|
|
24
|
+
let doc;
|
|
25
|
+
try {
|
|
26
|
+
doc = JSON.parse(raw);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
if (!isRecord(doc) || !isRecord(doc.meta) || !Array.isArray(doc.messages))
|
|
32
|
+
return undefined;
|
|
33
|
+
const { taskId, workspacePath, title, createdAt } = doc.meta;
|
|
34
|
+
if (typeof taskId !== 'string' || taskId === '')
|
|
35
|
+
return undefined;
|
|
36
|
+
if (typeof workspacePath !== 'string' || workspacePath === '')
|
|
37
|
+
return undefined;
|
|
38
|
+
const stats = emptyStats();
|
|
39
|
+
let turns = [];
|
|
40
|
+
let current;
|
|
41
|
+
let firstTime = 0;
|
|
42
|
+
for (const message of doc.messages) {
|
|
43
|
+
if (!isRecord(message))
|
|
44
|
+
continue;
|
|
45
|
+
if (message.role !== 'user' && message.role !== 'assistant')
|
|
46
|
+
continue;
|
|
47
|
+
if (typeof message.content !== 'string' || message.content === '')
|
|
48
|
+
continue;
|
|
49
|
+
if (firstTime === 0 && typeof message.timestamp === 'number')
|
|
50
|
+
firstTime = message.timestamp;
|
|
51
|
+
if (message.role === 'user') {
|
|
52
|
+
// Shared injection rules: harness blocks open no turn, wrappers keep
|
|
53
|
+
// only the human words.
|
|
54
|
+
if (isInjectedText(message.content)) {
|
|
55
|
+
stats.filtered += 1;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const prompt = unwrapUserText(message.content);
|
|
59
|
+
if (prompt === '')
|
|
60
|
+
continue;
|
|
61
|
+
current = { prompt, steps: [] };
|
|
62
|
+
turns.push(current);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (current === undefined) {
|
|
66
|
+
current = { prompt: '', steps: [] };
|
|
67
|
+
turns.push(current);
|
|
68
|
+
}
|
|
69
|
+
const step = newStep();
|
|
70
|
+
step.blocks.push({ type: 'text', text: message.content });
|
|
71
|
+
current.steps.push(step);
|
|
72
|
+
}
|
|
73
|
+
turns = turns.filter(turn => turn.prompt !== '' || turn.steps.length > 0);
|
|
74
|
+
if (turns.length === 0)
|
|
75
|
+
return undefined;
|
|
76
|
+
// meta.title is the store's own title (written to the log); the first real
|
|
77
|
+
// prompt is only a fallback.
|
|
78
|
+
const ownTitle = normalizeTitle(typeof title === 'string' ? title : undefined);
|
|
79
|
+
const shownTitle = ownTitle !== '' ? ownTitle : normalizeTitle(turns.find(turn => turn.prompt !== '')?.prompt);
|
|
80
|
+
return {
|
|
81
|
+
sourceId: taskId,
|
|
82
|
+
cwd: workspacePath,
|
|
83
|
+
...(shownTitle === '' ? {} : { title: shownTitle }),
|
|
84
|
+
titleExplicit: ownTitle !== '',
|
|
85
|
+
startedAt: typeof createdAt === 'number' ? createdAt : firstTime,
|
|
86
|
+
turns,
|
|
87
|
+
stats,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin-path.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/migrate/bin-path.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMjE"}
|