@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.
Files changed (355) hide show
  1. package/README.i18n.yaml +16 -16
  2. package/README.md +17 -5
  3. package/README.zh.md +17 -5
  4. package/lib/client.js +18 -15587
  5. package/lib/client.js.map +1 -0
  6. package/lib/types/chat-settings.d.ts.map +1 -0
  7. package/lib/types/chat-settings.js.map +1 -0
  8. package/lib/types/client/apply.d.ts.map +1 -0
  9. package/lib/types/client/apply.js.map +1 -0
  10. package/lib/types/client/chat/ApprovalCommand.d.ts +4 -3
  11. package/lib/types/client/chat/ApprovalCommand.d.ts.map +1 -0
  12. package/lib/types/client/chat/ApprovalCommand.js.map +1 -0
  13. package/lib/types/client/chat/AssistantMarkdown.d.ts.map +1 -0
  14. package/lib/types/client/chat/AssistantMarkdown.js.map +1 -0
  15. package/lib/types/client/chat/AssistantNodeView.d.ts.map +1 -0
  16. package/lib/types/client/chat/AssistantNodeView.js.map +1 -0
  17. package/lib/types/client/chat/ChatFlow.d.ts.map +1 -0
  18. package/lib/types/client/chat/ChatFlow.js.map +1 -0
  19. package/lib/types/client/chat/ChatGroupSeat.d.ts.map +1 -0
  20. package/lib/types/client/chat/ChatGroupSeat.js.map +1 -0
  21. package/lib/types/client/chat/ChatNodeSeat.d.ts.map +1 -0
  22. package/lib/types/client/chat/ChatNodeSeat.js.map +1 -0
  23. package/lib/types/client/chat/ChatView.d.ts +1 -1
  24. package/lib/types/client/chat/ChatView.d.ts.map +1 -0
  25. package/lib/types/client/chat/ChatView.js.map +1 -0
  26. package/lib/types/client/chat/CommandNodeView.d.ts.map +1 -0
  27. package/lib/types/client/chat/CommandNodeView.js.map +1 -0
  28. package/lib/types/client/chat/CompactionCommandCard.d.ts.map +1 -0
  29. package/lib/types/client/chat/CompactionCommandCard.js.map +1 -0
  30. package/lib/types/client/chat/CompactionItem.d.ts.map +1 -0
  31. package/lib/types/client/chat/CompactionItem.js.map +1 -0
  32. package/lib/types/client/chat/ContextBody.d.ts.map +1 -0
  33. package/lib/types/client/chat/ContextBody.js.map +1 -0
  34. package/lib/types/client/chat/ContextInjectionRow.d.ts.map +1 -0
  35. package/lib/types/client/chat/ContextInjectionRow.js.map +1 -0
  36. package/lib/types/client/chat/GenericCommandCard.d.ts.map +1 -0
  37. package/lib/types/client/chat/GenericCommandCard.js.map +1 -0
  38. package/lib/types/client/chat/MessageIconActions.d.ts.map +1 -0
  39. package/lib/types/client/chat/MessageIconActions.js.map +1 -0
  40. package/lib/types/client/chat/MessageItem.d.ts.map +1 -0
  41. package/lib/types/client/chat/MessageItem.js.map +1 -0
  42. package/lib/types/client/chat/QuotaNoticeHost.d.ts.map +1 -0
  43. package/lib/types/client/chat/QuotaNoticeHost.js.map +1 -0
  44. package/lib/types/client/chat/ReasoningContent.d.ts.map +1 -0
  45. package/lib/types/client/chat/ReasoningContent.js.map +1 -0
  46. package/lib/types/client/chat/ReasoningRow.d.ts.map +1 -0
  47. package/lib/types/client/chat/ReasoningRow.js.map +1 -0
  48. package/lib/types/client/chat/RunningStatus.d.ts.map +1 -0
  49. package/lib/types/client/chat/RunningStatus.js.map +1 -0
  50. package/lib/types/client/chat/RunningWhaleTail.d.ts.map +1 -0
  51. package/lib/types/client/chat/RunningWhaleTail.js.map +1 -0
  52. package/lib/types/client/chat/StatsPills.d.ts.map +1 -0
  53. package/lib/types/client/chat/StatsPills.js.map +1 -0
  54. package/lib/types/client/chat/SystemPromptRow.d.ts.map +1 -0
  55. package/lib/types/client/chat/SystemPromptRow.js.map +1 -0
  56. package/lib/types/client/chat/TurnNavigator.d.ts.map +1 -0
  57. package/lib/types/client/chat/TurnNavigator.js.map +1 -0
  58. package/lib/types/client/chat/TurnProcessNodeView.d.ts.map +1 -0
  59. package/lib/types/client/chat/TurnProcessNodeView.js.map +1 -0
  60. package/lib/types/client/chat/TurnTailNodeView.d.ts.map +1 -0
  61. package/lib/types/client/chat/TurnTailNodeView.js.map +1 -0
  62. package/lib/types/client/chat/TurnTriggerNodeView.d.ts.map +1 -0
  63. package/lib/types/client/chat/TurnTriggerNodeView.js.map +1 -0
  64. package/lib/types/client/chat/TurnUsagePanel.d.ts.map +1 -0
  65. package/lib/types/client/chat/TurnUsagePanel.js.map +1 -0
  66. package/lib/types/client/chat/UserContent.d.ts.map +1 -0
  67. package/lib/types/client/chat/UserContent.js.map +1 -0
  68. package/lib/types/client/chat/flow-motion.d.ts +2 -0
  69. package/lib/types/client/chat/flow-motion.d.ts.map +1 -0
  70. package/lib/types/client/chat/flow-motion.js.map +1 -0
  71. package/lib/types/client/chat/message-chrome.d.ts.map +1 -0
  72. package/lib/types/client/chat/message-chrome.js.map +1 -0
  73. package/lib/types/client/chat/register-node-renderers.d.ts.map +1 -0
  74. package/lib/types/client/chat/register-node-renderers.js.map +1 -0
  75. package/lib/types/client/chat/render-entry.d.ts.map +1 -0
  76. package/lib/types/client/chat/render-entry.js.map +1 -0
  77. package/lib/types/client/chat/searchable-hidden.d.ts.map +1 -0
  78. package/lib/types/client/chat/searchable-hidden.js.map +1 -0
  79. package/lib/types/client/chat/stat-dialog.d.ts +5 -10
  80. package/lib/types/client/chat/stat-dialog.d.ts.map +1 -0
  81. package/lib/types/client/chat/stat-dialog.js.map +1 -0
  82. package/lib/types/client/chat/step-process.d.ts.map +1 -0
  83. package/lib/types/client/chat/step-process.js.map +1 -0
  84. package/lib/types/client/chat/text-interaction.d.ts.map +1 -0
  85. package/lib/types/client/chat/text-interaction.js.map +1 -0
  86. package/lib/types/client/chat/text-selection.d.ts.map +1 -0
  87. package/lib/types/client/chat/text-selection.js.map +1 -0
  88. package/lib/types/client/chat/token-format.d.ts.map +1 -0
  89. package/lib/types/client/chat/token-format.js.map +1 -0
  90. package/lib/types/client/chat/turn-assistant.d.ts.map +1 -0
  91. package/lib/types/client/chat/turn-assistant.js.map +1 -0
  92. package/lib/types/client/chat/turn-rail-items.d.ts.map +1 -0
  93. package/lib/types/client/chat/turn-rail-items.js.map +1 -0
  94. package/lib/types/client/chat/turn-trigger.d.ts +3 -2
  95. package/lib/types/client/chat/turn-trigger.d.ts.map +1 -0
  96. package/lib/types/client/chat/turn-trigger.js.map +1 -0
  97. package/lib/types/client/chat/use-calendar-day.d.ts.map +1 -0
  98. package/lib/types/client/chat/use-calendar-day.js.map +1 -0
  99. package/lib/types/client/chat/use-chat-navigation.d.ts +21 -5
  100. package/lib/types/client/chat/use-chat-navigation.d.ts.map +1 -0
  101. package/lib/types/client/chat/use-chat-navigation.js.map +1 -0
  102. package/lib/types/client/chat/use-chat-reading.d.ts.map +1 -0
  103. package/lib/types/client/chat/use-chat-reading.js.map +1 -0
  104. package/lib/types/client/chat/use-chat-scroll.d.ts +5 -2
  105. package/lib/types/client/chat/use-chat-scroll.d.ts.map +1 -0
  106. package/lib/types/client/chat/use-chat-scroll.js.map +1 -0
  107. package/lib/types/client/chat/use-chat-viewport.d.ts +53 -0
  108. package/lib/types/client/chat/use-chat-viewport.d.ts.map +1 -0
  109. package/lib/types/client/chat/use-chat-viewport.js.map +1 -0
  110. package/lib/types/client/chat/use-disclosure.d.ts.map +1 -0
  111. package/lib/types/client/chat/use-disclosure.js.map +1 -0
  112. package/lib/types/client/chat/use-process-scroll.d.ts.map +1 -0
  113. package/lib/types/client/chat/use-process-scroll.js.map +1 -0
  114. package/lib/types/client/chat/use-scroll-follow.d.ts.map +1 -0
  115. package/lib/types/client/chat/use-scroll-follow.js.map +1 -0
  116. package/lib/types/client/chat/use-turn-data.d.ts.map +1 -0
  117. package/lib/types/client/chat/use-turn-data.js.map +1 -0
  118. package/lib/types/client/contract/assistant-content.d.ts.map +1 -0
  119. package/lib/types/client/contract/assistant-content.js.map +1 -0
  120. package/lib/types/client/contract/chat-nodes.d.ts.map +1 -0
  121. package/lib/types/client/contract/chat-nodes.js.map +1 -0
  122. package/lib/types/client/contract/chat-visibility.d.ts +2 -2
  123. package/lib/types/client/contract/chat-visibility.d.ts.map +1 -0
  124. package/lib/types/client/contract/chat-visibility.js.map +1 -0
  125. package/lib/types/client/contract/group-tree.d.ts.map +1 -0
  126. package/lib/types/client/contract/group-tree.js.map +1 -0
  127. package/lib/types/client/contract/process-groups.d.ts +6 -3
  128. package/lib/types/client/contract/process-groups.d.ts.map +1 -0
  129. package/lib/types/client/contract/process-groups.js.map +1 -0
  130. package/lib/types/client/contract/slots.d.ts +11 -2
  131. package/lib/types/client/contract/slots.d.ts.map +1 -0
  132. package/lib/types/client/contract/slots.js.map +1 -0
  133. package/lib/types/client/contract/snapshot.d.ts.map +1 -0
  134. package/lib/types/client/contract/snapshot.js.map +1 -0
  135. package/lib/types/client/contract/store.d.ts.map +1 -0
  136. package/lib/types/client/contract/store.js.map +1 -0
  137. package/lib/types/client/contract/turn-metrics.d.ts.map +1 -0
  138. package/lib/types/client/contract/turn-metrics.js.map +1 -0
  139. package/lib/types/client/contract/turn-process.d.ts.map +1 -0
  140. package/lib/types/client/contract/turn-process.js.map +1 -0
  141. package/lib/types/client/conversation-nodes/assistant.d.ts.map +1 -0
  142. package/lib/types/client/conversation-nodes/assistant.js.map +1 -0
  143. package/lib/types/client/conversation-nodes/chat-snapshot-builder.d.ts.map +1 -0
  144. package/lib/types/client/conversation-nodes/chat-snapshot-builder.js.map +1 -0
  145. package/lib/types/client/conversation-nodes/command.d.ts.map +1 -0
  146. package/lib/types/client/conversation-nodes/command.js.map +1 -0
  147. package/lib/types/client/conversation-nodes/common.d.ts.map +1 -0
  148. package/lib/types/client/conversation-nodes/common.js.map +1 -0
  149. package/lib/types/client/conversation-nodes/compaction.d.ts.map +1 -0
  150. package/lib/types/client/conversation-nodes/compaction.js.map +1 -0
  151. package/lib/types/client/conversation-nodes/event-projection.d.ts.map +1 -0
  152. package/lib/types/client/conversation-nodes/event-projection.js.map +1 -0
  153. package/lib/types/client/conversation-nodes/fallback.d.ts.map +1 -0
  154. package/lib/types/client/conversation-nodes/fallback.js.map +1 -0
  155. package/lib/types/client/conversation-nodes/group-tree-segments.d.ts.map +1 -0
  156. package/lib/types/client/conversation-nodes/group-tree-segments.js.map +1 -0
  157. package/lib/types/client/conversation-nodes/inbox.d.ts.map +1 -0
  158. package/lib/types/client/conversation-nodes/inbox.js.map +1 -0
  159. package/lib/types/client/conversation-nodes/message.d.ts +1 -1
  160. package/lib/types/client/conversation-nodes/message.d.ts.map +1 -0
  161. package/lib/types/client/conversation-nodes/message.js.map +1 -0
  162. package/lib/types/client/conversation-nodes/process-activity.d.ts +1 -0
  163. package/lib/types/client/conversation-nodes/process-activity.d.ts.map +1 -0
  164. package/lib/types/client/conversation-nodes/process-activity.js.map +1 -0
  165. package/lib/types/client/conversation-nodes/process-groups.d.ts.map +1 -0
  166. package/lib/types/client/conversation-nodes/process-groups.js.map +1 -0
  167. package/lib/types/client/conversation-nodes/register.d.ts.map +1 -0
  168. package/lib/types/client/conversation-nodes/register.js.map +1 -0
  169. package/lib/types/client/conversation-nodes/request-prompt.d.ts.map +1 -0
  170. package/lib/types/client/conversation-nodes/request-prompt.js.map +1 -0
  171. package/lib/types/client/conversation-nodes/retry.d.ts.map +1 -0
  172. package/lib/types/client/conversation-nodes/retry.js.map +1 -0
  173. package/lib/types/client/conversation-nodes/tool.d.ts.map +1 -0
  174. package/lib/types/client/conversation-nodes/tool.js.map +1 -0
  175. package/lib/types/client/conversation-nodes/turn-error.d.ts.map +1 -0
  176. package/lib/types/client/conversation-nodes/turn-error.js.map +1 -0
  177. package/lib/types/client/conversation-nodes/turn-max-tokens.d.ts.map +1 -0
  178. package/lib/types/client/conversation-nodes/turn-max-tokens.js.map +1 -0
  179. package/lib/types/client/conversation-nodes/turn-navigation.d.ts.map +1 -0
  180. package/lib/types/client/conversation-nodes/turn-navigation.js.map +1 -0
  181. package/lib/types/client/conversation-nodes/turn-process-presentation.d.ts.map +1 -0
  182. package/lib/types/client/conversation-nodes/turn-process-presentation.js.map +1 -0
  183. package/lib/types/client/conversation-nodes/turn-process.d.ts.map +1 -0
  184. package/lib/types/client/conversation-nodes/turn-process.js.map +1 -0
  185. package/lib/types/client/conversation-nodes/turn-tail.d.ts.map +1 -0
  186. package/lib/types/client/conversation-nodes/turn-tail.js.map +1 -0
  187. package/lib/types/client/fence/FenceLayers.d.ts +21 -0
  188. package/lib/types/client/fence/FenceLayers.d.ts.map +1 -0
  189. package/lib/types/client/fence/FenceLayers.js.map +1 -0
  190. package/lib/types/client/fence/register.d.ts +10 -0
  191. package/lib/types/client/fence/register.d.ts.map +1 -0
  192. package/lib/types/client/fence/register.js.map +1 -0
  193. package/lib/types/client/file-path.d.ts.map +1 -0
  194. package/lib/types/client/file-path.js.map +1 -0
  195. package/lib/types/client/index.d.ts +1 -1
  196. package/lib/types/client/index.d.ts.map +1 -0
  197. package/lib/types/client/index.js.map +1 -0
  198. package/lib/types/client/locale.d.ts +96 -0
  199. package/lib/types/client/locale.d.ts.map +1 -0
  200. package/lib/types/client/locale.js.map +1 -0
  201. package/lib/types/client/markdown-labels.d.ts.map +1 -0
  202. package/lib/types/client/markdown-labels.js.map +1 -0
  203. package/lib/types/client/model/conversation-context.d.ts.map +1 -0
  204. package/lib/types/client/model/conversation-context.js.map +1 -0
  205. package/lib/types/client/model/steering-history.d.ts.map +1 -0
  206. package/lib/types/client/model/steering-history.js.map +1 -0
  207. package/lib/types/client/model/tool-call-tree.d.ts.map +1 -0
  208. package/lib/types/client/model/tool-call-tree.js.map +1 -0
  209. package/lib/types/client/performance-usage.d.ts.map +1 -0
  210. package/lib/types/client/performance-usage.js.map +1 -0
  211. package/lib/types/client/presentation-policy.d.ts.map +1 -0
  212. package/lib/types/client/presentation-policy.js.map +1 -0
  213. package/lib/types/client/reasoning-text.d.ts.map +1 -0
  214. package/lib/types/client/reasoning-text.js.map +1 -0
  215. package/lib/types/client/settings/LinkOpeningRow.d.ts.map +1 -0
  216. package/lib/types/client/settings/LinkOpeningRow.js.map +1 -0
  217. package/lib/types/client/settings/PerformanceUsageRow.d.ts.map +1 -0
  218. package/lib/types/client/settings/PerformanceUsageRow.js.map +1 -0
  219. package/lib/types/client/settings/PreferenceRow.d.ts.map +1 -0
  220. package/lib/types/client/settings/PreferenceRow.js.map +1 -0
  221. package/lib/types/client/settings/TranscriptViewRow.d.ts.map +1 -0
  222. package/lib/types/client/settings/TranscriptViewRow.js.map +1 -0
  223. package/lib/types/client/stores.d.ts.map +1 -0
  224. package/lib/types/client/stores.js.map +1 -0
  225. package/lib/types/client/transcript-view.d.ts.map +1 -0
  226. package/lib/types/client/transcript-view.js.map +1 -0
  227. package/lib/types/index.d.ts.map +1 -0
  228. package/lib/types/index.js.map +1 -0
  229. package/package.json +47 -44
  230. package/src/chat-settings.ts +98 -0
  231. package/src/client/apply.ts +355 -0
  232. package/src/client/assets/running-whale@2x.png +0 -0
  233. package/src/client/chat/ApprovalCommand.tsx +42 -0
  234. package/src/client/chat/AssistantMarkdown.module.css +88 -0
  235. package/src/client/chat/AssistantMarkdown.tsx +170 -0
  236. package/src/client/chat/AssistantNodeView.tsx +67 -0
  237. package/src/client/chat/ChatFlow.tsx +100 -0
  238. package/src/client/chat/ChatGroupSeat.module.css +166 -0
  239. package/src/client/chat/ChatGroupSeat.tsx +208 -0
  240. package/src/client/chat/ChatNodeSeat.tsx +179 -0
  241. package/src/client/chat/ChatView.module.css +426 -0
  242. package/src/client/chat/ChatView.tsx +351 -0
  243. package/src/client/chat/CommandNodeView.tsx +40 -0
  244. package/src/client/chat/CompactionCommandCard.tsx +26 -0
  245. package/src/client/chat/CompactionItem.tsx +76 -0
  246. package/src/client/chat/ContextBody.module.css +161 -0
  247. package/src/client/chat/ContextBody.tsx +592 -0
  248. package/src/client/chat/ContextInjectionRow.module.css +68 -0
  249. package/src/client/chat/ContextInjectionRow.tsx +94 -0
  250. package/src/client/chat/GenericCommandCard.module.css +49 -0
  251. package/src/client/chat/GenericCommandCard.tsx +75 -0
  252. package/src/client/chat/MessageIconActions.module.css +116 -0
  253. package/src/client/chat/MessageIconActions.tsx +90 -0
  254. package/src/client/chat/MessageItem.module.css +360 -0
  255. package/src/client/chat/MessageItem.tsx +410 -0
  256. package/src/client/chat/QuotaNoticeHost.tsx +27 -0
  257. package/src/client/chat/ReasoningContent.tsx +26 -0
  258. package/src/client/chat/ReasoningRow.module.css +77 -0
  259. package/src/client/chat/ReasoningRow.tsx +112 -0
  260. package/src/client/chat/RunningStatus.tsx +48 -0
  261. package/src/client/chat/RunningWhaleTail.tsx +19 -0
  262. package/src/client/chat/StatsPills.module.css +63 -0
  263. package/src/client/chat/StatsPills.tsx +348 -0
  264. package/src/client/chat/SystemPromptRow.tsx +50 -0
  265. package/src/client/chat/TurnNavigator.module.css +223 -0
  266. package/src/client/chat/TurnNavigator.tsx +295 -0
  267. package/src/client/chat/TurnProcessNodeView.module.css +62 -0
  268. package/src/client/chat/TurnProcessNodeView.tsx +62 -0
  269. package/src/client/chat/TurnTailNodeView.module.css +12 -0
  270. package/src/client/chat/TurnTailNodeView.tsx +81 -0
  271. package/src/client/chat/TurnTriggerNodeView.module.css +50 -0
  272. package/src/client/chat/TurnTriggerNodeView.tsx +57 -0
  273. package/src/client/chat/TurnUsagePanel.module.css +79 -0
  274. package/src/client/chat/TurnUsagePanel.tsx +110 -0
  275. package/src/client/chat/UserContent.tsx +60 -0
  276. package/src/client/chat/accessibility.module.css +8 -0
  277. package/src/client/chat/flow-motion.ts +556 -0
  278. package/src/client/chat/message-chrome.ts +100 -0
  279. package/src/client/chat/register-node-renderers.ts +100 -0
  280. package/src/client/chat/render-entry.ts +16 -0
  281. package/src/client/chat/searchable-hidden.ts +45 -0
  282. package/src/client/chat/stat-dialog.module.css +149 -0
  283. package/src/client/chat/stat-dialog.ts +55 -0
  284. package/src/client/chat/step-process.ts +28 -0
  285. package/src/client/chat/text-interaction.ts +298 -0
  286. package/src/client/chat/text-selection.ts +180 -0
  287. package/src/client/chat/token-format.ts +98 -0
  288. package/src/client/chat/turn-assistant.ts +10 -0
  289. package/src/client/chat/turn-rail-items.ts +89 -0
  290. package/src/client/chat/turn-trigger.ts +88 -0
  291. package/src/client/chat/use-calendar-day.ts +25 -0
  292. package/src/client/chat/use-chat-navigation.ts +309 -0
  293. package/src/client/chat/use-chat-reading.ts +283 -0
  294. package/src/client/chat/use-chat-scroll.ts +209 -0
  295. package/src/client/chat/use-chat-viewport.ts +1130 -0
  296. package/src/client/chat/use-disclosure.ts +35 -0
  297. package/src/client/chat/use-process-scroll.ts +88 -0
  298. package/src/client/chat/use-scroll-follow.ts +182 -0
  299. package/src/client/chat/use-turn-data.ts +23 -0
  300. package/src/client/contract/assistant-content.ts +15 -0
  301. package/src/client/contract/chat-nodes.ts +135 -0
  302. package/src/client/contract/chat-visibility.ts +20 -0
  303. package/src/client/contract/group-tree.ts +37 -0
  304. package/src/client/contract/process-groups.ts +30 -0
  305. package/src/client/contract/slots.ts +508 -0
  306. package/src/client/contract/snapshot.ts +171 -0
  307. package/src/client/contract/store.ts +17 -0
  308. package/src/client/contract/turn-metrics.ts +43 -0
  309. package/src/client/contract/turn-process.ts +58 -0
  310. package/src/client/conversation-nodes/README.i18n.yaml +64 -0
  311. package/src/client/conversation-nodes/README.md +338 -0
  312. package/src/client/conversation-nodes/README.zh.md +338 -0
  313. package/src/client/conversation-nodes/assistant.ts +384 -0
  314. package/src/client/conversation-nodes/chat-snapshot-builder.ts +1244 -0
  315. package/src/client/conversation-nodes/command.ts +227 -0
  316. package/src/client/conversation-nodes/common.ts +83 -0
  317. package/src/client/conversation-nodes/compaction.ts +65 -0
  318. package/src/client/conversation-nodes/event-projection.ts +179 -0
  319. package/src/client/conversation-nodes/fallback.ts +41 -0
  320. package/src/client/conversation-nodes/group-tree-segments.ts +91 -0
  321. package/src/client/conversation-nodes/inbox.ts +148 -0
  322. package/src/client/conversation-nodes/message.ts +182 -0
  323. package/src/client/conversation-nodes/process-activity.ts +170 -0
  324. package/src/client/conversation-nodes/process-groups.ts +303 -0
  325. package/src/client/conversation-nodes/register.ts +38 -0
  326. package/src/client/conversation-nodes/request-prompt.ts +169 -0
  327. package/src/client/conversation-nodes/retry.ts +97 -0
  328. package/src/client/conversation-nodes/tool.ts +371 -0
  329. package/src/client/conversation-nodes/turn-error.ts +120 -0
  330. package/src/client/conversation-nodes/turn-max-tokens.ts +82 -0
  331. package/src/client/conversation-nodes/turn-navigation.ts +97 -0
  332. package/src/client/conversation-nodes/turn-process-presentation.ts +149 -0
  333. package/src/client/conversation-nodes/turn-process.ts +374 -0
  334. package/src/client/conversation-nodes/turn-tail.ts +164 -0
  335. package/src/client/fence/FenceLayers.tsx +33 -0
  336. package/src/client/fence/register.ts +22 -0
  337. package/src/client/file-path.ts +19 -0
  338. package/src/client/index.ts +69 -0
  339. package/src/client/locale.ts +1695 -0
  340. package/src/client/markdown-labels.ts +16 -0
  341. package/src/client/model/conversation-context.ts +24 -0
  342. package/src/client/model/steering-history.ts +64 -0
  343. package/src/client/model/tool-call-tree.ts +204 -0
  344. package/src/client/performance-usage.ts +34 -0
  345. package/src/client/presentation-policy.ts +109 -0
  346. package/src/client/reasoning-text.ts +25 -0
  347. package/src/client/settings/LinkOpeningRow.tsx +47 -0
  348. package/src/client/settings/PerformanceUsageRow.tsx +46 -0
  349. package/src/client/settings/PreferenceRow.module.css +66 -0
  350. package/src/client/settings/PreferenceRow.tsx +59 -0
  351. package/src/client/settings/TranscriptViewRow.tsx +93 -0
  352. package/src/client/stores.ts +62 -0
  353. package/src/client/transcript-view.ts +81 -0
  354. package/src/css-modules.d.ts +6 -0
  355. package/src/index.ts +45 -0
