@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,88 @@
|
|
|
1
|
+
/** Presentation of durable non-human messages claimed to begin a Turn. */
|
|
2
|
+
import type { ContextMessageNode } from '../contract/snapshot.ts'
|
|
3
|
+
import type { ChatKey } from '../locale.ts'
|
|
4
|
+
|
|
5
|
+
/** Existing primitive glyph selected for a Turn trigger's source family. */
|
|
6
|
+
export type TurnTriggerIcon = 'agent' | 'continue' | 'github' | 'goal' | 'job' | 'plugin' | 'request' | 'schedule' | 'subagent' | 'team' | 'webhook'
|
|
7
|
+
|
|
8
|
+
function record(value: unknown): Record<string, unknown> {
|
|
9
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) ? value as Record<string, unknown> : {}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function field(source: Record<string, unknown>, key: string): string {
|
|
13
|
+
return typeof source[key] === 'string' ? source[key] : ''
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Missing or malformed historical reasons stay generic; unfamiliar reasons never imply success. */
|
|
17
|
+
function subagentTitle(reason: unknown): ChatKey {
|
|
18
|
+
if (typeof reason !== 'string' || reason === '') return 'message.trigger.subagent'
|
|
19
|
+
switch (reason) {
|
|
20
|
+
case 'completed': return 'message.trigger.subagent.completed'
|
|
21
|
+
case 'aborted': return 'message.trigger.subagent.aborted'
|
|
22
|
+
case 'error': return 'message.trigger.subagent.error'
|
|
23
|
+
case 'max-tokens': return 'message.trigger.subagent.maxTokens'
|
|
24
|
+
case 'refusal': return 'message.trigger.subagent.refusal'
|
|
25
|
+
// Backends may extend the recorded reason vocabulary.
|
|
26
|
+
default: return 'message.trigger.subagent.unknown'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Describe a waking message using its recorded source.
|
|
32
|
+
* @param node - durable context, including the original notification body.
|
|
33
|
+
* @returns localized title, source-family icon, and compact presentation for continuation receipts.
|
|
34
|
+
*/
|
|
35
|
+
export function turnTriggerDetails(node: ContextMessageNode): {
|
|
36
|
+
title: ChatKey
|
|
37
|
+
icon: TurnTriggerIcon
|
|
38
|
+
compact?: true
|
|
39
|
+
} {
|
|
40
|
+
const source = record(node.source)
|
|
41
|
+
const kind = field(source, 'kind')
|
|
42
|
+
let title: ChatKey = 'message.trigger.request'
|
|
43
|
+
let icon: TurnTriggerIcon = 'request'
|
|
44
|
+
switch (kind) {
|
|
45
|
+
case 'retry':
|
|
46
|
+
if (node.content.length === 0) return { title: 'message.continuation.requested', icon: 'continue', compact: true }
|
|
47
|
+
break
|
|
48
|
+
case 'goal': {
|
|
49
|
+
title = 'message.trigger.goal'
|
|
50
|
+
icon = 'goal'
|
|
51
|
+
break
|
|
52
|
+
}
|
|
53
|
+
case 'agent-message':
|
|
54
|
+
title = 'message.trigger.agent'
|
|
55
|
+
icon = 'agent'
|
|
56
|
+
break
|
|
57
|
+
case 'team-message':
|
|
58
|
+
title = 'message.trigger.team'
|
|
59
|
+
icon = 'team'
|
|
60
|
+
break
|
|
61
|
+
case 'subagent-settled':
|
|
62
|
+
title = subagentTitle(source.stopReason)
|
|
63
|
+
icon = 'subagent'
|
|
64
|
+
break
|
|
65
|
+
case 'webhook': {
|
|
66
|
+
const github = field(source, 'provider') === 'github'
|
|
67
|
+
title = github ? 'message.trigger.github' : 'message.trigger.webhook'
|
|
68
|
+
icon = github ? 'github' : 'webhook'
|
|
69
|
+
break
|
|
70
|
+
}
|
|
71
|
+
case 'schedule':
|
|
72
|
+
title = 'message.trigger.schedule'
|
|
73
|
+
icon = 'schedule'
|
|
74
|
+
break
|
|
75
|
+
case 'tool-jobs':
|
|
76
|
+
title = 'message.trigger.job'
|
|
77
|
+
icon = 'job'
|
|
78
|
+
break
|
|
79
|
+
case 'cordis-host-runner':
|
|
80
|
+
title = 'message.trigger.plugin'
|
|
81
|
+
icon = 'plugin'
|
|
82
|
+
break
|
|
83
|
+
default:
|
|
84
|
+
// Custom sources remain visible without attributing unrecorded identity or success.
|
|
85
|
+
break
|
|
86
|
+
}
|
|
87
|
+
return { title, icon }
|
|
88
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Component-local calendar-day tick: memoized message rows keep stable props
|
|
2
|
+
// across midnight, so the IconActions clock needs a local day seat that
|
|
3
|
+
// re-fires at the next local midnight without reaching for framework hooks.
|
|
4
|
+
|
|
5
|
+
import { useEffect, useState } from 'react'
|
|
6
|
+
import { msUntilNextLocalMidnight, startOfLocalDay } from './message-chrome.ts'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Local calendar-day epoch that advances at each local midnight.
|
|
10
|
+
* @returns Midnight ms for the current local day; updates after the boundary.
|
|
11
|
+
*/
|
|
12
|
+
export function useCalendarDay(): number {
|
|
13
|
+
const [day, setDay] = useState(() => startOfLocalDay(Date.now()))
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
let timer: ReturnType<typeof setTimeout>
|
|
16
|
+
const arm = (): void => {
|
|
17
|
+
const now = Date.now()
|
|
18
|
+
setDay(startOfLocalDay(now))
|
|
19
|
+
timer = setTimeout(arm, msUntilNextLocalMidnight(now))
|
|
20
|
+
}
|
|
21
|
+
timer = setTimeout(arm, msUntilNextLocalMidnight(Date.now()))
|
|
22
|
+
return () => { clearTimeout(timer) }
|
|
23
|
+
}, [])
|
|
24
|
+
return day
|
|
25
|
+
}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/** Turn jumps and history-prepend anchoring, independent of DOM measurement. */
|
|
2
|
+
import { useLayoutEffect, useState } from 'react'
|
|
3
|
+
import type { SessionSnapshot } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
4
|
+
import type { SessionSeq } from '@deepseek-ai/dsh-session/types'
|
|
5
|
+
import type { ChatNode } from '../contract/chat-nodes.ts'
|
|
6
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts'
|
|
7
|
+
import type { TurnRailItem } from './turn-rail-items.ts'
|
|
8
|
+
import type { ChatReading, ReadingSample } from './use-chat-reading.ts'
|
|
9
|
+
import type { ChatViewport } from './use-chat-viewport.ts'
|
|
10
|
+
|
|
11
|
+
/** History availability and loading operations for the committed Chat window. */
|
|
12
|
+
export interface ChatNavigationInput extends Pick<ChatViewSlotProps, 'loadOlder' | 'loadThrough' | 'consumeOlder'> {
|
|
13
|
+
readonly firstSeq: ChatNode['anchorSeq'] | null
|
|
14
|
+
readonly hasMore: boolean
|
|
15
|
+
readonly loadingOlder: boolean
|
|
16
|
+
readonly historyLoadStatus: SessionSnapshot['historyLoadStatus']
|
|
17
|
+
readonly isOpen: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface TurnJump {
|
|
21
|
+
readonly turn: number
|
|
22
|
+
readonly seq: SessionSeq
|
|
23
|
+
phase: 'loading' | 'settled'
|
|
24
|
+
landing: 'pending' | 'landed' | 'interrupted'
|
|
25
|
+
repageHead: ChatNavigationInput['firstSeq']
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type HistoryIntent = 'none' | 'auto' | 'manual'
|
|
29
|
+
|
|
30
|
+
/** Owns one replaceable turn jump and the anchor retained while history loads. */
|
|
31
|
+
export class ChatNavigation {
|
|
32
|
+
private jump: TurnJump | null = null
|
|
33
|
+
private settleFrame: number | null = null
|
|
34
|
+
private historyFrame: number | null = null
|
|
35
|
+
private historyIntent: HistoryIntent = 'none'
|
|
36
|
+
private historyRequested = false
|
|
37
|
+
|
|
38
|
+
constructor(
|
|
39
|
+
private readonly viewport: ChatViewport,
|
|
40
|
+
private readonly reading: ChatReading,
|
|
41
|
+
private input: ChatNavigationInput,
|
|
42
|
+
private readonly onBusyTurn: (turn: number | null) => void,
|
|
43
|
+
private readonly onHistoryIntent: (intent: HistoryIntent) => void = () => {},
|
|
44
|
+
) {}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Adopt committed history availability without starting a request.
|
|
48
|
+
* @param input - history state from the latest committed render.
|
|
49
|
+
*/
|
|
50
|
+
setInput(input: ChatNavigationInput): void {
|
|
51
|
+
this.input = input
|
|
52
|
+
this.historyRequested = false
|
|
53
|
+
if (!input.isOpen || input.historyLoadStatus === 'error' || !input.hasMore) this.setHistoryIntent('none')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Cancel navigation when opening a Chat view. */
|
|
57
|
+
reset(): void {
|
|
58
|
+
this.cancel()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Cancel local callbacks; late history completions cannot revive a task. */
|
|
62
|
+
dispose(): void {
|
|
63
|
+
this.clearTask()
|
|
64
|
+
if (this.historyFrame !== null) cancelAnimationFrame(this.historyFrame)
|
|
65
|
+
this.historyFrame = null
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Release the jump, paging anchor, and busy indicator without cancelling shared history I/O. */
|
|
69
|
+
cancel(): void {
|
|
70
|
+
this.setHistoryIntent('none')
|
|
71
|
+
this.clearTask()
|
|
72
|
+
this.onBusyTurn(null)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Release a jump after reader input without cancelling an accepted history click. */
|
|
76
|
+
readerInteracted(): void {
|
|
77
|
+
this.clearTask()
|
|
78
|
+
this.onBusyTurn(null)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private clearTask(): void {
|
|
82
|
+
this.cancelFrame()
|
|
83
|
+
this.jump = null
|
|
84
|
+
this.viewport.stopPreserving()
|
|
85
|
+
this.viewport.cancelHistoryPrepend()
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Replace the current jump with an explicit turn selection.
|
|
90
|
+
* @param item - loaded anchor or unloaded turn to fetch before landing.
|
|
91
|
+
*/
|
|
92
|
+
readonly navigateToTurn = (item: TurnRailItem): void => {
|
|
93
|
+
if (item.anchor.kind === 'loaded') {
|
|
94
|
+
this.cancel()
|
|
95
|
+
const landing = this.viewport.scrollToTurn(item.turn)
|
|
96
|
+
if (landing === null) return
|
|
97
|
+
this.reading.acceptNavigation(landing)
|
|
98
|
+
if (this.input.loadingOlder) this.viewport.beginPreserving(landing.position)
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
this.cancel()
|
|
102
|
+
this.viewport.beginPreserving()
|
|
103
|
+
this.reading.pauseFollowing()
|
|
104
|
+
const jump: TurnJump = {
|
|
105
|
+
turn: item.turn,
|
|
106
|
+
seq: item.anchor.seq,
|
|
107
|
+
phase: 'loading',
|
|
108
|
+
landing: 'pending',
|
|
109
|
+
repageHead: null,
|
|
110
|
+
}
|
|
111
|
+
this.jump = jump
|
|
112
|
+
this.onBusyTurn(jump.turn)
|
|
113
|
+
this.request(jump)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Request and consume one page, retaining the click until success, exhaustion, or failure. */
|
|
117
|
+
readonly loadEarlier = (): void => {
|
|
118
|
+
this.cancel()
|
|
119
|
+
this.setHistoryIntent('manual')
|
|
120
|
+
this.reading.pauseFollowing()
|
|
121
|
+
if (this.input.historyLoadStatus === 'error') {
|
|
122
|
+
this.historyRequested = true
|
|
123
|
+
this.input.loadOlder()
|
|
124
|
+
} else this.requestHistoryCheck()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private setHistoryIntent(intent: HistoryIntent): void {
|
|
128
|
+
if (intent === this.historyIntent) return
|
|
129
|
+
this.historyIntent = intent
|
|
130
|
+
this.onHistoryIntent(intent)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Coalesce event-driven checks; waiting never schedules its own next frame. */
|
|
134
|
+
requestHistoryCheck(): void {
|
|
135
|
+
if (!this.input.isOpen || this.input.historyLoadStatus === 'error') return
|
|
136
|
+
if (this.historyIntent === 'none' && (this.input.historyLoadStatus !== 'idle'
|
|
137
|
+
|| !this.input.hasMore || this.reading.followingTail)) return
|
|
138
|
+
if (this.historyFrame !== null || typeof requestAnimationFrame !== 'function') return
|
|
139
|
+
this.historyFrame = requestAnimationFrame(() => {
|
|
140
|
+
this.historyFrame = null
|
|
141
|
+
this.checkHistory()
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private checkHistory(): void {
|
|
146
|
+
const input = this.input
|
|
147
|
+
if (!input.isOpen || this.jump !== null || this.historyRequested || input.loadingOlder) return
|
|
148
|
+
if (input.historyLoadStatus === 'error') return
|
|
149
|
+
if (input.historyLoadStatus === 'pendingConsumption') {
|
|
150
|
+
if (this.historyIntent === 'none') return
|
|
151
|
+
if (this.reading.followingTail && this.historyIntent === 'auto') {
|
|
152
|
+
this.setHistoryIntent('none')
|
|
153
|
+
return
|
|
154
|
+
}
|
|
155
|
+
if (this.historyIntent === 'manual') {
|
|
156
|
+
this.viewport.beginManualPaging()
|
|
157
|
+
this.reading.pauseFollowing()
|
|
158
|
+
this.consumeHistory('preserve')
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
const mode = this.viewport.historyConsumption()
|
|
162
|
+
switch (mode) {
|
|
163
|
+
case 'touch':
|
|
164
|
+
case 'inner-scroll':
|
|
165
|
+
return
|
|
166
|
+
case 'motion':
|
|
167
|
+
case 'pointer':
|
|
168
|
+
case 'unavailable':
|
|
169
|
+
this.setHistoryIntent('none')
|
|
170
|
+
return
|
|
171
|
+
case 'prepend':
|
|
172
|
+
if (!this.viewport.beginHistoryPrepend() && input.firstSeq !== null) {
|
|
173
|
+
this.setHistoryIntent('none')
|
|
174
|
+
return
|
|
175
|
+
}
|
|
176
|
+
break
|
|
177
|
+
case 'preserve':
|
|
178
|
+
case 'native':
|
|
179
|
+
break
|
|
180
|
+
}
|
|
181
|
+
if (mode === 'preserve') {
|
|
182
|
+
this.viewport.beginPreserving()
|
|
183
|
+
if (!this.viewport.preserving) this.viewport.beginPaging()
|
|
184
|
+
if (!this.viewport.preserving && input.firstSeq !== null) {
|
|
185
|
+
this.setHistoryIntent('none')
|
|
186
|
+
return
|
|
187
|
+
}
|
|
188
|
+
this.reading.pauseFollowing()
|
|
189
|
+
}
|
|
190
|
+
this.consumeHistory(mode)
|
|
191
|
+
return
|
|
192
|
+
}
|
|
193
|
+
if (!input.hasMore || this.historyIntent !== 'manual' && (this.reading.followingTail
|
|
194
|
+
|| !this.viewport.confirmHistoryStart())) return
|
|
195
|
+
if (this.historyIntent === 'none') this.setHistoryIntent('auto')
|
|
196
|
+
this.historyRequested = true
|
|
197
|
+
input.loadOlder()
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
private consumeHistory(mode: 'native' | 'preserve' | 'prepend'): void {
|
|
201
|
+
this.historyRequested = true
|
|
202
|
+
if (this.input.consumeOlder()) this.setHistoryIntent('none')
|
|
203
|
+
else {
|
|
204
|
+
this.historyRequested = false
|
|
205
|
+
if (mode === 'preserve') this.viewport.stopPreserving()
|
|
206
|
+
if (mode === 'prepend') this.viewport.cancelHistoryPrepend()
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Preserve reader ownership across pending history work.
|
|
212
|
+
* @param sample - settled reader movement that can update or interrupt an anchor.
|
|
213
|
+
*/
|
|
214
|
+
readerSampled(sample: ReadingSample): void {
|
|
215
|
+
if (sample.movedByReader && this.jump?.landing === 'landed') this.jump.landing = 'interrupted'
|
|
216
|
+
if (sample.followingTail || sample.movedByReader) this.viewport.stopPreserving()
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Preserve one paging anchor after a commit or a later size change, regardless of head identity.
|
|
221
|
+
* @returns whether the retained anchor handled the layout change.
|
|
222
|
+
*/
|
|
223
|
+
contentCommitted(): boolean {
|
|
224
|
+
if (!this.viewport.preserving || this.reading.pending) return false
|
|
225
|
+
if (this.landJump(false)) return true
|
|
226
|
+
const landing = this.viewport.preserve()
|
|
227
|
+
if (landing === null) return false
|
|
228
|
+
this.reading.preservePosition(landing)
|
|
229
|
+
return true
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** Land, retry, or complete the current jump against the committed window. */
|
|
233
|
+
reconcile(): void {
|
|
234
|
+
const jump = this.jump
|
|
235
|
+
if (jump === null || this.reading.pending) return
|
|
236
|
+
if (jump.phase === 'loading') {
|
|
237
|
+
if (jump.landing === 'pending') this.landJump(false)
|
|
238
|
+
return
|
|
239
|
+
}
|
|
240
|
+
if (this.input.loadingOlder) return
|
|
241
|
+
if (this.landJump(true)) return
|
|
242
|
+
const uncovered = this.input.firstSeq === null || this.input.firstSeq > jump.seq
|
|
243
|
+
if (uncovered && this.input.hasMore && jump.repageHead !== this.input.firstSeq) {
|
|
244
|
+
jump.repageHead = this.input.firstSeq
|
|
245
|
+
this.viewport.beginPreserving()
|
|
246
|
+
this.request(jump)
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
const fallback = this.viewport.scrollToTurnAtOrAfter(jump.turn)
|
|
250
|
+
this.cancel()
|
|
251
|
+
if (fallback !== null) this.reading.acceptNavigation(fallback)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
private landJump(settle: boolean): boolean {
|
|
255
|
+
const jump = this.jump
|
|
256
|
+
if (jump === null) return false
|
|
257
|
+
if (jump.landing === 'interrupted') {
|
|
258
|
+
if (settle) { this.cancel(); return true }
|
|
259
|
+
return false
|
|
260
|
+
}
|
|
261
|
+
const landing = this.viewport.scrollToTurn(jump.turn)
|
|
262
|
+
if (landing === null) return false
|
|
263
|
+
this.reading.acceptNavigation(landing)
|
|
264
|
+
if (settle) this.cancel()
|
|
265
|
+
else {
|
|
266
|
+
this.viewport.beginPreserving(landing.position)
|
|
267
|
+
jump.landing = 'landed'
|
|
268
|
+
}
|
|
269
|
+
return true
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
private request(jump: TurnJump): void {
|
|
273
|
+
jump.phase = 'loading'
|
|
274
|
+
const settled = (): void => {
|
|
275
|
+
if (this.jump !== jump) return
|
|
276
|
+
jump.phase = 'settled'
|
|
277
|
+
this.cancelFrame()
|
|
278
|
+
if (typeof requestAnimationFrame !== 'function') this.reconcile()
|
|
279
|
+
else this.settleFrame = requestAnimationFrame(() => {
|
|
280
|
+
this.settleFrame = null
|
|
281
|
+
if (this.jump === jump) this.reconcile()
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
void this.input.loadThrough(jump.seq).then(settled, settled)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
private cancelFrame(): void {
|
|
288
|
+
if (this.settleFrame !== null && typeof cancelAnimationFrame === 'function') cancelAnimationFrame(this.settleFrame)
|
|
289
|
+
this.settleFrame = null
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Retain one navigation owner for the component's lifetime.
|
|
295
|
+
* @param viewport - turn-aware DOM operations.
|
|
296
|
+
* @param reading - reading and follow policy receiving navigation landings.
|
|
297
|
+
* @param input - committed history state and load operations.
|
|
298
|
+
* @returns the navigation owner and its visible busy turn.
|
|
299
|
+
*/
|
|
300
|
+
export function useChatNavigation(
|
|
301
|
+
viewport: ChatViewport, reading: ChatReading, input: ChatNavigationInput,
|
|
302
|
+
): { navigation: ChatNavigation; busyTurn: number | null; historyPending: boolean; historyProcessing: boolean } {
|
|
303
|
+
const [busyTurn, setBusyTurn] = useState<number | null>(null)
|
|
304
|
+
const [historyIntent, setHistoryIntent] = useState<HistoryIntent>('none')
|
|
305
|
+
const [navigation] = useState(() => new ChatNavigation(viewport, reading, input, setBusyTurn, setHistoryIntent))
|
|
306
|
+
useLayoutEffect(() => { navigation.setInput(input) }, [navigation, input])
|
|
307
|
+
useLayoutEffect(() => () => { navigation.dispose() }, [navigation])
|
|
308
|
+
return { navigation, busyTurn, historyPending: historyIntent === 'manual', historyProcessing: historyIntent !== 'none' }
|
|
309
|
+
}
|