zidane-ui 9.2.2 → 9.3.1

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 (320) hide show
  1. package/dist/adapters/browser-keybindings-host.js +3 -1
  2. package/dist/adapters/live.d.ts +6 -0
  3. package/dist/adapters/live.js +16 -8
  4. package/dist/adapters/server-composer-host.js +22 -9
  5. package/dist/adapters/server-host.js +143 -18
  6. package/dist/adapters/server-media.d.ts +9 -1
  7. package/dist/adapters/server-media.js +14 -1
  8. package/dist/adapters/server-settings-host.js +30 -3
  9. package/dist/adapters/server-settings-sections.js +23 -1
  10. package/dist/adapters/server-sidebar-host.d.ts +3 -1
  11. package/dist/adapters/server-sidebar-host.js +10 -1
  12. package/dist/app/ModalProvider.js +1 -1
  13. package/dist/approvals/ApprovalShell.js +1 -1
  14. package/dist/chat/DaemonOrb.d.ts +29 -1
  15. package/dist/chat/DaemonOrb.js +25 -12
  16. package/dist/chat/HostTranscript.d.ts +0 -12
  17. package/dist/chat/HostTranscript.js +6 -1
  18. package/dist/chat/SessionStreamsProvider.d.ts +8 -0
  19. package/dist/chat/SessionStreamsProvider.js +11 -2
  20. package/dist/chat/StatusDot.js +8 -2
  21. package/dist/chat/Transcript.d.ts +20 -11
  22. package/dist/chat/Transcript.js +335 -162
  23. package/dist/chat/composer/ComposerEditor.js +1 -1
  24. package/dist/chat/headless/host.d.ts +43 -7
  25. package/dist/chat/headless/index.d.ts +8 -6
  26. package/dist/chat/headless/index.js +11 -9
  27. package/dist/chat/headless/labels.d.ts +30 -0
  28. package/dist/chat/headless/labels.js +29 -0
  29. package/dist/chat/headless/markdown-chunks.d.ts +2 -1
  30. package/dist/chat/headless/markdown-chunks.js +12 -20
  31. package/dist/chat/headless/markdown-scan.d.ts +66 -0
  32. package/dist/chat/headless/markdown-scan.js +124 -0
  33. package/dist/chat/headless/markdown-stream.d.ts +64 -0
  34. package/dist/chat/headless/markdown-stream.js +143 -0
  35. package/dist/chat/headless/output-pager.d.ts +68 -0
  36. package/dist/chat/headless/output-pager.js +113 -0
  37. package/dist/chat/headless/session-list.d.ts +20 -0
  38. package/dist/chat/headless/sidebar/activity.d.ts +14 -0
  39. package/dist/chat/headless/sidebar/activity.js +32 -0
  40. package/dist/chat/headless/sidebar/directory.d.ts +17 -2
  41. package/dist/chat/headless/sidebar/directory.js +50 -54
  42. package/dist/chat/headless/sidebar/environment.d.ts +5 -2
  43. package/dist/chat/headless/sidebar/environment.js +11 -2
  44. package/dist/chat/headless/sidebar/host.d.ts +15 -0
  45. package/dist/chat/headless/sidebar/inbox.d.ts +12 -3
  46. package/dist/chat/headless/sidebar/inbox.js +18 -9
  47. package/dist/chat/headless/sidebar/index.d.ts +2 -2
  48. package/dist/chat/headless/sidebar/index.js +2 -2
  49. package/dist/chat/headless/sidebar/labels.d.ts +38 -2
  50. package/dist/chat/headless/sidebar/labels.js +16 -0
  51. package/dist/chat/headless/sidebar/prewarm.d.ts +68 -0
  52. package/dist/chat/headless/sidebar/prewarm.js +114 -0
  53. package/dist/chat/headless/streams/actions.d.ts +2 -0
  54. package/dist/chat/headless/streams/actions.js +1 -0
  55. package/dist/chat/headless/streams/event-bytes.d.ts +6 -0
  56. package/dist/chat/headless/streams/event-bytes.js +34 -0
  57. package/dist/chat/headless/streams/live-events.d.ts +25 -1
  58. package/dist/chat/headless/streams/live-events.js +53 -2
  59. package/dist/chat/headless/streams/selectors.d.ts +3 -0
  60. package/dist/chat/headless/streams/selectors.js +8 -1
  61. package/dist/chat/headless/streams/session-streams.d.ts +15 -3
  62. package/dist/chat/headless/streams/session-streams.js +31 -3
  63. package/dist/chat/headless/streams/store.d.ts +24 -1
  64. package/dist/chat/headless/streams/store.js +51 -26
  65. package/dist/chat/headless/streams/transcript-map.d.ts +57 -0
  66. package/dist/chat/headless/streams/transcript-map.js +88 -0
  67. package/dist/chat/headless/streams/transcript.d.ts +4 -2
  68. package/dist/chat/headless/streams/transcript.js +19 -7
  69. package/dist/chat/headless/transcript/batch.js +5 -1
  70. package/dist/chat/headless/transcript/blob-media.d.ts +15 -0
  71. package/dist/chat/headless/transcript/blob-media.js +23 -0
  72. package/dist/chat/headless/transcript/collapse.d.ts +10 -0
  73. package/dist/chat/headless/transcript/collapse.js +32 -6
  74. package/dist/chat/headless/transcript/derive.d.ts +98 -0
  75. package/dist/chat/headless/transcript/derive.js +89 -0
  76. package/dist/chat/headless/transcript/exchange-media.d.ts +3 -1
  77. package/dist/chat/headless/transcript/exchange-media.js +8 -5
  78. package/dist/chat/headless/transcript/fold-actions.d.ts +8 -3
  79. package/dist/chat/headless/transcript/fold-actions.js +16 -0
  80. package/dist/chat/headless/transcript/fold-attachments.d.ts +2 -0
  81. package/dist/chat/headless/transcript/fold-attachments.js +3 -2
  82. package/dist/chat/headless/transcript/fold.d.ts +4 -2
  83. package/dist/chat/headless/transcript/fold.js +37 -7
  84. package/dist/chat/headless/transcript/incremental.d.ts +53 -0
  85. package/dist/chat/headless/transcript/incremental.js +181 -0
  86. package/dist/chat/headless/transcript/index.d.ts +2 -1
  87. package/dist/chat/headless/transcript/index.js +2 -1
  88. package/dist/chat/headless/transcript/nesting.js +2 -1
  89. package/dist/chat/headless/transcript/rail.d.ts +142 -0
  90. package/dist/chat/headless/transcript/rail.js +290 -0
  91. package/dist/chat/headless/transcript/rows.d.ts +11 -1
  92. package/dist/chat/headless/transcript/run-failures.d.ts +4 -0
  93. package/dist/chat/headless/transcript/run-failures.js +31 -2
  94. package/dist/chat/headless/transcript/seams.d.ts +78 -0
  95. package/dist/chat/headless/transcript/seams.js +116 -0
  96. package/dist/chat/headless/transcript/tool-media.d.ts +6 -7
  97. package/dist/chat/headless/transcript/tool-media.js +27 -9
  98. package/dist/chat/headless/transcript-labels.d.ts +1 -0
  99. package/dist/chat/headless/turn-labels.d.ts +1 -0
  100. package/dist/chat/headless/turn-labels.js +2 -1
  101. package/dist/chat/index.d.ts +10 -8
  102. package/dist/chat/index.js +9 -7
  103. package/dist/chat/interactions/ElicitationCard.js +1 -1
  104. package/dist/chat/interactions/InteractionCard.js +1 -1
  105. package/dist/chat/interactions/PlanCard.js +3 -3
  106. package/dist/chat/interactions/QuestionField.js +4 -4
  107. package/dist/chat/interactions/QuestionForm.js +3 -3
  108. package/dist/chat/interactions/SecretInput.js +1 -1
  109. package/dist/chat/sidebar/ProjectIcon.d.ts +1 -1
  110. package/dist/chat/sidebar/ProjectIcon.js +1 -1
  111. package/dist/chat/sidebar/RowChips.d.ts +3 -2
  112. package/dist/chat/sidebar/RowChips.js +6 -3
  113. package/dist/chat/sidebar/SessionSidebar.js +13 -14
  114. package/dist/chat/sidebar/SidebarFooter.d.ts +8 -5
  115. package/dist/chat/sidebar/SidebarFooter.js +6 -6
  116. package/dist/chat/sidebar/SidebarFrame.d.ts +2 -0
  117. package/dist/chat/sidebar/SidebarFrame.js +5 -2
  118. package/dist/chat/sidebar/SidebarSessionRow.d.ts +3 -1
  119. package/dist/chat/sidebar/SidebarSessionRow.js +3 -1
  120. package/dist/chat/sidebar/SpacesSection.d.ts +20 -1
  121. package/dist/chat/sidebar/SpacesSection.js +34 -13
  122. package/dist/chat/sidebar/index.d.ts +2 -2
  123. package/dist/chat/sidebar/session-menu.d.ts +11 -2
  124. package/dist/chat/sidebar/session-menu.js +50 -5
  125. package/dist/chat/sidebar/sidebar-live.js +1 -1
  126. package/dist/chat/sidebar/useInboxRows.js +43 -2
  127. package/dist/chat/sidebar/useInboxTriage.js +19 -14
  128. package/dist/chat/testing/contract.d.ts +5 -3
  129. package/dist/chat/testing/contract.js +66 -1
  130. package/dist/chat/testing/fixture-sidebar-host.d.ts +7 -1
  131. package/dist/chat/testing/fixture-sidebar-host.js +12 -0
  132. package/dist/chat/testing/sidebar.contract.d.ts +6 -0
  133. package/dist/chat/testing/sidebar.contract.js +24 -0
  134. package/dist/chat/transcript/DiffLines.d.ts +6 -1
  135. package/dist/chat/transcript/DiffLines.js +35 -20
  136. package/dist/chat/transcript/EditDiffBlock.d.ts +5 -1
  137. package/dist/chat/transcript/EditDiffBlock.js +89 -30
  138. package/dist/chat/transcript/InteractionToolBody.js +1 -1
  139. package/dist/chat/transcript/LazyRow.d.ts +40 -40
  140. package/dist/chat/transcript/LazyRow.js +101 -149
  141. package/dist/chat/transcript/MermaidDiagram.js +2 -1
  142. package/dist/chat/transcript/SelectCursor.d.ts +11 -1
  143. package/dist/chat/transcript/SelectCursor.js +10 -5
  144. package/dist/chat/transcript/SubagentBlock.js +3 -2
  145. package/dist/chat/transcript/TranscriptRail.d.ts +109 -0
  146. package/dist/chat/transcript/TranscriptRail.js +579 -0
  147. package/dist/chat/transcript/TranscriptRow.d.ts +4 -7
  148. package/dist/chat/transcript/TranscriptRow.js +9 -5
  149. package/dist/chat/transcript/actions.d.ts +43 -3
  150. package/dist/chat/transcript/actions.js +27 -1
  151. package/dist/chat/transcript/clipped-output.d.ts +58 -0
  152. package/dist/chat/transcript/clipped-output.js +131 -0
  153. package/dist/chat/transcript/fold-attachments.js +10 -5
  154. package/dist/chat/transcript/fold-worker.js +3 -2
  155. package/dist/chat/transcript/fold.js +21 -2
  156. package/dist/chat/transcript/index.d.ts +11 -9
  157. package/dist/chat/transcript/index.js +10 -8
  158. package/dist/chat/transcript/markdown-cache.d.ts +7 -1
  159. package/dist/chat/transcript/markdown-cache.js +12 -1
  160. package/dist/chat/transcript/markdown.js +116 -54
  161. package/dist/chat/transcript/media-gallery.d.ts +3 -2
  162. package/dist/chat/transcript/media-gallery.js +10 -7
  163. package/dist/chat/transcript/notices.d.ts +23 -1
  164. package/dist/chat/transcript/notices.js +110 -28
  165. package/dist/chat/transcript/prompt.js +6 -4
  166. package/dist/chat/transcript/prose.js +3 -1
  167. package/dist/chat/transcript/receipt-parts.d.ts +22 -0
  168. package/dist/chat/transcript/receipt-parts.js +87 -0
  169. package/dist/chat/transcript/root-items.d.ts +96 -0
  170. package/dist/chat/transcript/root-items.js +180 -0
  171. package/dist/chat/transcript/row-mount.d.ts +165 -0
  172. package/dist/chat/transcript/row-mount.js +498 -0
  173. package/dist/chat/transcript/row-parking.d.ts +125 -0
  174. package/dist/chat/transcript/row-parking.js +135 -0
  175. package/dist/chat/transcript/row-ui-state.d.ts +37 -0
  176. package/dist/chat/transcript/row-ui-state.js +53 -0
  177. package/dist/chat/transcript/run-rows.js +6 -78
  178. package/dist/chat/transcript/script-input.d.ts +1 -1
  179. package/dist/chat/transcript/scroll-clamp.js +1 -1
  180. package/dist/chat/transcript/tasks.js +3 -2
  181. package/dist/chat/transcript/tool-media.d.ts +4 -2
  182. package/dist/chat/transcript/tool-media.js +15 -7
  183. package/dist/chat/transcript/tool-parts.d.ts +27 -4
  184. package/dist/chat/transcript/tool-parts.js +31 -5
  185. package/dist/chat/transcript/tool-payload.js +26 -11
  186. package/dist/chat/transcript/tool-row.d.ts +2 -1
  187. package/dist/chat/transcript/tool-row.js +38 -19
  188. package/dist/chat/transcript/use-transcript-rows.d.ts +24 -7
  189. package/dist/chat/transcript/use-transcript-rows.js +28 -46
  190. package/dist/chat/transcript/useSettledReveal.js +15 -3
  191. package/dist/chat/transcript/useStickToBottom.js +4 -4
  192. package/dist/chat/transcript/useTranscriptSearch.js +30 -14
  193. package/dist/chat/transcript/view-scope.d.ts +26 -6
  194. package/dist/chat/transcript/view-scope.js +106 -20
  195. package/dist/components/ChoiceCards.js +1 -1
  196. package/dist/components/ConfirmDialog.js +1 -1
  197. package/dist/components/CopyValue.d.ts +33 -0
  198. package/dist/components/CopyValue.js +54 -0
  199. package/dist/components/Form.js +1 -1
  200. package/dist/components/HowItWorks.js +1 -1
  201. package/dist/components/Menu.js +1 -1
  202. package/dist/components/StepFrame.js +2 -2
  203. package/dist/components/SwatchPicker.js +1 -1
  204. package/dist/components/ToggleCard.js +1 -1
  205. package/dist/components/floating/HoverCard.js +2 -3
  206. package/dist/components/floating/hover-delay.d.ts +4 -0
  207. package/dist/components/floating/hover-delay.js +6 -0
  208. package/dist/core.css +14 -12
  209. package/dist/dist/{index-Betz0OWq.d.ts → index-C6-t1SS9.d.ts} +21 -2
  210. package/dist/dist/index-De9AbmxS.d.ts +1 -0
  211. package/dist/dist/index.d.ts +5 -5
  212. package/dist/dist/sandbox-CSUihARm.d.ts +2 -0
  213. package/dist/dist/{timeout-CyU7HLyz.d.ts → timeout-CmTx6V9y.d.ts} +1 -0
  214. package/dist/extensions/ExtensionDialogHost.js +1 -1
  215. package/dist/files/TreeColumn.js +3 -1
  216. package/dist/files/headless/host.d.ts +2 -2
  217. package/dist/git/ImportRepoDialog.js +1 -1
  218. package/dist/git/MoveSessionDialog.js +2 -2
  219. package/dist/git/SandboxManager.d.ts +42 -0
  220. package/dist/git/SandboxManager.js +297 -0
  221. package/dist/git/SyncChip.js +1 -1
  222. package/dist/git/headless/index.d.ts +2 -1
  223. package/dist/git/headless/index.js +2 -1
  224. package/dist/git/headless/labels.d.ts +29 -0
  225. package/dist/git/headless/labels.js +34 -1
  226. package/dist/git/headless/sandboxes.d.ts +43 -0
  227. package/dist/git/headless/sandboxes.js +52 -0
  228. package/dist/git/index.d.ts +2 -1
  229. package/dist/git/index.js +2 -1
  230. package/dist/index.d.ts +2 -1
  231. package/dist/index.js +2 -1
  232. package/dist/keybindings/headless/catalog.d.ts +1 -1
  233. package/dist/keybindings/headless/catalog.js +12 -0
  234. package/dist/machines/HostsSection.d.ts +1 -1
  235. package/dist/machines/headless/labels.js +2 -2
  236. package/dist/motion/flip-list.js +3 -10
  237. package/dist/motion/presence.d.ts +10 -0
  238. package/dist/motion/presence.js +20 -1
  239. package/dist/motion/swap.d.ts +8 -2
  240. package/dist/motion/swap.js +5 -2
  241. package/dist/onboarding/conversation.js +27 -15
  242. package/dist/onboarding/demos/how-it-works.js +1 -1
  243. package/dist/onboarding/skills/parts.js +4 -4
  244. package/dist/onboarding/sources/SourceBrowser.js +1 -1
  245. package/dist/onboarding/steps/ReadyStep.js +1 -1
  246. package/dist/onboarding/steps/connect/KeyForm.js +1 -1
  247. package/dist/palette/headless/app-sources.js +20 -0
  248. package/dist/palette/headless/labels.js +2 -0
  249. package/dist/session/PlanTracker.js +3 -3
  250. package/dist/session/SecretsPanel.js +1 -1
  251. package/dist/session/SessionHeader.d.ts +18 -6
  252. package/dist/session/SessionHeader.js +68 -12
  253. package/dist/session/SessionPlaceMenu.d.ts +35 -0
  254. package/dist/session/SessionPlaceMenu.js +299 -0
  255. package/dist/session/SessionShell.js +1 -1
  256. package/dist/session/TurnDetailsDialog.js +1 -1
  257. package/dist/session/headless/index.d.ts +2 -1
  258. package/dist/session/headless/index.js +2 -1
  259. package/dist/session/headless/labels.d.ts +73 -0
  260. package/dist/session/headless/labels.js +73 -0
  261. package/dist/session/headless/place.d.ts +49 -0
  262. package/dist/session/headless/place.js +57 -0
  263. package/dist/session/index.d.ts +2 -1
  264. package/dist/session/index.js +2 -1
  265. package/dist/settings/ConversationPresetsCard.js +1 -1
  266. package/dist/settings/SettingCard.js +2 -2
  267. package/dist/settings/SettingsRowsPage.js +1 -1
  268. package/dist/settings/headless/fixture-performance.js +4 -2
  269. package/dist/settings/headless/fixture-sections.js +7 -0
  270. package/dist/settings/headless/labels.d.ts +1 -1
  271. package/dist/settings/headless/labels.js +1 -1
  272. package/dist/settings/headless/layout.d.ts +4 -4
  273. package/dist/settings/headless/layout.js +1 -1
  274. package/dist/settings/headless/performance.d.ts +4 -0
  275. package/dist/settings/headless/search.d.ts +2 -2
  276. package/dist/settings/headless/sections-host.d.ts +20 -2
  277. package/dist/settings/sections/claude-import/ClaudeImportDialog.js +1 -1
  278. package/dist/settings/sections/enabled-list/EnabledListSection.js +2 -2
  279. package/dist/settings/sections/environments/EnvironmentsSection.d.ts +9 -3
  280. package/dist/settings/sections/environments/EnvironmentsSection.js +292 -52
  281. package/dist/settings/sections/environments/labels.d.ts +15 -0
  282. package/dist/settings/sections/environments/labels.js +18 -3
  283. package/dist/settings/sections/extensions/ChangeOriginDialog.js +1 -1
  284. package/dist/settings/sections/extensions/ExtensionSourceBrowser.js +1 -1
  285. package/dist/settings/sections/extensions/ExtensionsSection.d.ts +3 -2
  286. package/dist/settings/sections/extensions/ExtensionsSection.js +9 -3
  287. package/dist/settings/sections/host-catalog/HostCatalogSection.js +15 -5
  288. package/dist/settings/sections/keybindings/labels.d.ts +2 -0
  289. package/dist/settings/sections/keybindings/labels.js +2 -0
  290. package/dist/settings/sections/keybindings/rows.js +8 -0
  291. package/dist/settings/sections/models/SpacesDefaultsSection.d.ts +7 -3
  292. package/dist/settings/sections/models/SpacesDefaultsSection.js +11 -5
  293. package/dist/settings/sections/performance/PerformanceSection.js +8 -1
  294. package/dist/settings/sections/performance/labels.d.ts +2 -0
  295. package/dist/settings/sections/performance/labels.js +2 -0
  296. package/dist/settings/sections/skills/SkillGroups.js +1 -1
  297. package/dist/settings/server-app.d.ts +4 -2
  298. package/dist/settings/server-app.js +7 -3
  299. package/dist/settings/testing/sections.contract.d.ts +7 -1
  300. package/dist/settings/testing/sections.contract.js +37 -0
  301. package/dist/styles.css +243 -19
  302. package/dist/terminal/TerminalDrawer.js +3 -1
  303. package/dist/views/headless/answers.d.ts +8 -2
  304. package/dist/views/headless/answers.js +58 -1
  305. package/dist/views/headless/placement.d.ts +78 -0
  306. package/dist/views/headless/placement.js +154 -44
  307. package/dist/workspace/SidePanel.js +3 -1
  308. package/package.json +2 -2
  309. package/src/styles/base.css +13 -0
  310. package/src/styles/chat.css +30 -0
  311. package/src/styles/components.css +0 -10
  312. package/src/styles/files.css +5 -0
  313. package/src/styles/sidebar.css +29 -7
  314. package/src/styles/terminal.css +6 -0
  315. package/src/styles/tokens.css +5 -0
  316. package/src/styles/transcript.css +138 -0
  317. package/src/styles/workspace.css +6 -0
  318. package/dist/dist/index-QcFzZlao.d.ts +0 -1
  319. package/dist/dist/sandbox-D0zsW8I1.d.ts +0 -2
  320. /package/dist/dist/{types-_Dtoq_No.d.ts → execution-failure-SREfl-EZ.d.ts} +0 -0
