@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,508 @@
1
+ /** Chat-owned Slot declarations and composed component props. */
2
+ import type { RefObject } from 'react'
3
+ import type { MessageId } from '@deepseek-ai/dsh-llm/brand'
4
+ import type { SessionId, SessionSeq } from '@deepseek-ai/dsh-session/types'
5
+ import type { PendingSubmission } from '@deepseek-ai/dsh-api-session-controller/client'
6
+ import type { FileAttachmentRef } from '@deepseek-ai/dsh-attachment'
7
+ import type { InboxState } from '@deepseek-ai/dsh-agent/types'
8
+ import type {
9
+ CommandNode, CompactionSummaryNode, ConversationLocationDataStore, ConversationTurnDataMap,
10
+ TextInteractionGesture, TextInteractionSurface,
11
+ ConversationGroupData, GroupSnapshot,
12
+ MessageImageLoader, MessageImageSource, MessageImagesOwnerProps, RenderEntry, TurnLocation, UserTextFacts, UserTextInput,
13
+ } from '@deepseek-ai/dsh-client-ui-conversation/client'
14
+ import type {
15
+ HostObservable, InjectFace, KeyedSnapshotSelectorHook, PropsLocale, PropsRenderSlots, PropsRuntime,
16
+ PropsRenderFactories, PropsStore, SlotHookFactory, SnapshotSelectorHook,
17
+ } from '@deepseek-ai/dsh-client-ui-slots'
18
+ import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
19
+ import type { ConnectionStateSource } from '@deepseek-ai/dsh-client-connection/client'
20
+ import type { FileDragActions, MarkdownDelegateFenceInfo, MarkdownFileMentions, MarkdownLabels } from '@deepseek-ai/dsh-client-ui-primitives'
21
+ import type { ContextMenuTriggerProps } from '@deepseek-ai/dsh-client-ui-context-menu/client'
22
+ import type { ChatKey } from '../locale.ts'
23
+ import type {} from '@deepseek-ai/dsh-client-ui-layout/client'
24
+ // Type-only: the Session-scope access Hook (`useAccess`) the Chat entries read.
25
+ import type {} from '@deepseek-ai/dsh-client-ui-session/client'
26
+ import type { createChatStore } from '../stores.ts'
27
+ import type { ChatPresentationPolicy } from '../presentation-policy.ts'
28
+ import type { FlowMotionRows } from '../chat/flow-motion.ts'
29
+ import type { ToolCallId } from './store.ts'
30
+ import type { ChatConversationViewNode, ChatNode, ChatNodeKind } from './chat-nodes.ts'
31
+ import type {
32
+ ChatNodeProcessSource, ChatNodeSource, ChatSnapshot, ChatTurnProcessPresentation,
33
+ } from './snapshot.ts'
34
+ import type { TurnProcessSpec } from './turn-process.ts'
35
+ import type { PerformanceUsageMode } from '../../chat-settings.ts'
36
+
37
+ /** Selector hook over the current Conversation binding's Chat target. */
38
+ export type UseChat = SnapshotSelectorHook<ChatSnapshot>
39
+
40
+ /** Per-key selector hook over one Chat Node. */
41
+ export type UseChatNode = KeyedSnapshotSelectorHook<ChatConversationViewNode | undefined>
42
+
43
+ /** Per-key selector hook over one Chat Node's Turn-process presentation. */
44
+ export type UseChatNodeProcess = KeyedSnapshotSelectorHook<ChatTurnProcessPresentation | undefined>
45
+
46
+ /**
47
+ * Selector hook over the live presentation policy. Callers select one field or
48
+ * a derived conclusion, never the whole policy, so a mode change re-renders
49
+ * only components whose selected value changed.
50
+ */
51
+ export type UsePresentation = SnapshotSelectorHook<ChatPresentationPolicy>
52
+
53
+ /** Where in a file an open should land. */
54
+ export interface OpenFileOptions {
55
+ /** 1-based line to reveal; absent = the file's beginning. */
56
+ readonly line?: number
57
+ }
58
+
59
+ /** Owner currency of the completed-Turn extension chain. */
60
+ export interface TurnTailOwnerProps {
61
+ turn: TurnLocation
62
+ seq: number
63
+ openFile: (path: string) => void
64
+ }
65
+
66
+ /** Owner currency of finalized-assistant actions. */
67
+ export interface AssistantActionOwnerProps {
68
+ messageId: MessageId
69
+ }
70
+
71
+ /** Stable quota failure codes retained in the Session log; both raise the frame-wide notice. */
72
+ export type QuotaNoticeCode = 'QUOTA' | 'ACCOUNT_QUOTA'
73
+
74
+ /** The notice on display; `seq` keys remounts so an unretained later notice restarts its transient display. */
75
+ export interface QuotaNoticeState {
76
+ /** Stable failure code retained in the Session log. */
77
+ code: QuotaNoticeCode
78
+ /** Per-publication sequence; the host keys its surface by it. */
79
+ seq: number
80
+ }
81
+
82
+ /** Original and display-ready reasoning offered to the expanded Body Slot. */
83
+ export interface ReasoningBodyOwnerProps {
84
+ /** Complete or streaming model output. */
85
+ readonly rawText: string
86
+ /** Reasoning text prepared for display. */
87
+ readonly text: string
88
+ /** Whether the reasoning tail is still streaming. */
89
+ readonly running: boolean
90
+ }
91
+
92
+ /** Session-independent original or derived display input to the Content Factory. */
93
+ export interface ReasoningContentInput {
94
+ /** Caller-selected Markdown. */
95
+ readonly text: string
96
+ /** Whether the supplied text is still streaming. */
97
+ readonly running: boolean
98
+ /** Localized Markdown controls, used unchanged when supplied; omission uses Chat's defaults. */
99
+ readonly labels?: MarkdownLabels
100
+ }
101
+
102
+ /** Owner currency of one quota notice offered to the frame-wide chain. */
103
+ export interface QuotaNoticeOwnerProps {
104
+ /** Stable failure code retained in the Session log. */
105
+ code: QuotaNoticeCode
106
+ /** Provider-neutral notice copy in the active locale. */
107
+ message: string
108
+ /** Take the notice down. */
109
+ dismiss: () => void
110
+ /**
111
+ * Prevent later quota failures from replacing this notice. Dismissal clears
112
+ * all holds; releasing the last hold resumes future notices without replay.
113
+ * Callers must release on unmount.
114
+ * @returns idempotent release that cannot clear another hold.
115
+ */
116
+ keepOpen: () => () => void
117
+ }
118
+
119
+ /** Quota notice host share: the notice on display and its dismissal. */
120
+ export interface QuotaNoticeInjected {
121
+ hooks: {
122
+ /** The notice on display, or none. */
123
+ notice: HostObservable<QuotaNoticeState | null>
124
+ }
125
+ /** Take the notice down. */
126
+ dismissNotice: () => void
127
+ /**
128
+ * Acquire a hold with the lifecycle defined by QuotaNoticeOwnerProps.keepOpen.
129
+ * @returns idempotent release, or a no-op when no notice is live.
130
+ */
131
+ keepNoticeOpen: () => () => void
132
+ }
133
+
134
+ /** Full props of the Chat-owned frame-wide quota notice host. */
135
+ export type QuotaNoticeHostProps =
136
+ PropsRuntime<'shell.overlay'>
137
+ & PropsLocale<'chat'>
138
+ & PropsRenderSlots<'shell.quota-notice'>
139
+ & InjectFace<QuotaNoticeInjected>
140
+
141
+ /** Optional prose file-mention provider consumed by Chat. */
142
+ export interface ChatFileMentions {
143
+ /**
144
+ * Resolve prose links for one closing Turn.
145
+ * @param owner - closing-Turn identity and file opener.
146
+ * @param sessionId - viewed Session, including when history is inherited from a fork.
147
+ * @param getFileTriggerProps - ordinary gesture binding for a resolved file path.
148
+ * @returns link resolver when available.
149
+ */
150
+ forClosing(
151
+ owner: TurnTailOwnerProps, sessionId: SessionId, getFileTriggerProps?: (path: string) => ContextMenuTriggerProps,
152
+ ): MarkdownFileMentions | undefined
153
+ }
154
+
155
+ declare module '@deepseek-ai/cordis' {
156
+ interface Context {
157
+ /** Optional prose file-mention provider. */
158
+ chatFileMentions: ChatFileMentions
159
+ }
160
+ }
161
+
162
+ /** Hook constrained to business data published on the current Chat Node's Turn. */
163
+ export type UseChatNodeTurnData = <Key extends Extract<keyof ConversationTurnDataMap, string>>(
164
+ key: Key,
165
+ ) => Readonly<ConversationTurnDataMap[Key]> | undefined
166
+
167
+ /**
168
+ * Subscribe to enclosing-Turn resets and own one initially collapsed disclosure.
169
+ * Each invocation has independent open state; display-mode changes do not reset it.
170
+ * @returns the current open state, explicit setter, and toggle action.
171
+ */
172
+ export type UseDisclosure = () => {
173
+ readonly expanded: boolean
174
+ /** @param open - whether this disclosure is expanded. */
175
+ readonly setExpanded: (open: boolean) => void
176
+ readonly toggle: () => void
177
+ }
178
+
179
+ /**
180
+ * Searchable process hiding bound to the current node render's viewport.
181
+ * @param hidden - desired hidden state.
182
+ * @param reveal - browser-find and focus-protection callback.
183
+ * @returns the stable process-container ref.
184
+ */
185
+ export type UseGroupAction = (hidden: boolean, reveal: () => void) => RefObject<HTMLDivElement>
186
+
187
+ /**
188
+ * Plain header visibility bound to the flow's viewport, including growth on reveal.
189
+ * @param ref - stable header element.
190
+ * @param hidden - desired hidden state.
191
+ */
192
+ export type UseGroupHeaderAction = (ref: RefObject<HTMLElement | null>, hidden: boolean) => void
193
+
194
+ /** Viewport capability supplied once for each rendered Chat flow. */
195
+ export interface ChatFlowHookContext {
196
+ readonly motion: FlowMotionRows
197
+ }
198
+
199
+ /** Flow-wide behavior hooks bound to one viewport, independently of Session identity. */
200
+ export interface ChatFlowInjected {
201
+ hooks: {
202
+ groupAction: SlotHookFactory<'conversation.chat.flow', UseGroupAction>
203
+ groupHeaderAction: SlotHookFactory<'conversation.chat.flow', UseGroupHeaderAction>
204
+ }
205
+ }
206
+
207
+ /** Stable sources and capabilities bound to one rendered Chat Node. */
208
+ export interface ChatNodeHookContext {
209
+ readonly turnData: ConversationLocationDataStore<ConversationTurnDataMap> | undefined
210
+ readonly disclosureReset: ObservableSnapshot<number>
211
+ readonly useGroupAction: UseGroupAction
212
+ }
213
+
214
+ /** Slot-level Hook factories for keyed Chat renderers. */
215
+ export interface ChatNodeInjected {
216
+ hooks: {
217
+ turnData: SlotHookFactory<'conversation.chat.node', UseChatNodeTurnData>
218
+ disclosure: SlotHookFactory<'conversation.chat.node', UseDisclosure>
219
+ groupAction: SlotHookFactory<'conversation.chat.node', UseGroupAction>
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Owner currency of the message-source decoration above one user message bubble.
225
+ *
226
+ * Entry selectors receive the durable message `source` and row kind. A
227
+ * non-null selection elects the component and reaches it as `matched`.
228
+ * Entries own their markup and copy; Chat does not interpret the source.
229
+ */
230
+ export interface UserBeforeOwnerProps {
231
+ /** Durable message source; Chat does not interpret it. */
232
+ readonly source: unknown
233
+ /** Chat row kind that owns the decoration site. */
234
+ readonly kind: 'user' | 'steering'
235
+ }
236
+
237
+ /** Stable owner currency delivered to a keyed Chat renderer. */
238
+ export interface ChatNodeOwnerProps {
239
+ /** Renderer-owned Node portion selected by the grouping Definition. */
240
+ groupPart?: string
241
+ cwd?: string | undefined
242
+ openFile: (path: string, options?: OpenFileOptions) => void
243
+ inspectCall: ((callId: ToolCallId) => void) | undefined
244
+ forkAt: (seq: number) => void
245
+ /** Session-authorized image loader supplied by the Chat view. */
246
+ loadImage: MessageImageLoader
247
+ /** Turn-process state when this Node belongs to a projected Turn. */
248
+ turnProcess?: TurnProcessOwnerProps | undefined
249
+ }
250
+
251
+ /** One attachment in the original user-message display order. */
252
+ export type UserContentAttachment =
253
+ | { readonly type: 'image'; readonly image: MessageImageSource }
254
+ | { readonly type: 'file'; readonly file: FileAttachmentRef }
255
+
256
+ /** Prepared user contents without row identity, admission state, time, or actions. */
257
+ export interface UserContentData {
258
+ readonly text: string
259
+ readonly attachments: readonly UserContentAttachment[]
260
+ /** Blocks not represented by text or attachment presentation. */
261
+ readonly extraBlocks: readonly unknown[]
262
+ /** Labels displayed in the caller-provided reference summary. */
263
+ readonly referenceLabels?: readonly string[]
264
+ }
265
+
266
+ /** Public content rendering input; reference renderers own their injected actions. */
267
+ export interface UserContentInput extends Pick<ChatNodeOwnerProps, 'loadImage'>,
268
+ Pick<UserTextInput, 'interactive' | 'ellipsis'> {
269
+ readonly content: UserContentData
270
+ /** Transform inputs passed unchanged to UserText, separate from summary and rendering props. */
271
+ readonly facts: Readonly<Partial<UserTextFacts>>
272
+ }
273
+
274
+ /** Shared presentation state for one Turn-process answer generation. */
275
+ export interface TurnProcessOwnerProps {
276
+ /** Process content eligible to share one Turn-level disclosure. */
277
+ readonly hasContent: boolean
278
+ readonly spec: TurnProcessSpec
279
+ readonly foldable: boolean
280
+ readonly open: boolean
281
+ setOpen(open: boolean): void
282
+ }
283
+
284
+ /** Shared presentation policy source for renderers that depend on the work-details mode. */
285
+ export interface PresentationInjected {
286
+ hooks: {
287
+ /** Live presentation policy derived from the accepted work-details mode. */
288
+ presentation: ObservableSnapshot<ChatPresentationPolicy>
289
+ }
290
+ }
291
+
292
+ /** Full props of one keyed Chat renderer. */
293
+ export type ChatNodeViewProps<Kind extends ChatNodeKind = ChatNodeKind> =
294
+ PropsRuntime<'conversation.chat.node', Kind> & PropsLocale<'chat'> & PropsRenderFactories
295
+
296
+ /** Command-row owner share. */
297
+ export interface CommandRowOwnerProps {
298
+ node: CommandNode
299
+ compaction?: CompactionSummaryNode
300
+ }
301
+
302
+ /** Full props of a registered command row. */
303
+ export type CommandRowProps = PropsRuntime<'conversation.chat.commandview'>
304
+
305
+ /** Shared Chat store handle. */
306
+ export type ChatStore = ReturnType<typeof createChatStore>
307
+
308
+ /** In-memory reader position resilient to transcript reflow. */
309
+ export interface ChatScrollPosition {
310
+ readonly anchorKey: string
311
+ readonly anchorTop: number
312
+ readonly scrollTop: number
313
+ }
314
+
315
+ /** Shared settings source for the performance row, composer, and turn tail. */
316
+ export interface PerformanceUsageInjected {
317
+ hooks: {
318
+ /** Accepted performance and usage detail preference. */
319
+ performanceUsage: ObservableSnapshot<PerformanceUsageMode>
320
+ }
321
+ }
322
+
323
+ /** Business callbacks injected into the Chat view. */
324
+ export interface ChatViewInjected {
325
+ /** File preparation and failure callbacks owned by the file-drag plugin. */
326
+ readonly fileDrag: FileDragActions
327
+ /** Resolve the reference against this Session and its current path base when the gesture begins. */
328
+ resolveFilePath: (path: string) => string
329
+ /** Dispatch one gesture to the Conversation plugin registry. */
330
+ dispatchInteraction: (gesture: TextInteractionGesture) => string | null
331
+ hooks: {
332
+ /** Live plugin IDs; removed plugins dismiss their active surface. */
333
+ interactionIds: ObservableSnapshot<readonly string[]>
334
+ /** Live presentation policy derived from the accepted work-details mode. */
335
+ presentation: ObservableSnapshot<ChatPresentationPolicy>
336
+ }
337
+ keyedHooks: {
338
+ /** Resolve the stable source for one Chat Node key. */
339
+ chatNode: (key: string) => ChatNodeSource
340
+ /** Observe assembler-owned bottom membership for one Node. */
341
+ chatNodeBottom: (key: string) => ObservableSnapshot<boolean>
342
+ /** Resolve the stable Turn-process source for one Chat Node key. */
343
+ chatNodeProcess: (key: string) => ChatNodeProcessSource
344
+ /** Resolve one optional group without subscribing the root View to its data. */
345
+ chatGroup: (key: string) => ObservableSnapshot<GroupSnapshot<ConversationGroupData<'chat'>> | undefined> | undefined
346
+ }
347
+ /** Open one HTTP(S) message link at the selected destination, using an external tab if Sidebar Browser is unavailable. */
348
+ openExternalLink: (url: string) => void
349
+ openFile: (path: string, options?: OpenFileOptions) => Promise<void>
350
+ /** Prepare one older page without publishing it. */
351
+ loadOlder: () => void
352
+ /** Consume the prepared page synchronously; false when none is ready. */
353
+ consumeOlder: () => boolean
354
+ /** Jump loader: page history back through seq; resolves when the window covers it. */
355
+ loadThrough: (seq: SessionSeq) => Promise<void>
356
+ loadImage: MessageImageLoader
357
+ chatScroll: {
358
+ save: (position: ChatScrollPosition | null) => void
359
+ read: () => ChatScrollPosition | null
360
+ }
361
+ forkAt: (seq: number) => void
362
+ }
363
+
364
+ /** Session-owned node sources shared with the view, plus the flow's connection state. */
365
+ export type ChatFlowDataInjected = Pick<ChatViewInjected, 'keyedHooks'> & {
366
+ hooks: Pick<ChatViewInjected['hooks'], 'presentation'> & {
367
+ /** Client connection lifecycle; the running clock pauses while it is not connected. */
368
+ connectionState: ConnectionStateSource
369
+ }
370
+ }
371
+
372
+ /** Ordered rows and reconciled local echoes rendered inside one Chat viewport. */
373
+ export interface ChatFlowOwnerProps extends Pick<ChatNodeOwnerProps,
374
+ 'cwd' | 'openFile' | 'inspectCall' | 'forkAt' | 'loadImage'> {
375
+ readonly entries: readonly RenderEntry[]
376
+ readonly pendingInputs: readonly (PendingSubmission | InboxState['next-step'][number])[]
377
+ readonly lastInputTurn: number | undefined
378
+ readonly deferCollapse: boolean
379
+ }
380
+
381
+ /** Full props of the Chat-owned flow renderer. */
382
+ export type ChatFlowSlotProps =
383
+ PropsRuntime<'conversation.chat.flow'>
384
+ & PropsRenderSlots<'conversation.chat.node'>
385
+ & PropsRenderFactories
386
+ & PropsStore<ChatStore>
387
+ & InjectFace<ChatFlowDataInjected>
388
+ & PropsLocale<'chat'>
389
+
390
+ /** Full Chat view props. */
391
+ export type ChatViewSlotProps =
392
+ PropsRuntime<'conversation.view'>
393
+ & PropsRenderSlots<'conversation.chat.flow' | 'conversation.chat.text-interaction' | 'conversation.chat.markdown.fence'>
394
+ & PropsStore<ChatStore>
395
+ & InjectFace<ChatViewInjected>
396
+ & PropsLocale<'chat'>
397
+
398
+ /** Full props shared by the user and output image entries. */
399
+ export type MessageImagesProps =
400
+ PropsRuntime<'conversation.chat.user.images' | 'conversation.chat.message.images'> & PropsRenderFactories
401
+
402
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
403
+ interface SessionStandardProps {
404
+ /** Selector hook over the current Conversation binding's Chat target. */
405
+ useChat: UseChat
406
+ }
407
+
408
+ interface LocaleNamespaceMap {
409
+ /** Chat target, transcript node, statistics, and details copy. */
410
+ chat: ChatKey
411
+ }
412
+
413
+ interface SlotFactoryMap {
414
+ /** Prepared user text, attachments, and references inside a caller-owned message row. */
415
+ 'conversation.chat.user.content': {
416
+ scope: 'session'
417
+ props: UserContentInput
418
+ locale: 'chat'
419
+ children: { 'conversation.chat.user.images': { kind: 'single'; scope: 'session' } }
420
+ }
421
+ /** Session-independent reasoning Markdown with Chat labels and compact typography. */
422
+ 'conversation.chat.reasoning.content': {
423
+ scope: 'root'
424
+ props: ReasoningContentInput
425
+ locale: 'chat'
426
+ }
427
+ }
428
+
429
+ interface SlotMap {
430
+ /** Area-local text gestures and surfaces; each consumer registers its own synchronous admission. */
431
+ 'conversation.chat.text-interaction': { kind: 'keyed'; scope: 'session'; owner: TextInteractionSurface }
432
+ /** Language-keyed layers around one Markdown fence in the Chat flow; the content is the plain code block. */
433
+ 'conversation.chat.markdown.fence': { kind: 'hoc'; scope: 'session'; owner: MarkdownDelegateFenceInfo }
434
+
435
+ /** Ordered Chat rows and local echoes with viewport-bound visibility hooks. */
436
+ 'conversation.chat.flow': {
437
+ kind: 'single'
438
+ scope: 'session'
439
+ owner: ChatFlowOwnerProps
440
+ hookContext: ChatFlowHookContext
441
+ inject: ChatFlowInjected
442
+ }
443
+ /**
444
+ * Final Chat node renderer, keyed by `ChatNodeKind`. The component receives
445
+ * the typed node, shared Chat actions, and Turn-data hook. Reusing a key
446
+ * replaces that node renderer; a kind with no occupant renders no row.
447
+ */
448
+ 'conversation.chat.node': {
449
+ kind: 'keyed'
450
+ scope: 'session'
451
+ owner: ChatNodeOwnerProps
452
+ keyProps: { [Kind in ChatNodeKind]: { node: ChatNode<Kind> } }
453
+ hookContext: ChatNodeHookContext
454
+ inject: ChatNodeInjected
455
+ }
456
+ /**
457
+ * Message-source decoration owned and rendered by the user Node entry.
458
+ * Selectors elect one component from the durable source and row kind.
459
+ * No match renders no visible content; steering and pending rows do not
460
+ * render this slot.
461
+ */
462
+ 'conversation.chat.user.before': {
463
+ kind: 'chain'
464
+ scope: 'session'
465
+ owner: UserBeforeOwnerProps
466
+ }
467
+ /**
468
+ * Renderer for one consecutive group of durable message images. The owner
469
+ * supplies image references, an authorized loader, and alignment. A
470
+ * registration replaces the shipped gallery; without one, images are omitted.
471
+ */
472
+ 'conversation.chat.message.images': { kind: 'single'; scope: 'session'; owner: MessageImagesOwnerProps }
473
+ /** User-message images, including pending and local-echo previews, independently replaceable from output images. */
474
+ 'conversation.chat.user.images': { kind: 'single'; scope: 'session'; owner: MessageImagesOwnerProps }
475
+ /**
476
+ * Command row keyed by the command name. The component receives the folded
477
+ * command lifecycle and linked compaction when present. Reusing a key
478
+ * replaces that command renderer; an unoccupied key uses the generic card.
479
+ */
480
+ 'conversation.chat.commandview': { kind: 'keyed'; scope: 'session'; owner: CommandRowOwnerProps }
481
+ /**
482
+ * Expanded reasoning body with raw and display-ready text. The official entry
483
+ * has priority 100 and calls the reasoning Content Factory; smaller priority
484
+ * values replace it. Contributions must preserve access to untranslated display text.
485
+ */
486
+ 'conversation.chat.reasoning.body': { kind: 'single'; scope: 'session'; owner: ReasoningBodyOwnerProps }
487
+ /**
488
+ * Ordered feature contributions before a completed Turn's action row. Each
489
+ * entry receives the Turn, closing sequence, and file opener. A fresh `id`
490
+ * adds an entry; entries without content return null.
491
+ */
492
+ 'conversation.chat.turnTail': { kind: 'list'; scope: 'session'; owner: TurnTailOwnerProps }
493
+ /**
494
+ * Ordered actions for one finalized assistant message. Each entry receives
495
+ * the durable message id; a fresh `id` adds an action and reusing one replaces
496
+ * that entry. With no entries, the standard action row remains unchanged.
497
+ */
498
+ 'conversation.chat.assistant-actions': { kind: 'list'; scope: 'session'; owner: AssistantActionOwnerProps }
499
+ /**
500
+ * Frame-wide quota notice chain. The Chat-owned host in `shell.overlay`
501
+ * offers the one live notice; the first entry whose selector claims its
502
+ * code takes over the surface, and the all-decline case renders the host's
503
+ * generic warning Toast. The host lives outside the Chat panel, so a notice
504
+ * survives switching or closing the panel that reported it.
505
+ */
506
+ 'shell.quota-notice': { kind: 'chain'; scope: 'root'; owner: QuotaNoticeOwnerProps }
507
+ }
508
+ }
@@ -0,0 +1,171 @@
1
+ import type {
2
+ ConversationNode, ConversationTimelineSnapshot, PartialAssistant, RunningToolCall,
3
+ } from '@deepseek-ai/dsh-client-ui-conversation/client'
4
+ import type { ChatConversationViewNode, ChatNodeDataMap, ChatNodeKind } from './chat-nodes.ts'
5
+ import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
6
+ import type { TurnProcessSpec } from './turn-process.ts'
7
+
8
+ export type {
9
+ AssistantBlock, AssistantMessageNode, AssistantProviderMetadataView, AssistantRequestConfig,
10
+ AssistantTiming, CommandNode, CompactionSummaryNode, ContextMessageNode, ConversationNode,
11
+ ModelRetryNode, PartialAssistant, PreparingToolCall, RunningToolCall, StartedToolCall, SteeringMessageNode, TodoItem,
12
+ ToolArgs, ToolCallBlock, ToolResultNode, TurnErrorNode, TurnMaxTokensNode, UnknownSurfaceNode,
13
+ UserMessageNode,
14
+ } from '@deepseek-ai/dsh-client-ui-conversation/client'
15
+
16
+ /** Per-key observable used by one mounted Chat Node Seat. */
17
+ export interface ChatNodeSource {
18
+ /** @returns the current Node for this source's stable key. */
19
+ readonly getSnapshot: () => ChatConversationViewNode | undefined
20
+ /** @param listener - callback for changes to this key. @returns the unsubscribe function. */
21
+ readonly subscribe: (listener: () => void) => () => void
22
+ }
23
+
24
+ /** Per-key observable for the Turn-process presentation surrounding one Chat Node. */
25
+ export interface ChatNodeProcessSource {
26
+ /** @returns the current presentation, or absence outside a projected Turn process. */
27
+ readonly getSnapshot: () => ChatTurnProcessPresentation | undefined
28
+ /** @param listener - callback for presentation changes. @returns the unsubscribe function. */
29
+ readonly subscribe: (listener: () => void) => () => void
30
+ }
31
+
32
+ /** Stable live per-key reader for Chat nodes. */
33
+ export interface ChatNodeStore {
34
+ /** @param key - stable Conversation Context key. @returns current Node, when visible or hidden. */
35
+ get(key: string): ChatConversationViewNode | undefined
36
+ /** @param key - stable Conversation Context key. @returns its identity-stable observable source. */
37
+ source(key: string): ChatNodeSource
38
+ /**
39
+ * @param key - Chat Node identity.
40
+ * @returns whether the visible Node belongs to the latest loaded exchange (see `ChatConversationViewNode.groupTree`).
41
+ */
42
+ bottomSource(key: string): ObservableSnapshot<boolean>
43
+ /**
44
+ * Observe one Turn's data for a single Node kind, including hidden Nodes, in anchor order.
45
+ * Other Turns and kinds do not notify this source.
46
+ * @param turn - resolved owning Turn.
47
+ * @param kind - business Node kind.
48
+ * @returns an identity-stable source whose array changes only with its members.
49
+ */
50
+ turnDataSource<Kind extends ChatNodeKind>(turn: number, kind: Kind): ObservableSnapshot<readonly ChatNodeDataMap[Kind][]>
51
+ /** @param key - stable Conversation Context key. @returns its Turn-process presentation source. */
52
+ processSource(key: string): ChatNodeProcessSource
53
+ /** @returns all currently materialized Nodes without imposing render order. */
54
+ values(): readonly ChatConversationViewNode[]
55
+ }
56
+
57
+ /** One loaded Turn projected into the compact Chat navigation rail. */
58
+ export interface TurnNavigationItem {
59
+ readonly turn: number
60
+ /** Stable Conversation Context key the rail scrolls to. */
61
+ readonly anchorKey: string
62
+ /** Bounded prompt preview; empty when the loaded window starts mid-Turn. */
63
+ readonly prompt: string
64
+ /** Bounded assistant-response preview; empty until the Turn answers. */
65
+ readonly response: string
66
+ }
67
+
68
+ /** Stable live navigation projection of the loaded Turns. */
69
+ export interface ChatTurnNavigationIndex {
70
+ /**
71
+ * Loaded Turns that have a visible anchor, in timeline order. The array
72
+ * identity changes exactly when a Turn enters, leaves, or changes preview,
73
+ * so a renderer can select it directly as its change signal.
74
+ * @returns current navigation items.
75
+ */
76
+ items(): readonly TurnNavigationItem[]
77
+ }
78
+
79
+ /** Stable live Location index for Chat nodes. */
80
+ export interface ChatLocationNodeIndex {
81
+ /** @param turn - owning turn. @returns ordered Chat Node keys in the turn. */
82
+ getTurn(turn: number): readonly string[]
83
+ /** @param turn - owning turn. @param step - owning step. @returns ordered Chat Node keys in the step. */
84
+ getStep(turn: number, step: number): readonly string[]
85
+ }
86
+
87
+ /** Cross-Node presentation facts derived for one Turn process. */
88
+ export interface ChatTurnProcessPresentation {
89
+ readonly turn: number
90
+ readonly spec: TurnProcessSpec
91
+ /** Whether the loaded window contains this Turn's `turn/start`; folding is decided per Turn on this fact. */
92
+ readonly turnStarted: boolean
93
+ readonly turnClosed: boolean
94
+ readonly hasExternalProcess: boolean
95
+ /** Like `hasExternalProcess`, but a reply from another Step counts only through its reasoning. */
96
+ readonly hasNonReplyProcess: boolean
97
+ /** A visible input after process output prevents one disclosure from hiding its surrounding groups. */
98
+ readonly hasInterleavedInput: boolean
99
+ }
100
+
101
+ /** Compatibility projection backing the composer stats pills (StatsPills.tsx) and the legacy top-level snapshot fields. */
102
+ export interface LegacyConversationSlice {
103
+ readonly nodes: readonly ConversationNode[]
104
+ readonly turnTimings: ReadonlyMap<number, { readonly startTime: number; readonly endTime?: number }>
105
+ readonly turnEnds: ReadonlyMap<number, number>
106
+ readonly partial: PartialAssistant | null
107
+ readonly runningCalls: readonly RunningToolCall[]
108
+ }
109
+
110
+ /** Incremental Chat publication with immutable order and stable live keyed readers. */
111
+ export interface ChatSnapshot {
112
+ readonly order: readonly string[]
113
+ readonly nodes: ChatNodeStore
114
+ readonly locations: ChatLocationNodeIndex
115
+ readonly navigation: ChatTurnNavigationIndex
116
+ readonly timeline: ConversationTimelineSnapshot
117
+ readonly legacy: LegacyConversationSlice
118
+ }
119
+
120
+ declare module '@deepseek-ai/dsh-client-ui-conversation/client' {
121
+ interface ConversationViewSnapshotMap {
122
+ chat: ChatSnapshot
123
+ }
124
+ }
125
+
126
+ const EMPTY_LIST: readonly never[] = []
127
+ const EMPTY_TIMELINE: ConversationTimelineSnapshot = { turnOrder: EMPTY_LIST, turns: new Map() }
128
+ const EMPTY_NODE_SOURCE: ChatNodeSource = {
129
+ getSnapshot: () => undefined,
130
+ subscribe: () => () => {},
131
+ }
132
+ const EMPTY_BOTTOM_SOURCE: ObservableSnapshot<boolean> = {
133
+ getSnapshot: () => false,
134
+ subscribe: () => () => {},
135
+ }
136
+ const EMPTY_NODE_PROCESS_SOURCE: ChatNodeProcessSource = {
137
+ getSnapshot: () => undefined,
138
+ subscribe: () => () => {},
139
+ }
140
+ const EMPTY_TURN_NODE_SOURCE: ObservableSnapshot<readonly never[]> = {
141
+ getSnapshot: () => EMPTY_LIST,
142
+ subscribe: () => () => {},
143
+ }
144
+
145
+ /** Empty Chat target used before a view builder is registered. */
146
+ export const EMPTY_CHAT_SNAPSHOT: ChatSnapshot = {
147
+ order: EMPTY_LIST,
148
+ nodes: {
149
+ get: () => undefined,
150
+ source: () => EMPTY_NODE_SOURCE,
151
+ bottomSource: () => EMPTY_BOTTOM_SOURCE,
152
+ turnDataSource: () => EMPTY_TURN_NODE_SOURCE,
153
+ processSource: () => EMPTY_NODE_PROCESS_SOURCE,
154
+ values: () => EMPTY_LIST,
155
+ },
156
+ locations: {
157
+ getTurn: () => EMPTY_LIST,
158
+ getStep: () => EMPTY_LIST,
159
+ },
160
+ navigation: {
161
+ items: () => EMPTY_LIST,
162
+ },
163
+ timeline: EMPTY_TIMELINE,
164
+ legacy: {
165
+ nodes: EMPTY_LIST,
166
+ turnTimings: new Map(),
167
+ turnEnds: new Map(),
168
+ partial: null,
169
+ runningCalls: EMPTY_LIST,
170
+ },
171
+ }