dsh-tidy-display 0.1.0

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 (402) hide show
  1. package/CHANGELOG.md +270 -0
  2. package/DESIGN.md +72 -0
  3. package/LICENSE +24 -0
  4. package/README.en.md +118 -0
  5. package/README.md +118 -0
  6. package/THIRD_PARTY_NOTICES.md +65 -0
  7. package/compat/harness-rc2.json +99 -0
  8. package/cordis.patch.yml +5 -0
  9. package/cordis.yml +4 -0
  10. package/docs/official-rendering-bridge.md +65 -0
  11. package/docs/plans/2026-09-28-merge/checklist.md +21 -0
  12. package/docs/plans/2026-09-28-merge/findings.md +24 -0
  13. package/docs/plans/2026-09-28-merge/spec.md +61 -0
  14. package/docs/plans/2026-09-28-merge/tasks.md +34 -0
  15. package/dshx.yml +5 -0
  16. package/lib/client.js +50207 -0
  17. package/lib/client.js.map +1 -0
  18. package/lib/dsh-tidy-display.js +254 -0
  19. package/lib/types/client/Blocks.d.ts +49 -0
  20. package/lib/types/client/Blocks.d.ts.map +1 -0
  21. package/lib/types/client/Blocks.js +143 -0
  22. package/lib/types/client/Blocks.js.map +1 -0
  23. package/lib/types/client/ChoreographedFlow.d.ts +22 -0
  24. package/lib/types/client/ChoreographedFlow.d.ts.map +1 -0
  25. package/lib/types/client/ChoreographedFlow.js +218 -0
  26. package/lib/types/client/ChoreographedFlow.js.map +1 -0
  27. package/lib/types/client/ClosedProcessSummary.d.ts +9 -0
  28. package/lib/types/client/ClosedProcessSummary.d.ts.map +1 -0
  29. package/lib/types/client/ClosedProcessSummary.js +16 -0
  30. package/lib/types/client/ClosedProcessSummary.js.map +1 -0
  31. package/lib/types/client/DiffPanel.d.ts +13 -0
  32. package/lib/types/client/DiffPanel.d.ts.map +1 -0
  33. package/lib/types/client/DiffPanel.js +115 -0
  34. package/lib/types/client/DiffPanel.js.map +1 -0
  35. package/lib/types/client/LiveFold.d.ts +10 -0
  36. package/lib/types/client/LiveFold.d.ts.map +1 -0
  37. package/lib/types/client/LiveFold.js +39 -0
  38. package/lib/types/client/LiveFold.js.map +1 -0
  39. package/lib/types/client/McpAppFrame.d.ts +32 -0
  40. package/lib/types/client/McpAppFrame.d.ts.map +1 -0
  41. package/lib/types/client/McpAppFrame.js +193 -0
  42. package/lib/types/client/McpAppFrame.js.map +1 -0
  43. package/lib/types/client/OfficialContent.d.ts +25 -0
  44. package/lib/types/client/OfficialContent.d.ts.map +1 -0
  45. package/lib/types/client/OfficialContent.js +53 -0
  46. package/lib/types/client/OfficialContent.js.map +1 -0
  47. package/lib/types/client/Reader.d.ts +3 -0
  48. package/lib/types/client/Reader.d.ts.map +1 -0
  49. package/lib/types/client/Reader.js +508 -0
  50. package/lib/types/client/Reader.js.map +1 -0
  51. package/lib/types/client/ReasoningCard.d.ts +11 -0
  52. package/lib/types/client/ReasoningCard.d.ts.map +1 -0
  53. package/lib/types/client/ReasoningCard.js +322 -0
  54. package/lib/types/client/ReasoningCard.js.map +1 -0
  55. package/lib/types/client/SettingsSection.d.ts +59 -0
  56. package/lib/types/client/SettingsSection.d.ts.map +1 -0
  57. package/lib/types/client/SettingsSection.js +93 -0
  58. package/lib/types/client/SettingsSection.js.map +1 -0
  59. package/lib/types/client/StickyLane.d.ts +8 -0
  60. package/lib/types/client/StickyLane.d.ts.map +1 -0
  61. package/lib/types/client/StickyLane.js +39 -0
  62. package/lib/types/client/StickyLane.js.map +1 -0
  63. package/lib/types/client/TimelineRail.d.ts +10 -0
  64. package/lib/types/client/TimelineRail.d.ts.map +1 -0
  65. package/lib/types/client/TimelineRail.js +168 -0
  66. package/lib/types/client/TimelineRail.js.map +1 -0
  67. package/lib/types/client/ToolActivity.d.ts +17 -0
  68. package/lib/types/client/ToolActivity.d.ts.map +1 -0
  69. package/lib/types/client/ToolActivity.js +244 -0
  70. package/lib/types/client/ToolActivity.js.map +1 -0
  71. package/lib/types/client/TurnMetrics.d.ts +11 -0
  72. package/lib/types/client/TurnMetrics.d.ts.map +1 -0
  73. package/lib/types/client/TurnMetrics.js +44 -0
  74. package/lib/types/client/TurnMetrics.js.map +1 -0
  75. package/lib/types/client/WaitClock.d.ts +16 -0
  76. package/lib/types/client/WaitClock.d.ts.map +1 -0
  77. package/lib/types/client/WaitClock.js +29 -0
  78. package/lib/types/client/WaitClock.js.map +1 -0
  79. package/lib/types/client/WaitingClock.d.ts +15 -0
  80. package/lib/types/client/WaitingClock.d.ts.map +1 -0
  81. package/lib/types/client/WaitingClock.js +30 -0
  82. package/lib/types/client/WaitingClock.js.map +1 -0
  83. package/lib/types/client/WaitingStatus.d.ts +6 -0
  84. package/lib/types/client/WaitingStatus.d.ts.map +1 -0
  85. package/lib/types/client/WaitingStatus.js +9 -0
  86. package/lib/types/client/WaitingStatus.js.map +1 -0
  87. package/lib/types/client/conversation-scroll.d.ts +19 -0
  88. package/lib/types/client/conversation-scroll.d.ts.map +1 -0
  89. package/lib/types/client/conversation-scroll.js +25 -0
  90. package/lib/types/client/conversation-scroll.js.map +1 -0
  91. package/lib/types/client/deliverables.d.ts +24 -0
  92. package/lib/types/client/deliverables.d.ts.map +1 -0
  93. package/lib/types/client/deliverables.js +104 -0
  94. package/lib/types/client/deliverables.js.map +1 -0
  95. package/lib/types/client/entry-policy.d.ts +10 -0
  96. package/lib/types/client/entry-policy.d.ts.map +1 -0
  97. package/lib/types/client/entry-policy.js +24 -0
  98. package/lib/types/client/entry-policy.js.map +1 -0
  99. package/lib/types/client/entry.d.ts +4 -0
  100. package/lib/types/client/entry.d.ts.map +1 -0
  101. package/lib/types/client/entry.js +34 -0
  102. package/lib/types/client/entry.js.map +1 -0
  103. package/lib/types/client/fold-choreography.d.ts +40 -0
  104. package/lib/types/client/fold-choreography.d.ts.map +1 -0
  105. package/lib/types/client/fold-choreography.js +48 -0
  106. package/lib/types/client/fold-choreography.js.map +1 -0
  107. package/lib/types/client/fold-intensity.d.ts +11 -0
  108. package/lib/types/client/fold-intensity.d.ts.map +1 -0
  109. package/lib/types/client/fold-intensity.js +32 -0
  110. package/lib/types/client/fold-intensity.js.map +1 -0
  111. package/lib/types/client/index.d.ts +7 -0
  112. package/lib/types/client/index.d.ts.map +1 -0
  113. package/lib/types/client/index.js +234 -0
  114. package/lib/types/client/index.js.map +1 -0
  115. package/lib/types/client/live-turn.d.ts +58 -0
  116. package/lib/types/client/live-turn.d.ts.map +1 -0
  117. package/lib/types/client/live-turn.js +144 -0
  118. package/lib/types/client/live-turn.js.map +1 -0
  119. package/lib/types/client/markdown/MarkdownText.d.ts +41 -0
  120. package/lib/types/client/markdown/MarkdownText.d.ts.map +1 -0
  121. package/lib/types/client/markdown/MarkdownText.js +178 -0
  122. package/lib/types/client/markdown/MarkdownText.js.map +1 -0
  123. package/lib/types/client/markdown/cjkFriendlyStrong.d.ts +9 -0
  124. package/lib/types/client/markdown/cjkFriendlyStrong.d.ts.map +1 -0
  125. package/lib/types/client/markdown/cjkFriendlyStrong.js +73 -0
  126. package/lib/types/client/markdown/cjkFriendlyStrong.js.map +1 -0
  127. package/lib/types/client/markdown/incremental.d.ts +69 -0
  128. package/lib/types/client/markdown/incremental.d.ts.map +1 -0
  129. package/lib/types/client/markdown/incremental.js +108 -0
  130. package/lib/types/client/markdown/incremental.js.map +1 -0
  131. package/lib/types/client/markdown/katex.d.ts +27 -0
  132. package/lib/types/client/markdown/katex.d.ts.map +1 -0
  133. package/lib/types/client/markdown/katex.js +88 -0
  134. package/lib/types/client/markdown/katex.js.map +1 -0
  135. package/lib/types/client/markdown/mathCompatibility.d.ts +11 -0
  136. package/lib/types/client/markdown/mathCompatibility.d.ts.map +1 -0
  137. package/lib/types/client/markdown/mathCompatibility.js +295 -0
  138. package/lib/types/client/markdown/mathCompatibility.js.map +1 -0
  139. package/lib/types/client/markdown/parse.d.ts +25 -0
  140. package/lib/types/client/markdown/parse.d.ts.map +1 -0
  141. package/lib/types/client/markdown/parse.js +42 -0
  142. package/lib/types/client/markdown/parse.js.map +1 -0
  143. package/lib/types/client/markdown/render.d.ts +121 -0
  144. package/lib/types/client/markdown/render.d.ts.map +1 -0
  145. package/lib/types/client/markdown/render.js +452 -0
  146. package/lib/types/client/markdown/render.js.map +1 -0
  147. package/lib/types/client/mcp-app.d.ts +50 -0
  148. package/lib/types/client/mcp-app.d.ts.map +1 -0
  149. package/lib/types/client/mcp-app.js +328 -0
  150. package/lib/types/client/mcp-app.js.map +1 -0
  151. package/lib/types/client/message-chrome.d.ts +19 -0
  152. package/lib/types/client/message-chrome.d.ts.map +1 -0
  153. package/lib/types/client/message-chrome.js +42 -0
  154. package/lib/types/client/message-chrome.js.map +1 -0
  155. package/lib/types/client/motion.d.ts +38 -0
  156. package/lib/types/client/motion.d.ts.map +1 -0
  157. package/lib/types/client/motion.js +453 -0
  158. package/lib/types/client/motion.js.map +1 -0
  159. package/lib/types/client/native/ContextBody.d.ts +130 -0
  160. package/lib/types/client/native/ContextBody.d.ts.map +1 -0
  161. package/lib/types/client/native/ContextBody.js +398 -0
  162. package/lib/types/client/native/ContextBody.js.map +1 -0
  163. package/lib/types/client/native/ContextInjectionRow.d.ts +35 -0
  164. package/lib/types/client/native/ContextInjectionRow.d.ts.map +1 -0
  165. package/lib/types/client/native/ContextInjectionRow.js +42 -0
  166. package/lib/types/client/native/ContextInjectionRow.js.map +1 -0
  167. package/lib/types/client/native/ReferenceIcon.d.ts +16 -0
  168. package/lib/types/client/native/ReferenceIcon.d.ts.map +1 -0
  169. package/lib/types/client/native/ReferenceIcon.js +16 -0
  170. package/lib/types/client/native/ReferenceIcon.js.map +1 -0
  171. package/lib/types/client/native/tool-call-model.d.ts +58 -0
  172. package/lib/types/client/native/tool-call-model.d.ts.map +1 -0
  173. package/lib/types/client/native/tool-call-model.js +219 -0
  174. package/lib/types/client/native/tool-call-model.js.map +1 -0
  175. package/lib/types/client/native/tool-update.d.ts +23 -0
  176. package/lib/types/client/native/tool-update.d.ts.map +1 -0
  177. package/lib/types/client/native/tool-update.js +22 -0
  178. package/lib/types/client/native/tool-update.js.map +1 -0
  179. package/lib/types/client/official-slots.d.ts +71 -0
  180. package/lib/types/client/official-slots.d.ts.map +1 -0
  181. package/lib/types/client/official-slots.js +183 -0
  182. package/lib/types/client/official-slots.js.map +1 -0
  183. package/lib/types/client/open-file.d.ts +29 -0
  184. package/lib/types/client/open-file.d.ts.map +1 -0
  185. package/lib/types/client/open-file.js +71 -0
  186. package/lib/types/client/open-file.js.map +1 -0
  187. package/lib/types/client/pending-submission.d.ts +28 -0
  188. package/lib/types/client/pending-submission.d.ts.map +1 -0
  189. package/lib/types/client/pending-submission.js +28 -0
  190. package/lib/types/client/pending-submission.js.map +1 -0
  191. package/lib/types/client/platform-media.d.ts +6 -0
  192. package/lib/types/client/platform-media.d.ts.map +1 -0
  193. package/lib/types/client/platform-media.js +18 -0
  194. package/lib/types/client/platform-media.js.map +1 -0
  195. package/lib/types/client/primitive-labels.d.ts +10 -0
  196. package/lib/types/client/primitive-labels.d.ts.map +1 -0
  197. package/lib/types/client/primitive-labels.js +38 -0
  198. package/lib/types/client/primitive-labels.js.map +1 -0
  199. package/lib/types/client/projection.d.ts +41 -0
  200. package/lib/types/client/projection.d.ts.map +1 -0
  201. package/lib/types/client/projection.js +112 -0
  202. package/lib/types/client/projection.js.map +1 -0
  203. package/lib/types/client/rail/RailView.d.ts +24 -0
  204. package/lib/types/client/rail/RailView.d.ts.map +1 -0
  205. package/lib/types/client/rail/RailView.js +540 -0
  206. package/lib/types/client/rail/RailView.js.map +1 -0
  207. package/lib/types/client/rail/colors.d.ts +43 -0
  208. package/lib/types/client/rail/colors.d.ts.map +1 -0
  209. package/lib/types/client/rail/colors.js +223 -0
  210. package/lib/types/client/rail/colors.js.map +1 -0
  211. package/lib/types/client/reasoning-follow.d.ts +10 -0
  212. package/lib/types/client/reasoning-follow.d.ts.map +1 -0
  213. package/lib/types/client/reasoning-follow.js +21 -0
  214. package/lib/types/client/reasoning-follow.js.map +1 -0
  215. package/lib/types/client/resource-address.d.ts +3 -0
  216. package/lib/types/client/resource-address.d.ts.map +1 -0
  217. package/lib/types/client/resource-address.js +33 -0
  218. package/lib/types/client/resource-address.js.map +1 -0
  219. package/lib/types/client/settings-copy.d.ts +7 -0
  220. package/lib/types/client/settings-copy.d.ts.map +1 -0
  221. package/lib/types/client/settings-copy.js +85 -0
  222. package/lib/types/client/settings-copy.js.map +1 -0
  223. package/lib/types/client/settings-slots.d.ts +34 -0
  224. package/lib/types/client/settings-slots.d.ts.map +1 -0
  225. package/lib/types/client/settings-slots.js +2 -0
  226. package/lib/types/client/settings-slots.js.map +1 -0
  227. package/lib/types/client/settings.d.ts +4 -0
  228. package/lib/types/client/settings.d.ts.map +1 -0
  229. package/lib/types/client/settings.js +60 -0
  230. package/lib/types/client/settings.js.map +1 -0
  231. package/lib/types/client/skill-status.d.ts +25 -0
  232. package/lib/types/client/skill-status.d.ts.map +1 -0
  233. package/lib/types/client/skill-status.js +44 -0
  234. package/lib/types/client/skill-status.js.map +1 -0
  235. package/lib/types/client/store.d.ts +66 -0
  236. package/lib/types/client/store.d.ts.map +1 -0
  237. package/lib/types/client/store.js +61 -0
  238. package/lib/types/client/store.js.map +1 -0
  239. package/lib/types/client/stream-buffer.d.ts +37 -0
  240. package/lib/types/client/stream-buffer.d.ts.map +1 -0
  241. package/lib/types/client/stream-buffer.js +150 -0
  242. package/lib/types/client/stream-buffer.js.map +1 -0
  243. package/lib/types/client/streaming.d.ts +18 -0
  244. package/lib/types/client/streaming.d.ts.map +1 -0
  245. package/lib/types/client/streaming.js +84 -0
  246. package/lib/types/client/streaming.js.map +1 -0
  247. package/lib/types/client/timeline.d.ts +26 -0
  248. package/lib/types/client/timeline.d.ts.map +1 -0
  249. package/lib/types/client/timeline.js +48 -0
  250. package/lib/types/client/timeline.js.map +1 -0
  251. package/lib/types/client/tool-activity.d.ts +98 -0
  252. package/lib/types/client/tool-activity.d.ts.map +1 -0
  253. package/lib/types/client/tool-activity.js +301 -0
  254. package/lib/types/client/tool-activity.js.map +1 -0
  255. package/lib/types/client/types.d.ts +91 -0
  256. package/lib/types/client/types.d.ts.map +1 -0
  257. package/lib/types/client/types.js +2 -0
  258. package/lib/types/client/types.js.map +1 -0
  259. package/lib/types/client/waiting-clock.d.ts +49 -0
  260. package/lib/types/client/waiting-clock.d.ts.map +1 -0
  261. package/lib/types/client/waiting-clock.js +80 -0
  262. package/lib/types/client/waiting-clock.js.map +1 -0
  263. package/lib/types/client/word-motion.d.ts +16 -0
  264. package/lib/types/client/word-motion.d.ts.map +1 -0
  265. package/lib/types/client/word-motion.js +90 -0
  266. package/lib/types/client/word-motion.js.map +1 -0
  267. package/lib/types/client/word-timeline.d.ts +32 -0
  268. package/lib/types/client/word-timeline.d.ts.map +1 -0
  269. package/lib/types/client/word-timeline.js +119 -0
  270. package/lib/types/client/word-timeline.js.map +1 -0
  271. package/lib/types/dsh-tidy-display.d.ts +17 -0
  272. package/lib/types/dsh-tidy-display.d.ts.map +1 -0
  273. package/lib/types/dsh-tidy-display.js +97 -0
  274. package/lib/types/dsh-tidy-display.js.map +1 -0
  275. package/lib/types/skill-roots.d.ts +22 -0
  276. package/lib/types/skill-roots.d.ts.map +1 -0
  277. package/lib/types/skill-roots.js +126 -0
  278. package/lib/types/skill-roots.js.map +1 -0
  279. package/lib/types/skill-status.d.ts +36 -0
  280. package/lib/types/skill-status.d.ts.map +1 -0
  281. package/lib/types/skill-status.js +51 -0
  282. package/lib/types/skill-status.js.map +1 -0
  283. package/package.json +141 -0
  284. package/scripts/build-motion-fixture.mjs +26 -0
  285. package/scripts/check-harness-compat.mjs +75 -0
  286. package/scripts/link-harness-dependencies.mjs +54 -0
  287. package/scripts/verify-auto-fold.mjs +114 -0
  288. package/scripts/verify-official-bridge.mjs +121 -0
  289. package/scripts/verify-tool-shimmer.mjs +62 -0
  290. package/skills/generative-mcpapps/SKILL.md +47 -0
  291. package/skills/generative-mcpapps/examples/interactive_quiz.html +153 -0
  292. package/skills/generative-mcpapps/references/html_boilerplate.md +122 -0
  293. package/skills/generative-mcpapps/references/sep1865_protocol.md +54 -0
  294. package/src/client/Blocks.tsx +213 -0
  295. package/src/client/ChoreographedFlow.tsx +232 -0
  296. package/src/client/ClosedProcessSummary.tsx +23 -0
  297. package/src/client/DiffPanel.tsx +124 -0
  298. package/src/client/LiveFold.tsx +43 -0
  299. package/src/client/McpAppFrame.module.css +210 -0
  300. package/src/client/McpAppFrame.tsx +317 -0
  301. package/src/client/OfficialContent.tsx +69 -0
  302. package/src/client/Reader.module.css +714 -0
  303. package/src/client/Reader.tsx +783 -0
  304. package/src/client/ReasoningCard.tsx +306 -0
  305. package/src/client/SettingsSection.module.css +184 -0
  306. package/src/client/SettingsSection.tsx +391 -0
  307. package/src/client/StickyLane.tsx +34 -0
  308. package/src/client/ToolActivity.tsx +274 -0
  309. package/src/client/TurnMetrics.module.css +139 -0
  310. package/src/client/TurnMetrics.tsx +160 -0
  311. package/src/client/WaitClock.tsx +33 -0
  312. package/src/client/WaitingStatus.tsx +13 -0
  313. package/src/client/conversation-scroll.ts +28 -0
  314. package/src/client/deliverables.ts +122 -0
  315. package/src/client/entry-policy.ts +20 -0
  316. package/src/client/entry.tsx +40 -0
  317. package/src/client/fold-choreography.ts +55 -0
  318. package/src/client/fold-intensity.ts +36 -0
  319. package/src/client/index.tsx +268 -0
  320. package/src/client/live-turn.ts +155 -0
  321. package/src/client/markdown/MarkdownText.module.css +304 -0
  322. package/src/client/markdown/MarkdownText.tsx +195 -0
  323. package/src/client/markdown/cjkFriendlyStrong.ts +84 -0
  324. package/src/client/markdown/incremental.ts +131 -0
  325. package/src/client/markdown/katex.tsx +91 -0
  326. package/src/client/markdown/mathCompatibility.ts +352 -0
  327. package/src/client/markdown/parse.ts +45 -0
  328. package/src/client/markdown/render.tsx +647 -0
  329. package/src/client/markdown/upstream.json +14 -0
  330. package/src/client/mcp-app.ts +323 -0
  331. package/src/client/message-chrome.ts +47 -0
  332. package/src/client/motion.tsx +410 -0
  333. package/src/client/native/ContextBody.module.css +161 -0
  334. package/src/client/native/ContextBody.tsx +591 -0
  335. package/src/client/native/ContextInjectionRow.module.css +66 -0
  336. package/src/client/native/ContextInjectionRow.tsx +106 -0
  337. package/src/client/native/ReferenceIcon.tsx +35 -0
  338. package/src/client/native/tool-call-model.ts +248 -0
  339. package/src/client/native/tool-update.ts +32 -0
  340. package/src/client/native/upstream.json +41 -0
  341. package/src/client/official-slots.tsx +211 -0
  342. package/src/client/open-file.ts +94 -0
  343. package/src/client/pending-submission.ts +49 -0
  344. package/src/client/platform-media.ts +17 -0
  345. package/src/client/primitive-labels.ts +54 -0
  346. package/src/client/projection.ts +118 -0
  347. package/src/client/rail/RailView.tsx +508 -0
  348. package/src/client/rail/colors.ts +212 -0
  349. package/src/client/reasoning-follow.ts +28 -0
  350. package/src/client/settings-copy.ts +128 -0
  351. package/src/client/settings-slots.ts +27 -0
  352. package/src/client/settings.tsx +73 -0
  353. package/src/client/skill-status.ts +78 -0
  354. package/src/client/store.ts +130 -0
  355. package/src/client/stream-buffer.ts +136 -0
  356. package/src/client/streaming.tsx +70 -0
  357. package/src/client/style.d.ts +4 -0
  358. package/src/client/timeline.ts +75 -0
  359. package/src/client/tool-activity.ts +298 -0
  360. package/src/client/types.ts +89 -0
  361. package/src/client/waiting-clock.ts +83 -0
  362. package/src/client/word-motion.tsx +92 -0
  363. package/src/client/word-timeline.ts +113 -0
  364. package/src/dsh-tidy-display.ts +112 -0
  365. package/src/skill-roots.ts +138 -0
  366. package/src/skill-status.ts +81 -0
  367. package/tests/browser-auto-fold.tsx +64 -0
  368. package/tests/browser-closed-gap.tsx +20 -0
  369. package/tests/browser-motion.tsx +65 -0
  370. package/tests/browser-official-bridge.tsx +152 -0
  371. package/tests/browser-sticky-lanes.tsx +22 -0
  372. package/tests/browser-waiting-clock.tsx +14 -0
  373. package/tests/chat-flow-hook.test.ts +66 -0
  374. package/tests/cloud-gate.test.ts +34 -0
  375. package/tests/context-tool-update.test.ts +33 -0
  376. package/tests/conversation-scroll.test.ts +47 -0
  377. package/tests/deliverables.test.ts +128 -0
  378. package/tests/entry.test.ts +42 -0
  379. package/tests/fixtures/maid-composer-hide.html +31 -0
  380. package/tests/fold-choreography.test.ts +54 -0
  381. package/tests/fold-intensity.test.ts +93 -0
  382. package/tests/footer-precedence.test.ts +129 -0
  383. package/tests/history-word-regression.test.ts +16 -0
  384. package/tests/live-turn.test.ts +218 -0
  385. package/tests/mcp-apps.test.ts +157 -0
  386. package/tests/message-chrome.test.ts +29 -0
  387. package/tests/official-slots.test.ts +112 -0
  388. package/tests/open-file.test.ts +114 -0
  389. package/tests/pending-submission.test.ts +45 -0
  390. package/tests/platform-media.test.ts +23 -0
  391. package/tests/projection.test.ts +184 -0
  392. package/tests/reasoning-follow.test.ts +34 -0
  393. package/tests/settings-copy.test.ts +63 -0
  394. package/tests/skill-status.test.ts +140 -0
  395. package/tests/stock-install.test.ts +58 -0
  396. package/tests/stream-buffer.test.ts +102 -0
  397. package/tests/timeline.test.ts +59 -0
  398. package/tests/tool-diff.test.ts +57 -0
  399. package/tests/waiting-clock.test.ts +83 -0
  400. package/tests/word-timeline.test.ts +146 -0
  401. package/tsconfig.json +11 -0
  402. package/tsdown.config.ts +51 -0
