@deepseek-ai/dsh-client-ui-chat 0.2.2-rc.1 → 0.2.2-rc.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.i18n.yaml +16 -16
- package/README.md +17 -5
- package/README.zh.md +17 -5
- package/lib/client.js +18 -15587
- package/lib/client.js.map +1 -0
- package/lib/types/chat-settings.d.ts.map +1 -0
- package/lib/types/chat-settings.js.map +1 -0
- package/lib/types/client/apply.d.ts.map +1 -0
- package/lib/types/client/apply.js.map +1 -0
- package/lib/types/client/chat/ApprovalCommand.d.ts +4 -3
- package/lib/types/client/chat/ApprovalCommand.d.ts.map +1 -0
- package/lib/types/client/chat/ApprovalCommand.js.map +1 -0
- package/lib/types/client/chat/AssistantMarkdown.d.ts.map +1 -0
- package/lib/types/client/chat/AssistantMarkdown.js.map +1 -0
- package/lib/types/client/chat/AssistantNodeView.d.ts.map +1 -0
- package/lib/types/client/chat/AssistantNodeView.js.map +1 -0
- package/lib/types/client/chat/ChatFlow.d.ts.map +1 -0
- package/lib/types/client/chat/ChatFlow.js.map +1 -0
- package/lib/types/client/chat/ChatGroupSeat.d.ts.map +1 -0
- package/lib/types/client/chat/ChatGroupSeat.js.map +1 -0
- package/lib/types/client/chat/ChatNodeSeat.d.ts.map +1 -0
- package/lib/types/client/chat/ChatNodeSeat.js.map +1 -0
- package/lib/types/client/chat/ChatView.d.ts +1 -1
- package/lib/types/client/chat/ChatView.d.ts.map +1 -0
- package/lib/types/client/chat/ChatView.js.map +1 -0
- package/lib/types/client/chat/CommandNodeView.d.ts.map +1 -0
- package/lib/types/client/chat/CommandNodeView.js.map +1 -0
- package/lib/types/client/chat/CompactionCommandCard.d.ts.map +1 -0
- package/lib/types/client/chat/CompactionCommandCard.js.map +1 -0
- package/lib/types/client/chat/CompactionItem.d.ts.map +1 -0
- package/lib/types/client/chat/CompactionItem.js.map +1 -0
- package/lib/types/client/chat/ContextBody.d.ts.map +1 -0
- package/lib/types/client/chat/ContextBody.js.map +1 -0
- package/lib/types/client/chat/ContextInjectionRow.d.ts.map +1 -0
- package/lib/types/client/chat/ContextInjectionRow.js.map +1 -0
- package/lib/types/client/chat/GenericCommandCard.d.ts.map +1 -0
- package/lib/types/client/chat/GenericCommandCard.js.map +1 -0
- package/lib/types/client/chat/MessageIconActions.d.ts.map +1 -0
- package/lib/types/client/chat/MessageIconActions.js.map +1 -0
- package/lib/types/client/chat/MessageItem.d.ts.map +1 -0
- package/lib/types/client/chat/MessageItem.js.map +1 -0
- package/lib/types/client/chat/QuotaNoticeHost.d.ts.map +1 -0
- package/lib/types/client/chat/QuotaNoticeHost.js.map +1 -0
- package/lib/types/client/chat/ReasoningContent.d.ts.map +1 -0
- package/lib/types/client/chat/ReasoningContent.js.map +1 -0
- package/lib/types/client/chat/ReasoningRow.d.ts.map +1 -0
- package/lib/types/client/chat/ReasoningRow.js.map +1 -0
- package/lib/types/client/chat/RunningStatus.d.ts.map +1 -0
- package/lib/types/client/chat/RunningStatus.js.map +1 -0
- package/lib/types/client/chat/RunningWhaleTail.d.ts.map +1 -0
- package/lib/types/client/chat/RunningWhaleTail.js.map +1 -0
- package/lib/types/client/chat/StatsPills.d.ts.map +1 -0
- package/lib/types/client/chat/StatsPills.js.map +1 -0
- package/lib/types/client/chat/SystemPromptRow.d.ts.map +1 -0
- package/lib/types/client/chat/SystemPromptRow.js.map +1 -0
- package/lib/types/client/chat/TurnNavigator.d.ts.map +1 -0
- package/lib/types/client/chat/TurnNavigator.js.map +1 -0
- package/lib/types/client/chat/TurnProcessNodeView.d.ts.map +1 -0
- package/lib/types/client/chat/TurnProcessNodeView.js.map +1 -0
- package/lib/types/client/chat/TurnTailNodeView.d.ts.map +1 -0
- package/lib/types/client/chat/TurnTailNodeView.js.map +1 -0
- package/lib/types/client/chat/TurnTriggerNodeView.d.ts.map +1 -0
- package/lib/types/client/chat/TurnTriggerNodeView.js.map +1 -0
- package/lib/types/client/chat/TurnUsagePanel.d.ts.map +1 -0
- package/lib/types/client/chat/TurnUsagePanel.js.map +1 -0
- package/lib/types/client/chat/UserContent.d.ts.map +1 -0
- package/lib/types/client/chat/UserContent.js.map +1 -0
- package/lib/types/client/chat/flow-motion.d.ts +2 -0
- package/lib/types/client/chat/flow-motion.d.ts.map +1 -0
- package/lib/types/client/chat/flow-motion.js.map +1 -0
- package/lib/types/client/chat/message-chrome.d.ts.map +1 -0
- package/lib/types/client/chat/message-chrome.js.map +1 -0
- package/lib/types/client/chat/register-node-renderers.d.ts.map +1 -0
- package/lib/types/client/chat/register-node-renderers.js.map +1 -0
- package/lib/types/client/chat/render-entry.d.ts.map +1 -0
- package/lib/types/client/chat/render-entry.js.map +1 -0
- package/lib/types/client/chat/searchable-hidden.d.ts.map +1 -0
- package/lib/types/client/chat/searchable-hidden.js.map +1 -0
- package/lib/types/client/chat/stat-dialog.d.ts +5 -10
- package/lib/types/client/chat/stat-dialog.d.ts.map +1 -0
- package/lib/types/client/chat/stat-dialog.js.map +1 -0
- package/lib/types/client/chat/step-process.d.ts.map +1 -0
- package/lib/types/client/chat/step-process.js.map +1 -0
- package/lib/types/client/chat/text-interaction.d.ts.map +1 -0
- package/lib/types/client/chat/text-interaction.js.map +1 -0
- package/lib/types/client/chat/text-selection.d.ts.map +1 -0
- package/lib/types/client/chat/text-selection.js.map +1 -0
- package/lib/types/client/chat/token-format.d.ts.map +1 -0
- package/lib/types/client/chat/token-format.js.map +1 -0
- package/lib/types/client/chat/turn-assistant.d.ts.map +1 -0
- package/lib/types/client/chat/turn-assistant.js.map +1 -0
- package/lib/types/client/chat/turn-rail-items.d.ts.map +1 -0
- package/lib/types/client/chat/turn-rail-items.js.map +1 -0
- package/lib/types/client/chat/turn-trigger.d.ts +3 -2
- package/lib/types/client/chat/turn-trigger.d.ts.map +1 -0
- package/lib/types/client/chat/turn-trigger.js.map +1 -0
- package/lib/types/client/chat/use-calendar-day.d.ts.map +1 -0
- package/lib/types/client/chat/use-calendar-day.js.map +1 -0
- package/lib/types/client/chat/use-chat-navigation.d.ts +21 -5
- package/lib/types/client/chat/use-chat-navigation.d.ts.map +1 -0
- package/lib/types/client/chat/use-chat-navigation.js.map +1 -0
- package/lib/types/client/chat/use-chat-reading.d.ts.map +1 -0
- package/lib/types/client/chat/use-chat-reading.js.map +1 -0
- package/lib/types/client/chat/use-chat-scroll.d.ts +5 -2
- package/lib/types/client/chat/use-chat-scroll.d.ts.map +1 -0
- package/lib/types/client/chat/use-chat-scroll.js.map +1 -0
- package/lib/types/client/chat/use-chat-viewport.d.ts +53 -0
- package/lib/types/client/chat/use-chat-viewport.d.ts.map +1 -0
- package/lib/types/client/chat/use-chat-viewport.js.map +1 -0
- package/lib/types/client/chat/use-disclosure.d.ts.map +1 -0
- package/lib/types/client/chat/use-disclosure.js.map +1 -0
- package/lib/types/client/chat/use-process-scroll.d.ts.map +1 -0
- package/lib/types/client/chat/use-process-scroll.js.map +1 -0
- package/lib/types/client/chat/use-scroll-follow.d.ts.map +1 -0
- package/lib/types/client/chat/use-scroll-follow.js.map +1 -0
- package/lib/types/client/chat/use-turn-data.d.ts.map +1 -0
- package/lib/types/client/chat/use-turn-data.js.map +1 -0
- package/lib/types/client/contract/assistant-content.d.ts.map +1 -0
- package/lib/types/client/contract/assistant-content.js.map +1 -0
- package/lib/types/client/contract/chat-nodes.d.ts.map +1 -0
- package/lib/types/client/contract/chat-nodes.js.map +1 -0
- package/lib/types/client/contract/chat-visibility.d.ts +2 -2
- package/lib/types/client/contract/chat-visibility.d.ts.map +1 -0
- package/lib/types/client/contract/chat-visibility.js.map +1 -0
- package/lib/types/client/contract/group-tree.d.ts.map +1 -0
- package/lib/types/client/contract/group-tree.js.map +1 -0
- package/lib/types/client/contract/process-groups.d.ts +6 -3
- package/lib/types/client/contract/process-groups.d.ts.map +1 -0
- package/lib/types/client/contract/process-groups.js.map +1 -0
- package/lib/types/client/contract/slots.d.ts +11 -2
- package/lib/types/client/contract/slots.d.ts.map +1 -0
- package/lib/types/client/contract/slots.js.map +1 -0
- package/lib/types/client/contract/snapshot.d.ts.map +1 -0
- package/lib/types/client/contract/snapshot.js.map +1 -0
- package/lib/types/client/contract/store.d.ts.map +1 -0
- package/lib/types/client/contract/store.js.map +1 -0
- package/lib/types/client/contract/turn-metrics.d.ts.map +1 -0
- package/lib/types/client/contract/turn-metrics.js.map +1 -0
- package/lib/types/client/contract/turn-process.d.ts.map +1 -0
- package/lib/types/client/contract/turn-process.js.map +1 -0
- package/lib/types/client/conversation-nodes/assistant.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/assistant.js.map +1 -0
- package/lib/types/client/conversation-nodes/chat-snapshot-builder.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/chat-snapshot-builder.js.map +1 -0
- package/lib/types/client/conversation-nodes/command.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/command.js.map +1 -0
- package/lib/types/client/conversation-nodes/common.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/common.js.map +1 -0
- package/lib/types/client/conversation-nodes/compaction.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/compaction.js.map +1 -0
- package/lib/types/client/conversation-nodes/event-projection.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/event-projection.js.map +1 -0
- package/lib/types/client/conversation-nodes/fallback.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/fallback.js.map +1 -0
- package/lib/types/client/conversation-nodes/group-tree-segments.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/group-tree-segments.js.map +1 -0
- package/lib/types/client/conversation-nodes/inbox.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/inbox.js.map +1 -0
- package/lib/types/client/conversation-nodes/message.d.ts +1 -1
- package/lib/types/client/conversation-nodes/message.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/message.js.map +1 -0
- package/lib/types/client/conversation-nodes/process-activity.d.ts +1 -0
- package/lib/types/client/conversation-nodes/process-activity.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/process-activity.js.map +1 -0
- package/lib/types/client/conversation-nodes/process-groups.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/process-groups.js.map +1 -0
- package/lib/types/client/conversation-nodes/register.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/register.js.map +1 -0
- package/lib/types/client/conversation-nodes/request-prompt.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/request-prompt.js.map +1 -0
- package/lib/types/client/conversation-nodes/retry.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/retry.js.map +1 -0
- package/lib/types/client/conversation-nodes/tool.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/tool.js.map +1 -0
- package/lib/types/client/conversation-nodes/turn-error.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/turn-error.js.map +1 -0
- package/lib/types/client/conversation-nodes/turn-max-tokens.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/turn-max-tokens.js.map +1 -0
- package/lib/types/client/conversation-nodes/turn-navigation.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/turn-navigation.js.map +1 -0
- package/lib/types/client/conversation-nodes/turn-process-presentation.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/turn-process-presentation.js.map +1 -0
- package/lib/types/client/conversation-nodes/turn-process.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/turn-process.js.map +1 -0
- package/lib/types/client/conversation-nodes/turn-tail.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/turn-tail.js.map +1 -0
- package/lib/types/client/fence/FenceLayers.d.ts +21 -0
- package/lib/types/client/fence/FenceLayers.d.ts.map +1 -0
- package/lib/types/client/fence/FenceLayers.js.map +1 -0
- package/lib/types/client/fence/register.d.ts +10 -0
- package/lib/types/client/fence/register.d.ts.map +1 -0
- package/lib/types/client/fence/register.js.map +1 -0
- package/lib/types/client/file-path.d.ts.map +1 -0
- package/lib/types/client/file-path.js.map +1 -0
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/index.js.map +1 -0
- package/lib/types/client/locale.d.ts +96 -0
- package/lib/types/client/locale.d.ts.map +1 -0
- package/lib/types/client/locale.js.map +1 -0
- package/lib/types/client/markdown-labels.d.ts.map +1 -0
- package/lib/types/client/markdown-labels.js.map +1 -0
- package/lib/types/client/model/conversation-context.d.ts.map +1 -0
- package/lib/types/client/model/conversation-context.js.map +1 -0
- package/lib/types/client/model/steering-history.d.ts.map +1 -0
- package/lib/types/client/model/steering-history.js.map +1 -0
- package/lib/types/client/model/tool-call-tree.d.ts.map +1 -0
- package/lib/types/client/model/tool-call-tree.js.map +1 -0
- package/lib/types/client/performance-usage.d.ts.map +1 -0
- package/lib/types/client/performance-usage.js.map +1 -0
- package/lib/types/client/presentation-policy.d.ts.map +1 -0
- package/lib/types/client/presentation-policy.js.map +1 -0
- package/lib/types/client/reasoning-text.d.ts.map +1 -0
- package/lib/types/client/reasoning-text.js.map +1 -0
- package/lib/types/client/settings/LinkOpeningRow.d.ts.map +1 -0
- package/lib/types/client/settings/LinkOpeningRow.js.map +1 -0
- package/lib/types/client/settings/PerformanceUsageRow.d.ts.map +1 -0
- package/lib/types/client/settings/PerformanceUsageRow.js.map +1 -0
- package/lib/types/client/settings/PreferenceRow.d.ts.map +1 -0
- package/lib/types/client/settings/PreferenceRow.js.map +1 -0
- package/lib/types/client/settings/TranscriptViewRow.d.ts.map +1 -0
- package/lib/types/client/settings/TranscriptViewRow.js.map +1 -0
- package/lib/types/client/stores.d.ts.map +1 -0
- package/lib/types/client/stores.js.map +1 -0
- package/lib/types/client/transcript-view.d.ts.map +1 -0
- package/lib/types/client/transcript-view.js.map +1 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js.map +1 -0
- package/package.json +44 -41
- package/src/chat-settings.ts +98 -0
- package/src/client/apply.ts +355 -0
- package/src/client/assets/running-whale@2x.png +0 -0
- package/src/client/chat/ApprovalCommand.tsx +42 -0
- package/src/client/chat/AssistantMarkdown.module.css +88 -0
- package/src/client/chat/AssistantMarkdown.tsx +170 -0
- package/src/client/chat/AssistantNodeView.tsx +67 -0
- package/src/client/chat/ChatFlow.tsx +100 -0
- package/src/client/chat/ChatGroupSeat.module.css +166 -0
- package/src/client/chat/ChatGroupSeat.tsx +208 -0
- package/src/client/chat/ChatNodeSeat.tsx +179 -0
- package/src/client/chat/ChatView.module.css +426 -0
- package/src/client/chat/ChatView.tsx +351 -0
- package/src/client/chat/CommandNodeView.tsx +40 -0
- package/src/client/chat/CompactionCommandCard.tsx +26 -0
- package/src/client/chat/CompactionItem.tsx +76 -0
- package/src/client/chat/ContextBody.module.css +161 -0
- package/src/client/chat/ContextBody.tsx +592 -0
- package/src/client/chat/ContextInjectionRow.module.css +68 -0
- package/src/client/chat/ContextInjectionRow.tsx +94 -0
- package/src/client/chat/GenericCommandCard.module.css +49 -0
- package/src/client/chat/GenericCommandCard.tsx +75 -0
- package/src/client/chat/MessageIconActions.module.css +116 -0
- package/src/client/chat/MessageIconActions.tsx +90 -0
- package/src/client/chat/MessageItem.module.css +360 -0
- package/src/client/chat/MessageItem.tsx +410 -0
- package/src/client/chat/QuotaNoticeHost.tsx +27 -0
- package/src/client/chat/ReasoningContent.tsx +26 -0
- package/src/client/chat/ReasoningRow.module.css +77 -0
- package/src/client/chat/ReasoningRow.tsx +112 -0
- package/src/client/chat/RunningStatus.tsx +48 -0
- package/src/client/chat/RunningWhaleTail.tsx +19 -0
- package/src/client/chat/StatsPills.module.css +63 -0
- package/src/client/chat/StatsPills.tsx +348 -0
- package/src/client/chat/SystemPromptRow.tsx +50 -0
- package/src/client/chat/TurnNavigator.module.css +223 -0
- package/src/client/chat/TurnNavigator.tsx +295 -0
- package/src/client/chat/TurnProcessNodeView.module.css +62 -0
- package/src/client/chat/TurnProcessNodeView.tsx +62 -0
- package/src/client/chat/TurnTailNodeView.module.css +12 -0
- package/src/client/chat/TurnTailNodeView.tsx +81 -0
- package/src/client/chat/TurnTriggerNodeView.module.css +50 -0
- package/src/client/chat/TurnTriggerNodeView.tsx +57 -0
- package/src/client/chat/TurnUsagePanel.module.css +79 -0
- package/src/client/chat/TurnUsagePanel.tsx +110 -0
- package/src/client/chat/UserContent.tsx +60 -0
- package/src/client/chat/accessibility.module.css +8 -0
- package/src/client/chat/flow-motion.ts +556 -0
- package/src/client/chat/message-chrome.ts +100 -0
- package/src/client/chat/register-node-renderers.ts +100 -0
- package/src/client/chat/render-entry.ts +16 -0
- package/src/client/chat/searchable-hidden.ts +45 -0
- package/src/client/chat/stat-dialog.module.css +149 -0
- package/src/client/chat/stat-dialog.ts +55 -0
- package/src/client/chat/step-process.ts +28 -0
- package/src/client/chat/text-interaction.ts +298 -0
- package/src/client/chat/text-selection.ts +180 -0
- package/src/client/chat/token-format.ts +98 -0
- package/src/client/chat/turn-assistant.ts +10 -0
- package/src/client/chat/turn-rail-items.ts +89 -0
- package/src/client/chat/turn-trigger.ts +88 -0
- package/src/client/chat/use-calendar-day.ts +25 -0
- package/src/client/chat/use-chat-navigation.ts +309 -0
- package/src/client/chat/use-chat-reading.ts +283 -0
- package/src/client/chat/use-chat-scroll.ts +209 -0
- package/src/client/chat/use-chat-viewport.ts +1130 -0
- package/src/client/chat/use-disclosure.ts +35 -0
- package/src/client/chat/use-process-scroll.ts +88 -0
- package/src/client/chat/use-scroll-follow.ts +182 -0
- package/src/client/chat/use-turn-data.ts +23 -0
- package/src/client/contract/assistant-content.ts +15 -0
- package/src/client/contract/chat-nodes.ts +135 -0
- package/src/client/contract/chat-visibility.ts +20 -0
- package/src/client/contract/group-tree.ts +37 -0
- package/src/client/contract/process-groups.ts +30 -0
- package/src/client/contract/slots.ts +508 -0
- package/src/client/contract/snapshot.ts +171 -0
- package/src/client/contract/store.ts +17 -0
- package/src/client/contract/turn-metrics.ts +43 -0
- package/src/client/contract/turn-process.ts +58 -0
- package/src/client/conversation-nodes/README.i18n.yaml +64 -0
- package/src/client/conversation-nodes/README.md +338 -0
- package/src/client/conversation-nodes/README.zh.md +338 -0
- package/src/client/conversation-nodes/assistant.ts +384 -0
- package/src/client/conversation-nodes/chat-snapshot-builder.ts +1244 -0
- package/src/client/conversation-nodes/command.ts +227 -0
- package/src/client/conversation-nodes/common.ts +83 -0
- package/src/client/conversation-nodes/compaction.ts +65 -0
- package/src/client/conversation-nodes/event-projection.ts +179 -0
- package/src/client/conversation-nodes/fallback.ts +41 -0
- package/src/client/conversation-nodes/group-tree-segments.ts +91 -0
- package/src/client/conversation-nodes/inbox.ts +148 -0
- package/src/client/conversation-nodes/message.ts +182 -0
- package/src/client/conversation-nodes/process-activity.ts +170 -0
- package/src/client/conversation-nodes/process-groups.ts +303 -0
- package/src/client/conversation-nodes/register.ts +38 -0
- package/src/client/conversation-nodes/request-prompt.ts +169 -0
- package/src/client/conversation-nodes/retry.ts +97 -0
- package/src/client/conversation-nodes/tool.ts +371 -0
- package/src/client/conversation-nodes/turn-error.ts +120 -0
- package/src/client/conversation-nodes/turn-max-tokens.ts +82 -0
- package/src/client/conversation-nodes/turn-navigation.ts +97 -0
- package/src/client/conversation-nodes/turn-process-presentation.ts +149 -0
- package/src/client/conversation-nodes/turn-process.ts +374 -0
- package/src/client/conversation-nodes/turn-tail.ts +164 -0
- package/src/client/fence/FenceLayers.tsx +33 -0
- package/src/client/fence/register.ts +22 -0
- package/src/client/file-path.ts +19 -0
- package/src/client/index.ts +69 -0
- package/src/client/locale.ts +1695 -0
- package/src/client/markdown-labels.ts +16 -0
- package/src/client/model/conversation-context.ts +24 -0
- package/src/client/model/steering-history.ts +64 -0
- package/src/client/model/tool-call-tree.ts +204 -0
- package/src/client/performance-usage.ts +34 -0
- package/src/client/presentation-policy.ts +109 -0
- package/src/client/reasoning-text.ts +25 -0
- package/src/client/settings/LinkOpeningRow.tsx +47 -0
- package/src/client/settings/PerformanceUsageRow.tsx +46 -0
- package/src/client/settings/PreferenceRow.module.css +66 -0
- package/src/client/settings/PreferenceRow.tsx +59 -0
- package/src/client/settings/TranscriptViewRow.tsx +93 -0
- package/src/client/stores.ts +62 -0
- package/src/client/transcript-view.ts +81 -0
- package/src/css-modules.d.ts +6 -0
- package/src/index.ts +45 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Localized copy adapters for Cordis-free Markdown primitives. */
|
|
2
|
+
|
|
3
|
+
import type { MarkdownLabels } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
+
import type { ChatViewSlotProps } from './contract/slots.ts'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Build the complete Markdown chrome copy for one locale revision.
|
|
8
|
+
* @param t - Chat locale seat.
|
|
9
|
+
* @returns Labels for code fences and footnotes.
|
|
10
|
+
*/
|
|
11
|
+
export function markdownLabels(t: ChatViewSlotProps['t']): MarkdownLabels {
|
|
12
|
+
return {
|
|
13
|
+
code: { copyLabel: t('copy'), copiedLabel: t('copied'), toolbarLabels: { codeLabel: t('codeBlock.title'), wrapLabel: t('codeBlock.wrap'), unwrapLabel: t('codeBlock.unwrap') } },
|
|
14
|
+
footnotes: t('markdown.footnotes'),
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ConversationNode, ConversationPromptSnapshot,
|
|
3
|
+
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
4
|
+
|
|
5
|
+
/** Operation that started a new append-only model context. */
|
|
6
|
+
export type ConversationContextOriginKind = 'compaction' | 'rewind' | 'rewrite'
|
|
7
|
+
|
|
8
|
+
/** One immutable model-context generation reconstructed from surface replacements. */
|
|
9
|
+
export interface ConversationContext {
|
|
10
|
+
/** Zero-based generation within the session; stable across later appends. */
|
|
11
|
+
id: number
|
|
12
|
+
/** Previous generation in this session; absent for the initial context. */
|
|
13
|
+
parentId?: number
|
|
14
|
+
/** Why this generation exists; absent for the initial context. */
|
|
15
|
+
origin?: ConversationContextOriginKind
|
|
16
|
+
/** Event seq of the replacement that created this generation. */
|
|
17
|
+
originSeq?: number
|
|
18
|
+
/** Unix epoch ms of the replacement that created this generation. */
|
|
19
|
+
createdAt?: number
|
|
20
|
+
/** Latest request header observed in this generation, inherited until a later header replaces it. */
|
|
21
|
+
prompt?: ConversationPromptSnapshot
|
|
22
|
+
/** Final frozen nodes for historical generations, or current folded nodes for the tail. */
|
|
23
|
+
nodes: readonly ConversationNode[]
|
|
24
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** Reconstruct durable steering identity from the event-sourced agent inbox. */
|
|
2
|
+
|
|
3
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session/types'
|
|
4
|
+
import type { InboxTarget } from '@deepseek-ai/dsh-agent/types'
|
|
5
|
+
|
|
6
|
+
/** Minimal pending identity retained while replaying durable inbox splices. */
|
|
7
|
+
interface PendingIdentity {
|
|
8
|
+
readonly id: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Client-side structural view of the host-owned inbox event. */
|
|
12
|
+
interface InboxSplice {
|
|
13
|
+
readonly target: InboxTarget
|
|
14
|
+
readonly start: number
|
|
15
|
+
readonly removedCount?: number
|
|
16
|
+
readonly inserted: readonly PendingIdentity[]
|
|
17
|
+
readonly outcome?: 'canceled'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Incrementally identifies `user/message` events claimed from the next-step
|
|
22
|
+
* inbox. The agent loop records all admitted input as `user/message`; the
|
|
23
|
+
* preceding `agent/inbox/spliced` events preserve whether it came from the
|
|
24
|
+
* queued-turn list or the next-step list.
|
|
25
|
+
*/
|
|
26
|
+
export class SteeringHistory {
|
|
27
|
+
private readonly inbox: Record<InboxTarget, PendingIdentity[]> = {
|
|
28
|
+
'next-turn': [],
|
|
29
|
+
'next-step': [],
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private readonly claimedNextStep = new Set<string>()
|
|
33
|
+
|
|
34
|
+
/** Clear all replay state before rebuilding a history window. */
|
|
35
|
+
reset(): void {
|
|
36
|
+
this.inbox['next-turn'] = []
|
|
37
|
+
this.inbox['next-step'] = []
|
|
38
|
+
this.claimedNextStep.clear()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Apply one event and report whether it is a durable human steering message.
|
|
43
|
+
* @param event - next raw session event in sequence order.
|
|
44
|
+
* @returns true only for a user-origin message previously claimed from `next-step`.
|
|
45
|
+
*/
|
|
46
|
+
apply(event: SessionEvent): boolean {
|
|
47
|
+
if (event.type === 'agent/inbox/spliced') {
|
|
48
|
+
this.applySplice(event.data)
|
|
49
|
+
return false
|
|
50
|
+
}
|
|
51
|
+
if (event.type !== 'user/message') return false
|
|
52
|
+
const id = event.data.id
|
|
53
|
+
if (!this.claimedNextStep.delete(id)) return false
|
|
54
|
+
return event.data.source.kind === 'user'
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Replay one host-validated inbox splice. */
|
|
58
|
+
private applySplice({ target, start, removedCount = 0, inserted, outcome }: InboxSplice): void {
|
|
59
|
+
const removed = this.inbox[target].splice(start, removedCount, ...inserted)
|
|
60
|
+
for (const identity of inserted) this.claimedNextStep.delete(identity.id)
|
|
61
|
+
if (target !== 'next-step' || outcome === 'canceled') return
|
|
62
|
+
for (const identity of removed) this.claimedNextStep.add(identity.id)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session/types'
|
|
2
|
+
import type {} from '@deepseek-ai/dsh-tool-executor-ptc/client'
|
|
3
|
+
import type {
|
|
4
|
+
ConversationNode, RunningToolCall, ToolCallBlock, ToolResultNode,
|
|
5
|
+
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
6
|
+
import { PartialArguments } from '@deepseek-ai/dsh-util-values'
|
|
7
|
+
|
|
8
|
+
interface ProjectedBlock {
|
|
9
|
+
source: ToolCallBlock
|
|
10
|
+
children: readonly ToolCallBlock[]
|
|
11
|
+
value: ToolCallBlock
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Fixed wire-safety ceiling for every recursive Tool call consumer. */
|
|
15
|
+
export const MAX_TOOL_CALL_TREE_DEPTH = 256
|
|
16
|
+
|
|
17
|
+
function sameReferences<T>(
|
|
18
|
+
left: readonly T[],
|
|
19
|
+
right: readonly T[],
|
|
20
|
+
): boolean {
|
|
21
|
+
return left.length === right.length
|
|
22
|
+
&& left.every((block, index) => block === right[index])
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Owns PTC dispatch pairing and projects its private parent index into the
|
|
27
|
+
* recursive Tool call contract exposed by conversation snapshots.
|
|
28
|
+
*/
|
|
29
|
+
export class ToolCallTree {
|
|
30
|
+
private readonly childrenByParent = new Map<string, readonly ToolCallBlock[]>()
|
|
31
|
+
private readonly depthByCall = new Map<string, number>()
|
|
32
|
+
private readonly projectedByCall = new Map<string, ProjectedBlock>()
|
|
33
|
+
private revision = 0
|
|
34
|
+
private nodesCache: {
|
|
35
|
+
source: readonly ConversationNode[]
|
|
36
|
+
revision: number
|
|
37
|
+
value: readonly ConversationNode[]
|
|
38
|
+
} | null = null
|
|
39
|
+
private runningCache: {
|
|
40
|
+
source: readonly RunningToolCall[]
|
|
41
|
+
revision: number
|
|
42
|
+
value: readonly RunningToolCall[]
|
|
43
|
+
} | null = null
|
|
44
|
+
|
|
45
|
+
/** Forget all event-derived child calls before replaying a new window. */
|
|
46
|
+
reset(): void {
|
|
47
|
+
this.childrenByParent.clear()
|
|
48
|
+
this.depthByCall.clear()
|
|
49
|
+
this.projectedByCall.clear()
|
|
50
|
+
this.revision++
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Fold one event when it belongs to the PTC dispatch lifecycle.
|
|
55
|
+
* @param event - Session event from the current live or history window.
|
|
56
|
+
* @returns Whether the event was consumed as a child-call lifecycle event.
|
|
57
|
+
*/
|
|
58
|
+
apply(event: SessionEvent): boolean {
|
|
59
|
+
if (event.type === 'tool/ptc-dispatch-start') {
|
|
60
|
+
const data = event.data
|
|
61
|
+
const running: RunningToolCall = {
|
|
62
|
+
phase: 'start',
|
|
63
|
+
callId: data.subCallId,
|
|
64
|
+
parentCallId: data.parentCallId,
|
|
65
|
+
name: data.name,
|
|
66
|
+
argsRaw: JSON.stringify(data.arguments),
|
|
67
|
+
args: PartialArguments.fromObject(data.arguments),
|
|
68
|
+
turn: 0,
|
|
69
|
+
step: 0,
|
|
70
|
+
time: event.time,
|
|
71
|
+
subCalls: [],
|
|
72
|
+
}
|
|
73
|
+
const siblings = this.childrenByParent.get(data.parentCallId) ?? []
|
|
74
|
+
if (!this.acceptEdge(data.parentCallId, data.subCallId)) return true
|
|
75
|
+
this.childrenByParent.set(data.parentCallId, [...siblings, running])
|
|
76
|
+
this.revision++
|
|
77
|
+
return true
|
|
78
|
+
}
|
|
79
|
+
if (event.type !== 'tool/ptc-dispatch') return false
|
|
80
|
+
const data = event.data
|
|
81
|
+
const siblings = this.childrenByParent.get(data.parentCallId) ?? []
|
|
82
|
+
const at = siblings.findIndex(sub => sub.callId === data.subCallId)
|
|
83
|
+
if (at === -1 && !this.acceptEdge(data.parentCallId, data.subCallId)) return true
|
|
84
|
+
const started = at === -1 ? undefined : siblings[at]
|
|
85
|
+
const settled: ToolResultNode = {
|
|
86
|
+
kind: 'tool-result',
|
|
87
|
+
seq: event.seq,
|
|
88
|
+
time: event.time,
|
|
89
|
+
callId: data.subCallId,
|
|
90
|
+
parentCallId: data.parentCallId,
|
|
91
|
+
name: data.name,
|
|
92
|
+
args: started !== undefined && !('kind' in started) ? started.args : PartialArguments.fromObject(data.arguments),
|
|
93
|
+
call: { name: data.name, argsRaw: JSON.stringify(data.arguments) },
|
|
94
|
+
callTime: started?.time ?? null,
|
|
95
|
+
content: data.content,
|
|
96
|
+
isError: data.isError,
|
|
97
|
+
subCalls: [],
|
|
98
|
+
}
|
|
99
|
+
this.childrenByParent.set(
|
|
100
|
+
data.parentCallId,
|
|
101
|
+
at === -1
|
|
102
|
+
? [...siblings, settled]
|
|
103
|
+
: siblings.map((sub, index) => index === at ? settled : sub),
|
|
104
|
+
)
|
|
105
|
+
this.revision++
|
|
106
|
+
return true
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Attach recursively projected children to all settled roots in a node list.
|
|
111
|
+
* @param nodes - Cache-stable base conversation nodes.
|
|
112
|
+
* @returns The original list when no root changed, otherwise a structurally shared list.
|
|
113
|
+
*/
|
|
114
|
+
projectNodes(nodes: readonly ConversationNode[]): readonly ConversationNode[] {
|
|
115
|
+
if (this.nodesCache?.source === nodes && this.nodesCache.revision === this.revision) {
|
|
116
|
+
return this.nodesCache.value
|
|
117
|
+
}
|
|
118
|
+
const projected = nodes.map((node): ConversationNode => {
|
|
119
|
+
if (node.kind !== 'tool-result') return node
|
|
120
|
+
return this.projectBlock(node) as ToolResultNode
|
|
121
|
+
})
|
|
122
|
+
const value = sameReferences(nodes, projected) ? nodes : projected
|
|
123
|
+
this.nodesCache = { source: nodes, revision: this.revision, value }
|
|
124
|
+
return value
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Attach recursively projected children to all running root calls.
|
|
129
|
+
* @param calls - Cache-stable base running calls.
|
|
130
|
+
* @returns The original list when no root changed, otherwise a structurally shared list.
|
|
131
|
+
*/
|
|
132
|
+
projectRunningCalls(calls: readonly RunningToolCall[]): readonly RunningToolCall[] {
|
|
133
|
+
if (this.runningCache?.source === calls && this.runningCache.revision === this.revision) {
|
|
134
|
+
return this.runningCache.value
|
|
135
|
+
}
|
|
136
|
+
const projected = calls.map(call => this.projectBlock(call) as RunningToolCall)
|
|
137
|
+
const value = sameReferences(calls, projected) ? calls : projected
|
|
138
|
+
this.runningCache = { source: calls, revision: this.revision, value }
|
|
139
|
+
return value
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private projectBlock(block: ToolCallBlock): ToolCallBlock {
|
|
143
|
+
const children = this.childrenByParent.get(block.callId) ?? block.subCalls
|
|
144
|
+
const projectedChildren = children.map(child => this.projectBlock(child))
|
|
145
|
+
const childValue = sameReferences(children, projectedChildren)
|
|
146
|
+
? children
|
|
147
|
+
: projectedChildren
|
|
148
|
+
const cached = this.projectedByCall.get(block.callId)
|
|
149
|
+
if (cached?.source === block && sameReferences(cached.children, childValue)) {
|
|
150
|
+
return cached.value
|
|
151
|
+
}
|
|
152
|
+
const value: ToolCallBlock = block.subCalls === childValue
|
|
153
|
+
? block
|
|
154
|
+
: { ...block, subCalls: childValue }
|
|
155
|
+
this.projectedByCall.set(block.callId, {
|
|
156
|
+
source: block,
|
|
157
|
+
children: childValue,
|
|
158
|
+
value,
|
|
159
|
+
})
|
|
160
|
+
return value
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Accept an edge only when every recursive consumer can traverse it safely.
|
|
165
|
+
* Host-minted ids exclude cycles and current bindings emit one level; a
|
|
166
|
+
* malformed wire/history edge is consumed without hiding the rest of the session.
|
|
167
|
+
*/
|
|
168
|
+
private acceptEdge(parentCallId: string, subCallId: string): boolean {
|
|
169
|
+
if (this.wouldCreateCycle(parentCallId, subCallId)) return false
|
|
170
|
+
const pending = [{
|
|
171
|
+
callId: subCallId,
|
|
172
|
+
depth: (this.depthByCall.get(parentCallId) ?? 1) + 1,
|
|
173
|
+
}]
|
|
174
|
+
const updates = new Map<string, number>()
|
|
175
|
+
for (const candidate of pending) {
|
|
176
|
+
const knownDepth = updates.get(candidate.callId)
|
|
177
|
+
?? this.depthByCall.get(candidate.callId)
|
|
178
|
+
?? 1
|
|
179
|
+
if (candidate.depth <= knownDepth) continue
|
|
180
|
+
if (candidate.depth > MAX_TOOL_CALL_TREE_DEPTH) return false
|
|
181
|
+
updates.set(candidate.callId, candidate.depth)
|
|
182
|
+
for (const child of this.childrenByParent.get(candidate.callId) ?? []) {
|
|
183
|
+
pending.push({ callId: child.callId, depth: candidate.depth + 1 })
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
for (const [callId, depth] of updates) this.depthByCall.set(callId, depth)
|
|
187
|
+
return true
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private wouldCreateCycle(parentCallId: string, subCallId: string): boolean {
|
|
191
|
+
if (parentCallId === subCallId) return true
|
|
192
|
+
const pending = [subCallId]
|
|
193
|
+
const visited = new Set(pending)
|
|
194
|
+
for (const callId of pending) {
|
|
195
|
+
for (const child of this.childrenByParent.get(callId) ?? []) {
|
|
196
|
+
if (child.callId === parentCallId) return true
|
|
197
|
+
if (visited.has(child.callId)) continue
|
|
198
|
+
visited.add(child.callId)
|
|
199
|
+
pending.push(child.callId)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return false
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Performance detail preference, live immediately and reconciled with accepted Host settings. */
|
|
2
|
+
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
3
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
4
|
+
import { DEFAULT_PERFORMANCE_USAGE, type ChatSettings, type PerformanceUsageMode } from '../chat-settings.ts'
|
|
5
|
+
|
|
6
|
+
/** Shared live preference for the settings row and chat statistics. */
|
|
7
|
+
export class PerformanceUsagePolicy {
|
|
8
|
+
private readonly unsubscribe: () => void
|
|
9
|
+
/** Current choice, reconciled with accepted Host settings when available. */
|
|
10
|
+
readonly mode = createSnapshotStore<PerformanceUsageMode>(DEFAULT_PERFORMANCE_USAGE)
|
|
11
|
+
|
|
12
|
+
/** @param host - Chat settings scope persisted through the Host. */
|
|
13
|
+
constructor(private readonly host: ConfigForm<ChatSettings>) {
|
|
14
|
+
const adopt = (): void => {
|
|
15
|
+
const accepted = host.getSnapshot().value?.performanceUsage
|
|
16
|
+
if (accepted !== undefined) this.mode.set(accepted)
|
|
17
|
+
}
|
|
18
|
+
this.unsubscribe = host.subscribe(adopt)
|
|
19
|
+
adopt()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Release the accepted-value subscription. */
|
|
23
|
+
dispose(): void { this.unsubscribe() }
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Publish a choice immediately and queue its Host write.
|
|
27
|
+
* @param mode - Statistics detail selected by the user.
|
|
28
|
+
*/
|
|
29
|
+
setMode(mode: PerformanceUsageMode): void {
|
|
30
|
+
if (mode === this.mode.getSnapshot()) return
|
|
31
|
+
this.mode.set(mode)
|
|
32
|
+
void this.host.set('performanceUsage', mode)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/** Chat presentation derived from Host-backed detail, collapse timing, and folded replies. */
|
|
2
|
+
|
|
3
|
+
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
|
|
4
|
+
import { DEFAULT_FOLDED_REPLIES, type CollapseTiming, type FoldedReplies, type TranscriptViewMode } from '../chat-settings.ts'
|
|
5
|
+
export { COLLAPSE_TIMINGS, FOLDED_REPLIES, type CollapseTiming, type FoldedReplies } from '../chat-settings.ts'
|
|
6
|
+
|
|
7
|
+
/** Presentation capabilities that one work-details mode enables. */
|
|
8
|
+
export interface ChatPresentationPolicy {
|
|
9
|
+
/** Preference identity for layout resets and diagnostics; renderers select the capabilities below. */
|
|
10
|
+
readonly mode: TranscriptViewMode
|
|
11
|
+
/** Saved collapse timing; completion retains the default immediate folding and scrolling. */
|
|
12
|
+
readonly collapseTiming: CollapseTiming
|
|
13
|
+
/** Assistant replies that stay visible while a completed Turn folds: every reply, or only the final answer. */
|
|
14
|
+
readonly foldedReplies: FoldedReplies
|
|
15
|
+
/** Whether a normally completed Turn folds its process rows behind the whole-Turn control. */
|
|
16
|
+
readonly foldCompletedTurns: boolean
|
|
17
|
+
/** Collapsible group headers for all Turns, historical Turns only, or no Turns. */
|
|
18
|
+
readonly stepGrouping: 'collapsed' | 'history' | 'none'
|
|
19
|
+
/** Show the running command, path, query, or reasoning detail in group titles. */
|
|
20
|
+
readonly liveProcessDetail: boolean
|
|
21
|
+
/** Whether a settled reasoning row previews its first line beside the Think title. */
|
|
22
|
+
readonly settledReasoningPreview: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const POLICIES: Readonly<Record<TranscriptViewMode, Omit<ChatPresentationPolicy, 'collapseTiming' | 'foldedReplies'>>> = {
|
|
26
|
+
compact: {
|
|
27
|
+
mode: 'compact',
|
|
28
|
+
foldCompletedTurns: true,
|
|
29
|
+
stepGrouping: 'collapsed',
|
|
30
|
+
liveProcessDetail: false,
|
|
31
|
+
settledReasoningPreview: false,
|
|
32
|
+
},
|
|
33
|
+
standard: {
|
|
34
|
+
mode: 'standard',
|
|
35
|
+
foldCompletedTurns: true,
|
|
36
|
+
stepGrouping: 'collapsed',
|
|
37
|
+
liveProcessDetail: true,
|
|
38
|
+
settledReasoningPreview: true,
|
|
39
|
+
},
|
|
40
|
+
detailed: {
|
|
41
|
+
mode: 'detailed',
|
|
42
|
+
foldCompletedTurns: true,
|
|
43
|
+
stepGrouping: 'history',
|
|
44
|
+
liveProcessDetail: true,
|
|
45
|
+
settledReasoningPreview: true,
|
|
46
|
+
},
|
|
47
|
+
verbose: {
|
|
48
|
+
mode: 'verbose',
|
|
49
|
+
foldCompletedTurns: false,
|
|
50
|
+
stepGrouping: 'none',
|
|
51
|
+
liveProcessDetail: false,
|
|
52
|
+
settledReasoningPreview: true,
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function withTiming(
|
|
57
|
+
collapseTiming: CollapseTiming,
|
|
58
|
+
foldedReplies: FoldedReplies,
|
|
59
|
+
): Readonly<Record<TranscriptViewMode, ChatPresentationPolicy>> {
|
|
60
|
+
return {
|
|
61
|
+
compact: { ...POLICIES.compact, collapseTiming, foldedReplies },
|
|
62
|
+
standard: { ...POLICIES.standard, collapseTiming, foldedReplies },
|
|
63
|
+
detailed: { ...POLICIES.detailed, collapseTiming, foldedReplies },
|
|
64
|
+
verbose: { ...POLICIES.verbose, collapseTiming, foldedReplies },
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const TIMING_POLICIES = {
|
|
69
|
+
completion: { all: withTiming('completion', 'all'), final: withTiming('completion', 'final') },
|
|
70
|
+
'next-input': { all: withTiming('next-input', 'all'), final: withTiming('next-input', 'final') },
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Resolve a stable policy for one detail mode, collapse timing, and folded-reply choice.
|
|
75
|
+
* @param mode - persisted work-details mode.
|
|
76
|
+
* @param collapseTiming - persisted timing; defaults to immediate completion folding.
|
|
77
|
+
* @param foldedReplies - persisted folded-reply choice; defaults to keeping every reply visible.
|
|
78
|
+
* @returns the same policy object for the same choices.
|
|
79
|
+
*/
|
|
80
|
+
export function presentationPolicyFor(
|
|
81
|
+
mode: TranscriptViewMode,
|
|
82
|
+
collapseTiming: CollapseTiming = 'completion',
|
|
83
|
+
foldedReplies: FoldedReplies = DEFAULT_FOLDED_REPLIES,
|
|
84
|
+
): ChatPresentationPolicy {
|
|
85
|
+
return TIMING_POLICIES[collapseTiming][foldedReplies][mode]
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Combine Host-backed detail, persisted timing, and folded replies without owning subscriptions.
|
|
90
|
+
* @param mode - live work-details mode.
|
|
91
|
+
* @param collapseTiming - live Host-backed collapse timing.
|
|
92
|
+
* @param foldedReplies - live Host-backed folded-reply choice.
|
|
93
|
+
* @returns observable policy whose subscriptions follow all three preferences.
|
|
94
|
+
*/
|
|
95
|
+
export function derivePresentationPolicy(
|
|
96
|
+
mode: ObservableSnapshot<TranscriptViewMode>,
|
|
97
|
+
collapseTiming: ObservableSnapshot<CollapseTiming>,
|
|
98
|
+
foldedReplies: ObservableSnapshot<FoldedReplies>,
|
|
99
|
+
): ObservableSnapshot<ChatPresentationPolicy> {
|
|
100
|
+
return {
|
|
101
|
+
getSnapshot: () => presentationPolicyFor(mode.getSnapshot(), collapseTiming.getSnapshot(), foldedReplies.getSnapshot()),
|
|
102
|
+
subscribe: (listener) => {
|
|
103
|
+
const unsubscribeMode = mode.subscribe(listener)
|
|
104
|
+
const unsubscribeTiming = collapseTiming.subscribe(listener)
|
|
105
|
+
const unsubscribeReplies = foldedReplies.subscribe(listener)
|
|
106
|
+
return () => { unsubscribeMode(); unsubscribeTiming(); unsubscribeReplies() }
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Display text preparation for model reasoning. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Prepare complete or streaming reasoning for display.
|
|
5
|
+
* @param text - original complete or streaming reasoning.
|
|
6
|
+
* @returns display text, or empty text when no displayable content is available.
|
|
7
|
+
*/
|
|
8
|
+
export function reasoningText(text: string): string {
|
|
9
|
+
if (text[0] !== '<') return text
|
|
10
|
+
/* v8 ignore start -- Custom rendering behavior is outside unit coverage. */
|
|
11
|
+
const opening = '<signature>'
|
|
12
|
+
if (opening.startsWith(text)) return ''
|
|
13
|
+
if (!text.startsWith(opening)) return text
|
|
14
|
+
const closing = '</signature>'
|
|
15
|
+
const end = text.indexOf(closing, opening.length)
|
|
16
|
+
if (end === -1) return ''
|
|
17
|
+
let start = end + closing.length
|
|
18
|
+
while (start < text.length) {
|
|
19
|
+
if (text[start] === '\n') start++
|
|
20
|
+
else if (text[start] === '\r' && text[start + 1] === '\n') start += 2
|
|
21
|
+
else break
|
|
22
|
+
}
|
|
23
|
+
return text.slice(start)
|
|
24
|
+
/* v8 ignore stop */
|
|
25
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** General Settings row for Chat HTTP(S) link destinations. */
|
|
2
|
+
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
|
|
3
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
|
4
|
+
import type { LinkOpening } from '../../chat-settings.ts'
|
|
5
|
+
import { PreferenceRow } from './PreferenceRow.tsx'
|
|
6
|
+
|
|
7
|
+
/** Registration-side link-opening preference. */
|
|
8
|
+
export interface LinkOpeningRowInjected {
|
|
9
|
+
hooks: {
|
|
10
|
+
/** Current destination, bound as useLinkOpening. */
|
|
11
|
+
linkOpening: ObservableSnapshot<LinkOpening>
|
|
12
|
+
/** Whether the built-in browser is registered, bound as useBrowserAvailable. */
|
|
13
|
+
browserAvailable: ObservableSnapshot<boolean>
|
|
14
|
+
}
|
|
15
|
+
/** Change the default destination for Chat HTTP(S) links. */
|
|
16
|
+
setLinkOpening: (destination: LinkOpening) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Full Settings-row props. */
|
|
20
|
+
export type LinkOpeningRowProps =
|
|
21
|
+
PropsRuntime<'settings.general.item'>
|
|
22
|
+
& PropsLocale<'chat'>
|
|
23
|
+
& InjectFace<LinkOpeningRowInjected>
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Render the link-opening destination selector.
|
|
27
|
+
* @param props - Composed Settings slot props.
|
|
28
|
+
* @returns The preference row.
|
|
29
|
+
*/
|
|
30
|
+
export function LinkOpeningRow({ useLinkOpening, useBrowserAvailable, setLinkOpening, t }: LinkOpeningRowProps) {
|
|
31
|
+
const destination = useLinkOpening(value => value)
|
|
32
|
+
const browserAvailable = useBrowserAvailable(value => value)
|
|
33
|
+
if (!browserAvailable) return null
|
|
34
|
+
return (
|
|
35
|
+
<PreferenceRow
|
|
36
|
+
title={t('settings.links.title')}
|
|
37
|
+
description={t('settings.links.description')}
|
|
38
|
+
value={destination}
|
|
39
|
+
selectedLabel={t(destination === 'sidebar' ? 'settings.links.sidebar' : 'settings.links.newTab')}
|
|
40
|
+
options={[
|
|
41
|
+
{ id: 'sidebar', label: t('settings.links.sidebar') },
|
|
42
|
+
{ id: 'new-tab', label: t('settings.links.newTab') },
|
|
43
|
+
]}
|
|
44
|
+
onSelect={(value) => { setLinkOpening(value as LinkOpening) }}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** General Settings row for performance and usage detail. */
|
|
2
|
+
|
|
3
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
|
4
|
+
import type { PerformanceUsageMode } from '../../chat-settings.ts'
|
|
5
|
+
import type { PerformanceUsageInjected } from '../contract/slots.ts'
|
|
6
|
+
import type { ChatKey } from '../locale.ts'
|
|
7
|
+
import { PreferenceRow } from './PreferenceRow.tsx'
|
|
8
|
+
|
|
9
|
+
/** Registration-side performance and usage preference face. */
|
|
10
|
+
export interface PerformanceUsageRowInjected extends PerformanceUsageInjected {
|
|
11
|
+
/** Change the performance and usage detail. */
|
|
12
|
+
setPerformanceUsage: (mode: PerformanceUsageMode) => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Full Settings-row props. */
|
|
16
|
+
export type PerformanceUsageRowProps =
|
|
17
|
+
PropsRuntime<'settings.general.item'>
|
|
18
|
+
& PropsLocale<'chat'>
|
|
19
|
+
& InjectFace<PerformanceUsageRowInjected>
|
|
20
|
+
|
|
21
|
+
const OPTIONS: readonly { id: PerformanceUsageMode; label: ChatKey }[] = [
|
|
22
|
+
{ id: 'compact', label: 'settings.performance.compact' },
|
|
23
|
+
{ id: 'detailed', label: 'settings.performance.detailed' },
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Render the performance and usage detail selector.
|
|
28
|
+
* @param props - composed Settings slot props.
|
|
29
|
+
* @returns the preference row.
|
|
30
|
+
*/
|
|
31
|
+
export function PerformanceUsageRow({ usePerformanceUsage, setPerformanceUsage, t }: PerformanceUsageRowProps) {
|
|
32
|
+
const mode = usePerformanceUsage(value => value)
|
|
33
|
+
const selectedLabel = mode === 'detailed'
|
|
34
|
+
? 'settings.performance.detailed'
|
|
35
|
+
: 'settings.performance.compact'
|
|
36
|
+
return (
|
|
37
|
+
<PreferenceRow
|
|
38
|
+
title={t('settings.performance.title')}
|
|
39
|
+
description={t('settings.performance.description')}
|
|
40
|
+
value={mode}
|
|
41
|
+
selectedLabel={t(selectedLabel)}
|
|
42
|
+
options={OPTIONS.map(option => ({ id: option.id, label: t(option.label) }))}
|
|
43
|
+
onSelect={(value) => { setPerformanceUsage(value as PerformanceUsageMode) }}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* Chat preference row: label plus selector pill. */
|
|
2
|
+
|
|
3
|
+
.row {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: 8px;
|
|
7
|
+
padding: 16px 0;
|
|
8
|
+
border-bottom: 0.5px solid var(--dsw-alias-border-l2);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.rowText {
|
|
12
|
+
flex: 1;
|
|
13
|
+
min-width: 0;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 4px;
|
|
17
|
+
padding-right: 48px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Narrow settings panel: the 48px gutter separates the label from its control
|
|
21
|
+
across a wide row and only squeezes the label here. */
|
|
22
|
+
@media (max-width: 767px) {
|
|
23
|
+
:global(html:not([data-windows-titlebar]):not([data-platform='darwin'])) .rowText {
|
|
24
|
+
padding-right: 16px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.title {
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
line-height: 22px;
|
|
32
|
+
color: var(--dsw-alias-label-primary);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.desc {
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
font-weight: 400;
|
|
38
|
+
line-height: 18px;
|
|
39
|
+
color: var(--dsw-alias-label-tertiary);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.selector {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 12px;
|
|
46
|
+
height: 36px;
|
|
47
|
+
padding: 0 14px;
|
|
48
|
+
border: none;
|
|
49
|
+
border-radius: var(--dsw-radius-md);
|
|
50
|
+
background: var(--dsw-alias-bg-module-platform);
|
|
51
|
+
font: inherit;
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
line-height: 22px;
|
|
54
|
+
color: var(--dsw-alias-label-primary);
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@media (hover: hover) {
|
|
59
|
+
.selector:hover {
|
|
60
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.chevron {
|
|
65
|
+
flex: none;
|
|
66
|
+
}
|