@deepseek-ai/dsh-client-ui-chat 0.2.2-alpha.3 → 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 +47 -44
- 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,351 @@
|
|
|
1
|
+
// An enclosing `[data-conversation-scroll]` owns scrolling when present;
|
|
2
|
+
// otherwise this view owns it. Each row subscribes to one stable node key.
|
|
3
|
+
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
5
|
+
import type {
|
|
6
|
+
NodeKey, RenderEntry,
|
|
7
|
+
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
8
|
+
import type { InboxState } from '@deepseek-ai/dsh-agent/types'
|
|
9
|
+
import type { PendingSubmission } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
10
|
+
import {
|
|
11
|
+
Button, FenceCodeBlock, IconChevronDownOutlineRegular, MarkdownDelegateProvider, Modal,
|
|
12
|
+
type MarkdownDelegateFenceInfo, type MarkdownMenuTarget,
|
|
13
|
+
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
14
|
+
import { isAtOrOutside } from '../contract/group-tree.ts'
|
|
15
|
+
import type { ChatFlowHookContext, ChatViewSlotProps, OpenFileOptions } from '../contract/slots.ts'
|
|
16
|
+
import type { ChatSnapshot } from '../contract/snapshot.ts'
|
|
17
|
+
import { markdownLabels } from '../markdown-labels.ts'
|
|
18
|
+
import { TurnNavigator } from './TurnNavigator.tsx'
|
|
19
|
+
import { mergeTurnRailItems } from './turn-rail-items.ts'
|
|
20
|
+
import { useTextInteraction } from './text-interaction.ts'
|
|
21
|
+
import { useChatScroll } from './use-chat-scroll.ts'
|
|
22
|
+
import { fileMediaUrl, resolveWorkspacePath, sessionFileAddress } from '@deepseek-ai/dsh-util-workspace-path'
|
|
23
|
+
import css from './ChatView.module.css'
|
|
24
|
+
|
|
25
|
+
/** Host/OS refusal text for the file-open dialog; empty throws keep a locale fallback. */
|
|
26
|
+
function openFailureMessage(error: unknown, fallback: string): string {
|
|
27
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
28
|
+
return message === '' ? fallback : message
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Durable input identities suppress matching echoes in the same render.
|
|
33
|
+
* The last input's Turn also distinguishes an empty opening control from
|
|
34
|
+
* one whose human input or trigger notice is already present.
|
|
35
|
+
*/
|
|
36
|
+
function observedInputs(
|
|
37
|
+
order: readonly string[],
|
|
38
|
+
nodes: ChatSnapshot['nodes'],
|
|
39
|
+
): { readonly rpcIds: ReadonlySet<string>; readonly lastInputTurn: number | undefined } {
|
|
40
|
+
const observed = new Set<string>()
|
|
41
|
+
let lastInputTurn: number | undefined
|
|
42
|
+
for (const key of order) {
|
|
43
|
+
const node = nodes.get(key)
|
|
44
|
+
if (node === undefined || !isAtOrOutside(node, 'input')) continue
|
|
45
|
+
if (node.location.kind === 'turn' || node.location.kind === 'step') lastInputTurn = node.location.turn.turn
|
|
46
|
+
const data: unknown = node.data
|
|
47
|
+
const source = typeof data === 'object' && data !== null && 'source' in data ? data.source : undefined
|
|
48
|
+
if (typeof source === 'object' && source !== null && 'kind' in source && source.kind === 'user'
|
|
49
|
+
&& 'rpcId' in source && typeof source.rpcId === 'string') observed.add(source.rpcId)
|
|
50
|
+
}
|
|
51
|
+
return { rpcIds: observed, lastInputTurn }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type PendingInput = PendingSubmission | InboxState['next-step'][number]
|
|
55
|
+
|
|
56
|
+
/** How long fold transitions stay enabled after a Turn stops running. */
|
|
57
|
+
const MOTION_TAIL_MS = 800
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The chat view slot entry: pure component over the composed props; each
|
|
61
|
+
* ordered business Node crosses the keyed renderer seat.
|
|
62
|
+
*/
|
|
63
|
+
export function ChatView({
|
|
64
|
+
useSession, useChat, useConversation, useSessions, renderSlot,
|
|
65
|
+
sessionId, openFile, openExternalLink, resolveFilePath, useContextMenu,
|
|
66
|
+
loadOlder, consumeOlder, loadThrough, loadImage, inspectCall, chatScroll, forkAt,
|
|
67
|
+
usePresentation, useProjection, useInteractionIds, dispatchInteraction, t, fileDrag,
|
|
68
|
+
}: ChatViewSlotProps) {
|
|
69
|
+
const { getTriggerProps } = useContextMenu()
|
|
70
|
+
const getMarkdownTriggerProps = useCallback((target: MarkdownMenuTarget) => getTriggerProps(() => {
|
|
71
|
+
switch (target.kind) {
|
|
72
|
+
case 'file': return { kind: 'file', value: { sessionId, path: resolveFilePath(target.path),
|
|
73
|
+
...(target.line === undefined ? {} : { line: target.line }) } }
|
|
74
|
+
case 'url': return { kind: 'url', value: { sessionId, url: target.url } }
|
|
75
|
+
case 'image': return { kind: 'image', value: { sessionId, url: target.url,
|
|
76
|
+
...(target.name === undefined ? {} : { name: target.name }),
|
|
77
|
+
...(target.mediaType === undefined ? {} : { mediaType: target.mediaType }),
|
|
78
|
+
...(target.path === undefined ? {} : { path: resolveFilePath(target.path) }) } }
|
|
79
|
+
}
|
|
80
|
+
}), [getTriggerProps, resolveFilePath, sessionId])
|
|
81
|
+
const order = useChat(s => s.order)
|
|
82
|
+
const groupedEntries = useConversation(snapshot => snapshot.views.grouped('chat')?.entries)
|
|
83
|
+
const entries = useMemo<readonly RenderEntry[]>(() => groupedEntries
|
|
84
|
+
?? order.map(key => ({ kind: 'node', key: key as NodeKey })), [groupedEntries, order])
|
|
85
|
+
const nodeStore = useChat(s => s.nodes)
|
|
86
|
+
const deferCompletedTurns = usePresentation(policy => policy.collapseTiming === 'next-input')
|
|
87
|
+
const transcriptView = usePresentation(policy => policy.mode)
|
|
88
|
+
// The rail's items are accumulated in the Chat snapshot, so this selector is
|
|
89
|
+
// both the data and its change signal: the array identity moves only when a
|
|
90
|
+
// Turn enters, leaves, or changes its preview.
|
|
91
|
+
const turnNavigationItems = useChat(s => s.navigation.items())
|
|
92
|
+
// Host-computed whole-log outline; the merge is view-layer only (the
|
|
93
|
+
// conversation snapshot never carries projection values).
|
|
94
|
+
const turnOutline = useProjection('turnOutline')
|
|
95
|
+
const railItems = useMemo(
|
|
96
|
+
() => mergeTurnRailItems(turnNavigationItems, turnOutline),
|
|
97
|
+
[turnNavigationItems, turnOutline],
|
|
98
|
+
)
|
|
99
|
+
const inbox = useProjection('inbox') as InboxState | undefined
|
|
100
|
+
// Workspace root off the session list row: path summaries display relative to it.
|
|
101
|
+
const cwd = useSessions(s => s.byId[sessionId]?.cwd)
|
|
102
|
+
const fileImages = useMemo(() => ({
|
|
103
|
+
fileDrag,
|
|
104
|
+
resolve: (path: string) => fileMediaUrl(document.baseURI, resolveWorkspacePath(cwd, path)),
|
|
105
|
+
resourceAddress: (path: string) => sessionFileAddress(sessionId, resolveWorkspacePath(cwd, path)),
|
|
106
|
+
labels: {
|
|
107
|
+
open: t('image.open'), loading: t('image.loading'), failed: t('image.failed'),
|
|
108
|
+
dialog: t('image.dialog'), close: t('image.close'),
|
|
109
|
+
},
|
|
110
|
+
}), [cwd, t, fileDrag, sessionId])
|
|
111
|
+
const codeLabels = useMemo(() => markdownLabels(t).code, [t])
|
|
112
|
+
// Every fence in the flow dispatches by language; the content is the plain
|
|
113
|
+
// code block, so a language without a layer renders as code without diff rows.
|
|
114
|
+
const renderCode = useCallback((fence: MarkdownDelegateFenceInfo) => renderSlot('conversation.chat.markdown.fence', fence, {
|
|
115
|
+
entryKey: fence.lang,
|
|
116
|
+
children: (
|
|
117
|
+
<FenceCodeBlock lang={fence.lang} code={fence.code} streaming={fence.streaming} labels={codeLabels} diff={false} />
|
|
118
|
+
),
|
|
119
|
+
}), [renderSlot, codeLabels])
|
|
120
|
+
const running = useSession(s => s.running)
|
|
121
|
+
// Fold transitions run while a Turn is live, while an input is pending, and briefly after settling.
|
|
122
|
+
const [motionTail, setMotionTail] = useState(false)
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (!deferCompletedTurns) {
|
|
125
|
+
setMotionTail(false)
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
if (running) {
|
|
129
|
+
setMotionTail(true)
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
const timer = setTimeout(() => { setMotionTail(false) }, MOTION_TAIL_MS)
|
|
133
|
+
return () => { clearTimeout(timer) }
|
|
134
|
+
}, [running, deferCompletedTurns])
|
|
135
|
+
const openState = useSession(s => s.openState)
|
|
136
|
+
const openError = useSession(s => s.openError)
|
|
137
|
+
const hasMore = useSession(s => s.hasMore)
|
|
138
|
+
const loadingOlder = useSession(s => s.loadingOlder)
|
|
139
|
+
const historyLoadStatus = useSession(s => s.historyLoadStatus)
|
|
140
|
+
const historyWasPartial = useSession(s => s.historyWasPartial)
|
|
141
|
+
const [fileOpenError, setFileOpenError] = useState<{ path: string; message: string } | null>(null)
|
|
142
|
+
const [fileOpenBusy, setFileOpenBusy] = useState(false)
|
|
143
|
+
// Close/retry must ignore a settlement that started before the latest
|
|
144
|
+
// gesture; otherwise a cancelled in-flight refusal reopens the dialog.
|
|
145
|
+
const fileOpenRequest = useRef(0)
|
|
146
|
+
|
|
147
|
+
const requestOpenFile = useCallback((path: string, options?: OpenFileOptions) => {
|
|
148
|
+
const id = ++fileOpenRequest.current
|
|
149
|
+
setFileOpenBusy(true)
|
|
150
|
+
void (options === undefined ? openFile(path) : openFile(path, options)).then(
|
|
151
|
+
() => {
|
|
152
|
+
if (id !== fileOpenRequest.current) return
|
|
153
|
+
setFileOpenError(null)
|
|
154
|
+
setFileOpenBusy(false)
|
|
155
|
+
},
|
|
156
|
+
(error: unknown) => {
|
|
157
|
+
if (id !== fileOpenRequest.current) return
|
|
158
|
+
setFileOpenError({
|
|
159
|
+
path,
|
|
160
|
+
message: openFailureMessage(
|
|
161
|
+
error,
|
|
162
|
+
t('fileOpen.unknown'),
|
|
163
|
+
),
|
|
164
|
+
})
|
|
165
|
+
setFileOpenBusy(false)
|
|
166
|
+
},
|
|
167
|
+
)
|
|
168
|
+
}, [openFile, t])
|
|
169
|
+
|
|
170
|
+
const closeFileOpenError = useCallback(() => {
|
|
171
|
+
fileOpenRequest.current += 1
|
|
172
|
+
setFileOpenError(null)
|
|
173
|
+
setFileOpenBusy(false)
|
|
174
|
+
}, [])
|
|
175
|
+
|
|
176
|
+
const inboxSteering = useMemo(
|
|
177
|
+
() => inbox?.['next-step'].filter(message => message.source.kind === 'user') ?? [],
|
|
178
|
+
[inbox],
|
|
179
|
+
)
|
|
180
|
+
const pendingSubmissions = useSession(s => s.pendingSubmissions)
|
|
181
|
+
// Submission echoes still awaiting their durable counterpart. `order` is the
|
|
182
|
+
// recompute trigger: durable user material always arrives as an append, and
|
|
183
|
+
// every append replaces the order array.
|
|
184
|
+
const [visibleSubmissions, lastInputTurn] = useMemo(() => {
|
|
185
|
+
if (pendingSubmissions.length === 0) return [pendingSubmissions, undefined] as const
|
|
186
|
+
const observed = observedInputs(order, nodeStore)
|
|
187
|
+
return [pendingSubmissions.filter(submission => (
|
|
188
|
+
submission.placement !== 'queued' && !observed.rpcIds.has(submission.requestId)
|
|
189
|
+
)), observed.lastInputTurn] as const
|
|
190
|
+
}, [pendingSubmissions, order, nodeStore])
|
|
191
|
+
const pendingInputs = useMemo(() => {
|
|
192
|
+
const local = new Map(visibleSubmissions.map(submission => [submission.requestId, submission]))
|
|
193
|
+
// Admitted local identities outlive their bubbles until the Inbox claim watermark.
|
|
194
|
+
const localIds = new Set(pendingSubmissions.filter(submission => submission.placement !== 'queued')
|
|
195
|
+
.map(submission => submission.requestId))
|
|
196
|
+
const pending = inboxSteering.flatMap<PendingInput>((item) => {
|
|
197
|
+
const source = item.source
|
|
198
|
+
if (source.kind !== 'user' || !('rpcId' in source)) return [item]
|
|
199
|
+
const submission = local.get(source.rpcId)
|
|
200
|
+
if (submission === undefined) return localIds.has(source.rpcId) ? [] : [item]
|
|
201
|
+
local.delete(source.rpcId)
|
|
202
|
+
return [submission]
|
|
203
|
+
})
|
|
204
|
+
return [...pending, ...local.values()]
|
|
205
|
+
}, [inboxSteering, pendingSubmissions, visibleSubmissions])
|
|
206
|
+
const deferCollapse = deferCompletedTurns
|
|
207
|
+
&& !pendingInputs.some(item => 'requestId' in item && item.placement === 'transcript')
|
|
208
|
+
|
|
209
|
+
const firstKey = order[0]
|
|
210
|
+
const firstSeq = firstKey === undefined ? null : nodeStore.get(firstKey)?.anchorSeq ?? null
|
|
211
|
+
const lastKey = order.at(-1) ?? null
|
|
212
|
+
const latestSteering = pendingInputs.findLast(item => 'source' in item)
|
|
213
|
+
const steeringId = latestSteering?.source.kind === 'user' && 'rpcId' in latestSteering.source
|
|
214
|
+
? latestSteering.source.rpcId : latestSteering?.id ?? null
|
|
215
|
+
const scroll = useChatScroll({
|
|
216
|
+
isOpen: openState === 'open',
|
|
217
|
+
order, firstSeq, lastKey, running, loadingOlder, historyLoadStatus, hasMore, chatScroll,
|
|
218
|
+
loadOlder, consumeOlder, loadThrough, deferCompletedTurns,
|
|
219
|
+
lastIsUser: lastKey !== null && nodeStore.get(lastKey)?.kind === 'user',
|
|
220
|
+
steeringId,
|
|
221
|
+
submissionId: visibleSubmissions.at(-1)?.requestId ?? null,
|
|
222
|
+
submissionSteers: visibleSubmissions.at(-1)?.placement === 'steering',
|
|
223
|
+
loadedTurns: turnNavigationItems,
|
|
224
|
+
transcriptView,
|
|
225
|
+
})
|
|
226
|
+
const interactionSurfaceRef = useRef<HTMLDivElement>(null)
|
|
227
|
+
const interactionIds = useInteractionIds(ids => ids)
|
|
228
|
+
const textInteraction = useTextInteraction(scroll.columnRef, interactionSurfaceRef, dispatchInteraction, interactionIds)
|
|
229
|
+
const flowContext = useMemo<ChatFlowHookContext>(() => ({ motion: scroll.motion }), [scroll.motion])
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<div className={css.frame}>
|
|
233
|
+
{scroll.initialized && (
|
|
234
|
+
<TurnNavigator
|
|
235
|
+
items={railItems}
|
|
236
|
+
activeTurn={scroll.activeTurn}
|
|
237
|
+
busyTurn={scroll.busyTurn}
|
|
238
|
+
onNavigate={scroll.navigateToTurn}
|
|
239
|
+
t={t}
|
|
240
|
+
/>
|
|
241
|
+
)}
|
|
242
|
+
<div className={css.root} data-chat-following-tail={scroll.followingTail ? '' : undefined}>
|
|
243
|
+
<div ref={scroll.listRef} className={css.scroll}>
|
|
244
|
+
<div ref={scroll.columnRef} className={css.column} data-chat-flow=""
|
|
245
|
+
data-chat-motion={deferCompletedTurns && scroll.initialized
|
|
246
|
+
&& (running || motionTail || pendingInputs.length > 0) ? '' : undefined}>
|
|
247
|
+
{openState === 'loading' && <div className={css.hint}>{t('chat.loadingHistory')}</div>}
|
|
248
|
+
{openState === 'error' && openError !== null && (
|
|
249
|
+
<div className={css.openError}>
|
|
250
|
+
{t('chat.loadError', { message: openError.message, code: openError.code })}
|
|
251
|
+
</div>
|
|
252
|
+
)}
|
|
253
|
+
{(hasMore || historyWasPartial) && (
|
|
254
|
+
<div className={css.older} ref={scroll.historyEdgeRef} data-chat-history={historyLoadStatus}>
|
|
255
|
+
<button type="button" disabled={!hasMore}
|
|
256
|
+
onClick={scroll.loadEarlier}>
|
|
257
|
+
{([
|
|
258
|
+
['more', t('chat.loadOlder')],
|
|
259
|
+
['loading', t('chat.loadingOlder')],
|
|
260
|
+
['processing', t('chat.processingOlder')],
|
|
261
|
+
['error', t('chat.retryOlder')],
|
|
262
|
+
['start', t('chat.historyStart')],
|
|
263
|
+
] as const).map(([state, label]) => {
|
|
264
|
+
const current = !hasMore ? 'start' : loadingOlder ? 'loading'
|
|
265
|
+
: historyLoadStatus === 'error' ? 'error'
|
|
266
|
+
: scroll.historyInputHeld ? 'more'
|
|
267
|
+
: scroll.historyProcessing ? 'processing' : 'more'
|
|
268
|
+
return <span key={state} aria-hidden={state !== current}
|
|
269
|
+
className={state === current ? undefined : css.historyHidden}>{label}</span>
|
|
270
|
+
})}
|
|
271
|
+
</button>
|
|
272
|
+
</div>
|
|
273
|
+
)}
|
|
274
|
+
<MarkdownDelegateProvider
|
|
275
|
+
getTriggerProps={getMarkdownTriggerProps}
|
|
276
|
+
openFile={requestOpenFile}
|
|
277
|
+
openExternalLink={openExternalLink}
|
|
278
|
+
fileImages={fileImages}
|
|
279
|
+
renderCode={renderCode}
|
|
280
|
+
>
|
|
281
|
+
{renderSlot('conversation.chat.flow', {
|
|
282
|
+
entries, pendingInputs, lastInputTurn, deferCollapse,
|
|
283
|
+
cwd, openFile: requestOpenFile, inspectCall, forkAt, loadImage,
|
|
284
|
+
}, { hookContext: flowContext })}
|
|
285
|
+
</MarkdownDelegateProvider>
|
|
286
|
+
<div ref={interactionSurfaceRef} className={css.textInteraction} data-text-interaction-surface=""
|
|
287
|
+
aria-hidden={textInteraction.active === null}>
|
|
288
|
+
{textInteraction.active !== null && renderSlot('conversation.chat.text-interaction', {
|
|
289
|
+
trigger: textInteraction.active.trigger, readText: textInteraction.readText,
|
|
290
|
+
dismiss: textInteraction.dismiss, clearSelection: textInteraction.clearSelection,
|
|
291
|
+
}, { entryKey: textInteraction.active.id })}
|
|
292
|
+
</div>
|
|
293
|
+
{/* No pending placeholders: questions (ui-user-questions) and approvals
|
|
294
|
+
(ApprovalPanel) both take over the composer, so a flow card would
|
|
295
|
+
double-render the same wait. */}
|
|
296
|
+
</div>
|
|
297
|
+
{/* Fold room is reclaimed by viewport scroll, content-growth, and display-mode policies. */}
|
|
298
|
+
<div className={css.turnSpacer} data-chat-turn-spacer aria-hidden="true" />
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
{!scroll.followingTail && (
|
|
302
|
+
<div className={css.toBottomSlot}>
|
|
303
|
+
<button
|
|
304
|
+
type="button"
|
|
305
|
+
className={css.toBottom}
|
|
306
|
+
aria-label={t('chat.toBottom')}
|
|
307
|
+
onClick={scroll.returnToBottom}
|
|
308
|
+
>
|
|
309
|
+
<IconChevronDownOutlineRegular />
|
|
310
|
+
</button>
|
|
311
|
+
</div>
|
|
312
|
+
)}
|
|
313
|
+
{fileOpenError !== null && (
|
|
314
|
+
<FileOpenErrorDialog
|
|
315
|
+
message={fileOpenError.message}
|
|
316
|
+
busy={fileOpenBusy}
|
|
317
|
+
onClose={closeFileOpenError}
|
|
318
|
+
onRetry={() => { requestOpenFile(fileOpenError.path) }}
|
|
319
|
+
t={t}
|
|
320
|
+
/>
|
|
321
|
+
)}
|
|
322
|
+
</div>
|
|
323
|
+
)
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** In-page Host open-path refusal: the wire reason plus a retry of the same path. */
|
|
327
|
+
function FileOpenErrorDialog({
|
|
328
|
+
message, busy, onClose, onRetry, t,
|
|
329
|
+
}: {
|
|
330
|
+
message: string
|
|
331
|
+
busy: boolean
|
|
332
|
+
onClose: () => void
|
|
333
|
+
onRetry: () => void
|
|
334
|
+
t: ChatViewSlotProps['t']
|
|
335
|
+
}) {
|
|
336
|
+
return (
|
|
337
|
+
<Modal
|
|
338
|
+
open
|
|
339
|
+
onClose={onClose}
|
|
340
|
+
closeLabel={t('close')}
|
|
341
|
+
title={t('fileOpen.title')}
|
|
342
|
+
description={message}
|
|
343
|
+
footer={(
|
|
344
|
+
<>
|
|
345
|
+
<Button variant="outline" className={css.modalAction} onClick={onClose}>{t('cancel')}</Button>
|
|
346
|
+
<Button variant="primary" className={css.modalAction} disabled={busy} onClick={onRetry}>{t('retry')}</Button>
|
|
347
|
+
</>
|
|
348
|
+
)}
|
|
349
|
+
/>
|
|
350
|
+
)
|
|
351
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { memo, useMemo } from 'react'
|
|
2
|
+
import type { PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
|
|
3
|
+
import type {
|
|
4
|
+
ChatNodeViewProps, CommandRowOwnerProps,
|
|
5
|
+
} from '../contract/slots.ts'
|
|
6
|
+
import { CompactionCommandCard } from './CompactionCommandCard.tsx'
|
|
7
|
+
import { GenericCommandCard } from './GenericCommandCard.tsx'
|
|
8
|
+
import css from './ChatView.module.css'
|
|
9
|
+
|
|
10
|
+
type CommandNodeViewProps = ChatNodeViewProps<'command'> & PropsRenderSlots<'conversation.chat.commandview'>
|
|
11
|
+
|
|
12
|
+
/** Ordinary command lifecycle renderer with command-name keyed specialization. */
|
|
13
|
+
export const CommandNodeView = memo(function CommandNodeView({ node, renderSlot, t }: CommandNodeViewProps) {
|
|
14
|
+
const command = node.data
|
|
15
|
+
const owner = useMemo<CommandRowOwnerProps>(() => ({ node: command }), [command])
|
|
16
|
+
return (
|
|
17
|
+
<div className={css.callRow}>
|
|
18
|
+
{renderSlot('conversation.chat.commandview', owner, {
|
|
19
|
+
entryKey: command.name ?? '',
|
|
20
|
+
fallback: <GenericCommandCard {...owner} t={t} />,
|
|
21
|
+
})}
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
/** One integrated `/compact` command and compaction transaction renderer. */
|
|
27
|
+
export const ManualCompactionNodeView = memo(function ManualCompactionNodeView({
|
|
28
|
+
node, t,
|
|
29
|
+
}: ChatNodeViewProps<'manual-compaction'>) {
|
|
30
|
+
const data = node.data
|
|
31
|
+
return (
|
|
32
|
+
<div className={css.callRow}>
|
|
33
|
+
<CompactionCommandCard
|
|
34
|
+
node={data.command}
|
|
35
|
+
{...data.compaction === null ? {} : { compaction: data.compaction }}
|
|
36
|
+
t={t}
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Only a structured checkpoint uses the compaction marker; all other outcomes
|
|
2
|
+
// retain the command's complete settlement text.
|
|
3
|
+
|
|
4
|
+
import type { ChatViewSlotProps, CommandRowOwnerProps } from '../contract/slots.ts'
|
|
5
|
+
import { CompactionItem } from './CompactionItem.tsx'
|
|
6
|
+
import { GenericCommandCard } from './GenericCommandCard.tsx'
|
|
7
|
+
|
|
8
|
+
interface CompactionCommandCardProps extends CommandRowOwnerProps {
|
|
9
|
+
t: ChatViewSlotProps['t']
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Render one manual compaction lifecycle without duplicating its checkpoint marker. */
|
|
13
|
+
export function CompactionCommandCard({ node, compaction, t }: CompactionCommandCardProps) {
|
|
14
|
+
if (compaction !== undefined) {
|
|
15
|
+
return (
|
|
16
|
+
<CompactionItem
|
|
17
|
+
node={compaction}
|
|
18
|
+
title={t('message.compaction.commandTitle')}
|
|
19
|
+
fallbackSummary={node.outcome?.text ?? null}
|
|
20
|
+
t={t}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
if (node.outcome !== null) return <GenericCommandCard node={node} t={t} />
|
|
25
|
+
return <GenericCommandCard node={node} t={t} runningSummary={t('message.compaction.running')} />
|
|
26
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// A compaction marker does not replace shadowed transcript rows. It is
|
|
2
|
+
// expandable only when the current window includes its cited summary.
|
|
3
|
+
|
|
4
|
+
import { memo, useMemo, useState } from 'react'
|
|
5
|
+
import {
|
|
6
|
+
IconApiOutlineRegular,
|
|
7
|
+
IconChevronDownOutlineRegular,
|
|
8
|
+
IconChevronRightOutlineRegular,
|
|
9
|
+
MarkdownText,
|
|
10
|
+
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
11
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts'
|
|
12
|
+
import { markdownLabels } from '../markdown-labels.ts'
|
|
13
|
+
import type { CompactionSummaryNode } from '../contract/snapshot.ts'
|
|
14
|
+
import css from './MessageItem.module.css'
|
|
15
|
+
|
|
16
|
+
interface CompactionItemProps {
|
|
17
|
+
node: CompactionSummaryNode
|
|
18
|
+
/** Optional command title for a manual compaction folded into this marker. */
|
|
19
|
+
title?: string
|
|
20
|
+
/** Command settlement text used when structured compaction counts are unavailable. */
|
|
21
|
+
fallbackSummary?: string | null
|
|
22
|
+
/** The owning view's locale seat. */
|
|
23
|
+
t: ChatViewSlotProps['t']
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Renders the model-history compaction marker.
|
|
28
|
+
* @param props - the marker node off the snapshot cache.
|
|
29
|
+
* @returns the marker row, with the summary disclosure when one is available.
|
|
30
|
+
*/
|
|
31
|
+
export const CompactionItem = memo(function CompactionItem({
|
|
32
|
+
node,
|
|
33
|
+
title,
|
|
34
|
+
fallbackSummary,
|
|
35
|
+
t,
|
|
36
|
+
}: CompactionItemProps) {
|
|
37
|
+
const [expanded, setExpanded] = useState(false)
|
|
38
|
+
const labels = useMemo(() => markdownLabels(t), [t])
|
|
39
|
+
const expandable = node.summary !== null
|
|
40
|
+
const open = expandable && expanded
|
|
41
|
+
const summary = node.shadowedItemCount !== null && node.shadowedTokenCount !== null
|
|
42
|
+
? t('message.compaction.completed', {
|
|
43
|
+
items: node.shadowedItemCount,
|
|
44
|
+
tokens: node.shadowedTokenCount,
|
|
45
|
+
})
|
|
46
|
+
: fallbackSummary
|
|
47
|
+
?? (expandable ? t('message.compaction.expand') : t('message.compaction.unavailable'))
|
|
48
|
+
return (
|
|
49
|
+
<div className={css.compactionRow}>
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
className={css.compactionButton}
|
|
53
|
+
disabled={!expandable}
|
|
54
|
+
aria-expanded={expandable ? open : undefined}
|
|
55
|
+
onClick={() => { setExpanded(value => !value) }}
|
|
56
|
+
>
|
|
57
|
+
<span className={css.compactionLeading} aria-hidden>
|
|
58
|
+
<span className={css.compactionContextIcon} data-compaction-icon="context">
|
|
59
|
+
<IconApiOutlineRegular />
|
|
60
|
+
</span>
|
|
61
|
+
<span
|
|
62
|
+
className={css.compactionDisclosureIcon}
|
|
63
|
+
data-compaction-disclosure={open ? 'expanded' : 'collapsed'}
|
|
64
|
+
>
|
|
65
|
+
{open ? <IconChevronDownOutlineRegular /> : <IconChevronRightOutlineRegular />}
|
|
66
|
+
</span>
|
|
67
|
+
</span>
|
|
68
|
+
<span className={css.compactionTitle}>{title ?? t('message.compaction')}</span>
|
|
69
|
+
<span className={css.compactionSep} aria-hidden />
|
|
70
|
+
<span className={css.compactionSummary}>{summary}</span>
|
|
71
|
+
</button>
|
|
72
|
+
{open && node.summary !== null
|
|
73
|
+
&& <div className={css.compactionBody}><MarkdownText text={node.summary} labels={labels} /></div>}
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
})
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/* Expanded context bodies: one code-block surface shared by every form, so the
|
|
2
|
+
disclosure keeps the Figma 10:2482 geometry whichever form renders inside. */
|
|
3
|
+
|
|
4
|
+
.text {
|
|
5
|
+
margin: 0;
|
|
6
|
+
color: var(--dsw-alias-label-secondary);
|
|
7
|
+
font: inherit;
|
|
8
|
+
white-space: pre-wrap;
|
|
9
|
+
overflow-wrap: anywhere;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Source fields beneath the text: dimmer than the content they describe. */
|
|
13
|
+
.fields {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 2px;
|
|
17
|
+
margin: 8px 0 0;
|
|
18
|
+
padding-top: 8px;
|
|
19
|
+
border-top: 0.5px solid var(--dsw-alias-border-l2);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.field {
|
|
23
|
+
display: flex;
|
|
24
|
+
gap: 8px;
|
|
25
|
+
min-width: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.fieldKey {
|
|
29
|
+
flex: none;
|
|
30
|
+
min-width: 96px;
|
|
31
|
+
color: var(--dsw-alias-label-caption);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.fieldValue {
|
|
35
|
+
flex: 1 1 auto;
|
|
36
|
+
min-width: 0;
|
|
37
|
+
margin: 0;
|
|
38
|
+
color: var(--dsw-alias-label-tertiary);
|
|
39
|
+
overflow-wrap: anywhere;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* instructions: the reconciled files, above their text. */
|
|
43
|
+
.files {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-wrap: wrap;
|
|
46
|
+
gap: 4px 12px;
|
|
47
|
+
margin: 0 0 8px;
|
|
48
|
+
padding: 0;
|
|
49
|
+
list-style: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.file {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: baseline;
|
|
55
|
+
gap: 6px;
|
|
56
|
+
min-width: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.filePath {
|
|
60
|
+
color: var(--dsw-alias-label-secondary);
|
|
61
|
+
overflow-wrap: anywhere;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.fileAction {
|
|
65
|
+
color: var(--dsw-alias-label-caption);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* catalog: a replacement notice above one row per published entry. */
|
|
69
|
+
.catalogNotice {
|
|
70
|
+
margin: 0 0 6px;
|
|
71
|
+
color: var(--dsw-alias-label-caption);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
.entries {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
gap: 4px;
|
|
79
|
+
margin: 0;
|
|
80
|
+
padding: 0;
|
|
81
|
+
list-style: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.entry {
|
|
85
|
+
display: flex;
|
|
86
|
+
gap: 8px;
|
|
87
|
+
min-width: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.entryName {
|
|
91
|
+
flex: none;
|
|
92
|
+
color: var(--dsw-alias-label-secondary);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.entryDescription {
|
|
96
|
+
flex: 1 1 auto;
|
|
97
|
+
min-width: 0;
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
color: var(--dsw-alias-label-tertiary);
|
|
100
|
+
text-overflow: ellipsis;
|
|
101
|
+
white-space: nowrap;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* snapshot: one titled block per contributing subsystem. */
|
|
105
|
+
.sections {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
gap: 8px;
|
|
109
|
+
margin: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.section {
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-direction: column;
|
|
115
|
+
gap: 2px;
|
|
116
|
+
min-width: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.sectionName {
|
|
120
|
+
color: var(--dsw-alias-label-caption);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.sectionText {
|
|
124
|
+
margin: 0;
|
|
125
|
+
color: var(--dsw-alias-label-secondary);
|
|
126
|
+
white-space: pre-wrap;
|
|
127
|
+
overflow-wrap: anywhere;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* relay: who sent this, above what they said. */
|
|
131
|
+
.relaySender {
|
|
132
|
+
margin: 0 0 6px;
|
|
133
|
+
color: var(--dsw-alias-label-caption);
|
|
134
|
+
overflow-wrap: anywhere;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* recall: one row per source session, with how much of it survived. */
|
|
138
|
+
.recalls {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
gap: 2px;
|
|
142
|
+
margin: 0 0 8px;
|
|
143
|
+
padding: 0;
|
|
144
|
+
list-style: none;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.recall {
|
|
148
|
+
display: flex;
|
|
149
|
+
gap: 8px;
|
|
150
|
+
min-width: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.recallLabel {
|
|
154
|
+
color: var(--dsw-alias-label-secondary);
|
|
155
|
+
overflow-wrap: anywhere;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.recallCounts {
|
|
159
|
+
flex: none;
|
|
160
|
+
color: var(--dsw-alias-label-caption);
|
|
161
|
+
}
|