@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,90 @@
|
|
|
1
|
+
/** Last successful listing for first paint only; the backend still refreshes it. */
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { isAbsolute, join, normalize } from 'node:path';
|
|
5
|
+
import { DATA_DIR } from '../../utils/paths.js';
|
|
6
|
+
const directory = join(DATA_DIR, 'session-lists');
|
|
7
|
+
const generations = new Map();
|
|
8
|
+
/** Only the known JSONL provider exposes a public, durable source configuration. */
|
|
9
|
+
function sourceKey(source) {
|
|
10
|
+
if (source.name !== 'session-persistence-jsonl')
|
|
11
|
+
return undefined;
|
|
12
|
+
const config = source.config;
|
|
13
|
+
if (config === null || typeof config !== 'object')
|
|
14
|
+
return undefined;
|
|
15
|
+
const { root, compression } = config;
|
|
16
|
+
// A relative config root could be reinterpreted after a workspace switch.
|
|
17
|
+
// Decline caching rather than inspecting the backend's private resolved root.
|
|
18
|
+
if (typeof root !== 'string' || !isAbsolute(root))
|
|
19
|
+
return undefined;
|
|
20
|
+
if (compression !== undefined && compression !== 'zstd' && compression !== 'none')
|
|
21
|
+
return undefined;
|
|
22
|
+
const path = normalize(root);
|
|
23
|
+
// Even Windows can host case-sensitive directories; alias misses are safer
|
|
24
|
+
// than displaying a different store's rows.
|
|
25
|
+
return JSON.stringify([source.name, path, compression ?? 'zstd']);
|
|
26
|
+
}
|
|
27
|
+
const record = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
28
|
+
const finite = (value) => typeof value === 'number' && Number.isFinite(value);
|
|
29
|
+
const optionalText = (value) => value === undefined || typeof value === 'string';
|
|
30
|
+
function isSummary(value) {
|
|
31
|
+
if (!record(value) || typeof value.id !== 'string' || !value.id || typeof value.cwd !== 'string' ||
|
|
32
|
+
!finite(value.createdAt) || !finite(value.updatedAt) || typeof value.hasPrompt !== 'boolean' ||
|
|
33
|
+
!finite(value.childCount) || value.childCount < 0 ||
|
|
34
|
+
(value.bytes !== undefined && (!finite(value.bytes) || value.bytes < 0)) ||
|
|
35
|
+
!['agentPreset', 'model', 'label', 'branch'].every(key => optionalText(value[key])))
|
|
36
|
+
return false;
|
|
37
|
+
const { title, kind } = value;
|
|
38
|
+
if (!record(title) || typeof title.text !== 'string' || typeof title.source !== 'string' ||
|
|
39
|
+
!['renamed', 'auto', 'prompt', 'fallback'].includes(title.source) || !record(kind))
|
|
40
|
+
return false;
|
|
41
|
+
return kind.kind === 'root' ||
|
|
42
|
+
(kind.kind === 'fork' && typeof kind.parent === 'string') ||
|
|
43
|
+
(kind.kind === 'subagent' && optionalText(kind.parent) && finite(kind.depth) && kind.depth >= 0);
|
|
44
|
+
}
|
|
45
|
+
function fileOf(key) {
|
|
46
|
+
return join(directory, createHash('sha256').update(key).digest('hex') + '.json');
|
|
47
|
+
}
|
|
48
|
+
function read(key) {
|
|
49
|
+
try {
|
|
50
|
+
const value = JSON.parse(readFileSync(fileOf(key), 'utf8'));
|
|
51
|
+
if (!record(value) || value.version !== 1 || value.source !== key || !Array.isArray(value.rows) || !value.rows.every(isSummary))
|
|
52
|
+
return undefined;
|
|
53
|
+
if (new Set(value.rows.map(row => row.id)).size !== value.rows.length)
|
|
54
|
+
return undefined;
|
|
55
|
+
return value.rows;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** Undefined is unknown; an empty snapshot is a successful empty listing. */
|
|
62
|
+
export function readListingSnapshot(source) {
|
|
63
|
+
const key = sourceKey(source);
|
|
64
|
+
return key === undefined ? undefined : read(key);
|
|
65
|
+
}
|
|
66
|
+
/** Capture ordering before async work, including across distinct Context proxies. */
|
|
67
|
+
export function beginListingSnapshot(source) {
|
|
68
|
+
const key = sourceKey(source);
|
|
69
|
+
if (key === undefined)
|
|
70
|
+
return () => { };
|
|
71
|
+
const generation = (generations.get(key) ?? 0) + 1;
|
|
72
|
+
generations.set(key, generation);
|
|
73
|
+
return rows => {
|
|
74
|
+
if (generations.get(key) !== generation)
|
|
75
|
+
return;
|
|
76
|
+
const file = fileOf(key);
|
|
77
|
+
const temporary = file + '.' + process.pid + '.tmp';
|
|
78
|
+
try {
|
|
79
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
80
|
+
writeFileSync(temporary, JSON.stringify({ version: 1, source: key, rows }), { mode: 0o600 });
|
|
81
|
+
renameSync(temporary, file);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
try {
|
|
85
|
+
rmSync(temporary, { force: true });
|
|
86
|
+
}
|
|
87
|
+
catch { /* A cache never blocks listing. */ }
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { TitleSource } from './types.js';
|
|
2
|
+
/** Cheap file generation check for asynchronous listing writes. */
|
|
3
|
+
export declare function indexFileStamp(): string | undefined;
|
|
2
4
|
/** Facts derived from a log at one revision. */
|
|
3
5
|
export interface DerivedEntry {
|
|
4
6
|
readonly revision: string;
|
|
5
7
|
/** Artifact size at this observation; append growth can retain older title evidence. */
|
|
6
8
|
readonly bytes: number;
|
|
9
|
+
/** Last-write time observed with this revision, for the revision-only path. */
|
|
10
|
+
readonly modifiedAt: number | undefined;
|
|
7
11
|
/** Physical file identity; a replacement invalidates append-only evidence. */
|
|
8
12
|
readonly identity: string | undefined;
|
|
9
|
-
/**
|
|
13
|
+
/** Optional in older indexes; certifies only the physical-file-derived summary. */
|
|
14
|
+
readonly artifactStamp?: string;
|
|
15
|
+
/** Old EOF neighborhood hash, paired with the backend's append-only contract. */
|
|
10
16
|
readonly anchor: string | undefined;
|
|
11
17
|
readonly title: string;
|
|
12
18
|
readonly titleSource: TitleSource;
|
|
@@ -26,8 +32,8 @@ export interface IndexEntry {
|
|
|
26
32
|
export type SessionIndex = Map<string, IndexEntry>;
|
|
27
33
|
/**
|
|
28
34
|
* Load the cache.
|
|
29
|
-
* @returns The parsed index;
|
|
30
|
-
*
|
|
35
|
+
* @returns The parsed index; version 3 derivations are upgraded lazily and
|
|
36
|
+
* version 2 retains branch notes only.
|
|
31
37
|
*/
|
|
32
38
|
export declare function readIndex(): SessionIndex;
|
|
33
39
|
/**
|
|
@@ -38,7 +44,7 @@ export declare function readIndex(): SessionIndex;
|
|
|
38
44
|
* A concurrent writer may win the rename; the loser's derivations are simply
|
|
39
45
|
* recomputed next time.
|
|
40
46
|
*
|
|
41
|
-
* @param index - The index to store.
|
|
47
|
+
* @param index - The index to store. Stable id order ignores scan scheduling.
|
|
42
48
|
*/
|
|
43
49
|
export declare function writeIndex(index: SessionIndex): void;
|
|
44
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/sessions/store.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/sessions/store.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAsB7C,mEAAmE;AACnE,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAE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G,IAAI,CAO9E"}
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
* service already hands out the exact token needed to avoid it:
|
|
7
7
|
* `listSnapshots()` returns, per session, an opaque revision that changes
|
|
8
8
|
* whenever the stored log changes. An entry whose revision still matches is
|
|
9
|
-
* reused verbatim
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* reused verbatim. A changed logical revision can still reuse a summary when
|
|
10
|
+
* its physical artifact stamp matches: historical revisions also depend on
|
|
11
|
+
* other sessions, whereas these derived fields read only the located file.
|
|
12
|
+
* A session edited by another client invalidates its artifact stamp.
|
|
12
13
|
*
|
|
13
14
|
* The revision is treated as opaque, as its contract requires. It happens to
|
|
14
15
|
* be stat-derived today, but parsing it to shortcut a `stat` would couple this
|
|
@@ -16,10 +17,9 @@
|
|
|
16
17
|
* per-session files is used.
|
|
17
18
|
*
|
|
18
19
|
* Two halves live in one entry because they have different lifetimes:
|
|
19
|
-
* `derived` facts come from the log and
|
|
20
|
-
* is a local note about how this install
|
|
21
|
-
*
|
|
22
|
-
* field makes that boundary explicit instead of implied.
|
|
20
|
+
* `derived` facts come from the log and are checked against its revision or
|
|
21
|
+
* physical artifact stamp. `branch` is a local note about how this install
|
|
22
|
+
* used the session and no log change can invalidate it.
|
|
23
23
|
*
|
|
24
24
|
* Every operation is best-effort. The index is a cache: a corrupt file, a
|
|
25
25
|
* losing concurrent write, or a read-only home directory costs a re-derivation
|
|
@@ -27,16 +27,31 @@
|
|
|
27
27
|
*
|
|
28
28
|
* @module @deepseek-harness-tui/dsh-tui/sessions/store
|
|
29
29
|
*/
|
|
30
|
-
import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
30
|
+
import { mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
31
31
|
import { join } from 'node:path';
|
|
32
32
|
import { DATA_DIR } from '../../utils/paths.js';
|
|
33
33
|
/**
|
|
34
|
-
* Bumped
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* Bumped for cached mtime. Version 3 derivations remain readable and receive
|
|
35
|
+
* that field on their next listing; version 2 could cache incomplete reads as
|
|
36
|
+
* empty, so only its branch notes survive.
|
|
37
37
|
*/
|
|
38
|
-
const SCHEMA_VERSION =
|
|
38
|
+
const SCHEMA_VERSION = 4;
|
|
39
39
|
const INDEX_FILE = join(DATA_DIR, 'session-index.json');
|
|
40
|
+
let loadedStamp;
|
|
41
|
+
let loadedIndex;
|
|
42
|
+
function indexStamp() {
|
|
43
|
+
try {
|
|
44
|
+
const stats = statSync(INDEX_FILE);
|
|
45
|
+
return `${stats.dev}:${stats.ino}:${stats.size}:${stats.mtimeMs}:${stats.ctimeMs}`;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** Cheap file generation check for asynchronous listing writes. */
|
|
52
|
+
export function indexFileStamp() {
|
|
53
|
+
return indexStamp();
|
|
54
|
+
}
|
|
40
55
|
/** A title source as written to disk, or undefined for anything unexpected. */
|
|
41
56
|
function readTitleSource(value) {
|
|
42
57
|
return value === 'renamed' || value === 'auto' || value === 'prompt' || value === 'fallback'
|
|
@@ -55,6 +70,7 @@ function readEntry(value, derivedValid) {
|
|
|
55
70
|
const derived = raw;
|
|
56
71
|
const revision = derived['revision'];
|
|
57
72
|
const bytes = derived['bytes'];
|
|
73
|
+
const modifiedAt = derived['modifiedAt'];
|
|
58
74
|
const identity = derived['identity'];
|
|
59
75
|
const anchor = derived['anchor'];
|
|
60
76
|
const title = derived['title'];
|
|
@@ -64,6 +80,7 @@ function readEntry(value, derivedValid) {
|
|
|
64
80
|
typeof bytes !== 'number' ||
|
|
65
81
|
!Number.isFinite(bytes) ||
|
|
66
82
|
bytes < 0 ||
|
|
83
|
+
(modifiedAt !== undefined && (typeof modifiedAt !== 'number' || !Number.isFinite(modifiedAt))) ||
|
|
67
84
|
(identity !== undefined && typeof identity !== 'string') ||
|
|
68
85
|
(anchor !== undefined && typeof anchor !== 'string') ||
|
|
69
86
|
typeof title !== 'string' ||
|
|
@@ -77,7 +94,9 @@ function readEntry(value, derivedValid) {
|
|
|
77
94
|
derived: {
|
|
78
95
|
revision,
|
|
79
96
|
bytes,
|
|
97
|
+
modifiedAt: typeof modifiedAt === 'number' ? modifiedAt : undefined,
|
|
80
98
|
identity: typeof identity === 'string' ? identity : undefined,
|
|
99
|
+
artifactStamp: typeof derived['artifactStamp'] === 'string' ? derived['artifactStamp'] : undefined,
|
|
81
100
|
anchor: typeof anchor === 'string' ? anchor : undefined,
|
|
82
101
|
title,
|
|
83
102
|
titleSource,
|
|
@@ -90,32 +109,48 @@ function readEntry(value, derivedValid) {
|
|
|
90
109
|
}
|
|
91
110
|
/**
|
|
92
111
|
* Load the cache.
|
|
93
|
-
* @returns The parsed index;
|
|
94
|
-
*
|
|
112
|
+
* @returns The parsed index; version 3 derivations are upgraded lazily and
|
|
113
|
+
* version 2 retains branch notes only.
|
|
95
114
|
*/
|
|
96
115
|
export function readIndex() {
|
|
116
|
+
const stamp = indexStamp();
|
|
117
|
+
if (loadedIndex !== undefined && loadedStamp === stamp)
|
|
118
|
+
return new Map(loadedIndex);
|
|
97
119
|
const index = new Map();
|
|
98
120
|
let parsed;
|
|
99
121
|
try {
|
|
100
122
|
parsed = JSON.parse(readFileSync(INDEX_FILE, 'utf8'));
|
|
101
123
|
}
|
|
102
124
|
catch {
|
|
103
|
-
|
|
125
|
+
loadedStamp = stamp;
|
|
126
|
+
loadedIndex = index;
|
|
127
|
+
return new Map(index);
|
|
128
|
+
}
|
|
129
|
+
if (parsed === null || typeof parsed !== 'object') {
|
|
130
|
+
loadedStamp = stamp;
|
|
131
|
+
loadedIndex = index;
|
|
132
|
+
return new Map(index);
|
|
104
133
|
}
|
|
105
|
-
if (parsed === null || typeof parsed !== 'object')
|
|
106
|
-
return index;
|
|
107
134
|
const file = parsed;
|
|
108
|
-
if (file['version'] !== SCHEMA_VERSION && file['version'] !== 2)
|
|
109
|
-
|
|
135
|
+
if (file['version'] !== SCHEMA_VERSION && file['version'] !== 3 && file['version'] !== 2) {
|
|
136
|
+
loadedStamp = stamp;
|
|
137
|
+
loadedIndex = index;
|
|
138
|
+
return new Map(index);
|
|
139
|
+
}
|
|
110
140
|
const entries = file['entries'];
|
|
111
|
-
if (entries === null || typeof entries !== 'object')
|
|
112
|
-
|
|
141
|
+
if (entries === null || typeof entries !== 'object') {
|
|
142
|
+
loadedStamp = stamp;
|
|
143
|
+
loadedIndex = index;
|
|
144
|
+
return new Map(index);
|
|
145
|
+
}
|
|
113
146
|
for (const [id, value] of Object.entries(entries)) {
|
|
114
|
-
const entry = readEntry(value, file['version'] === SCHEMA_VERSION);
|
|
147
|
+
const entry = readEntry(value, file['version'] === SCHEMA_VERSION || file['version'] === 3);
|
|
115
148
|
if (entry !== undefined)
|
|
116
149
|
index.set(id, entry);
|
|
117
150
|
}
|
|
118
|
-
|
|
151
|
+
loadedStamp = stamp;
|
|
152
|
+
loadedIndex = index;
|
|
153
|
+
return new Map(index);
|
|
119
154
|
}
|
|
120
155
|
/**
|
|
121
156
|
* Persist the cache, atomically.
|
|
@@ -125,11 +160,11 @@ export function readIndex() {
|
|
|
125
160
|
* A concurrent writer may win the rename; the loser's derivations are simply
|
|
126
161
|
* recomputed next time.
|
|
127
162
|
*
|
|
128
|
-
* @param index - The index to store.
|
|
163
|
+
* @param index - The index to store. Stable id order ignores scan scheduling.
|
|
129
164
|
*/
|
|
130
165
|
export function writeIndex(index) {
|
|
131
166
|
const entries = {};
|
|
132
|
-
for (const [id, entry] of index) {
|
|
167
|
+
for (const [id, entry] of [...index].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
133
168
|
entries[id] = {
|
|
134
169
|
...(entry.derived === undefined ? {} : { derived: entry.derived }),
|
|
135
170
|
...(entry.branch === undefined ? {} : { branch: entry.branch }),
|
|
@@ -144,6 +179,8 @@ export function writeIndex(index) {
|
|
|
144
179
|
mkdirSync(DATA_DIR, { recursive: true, mode: 0o700 });
|
|
145
180
|
writeFileSync(temporary, JSON.stringify({ version: SCHEMA_VERSION, entries }), { mode: 0o600 });
|
|
146
181
|
renameSync(temporary, INDEX_FILE);
|
|
182
|
+
loadedStamp = indexStamp();
|
|
183
|
+
loadedIndex = new Map(index);
|
|
147
184
|
}
|
|
148
185
|
catch {
|
|
149
186
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-sections.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/settings-sections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAA2G,MAAM,sCAAsC,CAAA;AACvL,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AACvL;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAWtD,6EAA6E;AAC7E,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAAA;IACjD,IAAI,IAAI,SAAS,kBAAkB,EAAE,CAAA;IACrC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAAA;IACnD,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;CAC5C;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,mBAAmB,EAAE,0BAA0B,CAAA;KAChD;CACF;AAED,eAAO,MAAM,IAAI,8BAA8B,CAAA;AAE/C;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,OAAO;gBACzC,GAAG,EAAE,OAAO;IAsBxB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAuBjD,iDAAiD;IACjD,IAAI,IAAI,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,SAAS;IASnD;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;CAU5C;AA6FD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,0BAA0B,GAAG,SAAS,GAAG,uBAAuB,GAAG,SAAS,CAO5H;AAiDD,wBAAgB,4BAA4B,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAiBnF;AAED,eAAe,0BAA0B,CAAA"}
|
|
@@ -33,7 +33,7 @@ export class TuiSettingsSectionsRuntime extends Service {
|
|
|
33
33
|
return [...settingsSectionStateFor(runtime).sections.values()];
|
|
34
34
|
},
|
|
35
35
|
section(ns) {
|
|
36
|
-
return settingsSectionStateFor(runtime).sections.get(ns
|
|
36
|
+
return settingsSectionStateFor(runtime).sections.get(ns);
|
|
37
37
|
},
|
|
38
38
|
subscribe(listener) {
|
|
39
39
|
return subscribeSections(runtime, listener);
|
|
@@ -104,9 +104,12 @@ function settingsSectionStateFor(runtime) {
|
|
|
104
104
|
}
|
|
105
105
|
function registerSection(runtime, section, owner) {
|
|
106
106
|
const state = isSectionState(runtime) ? runtime : settingsSectionStateFor(runtime);
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
// Host sections use opaque Loader IDs; rewriting them breaks settings.mutate.
|
|
108
|
+
// Plugin-owned sections retain their existing namespace validation.
|
|
109
|
+
const ns = owner === undefined ? section.ns : section.ns.trim();
|
|
110
|
+
if (!ns || (owner !== undefined && !/^[a-z][a-z0-9_-]*$/u.test(ns))) {
|
|
109
111
|
throw new TypeError(`invalid TUI settings-section namespace: ${section.ns}`);
|
|
112
|
+
}
|
|
110
113
|
if (state.sections.has(ns))
|
|
111
114
|
throw new Error(`TUI settings section "${ns}" is already registered`);
|
|
112
115
|
const groupIds = new Set();
|
|
@@ -239,7 +242,7 @@ export function getLocalSettingsSectionsHost(ctx) {
|
|
|
239
242
|
return [...state.sections.values()];
|
|
240
243
|
},
|
|
241
244
|
section(ns) {
|
|
242
|
-
return state.sections.get(ns
|
|
245
|
+
return state.sections.get(ns);
|
|
243
246
|
},
|
|
244
247
|
subscribe(listener) {
|
|
245
248
|
return subscribeSections(state, listener);
|
|
@@ -6,12 +6,50 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
-
import { type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
9
|
+
import { type ContentBlock, type Message, type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
10
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
11
|
+
type ToolCall = Extract<ContentBlock, {
|
|
12
|
+
type: 'tool-call';
|
|
13
|
+
}>;
|
|
10
14
|
/**
|
|
11
15
|
* Describe the auxiliary call's scope: one answer from existing context,
|
|
12
16
|
* with no tools, follow-up actions, or interruption of the main session.
|
|
17
|
+
* `pending` names the main task's in-flight calls, which
|
|
18
|
+
* {@link splitUnresolvedToolCalls} removed from the replayed history.
|
|
13
19
|
*/
|
|
14
|
-
export declare function wrapSideQuestion(question: string): string;
|
|
20
|
+
export declare function wrapSideQuestion(question: string, pending?: readonly ToolCall[]): string;
|
|
21
|
+
/**
|
|
22
|
+
* Split assistant `tool-call` blocks whose result never entered the derived
|
|
23
|
+
* history out of it. The composer runs `/btw` immediately while the main turn
|
|
24
|
+
* streams, so the derived tail can end on a tool request still executing
|
|
25
|
+
* (a running command, a job read). Providers reject that transcript ("An
|
|
26
|
+
* assistant message with 'tool_calls' must be followed by tool messages
|
|
27
|
+
* responding to each 'tool_call_id'"): pi-ai routes pad such calls with
|
|
28
|
+
* synthetic results, but the native DeepSeek adapter (dsh-llm-deepseek, 0.1.5
|
|
29
|
+
* hosts) serializes history verbatim and gets a 400. Every unanswered call is
|
|
30
|
+
* removed — with any message left without content — but only those in
|
|
31
|
+
* `running` (see {@link openStepToolCallIds}) come back as `pending` for the
|
|
32
|
+
* wrapper to name: a closed step can keep a call without a result (a failed
|
|
33
|
+
* tool scheduler still appends `step/end`), and that call is not executing.
|
|
34
|
+
* A history whose calls are all answered is returned unchanged.
|
|
35
|
+
*
|
|
36
|
+
* 0.1.7 answers a call with a tool-role message carrying `toolCallId`; older
|
|
37
|
+
* logs wrap the result in a `tool-result` block inside a user message; both
|
|
38
|
+
* shapes count as answered via `answeredToolCallIds` (compat/messages.ts).
|
|
39
|
+
*/
|
|
40
|
+
export declare function splitUnresolvedToolCalls(messages: readonly Message[], running: ReadonlySet<string>): {
|
|
41
|
+
messages: readonly Message[];
|
|
42
|
+
pending: ToolCall[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Tool-call ids of the open step still waiting for their result: the calls
|
|
46
|
+
* the main task is executing right now. Mirrors dsh-session's crash-tail
|
|
47
|
+
* scan — a turn or step boundary closes every earlier call, answered or not.
|
|
48
|
+
* Ids come from `assistant/message`, not `tool/call`: upstream appends
|
|
49
|
+
* `tool/call` only when execution starts, so queued calls would go unnamed.
|
|
50
|
+
* `source.callId` is required on every supported line and read unguarded upstream.
|
|
51
|
+
*/
|
|
52
|
+
export declare function openStepToolCallIds(events: readonly SessionEvent[]): Set<string>;
|
|
15
53
|
/** Outcome of one side question: the visible text answer, or an error. */
|
|
16
54
|
export interface SideQuestionOutcome {
|
|
17
55
|
answer: string | null;
|
|
@@ -33,4 +71,5 @@ export declare function runSideQuestion(params: {
|
|
|
33
71
|
/** Cancellation: aborting yields `{answer: null}` with no error text. */
|
|
34
72
|
signal?: AbortSignal;
|
|
35
73
|
}): Promise<SideQuestionOutcome>;
|
|
74
|
+
export {};
|
|
36
75
|
//# sourceMappingURL=sideQuestion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sideQuestion.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/sideQuestion.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"sideQuestion.d.ts","sourceRo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AAA;CACrB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAuB/B"}
|
|
@@ -7,22 +7,118 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
import { BlockAssembler } from '@deepseek-ai/dsh-llm';
|
|
10
|
+
import { answeredToolCallIds } from './compat/messages.js';
|
|
11
|
+
/** Per-call argument budget in the pending-calls note; a file write can carry megabytes. */
|
|
12
|
+
const PENDING_ARGS_LIMIT = 400;
|
|
10
13
|
/**
|
|
11
14
|
* Describe the auxiliary call's scope: one answer from existing context,
|
|
12
15
|
* with no tools, follow-up actions, or interruption of the main session.
|
|
16
|
+
* `pending` names the main task's in-flight calls, which
|
|
17
|
+
* {@link splitUnresolvedToolCalls} removed from the replayed history.
|
|
13
18
|
*/
|
|
14
|
-
export function wrapSideQuestion(question) {
|
|
19
|
+
export function wrapSideQuestion(question, pending = []) {
|
|
20
|
+
const running = pending.length === 0 ? '' : `
|
|
21
|
+
The main task is still executing these tool calls; their results are not available yet:
|
|
22
|
+
${pending.map(call => `- ${call.name} ${clip(oneLine(call.arguments), PENDING_ARGS_LIMIT)}`).join('\n')}`;
|
|
15
23
|
return `<side-question-context>
|
|
16
24
|
Give one concise answer to the question below using the conversation already provided.
|
|
17
25
|
This auxiliary call runs alongside the main session. The main task continues independently;
|
|
18
26
|
do not describe it as interrupted, resumed, or as work performed by this call.
|
|
19
27
|
No tools are available here: do not claim to inspect files, execute commands, browse,
|
|
20
28
|
or carry out future actions. There will be no follow-up turn for this call.
|
|
21
|
-
When the available context is insufficient, state what is unknown without promising research
|
|
29
|
+
When the available context is insufficient, state what is unknown without promising research.${running}
|
|
22
30
|
</side-question-context>
|
|
23
31
|
|
|
24
32
|
${question}`;
|
|
25
33
|
}
|
|
34
|
+
/** Pretty-printed arguments carry literal breaks (the native adapter keeps the provider string); keep one bullet line. */
|
|
35
|
+
function oneLine(text) {
|
|
36
|
+
return text.replace(/\s+/g, ' ').trim();
|
|
37
|
+
}
|
|
38
|
+
/** Cut at a code-unit budget without stranding a high surrogate (a lone one reaches the wire as `\ud83d`). */
|
|
39
|
+
function clip(text, limit) {
|
|
40
|
+
if (text.length <= limit)
|
|
41
|
+
return text;
|
|
42
|
+
const code = text.charCodeAt(limit - 1);
|
|
43
|
+
const end = code >= 0xd800 && code <= 0xdbff ? limit - 1 : limit;
|
|
44
|
+
return `${text.slice(0, end)}…`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Split assistant `tool-call` blocks whose result never entered the derived
|
|
48
|
+
* history out of it. The composer runs `/btw` immediately while the main turn
|
|
49
|
+
* streams, so the derived tail can end on a tool request still executing
|
|
50
|
+
* (a running command, a job read). Providers reject that transcript ("An
|
|
51
|
+
* assistant message with 'tool_calls' must be followed by tool messages
|
|
52
|
+
* responding to each 'tool_call_id'"): pi-ai routes pad such calls with
|
|
53
|
+
* synthetic results, but the native DeepSeek adapter (dsh-llm-deepseek, 0.1.5
|
|
54
|
+
* hosts) serializes history verbatim and gets a 400. Every unanswered call is
|
|
55
|
+
* removed — with any message left without content — but only those in
|
|
56
|
+
* `running` (see {@link openStepToolCallIds}) come back as `pending` for the
|
|
57
|
+
* wrapper to name: a closed step can keep a call without a result (a failed
|
|
58
|
+
* tool scheduler still appends `step/end`), and that call is not executing.
|
|
59
|
+
* A history whose calls are all answered is returned unchanged.
|
|
60
|
+
*
|
|
61
|
+
* 0.1.7 answers a call with a tool-role message carrying `toolCallId`; older
|
|
62
|
+
* logs wrap the result in a `tool-result` block inside a user message; both
|
|
63
|
+
* shapes count as answered via `answeredToolCallIds` (compat/messages.ts).
|
|
64
|
+
*/
|
|
65
|
+
export function splitUnresolvedToolCalls(messages, running) {
|
|
66
|
+
const answered = new Set();
|
|
67
|
+
const calls = [];
|
|
68
|
+
for (const message of messages) {
|
|
69
|
+
for (const id of answeredToolCallIds(message))
|
|
70
|
+
answered.add(id);
|
|
71
|
+
if (message.role !== 'assistant')
|
|
72
|
+
continue;
|
|
73
|
+
for (const block of message.content)
|
|
74
|
+
if (block.type === 'tool-call')
|
|
75
|
+
calls.push(block);
|
|
76
|
+
}
|
|
77
|
+
const unresolved = new Set(calls.filter(call => !answered.has(call.id)).map(call => call.id));
|
|
78
|
+
if (unresolved.size === 0)
|
|
79
|
+
return { messages, pending: [] };
|
|
80
|
+
const pending = calls.filter(call => unresolved.has(call.id) && running.has(call.id));
|
|
81
|
+
const kept = [];
|
|
82
|
+
for (const message of messages) {
|
|
83
|
+
if (message.role !== 'assistant') {
|
|
84
|
+
kept.push(message);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const content = message.content.filter(block => block.type !== 'tool-call' || !unresolved.has(block.id));
|
|
88
|
+
// A reasoning-only remainder stays: upstream replays the same shape for a
|
|
89
|
+
// turn interrupted mid-thinking. An emptied message drops the way
|
|
90
|
+
// deriveEventMessage drops an empty assistant/message; the user→user
|
|
91
|
+
// adjacency this can leave already reaches the native adapter from the
|
|
92
|
+
// agent loop itself (prompt + runtime-context user messages).
|
|
93
|
+
if (content.length === 0)
|
|
94
|
+
continue;
|
|
95
|
+
kept.push(content.length === message.content.length ? message : { ...message, content });
|
|
96
|
+
}
|
|
97
|
+
return { messages: kept, pending };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Tool-call ids of the open step still waiting for their result: the calls
|
|
101
|
+
* the main task is executing right now. Mirrors dsh-session's crash-tail
|
|
102
|
+
* scan — a turn or step boundary closes every earlier call, answered or not.
|
|
103
|
+
* Ids come from `assistant/message`, not `tool/call`: upstream appends
|
|
104
|
+
* `tool/call` only when execution starts, so queued calls would go unnamed.
|
|
105
|
+
* `source.callId` is required on every supported line and read unguarded upstream.
|
|
106
|
+
*/
|
|
107
|
+
export function openStepToolCallIds(events) {
|
|
108
|
+
const open = new Set();
|
|
109
|
+
for (const event of events) {
|
|
110
|
+
if (event.type === 'turn/start' || event.type === 'turn/end' || event.type === 'step/end')
|
|
111
|
+
open.clear();
|
|
112
|
+
if (event.type === 'assistant/message') {
|
|
113
|
+
for (const block of event.data.message.content)
|
|
114
|
+
if (block.type === 'tool-call')
|
|
115
|
+
open.add(block.id);
|
|
116
|
+
}
|
|
117
|
+
if (event.type === 'tool/result')
|
|
118
|
+
open.delete(event.data.message.source.callId);
|
|
119
|
+
}
|
|
120
|
+
return open;
|
|
121
|
+
}
|
|
26
122
|
/**
|
|
27
123
|
* Run one side-question call: stream the assembled options, fold chunks
|
|
28
124
|
* through the shared BlockAssembler, and surface the assembled text
|
|
@@ -1,16 +1,41 @@
|
|
|
1
1
|
import type { AssistantStreamFrame } from '@deepseek-ai/dsh-agent';
|
|
2
|
-
import type { SubagentState, SubagentOutputKind, SubagentToolCall } from '../adapter/ports/channel-view.js';
|
|
3
|
-
export type { SubagentState, SubagentStatus, SubagentOutputLine, SubagentOutputKind, SubagentToolCall, SubagentTokenUsage } from '../adapter/ports/channel-view.js';
|
|
2
|
+
import type { CostTokenBuckets, SubagentCostEntry, SubagentState, SubagentOutputKind, SubagentToolCall } from '../adapter/ports/channel-view.js';
|
|
3
|
+
export type { SubagentState, SubagentStatus, SubagentOutputLine, SubagentOutputKind, SubagentToolCall, SubagentTokenUsage, SubagentCostEntry } from '../adapter/ports/channel-view.js';
|
|
4
|
+
/** 子代理 durable 用量的费用快照:entries 供多模型计价,unpriced 是
|
|
5
|
+
* 非官方/未收录用量的独立副本(展示与回归断言用)。 */
|
|
6
|
+
export interface SubagentCostSnapshot {
|
|
7
|
+
entries: SubagentCostEntry[];
|
|
8
|
+
unpriced: CostTokenBuckets;
|
|
9
|
+
}
|
|
4
10
|
export declare class SubagentActivityStore {
|
|
5
11
|
private states;
|
|
6
12
|
private sessionToAgent;
|
|
7
13
|
private listeners;
|
|
8
14
|
private streams;
|
|
15
|
+
/** 会话级 durable usage 费用桶,key = `${provider}\u0000${model}`。 */
|
|
16
|
+
private costByModel;
|
|
17
|
+
/** 非官方 provider / 未收录模型的用量副本(只展示 token,不计金额)。 */
|
|
18
|
+
private costUnpriced;
|
|
19
|
+
/** 每个 agent 已消费的最大 durable 事件 seq(同一事件重投不重复计费)。 */
|
|
20
|
+
private costSeq;
|
|
9
21
|
private commitLine;
|
|
10
22
|
private pushLine;
|
|
11
23
|
onSpawned(agentId: string, provider?: string, model?: string, info?: Partial<SubagentState>): void;
|
|
24
|
+
/** Durable discovery (`subagent/catalog`, workflow member events, registry
|
|
25
|
+
* back-fill): register a child WITHOUT disturbing an already-tracked run.
|
|
26
|
+
* `live` marks a child the agents registry currently holds, which keeps the
|
|
27
|
+
* row running; an idle historical child shows as `unknown` (the parent log
|
|
28
|
+
* alone cannot prove how its last epoch ended). */
|
|
29
|
+
onDiscovered(agentId: string, info?: {
|
|
30
|
+
label?: string;
|
|
31
|
+
childCreatedAt?: number;
|
|
32
|
+
live?: boolean;
|
|
33
|
+
provider?: string;
|
|
34
|
+
model?: string;
|
|
35
|
+
}): void;
|
|
12
36
|
linkSession(agentId: string, session: unknown): void;
|
|
13
37
|
getSubagentIdBySession(session: unknown): string | undefined;
|
|
38
|
+
has(agentId: string): boolean;
|
|
14
39
|
appendOutput(agentId: string, text: string, kind?: SubagentOutputKind): void;
|
|
15
40
|
/** Mark the streaming tail line complete (run settlement). */
|
|
16
41
|
flushOutput(agentId: string): void;
|
|
@@ -35,13 +60,26 @@ export declare class SubagentActivityStore {
|
|
|
35
60
|
total?: number;
|
|
36
61
|
context?: number;
|
|
37
62
|
}): void;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
63
|
+
/** durable usage 的计价字段;全零/非法返回 undefined(不建零桶)。 */
|
|
64
|
+
private costDeltaOf;
|
|
65
|
+
/** 一笔 durable usage 按发生时刻落 peak/idle 桶,model/provider 取事件
|
|
66
|
+
* 发生时的子代理身份;非官方/未收录同时进 unpriced 副本。
|
|
67
|
+
*
|
|
68
|
+
* `seq` 是同一 binding 内的事件序号:重放/回放把同一条 durable 事件再投
|
|
69
|
+
* 一次时只计第一笔(重投即双计会让"并入子代理"的估算凭空变大)。判据与
|
|
70
|
+
* `settleAssistant` 的 `settledSeq` 同源但**各自独立**——两处都要消费
|
|
71
|
+
* 同一个 seq,共用字段会让后消费的那处被前一处挡掉。 */
|
|
72
|
+
private accumulateCost;
|
|
73
|
+
/** durable 用量的费用快照(深拷贝):entries 供计价,unpriced 供展示。 */
|
|
74
|
+
costSnapshot(): SubagentCostSnapshot;
|
|
75
|
+
onCompleted(agentId: string, summary?: string, stopReason?: string, endedAt?: number): void;
|
|
76
|
+
onFailed(agentId: string, error: string, endedAt?: number): void;
|
|
77
|
+
onCancelled(agentId: string, reason?: string, summary?: string, endedAt?: number): void;
|
|
41
78
|
private finish;
|
|
42
79
|
/** Drop all tracked subagents and session links (session swap: the old
|
|
43
80
|
* session's children were disposed with their parent — nothing may keep
|
|
44
|
-
* routing events of a session the channel no longer projects).
|
|
81
|
+
* routing events of a session the channel no longer projects). The
|
|
82
|
+
* session-scoped cost buckets reset with them. */
|
|
45
83
|
reset(): void;
|
|
46
84
|
snapshot(): SubagentState[];
|
|
47
85
|
get(agentId: string): SubagentState | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagents.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/subagents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"subagents.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/subagents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAGlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAsC,kBAAkB,EAAE,gBAAgB,EAAsB,MAAM,kCAAkC,CAAA;AACxM,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAMtL;gCACgC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