@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,148 @@
1
+ import type { Context } from '@deepseek-ai/cordis'
2
+ import type {
3
+ ConversationNodeDefinition, ConversationPreviousContext,
4
+ } from '@deepseek-ai/dsh-client-ui-conversation/client'
5
+
6
+ interface InboxIdentity {
7
+ readonly id: string
8
+ readonly source: { readonly kind: string }
9
+ }
10
+
11
+ interface InboxSplice {
12
+ readonly start: number
13
+ readonly removedCount?: number
14
+ readonly inserted: readonly InboxIdentity[]
15
+ readonly outcome?: 'canceled'
16
+ }
17
+
18
+ interface PendingSnapshot {
19
+ readonly kind: 'snapshot'
20
+ readonly ids: readonly InboxIdentity[]
21
+ }
22
+
23
+ interface PendingSplice {
24
+ readonly kind: 'splice'
25
+ readonly previous: PendingState
26
+ readonly start: number
27
+ readonly removedCount: number
28
+ readonly inserted: readonly InboxIdentity[]
29
+ }
30
+
31
+ type PendingState = PendingSnapshot | PendingSplice
32
+
33
+ /** Persistent Inbox state after one durable Inbox splice. */
34
+ export interface InboxState {
35
+ /** Persistent splice chain materialized only when a batch is claimed. */
36
+ readonly pending: PendingState
37
+ /** Message ids in the current claim, shared until the next claim. */
38
+ readonly currentClaimed: ReadonlySet<string>
39
+ readonly claimSeq: number
40
+ /**
41
+ * First human message id of the current claim in Inbox order; undefined
42
+ * when the claim took no human message. The AgentLoop logs a claim's
43
+ * messages in this order, so this message is the claim's first steering row.
44
+ */
45
+ readonly firstClaimedHuman: string | undefined
46
+ }
47
+
48
+ const EMPTY_PENDING: PendingState = { kind: 'snapshot', ids: [] }
49
+ const EMPTY_CURRENT_CLAIMED: ReadonlySet<string> = new Set()
50
+
51
+ function materializePending(state: PendingState): InboxIdentity[] {
52
+ const splices: PendingSplice[] = []
53
+ let current = state
54
+ while (current.kind === 'splice') {
55
+ splices.push(current)
56
+ current = current.previous
57
+ }
58
+ const pending = [...current.ids]
59
+ for (const splice of splices.reverse()) {
60
+ pending.splice(splice.start, splice.removedCount, ...splice.inserted)
61
+ }
62
+ return pending
63
+ }
64
+
65
+ function withoutInserted(
66
+ claimed: ReadonlySet<string>,
67
+ inserted: readonly InboxIdentity[],
68
+ ): ReadonlySet<string> {
69
+ let next: Set<string> | undefined
70
+ for (const { id } of inserted) {
71
+ if (!claimed.has(id)) continue
72
+ next ??= new Set(claimed)
73
+ next.delete(id)
74
+ }
75
+ return next ?? claimed
76
+ }
77
+
78
+ /**
79
+ * Apply one Inbox splice under the AgentLoop's durable event ordering.
80
+ * An entered claim logs its complete message batch before another claim; a
81
+ * rejected claim logs no messages, so only the current claim can classify a
82
+ * later `user/message`.
83
+ */
84
+ function applySplice(
85
+ previous: ConversationPreviousContext<InboxState> | undefined,
86
+ splice: InboxSplice,
87
+ seq: number,
88
+ ): InboxState {
89
+ const priorPending = previous?.state.pending ?? EMPTY_PENDING
90
+ const inserted = splice.inserted
91
+ const removedCount = splice.removedCount ?? 0
92
+ if (removedCount > 0 && splice.outcome !== 'canceled') {
93
+ const pending = materializePending(priorPending)
94
+ const removed = pending.splice(splice.start, removedCount, ...inserted)
95
+ return {
96
+ pending: { kind: 'snapshot', ids: pending },
97
+ currentClaimed: new Set(removed.map(message => message.id)),
98
+ claimSeq: seq,
99
+ firstClaimedHuman: removed.find(message => message.source.kind === 'user')?.id,
100
+ }
101
+ }
102
+ const currentClaimed = withoutInserted(
103
+ previous?.state.currentClaimed ?? EMPTY_CURRENT_CLAIMED,
104
+ inserted,
105
+ )
106
+ return {
107
+ pending: {
108
+ kind: 'splice',
109
+ previous: priorPending,
110
+ start: splice.start,
111
+ removedCount,
112
+ inserted,
113
+ },
114
+ currentClaimed,
115
+ claimSeq: previous?.state.claimSeq ?? -1,
116
+ firstClaimedHuman: previous?.state.firstClaimedHuman,
117
+ }
118
+ }
119
+
120
+ function inboxDefinition(target: 'next-step' | 'next-turn'): ConversationNodeDefinition<InboxState> {
121
+ const kind = `inbox-${target}`
122
+ return {
123
+ kind,
124
+ match: event => event.type === 'agent/inbox/spliced' && event.data.target === target
125
+ ? { id: String(event.seq), role: 'start' } : null,
126
+ start: (_context, match, reader) => {
127
+ if (match.event.type !== 'agent/inbox/spliced') throw new Error('inbox start requires agent/inbox/spliced')
128
+ return applySplice(reader.previous<InboxState>(kind), match.event.data, match.event.seq)
129
+ },
130
+ update: context => context.state,
131
+ publication: () => 'none',
132
+ }
133
+ }
134
+
135
+ /** Persistent next-step claims identify messages admitted into a running Turn. */
136
+ export const nextStepInboxDefinition = inboxDefinition('next-step')
137
+
138
+ /** Persistent next-turn claims identify messages that wake a new Turn. */
139
+ export const nextTurnInboxDefinition = inboxDefinition('next-turn')
140
+
141
+ /**
142
+ * Register the Inbox state used by Chat message classification.
143
+ * @param ctx - owning UI Conversation context.
144
+ */
145
+ export function registerInboxConversationNodes(ctx: Context): void {
146
+ ctx.uiConversation.events.register(nextStepInboxDefinition)
147
+ ctx.uiConversation.events.register(nextTurnInboxDefinition)
148
+ }
@@ -0,0 +1,182 @@
1
+ import type { Context } from '@deepseek-ai/cordis'
2
+ import type {
3
+ ContextMessageNode, ConversationContextReader, ConversationLocation, ConversationNodeDefinition,
4
+ SteeringMessageNode, UserMessageNode,
5
+ } from '@deepseek-ai/dsh-client-ui-conversation/client'
6
+ import { isAppendSurfaceEvent, isReplacementSurfaceEvent } from '@deepseek-ai/dsh-session/surface'
7
+ import type { InboxState } from './inbox.ts'
8
+ import type { ProcessEvidenceState } from './turn-process.ts'
9
+ import { chatNode, contextLocation } from './common.ts'
10
+ import { contextForm, contextProducer } from './event-projection.ts'
11
+
12
+ interface ReferencedUserMessageNode extends UserMessageNode {
13
+ /** Labels cited by the immediately following session-reference context. */
14
+ readonly referenceLabels?: readonly string[]
15
+ /** Skill names the same step's `skill-invocation` injections loaded. */
16
+ readonly skillNames?: readonly string[]
17
+ }
18
+
19
+ interface ReferencedSteeringMessageNode extends SteeringMessageNode {
20
+ /** Labels cited by the immediately following session-reference context. */
21
+ readonly referenceLabels?: readonly string[]
22
+ /** Skill names the same step's `skill-invocation` injections loaded. */
23
+ readonly skillNames?: readonly string[]
24
+ /**
25
+ * First human message of its `next-step` claim that Chat orders after its Turn's process control;
26
+ * the row keeps the Turn tail slot above it.
27
+ */
28
+ readonly batchStart?: true
29
+ }
30
+
31
+ type MessageNode = ReferencedUserMessageNode | ReferencedSteeringMessageNode | (ContextMessageNode & { readonly waking?: boolean })
32
+
33
+ declare module '../contract/chat-nodes.ts' {
34
+ interface ChatNodeDataMap {
35
+ /** Ordinary turn-opening user message. */
36
+ user: ReferencedUserMessageNode
37
+ /** User message admitted into an active turn. */
38
+ steering: ReferencedSteeringMessageNode
39
+ /** Non-user context injected into model history. */
40
+ context: ContextMessageNode
41
+ /** Recorded notification or manual continuation that starts a Turn. */
42
+ 'turn-trigger': ContextMessageNode
43
+ }
44
+ }
45
+
46
+ function isCompactionCheckpoint(event: Parameters<ConversationNodeDefinition['match']>[0]): boolean {
47
+ if (event.type !== 'user/message' || !isReplacementSurfaceEvent(event)) return false
48
+ const source = event.data.source as { kind?: unknown }
49
+ return source.kind === 'compact-checkpoint'
50
+ }
51
+
52
+ /** Context presentation shared by user-role injections and developer messages. */
53
+ function contextMessage(
54
+ event: Pick<ContextMessageNode, 'seq' | 'time'>,
55
+ message: Pick<ContextMessageNode, 'content' | 'source'>,
56
+ ): ContextMessageNode {
57
+ return {
58
+ kind: 'context',
59
+ seq: event.seq,
60
+ time: event.time,
61
+ content: message.content,
62
+ source: message.source,
63
+ producer: contextProducer(message.source),
64
+ form: contextForm(message.source),
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Decide whether an input follows its Turn's process control in Chat order. The control anchors at the
70
+ * Turn's first process evidence, so the input follows it exactly when its Turn recorded evidence earlier;
71
+ * the nearest earlier evidence record then belongs to the input's own Turn.
72
+ * @param location - the input's Location.
73
+ * @param reader - strictly-backward Context lookup of the input's start.
74
+ * @returns whether Chat orders the input after the control.
75
+ */
76
+ function followsProcessEvidence(location: ConversationLocation, reader: ConversationContextReader): boolean {
77
+ if (location.kind !== 'turn' && location.kind !== 'step') return false
78
+ return reader.previous<ProcessEvidenceState>('process-evidence')?.state.turn === location.turn.turn
79
+ }
80
+
81
+ /** User, steering, and injected-context message classification Definition. */
82
+ export const messageDefinition: ConversationNodeDefinition<MessageNode> = {
83
+ kind: 'input-message',
84
+ target: 'chat',
85
+ match: (event) => {
86
+ if (event.type === 'user/message') {
87
+ return isAppendSurfaceEvent(event) && !isCompactionCheckpoint(event)
88
+ ? { id: String(event.data.id), role: 'start' }
89
+ : null
90
+ }
91
+ return null
92
+ },
93
+ start: (_context, match, reader) => {
94
+ const event = match.event
95
+ if (event.type !== 'user/message') throw new Error('input-message start requires user/message')
96
+ if (event.data.source.kind !== 'user') {
97
+ const nextTurn = reader.previous<InboxState>('inbox-next-turn')?.state
98
+ const nextStep = reader.previous<InboxState>('inbox-next-step')?.state
99
+ const location = match.location
100
+ const turnStart = location.kind === 'step' ? location.turn.start?.seq : undefined
101
+ // An idle steer opens Step 1 without a next-turn claim in this Turn.
102
+ // A human in that same next-step claim owns the opening instead of its notices.
103
+ const idleSteer = location.kind === 'step' && location.step.step === 1
104
+ && turnStart !== undefined && (nextStep?.claimSeq ?? -1) > turnStart
105
+ && (nextTurn?.claimSeq ?? -1) < turnStart && nextStep !== undefined
106
+ && nextStep.firstClaimedHuman === undefined && nextStep.currentClaimed.has(String(event.data.id))
107
+
108
+ return {
109
+ ...contextMessage(event, event.data),
110
+ waking: nextTurn?.currentClaimed.has(String(event.data.id)) === true || idleSteer,
111
+ }
112
+ }
113
+ const id = String(event.data.id)
114
+ const claim = reader.previous<InboxState>('inbox-next-step')?.state
115
+ return claim?.currentClaimed.has(id) === true
116
+ ? {
117
+ kind: 'steering',
118
+ messageId: event.data.id,
119
+ seq: event.seq,
120
+ time: event.time,
121
+ content: event.data.content,
122
+ source: event.data.source,
123
+ ...claim.firstClaimedHuman === id && followsProcessEvidence(match.location, reader)
124
+ ? { batchStart: true }
125
+ : {},
126
+ }
127
+ : {
128
+ kind: 'user',
129
+ messageId: event.data.id,
130
+ seq: event.seq,
131
+ time: event.time,
132
+ content: event.data.content,
133
+ source: event.data.source,
134
+ }
135
+ },
136
+ update: context => context.state,
137
+ buildViewNode: (context) => {
138
+ if (context.state === undefined) return null
139
+ const location = contextLocation(context)
140
+ if (context.state.kind === 'context' && context.start?.event.type === 'user/message'
141
+ && context.start.event.data.source.kind === 'retry' && context.start.event.data.content.length === 0) {
142
+ return chatNode(context, 'turn-trigger', context.state.seq, context.state, { location, groupTree: 'input' })
143
+ }
144
+ const waking = context.state.kind === 'context'
145
+ && context.start?.event.type === 'user/message'
146
+ && context.state.waking === true
147
+ // Human input claimed for Step 1 opens an exchange; Notice-woken Turns and
148
+ // later steering stay in the current exchange, so they never fold earlier Turns.
149
+ const human = context.state.kind === 'user' || context.state.kind === 'steering'
150
+ const opensExchange = human && location.kind === 'step' && location.step.step === 1
151
+ return chatNode(
152
+ context,
153
+ waking ? 'turn-trigger' : context.state.kind,
154
+ context.state.seq,
155
+ context.state,
156
+ { location, groupTree: opensExchange ? 'exchange' : (human || waking) ? 'input' : undefined },
157
+ )
158
+ },
159
+ }
160
+
161
+ /** Developer history uses the input-message lifecycle and context presentation. */
162
+ export const developerMessageDefinition: ConversationNodeDefinition<MessageNode> = {
163
+ ...messageDefinition,
164
+ kind: 'developer-message',
165
+ match: event => event.type === 'developer/message'
166
+ ? { id: String(event.data.message.id), role: 'start' }
167
+ : null,
168
+ start: (_context, match) => {
169
+ const event = match.event
170
+ if (event.type !== 'developer/message') throw new Error('developer-message start requires developer/message')
171
+ return contextMessage(event, event.data.message)
172
+ },
173
+ }
174
+
175
+ /**
176
+ * Register user, steering, injected-context, and developer message contributions.
177
+ * @param ctx - owning UI Conversation context.
178
+ */
179
+ export function registerMessageConversationNode(ctx: Context): void {
180
+ ctx.uiConversation.events.register(messageDefinition)
181
+ ctx.uiConversation.events.register(developerMessageDefinition)
182
+ }
@@ -0,0 +1,170 @@
1
+ /** Tool-category and live-detail interpretation owned by Chat grouping. */
2
+ import { reasoningText } from '../reasoning-text.ts'
3
+ import type { ToolArgs } from '@deepseek-ai/dsh-client-ui-conversation/client'
4
+ import type { ProcessActivity, ProcessActivitySummary, RunningProcessActivity } from '../contract/process-groups.ts'
5
+ import type { ChatNode } from '../contract/chat-nodes.ts'
6
+ import { isRunningTool } from '../contract/chat-nodes.ts'
7
+ import type { ToolCallBlock } from '../contract/snapshot.ts'
8
+
9
+ function activity(name: string): RunningProcessActivity {
10
+ if (name === 'read') return 'read'
11
+ if (name === 'read_image') return 'readImage'
12
+ if (name === 'grep' || name === 'glob' || name.endsWith('_inspect')) return 'search'
13
+ if (name === 'write') return 'write'
14
+ if (name === 'edit' || name === 'apply_patch') return 'edit'
15
+ if (['bash', 'pwsh', 'exec_command', 'write_stdin'].includes(name) || name.startsWith('terminal_')) return 'commands'
16
+ if (name === 'run_code') return 'code'
17
+ if (name === 'web_search') return 'webSearch'
18
+ if (name === 'web_fetch') return 'webFetch'
19
+ if (name === 'subagent' || name.startsWith('subagent_')) return 'subagents'
20
+ if (['todo_write', 'create_goal', 'update_goal', 'get_goal'].includes(name)) return 'plan'
21
+ if (name === 'ask_user_question' || name === 'request_user_input') return 'questions'
22
+ return 'tools'
23
+ }
24
+
25
+ const LIVE_TOOL_DETAIL_MAX_CHARS = 160
26
+ const LIVE_TOOL_DETAIL_PREFIX_CHARS = 512
27
+ const LIVE_TOOL_DETAIL_SEGMENTER = new Intl.Segmenter(undefined, { granularity: 'grapheme' })
28
+ const LIVE_TOOL_DETAIL_KEYS = [
29
+ 'title', 'description', 'objective', 'task', 'task_name', 'name', 'question', 'questions', 'prompt', 'message',
30
+ 'command', 'cmd', 'queries', 'query', 'pattern', 'url', 'uri', 'file_path', 'path', 'target', 'action', 'status',
31
+ ] as const
32
+
33
+ interface NormalizedDetail {
34
+ readonly text: string
35
+ readonly truncated: boolean
36
+ }
37
+
38
+ function normalizeLiveToolText(text: string): NormalizedDetail {
39
+ const normalized = text.replace(/\s+/g, ' ').trim()
40
+ if (normalized.length <= LIVE_TOOL_DETAIL_MAX_CHARS) return { text: normalized, truncated: false }
41
+ const chars: string[] = []
42
+ for (const { segment } of LIVE_TOOL_DETAIL_SEGMENTER.segment(normalized)) {
43
+ if (chars.length === LIVE_TOOL_DETAIL_MAX_CHARS) {
44
+ return {
45
+ text: `${chars.slice(0, LIVE_TOOL_DETAIL_MAX_CHARS - 1).join('').trimEnd()}…`,
46
+ truncated: true,
47
+ }
48
+ }
49
+ chars.push(segment)
50
+ }
51
+ return { text: normalized, truncated: false }
52
+ }
53
+
54
+ function normalizeLiveToolDetail(value: unknown): string {
55
+ const text = typeof value === 'string'
56
+ ? value
57
+ : Array.isArray(value) && value.every(item => typeof item === 'string')
58
+ ? value.join(', ')
59
+ : ''
60
+ return normalizeLiveToolText(text).text
61
+ }
62
+
63
+ function argumentTextDetail(args: ToolArgs, key: string): string | undefined {
64
+ let limit = LIVE_TOOL_DETAIL_PREFIX_CHARS
65
+ while (true) {
66
+ let prefix = args.textPrefix(key, limit)
67
+ if (prefix === undefined) return undefined
68
+ const last = prefix.charCodeAt(prefix.length - 1)
69
+ if (last >= 0xd800 && last <= 0xdbff) {
70
+ // The extra prefix read also observes a low surrogate arriving in a later delta.
71
+ const extended = args.textPrefix(key, limit + 1) as string
72
+ const next = extended.charCodeAt(prefix.length)
73
+ if (next >= 0xdc00 && next <= 0xdfff) {
74
+ prefix = extended
75
+ limit++
76
+ } else if (extended.length === prefix.length && !args.isSealed && !args.complete(key)) {
77
+ prefix = prefix.slice(0, -1)
78
+ }
79
+ }
80
+ const detail = normalizeLiveToolText(prefix)
81
+ if (detail.truncated || !args.stringExceeds(key, limit)) return detail.text
82
+ limit *= 2
83
+ }
84
+ }
85
+
86
+ function questionDetail(value: unknown): string {
87
+ if (!Array.isArray(value)) return ''
88
+ for (const item of value) {
89
+ if (item === null || typeof item !== 'object') continue
90
+ const detail = normalizeLiveToolDetail(Reflect.get(item, 'question'))
91
+ if (detail !== '') return detail
92
+ }
93
+ return ''
94
+ }
95
+
96
+ function liveReasoningDetail(nodes: readonly ChatNode[]): string {
97
+ for (let nodeIndex = nodes.length - 1; nodeIndex >= 0; nodeIndex--) {
98
+ const node = nodes[nodeIndex]
99
+ if (node?.kind !== 'assistant-step' || node.data.status !== 'running') continue
100
+ for (let blockIndex = node.data.blocks.length - 1; blockIndex >= 0; blockIndex--) {
101
+ const block = node.data.blocks[blockIndex]
102
+ if (block?.kind !== 'reasoning') continue
103
+ const paragraphs = reasoningText(block.text).split(/\r?\n[\t ]*\r?\n/)
104
+ for (let paragraphIndex = paragraphs.length - 1; paragraphIndex >= 0; paragraphIndex--) {
105
+ const detail = normalizeLiveToolDetail(paragraphs[paragraphIndex]?.replaceAll('**', ''))
106
+ if (detail !== '') return detail
107
+ }
108
+ }
109
+ }
110
+ return ''
111
+ }
112
+
113
+ /**
114
+ * One-line task detail from the argument view, read the same way while the
115
+ * arguments stream and after dispatch: the first detail key present with text
116
+ * so far or a closed value. Without one, the tool name stands in once no further
117
+ * field can arrive; a field still to come is not named early.
118
+ */
119
+ function liveToolDetail(name: string, args: ToolArgs): string {
120
+ for (const key of LIVE_TOOL_DETAIL_KEYS) {
121
+ if (!args.has(key)) continue
122
+ const detail = key === 'questions'
123
+ ? questionDetail(args.value(key))
124
+ : argumentTextDetail(args, key) ?? normalizeLiveToolDetail(args.value(key))
125
+ if (detail !== '') return detail
126
+ }
127
+ return args.closed() ? normalizeLiveToolDetail(name) : ''
128
+ }
129
+
130
+ /**
131
+ * Rank categories by distinct call count, breaking ties by first appearance.
132
+ * A group whose members are all Context reports one `context` category counting those members; Context beside other members adds no count.
133
+ * @param nodes - process members, including recursive tools.
134
+ * @returns all ranked categories and the latest running tool category and bounded task detail.
135
+ */
136
+ export function processActivity(nodes: readonly ChatNode[]): ProcessActivitySummary {
137
+ const counts = new Map<ProcessActivity, number>()
138
+ const seen = new Set<string>()
139
+ let running: RunningProcessActivity | undefined
140
+ let runningDetail = ''
141
+ let runningTime = -Infinity
142
+ let preparing: boolean | undefined
143
+ const visit = (tool: ToolCallBlock): void => {
144
+ if (seen.has(tool.callId)) return
145
+ seen.add(tool.callId)
146
+ const call = isRunningTool(tool) ? tool : tool.call
147
+ if (call !== null) {
148
+ const kind = activity(call.name)
149
+ if (isRunningTool(tool) && tool.time >= runningTime) {
150
+ running = kind
151
+ preparing = tool.phase === 'preparing'
152
+ runningDetail = liveToolDetail(tool.name, tool.args)
153
+ runningTime = tool.time
154
+ }
155
+ counts.set(kind, (counts.get(kind) ?? 0) + 1)
156
+ }
157
+ for (const child of tool.subCalls) visit(child)
158
+ }
159
+ for (const node of nodes) {
160
+ if (node.kind === 'tool-call') visit(node.data.root)
161
+ }
162
+ if (running === undefined) runningDetail = liveReasoningDetail(nodes)
163
+ if (nodes.length > 0 && nodes.every(node => node.kind === 'context')) counts.set('context', nodes.length)
164
+ return {
165
+ counts: [...counts].map(([kind, count]) => ({ kind, count })).sort((a, b) => b.count - a.count),
166
+ running,
167
+ runningDetail,
168
+ ...preparing ? { preparing: true } : {},
169
+ }
170
+ }