@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,384 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
2
|
+
import type {
|
|
3
|
+
AssistantBlock, AssistantMessageNode, ConversationLocation, ConversationMatch,
|
|
4
|
+
ConversationNodeContext, ConversationNodeDefinition,
|
|
5
|
+
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
6
|
+
import type { StreamChunk } from '@deepseek-ai/dsh-llm'
|
|
7
|
+
import type {} from '@deepseek-ai/dsh-llm-retry/types'
|
|
8
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session/types'
|
|
9
|
+
import type { AssistantChatData } from '../contract/chat-nodes.ts'
|
|
10
|
+
import { CHAT_SYNTHETIC_SEQ_OFFSETS, chatNode } from './common.ts'
|
|
11
|
+
import {
|
|
12
|
+
emptyAssistantBlock, isTokenDelta, toAssistantBlock, toAssistantBlocks,
|
|
13
|
+
} from './event-projection.ts'
|
|
14
|
+
|
|
15
|
+
declare module '../contract/chat-nodes.ts' {
|
|
16
|
+
interface ChatNodeDataMap {
|
|
17
|
+
/** Streaming, settled, or interrupted Assistant step. */
|
|
18
|
+
'assistant-step': AssistantChatData
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare module '@deepseek-ai/dsh-client-ui-conversation/client' {
|
|
23
|
+
interface ConversationStepDataMap {
|
|
24
|
+
/** Streaming, settled, or interrupted Assistant material for this Step. */
|
|
25
|
+
'assistant-step': AssistantChatData
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface AssistantState {
|
|
30
|
+
readonly turn: number
|
|
31
|
+
readonly step: number
|
|
32
|
+
readonly blocks: readonly (AssistantBlock | undefined)[]
|
|
33
|
+
/** Missing indices are invisible; same-kind appends preserve already-visible blocks. */
|
|
34
|
+
readonly visibleByIndex: readonly boolean[]
|
|
35
|
+
readonly visibleBlocks: number
|
|
36
|
+
readonly firstVisibleSeq: number | undefined
|
|
37
|
+
readonly firstVisibleTime: number | undefined
|
|
38
|
+
readonly firstTokenTime: number | undefined
|
|
39
|
+
readonly final: ConversationMatch | undefined
|
|
40
|
+
readonly usage: unknown
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function initialState(turn: number, step: number): AssistantState {
|
|
44
|
+
return {
|
|
45
|
+
turn,
|
|
46
|
+
step,
|
|
47
|
+
blocks: [],
|
|
48
|
+
visibleByIndex: [],
|
|
49
|
+
visibleBlocks: 0,
|
|
50
|
+
firstVisibleSeq: undefined,
|
|
51
|
+
firstVisibleTime: undefined,
|
|
52
|
+
firstTokenTime: undefined,
|
|
53
|
+
final: undefined,
|
|
54
|
+
usage: undefined,
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function compactBlocks(blocks: readonly (AssistantBlock | undefined)[]): AssistantBlock[] {
|
|
59
|
+
return blocks.filter((block): block is AssistantBlock => block !== undefined)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function blockIsVisible(block: AssistantBlock | undefined): boolean {
|
|
63
|
+
if (block === undefined || block.kind === 'tool-call') return false
|
|
64
|
+
if (block.kind === 'text' || block.kind === 'reasoning') return block.text.trim() !== ''
|
|
65
|
+
return true
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function hasVisibleContent(blocks: readonly AssistantBlock[]): boolean {
|
|
69
|
+
return blocks.some(blockIsVisible)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function hasInterruptionEvidence(blocks: readonly AssistantBlock[]): boolean {
|
|
73
|
+
return blocks.some((block) => {
|
|
74
|
+
if (block.kind === 'text' || block.kind === 'reasoning') return block.text.trim() !== ''
|
|
75
|
+
return true
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function resetForRetry(state: AssistantState): AssistantState {
|
|
80
|
+
return {
|
|
81
|
+
...initialState(state.turn, state.step),
|
|
82
|
+
firstTokenTime: state.firstTokenTime,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function updateChunk(
|
|
87
|
+
state: AssistantState,
|
|
88
|
+
chunk: StreamChunk,
|
|
89
|
+
seq: number,
|
|
90
|
+
time: number,
|
|
91
|
+
): AssistantState {
|
|
92
|
+
if (chunk.type === 'tool-call-delta') {
|
|
93
|
+
const previous = state.blocks[chunk.index]
|
|
94
|
+
if (previous?.kind === 'tool-call' && previous.callId !== ''
|
|
95
|
+
&& (chunk.name === undefined || chunk.name === previous.name)
|
|
96
|
+
&& (state.firstTokenTime !== undefined || !isTokenDelta(chunk))) return state
|
|
97
|
+
}
|
|
98
|
+
const blocks = [...state.blocks]
|
|
99
|
+
let changedIndex = -1
|
|
100
|
+
let previousVisible = false
|
|
101
|
+
let nextVisible = false
|
|
102
|
+
switch (chunk.type) {
|
|
103
|
+
case 'block-start':
|
|
104
|
+
changedIndex = chunk.index
|
|
105
|
+
previousVisible = state.visibleByIndex[chunk.index] === true
|
|
106
|
+
blocks[chunk.index] = emptyAssistantBlock(chunk.blockType)
|
|
107
|
+
nextVisible = blockIsVisible(blocks[chunk.index])
|
|
108
|
+
break
|
|
109
|
+
case 'text-delta': {
|
|
110
|
+
const previous = blocks[chunk.index]
|
|
111
|
+
changedIndex = chunk.index
|
|
112
|
+
previousVisible = state.visibleByIndex[chunk.index] === true
|
|
113
|
+
blocks[chunk.index] = { kind: 'text', text: (previous?.kind === 'text' ? previous.text : '') + chunk.text }
|
|
114
|
+
nextVisible = (previous?.kind === 'text' && previousVisible) || chunk.text.trim() !== ''
|
|
115
|
+
break
|
|
116
|
+
}
|
|
117
|
+
case 'reasoning-delta': {
|
|
118
|
+
const previous = blocks[chunk.index]
|
|
119
|
+
changedIndex = chunk.index
|
|
120
|
+
previousVisible = state.visibleByIndex[chunk.index] === true
|
|
121
|
+
blocks[chunk.index] = { kind: 'reasoning', text: (previous?.kind === 'reasoning' ? previous.text : '') + chunk.text }
|
|
122
|
+
nextVisible = (previous?.kind === 'reasoning' && previousVisible) || chunk.text.trim() !== ''
|
|
123
|
+
break
|
|
124
|
+
}
|
|
125
|
+
case 'tool-call-delta': {
|
|
126
|
+
const previous = blocks[chunk.index]
|
|
127
|
+
changedIndex = chunk.index
|
|
128
|
+
previousVisible = state.visibleByIndex[chunk.index] === true
|
|
129
|
+
// Tool Nodes own streamed arguments; Assistant protocol blocks retain identity until full settlement.
|
|
130
|
+
blocks[chunk.index] = {
|
|
131
|
+
kind: 'tool-call',
|
|
132
|
+
callId: (previous?.kind === 'tool-call' ? previous.callId : '') || String(chunk.id),
|
|
133
|
+
name: chunk.name ?? (previous?.kind === 'tool-call' ? previous.name : ''),
|
|
134
|
+
argsRaw: previous?.kind === 'tool-call' ? previous.argsRaw : '',
|
|
135
|
+
}
|
|
136
|
+
break
|
|
137
|
+
}
|
|
138
|
+
case 'block-end':
|
|
139
|
+
changedIndex = chunk.index
|
|
140
|
+
previousVisible = state.visibleByIndex[chunk.index] === true
|
|
141
|
+
blocks[chunk.index] = toAssistantBlock(chunk.block)
|
|
142
|
+
nextVisible = blockIsVisible(blocks[chunk.index])
|
|
143
|
+
break
|
|
144
|
+
case 'usage':
|
|
145
|
+
return { ...state, usage: chunk.usage }
|
|
146
|
+
default:
|
|
147
|
+
return state
|
|
148
|
+
}
|
|
149
|
+
const visibleBlocks = state.visibleBlocks
|
|
150
|
+
- Number(previousVisible)
|
|
151
|
+
+ Number(nextVisible)
|
|
152
|
+
let visibleByIndex = state.visibleByIndex
|
|
153
|
+
if (previousVisible !== nextVisible) {
|
|
154
|
+
const next = [...visibleByIndex]
|
|
155
|
+
next[changedIndex] = nextVisible
|
|
156
|
+
visibleByIndex = next
|
|
157
|
+
}
|
|
158
|
+
const firstToken = isTokenDelta(chunk)
|
|
159
|
+
return {
|
|
160
|
+
...state,
|
|
161
|
+
blocks,
|
|
162
|
+
visibleByIndex,
|
|
163
|
+
visibleBlocks,
|
|
164
|
+
...visibleBlocks > 0 && state.firstVisibleSeq === undefined
|
|
165
|
+
? { firstVisibleSeq: seq, firstVisibleTime: time }
|
|
166
|
+
: {},
|
|
167
|
+
...firstToken && state.firstTokenTime === undefined
|
|
168
|
+
? { firstTokenTime: time }
|
|
169
|
+
: {},
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function settleMessage(
|
|
174
|
+
state: AssistantState,
|
|
175
|
+
match: ConversationMatch,
|
|
176
|
+
event: SessionEvent<'assistant/message'>,
|
|
177
|
+
): AssistantState {
|
|
178
|
+
const blocks = toAssistantBlocks(event.data.message.content)
|
|
179
|
+
const visibleByIndex = blocks.map(blockIsVisible)
|
|
180
|
+
return {
|
|
181
|
+
...state,
|
|
182
|
+
blocks,
|
|
183
|
+
visibleByIndex,
|
|
184
|
+
visibleBlocks: visibleByIndex.reduce((count, visible) => count + Number(visible), 0),
|
|
185
|
+
final: match,
|
|
186
|
+
usage: event.data.usage,
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function closedBoundary(location: ConversationLocation): { seq: number; time: number } | undefined {
|
|
191
|
+
if (location.kind === 'step' && location.step.status === 'closed' && location.step.end !== undefined) {
|
|
192
|
+
return location.step.end
|
|
193
|
+
}
|
|
194
|
+
if ((location.kind === 'step' || location.kind === 'turn')
|
|
195
|
+
&& location.turn.status === 'closed' && location.turn.end !== undefined) {
|
|
196
|
+
return location.turn.end
|
|
197
|
+
}
|
|
198
|
+
return undefined
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function finalNode(
|
|
202
|
+
state: AssistantState,
|
|
203
|
+
context: ConversationNodeContext<AssistantState>,
|
|
204
|
+
): AssistantMessageNode | undefined {
|
|
205
|
+
const final = state.final
|
|
206
|
+
if (final?.event.type === 'assistant/message') {
|
|
207
|
+
const event = final.event
|
|
208
|
+
return {
|
|
209
|
+
kind: 'assistant',
|
|
210
|
+
seq: event.seq,
|
|
211
|
+
messageId: event.data.message.id,
|
|
212
|
+
time: event.time,
|
|
213
|
+
turn: state.turn,
|
|
214
|
+
step: state.step,
|
|
215
|
+
blocks: toAssistantBlocks(event.data.message.content),
|
|
216
|
+
usage: event.data.usage,
|
|
217
|
+
timing: {
|
|
218
|
+
stepStartTime: context.start?.event.time ?? null,
|
|
219
|
+
firstTokenTime: state.firstTokenTime ?? null,
|
|
220
|
+
completedTime: event.time,
|
|
221
|
+
},
|
|
222
|
+
...event.data.interrupted === true ? { interrupted: true } : {},
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const location = context.start?.location ?? context.matches.at(-1)?.location
|
|
226
|
+
const boundary = location === undefined ? undefined : closedBoundary(location)
|
|
227
|
+
if (boundary === undefined) return undefined
|
|
228
|
+
const blocks = compactBlocks(state.blocks)
|
|
229
|
+
if (!hasInterruptionEvidence(blocks)) return undefined
|
|
230
|
+
return {
|
|
231
|
+
kind: 'assistant',
|
|
232
|
+
seq: boundary.seq + CHAT_SYNTHETIC_SEQ_OFFSETS.interruptedAssistant,
|
|
233
|
+
time: boundary.time,
|
|
234
|
+
turn: state.turn,
|
|
235
|
+
step: state.step,
|
|
236
|
+
blocks,
|
|
237
|
+
interrupted: true,
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function fallbackState(context: ConversationNodeContext<AssistantState>): AssistantState | undefined {
|
|
242
|
+
let state: AssistantState | undefined
|
|
243
|
+
for (const match of context.matches) {
|
|
244
|
+
if (match.event.type === 'assistant/live-chunk') {
|
|
245
|
+
state ??= initialState(match.event.data.turn, match.event.data.step)
|
|
246
|
+
state = updateChunk(state, match.event.data.chunk, match.event.seq, match.event.time)
|
|
247
|
+
continue
|
|
248
|
+
}
|
|
249
|
+
if (match.event.type === 'assistant/message') {
|
|
250
|
+
state ??= initialState(match.event.data.turn, match.event.data.step)
|
|
251
|
+
state = settleMessage(state, match, match.event)
|
|
252
|
+
continue
|
|
253
|
+
}
|
|
254
|
+
if (match.event.type === 'llm/retry' && state !== undefined) {
|
|
255
|
+
state = resetForRetry(state)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return state
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
interface AssistantProjection {
|
|
262
|
+
readonly data: AssistantChatData
|
|
263
|
+
readonly anchorSeq: number
|
|
264
|
+
readonly visible: boolean
|
|
265
|
+
readonly settled: AssistantMessageNode | undefined
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function projectAssistant(context: ConversationNodeContext<AssistantState>): AssistantProjection | undefined {
|
|
269
|
+
const state = context.state ?? fallbackState(context)
|
|
270
|
+
if (state === undefined) return undefined
|
|
271
|
+
const settled = finalNode(state, context)
|
|
272
|
+
const blocks = settled?.blocks ?? compactBlocks(state.blocks)
|
|
273
|
+
const visible = settled === undefined ? state.visibleBlocks > 0 : hasVisibleContent(blocks)
|
|
274
|
+
const status = settled?.interrupted === true
|
|
275
|
+
? 'interrupted'
|
|
276
|
+
: settled === undefined ? 'running' : 'settled'
|
|
277
|
+
const anchorSeq = (settled?.interrupted === true ? settled.seq : state.firstVisibleSeq ?? settled?.seq)
|
|
278
|
+
?? context.matches[0]?.event.seq ?? 0
|
|
279
|
+
const time = settled?.time ?? state.firstVisibleTime ?? context.matches[0]?.event.time ?? 0
|
|
280
|
+
return {
|
|
281
|
+
anchorSeq,
|
|
282
|
+
visible,
|
|
283
|
+
settled,
|
|
284
|
+
data: {
|
|
285
|
+
status,
|
|
286
|
+
turn: state.turn,
|
|
287
|
+
step: state.step,
|
|
288
|
+
blocks,
|
|
289
|
+
time,
|
|
290
|
+
...state.usage === undefined ? {} : { usage: state.usage },
|
|
291
|
+
...settled === undefined ? {} : { finalNode: settled },
|
|
292
|
+
},
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function publishedAssistantData(
|
|
297
|
+
context: ConversationNodeContext<AssistantState>,
|
|
298
|
+
): Readonly<AssistantChatData> | undefined {
|
|
299
|
+
const location = context.start?.location ?? context.matches.at(-1)?.location
|
|
300
|
+
return location?.kind === 'step' ? location.step.data.get('assistant-step') : undefined
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Per-step Assistant lifecycle; materialized keys survive cleared stream content as hidden Nodes. */
|
|
304
|
+
export const assistantDefinition: ConversationNodeDefinition<AssistantState> = {
|
|
305
|
+
kind: 'assistant-step',
|
|
306
|
+
target: 'chat',
|
|
307
|
+
match: (event) => {
|
|
308
|
+
if (event.type === 'step/start') return { id: `${event.data.turn}:${event.data.step}`, role: 'start' }
|
|
309
|
+
if (event.type === 'assistant/live-chunk'
|
|
310
|
+
|| (event.type === 'assistant/message' && event.surfaceOp === 'append')) {
|
|
311
|
+
return { id: `${event.data.turn}:${event.data.step}`, role: 'update' }
|
|
312
|
+
}
|
|
313
|
+
if (event.type === 'llm/retry') {
|
|
314
|
+
return { id: `${event.data.turn}:${event.data.step}`, role: 'update' }
|
|
315
|
+
}
|
|
316
|
+
return null
|
|
317
|
+
},
|
|
318
|
+
start: (_context, match) => {
|
|
319
|
+
if (match.event.type !== 'step/start') throw new Error('assistant-step start requires step/start')
|
|
320
|
+
return initialState(match.event.data.turn, match.event.data.step)
|
|
321
|
+
},
|
|
322
|
+
update: (context, match) => {
|
|
323
|
+
if (match.event.type === 'assistant/live-chunk') {
|
|
324
|
+
return updateChunk(context.state, match.event.data.chunk, match.event.seq, match.event.time)
|
|
325
|
+
}
|
|
326
|
+
if (match.event.type === 'assistant/message') return settleMessage(context.state, match, match.event)
|
|
327
|
+
if (match.event.type === 'llm/retry') {
|
|
328
|
+
return resetForRetry(context.state)
|
|
329
|
+
}
|
|
330
|
+
return context.state
|
|
331
|
+
},
|
|
332
|
+
publication: (match) => {
|
|
333
|
+
if (match.event.type === 'step/start') return 'none'
|
|
334
|
+
if (match.event.type !== 'assistant/live-chunk') return 'immediate'
|
|
335
|
+
const type = match.event.data.chunk.type
|
|
336
|
+
return type === 'usage' || type === 'finish' ? 'none' : 'animation-frame'
|
|
337
|
+
},
|
|
338
|
+
buildLocationData: (context, scope) => {
|
|
339
|
+
if (scope !== 'step') return null
|
|
340
|
+
const projected = projectAssistant(context)
|
|
341
|
+
if (projected === undefined) return null
|
|
342
|
+
return {
|
|
343
|
+
kind: 'step',
|
|
344
|
+
turn: projected.data.turn,
|
|
345
|
+
step: projected.data.step,
|
|
346
|
+
key: 'assistant-step',
|
|
347
|
+
value: projected.data,
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
buildViewNode: (context) => {
|
|
351
|
+
const current = context.current.get('chat')
|
|
352
|
+
const state = context.state ?? fallbackState(context)
|
|
353
|
+
const data = publishedAssistantData(context)
|
|
354
|
+
if (state === undefined || data === undefined) {
|
|
355
|
+
return current == null ? null : { ...current, visibility: 'hidden' }
|
|
356
|
+
}
|
|
357
|
+
const settled = data.finalNode
|
|
358
|
+
const visible = settled === undefined ? state.visibleBlocks > 0 : hasVisibleContent(data.blocks)
|
|
359
|
+
if (settled === undefined && !visible && current == null) return null
|
|
360
|
+
// A successful message retains its live anchor alongside pending Tool calls.
|
|
361
|
+
const anchorSeq = (settled?.interrupted === true ? settled.seq : state.firstVisibleSeq ?? settled?.seq)
|
|
362
|
+
?? context.matches[0]?.event.seq ?? 0
|
|
363
|
+
return chatNode(context, 'assistant-step', anchorSeq, data, {
|
|
364
|
+
visibility: settled?.interrupted === true || visible ? 'visible' : 'hidden',
|
|
365
|
+
})
|
|
366
|
+
},
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Register the Assistant lifecycle business contribution.
|
|
371
|
+
* @param ctx - owning UI Conversation context.
|
|
372
|
+
*/
|
|
373
|
+
export function registerAssistantConversationNode(ctx: Context): void {
|
|
374
|
+
const match = assistantDefinition.match.bind(assistantDefinition)
|
|
375
|
+
ctx.uiConversation.events.register({
|
|
376
|
+
...assistantDefinition,
|
|
377
|
+
match: {
|
|
378
|
+
'step/start': match,
|
|
379
|
+
'assistant/live-chunk': match,
|
|
380
|
+
'assistant/message': match,
|
|
381
|
+
'llm/retry': match,
|
|
382
|
+
},
|
|
383
|
+
})
|
|
384
|
+
}
|