zidane-ui 9.2.3 → 9.4.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 (354) hide show
  1. package/dist/adapters/live.d.ts +8 -0
  2. package/dist/adapters/live.js +19 -8
  3. package/dist/adapters/server-composer-host.js +22 -9
  4. package/dist/adapters/server-git-host.js +5 -2
  5. package/dist/adapters/server-host.js +158 -27
  6. package/dist/adapters/server-machines-host.js +7 -0
  7. package/dist/adapters/server-media.d.ts +9 -1
  8. package/dist/adapters/server-media.js +14 -1
  9. package/dist/adapters/server-session-host.js +49 -0
  10. package/dist/adapters/server-settings-sections.js +4 -1
  11. package/dist/adapters/sse-host.js +3 -0
  12. package/dist/adapters/sse-protocol.d.ts +10 -0
  13. package/dist/appearance/ZoomIndicator.js +5 -8
  14. package/dist/chat/HostTranscript.d.ts +0 -12
  15. package/dist/chat/HostTranscript.js +20 -1
  16. package/dist/chat/SessionStreamsProvider.d.ts +9 -1
  17. package/dist/chat/SessionStreamsProvider.js +11 -2
  18. package/dist/chat/Transcript.d.ts +21 -11
  19. package/dist/chat/Transcript.js +346 -161
  20. package/dist/chat/composer/ModelOptionsPicker.js +6 -2
  21. package/dist/chat/composer/ModelPicker.d.ts +1 -1
  22. package/dist/chat/composer/PlacePicker.d.ts +3 -1
  23. package/dist/chat/composer/PlacePicker.js +5 -1
  24. package/dist/chat/composer/use-draft-target.js +15 -3
  25. package/dist/chat/headless/block-runs.js +26 -1
  26. package/dist/chat/headless/chip-views.js +1 -1
  27. package/dist/chat/headless/draft-target.d.ts +28 -1
  28. package/dist/chat/headless/draft-target.js +22 -1
  29. package/dist/chat/headless/host.d.ts +43 -7
  30. package/dist/chat/headless/hosts.d.ts +4 -0
  31. package/dist/chat/headless/index.d.ts +27 -26
  32. package/dist/chat/headless/index.js +15 -14
  33. package/dist/chat/headless/labels.d.ts +17 -0
  34. package/dist/chat/headless/labels.js +17 -0
  35. package/dist/chat/headless/markdown-chunks.d.ts +2 -1
  36. package/dist/chat/headless/markdown-chunks.js +12 -20
  37. package/dist/chat/headless/markdown-scan.d.ts +64 -0
  38. package/dist/chat/headless/markdown-scan.js +119 -0
  39. package/dist/chat/headless/markdown-stream.d.ts +64 -0
  40. package/dist/chat/headless/markdown-stream.js +143 -0
  41. package/dist/chat/headless/output-pager.d.ts +68 -0
  42. package/dist/chat/headless/output-pager.js +113 -0
  43. package/dist/chat/headless/prompt-origin.d.ts +2 -0
  44. package/dist/chat/headless/prompt-origin.js +6 -2
  45. package/dist/chat/headless/session-list.d.ts +10 -0
  46. package/dist/chat/headless/sidebar/activity.d.ts +14 -0
  47. package/dist/chat/headless/sidebar/activity.js +32 -0
  48. package/dist/chat/headless/sidebar/directory.d.ts +19 -2
  49. package/dist/chat/headless/sidebar/directory.js +19 -51
  50. package/dist/chat/headless/sidebar/environment.d.ts +15 -4
  51. package/dist/chat/headless/sidebar/environment.js +27 -9
  52. package/dist/chat/headless/sidebar/index.d.ts +2 -2
  53. package/dist/chat/headless/sidebar/index.js +2 -2
  54. package/dist/chat/headless/sidebar/labels.d.ts +19 -2
  55. package/dist/chat/headless/sidebar/labels.js +8 -1
  56. package/dist/chat/headless/sidebar/prewarm.d.ts +68 -0
  57. package/dist/chat/headless/sidebar/prewarm.js +114 -0
  58. package/dist/chat/headless/streams/actions.d.ts +4 -2
  59. package/dist/chat/headless/streams/actions.js +2 -1
  60. package/dist/chat/headless/streams/event-bytes.d.ts +17 -0
  61. package/dist/chat/headless/streams/event-bytes.js +46 -0
  62. package/dist/chat/headless/streams/live-events.d.ts +25 -1
  63. package/dist/chat/headless/streams/live-events.js +53 -2
  64. package/dist/chat/headless/streams/selectors.d.ts +3 -0
  65. package/dist/chat/headless/streams/selectors.js +8 -1
  66. package/dist/chat/headless/streams/session-streams.d.ts +15 -3
  67. package/dist/chat/headless/streams/session-streams.js +31 -3
  68. package/dist/chat/headless/streams/store.d.ts +45 -6
  69. package/dist/chat/headless/streams/store.js +85 -31
  70. package/dist/chat/headless/streams/transcript-map.d.ts +57 -0
  71. package/dist/chat/headless/streams/transcript-map.js +85 -0
  72. package/dist/chat/headless/streams/transcript.d.ts +4 -2
  73. package/dist/chat/headless/streams/transcript.js +19 -7
  74. package/dist/chat/headless/streams/types.d.ts +2 -1
  75. package/dist/chat/headless/transcript/batch.js +5 -1
  76. package/dist/chat/headless/transcript/blob-media.d.ts +15 -0
  77. package/dist/chat/headless/transcript/blob-media.js +23 -0
  78. package/dist/chat/headless/transcript/collapse.d.ts +10 -0
  79. package/dist/chat/headless/transcript/collapse.js +35 -6
  80. package/dist/chat/headless/transcript/derive.d.ts +98 -0
  81. package/dist/chat/headless/transcript/derive.js +89 -0
  82. package/dist/chat/headless/transcript/exchange-media.d.ts +3 -1
  83. package/dist/chat/headless/transcript/exchange-media.js +8 -5
  84. package/dist/chat/headless/transcript/fold-attachments.d.ts +2 -0
  85. package/dist/chat/headless/transcript/fold-attachments.js +3 -2
  86. package/dist/chat/headless/transcript/fold.d.ts +2 -1
  87. package/dist/chat/headless/transcript/fold.js +16 -6
  88. package/dist/chat/headless/transcript/incremental.d.ts +53 -0
  89. package/dist/chat/headless/transcript/incremental.js +181 -0
  90. package/dist/chat/headless/transcript/index.d.ts +2 -2
  91. package/dist/chat/headless/transcript/index.js +2 -2
  92. package/dist/chat/headless/transcript/nesting.js +2 -1
  93. package/dist/chat/headless/transcript/rail.d.ts +50 -1
  94. package/dist/chat/headless/transcript/rail.js +165 -23
  95. package/dist/chat/headless/transcript/rows.d.ts +5 -1
  96. package/dist/chat/headless/transcript/run-failures.js +2 -1
  97. package/dist/chat/headless/transcript/seams.d.ts +78 -0
  98. package/dist/chat/headless/transcript/seams.js +116 -0
  99. package/dist/chat/headless/transcript/tool-media.d.ts +6 -7
  100. package/dist/chat/headless/transcript/tool-media.js +27 -9
  101. package/dist/chat/index.d.ts +9 -8
  102. package/dist/chat/index.js +18 -17
  103. package/dist/chat/sidebar/ProjectIcon.js +1 -1
  104. package/dist/chat/sidebar/RowChips.js +2 -2
  105. package/dist/chat/sidebar/SessionSidebar.d.ts +6 -0
  106. package/dist/chat/sidebar/SessionSidebar.js +23 -16
  107. package/dist/chat/sidebar/SidebarFilterMenu.js +0 -1
  108. package/dist/chat/sidebar/SidebarFold.js +17 -16
  109. package/dist/chat/sidebar/SidebarFooter.d.ts +8 -5
  110. package/dist/chat/sidebar/SidebarFooter.js +6 -6
  111. package/dist/chat/sidebar/SidebarSessionRow.d.ts +7 -1
  112. package/dist/chat/sidebar/SidebarSessionRow.js +11 -8
  113. package/dist/chat/sidebar/session-menu.d.ts +4 -0
  114. package/dist/chat/sidebar/session-menu.js +14 -2
  115. package/dist/chat/sidebar/sidebar-live.js +28 -4
  116. package/dist/chat/sidebar/useInboxRows.js +6 -6
  117. package/dist/chat/sidebar/useInboxTriage.js +50 -47
  118. package/dist/chat/sidebar/useSessionSearch.js +19 -18
  119. package/dist/chat/testing/contract.d.ts +5 -3
  120. package/dist/chat/testing/contract.js +66 -1
  121. package/dist/chat/transcript/DiffLines.d.ts +6 -1
  122. package/dist/chat/transcript/DiffLines.js +35 -20
  123. package/dist/chat/transcript/EditDiffBlock.d.ts +5 -1
  124. package/dist/chat/transcript/EditDiffBlock.js +89 -30
  125. package/dist/chat/transcript/FileChip.js +28 -0
  126. package/dist/chat/transcript/LazyRow.d.ts +40 -40
  127. package/dist/chat/transcript/LazyRow.js +100 -149
  128. package/dist/chat/transcript/MermaidDiagram.js +2 -1
  129. package/dist/chat/transcript/PromptEcho.js +3 -11
  130. package/dist/chat/transcript/SessionChip.d.ts +11 -0
  131. package/dist/chat/transcript/SessionChip.js +34 -0
  132. package/dist/chat/transcript/SubagentBlock.js +3 -2
  133. package/dist/chat/transcript/TranscriptRail.d.ts +25 -2
  134. package/dist/chat/transcript/TranscriptRail.js +175 -17
  135. package/dist/chat/transcript/TranscriptRow.d.ts +4 -7
  136. package/dist/chat/transcript/TranscriptRow.js +4 -3
  137. package/dist/chat/transcript/actions.d.ts +37 -1
  138. package/dist/chat/transcript/actions.js +27 -1
  139. package/dist/chat/transcript/chip-details.d.ts +11 -0
  140. package/dist/chat/transcript/chip-details.js +17 -1
  141. package/dist/chat/transcript/clipped-output.d.ts +58 -0
  142. package/dist/chat/transcript/clipped-output.js +131 -0
  143. package/dist/chat/transcript/fold-attachments.js +10 -5
  144. package/dist/chat/transcript/fold-worker.js +5 -3
  145. package/dist/chat/transcript/fold.js +13 -4
  146. package/dist/chat/transcript/index.d.ts +11 -10
  147. package/dist/chat/transcript/index.js +10 -9
  148. package/dist/chat/transcript/markdown-cache.d.ts +17 -2
  149. package/dist/chat/transcript/markdown-cache.js +48 -4
  150. package/dist/chat/transcript/markdown.js +110 -55
  151. package/dist/chat/transcript/media-gallery.d.ts +3 -2
  152. package/dist/chat/transcript/media-gallery.js +19 -19
  153. package/dist/chat/transcript/messages.js +5 -4
  154. package/dist/chat/transcript/notices.js +2 -1
  155. package/dist/chat/transcript/prompt.d.ts +1 -1
  156. package/dist/chat/transcript/prompt.js +6 -4
  157. package/dist/chat/transcript/prose.js +2 -1
  158. package/dist/chat/transcript/root-items.d.ts +96 -0
  159. package/dist/chat/transcript/root-items.js +180 -0
  160. package/dist/chat/transcript/row-mount.d.ts +184 -0
  161. package/dist/chat/transcript/row-mount.js +532 -0
  162. package/dist/chat/transcript/row-parking.d.ts +152 -0
  163. package/dist/chat/transcript/row-parking.js +171 -0
  164. package/dist/chat/transcript/row-ui-state.d.ts +37 -0
  165. package/dist/chat/transcript/row-ui-state.js +53 -0
  166. package/dist/chat/transcript/run-rows.js +3 -2
  167. package/dist/chat/transcript/script-input.d.ts +1 -1
  168. package/dist/chat/transcript/tasks.js +3 -2
  169. package/dist/chat/transcript/tool-media.d.ts +4 -2
  170. package/dist/chat/transcript/tool-media.js +15 -7
  171. package/dist/chat/transcript/tool-parts.d.ts +27 -4
  172. package/dist/chat/transcript/tool-parts.js +31 -6
  173. package/dist/chat/transcript/tool-payload.js +26 -11
  174. package/dist/chat/transcript/tool-row.d.ts +2 -1
  175. package/dist/chat/transcript/tool-row.js +38 -19
  176. package/dist/chat/transcript/use-transcript-rows.d.ts +25 -8
  177. package/dist/chat/transcript/use-transcript-rows.js +28 -46
  178. package/dist/chat/transcript/useHistoryBackfill.d.ts +42 -0
  179. package/dist/chat/transcript/useHistoryBackfill.js +170 -0
  180. package/dist/chat/transcript/useStickToBottom.js +2 -3
  181. package/dist/chat/transcript/useTranscriptFind.js +2 -4
  182. package/dist/chat/transcript/useTranscriptScroll.d.ts +7 -4
  183. package/dist/chat/transcript/useTranscriptScroll.js +12 -1
  184. package/dist/chat/transcript/useTranscriptSearch.d.ts +2 -2
  185. package/dist/chat/transcript/useTranscriptSearch.js +35 -19
  186. package/dist/chat/transcript/useTranscriptSelectionCopy.d.ts +5 -5
  187. package/dist/chat/transcript/useTranscriptSelectionCopy.js +28 -7
  188. package/dist/chat/transcript/view-scope.d.ts +26 -6
  189. package/dist/chat/transcript/view-scope.js +106 -20
  190. package/dist/code/editor/FileTree.d.ts +2 -0
  191. package/dist/code/editor/FileTree.js +1 -1
  192. package/dist/code/editor/FileView.js +16 -25
  193. package/dist/code/editor/find/useFind.js +17 -17
  194. package/dist/code/editor/useCodeDocument.js +22 -19
  195. package/dist/code/editor/useDetachCleanup.js +4 -3
  196. package/dist/code/use-highlighted-html.js +12 -13
  197. package/dist/components/IconButton.d.ts +3 -1
  198. package/dist/components/IconButton.js +7 -2
  199. package/dist/components/IconButtonTip.d.ts +3 -1
  200. package/dist/components/IconButtonTip.js +2 -1
  201. package/dist/components/RowActionsMenu.js +7 -14
  202. package/dist/components/Tooltip.d.ts +4 -1
  203. package/dist/components/Tooltip.js +8 -6
  204. package/dist/components/assign-ref.d.ts +8 -0
  205. package/dist/components/assign-ref.js +12 -0
  206. package/dist/components/floating/FloatingSurface.js +2 -2
  207. package/dist/components/floating/HoverCard.js +32 -14
  208. package/dist/components/floating/Popover.js +4 -7
  209. package/dist/components/floating/useAnchoredPosition.d.ts +5 -3
  210. package/dist/components/floating/useAnchoredPosition.js +7 -7
  211. package/dist/components/object-key.d.ts +7 -0
  212. package/dist/components/object-key.js +18 -0
  213. package/dist/components/palette/PaletteList.js +2 -7
  214. package/dist/components/tooltip-arming.d.ts +3 -0
  215. package/dist/components/tooltip-arming.js +8 -1
  216. package/dist/core.css +3 -3
  217. package/dist/dist/{index-E1Z0aPmi.d.ts → index-BheVJOLc.d.ts} +3 -1
  218. package/dist/dist/index.d.ts +2 -2
  219. package/dist/files/FilesTab.js +0 -1
  220. package/dist/files/TreeColumn.d.ts +2 -4
  221. package/dist/files/TreeColumn.js +0 -5
  222. package/dist/files/headless/host.d.ts +3 -7
  223. package/dist/files/headless/labels.d.ts +0 -1
  224. package/dist/files/headless/labels.js +0 -1
  225. package/dist/files/headless/workspace-diff.js +1 -1
  226. package/dist/files/useCodeReview.js +1 -3
  227. package/dist/files/useFilesDiagnostics.d.ts +1 -1
  228. package/dist/files/useFilesDiagnostics.js +4 -11
  229. package/dist/files/useOpenFiles.js +9 -12
  230. package/dist/files/useWorkspace.d.ts +5 -7
  231. package/dist/files/useWorkspace.js +4 -15
  232. package/dist/git/GitBar.js +5 -3
  233. package/dist/git/MoveSessionDialog.d.ts +18 -8
  234. package/dist/git/MoveSessionDialog.js +32 -53
  235. package/dist/git/MoveToDialog.d.ts +61 -0
  236. package/dist/git/MoveToDialog.js +240 -0
  237. package/dist/git/SandboxManager.js +9 -4
  238. package/dist/git/SyncChip.js +11 -4
  239. package/dist/git/TeleportSessionDialog.d.ts +69 -0
  240. package/dist/git/TeleportSessionDialog.js +440 -0
  241. package/dist/git/headless/host.d.ts +14 -0
  242. package/dist/git/headless/index.d.ts +2 -1
  243. package/dist/git/headless/index.js +2 -1
  244. package/dist/git/headless/labels.d.ts +44 -1
  245. package/dist/git/headless/labels.js +50 -0
  246. package/dist/git/headless/sandboxes.d.ts +1 -1
  247. package/dist/git/headless/sandboxes.js +4 -3
  248. package/dist/git/headless/teleport.d.ts +76 -0
  249. package/dist/git/headless/teleport.js +19 -0
  250. package/dist/git/index.d.ts +4 -2
  251. package/dist/git/index.js +4 -2
  252. package/dist/git/useEnvironmentChoices.d.ts +5 -2
  253. package/dist/git/useEnvironmentChoices.js +12 -4
  254. package/dist/hooks/useLatest.d.ts +8 -0
  255. package/dist/hooks/useLatest.js +17 -0
  256. package/dist/hooks/useMinuteTick.d.ts +6 -2
  257. package/dist/hooks/useMinuteTick.js +12 -6
  258. package/dist/hooks/useNearViewport.js +11 -8
  259. package/dist/index.d.ts +3 -2
  260. package/dist/index.js +2 -1
  261. package/dist/keybindings/KeybindingsProvider.js +3 -4
  262. package/dist/keybindings/headless/catalog.d.ts +1 -1
  263. package/dist/keybindings/headless/catalog.js +18 -0
  264. package/dist/machines/AddServerForm.js +55 -3
  265. package/dist/machines/Banners.d.ts +2 -2
  266. package/dist/machines/Banners.js +3 -3
  267. package/dist/machines/DaemonMenu.js +1 -3
  268. package/dist/machines/HostsSection.js +5 -1
  269. package/dist/machines/OrganizationPanel.d.ts +25 -0
  270. package/dist/machines/OrganizationPanel.js +266 -0
  271. package/dist/machines/PersonalLayerPanel.d.ts +32 -0
  272. package/dist/machines/PersonalLayerPanel.js +360 -0
  273. package/dist/machines/headless/fixture-host.d.ts +10 -0
  274. package/dist/machines/headless/fixture-host.js +44 -0
  275. package/dist/machines/headless/host.d.ts +21 -1
  276. package/dist/machines/headless/index.d.ts +3 -1
  277. package/dist/machines/headless/index.js +3 -1
  278. package/dist/machines/headless/labels.d.ts +55 -0
  279. package/dist/machines/headless/labels.js +58 -1
  280. package/dist/machines/headless/layer.d.ts +64 -0
  281. package/dist/machines/headless/layer.js +56 -0
  282. package/dist/machines/headless/organization.d.ts +38 -0
  283. package/dist/machines/headless/organization.js +44 -0
  284. package/dist/machines/index.d.ts +3 -1
  285. package/dist/machines/index.js +3 -1
  286. package/dist/machines/testing/contract.d.ts +25 -1
  287. package/dist/machines/testing/contract.js +97 -1
  288. package/dist/motion/grow.js +12 -13
  289. package/dist/motion/swap.js +2 -5
  290. package/dist/motion/use-flip-list.d.ts +14 -0
  291. package/dist/motion/use-flip-list.js +17 -12
  292. package/dist/palette/headless/app-sources.js +37 -0
  293. package/dist/palette/headless/labels.js +3 -0
  294. package/dist/server/sse-handler.js +25 -2
  295. package/dist/session/DiffFileTree.js +1 -4
  296. package/dist/session/OpenSessionsDialog.d.ts +46 -0
  297. package/dist/session/OpenSessionsDialog.js +170 -0
  298. package/dist/session/PlanTracker.js +1 -2
  299. package/dist/session/ProjectHome.js +10 -9
  300. package/dist/session/RemindersPanel.js +10 -12
  301. package/dist/session/SecretsPanel.js +2 -1
  302. package/dist/session/SessionHeader.js +1 -0
  303. package/dist/session/SessionPeopleStack.d.ts +23 -0
  304. package/dist/session/SessionPeopleStack.js +65 -0
  305. package/dist/session/SessionPlaceMenu.js +5 -4
  306. package/dist/session/ShareSessionDialog.d.ts +32 -0
  307. package/dist/session/ShareSessionDialog.js +342 -0
  308. package/dist/session/TypingLine.d.ts +22 -0
  309. package/dist/session/TypingLine.js +31 -0
  310. package/dist/session/headless/host.d.ts +40 -1
  311. package/dist/session/headless/index.d.ts +4 -2
  312. package/dist/session/headless/index.js +3 -1
  313. package/dist/session/headless/labels.d.ts +49 -0
  314. package/dist/session/headless/labels.js +56 -0
  315. package/dist/session/headless/people.d.ts +29 -0
  316. package/dist/session/headless/people.js +53 -0
  317. package/dist/session/headless/place.d.ts +5 -0
  318. package/dist/session/headless/place.js +5 -1
  319. package/dist/session/headless/typing.d.ts +37 -0
  320. package/dist/session/headless/typing.js +60 -0
  321. package/dist/session/index.d.ts +5 -1
  322. package/dist/session/index.js +5 -1
  323. package/dist/settings/headless/fixture-performance.js +4 -2
  324. package/dist/settings/headless/performance.d.ts +4 -0
  325. package/dist/settings/headless/search.d.ts +1 -1
  326. package/dist/settings/headless/sections-host.d.ts +7 -2
  327. package/dist/settings/section.d.ts +15 -3
  328. package/dist/settings/section.js +15 -3
  329. package/dist/settings/sections/environments/EnvironmentsSection.js +30 -6
  330. package/dist/settings/sections/keybindings/labels.d.ts +3 -0
  331. package/dist/settings/sections/keybindings/labels.js +3 -0
  332. package/dist/settings/sections/keybindings/rows.js +12 -0
  333. package/dist/settings/sections/logs/LogsSection.js +5 -8
  334. package/dist/settings/sections/performance/PerformanceSection.js +8 -1
  335. package/dist/settings/sections/performance/labels.d.ts +2 -0
  336. package/dist/settings/sections/performance/labels.js +2 -0
  337. package/dist/styles.css +65 -9
  338. package/dist/terminal/HostTerminalSurface.js +28 -30
  339. package/dist/terminal/TerminalPanel.js +4 -12
  340. package/dist/terminal/TerminalProvider.d.ts +10 -2
  341. package/dist/terminal/TerminalProvider.js +10 -2
  342. package/dist/terminal/headless/labels.d.ts +0 -1
  343. package/dist/terminal/headless/labels.js +1 -2
  344. package/dist/terminal/headless/store.js +5 -1
  345. package/dist/views/headless/answers.d.ts +8 -2
  346. package/dist/views/headless/answers.js +58 -1
  347. package/dist/views/headless/placement.d.ts +78 -0
  348. package/dist/views/headless/placement.js +154 -44
  349. package/dist/workspace/LayoutBudget.js +1 -7
  350. package/package.json +2 -2
  351. package/src/styles/chat.css +3 -1
  352. package/src/styles/palette.css +3 -3
  353. package/src/styles/transcript.css +50 -5
  354. /package/dist/dist/{index-De9AbmxS.d.ts → index-ttmMvjgM.d.ts} +0 -0
