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,113 @@
1
+ /** Motion parameters from the public transitions.dev streaming-text recipe. */
2
+ export const WORD_MOTION = {
3
+ duration: 350,
4
+ gap: 60,
5
+ blur: 1,
6
+ easing: 'cubic-bezier(0.22, 1, 0.36, 1)',
7
+ maxDelay: 240,
8
+ /** Floor for the per-word cadence once a batch is compressed. */
9
+ minGap: 3,
10
+ /** One paint's words should land inside this window, however many arrive. */
11
+ batchMs: 90,
12
+ } as const;
13
+
14
+ const segmenter = new Intl.Segmenter(undefined, { granularity: 'word' });
15
+ const closingPunctuation = /^[\p{Pe}\p{Pf},.!?:;,。!?、;:%‰…·]+$/u;
16
+ const openingPunctuation = /^[\p{Ps}\p{Pi}]+$/u;
17
+ export interface RevealingWord { key: number; text: string; born: number | null }
18
+ interface SourceBirth { end: number; born: number | null }
19
+
20
+ /** Source-offset identity survives reparsing, frozen blocks, and final formatting. */
21
+ export class WordTimeline {
22
+ generation = 0;
23
+ hasLiveText = false;
24
+ private source: string | null = null;
25
+ private enabled = false;
26
+ private revision = 0;
27
+ private floor = 0;
28
+ private lastBirth = -Infinity;
29
+ private readonly births: SourceBirth[] = [];
30
+
31
+ begin(source: string, enabled: boolean, revision: number, now: number): void {
32
+ if (this.source === source && this.enabled === enabled && this.revision === revision) return;
33
+ const replaced = revision !== this.revision || (this.source !== null && !source.startsWith(this.source));
34
+ if (replaced || !enabled) {
35
+ this.births.length = 0;
36
+ this.lastBirth = -Infinity;
37
+ this.generation++;
38
+ this.floor = source.length;
39
+ } else if (this.source === null) {
40
+ // A mounted historical prefix must not replay; a fresh live buffer mounts empty.
41
+ this.floor = source.length;
42
+ } else {
43
+ // Allocate in source order, before Markdown can split/reorder text leaves.
44
+ // Intervals cover every offset, so resegmented CJK words inherit the time
45
+ // of their characters rather than falling through as instant "history".
46
+ const from = this.source.length;
47
+ const added = source.slice(from);
48
+ // The cadence follows the batch, not a constant. A fixed per-word gap caps
49
+ // the reveal at ~16 words/second however fast the model actually wrote, so
50
+ // a 500 tok/s answer still dripped out one word at a time. A batch of many
51
+ // words is compressed into one short window instead; a lone word keeps the
52
+ // original typing rhythm.
53
+ let arriving = 0;
54
+ for (const part of segmenter.segment(added)) if (part.segment.trim()) arriving++;
55
+ const gap = arriving > 1
56
+ ? Math.max(WORD_MOTION.minGap, Math.min(WORD_MOTION.gap, WORD_MOTION.batchMs / arriving))
57
+ : WORD_MOTION.gap;
58
+ for (const part of segmenter.segment(added)) {
59
+ let born = Number.isFinite(this.lastBirth) ? this.lastBirth : null;
60
+ if (part.segment.trim()) {
61
+ // Capping at the batch window is what stops a queue from forming: the
62
+ // clock can never run further ahead than one window past the newest text.
63
+ born = Math.min(now + WORD_MOTION.batchMs, Math.max(now, this.lastBirth + gap));
64
+ this.lastBirth = born;
65
+ }
66
+ const end = from + part.index + part.segment.length;
67
+ const previous = this.births.at(-1);
68
+ if (previous && previous.born === born) previous.end = end;
69
+ else this.births.push({ end, born });
70
+ }
71
+ }
72
+ this.source = source;
73
+ this.enabled = enabled;
74
+ this.revision = revision;
75
+ this.hasLiveText = enabled && this.births.length > 0;
76
+ }
77
+
78
+ bornAt(offset: number): number | null {
79
+ if (!this.enabled || offset < this.floor || this.births.length === 0) return null;
80
+ let low = 0;
81
+ let high = this.births.length - 1;
82
+ while (low < high) {
83
+ const middle = (low + high) >>> 1;
84
+ if (this.births[middle]!.end <= offset) low = middle + 1;
85
+ else high = middle;
86
+ }
87
+ return this.births[low]!.born;
88
+ }
89
+
90
+ words(value: string, offset: number): RevealingWord[] {
91
+ // Atomic inline animation boxes must not turn commas into legal line starts
92
+ // or strand opening quotes at a line end. Keep source-offset identities when
93
+ // punctuation arrives in a later chunk, so the preceding word never replays.
94
+ // Already received text is one inert leaf, not thousands of React Words.
95
+ // Only the newly appended suffix needs word identities and birth times.
96
+ const prefixLength = Math.min(value.length, Math.max(0, this.floor - offset));
97
+ const prefix: RevealingWord[] = prefixLength > 0
98
+ ? [{ key: offset, text: value.slice(0, prefixLength), born: null }]
99
+ : [];
100
+ const parts: { index: number; segment: string }[] = [];
101
+ for (const segment of segmenter.segment(value.slice(prefixLength))) {
102
+ const part = { index: prefixLength + segment.index, segment: segment.segment };
103
+ const previous = parts.at(-1);
104
+ if (previous?.segment.trim() && (closingPunctuation.test(part.segment) || openingPunctuation.test(previous.segment))) {
105
+ previous.segment += part.segment;
106
+ } else parts.push({ index: part.index, segment: part.segment });
107
+ }
108
+ return prefix.concat(parts.map(part => {
109
+ const key = offset + part.index;
110
+ return { key, text: part.segment, born: this.bornAt(key) };
111
+ }));
112
+ }
113
+ }
@@ -0,0 +1,112 @@
1
+ import { spawn } from 'node:child_process';
2
+ import type { IncomingMessage, ServerResponse } from 'node:http';
3
+ import type { Context } from '@deepseek-ai/cordis';
4
+ import { scanGenerativeMcpappsStatus } from './skill-roots.js';
5
+ import { skillsFromListResult, toPublicSkillStatus } from './skill-status.js';
6
+
7
+ declare module '@deepseek-ai/cordis' {
8
+ interface Context {
9
+ webServer?: {
10
+ register: (route: {
11
+ kind: 'exact' | 'prefix';
12
+ path: string;
13
+ handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
14
+ }) => () => void;
15
+ };
16
+ }
17
+ }
18
+
19
+ // Module id must equal the npm package name (the id the host mounts the
20
+ // client bundle under), or the host cannot mount the client bundle and the
21
+ // whole plugin silently fails to activate — the fork.4 regression this
22
+ // constant pins down.
23
+ export const name = 'dsh-tidy-display';
24
+ export const inject = ['webServer'];
25
+
26
+ function writeJson(res: ServerResponse, status: number, body: unknown): void {
27
+ res.setHeader('Content-Type', 'application/json');
28
+ res.statusCode = status;
29
+ res.end(JSON.stringify(body));
30
+ }
31
+
32
+ function skillLister(ctx: Context): (() => Promise<readonly { readonly name?: string }[] | undefined>) | undefined {
33
+ const skills = ctx.get?.('skills') as { list?: (options?: object) => Promise<unknown> } | undefined;
34
+ if (typeof skills?.list !== 'function') return undefined;
35
+ return async () => skillsFromListResult(await skills.list!({}));
36
+ }
37
+
38
+ export function apply(ctx: Context): void {
39
+ console.log('[my-plugins/dsh-tidy-display] loaded');
40
+
41
+ if (ctx.webServer) {
42
+ ctx.effect(() => {
43
+ const disposeReveal = ctx.webServer!.register({
44
+ kind: 'exact',
45
+ path: '/tidy-display/reveal',
46
+ handler: async (req, res) => {
47
+ if (req.method !== 'POST') {
48
+ res.statusCode = 405;
49
+ res.end();
50
+ return;
51
+ }
52
+ let body = '';
53
+ req.on('data', chunk => { body += chunk; });
54
+ req.on('end', () => {
55
+ try {
56
+ const data = JSON.parse(body);
57
+ const targetPath = typeof data.path === 'string' ? data.path.trim() : '';
58
+ if (!targetPath) {
59
+ res.statusCode = 400;
60
+ res.end(JSON.stringify({ ok: false, error: 'Empty path' }));
61
+ return;
62
+ }
63
+
64
+ if (process.platform === 'darwin') {
65
+ // Exact file reveal in macOS Finder with selection highlight
66
+ spawn('open', ['-R', targetPath], { detached: true, stdio: 'ignore' });
67
+ } else if (process.platform === 'win32') {
68
+ // Exact file selection in Windows Explorer
69
+ spawn('explorer.exe', [`/select,${targetPath}`], { detached: true, stdio: 'ignore' });
70
+ } else {
71
+ spawn('xdg-open', [targetPath], { detached: true, stdio: 'ignore' });
72
+ }
73
+
74
+ res.setHeader('Content-Type', 'application/json');
75
+ res.statusCode = 200;
76
+ res.end(JSON.stringify({ ok: true }));
77
+ } catch (err) {
78
+ res.statusCode = 400;
79
+ res.end(JSON.stringify({ ok: false, error: String(err) }));
80
+ }
81
+ });
82
+ },
83
+ });
84
+ const disposeSkill = ctx.webServer!.register({
85
+ kind: 'exact',
86
+ path: '/tidy-display/skill-status',
87
+ handler: async (req, res) => {
88
+ if (req.method !== 'GET') {
89
+ res.statusCode = 405;
90
+ res.end();
91
+ return;
92
+ }
93
+ try {
94
+ const url = new URL(req.url ?? '', 'http://127.0.0.1');
95
+ const cwd = url.searchParams.get('cwd') ?? undefined;
96
+ const status = await scanGenerativeMcpappsStatus({
97
+ cwd,
98
+ listSkills: skillLister(ctx),
99
+ });
100
+ writeJson(res, 200, toPublicSkillStatus(status));
101
+ } catch (err) {
102
+ writeJson(res, 500, { ok: false, error: String(err) });
103
+ }
104
+ },
105
+ });
106
+ return () => {
107
+ disposeReveal();
108
+ disposeSkill();
109
+ };
110
+ }, 'dsh-tidy-display: reveal and skill-status routes');
111
+ }
112
+ }
@@ -0,0 +1,138 @@
1
+ import { access, readdir } from 'node:fs/promises';
2
+ import { existsSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { dirname, isAbsolute, join, resolve } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import {
7
+ GENERATIVE_MCPAPPS_SKILL,
8
+ skillListIncludes,
9
+ skillRootEntryMatches,
10
+ type HostSkillStatus,
11
+ type SkillRootInfo,
12
+ } from './skill-status.js';
13
+
14
+ export function expandHomePath(path: string, home = homedir()): string {
15
+ if (path === '~') return home;
16
+ if (path.startsWith('~/') || path.startsWith('~\\')) return join(home, path.slice(2));
17
+ return path;
18
+ }
19
+
20
+ /** `$DSH_HOME` or `~/.dsh`, matching official `resolveDshHome`. */
21
+ export function resolveDshHome(env: Record<string, string | undefined> = process.env, home = homedir()): string {
22
+ const fromEnv = env.DSH_HOME;
23
+ const selected = fromEnv !== undefined && fromEnv.trim().length > 0 ? fromEnv : join(home, '.dsh');
24
+ return resolve(expandHomePath(selected, home));
25
+ }
26
+
27
+ /** `$DSH_AGENTS_HOME` or `~/.agents`. */
28
+ export function resolveAgentsHome(env: Record<string, string | undefined> = process.env, home = homedir()): string {
29
+ const fromEnv = env.DSH_AGENTS_HOME;
30
+ const selected = fromEnv !== undefined && fromEnv.trim().length > 0 ? fromEnv : join(home, '.agents');
31
+ return resolve(expandHomePath(selected, home));
32
+ }
33
+
34
+ export function userSkillRoots(
35
+ env: Record<string, string | undefined> = process.env,
36
+ home = homedir(),
37
+ ): readonly SkillRootInfo[] {
38
+ return [
39
+ { source: 'user-dsh', path: join(resolveDshHome(env, home), 'skills') },
40
+ { source: 'user-agents', path: join(resolveAgentsHome(env, home), 'skills') },
41
+ ];
42
+ }
43
+
44
+ export function projectSkillRoots(projectRoot: string): readonly SkillRootInfo[] {
45
+ return [
46
+ { source: 'project-dsh', path: join(projectRoot, '.dsh', 'skills') },
47
+ { source: 'project-agents', path: join(projectRoot, '.agents', 'skills') },
48
+ ];
49
+ }
50
+
51
+ export async function findProjectRoot(cwd: string): Promise<string> {
52
+ let current = resolve(cwd);
53
+ while (true) {
54
+ if (existsSync(join(current, '.git'))) return current;
55
+ const parent = dirname(current);
56
+ if (parent === current) return resolve(cwd);
57
+ current = parent;
58
+ }
59
+ }
60
+
61
+ export async function rootHasGenerativeMcpapps(rootPath: string): Promise<boolean> {
62
+ let entries;
63
+ try {
64
+ entries = await readdir(rootPath, { withFileTypes: true });
65
+ } catch {
66
+ return false;
67
+ }
68
+ for (const entry of entries) {
69
+ if (entry.name === '.system') continue;
70
+ if (!skillRootEntryMatches(entry.name)) continue;
71
+ if (entry.isDirectory()) {
72
+ try {
73
+ await access(join(rootPath, entry.name, 'SKILL.md'));
74
+ return true;
75
+ } catch {
76
+ continue;
77
+ }
78
+ }
79
+ if (entry.isFile()) return true;
80
+ }
81
+ return false;
82
+ }
83
+
84
+ /** Resolve the plugin-shipped pack. This path is never treated as a skill root. */
85
+ export function pluginSkillPackPath(moduleUrl = import.meta.url): string | undefined {
86
+ const here = dirname(fileURLToPath(moduleUrl));
87
+ const candidates = [
88
+ join(here, '../skills', GENERATIVE_MCPAPPS_SKILL),
89
+ join(here, '../../skills', GENERATIVE_MCPAPPS_SKILL),
90
+ join(here, 'skills', GENERATIVE_MCPAPPS_SKILL),
91
+ ];
92
+ return candidates.find(path => existsSync(join(path, 'SKILL.md')));
93
+ }
94
+
95
+ export async function scanGenerativeMcpappsStatus(options: {
96
+ cwd?: string;
97
+ env?: Record<string, string | undefined>;
98
+ home?: string;
99
+ packPath?: string;
100
+ listSkills?: () => Promise<readonly { readonly name?: string }[] | undefined>;
101
+ } = {}): Promise<HostSkillStatus> {
102
+ const env = options.env ?? process.env;
103
+ const home = options.home ?? homedir();
104
+ const roots: SkillRootInfo[] = [...userSkillRoots(env, home)];
105
+ const cwd = typeof options.cwd === 'string' && options.cwd.trim().length > 0
106
+ ? (isAbsolute(options.cwd) ? options.cwd : resolve(options.cwd))
107
+ : undefined;
108
+ if (cwd !== undefined) roots.unshift(...projectSkillRoots(await findProjectRoot(cwd)));
109
+
110
+ const inspected: SkillRootInfo[] = [];
111
+ let rootHit = false;
112
+ for (const root of roots) {
113
+ const present = await rootHasGenerativeMcpapps(root.path);
114
+ inspected.push({ ...root, present });
115
+ if (present) rootHit = true;
116
+ }
117
+
118
+ let via: HostSkillStatus['via'] = null;
119
+ let listHit = false;
120
+ if (options.listSkills) {
121
+ try {
122
+ listHit = skillListIncludes(await options.listSkills());
123
+ if (listHit) via = 'skills.list';
124
+ } catch {
125
+ // Registry/RPC absence falls back to the scanned roots.
126
+ }
127
+ }
128
+ if (!listHit && rootHit) via = 'skill-root';
129
+
130
+ const packPath = options.packPath ?? pluginSkillPackPath();
131
+ return {
132
+ name: GENERATIVE_MCPAPPS_SKILL,
133
+ installed: listHit || rootHit,
134
+ via,
135
+ roots: inspected,
136
+ ...packPath !== undefined ? { packPath } : {},
137
+ };
138
+ }
@@ -0,0 +1,81 @@
1
+ /** Shared generative-mcpapps identity. Plugin-tree presence is not installation. */
2
+
3
+ export const GENERATIVE_MCPAPPS_SKILL = 'generative-mcpapps';
4
+
5
+ /** Conventional relative roots only. Never expand $HOME or dump host `root.path`. */
6
+ export const CONVENTIONAL_SKILL_ROOTS = ['.dsh/skills', '.agents/skills'] as const;
7
+
8
+ /** Copy source relative to the plugin / checkout, not an absolute pack path. */
9
+ export const SKILL_PACK_RELATIVE = `skills/${GENERATIVE_MCPAPPS_SKILL}`;
10
+
11
+ export type SkillRootSource =
12
+ | 'project-dsh'
13
+ | 'project-agents'
14
+ | 'user-dsh'
15
+ | 'user-agents'
16
+ | 'custom'
17
+ | 'bundled'
18
+ | (string & {});
19
+
20
+ export interface SkillRootInfo {
21
+ readonly source: SkillRootSource;
22
+ readonly path: string;
23
+ readonly present?: boolean;
24
+ }
25
+
26
+ export interface HostSkillStatus {
27
+ readonly name: typeof GENERATIVE_MCPAPPS_SKILL;
28
+ readonly installed: boolean;
29
+ readonly via: 'skills.list' | 'skill-root' | null;
30
+ readonly roots: readonly SkillRootInfo[];
31
+ /** Plugin-shipped pack path for copy guidance. Not a harness skill root. */
32
+ readonly packPath?: string;
33
+ }
34
+
35
+ export function skillNameMatches(name: unknown): boolean {
36
+ return typeof name === 'string' && name === GENERATIVE_MCPAPPS_SKILL;
37
+ }
38
+
39
+ export function skillListIncludes(entries: readonly { readonly name?: string }[] | undefined): boolean {
40
+ return Array.isArray(entries) && entries.some(entry => skillNameMatches(entry?.name));
41
+ }
42
+
43
+ /** Directory bundle `name/SKILL.md` or flat `name.md` at a scanned root. */
44
+ export function skillRootEntryMatches(entryName: string): boolean {
45
+ return entryName === GENERATIVE_MCPAPPS_SKILL || entryName === `${GENERATIVE_MCPAPPS_SKILL}.md`;
46
+ }
47
+
48
+ export function skillsFromListResult(result: unknown): { name?: string }[] {
49
+ if (Array.isArray(result)) return result;
50
+ if (result === null || typeof result !== 'object') return [];
51
+ const record = result as {
52
+ ok?: boolean;
53
+ value?: { skills?: unknown } | unknown;
54
+ skills?: unknown;
55
+ };
56
+ if (record.ok === false) return [];
57
+ if (Array.isArray(record.skills)) return record.skills as { name?: string }[];
58
+ if (record.value && typeof record.value === 'object') {
59
+ const value = record.value as { skills?: unknown };
60
+ if (Array.isArray(value.skills)) return value.skills as { name?: string }[];
61
+ if (Array.isArray(record.value)) return record.value as { name?: string }[];
62
+ }
63
+ return [];
64
+ }
65
+
66
+ export function publicSkillRoots(): readonly SkillRootInfo[] {
67
+ return CONVENTIONAL_SKILL_ROOTS.map(path => ({ source: 'conventional', path }));
68
+ }
69
+
70
+ /**
71
+ * Strip host home / pack absolutes before anything user-facing (HTTP or Settings).
72
+ * Detection still uses the raw scan; this is the public face.
73
+ */
74
+ export function toPublicSkillStatus(status: HostSkillStatus): HostSkillStatus {
75
+ return {
76
+ name: status.name,
77
+ installed: status.installed,
78
+ via: status.via,
79
+ roots: publicSkillRoots(),
80
+ };
81
+ }
@@ -0,0 +1,64 @@
1
+ import React, { useSyncExternalStore } from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import type { ChatSnapshot } from '@deepseek-ai/dsh-client-ui-chat/client';
4
+ import { Reader } from '../src/client/Reader.js';
5
+ import { createReaderStore } from '../src/client/store.js';
6
+ import type { ReaderProps } from '../src/client/types.js';
7
+
8
+ // Real Reader and real root/session stores; only conversation data is synthetic.
9
+ const store = createReaderStore();
10
+ const prefs = store.create();
11
+ const session = store.create('auto-fold-fixture');
12
+ const nodes = new Map();
13
+ const turns = new Map();
14
+ for (const [number, closed] of [[1, true], [2, false]] as const) {
15
+ const turn = {
16
+ turn: number, status: closed ? 'closed' : 'open',
17
+ start: { seq: number * 10, time: 1 },
18
+ end: closed ? { time: 1001, data: { reason: { kind: 'completed' } } } : undefined,
19
+ data: new Map(closed ? [['turn-tail', { closing: { step: 1 } }]] : []),
20
+ steps: [] as any[],
21
+ };
22
+ for (let step = 0; step < 2; step++) {
23
+ const key = `turn-${number}-step-${step}`;
24
+ const data = { turn: number, step, status: closed || step === 0 ? 'settled' : 'running', time: 1,
25
+ blocks: [
26
+ { kind: 'reasoning', text: closed ? `已完成思考 ${step}` : `进行中思考 ${step}` },
27
+ { kind: 'text', text: closed && step === 1 ? '最终回答始终保留' : `过程说明 ${number}-${step}` },
28
+ ],
29
+ };
30
+ const location = { step, start: { seq: number * 10 + step }, data: new Map([['assistant-step', data]]) };
31
+ turn.steps.push(location);
32
+ nodes.set(key, { key, kind: 'assistant-step', visibility: 'visible', anchorSeq: number * 10 + step,
33
+ location: { kind: 'step', turn, step: location }, data });
34
+ }
35
+ turns.set(number, turn);
36
+ }
37
+ const chat = { order: [...nodes.keys()], nodes, timeline: { turns } } as unknown as ChatSnapshot;
38
+ const sessionSnapshot = { running: true, openState: 'ready', pendingSubmissions: [], hasMore: false, loadingOlder: false };
39
+ const sessionsSnapshot = { byId: { 'auto-fold-fixture': { cwd: '/fixture' } } };
40
+ const pending = new Map();
41
+ const host = { home: '/fixture' };
42
+ const useReaderStore: ReaderProps['useStore'] = selector => selector(useSyncExternalStore(session.subscribe, session.getSnapshot));
43
+ const props = {
44
+ sessionId: 'auto-fold-fixture', useChat: selector => selector(chat),
45
+ useSession: selector => selector(sessionSnapshot), useSessions: selector => selector(sessionsSnapshot),
46
+ useSessionStatus: selector => selector(new Map([['auto-fold-fixture', { running: true, pendingInteraction: pending.get('auto-fold-fixture'), completionUnread: false }]])),
47
+ useStore: useReaderStore, actions: session.actions, openPrefs: prefs,
48
+ t: key => key, renderSlot: (_name, _owner, options) => options?.fallback ?? null,
49
+ renderSlotChain: (_name, _owner, options) => options?.fallback ?? null,
50
+ loadImage: async () => ({ data: new Uint8Array(), mediaType: 'image/png' }),
51
+ officialImageLoader: Object.assign(async () => null, { peek: () => null }),
52
+ officialFileMentions: () => undefined, officialPreviewFile: () => {},
53
+ officialHost: { getSnapshot: () => host, subscribe: () => () => {} },
54
+ fillComposer: () => true, openFile: () => {}, loadOlder: async () => {}, openView: () => {},
55
+ } as ReaderProps;
56
+
57
+ Object.assign(window, { autoFoldFixture: {
58
+ // Exercise Settings' root preference path without recreating the Reader.
59
+ preference: (value: boolean) => prefs.actions.setAutoFold(value),
60
+ state: () => session.getSnapshot(),
61
+ } });
62
+ createRoot(document.getElementById('app')!).render(
63
+ <div data-conversation-scroll style={{ height: '100vh', overflow: 'auto' }}><Reader {...props} /></div>,
64
+ );
@@ -0,0 +1,20 @@
1
+ import React, { useMemo, useRef, useState } from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import type { ChatSnapshot } from '@deepseek-ai/dsh-client-ui-chat/client';
4
+ import { ChoreographedFlow } from '../src/client/ChoreographedFlow.js';
5
+ import { ClosedProcessSummary } from '../src/client/ClosedProcessSummary.js';
6
+ import { ProcessFragment } from '../src/client/motion.js';
7
+ import { presentLiveTurn } from '../src/client/live-turn.js';
8
+ import type { LiveStep } from '../src/client/live-turn.js';
9
+ function Fixture() {
10
+ const [open,setOpen]=useState(false);const button=useRef<HTMLButtonElement>(null);
11
+ const steps=useMemo(()=>Array.from({length:500},(_,i):LiveStep=>({kind:'reasoning',key:`r${i}`,nodeKey:`r${i}`,step:i,start:0,blocks:[]})),[]);
12
+ const frame=useMemo(()=>({items:presentLiveTurn(steps,{status:'closed',reason:'completed',closingStep:501,latestStep:501}),snapshot:{} as ChatSnapshot}),[steps]);
13
+ return <main style={{padding:30}}><h1>完成后 500 条过程记录:实际组件回归</h1>
14
+ <button ref={button} onClick={()=>setOpen(v=>!v)}>切换过程展开</button>
15
+ <ClosedProcessSummary steps={steps} open={open} onChange={setOpen} controls="closed-flow"/>
16
+ <ChoreographedFlow id="closed-flow" frame={frame} motion enabled={false} urgent={false} processOpen={open} open={{}} onOpenChange={()=>{}}
17
+ renderStep={step=><ProcessFragment open={open} motion onRead={()=>{}} returnFocusTo={button} nodeKey={step.key}><p>过程内容 {step.key}</p></ProcessFragment>}/>
18
+ <article data-final-answer>最终回答必须紧随统计,不能隔着 8000px 空白;展开、收起以后仍应如此。</article></main>;
19
+ }
20
+ createRoot(document.getElementById('app')!).render(<Fixture/>);
@@ -0,0 +1,65 @@
1
+ import React, { useMemo, useRef, useState } from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import type { ChatSnapshot } from '@deepseek-ai/dsh-client-ui-chat/client';
4
+ import { ChoreographedFlow, useFlowChat } from '../src/client/ChoreographedFlow.js';
5
+ import { presentLiveTurn } from '../src/client/live-turn.js';
6
+ import type { LiveStep } from '../src/client/live-turn.js';
7
+ import { Disclosure, StatusText, useMotionAllowed, useReadingScroll } from '../src/client/motion.js';
8
+ import { ReasoningCard } from '../src/client/ReasoningCard.js';
9
+ import { StreamMotionContext, useStreamingText } from '../src/client/streaming.js';
10
+ import css from '../src/client/Reader.module.css';
11
+
12
+ const sample = '旧内容保持原位,先完成连续收拢,再确认数字,最后继续输出。This is a real component regression fixture, not a replacement animation. ';
13
+ function Text({ step }: { step: LiveStep }) {
14
+ const node = useFlowChat(s => 'nodeKey' in step ? s.nodes.get(step.nodeKey) : undefined);
15
+ const source = (node?.data as { text?: string })?.text ?? '';
16
+ const text = useStreamingText(source, true, { startedAt: 0, interrupted: false, selected: false });
17
+ if (step.kind === 'reasoning') return <ReasoningCard step={step.step} active motion selected={false} onRead={() => {}}>
18
+ <div data-test-text={step.key} style={{ whiteSpace: 'pre-wrap' }}>{text.text}</div>
19
+ </ReasoningCard>;
20
+ return <div data-reader-anchor style={{ padding: '10px 0' }} data-test-text={step.key}>{step.kind === 'body' ? sample : '工具 · 读取源文件,等待下一个步骤'}</div>;
21
+ }
22
+ function Demo() {
23
+ const [n, setN] = useState(1);
24
+ const [tail, setTail] = useState(0);
25
+ const [auto, setAuto] = useState(true);
26
+ const [motionSetting, setMotion] = useState(true);
27
+ const motion = useMotionAllowed(motionSetting);
28
+ const [urgent, setUrgent] = useState(false);
29
+ const [expanded, setExpanded] = useState(true);
30
+ const [open, setOpen] = useState<Record<string, boolean>>({});
31
+ const root = useRef<HTMLDivElement>(null); const button=useRef<HTMLButtonElement>(null);
32
+ useReadingScroll(root, motion);
33
+ const frame = useMemo(() => {
34
+ const steps: LiveStep[] = [];
35
+ const nodes = new Map();
36
+ for (let i=1; i<=n; i++) {
37
+ steps.push({ kind: 'reasoning', key: `r${i}`, nodeKey:`r${i}`, start:0, blocks:[], step:i });
38
+ nodes.set(`r${i}`, { data: { text: sample.repeat(i===n && n>1 ? 3 + tail : 5) } });
39
+ if (i<n || n===1) {
40
+ steps.push({kind:'body',key:`b${i}`,nodeKey:`b${i}`,start:1,blocks:[],step:i});
41
+ steps.push({kind:'other',key:`t${i}`,nodeKey:`t${i}`});
42
+ }
43
+ }
44
+ return {items:presentLiveTurn(steps,{status:'open'},auto),snapshot:{nodes:{get:(key:string)=>nodes.get(key)}} as unknown as ChatSnapshot};
45
+ }, [n,tail,auto]);
46
+ (window as any).fixture = { next:()=>setN(v=>v+1), burst:()=>{setN(v=>v+1); setTimeout(()=>setN(v=>v+2),100); setTimeout(()=>setTail(v=>v+2),180);}, stop:()=>setUrgent(true), reduce:()=>setMotion(false), reset:()=>{setN(1);setTail(0);setUrgent(false);setOpen({});setMotion(true);setAuto(true);} };
47
+ return <><nav style={{padding:12,display:'flex',gap:12,flexWrap:'wrap'}}>
48
+ <b>转场验收 · 真实组件 / 模拟数据</b>
49
+ <button onClick={()=>(window as any).fixture.next()}>下一步</button>
50
+ <button onClick={()=>(window as any).fixture.burst()}>突发三步</button>
51
+ <button onClick={()=>(window as any).fixture.stop()}>停止</button>
52
+ <button onClick={()=>(window as any).fixture.reset()}>重置</button>
53
+ <button onClick={()=>setMotion(v=>!v)}>动效{motion?'开':'关'}</button>
54
+ </nav><div data-conversation-scroll style={{height:'calc(100vh - 70px)',overflow:'auto'}}>
55
+ <StreamMotionContext.Provider value={{enabled:motion,activatedAt:Date.now()}}>
56
+ <div ref={root} className={css.root} data-motion={motion?'on':'off'}><div className={css.column} data-chat-flow="">
57
+ <div className={css.toolbar}><button className={css.textButton} onClick={()=>setAuto(v=>!v)}>自动折叠{auto?'开':'关'}</button></div>
58
+ <div className={css.turnProcessSticky}><Disclosure open={expanded} onChange={setExpanded} buttonRef={button} label={<StatusText text="正在处理" motion={motion}/>} /></div>
59
+ <ChoreographedFlow id="fixture-flow" frame={frame} motion={motion} enabled={auto} urgent={urgent} processOpen={expanded}
60
+ open={open} onOpenChange={(key,value)=>setOpen(s=>({...s,[key]:value}))} renderStep={step=><Text step={step}/>} />
61
+ <div data-test-footer style={{height:72}}>输入区位置参照 · 后台数据不会被修改</div>
62
+ </div></div></StreamMotionContext.Provider>
63
+ </div></>;
64
+ }
65
+ createRoot(document.getElementById('app')!).render(<Demo />);