@@ -1,43 +1,38 @@
1
1
  /**
2
- * A transcript row that mounts its content on approach.
2
+ * The wrappers of transcript rows, and what the active searches hold mounted.
3
3
  *
4
- * `content-visibility: auto` already skips layout and paint for offscreen
5
- * rows, but React still RENDERS every one: parsing its markdown, building
6
- * its DOM. Without this, a page of history prepending (a couple hundred
7
- * rows at once) would be one long frame, and the DOM of a long session
8
- * would grow with rows the user never looked at. Until a row comes within `MARGIN` of the viewport it is
9
- * an empty box at its estimated height; once mounted it stays mounted
10
- * (expanded state, selection and the browser's remembered size survive).
4
+ * A root row renders through `LazyRow`: a placeholder at the row's height
5
+ * until it nears the view, then its content, for good (`row-mount.ts`: the
6
+ * mounter of its transcript decides, and parks far rows only past a budget
7
+ * while the reader is idle). What the reader did to a row lives in
8
+ * `useRowUiState`, so a parked row comes back as it was left.
11
9
  *
12
- * The tail of the transcript mounts eagerly so opening a session paints
13
- * real rows on the first frame, and ⌘F search mounts everything while a
14
- * needle is active (it walks the DOM's text, `useTranscriptSearch`).
15
- * Height corrections when a row mounts above the view are absorbed by the
16
- * scroller's anchoring (`useStickToBottom`), like a row's first paint.
17
- *
18
- * Two distances. Rows entering the far margin queue up, and each frame
19
- * mounts the nearest until `BUDGET_MS` is spent: a flick that brings twenty
20
- * rows into the margin spreads them over a few frames. Rows within a
21
- * viewport of the view mount at once, whatever the budget: a row must never
22
- * reach the screen as a blank placeholder, nor change height in view (the
23
- * view would reflow under the reader). Rows mounted from the queue tell
24
- * their content (`useBackgroundMount`) so long text may reveal over a few
25
- * frames; rows mounted near the view render whole.
10
+ * Rows mounted ahead of the view (`useBackgroundMount`) may reveal long
11
+ * text over a few frames; rows mounted near the view render whole. A row
12
+ * that mounts because the reader scrolled to it, or with the conversation, is
13
+ * quiet: no enter animation. Only a row new at the end of the transcript (its
14
+ * tail) plays it.
26
15
  */
