@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,48 @@
|
|
|
1
|
+
/** Running Turn clock isolated from the transcript's render cycle. */
|
|
2
|
+
import { memo, useEffect, useState } from 'react'
|
|
3
|
+
import { TextShimmer } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts'
|
|
5
|
+
import { formatRunDuration, LIVE_RUN_CLOCK_INTERVAL_MS } from './message-chrome.ts'
|
|
6
|
+
import { RunningWhaleTail } from './RunningWhaleTail.tsx'
|
|
7
|
+
import a11yCss from './accessibility.module.css'
|
|
8
|
+
import css from './ChatView.module.css'
|
|
9
|
+
|
|
10
|
+
interface RunningStatusProps {
|
|
11
|
+
readonly startTime: number | undefined
|
|
12
|
+
/** Freeze the shown duration while the Client cannot observe the Session. */
|
|
13
|
+
readonly paused: boolean
|
|
14
|
+
/** Keep the slot without showing or announcing the status: the Session stopped before its Turn closed. */
|
|
15
|
+
readonly holding?: boolean
|
|
16
|
+
readonly t: ChatViewSlotProps['t']
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Show live elapsed time after the current Turn's content without announcing ticks.
|
|
21
|
+
* @param props - Current Turn start time, pause state, and localized copy.
|
|
22
|
+
* @returns the blue running indicator; mount while the Session is running, or holding its slot hidden until the
|
|
23
|
+
* Turn's actions row replaces it.
|
|
24
|
+
*/
|
|
25
|
+
export const RunningStatus = memo(function RunningStatus({ startTime, paused, holding = false, t }: RunningStatusProps) {
|
|
26
|
+
const [now, setNow] = useState(Date.now)
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (startTime === undefined || paused || holding) return
|
|
29
|
+
setNow(Date.now())
|
|
30
|
+
const timer = setInterval(() => { setNow(Date.now()) }, LIVE_RUN_CLOCK_INTERVAL_MS)
|
|
31
|
+
return () => { clearInterval(timer) }
|
|
32
|
+
}, [startTime, paused, holding])
|
|
33
|
+
const label = startTime === undefined ? t('chat.deepDiving') : t('chat.deepDivingFor', {
|
|
34
|
+
duration: formatRunDuration(Math.max(1000, now - startTime), t).map(part => part.text).join(''),
|
|
35
|
+
})
|
|
36
|
+
return (
|
|
37
|
+
<div className={css.running} data-chat-running data-holding={holding ? '' : undefined} aria-hidden={holding || undefined}>
|
|
38
|
+
{holding ? null : (
|
|
39
|
+
<span className={a11yCss.visuallyHidden} role="status" aria-live="polite" aria-atomic="true">{t('chat.deepDiving')}</span>
|
|
40
|
+
)}
|
|
41
|
+
<span className={css.runningDivider} aria-hidden="true" />
|
|
42
|
+
<span className={css.runningContent}>
|
|
43
|
+
<RunningWhaleTail />
|
|
44
|
+
<TextShimmer active={!holding} className={css.runningText}>{label}</TextShimmer>
|
|
45
|
+
</span>
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Animated whale mask and static SVG fallback for the running Chat status. */
|
|
2
|
+
import css from './ChatView.module.css'
|
|
3
|
+
|
|
4
|
+
const REST_PATH = 'M8.844 13.742C8.967 12.328 8.45 10.4 8.45 9.65C8.45 8.94 8.88 8.43 9.6 8.43C11.285 8.43 12.106 8.281 12.685 8.104C13.71 7.791 14.585 6.768 15.055 5.945C15.137 5.803 14.99 5.641 14.829 5.671C13.829 5.86 12.828 5.376 11.827 4.978C10.659 4.514 9.491 4.707 8.935 4.876C8.805 4.915 8.658 4.819 8.636 4.686C8.468 3.643 7.405 2.615 5.498 2.238C4.54 2.048 3.748 1.574 3.347 1.202C3.252 1.113 3.088 1.125 3.03 1.242C2.628 2.059 2.168 3.82 5.248 6.115C5.82 6.494 6.31 6.785 6.574 7.637C6.72 8.104 6.157 9.168 6.061 9.368C5.157 11.27 5.089 12.19 4.926 13.742'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Render the decorative running icon; the APNG asset owns its animation timing.
|
|
8
|
+
* @returns mask and static SVG selected by browser capabilities and accessibility preferences.
|
|
9
|
+
*/
|
|
10
|
+
export function RunningWhaleTail() {
|
|
11
|
+
return (
|
|
12
|
+
<span className={css.runningIcon} aria-hidden="true">
|
|
13
|
+
<span className={css.runningWhaleAnimated} />
|
|
14
|
+
<svg className={css.runningWhaleStill} width="100%" height="100%" viewBox="0 0 16 16" fill="none">
|
|
15
|
+
<path d={REST_PATH} stroke="currentColor" strokeWidth={1} />
|
|
16
|
+
</svg>
|
|
17
|
+
</span>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* Composer statistics use compact controls; their click-open panels share
|
|
2
|
+
stat-dialog.module.css. */
|
|
3
|
+
|
|
4
|
+
/* Entry root and dialog anchor: shrink-wraps its pill so the panel clamp
|
|
5
|
+
measures the pill. */
|
|
6
|
+
.anchor {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
min-width: 0;
|
|
9
|
+
font-size: calc(var(--dsh-content-font-size-secondary, 13px) - 1px);
|
|
10
|
+
line-height: calc(20px + var(--dsh-content-font-delta-secondary, 0px));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.pill {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 6px;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
max-width: 100%;
|
|
19
|
+
padding: 1px 8px;
|
|
20
|
+
border: none;
|
|
21
|
+
border-radius: var(--dsw-radius-sm);
|
|
22
|
+
background: transparent;
|
|
23
|
+
color: var(--dsw-alias-label-tertiary);
|
|
24
|
+
font: inherit;
|
|
25
|
+
font-variant-numeric: tabular-nums;
|
|
26
|
+
line-height: inherit;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.pill svg {
|
|
31
|
+
width: 14px;
|
|
32
|
+
height: 14px;
|
|
33
|
+
flex: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Only the button form (a pill with dialog rows to open) invites interaction;
|
|
37
|
+
the static span form keeps the resting tertiary reading. */
|
|
38
|
+
button.pill {
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
button.pill[aria-expanded='true'] {
|
|
43
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
44
|
+
color: var(--dsw-alias-label-secondary);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@media (hover: hover) {
|
|
48
|
+
button.pill:hover {
|
|
49
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
50
|
+
color: var(--dsw-alias-label-secondary);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.label {
|
|
55
|
+
min-width: 0;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
text-overflow: ellipsis;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.sep {
|
|
61
|
+
color: var(--dsw-alias-separator-primary);
|
|
62
|
+
margin: 0 6px;
|
|
63
|
+
}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
// Composer statistics pills, each its own 'conversation.composer.dock' list
|
|
2
|
+
// entry (activity, usage) so a plugin can replace or add one pill by id.
|
|
3
|
+
// Compact keeps speed and cache hit as plain readings; Detailed adds counts,
|
|
4
|
+
// token totals, and click-open dialogs. Settled-node identity prevents
|
|
5
|
+
// stream-delta updates from rerendering the pills.
|
|
6
|
+
|
|
7
|
+
import { memo, useMemo, type ReactNode } from 'react'
|
|
8
|
+
import { createPortal } from 'react-dom'
|
|
9
|
+
import { IconDatabaseOutlineRegular, IconGaugeOutlineRegular, Tooltip } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
10
|
+
import type { UseProjection } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
11
|
+
import type { InjectFace, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots'
|
|
12
|
+
// Type-only: merges the sessionStats key into SessionProjectionMap for useProjection.
|
|
13
|
+
import type {} from '@deepseek-ai/dsh-session-stats/client'
|
|
14
|
+
import type { TokenUsageProjection } from '@deepseek-ai/dsh-token-meter/client'
|
|
15
|
+
import type { ChatViewSlotProps, PerformanceUsageInjected } from '../contract/slots.ts'
|
|
16
|
+
import type { ChatSnapshot } from '../contract/snapshot.ts'
|
|
17
|
+
import { formatTokensPerSecond } from './message-chrome.ts'
|
|
18
|
+
import { assistantStepReading } from '../contract/turn-metrics.ts'
|
|
19
|
+
import { formatCacheHitPercent, formatExactTokens, formatTokens } from './token-format.ts'
|
|
20
|
+
import { useStatDialog } from './stat-dialog.ts'
|
|
21
|
+
import css from './StatsPills.module.css'
|
|
22
|
+
import dialogCss from './stat-dialog.module.css'
|
|
23
|
+
|
|
24
|
+
interface WindowStats {
|
|
25
|
+
turns: number
|
|
26
|
+
steps: number
|
|
27
|
+
/** Summed request wall time (step/start → assistant/message); 0 when no node carries timing. */
|
|
28
|
+
llmMs: number
|
|
29
|
+
/** Summed tool wall time (tool/call → tool/result); 0 when no pair is in-window. */
|
|
30
|
+
toolMs: number
|
|
31
|
+
/** Summed first-token latency over `ttftSteps`; 0 when no step records it. */
|
|
32
|
+
ttftMs: number
|
|
33
|
+
/** Steps carrying a recorded TTFT. */
|
|
34
|
+
ttftSteps: number
|
|
35
|
+
/** Summed decode wall time over steps that also report output tokens. */
|
|
36
|
+
decodeMs: number
|
|
37
|
+
/** Summed output tokens over the same decode-timed steps. */
|
|
38
|
+
decodeTokens: number
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Fold assistant and tool-result nodes into window-scoped display totals —
|
|
43
|
+
* the FALLBACK for assemblies without the `sessionStats` projection.
|
|
44
|
+
*
|
|
45
|
+
* Every displayed figure rides that durable whole-log projection (and token
|
|
46
|
+
* accounting rides `tokenUsage`) because the window is paged and compaction
|
|
47
|
+
* rewrites it; this fold answers "what is on screen" only when no projection
|
|
48
|
+
* value is served. Its field names deliberately mirror the projection's so
|
|
49
|
+
* the two swap wholesale.
|
|
50
|
+
* @param nodes - snapshot nodes.
|
|
51
|
+
* @returns fallback counts and summed wall times.
|
|
52
|
+
*/
|
|
53
|
+
export function deriveStats(nodes: ChatSnapshot['legacy']['nodes']): WindowStats {
|
|
54
|
+
const turns = new Set<number>()
|
|
55
|
+
let steps = 0
|
|
56
|
+
let llmMs = 0
|
|
57
|
+
let toolMs = 0
|
|
58
|
+
let ttftMs = 0
|
|
59
|
+
let ttftSteps = 0
|
|
60
|
+
let decodeMs = 0
|
|
61
|
+
let decodeTokens = 0
|
|
62
|
+
for (const node of nodes) {
|
|
63
|
+
if (node.kind === 'tool-result') {
|
|
64
|
+
if (node.callTime !== null) toolMs += Math.max(0, node.time - node.callTime)
|
|
65
|
+
continue
|
|
66
|
+
}
|
|
67
|
+
if (node.kind !== 'assistant') continue
|
|
68
|
+
turns.add(node.turn)
|
|
69
|
+
steps += 1
|
|
70
|
+
if (node.timing !== undefined && node.timing.stepStartTime !== null) {
|
|
71
|
+
llmMs += Math.max(0, node.timing.completedTime - node.timing.stepStartTime)
|
|
72
|
+
}
|
|
73
|
+
const reading = assistantStepReading(node)
|
|
74
|
+
if (reading.ttftMs !== null) {
|
|
75
|
+
ttftMs += reading.ttftMs
|
|
76
|
+
ttftSteps += 1
|
|
77
|
+
}
|
|
78
|
+
if (reading.decodeMs !== null && reading.outputTokens !== null) {
|
|
79
|
+
decodeMs += reading.decodeMs
|
|
80
|
+
decodeTokens += reading.outputTokens
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return { turns: turns.size, steps, llmMs, toolMs, ttftMs, ttftSteps, decodeMs, decodeTokens }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Compact duration: 45.2s under a minute, 2m42s from there on.
|
|
88
|
+
* @param ms - duration in milliseconds.
|
|
89
|
+
* @returns display string.
|
|
90
|
+
*/
|
|
91
|
+
export function formatDuration(ms: number, t: ChatViewSlotProps['t']): string {
|
|
92
|
+
const s = ms / 1_000
|
|
93
|
+
if (s < 60) return t('duration.compactSeconds', { seconds: Math.round(s * 10) / 10 })
|
|
94
|
+
const whole = Math.round(s)
|
|
95
|
+
return t('duration.compactMinutes', {
|
|
96
|
+
minutes: Math.floor(whole / 60),
|
|
97
|
+
seconds: whole % 60,
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Display-ready cache-hit share of prompt-side input over the whole durable log.
|
|
103
|
+
* @param usage - the session's token-usage projection value.
|
|
104
|
+
* @returns integer text when integer rounding stays below 100, otherwise the
|
|
105
|
+
* minimum decimal precision that still rounds below 100; a full hit returns
|
|
106
|
+
* 100, and no billed input returns null.
|
|
107
|
+
*/
|
|
108
|
+
export function cacheHitPercent(usage: TokenUsageProjection): string | null {
|
|
109
|
+
const denominator = billedInputTokens(usage)
|
|
110
|
+
return formatCacheHitPercent(usage.cacheReadTokens, denominator)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Sum the three disjoint prompt-side billing buckets.
|
|
115
|
+
* @param usage - the session's token-usage projection value.
|
|
116
|
+
* @returns billed input tokens.
|
|
117
|
+
*/
|
|
118
|
+
export function billedInputTokens(usage: TokenUsageProjection): number {
|
|
119
|
+
return usage.uncachedInputTokens + usage.cacheReadTokens + usage.cacheWriteTokens
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
type Translate = ChatViewSlotProps['t']
|
|
123
|
+
|
|
124
|
+
/** Props shared by every composer stats pill: the conversation-snapshot selector plus the projection read seat. */
|
|
125
|
+
export interface StatPillProps extends InjectFace<PerformanceUsageInjected> {
|
|
126
|
+
useChat: SnapshotSelectorHook<ChatSnapshot>
|
|
127
|
+
useProjection: UseProjection
|
|
128
|
+
/** The owning dock's locale seat. */
|
|
129
|
+
t: Translate
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Dock entry id carried as `data-composer-stat` on each pill. */
|
|
133
|
+
type StatId = 'activity' | 'usage'
|
|
134
|
+
|
|
135
|
+
interface PillContent {
|
|
136
|
+
stat: StatId
|
|
137
|
+
icon: ReactNode
|
|
138
|
+
label: ReactNode
|
|
139
|
+
/** The full reading as plain text: the accessible name and the tooltip shown while the label is cut off. */
|
|
140
|
+
text: string
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function exactCount(value: number, t: Translate): string {
|
|
144
|
+
return t('message.turnUsage.count', { count: formatExactTokens(value, t) })
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** One or two reading segments, visually joined by a separator glyph. */
|
|
148
|
+
function reading(first: string, second: string | null): Pick<PillContent, 'label' | 'text'> {
|
|
149
|
+
if (second === null) return { label: first, text: first }
|
|
150
|
+
return {
|
|
151
|
+
label: (
|
|
152
|
+
<>
|
|
153
|
+
{first}
|
|
154
|
+
<span className={css.sep} aria-hidden>·</span>
|
|
155
|
+
{second}
|
|
156
|
+
</>
|
|
157
|
+
),
|
|
158
|
+
text: `${first} · ${second}`,
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Every figure rides the durable sessionStats projection, so paging and
|
|
163
|
+
// compaction cannot change any of them; an assembly without the unit falls
|
|
164
|
+
// back to the window-scoped fold wholesale (same field names), paid only
|
|
165
|
+
// while no projection value is served.
|
|
166
|
+
function useSessionStats(useChat: StatPillProps['useChat'], useProjection: UseProjection): WindowStats {
|
|
167
|
+
const settledNodes = useChat(s => s.legacy.nodes)
|
|
168
|
+
const projected = useProjection('sessionStats')
|
|
169
|
+
return useMemo(() => projected ?? deriveStats(settledNodes), [projected, settledNodes])
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function decodeSpeed(stats: WindowStats, t: Translate): string {
|
|
173
|
+
return t('message.tokensPerSecond', {
|
|
174
|
+
tps: formatTokensPerSecond(stats.decodeTokens / (stats.decodeMs / 1_000)),
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** The full reading above a pill, only while an ellipsis cuts its label; the delay matches the dock's context meter. */
|
|
179
|
+
const FULL_READING_TOOLTIP = { side: 'top', portal: true, delayMs: 200, onlyWhenClipped: true } as const
|
|
180
|
+
|
|
181
|
+
/** A static reading: used when the pill has no dialog rows or the mode is Compact. */
|
|
182
|
+
function PlainPill({ stat, icon, label, text }: PillContent) {
|
|
183
|
+
return (
|
|
184
|
+
<span className={css.anchor} data-composer-stat={stat}>
|
|
185
|
+
{/* No dialog carries a static reading, so a tap also pins the full text. */}
|
|
186
|
+
<Tooltip label={text} {...FULL_READING_TOOLTIP} openOnClick>
|
|
187
|
+
<span className={css.pill}>
|
|
188
|
+
{icon}
|
|
189
|
+
<span className={css.label}>{label}</span>
|
|
190
|
+
</span>
|
|
191
|
+
</Tooltip>
|
|
192
|
+
</span>
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* A pill button opening its own portaled dialog. Each pill owns its open
|
|
198
|
+
* state; useStatDialog closes it on Escape or an outside pointerdown or click,
|
|
199
|
+
* so at most one dialog is open across the dock.
|
|
200
|
+
*/
|
|
201
|
+
function DialogPill({ stat, icon, label, text, title, titleValue, children }: PillContent & {
|
|
202
|
+
title: string
|
|
203
|
+
titleValue?: string
|
|
204
|
+
children: ReactNode
|
|
205
|
+
}) {
|
|
206
|
+
const { open, setOpen, rootRef, panelRef, anchorName } = useStatDialog()
|
|
207
|
+
return (
|
|
208
|
+
<span ref={rootRef} style={{ anchorName }} className={css.anchor} data-composer-stat={stat}>
|
|
209
|
+
{/* The open dialog already shows every figure; a tooltip would cover it. */}
|
|
210
|
+
<Tooltip label={text} {...FULL_READING_TOOLTIP} disabled={open}>
|
|
211
|
+
<button
|
|
212
|
+
type="button"
|
|
213
|
+
className={css.pill}
|
|
214
|
+
aria-haspopup="dialog"
|
|
215
|
+
aria-expanded={open}
|
|
216
|
+
aria-label={text}
|
|
217
|
+
onClick={() => { setOpen(!open) }}
|
|
218
|
+
>
|
|
219
|
+
{icon}
|
|
220
|
+
<span className={css.label}>{label}</span>
|
|
221
|
+
</button>
|
|
222
|
+
</Tooltip>
|
|
223
|
+
{open && createPortal(
|
|
224
|
+
<div
|
|
225
|
+
ref={panelRef}
|
|
226
|
+
className={dialogCss.panel}
|
|
227
|
+
role="dialog"
|
|
228
|
+
aria-label={title}
|
|
229
|
+
style={{ positionAnchor: anchorName }}
|
|
230
|
+
>
|
|
231
|
+
<div className={dialogCss.title}>
|
|
232
|
+
<span className={dialogCss.titleLabel}>
|
|
233
|
+
{icon}
|
|
234
|
+
{title}
|
|
235
|
+
</span>
|
|
236
|
+
{titleValue !== undefined && <span className={dialogCss.titleValue}>{titleValue}</span>}
|
|
237
|
+
</div>
|
|
238
|
+
<div className={dialogCss.titleRule} aria-hidden />
|
|
239
|
+
{children}
|
|
240
|
+
</div>,
|
|
241
|
+
document.body,
|
|
242
|
+
)}
|
|
243
|
+
</span>
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Turn and step counts with whole-session speed, opening the time and speed
|
|
249
|
+
* dialog; Compact keeps only the speed reading.
|
|
250
|
+
*/
|
|
251
|
+
export const ActivityPill = memo(function ActivityPill({ useChat, useProjection, usePerformanceUsage, t }: StatPillProps) {
|
|
252
|
+
const mode = usePerformanceUsage(value => value)
|
|
253
|
+
const stats = useSessionStats(useChat, useProjection)
|
|
254
|
+
const speed = stats.decodeMs > 0 ? decodeSpeed(stats, t) : null
|
|
255
|
+
const icon = <IconGaugeOutlineRegular />
|
|
256
|
+
if (mode === 'compact') return speed === null ? null : <PlainPill stat="activity" icon={icon} {...reading(speed, null)} />
|
|
257
|
+
if (stats.steps === 0) return null
|
|
258
|
+
const counts = t('stats.counts', { turns: stats.turns, steps: stats.steps })
|
|
259
|
+
const content: PillContent = { stat: 'activity', icon, ...reading(counts, speed) }
|
|
260
|
+
// A window without one timed figure has no dialog rows to show, so the pill
|
|
261
|
+
// stays a plain reading instead of a button opening an empty dialog.
|
|
262
|
+
if (stats.llmMs <= 0 && stats.toolMs <= 0 && stats.ttftSteps <= 0 && speed === null) return <PlainPill {...content} />
|
|
263
|
+
return (
|
|
264
|
+
// The counts head the dialog, so a cut-off reading stays complete once the dialog opens.
|
|
265
|
+
<DialogPill {...content} title={t('stats.dialog.title')} titleValue={counts}>
|
|
266
|
+
<dl className={dialogCss.details} data-session-stats-details>
|
|
267
|
+
{stats.llmMs > 0 && (
|
|
268
|
+
<>
|
|
269
|
+
<dt>{t('stats.dialog.llmTime')}</dt>
|
|
270
|
+
<dd>{formatDuration(stats.llmMs, t)}</dd>
|
|
271
|
+
</>
|
|
272
|
+
)}
|
|
273
|
+
{stats.toolMs > 0 && (
|
|
274
|
+
<>
|
|
275
|
+
<dt>{t('stats.dialog.toolTime')}</dt>
|
|
276
|
+
<dd>{formatDuration(stats.toolMs, t)}</dd>
|
|
277
|
+
</>
|
|
278
|
+
)}
|
|
279
|
+
{stats.ttftSteps > 0 && (
|
|
280
|
+
<>
|
|
281
|
+
<dt>{t('stats.dialog.ttft')}</dt>
|
|
282
|
+
<dd>{formatDuration(stats.ttftMs / stats.ttftSteps, t)}</dd>
|
|
283
|
+
</>
|
|
284
|
+
)}
|
|
285
|
+
{speed !== null && (
|
|
286
|
+
<>
|
|
287
|
+
<dt>{t('stats.dialog.speed')}</dt>
|
|
288
|
+
<dd>{speed}</dd>
|
|
289
|
+
</>
|
|
290
|
+
)}
|
|
291
|
+
</dl>
|
|
292
|
+
</DialogPill>
|
|
293
|
+
)
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
/** Whole-log token total and cache hit; Compact keeps only the cache hit. */
|
|
297
|
+
export const UsagePill = memo(function UsagePill({ useProjection, usePerformanceUsage, t }: StatPillProps) {
|
|
298
|
+
const mode = usePerformanceUsage(value => value)
|
|
299
|
+
const usage = useProjection('tokenUsage')
|
|
300
|
+
// Gated on actual token activity: a session whose steps all settled without
|
|
301
|
+
// billing (e.g. every request failed) shows no usage pill.
|
|
302
|
+
if (usage === undefined || (billedInputTokens(usage) === 0 && usage.outputTokens === 0)) return null
|
|
303
|
+
const cacheHit = cacheHitPercent(usage)
|
|
304
|
+
const cacheHitText = cacheHit !== null ? t('stats.cacheHit', { percent: cacheHit }) : null
|
|
305
|
+
const icon = <IconDatabaseOutlineRegular />
|
|
306
|
+
if (mode === 'compact') {
|
|
307
|
+
return cacheHitText === null ? null : <PlainPill stat="usage" icon={icon} {...reading(cacheHitText, null)} />
|
|
308
|
+
}
|
|
309
|
+
// Same aggregate as the Turn pill's totalTokens: every prompt-side billing bucket plus output.
|
|
310
|
+
const total = billedInputTokens(usage) + usage.outputTokens
|
|
311
|
+
const totalText = t('message.turnUsage.count', { count: formatTokens(total, t) })
|
|
312
|
+
return (
|
|
313
|
+
<DialogPill
|
|
314
|
+
stat="usage"
|
|
315
|
+
icon={icon}
|
|
316
|
+
{...reading(totalText, cacheHitText)}
|
|
317
|
+
title={t('stats.dialog.usageTitle')}
|
|
318
|
+
titleValue={exactCount(total, t)}
|
|
319
|
+
>
|
|
320
|
+
{/* jscpd:ignore-start -- the session-total bucket rows deliberately mirror
|
|
321
|
+
TurnUsagePanel's per-turn dl: same skin, different data contract (the
|
|
322
|
+
buckets are always present here; per-turn fields are optional). A
|
|
323
|
+
session that never wrote cache drops the row, as the per-turn panel
|
|
324
|
+
drops its absent fields. */}
|
|
325
|
+
<dl className={dialogCss.details} data-session-stats-usage>
|
|
326
|
+
{cacheHit !== null && (
|
|
327
|
+
<>
|
|
328
|
+
<dt>{t('message.turnUsage.cacheHit')}</dt>
|
|
329
|
+
<dd>{`${cacheHit}%`}</dd>
|
|
330
|
+
</>
|
|
331
|
+
)}
|
|
332
|
+
<dt>{t('message.turnUsage.input')}</dt>
|
|
333
|
+
<dd>{exactCount(usage.uncachedInputTokens, t)}</dd>
|
|
334
|
+
<dt>{t('message.turnUsage.cacheRead')}</dt>
|
|
335
|
+
<dd>{exactCount(usage.cacheReadTokens, t)}</dd>
|
|
336
|
+
{usage.cacheWriteTokens !== 0 && (
|
|
337
|
+
<>
|
|
338
|
+
<dt>{t('message.turnUsage.cacheWrite')}</dt>
|
|
339
|
+
<dd>{exactCount(usage.cacheWriteTokens, t)}</dd>
|
|
340
|
+
</>
|
|
341
|
+
)}
|
|
342
|
+
<dt>{t('message.turnUsage.output')}</dt>
|
|
343
|
+
<dd>{exactCount(usage.outputTokens, t)}</dd>
|
|
344
|
+
</dl>
|
|
345
|
+
{/* jscpd:ignore-end */}
|
|
346
|
+
</DialogPill>
|
|
347
|
+
)
|
|
348
|
+
})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { memo, useState } from 'react'
|
|
2
|
+
import type { ChatNodeViewProps, ChatViewSlotProps } from '../contract/slots.ts'
|
|
3
|
+
import { DisclosureRow, IconBrowseOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
+
import { OpaqueBody } from './ContextBody.tsx'
|
|
5
|
+
import css from './ContextInjectionRow.module.css'
|
|
6
|
+
|
|
7
|
+
/** Props for one complete system prompt disclosure. */
|
|
8
|
+
export interface SystemPromptRowProps {
|
|
9
|
+
/** Complete model-visible prompt text. */
|
|
10
|
+
text: string
|
|
11
|
+
/** True when the prompt replaced an earlier one from this position in the history. */
|
|
12
|
+
update?: boolean
|
|
13
|
+
/** The owning view's locale seat. */
|
|
14
|
+
t: ChatViewSlotProps['t']
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Render one complete system prompt as a collapsed disclosure whose expanded
|
|
19
|
+
* body is the same opaque context chrome: 141px code-block scrollport and
|
|
20
|
+
* model-facing text with its real line breaks. An in-history update uses the
|
|
21
|
+
* same row under its own title.
|
|
22
|
+
* @param props - Complete prompt text, whether it is an update, and the locale seat.
|
|
23
|
+
* @returns The system-prompt disclosure row.
|
|
24
|
+
*/
|
|
25
|
+
export function SystemPromptRow({ text, update = false, t }: SystemPromptRowProps) {
|
|
26
|
+
const [open, setOpen] = useState(false)
|
|
27
|
+
return (
|
|
28
|
+
<DisclosureRow
|
|
29
|
+
className={css.root}
|
|
30
|
+
icon={<IconBrowseOutlineRegular size={14} />}
|
|
31
|
+
chevronClassName={css.chevron}
|
|
32
|
+
title={t(update ? 'message.systemPromptUpdate' : 'message.systemPrompt')}
|
|
33
|
+
open={open}
|
|
34
|
+
expandable
|
|
35
|
+
expandOnRowClick
|
|
36
|
+
onToggle={() => { setOpen(value => !value) }}
|
|
37
|
+
>
|
|
38
|
+
<div className={css.body} data-system-prompt-body>
|
|
39
|
+
<OpaqueBody content={[{ type: 'text', text }]} source={null} t={t} />
|
|
40
|
+
</div>
|
|
41
|
+
</DisclosureRow>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** System-prompt keyed Chat renderer. */
|
|
46
|
+
export const SystemPromptNodeView = memo(function SystemPromptNodeView({
|
|
47
|
+
node, t,
|
|
48
|
+
}: Pick<ChatNodeViewProps<'system-prompt'>, 'node' | 't'>) {
|
|
49
|
+
return <SystemPromptRow text={node.data.text} update={node.data.update === true} t={t} />
|
|
50
|
+
})
|