@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,592 @@
1
+ // Expanded bodies for the context disclosure, one per durable context form.
2
+ // The producer declares the form; this module only chooses a presentation for
3
+ // it. Every form falls back to OpaqueBody, which is the documented default for
4
+ // an absent, unknown, or malformed form — a resumed or foreign log must render
5
+ // even when this UI version has never seen its producer.
6
+
7
+ import type { ReactNode } from 'react'
8
+ import { JsonBlock } from '@deepseek-ai/dsh-client-ui-primitives'
9
+ import type { ChatViewSlotProps } from '../contract/slots.ts'
10
+ import type { ContextMessageNode } from '../contract/snapshot.ts'
11
+ import type { KnownContextForm } from '@deepseek-ai/dsh-client-ui-conversation/client'
12
+ import css from './ContextBody.module.css'
13
+
14
+ /** Model-facing text stays bounded at the disclosure, not at the producer. */
15
+ const MAX_CHARS = 20_000
16
+
17
+ /** Rows a list body materializes before summarizing the remainder. */
18
+ const MAX_ENTRIES = 200
19
+
20
+ type Translate = ChatViewSlotProps['t']
21
+
22
+ /** One durable source narrowed to the readable-record shape; null for anything else. */
23
+ function asRecord(value: unknown): Record<string, unknown> | null {
24
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
25
+ ? value as Record<string, unknown>
26
+ : null
27
+ }
28
+
29
+ /** One run of the model-facing content: adjacent text, or one unknown block. */
30
+ type ContentRun = { text: string } | { block: unknown }
31
+
32
+ /**
33
+ * The content blocks as runs, IN THE ORDER the model received them.
34
+ *
35
+ * Adjacent text blocks join with no separator, matching how provider adapters
36
+ * flatten them — inserting a line break would show the reader a line the model
37
+ * never saw. An unknown block breaks the run and keeps its own fallback rather
38
+ * than being hoisted past the text around it or vanishing; the block union is
39
+ * merge-extensible, so a foreign log may interleave shapes this build does not
40
+ * know.
41
+ */
42
+ function contentRuns(content: ContextMessageNode['content']): ContentRun[] {
43
+ const runs: ContentRun[] = []
44
+ for (const block of content) {
45
+ if (block.type !== 'text') {
46
+ runs.push({ block })
47
+ continue
48
+ }
49
+ const last = runs[runs.length - 1]
50
+ if (last !== undefined && 'text' in last) last.text += block.text
51
+ else runs.push({ text: block.text })
52
+ }
53
+ return runs
54
+ }
55
+
56
+ /** Only the blocks this UI version does not know, for bodies that replace the text. */
57
+ function unknownBlocks(content: ContextMessageNode['content']): unknown[] {
58
+ return contentRuns(content).flatMap(run => 'block' in run ? [run.block] : [])
59
+ }
60
+
61
+ /** The model-facing text, truncated to the display bound. */
62
+ function boundedText(text: string, t: Translate): string {
63
+ return text.length > MAX_CHARS
64
+ ? `${text.slice(0, MAX_CHARS)}\n${t('json.truncated', { total: text.length })}`
65
+ : text
66
+ }
67
+
68
+ /**
69
+ * One source field rendered as a value row; nested shapes stay compact JSON.
70
+ * Bounded on its own, because source fields are as unbounded as the text: an unknown
71
+ * producer may record an arbitrarily large string or array.
72
+ */
73
+ function fieldValue(value: unknown, t: Translate): string {
74
+ const text = typeof value === 'string'
75
+ ? value
76
+ : typeof value === 'number' || typeof value === 'boolean' ? String(value) : JSON.stringify(value)
77
+ return boundedText(text, t)
78
+ }
79
+
80
+ /**
81
+ * Source fields as a key/value list. `kind` is always omitted because the
82
+ * row header already names the producer. `form` is omitted only when a
83
+ * dedicated body rendered for it — then the presentation the reader is looking
84
+ * at IS that value. On the opaque fallback the declaration is kept, because
85
+ * that is the one place a form this version cannot present would otherwise
86
+ * disappear from the UI entirely.
87
+ */
88
+ function SourceFields({ source, formRendered, t }: {
89
+ source: unknown
90
+ formRendered: boolean
91
+ t: Translate
92
+ }): ReactNode {
93
+ const record = asRecord(source)
94
+ if (record === null) return null
95
+ const hidden = formRendered ? ['kind', 'form'] : ['kind']
96
+ const rows = Object.entries(record).filter(([key]) => !hidden.includes(key))
97
+ if (rows.length === 0) return null
98
+ return (
99
+ <dl className={css.fields} data-context-fields>
100
+ {rows.map(([key, value]) => (
101
+ <div key={key} className={css.field}>
102
+ <dt className={css.fieldKey}>{key}</dt>
103
+ <dd className={css.fieldValue}>{fieldValue(value, t)}</dd>
104
+ </div>
105
+ ))}
106
+ </dl>
107
+ )
108
+ }
109
+
110
+ /**
111
+ * Content blocks this UI version does not know, kept visible rather than
112
+ * dropped: the block union is merge-extensible, so a newer or foreign log may
113
+ * carry a shape this build has no presentation for.
114
+ * @param props - The unrecognized blocks and the locale seat.
115
+ * @returns One generic JSON block per unknown entry.
116
+ */
117
+ function UnknownBlocks({ blocks, t }: { blocks: readonly unknown[]; t: Translate }): ReactNode {
118
+ return (
119
+ <>
120
+ {blocks.map((block, index) => (
121
+ <JsonBlock
122
+ key={index}
123
+ label={t('message.unknownBlock')}
124
+ payload={block}
125
+ truncatedLabel={total => t('json.truncated', { total })}
126
+ />
127
+ ))}
128
+ </>
129
+ )
130
+ }
131
+
132
+ /**
133
+ * The model-facing content of one context, shared by every form that shows it:
134
+ * the text with its real line breaks, then any block this UI version does not
135
+ * know, which keeps its own fallback rather than vanishing.
136
+ * @param props - Durable content and the locale seat.
137
+ * @returns The content blocks as the model received them.
138
+ */
139
+ function ModelFacingContent({ content, t }: {
140
+ content: ContextMessageNode['content']
141
+ t: Translate
142
+ }): ReactNode {
143
+ return (
144
+ <>
145
+ {contentRuns(content).map((run, index) => ('text' in run
146
+ ? run.text !== '' && (
147
+ <pre key={index} className={css.text} data-context-text>{boundedText(run.text, t)}</pre>
148
+ )
149
+ : (
150
+ <JsonBlock
151
+ key={index}
152
+ label={t('message.unknownBlock')}
153
+ payload={run.block}
154
+ truncatedLabel={total => t('json.truncated', { total })}
155
+ />
156
+ )))}
157
+ </>
158
+ )
159
+ }
160
+
161
+ /**
162
+ * Default presentation: the model-facing text as text, with its real line
163
+ * breaks, and the remaining source fields beneath it. This is what every form
164
+ * this UI version does not recognize renders as.
165
+ * @param props - Durable content, its source, and the locale seat.
166
+ * @returns The opaque context body.
167
+ */
168
+ export function OpaqueBody({ content, source, t }: {
169
+ content: ContextMessageNode['content']
170
+ source: unknown
171
+ t: Translate
172
+ }): ReactNode {
173
+ return (
174
+ <>
175
+ <ModelFacingContent content={content} t={t} />
176
+ <SourceFields source={source} formRendered={false} t={t} />
177
+ </>
178
+ )
179
+ }
180
+
181
+ /** One reconciled instruction file, as the durable source records it. */
182
+ interface InstructionChange {
183
+ action: 'set' | 'replace' | 'remove'
184
+ path: string
185
+ digest?: string
186
+ }
187
+
188
+ /**
189
+ * Instruction changes read off the source, or null when the record is not a
190
+ * usable instruction list.
191
+ *
192
+ * The read is all-or-nothing: silently dropping one unreadable entry would show
193
+ * a confident, incomplete file list for a log this version cannot fully read.
194
+ * Paths are deduplicated in first-seen order, matching how the header label is
195
+ * derived from the same array.
196
+ */
197
+ function instructionChanges(source: unknown): InstructionChange[] | null {
198
+ const record = asRecord(source)
199
+ const list = record === null ? undefined : record['changes']
200
+ if (!Array.isArray(list)) return null
201
+ const changes: InstructionChange[] = []
202
+ const seen = new Set<string>()
203
+ for (const entry of list as readonly unknown[]) {
204
+ const change = asRecord(entry)
205
+ if (change === null) return null
206
+ const path = change['path']
207
+ if (typeof path !== 'string' || path === '') return null
208
+ const action = change['action']
209
+ // The action decides which word the row shows, so an unrecognized one is
210
+ // not a readable change — it would be presented as loaded or updated.
211
+ if (action !== 'set' && action !== 'replace' && action !== 'remove') return null
212
+ const digest = change['digest']
213
+ if (seen.has(path)) continue
214
+ seen.add(path)
215
+ changes.push({ action, path, ...typeof digest === 'string' ? { digest } : {} })
216
+ }
217
+ return changes.length === 0 ? null : changes
218
+ }
219
+
220
+ /**
221
+ * Locale key for one reconciled file. The baseline loads a file; a later delta
222
+ * distinguishes a newly reconciled path from a rewritten one, which `set` and
223
+ * `replace` already separate at the producer.
224
+ * @param action - the durable change action.
225
+ * @param baseline - whether this context is the startup/resume baseline.
226
+ * @returns the key naming what happened to that file.
227
+ */
228
+ function instructionAction(
229
+ action: InstructionChange['action'],
230
+ baseline: boolean,
231
+ ): 'message.context.instructions.removed' | 'message.context.instructions.loaded'
232
+ | 'message.context.instructions.added' | 'message.context.instructions.updated' {
233
+ if (action === 'remove') return 'message.context.instructions.removed'
234
+ if (baseline) return 'message.context.instructions.loaded'
235
+ return action === 'set' ? 'message.context.instructions.added' : 'message.context.instructions.updated'
236
+ }
237
+
238
+ /**
239
+ * `instructions` form: the files this context reconciled, then their text.
240
+ *
241
+ * The text keeps its `<system-reminder>` framing verbatim — the framing is part
242
+ * of what the model read, so hiding it would misreport the request.
243
+ * @param props - Durable content, its source, and the locale seat.
244
+ * @returns The instructions context body, or the opaque body when the change
245
+ * list is unreadable.
246
+ */
247
+ export function InstructionsBody({ content, source, t }: {
248
+ content: ContextMessageNode['content']
249
+ source: unknown
250
+ t: Translate
251
+ }): ReactNode {
252
+ const changes = instructionChanges(source)
253
+ if (changes === null) return <OpaqueBody content={content} source={source} t={t} />
254
+ const baseline = asRecord(source)?.['baseline'] === true
255
+ return (
256
+ <>
257
+ <ul className={css.files} data-context-files>
258
+ {changes.map(change => (
259
+ <li key={change.path} className={css.file} title={change.digest}>
260
+ <span className={css.filePath}>{change.path}</span>
261
+ <span className={css.fileAction}>
262
+ {t(instructionAction(change.action, baseline))}
263
+ </span>
264
+ </li>
265
+ ))}
266
+ </ul>
267
+ <ModelFacingContent content={content} t={t} />
268
+ </>
269
+ )
270
+ }
271
+
272
+ /** One catalog entry, as the durable source records it. */
273
+ interface CatalogEntry {
274
+ name: string
275
+ description: string
276
+ }
277
+
278
+ /**
279
+ * Catalog entries read off the source, or null when the record is not a usable
280
+ * catalog. All-or-nothing for the same reason as the instruction list: this body
281
+ * replaces the model-facing text, so a partial list would hide the only complete
282
+ * account of what the model read.
283
+ */
284
+ function catalogEntries(source: unknown): CatalogEntry[] | null {
285
+ const record = asRecord(source)
286
+ const list = record === null ? undefined : record['entries']
287
+ if (!Array.isArray(list)) return null
288
+ const entries: CatalogEntry[] = []
289
+ for (const item of list as readonly unknown[]) {
290
+ const entry = asRecord(item)
291
+ if (entry === null) return null
292
+ const name = entry['name']
293
+ const description = entry['description']
294
+ if (typeof name !== 'string' || name === '' || typeof description !== 'string') return null
295
+ entries.push({ name, description })
296
+ }
297
+ // An empty list is a real catalog: a replacement with no entries retires
298
+ // every earlier name. Only an unreadable shape falls back.
299
+ return entries
300
+ }
301
+
302
+ /**
303
+ * `catalog` form: the published entries as a list, read from the source rather
304
+ * than re-parsed out of the model-facing prose.
305
+ *
306
+ * A catalog whose source carries no usable entries falls through to the opaque
307
+ * body, so an older or hand-edited log still shows its text.
308
+ * @param props - Durable content, its source, and the locale seat.
309
+ * @returns The catalog context body, or the opaque body when the entry list is
310
+ * unreadable.
311
+ */
312
+ export function CatalogBody({ content, source, t }: {
313
+ content: ContextMessageNode['content']
314
+ source: unknown
315
+ t: Translate
316
+ }): ReactNode {
317
+ const entries = catalogEntries(source)
318
+ if (entries === null) return <OpaqueBody content={content} source={source} t={t} />
319
+ const update = asRecord(source)?.['update'] === true
320
+ // Entry count is unbounded (a provider may publish any number of skills), and
321
+ // the scrollport bounds height, not node count — so the list bounds itself.
322
+ const shown = entries.slice(0, MAX_ENTRIES)
323
+ const rest = unknownBlocks(content)
324
+ return (
325
+ <>
326
+ {update && <p className={css.catalogNotice} data-context-catalog-update>{t('message.context.catalog.replaced')}</p>}
327
+ <ul className={css.entries} data-context-entries>
328
+ {shown.map((entry, index) => (
329
+ // Index key: a hand-edited or foreign log may repeat a name, and a
330
+ // duplicate React key would drop a row the model did see.
331
+ <li key={index} className={css.entry}>
332
+ <code className={css.entryName}>{entry.name}</code>
333
+ <span className={css.entryDescription}>{entry.description}</span>
334
+ </li>
335
+ ))}
336
+ </ul>
337
+ {shown.length < entries.length && (
338
+ <p className={css.catalogNotice} data-context-entries-truncated>
339
+ {t('message.context.catalog.more', { count: entries.length - shown.length })}
340
+ </p>
341
+ )}
342
+ {/* The block union is merge-extensible: a catalog message carrying an
343
+ unknown block still shows it rather than dropping model-visible content. */}
344
+ <UnknownBlocks blocks={rest} t={t} />
345
+ </>
346
+ )
347
+ }
348
+
349
+ /** One named contribution to a runtime snapshot, as the durable source records it. */
350
+ interface SnapshotSection {
351
+ name: string
352
+ text: string
353
+ }
354
+
355
+ /** Snapshot sections read off the source, or null when the record is unusable. */
356
+ function snapshotSections(source: unknown): SnapshotSection[] | null {
357
+ const record = asRecord(source)
358
+ const list = record === null ? undefined : record['sections']
359
+ if (!Array.isArray(list)) return null
360
+ const sections: SnapshotSection[] = []
361
+ for (const item of list as readonly unknown[]) {
362
+ const section = asRecord(item)
363
+ if (section === null) return null
364
+ const name = section['name']
365
+ const text = section['text']
366
+ if (typeof name !== 'string' || name === '' || typeof text !== 'string') return null
367
+ sections.push({ name, text })
368
+ }
369
+ return sections.length === 0 ? null : sections
370
+ }
371
+
372
+ /**
373
+ * `snapshot` form: the named contributions this snapshot assembled, in order.
374
+ *
375
+ * The sections are the same bytes the model read, split at the boundaries the
376
+ * producer assembled them on, so a reader sees which subsystem contributed
377
+ * which state instead of one undifferentiated wall.
378
+ *
379
+ * One sentence of the model-facing text is NOT in any section: the producer's
380
+ * framing line declaring that this snapshot supersedes earlier ones. Unlike the
381
+ * `<system-reminder>` wrapper an instruction context carries — which wraps
382
+ * content and cannot be separated from it — that line states the form's own
383
+ * semantics, so the body states them as a caption instead of reprinting the
384
+ * joined prose beside the sections it was split from.
385
+ * @param props - Durable content, its source, and the locale seat.
386
+ * @returns The snapshot context body, or the opaque body when unreadable.
387
+ */
388
+ export function SnapshotBody({ content, source, t }: {
389
+ content: ContextMessageNode['content']
390
+ source: unknown
391
+ t: Translate
392
+ }): ReactNode {
393
+ const sections = snapshotSections(source)
394
+ /* v8 ignore next -- contextBody reads the sections before choosing this body. */
395
+ if (sections === null) return <OpaqueBody content={content} source={source} t={t} />
396
+ return (
397
+ <>
398
+ <p className={css.catalogNotice} data-context-snapshot-supersedes>
399
+ {t('message.context.snapshot.supersedes')}
400
+ </p>
401
+ <dl className={css.sections} data-context-sections>
402
+ {sections.map((section, index) => (
403
+ <div key={index} className={css.section}>
404
+ <dt className={css.sectionName}>{section.name}</dt>
405
+ <dd className={css.sectionText}>{boundedText(section.text, t)}</dd>
406
+ </div>
407
+ ))}
408
+ </dl>
409
+ </>
410
+ )
411
+ }
412
+
413
+ /**
414
+ * `notice` form: what just happened, with the model-facing text beneath it.
415
+ *
416
+ * The one-line account also rides the collapsed row ({@link contextBody}), so a
417
+ * notice is usually readable without expanding at all.
418
+ * @param props - Durable content, its source, and the locale seat.
419
+ * @returns The notice context body.
420
+ */
421
+ export function NoticeBody({ content, t }: {
422
+ content: ContextMessageNode['content']
423
+ source: unknown
424
+ t: Translate
425
+ }): ReactNode {
426
+ return <ModelFacingContent content={content} t={t} />
427
+ }
428
+
429
+ /**
430
+ * `relay` form: which agent sent this, then what it said.
431
+ *
432
+ * The sender is an opaque session id; it is shown as a field rather than a
433
+ * label, because this client cannot resolve it to a title.
434
+ * @param props - Durable content, its source, and the locale seat.
435
+ * @returns The relay context body.
436
+ */
437
+ export function RelayBody({ content, source, t }: {
438
+ content: ContextMessageNode['content']
439
+ source: unknown
440
+ t: Translate
441
+ }): ReactNode {
442
+ const sender = relaySender(source)
443
+ /* v8 ignore next -- contextBody resolves the sender before choosing this body. */
444
+ if (sender === null) return <OpaqueBody content={content} source={source} t={t} />
445
+ return (
446
+ <>
447
+ <p className={css.relaySender} data-context-relay-sender>
448
+ {t('message.context.relay.from', { session: sender })}
449
+ </p>
450
+ <ModelFacingContent content={content} t={t} />
451
+ </>
452
+ )
453
+ }
454
+
455
+ /** The sending agent's session id, or null when the record does not name one. */
456
+ function relaySender(source: unknown): string | null {
457
+ const sender = asRecord(source)?.['senderSessionId']
458
+ return typeof sender === 'string' && sender !== '' ? sender : null
459
+ }
460
+
461
+ /** One recalled session, as the durable source records it. */
462
+ interface RecalledSession {
463
+ label: string
464
+ retained: number
465
+ omitted: number
466
+ truncated: boolean
467
+ }
468
+
469
+ /** Recalled sessions read off the source, or null when the record is unusable. */
470
+ function recalledSessions(source: unknown): RecalledSession[] | null {
471
+ const record = asRecord(source)
472
+ const list = record === null ? undefined : record['references']
473
+ if (!Array.isArray(list)) return null
474
+ const sessions: RecalledSession[] = []
475
+ for (const item of list as readonly unknown[]) {
476
+ const reference = asRecord(item)
477
+ if (reference === null) return null
478
+ const label = reference['label']
479
+ const retained = reference['retainedMessages']
480
+ const omitted = reference['omittedMessages']
481
+ const truncated = reference['truncated']
482
+ // Completeness is the fact this card exists to report, so a reference that
483
+ // cannot state it is not a readable recall — showing the label alone would
484
+ // present a confident card over unknown loss.
485
+ if (typeof label !== 'string' || label === ''
486
+ || typeof retained !== 'number' || typeof omitted !== 'number'
487
+ || typeof truncated !== 'boolean') return null
488
+ sessions.push({ label, retained, omitted, truncated })
489
+ }
490
+ return sessions.length === 0 ? null : sessions
491
+ }
492
+
493
+ /**
494
+ * `recall` form: which sessions this material came from and how much of each
495
+ * survived the read, then the material itself.
496
+ *
497
+ * Completeness is the fact a reader needs first: recalled context is bounded on
498
+ * the way in, so a card that hid the omitted count would overstate what the
499
+ * model received.
500
+ * @param props - Durable content, its source, and the locale seat.
501
+ * @returns The recall context body, or the opaque body when unreadable.
502
+ */
503
+ export function RecallBody({ content, source, t }: {
504
+ content: ContextMessageNode['content']
505
+ source: unknown
506
+ t: Translate
507
+ }): ReactNode {
508
+ const sessions = recalledSessions(source)
509
+ if (sessions === null) return <OpaqueBody content={content} source={source} t={t} />
510
+ return (
511
+ <>
512
+ <ul className={css.recalls} data-context-recalls>
513
+ {sessions.map((session, index) => (
514
+ <li key={index} className={css.recall}>
515
+ <span className={css.recallLabel}>{session.label}</span>
516
+ <span className={css.recallCounts}>
517
+ {t('message.context.recall.counts', {
518
+ retained: session.retained,
519
+ omitted: session.omitted,
520
+ })}
521
+ </span>
522
+ {session.truncated && (
523
+ <span className={css.recallCounts}>{t('message.context.recall.truncated')}</span>
524
+ )}
525
+ </li>
526
+ ))}
527
+ </ul>
528
+ <ModelFacingContent content={content} t={t} />
529
+ </>
530
+ )
531
+ }
532
+
533
+ /** The one-line account a `notice` puts on its collapsed row, when it records one. */
534
+ function noticeSummary(source: unknown): string | null {
535
+ const summary = asRecord(source)?.['summary']
536
+ return typeof summary === 'string' && summary !== '' ? summary : null
537
+ }
538
+
539
+ /**
540
+ * Choose the body for one context node.
541
+ *
542
+ * Returns the form the body actually rendered as, which is not always the
543
+ * declared one: a declared form whose fields are unreadable falls back to
544
+ * opaque, and the caller labels the row with what it really shows.
545
+ * `summary` is the collapsed row's one-line account, which only a `notice`
546
+ * records: its whole point is being readable without expanding.
547
+ * @param form - the producer-declared form projected onto the node.
548
+ * @param props - durable content, its source, and the locale seat.
549
+ * @returns the rendered form (null for opaque), its collapsed summary, and its body.
550
+ */
551
+ export function contextBody(
552
+ form: ContextMessageNode['form'],
553
+ props: { content: ContextMessageNode['content']; source: unknown; t: Translate },
554
+ ): { rendered: KnownContextForm | null; summary: string | null; body: ReactNode } {
555
+ const opaque = { rendered: null, summary: null, body: <OpaqueBody {...props} /> }
556
+ switch (form) {
557
+ case 'instructions':
558
+ return instructionChanges(props.source) === null
559
+ ? opaque
560
+ : { rendered: 'instructions', summary: null, body: <InstructionsBody {...props} /> }
561
+ case 'catalog':
562
+ return catalogEntries(props.source) === null
563
+ ? opaque
564
+ : { rendered: 'catalog', summary: null, body: <CatalogBody {...props} /> }
565
+ case 'snapshot':
566
+ return snapshotSections(props.source) === null
567
+ ? opaque
568
+ : { rendered: 'snapshot', summary: null, body: <SnapshotBody {...props} /> }
569
+ case 'notice': {
570
+ const summary = noticeSummary(props.source)
571
+ return summary === null
572
+ ? opaque
573
+ : { rendered: 'notice', summary, body: <NoticeBody {...props} /> }
574
+ }
575
+ case 'relay':
576
+ return relaySender(props.source) === null
577
+ ? opaque
578
+ : { rendered: 'relay', summary: null, body: <RelayBody {...props} /> }
579
+ case 'recall':
580
+ return recalledSessions(props.source) === null
581
+ ? opaque
582
+ : { rendered: 'recall', summary: null, body: <RecallBody {...props} /> }
583
+ case null:
584
+ return opaque
585
+ /* v8 ignore next 4 -- closed-union backstop; the compiler rejects a new
586
+ KnownContextForm here rather than letting it degrade to opaque silently. */
587
+ default: {
588
+ const unreachable: never = form
589
+ throw new Error(`unreachable context form: ${String(unreachable)}`)
590
+ }
591
+ }
592
+ }
@@ -0,0 +1,68 @@
1
+ /* Figma 10:2482: 24px Tool calls header, 4px gap, 141px code block cap.
2
+ SystemPromptRow reuses this sheet so both disclosures share one body. */
3
+
4
+ .root {
5
+ min-width: 0;
6
+ }
7
+
8
+ .root[data-open] {
9
+ padding-bottom: 4px;
10
+ }
11
+
12
+ .chevron {
13
+ color: var(--dsw-alias-label-secondary);
14
+ }
15
+
16
+ /* Separator and producer name beside the role title: ToolRow's summary geometry,
17
+ so the two disclosure rows keep one 24px rhythm and one separator shape. */
18
+ .sep {
19
+ flex: none;
20
+ width: 2px;
21
+ height: 2px;
22
+ margin: 0 8px;
23
+ border-radius: 1px;
24
+ background: var(--dsw-alias-label-caption);
25
+ }
26
+
27
+ .source {
28
+ flex: none;
29
+ min-width: 0;
30
+ overflow: hidden;
31
+ color: var(--dsw-alias-label-tertiary);
32
+ font-size: var(--dsh-content-font-size-secondary, 13px);
33
+ line-height: calc(24px + var(--dsh-content-font-delta, 0px));
34
+ text-overflow: ellipsis;
35
+ white-space: nowrap;
36
+ }
37
+
38
+ /* A notice's one-line account: the reason it rarely needs expanding. */
39
+ .summary {
40
+ flex: 1 1 auto;
41
+ min-width: 0;
42
+ overflow: hidden;
43
+ color: var(--dsw-alias-label-tertiary);
44
+ font-size: var(--dsh-content-font-size-secondary, 13px);
45
+ line-height: calc(24px + var(--dsh-content-font-delta, 0px));
46
+ text-overflow: ellipsis;
47
+ white-space: nowrap;
48
+ }
49
+
50
+ .body {
51
+ box-sizing: border-box;
52
+ /* Indent under the title, which starts at leading (16 + delta) + gap 6. */
53
+ width: calc(100% - 22px - var(--dsh-content-font-delta, 0px));
54
+ max-height: 141px;
55
+ margin: 4px 0 0 calc(22px + var(--dsh-content-font-delta, 0px));
56
+ overflow: auto;
57
+ padding: 10px 16px 12px 12px;
58
+ border: none;
59
+ border-radius: var(--dsw-radius-md);
60
+ background: var(--dsw-alias-markdown-code-block);
61
+ color: var(--dsw-alias-label-tertiary);
62
+ /* Figma 10:2482 code text: the form bodies inherit it from the scrollport. */
63
+ font: 400 11px/16px var(--ds-font-family-code);
64
+ }
65
+
66
+ .toolChanges {
67
+ white-space: nowrap;
68
+ }