@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,208 @@
|
|
|
1
|
+
/** Stable process container; display policy changes visibility, never member parents. */
|
|
2
|
+
import { memo, useCallback, useEffect, useId, useRef, useState, type ComponentProps, type ReactNode } from 'react'
|
|
3
|
+
import {
|
|
4
|
+
IconAgentPresetOutlineRegular, IconApiOutlineRegular, IconBrowseOutlineRegular, IconChevronDownOutlineRegular,
|
|
5
|
+
IconChevronUpOutlineRegular, IconCodeOutlineRegular, IconContextInjectionOutlineRegular, IconEditOutlineRegular,
|
|
6
|
+
IconGlobeOutlineRegular, IconPlanOutlineRegular, IconQuestionOutlineRegular, IconSearchOutlineRegular, IconSparkleRegular,
|
|
7
|
+
IconThinkOutlineRegular, TextShimmer,
|
|
8
|
+
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
9
|
+
import type { GroupKey, NodeReference } from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
10
|
+
import type { ProcessActivity, RunningProcessActivity } from '../contract/process-groups.ts'
|
|
11
|
+
import type { ChatStoreState } from '../contract/store.ts'
|
|
12
|
+
import type { ChatFlowSlotProps } from '../contract/slots.ts'
|
|
13
|
+
import { turnProcessOpen } from '../stores.ts'
|
|
14
|
+
import { ChatNodeSeat } from './ChatNodeSeat.tsx'
|
|
15
|
+
import { hiddenOrCollapsing } from './flow-motion.ts'
|
|
16
|
+
import { chatRenderKey } from './render-entry.ts'
|
|
17
|
+
import { processTitle } from './step-process.ts'
|
|
18
|
+
import { useDisclosure } from './use-disclosure.ts'
|
|
19
|
+
import { useProcessScroll } from './use-process-scroll.ts'
|
|
20
|
+
import css from './ChatGroupSeat.module.css'
|
|
21
|
+
|
|
22
|
+
type SeatProps = Omit<ComponentProps<typeof ChatNodeSeat>, 'nodeKey' | 'groupPart'>
|
|
23
|
+
type ChatGroupSeatProps = SeatProps & {
|
|
24
|
+
readonly groupKey: GroupKey
|
|
25
|
+
readonly useChatGroup: ChatFlowSlotProps['useChatGroup']
|
|
26
|
+
readonly useGroupHeaderAction: ChatFlowSlotProps['useGroupHeaderAction']
|
|
27
|
+
}
|
|
28
|
+
const PROCESS_TITLE_MINIMUM_MS = 150
|
|
29
|
+
|
|
30
|
+
type ProcessTitleActivity = ProcessActivity | 'thinking'
|
|
31
|
+
|
|
32
|
+
interface LiveProcessTitle {
|
|
33
|
+
readonly activity: RunningProcessActivity | 'thinking'
|
|
34
|
+
readonly detail: string
|
|
35
|
+
readonly preparing: boolean
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const PROCESS_ICONS: Record<ProcessTitleActivity, ReactNode> = {
|
|
39
|
+
thinking: <IconThinkOutlineRegular />,
|
|
40
|
+
read: <IconBrowseOutlineRegular size={14} />,
|
|
41
|
+
readImage: <IconBrowseOutlineRegular size={14} />,
|
|
42
|
+
search: <IconSearchOutlineRegular size={14} />,
|
|
43
|
+
edit: <IconEditOutlineRegular size={14} />,
|
|
44
|
+
write: <IconEditOutlineRegular size={14} />,
|
|
45
|
+
commands: <IconApiOutlineRegular />,
|
|
46
|
+
code: <IconCodeOutlineRegular size={14} />,
|
|
47
|
+
webSearch: <IconGlobeOutlineRegular />,
|
|
48
|
+
webFetch: <IconBrowseOutlineRegular size={14} />,
|
|
49
|
+
subagents: <IconAgentPresetOutlineRegular size={14} />,
|
|
50
|
+
plan: <IconPlanOutlineRegular />,
|
|
51
|
+
questions: <IconQuestionOutlineRegular />,
|
|
52
|
+
tools: <IconSparkleRegular size={14} />,
|
|
53
|
+
context: <IconContextInjectionOutlineRegular size={14} />,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function sameLiveProcessTitle(left: LiveProcessTitle, right: LiveProcessTitle): boolean {
|
|
57
|
+
return left.activity === right.activity && left.detail === right.detail && left.preparing === right.preparing
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function useStableLiveProcessTitle(desired: LiveProcessTitle, active: boolean): LiveProcessTitle {
|
|
61
|
+
const [displayed, setDisplayed] = useState(desired)
|
|
62
|
+
const displayedRef = useRef(displayed)
|
|
63
|
+
const desiredRef = useRef(desired)
|
|
64
|
+
const displayedAtRef = useRef(Date.now())
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
desiredRef.current = desired
|
|
67
|
+
if (!active || sameLiveProcessTitle(displayedRef.current, desired)) return
|
|
68
|
+
const remaining = PROCESS_TITLE_MINIMUM_MS - (Date.now() - displayedAtRef.current)
|
|
69
|
+
const commit = (): void => {
|
|
70
|
+
const next = desiredRef.current
|
|
71
|
+
displayedRef.current = next
|
|
72
|
+
displayedAtRef.current = Date.now()
|
|
73
|
+
setDisplayed(next)
|
|
74
|
+
}
|
|
75
|
+
if (remaining <= 0) {
|
|
76
|
+
commit()
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
const timer = setTimeout(commit, remaining)
|
|
80
|
+
return () => { clearTimeout(timer) }
|
|
81
|
+
}, [active, desired.activity, desired.detail, desired.preparing])
|
|
82
|
+
return active ? displayed : desired
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
const GroupMembers = memo(function GroupMembers({ members, ...props }: SeatProps & {
|
|
87
|
+
readonly members: readonly NodeReference[]
|
|
88
|
+
}) {
|
|
89
|
+
return members.map(member => <ChatNodeSeat {...props} key={chatRenderKey(member)} nodeKey={member.key}
|
|
90
|
+
{...member.groupPart === undefined ? {} : { groupPart: member.groupPart }} />)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const ProcessGroupHeader = memo(function ProcessGroupHeader({ groupKey, useChatGroup, usePresentation, t, open, bodyId, toggle }: {
|
|
94
|
+
readonly groupKey: GroupKey
|
|
95
|
+
readonly useChatGroup: ChatFlowSlotProps['useChatGroup']
|
|
96
|
+
readonly usePresentation: ChatFlowSlotProps['usePresentation']
|
|
97
|
+
readonly t: ChatFlowSlotProps['t']
|
|
98
|
+
readonly open: boolean
|
|
99
|
+
readonly bodyId: string
|
|
100
|
+
readonly toggle: () => void
|
|
101
|
+
}) {
|
|
102
|
+
const data = useChatGroup(groupKey, group => group?.data)
|
|
103
|
+
const detailed = usePresentation(policy => data?.closed === false && policy.liveProcessDetail)
|
|
104
|
+
const live = useStableLiveProcessTitle({
|
|
105
|
+
activity: data?.summary.running ?? 'thinking',
|
|
106
|
+
detail: data?.summary.runningDetail ?? '',
|
|
107
|
+
preparing: data?.summary.preparing === true,
|
|
108
|
+
}, data !== undefined && !data.closed)
|
|
109
|
+
if (data === undefined) return null
|
|
110
|
+
const label = data.closed ? processTitle(data.summary, t)
|
|
111
|
+
: live.preparing ? t(`message.stepProcess.prepare.${live.activity === 'thinking' ? 'tools' : live.activity}`)
|
|
112
|
+
: t(`message.stepProcess.${live.activity}`)
|
|
113
|
+
const detail = detailed && !data.closed ? live.detail : ''
|
|
114
|
+
const title = detail === '' ? label : `${label}${t('message.turnProcess.separator')}${detail}`
|
|
115
|
+
const activity = data.closed ? data.summary.counts[0]?.kind ?? 'thinking' : live.activity
|
|
116
|
+
return (
|
|
117
|
+
<button type="button" className={css.title} aria-expanded={open} aria-controls={bodyId}
|
|
118
|
+
data-process-activity={activity} onClick={(event) => { event.currentTarget.focus(); toggle() }}>
|
|
119
|
+
<span className={css.leading} aria-hidden="true">
|
|
120
|
+
<span className={css.activityIcon} data-step-process-icon>{PROCESS_ICONS[activity]}</span>
|
|
121
|
+
<span className={css.chevron} data-step-process-chevron>
|
|
122
|
+
{open ? <IconChevronUpOutlineRegular /> : <IconChevronDownOutlineRegular />}
|
|
123
|
+
</span>
|
|
124
|
+
</span>
|
|
125
|
+
<TextShimmer active={!data.closed}>
|
|
126
|
+
<TextShimmer className={css.label}>{title}</TextShimmer>
|
|
127
|
+
</TextShimmer>
|
|
128
|
+
</button>
|
|
129
|
+
)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
/** Render a process group with local disclosure and the existing outer-Turn visibility. */
|
|
133
|
+
export const ChatGroupSeat = memo(function ChatGroupSeat({ groupKey, useChatGroup, useGroupHeaderAction, ...props }: ChatGroupSeatProps) {
|
|
134
|
+
const members = useChatGroup(groupKey, group => group?.members)
|
|
135
|
+
const turn = useChatGroup(groupKey, group => group?.data.turn)
|
|
136
|
+
const closed = useChatGroup(groupKey, group => group?.data.closed)
|
|
137
|
+
const foldCompleted = props.usePresentation(policy => policy.foldCompletedTurns)
|
|
138
|
+
const { expanded: open, setExpanded: setOpen } = useDisclosure()
|
|
139
|
+
const firstKey = members?.[0]?.key ?? ''
|
|
140
|
+
const bottom = props.useChatNodeBottom(firstKey)
|
|
141
|
+
const deferCollapse = bottom === true && props.deferCollapse
|
|
142
|
+
const presentation = props.useChatNodeProcess(firstKey)
|
|
143
|
+
const turnLocation = props.useChatNode(firstKey, (node) => {
|
|
144
|
+
const location = node?.location
|
|
145
|
+
return location?.kind === 'turn' || location?.kind === 'step' ? location.turn : undefined
|
|
146
|
+
})
|
|
147
|
+
// Detailed keeps the latest completed Turn flat, like a running one, until the next input.
|
|
148
|
+
const grouped = props.usePresentation(policy => policy.stepGrouping === 'collapsed'
|
|
149
|
+
|| (policy.stepGrouping === 'history' && turnLocation?.status !== 'open' && !deferCollapse))
|
|
150
|
+
const reason = turnLocation?.end?.data.reason.kind
|
|
151
|
+
const alwaysOpen = presentation?.turnClosed === false || presentation?.hasInterleavedInput === true
|
|
152
|
+
|| reason === 'aborted' || reason === 'interrupted' || reason === 'error'
|
|
153
|
+
const spec = presentation?.spec
|
|
154
|
+
const selectOpen = useCallback((state: Readonly<ChatStoreState>) => spec !== undefined
|
|
155
|
+
&& turnProcessOpen(state, spec, deferCollapse), [spec, deferCollapse])
|
|
156
|
+
const storedOpen = props.useStore(selectOpen)
|
|
157
|
+
const outerHidden = foldCompleted && presentation?.turnClosed === true && spec !== undefined
|
|
158
|
+
&& !alwaysOpen && !storedOpen
|
|
159
|
+
const revealOuter = useCallback(() => {
|
|
160
|
+
if (spec !== undefined && !alwaysOpen) props.actions.setTurnProcessOpen(spec.turn, spec.answerStep ?? 0, true)
|
|
161
|
+
}, [props.actions, spec, alwaysOpen])
|
|
162
|
+
const rootRef = props.useGroupAction(outerHidden, revealOuter)
|
|
163
|
+
// The header appears when a flat latest Turn becomes historical; it grows on the fold clock while the
|
|
164
|
+
// body closes. A group whose whole Turn is folding never shows one in the frame it starts closing.
|
|
165
|
+
const headerRef = useRef<HTMLDivElement>(null)
|
|
166
|
+
const deferCompletedTurns = props.usePresentation(policy => policy.collapseTiming === 'next-input')
|
|
167
|
+
useGroupHeaderAction(headerRef, !grouped || (deferCompletedTurns && outerHidden))
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (outerHidden && rootRef.current !== null && hiddenOrCollapsing(rootRef.current)) setOpen(false)
|
|
170
|
+
}, [outerHidden, rootRef, setOpen])
|
|
171
|
+
const reveal = useCallback(() => { setOpen(true) }, [setOpen])
|
|
172
|
+
const bodyRef = props.useGroupAction(grouped && !open, reveal)
|
|
173
|
+
const contentRef = useRef<HTMLDivElement>(null)
|
|
174
|
+
const bodyId = useId()
|
|
175
|
+
const { edges, events, initialize } = useProcessScroll(bodyRef, contentRef, open, grouped)
|
|
176
|
+
const toggle = useCallback(() => {
|
|
177
|
+
if (!open) initialize(closed === false ? 'bottom' : 'top')
|
|
178
|
+
setOpen(!open)
|
|
179
|
+
}, [closed, initialize, open, setOpen])
|
|
180
|
+
// With next-input timing the height cap applies only to a group the reader opened. A closing body keeps
|
|
181
|
+
// the cap it was last shown with, so the transition starts from what is on screen: a reader-opened group
|
|
182
|
+
// closes from its cap, and a flat latest Turn becoming historical closes from its flat height.
|
|
183
|
+
const shownCap = !grouped ? false : open ? true : undefined
|
|
184
|
+
const [closingCap, setClosingCap] = useState(shownCap ?? true)
|
|
185
|
+
if (shownCap !== undefined && shownCap !== closingCap) setClosingCap(shownCap)
|
|
186
|
+
if (members === undefined) return null
|
|
187
|
+
const capped = grouped && (!deferCompletedTurns || (shownCap ?? closingCap))
|
|
188
|
+
const classes = [css.body, !capped ? css.expandedBody : '',
|
|
189
|
+
capped && edges.canScrollUp ? css.fadeTop : '', capped && edges.canScrollDown ? css.fadeBottom : '']
|
|
190
|
+
return (
|
|
191
|
+
<div ref={rootRef} className={css.root} data-chat-group-key={groupKey}
|
|
192
|
+
data-chat-flow-key={groupKey} data-chat-anchor-key={`group:${groupKey}`} data-chat-turn={turn}
|
|
193
|
+
data-chat-paging-anchor={grouped && !open || undefined}
|
|
194
|
+
data-step-process data-group-expanded-mode={!grouped || undefined}>
|
|
195
|
+
<div ref={headerRef}>
|
|
196
|
+
<ProcessGroupHeader groupKey={groupKey} useChatGroup={useChatGroup}
|
|
197
|
+
usePresentation={props.usePresentation} t={props.t} open={open} bodyId={bodyId} toggle={toggle} />
|
|
198
|
+
</div>
|
|
199
|
+
<div ref={bodyRef} id={bodyId} className={classes.join(' ')} data-step-process-body
|
|
200
|
+
data-scroll-up={edges.canScrollUp || undefined} data-scroll-down={edges.canScrollDown || undefined}
|
|
201
|
+
{...events}>
|
|
202
|
+
<div ref={contentRef} className={css.content} data-step-process-content data-chat-flow="">
|
|
203
|
+
<GroupMembers {...props} members={members} />
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
)
|
|
208
|
+
})
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
|
2
|
+
import { JsonBlock } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
3
|
+
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
4
|
+
import type { ConversationLocationDataStore, ConversationTurnDataMap } from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
5
|
+
import type { ChatNodeHookContext, ChatNodeOwnerProps, ChatFlowSlotProps, UsePresentation } from '../contract/slots.ts'
|
|
6
|
+
import { hasAssistantReplyContent } from '../contract/assistant-content.ts'
|
|
7
|
+
import type { ChatNode } from '../contract/chat-nodes.ts'
|
|
8
|
+
import type { ChatNodeStore } from '../contract/snapshot.ts'
|
|
9
|
+
import { isAtOrOutside } from '../contract/group-tree.ts'
|
|
10
|
+
import { turnProcessAlwaysOpen } from '../contract/turn-process.ts'
|
|
11
|
+
import { turnProcessOpen } from '../stores.ts'
|
|
12
|
+
import { hiddenOrCollapsing } from './flow-motion.ts'
|
|
13
|
+
import css from './ChatView.module.css'
|
|
14
|
+
|
|
15
|
+
interface ChatNodeSeatProps extends ChatNodeOwnerProps {
|
|
16
|
+
readonly nodeKey: string
|
|
17
|
+
/** A replaced Builder must rebind keyed hooks even when references and keys survive. */
|
|
18
|
+
readonly nodeStore: ChatNodeStore
|
|
19
|
+
readonly useChatNode: ChatFlowSlotProps['useChatNode']
|
|
20
|
+
readonly useChatNodeProcess: ChatFlowSlotProps['useChatNodeProcess']
|
|
21
|
+
readonly usePresentation: UsePresentation
|
|
22
|
+
readonly useStore: ChatFlowSlotProps['useStore']
|
|
23
|
+
readonly actions: ChatFlowSlotProps['actions']
|
|
24
|
+
readonly renderSlot: ChatFlowSlotProps['renderSlot']
|
|
25
|
+
readonly t: ChatFlowSlotProps['t']
|
|
26
|
+
readonly useChatNodeBottom: ChatFlowSlotProps['useChatNodeBottom']
|
|
27
|
+
readonly deferCollapse: boolean
|
|
28
|
+
readonly useGroupAction: ChatFlowSlotProps['useGroupAction']
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type RoutedChatNodeOwner = {
|
|
32
|
+
[Kind in ChatNode['kind']]: ChatNodeOwnerProps & { readonly node: ChatNode<Kind> }
|
|
33
|
+
}[ChatNode['kind']]
|
|
34
|
+
|
|
35
|
+
function turnDataOf(node: ChatNode | undefined): ConversationLocationDataStore<ConversationTurnDataMap> | undefined {
|
|
36
|
+
const location = node?.location
|
|
37
|
+
return location?.kind === 'turn' || location?.kind === 'step' ? location.turn.data : undefined
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function turnOf(node: ChatNode | undefined): number | undefined {
|
|
41
|
+
const location = node?.location
|
|
42
|
+
return location?.kind === 'turn' || location?.kind === 'step' ? location.turn.turn : undefined
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Subscribe, apply Turn-process visibility, and dispatch one stable Context key.
|
|
47
|
+
* Policy reads select this seat's own conclusion, so a mode change re-renders
|
|
48
|
+
* only seats whose visibility actually changes.
|
|
49
|
+
*/
|
|
50
|
+
export const ChatNodeSeat = memo(function ChatNodeSeat({
|
|
51
|
+
nodeKey, groupPart, useChatNode, useChatNodeProcess, usePresentation,
|
|
52
|
+
cwd, openFile, inspectCall, forkAt,
|
|
53
|
+
loadImage, useStore, actions, renderSlot, t, useChatNodeBottom, deferCollapse, useGroupAction,
|
|
54
|
+
}: ChatNodeSeatProps) {
|
|
55
|
+
const bottom = useChatNodeBottom(nodeKey)
|
|
56
|
+
const node = useChatNode(nodeKey)
|
|
57
|
+
const routedNode = node as ChatNode | undefined
|
|
58
|
+
const turn = turnOf(routedNode)
|
|
59
|
+
const processPresentation = useChatNodeProcess(nodeKey)
|
|
60
|
+
const processSpec = processPresentation?.spec
|
|
61
|
+
const storedOpen = useStore(state => processSpec !== undefined
|
|
62
|
+
&& turnProcessOpen(state, processSpec, bottom === true && deferCollapse))
|
|
63
|
+
const liveProcess = processPresentation !== undefined && !processPresentation.turnClosed
|
|
64
|
+
const interleavedInput = processPresentation?.hasInterleavedInput === true
|
|
65
|
+
const alwaysOpen = liveProcess || interleavedInput || turnProcessAlwaysOpen(routedNode)
|
|
66
|
+
const processOpen = alwaysOpen || storedOpen
|
|
67
|
+
const setOpen = useCallback((open: boolean) => {
|
|
68
|
+
if (processSpec !== undefined && !alwaysOpen) {
|
|
69
|
+
actions.setTurnProcessOpen(processSpec.turn, processSpec.answerStep ?? 0, open)
|
|
70
|
+
}
|
|
71
|
+
}, [actions, processSpec, alwaysOpen])
|
|
72
|
+
const foldCompleted = usePresentation(policy => policy.foldCompletedTurns)
|
|
73
|
+
const keepReplies = usePresentation(policy => policy.foldedReplies === 'all')
|
|
74
|
+
// A loaded end makes a partial historical Turn eligible without its start.
|
|
75
|
+
const processWindowReady = processSpec !== undefined
|
|
76
|
+
&& processPresentation !== undefined
|
|
77
|
+
&& foldCompleted
|
|
78
|
+
&& processPresentation.turn === processSpec.turn
|
|
79
|
+
&& (processPresentation.turnStarted || processPresentation.turnClosed)
|
|
80
|
+
// With every reply kept, an Assistant reply stays outside whole-Turn folding; its reasoning remains process content.
|
|
81
|
+
const replyRow = keepReplies
|
|
82
|
+
&& routedNode?.kind === 'assistant-step'
|
|
83
|
+
&& groupPart !== 'reasoning'
|
|
84
|
+
&& hasAssistantReplyContent(routedNode.data.blocks)
|
|
85
|
+
const processMember = routedNode !== undefined
|
|
86
|
+
&& processWindowReady
|
|
87
|
+
&& !replyRow
|
|
88
|
+
&& !isAtOrOutside(routedNode, 'turn')
|
|
89
|
+
&& routedNode.anchorSeq >= processSpec.processStartSeq
|
|
90
|
+
&& (liveProcess || processSpec.answerAnchorSeq === null || routedNode.anchorSeq < processSpec.answerAnchorSeq
|
|
91
|
+
|| (groupPart === 'reasoning' && routedNode.kind === 'assistant-step' && routedNode.data.step === processSpec.answerStep))
|
|
92
|
+
const processAnswer = routedNode !== undefined
|
|
93
|
+
&& processWindowReady
|
|
94
|
+
&& !liveProcess
|
|
95
|
+
&& groupPart !== 'reasoning'
|
|
96
|
+
&& routedNode.kind === 'assistant-step'
|
|
97
|
+
&& routedNode.data.step === processSpec.answerStep
|
|
98
|
+
const ownsDisclosure = routedNode?.kind === 'turn-process' || processAnswer || replyRow
|
|
99
|
+
const foldable = processWindowReady
|
|
100
|
+
&& (liveProcess || processMember || ownsDisclosure)
|
|
101
|
+
const turnProcess = useMemo(() => processSpec === undefined
|
|
102
|
+
? undefined
|
|
103
|
+
: {
|
|
104
|
+
spec: processSpec,
|
|
105
|
+
foldable,
|
|
106
|
+
hasContent: !interleavedInput && (processSpec.inlineReasoning || (keepReplies
|
|
107
|
+
? processPresentation?.hasNonReplyProcess === true
|
|
108
|
+
: processPresentation?.hasExternalProcess === true)),
|
|
109
|
+
open: processOpen,
|
|
110
|
+
setOpen,
|
|
111
|
+
}, [
|
|
112
|
+
foldable, interleavedInput, keepReplies, processOpen, processSpec,
|
|
113
|
+
processPresentation?.hasExternalProcess, processPresentation?.hasNonReplyProcess, setOpen,
|
|
114
|
+
])
|
|
115
|
+
const controllerInactive = routedNode?.kind === 'turn-process'
|
|
116
|
+
&& foldCompleted && !foldable
|
|
117
|
+
const processHidden = controllerInactive || (foldable && processMember && !processOpen)
|
|
118
|
+
const revealProcess = useCallback(() => {
|
|
119
|
+
if (processMember) setOpen(true)
|
|
120
|
+
}, [processMember, setOpen])
|
|
121
|
+
const wrapperRef = useGroupAction(processHidden, revealProcess)
|
|
122
|
+
const [disclosureReset] = useState(() => createSnapshotStore(0))
|
|
123
|
+
const turnData = turnDataOf(routedNode)
|
|
124
|
+
const hookContext = useMemo<ChatNodeHookContext>(
|
|
125
|
+
() => ({ turnData, disclosureReset, useGroupAction }), [turnData, disclosureReset, useGroupAction],
|
|
126
|
+
)
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (processMember && processHidden && wrapperRef.current !== null && hiddenOrCollapsing(wrapperRef.current)) {
|
|
129
|
+
disclosureReset.set(disclosureReset.getSnapshot() + 1)
|
|
130
|
+
}
|
|
131
|
+
}, [processMember, processHidden, wrapperRef, disclosureReset])
|
|
132
|
+
const owner = useMemo<ChatNodeOwnerProps | null>(() => node === undefined
|
|
133
|
+
? null
|
|
134
|
+
: {
|
|
135
|
+
...groupPart === undefined ? {} : { groupPart },
|
|
136
|
+
cwd,
|
|
137
|
+
openFile,
|
|
138
|
+
inspectCall,
|
|
139
|
+
forkAt,
|
|
140
|
+
loadImage,
|
|
141
|
+
turnProcess,
|
|
142
|
+
}, [
|
|
143
|
+
node, groupPart, cwd, openFile, inspectCall, forkAt,
|
|
144
|
+
loadImage, turnProcess,
|
|
145
|
+
])
|
|
146
|
+
if (routedNode === undefined || owner === null) return null
|
|
147
|
+
// Runtime dispatch owns the correlation: every Node's discriminant is the
|
|
148
|
+
// keyed-slot entry passed alongside that same Node. TypeScript does not
|
|
149
|
+
// distribute an object containing a union into a union of objects itself.
|
|
150
|
+
const routedOwner = { ...owner, node: routedNode } as RoutedChatNodeOwner
|
|
151
|
+
const flowKey = groupPart === undefined || groupPart === 'response' ? routedNode.key : JSON.stringify([routedNode.key, groupPart])
|
|
152
|
+
return (
|
|
153
|
+
<div
|
|
154
|
+
ref={wrapperRef}
|
|
155
|
+
className={css.flowItem}
|
|
156
|
+
data-chat-anchor-key={flowKey}
|
|
157
|
+
data-chat-flow-key={flowKey}
|
|
158
|
+
data-chat-paging-anchor={routedNode.kind !== 'turn-process' || undefined}
|
|
159
|
+
data-chat-node-key={routedNode.key}
|
|
160
|
+
data-chat-group-part={groupPart}
|
|
161
|
+
data-chat-flow-kind={routedNode.kind}
|
|
162
|
+
data-chat-turn={turn}
|
|
163
|
+
data-turn-process-member={processMember || undefined}
|
|
164
|
+
data-turn-process-hidden={processHidden || undefined}
|
|
165
|
+
>
|
|
166
|
+
{renderSlot('conversation.chat.node', routedOwner, {
|
|
167
|
+
entryKey: routedNode.kind,
|
|
168
|
+
hookContext,
|
|
169
|
+
fallback: (
|
|
170
|
+
<JsonBlock
|
|
171
|
+
label={t('message.unknownSurface', { type: routedNode.kind })}
|
|
172
|
+
payload={routedNode.data}
|
|
173
|
+
truncatedLabel={total => t('json.truncated', { total })}
|
|
174
|
+
/>
|
|
175
|
+
),
|
|
176
|
+
})}
|
|
177
|
+
</div>
|
|
178
|
+
)
|
|
179
|
+
})
|