@@ -1,132 +1,57 @@
1
- import { scrollRootOf } from "../../hooks/useNearViewport.js";
2
- import { createContext, useContext, useEffect, useRef, useState, useSyncExternalStore } from "react";
1
+ import { RowMountContext } from "./row-mount.js";
2
+ import { RowKeyContext } from "./row-ui-state.js";
3
+ import { createContext, useContext, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
3
4
  import { jsx } from "react/jsx-runtime";
4
- import { flushSync } from "react-dom";
5
5
  // src/chat/transcript/LazyRow.tsx
6
- /** Far enough ahead that a fast flick finds rows mounted before they arrive. */
7
- const MARGIN = "2500px 0px";
8
- /** Within this, a row mounts right away. */
9
- const NEAR_MARGIN = "100% 0px";
10
- /** Main-thread time a frame may spend mounting rows ahead of the view. */
11
- const BUDGET_MS = 6;
12
- const queue = /* @__PURE__ */ new Map();
13
- let pumpScheduled = false;
14
- /** Per scroll root: the far (queue) and near (mount now) observers. */
15
- const observersByRoot = /* @__PURE__ */ new WeakMap();
16
- const observedBy = /* @__PURE__ */ new WeakMap();
17
- /** Observed rows and how to mount them; moved into `queue` once they enter the margin. */
18
- const pendingMounts = /* @__PURE__ */ new WeakMap();
19
- function mountNow(targets) {
20
- const mounts = [];
21
- for (const target of targets) {
22
- const mount = pendingMounts.get(target);
23
- if (!mount) continue;
24
- forget(target);
25
- mounts.push(mount);
26
- }
27
- if (mounts.length > 0) flushSync(() => mounts.forEach((mount) => mount(false)));
28
- }
29
- function lazyObservers(root) {
30
- const key = root ?? document;
31
- const hit = observersByRoot.get(key);
32
- if (hit) return hit;
33
- const pair = [new IntersectionObserver((entries) => {
34
- for (const entry of entries) {
35
- if (!entry.isIntersecting) continue;
36
- const mount = pendingMounts.get(entry.target);
37
- if (mount) queue.set(entry.target, mount);
38
- }
39
- schedulePump();
40
- }, {
41
- root,
42
- rootMargin: MARGIN
43
- }), new IntersectionObserver((entries) => mountNow(entries.filter((entry) => entry.isIntersecting).map((entry) => entry.target)), {
44
- root,
45
- rootMargin: NEAR_MARGIN
46
- })];
47
- observersByRoot.set(key, pair);
48
- return pair;
49
- }
50
- function forget(target) {
51
- pendingMounts.delete(target);
52
- queue.delete(target);
53
- const pair = observedBy.get(target);
54
- observedBy.delete(target);
55
- pair?.[0].unobserve(target);
56
- pair?.[1].unobserve(target);
6
+ const NO_FORCE = {
7
+ all: false,
8
+ needles: []
9
+ };
10
+ const holds = /* @__PURE__ */ new Set();
11
+ let forced = NO_FORCE;
12
+ const subscribers = /* @__PURE__ */ new Set();
13
+ function publish() {
14
+ const needles = /* @__PURE__ */ new Set();
15
+ let all = false;
16
+ for (const hold of holds) if (!hold.needles) all = true;
17
+ else hold.needles.forEach((n) => needles.add(n));
18
+ forced = holds.size === 0 ? NO_FORCE : {
19
+ all,
20
+ needles: [...needles]
21
+ };
22
+ for (const notify of subscribers) notify();
57
23
  }
58
24
  /**
59
- * Mount a lazy row's content now, wherever it is: a view putting its place
60
- * back (`useStickToBottom`'s `restorePosition`) lands on rows it never
61
- * came near. A row already mounted, or not a lazy row, is left alone. Call
62
- * it outside React's render and effects: it commits synchronously.
25
+ * Holds rows mounted while a search is active: the rows whose text holds one
26
+ * of `needles` (lowercased), or every row without them. The transcript mounts
27
+ * them wherever they are, so a walk of the DOM finds their text. Returns the release.
63
28
  *
64
- * @param row - The row's element, the wrapper `LazyRow` renders.
65
- */
66
- function mountRowNow(row) {
67
- mountNow([row]);
68
- }
69
- function schedulePump() {
70
- if (pumpScheduled || queue.size === 0) return;
71
- pumpScheduled = true;
72
- requestAnimationFrame(() => setTimeout(pump, 0));
73
- }
74
- /**
75
- * Distance from the visible part of the row's scroll root (0 = in view), and that view's height.
76
- * `views` keeps each root's top and bottom for one pump: a root is measured once, not per row.
29
+ * @param needles - What the search looks for, lowercased; absent, every row.
77
30
  */
78
- function distanceToView(el, views) {
79
- const r = el.getBoundingClientRect();
80
- const root = scrollRootOf(el);
81
- let view = views.get(root);
82
- if (!view) {
83
- const rect = root?.getBoundingClientRect();
84
- view = rect ? [rect.top, rect.bottom] : [0, window.innerHeight];
85
- views.set(root, view);
86
- }
87
- const [top, bottom] = view;
88
- return [r.bottom >= top && r.top <= bottom ? 0 : r.top > bottom ? r.top - bottom : top - r.bottom, bottom - top];
89
- }
90
- function pump() {
91
- pumpScheduled = false;
92
- const views = /* @__PURE__ */ new Map();
93
- const order = [...queue.keys()].filter((el) => el.isConnected).map((el) => [el, ...distanceToView(el, views)]).sort((a, b) => a[1] - b[1]);
94
- const isNear = ([, distance, view]) => distance <= view;
95
- mountNow(order.filter(isNear).map(([el]) => el));
96
- const start = performance.now();
97
- for (const entry of order) {
98
- if (isNear(entry)) continue;
99
- const el = entry[0];
100
- if (performance.now() - start > BUDGET_MS) break;
101
- const mount = queue.get(el);
102
- forget(el);
103
- if (mount) flushSync(() => mount(true));
104
- }
105
- for (const el of queue.keys()) if (!el.isConnected) queue.delete(el);
106
- schedulePump();
107
- }
108
- /** How many active searches want every row mounted; any one is enough. */
109
- let forceHolds = 0;
110
- const subscribers = /* @__PURE__ */ new Set();
111
- /** Every lazy row mounts while held (and stays mounted after release). Returns the release. */
112
- function holdForceMountRows() {
113
- forceHolds++;
114
- if (forceHolds === 1) for (const notify of subscribers) notify();
31
+ function holdForceMountRows(needles) {
32
+ const hold = { needles: needles ?? null };
33
+ holds.add(hold);
34
+ publish();
115
35
  let released = false;
116
36
  return () => {
117
37
  if (released) return;
118
38
  released = true;
119
- forceHolds--;
120
- if (forceHolds === 0) for (const notify of subscribers) notify();
39
+ holds.delete(hold);
40
+ publish();
121
41
  };
122
42
  }
123
43
  function subscribe(notify) {
124
44
  subscribers.add(notify);
125
45
  return () => subscribers.delete(notify);
126
46
  }
127
- const getForced = () => forceHolds > 0;
128
- /** Returns whether every lazy row must be mounted now, for example while a search needle is active. */
47
+ const getForced = () => forced;
48
+ const getForcing = () => forced !== NO_FORCE;
49
+ /** Returns whether a search holds rows mounted now (rows then render whole: no reveal over frames, groups open). */
129
50
  function useForceMountRows() {
51
+ return useSyncExternalStore(subscribe, getForcing, getForcing);
52
+ }
53
+ /** What the active searches hold mounted ({@link holdForceMountRows}); a new object on every change. */
54
+ function useForcedRows() {
130
55
  return useSyncExternalStore(subscribe, getForced, getForced);
131
56
  }
132
57
  /**
@@ -148,7 +73,10 @@ function CvRow({ style, children, className, ...rest }) {
148
73
  style,
149
74
  "data-quiet": quiet ? "" : void 0,
150
75
  ...rest,
151
- children
76
+ children: rest["data-row"] === void 0 ? children : /* @__PURE__ */ jsx(RowKeyContext.Provider, {
77
+ value: rest["data-row"],
78
+ children
79
+ })
152
80
  });
153
81
  }