27
16
  import { CSSProperties, ReactNode } from "react";
17
+ /** What the active searches want mounted: every row, or the rows holding any of these needles (lowercased). */
18
+ export interface ForcedRows {
19
+ /** Every row (a hold with no needles). */
20
+ all: boolean;
21
+ /** The needles of the holds that named some. */
22
+ needles: readonly string[];
23
+ }
28
24
  /**
29
- * Mount a lazy row's content now, wherever it is: a view putting its place
30
- * back (`useStickToBottom`'s `restorePosition`) lands on rows it never
31
- * came near. A row already mounted, or not a lazy row, is left alone. Call
32
- * 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.
33
28
  *
34
- * @param row - The row's element, the wrapper `LazyRow` renders.
29
+ * @param needles - What the search looks for, lowercased; absent, every row.
35
30
  */
36
- export declare function mountRowNow(row: Element): void;
37
- /** Every lazy row mounts while held (and stays mounted after release). Returns the release. */
38
- export declare function holdForceMountRows(): () => void;
39
- /** Returns whether every lazy row must be mounted now, for example while a search needle is active. */
31
+ export declare function holdForceMountRows(needles?: readonly string[]): () => void;
32
+ /** Returns whether a search holds rows mounted now (rows then render whole: no reveal over frames, groups open). */
40
33
  export declare function useForceMountRows(): boolean;
