@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,35 @@
1
+ /** Bind independent disclosure state to a Chat seat's reset source. */
2
+ import { useCallback, useState, useSyncExternalStore } from 'react'
3
+ import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
4
+ import type { UseDisclosure } from '../contract/slots.ts'
5
+
6
+ /**
7
+ * Own one initially collapsed disclosure without an external subscription.
8
+ * @param version - reset generation; unchanged generations retain local open state.
9
+ * @returns the open state, an explicit setter, and a toggle action.
10
+ */
11
+ export function useDisclosure(version = 0): ReturnType<UseDisclosure> {
12
+ const [expandedVersion, setExpandedVersion] = useState<number | null>(null)
13
+ const expanded = expandedVersion === version
14
+ const setExpanded = useCallback((open: boolean) => {
15
+ setExpandedVersion(open ? version : null)
16
+ }, [version])
17
+ const toggle = useCallback(() => {
18
+ setExpandedVersion(previous => previous === version ? null : version)
19
+ }, [version])
20
+ return { expanded, setExpanded, toggle }
21
+ }
22
+
23
+ /**
24
+ * Bind a Hook without subscribing until a component calls it.
25
+ * @param reset - stable source whose version advances when the seat is hidden by its Turn.
26
+ * @returns a Hook with independent open state for each invocation.
27
+ */
28
+ export function bindDisclosure(reset: ObservableSnapshot<number>): UseDisclosure {
29
+ const subscribe = (listener: () => void) => reset.subscribe(listener)
30
+ const getSnapshot = () => reset.getSnapshot()
31
+ return function useBoundDisclosure() {
32
+ const version = useSyncExternalStore(subscribe, getSnapshot)
33
+ return useDisclosure(version)
34
+ }
35
+ }
@@ -0,0 +1,88 @@
1
+ /** Capped process-group scrolling and fades over the shared follow controller. */
2
+ import { useCallback, useLayoutEffect, useMemo, useRef, useState, type DOMAttributes, type KeyboardEvent, type RefObject } from 'react'
3
+ import { scrollMetrics, useScrollFollow } from './use-scroll-follow.ts'
4
+
5
+ interface ScrollEdges { readonly canScrollUp: boolean; readonly canScrollDown: boolean }
6
+ const AT_REST: ScrollEdges = { canScrollUp: false, canScrollDown: false }
7
+ const SCROLL_KEYS = new Set(['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' '])
8
+
9
+ /**
10
+ * Observe one group's body and content without coupling its follow intent to the outer transcript.
11
+ * Wheel, touchstart, any pointerdown, and unprevented scroll keys interrupt active animations,
12
+ * including events from editable controls; subsequent position sampling determines follow intent.
13
+ * @param bodyRef - capped scrolling body.
14
+ * @param contentRef - uncapped content whose size reports growth.
15
+ * @param open - local disclosure state.
16
+ * @param grouped - whether the display mode retains the group's height cap.
17
+ * @returns edge fades, DOM event bindings, and one-shot positioning for manual opening.
18
+ */
19
+ export function useProcessScroll(
20
+ bodyRef: RefObject<HTMLDivElement>, contentRef: RefObject<HTMLDivElement>, open: boolean, grouped: boolean,
21
+ ): {
22
+ edges: ScrollEdges
23
+ events: Pick<DOMAttributes<HTMLDivElement>, 'onScroll' | 'onWheel' | 'onTouchStart' | 'onPointerDown' | 'onKeyDown'>
24
+ initialize: (position: 'top' | 'bottom') => void
25
+ } {
26
+ const follow = useScrollFollow(false, 1)
27
+ const initialPosition = useRef<'top' | 'bottom' | null>(null)
28
+ const [edges, setEdges] = useState<ScrollEdges>(AT_REST)
29
+ const initialize = useCallback((position: 'top' | 'bottom') => { initialPosition.current = position }, [])
30
+ const sync = useCallback((cause: 'resize' | 'scroll' | 'scrollend') => {
31
+ const body = bodyRef.current
32
+ let next = AT_REST
33
+ if (body !== null && body.closest('[hidden], [data-group-expanded-mode]') === null) {
34
+ let metrics = scrollMetrics(body)
35
+ const initial = cause === 'resize' ? initialPosition.current : null
36
+ if (initial !== null) {
37
+ metrics = follow.jump(body, metrics, initial === 'bottom' ? metrics.floor : 0)
38
+ if (initial === 'top') follow.setFollowing(false)
39
+ initialPosition.current = null
40
+ } else {
41
+ const wasAnimating = follow.animating
42
+ if (cause === 'scrollend') follow.settle(metrics)
43
+ else follow.sample(metrics)
44
+ if (follow.active && (cause === 'resize' || (cause === 'scrollend' && wasAnimating))) {
45
+ metrics = follow.toBottom(body, metrics, 'smooth')
46
+ }
47
+ }
48
+ next = { canScrollUp: metrics.top > 1, canScrollDown: metrics.top < metrics.floor - 1 }
49
+ } else follow.reset()
50
+ setEdges(previous => previous.canScrollUp === next.canScrollUp && previous.canScrollDown === next.canScrollDown
51
+ ? previous : next)
52
+ }, [bodyRef, follow])
53
+ const interrupt = useCallback(() => {
54
+ const body = bodyRef.current
55
+ if (body !== null && follow.animating) follow.interrupt(body, scrollMetrics(body))
56
+ }, [bodyRef, follow])
57
+ const events = useMemo(() => ({
58
+ onScroll: () => { sync('scroll') },
59
+ onWheel: interrupt,
60
+ onTouchStart: interrupt,
61
+ onPointerDown: interrupt,
62
+ onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => {
63
+ if (!event.defaultPrevented && SCROLL_KEYS.has(event.key)) interrupt()
64
+ },
65
+ }), [interrupt, sync])
66
+
67
+ useLayoutEffect(() => {
68
+ interrupt()
69
+ follow.reset()
70
+ if (!grouped || !open) initialPosition.current = null
71
+ }, [follow, grouped, interrupt, open])
72
+ useLayoutEffect(() => {
73
+ const body = bodyRef.current
74
+ if (body === null || !open || typeof ResizeObserver === 'undefined') return
75
+ const unbind = follow.bind(body)
76
+ const observer = new ResizeObserver(() => { sync('resize') })
77
+ const onScrollEnd = (event: Event): void => { if (event.target === body) sync('scrollend') }
78
+ body.addEventListener('scrollend', onScrollEnd)
79
+ observer.observe(body)
80
+ if (contentRef.current !== null) observer.observe(contentRef.current)
81
+ return () => {
82
+ unbind()
83
+ observer.disconnect()
84
+ body.removeEventListener('scrollend', onScrollEnd)
85
+ }
86
+ }, [bodyRef, contentRef, follow, open, sync])
87
+ return { edges, events, initialize }
88
+ }
@@ -0,0 +1,182 @@
1
+ /** Independent bottom-follow intent and native scrolling, without paging or DOM observers. */
2
+ import { useState } from 'react'
3
+
4
+ /** Scroll position, caller-supplied floor, and viewport height; raw measurements use the physical floor. */
5
+ export interface ViewportMetrics {
6
+ readonly top: number
7
+ readonly floor: number
8
+ readonly height: number
9
+ }
10
+
11
+ /**
12
+ * Read one scrollport without measuring its children.
13
+ * @param element - scrolling element.
14
+ * @returns current position and range.
15
+ */
16
+ export function scrollMetrics(element: HTMLElement): ViewportMetrics {
17
+ const height = element.clientHeight
18
+ return { top: element.scrollTop, height, floor: Math.max(0, element.scrollHeight - height) }
19
+ }
20
+
21
+ /** One scrollport's follow intent; native animation progress does not count as reader movement. */
22
+ export class ScrollFollow {
23
+ private static readonly owners = new WeakMap<HTMLElement, ScrollFollow>()
24
+ private target: number | null = null
25
+ private sampledTop: number | undefined
26
+
27
+ /**
28
+ * @param following - initial follow intent.
29
+ * @param threshold - accepted distance from the floor, in pixels.
30
+ */
31
+ constructor(private following: boolean, private readonly threshold: number) {}
32
+
33
+ /**
34
+ * Find the mounted controller for reading-position compensation.
35
+ * @param element - scrollport with an optional follow owner.
36
+ * @returns its controller, when bound.
37
+ */
38
+ static forElement(element: HTMLElement): ScrollFollow | undefined { return this.owners.get(element) }
39
+
40
+ /**
41
+ * Share this controller with reading-position compensation for the same scrollport.
42
+ * @param element - owned scrollport.
43
+ * @returns release the association on unmount or close.
44
+ */
45
+ bind(element: HTMLElement): () => void {
46
+ ScrollFollow.owners.set(element, this)
47
+ return () => { if (ScrollFollow.owners.get(element) === this) ScrollFollow.owners.delete(element) }
48
+ }
49
+
50
+ /**
51
+ * Expose follow intent independently of the current offset.
52
+ * @returns whether content growth should follow the floor.
53
+ */
54
+ get active(): boolean { return this.following }
55
+
56
+ /**
57
+ * Expose outstanding native motion before accepting reader input.
58
+ * @returns whether a native follow animation has an outstanding target.
59
+ */
60
+ get animating(): boolean { return this.target !== null }
61
+
62
+ /**
63
+ * Classify bottom arrivals using this scrollport's own tolerance.
64
+ * @param metrics - current scroll geometry.
65
+ * @returns whether the position is within the follow threshold.
66
+ */
67
+ nearBottom(metrics: ViewportMetrics): boolean { return Math.abs(metrics.floor - metrics.top) <= this.threshold }
68
+
69
+ /**
70
+ * Commit caller-owned follow decisions without moving the scrollport.
71
+ * @param active - externally committed follow intent.
72
+ */
73
+ setFollowing(active: boolean): void {
74
+ this.following = active
75
+ if (!active) this.target = null
76
+ }
77
+
78
+ /** Adopt the next visible layout as a fresh reader position. */
79
+ reset(): void {
80
+ this.setFollowing(false)
81
+ this.sampledTop = undefined
82
+ }
83
+
84
+ /**
85
+ * Adopt delivered scrolling while retaining intent during native animation.
86
+ * @param metrics - current geometry.
87
+ * @param movedByReader - caller attribution; omitted callers compare the last sampled position.
88
+ * @returns updated follow intent.
89
+ */
90
+ sample(metrics: ViewportMetrics, movedByReader = this.sampledTop === undefined
91
+ || Math.abs(metrics.top - this.sampledTop) > 0.5): boolean {
92
+ this.sampledTop = metrics.top
93
+ if (!this.animating && movedByReader) this.following = this.nearBottom(metrics)
94
+ return this.active
95
+ }
96
+
97
+ /**
98
+ * Settle native scrolling; an off-target stop releases follow intent.
99
+ * @param metrics - actual geometry delivered at scrollend.
100
+ * @returns follow intent after completing or interrupting native motion.
101
+ */
102
+ settle(metrics: ViewportMetrics): boolean {
103
+ const target = this.target
104
+ this.target = null
105
+ return this.sample(metrics, target === null ? undefined
106
+ : Math.abs(metrics.top - Math.min(target, metrics.floor)) > this.threshold)
107
+ }
108
+
109
+ /**
110
+ * Position immediately and adopt the resulting follow intent.
111
+ * @param element - scrolling element.
112
+ * @param metrics - geometry before positioning.
113
+ * @param top - requested offset, clamped to the measured range.
114
+ * @returns geometry after positioning.
115
+ */
116
+ jump(element: HTMLElement, metrics: ViewportMetrics, top: number): ViewportMetrics {
117
+ const animated = this.animating
118
+ this.target = null
119
+ const target = Math.max(0, Math.min(metrics.floor, top))
120
+ if (animated) element.scrollTo({ top: target, behavior: 'instant' })
121
+ else if (target !== metrics.top) element.scrollTop = target
122
+ const landed = { ...metrics, top: element.scrollTop }
123
+ this.sampledTop = landed.top
124
+ this.following = this.nearBottom(landed)
125
+ return landed
126
+ }
127
+
128
+ /**
129
+ * Follow the measured floor, respecting reduced motion for smooth requests.
130
+ * Smooth requests preserve an outstanding target; immediate follow updates
131
+ * retarget active motion when content changes the floor.
132
+ * Within-tolerance positioning is immediate while no animation is outstanding.
133
+ * @param element - scrolling element.
134
+ * @param metrics - current geometry.
135
+ * @param behavior - native animation for growth, or immediate positioning unless motion is already active.
136
+ * @returns current geometry; smooth requests retain their starting position until native scroll delivery.
137
+ */
138
+ toBottom(element: HTMLElement, metrics: ViewportMetrics, behavior: 'instant' | 'smooth'): ViewportMetrics {
139
+ this.following = true
140
+ if (metrics.top === metrics.floor) return this.jump(element, metrics, metrics.floor)
141
+ if (behavior === 'instant' && this.animating) {
142
+ // Content grew under an outstanding animation: retarget it instead of cutting to the floor.
143
+ if (this.target !== metrics.floor) {
144
+ this.target = metrics.floor
145
+ element.scrollTo({ top: metrics.floor, behavior: 'smooth' })
146
+ }
147
+ return metrics
148
+ }
149
+ if (behavior === 'instant' || (!this.animating && this.nearBottom(metrics))) return this.jump(element, metrics, metrics.floor)
150
+ if (typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches) {
151
+ return this.jump(element, metrics, metrics.floor)
152
+ }
153
+ if (this.target === null) {
154
+ this.target = metrics.floor
155
+ element.scrollTo({ top: metrics.floor, behavior: 'smooth' })
156
+ }
157
+ return metrics
158
+ }
159
+
160
+ /**
161
+ * Cancel native motion before a reader gesture; only subsequent actual movement changes follow intent.
162
+ * @param element - scrolling element.
163
+ * @param metrics - position at interruption.
164
+ */
165
+ interrupt(element: HTMLElement, metrics: ViewportMetrics): void {
166
+ if (!this.animating) return
167
+ this.target = null
168
+ this.sampledTop = metrics.top
169
+ element.scrollTo({ top: metrics.top, behavior: 'instant' })
170
+ }
171
+ }
172
+
173
+ /**
174
+ * Retain one independent follow controller without React updates for scroll samples.
175
+ * @param initial - initial follow intent.
176
+ * @param threshold - accepted distance from the floor, in pixels.
177
+ * @returns the stable controller shared by the caller's scroll and resize handlers.
178
+ */
179
+ export function useScrollFollow(initial: boolean, threshold: number): ScrollFollow {
180
+ const [follow] = useState(() => new ScrollFollow(initial, threshold))
181
+ return follow
182
+ }
@@ -0,0 +1,23 @@
1
+ import { useSyncExternalStore } from 'react'
2
+ import type {
3
+ ConversationLocationDataSource, ConversationLocationDataStore, ConversationTurnDataMap,
4
+ } from '@deepseek-ai/dsh-client-ui-conversation/client'
5
+
6
+ const EMPTY_SOURCE: ConversationLocationDataSource<undefined> = {
7
+ getSnapshot: () => undefined,
8
+ subscribe: () => () => {},
9
+ }
10
+
11
+ /**
12
+ * Subscribe to one value from a Turn's keyed Location-data store.
13
+ * @param data - current Turn data store, or absence for a Node outside a Turn.
14
+ * @param key - declaration-merged business key.
15
+ * @returns the current value for that key.
16
+ */
17
+ export function useTurnDataValue<Key extends Extract<keyof ConversationTurnDataMap, string>>(
18
+ data: ConversationLocationDataStore<ConversationTurnDataMap> | undefined,
19
+ key: Key,
20
+ ): Readonly<ConversationTurnDataMap[Key]> | undefined {
21
+ const source = data?.source(key) ?? EMPTY_SOURCE
22
+ return useSyncExternalStore(source.subscribe, source.getSnapshot)
23
+ }
@@ -0,0 +1,15 @@
1
+ import type { AssistantBlock } from '@deepseek-ai/dsh-client-ui-conversation/client'
2
+
3
+ /**
4
+ * Test whether Assistant blocks contain a user-facing reply rather than only
5
+ * reasoning or Tool-call protocol material.
6
+ * @param blocks - Assistant content blocks.
7
+ * @returns whether the blocks contain visible reply content.
8
+ */
9
+ export function hasAssistantReplyContent(blocks: readonly AssistantBlock[]): boolean {
10
+ return blocks.some((block) => {
11
+ if (block.kind === 'reasoning' || block.kind === 'tool-call') return false
12
+ if (block.kind === 'text') return block.text.trim() !== ''
13
+ return true
14
+ })
15
+ }
@@ -0,0 +1,135 @@
1
+ import type {
2
+ AssistantBlock, AssistantMessageNode, CommandNode, CompactionSummaryNode,
3
+ ConversationLocation, ConversationViewNode, ModelRetryNode, RunningToolCall,
4
+ ToolCallBlock,
5
+ } from '@deepseek-ai/dsh-client-ui-conversation/client'
6
+ import type { ChatGroupTree } from './group-tree.ts'
7
+
8
+ /** Final Chat render unit produced by a Chat business Definition. */
9
+ export interface ChatConversationViewNode extends ConversationViewNode {
10
+ readonly target: 'chat'
11
+ readonly anchorSeq: number
12
+ readonly location: ConversationLocation
13
+ readonly visibility: 'visible' | 'hidden'
14
+ /**
15
+ * Group-tree position, visible or hidden; absence joins the surrounding step
16
+ * run. An `exchange` Node's Turn and every later Turn before the next opening
17
+ * Turn form one exchange; the latest loaded exchange starts at the last loaded
18
+ * opening Turn, or at the first loaded Turn when none is loaded.
19
+ */
20
+ readonly groupTree?: ChatGroupTree | undefined
21
+ }
22
+
23
+ /** Merge-extensible payload registry keyed by final Chat renderer kind. */
24
+ export interface ChatNodeDataMap {}
25
+
26
+ /** Renderer kinds contributed by the currently installed Chat business modules. */
27
+ export type ChatNodeKind = Extract<keyof ChatNodeDataMap, string>
28
+
29
+ /** Final Chat Node narrowed to one registered renderer kind and payload. */
30
+ export type ChatNode<Kind extends ChatNodeKind = ChatNodeKind> = {
31
+ [RegisteredKind in Kind]: ChatConversationViewNode & {
32
+ readonly kind: RegisteredKind
33
+ readonly data: ChatNodeDataMap[RegisteredKind]
34
+ }
35
+ }[Kind]
36
+
37
+ /** Final Assistant row payload shared by streaming and settled states. */
38
+ export interface AssistantChatData {
39
+ readonly status: 'running' | 'settled' | 'interrupted'
40
+ readonly turn: number
41
+ readonly step: number
42
+ readonly blocks: readonly AssistantBlock[]
43
+ readonly time: number
44
+ readonly usage?: unknown
45
+ readonly finalNode?: AssistantMessageNode
46
+ }
47
+
48
+ /** Settled or interrupted Assistant payload with its durable presentation node. */
49
+ export type FinalAssistantChatData = AssistantChatData & {
50
+ readonly finalNode: AssistantMessageNode
51
+ }
52
+
53
+ /** Root Tool row payload; the root lifecycle owns all recursive subcalls. */
54
+ export interface ToolChatData {
55
+ readonly root: ToolCallBlock
56
+ }
57
+
58
+ /** One manual command and its correlated compaction transaction. */
59
+ export interface ManualCompactionChatData {
60
+ readonly command: CommandNode
61
+ readonly compaction: CompactionSummaryNode | null
62
+ }
63
+
64
+ /** One durable retry chain rendered as a single row. */
65
+ export interface RetryChatData {
66
+ readonly attempts: readonly ModelRetryNode[]
67
+ readonly current: ModelRetryNode
68
+ }
69
+
70
+ /** One provider/model route that contributed a billed request attempt. */
71
+ export interface TurnTokenUsageRoute {
72
+ readonly provider: string
73
+ readonly model: string
74
+ }
75
+
76
+ /** Exact provider-reported token accounting for every attempt in one completed Turn. */
77
+ export interface TurnTokenUsage {
78
+ /** Sum of uncached prompt input across all attempts. */
79
+ readonly uncachedInputTokens: number
80
+ readonly outputTokens: number
81
+ /** Exact aggregate prompt plus output total across all attempts. */
82
+ readonly totalTokens: number
83
+ /** Present only when every attempt reported the bucket. */
84
+ readonly cacheReadTokens?: number
85
+ /** Present only when every attempt reported the bucket. */
86
+ readonly cacheWriteTokens?: number
87
+ /** Output subset, present only when every attempt reported it. */
88
+ readonly reasoningTokens?: number
89
+ /** Present only when every billed attempt has provider/model attribution. */
90
+ readonly routes?: readonly TurnTokenUsageRoute[]
91
+ }
92
+
93
+ /** Turn-local footer row that owns actions and optional feature contributions. */
94
+ export interface TurnTailChatData {
95
+ readonly turn: number
96
+ readonly seq: number
97
+ readonly time: number
98
+ /** Last finalized content-bearing Assistant in this Turn. */
99
+ readonly closing: FinalAssistantChatData | null
100
+ /** Whether non-rendered later evidence makes the closing seq non-tail. */
101
+ readonly branchUnavailable: boolean
102
+ /** Exact per-Turn accounting; absent when the loaded evidence is incomplete. */
103
+ readonly tokenUsage?: TurnTokenUsage
104
+ }
105
+
106
+ /** Turn-level process disclosure projected before the finalized answer. */
107
+ export interface TurnProcessChatData {
108
+ readonly turn: number
109
+ readonly controlAnchorSeq: number
110
+ readonly processStartSeq: number
111
+ readonly answerAnchorSeq: number | null
112
+ readonly answerStep: number | null
113
+ readonly inlineReasoning: boolean
114
+ readonly messageCount: number
115
+ readonly toolCallCount: number
116
+ readonly subagentCount: number
117
+ }
118
+
119
+ /**
120
+ * Test whether a Tool root has settled.
121
+ * @param block - Tool root lifecycle value.
122
+ * @returns whether the root carries its final result.
123
+ */
124
+ export function isSettledTool(block: ToolCallBlock): block is Extract<ToolCallBlock, { kind: 'tool-result' }> {
125
+ return 'kind' in block
126
+ }
127
+
128
+ /**
129
+ * Test whether a Tool root is still running.
130
+ * @param block - Tool root lifecycle value.
131
+ * @returns whether the root lacks a final result.
132
+ */
133
+ export function isRunningTool(block: ToolCallBlock): block is RunningToolCall {
134
+ return !isSettledTool(block)
135
+ }
@@ -0,0 +1,20 @@
1
+ /** Chat-only row visibility; durable events and trajectory inspection remain intact. */
2
+ import type { ChatNode } from './chat-nodes.ts'
3
+
4
+ /**
5
+ * Exclude system prompts, permission commands, and normal Team toggle receipts.
6
+ * Failed Team toggles remain visible.
7
+ * @param node - projected Chat node.
8
+ * @returns whether the node contributes a visible Chat row.
9
+ */
10
+ export function isVisibleChatNode(node: ChatNode): boolean {
11
+ if (node.kind === 'command') {
12
+ if (node.data.name === 'permission') return false
13
+ if (node.data.name === 'team' && node.data.outcome?.kind !== 'error') {
14
+ const selection = node.data.args?.trim()
15
+ if (selection === 'on' || selection === 'off') return false
16
+ }
17
+ }
18
+ return node.visibility === 'visible'
19
+ && node.kind !== 'system-prompt'
20
+ }
@@ -0,0 +1,37 @@
1
+ import type { ChatConversationViewNode } from './chat-nodes.ts'
2
+
3
+ /**
4
+ * Chat group-tree positions from the outermost inward; a Node at a position
5
+ * also has the effect of every inner position.
6
+ * - `exchange`: the Node's Turn opens an exchange, the run of Turns that lasts
7
+ * until the next opening Turn.
8
+ * - `input`: the Node is an input of its Turn. An input before the Turn's
9
+ * process is the Turn's opening input; a later one is interleaved and keeps
10
+ * the whole Turn open.
11
+ * - `turn`: the Node stays in its Turn outside the Turn's process disclosure.
12
+ * - `process`: the Node stays in the process disclosure outside step runs.
13
+ * - absent: the Node joins the step run around it.
14
+ *
15
+ * The Definition that builds a Node chooses its position, and step runs, the
16
+ * process disclosure, and Turn inputs are selected by position. An
17
+ * `assistant-step` Node places its rows without one: its reasoning row joins
18
+ * the step run and its reply row stands outside it.
19
+ *
20
+ * Whole-Turn folding also exempts reply rows: with the default Replies After
21
+ * Collapse choice every `assistant-step` reply row stays visible, and with
22
+ * Final answer only just the final answer's reply row does. Reasoning rows
23
+ * stay in the folded process in both choices.
24
+ */
25
+ export type ChatGroupTree = 'exchange' | 'input' | 'turn' | 'process'
26
+
27
+ const DEPTH: Readonly<Record<ChatGroupTree, number>> = { exchange: 0, input: 1, turn: 2, process: 3 }
28
+
29
+ /**
30
+ * Test whether a Node stands at a group-tree position or outside it.
31
+ * @param node - Chat Node.
32
+ * @param position - group-tree position to compare against.
33
+ * @returns whether the Node's position is `position` or an outer one.
34
+ */
35
+ export function isAtOrOutside(node: Pick<ChatConversationViewNode, 'groupTree'>, position: ChatGroupTree): boolean {
36
+ return node.groupTree !== undefined && DEPTH[node.groupTree] <= DEPTH[position]
37
+ }
@@ -0,0 +1,30 @@
1
+ /** Business data for Chat process groups; source Nodes remain in the Chat store. */
2
+
3
+ /** Process-group category ranked by distinct calls; `context` names a group whose members are all Context. */
4
+ export type ProcessActivity = 'read' | 'readImage' | 'search' | 'write' | 'edit' | 'commands' | 'code'
5
+ | 'webSearch' | 'webFetch' | 'subagents' | 'plan' | 'questions' | 'tools' | 'context'
6
+
7
+ /** Categories a live tool call can report. */
8
+ export type RunningProcessActivity = Exclude<ProcessActivity, 'context'>
9
+
10
+ /** Category ranking by distinct calls, or by member count for an all-Context group, and the current live task detail. */
11
+ export interface ProcessActivitySummary {
12
+ readonly counts: readonly { readonly kind: ProcessActivity; readonly count: number }[]
13
+ readonly running: RunningProcessActivity | undefined
14
+ readonly runningDetail: string
15
+ /** Present only while the selected live activity has not reached tool/call. */
16
+ readonly preparing?: true
17
+ }
18
+
19
+ /** Presentation facts for one group between independent replies or input. */
20
+ export interface ProcessGroupData {
21
+ readonly turn: number
22
+ readonly closed: boolean
23
+ readonly summary: ProcessActivitySummary
24
+ }
25
+
26
+ declare module '@deepseek-ai/dsh-client-ui-conversation/client' {
27
+ interface ConversationGroupDataMap {
28
+ chat: ProcessGroupData
29
+ }
30
+ }