@deepseek-ai/dsh-client-ui-chat 0.2.2-rc.1 → 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 +44 -41
  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
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-client-ui-chat",
3
3
  "description": "Chat Conversation target, node definitions, renderers, and details surface",
4
- "version": "0.2.2-rc.1",
4
+ "version": "0.2.2-rc.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -54,48 +54,48 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@deepseek-ai/cordis": "~4.1.0",
57
- "@deepseek-ai/dsh-agent": "0.2.2-rc.1",
58
- "@deepseek-ai/dsh-api-remotes": "0.2.2-rc.1",
59
- "@deepseek-ai/dsh-api-session-controller": "0.2.2-rc.1",
60
- "@deepseek-ai/dsh-api-workspace-controller": "0.2.2-rc.1",
61
- "@deepseek-ai/dsh-api-workspace-files": "0.2.2-rc.1",
62
- "@deepseek-ai/dsh-attachment": "0.2.2-rc.1",
63
- "@deepseek-ai/dsh-brand": "0.2.2-rc.1",
64
- "@deepseek-ai/dsh-client-connection": "0.2.2-rc.1",
65
- "@deepseek-ai/dsh-client-locale": "0.2.2-rc.1",
66
- "@deepseek-ai/dsh-client-store": "0.2.2-rc.1",
67
- "@deepseek-ai/dsh-client-ui-approval": "0.2.2-rc.1",
68
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.2-rc.1",
69
- "@deepseek-ai/dsh-client-ui-input-trigger": "0.2.2-rc.1",
70
- "@deepseek-ai/dsh-client-ui-layout": "0.2.2-rc.1",
71
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.2-rc.1",
72
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.1",
73
- "@deepseek-ai/dsh-client-ui-session": "0.2.2-rc.1",
74
- "@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.1",
75
- "@deepseek-ai/dsh-client-ui-sidebar-browser": "0.2.2-rc.1",
76
- "@deepseek-ai/dsh-client-ui-sidebar-documentpreview": "0.2.2-rc.1",
77
- "@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.2-rc.1",
78
- "@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.1",
79
- "@deepseek-ai/dsh-client-ui-workspace": "0.2.2-rc.1",
80
- "@deepseek-ai/dsh-commands": "0.2.2-rc.1",
81
- "@deepseek-ai/dsh-compaction": "0.2.2-rc.1",
82
- "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
83
- "@deepseek-ai/dsh-llm-retry": "0.2.2-rc.1",
84
- "@deepseek-ai/dsh-session": "0.2.2-rc.1",
85
- "@deepseek-ai/dsh-session-stats": "0.2.2-rc.1",
86
- "@deepseek-ai/dsh-session-turn-outline": "0.2.2-rc.1",
87
- "@deepseek-ai/dsh-subagent": "0.2.2-rc.1",
88
- "@deepseek-ai/dsh-token-meter": "0.2.2-rc.1",
89
- "@deepseek-ai/dsh-util-workspace-path": "0.2.2-rc.1",
90
- "@deepseek-ai/dsh-tool-executor-ptc": "0.2.2-rc.1",
91
- "@deepseek-ai/dsh-util-values": "0.2.2-rc.1",
57
+ "@deepseek-ai/dsh-agent": "0.2.2-rc.2",
58
+ "@deepseek-ai/dsh-api-remotes": "0.2.2-rc.2",
59
+ "@deepseek-ai/dsh-api-session-controller": "0.2.2-rc.2",
60
+ "@deepseek-ai/dsh-api-workspace-controller": "0.2.2-rc.2",
61
+ "@deepseek-ai/dsh-api-workspace-files": "0.2.2-rc.2",
62
+ "@deepseek-ai/dsh-attachment": "0.2.2-rc.2",
63
+ "@deepseek-ai/dsh-brand": "0.2.2-rc.2",
64
+ "@deepseek-ai/dsh-client-connection": "0.2.2-rc.2",
65
+ "@deepseek-ai/dsh-client-locale": "0.2.2-rc.2",
66
+ "@deepseek-ai/dsh-client-store": "0.2.2-rc.2",
67
+ "@deepseek-ai/dsh-client-ui-approval": "0.2.2-rc.2",
68
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.2-rc.2",
69
+ "@deepseek-ai/dsh-client-ui-input-trigger": "0.2.2-rc.2",
70
+ "@deepseek-ai/dsh-client-ui-layout": "0.2.2-rc.2",
71
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.2-rc.2",
72
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.2",
73
+ "@deepseek-ai/dsh-client-ui-session": "0.2.2-rc.2",
74
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.2",
75
+ "@deepseek-ai/dsh-client-ui-sidebar-browser": "0.2.2-rc.2",
76
+ "@deepseek-ai/dsh-client-ui-sidebar-documentpreview": "0.2.2-rc.2",
77
+ "@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.2-rc.2",
78
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.2",
79
+ "@deepseek-ai/dsh-client-ui-workspace": "0.2.2-rc.2",
80
+ "@deepseek-ai/dsh-commands": "0.2.2-rc.2",
81
+ "@deepseek-ai/dsh-compaction": "0.2.2-rc.2",
82
+ "@deepseek-ai/dsh-llm": "0.2.2-rc.2",
83
+ "@deepseek-ai/dsh-llm-retry": "0.2.2-rc.2",
84
+ "@deepseek-ai/dsh-session": "0.2.2-rc.2",
85
+ "@deepseek-ai/dsh-session-stats": "0.2.2-rc.2",
86
+ "@deepseek-ai/dsh-session-turn-outline": "0.2.2-rc.2",
87
+ "@deepseek-ai/dsh-subagent": "0.2.2-rc.2",
88
+ "@deepseek-ai/dsh-token-meter": "0.2.2-rc.2",
89
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.2-rc.2",
90
+ "@deepseek-ai/dsh-tool-executor-ptc": "0.2.2-rc.2",
91
+ "@deepseek-ai/dsh-util-values": "0.2.2-rc.2",
92
92
  "@tanstack/react-virtual": "3.14.10",