154
82
  const BackgroundMount = createContext(false);
@@ -157,51 +85,74 @@ function useBackgroundMount() {
157
85
  return useContext(BackgroundMount);
158
86
  }
159
87
  /**
160
- * Renders a transcript row that mounts its content only when it nears the viewport. Until then it is an empty box at its estimated height; once mounted it stays mounted.
88
+ * Renders a root transcript row that mounts its content when it nears the view, and keeps it: until then (and
89
+ * parked) an empty box of the row's height, its last measured height when known, without `content-visibility`.
161
90
  *
162
- * @param props - Row props: `eager`, `estimatePx`, `style`, `children`, the select-mode data attributes and the row's id.
91
+ * @param props - Row props: `itemKey`, `estimatePx`, `style`, `children`, the row's id and the select-mode data attributes.
163
92
  */
164
- function LazyRow({ eager, estimatePx, style, children, className, ...rest }) {
165
- const ref = useRef(null);
166
- const force = useForceMountRows();
167
- const [near, setNear] = useState(eager);
168
- const [background, setBackground] = useState(false);
93
+ function LazyRow({ itemKey, estimatePx, style, children, className, box = false, ...rest }) {
94
+ const mounter = useContext(RowMountContext);
169
95
  const settling = useContext(TranscriptSettling);
170
- const [quiet] = useState(() => !eager || settling());
171
- if (force && !near) setNear(true);
172
- const mounted = near || force;
173
- useEffect(() => {
96
+ const [state, setState] = useState(() => {
97
+ const start = mounter?.start(itemKey) ?? {
98
+ mounted: true,
99
+ eager: true,
100
+ seen: false
101
+ };
102
+ return {
103
+ phase: start.mounted ? "mounted" : "lazy",
104
+ background: false,
105
+ parkedPx: void 0,
106
+ quiet: settling() || !start.eager || start.seen
107
+ };
108
+ });
109
+ const ref = useRef(null);
110
+ const phase = useRef(state.phase);
111
+ phase.current = state.phase;
112
+ useLayoutEffect(() => {
174
113
  const el = ref.current;
175
- if (!el || mounted) return void 0;
176
- if (typeof IntersectionObserver === "undefined") {
177
- setNear(true);
178
- return;
179
- }
180
- const pair = lazyObservers(scrollRootOf(el));
181
- const [far, close] = pair;
182
- observedBy.set(el, pair);
183
- pendingMounts.set(el, (bg) => {
184
- setBackground(bg);
185
- setNear(true);
114
+ if (!mounter || !el) return void 0;
115
+ return mounter.register({
116
+ key: itemKey,
117
+ el,
118
+ cv: !box,
119
+ phase: phase.current,
120
+ set: (next, background, parkedPx) => setState((s) => ({
121
+ ...s,
122
+ phase: next,
123
+ background,
124
+ parkedPx
125
+ }))
186
126
  });
187
- far.observe(el);
188
- close.observe(el);
189
- return () => forget(el);
190
- }, [mounted]);
127
+ }, [
128
+ mounter,
129
+ itemKey,
130
+ box
131
+ ]);
132
+ const mounted = state.phase === "mounted";
133
+ const known = mounter?.sizeOf(itemKey);
134
+ const px = state.parkedPx ?? known ?? estimatePx;
135
+ const wrapperStyle = !mounted ? { height: px } : box ? void 0 : {
136
+ ...style,
137
+ containIntrinsicSize: `auto ${Math.round(known ?? estimatePx)}px`
138
+ };
139
+ const rowKey = rest["data-row"];
191
140
  return /* @__PURE__ */ jsx("div", {
192
141
  ref,
193
- className: ["zg-cv-row", className].filter(Boolean).join(" "),
194
- style: mounted ? style : {
195
- ...style,
196
- height: estimatePx
197
- },
142
+ className: box ? className : ["zg-cv-row", className].filter(Boolean).join(" "),
143
+ style: wrapperStyle,
144
+ "data-item": itemKey,
198
145
  "data-lazy": mounted ? void 0 : "",
199
- "data-quiet": quiet ? "" : void 0,
146
+ "data-parked": state.phase === "parked" ? "" : void 0,
147
+ "data-quiet": state.quiet ? "" : void 0,
200
148
  ...rest,
201
- children: mounted ? /* @__PURE__ */ jsx(BackgroundMount.Provider, {
202
- value: background,
203
- children
149
+ children: mounted ? /* @__PURE__ */ jsx(RowKeyContext.Provider, {
150
+ value: rowKey,
151
+ children: /* @__PURE__ */ jsx(BackgroundMount.Provider, {
152
+ value: state.background,
153
+ children
154
+ })
204
155
  }) : null
205
156
  });
206
157
  }
207
- export { CvRow, LazyRow, TranscriptSettling, holdForceMountRows, mountRowNow, useBackgroundMount, useForceMountRows };
158
+ export { CvRow, LazyRow, TranscriptSettling, holdForceMountRows, useBackgroundMount, useForceMountRows, useForcedRows };
@@ -3,6 +3,7 @@ import { CodeFrame } from "../../components/CodeFrame.js";
3
3
  import { Notice } from "../../components/Notice.js";
4
4
  import { useNearViewport } from "../../hooks/useNearViewport.js";
5
5
  import { useChatLabels } from "../useChatLabels.js";
6
+ import { textKey, useRowPartKey, useRowUiState } from "./row-ui-state.js";
6
7
  import { memo, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
7
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
9
  // src/chat/transcript/MermaidDiagram.tsx
@@ -321,7 +322,7 @@ function failureOf(code, error) {
321
322
  */
322
323
  const MermaidDiagram = memo(({ code, streaming = false, className, style, view = false, still = false, highlight }) => {
323
324
  const labels = useChatLabels();
324
- const [showSource, setShowSource] = useState(false);
325
+ const [showSource, setShowSource] = useRowUiState(useRowPartKey(`mermaid:${textKey(code)}`), false);
325
326
  const [failure, setFailure] = useState(null);
326
327
  const failed = !streaming && failure?.code === code ? failure : null;
327
328
  const sourceToggle = (buttonClass) => {
@@ -5,11 +5,12 @@ import { useChatLabels } from "../useChatLabels.js";
5
5
  import { useBadgeMenu } from "./BadgeMenu.js";
6
6
  import { BADGE_GLYPH, FileBadgeIcon, LinkBadge, fileBadgeName } from "./badges.js";
7
7
  import { ChipHover } from "./ChipCard.js";
8
- import { CommandCard, SessionCard, SkillCard, SkillGroupCard } from "./ChipCards.js";
8
+ import { CommandCard, SkillCard, SkillGroupCard } from "./ChipCards.js";
9
9
  import { MarkdownContext } from "./markdown-context.js";
10
10
  import { PromptLines } from "./prompt-lines.js";
11
11
  import { useReferenceMatches } from "./references.js";
12
12
  import { ReferenceChip } from "./ReferenceText.js";
13
+ import { SessionChip } from "./SessionChip.js";
13
14
  import { useContext } from "react";
14
15
  import { jsx, jsxs } from "react/jsx-runtime";
15
16
  import { inferPromptRefs, splitPromptSegments, tidyPromptText } from "zidane/chat/pure";
@@ -154,16 +155,7 @@ function PromptBadge({ text, providerId, cwd, skillGroups }) {
154
155
  text
155
156
  })
156
157
  });
157
- case "chats": return /* @__PURE__ */ jsx(ChipHover, {
158
- ariaLabel: labels.chipChat(text),
159
- trigger: (props) => /* @__PURE__ */ jsx("span", {
160
- ...props,
161
- className: `zg-badge ${BADGE_GLYPH.chat}`,
162
- "data-kind": "chat",
163
- children: text
164
- }),
165
- children: /* @__PURE__ */ jsx(SessionCard, { token: text })
166
- });
158
+ case "chats": return /* @__PURE__ */ jsx(SessionChip, { token: text });
167
159
  default: return /* @__PURE__ */ jsx("span", {
168
160
  className: "zg-badge",
169
161
  children: text
@@ -0,0 +1,11 @@
1
+ /** Props for {@link SessionChip}. */
2
+ export interface SessionChipProps {
3
+ /** What names the session: a `#token`, an id prefix or a full id. */
4
+ token: string;
5
+ }
6
+ /**
7
+ * A session's chip: its title, its card on hover.
8
+ *
9
+ * @param props - The {@link SessionChipProps}.
10
+ */
11
+ export declare function SessionChip({ token }: SessionChipProps): import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { useChatLabels } from "../useChatLabels.js";
2
+ import { BADGE_GLYPH } from "./badges.js";
3
+ import { useTokenSession } from "./chip-details.js";
4
+ import { ChipHover } from "./ChipCard.js";
5
+ import { SessionCard } from "./ChipCards.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+ // src/chat/transcript/SessionChip.tsx
8
+ /**
9
+ * A session named in a chat: a `#chat` chip of a sent prompt, or a session id an answer wrote in inline code.
10
+ * It reads as the composer's chip does, the session's title (its token until the sessions are read, or when
11
+ * none matches), with the session's card on hover.
12
+ */
13
+ /**
14
+ * A session's chip: its title, its card on hover.
15
+ *
16
+ * @param props - The {@link SessionChipProps}.
17
+ */
18
+ function SessionChip({ token }) {
19
+ const labels = useChatLabels();
20
+ const { session } = useTokenSession(token);
21
+ const face = session?.title.trim() || token;
22
+ return /* @__PURE__ */ jsx(ChipHover, {
23
+ ariaLabel: labels.chipChat(token),
24
+ trigger: (props) => /* @__PURE__ */ jsx("span", {
25
+ ...props,
26
+ className: `zg-badge ${BADGE_GLYPH.chat}`,
27
+ "data-kind": "chat",
28
+ title: token,
29
+ children: face
30
+ }),
31
+ children: /* @__PURE__ */ jsx(SessionCard, { token })
32
+ });
33
+ }
34
+ export { SessionChip };
@@ -2,8 +2,9 @@ import { useStaysMounted } from "../../motion/collapse.js";
2
2
  import { RunEstimateChip, useRunEstimate } from "../RunEstimateChip.js";
3
3
  import { useChatLabels } from "../useChatLabels.js";
4
4
  import { Caret, Dot, FailedMark, lineStateOf, useRowIcons } from "./frame.js";
5
+ import { useRowUiState } from "./row-ui-state.js";
5
6
  import { ToolTiming } from "./tool-parts.js";
6
- import { useMemo, useState } from "react";
7
+ import { useMemo } from "react";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  import { previewLine, spawnStartParts } from "zidane/chat/pure";
9
10
  // src/chat/transcript/SubagentBlock.tsx
@@ -69,7 +70,7 @@ function subagentDot(status, streaming) {
69
70
  */
70
71
  function SubagentBlock({ childId, sessionId, depth, parentDepth, rows, defaultCollapsed, streaming, children, "data-row": rowId, className, style }) {
71
72
  const labels = useChatLabels();
72
- const [userOpen, setUserOpen] = useState(null);
73
+ const [userOpen, setUserOpen] = useRowUiState(`worker-block:${childId}`, null);
73
74
  const open = userOpen ?? !defaultCollapsed;
74
75
  const mounted = useStaysMounted(open);
75
76
  const { task, status, durationMs, turns } = useMemo(() => subagentHeaderMeta(rows), [rows]);
@@ -11,6 +11,15 @@
11
11
  * closes it. A click, or the previous / next message keys, glides the prompt
12
12
  * to the top; next past the last prompt glides to the end of its answer.
13
13
  *
14
+ * Every prompt of the session has a tick, loaded or not: the transcript's
15
+ * host gives the session's outline (`Transcript.outline`), and a tick whose
16
+ * history is not loaded yet loads up to it (`Transcript.loadThrough`) when
17
+ * picked, pulsing meanwhile, then lands there.
18
+ *
19
+ * A tick is 8px tall. Past `RAIL_MAX_TICKS` of them (or the view's height,
20
+ * less `RAIL_FIT_INSET_PX` above and below) the list scrolls: the edges with
21
+ * more ticks fade, and the tick in view is kept in sight.
22
+ *
14
23
  * The rail floats over that space: showing, hiding or growing it never moves
15
24
  * the layout. It hides with fewer than two prompts, where the space has no
16
25
  * room for it, and on touch screens.
@@ -29,7 +38,9 @@
29
38
  */
30
39
  import { Cluster, Row } from "../headless/transcript/rows.js";
31
40
  import { TranscriptRailStore } from "../headless/transcript/rail.js";
41
+ import { Transcript } from "../headless/host.js";
32
42
  import "../headless/transcript/index.js";
43
+ import { TranscriptRowsSlice } from "../headless/transcript/incremental.js";
33
44
  import { CSSProperties, ReactNode, RefObject } from "react";
34
45
  import { RunReceipt } from "zidane/chat/pure";
35
46
  /** Props for {@link TranscriptRailProvider}. */
@@ -49,12 +60,24 @@ export declare function useTranscriptRailStore(): TranscriptRailStore | null;
49
60
  * The transcript's side of the rail: publishes its exchanges and the cursor's exchange to the provider's store.
50
61
  * Outside a provider it computes nothing.
51
62
  *
52
- * @param clusters - The root clusters the transcript paints.
63
+ * @param clusters - The root clusters the transcript paints, or their settled and open parts (the settled ones fold once).
53
64
  * @param isHidden - Whether a row paints nothing.
54
65
  * @param receipts - The receipts docked on reply rows.
55
66
  * @param selectedTurn - Select-turn mode's selected stop (a turn id), or `null`.
56
67
  */
57
- export declare function useRailPublish(clusters: readonly Cluster[], isHidden: (row: Row) => boolean, receipts: ReadonlyMap<string, RunReceipt>, selectedTurn: string | null): TranscriptRailStore | null;
68
+ export declare function useRailPublish(clusters: readonly Cluster[] | {
69
+ settled: TranscriptRowsSlice;
70
+ open: TranscriptRowsSlice;
71
+ }, isHidden: (row: Row) => boolean, receipts: ReadonlyMap<string, RunReceipt>, selectedTurn: string | null): TranscriptRailStore | null;
72
+ /**
73
+ * The transcript host's side of the rail: hands it the session's prompt outline while part of the history is not
74
+ * loaded, and how to load up to one of them. Read again when the session changes, when more history becomes
75
+ * loadable, and when the outline no longer matches the loaded rows (the history was rewritten).
76
+ *
77
+ * @param transcript - The session's transcript, from its host.
78
+ * @param hasEarlier - Older history is not loaded yet.
79
+ */
80
+ export declare function useRailOutline(transcript: Transcript, hasEarlier: boolean): void;
58
81
  /** Props for {@link RailTint}. */
59
82
  interface RailTintProps {
60
83
  store: TranscriptRailStore;