@@ -0,0 +1,410 @@
1
+ import { memo, useEffect, useMemo, useState } from 'react'
2
+ import type { ReactNode } from 'react'
3
+ import type { PendingSubmission } from '@deepseek-ai/dsh-api-session-controller/client'
4
+ import type { PropsRenderFactories, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
5
+ import type { UserTextFacts } from '@deepseek-ai/dsh-client-ui-conversation/client'
6
+ import { JsonBlock, StateDot, TextShimmer } from '@deepseek-ai/dsh-client-ui-primitives'
7
+ import type {
8
+ ChatNodeOwnerProps, ChatNodeViewProps, ChatViewSlotProps, UserContentAttachment, UserContentData, UserContentInput,
9
+ } from '../contract/slots.ts'
10
+ import type { ModelRetryNode, TurnErrorNode, UserMessageNode } from '../contract/snapshot.ts'
11
+ import { CompactionItem } from './CompactionItem.tsx'
12
+ import { ContextInjectionRow } from './ContextInjectionRow.tsx'
13
+ import { MessageIconActions } from './MessageIconActions.tsx'
14
+ import css from './MessageItem.module.css'
15
+
16
+ const EMPTY_TEXT_FACTS: Readonly<Partial<UserTextFacts>> = {}
17
+
18
+ type UserImage = Extract<UserMessageNode['content'][number], { type: 'image' }>
19
+ type UserFile = Extract<UserMessageNode['content'][number], { type: 'file' }>
20
+ function contentParts(content: readonly unknown[]): {
21
+ text: string
22
+ attachments: UserContentAttachment[]
23
+ rest: unknown[]
24
+ } {
25
+ const texts: string[] = []
26
+ const attachments: UserContentAttachment[] = []
27
+ const rest: unknown[] = []
28
+ for (const block of content) {
29
+ const b = block as { type?: string; text?: string; attachment?: unknown }
30
+ if (b.type === 'text' && typeof b.text === 'string') texts.push(b.text)
31
+ else if (b.type === 'image' && b.attachment !== undefined) {
32
+ attachments.push({ type: 'image', image: { attachment: (b as UserImage).attachment } })
33
+ }
34
+ else if (b.type === 'file' && b.attachment !== undefined) {
35
+ attachments.push({ type: 'file', file: (b as UserFile).attachment })
36
+ }
37
+ else rest.push(block)
38
+ }
39
+ return { text: texts.join(''), attachments, rest }
40
+ }
41
+
42
+ function retrySeconds(milliseconds: number): number {
43
+ return Math.max(1, Math.ceil(milliseconds / 1_000))
44
+ }
45
+
46
+ interface RetryCountdown {
47
+ deadline: number
48
+ seconds: number
49
+ }
50
+
51
+ function failureMessage(
52
+ message: string,
53
+ code: unknown,
54
+ t: ChatViewSlotProps['t'],
55
+ ): string {
56
+ if (code === 'ACCOUNT_SIGNED_OUT') return t('message.failure.accountSignedOut')
57
+ if (code === 'INTERRUPTED') return t('message.failure.interrupted')
58
+ if (code === 'ACCOUNT_SIGN_IN_REQUIRED') return t('message.failure.accountSignInRequired')
59
+ if (code === 'QUOTA' || code === 'ACCOUNT_QUOTA') return t('message.failure.quota')
60
+ return code === 'AUTH' ? t('message.failure.auth') : message
61
+ }
62
+
63
+ function ModelRetryItem({ node, active, t }: {
64
+ node: ModelRetryNode
65
+ active: boolean
66
+ t: ChatViewSlotProps['t']
67
+ }) {
68
+ // Anchor the host-scheduled delay to this browser's first render of the
69
+ // retry node. Host event time and Date.now() may belong to different clocks.
70
+ const deadline = useMemo(() => Date.now() + node.delayMs, [node.delayMs, node.seq])
71
+ const scheduledSeconds = retrySeconds(node.delayMs)
72
+ const maximum = node.mode === 'normal' ? node.maxRetries : '∞'
73
+ const [countdown, setCountdown] = useState<RetryCountdown>(() => ({
74
+ deadline,
75
+ seconds: retrySeconds(deadline - Date.now()),
76
+ }))
77
+ const remainingSeconds = countdown.deadline === deadline
78
+ ? countdown.seconds
79
+ : retrySeconds(deadline - Date.now())
80
+
81
+ useEffect(() => {
82
+ if (!active) return
83
+ const updateCountdown = (): number => {
84
+ const next = retrySeconds(deadline - Date.now())
85
+ setCountdown(current => (
86
+ current.deadline === deadline && current.seconds === next
87
+ ? current
88
+ : { deadline, seconds: next }
89
+ ))
90
+ return next
91
+ }
92
+ if (updateCountdown() === 1) return
93
+ const timer = window.setInterval(() => {
94
+ if (updateCountdown() === 1) window.clearInterval(timer)
95
+ }, 250)
96
+ return () => { window.clearInterval(timer) }
97
+ }, [active, deadline])
98
+
99
+ const label = active
100
+ ? t('message.retry.active')
101
+ : node.retryState === 'cancelled'
102
+ ? t('message.retry.cancelled')
103
+ : node.retryState === 'started'
104
+ ? t('message.retry.started')
105
+ : t('message.retry.scheduled')
106
+ const seconds = active ? remainingSeconds : scheduledSeconds
107
+
108
+ return (
109
+ <details className={css.retryRow} data-active={active || undefined}>
110
+ <summary className={css.retrySummary}>
111
+ <span className={css.retryText} role="status">
112
+ <TextShimmer active={active}>
113
+ {t('message.retry.status', { label, retry: node.retry, maximum, seconds })}
114
+ </TextShimmer>
115
+ </span>
116
+ </summary>
117
+ <div className={css.retryDetails}>
118
+ <div>
119
+ <span className={css.retryDetailLabel}>{t('message.retry.delay')}</span>
120
+ {t('duration.milliseconds', { milliseconds: Math.round(node.delayMs) })}
121
+ </div>
122
+ <div>
123
+ <span className={css.retryDetailLabel}>{t('message.retry.failure')}</span>
124
+ {failureMessage(node.failure.message, node.failure.code, t)}
125
+ </div>
126
+ </div>
127
+ </details>
128
+ )
129
+ }
130
+
131
+ /** Persistent, turn-positioned feedback for a terminal failure. */
132
+ function TurnErrorItem({ node, t }: {
133
+ node: TurnErrorNode
134
+ t: ChatViewSlotProps['t']
135
+ }) {
136
+ return (
137
+ <div className={css.turnErrorRow} role="status">
138
+ <StateDot state="error" className={css.turnErrorDot} />
139
+ <div className={css.turnErrorCopy}>
140
+ <span className={css.turnErrorTitle}>{node.code === 'ACCOUNT_SIGNED_OUT' || node.code === 'INTERRUPTED' ? t('message.taskStopped') : t('message.turnError')}</span>
141
+ <span className={css.turnErrorMessage}>{failureMessage(node.message, node.code, t)}</span>
142
+ </div>
143
+ {node.code !== undefined && node.code !== 'INTERRUPTED' && <code className={css.turnErrorCode}>{node.code}</code>}
144
+ </div>
145
+ )
146
+ }
147
+
148
+ /** Persistent, turn-positioned notice for a turn ended at the output-token cap. */
149
+ function TurnMaxTokensItem({ t }: {
150
+ t: ChatViewSlotProps['t']
151
+ }) {
152
+ return (
153
+ <div className={css.turnErrorRow} role="status">
154
+ <StateDot state="warning" className={css.turnErrorDot} />
155
+ <div className={css.turnErrorCopy}>
156
+ <span className={css.maxTokensTitle}>{t('message.maxTokens')}</span>
157
+ <span className={css.turnErrorMessage}>{t('message.maxTokens.hint')}</span>
158
+ </div>
159
+ </div>
160
+ )
161
+ }
162
+
163
+ /**
164
+ * A row the message-source seat decorates. A durable Chat node satisfies it;
165
+ * pending and local-echo rows pass a source-less stand-in.
166
+ */
167
+ interface DecoratedRow {
168
+ readonly kind: 'user' | 'steering'
169
+ readonly data: { readonly source: unknown }
170
+ }
171
+
172
+ /** Pending and local-echo rows carry no durable source for the seat to elect. */
173
+ const UNDECORATED_ROW: DecoratedRow = { kind: 'user', data: { source: null } }
174
+
175
+ /** Occupant used by rows that do not own the message-source seat. */
176
+ const NO_MESSAGE_SOURCE: PropsRenderSlots<'conversation.chat.user.before'>['renderSlotChain'] = () => null
177
+
178
+ /** Right-aligned bubble shared by user and steering rows. */
179
+ function UserStyleBubble({
180
+ node, renderSlotChain, content, loadImage, renderFactorySlot, actions,
181
+ pending = false, echo = false, batchStart = false,
182
+ referenceLabels, skillNames, previewAttachments, facts: inputFacts = EMPTY_TEXT_FACTS, interactive = false,
183
+ }: {
184
+ content: readonly unknown[]
185
+ renderFactorySlot: PropsRenderFactories['renderFactorySlot']
186
+ /** Optional IconActions (or similar) below the bubble; receives the joined text. */
187
+ actions?: (text: string) => ReactNode
188
+ /** Row whose durable source the message-source seat elects above this bubble. */
189
+ node: DecoratedRow
190
+ /** Seat renderer; rows that do not own the seat pass {@link NO_MESSAGE_SOURCE}. */
191
+ renderSlotChain: PropsRenderSlots<'conversation.chat.user.before'>['renderSlotChain']
192
+ /** Whether this is the Host-authoritative pre-admission steering projection. */
193
+ pending?: boolean
194
+ /** Whether this is a local submission echo (invisible marker; the echo renders exactly like its durable replacement). */
195
+ echo?: boolean
196
+ /** Whether this admitted steering row starts its claim's batch and keeps the Turn tail slot above it. */
197
+ batchStart?: boolean
198
+ /** Exact session mention labels associated by the adjacent recall node. */
199
+ referenceLabels?: readonly string[]
200
+ /** Skill names the step's `skill-invocation` injections loaded for this message. */
201
+ skillNames?: readonly string[]
202
+ /** Local submission-echo attachments replacing the content-derived attachment sequence. */
203
+ previewAttachments?: readonly UserContentAttachment[]
204
+ /** Inputs used by text transforms, separate from row and rendering props. */
205
+ facts?: Readonly<Partial<UserTextFacts>>
206
+ } & Pick<ChatNodeOwnerProps, 'loadImage'> & Pick<UserContentInput, 'interactive'>): ReactNode {
207
+ const parts = useMemo(() => contentParts(content), [content])
208
+ const prepared = useMemo<UserContentData>(() => ({
209
+ text: parts.text,
210
+ attachments: previewAttachments ?? parts.attachments,
211
+ extraBlocks: parts.rest,
212
+ ...(referenceLabels === undefined ? {} : { referenceLabels }),
213
+ }), [parts, previewAttachments, referenceLabels])
214
+ const facts = useMemo<Readonly<Partial<UserTextFacts>>>(() => ({
215
+ ...inputFacts,
216
+ ...(referenceLabels === undefined ? {} : { sessionLabels: referenceLabels }),
217
+ ...(skillNames === undefined ? {} : { skillNames }),
218
+ }), [inputFacts, referenceLabels, skillNames])
219
+ return (
220
+ <div
221
+ className={css.userRow}
222
+ data-pending-steering={pending || undefined}
223
+ data-submission-echo={echo || undefined}
224
+ data-chat-steering-batch={batchStart ? 'start' : undefined}
225
+ >
226
+ {renderSlotChain('conversation.chat.user.before', { source: node.data.source, kind: node.kind }, { fallback: null })}
227
+ {renderFactorySlot('conversation.chat.user.content', {
228
+ content: prepared,
229
+ loadImage,
230
+ facts,
231
+ interactive,
232
+ })}
233
+ {actions?.(prepared.text)}
234
+ </div>
235
+ )
236
+ }
237
+
238
+ /**
239
+ * Render one Host-authoritative pending steering item with the same visual
240
+ * language as its eventual durable transcript node.
241
+ * @param props - pending content, authorized image loader, and Factory/locale seats.
242
+ * @returns the pending steering bubble.
243
+ */
244
+ export function PendingSteeringBubble({ content, loadImage, renderFactorySlot, t }: {
245
+ content: readonly unknown[]
246
+ renderFactorySlot: PropsRenderFactories['renderFactorySlot']
247
+ t: ChatViewSlotProps['t']
248
+ } & Pick<ChatNodeOwnerProps, 'loadImage'>): ReactNode {
249
+ return (
250
+ <UserStyleBubble
251
+ node={UNDECORATED_ROW}
252
+ renderSlotChain={NO_MESSAGE_SOURCE}
253
+ content={content}
254
+ renderFactorySlot={renderFactorySlot}
255
+ loadImage={loadImage}
256
+ pending
257
+ actions={text => (
258
+ <MessageIconActions
259
+ text={text}
260
+ clock="start"
261
+ className={css.actions}
262
+ t={t}
263
+ />
264
+ )}
265
+ />
266
+ )
267
+ }
268
+
269
+ /**
270
+ * Render one local transcript or steering submission echo with the same
271
+ * visual language and surface marker as the Host occurrence that replaces
272
+ * it: draft text plus object-URL previews, visible from the submit click
273
+ * until the durable `user/message` or steering occurrence renders.
274
+ * @param props - the pending submission, authorized image loader, and render seats.
275
+ * @returns the echoed user bubble.
276
+ */
277
+ export function PendingSubmissionBubble({ submission, loadImage, renderFactorySlot, t }: {
278
+ submission: PendingSubmission
279
+ renderFactorySlot: PropsRenderFactories['renderFactorySlot']
280
+ t: ChatViewSlotProps['t']
281
+ } & Pick<ChatNodeOwnerProps, 'loadImage'>): ReactNode {
282
+ const content = useMemo(
283
+ () => (submission.text === '' ? [] : [{ type: 'text', text: submission.text }]),
284
+ [submission.text],
285
+ )
286
+ const previewAttachments = useMemo<readonly UserContentAttachment[]>(
287
+ () => submission.attachments.map(attachment => attachment.type === 'image'
288
+ ? {
289
+ type: 'image',
290
+ image: {
291
+ preview: {
292
+ url: attachment.value.previewUrl,
293
+ ...(attachment.value.name === undefined ? {} : { name: attachment.value.name }),
294
+ ...(attachment.value.width === undefined ? {} : { width: attachment.value.width }),
295
+ ...(attachment.value.height === undefined ? {} : { height: attachment.value.height }),
296
+ },
297
+ },
298
+ }
299
+ : { type: 'file', file: attachment.value }),
300
+ [submission.attachments],
301
+ )
302
+ return (
303
+ <UserStyleBubble
304
+ node={UNDECORATED_ROW}
305
+ renderSlotChain={NO_MESSAGE_SOURCE}
306
+ content={content}
307
+ previewAttachments={previewAttachments}
308
+ renderFactorySlot={renderFactorySlot}
309
+ loadImage={loadImage}
310
+ pending={submission.placement === 'steering'}
311
+ echo
312
+ actions={text => (
313
+ <MessageIconActions
314
+ text={text}
315
+ time={submission.time}
316
+ clock="start"
317
+ className={css.actions}
318
+ t={t}
319
+ />
320
+ )}
321
+ />
322
+ )
323
+ }
324
+
325
+ /**
326
+ * Official user and admitted-steering keyed Chat renderer.
327
+ *
328
+ * Renders the durable-message chain seat directly above the bubble. The seat is
329
+ * declared by the `user` registration alone, so a steering row renders the same
330
+ * bubble without asking for it.
331
+ */
332
+ export const UserMessageNodeView = memo(function UserMessageNodeView({
333
+ node, renderFactorySlot, loadImage, renderSlotChain, t,
334
+ }: ChatNodeViewProps<'user' | 'steering'> & {
335
+ /** Bound by the `user` keyed registration, the only entry that declares the seat. */
336
+ renderSlotChain: PropsRenderSlots<'conversation.chat.user.before'>['renderSlotChain']
337
+ }) {
338
+ const data = node.data
339
+ return (
340
+ <UserStyleBubble
341
+ node={node}
342
+ renderSlotChain={renderSlotChain}
343
+ content={data.content}
344
+ interactive
345
+ renderFactorySlot={renderFactorySlot}
346
+ loadImage={loadImage}
347
+ batchStart={node.kind === 'steering' && node.data.batchStart === true}
348
+ {...data.referenceLabels === undefined ? {} : { referenceLabels: data.referenceLabels }}
349
+ {...data.skillNames === undefined ? {} : { skillNames: data.skillNames }}
350
+ actions={text => (
351
+ <MessageIconActions
352
+ text={text}
353
+ time={data.time}
354
+ clock="start"
355
+ className={css.actions}
356
+ t={t}
357
+ />
358
+ )}
359
+ />
360
+ )
361
+ })
362
+
363
+ /** Injected-context keyed Chat renderer. */
364
+ export const ContextMessageNodeView = memo(function ContextMessageNodeView({ node, t }: ChatNodeViewProps<'context'>) {
365
+ const data = node.data
366
+ return (
367
+ <ContextInjectionRow
368
+ content={data.content}
369
+ source={data.source}
370
+ producer={data.producer}
371
+ form={data.form}
372
+ t={t}
373
+ />
374
+ )
375
+ })
376
+
377
+ /** Automatic compaction keyed Chat renderer. */
378
+ export const CompactionNodeView = memo(function CompactionNodeView({ node, t }: ChatNodeViewProps<'compaction'>) {
379
+ return <CompactionItem node={node.data} t={t} />
380
+ })
381
+
382
+ /** Correlated retry-chain keyed Chat renderer. */
383
+ export const RetryNodeView = memo(function RetryNodeView({ node, t }: ChatNodeViewProps<'model-retry'>) {
384
+ const data = node.data
385
+ return <ModelRetryItem node={data.current} active={data.current.retryState === 'scheduled'} t={t} />
386
+ })
387
+
388
+ /** Terminal turn-error keyed Chat renderer. */
389
+ export const TurnErrorNodeView = memo(function TurnErrorNodeView({ node, t }: ChatNodeViewProps<'turn-error'>) {
390
+ return <TurnErrorItem node={node.data} t={t} />
391
+ })
392
+
393
+ /** Max-tokens turn-end notice keyed Chat renderer. */
394
+ export const TurnMaxTokensNodeView = memo(function TurnMaxTokensNodeView({ t }: ChatNodeViewProps<'turn-max-tokens'>) {
395
+ return <TurnMaxTokensItem t={t} />
396
+ })
397
+
398
+ /** Explicit unknown-surface keyed Chat renderer. */
399
+ export const UnknownNodeView = memo(function UnknownNodeView({ node, t }: ChatNodeViewProps<'unknown'>) {
400
+ const data = node.data
401
+ return (
402
+ <div className={css.contextRow}>
403
+ <JsonBlock
404
+ label={t('message.unknownSurface', { type: data.type })}
405
+ payload={data.data}
406
+ truncatedLabel={total => t('json.truncated', { total })}
407
+ />
408
+ </div>
409
+ )
410
+ })
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The frame-wide `shell.overlay` host for quota notices. It holds the one live
3
+ * notice for the whole app, so leaving the Chat panel does not drop it. A
4
+ * `shell.quota-notice` entry may replace the generic Toast for codes it claims.
5
+ */
6
+ import { Fragment } from 'react'
7
+ import { IconWarningOutlineRegular, Toast } from '@deepseek-ai/dsh-client-ui-primitives'
8
+ import type { QuotaNoticeHostProps, QuotaNoticeOwnerProps } from '../contract/slots.ts'
9
+
10
+ /**
11
+ * @param props - the live notice, its dismissal, the chain outlet, and the locale seat.
12
+ * @returns the notice on display, or null while none is live.
13
+ */
14
+ export function QuotaNoticeHost({ useNotice, dismissNotice, keepNoticeOpen, renderSlotChain, t }: QuotaNoticeHostProps) {
15
+ const notice = useNotice(current => current)
16
+ if (notice === null) return null
17
+ const owner: QuotaNoticeOwnerProps = {
18
+ code: notice.code, message: t('message.failure.quota'), dismiss: dismissNotice, keepOpen: keepNoticeOpen,
19
+ }
20
+ return (
21
+ <Fragment key={`quota-notice-${String(notice.seq)}`}>
22
+ {renderSlotChain('shell.quota-notice', owner, {
23
+ fallback: <Toast text={owner.message} icon={<IconWarningOutlineRegular size={18} />} onDone={dismissNotice} />,
24
+ })}
25
+ </Fragment>
26
+ )
27
+ }
@@ -0,0 +1,26 @@
1
+ /** Official reasoning content and its default Body Slot adapter. */
2
+ import { memo, useMemo } from 'react'
3
+ import { MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives'
4
+ import type { FactoryComponentPropsOf, PropsRenderFactories, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
5
+ import { markdownLabels } from '../markdown-labels.ts'
6
+
7
+ type ReasoningBodyProps = PropsRuntime<'conversation.chat.reasoning.body'> & PropsRenderFactories
8
+
9
+ /**
10
+ * Render compact reasoning with caller-supplied labels or Chat's defaults.
11
+ * @param props - display text, streaming state, optional localized labels, and the Factory's locale seat; no Session is required.
12
+ * @returns the standard reasoning content; supplied labels are used without merging defaults.
13
+ */
14
+ export const ReasoningContent = memo(function ReasoningContent({ text, running, labels, t }: FactoryComponentPropsOf<'conversation.chat.reasoning.content'>) {
15
+ const resolvedLabels = useMemo(() => labels ?? markdownLabels(t), [labels, t])
16
+ return <MarkdownText text={text} streaming={running} labels={resolvedLabels} variant="compact" />
17
+ })
18
+
19
+ /**
20
+ * Render the default Body through the same Factory available to third-party wrappers.
21
+ * @param props - display-ready reasoning and the framework's Factory renderer.
22
+ * @returns an occurrence of the official reasoning Content Factory.
23
+ */
24
+ export function DefaultReasoningBody({ text, running, renderFactorySlot }: ReasoningBodyProps) {
25
+ return renderFactorySlot('conversation.chat.reasoning.content', { text, running })
26
+ }
@@ -0,0 +1,77 @@
1
+ .root {
2
+ display: flex;
3
+ flex-direction: column;
4
+ }
5
+
6
+ .root:not([data-expanded]) {
7
+ contain: size layout;
8
+ height: calc(24px + var(--dsh-content-font-delta, 0px));
9
+ }
10
+
11
+ .row {
12
+ overflow: hidden;
13
+ }
14
+
15
+ /* The uncapped body scrolls with the conversation; keep its collapse toggle
16
+ reachable. Compact Markdown code banners stay in flow below this header. */
17
+ .root[data-expanded] [data-open] [data-disclosure-header] {
18
+ position: sticky;
19
+ top: 0;
20
+ z-index: 1;
21
+ background: var(--dsw-alias-bg-base);
22
+ }
23
+
24
+ .leading {
25
+ flex-shrink: 0;
26
+ }
27
+
28
+ .title {
29
+ font-weight: 400;
30
+ }
31
+
32
+ .separator {
33
+ flex: none;
34
+ width: 2px;
35
+ height: 2px;
36
+ margin: 0 8px;
37
+ border-radius: 1px;
38
+ background: var(--dsw-alias-label-caption);
39
+ }
40
+
41
+ /* Think text reads the secondary tier — one step under the body size
42
+ (setting −1 at ≤14, setting −2 above), shared with every flow-row title
43
+ and summary. */
44
+ .summary {
45
+ min-width: 0;
46
+ overflow: hidden;
47
+ flex: 1 1 auto;
48
+ font-size: var(--dsh-content-font-size-secondary, 13px);
49
+ line-height: calc(20px + var(--dsh-content-font-delta-secondary, 0px));
50
+ white-space: nowrap;
51
+ }
52
+
53
+ .summaryText {
54
+ display: block;
55
+ overflow: hidden;
56
+ text-overflow: ellipsis;
57
+ }
58
+
59
+ .summary[data-streaming] {
60
+ mask-image: linear-gradient(to right, black calc(100% - 48px), transparent);
61
+ }
62
+
63
+ .summary[data-streaming] .summaryText {
64
+ overflow: visible;
65
+ text-overflow: clip;
66
+ }
67
+
68
+ .root:not([data-preview]) .separator,
69
+ .root:not([data-preview]) .summary {
70
+ display: none;
71
+ }
72
+
73
+ .thinkBody {
74
+ /* Indent under the title, which starts at leading (16 + delta) + gap 6. */
75
+ padding: 4px 0 4px calc(22px + var(--dsh-content-font-delta, 0px));
76
+ min-width: 0;
77
+ }
@@ -0,0 +1,112 @@
1
+ /** Assistant reasoning disclosure, independent of Tool-call presentation. */
2
+ import { memo, useMemo } from 'react'
3
+ import { DisclosureRow, IconThinkOutlineRegular, TextShimmer } from '@deepseek-ai/dsh-client-ui-primitives'
4
+ import type { PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
5
+ import type { ChatViewSlotProps, UseDisclosure, UsePresentation } from '../contract/slots.ts'
6
+ import { reasoningText } from '../reasoning-text.ts'
7
+ import a11yCss from './accessibility.module.css'
8
+ import css from './ReasoningRow.module.css'
9
+
10
+ const THINK_ICON = <IconThinkOutlineRegular size={14} />
11
+
12
+ function firstLine(text: string): string {
13
+ const newline = text.indexOf('\n')
14
+ return newline === -1 ? text : text.slice(0, newline)
15
+ }
16
+
17
+ function latestCompletedParagraphFirstLine(text: string): string {
18
+ let summary = ''
19
+ let paragraphStart = 0
20
+ const separator = /\r?\n(?:[\t ]*\r?\n)+/g
21
+ while (true) {
22
+ const nextParagraph = separator.exec(text)
23
+ const paragraphEnd = nextParagraph === null ? text.length
24
+ : nextParagraph.index + nextParagraph[0].indexOf('\n')
25
+ const newline = text.indexOf('\n', paragraphStart)
26
+ if (newline !== -1 && newline <= paragraphEnd) {
27
+ const candidate = text.slice(paragraphStart, newline).trim()
28
+ if (candidate !== '') summary = candidate
29
+ }
30
+ if (nextParagraph === null) return summary
31
+ paragraphStart = nextParagraph.index + nextParagraph[0].length
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Render one assistant reasoning block collapsed until the reader opens it. The
37
+ * collapsed summary omits double-asterisk markers; expanded content renders
38
+ * the complete Markdown with secondary typography. A streaming preview advances
39
+ * when a paragraph's first line completes. Mode changes toggle CSS display without unmounting
40
+ * collapsed summaries. The Body Slot receives both original and display-ready text.
41
+ * @param props.text - complete or streaming reasoning text.
42
+ * @param props.running - whether this block is the streaming tail.
43
+ * @param props.usePresentation - live display-policy selector for this reasoning row.
44
+ * @param props.useDisclosure - independent open state with enclosing-Turn resets.
45
+ * @param props.renderSlot - framework renderer for the standard reasoning Body Slot.
46
+ * @param props.t - conversation locale seat for the disclosure and running status.
47
+ * @returns the reasoning disclosure.
48
+ */
49
+ export const ReasoningRow = memo(function ReasoningRow({
50
+ text: rawText, running, textInteractionSource = false, usePresentation, useDisclosure, renderSlot, t,
51
+ }: {
52
+ text: string
53
+ running: boolean
54
+ textInteractionSource?: boolean
55
+ useDisclosure: UseDisclosure
56
+ usePresentation: UsePresentation
57
+ t: ChatViewSlotProps['t']
58
+ } & Pick<PropsRenderSlots<'conversation.chat.reasoning.body'>, 'renderSlot'>) {
59
+ const { expanded, toggle } = useDisclosure()
60
+ const { text, hidden } = useMemo(() => {
61
+ const text = reasoningText(rawText)
62
+ return { text, hidden: text !== rawText && text.trim() === '' }
63
+ }, [rawText])
64
+ const summaryText = running ? latestCompletedParagraphFirstLine(text) : firstLine(text)
65
+ const summary = useMemo(() => summaryText.replaceAll('**', ''), [summaryText])
66
+ const preview = usePresentation(policy => !expanded && summary !== ''
67
+ && (running || policy.settledReasoningPreview))
68
+ const collapsedContent = useMemo(() => (
69
+ <>
70
+ <span className={css.separator} data-shimmer-decoration aria-hidden />
71
+ <span className={css.summary} data-streaming={running || undefined}>
72
+ <span className={css.summaryText}>
73
+ <TextShimmer>{summary}</TextShimmer>
74
+ </span>
75
+ </span>
76
+ </>
77
+ ), [running, summary])
78
+ const content = useMemo(() => expanded ? (
79
+ <div className={css.thinkBody} data-text-interaction-source={textInteractionSource && !running ? '' : undefined}>
80
+ {renderSlot('conversation.chat.reasoning.body', { rawText, text, running })}
81
+ </div>
82
+ ) : undefined, [expanded, renderSlot, running, rawText, text, textInteractionSource])
83
+
84
+ if (hidden) return null
85
+
86
+ return (
87
+ <div
88
+ className={css.root}
89
+ data-variant="think"
90
+ data-state={running ? 'running' : 'ok'}
91
+ data-expanded={expanded || undefined}
92
+ data-preview={preview || undefined}
93
+ >
94
+ {running && <span className={a11yCss.visuallyHidden}>{t('row.running')}</span>}
95
+ <DisclosureRow
96
+ rowClassName={css.row}
97
+ leadingClassName={css.leading}
98
+ titleClassName={css.title}
99
+ icon={THINK_ICON}
100
+ title={t('message.think')}
101
+ running={running}
102
+ open={expanded}
103
+ expandable
104
+ expandOnRowClick
105
+ onToggle={toggle}
106
+ collapsedContent={collapsedContent}
107
+ >
108
+ {content}
109
+ </DisclosureRow>
110
+ </div>
111
+ )
112
+ })