93
93
  "react": "^18.2.0",
94
94
  "react-dom": "^18.2.0",
95
- "@deepseek-ai/dsh-settings": "0.2.2-rc.1",
96
- "@deepseek-ai/dsh-client-product-analytics": "0.2.2-rc.1",
97
- "@deepseek-ai/dsh-client-ui-file-drag": "0.2.2-rc.1",
98
- "@deepseek-ai/dsh-client-ui-context-menu": "0.2.2-rc.1"
95
+ "@deepseek-ai/dsh-settings": "0.2.2-rc.2",
96
+ "@deepseek-ai/dsh-client-product-analytics": "0.2.2-rc.2",
97
+ "@deepseek-ai/dsh-client-ui-file-drag": "0.2.2-rc.2",
98
+ "@deepseek-ai/dsh-client-ui-context-menu": "0.2.2-rc.2"
99
99
  },
100
100
  "dependencies": {
101
101
  "@deepseek-ai/schemastery": "~3.19.0"
@@ -105,7 +105,10 @@
105
105
  "lib/index.js",
106
106
  "lib/client.js",
107
107
  "lib/assets",
108
- "lib/types/**/*.d.ts"
108
+ "lib/types/**/*.d.ts",
109
+ "lib/types/**/*.d.ts.map",
110
+ "lib/**/*.js.map",
111
+ "src"
109
112
  ],