34
+ /** What the active searches hold mounted ({@link holdForceMountRows}); a new object on every change. */
35
+ export declare function useForcedRows(): ForcedRows;
41
36
  /**
42
37
  * True while the transcript is first painting a conversation (switching to
43
38
  * it, or its history landing). Rows mounted then were already there: they
@@ -69,26 +64,31 @@ export declare function CvRow({ style, children, className, ...rest }: CvRowProp
69
64
  export declare function useBackgroundMount(): boolean;
70
65
  /** Props for {@link LazyRow}. */
71
66
  export interface LazyRowProps {
72
- /** Mounts the content at once instead of waiting for the row to approach. Used for the tail of the transcript. */
73
- 'eager': boolean;
74
- /** Height in pixels of the placeholder box before the content mounts. */
67
+ /** The root item's key: the row's id, or a worker block's. */
68
+ 'itemKey': string;
69
+ /** The placeholder's height before the row was ever measured (px). */
75
70
  'estimatePx': number;
76
71
  /** Inline style for the row's wrapper, usually its content-visibility sizing. */
77
- 'style': CSSProperties;
72
+ 'style'?: CSSProperties;
78
73
  /** The row's content. */
79
74
  'children': ReactNode;
75
+ /** A plain box (a worker's block): no content-visibility, no row id on the wrapper. */
76
+ 'box'?: boolean;
77
+ /** The row's id (`Row.id`): how a view that left the transcript finds its place again (`useStickToBottom`'s `restorePosition`). */
78
+ 'data-row'?: string;
80
79
  /** The select-turn stop the row belongs to. Set only in select mode; makes the row a hover and click target. */
81
80
  'data-stop'?: string;
82
81
  /** Marks the row as part of the selected stop, so the select cursor can find it. */
83
82
  'data-sel'?: string;
84
- /** The row's id (`Row.id`): how a view that left the transcript finds its place again (`useStickToBottom`'s `restorePosition`). */
85
- 'data-row'?: string;
83
+ /** A user's prompt: what an app's scrollback fill and the media gallery count (mounted or not). */
84
+ 'data-prompt'?: string;
86
85
  /** Extra classes on the root element. */
87
86
  'className'?: string;
88
87
  }