@@ -0,0 +1,508 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Fragment, memo, useCallback, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
3
+ import { JsonBlock, MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives';
4
+ import { BlockBoundary, Blocks, contentBlocks, CopyAnswer, UserMessageActions } from './Blocks.js';
5
+ import { ReasoningCard } from './ReasoningCard.js';
6
+ import { ToolActivity, ToolMedia } from './ToolActivity.js';
7
+ import { OfficialActions, OfficialNode, OfficialTail } from './OfficialContent.js';
8
+ import { preparingLabel, readerFlow } from './tool-activity.js';
9
+ import { Disclosure, ProcessFragment, RetiringContent, StatusText, useMotionAllowed, usePinnedSelection, useReadingScroll } from './motion.js';
10
+ import { StreamMotionContext } from './streaming.js';
11
+ import { assistantSegments, boundaryOf, forkAnchorSeq, groupNodes, hasProcessContent, hasVisibleBody, isEarlierNarration, processChoiceKey, processExpanded, terminalLabel } from './projection.js';
12
+ import { basename, createProducedFileMentions, dirname, getTurnDeliverables, showDeliverablesRow } from './deliverables.js';
13
+ import { deliverableOpenModeOf } from './open-file.js';
14
+ import { asReadonlyArray, pendingSubmissionImages } from './pending-submission.js';
15
+ import { WaitingStatus } from './WaitingStatus.js';
16
+ import { handsBackToModel, waitingAnchor } from './waiting-clock.js';
17
+ import { ContextInjectionRow } from './native/ContextInjectionRow.js';
18
+ import { RailView } from './rail/RailView.js';
19
+ import { presentLiveTurn, segmentLiveTurn } from './live-turn.js';
20
+ import { bubblesOf, frostedGlassOf } from './fold-intensity.js';
21
+ import { ChoreographedFlow, useFlowChat } from './ChoreographedFlow.js';
22
+ import { ClosedProcessSummary } from './ClosedProcessSummary.js';
23
+ import { StickyLane } from './StickyLane.js';
24
+ import css from './Reader.module.css';
25
+ import { markdownLabels, truncatedJsonLabel } from './primitive-labels.js';
26
+ function isNode(node, kind) {
27
+ return node.kind === kind;
28
+ }
29
+ function cleanErrorMessage(raw) {
30
+ if (!raw)
31
+ return '模型服务暂时无响应或连接中断,请稍后重试。';
32
+ let str = raw.trim();
33
+ if (str.includes('"error"') || str.startsWith('{')) {
34
+ try {
35
+ const idx = str.indexOf('{');
36
+ const parsed = JSON.parse(str.slice(idx));
37
+ const msg = parsed?.error?.message || parsed?.message || parsed?.error;
38
+ if (typeof msg === 'string')
39
+ str = msg;
40
+ }
41
+ catch {
42
+ // keep
43
+ }
44
+ }
45
+ return str;
46
+ }
47
+ const CompactionDivider = memo(function CompactionDivider({ data }) {
48
+ const [open, setOpen] = useState(false);
49
+ if (!data)
50
+ return null;
51
+ const hasSummary = typeof data.summary === 'string' && data.summary.trim().length > 0;
52
+ const items = data.shadowedItemCount;
53
+ const tokens = data.shadowedTokenCount;
54
+ let label = '已压缩历史上下文';
55
+ if (items && tokens) {
56
+ const kTokens = tokens >= 1000 ? `${(tokens / 1000).toFixed(1)}k` : String(tokens);
57
+ label = `已压缩 ${items} 条上下文 · 释放约 ${kTokens} tokens`;
58
+ }
59
+ else if (items) {
60
+ label = `已压缩 ${items} 条上下文`;
61
+ }
62
+ else if (tokens) {
63
+ const kTokens = tokens >= 1000 ? `${(tokens / 1000).toFixed(1)}k` : String(tokens);
64
+ label = `已压缩上下文 · 释放约 ${kTokens} tokens`;
65
+ }
66
+ return (_jsxs("div", { className: css.compactionRow, "data-reader-compaction": true, children: [_jsx("div", { className: css.compactionLine, children: hasSummary ? (_jsxs("button", { type: "button", className: `${css.compactionPill} ${css.compactionButton}`, onClick: () => setOpen(v => !v), "aria-expanded": open, title: open ? '收起历史记忆摘要' : '展开查看此节点提炼的记忆摘要', children: [_jsxs("svg", { className: css.compactionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("path", { d: "M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2z", strokeWidth: "1.2" }), _jsx("path", { d: "M8 5v3.2l2 1.8", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { children: label }), _jsx("span", { className: css.compactionToggle, children: open ? '收起备忘' : '查看备忘' })] })) : (_jsxs("span", { className: css.compactionPill, children: [_jsxs("svg", { className: css.compactionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("path", { d: "M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2z", strokeWidth: "1.2" }), _jsx("path", { d: "M8 5v3.2l2 1.8", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { children: label })] })) }), open && hasSummary && (_jsxs("div", { className: css.compactionSummaryBox, "data-reader-anchor": true, children: [_jsx("div", { className: css.compactionSummaryHeader, children: "\u524D\u671F\u5BF9\u8BDD\u8981\u70B9\u5907\u5FD8" }), _jsx(MarkdownText, { text: data.summary, labels: markdownLabels })] }))] }));
67
+ });
68
+ const ProcessNode = memo(function ProcessNode({ useChat, t, nodeKey, open, motion, onRead, returnFocusTo }) {
69
+ const node = useChat(snapshot => snapshot.nodes.get(nodeKey));
70
+ if (!node || node.visibility === 'hidden')
71
+ return null;
72
+ let content = null;
73
+ if (isNode(node, 'context'))
74
+ content = _jsx(ContextInjectionRow, { ...node.data, t: t });
75
+ else if (isNode(node, 'system-prompt'))
76
+ content = _jsxs("details", { className: css.detail, children: [_jsx("summary", { children: "\u7CFB\u7EDF\u63D0\u793A\u8BCD" }), _jsx("pre", { className: css.systemPrompt, children: node.data.text })] });
77
+ else if (isNode(node, 'model-retry'))
78
+ content = _jsx(JsonBlock, { label: "\u6A21\u578B\u91CD\u8BD5\u8BB0\u5F55", payload: node.data.attempts, truncatedLabel: truncatedJsonLabel });
79
+ else if (isNode(node, 'manual-compaction')) {
80
+ if (node.data.command.outcome?.kind === 'error') {
81
+ content = _jsxs("div", { className: css.error, role: "alert", children: [_jsxs("svg", { className: css.errorIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("circle", { cx: "8", cy: "8", r: "6.5", strokeWidth: "1.2" }), _jsx("path", { d: "M8 5v3.5M8 11.2h.01", strokeWidth: "1.5", strokeLinecap: "round" })] }), _jsxs("div", { className: css.errorCopy, children: [_jsx("div", { className: css.errorTitle, children: _jsx("strong", { children: "\u4E0A\u4E0B\u6587\u538B\u7F29\u672A\u6210\u529F" }) }), _jsx("p", { className: css.errorMessage, children: node.data.command.outcome.text })] })] });
82
+ }
83
+ else {
84
+ content = node.data.compaction ? _jsx(CompactionDivider, { data: node.data.compaction }) : null;
85
+ }
86
+ }
87
+ else if (isNode(node, 'compaction'))
88
+ content = _jsx(CompactionDivider, { data: node.data });
89
+ else if (isNode(node, 'command'))
90
+ content = _jsx(JsonBlock, { label: "\u547D\u4EE4\u8BB0\u5F55", payload: node.data, truncatedLabel: truncatedJsonLabel });
91
+ return content && _jsx(ProcessFragment, { open: open, motion: motion, onRead: onRead, returnFocusTo: returnFocusTo, nodeKey: nodeKey, framed: true, children: content });
92
+ });
93
+ const AssistantNode = memo(function AssistantNode({ useChat, nodeKey, boundary, processOpen = false, pinned = false, folded = false, partStart, motion, onRead, returnFocusTo, ...render }) {
94
+ const node = useChat(snapshot => snapshot.nodes.get(nodeKey));
95
+ if (!node || node.visibility === 'hidden' || !isNode(node, 'assistant-step'))
96
+ return null;
97
+ const data = node.data;
98
+ const parts = assistantSegments(data.blocks);
99
+ const earlier = isEarlierNarration(data, boundary);
100
+ const hasToolCalls = data.blocks.some(block => block.kind === 'tool-call');
101
+ const isProcessStep = earlier || folded || hasToolCalls || (boundary.latestStep > 0 && data.step < boundary.latestStep);
102
+ const body = data.blocks.filter(block => block.kind !== 'reasoning' && block.kind !== 'tool-call');
103
+ const visible = partStart === undefined ? parts : parts.filter(part => part.start === partStart);
104
+ return _jsx(_Fragment, { children: visible.map(part => {
105
+ const index = parts.findIndex(item => item.start === part.start);
106
+ const last = index === parts.length - 1;
107
+ return part.kind === 'reasoning'
108
+ ? _jsx(ProcessFragment, { open: processOpen, motion: motion, onRead: onRead, returnFocusTo: returnFocusTo, nodeKey: nodeKey, framed: true, children: _jsx(ReasoningCard, { step: data.step, active: processOpen && boundary.status === 'open' && data.step === boundary.latestStep, motion: motion, selected: pinned, onRead: onRead, children: _jsx(Blocks, { ...render, blocks: part.blocks, streaming: data.status === 'running' && last && data.blocks.at(-1)?.kind === 'reasoning', holdFormatting: pinned, startedAt: data.time, interrupted: data.status === 'interrupted', liveText: true }) }) }, part.start)
109
+ : isProcessStep ? _jsx(ProcessFragment, { open: processOpen, motion: motion, onRead: onRead, returnFocusTo: returnFocusTo, nodeKey: nodeKey, children: _jsx("article", { className: css.processCommentary, children: _jsx(Blocks, { ...render, blocks: part.blocks, streaming: data.status === 'running', holdFormatting: pinned, startedAt: data.time, interrupted: data.status === 'interrupted', liveText: true }) }) }, part.start)
110
+ : hasVisibleBody(part.blocks) && _jsx(RetiringContent, { visible: pinned || processOpen || (!earlier && !folded), children: _jsxs("article", { className: css.answer, "data-reader-answer": true, "data-reader-anchor": true, "data-reader-key": nodeKey, "data-chat-anchor-key": nodeKey, "data-chat-flow-kind": node.kind, "data-reader-source-start": part.start, "data-answer-status": data.status, "data-answer-phase": earlier || folded ? 'process' : 'body', children: [_jsx(Blocks, { ...render, blocks: part.blocks, streaming: data.status === 'running', holdFormatting: pinned, startedAt: data.time, interrupted: data.status === 'interrupted', liveText: true }), last && data.status === 'interrupted' && _jsx("span", { className: css.stopped, children: "\u5DF2\u505C\u6B62" }), last && !earlier && !folded && data.status !== 'running' && boundary.status === 'closed' && (_jsx(CopyAnswer, { blocks: body, onFork: (() => {
111
+ // The fork anchor must be the durable closing message seq (same as
112
+ // the official turn-tail branch). AssistantChatData carries no seq
113
+ // of its own; passing it would fork the whole session instead.
114
+ const anchor = forkAnchorSeq([data.finalNode, { seq: render.forkSeq }]);
115
+ return render.forkAt && anchor !== undefined ? () => render.forkAt(anchor) : undefined;
116
+ })(), metrics: render.metrics, extraActions: _jsx(OfficialActions, { official: render.official, messageId: data.finalNode?.messageId }) }))] }) }, part.start);
117
+ }) });
118
+ });
119
+ const MainNode = memo(function MainNode({ useChat, nodeKey, boundary: _boundary, pinned: _pinned, processOpen: _processOpen = false, ...render }) {
120
+ const node = useChat(snapshot => snapshot.nodes.get(nodeKey));
121
+ if (!node || node.visibility === 'hidden')
122
+ return null;
123
+ if (isNode(node, 'user') || isNode(node, 'steering')) {
124
+ const blocks = contentBlocks(node.data.content);
125
+ const imageBlocks = blocks.filter(b => b.kind === 'image');
126
+ const otherBlocks = blocks.filter(b => b.kind !== 'image');
127
+ const text = otherBlocks.filter((block) => block.kind === 'text').map(block => block.text).join('\n\n');
128
+ const time = node.data.time;
129
+ return _jsxs("div", { className: css.userCluster, "data-reader-anchor": true, "data-reader-key": nodeKey, "data-chat-anchor-key": nodeKey, "data-chat-flow-kind": node.kind, children: [node.kind === 'steering' && _jsx("p", { className: css.meta, children: "\u8865\u5145\u6D88\u606F" }), imageBlocks.length > 0 && _jsx("div", { className: css.userImages, children: _jsx(Blocks, { ...render, blocks: imageBlocks, source: "user" }) }), otherBlocks.length > 0 && _jsx("div", { className: css.user, children: _jsx(Blocks, { ...render, blocks: otherBlocks, source: "user" }) }), _jsx(UserMessageActions, { text: text, time: time })] });
130
+ }
131
+ if (isNode(node, 'assistant-step'))
132
+ return null;
133
+ if (isNode(node, 'tool-call'))
134
+ return _jsx(ToolMedia, { ...render, block: node.data.root });
135
+ if (isNode(node, 'turn-error'))
136
+ return _jsxs("div", { className: css.error, role: "alert", "data-reader-anchor": true, "data-chat-anchor-key": nodeKey, "data-chat-flow-kind": node.kind, children: [_jsxs("svg", { className: css.errorIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("circle", { cx: "8", cy: "8", r: "6.5", strokeWidth: "1.2" }), _jsx("path", { d: "M8 5v3.5M8 11.2h.01", strokeWidth: "1.5", strokeLinecap: "round" })] }), _jsxs("div", { className: css.errorCopy, children: [_jsxs("div", { className: css.errorTitle, children: [_jsx("strong", { children: "\u672C\u8F6E\u8FD0\u884C\u5931\u8D25" }), node.data.code && _jsx("code", { className: css.errorCode, children: node.data.code })] }), _jsx("p", { className: css.errorMessage, children: cleanErrorMessage(node.data.message) })] })] });
137
+ if (isNode(node, 'turn-max-tokens'))
138
+ return _jsx("div", { className: css.notice, children: "\u5DF2\u5230\u8FBE\u8F93\u51FA\u957F\u5EA6\u9650\u5236\uFF0C\u56DE\u7B54\u5C1A\u672A\u5B8C\u6574\u3002" });
139
+ if (isNode(node, 'model-retry'))
140
+ return node.data.current.retryState === 'scheduled'
141
+ ? _jsx("div", { className: css.notice, role: "status", children: "\u6A21\u578B\u8BF7\u6C42\u672A\u6210\u529F\uFF0C\u6B63\u5728\u7B49\u5F85\u91CD\u8BD5\u3002\u8BE6\u60C5\u4FDD\u7559\u5728\u6267\u884C\u8FC7\u7A0B\u4E2D\u3002" }) : null;
142
+ if (isNode(node, 'command') && render.official)
143
+ return _jsx(OfficialNode, { ...render, node: node, fallback: _jsx(JsonBlock, { label: "\u547D\u4EE4\u8BB0\u5F55", payload: node.data, truncatedLabel: truncatedJsonLabel }) });
144
+ if (isNode(node, 'command')) {
145
+ if (node.data.outcome?.kind === 'error')
146
+ return _jsxs("div", { className: css.error, role: "alert", children: [_jsxs("svg", { className: css.errorIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("circle", { cx: "8", cy: "8", r: "6.5", strokeWidth: "1.2" }), _jsx("path", { d: "M8 5v3.5M8 11.2h.01", strokeWidth: "1.5", strokeLinecap: "round" })] }), _jsxs("div", { className: css.errorCopy, children: [_jsx("div", { className: css.errorTitle, children: _jsx("strong", { children: "\u547D\u4EE4\u6267\u884C\u672A\u6210\u529F" }) }), _jsx("p", { className: css.errorMessage, children: node.data.outcome.text ?? node.data.name ?? '查看原对话中的命令记录' })] })] });
147
+ return node.data.outcome?.text ? _jsx(MarkdownText, { text: node.data.outcome.text, labels: markdownLabels }) : null;
148
+ }
149
+ if (isNode(node, 'manual-compaction') || isNode(node, 'compaction'))
150
+ return null;
151
+ if (node.kind === 'context' || node.kind === 'turn-tail' || node.kind === 'system-prompt' || node.kind === 'turn-process')
152
+ return null;
153
+ // No 'command-input' branch: that string is not a chat node kind in any released
154
+ // host (it appears nowhere in the installed packages), so a slash command arrives
155
+ // as 'command' above and is rendered there. Keeping the branch only made the file
156
+ // look like it handled a case that cannot occur.
157
+ return _jsx(OfficialNode, { ...render, node: node, fallback: _jsxs("div", { className: css.unknown, "data-reader-anchor": true, "data-chat-anchor-key": nodeKey, "data-chat-flow-kind": node.kind, children: [_jsxs("p", { children: ["\u6B64\u8BB0\u5F55\u7C7B\u578B\u6682\u672A\u63A5\u5165\u9605\u8BFB\u9875\uFF1A", node.kind] }), render.official && _jsx("button", { type: "button", className: css.textButton, onClick: () => render.official.openView('chat', node.key), children: "\u5728\u5BF9\u8BDD\u4E2D\u67E5\u770B" }), _jsx(JsonBlock, { label: "\u67E5\u770B\u539F\u59CB\u8BB0\u5F55", payload: node.data, truncatedLabel: truncatedJsonLabel })] }) });
158
+ });
159
+ /**
160
+ * Sub-agents this turn dispatched, read from the host's own Turn-process row.
161
+ *
162
+ * The host already derives this from the dispatch tree (`subagentCount` on
163
+ * `TurnProcessChatData`), so counting calls here would only risk disagreeing with
164
+ * it. The row is otherwise hidden by the reader, which is why this is the one place
165
+ * its counters are read.
166
+ */
167
+ function subagentCount(snapshot, keys) {
168
+ for (const key of keys) {
169
+ const node = snapshot.nodes.get(key);
170
+ if (!node || node.kind !== 'turn-process')
171
+ continue;
172
+ const value = node.data.subagentCount;
173
+ if (typeof value === 'number' && Number.isFinite(value) && value > 0)
174
+ return value;
175
+ }
176
+ return 0;
177
+ }
178
+ function GroupStatus({ group, sessionId: _sessionId, useChat, pending, motion }) {
179
+ const text = useChat(snapshot => {
180
+ const turn = group.turn === null ? undefined : snapshot.timeline.turns.get(group.turn);
181
+ if (turn?.status === 'closed') {
182
+ if (turn.end?.data.reason.kind !== 'completed')
183
+ return '执行过程';
184
+ const elapsed = turn.start && turn.end ? Math.max(0, Math.round((turn.end.time - turn.start.time) / 1000)) : null;
185
+ return elapsed === null ? '执行过程' : elapsed < 60 ? `用时 ${elapsed} 秒` : `用时 ${Math.floor(elapsed / 60)} 分 ${elapsed % 60} 秒`;
186
+ }
187
+ if (turn?.status !== 'open')
188
+ return '执行过程';
189
+ if (pending !== undefined)
190
+ return '等待你的操作';
191
+ const current = turn.steps.at(-1)?.data.get('assistant-step');
192
+ const last = current?.blocks.at(-1);
193
+ if (current?.status === 'running' && last?.kind === 'tool-call') {
194
+ const spawned = subagentCount(snapshot, group.keys);
195
+ return spawned ? `${preparingLabel(last.name)}·${spawned} 个子代理` : preparingLabel(last.name);
196
+ }
197
+ for (let index = group.keys.length - 1; index >= 0; index--) {
198
+ const node = snapshot.nodes.get(group.keys[index]);
199
+ if (!node)
200
+ continue;
201
+ if (isNode(node, 'tool-call') && !('kind' in node.data.root))
202
+ return '正在使用工具';
203
+ if (isNode(node, 'assistant-step') && node.data.status === 'running') {
204
+ const last = node.data.blocks.at(-1);
205
+ return last?.kind === 'reasoning' ? '正在思考' : last?.kind === 'text' ? '正在输出' : '正在准备回复';
206
+ }
207
+ }
208
+ return '正在处理';
209
+ });
210
+ const busy = useChat(snapshot => group.turn !== null && snapshot.timeline.turns.get(group.turn)?.status === 'open' && pending === undefined);
211
+ return _jsx(StatusText, { text: text, motion: motion, shimmer: busy });
212
+ }
213
+ const DeliverableChip = memo(function DeliverableChip({ path, openFile, revealFile, openMode }) {
214
+ const [status, setStatus] = useState('idle');
215
+ const timer = useRef();
216
+ const flash = (next) => {
217
+ setStatus(next);
218
+ clearTimeout(timer.current);
219
+ timer.current = setTimeout(() => setStatus('idle'), 1600);
220
+ };
221
+ const onOpen = (event) => {
222
+ event.stopPropagation();
223
+ try {
224
+ openFile?.(path);
225
+ flash('opened');
226
+ }
227
+ catch {
228
+ // fallback
229
+ }
230
+ };
231
+ const onReveal = (event) => {
232
+ event.stopPropagation();
233
+ try {
234
+ if (revealFile) {
235
+ revealFile(path);
236
+ }
237
+ else {
238
+ openFile?.(dirname(path));
239
+ }
240
+ flash('revealed');
241
+ }
242
+ catch {
243
+ // fallback
244
+ }
245
+ };
246
+ const onCopy = (event) => {
247
+ event.stopPropagation();
248
+ try {
249
+ void navigator.clipboard?.writeText(path);
250
+ flash('copied');
251
+ }
252
+ catch {
253
+ // fallback
254
+ }
255
+ };
256
+ const name = basename(path);
257
+ const folder = dirname(path);
258
+ return (_jsxs("div", { className: css.deliverableChip, "data-status": status, title: path, children: [_jsxs("button", { type: "button", className: css.chipMain, onClick: onOpen, onDoubleClick: onOpen, "aria-label": openMode === 'sidebar' ? `在内置面板中打开 ${path}` : `用系统应用打开 ${path}`, children: [status === 'opened' ? (_jsx("svg", { className: css.statusIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M3.5 8.5l3 3 6-7", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })) : (_jsxs("svg", { className: css.deliverableIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("path", { d: "M4 2.5h5l3 3V13.5H4V2.5z", strokeWidth: "1.2", strokeLinejoin: "round" }), _jsx("path", { d: "M9 2.5v3h3", strokeWidth: "1.2", strokeLinejoin: "round" })] })), _jsx("span", { className: css.deliverableName, children: status === 'opened' ? (openMode === 'sidebar' ? '已在面板打开' : '已在外部打开') : name })] }), _jsxs("div", { className: css.chipActions, "aria-label": "\u6587\u4EF6\u64CD\u4F5C", children: [_jsx("button", { type: "button", className: css.chipActionBtn, title: `在访达中定位所在目录 (${folder})`, "aria-label": "\u5728\u8BBF\u8FBE\u4E2D\u663E\u793A\u6240\u5728\u76EE\u5F55", onClick: onReveal, children: status === 'revealed' ? (_jsx("svg", { className: css.actionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M3.5 8.5l3 3 6-7", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })) : (_jsx("svg", { className: css.actionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M2 4.5h4l1.5 2H14v6.5H2V4.5z", strokeWidth: "1.2", strokeLinejoin: "round" }) })) }), _jsx("button", { type: "button", className: css.chipActionBtn, title: "\u590D\u5236\u76F8\u5BF9\u8DEF\u5F84", "aria-label": "\u590D\u5236\u76F8\u5BF9\u8DEF\u5F84", onClick: onCopy, children: status === 'copied' ? (_jsx("svg", { className: css.actionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M3.5 8.5l3 3 6-7", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })) : (_jsxs("svg", { className: css.actionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("rect", { x: "5.5", y: "5.5", width: "8", height: "8", rx: "1.5", strokeWidth: "1.2" }), _jsx("path", { d: "M4 10.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v1", strokeWidth: "1.2", strokeLinecap: "round" })] })) })] })] }));
259
+ });
260
+ function DeliverablesRow({ deliverables, openFile, revealFile, openMode }) {
261
+ const [folderStatus, setFolderStatus] = useState('idle');
262
+ const onOpenWorkspace = () => {
263
+ try {
264
+ openFile?.('.');
265
+ setFolderStatus('opened');
266
+ setTimeout(() => setFolderStatus('idle'), 1600);
267
+ }
268
+ catch {
269
+ // ignore
270
+ }
271
+ };
272
+ return (_jsxs("div", { className: css.deliverablesRoot, "data-reader-deliverables": true, children: [_jsx("span", { className: css.deliverablesLabel, children: "\u4EA7\u7269" }), _jsx("div", { className: css.deliverablesLane, children: _jsxs("div", { className: css.deliverablesRow, children: [deliverables.slice(0, 8).map(path => (_jsx(DeliverableChip, { path: path, openFile: openFile, revealFile: revealFile, openMode: openMode }, path))), deliverables.length > 8 && (_jsxs("span", { className: css.deliverablesMore, children: ["+ ", deliverables.length - 8, " \u4E2A\u6587\u4EF6"] })), deliverables.length > 1 && (_jsxs("button", { type: "button", className: css.deliverablesShowFolder, "data-status": folderStatus, onClick: onOpenWorkspace, title: "\u5728\u8BBF\u8FBE\u4E2D\u6253\u5F00\u6574\u4E2A\u5DE5\u4F5C\u533A\u76EE\u5F55", children: [folderStatus === 'opened' && (_jsx("svg", { className: css.statusIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M3.5 8.5l3 3 6-7", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })), _jsx("span", { children: folderStatus === 'opened' ? '已打开访达' : '在文件夹中显示' })] }))] }) })] }));
273
+ }
274
+ const TurnGroup = memo(function TurnGroup({ group, motion, autoFold, pinnedKeys, selectedProcessKeys, isAwaitingModel = false, ...props }) {
275
+ const snapshot = props.useChat(snapshot => snapshot);
276
+ const nodes = snapshot.nodes;
277
+ const turn = group.turn === null ? undefined : snapshot.timeline.turns.get(group.turn);
278
+ const interaction = props.useSessionStatus(snapshot => snapshot.get(props.sessionId)?.pendingInteraction);
279
+ const sessionRunning = props.useSession(snapshot => snapshot.running);
280
+ const boundary = useMemo(() => boundaryOf(turn), [turn]);
281
+ const choiceKey = processChoiceKey(group.key, boundary);
282
+ const expansionChoice = props.useStore(state => state.expanded[choiceKey]);
283
+ const flowId = useId();
284
+ const processButton = useRef(null);
285
+ const setExpanded = useCallback((value) => props.actions.setExpanded(choiceKey, value), [props.actions, choiceKey]);
286
+ const pinProcess = useCallback(() => setExpanded(true), [setExpanded]);
287
+ const firstKind = props.useChat(snapshot => snapshot.nodes.get(group.keys[0])?.kind);
288
+ const startsWithUser = firstKind === 'user';
289
+ const mainKeys = startsWithUser ? group.keys.slice(1) : group.keys;
290
+ const flow = useMemo(() => readerFlow({ ...group, keys: mainKeys }, turn, key => nodes.get(key)), [nodes, group, mainKeys, turn]);
291
+ const steps = useMemo(() => segmentLiveTurn(flow, key => nodes.get(key)), [flow, nodes]);
292
+ const liveItems = useMemo(() => presentLiveTurn(steps, boundary, autoFold), [steps, boundary, autoFold]);
293
+ const openMode = deliverableOpenModeOf(useSyncExternalStore(props.openPrefs?.subscribe ?? ((fn) => { void fn; return () => { }; }), () => props.openPrefs?.getSnapshot()?.deliverableOpenMode, () => 'external'));
294
+ const hasProcess = flow.some(item => item.kind === 'tool' || hasProcessContent(nodes.get(item.nodeKey), boundary));
295
+ // Only a real, still-active text selection delays folding. Merely clicking,
296
+ // focusing or scrolling the live card does not create a permanent override.
297
+ const holdingSelection = selectedProcessKeys.some(key => flow.some(item => item.key === key)
298
+ || liveItems.some(item => item.kind === 'fold'
299
+ ? item.key === key || item.steps.some(step => step.key === key || ('nodeKey' in step && step.nodeKey === key))
300
+ : item.key === key || ('nodeKey' in item.step && item.step.nodeKey === key)));
301
+ const expanded = !autoFold || holdingSelection || processExpanded(expansionChoice, boundary);
302
+ const [foldOpenByKey, setFoldOpenByKey] = useState({});
303
+ useLayoutEffect(() => {
304
+ // Restoring automatic folding also releases live "prior steps" disclosures.
305
+ if (autoFold)
306
+ setFoldOpenByKey(current => Object.keys(current).length ? {} : current);
307
+ }, [autoFold]);
308
+ const deliverables = useMemo(() => getTurnDeliverables(turn, flow), [turn, flow]);
309
+ const tailData = useMemo(() => {
310
+ for (const key of group.keys) {
311
+ const n = nodes.get(key);
312
+ if (n && isNode(n, 'turn-tail'))
313
+ return n.data;
314
+ }
315
+ return undefined;
316
+ }, [group.keys, nodes]);
317
+ const tailOwner = useMemo(() => turn && tailData ? {
318
+ turn, seq: tailData.closing?.finalNode.seq ?? tailData.seq, openFile: props.openFile,
319
+ } : undefined, [turn, tailData, props.openFile]);
320
+ const fileMentions = useMemo(() => {
321
+ const official = tailOwner ? props.officialFileMentions(tailOwner) : undefined;
322
+ const reader = deliverables.length > 0 ? createProducedFileMentions(deliverables, props.openFile) : undefined;
323
+ return official || reader ? { resolve: (value) => official?.resolve(value) ?? reader?.resolve(value) } : undefined;
324
+ }, [tailOwner, props.officialFileMentions, deliverables, props.openFile]);
325
+ const official = useMemo(() => ({
326
+ renderSlot: props.renderSlot, renderSlotChain: props.renderSlotChain,
327
+ officialImageLoader: props.officialImageLoader, officialFileMentions: props.officialFileMentions,
328
+ officialPreviewFile: props.officialPreviewFile,
329
+ officialHost: props.officialHost, openView: props.openView,
330
+ }), [props.renderSlot, props.renderSlotChain, props.officialImageLoader, props.officialFileMentions, props.officialPreviewFile, props.officialHost, props.openView]);
331
+ const cwd = props.useSessions(state => state.byId[props.sessionId]?.cwd);
332
+ const runMs = turn?.start && turn?.end ? Math.max(0, turn.end.time - turn.start.time) : undefined;
333
+ const metrics = useMemo(() => ({
334
+ usage: tailData?.tokenUsage,
335
+ runMs,
336
+ tokensPerSecond: tailData?.tokensPerSecond,
337
+ ttftMs: tailData?.ttftMs,
338
+ endedAt: tailData?.closing?.time ?? turn?.end?.time,
339
+ }), [tailData, runMs, turn?.end?.time]);
340
+ const forkSeq = forkAnchorSeq([tailData?.closing?.finalNode]);
341
+ const presentation = useMemo(() => {
342
+ // ChatNodeStore exposes live keyed readers. Materialize this turn instead of
343
+ // retaining a live get() function and mistakenly calling it a frozen frame.
344
+ const captured = new Map(group.keys.flatMap(key => {
345
+ const node = nodes.get(key);
346
+ return node ? [[key, node]] : [];
347
+ }));
348
+ return { items: holdingSelection ? presentLiveTurn(steps, boundary, false) : liveItems,
349
+ snapshot: { ...snapshot, nodes: { ...nodes, get: (key) => captured.get(key), values: () => [...captured.values()] } } };
350
+ }, [snapshot, nodes, group, steps, boundary, liveItems, holdingSelection]);
351
+ const shared = {
352
+ useChat: useFlowChat,
353
+ renderSlotChain: props.renderSlotChain,
354
+ loadImage: props.loadImage,
355
+ fillComposer: props.fillComposer,
356
+ openFile: props.openFile,
357
+ revealFile: props.revealFile,
358
+ forkAt: props.forkAt,
359
+ forkSeq,
360
+ fileMentions,
361
+ metrics,
362
+ official,
363
+ cwd,
364
+ };
365
+ const terminal = terminalLabel(boundary.reason);
366
+ const hasTurnError = flow.some(item => item.kind === 'node' && nodes.get(item.nodeKey)?.kind === 'turn-error');
367
+ // A stopped turn normally stays quiet, but a stopped turn that produced no
368
+ // prose at all reads as if its answer vanished into the process fold. Say so.
369
+ const hasAnswerProse = steps.some(step => step.kind === 'body'
370
+ && step.blocks.some(block => block.kind === 'text' && block.text.trim() !== ''));
371
+ const stoppedWithoutAnswer = (boundary.reason === 'interrupted' || boundary.reason === 'aborted') && !hasAnswerProse;
372
+ const showTerminalNotice = terminal && !hasTurnError
373
+ && (stoppedWithoutAnswer || (boundary.reason !== 'interrupted' && boundary.reason !== 'aborted'));
374
+ const renderStep = (step, folded) => {
375
+ const processOpen = folded || expanded;
376
+ if (step.kind === 'reasoning' || step.kind === 'body')
377
+ return _jsx(BlockBoundary, { children: _jsx(AssistantNode, { ...shared, boundary: boundary, nodeKey: step.nodeKey, partStart: step.start, pinned: pinnedKeys.includes(step.nodeKey), processOpen: processOpen, folded: folded, motion: motion, onRead: pinProcess, returnFocusTo: processButton }) });
378
+ if (step.kind === 'tool')
379
+ return _jsx(BlockBoundary, { children: _jsxs(ProcessFragment, { open: processOpen, motion: motion, onRead: pinProcess, returnFocusTo: processButton, nodeKey: step.key, framed: true, children: [_jsx(ToolActivity, { ...shared, entry: step.entry, motion: motion, turnClosed: boundary.status === 'closed', onRead: pinProcess }), step.entry.block && _jsx(ToolMedia, { ...shared, block: step.entry.block })] }) });
380
+ if (step.kind === 'user')
381
+ return _jsx(BlockBoundary, { children: _jsx(MainNode, { ...shared, boundary: boundary, nodeKey: step.nodeKey }) });
382
+ return _jsxs(Fragment, { children: [_jsx(BlockBoundary, { children: _jsx(ProcessNode, { useChat: useFlowChat, t: props.t, nodeKey: step.nodeKey, open: processOpen, motion: motion, onRead: pinProcess, returnFocusTo: processButton }) }), _jsx(BlockBoundary, { children: _jsx(MainNode, { ...shared, boundary: boundary, nodeKey: step.nodeKey, pinned: pinnedKeys.includes(step.nodeKey), processOpen: processOpen }) })] });
383
+ };
384
+ return _jsxs("section", { className: css.turn, "data-reader-turn": group.turn ?? 'unresolved', "data-reader-turn-state": boundary.status, "data-reader-turn-result": boundary.reason ?? undefined, children: [startsWithUser && _jsx(BlockBoundary, { children: _jsx(MainNode, { ...shared, useChat: props.useChat, boundary: boundary, nodeKey: group.keys[0] }) }), hasProcess && !isAwaitingModel && _jsx(StickyLane, { kind: "status", className: css.turnProcessSticky, children: _jsx(Disclosure, { open: expanded, onChange: setExpanded, controls: flowId, buttonRef: processButton, label: _jsx(GroupStatus, { group: group, sessionId: props.sessionId, useChat: props.useChat, pending: interaction, motion: motion }) }) }), boundary.status === 'closed' && hasProcess && autoFold && _jsx(ClosedProcessSummary, { open: expanded, onChange: setExpanded, controls: flowId, steps: steps.filter(step => {
385
+ if (step.kind === 'user')
386
+ return false;
387
+ if (step.kind !== 'body')
388
+ return true;
389
+ const node = nodes.get(step.nodeKey);
390
+ return !!node && isNode(node, 'assistant-step') && (isEarlierNarration(node.data, boundary)
391
+ || node.data.blocks.some(block => block.kind === 'tool-call')
392
+ || (boundary.latestStep > 0 && node.data.step < boundary.latestStep));
393
+ }) }), _jsx(ChoreographedFlow, { id: flowId, frame: presentation, motion: motion, enabled: autoFold && boundary.status === 'open' && !holdingSelection, urgent: hasTurnError || interaction !== undefined || !sessionRunning, open: foldOpenByKey, processOpen: expanded, onOpenChange: (key, value) => { pinProcess(); setFoldOpenByKey(current => ({ ...current, [key]: value })); }, renderStep: renderStep }), !hasProcess && boundary.status === 'open' && !isAwaitingModel && _jsx("div", { className: css.disclosure, "data-reader-status-only": true, children: _jsx(GroupStatus, { group: group, sessionId: props.sessionId, useChat: props.useChat, pending: interaction, motion: motion }) }), showDeliverablesRow(boundary.status, deliverables) && _jsx(DeliverablesRow, { deliverables: deliverables, openFile: props.openFile, revealFile: props.revealFile, openMode: openMode }), boundary.status === 'closed' && _jsx(BlockBoundary, { children: _jsx(OfficialTail, { official: official, owner: tailOwner, produced: deliverables }) }), showTerminalNotice && _jsx("div", { className: css.notice, "data-reader-terminal": true, children: terminal })] });
394
+ });
395
+ export function Reader(props) {
396
+ const root = useRef(null);
397
+ const activatedAt = useRef(Date.now());
398
+ const order = props.useChat(snapshot => snapshot.order);
399
+ const nodes = props.useChat(snapshot => snapshot.nodes);
400
+ const timeline = props.useChat(snapshot => snapshot.timeline);
401
+ const running = props.useSession(snapshot => snapshot.running);
402
+ const pending = props.useSessionStatus(snapshot => snapshot.get(props.sessionId)?.pendingInteraction);
403
+ const openError = props.useSession(snapshot => snapshot.openError);
404
+ const loading = props.useSession(snapshot => snapshot.openState === 'loading');
405
+ const hasMore = props.useSession(snapshot => snapshot.hasMore);
406
+ const loadingOlder = props.useSession(snapshot => snapshot.loadingOlder);
407
+ const pendingSubmissions = props.useSession(snapshot => snapshot.pendingSubmissions);
408
+ const pendingList = asReadonlyArray(pendingSubmissions);
409
+ const waitAnchor = waitingAnchor(order, key => nodes.get(key), pendingList);
410
+ const motionPreference = props.useStore(state => state.motion);
411
+ const motion = useMotionAllowed(motionPreference);
412
+ const prefsSnap = useSyncExternalStore(props.openPrefs?.subscribe ?? ((fn) => { void fn; return () => { }; }), () => props.openPrefs?.getSnapshot?.(), () => undefined);
413
+ const storeAutoFold = props.useStore(state => state.autoFold);
414
+ const autoFold = prefsSnap?.autoFold ?? (prefsSnap?.foldIntensity !== undefined ? prefsSnap.foldIntensity !== 0 : undefined) ?? storeAutoFold ?? true;
415
+ const previousAutoFold = useRef(autoFold);
416
+ useLayoutEffect(() => {
417
+ const restored = autoFold && !previousAutoFold.current;
418
+ previousAutoFold.current = autoFold;
419
+ // Watch the effective preference so toolbar and Settings changes behave alike.
420
+ // Reading while folding is off must not pin completed process content forever.
421
+ if (restored)
422
+ props.actions.resetExpanded();
423
+ }, [autoFold, props.actions]);
424
+ const frostedGlass = frostedGlassOf(prefsSnap);
425
+ const bubbles = bubblesOf(prefsSnap);
426
+ const streamMotion = useMemo(() => ({ enabled: motion, activatedAt: activatedAt.current }), [motion]);
427
+ const groups = useMemo(() => groupNodes(order, key => nodes.get(key)), [order, nodes, timeline]);
428
+ const isAwaitingModel = useMemo(() => {
429
+ // 状态机铁律:「深度求索中」与「正在处理/思考」永远互斥。
430
+ // 1. 仅空闲发送(!running)的本地回显窗口:用户按下回车第 0 毫秒立即反馈。
431
+ // 忙碌时的 queued/steering 回显不算等待——模型本来就在工作。
432
+ if (!running && pendingList.length > 0)
433
+ return true;
434
+ const lastKey = order.at(-1);
435
+ const lastNode = lastKey ? nodes.get(lastKey) : undefined;
436
+ if (!lastKey || !lastNode)
437
+ return false;
438
+ // 2. 模型已经产出内容:等待结束,计时器必须立刻消失。
439
+ // 「产出」= assistant-step 已带 block(正文/思维链/工具调用都算)。
440
+ if (lastNode.kind === 'assistant-step') {
441
+ const data = lastNode.data;
442
+ const blocks = data.blocks ?? [];
443
+ // 空 block 且仍在跑 = 请求已发出、模型还没吐字,正是要计时的那一刻。
444
+ return blocks.length === 0 && data.status === 'running';
445
+ }
446
+ // 3. 球在模型脚下:用户刚发言,或工具已返回、上下文已注入、命令已执行。
447
+ // 这些时刻模型随时可能卡住,正是要计时的地方;工具执行期间不计时,
448
+ // 因为那时忙的是工具而不是模型。
449
+ // handsBackToModel 内部按 chat 层 kind 判定,并区分「工具已返回」与
450
+ // 「工具仍在跑」——后者不算等待。
451
+ const modelOwesResponse = handsBackToModel(lastNode);
452
+ if (!modelOwesResponse)
453
+ return false;
454
+ // 轮次已结束就没什么可等的。
455
+ const lastGroup = groups.at(-1);
456
+ const turn = lastGroup?.turn === null || lastGroup?.turn === undefined ? undefined : timeline.turns.get(lastGroup.turn);
457
+ return turn?.status !== 'closed';
458
+ }, [running, pendingList, order, nodes, groups, timeline]);
459
+ const scroll = useReadingScroll(root, motion);
460
+ const pinnedKeys = usePinnedSelection(root);
461
+ const selectedProcessKeys = usePinnedSelection(root, '[data-reader-process]');
462
+ const [historyError, setHistoryError] = useState(false);
463
+ // Rail (ported from dsh-tidychat): config lives on the reader store. The rail
464
+ // is the single navigation rail — TimelineRail was removed in the merge; the
465
+ // outline-driven unloaded-turn coverage it provided is a rail follow-up.
466
+ const railEnabled = props.useStore(state => state.railEnabled);
467
+ const railSide = props.useStore(state => state.railSide);
468
+ const railStyle = props.useStore(state => state.railStyle);
469
+ const railRing = props.useStore(state => state.railRing);
470
+ const hideOfficialNav = props.useStore(state => state.hideOfficialNav);
471
+ const lastKey = order.at(-1);
472
+ const lastNode = lastKey ? nodes.get(lastKey) : undefined;
473
+ const lastSubmissionId = pendingList.length ? pendingList[pendingList.length - 1].requestId : null;
474
+ const lastOrderKeyRef = useRef(lastKey);
475
+ const lastSubmissionRef = useRef(lastSubmissionId);
476
+ useLayoutEffect(() => {
477
+ const appendedUser = lastKey !== lastOrderKeyRef.current && (lastNode?.kind === 'user' || lastNode?.kind === 'steering');
478
+ const appendedSubmission = lastSubmissionId !== null && lastSubmissionId !== lastSubmissionRef.current;
479
+ lastOrderKeyRef.current = lastKey;
480
+ lastSubmissionRef.current = lastSubmissionId;
481
+ if (appendedUser || appendedSubmission) {
482
+ scroll.jump();
483
+ }
484
+ }, [lastKey, lastNode?.kind, lastSubmissionId, scroll]);
485
+ const visibleSubmissions = useMemo(() => {
486
+ if (pendingList.length === 0)
487
+ return [];
488
+ return pendingList.filter(sub => sub.placement !== 'queued');
489
+ }, [pendingList]);
490
+ // ChatView publishes data-chat-flow="" on its column. Skins treat a
491
+ // scrollport without that hook as inspect-only and hide [data-composer-seat].
492
+ return _jsx(StreamMotionContext.Provider, { value: streamMotion, children: _jsxs("div", { ref: root, className: css.root, "data-reader-build": "0.3.3", "data-dsh-tidy-display": "0.3.3", "data-reader-wait-clock-version": "input-v1", "data-reader-wait-start": waitAnchor.time ?? undefined, "data-motion": motion ? 'on' : 'off', "data-reader-glass": frostedGlass || undefined, "data-reader-bubbles": bubbles ? 'on' : 'off', "data-reader-auto-fold": autoFold ? 'on' : 'off', children: [_jsx(RailView, { enabled: railEnabled, side: railSide, style: railStyle, ring: railRing, hideOfficialNav: hideOfficialNav, hasMore: hasMore, loadOlder: props.loadOlder }), _jsxs("div", { className: css.column, "data-chat-flow": "", children: [_jsx(StickyLane, { kind: "toolbar", className: css.toolbar, children: _jsx("button", { type: "button", className: css.textButton, "aria-pressed": autoFold, onClick: () => {
493
+ props.actions.setAutoFold(!autoFold);
494
+ props.openPrefs?.actions?.setAutoFold?.(!autoFold);
495
+ }, title: "\u65B0\u601D\u8003\u4EA7\u751F\u65F6\uFF0C\u662F\u5426\u81EA\u52A8\u5C06\u6B64\u524D\u6B65\u9AA4\u6536\u62E2\u4E3A\u4E00\u884C\u6C47\u603B\u3002\u5173\u95ED\u540E\u5B8C\u6574\u4FDD\u7559\u539F\u59CB\u8FC7\u7A0B\u4E0E\u6D41\u5F0F\u8F93\u51FA\u3002", children: `自动折叠${autoFold ? '开' : '关'}` }) }), hasMore && _jsx("button", { type: "button", className: css.historyButton, disabled: loadingOlder, onClick: async () => {
496
+ setHistoryError(false);
497
+ try {
498
+ await props.loadOlder();
499
+ }
500
+ catch {
501
+ setHistoryError(true);
502
+ }
503
+ }, children: loadingOlder ? '正在加载更早记录' : '加载更早记录' }), historyError && _jsx("div", { className: css.notice, children: "\u5386\u53F2\u8BB0\u5F55\u52A0\u8F7D\u5931\u8D25\uFF0C\u53EF\u518D\u6B21\u5C1D\u8BD5\uFF1B\u73B0\u6709\u5185\u5BB9\u672A\u6539\u53D8\u3002" }), openError && _jsxs("div", { className: css.error, role: "alert", children: ["\u4F1A\u8BDD\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\uFF1A", openError.message] }), loading && groups.length === 0 && _jsx("p", { className: css.empty, role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u4F1A\u8BDD\u2026" }), groups.map(group => _jsx(TurnGroup, { ...props, group: group, motion: motion, autoFold: autoFold, pinnedKeys: pinnedKeys, selectedProcessKeys: selectedProcessKeys, isAwaitingModel: isAwaitingModel && group.key === groups.at(-1)?.key }, group.key)), visibleSubmissions.map(submission => {
504
+ const images = pendingSubmissionImages(submission);
505
+ return (_jsxs("div", { className: css.userCluster, "data-reader-pending-submission": true, children: [images.length > 0 && (_jsx("div", { className: css.userImages, children: images.map((item, idx) => (_jsx("figure", { className: css.imageFigure, children: _jsx("div", { className: css.imageFrame, style: { aspectRatio: `${item.width || 4} / ${item.height || 3}` }, children: _jsx("img", { src: item.previewUrl, alt: item.name ?? '发送的图片', className: css.pendingImage }) }) }, idx))) })), submission.text ? (_jsx("div", { className: css.user, children: _jsx("div", { className: css.blocks, children: submission.text }) })) : null, _jsx(UserMessageActions, { text: submission.text ?? '', time: submission.time })] }, submission.requestId));
506
+ }), isAwaitingModel && _jsx(WaitingStatus, { anchor: waitAnchor, label: props.t ? props.t('chat.deepDiving') : '深度求索中...' }), pending !== undefined && _jsxs("div", { className: css.attention, role: "alert", "data-reader-attention": true, children: [_jsx("strong", { children: pending.kind === 'question' ? '需要你回答一个问题' : '需要你的确认' }), _jsx("span", { children: "\u8BF7\u5728\u4E0B\u65B9\u539F\u751F\u64CD\u4F5C\u533A\u5904\u7406\u3002\u6B64\u63D0\u793A\u4E0D\u4F1A\u6536\u8FDB\u6267\u884C\u8FC7\u7A0B\u3002" })] }), scroll.detached && _jsx("div", { className: css.jumpDock, children: _jsx("button", { type: "button", className: css.jump, "aria-label": "\u56DE\u5230\u5E95\u90E8", title: "\u56DE\u5230\u5E95\u90E8", onClick: scroll.jump, children: _jsx("svg", { viewBox: "0 0 14 14", width: "14", height: "14", "aria-hidden": "true", children: _jsx("path", { d: "M3 5.5 7 9.5 11 5.5", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) })] })] }) });
507
+ }
508
+ //# sourceMappingURL=Reader.js.map