110
113
  "scripts": {
111
114
  "bundle": "tsdown",
@@ -0,0 +1,98 @@
1
+ /** Chat display preferences stored in the Host user-settings document. */
2
+
3
+ import z from '@deepseek-ai/schemastery'
4
+
5
+ /** Settings namespace owned by the Chat target. */
6
+ export const CHAT_SETTINGS_NAMESPACE = 'ui-chat'
7
+
8
+ /** Field carrying the work-details presentation mode. */
9
+ export const TRANSCRIPT_VIEW_FIELD = 'transcriptView'
10
+
11
+ /** Field carrying the independent work-details collapse timing. */
12
+ export const COLLAPSE_TIMING_FIELD = 'collapseTiming'
13
+
14
+ /** Available points when a completed Turn returns to its historical presentation. */
15
+ export const COLLAPSE_TIMINGS = ['completion', 'next-input'] as const
16
+
17
+ /** When a completed Turn returns to its historical presentation. */
18
+ export type CollapseTiming = typeof COLLAPSE_TIMINGS[number]
19
+
20
+ /** Preserve completion-time folding when no timing preference is saved. */
21
+ export const DEFAULT_COLLAPSE_TIMING: CollapseTiming = 'completion'
22
+
23
+ /** Field carrying which Assistant replies stay visible in a folded Turn. */
24
+ export const FOLDED_REPLIES_FIELD = 'foldedReplies'
25
+
26
+ /** Assistant replies kept visible while a completed Turn folds its process: every reply, or only the final answer. */
27
+ export const FOLDED_REPLIES = ['all', 'final'] as const
28
+
29
+ /** Which Assistant replies stay visible while a completed Turn folds its process. */
30
+ export type FoldedReplies = typeof FOLDED_REPLIES[number]
31
+
32
+ /** Keep every Assistant reply visible when no folded-reply preference is saved. */
33
+ export const DEFAULT_FOLDED_REPLIES: FoldedReplies = 'all'
34
+
35
+ /** Work-details presentation modes a user can choose. */
36
+ export const TRANSCRIPT_VIEW_MODES = ['compact', 'standard', 'detailed', 'verbose'] as const
37
+
38
+ /** Work-details presentation mode. */
39
+ export type TranscriptViewMode = typeof TRANSCRIPT_VIEW_MODES[number]
40
+
41
+ /**
42
+ * Saved value from the two-mode generation of this setting. Read as `detailed`;
43
+ * never offered as a choice and never written back.
44
+ */
45
+ export const LEGACY_TRANSCRIPT_VIEW_MODE = 'normal'
46
+
47
+ /** Saved `expanded` values read as `detailed`, without being offered or written back. */
48
+ export const LEGACY_EXPANDED_TRANSCRIPT_VIEW_MODE = 'expanded'
49
+
50
+ /** Every value the durable field accepts: current modes plus legacy saved values. */
51
+ const TRANSCRIPT_VIEW_SETTING_VALUES = [
52
+ ...TRANSCRIPT_VIEW_MODES, LEGACY_TRANSCRIPT_VIEW_MODE, LEGACY_EXPANDED_TRANSCRIPT_VIEW_MODE,
53
+ ] as const
54
+
55
+ /** Default work details for non-Desktop Web clients. */
56
+ export const DEFAULT_TRANSCRIPT_VIEW_MODE: TranscriptViewMode = 'detailed'
57
+
58
+ /** Performance and usage detail levels accepted by user settings. */
59
+ export const PERFORMANCE_USAGE_MODES = ['compact', 'detailed'] as const
60
+
61
+ /** Performance and usage presentation. */
62
+ export type PerformanceUsageMode = typeof PERFORMANCE_USAGE_MODES[number]
63
+
64
+ /** Preserve detailed accounting for users without an explicit preference. */
65
+ export const DEFAULT_PERFORMANCE_USAGE: PerformanceUsageMode = 'detailed'
66
+
67
+ /** Destinations for ordinary clicks on Chat HTTP(S) links. */
68
+ export type LinkOpening = 'sidebar' | 'new-tab'
69
+
70
+ /** Preserve the built-in browser for users without an explicit preference. */
71
+ export const DEFAULT_LINK_OPENING: LinkOpening = 'sidebar'
72
+
73
+ /** Durable Chat section shared by the Host schema and browser scope. */
74
+ export interface ChatSettings {
75
+ /** Work-details preference; absence uses the client default, and legacy saved values remain accepted. */
76
+ transcriptView?: TranscriptViewMode | typeof LEGACY_TRANSCRIPT_VIEW_MODE | typeof LEGACY_EXPANDED_TRANSCRIPT_VIEW_MODE | null
77
+ /** Independent collapse timing; absence preserves completion-time folding. */
78
+ collapseTiming?: CollapseTiming
79
+ /** Replies kept visible in a folded Turn; absence keeps every reply. */
80
+ foldedReplies?: FoldedReplies
81
+ /** Detail level for composer statistics and completed-Turn usage. */
82
+ performanceUsage: PerformanceUsageMode
83
+ /** Default destination for Chat HTTP(S) links. */
84
+ linkOpening: LinkOpening
85
+ }
86
+
87
+ /** Durable Chat schema; also the wire envelope the browser scope validates against. */
88
+ export const ChatSettingsFields = {
89
+ [COLLAPSE_TIMING_FIELD]: z.union([...COLLAPSE_TIMINGS]).default(DEFAULT_COLLAPSE_TIMING),
90
+ [FOLDED_REPLIES_FIELD]: z.union([...FOLDED_REPLIES]).default(DEFAULT_FOLDED_REPLIES),
91
+ linkOpening: z.union(['sidebar', 'new-tab']).default(DEFAULT_LINK_OPENING),
92
+ performanceUsage: z.union([...PERFORMANCE_USAGE_MODES]).default(DEFAULT_PERFORMANCE_USAGE),
93
+ // Missing and unrecognized modes defer to the client's default.
94
+ [TRANSCRIPT_VIEW_FIELD]: z.union([...TRANSCRIPT_VIEW_SETTING_VALUES]).loose(),
95
+ }
96
+
97
+ /** Schema for shared configuration values. */
98
+ export const ChatSettingsSchema = z.object(ChatSettingsFields)
@@ -0,0 +1,355 @@
1
+ import type {} from '@deepseek-ai/dsh-client-ui-context-menu/client'
2
+ /** Register the Chat Conversation target, renderers, stats, and details surface. */
3
+ import type {} from '@deepseek-ai/dsh-client-ui-file-drag/client'
4
+ import type {} from '@deepseek-ai/dsh-client-product-analytics/client'
5
+ import type { Context } from '@deepseek-ai/cordis'
6
+ import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment'
7
+ import type {} from '@deepseek-ai/dsh-api-remotes/client'
8
+ import type { SessionBinding } from '@deepseek-ai/dsh-api-session-controller/client'
9
+ import type { GroupKey } from '@deepseek-ai/dsh-client-ui-conversation/client'
10
+ import { createSnapshotStore, type ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
11
+ import type { SessionId } from '@deepseek-ai/dsh-session/types'
12
+ import type {} from '@deepseek-ai/dsh-client-ui-sidebar-right/client'
13
+ import type {} from '@deepseek-ai/dsh-client-ui-sidebar-browser/client'
14
+ import type {} from '@deepseek-ai/dsh-client-ui-input-trigger/client'
15
+ // The `file` entry of `SidebarRightResourceParamsMap`, which types `{ params: { line } }` below.
16
+ import type {} from '@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client'
17
+ import { fileAddressFor, resolveWorkspacePath } from '@deepseek-ai/dsh-util-workspace-path'
18
+ // Type-only service and declaration merges used by the apply world.
19
+ import type {} from '@deepseek-ai/dsh-client-locale/client'
20
+ import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
21
+ import type {} from '@deepseek-ai/dsh-client-ui-layout/client'
22
+ import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
23
+ import type {} from '@deepseek-ai/dsh-client-ui-session/client'
24
+ import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
25
+ import type {} from '@deepseek-ai/dsh-client-ui-workspace/client'
26
+ import type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'
27
+ import type {
28
+ ChatFlowDataInjected, ChatFlowInjected, ChatNodeInjected, ChatScrollPosition, ChatViewInjected,
29
+ QuotaNoticeInjected, QuotaNoticeState,
30
+ } from './contract/slots.ts'
31
+ import type { ChatSnapshot } from './contract/snapshot.ts'
32
+ import { EMPTY_CHAT_SNAPSHOT } from './contract/snapshot.ts'
33
+ import { ApprovalCommand } from './chat/ApprovalCommand.tsx'
34
+ import { sessionFilePath } from './file-path.ts'
35
+ import { ChatView } from './chat/ChatView.tsx'
36
+ import { ChatFlow } from './chat/ChatFlow.tsx'
37
+ import { registerChatNodeRenderers } from './chat/register-node-renderers.ts'
38
+ import { UserContent } from './chat/UserContent.tsx'
39
+ import { ActivityPill, UsagePill } from './chat/StatsPills.tsx'
40
+ import { registerConversationNodes } from './conversation-nodes/register.ts'
41
+ import { registerFenceLayers } from './fence/register.ts'
42
+ import { QuotaNoticeHost } from './chat/QuotaNoticeHost.tsx'
43
+ import { en, ja, es, fr, de, ru, pt, NS, zh } from './locale.ts'
44
+ import { TranscriptViewRow, type TranscriptViewRowInjected } from './settings/TranscriptViewRow.tsx'
45
+ import { createChatStore } from './stores.ts'
46
+ import { TranscriptViewPolicy } from './transcript-view.ts'
47
+ import { derivePresentationPolicy } from './presentation-policy.ts'
48
+ import { CHAT_SETTINGS_NAMESPACE, DEFAULT_LINK_OPENING, DEFAULT_TRANSCRIPT_VIEW_MODE, type ChatSettings } from '../chat-settings.ts'
49
+ import { LinkOpeningRow, type LinkOpeningRowInjected } from './settings/LinkOpeningRow.tsx'
50
+ import { PerformanceUsageRow, type PerformanceUsageRowInjected } from './settings/PerformanceUsageRow.tsx'
51
+ import { PerformanceUsagePolicy } from './performance-usage.ts'
52
+ import { useTurnDataValue } from './chat/use-turn-data.ts'
53
+ import { bindDisclosure } from './chat/use-disclosure.ts'
54
+ import { useFlowHidden, useMotionHidden } from './chat/flow-motion.ts'
55
+
56
+ /** Bind group and header visibility to the viewport of one flow render. */
57
+ export const CHAT_FLOW_INJECT: ChatFlowInjected = {
58
+ hooks: {
59
+ groupAction: (_standard, { motion }) => function useGroupAction(hidden, reveal) {
60
+ return useFlowHidden(hidden, reveal, motion)
61
+ },
62
+ groupHeaderAction: (_standard, { motion }) => function useGroupHeaderAction(ref, hidden) {
63
+ useMotionHidden(ref, hidden, motion)
64
+ },
65
+ },
66
+ }
67
+
68
+ /** Bind node-local sources and forward the flow's existing visibility hook. */
69
+ export const CHAT_NODE_INJECT: ChatNodeInjected = {
70
+ hooks: {
71
+ turnData: (_standard, { turnData }) => function useTurnData(key) {
72
+ return useTurnDataValue(turnData, key)
73
+ },
74
+ disclosure: (_standard, { disclosureReset }) => bindDisclosure(disclosureReset),
75
+ groupAction: (_standard, { useGroupAction }) => useGroupAction,
76
+ },
77
+ }
78
+
79
+ /** Services required by the Chat target and its presentation registrations. */
80
+ export const inject = [
81
+ 'slots', 'sessions', 'uiWorkspace', 'uiSession', 'uiConversation', 'locale',
82
+ 'configForms', 'connection', 'remote', 'remote.session', 'sidebarRight', 'fileDrag',
83
+ ]
84
+
85
+ /**
86
+ * Mount all Chat-owned contributions.
87
+ * @param ctx - Client root context.
88
+ */
89
+ export function apply(ctx: Context): void {
90
+ const quotaNotice = createSnapshotStore<QuotaNoticeState | null>(null)
91
+ let quotaNoticeSeq = 0
92
+ // Each hold is its own token, so a release can only drop the hold it was
93
+ // issued for: one arriving after a dismissal or a later acquisition leaves
94
+ // that newer hold alone.
95
+ const quotaNoticeHolds = new Set<symbol>()
96
+ const chatSources = new WeakMap<SessionBinding, ObservableSnapshot<ChatSnapshot>>()
97
+ const quotaSubscriptions = new Set<() => Promise<void>>()
98
+ ctx.effect(() => async () => {
99
+ await Promise.all([...quotaSubscriptions].map(dispose => dispose()))
100
+ }, 'ui-chat: live quota notices')
101
+ const chatSource = (binding: SessionBinding): ObservableSnapshot<ChatSnapshot> => {
102
+ let source = chatSources.get(binding)
103
+ if (source === undefined) {
104
+ // One live quota failure publishes one frame-wide notice; history
105
+ // replacement or paging never does, because an old failure scrolling
106
+ // back into view is not news.
107
+ const dispose = binding.ctx.effect(() => {
108
+ const stop = binding.eventSource.subscribe(() => {
109
+ const { change } = binding.eventSource.getSnapshot()
110
+ if (change.kind !== 'append') return
111
+ for (const { event } of change.entries) {
112
+ if (event.type !== 'turn/end' || event.data.reason.kind !== 'error') continue
113
+ const { code } = event.data.reason.error
114
+ if (quotaNoticeHolds.size > 0 || (code !== 'QUOTA' && code !== 'ACCOUNT_QUOTA')) continue
115
+ quotaNotice.set({ code, seq: ++quotaNoticeSeq })
116
+ }
117
+ })
118
+ return () => {
119
+ stop()
120
+ chatSources.delete(binding)
121
+ quotaSubscriptions.delete(dispose)
122
+ }
123
+ }, 'ui-chat: Provider binding quota notices')
124
+ quotaSubscriptions.add(dispose)
125
+ const target = ctx.uiConversation.binding(binding).target('chat')
126
+ source = {
127
+ getSnapshot: () => target.getSnapshot() ?? EMPTY_CHAT_SNAPSHOT,
128
+ subscribe: listener => target.subscribe(listener),
129
+ }
130
+ chatSources.set(binding, source)
131
+ }
132
+ return source
133
+ }
134
+ registerConversationNodes(ctx)
135
+ ctx.uiSession.provide({
136
+ hooks: ['chat'],
137
+ resolve: binding => ({ hooks: { chat: chatSource(binding) } }),
138
+ })
139
+
140
+ ctx.effect(() => ctx.locale.register(NS, { zh, en, ja, es, fr, de, ru, pt }), 'ui-chat: dictionaries')
141
+ const t = ctx.locale.bind(NS)
142
+ const chatStore = createChatStore()
143
+ const chatScrollPositions = new Map<SessionId, ChatScrollPosition>()
144
+ const chatSettings = ctx.configForms.get<ChatSettings>(CHAT_SETTINGS_NAMESPACE)
145
+ const linkOpening = createSnapshotStore(chatSettings.getSnapshot().value?.linkOpening ?? DEFAULT_LINK_OPENING)
146
+ ctx.effect(() => chatSettings.subscribe(() => {
147
+ const accepted = chatSettings.getSnapshot().value?.linkOpening
148
+ if (accepted !== undefined) linkOpening.set(accepted)
149
+ }))
150
+ ctx.inject(['sidebarRightTabs'], (scope) => {
151
+ const tabs = scope.sidebarRightTabs
152
+ const browserAvailable: ObservableSnapshot<boolean> = {
153
+ getSnapshot: () => tabs.get('browser') !== undefined,
154
+ subscribe: listener => tabs.subscribe(listener),
155
+ }
156
+ scope.slots.inject('settings.general.item', () => scope.slots.register({
157
+ name: 'settings.general.item',
158
+ id: 'link-opening',
159
+ order: 17,
160
+ locale: NS,
161
+ inject: (): LinkOpeningRowInjected => ({
162
+ hooks: { linkOpening, browserAvailable },
163
+ setLinkOpening: (destination) => {
164
+ linkOpening.set(destination)
165
+ void chatSettings.set('linkOpening', destination).catch((_error: unknown) => {
166
+ // The local choice remains usable when persistence is unavailable.
167
+ })
168
+ },
169
+ }),
170
+ }, LinkOpeningRow))
171
+ })
172
+ const transcriptView = new TranscriptViewPolicy(chatSettings, 'dshDesktop' in globalThis ? 'standard' : DEFAULT_TRANSCRIPT_VIEW_MODE)
173
+ const presentation = derivePresentationPolicy(transcriptView.mode, transcriptView.collapseTiming, transcriptView.foldedReplies)
174
+ const performancePolicy = new PerformanceUsagePolicy(chatSettings)
175
+ ctx.effect(() => () => { transcriptView.dispose(); performancePolicy.dispose() })
176
+ const performanceUsage = performancePolicy.mode
177
+ registerChatNodeRenderers(ctx, performanceUsage, presentation)
178
+ ctx.slots.registerFactory({
179
+ name: 'conversation.chat.user.content', scope: 'session', locale: NS,
180
+ children: { 'conversation.chat.user.images': { kind: 'single', scope: 'session' } },
181
+ }, UserContent)
182
+
183
+ ctx.slots.inject('settings.general.item', () => ctx.slots.register({
184
+ name: 'settings.general.item',
185
+ id: 'performance-usage',
186
+ order: 30,
187
+ locale: NS,
188
+ inject: (): PerformanceUsageRowInjected => ({
189
+ hooks: { performanceUsage },
190
+ setPerformanceUsage: (mode) => { performancePolicy.setMode(mode) },
191
+ }),
192
+ }, PerformanceUsageRow))
193
+
194
+ ctx.slots.inject('settings.general.item', () => ctx.slots.register({
195
+ name: 'settings.general.item',
196
+ id: 'transcript-view',
197
+ order: 12,
198
+ locale: NS,
199
+ inject: (): TranscriptViewRowInjected => ({
200
+ hooks: {
201
+ transcriptView: transcriptView.mode,
202
+ collapseTiming: transcriptView.collapseTiming,
203
+ foldedReplies: transcriptView.foldedReplies,
204
+ },
205
+ setTranscriptView: (mode) => { transcriptView.setMode(mode) },
206
+ setCollapseTiming: (timing) => { transcriptView.setCollapseTiming(timing) },
207
+ setFoldedReplies: (replies) => { transcriptView.setFoldedReplies(replies) },
208
+ }),
209
+ }, TranscriptViewRow))
210
+
211
+ const connectionState = (ctx.get('connection') as ConnectionHandle).state
212
+ const nodeSources = (binding: SessionBinding): Pick<ChatViewInjected, 'keyedHooks'> => {
213
+ const chat = chatSource(binding)
214
+ const conversation = ctx.uiConversation.binding(binding)
215
+ return {
216
+ keyedHooks: {
217
+ chatNode: key => chat.getSnapshot().nodes.source(key),
218
+ chatNodeBottom: key => chat.getSnapshot().nodes.bottomSource(key),
219
+ chatNodeProcess: key => chat.getSnapshot().nodes.processSource(key),
220
+ chatGroup: key => conversation.snapshot.getSnapshot().views.grouped('chat')?.groupSource(key as GroupKey),
221
+ },
222
+ }
223
+ }
224
+
225
+ ctx.slots.inject('conversation.chat.flow', () => ctx.slots.register({
226
+ name: 'conversation.chat.flow', locale: NS, store: chatStore,
227
+ children: {
228
+ 'conversation.chat.node': { kind: 'keyed', scope: 'session', inject: CHAT_NODE_INJECT },
229
+ },
230
+ inject: (sessionId: SessionId): ChatFlowDataInjected => {
231
+ const binding = ctx.sessions.binding(sessionId)
232
+ if (binding === undefined) throw new Error(`ui-chat: unknown session "${sessionId}"`)
233
+ return { ...nodeSources(binding), hooks: { presentation, connectionState } }
234
+ },
235
+ }, ChatFlow))
236
+
237
+ ctx.slots.inject('conversation.view', () => {
238
+ const disposeView = ctx.slots.register({
239
+ name: 'conversation.view',
240
+ id: 'chat',
241
+ order: 0,
242
+ label: () => t('view.chat'),
243
+ locale: NS,
244
+ children: {
245
+ 'conversation.chat.flow': { kind: 'single', scope: 'session', inject: CHAT_FLOW_INJECT },
246
+ 'conversation.chat.text-interaction': { kind: 'keyed', scope: 'session' },
247
+ 'conversation.chat.markdown.fence': { kind: 'hoc', scope: 'session' },
248
+ },
249
+ store: chatStore,
250
+ inject: (sessionId: SessionId): ChatViewInjected => {
251
+ const binding = ctx.sessions.binding(sessionId)
252
+ if (binding === undefined) throw new Error(`ui-chat: unknown session "${sessionId}"`)
253
+ const session = binding.session
254
+ const chat = chatSource(binding)
255
+ return {
256
+ ...nodeSources(binding),
257
+ fileDrag: ctx.fileDrag.actions,
258
+ hooks: { presentation, interactionIds: ctx.uiConversation.interactions },
259
+ dispatchInteraction: gesture => ctx.uiConversation.interactions.dispatch(sessionId, gesture),
260
+ // Files open in the right Sidebar, not in a desktop application: the
261
+ // content stays in the product, beside the conversation that produced
262
+ // it. A relative path resolves from the Session's working directory
263
+ // at click time, which a directory change can move away from the
264
+ // workspace root; links from earlier Turns follow later changes. A
265
+ // path inside the workspace is addressed under this
266
+ // session's scope, `dsh-resource://file/session/<id>/<path>`; an
267
+ // absolute path elsewhere keeps its absolute spelling in the same
268
+ // Session's address. Which tab type claims the address is the
269
+ // Sidebar's decision, not this call site's.
270
+ // A line travels as a navigation parameter, not as part of the
271
+ // address: the file is one piece of content whether it is opened at
272
+ // its top or at line 400, so the same tab is revealed and told where
273
+ // to land.
274
+ openFile: async (path, options) => {
275
+ const cwd = ctx.sessions.list.getSnapshot().byId[sessionId]?.cwd
276
+ const current = session.projections.faceOf('workingDirectory').getSnapshot() as string | null | undefined
277
+ const url = fileAddressFor(sessionId, cwd, resolveWorkspacePath(current ?? undefined, path))
278
+ if (options?.line === undefined) ctx.sidebarRight.openResource(url)
279
+ else ctx.sidebarRight.openResource(url, { params: { line: options.line } })
280
+ await Promise.resolve()
281
+ },
282
+ resolveFilePath: sessionFilePath(ctx, sessionId),
283
+ openExternalLink: (url) => {
284
+ if (linkOpening.getSnapshot() === 'sidebar' && ctx.get('sidebarRightTabs')?.get('browser') !== undefined) {
285
+ ctx.sidebarRight.openTab('browser', { params: { url } })
286
+ } else {
287
+ window.open(url, '_blank', 'noopener,noreferrer')
288
+ }
289
+ },
290
+ loadOlder: () => { void session.loadOlder({ deferConsumption: true }) },
291
+ consumeOlder: () => session.consumeOlder(),
292
+ loadThrough: seq => session.loadThrough(seq),
293
+ loadImage: Object.assign(
294
+ (attachment: ImageAttachmentRef) => ctx.uiConversation.imageUrl(sessionId, attachment),
295
+ { peek: (attachment: ImageAttachmentRef) => ctx.uiConversation.peekImageUrl(sessionId, attachment) },
296
+ ),
297
+ chatScroll: {
298
+ save: (position) => {
299
+ if (position === null) chatScrollPositions.delete(sessionId)
300
+ else chatScrollPositions.set(sessionId, position)
301
+ },
302
+ read: () => chatScrollPositions.get(sessionId) ?? null,
303
+ },
304
+ forkAt: (seq) => {
305
+ const turn = [...chat.getSnapshot().timeline.turns.values()].find(turn => turn.end?.seq === seq)
306
+ const messageId = turn?.data.get('turn-tail')?.closing?.finalNode.messageId
307
+ ctx.sessions.fork({ sessionId, atSeq: seq, increaseTitle: true, onCreated: (childId) => {
308
+ ctx.get('productAnalytics')?.track('branch_session_click', { session_id: childId, parent_session_id: sessionId, ...messageId === undefined ? {} : { parent_message_id: messageId }, click_position: 'footer' })
309
+ } })
310
+ .then((childId) => { ctx.uiWorkspace.openSession(childId) })
311
+ .catch(() => {
312
+ // Fork or child-title failure leaves the source view unchanged.
313
+ })
314
+ },
315
+ }
316
+ },
317
+ }, ChatView)
318
+ return disposeView
319
+ })
320
+ registerFenceLayers(ctx)
321
+
322
+ // The quota notice host lives in the frame-wide layer so a notice outlives
323
+ // the Chat panel that reported it. Its chain child lets a package with a
324
+ // billing surface claim the one live notice without importing Chat.
325
+ ctx.slots.inject('shell.overlay', () => ctx.slots.register({
326
+ name: 'shell.overlay', id: 'chat.quota-notice', locale: NS,
327
+ children: { 'shell.quota-notice': { kind: 'chain', scope: 'root' } },
328
+ inject: (): QuotaNoticeInjected => ({
329
+ hooks: { notice: quotaNotice },
330
+ dismissNotice: () => { quotaNoticeHolds.clear(); quotaNotice.set(null) },
331
+ keepNoticeOpen: () => {
332
+ // Nothing live to retain: later failures must still publish.
333
+ if (quotaNotice.getSnapshot() === null) return () => {}
334
+ const token = Symbol('ui-chat quota notice hold')
335
+ quotaNoticeHolds.add(token)
336
+ return () => { quotaNoticeHolds.delete(token) }
337
+ },
338
+ }),
339
+ }, QuotaNoticeHost))
340
+
341
+ // One dock entry per pill, so a plugin replaces or adds a single pill by id.
342
+ const statPillInject = () => ({ hooks: { performanceUsage } })
343
+ ctx.slots.inject('conversation.composer.dock', function* () {
344
+ yield ctx.slots.register({
345
+ name: 'conversation.composer.dock', id: 'activity', order: 0, locale: NS, inject: statPillInject,
346
+ }, ActivityPill)
347
+ yield ctx.slots.register({
348
+ name: 'conversation.composer.dock', id: 'usage', order: 1, locale: NS, inject: statPillInject,
349
+ }, UsagePill)
350
+ })
351
+
352
+ ctx.slots.inject('conversation.approval.detail', () =>
353
+ ctx.slots.register({ name: 'conversation.approval.detail' }, ApprovalCommand))
354
+
355
+ }
@@ -0,0 +1,42 @@
1
+ /** Chat-owned approval detail resolving a correlated Tool call's command. */
2
+ import type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
3
+ import type {} from '@deepseek-ai/dsh-client-ui-approval/client'
4
+ import type { ChatNode } from '../contract/chat-nodes.ts'
5
+
6
+ interface ApprovalToolCall {
7
+ readonly callId: string
8
+ readonly name: string
9
+ readonly argsRaw: string
10
+ }
11
+
12
+ /**
13
+ * Extract the command line from a correlated Tool call: a shell `command`, or the text `terminal_send` types into a terminal.
14
+ * @param call - Tool call name and arguments, when a correlated call exists.
15
+ * @returns command text, or undefined for absent, empty, malformed, or unrelated arguments.
16
+ */
17
+ export function commandOf(call: ApprovalToolCall | undefined): string | undefined {
18
+ if (call === undefined) return undefined
19
+ try {
20
+ const args = JSON.parse(call.argsRaw) as Record<string, unknown>
21
+ const command = call.name === 'terminal_send' ? args.text : args.command
22
+ return typeof command === 'string' && command.length > 0 ? command : undefined
23
+ } catch {
24
+ return undefined
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Render the command of the Chat Tool node correlated with an approval.
30
+ * @param props - Approval identity and Session-standard Chat selector hook.
31
+ * @returns command text when the correlated call carries one.
32
+ */
33
+ export function ApprovalCommand({ callId, useChat }: PropsRuntime<'conversation.approval.detail'>) {
34
+ const command = useChat((snapshot) => {
35
+ for (const node of snapshot.nodes.values()) {
36
+ const root = node.kind === 'tool-call' ? (node as ChatNode<'tool-call'>).data.root : undefined
37
+ if (root !== undefined && root.callId === callId && !('kind' in root) && root.phase === 'start') return commandOf(root)
38
+ }
39
+ return undefined
40
+ })
41
+ return command ?? null
42
+ }