89
88
  /**
90
- * 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.
89
+ * Renders a root transcript row that mounts its content when it nears the view, and keeps it: until then (and
90
+ * parked) an empty box of the row's height, its last measured height when known.
91
91
  *
92
- * @param props - Row props: `eager`, `estimatePx`, `style`, `children`, the select-mode data attributes and the row's id.
92
+ * @param props - Row props: `itemKey`, `estimatePx`, `style`, `children`, the row's id and the select-mode data attributes.
93
93
  */
94
- export declare function LazyRow({ eager, estimatePx, style, children, className, ...rest }: LazyRowProps): import("react").JSX.Element;
94
+ export declare function LazyRow({ itemKey, estimatePx, style, children, className, box, ...rest }: LazyRowProps): import("react").JSX.Element;
@@ -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,75 @@ 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.
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 = box ? mounted ? void 0 : { height: px } : {
136
+ ...style,
137
+ containIntrinsicSize: `auto ${Math.round(known ?? estimatePx)}px`,
138
+ ...mounted ? null : { height: px }
139
+ };
140
+ const rowKey = rest["data-row"];
191
141
  return /* @__PURE__ */ jsx("div", {
192
142
  ref,
193
- className: ["zg-cv-row", className].filter(Boolean).join(" "),
194
- style: mounted ? style : {
195
- ...style,
196
- height: estimatePx
197
- },
143
+ className: box ? className : ["zg-cv-row", className].filter(Boolean).join(" "),
144
+ style: wrapperStyle,
145
+ "data-item": itemKey,
198
146
  "data-lazy": mounted ? void 0 : "",
199
- "data-quiet": quiet ? "" : void 0,
147
+ "data-parked": state.phase === "parked" ? "" : void 0,
148
+ "data-quiet": state.quiet ? "" : void 0,
200
149
  ...rest,
201
- children: mounted ? /* @__PURE__ */ jsx(BackgroundMount.Provider, {
202
- value: background,
203
- children
150
+ children: mounted ? /* @__PURE__ */ jsx(RowKeyContext.Provider, {
151
+ value: rowKey,
152
+ children: /* @__PURE__ */ jsx(BackgroundMount.Provider, {
153
+ value: state.background,
154
+ children
155
+ })
204
156
  }) : null
205
157
  });
206
158
  }
207
- export { CvRow, LazyRow, TranscriptSettling, holdForceMountRows, mountRowNow, useBackgroundMount, useForceMountRows };
159
+ 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,6 +5,16 @@ export interface SelectCursorProps {
5
5
  selected: string | null;
6
6
  /** Any value that changes when rows reflow, such as the stops. A change re-measures the highlight. */
7
7
  layout: unknown;
8
+ /**
9
+ * The span to tint by its first and last root rows (`data-row`), instead of the rows marked `data-sel`: the
10
+ * prompt rail's hovered exchange.
11
+ */
12
+ span?: {
13
+ first: string;
14
+ last: string;
15
+ } | null;
16
+ /** Scrolls the selection into view after each move. Off for a tint that only shows where something is. */
17
+ follow?: boolean;
8
18
  /** Extra classes on the root element. */
9
19
  className?: string;
10
20
  /** Inline styles on the root element, merged after the component's own. */
@@ -15,4 +25,4 @@ export interface SelectCursorProps {
15
25
  *
16
26
  * @param props - Cursor props: the `selected` stop and a `layout` token.
17
27
  */
18
- export declare function SelectCursor({ selected, layout, className, style }: SelectCursorProps): import("react").JSX.Element;
28
+ export declare function SelectCursor({ selected, layout, span, follow, className, style }: SelectCursorProps): import("react").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { useReducedMotion } from "../../motion/reduced.js";
2
+ import { dataRowSelector } from "../headless/transcript/rail.js";
2
3
  import { useEffect, useLayoutEffect, useRef, useState } from "react";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  // src/chat/transcript/SelectCursor.tsx
@@ -10,7 +11,7 @@ const SELECT_BLEED_TOP_PX = 8;
10
11
  *
11
12
  * @param props - Cursor props: the `selected` stop and a `layout` token.
12
13
  */
13
- function SelectCursor({ selected, layout, className, style }) {
14
+ function SelectCursor({ selected, layout, span = null, follow = true, className, style }) {
14
15
  const ref = useRef(null);
15
16
  const reduced = useReducedMotion();
16
17
  const [box, setBox] = useState(null);
@@ -24,8 +25,10 @@ function SelectCursor({ selected, layout, className, style }) {
24
25
  followed.current = null;
25
26
  return;
26
27
  }
28
+ const rowSel = (id) => `:scope > ${dataRowSelector(id)}`;
29
+ const pick = () => span ? [span.first, span.last].flatMap((id) => timeline.querySelector(rowSel(id)) ?? []) : [...timeline.querySelectorAll("[data-sel]")];
27
30
  const measure = () => {
28
- const marked = timeline.querySelectorAll("[data-sel]");
31
+ const marked = pick();
29
32
  if (marked.length === 0) return null;
30
33
  const base = timeline.getBoundingClientRect().top;
31
34
  let top = Number.POSITIVE_INFINITY;
@@ -43,7 +46,7 @@ function SelectCursor({ selected, layout, className, style }) {
43
46
  const next = measure();
44
47
  setBox(next);
45
48
  const scroller = timeline.closest(".overflow-y-auto");
46
- if (next && scroller && followed.current !== selected) {
49
+ if (follow && next && scroller && followed.current !== selected) {
47
50
  followed.current = selected;
48
51
  const view = scroller.getBoundingClientRect();
49
52
  const top = timeline.getBoundingClientRect().top + next.top;
@@ -65,12 +68,14 @@ function SelectCursor({ selected, layout, className, style }) {
65
68
  const box = measure();
66
69
  setBox((prev) => prev && box && prev.top === box.top && prev.height === box.height ? prev : box);
67
70
  });
68
- for (const node of timeline.querySelectorAll("[data-sel]")) ro.observe(node);
71
+ for (const node of pick()) ro.observe(node);
69
72
  return () => ro.disconnect();
70
73
  }, [
71
74
  selected,
72
75
  layout,
73
- reduced
76
+ reduced,
77
+ span,
78
+ follow
74
79
  ]);
75
80
  useEffect(() => {
76
81
  if (box === null || sliding) return void 0;
@@ -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]);
@@ -0,0 +1,109 @@
1
+ /**
2
+ * The prompt rail: one tick per prompt the user typed, left of the
3
+ * transcript's column (`.zg-transcript-column`, `--zg-transcript-gutter`):
4
+ * centred in the space between the pane's edge and the text, and once that
5
+ * space is wide, held near the pane's edge (`RAIL_EDGE_INSET_PX`), clear of
6
+ * the conversation.
7
+ * The tick of the exchange in view is raised as the transcript scrolls (or
8
+ * the one holding select-turn mode's cursor). Hovering a tick tints that
9
+ * exchange's rows and opens a card with the prompt and the start of its
10
+ * answer; moving along the rail moves the card, with no new delay, and Esc
11
+ * closes it. A click, or the previous / next message keys, glides the prompt
12
+ * to the top; next past the last prompt glides to the end of its answer.
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
+ *
23
+ * The rail floats over that space: showing, hiding or growing it never moves
24
+ * the layout. It hides with fewer than two prompts, where the space has no
25
+ * room for it, and on touch screens.
26
+ *
27
+ * <TranscriptRailProvider>
28
+ * <div className="relative">
29
+ * <section ref={scroller} className="overflow-y-auto">
30
+ * <div className="zg-transcript-column"><Transcript … /></div>
31
+ * </section>
32
+ * <TranscriptRail scroller={scroller} keys />
33
+ * </div>
34
+ * </TranscriptRailProvider>
35
+ *
36
+ * The transcript under the provider publishes its exchanges to it; one
37
+ * provider holds one transcript.
38
+ */
39
+ import { Transcript } from "../headless/host.js";
40
+ import { Cluster, Row } from "../headless/transcript/rows.js";
41
+ import { TranscriptRailStore } from "../headless/transcript/rail.js";
42
+ import "../headless/transcript/index.js";
43
+ import { TranscriptRowsSlice } from "../headless/transcript/incremental.js";
44
+ import { CSSProperties, ReactNode, RefObject } from "react";
45
+ import { RunReceipt } from "zidane/chat/pure";
46
+ /** Props for {@link TranscriptRailProvider}. */
47
+ export interface TranscriptRailProviderProps {
48
+ /** The transcript and its rail. */
49
+ children: ReactNode;
50
+ }
51
+ /**
52
+ * Holds the rail's store for the transcript and the rail below it.
53
+ *
54
+ * @param props - The {@link TranscriptRailProviderProps}.
55
+ */
56
+ export declare function TranscriptRailProvider({ children }: TranscriptRailProviderProps): import("react").JSX.Element;
57
+ /** The rail store of the nearest {@link TranscriptRailProvider}, or `null` outside one. */
58
+ export declare function useTranscriptRailStore(): TranscriptRailStore | null;
59
+ /**
60
+ * The transcript's side of the rail: publishes its exchanges and the cursor's exchange to the provider's store.
61
+ * Outside a provider it computes nothing.
62
+ *
63
+ * @param clusters - The root clusters the transcript paints, or their settled and open parts (the settled ones fold once).
64
+ * @param isHidden - Whether a row paints nothing.
65
+ * @param receipts - The receipts docked on reply rows.
66
+ * @param selectedTurn - Select-turn mode's selected stop (a turn id), or `null`.
67
+ */
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;
81
+ /** Props for {@link RailTint}. */
82
+ interface RailTintProps {
83
+ store: TranscriptRailStore;
84
+ }
85
+ /**
86
+ * The hovered exchange's tint, behind the transcript's rows (the select cursor's element, without following).
87
+ *
88
+ * @param props - The rail's store.
89
+ */
90
+ export declare const RailTint: import("react").MemoExoticComponent<({ store }: RailTintProps) => import("react").JSX.Element>;
91
+ /** Props for {@link TranscriptRail}. */
92
+ export interface TranscriptRailProps {
93
+ /** The transcript's scroll area. The rail sits left of its `.zg-transcript-column`, in the rail's offset parent. */
94
+ scroller: RefObject<HTMLElement | null>;
95
+ /** Binds the previous / next prompt keys (`previousPrompt`, `nextPrompt`) to this rail: the conversation on show. */
96
+ keys?: boolean;
97
+ /** Extra classes on the rail's root element. */
98
+ className?: string;
99
+ /** Inline styles on the root element, merged after the component's own. */
100
+ style?: CSSProperties;
101
+ }
102
+ /**
103
+ * Renders the prompt rail left of a transcript's column: a tick per prompt, the one in view raised, a card on hover,
104
+ * a jump on click.
105
+ *
106
+ * @param props - The {@link TranscriptRailProps}.
107
+ */
108
+ export declare function TranscriptRail({ scroller, keys, className, style }: TranscriptRailProps): import("react").JSX.Element;
109
+ export {};